@fctc/widget-logic 1.1.1 → 1.1.2

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.
@@ -0,0 +1,123 @@
1
+ interface ValuePropsType {
2
+ id: number | string;
3
+ display_name: number | string;
4
+ [key: string]: any;
5
+ }
6
+ interface IInputFieldProps {
7
+ name?: string;
8
+ type?: string;
9
+ readonly?: boolean;
10
+ required?: boolean;
11
+ placeholder?: string;
12
+ defaultValue?: string | number | ValuePropsType;
13
+ invisible?: boolean;
14
+ methods?: any;
15
+ onChange?: (name: string, value: any) => void;
16
+ onBlur?: Function;
17
+ onRefetch?: Function;
18
+ isForm?: boolean;
19
+ className?: string;
20
+ value?: string | number | ValuePropsType | null | Record<any, any> | any;
21
+ string?: string;
22
+ isEditTable?: boolean;
23
+ }
24
+ interface WidgetPropsType {
25
+ name?: string;
26
+ type?: string;
27
+ readonly?: boolean;
28
+ required?: boolean;
29
+ placeholder?: string;
30
+ translate?: boolean;
31
+ change_default?: boolean;
32
+ groupable?: boolean;
33
+ searchable?: boolean;
34
+ sortable?: boolean;
35
+ store?: boolean;
36
+ string?: string;
37
+ trim?: boolean;
38
+ relation?: string;
39
+ domain?: string | [] | any;
40
+ selection?: [string | number, string][] | any;
41
+ help?: string;
42
+ relation_field?: string;
43
+ related?: string;
44
+ aggregator?: string;
45
+ options?: string;
46
+ value?: string | number | ValuePropsType | null | Record<any, any> | any;
47
+ defaultValue?: string | number | ValuePropsType;
48
+ invisible?: boolean;
49
+ methods?: any;
50
+ onChange?: (name: string, value: any) => void;
51
+ onBlur?: Function;
52
+ onRefetch?: Function;
53
+ isForm?: boolean;
54
+ className?: string;
55
+ id?: string | number;
56
+ model?: string;
57
+ widget?: string;
58
+ index?: number | string;
59
+ actionData?: {
60
+ [key: string]: any;
61
+ };
62
+ viewData?: {
63
+ [key: string]: any;
64
+ };
65
+ context?: any;
66
+ formValues?: Record<string, any>;
67
+ state?: string | undefined;
68
+ renderDetail?: (props: any) => void;
69
+ renderField?: (props: any) => void;
70
+ title?: string;
71
+ aid?: string;
72
+ isModal?: boolean;
73
+ setDomain?: any;
74
+ tab?: any;
75
+ append?: any;
76
+ onChoose?: any;
77
+ onClose?: any;
78
+ useClickOutside?: any;
79
+ isCheckBox?: boolean;
80
+ onAddNew?: any;
81
+ selectedRowKeys?: any;
82
+ setSelectedRowKeys?: any;
83
+ fields?: any;
84
+ setFields?: any;
85
+ isUploadMultiple?: boolean;
86
+ selectedTags?: any;
87
+ tableHead?: any;
88
+ searchString?: any;
89
+ hoveredIndexSearchList?: any;
90
+ groupBy?: any;
91
+ filterBy?: any;
92
+ firstDomain?: any;
93
+ groupByDomain?: any;
94
+ searchMap?: any;
95
+ page?: any;
96
+ regex?: any;
97
+ min?: string;
98
+ max?: string;
99
+ lowcase?: string;
100
+ special?: string;
101
+ upcase?: string;
102
+ digit?: string;
103
+ isEditTable?: boolean;
104
+ [key: string]: any;
105
+ }
106
+
107
+ interface GoogleLoginType {
108
+ db: string;
109
+ onSuccess: (access_token: string, refresh_token: string) => void;
110
+ }
111
+
112
+ interface ColorType {
113
+ name: string;
114
+ color: string;
115
+ id: number;
116
+ }
117
+ interface ColorWrapperControllerProps {
118
+ savePickColor: any;
119
+ defaultColor: number;
120
+ colors: ColorType[];
121
+ }
122
+
123
+ export type { ColorType, ColorWrapperControllerProps, GoogleLoginType, IInputFieldProps, ValuePropsType, WidgetPropsType };
@@ -0,0 +1,123 @@
1
+ interface ValuePropsType {
2
+ id: number | string;
3
+ display_name: number | string;
4
+ [key: string]: any;
5
+ }
6
+ interface IInputFieldProps {
7
+ name?: string;
8
+ type?: string;
9
+ readonly?: boolean;
10
+ required?: boolean;
11
+ placeholder?: string;
12
+ defaultValue?: string | number | ValuePropsType;
13
+ invisible?: boolean;
14
+ methods?: any;
15
+ onChange?: (name: string, value: any) => void;
16
+ onBlur?: Function;
17
+ onRefetch?: Function;
18
+ isForm?: boolean;
19
+ className?: string;
20
+ value?: string | number | ValuePropsType | null | Record<any, any> | any;
21
+ string?: string;
22
+ isEditTable?: boolean;
23
+ }
24
+ interface WidgetPropsType {
25
+ name?: string;
26
+ type?: string;
27
+ readonly?: boolean;
28
+ required?: boolean;
29
+ placeholder?: string;
30
+ translate?: boolean;
31
+ change_default?: boolean;
32
+ groupable?: boolean;
33
+ searchable?: boolean;
34
+ sortable?: boolean;
35
+ store?: boolean;
36
+ string?: string;
37
+ trim?: boolean;
38
+ relation?: string;
39
+ domain?: string | [] | any;
40
+ selection?: [string | number, string][] | any;
41
+ help?: string;
42
+ relation_field?: string;
43
+ related?: string;
44
+ aggregator?: string;
45
+ options?: string;
46
+ value?: string | number | ValuePropsType | null | Record<any, any> | any;
47
+ defaultValue?: string | number | ValuePropsType;
48
+ invisible?: boolean;
49
+ methods?: any;
50
+ onChange?: (name: string, value: any) => void;
51
+ onBlur?: Function;
52
+ onRefetch?: Function;
53
+ isForm?: boolean;
54
+ className?: string;
55
+ id?: string | number;
56
+ model?: string;
57
+ widget?: string;
58
+ index?: number | string;
59
+ actionData?: {
60
+ [key: string]: any;
61
+ };
62
+ viewData?: {
63
+ [key: string]: any;
64
+ };
65
+ context?: any;
66
+ formValues?: Record<string, any>;
67
+ state?: string | undefined;
68
+ renderDetail?: (props: any) => void;
69
+ renderField?: (props: any) => void;
70
+ title?: string;
71
+ aid?: string;
72
+ isModal?: boolean;
73
+ setDomain?: any;
74
+ tab?: any;
75
+ append?: any;
76
+ onChoose?: any;
77
+ onClose?: any;
78
+ useClickOutside?: any;
79
+ isCheckBox?: boolean;
80
+ onAddNew?: any;
81
+ selectedRowKeys?: any;
82
+ setSelectedRowKeys?: any;
83
+ fields?: any;
84
+ setFields?: any;
85
+ isUploadMultiple?: boolean;
86
+ selectedTags?: any;
87
+ tableHead?: any;
88
+ searchString?: any;
89
+ hoveredIndexSearchList?: any;
90
+ groupBy?: any;
91
+ filterBy?: any;
92
+ firstDomain?: any;
93
+ groupByDomain?: any;
94
+ searchMap?: any;
95
+ page?: any;
96
+ regex?: any;
97
+ min?: string;
98
+ max?: string;
99
+ lowcase?: string;
100
+ special?: string;
101
+ upcase?: string;
102
+ digit?: string;
103
+ isEditTable?: boolean;
104
+ [key: string]: any;
105
+ }
106
+
107
+ interface GoogleLoginType {
108
+ db: string;
109
+ onSuccess: (access_token: string, refresh_token: string) => void;
110
+ }
111
+
112
+ interface ColorType {
113
+ name: string;
114
+ color: string;
115
+ id: number;
116
+ }
117
+ interface ColorWrapperControllerProps {
118
+ savePickColor: any;
119
+ defaultColor: number;
120
+ colors: ColorType[];
121
+ }
122
+
123
+ export type { ColorType, ColorWrapperControllerProps, GoogleLoginType, IInputFieldProps, ValuePropsType, WidgetPropsType };
package/dist/types.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
package/dist/types.mjs ADDED
File without changes
package/package.json CHANGED
@@ -1,34 +1,29 @@
1
1
  {
2
2
  "name": "@fctc/widget-logic",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
+ "types": "dist/index.d.ts",
4
5
  "main": "dist/index.cjs",
5
6
  "module": "dist/index.mjs",
6
- "types": "dist/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
9
  "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.mjs",
11
11
  "require": "./dist/index.cjs"
12
12
  },
