@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/index.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/index.ts
@@ -154,8 +144,7 @@ __export(index_exports, {
154
144
  useValidateActionToken: () => import_hooks2.useValidateActionToken,
155
145
  useVerify2FA: () => import_hooks2.useVerify2FA,
156
146
  useVerifyTotp: () => import_hooks2.useVerifyTotp,
157
- useViewV2: () => useViewV2,
158
- validateAndParseDate: () => validateAndParseDate
147
+ useViewV2: () => useViewV2
159
148
  });
160
149
  module.exports = __toCommonJS(index_exports);
161
150
 
@@ -235,8 +224,7 @@ __export(utils_exports, {
235
224
  languages: () => languages,
236
225
  mergeButtons: () => mergeButtons,
237
226
  setStorageItemAsync: () => setStorageItemAsync,
238
- useStorageState: () => useStorageState,
239
- validateAndParseDate: () => validateAndParseDate
227
+ useStorageState: () => useStorageState
240
228
  });
241
229
 
242
230
  // src/utils/constants.ts
@@ -332,290 +320,6 @@ var guessTypeFromUrl = (url) => {
332
320
  return map[ext] || null;
333
321
  };
334
322
 
335
- // src/utils/format-date.ts
336
- var import_moment = __toESM(require("moment"));
337
- var validateAndParseDate = (input, isDateTime = false) => {
338
- if (!input || typeof input !== "string") return null;
339
- const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
340
- const dateFormat = "YYYY-MM-DD";
341
- const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
342
- const currentDay = (0, import_moment.default)().format("DD");
343
- const currentMonth = (0, import_moment.default)().format("MM");
344
- const currentYear = (0, import_moment.default)().format("YYYY");
345
- const defaultTime = "00:00:00";
346
- const maxYear = parseInt(currentYear) + 10;
347
- const isValidDate = (day, month, year) => {
348
- const date = (0, import_moment.default)(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
349
- return date.isValid();
350
- };
351
- const isValidTime = (hour, minute = "00", second = "00") => {
352
- const h = parseInt(hour, 10);
353
- const m = parseInt(minute, 10);
354
- const s = parseInt(second, 10);
355
- return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
356
- };
357
- const formatOutput = (day, month, year, time = defaultTime) => {
358
- let result = (0, import_moment.default)(
359
- `${day}-${month}-${year} ${time}`,
360
- "DD-MM-YYYY HH:mm:ss"
361
- );
362
- if (!result.isValid()) return null;
363
- if (isDateTime) {
364
- result = result.subtract(7, "hours");
365
- return result.format(dateTimeFormat);
366
- }
367
- return result.format(dateFormat);
368
- };
369
- if (isDateTime && input.match(
370
- /^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
371
- )) {
372
- const [datePart, timePart] = input.split(/\s+/);
373
- const dateParts = datePart.split(/[\/-]/);
374
- const timeParts = timePart.split(":");
375
- const day = dateParts[0].padStart(2, "0");
376
- const month = dateParts[1].padStart(2, "0");
377
- const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
378
- const hour = timeParts[0].padStart(2, "0");
379
- const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
380
- const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
381
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
382
- let result = (0, import_moment.default)(
383
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
384
- "DD-MM-YYYY HH:mm:ss"
385
- );
386
- if (!result.isValid()) return null;
387
- result = result.subtract(7, "hours");
388
- return result.format(dateTimeFormat);
389
- }
390
- return null;
391
- }
392
- if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
393
- const [year, month, day] = cleanInput.split("-");
394
- if (isValidDate(day, month, year)) {
395
- return formatOutput(day, month, year);
396
- }
397
- return null;
398
- }
399
- if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
400
- const [day, month, year] = cleanInput.split("/");
401
- const paddedDay = day.padStart(2, "0");
402
- const paddedMonth = month.padStart(2, "0");
403
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
404
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
405
- return formatOutput(paddedDay, paddedMonth, fullYear);
406
- }
407
- return null;
408
- }
409
- if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
410
- const [day, month, year] = cleanInput.split("-");
411
- const paddedDay = day.padStart(2, "0");
412
- const paddedMonth = month.padStart(2, "0");
413
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
414
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
415
- return formatOutput(paddedDay, paddedMonth, fullYear);
416
- }
417
- return null;
418
- }
419
- if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
420
- const [day, month] = cleanInput.split(/[\/-]/);
421
- const paddedDay = day.padStart(2, "0");
422
- const paddedMonth = month.padStart(2, "0");
423
- if (isValidDate(paddedDay, paddedMonth, currentYear)) {
424
- return formatOutput(paddedDay, paddedMonth, currentYear);
425
- }
426
- return null;
427
- }
428
- if (cleanInput.match(/^\d{4}$/)) {
429
- const num = parseInt(cleanInput, 10);
430
- if (num >= 2e3 && num <= maxYear) {
431
- if (isValidDate(currentDay, currentMonth, num.toString())) {
432
- return formatOutput(currentDay, currentMonth, num.toString());
433
- }
434
- return null;
435
- }
436
- const day = cleanInput.slice(0, 2);
437
- const month = cleanInput.slice(2, 4);
438
- if (isValidDate(day, month, currentYear)) {
439
- return formatOutput(day, month, currentYear);
440
- }
441
- return null;
442
- }
443
- if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
444
- const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
445
- let result = (0, import_moment.default)().subtract(daysToSubtract, "days");
446
- if (isDateTime) {
447
- result = result.subtract(7, "hours");
448
- }
449
- if (result.isValid()) {
450
- return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
451
- }
452
- return null;
453
- }
454
- if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
455
- const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
456
- const day = parts[0].padStart(2, "0");
457
- const month = parts[1].padStart(2, "0");
458
- let year = parts[2];
459
- year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
460
- if (isValidDate(day, month, year)) {
461
- return formatOutput(day, month, year);
462
- }
463
- return null;
464
- }
465
- if (isDateTime) {
466
- if (cleanInput.length === 9) {
467
- const day = cleanInput.slice(0, 2);
468
- const month = cleanInput.slice(2, 4);
469
- const year = cleanInput.slice(4, 8);
470
- const hour = cleanInput.slice(8, 9).padStart(2, "0");
471
- if (isValidDate(day, month, year) && isValidTime(hour)) {
472
- let result = (0, import_moment.default)(
473
- `${day}-${month}-${year} ${hour}:00:00`,
474
- "DD-MM-YYYY HH:mm:ss"
475
- );
476
- if (!result.isValid()) return null;
477
- result = result.subtract(7, "hours");
478
- return result.format(dateTimeFormat);
479
- }
480
- return null;
481
- }
482
- if (cleanInput.length === 10) {
483
- const day = cleanInput.slice(0, 2);
484
- const month = cleanInput.slice(2, 4);
485
- const year = cleanInput.slice(4, 8);
486
- const hour = cleanInput.slice(8, 10);
487
- if (isValidDate(day, month, year) && isValidTime(hour)) {
488
- let result = (0, import_moment.default)(
489
- `${day}-${month}-${year} ${hour}:00:00`,
490
- "DD-MM-YYYY HH:mm:ss"
491
- );
492
- if (!result.isValid()) return null;
493
- result = result.subtract(7, "hours");
494
- return result.format(dateTimeFormat);
495
- }
496
- return null;
497
- }
498
- if (cleanInput.length === 11) {
499
- const day = cleanInput.slice(0, 2);
500
- const month = cleanInput.slice(2, 4);
501
- const year = cleanInput.slice(4, 8);
502
- const hour = cleanInput.slice(8, 10);
503
- const minute = cleanInput.slice(10, 11).padStart(2, "0");
504
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
505
- let result = (0, import_moment.default)(
506
- `${day}-${month}-${year} ${hour}:${minute}:00`,
507
- "DD-MM-YYYY HH:mm:ss"
508
- );
509
- if (!result.isValid()) return null;
510
- result = result.subtract(7, "hours");
511
- return result.format(dateTimeFormat);
512
- }
513
- return null;
514
- }
515
- if (cleanInput.length === 12) {
516
- const day = cleanInput.slice(0, 2);
517
- const month = cleanInput.slice(2, 4);
518
- const year = cleanInput.slice(4, 8);
519
- const hour = cleanInput.slice(8, 10);
520
- const minute = cleanInput.slice(10, 12);
521
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
522
- let result = (0, import_moment.default)(
523
- `${day}-${month}-${year} ${hour}:${minute}:00`,
524
- "DD-MM-YYYY HH:mm:ss"
525
- );
526
- if (!result.isValid()) return null;
527
- result = result.subtract(7, "hours");
528
- return result.format(dateTimeFormat);
529
- }
530
- return null;
531
- }
532
- if (cleanInput.length === 13) {
533
- const day = cleanInput.slice(0, 2);
534
- const month = cleanInput.slice(2, 4);
535
- const year = cleanInput.slice(4, 8);
536
- const hour = cleanInput.slice(8, 10);
537
- const minute = cleanInput.slice(10, 12);
538
- const second = cleanInput.slice(12, 13).padStart(2, "0");
539
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
540
- let result = (0, import_moment.default)(
541
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
542
- "DD-MM-YYYY HH:mm:ss"
543
- );
544
- if (!result.isValid()) return null;
545
- result = result.subtract(7, "hours");
546
- return result.format(dateTimeFormat);
547
- }
548
- return null;
549
- }
550
- if (cleanInput.length === 14) {
551
- const day = cleanInput.slice(0, 2);
552
- const month = cleanInput.slice(2, 4);
553
- const year = cleanInput.slice(4, 8);
554
- const hour = cleanInput.slice(8, 10);
555
- const minute = cleanInput.slice(10, 12);
556
- const second = cleanInput.slice(12, 14);
557
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
558
- let result = (0, import_moment.default)(
559
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
560
- "DD-MM-YYYY HH:mm:ss"
561
- );
562
- if (!result.isValid()) return null;
563
- result = result.subtract(7, "hours");
564
- return result.format(dateTimeFormat);
565
- }
566
- return null;
567
- }
568
- }
569
- const len = cleanInput.length;
570
- if (len === 1 || len === 2) {
571
- const paddedDay = cleanInput.padStart(2, "0");
572
- if (isValidDate(paddedDay, currentMonth, currentYear)) {
573
- return formatOutput(paddedDay, currentMonth, currentYear);
574
- }
575
- return null;
576
- }
577
- if (len === 3) {
578
- const day = cleanInput.slice(0, 2);
579
- const month = cleanInput.slice(2, 3).padStart(2, "0");
580
- if (isValidDate(day, month, currentYear)) {
581
- return formatOutput(day, month, currentYear);
582
- }
583
- return null;
584
- }
585
- if (len === 6) {
586
- const day = cleanInput.slice(0, 2);
587
- const month = cleanInput.slice(2, 4);
588
- let year = cleanInput.slice(4, 6);
589
- year = `20${year}`;
590
- if (parseInt(month) > 12) {
591
- if (isValidDate(day, currentMonth, currentYear)) {
592
- return formatOutput(day, currentMonth, currentYear);
593
- }
594
- return null;
595
- }
596
- if (isValidDate(day, month, year)) {
597
- return formatOutput(day, month, year);
598
- }
599
- return null;
600
- }
601
- if (len === 7) {
602
- return null;
603
- }
604
- if (len === 8) {
605
- const day = cleanInput.slice(0, 2);
606
- const month = cleanInput.slice(2, 4);
607
- const year = cleanInput.slice(4, 8);
608
- if (isValidDate(day, month, year)) {
609
- return formatOutput(day, month, year);
610
- }
611
- return null;
612
- }
613
- if (len > 8 && !isDateTime) {
614
- return null;
615
- }
616
- return null;
617
- };
618
-
619
323
  // src/utils.ts
