@followupus/common 0.10.32 → 0.10.34

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;
@@ -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;
@@ -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
- 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);
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
- : isInConditionValues(itemVal, valueType, condition);
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
- : !isInConditionValues(itemVal, valueType, condition);
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 === 'or');
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)
@@ -13,6 +13,20 @@ export interface ILinkedSource {
13
13
  deleted?: boolean;
14
14
  type: string;
15
15
  name: 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
+ };
16
30
  dropdowns?: {
17
31
  key: string;
18
32
  value: string;
@@ -35,6 +49,15 @@ export interface IBaseItem {
35
49
  expand?: boolean;
36
50
  createdBy?: string;
37
51
  createdAt?: string;
52
+ updatedBy?: string;
53
+ updatedAt?: string;
54
+ actionNum?: number;
55
+ rollbackColumns?: Record<string, any>;
56
+ }
57
+ export interface IColumnSettingRule {
58
+ target: string;
59
+ compare: ">" | "<" | ">=" | "<=";
60
+ allowEmpty?: boolean;
38
61
  }
39
62
  export interface IColumnSetting {
40
63
  currency?: string;
@@ -43,6 +66,24 @@ export interface IColumnSetting {
43
66
  autoParseUrl?: boolean;
44
67
  prefix?: string | null;
45
68
  startNumber?: number;
69
+ numRange?: (number | undefined)[];
70
+ textLength?: number;
71
+ emailDomains?: string[];
72
+ dateRange?: (string | undefined)[];
73
+ fileTypes?: string[];
74
+ fileSize?: string;
75
+ formula?: string;
76
+ depColumnIds?: string[];
77
+ formulaDisplay?: string;
78
+ system?: boolean;
79
+ hidden?: boolean;
80
+ relate?: {
81
+ r: string;
82
+ s: string;
83
+ t: string;
84
+ };
85
+ rules?: IColumnSettingRule[];
86
+ link_to?: string;
46
87
  }
47
88
  export interface IDropdownOption {
48
89
  key: string;
@@ -51,9 +92,15 @@ export interface IDropdownOption {
51
92
  attr?: {
52
93
  color?: string;
53
94
  };
95
+ setting?: {
96
+ link_to?: string;
97
+ hidden?: boolean;
98
+ };
54
99
  deleted?: number;
100
+ eqVal?: string;
55
101
  }
56
102
  export interface IBaseCustomColumn {
103
+ boardId?: string;
57
104
  columnId: string;
58
105
  type: string;
59
106
  name: string;
@@ -85,6 +132,7 @@ export interface IBaseBoard {
85
132
  orgId?: string;
86
133
  description?: string;
87
134
  workspaceId?: string;
135
+ appId?: string;
88
136
  createdBy?: string;
89
137
  updatedBy?: string;
90
138
  createdAt?: string;
@@ -98,9 +146,11 @@ export interface IPureBoard extends IBaseBoard {
98
146
  export interface IFilterCondition {
99
147
  conditionId?: string;
100
148
  columnId: string;
149
+ targetKey: string;
101
150
  op: string;
102
- value: any[];
151
+ value?: any[];
103
152
  blank?: boolean;
153
+ disabled?: boolean;
104
154
  }
105
155
  export interface IFilter {
106
156
  andOr: "and" | "or";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followupus/common",
3
- "version": "0.10.32",
3
+ "version": "0.10.34",
4
4
  "description": "followup common utils npm package with TypeScript and VSCode",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",