@cellaware/utils 8.2.0 → 8.2.1

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.
@@ -116,6 +116,7 @@ export interface DatagridCondition {
116
116
  }
117
117
  export declare function initDatagridCondition(): DatagridCondition;
118
118
  export declare function summarizeCondition(condition: DatagridCondition, localeMessageFn: (language: string, messageId: string) => Promise<string>): Promise<string>;
119
+ export declare function summarizeConditionAsMarkdown(condition: DatagridCondition, localeMessageFn: (language: string, messageId: string) => Promise<string>): Promise<string>;
119
120
  export declare function codifyCondition(condition: DatagridCondition): string;
120
121
  /**
121
122
  * Equivalent of `parseNumeric` in front end
@@ -286,6 +286,27 @@ export async function summarizeCondition(condition, localeMessageFn) {
286
286
  }
287
287
  return `${condition.columnName} ${ruleStr}`;
288
288
  }
289
+ export async function summarizeConditionAsMarkdown(condition, localeMessageFn) {
290
+ let ruleStr = '';
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}`;
309
+ }
289
310
  export function codifyCondition(condition) {
290
311
  // NOTE: since we check for action/unsafe SQL with every query, we do not need to check for SQL injection here.
291
312
  if (condition.dataType === 'number') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.2.0",
3
+ "version": "8.2.1",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",