@cellaware/utils 8.2.1 → 8.2.3
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 +1 -2
- package/dist/chatwms/datagrid.js +39 -38
- package/package.json +1 -1
|
@@ -115,8 +115,7 @@ export interface DatagridCondition {
|
|
|
115
115
|
value2?: string;
|
|
116
116
|
}
|
|
117
117
|
export declare function initDatagridCondition(): DatagridCondition;
|
|
118
|
-
export declare function summarizeCondition(condition: DatagridCondition, localeMessageFn: (language: string, messageId: string) => Promise<string
|
|
119
|
-
export declare function summarizeConditionAsMarkdown(condition: DatagridCondition, localeMessageFn: (language: string, messageId: string) => Promise<string>): Promise<string>;
|
|
118
|
+
export declare function summarizeCondition(condition: DatagridCondition, localeMessageFn: (language: string, messageId: string) => Promise<string>, markdown?: boolean): Promise<string>;
|
|
120
119
|
export declare function codifyCondition(condition: DatagridCondition): string;
|
|
121
120
|
/**
|
|
122
121
|
* Equivalent of `parseNumeric` in front end
|
package/dist/chatwms/datagrid.js
CHANGED
|
@@ -265,47 +265,48 @@ export function initDatagridCondition() {
|
|
|
265
265
|
value: ''
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
export async function summarizeCondition(condition, localeMessageFn) {
|
|
268
|
+
export async function summarizeCondition(condition, localeMessageFn, markdown) {
|
|
269
269
|
let ruleStr = '';
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
270
|
+
if (!!markdown) {
|
|
271
|
+
switch (condition.rule) {
|
|
272
|
+
case ConditionalFormatRule.BETWEEN:
|
|
273
|
+
ruleStr = `**${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)}** ${condition.value} **${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, 'conditional-format-rule-and')}** ${condition.value2}`;
|
|
274
|
+
break;
|
|
275
|
+
case ConditionalFormatRule.BLANK:
|
|
276
|
+
case ConditionalFormatRule.NOT_BLANK:
|
|
277
|
+
ruleStr = `**${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)}**`;
|
|
278
|
+
break;
|
|
279
|
+
default:
|
|
280
|
+
if (condition.dataType === 'text') {
|
|
281
|
+
ruleStr = `**${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)}** '${condition.value}'`;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
ruleStr = `**${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)}** ${condition.value}`;
|
|
285
|
+
}
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
return `\`${condition.columnName}\` ${ruleStr}`;
|
|
286
289
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
break;
|
|
290
|
+
else {
|
|
291
|
+
switch (condition.rule) {
|
|
292
|
+
case ConditionalFormatRule.BETWEEN:
|
|
293
|
+
ruleStr = `${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)} ${condition.value} ${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, 'conditional-format-rule-and')} ${condition.value2}`;
|
|
294
|
+
break;
|
|
295
|
+
case ConditionalFormatRule.BLANK:
|
|
296
|
+
case ConditionalFormatRule.NOT_BLANK:
|
|
297
|
+
ruleStr = `${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)}`;
|
|
298
|
+
break;
|
|
299
|
+
default:
|
|
300
|
+
if (condition.dataType === 'text') {
|
|
301
|
+
ruleStr = `${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)} '${condition.value}'`;
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
ruleStr = `${await localeMessageFn(CHATWMS_DEFAULT_LANGUAGE, condition.rule)} ${condition.value}`;
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
return `${condition.columnName} ${ruleStr}`;
|
|
307
309
|
}
|
|
308
|
-
return `\`${condition.columnName}\` ${ruleStr}`;
|
|
309
310
|
}
|
|
310
311
|
export function codifyCondition(condition) {
|
|
311
312
|
// NOTE: since we check for action/unsafe SQL with every query, we do not need to check for SQL injection here.
|