@followupus/common 0.10.25 → 0.10.27
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/shared/shared.d.ts +6 -3
- package/dist/shared/shared.js +37 -0
- package/package.json +1 -1
package/dist/shared/shared.d.ts
CHANGED
|
@@ -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: {
|
|
@@ -103,6 +105,7 @@ export declare const getColumnValueType: (columnType: string) => "string" | "num
|
|
|
103
105
|
export declare const getFilterDateGroupKeys: (dateStr: string) => string[] | null;
|
|
104
106
|
export declare const getDateGroupKey: (dateStr: string) => string | null;
|
|
105
107
|
export declare const extractDomain: (url?: string) => string | undefined;
|
|
108
|
+
export declare const hasDynamicCondition: (filter: IFilter, headers?: IBaseCustomColumn[]) => boolean;
|
|
106
109
|
export declare const getValidConditions: (filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string, escapeHeaderCheck?: boolean) => IFilterCondition[];
|
|
107
110
|
export declare const isDateMatchConditionValue: (dateVal: string, conditionValue: string | {
|
|
108
111
|
start: string;
|
package/dist/shared/shared.js
CHANGED
|
@@ -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,
|
|
@@ -362,6 +373,23 @@ export const extractDomain = (url) => {
|
|
|
362
373
|
//
|
|
363
374
|
// return domainParts.join(".");
|
|
364
375
|
// };
|
|
376
|
+
export const hasDynamicCondition = (filter, headers) => {
|
|
377
|
+
if (!filter?.criteria?.length || !headers?.length) {
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
return filter.criteria?.some(c => {
|
|
381
|
+
const validHeader = headers.find(h => h.columnId === c.columnId);
|
|
382
|
+
let checkHeader = validHeader;
|
|
383
|
+
if (isLinkedColumns(validHeader?.type)) {
|
|
384
|
+
checkHeader = validHeader?.linked;
|
|
385
|
+
}
|
|
386
|
+
if (checkHeader?.type === COLUMN_TYPES.PEOPLE ||
|
|
387
|
+
checkHeader?.type === COLUMN_TYPES.CREATED_BY) {
|
|
388
|
+
return c.value?.find(val => val === THEMSELVES);
|
|
389
|
+
}
|
|
390
|
+
return false;
|
|
391
|
+
});
|
|
392
|
+
};
|
|
365
393
|
export const getValidConditions = (filter, headers, currentUserId, escapeHeaderCheck) => {
|
|
366
394
|
const newFilter = _.cloneDeep(filter);
|
|
367
395
|
if (!newFilter?.criteria?.length || !headers?.length) {
|
|
@@ -438,6 +466,9 @@ export const getValidConditions = (filter, headers, currentUserId, escapeHeaderC
|
|
|
438
466
|
case OP_TYPES.AFTER:
|
|
439
467
|
return (isDate &&
|
|
440
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;
|
|
441
472
|
default:
|
|
442
473
|
return false;
|
|
443
474
|
}
|
|
@@ -713,6 +744,12 @@ const checkItemMatched = (item, validConditions, headers, matchAny) => {
|
|
|
713
744
|
match =
|
|
714
745
|
typeof itemVal === "number" ? isLess(itemVal, condition) : false;
|
|
715
746
|
break;
|
|
747
|
+
case OP_TYPES.CHECKED:
|
|
748
|
+
match = !!itemVal;
|
|
749
|
+
break;
|
|
750
|
+
case OP_TYPES.NOT_CHECKED:
|
|
751
|
+
match = !itemVal;
|
|
752
|
+
break;
|
|
716
753
|
default:
|
|
717
754
|
break;
|
|
718
755
|
}
|