13
- "./action": {
14
- "types": "./dist/action.d.ts",
15
- "import": "./dist/action.mjs",
16
- "require": "./dist/action.cjs"
17
- },
18
- "./form": {
19
- "types": "./dist/form.d.ts",
20
- "import": "./dist/form.mjs",
21
- "require": "./dist/form.cjs"
13
+ "./hooks": {
14
+ "types": "./dist/hooks.d.ts",
15
+ "import": "./dist/hooks.mjs",
16
+ "require": "./dist/hooks.cjs"
22
17
  },
23
- "./table": {
24
- "types": "./dist/table.d.ts",
25
- "import": "./dist/table.mjs",
26
- "require": "./dist/table.cjs"
18
+ "./types": {
19
+ "types": "./dist/types.d.ts",
20
+ "import": "./dist/types.mjs",
21
+ "require": "./dist/types.cjs"
27
22
  },
28
- "./common": {
29
- "types": "./dist/common.d.ts",
30
- "import": "./dist/common.mjs",
31
- "require": "./dist/common.cjs"
23
+ "./widget": {
24
+ "types": "./dist/widget.d.ts",
25
+ "import": "./dist/widget.mjs",
26
+ "require": "./dist/widget.cjs"
32
27
  }
33
28
  },
34
29
  "files": [
@@ -39,7 +34,12 @@
39
34
  "test": "jest"
40
35
  },
41
36
  "dependencies": {
42
- "@fctc/interface-logic": "^1.0.4"
37
+ "@fctc/interface-logic": "^1.0.4",
38
+ "@headlessui/react": "^2.2.6",
39
+ "@types/react-dom": "^19.1.7",
40
+ "react-datepicker": "^8.4.0",
41
+ "react-dom": "^19.1.1",
42
+ "react-tooltip": "^5.29.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/react": "18.0.0",
package/dist/action.d.mts DELETED
@@ -1,68 +0,0 @@
1
- interface UseArchieveProps {
2
- data: {
3
- method: string;
4
- model: string;
5
- ids: number[];
6
- context: any;
7
- actionName: 'archive' | 'unarchive';
8
- };
9
- onSuccess?: (res: any) => void;
10
- onError?: (err: any) => void;
11
- onSettled?: (err: any) => void;
12
- }
13
- declare const useArchieveHandler: ({ data, onSuccess, onError, onSettled, }: UseArchieveProps) => () => void;
14
-
15
- interface UseDuplicateRowProps {
16
- data: {
17
- model: string;
18
- ids: any;
19
- context: any;
20
- };
21
- onSuccess?: (res: any) => void;
22
- onError?: (err: any) => void;
23
- onSettled?: (err: any) => void;
24
- }
25
- declare const useDuplicateRowHandler: ({ data, onSuccess, onError, onSettled, }: UseDuplicateRowProps) => () => void;
26
-
27
- interface UseGetFieldExportProps {
28
- data: {
29
- ids: number[];
30
- model: string;
31
- isShow?: boolean;
32
- fieldType?: any;
33
- importCompat?: boolean;
34
- name?: string;
35
- parentField?: any;
36
- parentName?: string;
37
- prefix?: any;
38
- context?: any;
39
- };
40
- onSuccess?: (res: any) => void;
41
- onError?: (err: any) => void;
42
- onSettled?: (err: any) => void;
43
- }
44
- declare const useGetFieldExportHandler: ({ data, onSuccess, onError, onSettled, }: UseGetFieldExportProps) => () => void;
45
-
46
- interface UseExportExcelProps {
47
- data: {
48
- context: any;
49
- model: string;
50
- fields: {
51
- name: string;
52
- label: string;
53
- type: string;
54
- }[];
55
- domain: any;
56
- title?: string;
57
- ids?: number[];
58
- groupby?: any;
59
- importCompat?: boolean;
60
- type?: 'xlsx' | 'csv';
61
- };
62
- onSuccess?: (res: any) => void;
63
- onError?: (err: any) => void;
64
- onSettled?: (err: any) => void;
65
- }
66
- declare const useExportExcelHandler: ({ data, onSuccess, onError, onSettled, }: UseExportExcelProps) => () => void;
67
-
68
- export { useArchieveHandler, useDuplicateRowHandler, useExportExcelHandler, useGetFieldExportHandler };
package/dist/action.d.ts DELETED
@@ -1,68 +0,0 @@
1
- interface UseArchieveProps {
2
- data: {
3
- method: string;
4
- model: string;
5
- ids: number[];
6
- context: any;
7
- actionName: 'archive' | 'unarchive';
8
- };
9
- onSuccess?: (res: any) => void;
10
- onError?: (err: any) => void;
11
- onSettled?: (err: any) => void;
12
- }
13
- declare const useArchieveHandler: ({ data, onSuccess, onError, onSettled, }: UseArchieveProps) => () => void;
14
-
15
- interface UseDuplicateRowProps {
16
- data: {
17
- model: string;
18
- ids: any;
19
- context: any;
20
- };
21
- onSuccess?: (res: any) => void;
22
- onError?: (err: any) => void;
23
- onSettled?: (err: any) => void;
24
- }
25
- declare const useDuplicateRowHandler: ({ data, onSuccess, onError, onSettled, }: UseDuplicateRowProps) => () => void;
26
-
27
- interface UseGetFieldExportProps {
28
- data: {
29
- ids: number[];
30
- model: string;
31
- isShow?: boolean;
32
- fieldType?: any;
33
- importCompat?: boolean;
34
- name?: string;
35
- parentField?: any;
36
- parentName?: string;
37
- prefix?: any;
38
- context?: any;
39
- };
40
- onSuccess?: (res: any) => void;
41
- onError?: (err: any) => void;
42
- onSettled?: (err: any) => void;
43
- }
44
- declare const useGetFieldExportHandler: ({ data, onSuccess, onError, onSettled, }: UseGetFieldExportProps) => () => void;
45
-
46
- interface UseExportExcelProps {
47
- data: {
48
- context: any;
49
- model: string;
50
- fields: {
51
- name: string;
52
- label: string;
53
- type: string;
54
- }[];
55
- domain: any;
56
- title?: string;
57
- ids?: number[];
58
- groupby?: any;
59
- importCompat?: boolean;
60
- type?: 'xlsx' | 'csv';
61
- };
62
- onSuccess?: (res: any) => void;
63
- onError?: (err: any) => void;
64
- onSettled?: (err: any) => void;
65
- }
66
- declare const useExportExcelHandler: ({ data, onSuccess, onError, onSettled, }: UseExportExcelProps) => () => void;
67
-
68
- export { useArchieveHandler, useDuplicateRowHandler, useExportExcelHandler, useGetFieldExportHandler };
package/dist/action.js DELETED
@@ -1,152 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/action.ts
21
- var action_exports = {};
22
- __export(action_exports, {
23
- useArchieveHandler: () => useArchieveHandler,
24
- useDuplicateRowHandler: () => useDuplicateRowHandler,
25
- useExportExcelHandler: () => useExportExcelHandler,
26
- useGetFieldExportHandler: () => useGetFieldExportHandler
27
- });
28
- module.exports = __toCommonJS(action_exports);
29
-
30
- // src/action/use-archieve-row.ts
31
- var import_interface_logic = require("@fctc/interface-logic");
32
- var useArchieveHandler = ({
33
- data,
34
- onSuccess,
35
- onError,
36
- onSettled
37
- }) => {
38
- const archieve = (0, import_interface_logic.useButton)();
39
- const handleDuplicateRecord = () => {
40
- archieve.mutate(
41
- {
42
- method: `action_${data.actionName}`,
43
- model: data.model,
44
- ids: Array.isArray(data.ids) ? [...data.ids] : data.ids,
45
- context: data.context
46
- },
47
- {
48
- onSuccess,
49
- onError,
50
- onSettled
51
- }
52
- );
53
- };
54
- return handleDuplicateRecord;
55
- };
56
-
57
- // src/action/use-duplicate-row.ts
58
- var import_interface_logic2 = require("@fctc/interface-logic");
59
- var useDuplicateRowHandler = ({
60
- data,
61
- onSuccess,
62
- onError,
63
- onSettled
64
- }) => {
65
- const duplicateRecord = (0, import_interface_logic2.useDuplicateRecord)();
66
- const handleDuplicateRecord = () => {
67
- duplicateRecord.mutate(
68
- {
69
- model: data.model,
70
- id: Array.isArray(data.ids) ? [...data.ids] : data.ids,
71
- context: data.context
72
- },
73
- {
74
- onSuccess,
75
- onError,
76
- onSettled
77
- }
78
- );
79
- };
80
- return handleDuplicateRecord;
81
- };
82
-
83
- // src/action/use-get-field-export.ts
84
- var import_interface_logic3 = require("@fctc/interface-logic");
85
- var useGetFieldExportHandler = ({
86
- data,
87
- onSuccess,
88
- onError,
89
- onSettled
90
- }) => {
91
- const fieldExport = (0, import_interface_logic3.useGetFieldExport)();
92
- const handleGetFieldExport = () => {
93
- fieldExport.mutate(
94
- {
95
- context: data.context,
96
- ids: data.ids,
97
- model: data.model,
98
- isShow: data.isShow,
99
- fieldType: data.fieldType,
100
- importCompat: data.importCompat,
101
- name: data.name,
102
- parentField: data.parentField,
103
- parentName: data.parentName,
104
- prefix: data.prefix
105
- },
106
- {
107
- onSuccess,
108
- onError,
109
- onSettled
110
- }
111
- );
112
- };
113
- return handleGetFieldExport;
114
- };
115
-
116
- // src/action/use-export-excel.ts
117
- var import_interface_logic4 = require("@fctc/interface-logic");
118
- var useExportExcelHandler = ({
119
- data,
120
- onSuccess,
121
- onError,
122
- onSettled
123
- }) => {
124
- const exportExcel = (0, import_interface_logic4.useExportExcel)();
125
- const handleExport = () => {
126
- exportExcel.mutate(
127
- {
128
- model: data.model,
129
- ids: data?.ids,
130
- fields: data.fields,
131
- domain: (0, import_interface_logic4.evalJSONDomain)(data.domain, data.context),
132
- importCompat: data?.importCompat,
133
- type: data.type,
134
- context: data.context,
135
- groupby: data?.groupby
136
- },
137
- {
138
- onSuccess,
139
- onError,
140
- onSettled
141
- }
142
- );
143
- };
144
- return handleExport;
145
- };
146
- // Annotate the CommonJS export names for ESM import in node:
147
- 0 && (module.exports = {
148
- useArchieveHandler,
149
- useDuplicateRowHandler,
150
- useExportExcelHandler,
151
- useGetFieldExportHandler
152
- });