@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/index.mjs
CHANGED
|
@@ -142,8 +142,7 @@ __export(index_exports, {
|
|
|
142
142
|
useValidateActionToken: () => useValidateActionToken,
|
|
143
143
|
useVerify2FA: () => useVerify2FA,
|
|
144
144
|
useVerifyTotp: () => useVerifyTotp,
|
|
145
|
-
useViewV2: () => useViewV2
|
|
146
|
-
validateAndParseDate: () => validateAndParseDate
|
|
145
|
+
useViewV2: () => useViewV2
|
|
147
146
|
});
|
|
148
147
|
|
|
149
148
|
// src/hooks.ts
|
|
@@ -307,8 +306,7 @@ __export(utils_exports, {
|
|
|
307
306
|
languages: () => languages,
|
|
308
307
|
mergeButtons: () => mergeButtons,
|
|
309
308
|
setStorageItemAsync: () => setStorageItemAsync,
|
|
310
|
-
useStorageState: () => useStorageState
|
|
311
|
-
validateAndParseDate: () => validateAndParseDate
|
|
309
|
+
useStorageState: () => useStorageState
|
|
312
310
|
});
|
|
313
311
|
|
|
314
312
|
// src/utils/constants.ts
|
|
@@ -404,290 +402,6 @@ var guessTypeFromUrl = (url) => {
|
|
|
404
402
|
return map[ext] || null;
|
|
405
403
|
};
|
|
406
404
|
|
|
407
|
-
// src/utils/format-date.ts
|
|
408
|
-
import moment from "moment";
|
|
409
|
-
var validateAndParseDate = (input, isDateTime = false) => {
|
|
410
|
-
if (!input || typeof input !== "string") return null;
|
|
411
|
-
const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
|
|
412
|
-
const dateFormat = "YYYY-MM-DD";
|
|
413
|
-
const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
|
|
414
|
-
const currentDay = moment().format("DD");
|
|
415
|
-
const currentMonth = moment().format("MM");
|
|
416
|
-
const currentYear = moment().format("YYYY");
|
|
417
|
-
const defaultTime = "00:00:00";
|
|
418
|
-
const maxYear = parseInt(currentYear) + 10;
|
|
419
|
-
const isValidDate = (day, month, year) => {
|
|
420
|
-
const date = moment(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
|
|
421
|
-
return date.isValid();
|
|
422
|
-
};
|
|
423
|
-
const isValidTime = (hour, minute = "00", second = "00") => {
|
|
424
|
-
const h = parseInt(hour, 10);
|
|
425
|
-
const m = parseInt(minute, 10);
|
|
426
|
-
const s = parseInt(second, 10);
|
|
427
|
-
return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
|
|
428
|
-
};
|
|
429
|
-
const formatOutput = (day, month, year, time = defaultTime) => {
|
|
430
|
-
let result = moment(
|
|
431
|
-
`${day}-${month}-${year} ${time}`,
|
|
432
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
433
|
-
);
|
|
434
|
-
if (!result.isValid()) return null;
|
|
435
|
-
if (isDateTime) {
|
|
436
|
-
result = result.subtract(7, "hours");
|
|
437
|
-
return result.format(dateTimeFormat);
|
|
438
|
-
}
|
|
439
|
-
return result.format(dateFormat);
|
|
440
|
-
};
|
|
441
|
-
if (isDateTime && input.match(
|
|
442
|
-
/^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
|
|
443
|
-
)) {
|
|
444
|
-
const [datePart, timePart] = input.split(/\s+/);
|
|
445
|
-
const dateParts = datePart.split(/[\/-]/);
|
|
446
|
-
const timeParts = timePart.split(":");
|
|
447
|
-
const day = dateParts[0].padStart(2, "0");
|
|
448
|
-
const month = dateParts[1].padStart(2, "0");
|
|
449
|
-
const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
|
|
450
|
-
const hour = timeParts[0].padStart(2, "0");
|
|
451
|
-
const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
|
|
452
|
-
const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
|
|
453
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
454
|
-
let result = moment(
|
|
455
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
456
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
457
|
-
);
|
|
458
|
-
if (!result.isValid()) return null;
|
|
459
|
-
result = result.subtract(7, "hours");
|
|
460
|
-
return result.format(dateTimeFormat);
|
|
461
|
-
}
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
|
465
|
-
const [year, month, day] = cleanInput.split("-");
|
|
466
|
-
if (isValidDate(day, month, year)) {
|
|
467
|
-
return formatOutput(day, month, year);
|
|
468
|
-
}
|
|
469
|
-
return null;
|
|
470
|
-
}
|
|
471
|
-
if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
|
|
472
|
-
const [day, month, year] = cleanInput.split("/");
|
|
473
|
-
const paddedDay = day.padStart(2, "0");
|
|
474
|
-
const paddedMonth = month.padStart(2, "0");
|
|
475
|
-
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
476
|
-
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
477
|
-
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
478
|
-
}
|
|
479
|
-
return null;
|
|
480
|
-
}
|
|
481
|
-
if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
|
|
482
|
-
const [day, month, year] = cleanInput.split("-");
|
|
483
|
-
const paddedDay = day.padStart(2, "0");
|
|
484
|
-
const paddedMonth = month.padStart(2, "0");
|
|
485
|
-
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
486
|
-
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
487
|
-
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
488
|
-
}
|
|
489
|
-
return null;
|
|
490
|
-
}
|
|
491
|
-
if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
|
|
492
|
-
const [day, month] = cleanInput.split(/[\/-]/);
|
|
493
|
-
const paddedDay = day.padStart(2, "0");
|
|
494
|
-
const paddedMonth = month.padStart(2, "0");
|
|
495
|
-
if (isValidDate(paddedDay, paddedMonth, currentYear)) {
|
|
496
|
-
return formatOutput(paddedDay, paddedMonth, currentYear);
|
|
497
|
-
}
|
|
498
|
-
return null;
|
|
499
|
-
}
|
|
500
|
-
if (cleanInput.match(/^\d{4}$/)) {
|
|
501
|
-
const num = parseInt(cleanInput, 10);
|
|
502
|
-
if (num >= 2e3 && num <= maxYear) {
|
|
503
|
-
if (isValidDate(currentDay, currentMonth, num.toString())) {
|
|
504
|
-
return formatOutput(currentDay, currentMonth, num.toString());
|
|
505
|
-
}
|
|
506
|
-
return null;
|
|
507
|
-
}
|
|
508
|
-
const day = cleanInput.slice(0, 2);
|
|
509
|
-
const month = cleanInput.slice(2, 4);
|
|
510
|
-
if (isValidDate(day, month, currentYear)) {
|
|
511
|
-
return formatOutput(day, month, currentYear);
|
|
512
|
-
}
|
|
513
|
-
return null;
|
|
514
|
-
}
|
|
515
|
-
if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
|
|
516
|
-
const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
|
|
517
|
-
let result = moment().subtract(daysToSubtract, "days");
|
|
518
|
-
if (isDateTime) {
|
|
519
|
-
result = result.subtract(7, "hours");
|
|
520
|
-
}
|
|
521
|
-
if (result.isValid()) {
|
|
522
|
-
return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
|
|
523
|
-
}
|
|
524
|
-
return null;
|
|
525
|
-
}
|
|
526
|
-
if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
|
|
527
|
-
const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
|
|
528
|
-
const day = parts[0].padStart(2, "0");
|
|
529
|
-
const month = parts[1].padStart(2, "0");
|
|
530
|
-
let year = parts[2];
|
|
531
|
-
year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
|
|
532
|
-
if (isValidDate(day, month, year)) {
|
|
533
|
-
return formatOutput(day, month, year);
|
|
534
|
-
}
|
|
535
|
-
return null;
|
|
536
|
-
}
|
|
537
|
-
if (isDateTime) {
|
|
538
|
-
if (cleanInput.length === 9) {
|
|
539
|
-
const day = cleanInput.slice(0, 2);
|
|
540
|
-
const month = cleanInput.slice(2, 4);
|
|
541
|
-
const year = cleanInput.slice(4, 8);
|
|
542
|
-
const hour = cleanInput.slice(8, 9).padStart(2, "0");
|
|
543
|
-
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
544
|
-
let result = moment(
|
|
545
|
-
`${day}-${month}-${year} ${hour}:00:00`,
|
|
546
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
547
|
-
);
|
|
548
|
-
if (!result.isValid()) return null;
|
|
549
|
-
result = result.subtract(7, "hours");
|
|
550
|
-
return result.format(dateTimeFormat);
|
|
551
|
-
}
|
|
552
|
-
return null;
|
|
553
|
-
}
|
|
554
|
-
if (cleanInput.length === 10) {
|
|
555
|
-
const day = cleanInput.slice(0, 2);
|
|
556
|
-
const month = cleanInput.slice(2, 4);
|
|
557
|
-
const year = cleanInput.slice(4, 8);
|
|
558
|
-
const hour = cleanInput.slice(8, 10);
|
|
559
|
-
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
560
|
-
let result = moment(
|
|
561
|
-
`${day}-${month}-${year} ${hour}:00:00`,
|
|
562
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
563
|
-
);
|
|
564
|
-
if (!result.isValid()) return null;
|
|
565
|
-
result = result.subtract(7, "hours");
|
|
566
|
-
return result.format(dateTimeFormat);
|
|
567
|
-
}
|
|
568
|
-
return null;
|
|
569
|
-
}
|
|
570
|
-
if (cleanInput.length === 11) {
|
|
571
|
-
const day = cleanInput.slice(0, 2);
|
|
572
|
-
const month = cleanInput.slice(2, 4);
|
|
573
|
-
const year = cleanInput.slice(4, 8);
|
|
574
|
-
const hour = cleanInput.slice(8, 10);
|
|
575
|
-
const minute = cleanInput.slice(10, 11).padStart(2, "0");
|
|
576
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
577
|
-
let result = moment(
|
|
578
|
-
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
579
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
580
|
-
);
|
|
581
|
-
if (!result.isValid()) return null;
|
|
582
|
-
result = result.subtract(7, "hours");
|
|
583
|
-
return result.format(dateTimeFormat);
|
|
584
|
-
}
|
|
585
|
-
return null;
|
|
586
|
-
}
|
|
587
|
-
if (cleanInput.length === 12) {
|
|
588
|
-
const day = cleanInput.slice(0, 2);
|
|
589
|
-
const month = cleanInput.slice(2, 4);
|
|
590
|
-
const year = cleanInput.slice(4, 8);
|
|
591
|
-
const hour = cleanInput.slice(8, 10);
|
|
592
|
-
const minute = cleanInput.slice(10, 12);
|
|
593
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
594
|
-
let result = moment(
|
|
595
|
-
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
596
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
597
|
-
);
|
|
598
|
-
if (!result.isValid()) return null;
|
|
599
|
-
result = result.subtract(7, "hours");
|
|
600
|
-
return result.format(dateTimeFormat);
|
|
601
|
-
}
|
|
602
|
-
return null;
|
|
603
|
-
}
|
|
604
|
-
if (cleanInput.length === 13) {
|
|
605
|
-
const day = cleanInput.slice(0, 2);
|
|
606
|
-
const month = cleanInput.slice(2, 4);
|
|
607
|
-
const year = cleanInput.slice(4, 8);
|
|
608
|
-
const hour = cleanInput.slice(8, 10);
|
|
609
|
-
const minute = cleanInput.slice(10, 12);
|
|
610
|
-
const second = cleanInput.slice(12, 13).padStart(2, "0");
|
|
611
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
612
|
-
let result = moment(
|
|
613
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
614
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
615
|
-
);
|
|
616
|
-
if (!result.isValid()) return null;
|
|
617
|
-
result = result.subtract(7, "hours");
|
|
618
|
-
return result.format(dateTimeFormat);
|
|
619
|
-
}
|
|
620
|
-
return null;
|
|
621
|
-
}
|
|
622
|
-
if (cleanInput.length === 14) {
|
|
623
|
-
const day = cleanInput.slice(0, 2);
|
|
624
|
-
const month = cleanInput.slice(2, 4);
|
|
625
|
-
const year = cleanInput.slice(4, 8);
|
|
626
|
-
const hour = cleanInput.slice(8, 10);
|
|
627
|
-
const minute = cleanInput.slice(10, 12);
|
|
628
|
-
const second = cleanInput.slice(12, 14);
|
|
629
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
630
|
-
let result = moment(
|
|
631
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
632
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
633
|
-
);
|
|
634
|
-
if (!result.isValid()) return null;
|
|
635
|
-
result = result.subtract(7, "hours");
|
|
636
|
-
return result.format(dateTimeFormat);
|
|
637
|
-
}
|
|
638
|
-
return null;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
const len = cleanInput.length;
|
|
642
|
-
if (len === 1 || len === 2) {
|
|
643
|
-
const paddedDay = cleanInput.padStart(2, "0");
|
|
644
|
-
if (isValidDate(paddedDay, currentMonth, currentYear)) {
|
|
645
|
-
return formatOutput(paddedDay, currentMonth, currentYear);
|
|
646
|
-
}
|
|
647
|
-
return null;
|
|
648
|
-
}
|
|
649
|
-
if (len === 3) {
|
|
650
|
-
const day = cleanInput.slice(0, 2);
|
|
651
|
-
const month = cleanInput.slice(2, 3).padStart(2, "0");
|
|
652
|
-
if (isValidDate(day, month, currentYear)) {
|
|
653
|
-
return formatOutput(day, month, currentYear);
|
|
654
|
-
}
|
|
655
|
-
return null;
|
|
656
|
-
}
|
|
657
|
-
if (len === 6) {
|
|
658
|
-
const day = cleanInput.slice(0, 2);
|
|
659
|
-
const month = cleanInput.slice(2, 4);
|
|
660
|
-
let year = cleanInput.slice(4, 6);
|
|
661
|
-
year = `20${year}`;
|
|
662
|
-
if (parseInt(month) > 12) {
|
|
663
|
-
if (isValidDate(day, currentMonth, currentYear)) {
|
|
664
|
-
return formatOutput(day, currentMonth, currentYear);
|
|
665
|
-
}
|
|
666
|
-
return null;
|
|
667
|
-
}
|
|
668
|
-
if (isValidDate(day, month, year)) {
|
|
669
|
-
return formatOutput(day, month, year);
|
|
670
|
-
}
|
|
671
|
-
return null;
|
|
672
|
-
}
|
|
673
|
-
if (len === 7) {
|
|
674
|
-
return null;
|
|
675
|
-
}
|
|
676
|
-
if (len === 8) {
|
|
677
|
-
const day = cleanInput.slice(0, 2);
|
|
678
|
-
const month = cleanInput.slice(2, 4);
|
|
679
|
-
const year = cleanInput.slice(4, 8);
|
|
680
|
-
if (isValidDate(day, month, year)) {
|
|
681
|
-
return formatOutput(day, month, year);
|
|
682
|
-
}
|
|
683
|
-
return null;
|
|
684
|
-
}
|
|
685
|
-
if (len > 8 && !isDateTime) {
|
|
686
|
-
return null;
|
|
687
|
-
}
|
|
688
|
-
return null;
|
|
689
|
-
};
|
|
690
|
-
|
|
691
405
|
// src/utils.ts
|
|
692
406
|
__reExport(utils_exports, utils_star);
|
|
693
407
|
import * as utils_star from "@fctc/interface-logic/utils";
|
|
@@ -1096,10 +810,6 @@ var useGetSpecification = ({
|
|
|
1096
810
|
|
|
1097
811
|
// src/hooks/core/use-list-data.ts
|
|
1098
812
|
import { useMemo as useMemo6, useState as useState5 } from "react";
|
|
1099
|
-
import {
|
|
1100
|
-
evalJSONDomain,
|
|
1101
|
-
formatSortingString
|
|
1102
|
-
} from "@fctc/interface-logic/utils";
|
|
1103
813
|
|
|
1104
814
|
// src/hooks/utils/use-debounce.ts
|
|
1105
815
|
import { useEffect as useEffect6, useState as useState3 } from "react";
|
|
@@ -1211,12 +921,12 @@ var useListData = ({
|
|
|
1211
921
|
if (!viewData || !action || !context) {
|
|
1212
922
|
return null;
|
|
1213
923
|
}
|
|
1214
|
-
const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : evalJSONDomain(action?.domain, context) : [];
|
|
924
|
+
const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, utils_exports.evalJSONDomain)(action?.domain, context) : [];
|
|
1215
925
|
const limit2 = pageLimit;
|
|
1216
926
|
const offset = debouncedPage * pageLimit;
|
|
1217
927
|
const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
|
|
1218
928
|
const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
|
|
1219
|
-
const sort = order ?? formatSortingString(
|
|
929
|
+
const sort = order ?? (0, utils_exports.formatSortingString)(
|
|
1220
930
|
(mode === "kanban" ? viewData?.views?.kanban : viewData?.views?.list)?.default_order
|
|
1221
931
|
) ?? "";
|
|
1222
932
|
return {
|
|
@@ -1287,11 +997,16 @@ __reExport(index_exports, config_exports);
|
|
|
1287
997
|
|
|
1288
998
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
1289
999
|
import { useEffect as useEffect8, useRef as useRef2, useState as useState6 } from "react";
|
|
1290
|
-
|
|
1291
|
-
|
|
1000
|
+
|
|
1001
|
+
// src/environment.ts
|
|
1002
|
+
var environment_exports = {};
|
|
1003
|
+
__reExport(environment_exports, environment_star);
|
|
1004
|
+
import * as environment_star from "@fctc/interface-logic/environment";
|
|
1005
|
+
|
|
1006
|
+
// src/widget/basic/status-dropdown-field/controller.ts
|
|
1292
1007
|
var statusDropdownController = (props) => {
|
|
1293
1008
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
1294
|
-
const env = getEnv();
|
|
1009
|
+
const env = (0, environment_exports.getEnv)();
|
|
1295
1010
|
const colors = {
|
|
1296
1011
|
normal: "bg-[#e9ecef]",
|
|
1297
1012
|
done: "bg-primary",
|
|
@@ -1310,7 +1025,7 @@ var statusDropdownController = (props) => {
|
|
|
1310
1025
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1311
1026
|
};
|
|
1312
1027
|
}, []);
|
|
1313
|
-
const { mutate: onSave } =
|
|
1028
|
+
const { mutate: onSave } = useSave();
|
|
1314
1029
|
const handleClick = async (status) => {
|
|
1315
1030
|
setIsOpen(!isOpen);
|
|
1316
1031
|
onSave(
|
|
@@ -1363,7 +1078,7 @@ var many2oneFieldController = (props) => {
|
|
|
1363
1078
|
} = props;
|
|
1364
1079
|
const { env } = (0, provider_exports.useEnv)();
|
|
1365
1080
|
const { action } = useAppProvider();
|
|
1366
|
-
const { useGetSelection:
|
|
1081
|
+
const { useGetSelection: useGetSelection2, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
|
|
1367
1082
|
const [listOptions, setListOptions] = useState7([]);
|
|
1368
1083
|
const [inputValue, setInputValue] = useState7("");
|
|
1369
1084
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
@@ -1401,7 +1116,7 @@ var many2oneFieldController = (props) => {
|
|
|
1401
1116
|
data: dataOfSelection,
|
|
1402
1117
|
refetch,
|
|
1403
1118
|
isFetching
|
|
1404
|
-
} =
|
|
1119
|
+
} = useGetSelection2({
|
|
1405
1120
|
data,
|
|
1406
1121
|
queryKey: [`data_${relation}`, domainObject],
|
|
1407
1122
|
enabled: false,
|
|
@@ -1619,20 +1334,17 @@ var many2oneFieldController = (props) => {
|
|
|
1619
1334
|
};
|
|
1620
1335
|
|
|
1621
1336
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
1622
|
-
import { getEnv as getEnv2 } from "@fctc/interface-logic/environment";
|
|
1623
|
-
import { useGetSelection as useGetSelection2 } from "@fctc/interface-logic/hooks";
|
|
1624
|
-
import { evalJSONDomain as evalJSONDomain3, evalJSONContext as evalJSONContext3 } from "@fctc/interface-logic/utils";
|
|
1625
1337
|
var many2oneButtonController = (props) => {
|
|
1626
1338
|
const { domain, methods, relation, service, xNode } = props;
|
|
1627
1339
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
1628
|
-
const env =
|
|
1629
|
-
const domainObject =
|
|
1340
|
+
const env = (0, environment_exports.getEnv)();
|
|
1341
|
+
const domainObject = (0, utils_exports.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
1630
1342
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
1631
|
-
const { data: dataOfSelection } =
|
|
1343
|
+
const { data: dataOfSelection } = useGetSelection({
|
|
1632
1344
|
data: {
|
|
1633
1345
|
model: relation ?? "",
|
|
1634
1346
|
domain: domainObject,
|
|
1635
|
-
context: { ...env.context, ...
|
|
1347
|
+
context: { ...env.context, ...(0, utils_exports.evalJSONContext)(actionData?.context) }
|
|
1636
1348
|
},
|
|
1637
1349
|
queryKey: [`data_${relation}`, domainObject],
|
|
1638
1350
|
service,
|
|
@@ -1649,7 +1361,6 @@ var many2oneButtonController = (props) => {
|
|
|
1649
1361
|
|
|
1650
1362
|
// src/widget/basic/many2many-field/controller.ts
|
|
1651
1363
|
import { useEffect as useEffect10, useMemo as useMemo8 } from "react";
|
|
1652
|
-
import { evalJSONContext as evalJSONContext4 } from "@fctc/interface-logic/utils";
|
|
1653
1364
|
var many2manyFieldController = (props) => {
|
|
1654
1365
|
const {
|
|
1655
1366
|
relation,
|
|
@@ -1657,7 +1368,9 @@ var many2manyFieldController = (props) => {
|
|
|
1657
1368
|
context,
|
|
1658
1369
|
options,
|
|
1659
1370
|
enabled: enabledCallAPI,
|
|
1660
|
-
service
|
|
1371
|
+
service,
|
|
1372
|
+
validateAndParseDate,
|
|
1373
|
+
moment
|
|
1661
1374
|
} = props;
|
|
1662
1375
|
const { env } = (0, provider_exports.useEnv)();
|
|
1663
1376
|
const { user } = useAppProvider();
|
|
@@ -1689,7 +1402,7 @@ var many2manyFieldController = (props) => {
|
|
|
1689
1402
|
});
|
|
1690
1403
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
1691
1404
|
const optionsObject = useMemo8(
|
|
1692
|
-
() => (options && typeof options === "string" ?
|
|
1405
|
+
() => (options && typeof options === "string" ? (0, utils_exports.evalJSONContext)(options) : options) || {},
|
|
1693
1406
|
[options]
|
|
1694
1407
|
);
|
|
1695
1408
|
const {
|
|
@@ -1749,10 +1462,10 @@ var many2manyFieldController = (props) => {
|
|
|
1749
1462
|
...columns?.filter(
|
|
1750
1463
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
1751
1464
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
1752
|
-
]
|
|
1465
|
+
],
|
|
1466
|
+
validateAndParseDate,
|
|
1467
|
+
moment
|
|
1753
1468
|
});
|
|
1754
|
-
const handleCreateNewOnPage = async () => {
|
|
1755
|
-
};
|
|
1756
1469
|
return {
|
|
1757
1470
|
rows,
|
|
1758
1471
|
columns,
|
|
@@ -1775,15 +1488,19 @@ var many2manyFieldController = (props) => {
|
|
|
1775
1488
|
setGroupByList,
|
|
1776
1489
|
setSelectedRowKeys,
|
|
1777
1490
|
searchController: searchControllers,
|
|
1778
|
-
handleCreateNewOnPage,
|
|
1779
1491
|
specification
|
|
1780
1492
|
};
|
|
1781
1493
|
};
|
|
1782
1494
|
|
|
1783
1495
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
1784
1496
|
import { useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo9, useState as useState8 } from "react";
|
|
1785
|
-
|
|
1786
|
-
|
|
1497
|
+
|
|
1498
|
+
// src/constants.ts
|
|
1499
|
+
var constants_exports = {};
|
|
1500
|
+
__reExport(constants_exports, constants_star);
|
|
1501
|
+
import * as constants_star from "@fctc/interface-logic/constants";
|
|
1502
|
+
|
|
1503
|
+
// src/widget/basic/many2many-tags-field/controller.ts
|
|
1787
1504
|
var many2manyTagsController = (props) => {
|
|
1788
1505
|
const {
|
|
1789
1506
|
relation,
|
|
@@ -1801,13 +1518,13 @@ var many2manyTagsController = (props) => {
|
|
|
1801
1518
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
1802
1519
|
const { env } = (0, provider_exports.useEnv)();
|
|
1803
1520
|
const { action } = useAppProvider();
|
|
1804
|
-
const { useGetSelection:
|
|
1521
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
1805
1522
|
const [options, setOptions] = useState8([]);
|
|
1806
1523
|
const [domainObject, setDomainObject] = useState8(null);
|
|
1807
1524
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = useState8(false);
|
|
1808
|
-
const addtionalFields = optionsFields ?
|
|
1525
|
+
const addtionalFields = optionsFields ? (0, utils_exports.evalJSONContext)(optionsFields) : null;
|
|
1809
1526
|
const contextObject = {
|
|
1810
|
-
...
|
|
1527
|
+
...(0, utils_exports.evalJSONContext)(action?.context) || {},
|
|
1811
1528
|
...fieldContext ?? {},
|
|
1812
1529
|
...env?.context
|
|
1813
1530
|
};
|
|
@@ -1823,7 +1540,7 @@ var many2manyTagsController = (props) => {
|
|
|
1823
1540
|
[formValues, contextObject]
|
|
1824
1541
|
);
|
|
1825
1542
|
useEffect11(() => {
|
|
1826
|
-
const newDomain =
|
|
1543
|
+
const newDomain = (0, utils_exports.evalJSONDomain)(domain, parsedFormValues);
|
|
1827
1544
|
setDomainObject(
|
|
1828
1545
|
(prev) => JSON.stringify(prev) === JSON.stringify(newDomain) ? prev : newDomain
|
|
1829
1546
|
);
|
|
@@ -1835,8 +1552,8 @@ var many2manyTagsController = (props) => {
|
|
|
1835
1552
|
id: {},
|
|
1836
1553
|
name: {},
|
|
1837
1554
|
display_name: {},
|
|
1838
|
-
...widget && WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
1839
|
-
...widget && WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
1555
|
+
...widget && constants_exports.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
1556
|
+
...widget && constants_exports.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
1840
1557
|
},
|
|
1841
1558
|
context: env.context
|
|
1842
1559
|
};
|
|
@@ -1845,7 +1562,7 @@ var many2manyTagsController = (props) => {
|
|
|
1845
1562
|
data: dataOfSelection,
|
|
1846
1563
|
refetch,
|
|
1847
1564
|
isFetching
|
|
1848
|
-
} =
|
|
1565
|
+
} = useGetSelection2({
|
|
1849
1566
|
data,
|
|
1850
1567
|
queryKey,
|
|
1851
1568
|
service,
|
|
@@ -1898,7 +1615,6 @@ var many2manyTagsController = (props) => {
|
|
|
1898
1615
|
|
|
1899
1616
|
// src/widget/basic/status-bar-field/controller.ts
|
|
1900
1617
|
import { useState as useState9 } from "react";
|
|
1901
|
-
import { evalJSONDomain as evalJSONDomain5 } from "@fctc/interface-logic/utils";
|
|
1902
1618
|
var durationController = (props) => {
|
|
1903
1619
|
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
1904
1620
|
const specification = {
|
|
@@ -1914,7 +1630,7 @@ var durationController = (props) => {
|
|
|
1914
1630
|
const listDataProps = {
|
|
1915
1631
|
model: relation,
|
|
1916
1632
|
specification,
|
|
1917
|
-
domain:
|
|
1633
|
+
domain: (0, utils_exports.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
1918
1634
|
limit: 10,
|
|
1919
1635
|
offset: 0,
|
|
1920
1636
|
fields: "",
|
|
@@ -1964,13 +1680,12 @@ var durationController = (props) => {
|
|
|
1964
1680
|
};
|
|
1965
1681
|
|
|
1966
1682
|
// src/widget/basic/priority-field/controller.ts
|
|
1967
|
-
import { evalJSONContext as evalJSONContext6 } from "@fctc/interface-logic/utils";
|
|
1968
1683
|
var priorityFieldController = (props) => {
|
|
1969
1684
|
const { name, model, index, actionData, context, onChange, specification } = props;
|
|
1970
|
-
const _context = { ...
|
|
1685
|
+
const _context = { ...(0, utils_exports.evalJSONContext)(actionData?.context) };
|
|
1971
1686
|
const contextObject = { ...context, ..._context };
|
|
1972
|
-
const { useSave:
|
|
1973
|
-
const { mutateAsync: fetchSave } =
|
|
1687
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
1688
|
+
const { mutateAsync: fetchSave } = useSave2();
|
|
1974
1689
|
const savePriorities = async ({
|
|
1975
1690
|
value,
|
|
1976
1691
|
resetPriority
|
|
@@ -2102,15 +1817,14 @@ var copyLinkButtonController = (props) => {
|
|
|
2102
1817
|
};
|
|
2103
1818
|
|
|
2104
1819
|
// src/widget/basic/color-field/color-controller.ts
|
|
2105
|
-
import { evalJSONContext as evalJSONContext7 } from "@fctc/interface-logic/utils";
|
|
2106
1820
|
var colorFieldController = (props) => {
|
|
2107
1821
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
2108
1822
|
const { env } = (0, provider_exports.useEnv)();
|
|
2109
|
-
const { useSave:
|
|
2110
|
-
const _context = { ...
|
|
1823
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
1824
|
+
const _context = { ...(0, utils_exports.evalJSONContext)(actionData?.context) || {} };
|
|
2111
1825
|
const contextObject = { ...env.context, ..._context };
|
|
2112
1826
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
2113
|
-
const { mutate: onSave } =
|
|
1827
|
+
const { mutate: onSave } = useSave2();
|
|
2114
1828
|
const savePickColor = async (colorObject) => {
|
|
2115
1829
|
const { id } = colorObject;
|
|
2116
1830
|
if (value === id) return;
|
|
@@ -2329,7 +2043,7 @@ var providerEinvoiceFieldController = (props) => {
|
|
|
2329
2043
|
const { relation, formValues, options: fieldOptions, xNode } = props;
|
|
2330
2044
|
const { env } = (0, provider_exports.useEnv)();
|
|
2331
2045
|
const { action } = useAppProvider();
|
|
2332
|
-
const { useGetSelection:
|
|
2046
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
2333
2047
|
const contextObject = {
|
|
2334
2048
|
...(typeof action?.context === "string" ? (0, utils_exports.evalJSONContext)(action?.context) : action?.context) || {},
|
|
2335
2049
|
...env?.context
|
|
@@ -2349,7 +2063,7 @@ var providerEinvoiceFieldController = (props) => {
|
|
|
2349
2063
|
},
|
|
2350
2064
|
specification: optionsObject?.specification
|
|
2351
2065
|
};
|
|
2352
|
-
const { data: listDataCard } =
|
|
2066
|
+
const { data: listDataCard } = useGetSelection2({
|
|
2353
2067
|
data,
|
|
2354
2068
|
queryKey: [`data_${relation}`],
|
|
2355
2069
|
enabled: true,
|
|
@@ -2429,7 +2143,6 @@ var tableHeadController = (props) => {
|
|
|
2429
2143
|
|
|
2430
2144
|
// src/widget/advance/table/table-view/controller.ts
|
|
2431
2145
|
import { useCallback as useCallback6, useEffect as useEffect13, useMemo as useMemo11, useState as useState14 } from "react";
|
|
2432
|
-
import { domainHelper } from "@fctc/interface-logic/utils";
|
|
2433
2146
|
var tableController = ({ data }) => {
|
|
2434
2147
|
const [rows, setRows] = useState14([]);
|
|
2435
2148
|
const [columnVisibility, setColumnVisibility] = useState14({});
|
|
@@ -2472,10 +2185,10 @@ var tableController = ({ data }) => {
|
|
|
2472
2185
|
const columns = useMemo11(() => {
|
|
2473
2186
|
try {
|
|
2474
2187
|
return mergeFields?.filter((item) => {
|
|
2475
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? domainHelper.matchDomains(
|
|
2188
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? utils_exports.domainHelper.matchDomains(
|
|
2476
2189
|
data.context,
|
|
2477
2190
|
item?.column_invisible
|
|
2478
|
-
) : item?.invisible ? domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
2191
|
+
) : item?.invisible ? utils_exports.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
2479
2192
|
})?.map((field) => {
|
|
2480
2193
|
const overridden = columnVisibility[field?.name];
|
|
2481
2194
|
return {
|
|
@@ -2605,24 +2318,18 @@ var tableGroupController = (props) => {
|
|
|
2605
2318
|
};
|
|
2606
2319
|
|
|
2607
2320
|
// src/widget/advance/search/controller.ts
|
|
2608
|
-
import
|
|
2609
|
-
import { useCallback as useCallback7, useEffect as useEffect14, useState as useState16 } from "react";
|
|
2610
|
-
|
|
2611
|
-
// src/constants.ts
|
|
2612
|
-
var constants_exports = {};
|
|
2613
|
-
__reExport(constants_exports, constants_star);
|
|
2614
|
-
import * as constants_star from "@fctc/interface-logic/constants";
|
|
2615
|
-
|
|
2616
|
-
// src/widget/advance/search/controller.ts
|
|
2321
|
+
import { useState as useState16, useEffect as useEffect14, useCallback as useCallback7 } from "react";
|
|
2617
2322
|
var searchController = ({
|
|
2618
2323
|
viewData,
|
|
2619
2324
|
model,
|
|
2620
2325
|
domain,
|
|
2621
2326
|
context,
|
|
2622
|
-
fieldsList
|
|
2327
|
+
fieldsList,
|
|
2328
|
+
validateAndParseDate,
|
|
2329
|
+
moment
|
|
2623
2330
|
}) => {
|
|
2624
2331
|
const { env } = (0, provider_exports.useEnv)();
|
|
2625
|
-
const [filterBy, setFilterBy] = useState16(
|
|
2332
|
+
const [filterBy, setFilterBy] = useState16([]);
|
|
2626
2333
|
const [searchBy, setSearchBy] = useState16(null);
|
|
2627
2334
|
const [groupBy, setGroupBy] = useState16(null);
|
|
2628
2335
|
const [selectedTags, setSelectedTags] = useState16(null);
|
|
@@ -2633,7 +2340,7 @@ var searchController = ({
|
|
|
2633
2340
|
const actionContext = typeof context === "string" ? (0, utils_exports.evalJSONContext)(context) : context;
|
|
2634
2341
|
const contextSearch = { ...env.context, ...actionContext };
|
|
2635
2342
|
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, utils_exports.evalJSONDomain)(domain, contextSearch) : [];
|
|
2636
|
-
const
|
|
2343
|
+
const resetAllStateSearch = () => {
|
|
2637
2344
|
setFilterBy([]);
|
|
2638
2345
|
setGroupBy([]);
|
|
2639
2346
|
setSearchBy([]);
|
|
@@ -2649,7 +2356,17 @@ var searchController = ({
|
|
|
2649
2356
|
const searchByItems = searchViews?.search_by?.filter(
|
|
2650
2357
|
(item) => !utils_exports.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
2651
2358
|
)?.map(
|
|
2652
|
-
({
|
|
2359
|
+
({
|
|
2360
|
+
string,
|
|
2361
|
+
name,
|
|
2362
|
+
filter_domain,
|
|
2363
|
+
operator,
|
|
2364
|
+
widget,
|
|
2365
|
+
class: classSearchItem,
|
|
2366
|
+
placeholder
|
|
2367
|
+
}, index) => ({
|
|
2368
|
+
placeholder,
|
|
2369
|
+
class: classSearchItem,
|
|
2653
2370
|
dataIndex: index,
|
|
2654
2371
|
title: string ?? dataModel?.[name]?.string,
|
|
2655
2372
|
name: name ?? dataModel?.[name]?.name,
|
|
@@ -2744,8 +2461,8 @@ var searchController = ({
|
|
|
2744
2461
|
} else if (value?.modelType === "datetime") {
|
|
2745
2462
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
2746
2463
|
const parsedDate = validateAndParseDate(value?.value, true);
|
|
2747
|
-
const hasTime =
|
|
2748
|
-
valueDomainItem = hasTime ?
|
|
2464
|
+
const hasTime = moment(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
2465
|
+
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");
|
|
2749
2466
|
} else {
|
|
2750
2467
|
valueDomainItem = validateAndParseDate(value?.value, true);
|
|
2751
2468
|
}
|
|
@@ -2770,7 +2487,8 @@ var searchController = ({
|
|
|
2770
2487
|
type,
|
|
2771
2488
|
widget,
|
|
2772
2489
|
modelType,
|
|
2773
|
-
dataIndex
|
|
2490
|
+
dataIndex,
|
|
2491
|
+
date
|
|
2774
2492
|
} = objValues[0];
|
|
2775
2493
|
if (!key?.includes(constants_exports.SearchType.GROUP)) {
|
|
2776
2494
|
const values = objValues?.map((objValue) => objValue.value);
|
|
@@ -2780,7 +2498,8 @@ var searchController = ({
|
|
|
2780
2498
|
values,
|
|
2781
2499
|
type,
|
|
2782
2500
|
widget,
|
|
2783
|
-
modelType
|
|
2501
|
+
modelType,
|
|
2502
|
+
date
|
|
2784
2503
|
};
|
|
2785
2504
|
} else {
|
|
2786
2505
|
const contexts = [];
|
|
@@ -2821,6 +2540,19 @@ var searchController = ({
|
|
|
2821
2540
|
},
|
|
2822
2541
|
[searchMap]
|
|
2823
2542
|
);
|
|
2543
|
+
const removeSearchItemsByType = (type) => {
|
|
2544
|
+
const newSearchMap = {};
|
|
2545
|
+
Object.entries(searchMap).forEach(([key, values]) => {
|
|
2546
|
+
const isGroup = key.includes(constants_exports.SearchType.GROUP);
|
|
2547
|
+
const isFilter = key.includes(constants_exports.SearchType.FILTER);
|
|
2548
|
+
const isSearch = key.includes(constants_exports.SearchType.SEARCH);
|
|
2549
|
+
if (type === constants_exports.SearchType.GROUP && isGroup) return;
|
|
2550
|
+
if (type === constants_exports.SearchType.FILTER && isFilter) return;
|
|
2551
|
+
if (type === constants_exports.SearchType.SEARCH && isSearch) return;
|
|
2552
|
+
newSearchMap[key] = values;
|
|
2553
|
+
});
|
|
2554
|
+
setSearchMap(newSearchMap);
|
|
2555
|
+
};
|
|
2824
2556
|
useEffect14(() => {
|
|
2825
2557
|
setTagSearch(searchMap);
|
|
2826
2558
|
}, [searchMap]);
|
|
@@ -2918,7 +2650,7 @@ var searchController = ({
|
|
|
2918
2650
|
setFilterBy,
|
|
2919
2651
|
setGroupBy,
|
|
2920
2652
|
setSearchBy,
|
|
2921
|
-
|
|
2653
|
+
resetAllStateSearch,
|
|
2922
2654
|
setSelectedTags,
|
|
2923
2655
|
removeSearchItems,
|
|
2924
2656
|
onSearchString: onChangeSearchInput,
|
|
@@ -2928,20 +2660,14 @@ var searchController = ({
|
|
|
2928
2660
|
onKeyDown,
|
|
2929
2661
|
handleMouseEnter,
|
|
2930
2662
|
handleMouseLeave,
|
|
2931
|
-
hoveredIndexSearchList
|
|
2663
|
+
hoveredIndexSearchList,
|
|
2664
|
+
removeSearchItemsByType
|
|
2932
2665
|
};
|
|
2933
2666
|
};
|
|
2934
2667
|
|
|
2935
2668
|
// src/index.ts
|
|
2936
2669
|
__reExport(index_exports, utils_exports);
|
|
2937
2670
|
__reExport(index_exports, constants_exports);
|
|
2938
|
-
|
|
2939
|
-
// src/environment.ts
|
|
2940
|
-
var environment_exports = {};
|
|
2941
|
-
__reExport(environment_exports, environment_star);
|
|
2942
|
-
import * as environment_star from "@fctc/interface-logic/environment";
|
|
2943
|
-
|
|
2944
|
-
// src/index.ts
|
|
2945
2671
|
__reExport(index_exports, environment_exports);
|
|
2946
2672
|
__reExport(index_exports, provider_exports);
|
|
2947
2673
|
|
|
@@ -3084,6 +2810,5 @@ export {
|
|
|
3084
2810
|
useValidateActionToken,
|
|
3085
2811
|
useVerify2FA,
|
|
3086
2812
|
useVerifyTotp,
|
|
3087
|
-
useViewV2
|
|
3088
|
-
validateAndParseDate
|
|
2813
|
+
useViewV2
|
|
3089
2814
|
};
|