@followupus/common 0.10.22 → 0.10.23

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,26 +1,4 @@
1
1
  import { IBaseCustomColumn, IBaseGroup, IFilter, IFilterCondition, IPureBoard, IBaseItem } from "./types";
2
- export declare const ACTION_TYPE: {
3
- CREATE: string;
4
- UPDATE: string;
5
- DELETE: string;
6
- DUPLICATE: string;
7
- MOVE: string;
8
- RESOLVE: string;
9
- };
10
- export declare const OBJECT_TYPE: {
11
- WORKSPACE: string;
12
- APP: string;
13
- FOLDER: string;
14
- BOARD: string;
15
- VIEW: string;
16
- DOC: string;
17
- GROUP: string;
18
- HEADER: string;
19
- ITEM: string;
20
- DROPDOWN: string;
21
- MEMBER: string;
22
- ACTION: string;
23
- };
24
2
  export declare const COLUMN_TYPES: {
25
3
  TEXT: string;
26
4
  DATE: string;
@@ -38,6 +16,8 @@ export declare const COLUMN_TYPES: {
38
16
  TAGS: string;
39
17
  LINK: string;
40
18
  FILES: string;
19
+ CHECKBOX: string;
20
+ PERCENTAGE: string;
41
21
  AUTO_NUMBER: string;
42
22
  LINKED_COLUMN: string;
43
23
  REF_LINED_COLUMN: string;
@@ -97,7 +77,7 @@ export declare enum SpecialKeyInDateFilter {
97
77
  }
98
78
  export declare const isLinkedColumns: (columnType?: string) => boolean;
99
79
  export declare const getColumnTypeFromId: (columnId: string) => string | undefined;
100
- export declare const getColumnValueType: (columnType: string) => "string" | "number" | "object" | "stringArray" | "objectArray";
80
+ export declare const getColumnValueType: (columnType: string) => "string" | "number" | "object" | "stringArray" | "objectArray" | "bool";
101
81
  export declare const getFilterDateGroupKeys: (dateStr: string) => string[] | null;
102
82
  export declare const getDateGroupKey: (dateStr: string) => string | null;
103
83
  export declare const extractDomain: (url?: string) => string | undefined;
@@ -2,30 +2,6 @@ import { phoneCountryList } from "./phone.js";
2
2
  import dayjs from "dayjs";
3
3
  import _ from "lodash";
4
4
  // the key order is used for Add Column Menu order, keep it
5
- //One-to-One Matching UI.
6
- export const ACTION_TYPE = {
7
- CREATE: "CREATE",
8
- UPDATE: "UPDATE",
9
- DELETE: "DELETE",
10
- DUPLICATE: "DUPLICATE",
11
- MOVE: "MOVE",
12
- RESOLVE: "RESOLVE",
13
- };
14
- // One-to-One Matching UI.
15
- export const OBJECT_TYPE = {
16
- WORKSPACE: "workspace",
17
- APP: "app",
18
- FOLDER: "folder",
19
- BOARD: "board",
20
- VIEW: "view",
21
- DOC: "doc",
22
- GROUP: "group",
23
- HEADER: "header",
24
- ITEM: "item",
25
- DROPDOWN: "dropdown",
26
- MEMBER: "member",
27
- ACTION: "action",
28
- };
29
5
  export const COLUMN_TYPES = {
30
6
  TEXT: "string",
31
7
  DATE: "date",
@@ -43,6 +19,8 @@ export const COLUMN_TYPES = {
43
19
  TAGS: "tags",
44
20
  LINK: "link",
45
21
  FILES: "files",
22
+ CHECKBOX: "checkbox",
23
+ PERCENTAGE: "percent",
46
24
  AUTO_NUMBER: "auto_number",
47
25
  LINKED_COLUMN: "linked_column",
48
26
  REF_LINED_COLUMN: "ref_linked_column",
@@ -117,6 +95,16 @@ export const COLUMN_OP_TYPES = {
117
95
  OP_TYPES.EMPTY,
118
96
  OP_TYPES.NOT_EMPTY,
119
97
  ],
98
+ [COLUMN_TYPES.AUTO_NUMBER]: [
99
+ OP_TYPES.EQUAL,
100
+ OP_TYPES.NOT_EQUAL,
101
+ OP_TYPES.GREATER,
102
+ OP_TYPES.GREATER_EQUAL,
103
+ OP_TYPES.LESS,
104
+ OP_TYPES.LESS_EQUAL,
105
+ OP_TYPES.EMPTY,
106
+ OP_TYPES.NOT_EMPTY,
107
+ ],
120
108
  [COLUMN_TYPES.CURRENCY]: [
121
109
  OP_TYPES.EQUAL,
122
110
  OP_TYPES.NOT_EQUAL,
@@ -258,10 +246,14 @@ export const getColumnValueType = (columnType) => {
258
246
  case COLUMN_TYPES.NUMBER:
259
247
  case COLUMN_TYPES.HOURS:
260
248
  case COLUMN_TYPES.CURRENCY:
249
+ case COLUMN_TYPES.AUTO_NUMBER:
250
+ case COLUMN_TYPES.PERCENTAGE:
261
251
  return "number";
262
252
  case COLUMN_TYPES.LINKED_COLUMN:
263
253
  case COLUMN_TYPES.REF_LINED_COLUMN:
264
254
  return "objectArray";
255
+ case COLUMN_TYPES.CHECKBOX:
256
+ return "bool";
265
257
  default:
266
258
  return "string";
267
259
  }
@@ -635,6 +627,10 @@ const checkItemMatched = (item, validConditions, headers, matchAny) => {
635
627
  const valueType = getColumnValueType(checkHeader?.type ?? "");
636
628
  const checkConditionFn = (itemVal) => {
637
629
  let match = false;
630
+ const isAutonumber = checkHeader?.type === COLUMN_TYPES.AUTO_NUMBER;
631
+ if (isAutonumber && checkHeader?.setting?.startNumber) {
632
+ itemVal = parseInt(itemVal, 10) + checkHeader.setting.startNumber;
633
+ }
638
634
  const isDate = checkHeader?.type === COLUMN_TYPES.DATE ||
639
635
  checkHeader?.type === COLUMN_TYPES.CREATED_AT;
640
636
  switch (condition.op) {
@@ -33,7 +33,7 @@ export interface IBaseItem {
33
33
  index?: number;
34
34
  deleted?: boolean;
35
35
  expand?: boolean;
36
- createdBy?: string[];
36
+ createdBy?: string;
37
37
  createdAt?: string;
38
38
  }
39
39
  export interface IColumnSetting {
@@ -41,6 +41,8 @@ export interface IColumnSetting {
41
41
  multiple?: boolean;
42
42
  notify?: boolean;
43
43
  autoParseUrl?: boolean;
44
+ prefix?: string | null;
45
+ startNumber?: number;
44
46
  }
45
47
  export interface IDropdownOption {
46
48
  key: string;
@@ -60,6 +62,7 @@ export interface IBaseCustomColumn {
60
62
  linked?: ILinkedSource;
61
63
  index?: number;
62
64
  deleted?: boolean;
65
+ setting?: IColumnSetting;
63
66
  }
64
67
  export interface IBaseGroup {
65
68
  groupId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followupus/common",
3
- "version": "0.10.22",
3
+ "version": "0.10.23",
4
4
  "description": "followup common utils npm package with TypeScript and VSCode",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",