@followupus/common 0.10.31 → 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.
@@ -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;
@@ -31,6 +37,7 @@ export declare const ACTION_TYPE: {
31
37
  DUPLICATE: string;
32
38
  MOVE: string;
33
39
  RESOLVE: string;
40
+ MOVE_PHASE: string;
34
41
  };
35
42
  export declare const OBJECT_TYPE: {
36
43
  WORKSPACE: string;
@@ -47,6 +54,8 @@ export declare const OBJECT_TYPE: {
47
54
  ACTION: string;
48
55
  };
49
56
  export declare const NAME_COLUMN = "name";
57
+ export declare const GATE_COLUMN = "string_gate";
58
+ export declare const PROGRESS_COLUMN = "string_progress";
50
59
  export declare const OP_TYPES: {
51
60
  CONTAINS: string;
52
61
  NOT_CONTAINS: string;
@@ -112,6 +121,7 @@ export declare const isDateMatchConditionValue: (dateVal: string, conditionValue
112
121
  end: string;
113
122
  }) => boolean;
114
123
  export declare const isDateInConditionValues: (itemVal: any, condition: IFilterCondition) => boolean;
124
+ export declare const isEqValInConditionValues: (itemVal: any, condition: IFilterCondition, checkHeader?: IBaseCustomColumn) => boolean;
115
125
  export declare const filterItemsByConditions: (groups: IBaseGroup[], filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string) => IBaseGroup[];
116
126
  export declare const isItemMatchedByConditions: (item: IBaseItem, filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string) => boolean;
117
127
  export declare const filterBoardTree: (board: IPureBoard, filter: IFilter, currentUserId?: string) => IPureBoard;
@@ -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",
@@ -36,6 +41,7 @@ export const ACTION_TYPE = {
36
41
  DUPLICATE: "DUPLICATE",
37
42
  MOVE: "MOVE",
38
43
  RESOLVE: "RESOLVE",
44
+ MOVE_PHASE: "PHASE_MOVE", // for workflow
39
45
  };
40
46
  // One-to-One Matching UI.
41
47
  export const OBJECT_TYPE = {
@@ -53,6 +59,8 @@ export const OBJECT_TYPE = {
53
59
  ACTION: "action",
54
60
  };
55
61
  export const NAME_COLUMN = "name";
62
+ export const GATE_COLUMN = "string_gate";
63
+ export const PROGRESS_COLUMN = "string_progress";
56
64
  export const OP_TYPES = {
57
65
  CONTAINS: "like",
58
66
  NOT_CONTAINS: "not_like",
@@ -265,11 +273,20 @@ export const isLinkedColumns = (columnType) => {
265
273
  export const getColumnTypeFromId = (columnId) => {
266
274
  if (columnId === NAME_COLUMN)
267
275
  return COLUMN_TYPES.TEXT;
268
- return Object.values(COLUMN_TYPES).find(type => columnId.startsWith(type + '_'));
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);
269
285
  };
270
286
  export const getColumnValueType = (columnType) => {
271
287
  switch (columnType) {
272
288
  case COLUMN_TYPES.PEOPLE:
289
+ case COLUMN_TYPES.VOTE:
273
290
  case COLUMN_TYPES.CREATED_BY:
274
291
  case COLUMN_TYPES.FILES:
275
292
  case COLUMN_TYPES.TAGS:
@@ -287,6 +304,7 @@ export const getColumnValueType = (columnType) => {
287
304
  return "number";
288
305
  case COLUMN_TYPES.LINKED_COLUMN:
289
306
  case COLUMN_TYPES.REF_LINED_COLUMN:
307
+ case COLUMN_TYPES.ROLLUP:
290
308
  return "objectArray";
291
309
  case COLUMN_TYPES.CHECKBOX:
292
310
  return "bool";
@@ -448,7 +466,7 @@ export const getValidConditions = (filter, headers, currentUserId, escapeHeaderC
448
466
  (!!c.value?.filter(v => !!v || v === 0)?.length &&
449
467
  (!isDropdown ||
450
468
  escapeHeaderCheck ||
451
- 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)))));
452
470
  case OP_TYPES.EMPTY:
453
471
  case OP_TYPES.NOT_EMPTY:
454
472
  return true;
@@ -553,6 +571,19 @@ const isDateAfterConditionValues = (itemVal, condition) => {
553
571
  }
554
572
  });
555
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
+ };
556
587
  const isEmpty = (itemVal, valueType, columnType) => {
557
588
  const isLink = columnType === COLUMN_TYPES.LINK;
558
589
  const isPhone = columnType === COLUMN_TYPES.PHONE;
@@ -689,16 +720,22 @@ const checkItemMatched = (item, validConditions, headers, matchAny) => {
689
720
  }
690
721
  const isDate = checkHeader?.type === COLUMN_TYPES.DATE ||
691
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;
692
725
  switch (condition.op) {
693
726
  case OP_TYPES.IS:
694
727
  match = isDate
695
728
  ? isDateInConditionValues(itemVal, condition)
696
- : isInConditionValues(itemVal, valueType, condition);
729
+ : isHasEqVal
730
+ ? isEqValInConditionValues(itemVal, condition, checkHeader)
731
+ : isInConditionValues(itemVal, valueType, condition);
697
732
  break;
698
733
  case OP_TYPES.IS_NOT:
699
734
  match = isDate
700
735
  ? !isDateInConditionValues(itemVal, condition)
701
- : !isInConditionValues(itemVal, valueType, condition);
736
+ : isHasEqVal
737
+ ? !isEqValInConditionValues(itemVal, condition, checkHeader)
738
+ : !isInConditionValues(itemVal, valueType, condition);
702
739
  break;
703
740
  case OP_TYPES.BEFORE: // only for date type
704
741
  match = isDate && isDateBeforeConditionValues(itemVal, condition);
@@ -811,7 +848,7 @@ export const isItemMatchedByConditions = (item, filter, headers, currentUserId)
811
848
  if (!validConditions?.length) {
812
849
  return true;
813
850
  }
814
- return checkItemMatched(item, validConditions, headers, filter?.andOr === 'or');
851
+ return checkItemMatched(item, validConditions, headers, filter?.andOr === "or");
815
852
  };
816
853
  export const filterBoardTree = (board, filter, currentUserId) => {
817
854
  if (!board?.groups?.length || !board?.headers?.length || !filter)
@@ -13,15 +13,20 @@ export interface ILinkedSource {
13
13
  deleted?: boolean;
14
14
  type: string;
15
15
  name: string;
16
- dropdowns?: {
17
- key: string;
18
- value: string;
19
- attr?: {
20
- color?: string;
21
- };
22
- }[];
23
- setting?: IColumnSetting;
24
- linkedGroup?: string;
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: any[];
142
+ value?: any[];
103
143
  blank?: boolean;
144
+ disabled?: boolean;
104
145
  }
105
146
  export interface IFilter {
106
147
  andOr: "and" | "or";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followupus/common",
3
- "version": "0.10.31",
3
+ "version": "0.10.33",
4
4
  "description": "followup common utils npm package with TypeScript and VSCode",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",