@fctc/widget-logic 1.9.1 → 1.9.3

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/widget.js CHANGED
@@ -4042,8 +4042,6 @@ __export(widget_exports, {
4042
4042
  downLoadBinaryController: () => downLoadBinaryController,
4043
4043
  downloadFileController: () => downloadFileController,
4044
4044
  durationController: () => durationController,
4045
- floatController: () => floatController,
4046
- floatTimeFiledController: () => floatTimeFiledController,
4047
4045
  many2manyFieldController: () => many2manyFieldController,
4048
4046
  many2manyTagsController: () => many2manyTagsController,
4049
4047
  many2oneButtonController: () => many2oneButtonController,
@@ -5516,95 +5514,63 @@ var priorityFieldController = (props) => {
5516
5514
  };
5517
5515
  };
5518
5516
 
5519
- // src/widget/basic/float-time-field/controller.ts
5517
+ // src/widget/basic/download-file-field/controller.ts
5520
5518
  var import_react18 = require("react");
5521
- var import_utils10 = require("@fctc/interface-logic/utils");
5522
- var floatTimeFiledController = ({
5523
- onChange: fieldOnChange,
5524
- onBlur,
5525
- value,
5526
- isDirty,
5527
- props
5528
- }) => {
5529
- const { name, defaultValue = 0, onChange } = props;
5530
- const [input, setInput] = (0, import_react18.useState)(
5531
- (0, import_utils10.convertFloatToTime)(value ?? defaultValue)
5532
- );
5533
- const [formattedTime, setFormattedTime] = (0, import_react18.useState)("");
5534
- const [errors, setErrors] = (0, import_react18.useState)("");
5535
- const handleInputChange = (e) => {
5536
- const raw = e.target.value.replace(/[^\d:]/g, "");
5537
- setInput(raw);
5538
- const timeRegex = /^(\d{1,2}):?(\d{0,2})$/;
5539
- const match = raw.match(timeRegex);
5540
- if (!match) {
5541
- setErrors("\u0110\u1ECBnh d\u1EA1ng kh\xF4ng h\u1EE3p l\u1EC7");
5542
- setFormattedTime("");
5543
- return;
5544
- }
5545
- let hours = parseInt(match[1] ?? "0", 10);
5546
- let minutes = parseInt(match[2] ?? "0", 10);
5547
- if (isNaN(hours)) hours = 0;
5548
- if (isNaN(minutes)) minutes = 0;
5549
- if (hours >= 24) {
5550
- hours = 0;
5551
- }
5552
- if (minutes >= 60) {
5553
- minutes = 0;
5554
- }
5555
- const formatted = `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
5556
- setErrors("");
5557
- setFormattedTime(formatted);
5558
- fieldOnChange(formatted);
5519
+ var downloadFileController = () => {
5520
+ const inputId = (0, import_react18.useId)();
5521
+ const [file, setFile] = (0, import_react18.useState)(null);
5522
+ const handleFileChange = (e) => {
5523
+ setFile(e.target.files[0]);
5559
5524
  };
5560
- const handleBlur = () => {
5561
- if (!isDirty) return;
5562
- if (formattedTime) {
5563
- setInput(formattedTime);
5564
- const floatVal = (0, import_utils10.convertTimeToFloat)(formattedTime);
5565
- fieldOnChange(floatVal);
5566
- if (onChange) {
5567
- onChange(name ?? "", floatVal);
5568
- }
5569
- } else {
5570
- setInput("00:00");
5571
- fieldOnChange(0);
5572
- if (onChange) {
5573
- onChange(name ?? "", 0);
5574
- }
5575
- setErrors("");
5576
- }
5577
- onBlur();
5525
+ const handleFileDownload = () => {
5526
+ const url = URL.createObjectURL(file);
5527
+ const link = document.createElement("a");
5528
+ link.href = url;
5529
+ link.download = file.name;
5530
+ document.body.appendChild(link);
5531
+ link.click();
5532
+ document.body.removeChild(link);
5578
5533
  };
5579
- const handleKeyDown = (e) => {
5580
- {
5581
- const allowed = [
5582
- "Backspace",
5583
- "Tab",
5584
- "ArrowLeft",
5585
- "ArrowRight",
5586
- "Delete",
5587
- "Home",
5588
- "End",
5589
- ":"
5590
- ];
5591
- const isNumber = /^[0-9]$/.test(e.key);
5592
- if (!isNumber && !allowed.includes(e.key)) {
5593
- e.preventDefault();
5534
+ return {
5535
+ inputId,
5536
+ file,
5537
+ handleFileChange,
5538
+ handleFileDownload
5539
+ };
5540
+ };
5541
+
5542
+ // src/widget/basic/download-binary-field/controller.ts
5543
+ var downLoadBinaryController = (props) => {
5544
+ const { value, defaultValue, formValues } = props;
5545
+ const handleFileDownload = async (e) => {
5546
+ e.stopPropagation();
5547
+ await downloadFile(value || defaultValue, formValues?.name);
5548
+ };
5549
+ const downloadFile = async (url, filename) => {
5550
+ try {
5551
+ const response = await fetch(url);
5552
+ if (response) {
5553
+ const blob = await response.blob();
5554
+ const urlBlob = window.URL.createObjectURL(blob);
5555
+ const link = document.createElement("a");
5556
+ link.href = urlBlob;
5557
+ link.download = filename || "downloaded-file";
5558
+ document.body.appendChild(link);
5559
+ link.click();
5560
+ document.body.removeChild(link);
5561
+ window.URL.revokeObjectURL(urlBlob);
5594
5562
  }
5563
+ } catch (error) {
5564
+ console.error("File download failed:", error);
5595
5565
  }
5596
5566
  };
5597
5567
  return {
5598
- handleInputChange,
5599
- handleBlur,
5600
- handleKeyDown,
5601
- input,
5602
- errors
5568
+ handleFileDownload
5603
5569
  };
5604
5570
  };
5605
5571
 
5606
- // src/widget/basic/float-field/controller.ts
5607
- var import_react19 = require("react");
5572
+ // src/widget/basic/date-field/controller.ts
5573
+ var import_moment = __toESM(require_moment());
5608
5574
 
5609
5575
  // src/utils/i18n.ts
5610
5576
  var import_react_i18next2 = require("react-i18next");
@@ -6372,184 +6338,7 @@ import_i18next.default.use(import_i18next_browser_languagedetector.default).use(
6372
6338
  });
6373
6339
  var i18n_default = import_i18next.default;
6374
6340
 
6375
- // src/widget/basic/float-field/controller.ts
6376
- var floatController = ({
6377
- onChange,
6378
- value,
6379
- props
6380
- }) => {
6381
- const { name, required, methods, onChange: handleOnchange, string } = props;
6382
- const { setError, clearErrors } = methods;
6383
- const [inputValue, setInputValue] = (0, import_react19.useState)(
6384
- value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
6385
- );
6386
- (0, import_react19.useEffect)(() => {
6387
- if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
6388
- setInputValue(useFormatFloatNumber(value));
6389
- clearErrors(name);
6390
- } else if (value === null || value === void 0) {
6391
- setInputValue("");
6392
- }
6393
- }, [value, name, clearErrors]);
6394
- const isDirtyRef = (0, import_react19.useRef)(false);
6395
- const inputRef = (0, import_react19.useRef)(null);
6396
- const lastCommittedValueRef = (0, import_react19.useRef)(null);
6397
- const handleInputChange = (e) => {
6398
- const newValue = e.target.value;
6399
- const valueWithoutCommas = newValue.replace(/,/g, "");
6400
- if (/^[0-9]*[.,]?[0-9]*$/.test(valueWithoutCommas) || newValue === "") {
6401
- const parts = valueWithoutCommas.split(".");
6402
- let integerPart = parts[0] || "";
6403
- const decimalPart = parts[1] || "";
6404
- if (decimalPart.length > 100) return;
6405
- if (integerPart) {
6406
- integerPart = Number(integerPart).toLocaleString("en-US");
6407
- }
6408
- const formattedValue = decimalPart ? `${integerPart}.${decimalPart}` : integerPart;
6409
- setInputValue(formattedValue);
6410
- const parsedValue = parseFloat(valueWithoutCommas.replace(",", "."));
6411
- if (!isNaN(parsedValue)) {
6412
- if (parsedValue < 0) {
6413
- setError(name, {
6414
- type: "validate",
6415
- message: i18n_default.t("invalid_number")
6416
- });
6417
- } else {
6418
- onChange(parsedValue);
6419
- clearErrors(name);
6420
- isDirtyRef.current = true;
6421
- }
6422
- } else {
6423
- onChange(null);
6424
- clearErrors(name);
6425
- }
6426
- }
6427
- };
6428
- const handleInputMouseLeave = () => {
6429
- if (!isDirtyRef.current) {
6430
- inputRef.current?.blur();
6431
- return;
6432
- }
6433
- const rawValue = inputValue.replace(/,/g, "");
6434
- const parsedValue = parseFloat(rawValue);
6435
- if (rawValue === "" || rawValue === ".") {
6436
- if (required) {
6437
- setError(name, {
6438
- type: "required",
6439
- message: `${string} ${i18n_default.t("must_required")}`
6440
- });
6441
- }
6442
- onChange(null);
6443
- setInputValue("");
6444
- lastCommittedValueRef.current = null;
6445
- } else if (!isNaN(parsedValue)) {
6446
- if (parsedValue < 0) {
6447
- setError(name, {
6448
- type: "validate",
6449
- message: i18n_default.t("invalid_number")
6450
- });
6451
- setInputValue("");
6452
- lastCommittedValueRef.current = null;
6453
- } else {
6454
- if (lastCommittedValueRef.current !== parsedValue) {
6455
- const parts = rawValue.split(".");
6456
- let integerPart = parts[0];
6457
- const decimalPart = parts[1] || "";
6458
- integerPart = Number(integerPart).toLocaleString("en-US");
6459
- const formattedValue = decimalPart ? `${integerPart}.${decimalPart}` : integerPart;
6460
- onChange(parsedValue);
6461
- setInputValue(formattedValue);
6462
- handleOnchange?.(name ?? "", parsedValue);
6463
- clearErrors(name);
6464
- lastCommittedValueRef.current = parsedValue;
6465
- }
6466
- }
6467
- } else {
6468
- setError(name, {
6469
- type: "validate",
6470
- message: i18n_default.t("invalid_number")
6471
- });
6472
- setInputValue("");
6473
- lastCommittedValueRef.current = null;
6474
- }
6475
- isDirtyRef.current = false;
6476
- inputRef.current?.blur();
6477
- };
6478
- return {
6479
- handleInputMouseLeave,
6480
- handleInputChange,
6481
- useFormatFloatNumber,
6482
- inputRef,
6483
- inputValue
6484
- };
6485
- };
6486
- var useFormatFloatNumber = (value) => {
6487
- if (value === void 0 || value === null || value === "") return "";
6488
- const numValue = typeof value === "string" ? parseFloat(value.replace(/,/g, "")) : value;
6489
- if (isNaN(numValue)) return "";
6490
- return numValue.toLocaleString("en-US", {
6491
- minimumFractionDigits: numValue % 1 === 0 ? 0 : 1,
6492
- maximumFractionDigits: 20
6493
- });
6494
- };
6495
-
6496
- // src/widget/basic/download-file-field/controller.ts
6497
- var import_react20 = require("react");
6498
- var downloadFileController = () => {
6499
- const inputId = (0, import_react20.useId)();
6500
- const [file, setFile] = (0, import_react20.useState)(null);
6501
- const handleFileChange = (e) => {
6502
- setFile(e.target.files[0]);
6503
- };
6504
- const handleFileDownload = () => {
6505
- const url = URL.createObjectURL(file);
6506
- const link = document.createElement("a");
6507
- link.href = url;
6508
- link.download = file.name;
6509
- document.body.appendChild(link);
6510
- link.click();
6511
- document.body.removeChild(link);
6512
- };
6513
- return {
6514
- inputId,
6515
- file,
6516
- handleFileChange,
6517
- handleFileDownload
6518
- };
6519
- };
6520
-
6521
- // src/widget/basic/download-binary-field/controller.ts
6522
- var downLoadBinaryController = (props) => {
6523
- const { value, defaultValue, formValues } = props;
6524
- const handleFileDownload = async (e) => {
6525
- e.stopPropagation();
6526
- await downloadFile(value || defaultValue, formValues?.name);
6527
- };
6528
- const downloadFile = async (url, filename) => {
6529
- try {
6530
- const response = await fetch(url);
6531
- if (response) {
6532
- const blob = await response.blob();
6533
- const urlBlob = window.URL.createObjectURL(blob);
6534
- const link = document.createElement("a");
6535
- link.href = urlBlob;
6536
- link.download = filename || "downloaded-file";
6537
- document.body.appendChild(link);
6538
- link.click();
6539
- document.body.removeChild(link);
6540
- window.URL.revokeObjectURL(urlBlob);
6541
- }
6542
- } catch (error) {
6543
- console.error("File download failed:", error);
6544
- }
6545
- };
6546
- return {
6547
- handleFileDownload
6548
- };
6549
- };
6550
-
6551
6341
  // src/widget/basic/date-field/controller.ts
6552
- var import_moment = __toESM(require_moment());
6553
6342
  var DURATIONS = {
6554
6343
  PAST: "past",
6555
6344
  NOW: "now",
@@ -6661,13 +6450,13 @@ var dateFieldController = (props) => {
6661
6450
  };
6662
6451
 
6663
6452
  // src/widget/basic/copy-link-button/controller.ts
6664
- var import_react21 = require("react");
6665
- var import_utils11 = require("@fctc/interface-logic/utils");
6453
+ var import_react19 = require("react");
6454
+ var import_utils10 = require("@fctc/interface-logic/utils");
6666
6455
  var copyLinkButtonController = (props) => {
6667
6456
  const { value, defaultValue } = props;
6668
- const [isCopied, setIsCopied] = (0, import_react21.useState)(false);
6457
+ const [isCopied, setIsCopied] = (0, import_react19.useState)(false);
6669
6458
  const handleCopyToClipboard = async (value2) => {
6670
- await (0, import_utils11.copyTextToClipboard)(value2);
6459
+ await (0, import_utils10.copyTextToClipboard)(value2);
6671
6460
  setIsCopied(true);
6672
6461
  setTimeout(() => setIsCopied(false), 2e3);
6673
6462
  };
@@ -6680,12 +6469,12 @@ var copyLinkButtonController = (props) => {
6680
6469
  };
6681
6470
 
6682
6471
  // src/widget/basic/color-field/color-controller.ts
6683
- var import_utils12 = require("@fctc/interface-logic/utils");
6472
+ var import_utils11 = require("@fctc/interface-logic/utils");
6684
6473
  var colorFieldController = (props) => {
6685
6474
  const { value, isForm, name, formValues, idForm, model, actionData } = props;
6686
6475
  const { env } = (0, provider_exports.useEnv)();
6687
6476
  const { useSave: useSave3 } = (0, provider_exports.useService)();
6688
- const _context = { ...(0, import_utils12.evalJSONContext)(actionData?.context) || {} };
6477
+ const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) || {} };
6689
6478
  const contextObject = { ...env.context, ..._context };
6690
6479
  const idDefault = isForm ? idForm : formValues?.id;
6691
6480
  const { mutate: onSave } = useSave3();
@@ -6695,8 +6484,8 @@ var colorFieldController = (props) => {
6695
6484
  try {
6696
6485
  onSave({
6697
6486
  ids: idDefault !== null ? [idDefault] : [],
6698
- model: model ?? "",
6699
- data: { [name ?? ""]: id },
6487
+ model: String(model),
6488
+ data: { [String(name)]: id },
6700
6489
  specification: {
6701
6490
  name: {},
6702
6491
  color: {}
@@ -6713,16 +6502,16 @@ var colorFieldController = (props) => {
6713
6502
  };
6714
6503
 
6715
6504
  // src/widget/basic/binary-field/controller.ts
6716
- var import_react22 = require("react");
6717
- var import_utils13 = require("@fctc/interface-logic/utils");
6505
+ var import_react20 = require("react");
6506
+ var import_utils12 = require("@fctc/interface-logic/utils");
6718
6507
  var binaryFieldController = (props) => {
6719
6508
  const { name, methods, readonly = false, value } = props;
6720
- const inputId = (0, import_react22.useId)();
6721
- const [selectedImage, setSelectedImage] = (0, import_react22.useState)(null);
6722
- const [initialImage, setInitialImage] = (0, import_react22.useState)(value || null);
6723
- const [isInsideTable, setIsInsideTable] = (0, import_react22.useState)(false);
6509
+ const inputId = (0, import_react20.useId)();
6510
+ const [selectedImage, setSelectedImage] = (0, import_react20.useState)(null);
6511
+ const [initialImage, setInitialImage] = (0, import_react20.useState)(value || null);
6512
+ const [isInsideTable, setIsInsideTable] = (0, import_react20.useState)(false);
6724
6513
  const { setValue } = methods;
6725
- const binaryRef = (0, import_react22.useRef)(null);
6514
+ const binaryRef = (0, import_react20.useRef)(null);
6726
6515
  const convertUrlToBase64 = async (url) => {
6727
6516
  try {
6728
6517
  const response = await fetch(url);
@@ -6771,11 +6560,11 @@ var binaryFieldController = (props) => {
6771
6560
  };
6772
6561
  const checkIsImageLink = (url) => {
6773
6562
  const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
6774
- return imageExtensions.test(url) || (0, import_utils13.isBase64Image)(url) || isBlobUrl(url);
6563
+ return imageExtensions.test(url) || (0, import_utils12.isBase64Image)(url) || isBlobUrl(url);
6775
6564
  };
6776
6565
  const getImageBase64WithMimeType = (base64) => {
6777
6566
  if (typeof base64 !== "string" || base64.length < 10) return null;
6778
- if ((0, import_utils13.isBase64Image)(base64)) return base64;
6567
+ if ((0, import_utils12.isBase64Image)(base64)) return base64;
6779
6568
  let mimeType = null;
6780
6569
  if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
6781
6570
  else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
@@ -6784,14 +6573,14 @@ var binaryFieldController = (props) => {
6784
6573
  else if (base64.startsWith("UklGR")) mimeType = "image/webp";
6785
6574
  return mimeType ? `data:${mimeType};base64,${base64}` : null;
6786
6575
  };
6787
- (0, import_react22.useEffect)(() => {
6576
+ (0, import_react20.useEffect)(() => {
6788
6577
  return () => {
6789
6578
  if (selectedImage) {
6790
6579
  URL.revokeObjectURL(selectedImage);
6791
6580
  }
6792
6581
  };
6793
6582
  }, [selectedImage]);
6794
- (0, import_react22.useEffect)(() => {
6583
+ (0, import_react20.useEffect)(() => {
6795
6584
  if (binaryRef.current) {
6796
6585
  const isInsideTable2 = !!binaryRef.current.closest("table");
6797
6586
  setIsInsideTable(isInsideTable2);
@@ -6812,7 +6601,7 @@ var binaryFieldController = (props) => {
6812
6601
 
6813
6602
  // src/widget/advance/table/table-body/controller.ts
6814
6603
  var import_store9 = require("@fctc/interface-logic/store");
6815
- var import_react23 = require("react");
6604
+ var import_react21 = require("react");
6816
6605
  var tableBodyController = (props) => {
6817
6606
  const {
6818
6607
  checkedAll,
@@ -6825,7 +6614,7 @@ var tableBodyController = (props) => {
6825
6614
  onClickRow
6826
6615
  } = props;
6827
6616
  const appDispatch = (0, import_store9.useAppDispatch)();
6828
- const checked = (0, import_react23.useMemo)(() => {
6617
+ const checked = (0, import_react21.useMemo)(() => {
6829
6618
  if (!row?.id) return false;
6830
6619
  if (selectedRowKeys?.includes(row.id)) {
6831
6620
  return true;
@@ -6846,7 +6635,7 @@ var tableBodyController = (props) => {
6846
6635
  const handleClickRow = (col, row2) => {
6847
6636
  onClickRow(col, row2);
6848
6637
  };
6849
- (0, import_react23.useEffect)(() => {
6638
+ (0, import_react21.useEffect)(() => {
6850
6639
  if (!row?.id) return;
6851
6640
  if (isAutoSelect) {
6852
6641
  if (checkboxRef?.current === "uncheck") {
@@ -6864,7 +6653,7 @@ var tableBodyController = (props) => {
6864
6653
  }
6865
6654
  }
6866
6655
  }, [isAutoSelect]);
6867
- (0, import_react23.useEffect)(() => {
6656
+ (0, import_react21.useEffect)(() => {
6868
6657
  if (!checkedAll) {
6869
6658
  checkboxRef.current = "enabled";
6870
6659
  false;
@@ -6915,12 +6704,12 @@ var tableHeadController = (props) => {
6915
6704
  };
6916
6705
 
6917
6706
  // src/widget/advance/table/table-view/controller.ts
6918
- var import_react24 = require("react");
6707
+ var import_react22 = require("react");
6919
6708
  var import_store11 = require("@fctc/interface-logic/store");
6920
- var import_utils14 = require("@fctc/interface-logic/utils");
6709
+ var import_utils13 = require("@fctc/interface-logic/utils");
6921
6710
  var tableController = ({ data }) => {
6922
- const [rows, setRows] = (0, import_react24.useState)(data.records || []);
6923
- const [columns, setColumns] = (0, import_react24.useState)([]);
6711
+ const [rows, setRows] = (0, import_react22.useState)(data.records || []);
6712
+ const [columns, setColumns] = (0, import_react22.useState)([]);
6924
6713
  const dataModelFields = data.fields?.map((field) => {
6925
6714
  return {
6926
6715
  ...data.dataModel?.[field?.name],
@@ -6948,14 +6737,14 @@ var tableController = ({ data }) => {
6948
6737
  return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
6949
6738
  });
6950
6739
  };
6951
- (0, import_react24.useEffect)(() => {
6740
+ (0, import_react22.useEffect)(() => {
6952
6741
  setRows(transformData(data.records || null));
6953
6742
  }, [data.records]);
6954
6743
  const handleGetColumns = () => {
6955
6744
  let cols = [];
6956
6745
  try {
6957
6746
  cols = mergeFields?.filter((item) => {
6958
- return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils14.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils14.domainHelper.matchDomains(data.context, item?.invisible) : false);
6747
+ return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils13.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils13.domainHelper.matchDomains(data.context, item?.invisible) : false);
6959
6748
  })?.map((field) => {
6960
6749
  return {
6961
6750
  name: field?.name,
@@ -6969,7 +6758,7 @@ var tableController = ({ data }) => {
6969
6758
  }
6970
6759
  return cols;
6971
6760
  };
6972
- (0, import_react24.useEffect)(() => {
6761
+ (0, import_react22.useEffect)(() => {
6973
6762
  const columns2 = handleGetColumns();
6974
6763
  setColumns(columns2);
6975
6764
  }, [data.records]);
@@ -6994,7 +6783,7 @@ var tableController = ({ data }) => {
6994
6783
  };
6995
6784
 
6996
6785
  // src/widget/advance/table/table-group/controller.ts
6997
- var import_react25 = require("react");
6786
+ var import_react23 = require("react");
6998
6787
  var import_hooks16 = require("@fctc/interface-logic/hooks");
6999
6788
  var import_store12 = require("@fctc/interface-logic/store");
7000
6789
 
@@ -7023,18 +6812,18 @@ var tableGroupController = (props) => {
7023
6812
  setIsAutoSelect,
7024
6813
  selectedRowKeysRef
7025
6814
  } = props;
7026
- const [pageGroup, setPageGroup] = (0, import_react25.useState)(0);
6815
+ const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
7027
6816
  const { groupByDomain, selectedTags } = (0, import_store12.useAppSelector)(import_store12.selectSearch);
7028
6817
  const { selectedRowKeys } = (0, import_store12.useAppSelector)(import_store12.selectList);
7029
6818
  const appDispatch = (0, import_store12.useAppDispatch)();
7030
6819
  const { toDataJS } = (0, import_hooks16.useOdooDataTransform)();
7031
6820
  const initVal = toDataJS(row, viewData, model);
7032
- const [isShowGroup, setIsShowGroup] = (0, import_react25.useState)(false);
7033
- const [colEmptyGroup, setColEmptyGroup] = (0, import_react25.useState)({
6821
+ const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
6822
+ const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
7034
6823
  fromStart: 1,
7035
6824
  fromEnd: 1
7036
6825
  });
7037
- const processedData = (0, import_react25.useMemo)(() => {
6826
+ const processedData = (0, import_react23.useMemo)(() => {
7038
6827
  const calculateColSpanEmpty = () => {
7039
6828
  const startIndex = columns.findIndex(
7040
6829
  (col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
@@ -7049,7 +6838,7 @@ var tableGroupController = (props) => {
7049
6838
  };
7050
6839
  return calculateColSpanEmpty();
7051
6840
  }, [columns, row]);
7052
- const shouldFetchData = (0, import_react25.useMemo)(() => {
6841
+ const shouldFetchData = (0, import_react23.useMemo)(() => {
7053
6842
  return !!isShowGroup;
7054
6843
  }, [isShowGroup]);
7055
6844
  const enabled = shouldFetchData && !!processedData;
@@ -7089,7 +6878,7 @@ var tableGroupController = (props) => {
7089
6878
  }
7090
6879
  });
7091
6880
  const leftPadding = level > 1 ? level * 8 + "px" : "0px";
7092
- (0, import_react25.useEffect)(() => {
6881
+ (0, import_react23.useEffect)(() => {
7093
6882
  if (isShowGroup && selectedTags?.length > 0) {
7094
6883
  setIsShowGroup(false);
7095
6884
  }
@@ -7123,7 +6912,7 @@ var tableGroupController = (props) => {
7123
6912
  }
7124
6913
  toggleShowGroup();
7125
6914
  };
7126
- (0, import_react25.useEffect)(() => {
6915
+ (0, import_react23.useEffect)(() => {
7127
6916
  if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
7128
6917
  return;
7129
6918
  }
@@ -7164,9 +6953,9 @@ var tableGroupController = (props) => {
7164
6953
 
7165
6954
  // src/widget/advance/search/controller.ts
7166
6955
  var import_constants5 = require("@fctc/interface-logic/constants");
7167
- var import_utils15 = require("@fctc/interface-logic/utils");
6956
+ var import_utils14 = require("@fctc/interface-logic/utils");
7168
6957
  var import_moment2 = __toESM(require_moment());
7169
- var import_react26 = require("react");
6958
+ var import_react24 = require("react");
7170
6959
  var searchController = ({
7171
6960
  viewData,
7172
6961
  actionData,
@@ -7175,12 +6964,12 @@ var searchController = ({
7175
6964
  setSearchMap,
7176
6965
  searchMap
7177
6966
  }) => {
7178
- const [filterBy, setFilterBy] = (0, import_react26.useState)(null);
7179
- const [searchBy, setSearchBy] = (0, import_react26.useState)(null);
7180
- const [groupBy, setGroupBy] = (0, import_react26.useState)(null);
7181
- const [selectedTags, setSelectedTags] = (0, import_react26.useState)(null);
7182
- const [searchString, setSearchString] = (0, import_react26.useState)("");
7183
- const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils15.evalJSONDomain)(actionData?.domain, contextSearch) : [];
6967
+ const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
6968
+ const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
6969
+ const [groupBy, setGroupBy] = (0, import_react24.useState)(null);
6970
+ const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
6971
+ const [searchString, setSearchString] = (0, import_react24.useState)("");
6972
+ const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils14.evalJSONDomain)(actionData?.domain, contextSearch) : [];
7184
6973
  const aid = actionData?.id;
7185
6974
  const model = actionData?.res_model;
7186
6975
  const clearSearch = () => {
@@ -7197,7 +6986,7 @@ var searchController = ({
7197
6986
  const dataModel = viewData?.models?.[model];
7198
6987
  const searchViews = viewData?.views?.search;
7199
6988
  const searchByItems = searchViews?.search_by?.filter(
7200
- (item) => !import_utils15.domainHelper.matchDomains(contextSearch, item.invisible)
6989
+ (item) => !import_utils14.domainHelper.matchDomains(contextSearch, item.invisible)
7201
6990
  )?.map(
7202
6991
  ({ string, name, filter_domain, operator, widget }, index) => ({
7203
6992
  dataIndex: index,
@@ -7210,10 +6999,10 @@ var searchController = ({
7210
6999
  })
7211
7000
  );
7212
7001
  const filterByItems = searchViews?.filter_by.filter((item) => {
7213
- return !import_utils15.domainHelper.matchDomains(contextSearch, item?.invisible);
7002
+ return !import_utils14.domainHelper.matchDomains(contextSearch, item?.invisible);
7214
7003
  })?.map((item) => ({ ...item, active: false }));
7215
7004
  const groupByItems = searchViews?.group_by.filter(
7216
- (item) => !import_utils15.domainHelper.matchDomains(contextSearch, item?.invisible)
7005
+ (item) => !import_utils14.domainHelper.matchDomains(contextSearch, item?.invisible)
7217
7006
  ).map((item) => ({
7218
7007
  ...item,
7219
7008
  string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
@@ -7226,7 +7015,7 @@ var searchController = ({
7226
7015
  }
7227
7016
  }
7228
7017
  };
7229
- (0, import_react26.useEffect)(() => {
7018
+ (0, import_react24.useEffect)(() => {
7230
7019
  clearSearch();
7231
7020
  fetchData();
7232
7021
  }, [aid, model, viewData]);
@@ -7291,14 +7080,14 @@ var searchController = ({
7291
7080
  }
7292
7081
  let valueDomainItem = value?.value;
7293
7082
  if (value?.modelType === "date") {
7294
- valueDomainItem = (0, import_utils15.validateAndParseDate)(value?.value);
7083
+ valueDomainItem = (0, import_utils14.validateAndParseDate)(value?.value);
7295
7084
  } else if (value?.modelType === "datetime") {
7296
7085
  if (value?.operator === "<=" || value?.operator === "<") {
7297
- const parsedDate = (0, import_utils15.validateAndParseDate)(value?.value, true);
7086
+ const parsedDate = (0, import_utils14.validateAndParseDate)(value?.value, true);
7298
7087
  const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
7299
7088
  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");
7300
7089
  } else {
7301
- valueDomainItem = (0, import_utils15.validateAndParseDate)(value?.value, true);
7090
+ valueDomainItem = (0, import_utils14.validateAndParseDate)(value?.value, true);
7302
7091
  }
7303
7092
  }
7304
7093
  const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
@@ -7309,7 +7098,7 @@ var searchController = ({
7309
7098
  return [...domain];
7310
7099
  }
7311
7100
  };
7312
- const setTagSearch = (0, import_react26.useCallback)(
7101
+ const setTagSearch = (0, import_react24.useCallback)(
7313
7102
  (updatedMap) => {
7314
7103
  if (!updatedMap) return;
7315
7104
  const tagsSearch = Object.entries(updatedMap).map(
@@ -7372,7 +7161,7 @@ var searchController = ({
7372
7161
  },
7373
7162
  [searchMap]
7374
7163
  );
7375
- (0, import_react26.useEffect)(() => {
7164
+ (0, import_react24.useEffect)(() => {
7376
7165
  setSelectedTags(null);
7377
7166
  setTagSearch(searchMap);
7378
7167
  }, [searchMap]);
@@ -7387,7 +7176,7 @@ var searchController = ({
7387
7176
  active,
7388
7177
  dataIndex
7389
7178
  } = tag;
7390
- const domainFormat = new import_utils15.domainHelper.Domain(domain);
7179
+ const domainFormat = new import_utils14.domainHelper.Domain(domain);
7391
7180
  if (type === import_constants5.SearchType.FILTER) {
7392
7181
  addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
7393
7182
  ...tag,
@@ -7437,8 +7226,6 @@ var searchController = ({
7437
7226
  downLoadBinaryController,
7438
7227
  downloadFileController,
7439
7228
  durationController,
7440
- floatController,
7441
- floatTimeFiledController,
7442
7229
  many2manyFieldController,
7443
7230
  many2manyTagsController,
7444
7231
  many2oneButtonController,