@followupus/common 0.10.32 → 0.10.33
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 +10 -1
- package/dist/shared/shared.js +42 -6
- package/dist/shared/types.d.ts +51 -10
- package/package.json +1 -1
package/dist/shared/shared.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBaseCustomColumn, IBaseGroup, IFilter, IFilterCondition, IPureBoard, IBaseItem } from "./types";
|
|
1
|
+
import type { IBaseCustomColumn, IBaseGroup, IFilter, IFilterCondition, IPureBoard, IBaseItem } from "./types";
|
|
2
2
|
export declare const COLUMN_TYPES: {
|
|
3
3
|
TEXT: string;
|
|
4
4
|
DROPDOWN: string;
|
|
@@ -17,12 +17,18 @@ export declare const COLUMN_TYPES: {
|
|
|
17
17
|
TIMELINE: string;
|
|
18
18
|
CURRENCY: string;
|
|
19
19
|
PERCENTAGE: string;
|
|
20
|
+
VOTE: string;
|
|
21
|
+
LONGTEXT: string;
|
|
22
|
+
FORMULA: string;
|
|
20
23
|
LINKED_COLUMN: string;
|
|
21
24
|
REF_LINED_COLUMN: string;
|
|
25
|
+
ROLLUP: string;
|
|
22
26
|
TIME_TRACKING: string;
|
|
23
27
|
AUTO_NUMBER: string;
|
|
24
28
|
CREATED_BY: string;
|
|
25
29
|
CREATED_AT: string;
|
|
30
|
+
DATETIME: string;
|
|
31
|
+
TEAM: string;
|
|
26
32
|
};
|
|
27
33
|
export declare const ACTION_TYPE: {
|
|
28
34
|
CREATE: string;
|
|
@@ -48,6 +54,8 @@ export declare const OBJECT_TYPE: {
|
|
|
48
54
|
ACTION: string;
|
|
49
55
|
};
|
|
50
56
|
export declare const NAME_COLUMN = "name";
|
|
57
|
+
export declare const GATE_COLUMN = "string_gate";
|
|
58
|
+
export declare const PROGRESS_COLUMN = "string_progress";
|
|
51
59
|
export declare const OP_TYPES: {
|
|
52
60
|
CONTAINS: string;
|
|
53
61
|
NOT_CONTAINS: string;
|
|
@@ -113,6 +121,7 @@ export declare const isDateMatchConditionValue: (dateVal: string, conditionValue
|
|
|
113
121
|
end: string;
|
|
114
122
|
}) => boolean;
|
|
115
123
|
export declare const isDateInConditionValues: (itemVal: any, condition: IFilterCondition) => boolean;
|
|
124
|
+
export declare const isEqValInConditionValues: (itemVal: any, condition: IFilterCondition, checkHeader?: IBaseCustomColumn) => boolean;
|
|
116
125
|
export declare const filterItemsByConditions: (groups: IBaseGroup[], filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string) => IBaseGroup[];
|
|
117
126
|
export declare const isItemMatchedByConditions: (item: IBaseItem, filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string) => boolean;
|
|
118
127
|
export declare const filterBoardTree: (board: IPureBoard, filter: IFilter, currentUserId?: string) => IPureBoard;
|
package/dist/shared/shared.js
CHANGED
|
@@ -20,14 +20,19 @@ export const COLUMN_TYPES = {
|
|
|
20
20
|
TIMELINE: "timeline",
|
|
21
21
|
CURRENCY: "currency",
|
|
22
22
|
PERCENTAGE: "percent",
|
|
23
|
+
VOTE: "vote",
|
|
24
|
+
LONGTEXT: "long_text",
|
|
25
|
+
FORMULA: "formula",
|
|
23
26
|
LINKED_COLUMN: "linked_column",
|
|
24
27
|
REF_LINED_COLUMN: "ref_linked_column",
|
|
28
|
+
ROLLUP: "rollup",
|
|
25
29
|
TIME_TRACKING: "time_tracking",
|
|
26
30
|
AUTO_NUMBER: "auto_number",
|
|
27
31
|
CREATED_BY: "created_by",
|
|
28
32
|
CREATED_AT: "created_at",
|
|
33
|
+
DATETIME: "datetime",
|
|
34
|
+
TEAM: "team",
|
|
29
35
|
};
|
|
30
|
-
// the key order is used for Add Column Menu order, keep it
|
|
31
36
|
//One-to-One Matching UI.
|
|
32
37
|
export const ACTION_TYPE = {
|
|
33
38
|
CREATE: "CREATE",
|
|
@@ -54,6 +59,8 @@ export const OBJECT_TYPE = {
|
|
|
54
59
|
ACTION: "action",
|
|
55
60
|
};
|
|
56
61
|
export const NAME_COLUMN = "name";
|
|
62
|
+
export const GATE_COLUMN = "string_gate";
|
|
63
|
+
export const PROGRESS_COLUMN = "string_progress";
|
|
57
64
|
export const OP_TYPES = {
|
|
58
65
|
CONTAINS: "like",
|
|
59
66
|
NOT_CONTAINS: "not_like",
|
|
@@ -266,11 +273,20 @@ export const isLinkedColumns = (columnType) => {
|
|
|
266
273
|
export const getColumnTypeFromId = (columnId) => {
|
|
267
274
|
if (columnId === NAME_COLUMN)
|
|
268
275
|
return COLUMN_TYPES.TEXT;
|
|
269
|
-
|
|
276
|
+
if (columnId.startsWith("graph_d_")) {
|
|
277
|
+
return COLUMN_TYPES.DROPDOWN;
|
|
278
|
+
}
|
|
279
|
+
else if (columnId.startsWith("graph_")) {
|
|
280
|
+
// temp for special relation column
|
|
281
|
+
return COLUMN_TYPES.TAGS;
|
|
282
|
+
}
|
|
283
|
+
const lastIdx = columnId.lastIndexOf("_");
|
|
284
|
+
return lastIdx === -1 ? undefined : columnId.substring(0, lastIdx);
|
|
270
285
|
};
|
|
271
286
|
export const getColumnValueType = (columnType) => {
|
|
272
287
|
switch (columnType) {
|
|
273
288
|
case COLUMN_TYPES.PEOPLE:
|
|
289
|
+
case COLUMN_TYPES.VOTE:
|
|
274
290
|
case COLUMN_TYPES.CREATED_BY:
|
|
275
291
|
case COLUMN_TYPES.FILES:
|
|
276
292
|
case COLUMN_TYPES.TAGS:
|
|
@@ -288,6 +304,7 @@ export const getColumnValueType = (columnType) => {
|
|
|
288
304
|
return "number";
|
|
289
305
|
case COLUMN_TYPES.LINKED_COLUMN:
|
|
290
306
|
case COLUMN_TYPES.REF_LINED_COLUMN:
|
|
307
|
+
case COLUMN_TYPES.ROLLUP:
|
|
291
308
|
return "objectArray";
|
|
292
309
|
case COLUMN_TYPES.CHECKBOX:
|
|
293
310
|
return "bool";
|
|
@@ -449,7 +466,7 @@ export const getValidConditions = (filter, headers, currentUserId, escapeHeaderC
|
|
|
449
466
|
(!!c.value?.filter(v => !!v || v === 0)?.length &&
|
|
450
467
|
(!isDropdown ||
|
|
451
468
|
escapeHeaderCheck ||
|
|
452
|
-
c.value.some(v => checkHeader?.dropdowns?.find(d => d.key === v)))));
|
|
469
|
+
c.value.some(v => checkHeader?.dropdowns?.find(d => d.key === v || d.eqVal === v)))));
|
|
453
470
|
case OP_TYPES.EMPTY:
|
|
454
471
|
case OP_TYPES.NOT_EMPTY:
|
|
455
472
|
return true;
|
|
@@ -554,6 +571,19 @@ const isDateAfterConditionValues = (itemVal, condition) => {
|
|
|
554
571
|
}
|
|
555
572
|
});
|
|
556
573
|
};
|
|
574
|
+
export const isEqValInConditionValues = (itemVal, condition, checkHeader) => {
|
|
575
|
+
if (condition.blank && !itemVal)
|
|
576
|
+
return true;
|
|
577
|
+
return !!condition.value?.some(c => {
|
|
578
|
+
const itemDropdown = checkHeader?.dropdowns?.find(d => d.key === itemVal);
|
|
579
|
+
if (itemDropdown) {
|
|
580
|
+
return itemDropdown.value === c || itemDropdown.eqVal === c;
|
|
581
|
+
}
|
|
582
|
+
return false;
|
|
583
|
+
});
|
|
584
|
+
// if (!groupKey) return !!condition.blank;
|
|
585
|
+
// return !!condition.value?.find((dateGroup) => dateGroup === groupKey);
|
|
586
|
+
};
|
|
557
587
|
const isEmpty = (itemVal, valueType, columnType) => {
|
|
558
588
|
const isLink = columnType === COLUMN_TYPES.LINK;
|
|
559
589
|
const isPhone = columnType === COLUMN_TYPES.PHONE;
|
|
@@ -690,16 +720,22 @@ const checkItemMatched = (item, validConditions, headers, matchAny) => {
|
|
|
690
720
|
}
|
|
691
721
|
const isDate = checkHeader?.type === COLUMN_TYPES.DATE ||
|
|
692
722
|
checkHeader?.type === COLUMN_TYPES.CREATED_AT;
|
|
723
|
+
const isHasEqVal = checkHeader?.dropdowns?.some(d => !!d.eqVal);
|
|
724
|
+
// FIX LATER: this judgement is not strong, fix it later when has better way;
|
|
693
725
|
switch (condition.op) {
|
|
694
726
|
case OP_TYPES.IS:
|
|
695
727
|
match = isDate
|
|
696
728
|
? isDateInConditionValues(itemVal, condition)
|
|
697
|
-
:
|
|
729
|
+
: isHasEqVal
|
|
730
|
+
? isEqValInConditionValues(itemVal, condition, checkHeader)
|
|
731
|
+
: isInConditionValues(itemVal, valueType, condition);
|
|
698
732
|
break;
|
|
699
733
|
case OP_TYPES.IS_NOT:
|
|
700
734
|
match = isDate
|
|
701
735
|
? !isDateInConditionValues(itemVal, condition)
|
|
702
|
-
:
|
|
736
|
+
: isHasEqVal
|
|
737
|
+
? !isEqValInConditionValues(itemVal, condition, checkHeader)
|
|
738
|
+
: !isInConditionValues(itemVal, valueType, condition);
|
|
703
739
|
break;
|
|
704
740
|
case OP_TYPES.BEFORE: // only for date type
|
|
705
741
|
match = isDate && isDateBeforeConditionValues(itemVal, condition);
|
|
@@ -812,7 +848,7 @@ export const isItemMatchedByConditions = (item, filter, headers, currentUserId)
|
|
|
812
848
|
if (!validConditions?.length) {
|
|
813
849
|
return true;
|
|
814
850
|
}
|
|
815
|
-
return checkItemMatched(item, validConditions, headers, filter?.andOr ===
|
|
851
|
+
return checkItemMatched(item, validConditions, headers, filter?.andOr === "or");
|
|
816
852
|
};
|
|
817
853
|
export const filterBoardTree = (board, filter, currentUserId) => {
|
|
818
854
|
if (!board?.groups?.length || !board?.headers?.length || !filter)
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -13,15 +13,20 @@ export interface ILinkedSource {
|
|
|
13
13
|
deleted?: boolean;
|
|
14
14
|
type: string;
|
|
15
15
|
name: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
displayMode?: string;
|
|
17
|
+
condition: {
|
|
18
|
+
andOr?: string;
|
|
19
|
+
criteria?: {
|
|
20
|
+
op?: string;
|
|
21
|
+
linkedColumnId?: string;
|
|
22
|
+
conditionId?: string;
|
|
23
|
+
blank?: boolean;
|
|
24
|
+
value?: {
|
|
25
|
+
val?: any[] | undefined;
|
|
26
|
+
columnId?: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
25
30
|
}
|
|
26
31
|
export interface IBaseItem {
|
|
27
32
|
itemId: string;
|
|
@@ -35,6 +40,15 @@ export interface IBaseItem {
|
|
|
35
40
|
expand?: boolean;
|
|
36
41
|
createdBy?: string;
|
|
37
42
|
createdAt?: string;
|
|
43
|
+
updatedBy?: string;
|
|
44
|
+
updatedAt?: string;
|
|
45
|
+
actionNum?: number;
|
|
46
|
+
rollbackColumns?: Record<string, any>;
|
|
47
|
+
}
|
|
48
|
+
export interface IColumnSettingRule {
|
|
49
|
+
target: string;
|
|
50
|
+
compare: ">" | "<" | ">=" | "<=";
|
|
51
|
+
allowEmpty?: boolean;
|
|
38
52
|
}
|
|
39
53
|
export interface IColumnSetting {
|
|
40
54
|
currency?: string;
|
|
@@ -43,6 +57,24 @@ export interface IColumnSetting {
|
|
|
43
57
|
autoParseUrl?: boolean;
|
|
44
58
|
prefix?: string | null;
|
|
45
59
|
startNumber?: number;
|
|
60
|
+
numRange?: (number | undefined)[];
|
|
61
|
+
textLength?: number;
|
|
62
|
+
emailDomains?: string[];
|
|
63
|
+
dateRange?: (string | undefined)[];
|
|
64
|
+
fileTypes?: string[];
|
|
65
|
+
fileSize?: string;
|
|
66
|
+
formula?: string;
|
|
67
|
+
depColumnIds?: string[];
|
|
68
|
+
formulaDisplay?: string;
|
|
69
|
+
system?: boolean;
|
|
70
|
+
hidden?: boolean;
|
|
71
|
+
relate?: {
|
|
72
|
+
r: string;
|
|
73
|
+
s: string;
|
|
74
|
+
t: string;
|
|
75
|
+
};
|
|
76
|
+
rules?: IColumnSettingRule[];
|
|
77
|
+
link_to?: string;
|
|
46
78
|
}
|
|
47
79
|
export interface IDropdownOption {
|
|
48
80
|
key: string;
|
|
@@ -51,9 +83,15 @@ export interface IDropdownOption {
|
|
|
51
83
|
attr?: {
|
|
52
84
|
color?: string;
|
|
53
85
|
};
|
|
86
|
+
setting?: {
|
|
87
|
+
link_to?: string;
|
|
88
|
+
hidden?: boolean;
|
|
89
|
+
};
|
|
54
90
|
deleted?: number;
|
|
91
|
+
eqVal?: string;
|
|
55
92
|
}
|
|
56
93
|
export interface IBaseCustomColumn {
|
|
94
|
+
boardId?: string;
|
|
57
95
|
columnId: string;
|
|
58
96
|
type: string;
|
|
59
97
|
name: string;
|
|
@@ -85,6 +123,7 @@ export interface IBaseBoard {
|
|
|
85
123
|
orgId?: string;
|
|
86
124
|
description?: string;
|
|
87
125
|
workspaceId?: string;
|
|
126
|
+
appId?: string;
|
|
88
127
|
createdBy?: string;
|
|
89
128
|
updatedBy?: string;
|
|
90
129
|
createdAt?: string;
|
|
@@ -98,9 +137,11 @@ export interface IPureBoard extends IBaseBoard {
|
|
|
98
137
|
export interface IFilterCondition {
|
|
99
138
|
conditionId?: string;
|
|
100
139
|
columnId: string;
|
|
140
|
+
targetKey: string;
|
|
101
141
|
op: string;
|
|
102
|
-
value
|
|
142
|
+
value?: any[];
|
|
103
143
|
blank?: boolean;
|
|
144
|
+
disabled?: boolean;
|
|
104
145
|
}
|
|
105
146
|
export interface IFilter {
|
|
106
147
|
andOr: "and" | "or";
|