@cellaware/utils 8.6.13 → 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 +59 -39
- 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;
|
|
@@ -780,9 +796,9 @@ function sortRows(data, sortModel) {
|
|
|
780
796
|
return 0;
|
|
781
797
|
});
|
|
782
798
|
}
|
|
783
|
-
function processHtmlStyles(value, columnFormat, rowStyles, columnStyles) {
|
|
799
|
+
function processHtmlStyles(value, columnName, columnFormat, rowStyles, columnStyles) {
|
|
784
800
|
let columnStyle = {
|
|
785
|
-
columnName
|
|
801
|
+
columnName,
|
|
786
802
|
styles: []
|
|
787
803
|
};
|
|
788
804
|
// Reminder: Value Formatting is performed **before** Conditional Formatting.
|
|
@@ -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,6 +879,7 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
861
879
|
return {};
|
|
862
880
|
}
|
|
863
881
|
};
|
|
882
|
+
console.log('COUNT: ' + htmlColumnStyles.length);
|
|
864
883
|
for (const htmlColumnStyle of htmlColumnStyles) {
|
|
865
884
|
teamsColumnStyles.push({
|
|
866
885
|
columnName: htmlColumnStyle.columnName,
|
|
@@ -886,39 +905,41 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
886
905
|
};
|
|
887
906
|
for (const htmlRowStyle of htmlRowStyles) {
|
|
888
907
|
switch (htmlRowStyle) {
|
|
889
|
-
case
|
|
908
|
+
case ConditionalFormatStyle.GREEN_BACKGROUND:
|
|
890
909
|
teamsRowStyles.push('good');
|
|
891
|
-
applyRowStyleToColumns(
|
|
910
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
892
911
|
break;
|
|
893
|
-
case
|
|
912
|
+
case ConditionalFormatStyle.YELLOW_BACKGROUND:
|
|
894
913
|
teamsRowStyles.push('warning');
|
|
895
|
-
applyRowStyleToColumns(
|
|
914
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
896
915
|
break;
|
|
897
|
-
case
|
|
916
|
+
case ConditionalFormatStyle.RED_BACKGROUND:
|
|
898
917
|
teamsRowStyles.push('attention');
|
|
899
|
-
applyRowStyleToColumns(
|
|
918
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
900
919
|
break;
|
|
901
|
-
case
|
|
920
|
+
case ConditionalFormatStyle.BLUE_BACKGROUND:
|
|
921
|
+
case ConditionalFormatStyle.PURPLE_BACKGROUND:
|
|
902
922
|
teamsRowStyles.push('accent');
|
|
903
|
-
applyRowStyleToColumns(
|
|
923
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
904
924
|
break;
|
|
905
|
-
case
|
|
906
|
-
applyRowStyleToColumns(
|
|
925
|
+
case ConditionalFormatStyle.BOLD:
|
|
926
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
907
927
|
break;
|
|
908
|
-
case
|
|
909
|
-
applyRowStyleToColumns(
|
|
928
|
+
case ConditionalFormatStyle.GREEN_BOLD:
|
|
929
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
910
930
|
break;
|
|
911
|
-
case
|
|
912
|
-
applyRowStyleToColumns(
|
|
931
|
+
case ConditionalFormatStyle.YELLOW_BOLD:
|
|
932
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
913
933
|
break;
|
|
914
|
-
case
|
|
915
|
-
applyRowStyleToColumns(
|
|
934
|
+
case ConditionalFormatStyle.RED_BOLD:
|
|
935
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
916
936
|
break;
|
|
917
|
-
case
|
|
918
|
-
|
|
937
|
+
case ConditionalFormatStyle.BLUE_BOLD:
|
|
938
|
+
case ConditionalFormatStyle.PURPLE_BOLD:
|
|
939
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
919
940
|
break;
|
|
920
|
-
case
|
|
921
|
-
applyRowStyleToColumns(
|
|
941
|
+
case ConditionalFormatStyle.NOT_IMPORTANT:
|
|
942
|
+
applyRowStyleToColumns(htmlRowStyle);
|
|
922
943
|
break;
|
|
923
944
|
default:
|
|
924
945
|
break;
|
|
@@ -1024,7 +1045,7 @@ function createTeamsTableRow(columnNames, values, rowStyles, columnStyles) {
|
|
|
1024
1045
|
style: rowStyle,
|
|
1025
1046
|
cells: values.map((value, idx) => {
|
|
1026
1047
|
const columnName = columnNames[idx];
|
|
1027
|
-
const columnStyle = columnStyles
|
|
1048
|
+
const columnStyle = columnStyles.find(cs => cs.columnName === columnName);
|
|
1028
1049
|
console.log('C.');
|
|
1029
1050
|
console.log(columnStyle);
|
|
1030
1051
|
let style = undefined;
|
|
@@ -1084,8 +1105,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1084
1105
|
row[columnFormat.displayName] = formattedValue;
|
|
1085
1106
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1086
1107
|
htmlRowValues.push(formattedValue);
|
|
1087
|
-
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1088
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1108
|
+
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1089
1109
|
if (rowIdx === 0) {
|
|
1090
1110
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1091
1111
|
}
|
|
@@ -1106,8 +1126,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1106
1126
|
row[adjDisplayName] = formattedValue;
|
|
1107
1127
|
chartRow[adjDisplayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1108
1128
|
htmlRowValues.push(formattedValue);
|
|
1109
|
-
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1110
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1129
|
+
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, adjDisplayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1111
1130
|
if (rowIdx === 0) {
|
|
1112
1131
|
htmlColumnNames.push(adjDisplayName);
|
|
1113
1132
|
}
|
|
@@ -1132,6 +1151,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1132
1151
|
if (rowIdx < HTML_ROWS) {
|
|
1133
1152
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
1134
1153
|
if (rowIdx < TEAMS_ROWS) {
|
|
1154
|
+
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1135
1155
|
teamsRows.push(createTeamsTableRow(htmlColumnNames, htmlRowValues, teamsRowStyles, teamsColumnStyles));
|
|
1136
1156
|
}
|
|
1137
1157
|
}
|
|
@@ -1165,8 +1185,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1165
1185
|
row[columnFormat.displayName] = formattedValue;
|
|
1166
1186
|
chartRow[columnFormat.displayName] = formatNumberEnabled(columnFormat.valueFormat) ? value : formattedValue;
|
|
1167
1187
|
htmlRowValues.push(formattedValue);
|
|
1168
|
-
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1169
|
-
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1188
|
+
[htmlRowStyles, htmlColumnStyles] = processHtmlStyles(formattedValue, columnFormat.displayName, columnFormat, htmlRowStyles, htmlColumnStyles);
|
|
1170
1189
|
if (rowIdx === 0) {
|
|
1171
1190
|
htmlColumnNames.push(columnFormat.displayName);
|
|
1172
1191
|
}
|
|
@@ -1179,6 +1198,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
1179
1198
|
if (rowIdx < HTML_ROWS) {
|
|
1180
1199
|
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
1181
1200
|
if (rowIdx < TEAMS_ROWS) {
|
|
1201
|
+
[teamsRowStyles, teamsColumnStyles] = mapTeamsStyles(htmlColumnNames, htmlRowStyles, htmlColumnStyles, teamsRowStyles, teamsColumnStyles);
|
|
1182
1202
|
teamsRows.push(createTeamsTableRow(htmlColumnNames, htmlRowValues, teamsRowStyles, teamsColumnStyles));
|
|
1183
1203
|
}
|
|
1184
1204
|
}
|