@fctc/widget-logic 5.3.7-beta.15 → 5.3.7-beta.17
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/hooks.js +3 -299
- package/dist/hooks.mjs +3 -292
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +88 -370
- package/dist/index.mjs +91 -366
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.mts +1 -3
- package/dist/utils.d.ts +1 -3
- package/dist/utils.js +1 -297
- package/dist/utils.mjs +1 -286
- package/dist/widget.d.mts +26 -22
- package/dist/widget.d.ts +26 -22
- package/dist/widget.js +170 -446
- package/dist/widget.mjs +160 -428
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
18
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
|
|
31
21
|
// src/widget.ts
|
|
@@ -53,73 +43,23 @@ __export(widget_exports, {
|
|
|
53
43
|
module.exports = __toCommonJS(widget_exports);
|
|
54
44
|
|
|
55
45
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
56
|
-
var
|
|
57
|
-
var import_environment = require("@fctc/interface-logic/environment");
|
|
58
|
-
var import_hooks = require("@fctc/interface-logic/hooks");
|
|
59
|
-
var statusDropdownController = (props) => {
|
|
60
|
-
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
61
|
-
const env = (0, import_environment.getEnv)();
|
|
62
|
-
const colors = {
|
|
63
|
-
normal: "bg-[#e9ecef]",
|
|
64
|
-
done: "bg-primary",
|
|
65
|
-
blocked: "bg-red-500"
|
|
66
|
-
};
|
|
67
|
-
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
68
|
-
const buttonRef = (0, import_react.useRef)(null);
|
|
69
|
-
(0, import_react.useEffect)(() => {
|
|
70
|
-
const handleClickOutside = (event) => {
|
|
71
|
-
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
72
|
-
setIsOpen(false);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
76
|
-
return () => {
|
|
77
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
78
|
-
};
|
|
79
|
-
}, []);
|
|
80
|
-
const { mutate: onSave } = (0, import_hooks.useSave)();
|
|
81
|
-
const handleClick = async (status) => {
|
|
82
|
-
setIsOpen(!isOpen);
|
|
83
|
-
onSave(
|
|
84
|
-
{
|
|
85
|
-
ids: id ? [id] : [],
|
|
86
|
-
model: model ?? "",
|
|
87
|
-
data: { [name ?? ""]: status },
|
|
88
|
-
context: env.context
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
onSuccess: () => {
|
|
92
|
-
onRefetch && onRefetch();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
return {
|
|
98
|
-
handleClick,
|
|
99
|
-
buttonRef,
|
|
100
|
-
isForm,
|
|
101
|
-
setIsOpen,
|
|
102
|
-
isOpen,
|
|
103
|
-
selection,
|
|
104
|
-
state,
|
|
105
|
-
colors
|
|
106
|
-
};
|
|
107
|
-
};
|
|
46
|
+
var import_react14 = require("react");
|
|
108
47
|
|
|
109
|
-
// src/
|
|
110
|
-
var
|
|
48
|
+
// src/environment.ts
|
|
49
|
+
var environment_exports = {};
|
|
50
|
+
__reExport(environment_exports, require("@fctc/interface-logic/environment"));
|
|
111
51
|
|
|
112
52
|
// src/hooks.ts
|
|
113
|
-
var
|
|
53
|
+
var import_hooks2 = require("@fctc/interface-logic/hooks");
|
|
114
54
|
|
|
115
55
|
// src/hooks/core/use-app-provider.tsx
|
|
116
|
-
var
|
|
56
|
+
var import_react8 = require("react");
|
|
117
57
|
|
|
118
58
|
// src/hooks/core/use-menu.ts
|
|
119
|
-
var
|
|
59
|
+
var import_react3 = require("react");
|
|
120
60
|
|
|
121
61
|
// src/hooks/core/use-call-action.ts
|
|
122
|
-
var
|
|
62
|
+
var import_react = require("react");
|
|
123
63
|
|
|
124
64
|
// src/provider.ts
|
|
125
65
|
var provider_exports = {};
|
|
@@ -135,8 +75,7 @@ __export(utils_exports, {
|
|
|
135
75
|
languages: () => languages,
|
|
136
76
|
mergeButtons: () => mergeButtons,
|
|
137
77
|
setStorageItemAsync: () => setStorageItemAsync,
|
|
138
|
-
useStorageState: () => useStorageState
|
|
139
|
-
validateAndParseDate: () => validateAndParseDate
|
|
78
|
+
useStorageState: () => useStorageState
|
|
140
79
|
});
|
|
141
80
|
|
|
142
81
|
// src/utils/constants.ts
|
|
@@ -147,7 +86,7 @@ var languages = [
|
|
|
147
86
|
var isBlobUrl = (url) => url.startsWith("blob:");
|
|
148
87
|
|
|
149
88
|
// src/utils/function.ts
|
|
150
|
-
var
|
|
89
|
+
var import_react2 = require("react");
|
|
151
90
|
var countSum = (data, field) => {
|
|
152
91
|
if (!data || !field) return 0;
|
|
153
92
|
return data.reduce(
|
|
@@ -174,7 +113,7 @@ var STORAGES = {
|
|
|
174
113
|
USER_INFO: "USER_INFO"
|
|
175
114
|
};
|
|
176
115
|
function useAsyncState(initialValue = [true, null]) {
|
|
177
|
-
return (0,
|
|
116
|
+
return (0, import_react2.useReducer)(
|
|
178
117
|
(_state, action = null) => [false, action],
|
|
179
118
|
initialValue
|
|
180
119
|
);
|
|
@@ -192,7 +131,7 @@ async function setStorageItemAsync(key, value) {
|
|
|
192
131
|
}
|
|
193
132
|
function useStorageState(key) {
|
|
194
133
|
const [state, setState] = useAsyncState();
|
|
195
|
-
(0,
|
|
134
|
+
(0, import_react2.useEffect)(() => {
|
|
196
135
|
try {
|
|
197
136
|
const storedValue = localStorage.getItem(key);
|
|
198
137
|
setState(storedValue);
|
|
@@ -200,7 +139,7 @@ function useStorageState(key) {
|
|
|
200
139
|
console.error("Local storage is unavailable:", e);
|
|
201
140
|
}
|
|
202
141
|
}, [key]);
|
|
203
|
-
const setValue = (0,
|
|
142
|
+
const setValue = (0, import_react2.useCallback)(
|
|
204
143
|
(value) => {
|
|
205
144
|
setState(value);
|
|
206
145
|
setStorageItemAsync(key, value);
|
|
@@ -232,307 +171,23 @@ var guessTypeFromUrl = (url) => {
|
|
|
232
171
|
return map[ext] || null;
|
|
233
172
|
};
|
|
234
173
|
|
|
235
|
-
// src/utils/format-date.ts
|
|
236
|
-
var import_moment = __toESM(require("moment"));
|
|
237
|
-
var validateAndParseDate = (input, isDateTime = false) => {
|
|
238
|
-
if (!input || typeof input !== "string") return null;
|
|
239
|
-
const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
|
|
240
|
-
const dateFormat = "YYYY-MM-DD";
|
|
241
|
-
const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
|
|
242
|
-
const currentDay = (0, import_moment.default)().format("DD");
|
|
243
|
-
const currentMonth = (0, import_moment.default)().format("MM");
|
|
244
|
-
const currentYear = (0, import_moment.default)().format("YYYY");
|
|
245
|
-
const defaultTime = "00:00:00";
|
|
246
|
-
const maxYear = parseInt(currentYear) + 10;
|
|
247
|
-
const isValidDate = (day, month, year) => {
|
|
248
|
-
const date = (0, import_moment.default)(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
|
|
249
|
-
return date.isValid();
|
|
250
|
-
};
|
|
251
|
-
const isValidTime = (hour, minute = "00", second = "00") => {
|
|
252
|
-
const h = parseInt(hour, 10);
|
|
253
|
-
const m = parseInt(minute, 10);
|
|
254
|
-
const s = parseInt(second, 10);
|
|
255
|
-
return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
|
|
256
|
-
};
|
|
257
|
-
const formatOutput = (day, month, year, time = defaultTime) => {
|
|
258
|
-
let result = (0, import_moment.default)(
|
|
259
|
-
`${day}-${month}-${year} ${time}`,
|
|
260
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
261
|
-
);
|
|
262
|
-
if (!result.isValid()) return null;
|
|
263
|
-
if (isDateTime) {
|
|
264
|
-
result = result.subtract(7, "hours");
|
|
265
|
-
return result.format(dateTimeFormat);
|
|
266
|
-
}
|
|
267
|
-
return result.format(dateFormat);
|
|
268
|
-
};
|
|
269
|
-
if (isDateTime && input.match(
|
|
270
|
-
/^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
|
|
271
|
-
)) {
|
|
272
|
-
const [datePart, timePart] = input.split(/\s+/);
|
|
273
|
-
const dateParts = datePart.split(/[\/-]/);
|
|
274
|
-
const timeParts = timePart.split(":");
|
|
275
|
-
const day = dateParts[0].padStart(2, "0");
|
|
276
|
-
const month = dateParts[1].padStart(2, "0");
|
|
277
|
-
const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
|
|
278
|
-
const hour = timeParts[0].padStart(2, "0");
|
|
279
|
-
const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
|
|
280
|
-
const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
|
|
281
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
282
|
-
let result = (0, import_moment.default)(
|
|
283
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
284
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
285
|
-
);
|
|
286
|
-
if (!result.isValid()) return null;
|
|
287
|
-
result = result.subtract(7, "hours");
|
|
288
|
-
return result.format(dateTimeFormat);
|
|
289
|
-
}
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
|
293
|
-
const [year, month, day] = cleanInput.split("-");
|
|
294
|
-
if (isValidDate(day, month, year)) {
|
|
295
|
-
return formatOutput(day, month, year);
|
|
296
|
-
}
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
|
|
300
|
-
const [day, month, year] = cleanInput.split("/");
|
|
301
|
-
const paddedDay = day.padStart(2, "0");
|
|
302
|
-
const paddedMonth = month.padStart(2, "0");
|
|
303
|
-
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
304
|
-
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
305
|
-
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
306
|
-
}
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
|
|
310
|
-
const [day, month, year] = cleanInput.split("-");
|
|
311
|
-
const paddedDay = day.padStart(2, "0");
|
|
312
|
-
const paddedMonth = month.padStart(2, "0");
|
|
313
|
-
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
314
|
-
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
315
|
-
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
316
|
-
}
|
|
317
|
-
return null;
|
|
318
|
-
}
|
|
319
|
-
if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
|
|
320
|
-
const [day, month] = cleanInput.split(/[\/-]/);
|
|
321
|
-
const paddedDay = day.padStart(2, "0");
|
|
322
|
-
const paddedMonth = month.padStart(2, "0");
|
|
323
|
-
if (isValidDate(paddedDay, paddedMonth, currentYear)) {
|
|
324
|
-
return formatOutput(paddedDay, paddedMonth, currentYear);
|
|
325
|
-
}
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
if (cleanInput.match(/^\d{4}$/)) {
|
|
329
|
-
const num = parseInt(cleanInput, 10);
|
|
330
|
-
if (num >= 2e3 && num <= maxYear) {
|
|
331
|
-
if (isValidDate(currentDay, currentMonth, num.toString())) {
|
|
332
|
-
return formatOutput(currentDay, currentMonth, num.toString());
|
|
333
|
-
}
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
const day = cleanInput.slice(0, 2);
|
|
337
|
-
const month = cleanInput.slice(2, 4);
|
|
338
|
-
if (isValidDate(day, month, currentYear)) {
|
|
339
|
-
return formatOutput(day, month, currentYear);
|
|
340
|
-
}
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
|
-
if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
|
|
344
|
-
const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
|
|
345
|
-
let result = (0, import_moment.default)().subtract(daysToSubtract, "days");
|
|
346
|
-
if (isDateTime) {
|
|
347
|
-
result = result.subtract(7, "hours");
|
|
348
|
-
}
|
|
349
|
-
if (result.isValid()) {
|
|
350
|
-
return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
|
|
351
|
-
}
|
|
352
|
-
return null;
|
|
353
|
-
}
|
|
354
|
-
if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
|
|
355
|
-
const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
|
|
356
|
-
const day = parts[0].padStart(2, "0");
|
|
357
|
-
const month = parts[1].padStart(2, "0");
|
|
358
|
-
let year = parts[2];
|
|
359
|
-
year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
|
|
360
|
-
if (isValidDate(day, month, year)) {
|
|
361
|
-
return formatOutput(day, month, year);
|
|
362
|
-
}
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
if (isDateTime) {
|
|
366
|
-
if (cleanInput.length === 9) {
|
|
367
|
-
const day = cleanInput.slice(0, 2);
|
|
368
|
-
const month = cleanInput.slice(2, 4);
|
|
369
|
-
const year = cleanInput.slice(4, 8);
|
|
370
|
-
const hour = cleanInput.slice(8, 9).padStart(2, "0");
|
|
371
|
-
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
372
|
-
let result = (0, import_moment.default)(
|
|
373
|
-
`${day}-${month}-${year} ${hour}:00:00`,
|
|
374
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
375
|
-
);
|
|
376
|
-
if (!result.isValid()) return null;
|
|
377
|
-
result = result.subtract(7, "hours");
|
|
378
|
-
return result.format(dateTimeFormat);
|
|
379
|
-
}
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
if (cleanInput.length === 10) {
|
|
383
|
-
const day = cleanInput.slice(0, 2);
|
|
384
|
-
const month = cleanInput.slice(2, 4);
|
|
385
|
-
const year = cleanInput.slice(4, 8);
|
|
386
|
-
const hour = cleanInput.slice(8, 10);
|
|
387
|
-
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
388
|
-
let result = (0, import_moment.default)(
|
|
389
|
-
`${day}-${month}-${year} ${hour}:00:00`,
|
|
390
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
391
|
-
);
|
|
392
|
-
if (!result.isValid()) return null;
|
|
393
|
-
result = result.subtract(7, "hours");
|
|
394
|
-
return result.format(dateTimeFormat);
|
|
395
|
-
}
|
|
396
|
-
return null;
|
|
397
|
-
}
|
|
398
|
-
if (cleanInput.length === 11) {
|
|
399
|
-
const day = cleanInput.slice(0, 2);
|
|
400
|
-
const month = cleanInput.slice(2, 4);
|
|
401
|
-
const year = cleanInput.slice(4, 8);
|
|
402
|
-
const hour = cleanInput.slice(8, 10);
|
|
403
|
-
const minute = cleanInput.slice(10, 11).padStart(2, "0");
|
|
404
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
405
|
-
let result = (0, import_moment.default)(
|
|
406
|
-
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
407
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
408
|
-
);
|
|
409
|
-
if (!result.isValid()) return null;
|
|
410
|
-
result = result.subtract(7, "hours");
|
|
411
|
-
return result.format(dateTimeFormat);
|
|
412
|
-
}
|
|
413
|
-
return null;
|
|
414
|
-
}
|
|
415
|
-
if (cleanInput.length === 12) {
|
|
416
|
-
const day = cleanInput.slice(0, 2);
|
|
417
|
-
const month = cleanInput.slice(2, 4);
|
|
418
|
-
const year = cleanInput.slice(4, 8);
|
|
419
|
-
const hour = cleanInput.slice(8, 10);
|
|
420
|
-
const minute = cleanInput.slice(10, 12);
|
|
421
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
422
|
-
let result = (0, import_moment.default)(
|
|
423
|
-
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
424
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
425
|
-
);
|
|
426
|
-
if (!result.isValid()) return null;
|
|
427
|
-
result = result.subtract(7, "hours");
|
|
428
|
-
return result.format(dateTimeFormat);
|
|
429
|
-
}
|
|
430
|
-
return null;
|
|
431
|
-
}
|
|
432
|
-
if (cleanInput.length === 13) {
|
|
433
|
-
const day = cleanInput.slice(0, 2);
|
|
434
|
-
const month = cleanInput.slice(2, 4);
|
|
435
|
-
const year = cleanInput.slice(4, 8);
|
|
436
|
-
const hour = cleanInput.slice(8, 10);
|
|
437
|
-
const minute = cleanInput.slice(10, 12);
|
|
438
|
-
const second = cleanInput.slice(12, 13).padStart(2, "0");
|
|
439
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
440
|
-
let result = (0, import_moment.default)(
|
|
441
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
442
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
443
|
-
);
|
|
444
|
-
if (!result.isValid()) return null;
|
|
445
|
-
result = result.subtract(7, "hours");
|
|
446
|
-
return result.format(dateTimeFormat);
|
|
447
|
-
}
|
|
448
|
-
return null;
|
|
449
|
-
}
|
|
450
|
-
if (cleanInput.length === 14) {
|
|
451
|
-
const day = cleanInput.slice(0, 2);
|
|
452
|
-
const month = cleanInput.slice(2, 4);
|
|
453
|
-
const year = cleanInput.slice(4, 8);
|
|
454
|
-
const hour = cleanInput.slice(8, 10);
|
|
455
|
-
const minute = cleanInput.slice(10, 12);
|
|
456
|
-
const second = cleanInput.slice(12, 14);
|
|
457
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
458
|
-
let result = (0, import_moment.default)(
|
|
459
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
460
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
461
|
-
);
|
|
462
|
-
if (!result.isValid()) return null;
|
|
463
|
-
result = result.subtract(7, "hours");
|
|
464
|
-
return result.format(dateTimeFormat);
|
|
465
|
-
}
|
|
466
|
-
return null;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
const len = cleanInput.length;
|
|
470
|
-
if (len === 1 || len === 2) {
|
|
471
|
-
const paddedDay = cleanInput.padStart(2, "0");
|
|
472
|
-
if (isValidDate(paddedDay, currentMonth, currentYear)) {
|
|
473
|
-
return formatOutput(paddedDay, currentMonth, currentYear);
|
|
474
|
-
}
|
|
475
|
-
return null;
|
|
476
|
-
}
|
|
477
|
-
if (len === 3) {
|
|
478
|
-
const day = cleanInput.slice(0, 2);
|
|
479
|
-
const month = cleanInput.slice(2, 3).padStart(2, "0");
|
|
480
|
-
if (isValidDate(day, month, currentYear)) {
|
|
481
|
-
return formatOutput(day, month, currentYear);
|
|
482
|
-
}
|
|
483
|
-
return null;
|
|
484
|
-
}
|
|
485
|
-
if (len === 6) {
|
|
486
|
-
const day = cleanInput.slice(0, 2);
|
|
487
|
-
const month = cleanInput.slice(2, 4);
|
|
488
|
-
let year = cleanInput.slice(4, 6);
|
|
489
|
-
year = `20${year}`;
|
|
490
|
-
if (parseInt(month) > 12) {
|
|
491
|
-
if (isValidDate(day, currentMonth, currentYear)) {
|
|
492
|
-
return formatOutput(day, currentMonth, currentYear);
|
|
493
|
-
}
|
|
494
|
-
return null;
|
|
495
|
-
}
|
|
496
|
-
if (isValidDate(day, month, year)) {
|
|
497
|
-
return formatOutput(day, month, year);
|
|
498
|
-
}
|
|
499
|
-
return null;
|
|
500
|
-
}
|
|
501
|
-
if (len === 7) {
|
|
502
|
-
return null;
|
|
503
|
-
}
|
|
504
|
-
if (len === 8) {
|
|
505
|
-
const day = cleanInput.slice(0, 2);
|
|
506
|
-
const month = cleanInput.slice(2, 4);
|
|
507
|
-
const year = cleanInput.slice(4, 8);
|
|
508
|
-
if (isValidDate(day, month, year)) {
|
|
509
|
-
return formatOutput(day, month, year);
|
|
510
|
-
}
|
|
511
|
-
return null;
|
|
512
|
-
}
|
|
513
|
-
if (len > 8 && !isDateTime) {
|
|
514
|
-
return null;
|
|
515
|
-
}
|
|
516
|
-
return null;
|
|
517
|
-
};
|
|
518
|
-
|
|
519
174
|
// src/utils.ts
|
|
520
175
|
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
521
176
|
|
|
522
177
|
// src/hooks/core/use-detail.ts
|
|
523
178
|
var import_react_query = require("@tanstack/react-query");
|
|
524
|
-
var
|
|
179
|
+
var import_react4 = require("react");
|
|
525
180
|
|
|
526
181
|
// src/hooks/core/use-profile.ts
|
|
527
182
|
var import_react_query2 = require("@tanstack/react-query");
|
|
528
|
-
var
|
|
183
|
+
var import_react5 = require("react");
|
|
529
184
|
|
|
530
185
|
// src/hooks/core/use-view-v2.ts
|
|
531
|
-
var
|
|
186
|
+
var import_react6 = require("react");
|
|
532
187
|
|
|
533
188
|
// src/hooks/core/use-company.ts
|
|
534
189
|
var import_react_query3 = require("@tanstack/react-query");
|
|
535
|
-
var
|
|
190
|
+
var import_react7 = require("react");
|
|
536
191
|
|
|
537
192
|
// src/hooks/core/use-app-provider.tsx
|
|
538
193
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -543,9 +198,9 @@ var AppProviderInitialValue = {
|
|
|
543
198
|
menu: {},
|
|
544
199
|
view: {}
|
|
545
200
|
};
|
|
546
|
-
var ReactContext = (0,
|
|
201
|
+
var ReactContext = (0, import_react8.createContext)(AppProviderInitialValue);
|
|
547
202
|
var useAppProvider = () => {
|
|
548
|
-
const context = (0,
|
|
203
|
+
const context = (0, import_react8.useContext)(ReactContext);
|
|
549
204
|
if (!context) {
|
|
550
205
|
return AppProviderInitialValue;
|
|
551
206
|
}
|
|
@@ -553,16 +208,16 @@ var useAppProvider = () => {
|
|
|
553
208
|
};
|
|
554
209
|
|
|
555
210
|
// src/hooks/core/use-config.ts
|
|
556
|
-
var
|
|
211
|
+
var import_react9 = require("react");
|
|
557
212
|
|
|
558
213
|
// src/hooks/core/use-get-specification.ts
|
|
559
|
-
var
|
|
214
|
+
var import_react10 = require("react");
|
|
560
215
|
var useGetSpecification = ({
|
|
561
216
|
model,
|
|
562
217
|
viewData,
|
|
563
218
|
fields
|
|
564
219
|
}) => {
|
|
565
|
-
const baseModel = (0,
|
|
220
|
+
const baseModel = (0, import_react10.useMemo)(
|
|
566
221
|
() => ({
|
|
567
222
|
name: String(model),
|
|
568
223
|
view: viewData,
|
|
@@ -570,14 +225,14 @@ var useGetSpecification = ({
|
|
|
570
225
|
}),
|
|
571
226
|
[model, viewData, fields]
|
|
572
227
|
);
|
|
573
|
-
const initModel = (0,
|
|
574
|
-
const modelInstance = (0,
|
|
228
|
+
const initModel = (0, import_hooks2.useModel)();
|
|
229
|
+
const modelInstance = (0, import_react10.useMemo)(() => {
|
|
575
230
|
if (viewData) {
|
|
576
231
|
return initModel.initModel(baseModel);
|
|
577
232
|
}
|
|
578
233
|
return null;
|
|
579
234
|
}, [baseModel, viewData, model]);
|
|
580
|
-
const specification = (0,
|
|
235
|
+
const specification = (0, import_react10.useMemo)(() => {
|
|
581
236
|
if (modelInstance) {
|
|
582
237
|
return modelInstance.getSpecification();
|
|
583
238
|
}
|
|
@@ -587,14 +242,13 @@ var useGetSpecification = ({
|
|
|
587
242
|
};
|
|
588
243
|
|
|
589
244
|
// src/hooks/core/use-list-data.ts
|
|
590
|
-
var
|
|
591
|
-
var import_utils5 = require("@fctc/interface-logic/utils");
|
|
245
|
+
var import_react13 = require("react");
|
|
592
246
|
|
|
593
247
|
// src/hooks/utils/use-debounce.ts
|
|
594
|
-
var
|
|
248
|
+
var import_react11 = require("react");
|
|
595
249
|
function useDebounce(value, delay) {
|
|
596
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
597
|
-
(0,
|
|
250
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react11.useState)(value);
|
|
251
|
+
(0, import_react11.useEffect)(() => {
|
|
598
252
|
const handler = setTimeout(() => {
|
|
599
253
|
setDebouncedValue(value);
|
|
600
254
|
}, delay);
|
|
@@ -606,7 +260,7 @@ function useDebounce(value, delay) {
|
|
|
606
260
|
}
|
|
607
261
|
|
|
608
262
|
// src/hooks/utils/use-get-rowids.ts
|
|
609
|
-
var
|
|
263
|
+
var import_react12 = require("react");
|
|
610
264
|
var useGetRowIds = (tableRef) => {
|
|
611
265
|
function isElementVisible(el) {
|
|
612
266
|
const style = window.getComputedStyle(el);
|
|
@@ -623,9 +277,9 @@ var useGetRowIds = (tableRef) => {
|
|
|
623
277
|
}
|
|
624
278
|
return true;
|
|
625
279
|
}
|
|
626
|
-
const [rowIds, setRowIds] = (0,
|
|
627
|
-
const lastRowIdsRef = (0,
|
|
628
|
-
const updateVisibleRowIds = (0,
|
|
280
|
+
const [rowIds, setRowIds] = (0, import_react12.useState)([]);
|
|
281
|
+
const lastRowIdsRef = (0, import_react12.useRef)([]);
|
|
282
|
+
const updateVisibleRowIds = (0, import_react12.useCallback)(() => {
|
|
629
283
|
const table = tableRef.current;
|
|
630
284
|
if (!table) return;
|
|
631
285
|
const rows = table.querySelectorAll("tr[data-row-id]");
|
|
@@ -643,7 +297,7 @@ var useGetRowIds = (tableRef) => {
|
|
|
643
297
|
setRowIds(uniqueIds);
|
|
644
298
|
}
|
|
645
299
|
}, [tableRef]);
|
|
646
|
-
(0,
|
|
300
|
+
(0, import_react12.useEffect)(() => {
|
|
647
301
|
const table = tableRef.current;
|
|
648
302
|
if (!table) return;
|
|
649
303
|
const mutationObserver = new MutationObserver(() => {
|
|
@@ -683,12 +337,12 @@ var useListData = ({
|
|
|
683
337
|
limit = 10
|
|
684
338
|
}) => {
|
|
685
339
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
686
|
-
const [page, setPage] = (0,
|
|
687
|
-
const [pageLimit, setPageLimit] = (0,
|
|
688
|
-
const [groupByList, setGroupByList] = (0,
|
|
689
|
-
const [domain, setDomain] = (0,
|
|
690
|
-
const [order, setOrder] = (0,
|
|
691
|
-
const [selectedRowKeys, setSelectedRowKeys] = (0,
|
|
340
|
+
const [page, setPage] = (0, import_react13.useState)(0);
|
|
341
|
+
const [pageLimit, setPageLimit] = (0, import_react13.useState)(limit);
|
|
342
|
+
const [groupByList, setGroupByList] = (0, import_react13.useState)(null);
|
|
343
|
+
const [domain, setDomain] = (0, import_react13.useState)(null);
|
|
344
|
+
const [order, setOrder] = (0, import_react13.useState)("");
|
|
345
|
+
const [selectedRowKeys, setSelectedRowKeys] = (0, import_react13.useState)([]);
|
|
692
346
|
const [debouncedPage] = useDebounce(page, 500);
|
|
693
347
|
const [debouncedDomain] = useDebounce(domain, 500);
|
|
694
348
|
const { specification } = useGetSpecification({
|
|
@@ -696,16 +350,16 @@ var useListData = ({
|
|
|
696
350
|
viewData,
|
|
697
351
|
fields: mode === "kanban" ? viewData?.views?.kanban?.fields : viewData?.views?.list?.fields
|
|
698
352
|
});
|
|
699
|
-
const listDataProps = (0,
|
|
353
|
+
const listDataProps = (0, import_react13.useMemo)(() => {
|
|
700
354
|
if (!viewData || !action || !context) {
|
|
701
355
|
return null;
|
|
702
356
|
}
|
|
703
|
-
const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0,
|
|
357
|
+
const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, utils_exports.evalJSONDomain)(action?.domain, context) : [];
|
|
704
358
|
const limit2 = pageLimit;
|
|
705
359
|
const offset = debouncedPage * pageLimit;
|
|
706
360
|
const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
|
|
707
361
|
const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
|
|
708
|
-
const sort = order ?? (0,
|
|
362
|
+
const sort = order ?? (0, utils_exports.formatSortingString)(
|
|
709
363
|
(mode === "kanban" ? viewData?.views?.kanban : viewData?.views?.list)?.default_order
|
|
710
364
|
) ?? "";
|
|
711
365
|
return {
|
|
@@ -766,7 +420,59 @@ var useListData = ({
|
|
|
766
420
|
};
|
|
767
421
|
};
|
|
768
422
|
|
|
423
|
+
// src/widget/basic/status-dropdown-field/controller.ts
|
|
424
|
+
var statusDropdownController = (props) => {
|
|
425
|
+
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
426
|
+
const env = (0, environment_exports.getEnv)();
|
|
427
|
+
const colors = {
|
|
428
|
+
normal: "bg-[#e9ecef]",
|
|
429
|
+
done: "bg-primary",
|
|
430
|
+
blocked: "bg-red-500"
|
|
431
|
+
};
|
|
432
|
+
const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
|
|
433
|
+
const buttonRef = (0, import_react14.useRef)(null);
|
|
434
|
+
(0, import_react14.useEffect)(() => {
|
|
435
|
+
const handleClickOutside = (event) => {
|
|
436
|
+
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
437
|
+
setIsOpen(false);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
441
|
+
return () => {
|
|
442
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
443
|
+
};
|
|
444
|
+
}, []);
|
|
445
|
+
const { mutate: onSave } = (0, import_hooks2.useSave)();
|
|
446
|
+
const handleClick = async (status) => {
|
|
447
|
+
setIsOpen(!isOpen);
|
|
448
|
+
onSave(
|
|
449
|
+
{
|
|
450
|
+
ids: id ? [id] : [],
|
|
451
|
+
model: model ?? "",
|
|
452
|
+
data: { [name ?? ""]: status },
|
|
453
|
+
context: env.context
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
onSuccess: () => {
|
|
457
|
+
onRefetch && onRefetch();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
};
|
|
462
|
+
return {
|
|
463
|
+
handleClick,
|
|
464
|
+
buttonRef,
|
|
465
|
+
isForm,
|
|
466
|
+
setIsOpen,
|
|
467
|
+
isOpen,
|
|
468
|
+
selection,
|
|
469
|
+
state,
|
|
470
|
+
colors
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
|
|
769
474
|
// src/widget/basic/many2one-field/controller.ts
|
|
475
|
+
var import_react15 = require("react");
|
|
770
476
|
var MANY2ONE_EXTERNAL = "many2one_external";
|
|
771
477
|
var many2oneFieldController = (props) => {
|
|
772
478
|
const {
|
|
@@ -789,7 +495,7 @@ var many2oneFieldController = (props) => {
|
|
|
789
495
|
} = props;
|
|
790
496
|
const { env } = (0, provider_exports.useEnv)();
|
|
791
497
|
const { action } = useAppProvider();
|
|
792
|
-
const { useGetSelection:
|
|
498
|
+
const { useGetSelection: useGetSelection2, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
|
|
793
499
|
const [listOptions, setListOptions] = (0, import_react15.useState)([]);
|
|
794
500
|
const [inputValue, setInputValue] = (0, import_react15.useState)("");
|
|
795
501
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
@@ -827,7 +533,7 @@ var many2oneFieldController = (props) => {
|
|
|
827
533
|
data: dataOfSelection,
|
|
828
534
|
refetch,
|
|
829
535
|
isFetching
|
|
830
|
-
} =
|
|
536
|
+
} = useGetSelection2({
|
|
831
537
|
data,
|
|
832
538
|
queryKey: [`data_${relation}`, domainObject],
|
|
833
539
|
enabled: false,
|
|
@@ -1045,20 +751,17 @@ var many2oneFieldController = (props) => {
|
|
|
1045
751
|
};
|
|
1046
752
|
|
|
1047
753
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
1048
|
-
var import_environment2 = require("@fctc/interface-logic/environment");
|
|
1049
|
-
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
1050
|
-
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
1051
754
|
var many2oneButtonController = (props) => {
|
|
1052
755
|
const { domain, methods, relation, service, xNode } = props;
|
|
1053
756
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
1054
|
-
const env = (0,
|
|
1055
|
-
const domainObject = (0,
|
|
757
|
+
const env = (0, environment_exports.getEnv)();
|
|
758
|
+
const domainObject = (0, utils_exports.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
1056
759
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
1057
|
-
const { data: dataOfSelection } = (0,
|
|
760
|
+
const { data: dataOfSelection } = (0, import_hooks2.useGetSelection)({
|
|
1058
761
|
data: {
|
|
1059
762
|
model: relation ?? "",
|
|
1060
763
|
domain: domainObject,
|
|
1061
|
-
context: { ...env.context, ...(0,
|
|
764
|
+
context: { ...env.context, ...(0, utils_exports.evalJSONContext)(actionData?.context) }
|
|
1062
765
|
},
|
|
1063
766
|
queryKey: [`data_${relation}`, domainObject],
|
|
1064
767
|
service,
|
|
@@ -1075,7 +778,6 @@ var many2oneButtonController = (props) => {
|
|
|
1075
778
|
|
|
1076
779
|
// src/widget/basic/many2many-field/controller.ts
|
|
1077
780
|
var import_react16 = require("react");
|
|
1078
|
-
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
1079
781
|
var many2manyFieldController = (props) => {
|
|
1080
782
|
const {
|
|
1081
783
|
relation,
|
|
@@ -1083,7 +785,9 @@ var many2manyFieldController = (props) => {
|
|
|
1083
785
|
context,
|
|
1084
786
|
options,
|
|
1085
787
|
enabled: enabledCallAPI,
|
|
1086
|
-
service
|
|
788
|
+
service,
|
|
789
|
+
validateAndParseDate,
|
|
790
|
+
moment
|
|
1087
791
|
} = props;
|
|
1088
792
|
const { env } = (0, provider_exports.useEnv)();
|
|
1089
793
|
const { user } = useAppProvider();
|
|
@@ -1115,7 +819,7 @@ var many2manyFieldController = (props) => {
|
|
|
1115
819
|
});
|
|
1116
820
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
1117
821
|
const optionsObject = (0, import_react16.useMemo)(
|
|
1118
|
-
() => (options && typeof options === "string" ? (0,
|
|
822
|
+
() => (options && typeof options === "string" ? (0, utils_exports.evalJSONContext)(options) : options) || {},
|
|
1119
823
|
[options]
|
|
1120
824
|
);
|
|
1121
825
|
const {
|
|
@@ -1175,10 +879,10 @@ var many2manyFieldController = (props) => {
|
|
|
1175
879
|
...columns?.filter(
|
|
1176
880
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
1177
881
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
1178
|
-
]
|
|
882
|
+
],
|
|
883
|
+
validateAndParseDate,
|
|
884
|
+
moment
|
|
1179
885
|
});
|
|
1180
|
-
const handleCreateNewOnPage = async () => {
|
|
1181
|
-
};
|
|
1182
886
|
return {
|
|
1183
887
|
rows,
|
|
1184
888
|
columns,
|
|
@@ -1201,15 +905,18 @@ var many2manyFieldController = (props) => {
|
|
|
1201
905
|
setGroupByList,
|
|
1202
906
|
setSelectedRowKeys,
|
|
1203
907
|
searchController: searchControllers,
|
|
1204
|
-
handleCreateNewOnPage,
|
|
1205
908
|
specification
|
|
1206
909
|
};
|
|
1207
910
|
};
|
|
1208
911
|
|
|
1209
912
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
1210
913
|
var import_react17 = require("react");
|
|
1211
|
-
|
|
1212
|
-
|
|
914
|
+
|
|
915
|
+
// src/constants.ts
|
|
916
|
+
var constants_exports = {};
|
|
917
|
+
__reExport(constants_exports, require("@fctc/interface-logic/constants"));
|
|
918
|
+
|
|
919
|
+
// src/widget/basic/many2many-tags-field/controller.ts
|
|
1213
920
|
var many2manyTagsController = (props) => {
|
|
1214
921
|
const {
|
|
1215
922
|
relation,
|
|
@@ -1227,13 +934,13 @@ var many2manyTagsController = (props) => {
|
|
|
1227
934
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
1228
935
|
const { env } = (0, provider_exports.useEnv)();
|
|
1229
936
|
const { action } = useAppProvider();
|
|
1230
|
-
const { useGetSelection:
|
|
937
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
1231
938
|
const [options, setOptions] = (0, import_react17.useState)([]);
|
|
1232
939
|
const [domainObject, setDomainObject] = (0, import_react17.useState)(null);
|
|
1233
940
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react17.useState)(false);
|
|
1234
|
-
const addtionalFields = optionsFields ? (0,
|
|
941
|
+
const addtionalFields = optionsFields ? (0, utils_exports.evalJSONContext)(optionsFields) : null;
|
|
1235
942
|
const contextObject = {
|
|
1236
|
-
...(0,
|
|
943
|
+
...(0, utils_exports.evalJSONContext)(action?.context) || {},
|
|
1237
944
|
...fieldContext ?? {},
|
|
1238
945
|
...env?.context
|
|
1239
946
|
};
|
|
@@ -1249,7 +956,7 @@ var many2manyTagsController = (props) => {
|
|
|
1249
956
|
[formValues, contextObject]
|
|
1250
957
|
);
|
|
1251
958
|
(0, import_react17.useEffect)(() => {
|
|
1252
|
-
const newDomain = (0,
|
|
959
|
+
const newDomain = (0, utils_exports.evalJSONDomain)(domain, parsedFormValues);
|
|
1253
960
|
setDomainObject(
|
|
1254
961
|
(prev) => JSON.stringify(prev) === JSON.stringify(newDomain) ? prev : newDomain
|
|
1255
962
|
);
|
|
@@ -1261,8 +968,8 @@ var many2manyTagsController = (props) => {
|
|
|
1261
968
|
id: {},
|
|
1262
969
|
name: {},
|
|
1263
970
|
display_name: {},
|
|
1264
|
-
...widget &&
|
|
1265
|
-
...widget &&
|
|
971
|
+
...widget && constants_exports.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
972
|
+
...widget && constants_exports.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
1266
973
|
},
|
|
1267
974
|
context: env.context
|
|
1268
975
|
};
|
|
@@ -1271,7 +978,7 @@ var many2manyTagsController = (props) => {
|
|
|
1271
978
|
data: dataOfSelection,
|
|
1272
979
|
refetch,
|
|
1273
980
|
isFetching
|
|
1274
|
-
} =
|
|
981
|
+
} = useGetSelection2({
|
|
1275
982
|
data,
|
|
1276
983
|
queryKey,
|
|
1277
984
|
service,
|
|
@@ -1324,7 +1031,6 @@ var many2manyTagsController = (props) => {
|
|
|
1324
1031
|
|
|
1325
1032
|
// src/widget/basic/status-bar-field/controller.ts
|
|
1326
1033
|
var import_react18 = require("react");
|
|
1327
|
-
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
1328
1034
|
var durationController = (props) => {
|
|
1329
1035
|
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
1330
1036
|
const specification = {
|
|
@@ -1340,7 +1046,7 @@ var durationController = (props) => {
|
|
|
1340
1046
|
const listDataProps = {
|
|
1341
1047
|
model: relation,
|
|
1342
1048
|
specification,
|
|
1343
|
-
domain: (0,
|
|
1049
|
+
domain: (0, utils_exports.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
1344
1050
|
limit: 10,
|
|
1345
1051
|
offset: 0,
|
|
1346
1052
|
fields: "",
|
|
@@ -1390,13 +1096,12 @@ var durationController = (props) => {
|
|
|
1390
1096
|
};
|
|
1391
1097
|
|
|
1392
1098
|
// src/widget/basic/priority-field/controller.ts
|
|
1393
|
-
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
1394
1099
|
var priorityFieldController = (props) => {
|
|
1395
1100
|
const { name, model, index, actionData, context, onChange, specification } = props;
|
|
1396
|
-
const _context = { ...(0,
|
|
1101
|
+
const _context = { ...(0, utils_exports.evalJSONContext)(actionData?.context) };
|
|
1397
1102
|
const contextObject = { ...context, ..._context };
|
|
1398
|
-
const { useSave:
|
|
1399
|
-
const { mutateAsync: fetchSave } =
|
|
1103
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
1104
|
+
const { mutateAsync: fetchSave } = useSave2();
|
|
1400
1105
|
const savePriorities = async ({
|
|
1401
1106
|
value,
|
|
1402
1107
|
resetPriority
|
|
@@ -1528,15 +1233,14 @@ var copyLinkButtonController = (props) => {
|
|
|
1528
1233
|
};
|
|
1529
1234
|
|
|
1530
1235
|
// src/widget/basic/color-field/color-controller.ts
|
|
1531
|
-
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
1532
1236
|
var colorFieldController = (props) => {
|
|
1533
1237
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
1534
1238
|
const { env } = (0, provider_exports.useEnv)();
|
|
1535
|
-
const { useSave:
|
|
1536
|
-
const _context = { ...(0,
|
|
1239
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
1240
|
+
const _context = { ...(0, utils_exports.evalJSONContext)(actionData?.context) || {} };
|
|
1537
1241
|
const contextObject = { ...env.context, ..._context };
|
|
1538
1242
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
1539
|
-
const { mutate: onSave } =
|
|
1243
|
+
const { mutate: onSave } = useSave2();
|
|
1540
1244
|
const savePickColor = async (colorObject) => {
|
|
1541
1245
|
const { id } = colorObject;
|
|
1542
1246
|
if (value === id) return;
|
|
@@ -1755,7 +1459,7 @@ var providerEinvoiceFieldController = (props) => {
|
|
|
1755
1459
|
const { relation, formValues, options: fieldOptions, xNode } = props;
|
|
1756
1460
|
const { env } = (0, provider_exports.useEnv)();
|
|
1757
1461
|
const { action } = useAppProvider();
|
|
1758
|
-
const { useGetSelection:
|
|
1462
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
1759
1463
|
const contextObject = {
|
|
1760
1464
|
...(typeof action?.context === "string" ? (0, utils_exports.evalJSONContext)(action?.context) : action?.context) || {},
|
|
1761
1465
|
...env?.context
|
|
@@ -1775,7 +1479,7 @@ var providerEinvoiceFieldController = (props) => {
|
|
|
1775
1479
|
},
|
|
1776
1480
|
specification: optionsObject?.specification
|
|
1777
1481
|
};
|
|
1778
|
-
const { data: listDataCard } =
|
|
1482
|
+
const { data: listDataCard } = useGetSelection2({
|
|
1779
1483
|
data,
|
|
1780
1484
|
queryKey: [`data_${relation}`],
|
|
1781
1485
|
enabled: true,
|
|
@@ -1855,7 +1559,6 @@ var tableHeadController = (props) => {
|
|
|
1855
1559
|
|
|
1856
1560
|
// src/widget/advance/table/table-view/controller.ts
|
|
1857
1561
|
var import_react24 = require("react");
|
|
1858
|
-
var import_utils18 = require("@fctc/interface-logic/utils");
|
|
1859
1562
|
var tableController = ({ data }) => {
|
|
1860
1563
|
const [rows, setRows] = (0, import_react24.useState)([]);
|
|
1861
1564
|
const [columnVisibility, setColumnVisibility] = (0, import_react24.useState)({});
|
|
@@ -1898,10 +1601,10 @@ var tableController = ({ data }) => {
|
|
|
1898
1601
|
const columns = (0, import_react24.useMemo)(() => {
|
|
1899
1602
|
try {
|
|
1900
1603
|
return mergeFields?.filter((item) => {
|
|
1901
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
1604
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? utils_exports.domainHelper.matchDomains(
|
|
1902
1605
|
data.context,
|
|
1903
1606
|
item?.column_invisible
|
|
1904
|
-
) : item?.invisible ?
|
|
1607
|
+
) : item?.invisible ? utils_exports.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
1905
1608
|
})?.map((field) => {
|
|
1906
1609
|
const overridden = columnVisibility[field?.name];
|
|
1907
1610
|
return {
|
|
@@ -2031,23 +1734,18 @@ var tableGroupController = (props) => {
|
|
|
2031
1734
|
};
|
|
2032
1735
|
|
|
2033
1736
|
// src/widget/advance/search/controller.ts
|
|
2034
|
-
var import_moment2 = __toESM(require("moment"));
|
|
2035
1737
|
var import_react26 = require("react");
|
|
2036
|
-
|
|
2037
|
-
// src/constants.ts
|
|
2038
|
-
var constants_exports = {};
|
|
2039
|
-
__reExport(constants_exports, require("@fctc/interface-logic/constants"));
|
|
2040
|
-
|
|
2041
|
-
// src/widget/advance/search/controller.ts
|
|
2042
1738
|
var searchController = ({
|
|
2043
1739
|
viewData,
|
|
2044
1740
|
model,
|
|
2045
1741
|
domain,
|
|
2046
1742
|
context,
|
|
2047
|
-
fieldsList
|
|
1743
|
+
fieldsList,
|
|
1744
|
+
validateAndParseDate,
|
|
1745
|
+
moment
|
|
2048
1746
|
}) => {
|
|
2049
1747
|
const { env } = (0, provider_exports.useEnv)();
|
|
2050
|
-
const [filterBy, setFilterBy] = (0, import_react26.useState)(
|
|
1748
|
+
const [filterBy, setFilterBy] = (0, import_react26.useState)([]);
|
|
2051
1749
|
const [searchBy, setSearchBy] = (0, import_react26.useState)(null);
|
|
2052
1750
|
const [groupBy, setGroupBy] = (0, import_react26.useState)(null);
|
|
2053
1751
|
const [selectedTags, setSelectedTags] = (0, import_react26.useState)(null);
|
|
@@ -2058,7 +1756,7 @@ var searchController = ({
|
|
|
2058
1756
|
const actionContext = typeof context === "string" ? (0, utils_exports.evalJSONContext)(context) : context;
|
|
2059
1757
|
const contextSearch = { ...env.context, ...actionContext };
|
|
2060
1758
|
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, utils_exports.evalJSONDomain)(domain, contextSearch) : [];
|
|
2061
|
-
const
|
|
1759
|
+
const resetAllStateSearch = () => {
|
|
2062
1760
|
setFilterBy([]);
|
|
2063
1761
|
setGroupBy([]);
|
|
2064
1762
|
setSearchBy([]);
|
|
@@ -2074,7 +1772,17 @@ var searchController = ({
|
|
|
2074
1772
|
const searchByItems = searchViews?.search_by?.filter(
|
|
2075
1773
|
(item) => !utils_exports.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
2076
1774
|
)?.map(
|
|
2077
|
-
({
|
|
1775
|
+
({
|
|
1776
|
+
string,
|
|
1777
|
+
name,
|
|
1778
|
+
filter_domain,
|
|
1779
|
+
operator,
|
|
1780
|
+
widget,
|
|
1781
|
+
class: classSearchItem,
|
|
1782
|
+
placeholder
|
|
1783
|
+
}, index) => ({
|
|
1784
|
+
placeholder,
|
|
1785
|
+
class: classSearchItem,
|
|
2078
1786
|
dataIndex: index,
|
|
2079
1787
|
title: string ?? dataModel?.[name]?.string,
|
|
2080
1788
|
name: name ?? dataModel?.[name]?.name,
|
|
@@ -2169,8 +1877,8 @@ var searchController = ({
|
|
|
2169
1877
|
} else if (value?.modelType === "datetime") {
|
|
2170
1878
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
2171
1879
|
const parsedDate = validateAndParseDate(value?.value, true);
|
|
2172
|
-
const hasTime = (
|
|
2173
|
-
valueDomainItem = hasTime ? (
|
|
1880
|
+
const hasTime = moment(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
1881
|
+
valueDomainItem = hasTime ? moment(parsedDate).format("YYYY-MM-DD HH:mm:ss") : moment(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
2174
1882
|
} else {
|
|
2175
1883
|
valueDomainItem = validateAndParseDate(value?.value, true);
|
|
2176
1884
|
}
|
|
@@ -2195,7 +1903,8 @@ var searchController = ({
|
|
|
2195
1903
|
type,
|
|
2196
1904
|
widget,
|
|
2197
1905
|
modelType,
|
|
2198
|
-
dataIndex
|
|
1906
|
+
dataIndex,
|
|
1907
|
+
date
|
|
2199
1908
|
} = objValues[0];
|
|
2200
1909
|
if (!key?.includes(constants_exports.SearchType.GROUP)) {
|
|
2201
1910
|
const values = objValues?.map((objValue) => objValue.value);
|
|
@@ -2205,7 +1914,8 @@ var searchController = ({
|
|
|
2205
1914
|
values,
|
|
2206
1915
|
type,
|
|
2207
1916
|
widget,
|
|
2208
|
-
modelType
|
|
1917
|
+
modelType,
|
|
1918
|
+
date
|
|
2209
1919
|
};
|
|
2210
1920
|
} else {
|
|
2211
1921
|
const contexts = [];
|
|
@@ -2246,6 +1956,19 @@ var searchController = ({
|
|
|
2246
1956
|
},
|
|
2247
1957
|
[searchMap]
|
|
2248
1958
|
);
|
|
1959
|
+
const removeSearchItemsByType = (type) => {
|
|
1960
|
+
const newSearchMap = {};
|
|
1961
|
+
Object.entries(searchMap).forEach(([key, values]) => {
|
|
1962
|
+
const isGroup = key.includes(constants_exports.SearchType.GROUP);
|
|
1963
|
+
const isFilter = key.includes(constants_exports.SearchType.FILTER);
|
|
1964
|
+
const isSearch = key.includes(constants_exports.SearchType.SEARCH);
|
|
1965
|
+
if (type === constants_exports.SearchType.GROUP && isGroup) return;
|
|
1966
|
+
if (type === constants_exports.SearchType.FILTER && isFilter) return;
|
|
1967
|
+
if (type === constants_exports.SearchType.SEARCH && isSearch) return;
|
|
1968
|
+
newSearchMap[key] = values;
|
|
1969
|
+
});
|
|
1970
|
+
setSearchMap(newSearchMap);
|
|
1971
|
+
};
|
|
2249
1972
|
(0, import_react26.useEffect)(() => {
|
|
2250
1973
|
setTagSearch(searchMap);
|
|
2251
1974
|
}, [searchMap]);
|
|
@@ -2343,7 +2066,7 @@ var searchController = ({
|
|
|
2343
2066
|
setFilterBy,
|
|
2344
2067
|
setGroupBy,
|
|
2345
2068
|
setSearchBy,
|
|
2346
|
-
|
|
2069
|
+
resetAllStateSearch,
|
|
2347
2070
|
setSelectedTags,
|
|
2348
2071
|
removeSearchItems,
|
|
2349
2072
|
onSearchString: onChangeSearchInput,
|
|
@@ -2353,7 +2076,8 @@ var searchController = ({
|
|
|
2353
2076
|
onKeyDown,
|
|
2354
2077
|
handleMouseEnter,
|
|
2355
2078
|
handleMouseLeave,
|
|
2356
|
-
hoveredIndexSearchList
|
|
2079
|
+
hoveredIndexSearchList,
|
|
2080
|
+
removeSearchItemsByType
|
|
2357
2081
|
};
|
|
2358
2082
|
};
|
|
2359
2083
|
// Annotate the CommonJS export names for ESM import in node:
|