@fctc/widget-logic 1.4.0 → 1.4.1
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/config.d.mts +6 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +24 -0
- package/dist/config.mjs +2 -0
- package/dist/constants.d.mts +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +24 -0
- package/dist/constants.mjs +2 -0
- package/dist/environment.d.mts +1 -0
- package/dist/environment.d.ts +1 -0
- package/dist/environment.js +24 -0
- package/dist/environment.mjs +2 -0
- package/dist/hooks.d.mts +969 -0
- package/dist/hooks.d.ts +969 -0
- package/dist/hooks.js +743 -0
- package/dist/hooks.mjs +717 -0
- package/dist/icons.d.mts +9 -0
- package/dist/icons.d.ts +9 -0
- package/dist/icons.js +139 -0
- package/dist/icons.mjs +110 -0
- package/dist/index.d.mts +2 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.js +0 -364
- package/dist/index.mjs +0 -330
- package/dist/provider.d.mts +1 -0
- package/dist/provider.d.ts +1 -0
- package/dist/provider.js +24 -0
- package/dist/provider.mjs +2 -0
- package/dist/services.d.mts +1 -0
- package/dist/services.d.ts +1 -0
- package/dist/services.js +24 -0
- package/dist/services.mjs +2 -0
- package/dist/store.d.mts +1 -0
- package/dist/store.d.ts +1 -0
- package/dist/store.js +24 -0
- package/dist/store.mjs +2 -0
- package/dist/utils.d.mts +38 -0
- package/dist/utils.d.ts +38 -0
- package/dist/utils.js +282 -0
- package/dist/utils.mjs +242 -0
- package/package.json +60 -22
- package/dist/action.d.mts +0 -68
- package/dist/action.d.ts +0 -68
- package/dist/action.js +0 -152
- package/dist/action.mjs +0 -122
- package/dist/common.d.mts +0 -13
- package/dist/common.d.ts +0 -13
- package/dist/common.js +0 -60
- package/dist/common.mjs +0 -33
- package/dist/form.d.mts +0 -41
- package/dist/form.d.ts +0 -41
- package/dist/form.js +0 -116
- package/dist/form.mjs +0 -87
- package/dist/table.d.mts +0 -22
- package/dist/table.d.ts +0 -22
- package/dist/table.js +0 -118
- package/dist/table.mjs +0 -91
package/dist/index.mjs
CHANGED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
// src/action/use-archieve-row.ts
|
|
2
|
-
import { useButton } from "@fctc/interface-logic";
|
|
3
|
-
var useArchieveHandler = ({
|
|
4
|
-
data,
|
|
5
|
-
onSuccess,
|
|
6
|
-
onError,
|
|
7
|
-
onSettled
|
|
8
|
-
}) => {
|
|
9
|
-
const archieve = useButton();
|
|
10
|
-
const handleDuplicateRecord = () => {
|
|
11
|
-
archieve.mutate(
|
|
12
|
-
{
|
|
13
|
-
method: `action_${data.actionName}`,
|
|
14
|
-
model: data.model,
|
|
15
|
-
ids: Array.isArray(data.ids) ? [...data.ids] : data.ids,
|
|
16
|
-
context: data.context
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
onSuccess,
|
|
20
|
-
onError,
|
|
21
|
-
onSettled
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
return handleDuplicateRecord;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// src/action/use-duplicate-row.ts
|
|
29
|
-
import { useDuplicateRecord } from "@fctc/interface-logic";
|
|
30
|
-
var useDuplicateRowHandler = ({
|
|
31
|
-
data,
|
|
32
|
-
onSuccess,
|
|
33
|
-
onError,
|
|
34
|
-
onSettled
|
|
35
|
-
}) => {
|
|
36
|
-
const duplicateRecord = useDuplicateRecord();
|
|
37
|
-
const handleDuplicateRecord = () => {
|
|
38
|
-
duplicateRecord.mutate(
|
|
39
|
-
{
|
|
40
|
-
model: data.model,
|
|
41
|
-
id: Array.isArray(data.ids) ? [...data.ids] : data.ids,
|
|
42
|
-
context: data.context
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
onSuccess,
|
|
46
|
-
onError,
|
|
47
|
-
onSettled
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
return handleDuplicateRecord;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// src/action/use-get-field-export.ts
|
|
55
|
-
import { useGetFieldExport } from "@fctc/interface-logic";
|
|
56
|
-
var useGetFieldExportHandler = ({
|
|
57
|
-
data,
|
|
58
|
-
onSuccess,
|
|
59
|
-
onError,
|
|
60
|
-
onSettled
|
|
61
|
-
}) => {
|
|
62
|
-
const fieldExport = useGetFieldExport();
|
|
63
|
-
const handleGetFieldExport = () => {
|
|
64
|
-
fieldExport.mutate(
|
|
65
|
-
{
|
|
66
|
-
context: data.context,
|
|
67
|
-
ids: data.ids,
|
|
68
|
-
model: data.model,
|
|
69
|
-
isShow: data.isShow,
|
|
70
|
-
fieldType: data.fieldType,
|
|
71
|
-
importCompat: data.importCompat,
|
|
72
|
-
name: data.name,
|
|
73
|
-
parentField: data.parentField,
|
|
74
|
-
parentName: data.parentName,
|
|
75
|
-
prefix: data.prefix
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
onSuccess,
|
|
79
|
-
onError,
|
|
80
|
-
onSettled
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
return handleGetFieldExport;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// src/action/use-export-excel.ts
|
|
88
|
-
import { evalJSONDomain, useExportExcel } from "@fctc/interface-logic";
|
|
89
|
-
var useExportExcelHandler = ({
|
|
90
|
-
data,
|
|
91
|
-
onSuccess,
|
|
92
|
-
onError,
|
|
93
|
-
onSettled
|
|
94
|
-
}) => {
|
|
95
|
-
const exportExcel = useExportExcel();
|
|
96
|
-
const handleExport = () => {
|
|
97
|
-
exportExcel.mutate(
|
|
98
|
-
{
|
|
99
|
-
model: data.model,
|
|
100
|
-
ids: data?.ids,
|
|
101
|
-
fields: data.fields,
|
|
102
|
-
domain: evalJSONDomain(data.domain, data.context),
|
|
103
|
-
importCompat: data?.importCompat,
|
|
104
|
-
type: data.type,
|
|
105
|
-
context: data.context,
|
|
106
|
-
groupby: data?.groupby
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
onSuccess,
|
|
110
|
-
onError,
|
|
111
|
-
onSettled
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
};
|
|
115
|
-
return handleExport;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// src/widget/form/use-on-change-form.ts
|
|
119
|
-
import { useOnChangeForm } from "@fctc/interface-logic";
|
|
120
|
-
var UseOnChangeFormHandler = ({
|
|
121
|
-
data,
|
|
122
|
-
onSuccess,
|
|
123
|
-
onError,
|
|
124
|
-
onSettled
|
|
125
|
-
}) => {
|
|
126
|
-
const fetchOnchange = useOnChangeForm();
|
|
127
|
-
const handleOnChangeForm = () => {
|
|
128
|
-
fetchOnchange.mutate(
|
|
129
|
-
{
|
|
130
|
-
ids: data.id ? data.id : [],
|
|
131
|
-
model: data.model,
|
|
132
|
-
specification: data.specification,
|
|
133
|
-
context: data.context,
|
|
134
|
-
object: data.object,
|
|
135
|
-
fieldChange: [data.nameField]
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
onSuccess,
|
|
139
|
-
onError,
|
|
140
|
-
onSettled
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
};
|
|
144
|
-
return handleOnChangeForm;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// src/widget/form/use-save-form.ts
|
|
148
|
-
import { useSave } from "@fctc/interface-logic";
|
|
149
|
-
var useSaveFormHandler = ({
|
|
150
|
-
data,
|
|
151
|
-
onSuccess,
|
|
152
|
-
onError,
|
|
153
|
-
onSettled
|
|
154
|
-
}) => {
|
|
155
|
-
const fetchSave = useSave();
|
|
156
|
-
const handleSaveForm = () => {
|
|
157
|
-
fetchSave.mutate(
|
|
158
|
-
{
|
|
159
|
-
ids: data.id ? [data.id] : [],
|
|
160
|
-
model: data.model,
|
|
161
|
-
data,
|
|
162
|
-
specification: data.specification,
|
|
163
|
-
context: data.context
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
onSuccess,
|
|
167
|
-
onError,
|
|
168
|
-
onSettled
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
return handleSaveForm;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
// src/widget/form/use-remove-row.ts
|
|
176
|
-
import { useRemoveRow } from "@fctc/interface-logic";
|
|
177
|
-
var useRemoveRowHandler = ({
|
|
178
|
-
data,
|
|
179
|
-
onSuccess,
|
|
180
|
-
onError,
|
|
181
|
-
onSettled
|
|
182
|
-
}) => {
|
|
183
|
-
const remove = useRemoveRow();
|
|
184
|
-
const handleRemoveRow = () => {
|
|
185
|
-
remove.mutate(
|
|
186
|
-
{
|
|
187
|
-
model: data.model,
|
|
188
|
-
ids: Array.isArray(data.ids) ? [...data.ids] : data.ids,
|
|
189
|
-
context: data.context
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
onSuccess,
|
|
193
|
-
onError,
|
|
194
|
-
onSettled
|
|
195
|
-
}
|
|
196
|
-
);
|
|
197
|
-
};
|
|
198
|
-
return handleRemoveRow;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// src/widget/table/use-table.ts
|
|
202
|
-
import { domainHelper } from "@fctc/interface-logic";
|
|
203
|
-
import { useEffect, useState } from "react";
|
|
204
|
-
function mergeButtons(fields) {
|
|
205
|
-
const buttons = fields?.filter((f) => f.type_co === "button");
|
|
206
|
-
const others = fields?.filter((f) => f.type_co !== "button");
|
|
207
|
-
if (buttons?.length) {
|
|
208
|
-
others.push({
|
|
209
|
-
type_co: "buttons",
|
|
210
|
-
buttons
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
return others;
|
|
214
|
-
}
|
|
215
|
-
var useTableHandler = ({ data }) => {
|
|
216
|
-
const [rows, setRows] = useState(data.records || []);
|
|
217
|
-
const [columns, setColumns] = useState([]);
|
|
218
|
-
const dataModelFields = data.fields?.map((field) => {
|
|
219
|
-
return {
|
|
220
|
-
...data.dataModel?.[field?.name],
|
|
221
|
-
...field,
|
|
222
|
-
string: field?.string || data.dataModel?.[field?.name]?.string
|
|
223
|
-
};
|
|
224
|
-
});
|
|
225
|
-
const mergeFields = mergeButtons(dataModelFields);
|
|
226
|
-
const transformData = (dataList) => {
|
|
227
|
-
if (!dataList) return;
|
|
228
|
-
return dataList?.map((item) => {
|
|
229
|
-
const transformedItem = { ...item };
|
|
230
|
-
Object.keys(item).forEach((field) => {
|
|
231
|
-
if (field !== "__domain") {
|
|
232
|
-
if (item[field] && typeof item[field] === "object" && item[field].display_name) {
|
|
233
|
-
transformedItem[field] = item[field];
|
|
234
|
-
} else if (Array.isArray(item[field]) && item[field].length > 0) {
|
|
235
|
-
if (data.typeTable === "group" && item[field]?.length === 2 && typeof item[field]?.[1] === "string") {
|
|
236
|
-
transformedItem["string"] = item[field]?.[1];
|
|
237
|
-
}
|
|
238
|
-
transformedItem[field] = item[field];
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
useEffect(() => {
|
|
246
|
-
setRows(transformData(data.records || null));
|
|
247
|
-
}, [data.records]);
|
|
248
|
-
const handleGetColumns = () => {
|
|
249
|
-
let cols = [];
|
|
250
|
-
try {
|
|
251
|
-
cols = mergeFields?.filter((item) => {
|
|
252
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
253
|
-
})?.map((field) => {
|
|
254
|
-
return {
|
|
255
|
-
name: field?.name,
|
|
256
|
-
optional: field?.optional,
|
|
257
|
-
title: field?.type_co === "button" ? "" : field?.string,
|
|
258
|
-
field: { ...field }
|
|
259
|
-
};
|
|
260
|
-
});
|
|
261
|
-
} catch (error) {
|
|
262
|
-
console.error("Error in useTable:", error);
|
|
263
|
-
}
|
|
264
|
-
return cols;
|
|
265
|
-
};
|
|
266
|
-
useEffect(() => {
|
|
267
|
-
const columns2 = handleGetColumns();
|
|
268
|
-
setColumns(columns2);
|
|
269
|
-
}, [data.records]);
|
|
270
|
-
const onToggleColumnOptional = (item) => {
|
|
271
|
-
const tempColumn = [...columns]?.map((val) => {
|
|
272
|
-
if (item?.name === val?.name) {
|
|
273
|
-
return {
|
|
274
|
-
...val,
|
|
275
|
-
optional: item?.optional === "show" ? "hide" : "show"
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
return val;
|
|
279
|
-
});
|
|
280
|
-
setColumns(tempColumn);
|
|
281
|
-
};
|
|
282
|
-
return {
|
|
283
|
-
rows,
|
|
284
|
-
columns,
|
|
285
|
-
onToggleColumnOptional,
|
|
286
|
-
typeTable: data.typeTable
|
|
287
|
-
};
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
// src/common/use-click-outside.ts
|
|
291
|
-
import { useEffect as useEffect2, useRef } from "react";
|
|
292
|
-
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
293
|
-
var useClickOutside = ({
|
|
294
|
-
handler,
|
|
295
|
-
events = DEFAULT_EVENTS,
|
|
296
|
-
nodes = [],
|
|
297
|
-
refs
|
|
298
|
-
}) => {
|
|
299
|
-
const ref = useRef(null);
|
|
300
|
-
useEffect2(() => {
|
|
301
|
-
const listener = (event) => {
|
|
302
|
-
const { target } = event;
|
|
303
|
-
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
if (!(target instanceof HTMLElement)) return;
|
|
307
|
-
const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
|
|
308
|
-
const shouldTrigger = nodes.length > 0 ? nodes.every((node) => node && !event.composedPath().includes(node)) : ref.current && !ref.current.contains(target);
|
|
309
|
-
if (shouldTrigger && !shouldIgnore) {
|
|
310
|
-
handler(event);
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
events.forEach((event) => document.addEventListener(event, listener));
|
|
314
|
-
return () => {
|
|
315
|
-
events.forEach((event) => document.removeEventListener(event, listener));
|
|
316
|
-
};
|
|
317
|
-
}, [handler, nodes, events]);
|
|
318
|
-
return ref;
|
|
319
|
-
};
|
|
320
|
-
export {
|
|
321
|
-
UseOnChangeFormHandler,
|
|
322
|
-
useArchieveHandler,
|
|
323
|
-
useClickOutside,
|
|
324
|
-
useDuplicateRowHandler,
|
|
325
|
-
useExportExcelHandler,
|
|
326
|
-
useGetFieldExportHandler,
|
|
327
|
-
useRemoveRowHandler,
|
|
328
|
-
useSaveFormHandler,
|
|
329
|
-
useTableHandler
|
|
330
|
-
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/provider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/provider';
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/provider.ts
|
|
18
|
+
var provider_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(provider_exports);
|
|
20
|
+
__reExport(provider_exports, require("@fctc/interface-logic/provider"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("@fctc/interface-logic/provider")
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/services';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/services';
|
package/dist/services.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/services.ts
|
|
18
|
+
var services_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(services_exports);
|
|
20
|
+
__reExport(services_exports, require("@fctc/interface-logic/services"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("@fctc/interface-logic/services")
|
|
24
|
+
});
|
package/dist/store.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/store';
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/store';
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/store.ts
|
|
18
|
+
var store_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(store_exports);
|
|
20
|
+
__reExport(store_exports, require("@fctc/interface-logic/store"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("@fctc/interface-logic/store")
|
|
24
|
+
});
|
package/dist/store.mjs
ADDED
package/dist/utils.d.mts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/utils';
|
|
2
|
+
|
|
3
|
+
declare const languages: {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}[];
|
|
7
|
+
declare const API_PRESCHOOL_URL: {
|
|
8
|
+
baseURL: string;
|
|
9
|
+
};
|
|
10
|
+
declare const API_APP_URL: {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
c2: string;
|
|
13
|
+
apiV2: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const countSum: (data: any[], field: string) => number;
|
|
17
|
+
declare function mergeButtons(fields: any): any;
|
|
18
|
+
declare function useGetRowIds(tableRef: React.RefObject<HTMLTableElement | null>): {
|
|
19
|
+
rowIds: string[];
|
|
20
|
+
refresh: () => void;
|
|
21
|
+
};
|
|
22
|
+
declare const getDateRange: (currentDate: any, unit: string) => string[][];
|
|
23
|
+
declare const convertFieldsToArray: (fields: any[] | undefined | null) => any[];
|
|
24
|
+
declare function combineContexts(contexts: ({
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
} | undefined)[]): {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
} | undefined;
|
|
29
|
+
declare const STORAGES: {
|
|
30
|
+
readonly TOKEN: "accessToken";
|
|
31
|
+
readonly USER_INFO: "USER_INFO";
|
|
32
|
+
};
|
|
33
|
+
type UseStateHook<T> = [[boolean, T | null], (value: T | null) => void];
|
|
34
|
+
type StorageKey = keyof typeof STORAGES;
|
|
35
|
+
declare function setStorageItemAsync(key: StorageKey, value: string | null): Promise<void>;
|
|
36
|
+
declare function useStorageState(key: StorageKey): UseStateHook<string>;
|
|
37
|
+
|
|
38
|
+
export { API_APP_URL, API_PRESCHOOL_URL, STORAGES, combineContexts, convertFieldsToArray, countSum, getDateRange, languages, mergeButtons, setStorageItemAsync, useGetRowIds, useStorageState };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export * from '@fctc/interface-logic/utils';
|
|
2
|
+
|
|
3
|
+
declare const languages: {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}[];
|
|
7
|
+
declare const API_PRESCHOOL_URL: {
|
|
8
|
+
baseURL: string;
|
|
9
|
+
};
|
|
10
|
+
declare const API_APP_URL: {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
c2: string;
|
|
13
|
+
apiV2: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const countSum: (data: any[], field: string) => number;
|
|
17
|
+
declare function mergeButtons(fields: any): any;
|
|
18
|
+
declare function useGetRowIds(tableRef: React.RefObject<HTMLTableElement | null>): {
|
|
19
|
+
rowIds: string[];
|
|
20
|
+
refresh: () => void;
|
|
21
|
+
};
|
|
22
|
+
declare const getDateRange: (currentDate: any, unit: string) => string[][];
|
|
23
|
+
declare const convertFieldsToArray: (fields: any[] | undefined | null) => any[];
|
|
24
|
+
declare function combineContexts(contexts: ({
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
} | undefined)[]): {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
} | undefined;
|
|
29
|
+
declare const STORAGES: {
|
|
30
|
+
readonly TOKEN: "accessToken";
|
|
31
|
+
readonly USER_INFO: "USER_INFO";
|
|
32
|
+
};
|
|
33
|
+
type UseStateHook<T> = [[boolean, T | null], (value: T | null) => void];
|
|
34
|
+
type StorageKey = keyof typeof STORAGES;
|
|
35
|
+
declare function setStorageItemAsync(key: StorageKey, value: string | null): Promise<void>;
|
|
36
|
+
declare function useStorageState(key: StorageKey): UseStateHook<string>;
|
|
37
|
+
|
|
38
|
+
export { API_APP_URL, API_PRESCHOOL_URL, STORAGES, combineContexts, convertFieldsToArray, countSum, getDateRange, languages, mergeButtons, setStorageItemAsync, useGetRowIds, useStorageState };
|