@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.
Files changed (57) hide show
  1. package/dist/config.d.mts +6 -0
  2. package/dist/config.d.ts +6 -0
  3. package/dist/config.js +24 -0
  4. package/dist/config.mjs +2 -0
  5. package/dist/constants.d.mts +1 -0
  6. package/dist/constants.d.ts +1 -0
  7. package/dist/constants.js +24 -0
  8. package/dist/constants.mjs +2 -0
  9. package/dist/environment.d.mts +1 -0
  10. package/dist/environment.d.ts +1 -0
  11. package/dist/environment.js +24 -0
  12. package/dist/environment.mjs +2 -0
  13. package/dist/hooks.d.mts +969 -0
  14. package/dist/hooks.d.ts +969 -0
  15. package/dist/hooks.js +743 -0
  16. package/dist/hooks.mjs +717 -0
  17. package/dist/icons.d.mts +9 -0
  18. package/dist/icons.d.ts +9 -0
  19. package/dist/icons.js +139 -0
  20. package/dist/icons.mjs +110 -0
  21. package/dist/index.d.mts +2 -5
  22. package/dist/index.d.ts +2 -5
  23. package/dist/index.js +0 -364
  24. package/dist/index.mjs +0 -330
  25. package/dist/provider.d.mts +1 -0
  26. package/dist/provider.d.ts +1 -0
  27. package/dist/provider.js +24 -0
  28. package/dist/provider.mjs +2 -0
  29. package/dist/services.d.mts +1 -0
  30. package/dist/services.d.ts +1 -0
  31. package/dist/services.js +24 -0
  32. package/dist/services.mjs +2 -0
  33. package/dist/store.d.mts +1 -0
  34. package/dist/store.d.ts +1 -0
  35. package/dist/store.js +24 -0
  36. package/dist/store.mjs +2 -0
  37. package/dist/utils.d.mts +38 -0
  38. package/dist/utils.d.ts +38 -0
  39. package/dist/utils.js +282 -0
  40. package/dist/utils.mjs +242 -0
  41. package/package.json +60 -22
  42. package/dist/action.d.mts +0 -68
  43. package/dist/action.d.ts +0 -68
  44. package/dist/action.js +0 -152
  45. package/dist/action.mjs +0 -122
  46. package/dist/common.d.mts +0 -13
  47. package/dist/common.d.ts +0 -13
  48. package/dist/common.js +0 -60
  49. package/dist/common.mjs +0 -33
  50. package/dist/form.d.mts +0 -41
  51. package/dist/form.d.ts +0 -41
  52. package/dist/form.js +0 -116
  53. package/dist/form.mjs +0 -87
  54. package/dist/table.d.mts +0 -22
  55. package/dist/table.d.ts +0 -22
  56. package/dist/table.js +0 -118
  57. package/dist/table.mjs +0 -91
