You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [Excel] Map existing snippets to ref docs
* Map CardLayoutSection to different snippet
* Map EntityPropertyType and EntityViewLayouts to shorter snippet
* Add explicit types as comments
function makeProductEntity(productID: number, productName: string, product?:
455
+
any) {
456
+
const entity: Excel.EntityCellValue = {
457
+
type: Excel.CellValueType.entity,
458
+
text: productName,
459
+
properties: { /* Excel.EntityPropertyType */
460
+
"Product ID": {
461
+
type: Excel.CellValueType.string,
462
+
basicValue: productID.toString() || ""
463
+
},
464
+
"Product Name": {
465
+
type: Excel.CellValueType.string,
466
+
basicValue: productName || ""
467
+
},
468
+
"Quantity Per Unit": {
469
+
type: Excel.CellValueType.string,
470
+
basicValue: product.quantityPerUnit || ""
471
+
},
472
+
// Add Unit Price as a formatted number.
473
+
"Unit Price": {
474
+
type: Excel.CellValueType.formattedNumber,
475
+
basicValue: product.unitPrice,
476
+
numberFormat: "$* #,##0.00"
477
+
}
478
+
},
479
+
layouts: { /* Excel.EntityViewLayouts */
480
+
card: { /* Excel.EntityCardLayout */
481
+
title: { property: "Product Name" },
482
+
sections: [ /* Excel.CardLayoutSection */
483
+
{
484
+
layout: "List",
485
+
properties: ["Product ID"]
486
+
},
487
+
{
488
+
layout: "List",
489
+
title: "Quantity and price",
490
+
collapsible: true,
491
+
collapsed: false,
492
+
properties: ["Quantity Per Unit", "Unit Price"]
493
+
}
494
+
]
495
+
}
496
+
},
497
+
provider: {
498
+
description: product.providerName, // Name of the data provider. Displays as a tooltip when hovering over the logo. Also displays as a fallback if the source address for the image is broken.
499
+
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
500
+
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
function makeProductEntity(productID: number, productName: string, product?:
4017
+
any) {
4018
+
const entity: Excel.EntityCellValue = {
4019
+
type: Excel.CellValueType.entity,
4020
+
text: productName,
4021
+
properties: { /* Excel.EntityPropertyType */
4022
+
"Product ID": {
4023
+
type: Excel.CellValueType.string,
4024
+
basicValue: productID.toString() || ""
4025
+
},
4026
+
"Product Name": {
4027
+
type: Excel.CellValueType.string,
4028
+
basicValue: productName || ""
4029
+
},
4030
+
"Quantity Per Unit": {
4031
+
type: Excel.CellValueType.string,
4032
+
basicValue: product.quantityPerUnit || ""
4033
+
},
4034
+
// Add Unit Price as a formatted number.
4035
+
"Unit Price": {
4036
+
type: Excel.CellValueType.formattedNumber,
4037
+
basicValue: product.unitPrice,
4038
+
numberFormat: "$* #,##0.00"
4039
+
}
4040
+
},
4041
+
layouts: { /* Excel.EntityViewLayouts */
4042
+
card: { /* Excel.EntityCardLayout */
4043
+
title: { property: "Product Name" },
4044
+
sections: [ /* Excel.CardLayoutSection */
4045
+
{
4046
+
layout: "List",
4047
+
properties: ["Product ID"]
4048
+
},
4049
+
{
4050
+
layout: "List",
4051
+
title: "Quantity and price",
4052
+
collapsible: true,
4053
+
collapsed: false,
4054
+
properties: ["Quantity Per Unit", "Unit Price"]
4055
+
}
4056
+
]
4057
+
}
4058
+
},
4059
+
provider: {
4060
+
description: product.providerName, // Name of the data provider. Displays as a tooltip when hovering over the logo. Also displays as a fallback if the source address for the image is broken.
4061
+
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
4062
+
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
function makeProductEntity(productID: number, productName: string, product?:
4104
+
any) {
4105
+
const entity: Excel.EntityCellValue = {
4106
+
type: Excel.CellValueType.entity,
4107
+
text: productName,
4108
+
properties: { /* Excel.EntityPropertyType */
4109
+
"Product ID": {
4110
+
type: Excel.CellValueType.string,
4111
+
basicValue: productID.toString() || ""
4112
+
},
4113
+
"Product Name": {
4114
+
type: Excel.CellValueType.string,
4115
+
basicValue: productName || ""
4116
+
},
4117
+
"Quantity Per Unit": {
4118
+
type: Excel.CellValueType.string,
4119
+
basicValue: product.quantityPerUnit || ""
4120
+
},
4121
+
// Add Unit Price as a formatted number.
4122
+
"Unit Price": {
4123
+
type: Excel.CellValueType.formattedNumber,
4124
+
basicValue: product.unitPrice,
4125
+
numberFormat: "$* #,##0.00"
4126
+
}
4127
+
},
4128
+
layouts: { /* Excel.EntityViewLayouts */
4129
+
card: { /* Excel.EntityCardLayout */
4130
+
title: { property: "Product Name" },
4131
+
sections: [ /* Excel.CardLayoutSection */
4132
+
{
4133
+
layout: "List",
4134
+
properties: ["Product ID"]
4135
+
},
4136
+
{
4137
+
layout: "List",
4138
+
title: "Quantity and price",
4139
+
collapsible: true,
4140
+
collapsed: false,
4141
+
properties: ["Quantity Per Unit", "Unit Price"]
4142
+
}
4143
+
]
4144
+
}
4145
+
},
4146
+
provider: {
4147
+
description: product.providerName, // Name of the data provider. Displays as a tooltip when hovering over the logo. Also displays as a fallback if the source address for the image is broken.
4148
+
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
4149
+
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
function makeProductEntity(productID: number, productName: string, product?:
4162
+
any) {
4163
+
const entity: Excel.EntityCellValue = {
4164
+
type: Excel.CellValueType.entity,
4165
+
text: productName,
4166
+
properties: { /* Excel.EntityPropertyType */
4167
+
"Product ID": {
4168
+
type: Excel.CellValueType.string,
4169
+
basicValue: productID.toString() || ""
4170
+
},
4171
+
"Product Name": {
4172
+
type: Excel.CellValueType.string,
4173
+
basicValue: productName || ""
4174
+
},
4175
+
"Quantity Per Unit": {
4176
+
type: Excel.CellValueType.string,
4177
+
basicValue: product.quantityPerUnit || ""
4178
+
},
4179
+
// Add Unit Price as a formatted number.
4180
+
"Unit Price": {
4181
+
type: Excel.CellValueType.formattedNumber,
4182
+
basicValue: product.unitPrice,
4183
+
numberFormat: "$* #,##0.00"
4184
+
}
4185
+
},
4186
+
layouts: { /* Excel.EntityViewLayouts */
4187
+
card: { /* Excel.EntityCardLayout */
4188
+
title: { property: "Product Name" },
4189
+
sections: [ /* Excel.CardLayoutSection */
4190
+
{
4191
+
layout: "List",
4192
+
properties: ["Product ID"]
4193
+
},
4194
+
{
4195
+
layout: "List",
4196
+
title: "Quantity and price",
4197
+
collapsible: true,
4198
+
collapsed: false,
4199
+
properties: ["Quantity Per Unit", "Unit Price"]
4200
+
}
4201
+
]
4202
+
}
4203
+
},
4204
+
provider: {
4205
+
description: product.providerName, // Name of the data provider. Displays as a tooltip when hovering over the logo. Also displays as a fallback if the source address for the image is broken.
4206
+
logoSourceAddress: product.sourceAddress, // Source URL of the logo to display.
4207
+
logoTargetAddress: product.targetAddress // Destination URL that the logo navigates to when clicked.
0 commit comments