@cellaware/utils 8.6.14 → 8.6.16
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.
- package/dist/chatwms/datagrid.d.ts +15 -0
- package/dist/chatwms/datagrid.js +55 -40
- package/dist/chatwms/teams.js +12 -5
- package/package.json +1 -1
|
@@ -102,6 +102,21 @@ export declare const CONDITIONAL_FORMAT_RULES: string[];
|
|
|
102
102
|
export declare const CONDITIONAL_FORMAT_RULES_TEXT: string[];
|
|
103
103
|
export declare const CONDITIONAL_FORMAT_RULES_NUMBER: string[];
|
|
104
104
|
export declare const CONDITIONAL_FORMAT_RULES_BOOLEAN: string[];
|
|
105
|
+
export declare enum ConditionalFormatStyle {
|
|
106
|
+
NONE = "conditional-format-style-none",
|
|
107
|
+
GREEN_BACKGROUND = "conditional-format-style-green-background",
|
|
108
|
+
YELLOW_BACKGROUND = "conditional-format-style-yellow-background",
|
|
109
|
+
RED_BACKGROUND = "conditional-format-style-red-background",
|
|
110
|
+
BLUE_BACKGROUND = "conditional-format-style-blue-background",
|
|
111
|
+
PURPLE_BACKGROUND = "conditional-format-style-purple-background",
|
|
112
|
+
BOLD = "conditional-format-style-bold",
|
|
113
|
+
GREEN_BOLD = "conditional-format-style-green-bold",
|
|
114
|
+
YELLOW_BOLD = "conditional-format-style-yellow-bold",
|
|
115
|
+
RED_BOLD = "conditional-format-style-red-bold",
|
|
116
|
+
BLUE_BOLD = "conditional-format-style-blue-bold",
|
|
117
|
+
PURPLE_BOLD = "conditional-format-style-purple-bold",
|
|
118
|
+
NOT_IMPORTANT = "conditional-format-style-not-important"
|
|
119
|
+
}
|
|
105
120
|
export interface ConditionalFormat {
|
|
106
121
|
sequence: number;
|
|
107
122
|
rule: string;
|
package/dist/chatwms/datagrid.js
CHANGED
|
@@ -237,6 +237,22 @@ export const CONDITIONAL_FORMAT_RULES_BOOLEAN = [
|
|
|
237
237
|
ConditionalFormatRule.BLANK,
|
|
238
238
|
ConditionalFormatRule.NOT_BLANK
|
|
239
239
|
];
|
|
240
|
+
export var ConditionalFormatStyle;
|
|
241
|
+
(function (ConditionalFormatStyle) {
|
|
242
|
+
ConditionalFormatStyle["NONE"] = "conditional-format-style-none";
|
|
243
|
+
ConditionalFormatStyle["GREEN_BACKGROUND"] = "conditional-format-style-green-background";
|
|
244
|
+
ConditionalFormatStyle["YELLOW_BACKGROUND"] = "conditional-format-style-yellow-background";
|
|
245
|
+
ConditionalFormatStyle["RED_BACKGROUND"] = "conditional-format-style-red-background";
|
|
246
|
+
ConditionalFormatStyle["BLUE_BACKGROUND"] = "conditional-format-style-blue-background";
|
|
247
|
+
ConditionalFormatStyle["PURPLE_BACKGROUND"] = "conditional-format-style-purple-background";
|
|
248
|
+
ConditionalFormatStyle["BOLD"] = "conditional-format-style-bold";
|
|
249
|
+
ConditionalFormatStyle["GREEN_BOLD"] = "conditional-format-style-green-bold";
|
|
250
|
+
ConditionalFormatStyle["YELLOW_BOLD"] = "conditional-format-style-yellow-bold";
|
|
251
|
+
ConditionalFormatStyle["RED_BOLD"] = "conditional-format-style-red-bold";
|
|
252
|
+
ConditionalFormatStyle["BLUE_BOLD"] = "conditional-format-style-blue-bold";
|
|
253
|
+
ConditionalFormatStyle["PURPLE_BOLD"] = "conditional-format-style-purple-bold";
|
|
254
|
+
ConditionalFormatStyle["NOT_IMPORTANT"] = "conditional-format-style-not-important";
|
|
255
|
+
})(ConditionalFormatStyle || (ConditionalFormatStyle = {}));
|
|
240
256
|
export function evaluateConditionalFormat(condFmt, dataType, value) {
|
|
241
257
|
const isBlank = (v) => v === null || v === undefined || (dataType !== 'number' && dataType !== 'boolean' && v === '');
|
|
242
258
|
const v1 = condFmt.value;
|
|
@@ -808,51 +824,53 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
808
824
|
// We can simply iterate over all the matched styles and accumulate them.
|
|
809
825
|
const getColumnStyle = (style) => {
|
|
810
826
|
switch (style) {
|
|
811
|
-
case
|
|
827
|
+
case ConditionalFormatStyle.GREEN_BACKGROUND:
|
|
812
828
|
return {
|
|
813
829
|
color: 'Good',
|
|
814
830
|
style: 'good'
|
|
815
831
|
};
|
|
816
|
-
case
|
|
832
|
+
case ConditionalFormatStyle.YELLOW_BACKGROUND:
|
|
817
833
|
return {
|
|
818
834
|
color: 'Warning',
|
|
819
835
|
style: 'warning'
|
|
820
836
|
};
|
|
821
|
-
case
|
|
837
|
+
case ConditionalFormatStyle.RED_BACKGROUND:
|
|
822
838
|
return {
|
|
823
839
|
color: 'Attention',
|
|
824
840
|
style: 'attention'
|
|
825
841
|
};
|
|
826
|
-
case
|
|
842
|
+
case ConditionalFormatStyle.BLUE_BACKGROUND:
|
|
843
|
+
case ConditionalFormatStyle.PURPLE_BACKGROUND:
|
|
827
844
|
return {
|
|
828
845
|
color: 'Accent',
|
|
829
846
|
style: 'accent'
|
|
830
847
|
};
|
|
831
|
-
case
|
|
848
|
+
case ConditionalFormatStyle.BOLD:
|
|
832
849
|
return {
|
|
833
850
|
weight: 'Bolder'
|
|
834
851
|
};
|
|
835
|
-
case
|
|
852
|
+
case ConditionalFormatStyle.GREEN_BOLD:
|
|
836
853
|
return {
|
|
837
854
|
color: 'Good',
|
|
838
855
|
weight: 'Bolder'
|
|
839
856
|
};
|
|
840
|
-
case
|
|
857
|
+
case ConditionalFormatStyle.YELLOW_BOLD:
|
|
841
858
|
return {
|
|
842
859
|
color: 'Warning',
|
|
843
860
|
weight: 'Bolder'
|
|
844
861
|
};
|
|
845
|
-
case
|
|
862
|
+
case ConditionalFormatStyle.RED_BOLD:
|
|
846
863
|
return {
|
|
847
864
|
color: 'Attention',
|
|
848
865
|
weight: 'Bolder'
|
|
849
866
|
};
|
|
850
|
-
case
|
|
867
|
+
case ConditionalFormatStyle.BLUE_BOLD:
|
|
868
|
+
case ConditionalFormatStyle.PURPLE_BOLD:
|
|
851
869
|
return {
|
|
852
870
|
color: 'Accent',
|
|
853
871
|
weight: 'Bolder'
|
|
854
872
|
};
|
|
855
|
-
case
|
|
873
|
+
case ConditionalFormatStyle.NOT_IMPORTANT:
|
|
856
874
|
return {
|
|
857
875
|
isSubtle: true,
|
|
858
876
|
italic: true
|
|
@@ -861,15 +879,12 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
861
879
|
return {};
|
|
862
880
|
}
|
|
863
881
|
};
|
|
864
|
-
console.log('COUNT: ' + htmlColumnStyles.length);
|
|
865
882
|
for (const htmlColumnStyle of htmlColumnStyles) {
|
|
866
883
|
teamsColumnStyles.push({
|
|
867
884
|
columnName: htmlColumnStyle.columnName,
|
|
868
885
|
styles: htmlColumnStyle.styles.map(style => getColumnStyle(style))
|
|
869
886
|
});
|
|
870
887
|
}
|
|
871
|
-
console.log('A.');
|
|
872
|
-
console.log(JSON.stringify(teamsColumnStyles));
|
|
873
888
|
const applyRowStyleToColumns = (style) => {
|
|
874
889
|
for (const columnName of columnNames) {
|
|
875
890
|
const columnStyle = getColumnStyle(style);
|
|
@@ -887,39 +902,41 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
887
902
|
};
|
|
888
903
|
for (const htmlRowStyle of htmlRowStyles) {
|
|
889
904
|
switch (htmlRowStyle) {
|
|
890
|
-
case
|
|
905
|
+
case ConditionalFormatStyle.GREEN_BACKGROUND:
|
|
891
906
|
teamsRowStyles.push('good');
|
|
892
|
-
applyRowStyleToColumns(
|
|
907
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
893
908
|
break;
|
|
894
|
-
case
|
|
909
|
+
case ConditionalFormatStyle.YELLOW_BACKGROUND:
|
|
895
910
|
teamsRowStyles.push('warning');
|
|
896
|
-
applyRowStyleToColumns(
|
|
911
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
897
912
|
break;
|
|
898
|
-
case
|
|
913
|
+
case ConditionalFormatStyle.RED_BACKGROUND:
|
|
899
914
|
teamsRowStyles.push('attention');
|
|
900
|
-
applyRowStyleToColumns(
|
|
915
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
901
916
|
break;
|
|
902
|
-
case
|
|
917
|
+
case ConditionalFormatStyle.BLUE_BACKGROUND:
|
|
918
|
+
case ConditionalFormatStyle.PURPLE_BACKGROUND:
|
|
903
919
|
teamsRowStyles.push('accent');
|
|
904
|
-
applyRowStyleToColumns(
|
|
920
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
905
921
|
break;
|
|
906
|
-
case
|
|
907
|
-
applyRowStyleToColumns(
|
|
922
|
+
case ConditionalFormatStyle.BOLD:
|
|
923
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
908
924
|
break;
|
|
909
|
-
case
|
|
910
|
-
applyRowStyleToColumns(
|
|
925
|
+
case ConditionalFormatStyle.GREEN_BOLD:
|
|
926
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
911
927
|
break;
|
|
912
|
-
case
|
|
913
|
-
applyRowStyleToColumns(
|
|
928
|
+
case ConditionalFormatStyle.YELLOW_BOLD:
|
|
929
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
914
930
|
break;
|
|
915
|
-
case
|
|
916
|
-
applyRowStyleToColumns(
|
|
931
|
+
case ConditionalFormatStyle.RED_BOLD:
|
|
932
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
917
933
|
break;
|
|
918
|
-
case
|
|
919
|
-
|
|
934
|
+
case ConditionalFormatStyle.BLUE_BOLD:
|
|
935
|
+
case ConditionalFormatStyle.PURPLE_BOLD:
|
|
936
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
920
937
|
break;
|
|
921
|
-
case
|
|
922
|
-
applyRowStyleToColumns(
|
|
938
|
+
case ConditionalFormatStyle.NOT_IMPORTANT:
|
|
939
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
923
940
|
break;
|
|
924
941
|
default:
|
|
925
942
|
break;
|
|
@@ -1000,6 +1017,9 @@ function createTeamsTableCellText(value, columnStyle) {
|
|
|
1000
1017
|
if (!!styles.isSubtle) {
|
|
1001
1018
|
isSubtle = styles.isSubtle;
|
|
1002
1019
|
}
|
|
1020
|
+
if (!!styles.italic) {
|
|
1021
|
+
italic = styles.italic;
|
|
1022
|
+
}
|
|
1003
1023
|
}
|
|
1004
1024
|
return {
|
|
1005
1025
|
type: "TextBlock",
|
|
@@ -1018,16 +1038,12 @@ function createTeamsTableRow(columnNames, values, rowStyles, columnStyles) {
|
|
|
1018
1038
|
for (const style of rowStyles) {
|
|
1019
1039
|
rowStyle = style;
|
|
1020
1040
|
}
|
|
1021
|
-
console.log('B.');
|
|
1022
|
-
console.log(JSON.stringify(columnStyles));
|
|
1023
1041
|
return {
|
|
1024
1042
|
type: "TableRow",
|
|
1025
1043
|
style: rowStyle,
|
|
1026
1044
|
cells: values.map((value, idx) => {
|
|
1027
1045
|
const columnName = columnNames[idx];
|
|
1028
1046
|
const columnStyle = columnStyles.find(cs => cs.columnName === columnName);
|
|
1029
|
-
console.log('C.');
|
|
1030
|
-
console.log(columnStyle);
|
|
1031
1047
|
let style = undefined;
|
|
1032
1048
|
for (const styles of columnStyle?.styles ?? []) {
|
|
1033
1049
|
if (!!styles.style) {
|
|
@@ -1086,7 +1102,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1086
1102
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1087
1103
|
htmlRowValues.push(formattedValue);
|
|
1088
1104
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1089
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1090
1105
|
if (rowIdx === 0) {
|
|
1091
1106
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1092
1107
|
}
|
|
@@ -1108,7 +1123,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1108
1123
|
chartRow[adjDisplayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1109
1124
|
htmlRowValues.push(formattedValue);
|
|
1110
1125
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, adjDisplayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1111
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1112
1126
|
if (rowIdx === 0) {
|
|
1113
1127
|
htmlColumnNames.push(adjDisplayName);
|
|
1114
1128
|
}
|
|
@@ -1133,6 +1147,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1133
1147
|
if (rowIdx < HTML_ROWS) {
|
|
1134
1148
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
1135
1149
|
if (rowIdx < TEAMS_ROWS) {
|
|
1150
|
+
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1136
1151
|
teamsRows.push(createTeamsTableRow(htmlColumnNames, htmlRowValues, teamsRowStyles, teamsColumnStyles));
|
|
1137
1152
|
}
|
|
1138
1153
|
}
|
|
@@ -1167,7 +1182,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1167
1182
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1168
1183
|
htmlRowValues.push(formattedValue);
|
|
1169
1184
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1170
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1171
1185
|
if (rowIdx === 0) {
|
|
1172
1186
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1173
1187
|
}
|
|
@@ -1180,6 +1194,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1180
1194
|
if (rowIdx < HTML_ROWS) {
|
|
1181
1195
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
1182
1196
|
if (rowIdx < TEAMS_ROWS) {
|
|
1197
|
+
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1183
1198
|
teamsRows.push(createTeamsTableRow(htmlColumnNames, htmlRowValues, teamsRowStyles, teamsColumnStyles));
|
|
1184
1199
|
}
|
|
1185
1200
|
}
|
package/dist/chatwms/teams.js
CHANGED
|
@@ -35,14 +35,18 @@ export function createTeamsTableCard(title, table, summary) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
export function createTeamsValueCard(title, columnName, value, styles, summary) {
|
|
38
|
-
let
|
|
39
|
-
let
|
|
40
|
-
[
|
|
38
|
+
let rowStyles = [];
|
|
39
|
+
let columnStyles = [];
|
|
40
|
+
[rowStyles, columnStyles] = mapTeamsStyles([columnName], styles, [], rowStyles, columnStyles);
|
|
41
|
+
console.log(styles);
|
|
42
|
+
console.log('--==--==--==--==--==--==--==--==--');
|
|
43
|
+
console.log(columnStyles);
|
|
41
44
|
let color = undefined;
|
|
42
45
|
let style = undefined;
|
|
43
46
|
let weight = undefined;
|
|
44
47
|
let isSubtle = undefined;
|
|
45
|
-
|
|
48
|
+
let italic = undefined;
|
|
49
|
+
for (const styles of columnStyles) {
|
|
46
50
|
if (!!styles.color) {
|
|
47
51
|
color = styles.color;
|
|
48
52
|
}
|
|
@@ -55,6 +59,9 @@ export function createTeamsValueCard(title, columnName, value, styles, summary)
|
|
|
55
59
|
if (!!styles.isSubtle) {
|
|
56
60
|
isSubtle = styles.isSubtle;
|
|
57
61
|
}
|
|
62
|
+
if (!!styles.italic) {
|
|
63
|
+
italic = styles.italic;
|
|
64
|
+
}
|
|
58
65
|
}
|
|
59
66
|
return {
|
|
60
67
|
type: "AdaptiveCard",
|
|
@@ -68,7 +75,7 @@ export function createTeamsValueCard(title, columnName, value, styles, summary)
|
|
|
68
75
|
items: [
|
|
69
76
|
{
|
|
70
77
|
type: "TextBlock",
|
|
71
|
-
text: value,
|
|
78
|
+
text: italic ? `*${value}*` : value,
|
|
72
79
|
wrap: true,
|
|
73
80
|
size: "ExtraLarge",
|
|
74
81
|
color,
|