@fctc/widget-logic 1.0.3 → 1.0.4
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/action.d.mts +12 -4
- package/dist/action.d.ts +12 -4
- package/dist/action.js +21 -13
- package/dist/action.mjs +21 -13
- package/dist/table.js +2191 -1
- package/dist/table.mjs +2208 -5
- package/package.json +4 -6
package/dist/action.d.mts
CHANGED
|
@@ -3,22 +3,26 @@ interface UseArchieveProps {
|
|
|
3
3
|
method: string;
|
|
4
4
|
model: string;
|
|
5
5
|
ids: number[];
|
|
6
|
+
context: any;
|
|
6
7
|
actionName: 'archieve' | 'unarchive';
|
|
7
8
|
};
|
|
8
9
|
onSuccess?: (res: any) => void;
|
|
9
10
|
onError?: (err: any) => void;
|
|
11
|
+
onSettled?: (err: any) => void;
|
|
10
12
|
}
|
|
11
|
-
declare const useArchieveHandler: ({ data, onSuccess, onError, }: UseArchieveProps) => () => void;
|
|
13
|
+
declare const useArchieveHandler: ({ data, onSuccess, onError, onSettled, }: UseArchieveProps) => () => void;
|
|
12
14
|
|
|
13
15
|
interface UseDuplicateRowProps {
|
|
14
16
|
data: {
|
|
15
17
|
model: string;
|
|
16
18
|
ids: any;
|
|
19
|
+
context: any;
|
|
17
20
|
};
|
|
18
21
|
onSuccess?: (res: any) => void;
|
|
19
22
|
onError?: (err: any) => void;
|
|
23
|
+
onSettled?: (err: any) => void;
|
|
20
24
|
}
|
|
21
|
-
declare const useDuplicateRowHandler: ({ data, onSuccess, onError, }: UseDuplicateRowProps) => () => void;
|
|
25
|
+
declare const useDuplicateRowHandler: ({ data, onSuccess, onError, onSettled, }: UseDuplicateRowProps) => () => void;
|
|
22
26
|
|
|
23
27
|
interface UseGetFieldExportProps {
|
|
24
28
|
data: {
|
|
@@ -31,14 +35,17 @@ interface UseGetFieldExportProps {
|
|
|
31
35
|
parentField?: any;
|
|
32
36
|
parentName?: string;
|
|
33
37
|
prefix?: any;
|
|
38
|
+
context?: any;
|
|
34
39
|
};
|
|
35
40
|
onSuccess?: (res: any) => void;
|
|
36
41
|
onError?: (err: any) => void;
|
|
42
|
+
onSettled?: (err: any) => void;
|
|
37
43
|
}
|
|
38
|
-
declare const useGetFieldExportHandler: ({ data, onSuccess, onError, }: UseGetFieldExportProps) => () => void;
|
|
44
|
+
declare const useGetFieldExportHandler: ({ data, onSuccess, onError, onSettled, }: UseGetFieldExportProps) => () => void;
|
|
39
45
|
|
|
40
46
|
interface UseExportExcelProps {
|
|
41
47
|
data: {
|
|
48
|
+
context: any;
|
|
42
49
|
model: string;
|
|
43
50
|
fields: {
|
|
44
51
|
name: string;
|
|
@@ -54,7 +61,8 @@ interface UseExportExcelProps {
|
|
|
54
61
|
};
|
|
55
62
|
onSuccess?: (res: any) => void;
|
|
56
63
|
onError?: (err: any) => void;
|
|
64
|
+
onSettled?: (err: any) => void;
|
|
57
65
|
}
|
|
58
|
-
declare const useExportExcelHandler: ({ data, onSuccess, onError, }: UseExportExcelProps) => () => void;
|
|
66
|
+
declare const useExportExcelHandler: ({ data, onSuccess, onError, onSettled, }: UseExportExcelProps) => () => void;
|
|
59
67
|
|
|
60
68
|
export { useArchieveHandler, useDuplicateRowHandler, useExportExcelHandler, useGetFieldExportHandler };
|
package/dist/action.d.ts
CHANGED
|
@@ -3,22 +3,26 @@ interface UseArchieveProps {
|
|
|
3
3
|
method: string;
|
|
4
4
|
model: string;
|
|
5
5
|
ids: number[];
|
|
6
|
+
context: any;
|
|
6
7
|
actionName: 'archieve' | 'unarchive';
|
|
7
8
|
};
|
|
8
9
|
onSuccess?: (res: any) => void;
|
|
9
10
|
onError?: (err: any) => void;
|
|
11
|
+
onSettled?: (err: any) => void;
|
|
10
12
|
}
|
|
11
|
-
declare const useArchieveHandler: ({ data, onSuccess, onError, }: UseArchieveProps) => () => void;
|
|
13
|
+
declare const useArchieveHandler: ({ data, onSuccess, onError, onSettled, }: UseArchieveProps) => () => void;
|
|
12
14
|
|
|
13
15
|
interface UseDuplicateRowProps {
|
|
14
16
|
data: {
|
|
15
17
|
model: string;
|
|
16
18
|
ids: any;
|
|
19
|
+
context: any;
|
|
17
20
|
};
|
|
18
21
|
onSuccess?: (res: any) => void;
|
|
19
22
|
onError?: (err: any) => void;
|
|
23
|
+
onSettled?: (err: any) => void;
|
|
20
24
|
}
|
|
21
|
-
declare const useDuplicateRowHandler: ({ data, onSuccess, onError, }: UseDuplicateRowProps) => () => void;
|
|
25
|
+
declare const useDuplicateRowHandler: ({ data, onSuccess, onError, onSettled, }: UseDuplicateRowProps) => () => void;
|
|
22
26
|
|
|
23
27
|
interface UseGetFieldExportProps {
|
|
24
28
|
data: {
|
|
@@ -31,14 +35,17 @@ interface UseGetFieldExportProps {
|
|
|
31
35
|
parentField?: any;
|
|
32
36
|
parentName?: string;
|
|
33
37
|
prefix?: any;
|
|
38
|
+
context?: any;
|
|
34
39
|
};
|
|
35
40
|
onSuccess?: (res: any) => void;
|
|
36
41
|
onError?: (err: any) => void;
|
|
42
|
+
onSettled?: (err: any) => void;
|
|
37
43
|
}
|
|
38
|
-
declare const useGetFieldExportHandler: ({ data, onSuccess, onError, }: UseGetFieldExportProps) => () => void;
|
|
44
|
+
declare const useGetFieldExportHandler: ({ data, onSuccess, onError, onSettled, }: UseGetFieldExportProps) => () => void;
|
|
39
45
|
|
|
40
46
|
interface UseExportExcelProps {
|
|
41
47
|
data: {
|
|
48
|
+
context: any;
|
|
42
49
|
model: string;
|
|
43
50
|
fields: {
|
|
44
51
|
name: string;
|
|
@@ -54,7 +61,8 @@ interface UseExportExcelProps {
|
|
|
54
61
|
};
|
|
55
62
|
onSuccess?: (res: any) => void;
|
|
56
63
|
onError?: (err: any) => void;
|
|
64
|
+
onSettled?: (err: any) => void;
|
|
57
65
|
}
|
|
58
|
-
declare const useExportExcelHandler: ({ data, onSuccess, onError, }: UseExportExcelProps) => () => void;
|
|
66
|
+
declare const useExportExcelHandler: ({ data, onSuccess, onError, onSettled, }: UseExportExcelProps) => () => void;
|
|
59
67
|
|
|
60
68
|
export { useArchieveHandler, useDuplicateRowHandler, useExportExcelHandler, useGetFieldExportHandler };
|
package/dist/action.js
CHANGED
|
@@ -32,7 +32,8 @@ var import_interface_logic = require("@fctc/interface-logic");
|
|
|
32
32
|
var useArchieveHandler = ({
|
|
33
33
|
data,
|
|
34
34
|
onSuccess,
|
|
35
|
-
onError
|
|
35
|
+
onError,
|
|
36
|
+
onSettled
|
|
36
37
|
}) => {
|
|
37
38
|
const archieve = (0, import_interface_logic.useButton)();
|
|
38
39
|
const env = (0, import_interface_logic.getEnv)();
|
|
@@ -42,11 +43,12 @@ var useArchieveHandler = ({
|
|
|
42
43
|
method: `action_${data.actionName}`,
|
|
43
44
|
model: data.model,
|
|
44
45
|
ids: Array.isArray(data.ids) ? [...data.ids] : data.ids,
|
|
45
|
-
context:
|
|
46
|
+
context: data.context
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
onSuccess,
|
|
49
|
-
onError
|
|
50
|
+
onError,
|
|
51
|
+
onSettled
|
|
50
52
|
}
|
|
51
53
|
);
|
|
52
54
|
};
|
|
@@ -58,7 +60,8 @@ var import_interface_logic2 = require("@fctc/interface-logic");
|
|
|
58
60
|
var useDuplicateRowHandler = ({
|
|
59
61
|
data,
|
|
60
62
|
onSuccess,
|
|
61
|
-
onError
|
|
63
|
+
onError,
|
|
64
|
+
onSettled
|
|
62
65
|
}) => {
|
|
63
66
|
const duplicateRecord = (0, import_interface_logic2.useDuplicateRecord)();
|
|
64
67
|
const env = (0, import_interface_logic2.getEnv)();
|
|
@@ -67,11 +70,12 @@ var useDuplicateRowHandler = ({
|
|
|
67
70
|
{
|
|
68
71
|
model: data.model,
|
|
69
72
|
id: Array.isArray(data.ids) ? [...data.ids] : data.ids,
|
|
70
|
-
context:
|
|
73
|
+
context: data.context
|
|
71
74
|
},
|
|
72
75
|
{
|
|
73
76
|
onSuccess,
|
|
74
|
-
onError
|
|
77
|
+
onError,
|
|
78
|
+
onSettled
|
|
75
79
|
}
|
|
76
80
|
);
|
|
77
81
|
};
|
|
@@ -83,14 +87,15 @@ var import_interface_logic3 = require("@fctc/interface-logic");
|
|
|
83
87
|
var useGetFieldExportHandler = ({
|
|
84
88
|
data,
|
|
85
89
|
onSuccess,
|
|
86
|
-
onError
|
|
90
|
+
onError,
|
|
91
|
+
onSettled
|
|
87
92
|
}) => {
|
|
88
93
|
const fieldExport = (0, import_interface_logic3.useGetFieldExport)();
|
|
89
94
|
const env = (0, import_interface_logic3.getEnv)();
|
|
90
95
|
const handleGetFieldExport = () => {
|
|
91
96
|
fieldExport.mutate(
|
|
92
97
|
{
|
|
93
|
-
context:
|
|
98
|
+
context: data.context,
|
|
94
99
|
ids: data.ids,
|
|
95
100
|
model: data.model,
|
|
96
101
|
isShow: data.isShow,
|
|
@@ -103,7 +108,8 @@ var useGetFieldExportHandler = ({
|
|
|
103
108
|
},
|
|
104
109
|
{
|
|
105
110
|
onSuccess,
|
|
106
|
-
onError
|
|
111
|
+
onError,
|
|
112
|
+
onSettled
|
|
107
113
|
}
|
|
108
114
|
);
|
|
109
115
|
};
|
|
@@ -115,7 +121,8 @@ var import_interface_logic4 = require("@fctc/interface-logic");
|
|
|
115
121
|
var useExportExcelHandler = ({
|
|
116
122
|
data,
|
|
117
123
|
onSuccess,
|
|
118
|
-
onError
|
|
124
|
+
onError,
|
|
125
|
+
onSettled
|
|
119
126
|
}) => {
|
|
120
127
|
const exportExcel = (0, import_interface_logic4.useExportExcel)();
|
|
121
128
|
const env = (0, import_interface_logic4.getEnv)();
|
|
@@ -125,15 +132,16 @@ var useExportExcelHandler = ({
|
|
|
125
132
|
model: data.model,
|
|
126
133
|
ids: data?.ids,
|
|
127
134
|
fields: data.fields,
|
|
128
|
-
domain: (0, import_interface_logic4.evalJSONDomain)(data.domain,
|
|
135
|
+
domain: (0, import_interface_logic4.evalJSONDomain)(data.domain, data.context),
|
|
129
136
|
importCompat: data?.importCompat,
|
|
130
137
|
type: data.type,
|
|
131
|
-
context:
|
|
138
|
+
context: data.context,
|
|
132
139
|
groupby: data?.groupby
|
|
133
140
|
},
|
|
134
141
|
{
|
|
135
142
|
onSuccess,
|
|
136
|
-
onError
|
|
143
|
+
onError,
|
|
144
|
+
onSettled
|
|
137
145
|
}
|
|
138
146
|
);
|
|
139
147
|
};
|
package/dist/action.mjs
CHANGED
|
@@ -3,7 +3,8 @@ import { getEnv, useButton } from "@fctc/interface-logic";
|
|
|
3
3
|
var useArchieveHandler = ({
|
|
4
4
|
data,
|
|
5
5
|
onSuccess,
|
|
6
|
-
onError
|
|
6
|
+
onError,
|
|
7
|
+
onSettled
|
|
7
8
|
}) => {
|
|
8
9
|
const archieve = useButton();
|
|
9
10
|
const env = getEnv();
|
|
@@ -13,11 +14,12 @@ var useArchieveHandler = ({
|
|
|
13
14
|
method: `action_${data.actionName}`,
|
|
14
15
|
model: data.model,
|
|
15
16
|
ids: Array.isArray(data.ids) ? [...data.ids] : data.ids,
|
|
16
|
-
context:
|
|
17
|
+
context: data.context
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
onSuccess,
|
|
20
|
-
onError
|
|
21
|
+
onError,
|
|
22
|
+
onSettled
|
|
21
23
|
}
|
|
22
24
|
);
|
|
23
25
|
};
|
|
@@ -29,7 +31,8 @@ import { getEnv as getEnv2, useDuplicateRecord } from "@fctc/interface-logic";
|
|
|
29
31
|
var useDuplicateRowHandler = ({
|
|
30
32
|
data,
|
|
31
33
|
onSuccess,
|
|
32
|
-
onError
|
|
34
|
+
onError,
|
|
35
|
+
onSettled
|
|
33
36
|
}) => {
|
|
34
37
|
const duplicateRecord = useDuplicateRecord();
|
|
35
38
|
const env = getEnv2();
|
|
@@ -38,11 +41,12 @@ var useDuplicateRowHandler = ({
|
|
|
38
41
|
{
|
|
39
42
|
model: data.model,
|
|
40
43
|
id: Array.isArray(data.ids) ? [...data.ids] : data.ids,
|
|
41
|
-
context:
|
|
44
|
+
context: data.context
|
|
42
45
|
},
|
|
43
46
|
{
|
|
44
47
|
onSuccess,
|
|
45
|
-
onError
|
|
48
|
+
onError,
|
|
49
|
+
onSettled
|
|
46
50
|
}
|
|
47
51
|
);
|
|
48
52
|
};
|
|
@@ -54,14 +58,15 @@ import { getEnv as getEnv3, useGetFieldExport } from "@fctc/interface-logic";
|
|
|
54
58
|
var useGetFieldExportHandler = ({
|
|
55
59
|
data,
|
|
56
60
|
onSuccess,
|
|
57
|
-
onError
|
|
61
|
+
onError,
|
|
62
|
+
onSettled
|
|
58
63
|
}) => {
|
|
59
64
|
const fieldExport = useGetFieldExport();
|
|
60
65
|
const env = getEnv3();
|
|
61
66
|
const handleGetFieldExport = () => {
|
|
62
67
|
fieldExport.mutate(
|
|
63
68
|
{
|
|
64
|
-
context:
|
|
69
|
+
context: data.context,
|
|
65
70
|
ids: data.ids,
|
|
66
71
|
model: data.model,
|
|
67
72
|
isShow: data.isShow,
|
|
@@ -74,7 +79,8 @@ var useGetFieldExportHandler = ({
|
|
|
74
79
|
},
|
|
75
80
|
{
|
|
76
81
|
onSuccess,
|
|
77
|
-
onError
|
|
82
|
+
onError,
|
|
83
|
+
onSettled
|
|
78
84
|
}
|
|
79
85
|
);
|
|
80
86
|
};
|
|
@@ -86,7 +92,8 @@ import { evalJSONDomain, getEnv as getEnv4, useExportExcel } from "@fctc/interfa
|
|
|
86
92
|
var useExportExcelHandler = ({
|
|
87
93
|
data,
|
|
88
94
|
onSuccess,
|
|
89
|
-
onError
|
|
95
|
+
onError,
|
|
96
|
+
onSettled
|
|
90
97
|
}) => {
|
|
91
98
|
const exportExcel = useExportExcel();
|
|
92
99
|
const env = getEnv4();
|
|
@@ -96,15 +103,16 @@ var useExportExcelHandler = ({
|
|
|
96
103
|
model: data.model,
|
|
97
104
|
ids: data?.ids,
|
|
98
105
|
fields: data.fields,
|
|
99
|
-
domain: evalJSONDomain(data.domain,
|
|
106
|
+
domain: evalJSONDomain(data.domain, data.context),
|
|
100
107
|
importCompat: data?.importCompat,
|
|
101
108
|
type: data.type,
|
|
102
|
-
context:
|
|
109
|
+
context: data.context,
|
|
103
110
|
groupby: data?.groupby
|
|
104
111
|
},
|
|
105
112
|
{
|
|
106
113
|
onSuccess,
|
|
107
|
-
onError
|
|
114
|
+
onError,
|
|
115
|
+
onSettled
|
|
108
116
|
}
|
|
109
117
|
);
|
|
110
118
|
};
|