620
324
  __reExport(utils_exports, require("@fctc/interface-logic/utils"));
621
325
 
@@ -1023,7 +727,6 @@ var useGetSpecification = ({
1023
727
 
1024
728
  // src/hooks/core/use-list-data.ts
1025
729
  var import_react13 = require("react");
1026
- var import_utils5 = require("@fctc/interface-logic/utils");
1027
730
 
1028
731
  // src/hooks/utils/use-debounce.ts
1029
732
  var import_react11 = require("react");
@@ -1135,12 +838,12 @@ var useListData = ({
1135
838
  if (!viewData || !action || !context) {
1136
839
  return null;
1137
840
  }
1138
- const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, import_utils5.evalJSONDomain)(action?.domain, context) : [];
841
+ const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, utils_exports.evalJSONDomain)(action?.domain, context) : [];
1139
842
  const limit2 = pageLimit;
1140
843
  const offset = debouncedPage * pageLimit;
1141
844
  const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
1142
845
  const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
1143
- const sort = order ?? (0, import_utils5.formatSortingString)(
846
+ const sort = order ?? (0, utils_exports.formatSortingString)(
1144
847
  (mode === "kanban" ? viewData?.views?.kanban : viewData?.views?.list)?.default_order
1145
848
  ) ?? "";
1146
849
  return {
@@ -1210,11 +913,15 @@ __reExport(index_exports, config_exports, module.exports);
1210
913
 
1211
914
  // src/widget/basic/status-dropdown-field/controller.ts
1212
915
  var import_react14 = require("react");
1213
- var import_environment = require("@fctc/interface-logic/environment");
1214
- var import_hooks4 = require("@fctc/interface-logic/hooks");
916
+
917
+ // src/environment.ts
918
+ var environment_exports = {};
919
+ __reExport(environment_exports, require("@fctc/interface-logic/environment"));
920
+
921
+ // src/widget/basic/status-dropdown-field/controller.ts
1215
922
  var statusDropdownController = (props) => {
1216
923
  const { selection, isForm, id, model, name, state, onRefetch } = props;
1217
- const env = (0, import_environment.getEnv)();
924
+ const env = (0, environment_exports.getEnv)();
1218
925
  const colors = {
1219
926
  normal: "bg-[#e9ecef]",
1220
927
  done: "bg-primary",
@@ -1233,7 +940,7 @@ var statusDropdownController = (props) => {
1233
940
  document.removeEventListener("mousedown", handleClickOutside);
1234
941
  };
1235
942
  }, []);
1236
- const { mutate: onSave } = (0, import_hooks4.useSave)();
943
+ const { mutate: onSave } = (0, import_hooks2.useSave)();
1237
944
  const handleClick = async (status) => {
1238
945
  setIsOpen(!isOpen);
1239
946
  onSave(
@@ -1286,7 +993,7 @@ var many2oneFieldController = (props) => {
1286
993
  } = props;
1287
994
  const { env } = (0, provider_exports.useEnv)();
1288
995
  const { action } = useAppProvider();
1289
- const { useGetSelection: useGetSelection3, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
996
+ const { useGetSelection: useGetSelection2, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
1290
997
  const [listOptions, setListOptions] = (0, import_react15.useState)([]);
1291
998
  const [inputValue, setInputValue] = (0, import_react15.useState)("");
1292
999
  const [debouncedInputValue] = useDebounce(inputValue, 1e3);
@@ -1324,7 +1031,7 @@ var many2oneFieldController = (props) => {
1324
1031
  data: dataOfSelection,
1325
1032
  refetch,
1326
1033
  isFetching
1327
- } = useGetSelection3({
1034
+ } = useGetSelection2({
1328
1035
  data,
1329
1036
  queryKey: [`data_${relation}`, domainObject],
1330
1037
  enabled: false,
@@ -1542,20 +1249,17 @@ var many2oneFieldController = (props) => {
1542
1249
  };
1543
1250
 
1544
1251
  // src/widget/basic/many2one-button-field/controller.ts
1545
- var import_environment2 = require("@fctc/interface-logic/environment");
1546
- var import_hooks6 = require("@fctc/interface-logic/hooks");
1547
- var import_utils9 = require("@fctc/interface-logic/utils");
1548
1252
  var many2oneButtonController = (props) => {
1549
1253
  const { domain, methods, relation, service, xNode } = props;
1550
1254
  const actionDataString = sessionStorage.getItem("actionData");
1551
- const env = (0, import_environment2.getEnv)();
1552
- const domainObject = (0, import_utils9.evalJSONDomain)(domain, methods?.getValues() || {});
1255
+ const env = (0, environment_exports.getEnv)();
1256
+ const domainObject = (0, utils_exports.evalJSONDomain)(domain, methods?.getValues() || {});
1553
1257
  const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
1554
- const { data: dataOfSelection } = (0, import_hooks6.useGetSelection)({
1258
+ const { data: dataOfSelection } = (0, import_hooks2.useGetSelection)({
1555
1259
  data: {
1556
1260
  model: relation ?? "",
1557
1261
  domain: domainObject,
1558
- context: { ...env.context, ...(0, import_utils9.evalJSONContext)(actionData?.context) }
1262
+ context: { ...env.context, ...(0, utils_exports.evalJSONContext)(actionData?.context) }
1559
1263
  },
1560
1264
  queryKey: [`data_${relation}`, domainObject],
1561
1265
  service,
@@ -1572,7 +1276,6 @@ var many2oneButtonController = (props) => {
1572
1276
 
1573
1277
  // src/widget/basic/many2many-field/controller.ts
1574
1278
  var import_react16 = require("react");
1575
- var import_utils10 = require("@fctc/interface-logic/utils");
1576
1279
  var many2manyFieldController = (props) => {
1577
1280
  const {
1578
1281
  relation,
@@ -1580,7 +1283,9 @@ var many2manyFieldController = (props) => {
1580
1283
  context,
1581
1284
  options,
1582
1285
  enabled: enabledCallAPI,
1583
- service
1286
+ service,
1287
+ validateAndParseDate,
1288
+ moment
1584
1289
  } = props;
1585
1290
  const { env } = (0, provider_exports.useEnv)();
1586
1291
  const { user } = useAppProvider();
@@ -1612,7 +1317,7 @@ var many2manyFieldController = (props) => {
1612
1317
  });
1613
1318
  const default_order = viewResponse && viewResponse?.views?.list?.default_order;
1614
1319
  const optionsObject = (0, import_react16.useMemo)(
1615
- () => (options && typeof options === "string" ? (0, import_utils10.evalJSONContext)(options) : options) || {},
1320
+ () => (options && typeof options === "string" ? (0, utils_exports.evalJSONContext)(options) : options) || {},
1616
1321
  [options]
1617
1322
  );
1618
1323
  const {
@@ -1672,10 +1377,10 @@ var many2manyFieldController = (props) => {
1672
1377
  ...columns?.filter(
1673
1378
  (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
1674
1379
  )?.map((col) => ({ ...col.field })) ?? []
1675
- ]
1380
+ ],
1381
+ validateAndParseDate,
1382
+ moment
1676
1383
  });
1677
- const handleCreateNewOnPage = async () => {
1678
- };
1679
1384
  return {
1680
1385
  rows,
1681
1386
  columns,
@@ -1698,15 +1403,18 @@ var many2manyFieldController = (props) => {
1698
1403
  setGroupByList,
1699
1404
  setSelectedRowKeys,
1700
1405
  searchController: searchControllers,
1701
- handleCreateNewOnPage,
1702
1406
  specification
1703
1407
  };
1704
1408
  };
1705
1409
 
1706
1410
  // src/widget/basic/many2many-tags-field/controller.ts
1707
1411
  var import_react17 = require("react");
1708
- var import_constants2 = require("@fctc/interface-logic/constants");
1709
- var import_utils11 = require("@fctc/interface-logic/utils");
1412
+
1413
+ // src/constants.ts
1414
+ var constants_exports = {};
1415
+ __reExport(constants_exports, require("@fctc/interface-logic/constants"));
1416
+
1417
+ // src/widget/basic/many2many-tags-field/controller.ts
1710
1418
  var many2manyTagsController = (props) => {
1711
1419
  const {
1712
1420
  relation,
@@ -1724,13 +1432,13 @@ var many2manyTagsController = (props) => {
1724
1432
  const isUser = relation === "res.users" || relation === "res.partner";
1725
1433
  const { env } = (0, provider_exports.useEnv)();
1726
1434
  const { action } = useAppProvider();
1727
- const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
1435
+ const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
1728
1436
  const [options, setOptions] = (0, import_react17.useState)([]);
1729
1437
  const [domainObject, setDomainObject] = (0, import_react17.useState)(null);
1730
1438
  const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react17.useState)(false);
1731
- const addtionalFields = optionsFields ? (0, import_utils11.evalJSONContext)(optionsFields) : null;
1439
+ const addtionalFields = optionsFields ? (0, utils_exports.evalJSONContext)(optionsFields) : null;
1732
1440
  const contextObject = {
1733
- ...(0, import_utils11.evalJSONContext)(action?.context) || {},
1441
+ ...(0, utils_exports.evalJSONContext)(action?.context) || {},
1734
1442
  ...fieldContext ?? {},
1735
1443
  ...env?.context
1736
1444
  };
@@ -1746,7 +1454,7 @@ var many2manyTagsController = (props) => {
1746
1454
  [formValues, contextObject]
1747
1455
  );
1748
1456
  (0, import_react17.useEffect)(() => {
1749
- const newDomain = (0, import_utils11.evalJSONDomain)(domain, parsedFormValues);
1457
+ const newDomain = (0, utils_exports.evalJSONDomain)(domain, parsedFormValues);
1750
1458
  setDomainObject(
1751
1459
  (prev) => JSON.stringify(prev) === JSON.stringify(newDomain) ? prev : newDomain
1752
1460
  );
@@ -1758,8 +1466,8 @@ var many2manyTagsController = (props) => {
1758
1466
  id: {},
1759
1467
  name: {},
1760
1468
  display_name: {},
1761
- ...widget && import_constants2.WIDGETAVATAR[widget] ? { image_256: {} } : {},
1762
- ...widget && import_constants2.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
1469
+ ...widget && constants_exports.WIDGETAVATAR[widget] ? { image_256: {} } : {},
1470
+ ...widget && constants_exports.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
1763
1471
  },
1764
1472
  context: env.context
1765
1473
  };
@@ -1768,7 +1476,7 @@ var many2manyTagsController = (props) => {
1768
1476
  data: dataOfSelection,
1769
1477
  refetch,
1770
1478
  isFetching
1771
- } = useGetSelection3({
1479
+ } = useGetSelection2({
1772
1480
  data,
1773
1481
  queryKey,
1774
1482
  service,
@@ -1821,7 +1529,6 @@ var many2manyTagsController = (props) => {
1821
1529
 
1822
1530
  // src/widget/basic/status-bar-field/controller.ts
1823
1531
  var import_react18 = require("react");
1824
- var import_utils12 = require("@fctc/interface-logic/utils");
1825
1532
  var durationController = (props) => {
1826
1533
  const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
1827
1534
  const specification = {
@@ -1837,7 +1544,7 @@ var durationController = (props) => {
1837
1544
  const listDataProps = {
1838
1545
  model: relation,
1839
1546
  specification,
1840
- domain: (0, import_utils12.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
1547
+ domain: (0, utils_exports.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
1841
1548
  limit: 10,
1842
1549
  offset: 0,
1843
1550
  fields: "",
@@ -1887,13 +1594,12 @@ var durationController = (props) => {
1887
1594
  };
1888
1595
 
1889
1596
  // src/widget/basic/priority-field/controller.ts
1890
- var import_utils13 = require("@fctc/interface-logic/utils");
1891
1597
  var priorityFieldController = (props) => {
1892
1598
  const { name, model, index, actionData, context, onChange, specification } = props;
1893
- const _context = { ...(0, import_utils13.evalJSONContext)(actionData?.context) };
1599
+ const _context = { ...(0, utils_exports.evalJSONContext)(actionData?.context) };
1894
1600
  const contextObject = { ...context, ..._context };
1895
- const { useSave: useSave3 } = (0, provider_exports.useService)();
1896
- const { mutateAsync: fetchSave } = useSave3();
1601
+ const { useSave: useSave2 } = (0, provider_exports.useService)();
1602
+ const { mutateAsync: fetchSave } = useSave2();
1897
1603
  const savePriorities = async ({
1898
1604
  value,
1899
1605
  resetPriority
@@ -2025,15 +1731,14 @@ var copyLinkButtonController = (props) => {
2025
1731
  };
2026
1732
 
2027
1733
  // src/widget/basic/color-field/color-controller.ts
2028
- var import_utils14 = require("@fctc/interface-logic/utils");
2029
1734
  var colorFieldController = (props) => {
2030
1735
  const { value, isForm, name, formValues, idForm, model, actionData } = props;
2031
1736
  const { env } = (0, provider_exports.useEnv)();
2032
- const { useSave: useSave3 } = (0, provider_exports.useService)();
2033
- const _context = { ...(0, import_utils14.evalJSONContext)(actionData?.context) || {} };
1737
+ const { useSave: useSave2 } = (0, provider_exports.useService)();
1738
+ const _context = { ...(0, utils_exports.evalJSONContext)(actionData?.context) || {} };
2034
1739
  const contextObject = { ...env.context, ..._context };
2035
1740
  const idDefault = isForm ? idForm : formValues?.id;
2036
- const { mutate: onSave } = useSave3();
1741
+ const { mutate: onSave } = useSave2();
2037
1742
  const savePickColor = async (colorObject) => {
2038
1743
  const { id } = colorObject;
2039
1744
  if (value === id) return;
@@ -2252,7 +1957,7 @@ var providerEinvoiceFieldController = (props) => {
2252
1957
  const { relation, formValues, options: fieldOptions, xNode } = props;
2253
1958
  const { env } = (0, provider_exports.useEnv)();
2254
1959
  const { action } = useAppProvider();
2255
- const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
1960
+ const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
2256
1961
  const contextObject = {
2257
1962
  ...(typeof action?.context === "string" ? (0, utils_exports.evalJSONContext)(action?.context) : action?.context) || {},
2258
1963
  ...env?.context
@@ -2272,7 +1977,7 @@ var providerEinvoiceFieldController = (props) => {
2272
1977
  },
2273
1978
  specification: optionsObject?.specification
2274
1979
  };
2275
- const { data: listDataCard } = useGetSelection3({
1980
+ const { data: listDataCard } = useGetSelection2({
2276
1981
  data,
2277
1982
  queryKey: [`data_${relation}`],
2278
1983
  enabled: true,
@@ -2352,7 +2057,6 @@ var tableHeadController = (props) => {
2352
2057
 
2353
2058
  // src/widget/advance/table/table-view/controller.ts
2354
2059
  var import_react24 = require("react");
2355
- var import_utils18 = require("@fctc/interface-logic/utils");
2356
2060
  var tableController = ({ data }) => {
2357
2061
  const [rows, setRows] = (0, import_react24.useState)([]);
2358
2062
  const [columnVisibility, setColumnVisibility] = (0, import_react24.useState)({});
@@ -2395,10 +2099,10 @@ var tableController = ({ data }) => {
2395
2099
  const columns = (0, import_react24.useMemo)(() => {
2396
2100
  try {
2397
2101
  return mergeFields?.filter((item) => {
2398
- return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils18.domainHelper.matchDomains(
2102
+ return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? utils_exports.domainHelper.matchDomains(
2399
2103
  data.context,
2400
2104
  item?.column_invisible
2401
- ) : item?.invisible ? import_utils18.domainHelper.matchDomains(data.context, item?.invisible) : false);
2105
+ ) : item?.invisible ? utils_exports.domainHelper.matchDomains(data.context, item?.invisible) : false);
2402
2106
  })?.map((field) => {
2403
2107
  const overridden = columnVisibility[field?.name];
2404
2108
  return {
@@ -2528,23 +2232,18 @@ var tableGroupController = (props) => {
2528
2232
  };
2529
2233
 
2530
2234
  // src/widget/advance/search/controller.ts
2531
- var import_moment2 = __toESM(require("moment"));
2532
2235
  var import_react26 = require("react");
2533
-
2534
- // src/constants.ts
2535
- var constants_exports = {};
2536
- __reExport(constants_exports, require("@fctc/interface-logic/constants"));
2537
-
2538
- // src/widget/advance/search/controller.ts
2539
2236
  var searchController = ({
2540
2237
  viewData,
2541
2238
  model,
2542
2239
  domain,
2543
2240
  context,
2544
- fieldsList
2241
+ fieldsList,
2242
+ validateAndParseDate,
2243
+ moment
2545
2244
  }) => {
2546
2245
  const { env } = (0, provider_exports.useEnv)();
2547
- const [filterBy, setFilterBy] = (0, import_react26.useState)(null);
2246
+ const [filterBy, setFilterBy] = (0, import_react26.useState)([]);
2548
2247
  const [searchBy, setSearchBy] = (0, import_react26.useState)(null);
2549
2248
  const [groupBy, setGroupBy] = (0, import_react26.useState)(null);
2550
2249
  const [selectedTags, setSelectedTags] = (0, import_react26.useState)(null);
@@ -2555,7 +2254,7 @@ var searchController = ({
2555
2254
  const actionContext = typeof context === "string" ? (0, utils_exports.evalJSONContext)(context) : context;
2556
2255
  const contextSearch = { ...env.context, ...actionContext };
2557
2256
  const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, utils_exports.evalJSONDomain)(domain, contextSearch) : [];
2558
- const clearSearch = () => {
2257
+ const resetAllStateSearch = () => {
2559
2258
  setFilterBy([]);
2560
2259
  setGroupBy([]);
2561
2260
  setSearchBy([]);
@@ -2571,7 +2270,17 @@ var searchController = ({
2571
2270
  const searchByItems = searchViews?.search_by?.filter(
2572
2271
  (item) => !utils_exports.domainHelper.matchDomains(contextSearch, item.invisible)
2573
2272
  )?.map(
2574
- ({ string, name, filter_domain, operator, widget }, index) => ({
2273
+ ({
2274
+ string,
2275
+ name,
2276
+ filter_domain,
2277
+ operator,
2278
+ widget,
2279
+ class: classSearchItem,
2280
+ placeholder
2281
+ }, index) => ({
2282
+ placeholder,
2283
+ class: classSearchItem,
2575
2284
  dataIndex: index,
2576
2285
  title: string ?? dataModel?.[name]?.string,
2577
2286
  name: name ?? dataModel?.[name]?.name,
@@ -2666,8 +2375,8 @@ var searchController = ({
2666
2375
  } else if (value?.modelType === "datetime") {
2667
2376
  if (value?.operator === "<=" || value?.operator === "<") {
2668
2377
  const parsedDate = validateAndParseDate(value?.value, true);
2669
- const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
2670
- valueDomainItem = hasTime ? (0, import_moment2.default)(parsedDate).format("YYYY-MM-DD HH:mm:ss") : (0, import_moment2.default)(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
2378
+ const hasTime = moment(value?.value).format("HH:mm:ss") !== "00:00:00";
2379
+ 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");
2671
2380
  } else {
2672
2381
  valueDomainItem = validateAndParseDate(value?.value, true);
2673
2382
  }
@@ -2692,7 +2401,8 @@ var searchController = ({
2692
2401
  type,
2693
2402
  widget,
2694
2403
  modelType,
2695
- dataIndex
2404
+ dataIndex,
2405
+ date
2696
2406
  } = objValues[0];
2697
2407
  if (!key?.includes(constants_exports.SearchType.GROUP)) {
2698
2408
  const values = objValues?.map((objValue) => objValue.value);
@@ -2702,7 +2412,8 @@ var searchController = ({
2702
2412
  values,
2703
2413
  type,
2704
2414
  widget,
2705
- modelType
2415
+ modelType,
2416
+ date
2706
2417
  };
2707
2418
  } else {
2708
2419
  const contexts = [];
@@ -2743,6 +2454,19 @@ var searchController = ({
2743
2454
  },
2744
2455
  [searchMap]
2745
2456
  );
2457
+ const removeSearchItemsByType = (type) => {
2458
+ const newSearchMap = {};
2459
+ Object.entries(searchMap).forEach(([key, values]) => {
2460
+ const isGroup = key.includes(constants_exports.SearchType.GROUP);
2461
+ const isFilter = key.includes(constants_exports.SearchType.FILTER);
2462
+ const isSearch = key.includes(constants_exports.SearchType.SEARCH);
2463
+ if (type === constants_exports.SearchType.GROUP && isGroup) return;
2464
+ if (type === constants_exports.SearchType.FILTER && isFilter) return;
2465
+ if (type === constants_exports.SearchType.SEARCH && isSearch) return;
2466
+ newSearchMap[key] = values;
2467
+ });
2468
+ setSearchMap(newSearchMap);
2469
+ };
2746
2470
  (0, import_react26.useEffect)(() => {
2747
2471
  setTagSearch(searchMap);
2748
2472
  }, [searchMap]);
@@ -2840,7 +2564,7 @@ var searchController = ({
2840
2564
  setFilterBy,
2841
2565
  setGroupBy,
2842
2566
  setSearchBy,
2843
- clearSearch,
2567
+ resetAllStateSearch,
2844
2568
  setSelectedTags,
2845
2569
  removeSearchItems,
2846
2570
  onSearchString: onChangeSearchInput,
@@ -2850,19 +2574,14 @@ var searchController = ({
2850
2574
  onKeyDown,
2851
2575
  handleMouseEnter,
2852
2576
  handleMouseLeave,
2853
- hoveredIndexSearchList
2577
+ hoveredIndexSearchList,
2578
+ removeSearchItemsByType
2854
2579
  };
2855
2580
  };
2856
2581
 
2857
2582
  // src/index.ts
2858
2583
  __reExport(index_exports, utils_exports, module.exports);
2859
2584
  __reExport(index_exports, constants_exports, module.exports);
2860
-
2861
- // src/environment.ts
2862
- var environment_exports = {};
2863
- __reExport(environment_exports, require("@fctc/interface-logic/environment"));
2864
-
2865
- // src/index.ts
2866
2585
  __reExport(index_exports, environment_exports, module.exports);
2867
2586
  __reExport(index_exports, provider_exports, module.exports);
2868
2587
 
@@ -3004,6 +2723,5 @@ __reExport(index_exports, types_exports, module.exports);
3004
2723
  useValidateActionToken,
3005
2724
  useVerify2FA,
3006
2725
  useVerifyTotp,
3007
- useViewV2,
3008
- validateAndParseDate
2726
+ useViewV2
3009
2727
  });