@fctc/interface-logic 2.3.1 → 2.3.3

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/utils.d.ts CHANGED
@@ -50,13 +50,14 @@ declare const convertFloatToTime: (floatValue: number) => string;
50
50
  declare const convertTimeToFloat: (timeString: string) => number;
51
51
  declare const stringToColor: (name: string, id: number) => string;
52
52
  declare const getFieldsOnChange: (fields: any) => any;
53
- declare const filterFieldDirty: ({ id, viewData, formValues, dirtyFields, model, defaultData, }: {
53
+ declare const filterFieldDirty: ({ id, viewData, formValues, dirtyFields, model, defaultData, keepZeroValue, }: {
54
54
  id?: any;
55
55
  viewData?: any;
56
56
  formValues?: any;
57
57
  dirtyFields?: any;
58
58
  model?: any;
59
59
  defaultData?: any;
60
+ keepZeroValue?: boolean;
60
61
  }) => any;
61
62
  type MergeableObject = {
62
63
  [key: string]: any;
package/dist/utils.js CHANGED
@@ -2654,7 +2654,8 @@ var filterFieldDirty = ({
2654
2654
  formValues,
2655
2655
  dirtyFields,
2656
2656
  model,
2657
- defaultData
2657
+ defaultData,
2658
+ keepZeroValue = false
2658
2659
  }) => {
2659
2660
  const data = id ? { ...dirtyFields } : { ...formValues };
2660
2661
  for (const key in data) {
@@ -2723,7 +2724,7 @@ var filterFieldDirty = ({
2723
2724
  if (id && (typeof dirtyFields?.[key] === "object" && !dirtyFields?.[key]?.id || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
2724
2725
  delete data[key];
2725
2726
  } else {
2726
- if (!data[key]) {
2727
+ if (!data[key] && !(keepZeroValue && (data[key] === 0 || data[key] === "0"))) {
2727
2728
  delete data[key];
2728
2729
  } else {
2729
2730
  data[key] = formValues?.[key]?.display_name ? formValues?.[key]?.id : formValues?.[key];
package/dist/utils.mjs CHANGED
@@ -2589,7 +2589,8 @@ var filterFieldDirty = ({
2589
2589
  formValues,
2590
2590
  dirtyFields,
2591
2591
  model,
2592
- defaultData
2592
+ defaultData,
2593
+ keepZeroValue = false
2593
2594
  }) => {
2594
2595
  const data = id ? { ...dirtyFields } : { ...formValues };
2595
2596
  for (const key in data) {
@@ -2658,7 +2659,7 @@ var filterFieldDirty = ({
2658
2659
  if (id && (typeof dirtyFields?.[key] === "object" && !dirtyFields?.[key]?.id || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
2659
2660
  delete data[key];
2660
2661
  } else {
2661
- if (!data[key]) {
2662
+ if (!data[key] && !(keepZeroValue && (data[key] === 0 || data[key] === "0"))) {
2662
2663
  delete data[key];
2663
2664
  } else {
2664
2665
  data[key] = formValues?.[key]?.display_name ? formValues?.[key]?.id : formValues?.[key];
@@ -58,7 +58,6 @@ interface GetDetailParams {
58
58
  model?: string;
59
59
  specification?: Specification;
60
60
  context?: ContextApi;
61
- service?: string;
62
61
  }
63
62
  interface SaveParams {
64
63
  model: string;
@@ -67,12 +66,10 @@ interface SaveParams {
67
66
  specification?: Specification;
68
67
  context?: ContextApi;
69
68
  path?: string;
70
- service?: string;
71
69
  }
72
70
  interface DeleteParams {
73
71
  ids?: number[];
74
72
  model: string;
75
- service?: string;
76
73
  }
77
74
  interface OnChangeParams {
78
75
  ids?: number[];
@@ -81,7 +78,6 @@ interface OnChangeParams {
81
78
  specification: Specification;
82
79
  context?: ContextApi;
83
80
  fieldChange?: string[];
84
- service?: string;
85
81
  }
86
82
  interface ViewData {
87
83
  models?: {
@@ -112,7 +108,6 @@ interface GetViewParams {
112
108
  context?: Record<string, any>;
113
109
  options?: Option;
114
110
  aid?: number | string | null | boolean;
115
- service?: string;
116
111
  }
117
112
 
118
113
  export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetAllParams as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SaveParams as S, UpdatePasswordRequest as U, ViewData as V, GetDetailParams as a, GetListParams as b, GetSelectionType as c, SocialTokenBody as d, Specification as e, GetViewParams as f, View as g, updatePasswordBody as u };
@@ -58,7 +58,6 @@ interface GetDetailParams {
58
58
  model?: string;
59
59
  specification?: Specification;
60
60
  context?: ContextApi;
61
- service?: string;
62
61
  }
63
62
  interface SaveParams {
64
63
  model: string;
@@ -67,12 +66,10 @@ interface SaveParams {
67
66
  specification?: Specification;
68
67
  context?: ContextApi;
69
68
  path?: string;
70
- service?: string;
71
69
  }
72
70
  interface DeleteParams {
73
71
  ids?: number[];
74
72
  model: string;
75
- service?: string;
76
73
  }
77
74
  interface OnChangeParams {
78
75
  ids?: number[];
@@ -81,7 +78,6 @@ interface OnChangeParams {
81
78
  specification: Specification;
82
79
  context?: ContextApi;
83
80
  fieldChange?: string[];
84
- service?: string;
85
81
  }
86
82
  interface ViewData {
87
83
  models?: {
@@ -112,7 +108,6 @@ interface GetViewParams {
112
108
  context?: Record<string, any>;
113
109
  options?: Option;
114
110
  aid?: number | string | null | boolean;
115
- service?: string;
116
111
  }
117
112
 
118
113
  export type { ContextApi as C, DeleteParams as D, ForgotPasswordBody as F, GetAllParams as G, LoginCredentialBody as L, OnChangeParams as O, ResetPasswordRequest as R, SaveParams as S, UpdatePasswordRequest as U, ViewData as V, GetDetailParams as a, GetListParams as b, GetSelectionType as c, SocialTokenBody as d, Specification as e, GetViewParams as f, View as g, updatePasswordBody as u };
package/package.json CHANGED
@@ -1,85 +1,85 @@
1
- {
2
- "name": "@fctc/interface-logic",
3
- "version": "2.3.1",
4
- "types": "dist/index.d.ts",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
12
- },
13
- "./configs": {
14
- "types": "./dist/configs.d.ts",
15
- "import": "./dist/configs.mjs",
16
- "require": "./dist/configs.cjs"
17
- },
18
- "./constants": {
19
- "types": "./dist/constants.d.ts",
20
- "import": "./dist/constants.mjs",
21
- "require": "./dist/constants.cjs"
22
- },
23
- "./environment": {
24
- "types": "./dist/environment.d.ts",
25
- "import": "./dist/environment.mjs",
26
- "require": "./dist/environment.cjs"
27
- },
28
- "./hooks": {
29
- "types": "./dist/hooks.d.ts",
30
- "import": "./dist/hooks.mjs",
31
- "require": "./dist/hooks.cjs"
32
- },
33
- "./provider": {
34
- "types": "./dist/provider.d.ts",
35
- "import": "./dist/provider.mjs",
36
- "require": "./dist/provider.cjs"
37
- },
38
- "./services": {
39
- "types": "./dist/services.d.ts",
40
- "import": "./dist/services.mjs",
41
- "require": "./dist/services.cjs"
42
- },
43
- "./store": {
44
- "types": "./dist/store.d.ts",
45
- "import": "./dist/store.mjs",
46
- "require": "./dist/store.cjs"
47
- },
48
- "./utils": {
49
- "types": "./dist/utils.d.ts",
50
- "import": "./dist/utils.mjs",
51
- "require": "./dist/utils.cjs"
52
- },
53
- "./types": {
54
- "types": "./dist/types.d.ts",
55
- "import": "./dist/types.mjs",
56
- "require": "./dist/types.cjs"
57
- }
58
- },
59
- "files": [
60
- "dist"
61
- ],
62
- "scripts": {
63
- "build": "tsup",
64
- "test": "jest"
65
- },
66
- "peerDependencies": {
67
- "react": "18.0.0",
68
- "@tanstack/react-query": "^5.83.0"
69
- },
70
- "dependencies": {
71
- "@reduxjs/toolkit": "^2.8.2",
72
- "@tanstack/react-query": "^5.83.0",
73
- "axios": "^1.11.0",
74
- "moment": "^2.30.1",
75
- "react-redux": "^9.2.0"
76
- },
77
- "devDependencies": {
78
- "@types/react": "^18.3.1",
79
- "react": "18.0.0",
80
- "jest": "^29.7.0",
81
- "tsup": "^8.0.0",
82
- "typescript": "^5.8.2"
83
- },
84
- "packageManager": "yarn@1.22.0"
85
- }
1
+ {
2
+ "name": "@fctc/interface-logic",
3
+ "version": "2.3.3",
4
+ "types": "dist/index.d.ts",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./configs": {
14
+ "types": "./dist/configs.d.ts",
15
+ "import": "./dist/configs.mjs",
16
+ "require": "./dist/configs.cjs"
17
+ },
18
+ "./constants": {
19
+ "types": "./dist/constants.d.ts",
20
+ "import": "./dist/constants.mjs",
21
+ "require": "./dist/constants.cjs"
22
+ },
23
+ "./environment": {
24
+ "types": "./dist/environment.d.ts",
25
+ "import": "./dist/environment.mjs",
26
+ "require": "./dist/environment.cjs"
27
+ },
28
+ "./hooks": {
29
+ "types": "./dist/hooks.d.ts",
30
+ "import": "./dist/hooks.mjs",
31
+ "require": "./dist/hooks.cjs"
32
+ },
33
+ "./provider": {
34
+ "types": "./dist/provider.d.ts",
35
+ "import": "./dist/provider.mjs",
36
+ "require": "./dist/provider.cjs"
37
+ },
38
+ "./services": {
39
+ "types": "./dist/services.d.ts",
40
+ "import": "./dist/services.mjs",
41
+ "require": "./dist/services.cjs"
42
+ },
43
+ "./store": {
44
+ "types": "./dist/store.d.ts",
45
+ "import": "./dist/store.mjs",
46
+ "require": "./dist/store.cjs"
47
+ },
48
+ "./utils": {
49
+ "types": "./dist/utils.d.ts",
50
+ "import": "./dist/utils.mjs",
51
+ "require": "./dist/utils.cjs"
52
+ },
53
+ "./types": {
54
+ "types": "./dist/types.d.ts",
55
+ "import": "./dist/types.mjs",
56
+ "require": "./dist/types.cjs"
57
+ }
58
+ },
59
+ "files": [
60
+ "dist"
61
+ ],
62
+ "scripts": {
63
+ "build": "tsup",
64
+ "test": "jest"
65
+ },
66
+ "peerDependencies": {
67
+ "react": "18.0.0",
68
+ "@tanstack/react-query": "^5.83.0"
69
+ },
70
+ "dependencies": {
71
+ "@reduxjs/toolkit": "^2.8.2",
72
+ "@tanstack/react-query": "^5.83.0",
73
+ "axios": "^1.11.0",
74
+ "moment": "^2.30.1",
75
+ "react-redux": "^9.2.0"
76
+ },
77
+ "devDependencies": {
78
+ "@types/react": "^18.3.1",
79
+ "react": "18.0.0",
80
+ "jest": "^29.7.0",
81
+ "tsup": "^8.0.0",
82
+ "typescript": "^5.8.2"
83
+ },
84
+ "packageManager": "yarn@1.22.0"
85
+ }