package/dist/utils.js ADDED
@@ -0,0 +1,282 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/utils.ts
22
+ var utils_exports = {};
23
+ __export(utils_exports, {
24
+ API_APP_URL: () => API_APP_URL,
25
+ API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
26
+ STORAGES: () => STORAGES,
27
+ combineContexts: () => combineContexts,
28
+ convertFieldsToArray: () => convertFieldsToArray,
29
+ countSum: () => countSum,
30
+ getDateRange: () => getDateRange,
31
+ languages: () => languages,
32
+ mergeButtons: () => mergeButtons,
33
+ setStorageItemAsync: () => setStorageItemAsync,
34
+ useGetRowIds: () => useGetRowIds,
35
+ useStorageState: () => useStorageState
36
+ });
37
+ module.exports = __toCommonJS(utils_exports);
38
+
39
+ // src/utils/constants.ts
40
+ var languages = [
41
+ { id: "vi_VN", name: "VIE" },
42
+ { id: "en_US", name: "ENG" }
43
+ ];
44
+ var API_PRESCHOOL_URL = {
45
+ baseURL: "https://preschool.vitrust.app"
46
+ };
47
+ var API_APP_URL = {
48
+ baseUrl: "https://api.vitrust.app",
49
+ c2: "https://api.vitrust.app/c2",
50
+ apiV2: "https://api.vitrust.app/c2/api/v2"
51
+ };
52
+
53
+ // src/utils/function.ts
54
+ var import_react = require("react");
55
+ var countSum = (data, field) => {
56
+ if (!data || !field) return 0;
57
+ return data.reduce(
58
+ (total, item) => total + (item?.[`${field}_count`] || 0),
59
+ 0
60
+ );
61
+ };
62
+ function mergeButtons(fields) {
63
+ const buttons = fields?.filter((f) => f.type_co === "button");
64
+ const others = fields?.filter((f) => f.type_co !== "button");
65
+ if (buttons?.length) {
66
+ others.push({
67
+ type_co: "buttons",
68
+ buttons
69
+ });
70
+ }
71
+ return others;
72
+ }
73
+ function isElementVisible(el) {
74
+ const style = window.getComputedStyle(el);
75
+ return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0";
76
+ }
77
+ function arraysAreEqual(a, b) {
78
+ if (a.length !== b.length) return false;
79
+ const setA = new Set(a);
80
+ const setB = new Set(b);
81
+ if (setA.size !== setB.size) return false;
82
+ for (const val of setA) {
83
+ if (!setB.has(val)) return false;
84
+ }
85
+ return true;
86
+ }
87
+ function useGetRowIds(tableRef) {
88
+ const [rowIds, setRowIds] = (0, import_react.useState)([]);
89
+ const lastRowIdsRef = (0, import_react.useRef)([]);
90
+ const updateVisibleRowIds = (0, import_react.useCallback)(() => {
91
+ const table = tableRef?.current;
92
+ if (!table) return;
93
+ const rows = table.querySelectorAll("tr[data-row-id]");
94
+ const ids = [];
95
+ rows.forEach((row) => {
96
+ const el = row;
97
+ if (isElementVisible(el)) {
98
+ const id = el.getAttribute("data-row-id");
99
+ if (id) ids.push(id);
100
+ }
101
+ });
102
+ const uniqueIds = Array.from(new Set(ids));
103
+ if (!arraysAreEqual(lastRowIdsRef.current, uniqueIds)) {
104
+ lastRowIdsRef.current = uniqueIds;
105
+ setRowIds(uniqueIds);
106
+ }
107
+ }, [tableRef]);
108
+ (0, import_react.useEffect)(() => {
109
+ const table = tableRef?.current;
110
+ if (!table) return;
111
+ const observer = new MutationObserver(() => {
112
+ updateVisibleRowIds();
113
+ });
114
+ observer.observe(table, {
115
+ childList: true,
116
+ subtree: true,
117
+ attributes: true,
118
+ attributeFilter: ["style", "class"]
119
+ });
120
+ updateVisibleRowIds();
121
+ return () => {
122
+ observer.disconnect();
123
+ };
124
+ }, [updateVisibleRowIds, tableRef]);
125
+ return { rowIds, refresh: updateVisibleRowIds };
126
+ }
127
+ var getDateRange = (currentDate, unit) => {
128
+ const date = new Date(currentDate);
129
+ let dateStart, dateEnd;
130
+ function formatDate(d) {
131
+ return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0") + " " + String(d.getHours()).padStart(2, "0") + ":" + String(d.getMinutes()).padStart(2, "0") + ":" + String(d.getSeconds()).padStart(2, "0");
132
+ }
133
+ switch (unit) {
134
+ case "month":
135
+ dateStart = new Date(
136
+ date.getFullYear(),
137
+ date.getMonth() + 1,
138
+ date.getDate(),
139
+ 23,
140
+ 59,
141
+ 59
142
+ );
143
+ dateStart.setHours(dateStart.getHours() - 7);
144
+ dateEnd = new Date(date.getFullYear(), date.getMonth(), 0, 0, 0, 0);
145
+ dateEnd.setHours(dateEnd.getHours() - 7);
146
+ break;
147
+ case "day":
148
+ dateStart = new Date(
149
+ date.getFullYear(),
150
+ date.getMonth(),
151
+ date.getDate(),
152
+ 23,
153
+ 59,
154
+ 59
155
+ );
156
+ dateStart.setHours(dateStart.getHours() - 7);
157
+ dateEnd = new Date(
158
+ date.getFullYear(),
159
+ date.getMonth(),
160
+ date.getDate(),
161
+ 0,
162
+ 0,
163
+ 0
164
+ );
165
+ dateEnd.setHours(dateEnd.getHours() - 7);
166
+ break;
167
+ case "week":
168
+ const dayOfWeek = date.getDay();
169
+ const daysToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
170
+ const daysToSunday = dayOfWeek === 0 ? 0 : 7 - dayOfWeek;
171
+ dateStart = new Date(
172
+ date.getFullYear(),
173
+ date.getMonth(),
174
+ date.getDate() + daysToSunday,
175
+ 23,
176
+ 59,
177
+ 59
178
+ );
179
+ dateStart.setHours(dateStart.getHours() - 7);
180
+ dateEnd = new Date(
181
+ date.getFullYear(),
182
+ date.getMonth(),
183
+ date.getDate() + daysToMonday,
184
+ 0,
185
+ 0,
186
+ 0
187
+ );
188
+ dateEnd.setHours(dateEnd.getHours() - 7);
189
+ break;
190
+ case "year":
191
+ dateStart = new Date(date.getFullYear(), 11, 31, 23, 59, 59);
192
+ dateStart.setHours(dateStart.getHours() - 7);
193
+ dateEnd = new Date(date.getFullYear() - 1, 11, 31, 0, 0, 0);
194
+ dateEnd.setHours(dateEnd.getHours() - 7);
195
+ break;
196
+ default:
197
+ throw new Error(
198
+ "\u0110\u01A1n v\u1ECB kh\xF4ng h\u1EE3p l\u1EC7. Ch\u1EC9 ch\u1EA5p nh\u1EADn: week, day, month, year"
199
+ );
200
+ }
201
+ return [
202
+ ["date_start", "<=", formatDate(dateStart)],
203
+ ["date_end", ">=", formatDate(dateEnd)]
204
+ ];
205
+ };
206
+ var convertFieldsToArray = (fields) => {
207
+ const defaultFields = ["display_name", "date_start", "date_end"];
208
+ if (!fields || !Array.isArray(fields)) {
209
+ return defaultFields;
210
+ }
211
+ const inputFields = fields.filter((field) => field && field.type_co === "field").map((field) => field.name);
212
+ return [...defaultFields, ...inputFields];
213
+ };
214
+ function combineContexts(contexts) {
215
+ if (contexts.some((context) => !context)) {
216
+ return void 0;
217
+ } else {
218
+ const res = contexts.reduce((acc, context) => {
219
+ return { ...acc, ...context };
220
+ }, {});
221
+ return res;
222
+ }
223
+ }
224
+ var STORAGES = {
225
+ TOKEN: "accessToken",
226
+ USER_INFO: "USER_INFO"
227
+ };
228
+ function useAsyncState(initialValue = [true, null]) {
229
+ return (0, import_react.useReducer)(
230
+ (_state, action = null) => [false, action],
231
+ initialValue
232
+ );
233
+ }
234
+ async function setStorageItemAsync(key, value) {
235
+ try {
236
+ if (value === null) {
237
+ localStorage.removeItem(key);
238
+ } else {
239
+ localStorage.setItem(key, value);
240
+ }
241
+ } catch (e) {
242
+ console.error("Local storage is unavailable:", e);
243
+ }
244
+ }
245
+ function useStorageState(key) {
246
+ const [state, setState] = useAsyncState();
247
+ (0, import_react.useEffect)(() => {
248
+ try {
249
+ const storedValue = localStorage.getItem(key);
250
+ setState(storedValue);
251
+ } catch (e) {
252
+ console.error("Local storage is unavailable:", e);
253
+ }
254
+ }, [key]);
255
+ const setValue = (0, import_react.useCallback)(
256
+ (value) => {
257
+ setState(value);
258
+ setStorageItemAsync(key, value);
259
+ },
260
+ [key]
261
+ );
262
+ return [state, setValue];
263
+ }
264
+
265
+ // src/utils.ts
266
+ __reExport(utils_exports, require("@fctc/interface-logic/utils"), module.exports);
267
+ // Annotate the CommonJS export names for ESM import in node:
268
+ 0 && (module.exports = {
269
+ API_APP_URL,
270
+ API_PRESCHOOL_URL,
271
+ STORAGES,
272
+ combineContexts,
273
+ convertFieldsToArray,
274
+ countSum,
275
+ getDateRange,
276
+ languages,
277
+ mergeButtons,
278
+ setStorageItemAsync,
279
+ useGetRowIds,
280
+ useStorageState,
281
+ ...require("@fctc/interface-logic/utils")
282
+ });
package/dist/utils.mjs ADDED
@@ -0,0 +1,242 @@
1
+ // src/utils/constants.ts
2
+ var languages = [
3
+ { id: "vi_VN", name: "VIE" },
4
+ { id: "en_US", name: "ENG" }
5
+ ];
6
+ var API_PRESCHOOL_URL = {
7
+ baseURL: "https://preschool.vitrust.app"
8
+ };
9
+ var API_APP_URL = {
10
+ baseUrl: "https://api.vitrust.app",
11
+ c2: "https://api.vitrust.app/c2",
12
+ apiV2: "https://api.vitrust.app/c2/api/v2"
13
+ };
14
+
15
+ // src/utils/function.ts
16
+ import { useCallback, useEffect, useReducer, useRef, useState } from "react";
17
+ var countSum = (data, field) => {
18
+ if (!data || !field) return 0;
19
+ return data.reduce(
20
+ (total, item) => total + (item?.[`${field}_count`] || 0),
21
+ 0
22
+ );
23
+ };
24
+ function mergeButtons(fields) {
25
+ const buttons = fields?.filter((f) => f.type_co === "button");
26
+ const others = fields?.filter((f) => f.type_co !== "button");
27
+ if (buttons?.length) {
28
+ others.push({
29
+ type_co: "buttons",
30
+ buttons
31
+ });
32
+ }
33
+ return others;
34
+ }
35
+ function isElementVisible(el) {
36
+ const style = window.getComputedStyle(el);
37
+ return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0";
38
+ }
39
+ function arraysAreEqual(a, b) {
40
+ if (a.length !== b.length) return false;
41
+ const setA = new Set(a);
42
+ const setB = new Set(b);
43
+ if (setA.size !== setB.size) return false;
44
+ for (const val of setA) {
45
+ if (!setB.has(val)) return false;
46
+ }
47
+ return true;
48
+ }
49
+ function useGetRowIds(tableRef) {
50
+ const [rowIds, setRowIds] = useState([]);
51
+ const lastRowIdsRef = useRef([]);
52
+ const updateVisibleRowIds = useCallback(() => {
53
+ const table = tableRef?.current;
54
+ if (!table) return;
55
+ const rows = table.querySelectorAll("tr[data-row-id]");
56
+ const ids = [];
57
+ rows.forEach((row) => {
58
+ const el = row;
59
+ if (isElementVisible(el)) {
60
+ const id = el.getAttribute("data-row-id");
61
+ if (id) ids.push(id);
62
+ }
63
+ });
64
+ const uniqueIds = Array.from(new Set(ids));
65
+ if (!arraysAreEqual(lastRowIdsRef.current, uniqueIds)) {
66
+ lastRowIdsRef.current = uniqueIds;
67
+ setRowIds(uniqueIds);
68
+ }
69
+ }, [tableRef]);
70
+ useEffect(() => {
71
+ const table = tableRef?.current;
72
+ if (!table) return;
73
+ const observer = new MutationObserver(() => {
74
+ updateVisibleRowIds();
75
+ });
76
+ observer.observe(table, {
77
+ childList: true,
78
+ subtree: true,
79
+ attributes: true,
80
+ attributeFilter: ["style", "class"]
81
+ });
82
+ updateVisibleRowIds();
83
+ return () => {
84
+ observer.disconnect();
85
+ };
86
+ }, [updateVisibleRowIds, tableRef]);
87
+ return { rowIds, refresh: updateVisibleRowIds };
88
+ }
89
+ var getDateRange = (currentDate, unit) => {
90
+ const date = new Date(currentDate);
91
+ let dateStart, dateEnd;
92
+ function formatDate(d) {
93
+ return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0") + " " + String(d.getHours()).padStart(2, "0") + ":" + String(d.getMinutes()).padStart(2, "0") + ":" + String(d.getSeconds()).padStart(2, "0");
94
+ }
95
+ switch (unit) {
96
+ case "month":
97
+ dateStart = new Date(
98
+ date.getFullYear(),
99
+ date.getMonth() + 1,
100
+ date.getDate(),
101
+ 23,
102
+ 59,
103
+ 59
104
+ );
105
+ dateStart.setHours(dateStart.getHours() - 7);
106
+ dateEnd = new Date(date.getFullYear(), date.getMonth(), 0, 0, 0, 0);
107
+ dateEnd.setHours(dateEnd.getHours() - 7);
108
+ break;
109
+ case "day":
110
+ dateStart = new Date(
111
+ date.getFullYear(),
112
+ date.getMonth(),
113
+ date.getDate(),
114
+ 23,
115
+ 59,
116
+ 59
117
+ );
118
+ dateStart.setHours(dateStart.getHours() - 7);
119
+ dateEnd = new Date(
120
+ date.getFullYear(),
121
+ date.getMonth(),
122
+ date.getDate(),
123
+ 0,
124
+ 0,
125
+ 0
126
+ );
127
+ dateEnd.setHours(dateEnd.getHours() - 7);
128
+ break;
129
+ case "week":
130
+ const dayOfWeek = date.getDay();
131
+ const daysToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
132
+ const daysToSunday = dayOfWeek === 0 ? 0 : 7 - dayOfWeek;
133
+ dateStart = new Date(
134
+ date.getFullYear(),
135
+ date.getMonth(),
136
+ date.getDate() + daysToSunday,
137
+ 23,
138
+ 59,
139
+ 59
140
+ );
141
+ dateStart.setHours(dateStart.getHours() - 7);
142
+ dateEnd = new Date(
143
+ date.getFullYear(),
144
+ date.getMonth(),
145
+ date.getDate() + daysToMonday,
146
+ 0,
147
+ 0,
148
+ 0
149
+ );
150
+ dateEnd.setHours(dateEnd.getHours() - 7);
151
+ break;
152
+ case "year":
153
+ dateStart = new Date(date.getFullYear(), 11, 31, 23, 59, 59);
154
+ dateStart.setHours(dateStart.getHours() - 7);
155
+ dateEnd = new Date(date.getFullYear() - 1, 11, 31, 0, 0, 0);
156
+ dateEnd.setHours(dateEnd.getHours() - 7);
157
+ break;
158
+ default:
159
+ throw new Error(
160
+ "\u0110\u01A1n v\u1ECB kh\xF4ng h\u1EE3p l\u1EC7. Ch\u1EC9 ch\u1EA5p nh\u1EADn: week, day, month, year"
161
+ );
162
+ }
163
+ return [
164
+ ["date_start", "<=", formatDate(dateStart)],
165
+ ["date_end", ">=", formatDate(dateEnd)]
166
+ ];
167
+ };
168
+ var convertFieldsToArray = (fields) => {
169
+ const defaultFields = ["display_name", "date_start", "date_end"];
170
+ if (!fields || !Array.isArray(fields)) {
171
+ return defaultFields;
172
+ }
173
+ const inputFields = fields.filter((field) => field && field.type_co === "field").map((field) => field.name);
174
+ return [...defaultFields, ...inputFields];
175
+ };
176
+ function combineContexts(contexts) {
177
+ if (contexts.some((context) => !context)) {
178
+ return void 0;
179
+ } else {
180
+ const res = contexts.reduce((acc, context) => {
181
+ return { ...acc, ...context };
182
+ }, {});
183
+ return res;
184
+ }
185
+ }
186
+ var STORAGES = {
187
+ TOKEN: "accessToken",
188
+ USER_INFO: "USER_INFO"
189
+ };
190
+ function useAsyncState(initialValue = [true, null]) {
191
+ return useReducer(
192
+ (_state, action = null) => [false, action],
193
+ initialValue
194
+ );
195
+ }
196
+ async function setStorageItemAsync(key, value) {
197
+ try {
198
+ if (value === null) {
199
+ localStorage.removeItem(key);
200
+ } else {
201
+ localStorage.setItem(key, value);
202
+ }
203
+ } catch (e) {
204
+ console.error("Local storage is unavailable:", e);
205
+ }
206
+ }
207
+ function useStorageState(key) {
208
+ const [state, setState] = useAsyncState();
209
+ useEffect(() => {
210
+ try {
211
+ const storedValue = localStorage.getItem(key);
212
+ setState(storedValue);
213
+ } catch (e) {
214
+ console.error("Local storage is unavailable:", e);
215
+ }
216
+ }, [key]);
217
+ const setValue = useCallback(
218
+ (value) => {
219
+ setState(value);
220
+ setStorageItemAsync(key, value);
221
+ },
222
+ [key]
223
+ );
224
+ return [state, setValue];
225
+ }
226
+
227
+ // src/utils.ts
228
+ export * from "@fctc/interface-logic/utils";
229
+ export {
230
+ API_APP_URL,
231
+ API_PRESCHOOL_URL,
232
+ STORAGES,
233
+ combineContexts,
234
+ convertFieldsToArray,
235
+ countSum,
236
+ getDateRange,
237
+ languages,
238
+ mergeButtons,
239
+ setStorageItemAsync,
240
+ useGetRowIds,
241
+ useStorageState
242
+ };
package/package.json CHANGED
@@ -1,34 +1,64 @@
1
1
  {
2
2
  "name": "@fctc/widget-logic",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
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"
22
- },
23
- "./table": {
24
- "types": "./dist/table.d.ts",
25
- "import": "./dist/table.mjs",
26
- "require": "./dist/table.cjs"
27
- },
28
- "./common": {
29
- "types": "./dist/common.d.ts",
30
- "import": "./dist/common.mjs",
31
- "require": "./dist/common.cjs"
13
+ "./hooks": {
14
+ "types": "./dist/hooks.d.ts",
15
+ "import": "./dist/hooks.mjs",
16
+ "require": "./dist/hooks.cjs"
17
+ },
18
+ "./widget": {
19
+ "types": "./dist/widget.d.ts",
20
+ "import": "./dist/widget.mjs",
21
+ "require": "./dist/widget.cjs"
22
+ },
23
+ "./icons": {
24
+ "types": "./dist/icons.d.ts",
25
+ "import": "./dist/icons.mjs",
26
+ "require": "./dist/icons.cjs"
27
+ },
28
+ "./utils": {
29
+ "types": "./dist/utils.d.ts",
30
+ "import": "./dist/utils.mjs",
31
+ "require": "./dist/utils.cjs"
32
+ },
33
+ "./store": {
34
+ "types": "./dist/store.d.ts",
35
+ "import": "./dist/store.mjs",
36
+ "require": "./dist/store.cjs"
37
+ },
38
+ "./config": {
39
+ "types": "./dist/config.d.ts",
40
+ "import": "./dist/config.mjs",
41
+ "require": "./dist/config.cjs"
42
+ },
43
+ "./constants": {
44
+ "types": "./dist/constants.d.ts",
45
+ "import": "./dist/constants.mjs",
46
+ "require": "./dist/constants.cjs"
47
+ },
48
+ "./environment": {
49
+ "types": "./dist/environment.d.ts",
50
+ "import": "./dist/environment.mjs",
51
+ "require": "./dist/environment.cjs"
52
+ },
53
+ "./provider": {
54
+ "types": "./dist/provider.d.ts",
55
+ "import": "./dist/provider.mjs",
56
+ "require": "./dist/provider.cjs"
57
+ },
58
+ "./services": {
59
+ "types": "./dist/services.d.ts",
60
+ "import": "./dist/services.mjs",
61
+ "require": "./dist/services.cjs"
32
62
  }
33
63
  },
34
64
  "files": [
@@ -39,7 +69,15 @@
39
69
  "test": "jest"
40
70
  },
41
71
  "dependencies": {
42
- "@fctc/interface-logic": "^1.0.4"
72
+ "@fctc/interface-logic": "^1.3.2",
73
+ "@headlessui/react": "^2.2.6",
74
+ "@tanstack/react-query": "^5.84.0",
75
+ "@types/react-dom": "^19.1.7",
76
+ "i18next": "^25.3.2",
77
+ "i18next-browser-languagedetector": "^8.2.0",
78
+ "react-dom": "^19.1.1",
79
+ "react-i18next": "^15.6.1",
80
+ "react-tooltip": "^5.29.1"
43
81
  },
44
82
  "devDependencies": {
45
83
  "@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 };