@followupus/common 0.9.11 → 0.9.13
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 +2 -0
- package/dist/shared/shared.js +38 -8
- package/dist/shared/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/shared/shared.d.ts
CHANGED
package/dist/shared/shared.js
CHANGED
|
@@ -19,6 +19,8 @@ export const COLUMN_TYPES = {
|
|
|
19
19
|
PHONE: "phone",
|
|
20
20
|
CURRENCY: "currency",
|
|
21
21
|
TIME_TRACKING: "time_tracking",
|
|
22
|
+
CREATED_BY: "created_by",
|
|
23
|
+
CREATED_AT: "created_at",
|
|
22
24
|
};
|
|
23
25
|
export const OP_TYPES = {
|
|
24
26
|
CONTAINS: "like",
|
|
@@ -51,6 +53,12 @@ export const COLUMN_OP_TYPES = {
|
|
|
51
53
|
OP_TYPES.BEFORE,
|
|
52
54
|
OP_TYPES.AFTER,
|
|
53
55
|
],
|
|
56
|
+
[COLUMN_TYPES.CREATED_AT]: [
|
|
57
|
+
OP_TYPES.IS,
|
|
58
|
+
OP_TYPES.IS_NOT,
|
|
59
|
+
OP_TYPES.BEFORE,
|
|
60
|
+
OP_TYPES.AFTER,
|
|
61
|
+
],
|
|
54
62
|
[COLUMN_TYPES.NUMBER]: [
|
|
55
63
|
OP_TYPES.EQUAL,
|
|
56
64
|
OP_TYPES.NOT_EQUAL,
|
|
@@ -91,6 +99,12 @@ export const COLUMN_OP_TYPES = {
|
|
|
91
99
|
OP_TYPES.EMPTY,
|
|
92
100
|
OP_TYPES.NOT_EMPTY,
|
|
93
101
|
],
|
|
102
|
+
[COLUMN_TYPES.CREATED_BY]: [
|
|
103
|
+
OP_TYPES.IS,
|
|
104
|
+
OP_TYPES.IS_NOT,
|
|
105
|
+
OP_TYPES.EMPTY,
|
|
106
|
+
OP_TYPES.NOT_EMPTY,
|
|
107
|
+
],
|
|
94
108
|
};
|
|
95
109
|
export const AUTOMATION_OP_TYPES = {
|
|
96
110
|
...COLUMN_OP_TYPES,
|
|
@@ -105,6 +119,16 @@ export const AUTOMATION_OP_TYPES = {
|
|
|
105
119
|
OP_TYPES.EMPTY,
|
|
106
120
|
OP_TYPES.NOT_EMPTY,
|
|
107
121
|
],
|
|
122
|
+
[COLUMN_TYPES.CREATED_AT]: [
|
|
123
|
+
OP_TYPES.EQUAL,
|
|
124
|
+
OP_TYPES.NOT_EQUAL,
|
|
125
|
+
OP_TYPES.GREATER,
|
|
126
|
+
OP_TYPES.GREATER_EQUAL,
|
|
127
|
+
OP_TYPES.LESS,
|
|
128
|
+
OP_TYPES.LESS_EQUAL,
|
|
129
|
+
OP_TYPES.EMPTY,
|
|
130
|
+
OP_TYPES.NOT_EMPTY,
|
|
131
|
+
],
|
|
108
132
|
};
|
|
109
133
|
export const DYNAMIC_VIEW_OP_TYPES = {
|
|
110
134
|
...COLUMN_OP_TYPES,
|
|
@@ -147,6 +171,7 @@ export const getColumnTypeFromId = (columnId) => {
|
|
|
147
171
|
export const getColumnValueType = (columnType) => {
|
|
148
172
|
switch (columnType) {
|
|
149
173
|
case COLUMN_TYPES.PEOPLE:
|
|
174
|
+
case COLUMN_TYPES.CREATED_BY:
|
|
150
175
|
case COLUMN_TYPES.FILES:
|
|
151
176
|
case COLUMN_TYPES.TAGS:
|
|
152
177
|
return "stringArray";
|
|
@@ -241,15 +266,16 @@ export const getValidConditions = (filter, headers, currentUserId, escapeHeaderC
|
|
|
241
266
|
if (!checkHeader && !escapeHeaderCheck)
|
|
242
267
|
return;
|
|
243
268
|
if (checkHeader?.type === COLUMN_TYPES.PEOPLE ||
|
|
244
|
-
|
|
269
|
+
checkHeader?.type === COLUMN_TYPES.CREATED_BY) {
|
|
245
270
|
if (c.value?.find(val => val === THEMSELVES) && currentUserId) {
|
|
246
271
|
const idx = c.value.findIndex(val => val === THEMSELVES);
|
|
247
272
|
if (idx > -1)
|
|
248
273
|
c.value.splice(idx, 1, currentUserId);
|
|
249
274
|
}
|
|
250
275
|
}
|
|
251
|
-
if (checkHeader?.type === COLUMN_TYPES.DATE
|
|
252
|
-
|
|
276
|
+
if (checkHeader?.type === COLUMN_TYPES.DATE ||
|
|
277
|
+
checkHeader?.type === COLUMN_TYPES.CREATED_AT) {
|
|
278
|
+
_.remove(c.value, v => Object.values(SpecialKeyInDateFilter).includes(v));
|
|
253
279
|
}
|
|
254
280
|
});
|
|
255
281
|
// 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
|
|
@@ -275,7 +301,8 @@ export const getValidConditions = (filter, headers, currentUserId, escapeHeaderC
|
|
|
275
301
|
COLUMN_TYPES.PRIORITY,
|
|
276
302
|
COLUMN_TYPES.TAGS,
|
|
277
303
|
].includes(columnType);
|
|
278
|
-
const isDate = columnType === COLUMN_TYPES.DATE
|
|
304
|
+
const isDate = columnType === COLUMN_TYPES.DATE ||
|
|
305
|
+
columnType === COLUMN_TYPES.CREATED_AT;
|
|
279
306
|
switch (c.op) {
|
|
280
307
|
case OP_TYPES.IS:
|
|
281
308
|
case OP_TYPES.IS_NOT:
|
|
@@ -328,8 +355,9 @@ const isInConditionValues = (itemVal, valueType, condition) => {
|
|
|
328
355
|
return false;
|
|
329
356
|
};
|
|
330
357
|
const isDateInConditionValues = (itemVal, condition) => {
|
|
331
|
-
if (
|
|
332
|
-
return
|
|
358
|
+
if (!itemVal || !dayjs(itemVal).isValid()) {
|
|
359
|
+
return !!condition.blank;
|
|
360
|
+
}
|
|
333
361
|
const itemDate = dayjs(itemVal);
|
|
334
362
|
return !!condition.value?.some(c => {
|
|
335
363
|
if (c && typeof c === "object") {
|
|
@@ -483,11 +511,13 @@ const checkItemMatched = (item, validConditions, headers) => {
|
|
|
483
511
|
if (isLinkedColumn) {
|
|
484
512
|
checkHeader = header?.linked;
|
|
485
513
|
}
|
|
486
|
-
const isPeople = checkHeader?.type === COLUMN_TYPES.PEOPLE
|
|
514
|
+
const isPeople = checkHeader?.type === COLUMN_TYPES.PEOPLE ||
|
|
515
|
+
checkHeader?.type === COLUMN_TYPES.CREATED_BY;
|
|
487
516
|
const valueType = getColumnValueType(checkHeader?.type ?? "");
|
|
488
517
|
const checkConditionFn = (itemVal) => {
|
|
489
518
|
let match = false;
|
|
490
|
-
const isDate = checkHeader?.type === COLUMN_TYPES.DATE
|
|
519
|
+
const isDate = checkHeader?.type === COLUMN_TYPES.DATE ||
|
|
520
|
+
checkHeader?.type === COLUMN_TYPES.CREATED_AT;
|
|
491
521
|
switch (condition.op) {
|
|
492
522
|
case OP_TYPES.IS:
|
|
493
523
|
match = isDate
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -32,9 +32,14 @@ export interface IBaseItem {
|
|
|
32
32
|
subs?: IBaseItem[];
|
|
33
33
|
index?: number;
|
|
34
34
|
deleted?: boolean;
|
|
35
|
+
expand?: boolean;
|
|
36
|
+
createdBy?: string[];
|
|
37
|
+
createdAt?: string;
|
|
35
38
|
}
|
|
36
39
|
export interface IColumnSetting {
|
|
37
40
|
currency?: string;
|
|
41
|
+
multiple?: boolean;
|
|
42
|
+
notify?: boolean;
|
|
38
43
|
}
|
|
39
44
|
export interface IDropdownOption {
|
|
40
45
|
key: string;
|