@followupus/common 0.10.26 → 0.10.28

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.
@@ -62,15 +62,17 @@ export declare const OP_TYPES: {
62
62
  LESS: string;
63
63
  BEFORE: string;
64
64
  AFTER: string;
65
+ CHECKED: string;
66
+ NOT_CHECKED: string;
65
67
  };
66
68
  export declare const COLUMN_OP_TYPES: {
67
- readonly [x: string]: readonly [string, string, string, string, string, string] | readonly [string, string, string, string] | readonly [string, string, string, string, string, string, string, string];
69
+ readonly [x: string]: readonly [string, string, string, string, string, string] | readonly [string, string, string, string] | readonly [string, string, string, string, string, string, string, string] | readonly [string, string];
68
70
  };
69
71
  export declare const AUTOMATION_OP_TYPES: {
70
- [x: string]: string[] | readonly [string, string, string, string, string, string] | readonly [string, string, string, string] | readonly [string, string, string, string, string, string, string, string];
72
+ [x: string]: string[] | readonly [string, string, string, string, string, string] | readonly [string, string, string, string] | readonly [string, string, string, string, string, string, string, string] | readonly [string, string];
71
73
  };
72
74
  export declare const DYNAMIC_VIEW_OP_TYPES: {
73
- [x: string]: string[] | readonly [string, string, string, string, string, string] | readonly [string, string, string, string] | readonly [string, string, string, string, string, string, string, string];
75
+ [x: string]: string[] | readonly [string, string, string, string, string, string] | readonly [string, string, string, string] | readonly [string, string, string, string, string, string, string, string] | readonly [string, string];
74
76
  };
75
77
  export declare const THEMSELVES = "self";
76
78
  export declare const DATE_GROUPS: {
@@ -68,6 +68,8 @@ export const OP_TYPES = {
68
68
  LESS: "lt",
69
69
  BEFORE: "before",
70
70
  AFTER: "after",
71
+ CHECKED: "checked",
72
+ NOT_CHECKED: "not_checked",
71
73
  };
72
74
  export const COLUMN_OP_TYPES = {
73
75
  [COLUMN_TYPES.TEXT]: [
@@ -127,6 +129,14 @@ export const COLUMN_OP_TYPES = {
127
129
  OP_TYPES.GREATER_EQUAL,
128
130
  OP_TYPES.LESS,
129
131
  OP_TYPES.LESS_EQUAL,
132
+ ],
133
+ [COLUMN_TYPES.PERCENTAGE]: [
134
+ OP_TYPES.EQUAL,
135
+ OP_TYPES.NOT_EQUAL,
136
+ OP_TYPES.GREATER,
137
+ OP_TYPES.GREATER_EQUAL,
138
+ OP_TYPES.LESS,
139
+ OP_TYPES.LESS_EQUAL,
130
140
  OP_TYPES.EMPTY,
131
141
  OP_TYPES.NOT_EMPTY,
132
142
  ],
@@ -186,6 +196,7 @@ export const COLUMN_OP_TYPES = {
186
196
  OP_TYPES.EMPTY,
187
197
  OP_TYPES.NOT_EMPTY,
188
198
  ],
199
+ [COLUMN_TYPES.CHECKBOX]: [OP_TYPES.CHECKED, OP_TYPES.NOT_CHECKED],
189
200
  };
190
201
  export const AUTOMATION_OP_TYPES = {
191
202
  ...COLUMN_OP_TYPES,
@@ -402,7 +413,7 @@ export const getValidConditions = (filter, headers, currentUserId, escapeHeaderC
402
413
  }
403
414
  if (checkHeader?.type === COLUMN_TYPES.DATE ||
404
415
  checkHeader?.type === COLUMN_TYPES.CREATED_AT) {
405
- _.remove(c.value, v => Object.values(SpecialKeyInDateFilter).includes(v));
416
+ _.remove(c.value ?? [], v => Object.values(SpecialKeyInDateFilter).includes(v));
406
417
  }
407
418
  });
408
419
  // for dropdown, if set the option is in filter condition, and user delete the option. should ignore it or make the option can't be deleted
@@ -455,6 +466,9 @@ export const getValidConditions = (filter, headers, currentUserId, escapeHeaderC
455
466
  case OP_TYPES.AFTER:
456
467
  return (isDate &&
457
468
  !!c.value?.filter(v => v === FILTER_DATE_GROUPS.TODAY || dayjs(v).isValid())?.length);
469
+ case OP_TYPES.CHECKED:
470
+ case OP_TYPES.NOT_CHECKED:
471
+ return true;
458
472
  default:
459
473
  return false;
460
474
  }
@@ -465,16 +479,16 @@ const isInConditionValues = (itemVal, valueType, condition) => {
465
479
  case "number":
466
480
  case "string":
467
481
  return ((condition.blank && !itemVal) ||
468
- !!condition.value.find(val => val === itemVal));
482
+ !!condition.value?.find(val => val === itemVal));
469
483
  case "stringArray":
470
484
  return ((condition.blank && !itemVal?.length) ||
471
- condition.value.some(val => Array.isArray(itemVal) && itemVal?.includes(val)));
485
+ !!condition.value?.some(val => Array.isArray(itemVal) && itemVal?.includes(val)));
472
486
  case "object":
473
487
  return ((condition.blank && !itemVal) ||
474
- !!condition.value.find(val => _.isEqual(val, itemVal)));
488
+ !!condition.value?.find(val => _.isEqual(val, itemVal)));
475
489
  case "objectArray":
476
490
  return ((condition.blank && !itemVal?.length) ||
477
- condition.value.some(val => Array.isArray(itemVal) &&
491
+ !!condition.value?.some(val => Array.isArray(itemVal) &&
478
492
  itemVal.find(existVal => _.isEqual(val, existVal))));
479
493
  default:
480
494
  break;
@@ -730,6 +744,12 @@ const checkItemMatched = (item, validConditions, headers, matchAny) => {
730
744
  match =
731
745
  typeof itemVal === "number" ? isLess(itemVal, condition) : false;
732
746
  break;
747
+ case OP_TYPES.CHECKED:
748
+ match = !!itemVal;
749
+ break;
750
+ case OP_TYPES.NOT_CHECKED:
751
+ match = !itemVal;
752
+ break;
733
753
  default:
734
754
  break;
735
755
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followupus/common",
3
- "version": "0.10.26",
3
+ "version": "0.10.28",
4
4
  "description": "followup common utils npm package with TypeScript and VSCode",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",