@cellaware/utils 8.6.14 → 8.6.15
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 +52 -33
- 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
|
|
@@ -887,39 +905,41 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
887
905
|
};
|
|
888
906
|
for (const htmlRowStyle of htmlRowStyles) {
|
|
889
907
|
switch (htmlRowStyle) {
|
|
890
|
-
case
|
|
908
|
+
case ConditionalFormatStyle.GREEN_BACKGROUND:
|
|
891
909
|
teamsRowStyles.push('good');
|
|
892
|
-
applyRowStyleToColumns(
|
|
910
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
893
911
|
break;
|
|
894
|
-
case
|
|
912
|
+
case ConditionalFormatStyle.YELLOW_BACKGROUND:
|
|
895
913
|
teamsRowStyles.push('warning');
|
|
896
|
-
applyRowStyleToColumns(
|
|
914
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
897
915
|
break;
|
|
898
|
-
case
|
|
916
|
+
case ConditionalFormatStyle.RED_BACKGROUND:
|
|
899
917
|
teamsRowStyles.push('attention');
|
|
900
|
-
applyRowStyleToColumns(
|
|
918
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
901
919
|
break;
|
|
902
|
-
case
|
|
920
|
+
case ConditionalFormatStyle.BLUE_BACKGROUND:
|
|
921
|
+
case ConditionalFormatStyle.PURPLE_BACKGROUND:
|
|
903
922
|
teamsRowStyles.push('accent');
|
|
904
|
-
applyRowStyleToColumns(
|
|
923
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
905
924
|
break;
|
|
906
|
-
case
|
|
907
|
-
applyRowStyleToColumns(
|
|
925
|
+
case ConditionalFormatStyle.BOLD:
|
|
926
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
908
927
|
break;
|
|
909
|
-
case
|
|
910
|
-
applyRowStyleToColumns(
|
|
928
|
+
case ConditionalFormatStyle.GREEN_BOLD:
|
|
929
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
911
930
|
break;
|
|
912
|
-
case
|
|
913
|
-
applyRowStyleToColumns(
|
|
931
|
+
case ConditionalFormatStyle.YELLOW_BOLD:
|
|
932
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
914
933
|
break;
|
|
915
|
-
case
|
|
916
|
-
applyRowStyleToColumns(
|
|
934
|
+
case ConditionalFormatStyle.RED_BOLD:
|
|
935
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
917
936
|
break;
|
|
918
|
-
case
|
|
919
|
-
|
|
937
|
+
case ConditionalFormatStyle.BLUE_BOLD:
|
|
938
|
+
case ConditionalFormatStyle.PURPLE_BOLD:
|
|
939
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
920
940
|
break;
|
|
921
|
-
case
|
|
922
|
-
applyRowStyleToColumns(
|
|
941
|
+
case ConditionalFormatStyle.NOT_IMPORTANT:
|
|
942
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
923
943
|
break;
|
|
924
944
|
default:
|
|
925
945
|
break;
|
|
@@ -1086,7 +1106,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1086
1106
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1087
1107
|
htmlRowValues.push(formattedValue);
|
|
1088
1108
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1089
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1090
1109
|
if (rowIdx === 0) {
|
|
1091
1110
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1092
1111
|
}
|
|
@@ -1108,7 +1127,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1108
1127
|
chartRow[adjDisplayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1109
1128
|
htmlRowValues.push(formattedValue);
|
|
1110
1129
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, adjDisplayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1111
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1112
1130
|
if (rowIdx === 0) {
|
|
1113
1131
|
htmlColumnNames.push(adjDisplayName);
|
|
1114
1132
|
}
|
|
@@ -1133,6 +1151,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1133
1151
|
if (rowIdx < HTML_ROWS) {
|
|
1134
1152
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
1135
1153
|
if (rowIdx < TEAMS_ROWS) {
|
|
1154
|
+
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1136
1155
|
teamsRows.push(createTeamsTableRow(htmlColumnNames, htmlRowValues, teamsRowStyles, teamsColumnStyles));
|
|
1137
1156
|
}
|
|
1138
1157
|
}
|
|
@@ -1167,7 +1186,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1167
1186
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1168
1187
|
htmlRowValues.push(formattedValue);
|
|
1169
1188
|
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1170
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1171
1189
|
if (rowIdx === 0) {
|
|
1172
1190
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1173
1191
|
}
|
|
@@ -1180,6 +1198,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1180
1198
|
if (rowIdx < HTML_ROWS) {
|
|
1181
1199
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
1182
1200
|
if (rowIdx < TEAMS_ROWS) {
|
|
1201
|
+
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1183
1202
|
teamsRows.push(createTeamsTableRow(htmlColumnNames, htmlRowValues, teamsRowStyles, teamsColumnStyles));
|
|
1184
1203
|
}
|
|
1185
1204
|
}
|