@cellaware/utils 8.11.1 → 8.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -167,6 +167,7 @@ export interface TeamsColumnStyle {
|
|
|
167
167
|
styles: TeamsColumnStyleAttributes[];
|
|
168
168
|
}
|
|
169
169
|
export declare function mapTeamsStyles(columnNames: string[], htmlRowStyles: string[], htmlColumnStyles: HtmlColumnStyle[], teamsRowStyles: string[], teamsColumnStyles: TeamsColumnStyle[]): [string[], TeamsColumnStyle[]];
|
|
170
|
+
export declare function mapTeamsTransposeStyles(htmlColumnStyle: HtmlColumnStyle): TeamsColumnStyle;
|
|
170
171
|
export declare function createTeamsTableColumns(columnNames: string[]): {
|
|
171
172
|
type: string;
|
|
172
173
|
cells: {
|
|
@@ -195,6 +196,13 @@ export declare function createTeamsTableRow(columnNames: string[], values: any[]
|
|
|
195
196
|
}[];
|
|
196
197
|
}[];
|
|
197
198
|
};
|
|
199
|
+
export declare function createTeamsTransposeTableRow(row: {
|
|
200
|
+
key: string;
|
|
201
|
+
value: any;
|
|
202
|
+
}, columnStyle: TeamsColumnStyle): {
|
|
203
|
+
type: string;
|
|
204
|
+
cells: any[];
|
|
205
|
+
};
|
|
198
206
|
/**
|
|
199
207
|
* **Important:** `html` and `teamsRows` output will be limited to **1,000 rows/24 rows** and **8 columns**, respectively.
|
|
200
208
|
*
|
package/dist/chatwms/datagrid.js
CHANGED
|
@@ -977,6 +977,71 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
977
977
|
}
|
|
978
978
|
return [teamsRowStyles, teamsColumnStyles];
|
|
979
979
|
}
|
|
980
|
+
export function mapTeamsTransposeStyles(htmlColumnStyle) {
|
|
981
|
+
// Generally the same logic as ^^^, just handling a few things differently for transpose.
|
|
982
|
+
const getColumnStyle = (style) => {
|
|
983
|
+
switch (style) {
|
|
984
|
+
case ConditionalFormatStyle.GREEN_BACKGROUND:
|
|
985
|
+
return {
|
|
986
|
+
color: 'Good',
|
|
987
|
+
style: 'good'
|
|
988
|
+
};
|
|
989
|
+
case ConditionalFormatStyle.YELLOW_BACKGROUND:
|
|
990
|
+
return {
|
|
991
|
+
color: 'Warning',
|
|
992
|
+
style: 'warning'
|
|
993
|
+
};
|
|
994
|
+
case ConditionalFormatStyle.RED_BACKGROUND:
|
|
995
|
+
return {
|
|
996
|
+
color: 'Attention',
|
|
997
|
+
style: 'attention'
|
|
998
|
+
};
|
|
999
|
+
case ConditionalFormatStyle.BLUE_BACKGROUND:
|
|
1000
|
+
case ConditionalFormatStyle.PURPLE_BACKGROUND:
|
|
1001
|
+
return {
|
|
1002
|
+
color: 'Accent',
|
|
1003
|
+
style: 'accent'
|
|
1004
|
+
};
|
|
1005
|
+
case ConditionalFormatStyle.BOLD:
|
|
1006
|
+
return {
|
|
1007
|
+
weight: 'Bolder'
|
|
1008
|
+
};
|
|
1009
|
+
case ConditionalFormatStyle.GREEN_BOLD:
|
|
1010
|
+
return {
|
|
1011
|
+
color: 'Good',
|
|
1012
|
+
weight: 'Bolder'
|
|
1013
|
+
};
|
|
1014
|
+
case ConditionalFormatStyle.YELLOW_BOLD:
|
|
1015
|
+
return {
|
|
1016
|
+
color: 'Warning',
|
|
1017
|
+
weight: 'Bolder'
|
|
1018
|
+
};
|
|
1019
|
+
case ConditionalFormatStyle.RED_BOLD:
|
|
1020
|
+
return {
|
|
1021
|
+
color: 'Attention',
|
|
1022
|
+
weight: 'Bolder'
|
|
1023
|
+
};
|
|
1024
|
+
case ConditionalFormatStyle.BLUE_BOLD:
|
|
1025
|
+
case ConditionalFormatStyle.PURPLE_BOLD:
|
|
1026
|
+
return {
|
|
1027
|
+
color: 'Accent',
|
|
1028
|
+
weight: 'Bolder'
|
|
1029
|
+
};
|
|
1030
|
+
case ConditionalFormatStyle.NOT_IMPORTANT:
|
|
1031
|
+
return {
|
|
1032
|
+
isSubtle: true,
|
|
1033
|
+
italic: true,
|
|
1034
|
+
weight: 'Lighter'
|
|
1035
|
+
};
|
|
1036
|
+
default:
|
|
1037
|
+
return {};
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
return {
|
|
1041
|
+
columnName: htmlColumnStyle.columnName,
|
|
1042
|
+
styles: htmlColumnStyle.styles.map(style => getColumnStyle(style))
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
980
1045
|
function buildHtmlTableHeader(columnNames) {
|
|
981
1046
|
let buf = '<table>\n\t<thead>\n\t\t<tr>';
|
|
982
1047
|
for (const columnName of columnNames) {
|
|
@@ -1021,13 +1086,13 @@ function buildHtmlRow(rowValues, rowStyles, columnStyles, columnCount) {
|
|
|
1021
1086
|
}
|
|
1022
1087
|
function buildHtmlTransposeRow(row, columnStyle) {
|
|
1023
1088
|
let buf = '';
|
|
1024
|
-
buf += `\n\t\t\t<td>${truncateValue(row.key, 24)}</td>`;
|
|
1089
|
+
buf += `\n\t\t\t<td style="font-size: 13px; font-weight: 600;">${truncateValue(row.key, 24)}</td>`;
|
|
1025
1090
|
const truncValue = truncateValue(row.value, 24);
|
|
1026
1091
|
if (columnStyle.styles.length > 0) {
|
|
1027
|
-
buf += `\n\t\t\t<td class="${columnStyle.styles.join(' ')}">${truncValue}</td>`;
|
|
1092
|
+
buf += `\n\t\t\t<td style="font-size: 16px;" class="${columnStyle.styles.join(' ')}">${truncValue}</td>`;
|
|
1028
1093
|
}
|
|
1029
1094
|
else {
|
|
1030
|
-
buf += `\n\t\t\t<td>${truncValue}</td>`;
|
|
1095
|
+
buf += `\n\t\t\t<td style="font-size: 16px;">${truncValue}</td>`;
|
|
1031
1096
|
}
|
|
1032
1097
|
buf += '\n\t\t</tr>';
|
|
1033
1098
|
return buf;
|
|
@@ -1103,6 +1168,23 @@ export function createTeamsTableRow(columnNames, values, rowStyles, columnStyles
|
|
|
1103
1168
|
})
|
|
1104
1169
|
};
|
|
1105
1170
|
}
|
|
1171
|
+
export function createTeamsTransposeTableRow(row, columnStyle) {
|
|
1172
|
+
const keyCell = {
|
|
1173
|
+
type: "TableCell",
|
|
1174
|
+
items: [createTeamsTableCellText(row.key, {
|
|
1175
|
+
columnName: 'key',
|
|
1176
|
+
styles: [{ weight: 'Bolder' }]
|
|
1177
|
+
})]
|
|
1178
|
+
};
|
|
1179
|
+
const valueCell = {
|
|
1180
|
+
type: "TableCell",
|
|
1181
|
+
items: [createTeamsTableCellText(row.value, columnStyle)]
|
|
1182
|
+
};
|
|
1183
|
+
return {
|
|
1184
|
+
type: "TableRow",
|
|
1185
|
+
cells: [keyCell, valueCell]
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1106
1188
|
/**
|
|
1107
1189
|
* **Important:** `html` and `teamsRows` output will be limited to **1,000 rows/24 rows** and **8 columns**, respectively.
|
|
1108
1190
|
*
|
|
@@ -1205,7 +1287,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1205
1287
|
}));
|
|
1206
1288
|
for (let i = 0; i < transposedRows.length; i++) {
|
|
1207
1289
|
htmlTransposeBuf += buildHtmlTransposeRow(transposedRows[i], htmlTransposeColumnStyles[i]);
|
|
1208
|
-
|
|
1290
|
+
teamsRows.push(createTeamsTransposeTableRow(transposedRows[i], mapTeamsTransposeStyles(htmlTransposeColumnStyles[i])));
|
|
1209
1291
|
}
|
|
1210
1292
|
}
|
|
1211
1293
|
rowIdx++;
|
|
@@ -1264,7 +1346,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1264
1346
|
}));
|
|
1265
1347
|
for (let i = 0; i < transposedRows.length; i++) {
|
|
1266
1348
|
htmlTransposeBuf += buildHtmlTransposeRow(transposedRows[i], htmlTransposeColumnStyles[i]);
|
|
1267
|
-
|
|
1349
|
+
teamsRows.push(createTeamsTransposeTableRow(transposedRows[i], mapTeamsTransposeStyles(htmlTransposeColumnStyles[i])));
|
|
1268
1350
|
}
|
|
1269
1351
|
}
|
|
1270
1352
|
rowIdx++;
|