@followupus/common 0.10.17 → 0.10.19

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.
@@ -70,7 +70,7 @@ export const PREFIX_PK = {
70
70
  TIME_TRACKING_log: "TG",
71
71
  AI_USER_AGENT: "AG",
72
72
  ITEM_RELATIONSHIP: "IR",
73
- WORKFLOW: "WF",
73
+ WORKFLOW: 'WF',
74
74
  WORKFLOW_LOG: "WG",
75
- APP: "AP"
75
+ APP: 'AP',
76
76
  };
@@ -42,6 +42,7 @@ export declare const COLUMN_TYPES: {
42
42
  CREATED_BY: string;
43
43
  CREATED_AT: string;
44
44
  };
45
+ export declare const NAME_COLUMN = "name";
45
46
  export declare const OP_TYPES: {
46
47
  CONTAINS: string;
47
48
  NOT_CONTAINS: string;
@@ -82,6 +83,11 @@ export declare const FILTER_DATE_GROUPS: {
82
83
  THIS_WEEK: string;
83
84
  THIS_MONTH: string;
84
85
  };
86
+ export declare const INBOX_DATE_GROUPS: {
87
+ TODAY: string;
88
+ YESTERDAY: string;
89
+ BEFORE_YESTERDAY: string;
90
+ };
85
91
  export declare const DATE_VALUE_FORMAT = "YYYY-MM-DD";
86
92
  export declare enum SpecialKeyInDateFilter {
87
93
  SelectDate = "selectDate",
@@ -93,6 +99,7 @@ export declare const getColumnValueType: (columnType: string) => "string" | "num
93
99
  export declare const getFilterDateGroupKeys: (dateStr: string) => string[] | null;
94
100
  export declare const getDateGroupKey: (dateStr: string) => string | null;
95
101
  export declare const getValidConditions: (filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string, escapeHeaderCheck?: boolean) => IFilterCondition[];
102
+ export declare const isDateInConditionValues: (itemVal: any, condition: IFilterCondition) => boolean;
96
103
  export declare const filterItemsByConditions: (groups: IBaseGroup[], filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string) => IBaseGroup[];
97
104
  export declare const isItemMatchedByConditions: (item: IBaseItem, filter: IFilter, headers?: IBaseCustomColumn[], currentUserId?: string) => boolean;
98
105
  export declare const filterBoardTree: (board: IPureBoard, filter: IFilter, currentUserId?: string) => IPureBoard;
@@ -45,6 +45,7 @@ export const COLUMN_TYPES = {
45
45
  CREATED_BY: "created_by",
46
46
  CREATED_AT: "created_at",
47
47
  };
48
+ export const NAME_COLUMN = "name";
48
49
  export const OP_TYPES = {
49
50
  CONTAINS: "like",
50
51
  NOT_CONTAINS: "not_like",
@@ -159,20 +160,25 @@ export const COLUMN_OP_TYPES = {
159
160
  };
160
161
  export const AUTOMATION_OP_TYPES = {
161
162
  ...COLUMN_OP_TYPES,
162
- [COLUMN_TYPES.TEXT]: [OP_TYPES.CONTAINS, OP_TYPES.NOT_CONTAINS],
163
- [COLUMN_TYPES.EMAIL]: [OP_TYPES.CONTAINS, OP_TYPES.NOT_CONTAINS],
164
- [COLUMN_TYPES.DATE]: [
165
- OP_TYPES.EQUAL,
166
- OP_TYPES.NOT_EQUAL,
167
- OP_TYPES.BEFORE,
168
- OP_TYPES.AFTER,
169
- ],
170
- [COLUMN_TYPES.CREATED_AT]: [
171
- OP_TYPES.EQUAL,
172
- OP_TYPES.NOT_EQUAL,
173
- OP_TYPES.BEFORE,
174
- OP_TYPES.AFTER,
163
+ [COLUMN_TYPES.TEXT]: [
164
+ OP_TYPES.CONTAINS,
165
+ OP_TYPES.NOT_CONTAINS,
166
+ OP_TYPES.EMPTY,
167
+ OP_TYPES.NOT_EMPTY,
175
168
  ],
169
+ [COLUMN_TYPES.EMAIL]: [OP_TYPES.CONTAINS, OP_TYPES.NOT_CONTAINS],
170
+ // [COLUMN_TYPES.DATE]: [
171
+ // OP_TYPES.EQUAL,
172
+ // OP_TYPES.NOT_EQUAL,
173
+ // OP_TYPES.BEFORE,
174
+ // OP_TYPES.AFTER,
175
+ // ],
176
+ // [COLUMN_TYPES.CREATED_AT]: [
177
+ // OP_TYPES.EQUAL,
178
+ // OP_TYPES.NOT_EQUAL,
179
+ // OP_TYPES.BEFORE,
180
+ // OP_TYPES.AFTER,
181
+ // ],
176
182
  };
177
183
  export const DYNAMIC_VIEW_OP_TYPES = {
178
184
  ...COLUMN_OP_TYPES,
@@ -198,6 +204,11 @@ export const FILTER_DATE_GROUPS = {
198
204
  THIS_WEEK: "thisWeek",
199
205
  THIS_MONTH: "thisMonth",
200
206
  };
207
+ export const INBOX_DATE_GROUPS = {
208
+ TODAY: "today",
209
+ YESTERDAY: "yesterday",
210
+ BEFORE_YESTERDAY: "before_yesterday",
211
+ };
201
212
  export const DATE_VALUE_FORMAT = "YYYY-MM-DD";
202
213
  export var SpecialKeyInDateFilter;
203
214
  (function (SpecialKeyInDateFilter) {
@@ -210,7 +221,9 @@ export const isLinkedColumns = (columnType) => {
210
221
  return [COLUMN_TYPES.LINKED_COLUMN, COLUMN_TYPES.REF_LINED_COLUMN].includes(columnType);
211
222
  };
212
223
  export const getColumnTypeFromId = (columnId) => {
213
- return Object.values(COLUMN_TYPES).find(type => columnId.startsWith(type));
224
+ if (columnId === NAME_COLUMN)
225
+ return COLUMN_TYPES.TEXT;
226
+ return Object.values(COLUMN_TYPES).find(type => columnId.startsWith(type + '_'));
214
227
  };
215
228
  export const getColumnValueType = (columnType) => {
216
229
  switch (columnType) {
@@ -399,7 +412,7 @@ const isInConditionValues = (itemVal, valueType, condition) => {
399
412
  }
400
413
  return false;
401
414
  };
402
- const isDateInConditionValues = (itemVal, condition) => {
415
+ export const isDateInConditionValues = (itemVal, condition) => {
403
416
  if (!itemVal || !dayjs(itemVal).isValid()) {
404
417
  return !!condition.blank;
405
418
  }
@@ -547,7 +560,7 @@ const isLessEqual = (itemVal, condition) => {
547
560
  return parseVal ? itemVal <= parseVal : false;
548
561
  }
549
562
  };
550
- const checkItemMatched = (item, validConditions, headers) => {
563
+ const checkItemMatched = (item, validConditions, headers, matchAny) => {
551
564
  let isItemMatched = false;
552
565
  for (const condition of validConditions) {
553
566
  const header = headers?.find(h => h.columnId === condition.columnId);
@@ -650,8 +663,10 @@ const checkItemMatched = (item, validConditions, headers) => {
650
663
  return checkConditionFn(subValue);
651
664
  }));
652
665
  }
653
- if (!isItemMatched)
666
+ if (!isItemMatched && !matchAny)
654
667
  return false;
668
+ if (isItemMatched && matchAny)
669
+ return true;
655
670
  }
656
671
  return isItemMatched;
657
672
  };
@@ -662,9 +677,10 @@ export const filterItemsByConditions = (groups, filter, headers, currentUserId)
662
677
  if (!validConditions?.length) {
663
678
  return groups;
664
679
  }
680
+ const matchAny = filter.andOr === "or";
665
681
  groups.forEach(g => {
666
682
  g.items = g.items?.filter(item => {
667
- return checkItemMatched(item, validConditions, headers);
683
+ return checkItemMatched(item, validConditions, headers, matchAny);
668
684
  });
669
685
  });
670
686
  return groups;
@@ -676,7 +692,7 @@ export const isItemMatchedByConditions = (item, filter, headers, currentUserId)
676
692
  if (!validConditions?.length) {
677
693
  return true;
678
694
  }
679
- return checkItemMatched(item, validConditions, headers);
695
+ return checkItemMatched(item, validConditions, headers, filter?.andOr === 'or');
680
696
  };
681
697
  export const filterBoardTree = (board, filter, currentUserId) => {
682
698
  if (!board?.groups?.length || !board?.headers?.length || !filter)
@@ -10,7 +10,7 @@ export interface ILinkedSource {
10
10
  boardId: string;
11
11
  boardName?: string;
12
12
  columnId: string;
13
- deleted?: number;
13
+ deleted?: boolean;
14
14
  type: string;
15
15
  name: string;
16
16
  dropdowns?: {
@@ -49,6 +49,7 @@ export interface IDropdownOption {
49
49
  attr?: {
50
50
  color?: string;
51
51
  };
52
+ deleted?: number;
52
53
  }
53
54
  export interface IBaseCustomColumn {
54
55
  columnId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followupus/common",
3
- "version": "0.10.17",
3
+ "version": "0.10.19",
4
4
  "description": "followup common utils npm package with TypeScript and VSCode",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",