@fctc/widget-logic 1.2.2 → 1.2.4

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
@@ -4754,9 +4754,7 @@ var AppProvider = ({ children }) => {
4754
4754
  return combineContexts([user.context, company.context]);
4755
4755
  }, [user.context, company.context]);
4756
4756
  const menu = useMenu({ context: menuContext });
4757
- const action = (0, import_react10.useMemo)(() => {
4758
- return menu.state.action;
4759
- }, [menu.state.action]);
4757
+ const action = (0, import_react10.useMemo)(() => menu.state.action, [menu.state.action]);
4760
4758
  const viewContext = (0, import_react10.useMemo)(() => {
4761
4759
  return combineContexts([
4762
4760
  menuContext,
@@ -4785,15 +4783,13 @@ var AppProvider = ({ children }) => {
4785
4783
  action,
4786
4784
  view
4787
4785
  },
4788
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface_logic10.MainProvider, { children })
4786
+ children
4789
4787
  }
4790
4788
  );
4791
4789
  };
4792
4790
  var useAppProvider = () => {
4793
4791
  const context = (0, import_react10.useContext)(ReactContext);
4794
- if (!context) {
4795
- return AppProviderInitialValue;
4796
- }
4792
+ if (!context) return AppProviderInitialValue;
4797
4793
  return context;
4798
4794
  };
4799
4795
 
@@ -5180,7 +5176,7 @@ var many2oneFieldController = (props) => {
5180
5176
  const queryKey = [`data_${relation}`, domainObject];
5181
5177
  const {
5182
5178
  data: dataOfSelection,
5183
- refetch,
5179
+ // refetch,
5184
5180
  isFetching
5185
5181
  } = (0, import_interface_logic16.useGetSelection)({
5186
5182
  data,
@@ -5209,9 +5205,6 @@ var many2oneFieldController = (props) => {
5209
5205
  });
5210
5206
  }
5211
5207
  }, [propValue]);
5212
- const fetchMoreOptions = (0, import_react18.useCallback)(() => {
5213
- refetch();
5214
- }, [refetch]);
5215
5208
  (0, import_react18.useEffect)(() => {
5216
5209
  if (actionId) {
5217
5210
  localStorage.setItem("aid", actionId);
@@ -5268,6 +5261,12 @@ var many2oneFieldController = (props) => {
5268
5261
  [methods, name, onChange]
5269
5262
  );
5270
5263
  const allowShowDetail = showDetail && contextObject?.form_view_ref && (!("no_open" in optionsObject) || optionsObject?.no_open === false);
5264
+ const fetchMoreOptions = (0, import_react18.useCallback)(() => {
5265
+ if (typeof dataOfSelection?.refetch === "function") {
5266
+ ;
5267
+ dataOfSelection.refetch();
5268
+ }
5269
+ }, [dataOfSelection]);
5271
5270
  return {
5272
5271
  allowShowDetail,
5273
5272
  handleClose,
@@ -5283,7 +5282,8 @@ var many2oneFieldController = (props) => {
5283
5282
  setTempSelectedOption,
5284
5283
  setDomainModal,
5285
5284
  dataOfSelection,
5286
- refetch,
5285
+ refetch: dataOfSelection?.refetch ?? (() => {
5286
+ }),
5287
5287
  selectOptions,
5288
5288
  optionsObject,
5289
5289
  contextObject,
@@ -5318,15 +5318,119 @@ var many2oneButtonController = (props) => {
5318
5318
  };
5319
5319
 
5320
5320
  // src/widget/basic/many2many-field/controller.ts
5321
- var import_react20 = require("react");
5322
- var import_interface_logic19 = require("@fctc/interface-logic");
5321
+ var import_react22 = require("react");
5322
+ var import_interface_logic22 = require("@fctc/interface-logic");
5323
5323
 
5324
- // src/widget/advance/table/table-view/controller.ts
5324
+ // src/widget/advance/table/table-body/controller.ts
5325
5325
  var import_interface_logic18 = require("@fctc/interface-logic");
5326
5326
  var import_react19 = require("react");
5327
+ var tableBodyController = (props) => {
5328
+ const {
5329
+ checkedAll,
5330
+ checkboxRef,
5331
+ setIsAutoSelect,
5332
+ selectedRowKeys,
5333
+ row,
5334
+ isAutoSelect,
5335
+ selectedRowKeysRef,
5336
+ onClickRow
5337
+ } = props;
5338
+ const appDispatch = (0, import_interface_logic18.useAppDispatch)();
5339
+ const checked = (0, import_react19.useMemo)(() => {
5340
+ if (!row?.id) return false;
5341
+ if (selectedRowKeys?.includes(row.id)) {
5342
+ return true;
5343
+ }
5344
+ return checkedAll;
5345
+ }, [row?.id, selectedRowKeys, checkedAll]);
5346
+ const handleCheckBoxSingle = (event) => {
5347
+ event.stopPropagation();
5348
+ if (checkedAll) {
5349
+ checkboxRef.current = "uncheck";
5350
+ setIsAutoSelect(true);
5351
+ return;
5352
+ }
5353
+ const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
5354
+ console.log("newSelectedRowKeys", newSelectedRowKeys);
5355
+ appDispatch((0, import_interface_logic18.setSelectedRowKeys)(newSelectedRowKeys));
5356
+ };
5357
+ const handleClickRow = (col, row2) => {
5358
+ onClickRow(col, row2);
5359
+ };
5360
+ (0, import_react19.useEffect)(() => {
5361
+ if (!row?.id) return;
5362
+ if (isAutoSelect) {
5363
+ if (checkboxRef?.current === "uncheck") {
5364
+ const filtered = selectedRowKeysRef.current.filter(
5365
+ (id) => id !== row.id
5366
+ );
5367
+ selectedRowKeysRef.current = filtered;
5368
+ appDispatch((0, import_interface_logic18.setSelectedRowKeys)(filtered));
5369
+ } else {
5370
+ const unique = Array.from(
5371
+ /* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
5372
+ );
5373
+ selectedRowKeysRef.current = unique;
5374
+ appDispatch((0, import_interface_logic18.setSelectedRowKeys)(unique));
5375
+ }
5376
+ }
5377
+ }, [isAutoSelect]);
5378
+ (0, import_react19.useEffect)(() => {
5379
+ if (!checkedAll) {
5380
+ checkboxRef.current = "enabled";
5381
+ false;
5382
+ }
5383
+ }, [checkedAll]);
5384
+ return {
5385
+ handleCheckBoxSingle,
5386
+ checked,
5387
+ handleClickRow
5388
+ };
5389
+ };
5390
+
5391
+ // src/widget/advance/table/table-head/controller.ts
5392
+ var import_interface_logic19 = require("@fctc/interface-logic");
5393
+ var tableHeadController = (props) => {
5394
+ const { typeTable, rows, selectedRowKeysRef } = props;
5395
+ const appDispatch = (0, import_interface_logic19.useAppDispatch)();
5396
+ const { groupByDomain } = (0, import_interface_logic19.useAppSelector)(import_interface_logic19.selectSearch);
5397
+ const handleCheckBoxAll = (event) => {
5398
+ if (event?.target?.checked && typeTable === "list") {
5399
+ const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
5400
+ appDispatch((0, import_interface_logic19.setSelectedRowKeys)(allRowKeys));
5401
+ } else if (event?.target?.checked && typeTable === "group") {
5402
+ const rowsIDs = document.querySelectorAll("tr[data-row-id]");
5403
+ const ids = Array.from(rowsIDs)?.map(
5404
+ (row) => Number(row?.getAttribute("data-row-id"))
5405
+ );
5406
+ if (ids?.length > 0) {
5407
+ appDispatch((0, import_interface_logic19.setSelectedRowKeys)(ids));
5408
+ } else {
5409
+ const sum = countSum(
5410
+ rows,
5411
+ typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
5412
+ );
5413
+ const keys = Array.from({ length: sum }, (_) => void 0);
5414
+ appDispatch((0, import_interface_logic19.setSelectedRowKeys)(keys));
5415
+ }
5416
+ if (selectedRowKeysRef) {
5417
+ selectedRowKeysRef.current = [];
5418
+ }
5419
+ } else {
5420
+ appDispatch((0, import_interface_logic19.setSelectedRowKeys)([]));
5421
+ }
5422
+ };
5423
+ return {
5424
+ handleCheckBoxAll
5425
+ };
5426
+ };
5427
+
5428
+ // src/widget/advance/table/table-view/controller.ts
5429
+ var import_interface_logic20 = require("@fctc/interface-logic");
5430
+ var import_react20 = require("react");
5327
5431
  var tableController = ({ data }) => {
5328
- const [rows, setRows] = (0, import_react19.useState)(data.records || []);
5329
- const [columns, setColumns] = (0, import_react19.useState)([]);
5432
+ const [rows, setRows] = (0, import_react20.useState)(data.records || []);
5433
+ const [columns, setColumns] = (0, import_react20.useState)([]);
5330
5434
  const dataModelFields = data.fields?.map((field) => {
5331
5435
  return {
5332
5436
  ...data.dataModel?.[field?.name],
@@ -5354,14 +5458,14 @@ var tableController = ({ data }) => {
5354
5458
  return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
5355
5459
  });
5356
5460
  };
5357
- (0, import_react19.useEffect)(() => {
5461
+ (0, import_react20.useEffect)(() => {
5358
5462
  setRows(transformData(data.records || null));
5359
5463
  }, [data.records]);
5360
5464
  const handleGetColumns = () => {
5361
5465
  let cols = [];
5362
5466
  try {
5363
5467
  cols = mergeFields?.filter((item) => {
5364
- return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic18.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic18.domainHelper.matchDomains(data.context, item?.invisible) : false);
5468
+ return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic20.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic20.domainHelper.matchDomains(data.context, item?.invisible) : false);
5365
5469
  })?.map((field) => {
5366
5470
  return {
5367
5471
  name: field?.name,
@@ -5375,7 +5479,7 @@ var tableController = ({ data }) => {
5375
5479
  }
5376
5480
  return cols;
5377
5481
  };
5378
- (0, import_react19.useEffect)(() => {
5482
+ (0, import_react20.useEffect)(() => {
5379
5483
  const columns2 = handleGetColumns();
5380
5484
  setColumns(columns2);
5381
5485
  }, [data.records]);
@@ -5399,453 +5503,14 @@ var tableController = ({ data }) => {
5399
5503
  };
5400
5504
  };
5401
5505
 
5402
- // src/widget/basic/many2many-field/controller.ts
5403
- var many2manyFieldController = (props) => {
5404
- const {
5405
- relation,
5406
- domain,
5407
- context,
5408
- tab,
5409
- model,
5410
- aid,
5411
- setSelectedRowKeys: setSelectedRowKeys4,
5412
- fields,
5413
- setFields,
5414
- groupByDomain,
5415
- page,
5416
- options,
5417
- sessionStorageUtils
5418
- } = props;
5419
- const appDispatch = (0, import_interface_logic19.useAppDispatch)();
5420
- const actionData = sessionStorageUtils.getActionData();
5421
- const [debouncedPage] = useDebounce(page, 500);
5422
- const [order, setOrder] = (0, import_react20.useState)();
5423
- const [isLoadedData, setIsLoadedData] = (0, import_react20.useState)(false);
5424
- const [domainMany2Many, setDomainMany2Many] = (0, import_react20.useState)(domain);
5425
- const env = (0, import_interface_logic19.getEnv)();
5426
- const { selectedTags } = (0, import_interface_logic19.useAppSelector)(import_interface_logic19.selectSearch);
5427
- const viewParams = {
5428
- model: relation,
5429
- views: [
5430
- [false, "list"],
5431
- [false, "search"]
5432
- ],
5433
- context
5434
- };
5435
- const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic19.useGetView)(
5436
- viewParams,
5437
- actionData
5438
- );
5439
- const baseModel = (0, import_react20.useMemo)(
5440
- () => ({
5441
- name: String(relation),
5442
- view: viewResponse || {},
5443
- actContext: context,
5444
- fields: [
5445
- ...Object.values(viewResponse?.views?.list?.fields ?? {}),
5446
- ...tab?.fields ? tab.fields : []
5447
- ]
5448
- }),
5449
- [model, viewResponse]
5450
- );
5451
- const initModel = (0, import_interface_logic19.useModel)();
5452
- const modelInstance = (0, import_react20.useMemo)(() => {
5453
- if (viewResponse) {
5454
- return initModel.initModel(baseModel);
5455
- }
5456
- return null;
5457
- }, [baseModel, viewResponse]);
5458
- const specification = (0, import_react20.useMemo)(() => {
5459
- if (modelInstance) {
5460
- return modelInstance.getSpecification();
5461
- }
5462
- return null;
5463
- }, [modelInstance]);
5464
- const default_order = viewResponse && viewResponse?.views?.list?.default_order;
5465
- const optionsObject = tab?.options ? (0, import_interface_logic19.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic19.evalJSONContext)(options) : {}) || {};
5466
- const fetchData = async () => {
5467
- try {
5468
- setDomainMany2Many(domain);
5469
- appDispatch((0, import_interface_logic19.setFirstDomain)(domain));
5470
- appDispatch((0, import_interface_logic19.setViewDataStore)(viewResponse));
5471
- const modalData = viewResponse?.views?.list?.fields.map((field) => ({
5472
- ...viewResponse?.models?.[String(model)]?.[field?.name],
5473
- ...field
5474
- }));
5475
- if (!fields?.[`${aid}_${relation}_popupmany2many`] && modalData) {
5476
- setFields({
5477
- ...fields,
5478
- [`${aid}_${relation}_popupmany2many`]: modalData
5479
- });
5480
- }
5481
- appDispatch((0, import_interface_logic19.setPage)(0));
5482
- } catch (err) {
5483
- console.log(err);
5484
- }
5485
- };
5486
- const queryKey = [
5487
- `view-${relation}-${aid}`,
5488
- specification,
5489
- domainMany2Many,
5490
- debouncedPage,
5491
- groupByDomain,
5492
- order
5493
- ];
5494
- const data = {
5495
- model: relation,
5496
- specification,
5497
- domain: domainMany2Many,
5498
- offset: debouncedPage * 10,
5499
- limit: 10,
5500
- context,
5501
- fields: groupByDomain?.fields,
5502
- groupby: [groupByDomain?.contexts[0]?.group_by],
5503
- sort: order ? order : default_order ? (0, import_interface_logic19.formatSortingString)(default_order) : ""
5504
- };
5505
- const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
5506
- const {
5507
- data: dataResponse,
5508
- isLoading: isDataLoading,
5509
- isFetched: isDataResponseFetched,
5510
- isPlaceholderData
5511
- } = (0, import_interface_logic19.useGetListData)(data, queryKey, enabled);
5512
- (0, import_react20.useEffect)(() => {
5513
- if (viewResponse) {
5514
- fetchData();
5515
- }
5516
- return () => {
5517
- appDispatch((0, import_interface_logic19.setGroupByDomain)(null));
5518
- setFields((prevFields) => ({
5519
- ...prevFields,
5520
- [`${aid}_${relation}_popupmany2many`]: null
5521
- }));
5522
- appDispatch((0, import_interface_logic19.setPage)(0));
5523
- setSelectedRowKeys4([]);
5524
- setDomainMany2Many(null);
5525
- setIsLoadedData(false);
5526
- };
5527
- }, [viewResponse]);
5528
- const { rows, columns, typeTable } = tableController({
5529
- data: {
5530
- fields: fields?.[`${aid}_${relation}_popupmany2many`] || viewResponse?.views?.list?.fields,
5531
- records: dataResponse?.records ?? dataResponse?.groups,
5532
- dataModel: viewResponse?.models?.[String(relation)],
5533
- context: { ...env.context, ...context },
5534
- typeTable: dataResponse?.groups ? "group" : "list"
5535
- }
5536
- });
5537
- const dataFormView = {
5538
- id: null,
5539
- model: relation,
5540
- context
5541
- };
5542
- const {
5543
- refetch,
5544
- data: dataFormViewResponse,
5545
- isSuccess
5546
- } = (0, import_interface_logic19.useGetFormView)({
5547
- data: dataFormView,
5548
- queryKey: [`form-view-action-${relation}`],
5549
- enabled: false
5550
- });
5551
- (0, import_react20.useEffect)(() => {
5552
- if (isSuccess && dataFormViewResponse) {
5553
- sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
5554
- window.location.href = `/form/menu?model=${relation}`;
5555
- }
5556
- }, [isSuccess]);
5557
- (0, import_react20.useEffect)(() => {
5558
- if (domainMany2Many && !isLoadedData) {
5559
- setIsLoadedData(true);
5560
- }
5561
- }, [domainMany2Many]);
5562
- const handleCreateNewOnPage = async () => {
5563
- try {
5564
- refetch();
5565
- } catch (error) {
5566
- console.log(error);
5567
- }
5568
- };
5569
- return {};
5570
- };
5571
-
5572
- // src/widget/basic/many2many-tags-field/controller.ts
5573
- var import_react21 = require("react");
5574
- var import_interface_logic20 = require("@fctc/interface-logic");
5575
- var many2manyTagsController = (props) => {
5576
- const {
5577
- relation,
5578
- domain,
5579
- options: optionsFields,
5580
- widget,
5581
- formValues,
5582
- placeholderNoOption
5583
- } = props;
5584
- const isUser = relation === "res.users" || relation === "res.partner";
5585
- const env = (0, import_interface_logic20.getEnv)();
5586
- const addtionalFields = optionsFields ? (0, import_interface_logic20.evalJSONContext)(optionsFields) : null;
5587
- const domainObject = (0, import_react21.useMemo)(
5588
- () => (0, import_interface_logic20.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
5589
- [domain, formValues]
5590
- );
5591
- const data = {
5592
- model: relation ?? "",
5593
- domain: domainObject,
5594
- specification: {
5595
- id: {},
5596
- name: {},
5597
- display_name: {},
5598
- ...widget && import_interface_logic20.WIDGETAVATAR[widget] ? { image_256: {} } : {},
5599
- ...widget && import_interface_logic20.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
5600
- },
5601
- enabled: true,
5602
- context: env.context
5603
- };
5604
- const { data: dataOfSelection } = (0, import_interface_logic20.useGetSelection)({
5605
- data,
5606
- queryKey: [`data_${relation}`, domainObject]
5607
- });
5608
- const customNoOptionsMessage = () => placeholderNoOption;
5609
- const tranfer = (data2) => {
5610
- return data2?.map((val) => ({
5611
- id: val.value,
5612
- display_name: val.label
5613
- })) || [];
5614
- };
5615
- const options = dataOfSelection?.records?.map((val) => ({
5616
- value: val.id,
5617
- label: val.name ?? val.display_name,
5618
- ...val
5619
- })) || [];
5620
- return {
5621
- options,
5622
- customNoOptionsMessage,
5623
- tranfer,
5624
- dataOfSelection,
5625
- isUser
5626
- };
5627
- };
5628
-
5629
- // src/widget/basic/status-bar-field/controller.ts
5630
- var import_react22 = require("react");
5506
+ // src/widget/advance/table/table-group/controller.ts
5631
5507
  var import_interface_logic21 = require("@fctc/interface-logic");
5632
- var durationController = (props) => {
5633
- const {
5634
- relation,
5635
- defaultValue,
5636
- domain,
5637
- formValues,
5638
- name,
5639
- id,
5640
- model,
5641
- onRefetch
5642
- } = props;
5643
- const specification = {
5644
- id: 0,
5645
- name: "",
5646
- fold: ""
5647
- };
5648
- const [disabled, setDisabled] = (0, import_react22.useState)(false);
5649
- const [modelStatus, setModalStatus] = (0, import_react22.useState)(false);
5650
- const { context } = (0, import_interface_logic21.useAppSelector)(import_interface_logic21.selectEnv);
5651
- const queryKey = [`data-status-duration`, specification];
5652
- const listDataProps = {
5653
- model: relation,
5654
- specification,
5655
- domain: (0, import_interface_logic21.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
5656
- limit: 10,
5657
- offset: 0,
5658
- fields: "",
5659
- groupby: [],
5660
- context: {
5661
- lang: context.lang
5662
- },
5663
- sort: ""
5664
- };
5665
- const { data: dataResponse } = (0, import_interface_logic21.useGetListData)(listDataProps, queryKey);
5666
- const { mutate: fetchChangeStatus } = (0, import_interface_logic21.useChangeStatus)();
5667
- const handleClick = async (stage_id) => {
5668
- setDisabled(true);
5669
- if (stage_id) {
5670
- fetchChangeStatus(
5671
- {
5672
- data: {
5673
- stage_id,
5674
- name,
5675
- id,
5676
- model,
5677
- lang: context.lang
5678
- }
5679
- },
5680
- {
5681
- onSuccess: (res) => {
5682
- if (res) {
5683
- setDisabled(false);
5684
- onRefetch && onRefetch();
5685
- }
5686
- }
5687
- }
5688
- );
5689
- }
5690
- };
5691
- return {
5692
- defaultValue,
5693
- dataResponse,
5694
- handleClick,
5695
- disabled,
5696
- modelStatus,
5697
- setModalStatus
5698
- };
5699
- };
5508
+ var import_react21 = require("react");
5700
5509
 
5701
- // src/widget/basic/priority-field/controller.ts
5702
- var import_interface_logic22 = require("@fctc/interface-logic");
5703
- var priorityFieldController = (props) => {
5704
- const {
5705
- value,
5706
- isForm,
5707
- name,
5708
- methods,
5709
- onChange,
5710
- model,
5711
- selection,
5712
- id,
5713
- actionData,
5714
- viewData,
5715
- context
5716
- } = props;
5717
- const _context = { ...(0, import_interface_logic22.evalJSONContext)(actionData?.context) };
5718
- const contextObject = { ...context, ..._context };
5719
- const defaultPriority = parseInt(value) + 1;
5720
- const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
5721
- const { mutateAsync: fetchSave } = (0, import_interface_logic22.useSave)();
5722
- const savePriorities = async ({
5723
- value: value2,
5724
- resetPriority
5725
- }) => {
5726
- const priorityValue = value2 <= 0 ? 0 : value2 - 1;
5727
- try {
5728
- fetchSave({
5729
- ids: id ? [id] : [],
5730
- data: { [name ?? ""]: String(priorityValue) },
5731
- model: model ?? "",
5732
- context: contextObject
5733
- });
5734
- if (typeof onChange === "function") {
5735
- onChange(name ?? "", String(priorityValue));
5736
- }
5737
- } catch (error) {
5738
- if (resetPriority) {
5739
- resetPriority();
5740
- }
5741
- }
5742
- };
5743
- return {
5744
- selection,
5745
- isForm,
5746
- methods,
5747
- defaultPriority,
5748
- savePriorities,
5749
- label,
5750
- id,
5751
- onChange
5752
- };
5753
- };
5754
-
5755
- // src/widget/basic/float-time-field/controller.ts
5756
- var import_react23 = require("react");
5757
- var import_interface_logic23 = require("@fctc/interface-logic");
5758
- var floatTimeFiledController = ({
5759
- onChange: fieldOnChange,
5760
- onBlur,
5761
- value,
5762
- isDirty,
5763
- props
5764
- }) => {
5765
- const { name, defaultValue = 0, onChange } = props;
5766
- const [input, setInput] = (0, import_react23.useState)(
5767
- (0, import_interface_logic23.convertFloatToTime)(value ?? defaultValue)
5768
- );
5769
- const [formattedTime, setFormattedTime] = (0, import_react23.useState)("");
5770
- const [errors, setErrors] = (0, import_react23.useState)("");
5771
- const handleInputChange = (e) => {
5772
- const raw = e.target.value.replace(/[^\d:]/g, "");
5773
- setInput(raw);
5774
- const timeRegex = /^(\d{1,2}):?(\d{0,2})$/;
5775
- const match = raw.match(timeRegex);
5776
- if (!match) {
5777
- setErrors("\u0110\u1ECBnh d\u1EA1ng kh\xF4ng h\u1EE3p l\u1EC7");
5778
- setFormattedTime("");
5779
- return;
5780
- }
5781
- let hours = parseInt(match[1] ?? "0", 10);
5782
- let minutes = parseInt(match[2] ?? "0", 10);
5783
- if (isNaN(hours)) hours = 0;
5784
- if (isNaN(minutes)) minutes = 0;
5785
- if (hours >= 24) {
5786
- hours = 0;
5787
- }
5788
- if (minutes >= 60) {
5789
- minutes = 0;
5790
- }
5791
- const formatted = `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
5792
- setErrors("");
5793
- setFormattedTime(formatted);
5794
- fieldOnChange(formatted);
5795
- };
5796
- const handleBlur = () => {
5797
- if (!isDirty) return;
5798
- if (formattedTime) {
5799
- setInput(formattedTime);
5800
- const floatVal = (0, import_interface_logic23.convertTimeToFloat)(formattedTime);
5801
- fieldOnChange(floatVal);
5802
- if (onChange) {
5803
- onChange(name ?? "", floatVal);
5804
- }
5805
- } else {
5806
- setInput("00:00");
5807
- fieldOnChange(0);
5808
- if (onChange) {
5809
- onChange(name ?? "", 0);
5810
- }
5811
- setErrors("");
5812
- }
5813
- onBlur();
5814
- };
5815
- const handleKeyDown = (e) => {
5816
- {
5817
- const allowed = [
5818
- "Backspace",
5819
- "Tab",
5820
- "ArrowLeft",
5821
- "ArrowRight",
5822
- "Delete",
5823
- "Home",
5824
- "End",
5825
- ":"
5826
- ];
5827
- const isNumber = /^[0-9]$/.test(e.key);
5828
- if (!isNumber && !allowed.includes(e.key)) {
5829
- e.preventDefault();
5830
- }
5831
- }
5832
- };
5833
- return {
5834
- handleInputChange,
5835
- handleBlur,
5836
- handleKeyDown,
5837
- input,
5838
- errors
5839
- };
5840
- };
5841
-
5842
- // src/widget/basic/float-field/controller.ts
5843
- var import_react24 = require("react");
5844
-
5845
- // src/utils/i18n.ts
5846
- var import_react_i18next2 = require("react-i18next");
5847
- var import_i18next = __toESM(require("i18next"));
5848
- var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
5510
+ // src/utils/i18n.ts
5511
+ var import_react_i18next2 = require("react-i18next");
5512
+ var import_i18next = __toESM(require("i18next"));
5513
+ var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
5849
5514
 
5850
5515
  // src/locales/vi.json
5851
5516
  var vi_default = {
@@ -6032,8 +5697,6 @@ var vi_default = {
6032
5697
  add_new_attribute: "Th\xEAm thu\u1ED9c t\xEDnh",
6033
5698
  add_attribute_name: "T\xEAn thu\u1ED9c t\xEDnh",
6034
5699
  images_product: "H\xECnh \u1EA3nh",
6035
- selected: "\u0111\u01B0\u1EE3c ch\u1ECDn",
6036
- print: "In",
6037
5700
  generate_code_product: "T\u1EA1o m\xE3 s\u1EA3n ph\u1EA9m",
6038
5701
  order_today: "\u0110\u01A1n h\xE0ng",
6039
5702
  list_best_selling_product: "S\u1EA3n ph\u1EA9m b\xE1n ch\u1EA1y",
@@ -6610,7 +6273,608 @@ import_i18next.default.use(import_i18next_browser_languagedetector.default).use(
6610
6273
  });
6611
6274
  var i18n_default = import_i18next.default;
6612
6275
 
6276
+ // src/widget/advance/table/table-group/controller.ts
6277
+ var tableGroupController = (props) => {
6278
+ const env = (0, import_interface_logic21.getEnv)();
6279
+ const {
6280
+ rows,
6281
+ columns,
6282
+ indexRow,
6283
+ row,
6284
+ model,
6285
+ viewData,
6286
+ renderField,
6287
+ level,
6288
+ specification,
6289
+ domain,
6290
+ context,
6291
+ checkedAll,
6292
+ isDisplayCheckbox,
6293
+ isAutoSelect,
6294
+ setIsAutoSelect,
6295
+ selectedRowKeysRef
6296
+ } = props;
6297
+ const [pageGroup, setPageGroup] = (0, import_react21.useState)(0);
6298
+ const { groupByDomain, selectedTags } = (0, import_interface_logic21.useAppSelector)(import_interface_logic21.selectSearch);
6299
+ const { selectedRowKeys } = (0, import_interface_logic21.useAppSelector)(import_interface_logic21.selectList);
6300
+ const appDispatch = (0, import_interface_logic21.useAppDispatch)();
6301
+ const { toDataJS } = (0, import_interface_logic21.useOdooDataTransform)();
6302
+ const initVal = toDataJS(row, viewData, model);
6303
+ const [isShowGroup, setIsShowGroup] = (0, import_react21.useState)(false);
6304
+ const [colEmptyGroup, setColEmptyGroup] = (0, import_react21.useState)({
6305
+ fromStart: 1,
6306
+ fromEnd: 1
6307
+ });
6308
+ const processedData = (0, import_react21.useMemo)(() => {
6309
+ const calculateColSpanEmpty = () => {
6310
+ const startIndex = columns.findIndex(
6311
+ (col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
6312
+ );
6313
+ const endIndex = columns.findLastIndex(
6314
+ (col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator !== "sum"
6315
+ );
6316
+ const fromStart = startIndex === -1 ? columns.length : startIndex;
6317
+ const fromEnd = endIndex === -1 ? columns.length : columns.length - 1 - endIndex;
6318
+ setColEmptyGroup({ fromStart: fromStart + 1, fromEnd: fromEnd + 1 });
6319
+ return { fromStart: fromStart + 1, fromEnd: fromEnd + 1 };
6320
+ };
6321
+ return calculateColSpanEmpty();
6322
+ }, [columns, row]);
6323
+ const shouldFetchData = (0, import_react21.useMemo)(() => {
6324
+ return !!isShowGroup;
6325
+ }, [isShowGroup]);
6326
+ const enabled = shouldFetchData && !!processedData;
6327
+ const listDataProps = {
6328
+ model,
6329
+ specification,
6330
+ domain,
6331
+ context,
6332
+ offset: pageGroup * 10,
6333
+ fields: groupByDomain?.fields,
6334
+ groupby: [groupByDomain?.contexts[level]?.group_by]
6335
+ };
6336
+ const queryKey = [
6337
+ `data-${model}--${level}-row${indexRow}`,
6338
+ specification,
6339
+ domain,
6340
+ pageGroup
6341
+ ];
6342
+ const {
6343
+ data: dataResponse,
6344
+ isFetched: isQueryFetched,
6345
+ isPlaceholderData,
6346
+ isLoading,
6347
+ isFetching
6348
+ } = (0, import_interface_logic21.useGetListData)(listDataProps, queryKey, enabled);
6349
+ const {
6350
+ columns: columnsGroup,
6351
+ rows: rowsGroup,
6352
+ typeTable: typeTableGroup
6353
+ } = tableController({
6354
+ data: {
6355
+ fields: viewData?.views?.list?.fields,
6356
+ records: dataResponse?.records ?? dataResponse?.groups,
6357
+ dataModel: viewData?.models?.[model],
6358
+ context: env.context,
6359
+ typeTable: dataResponse?.groups ? "group" : "list"
6360
+ }
6361
+ });
6362
+ const leftPadding = level > 1 ? level * 8 + "px" : "0px";
6363
+ (0, import_react21.useEffect)(() => {
6364
+ if (isShowGroup && selectedTags?.length > 0) {
6365
+ setIsShowGroup(false);
6366
+ }
6367
+ }, [selectedTags]);
6368
+ const group_by_field_name = groupByDomain?.contexts[level - 1]?.group_by;
6369
+ const nameGroup = Array.isArray(row[group_by_field_name]) ? row?.string ?? row[`${group_by_field_name}`][1] : viewData?.models?.[model]?.[group_by_field_name]?.selection ? viewData.models[model][group_by_field_name].selection.find(
6370
+ (selectItem) => selectItem?.[0] === row[group_by_field_name]
6371
+ )?.[1] : row[group_by_field_name];
6372
+ const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
6373
+ const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
6374
+ const handleExpandChildGroup = () => {
6375
+ if (isLoading || isFetching) return;
6376
+ const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
6377
+ if (allIdsNull || typeTableGroup === "group") {
6378
+ toggleShowGroup();
6379
+ return;
6380
+ }
6381
+ if (isShowGroup && checkedAll) {
6382
+ const ids = rowsGroup?.map((item) => item?.id) || [];
6383
+ const filteredIds = selectedRowKeys.filter(
6384
+ (id) => !ids.includes(id)
6385
+ );
6386
+ appDispatch((0, import_interface_logic21.setSelectedRowKeys)(filteredIds));
6387
+ } else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
6388
+ const clonedKeys = [...selectedRowKeys];
6389
+ appDispatch((0, import_interface_logic21.setSelectedRowKeys)([...clonedKeys, -1]));
6390
+ setTimeout(() => appDispatch((0, import_interface_logic21.setSelectedRowKeys)(clonedKeys)), 500);
6391
+ } else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
6392
+ const filteredKeys = selectedRowKeys.filter((id) => id > -1);
6393
+ appDispatch((0, import_interface_logic21.setSelectedRowKeys)(filteredKeys));
6394
+ }
6395
+ toggleShowGroup();
6396
+ };
6397
+ (0, import_react21.useEffect)(() => {
6398
+ if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
6399
+ return;
6400
+ }
6401
+ const clonedKeys = [...selectedRowKeys];
6402
+ (0, import_interface_logic21.setSelectedRowKeys)([...clonedKeys, -1]);
6403
+ setTimeout(() => (0, import_interface_logic21.setSelectedRowKeys)(clonedKeys), 500);
6404
+ }, [isQueryFetched]);
6405
+ return {
6406
+ handleExpandChildGroup,
6407
+ colEmptyGroup,
6408
+ leftPadding,
6409
+ isShowGroup,
6410
+ isQueryFetched,
6411
+ nameGroupWithCount,
6412
+ columns,
6413
+ row,
6414
+ isPlaceholderData,
6415
+ columnsGroup,
6416
+ indexRow,
6417
+ rowsGroup,
6418
+ model,
6419
+ viewData,
6420
+ renderField,
6421
+ level,
6422
+ specification,
6423
+ context,
6424
+ checkedAll,
6425
+ isDisplayCheckbox,
6426
+ isAutoSelect,
6427
+ setIsAutoSelect,
6428
+ selectedRowKeysRef,
6429
+ initVal,
6430
+ dataResponse,
6431
+ pageGroup,
6432
+ setPageGroup
6433
+ };
6434
+ };
6435
+
6436
+ // src/widget/basic/many2many-field/controller.ts
6437
+ var many2manyFieldController = (props) => {
6438
+ const {
6439
+ relation,
6440
+ domain,
6441
+ context,
6442
+ tab,
6443
+ model,
6444
+ aid,
6445
+ setSelectedRowKeys: setSelectedRowKeys4,
6446
+ fields,
6447
+ setFields,
6448
+ groupByDomain,
6449
+ page,
6450
+ options,
6451
+ sessionStorageUtils
6452
+ } = props;
6453
+ const appDispatch = (0, import_interface_logic22.useAppDispatch)();
6454
+ const actionData = sessionStorageUtils.getActionData();
6455
+ const [debouncedPage] = useDebounce(page, 500);
6456
+ const [order, setOrder] = (0, import_react22.useState)();
6457
+ const [isLoadedData, setIsLoadedData] = (0, import_react22.useState)(false);
6458
+ const [domainMany2Many, setDomainMany2Many] = (0, import_react22.useState)(domain);
6459
+ const env = (0, import_interface_logic22.getEnv)();
6460
+ const { selectedTags } = (0, import_interface_logic22.useAppSelector)(import_interface_logic22.selectSearch);
6461
+ const viewParams = {
6462
+ model: relation,
6463
+ views: [
6464
+ [false, "list"],
6465
+ [false, "search"]
6466
+ ],
6467
+ context
6468
+ };
6469
+ const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic22.useGetView)(
6470
+ viewParams,
6471
+ actionData
6472
+ );
6473
+ const baseModel = (0, import_react22.useMemo)(
6474
+ () => ({
6475
+ name: String(relation),
6476
+ view: viewResponse || {},
6477
+ actContext: context,
6478
+ fields: [
6479
+ ...Object.values(viewResponse?.views?.list?.fields ?? {}),
6480
+ ...tab?.fields ? tab.fields : []
6481
+ ]
6482
+ }),
6483
+ [model, viewResponse]
6484
+ );
6485
+ const initModel = (0, import_interface_logic22.useModel)();
6486
+ const modelInstance = (0, import_react22.useMemo)(() => {
6487
+ if (viewResponse) {
6488
+ return initModel.initModel(baseModel);
6489
+ }
6490
+ return null;
6491
+ }, [baseModel, viewResponse]);
6492
+ const specification = (0, import_react22.useMemo)(() => {
6493
+ if (modelInstance) {
6494
+ return modelInstance.getSpecification();
6495
+ }
6496
+ return null;
6497
+ }, [modelInstance]);
6498
+ const default_order = viewResponse && viewResponse?.views?.list?.default_order;
6499
+ const optionsObject = tab?.options ? (0, import_interface_logic22.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic22.evalJSONContext)(options) : {}) || {};
6500
+ const fetchData = async () => {
6501
+ try {
6502
+ setDomainMany2Many(domain);
6503
+ appDispatch((0, import_interface_logic22.setFirstDomain)(domain));
6504
+ appDispatch((0, import_interface_logic22.setViewDataStore)(viewResponse));
6505
+ const modalData = viewResponse?.views?.list?.fields.map((field) => ({
6506
+ ...viewResponse?.models?.[String(model)]?.[field?.name],
6507
+ ...field
6508
+ }));
6509
+ if (!fields?.[`${aid}_${relation}_popupmany2many`] && modalData) {
6510
+ setFields({
6511
+ ...fields,
6512
+ [`${aid}_${relation}_popupmany2many`]: modalData
6513
+ });
6514
+ }
6515
+ appDispatch((0, import_interface_logic22.setPage)(0));
6516
+ } catch (err) {
6517
+ console.log(err);
6518
+ }
6519
+ };
6520
+ const queryKey = [
6521
+ `view-${relation}-${aid}`,
6522
+ specification,
6523
+ domainMany2Many,
6524
+ debouncedPage,
6525
+ groupByDomain,
6526
+ order
6527
+ ];
6528
+ const data = {
6529
+ model: relation,
6530
+ specification,
6531
+ domain: domainMany2Many,
6532
+ offset: debouncedPage * 10,
6533
+ limit: 10,
6534
+ context,
6535
+ fields: groupByDomain?.fields,
6536
+ groupby: [groupByDomain?.contexts[0]?.group_by],
6537
+ sort: order ? order : default_order ? (0, import_interface_logic22.formatSortingString)(default_order) : ""
6538
+ };
6539
+ const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
6540
+ const {
6541
+ data: dataResponse,
6542
+ isLoading: isDataLoading,
6543
+ isFetched: isDataResponseFetched,
6544
+ isPlaceholderData
6545
+ } = (0, import_interface_logic22.useGetListData)(data, queryKey, enabled);
6546
+ (0, import_react22.useEffect)(() => {
6547
+ if (viewResponse) {
6548
+ fetchData();
6549
+ }
6550
+ return () => {
6551
+ appDispatch((0, import_interface_logic22.setGroupByDomain)(null));
6552
+ setFields((prevFields) => ({
6553
+ ...prevFields,
6554
+ [`${aid}_${relation}_popupmany2many`]: null
6555
+ }));
6556
+ appDispatch((0, import_interface_logic22.setPage)(0));
6557
+ setSelectedRowKeys4([]);
6558
+ setDomainMany2Many(null);
6559
+ setIsLoadedData(false);
6560
+ };
6561
+ }, [viewResponse]);
6562
+ const { rows, columns, typeTable } = tableController({
6563
+ data: {
6564
+ fields: fields?.[`${aid}_${relation}_popupmany2many`] || viewResponse?.views?.list?.fields,
6565
+ records: dataResponse?.records ?? dataResponse?.groups,
6566
+ dataModel: viewResponse?.models?.[String(relation)],
6567
+ context: { ...env.context, ...context },
6568
+ typeTable: dataResponse?.groups ? "group" : "list"
6569
+ }
6570
+ });
6571
+ const dataFormView = {
6572
+ id: null,
6573
+ model: relation,
6574
+ context
6575
+ };
6576
+ const {
6577
+ refetch,
6578
+ data: dataFormViewResponse,
6579
+ isSuccess
6580
+ } = (0, import_interface_logic22.useGetFormView)({
6581
+ data: dataFormView,
6582
+ queryKey: [`form-view-action-${relation}`],
6583
+ enabled: false
6584
+ });
6585
+ (0, import_react22.useEffect)(() => {
6586
+ if (isSuccess && dataFormViewResponse) {
6587
+ sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
6588
+ window.location.href = `/form/menu?model=${relation}`;
6589
+ }
6590
+ }, [isSuccess]);
6591
+ (0, import_react22.useEffect)(() => {
6592
+ if (domainMany2Many && !isLoadedData) {
6593
+ setIsLoadedData(true);
6594
+ }
6595
+ }, [domainMany2Many]);
6596
+ const handleCreateNewOnPage = async () => {
6597
+ try {
6598
+ refetch();
6599
+ } catch (error) {
6600
+ console.log(error);
6601
+ }
6602
+ };
6603
+ return {};
6604
+ };
6605
+
6606
+ // src/widget/basic/many2many-tags-field/controller.ts
6607
+ var import_react23 = require("react");
6608
+ var import_interface_logic23 = require("@fctc/interface-logic");
6609
+ var many2manyTagsController = (props) => {
6610
+ const {
6611
+ relation,
6612
+ domain,
6613
+ options: optionsFields,
6614
+ widget,
6615
+ formValues,
6616
+ placeholderNoOption
6617
+ } = props;
6618
+ const isUser = relation === "res.users" || relation === "res.partner";
6619
+ const env = (0, import_interface_logic23.getEnv)();
6620
+ const addtionalFields = optionsFields ? (0, import_interface_logic23.evalJSONContext)(optionsFields) : null;
6621
+ const domainObject = (0, import_react23.useMemo)(
6622
+ () => (0, import_interface_logic23.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
6623
+ [domain, formValues]
6624
+ );
6625
+ const data = {
6626
+ model: relation ?? "",
6627
+ domain: domainObject,
6628
+ specification: {
6629
+ id: {},
6630
+ name: {},
6631
+ display_name: {},
6632
+ ...widget && import_interface_logic23.WIDGETAVATAR[widget] ? { image_256: {} } : {},
6633
+ ...widget && import_interface_logic23.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
6634
+ },
6635
+ enabled: true,
6636
+ context: env.context
6637
+ };
6638
+ const { data: dataOfSelection } = (0, import_interface_logic23.useGetSelection)({
6639
+ data,
6640
+ queryKey: [`data_${relation}`, domainObject]
6641
+ });
6642
+ const customNoOptionsMessage = () => placeholderNoOption;
6643
+ const tranfer = (data2) => {
6644
+ return data2?.map((val) => ({
6645
+ id: val.value,
6646
+ display_name: val.label
6647
+ })) || [];
6648
+ };
6649
+ const options = dataOfSelection?.records?.map((val) => ({
6650
+ value: val.id,
6651
+ label: val.name ?? val.display_name,
6652
+ ...val
6653
+ })) || [];
6654
+ return {
6655
+ options,
6656
+ customNoOptionsMessage,
6657
+ tranfer,
6658
+ dataOfSelection,
6659
+ isUser
6660
+ };
6661
+ };
6662
+
6663
+ // src/widget/basic/status-bar-field/controller.ts
6664
+ var import_react24 = require("react");
6665
+ var import_interface_logic24 = require("@fctc/interface-logic");
6666
+ var durationController = (props) => {
6667
+ const {
6668
+ relation,
6669
+ defaultValue,
6670
+ domain,
6671
+ formValues,
6672
+ name,
6673
+ id,
6674
+ model,
6675
+ onRefetch
6676
+ } = props;
6677
+ const specification = {
6678
+ id: 0,
6679
+ name: "",
6680
+ fold: ""
6681
+ };
6682
+ const [disabled, setDisabled] = (0, import_react24.useState)(false);
6683
+ const [modelStatus, setModalStatus] = (0, import_react24.useState)(false);
6684
+ const { context } = (0, import_interface_logic24.useAppSelector)(import_interface_logic24.selectEnv);
6685
+ const queryKey = [`data-status-duration`, specification];
6686
+ const listDataProps = {
6687
+ model: relation,
6688
+ specification,
6689
+ domain: (0, import_interface_logic24.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
6690
+ limit: 10,
6691
+ offset: 0,
6692
+ fields: "",
6693
+ groupby: [],
6694
+ context: {
6695
+ lang: context.lang
6696
+ },
6697
+ sort: ""
6698
+ };
6699
+ const { data: dataResponse } = (0, import_interface_logic24.useGetListData)(listDataProps, queryKey);
6700
+ const { mutate: fetchChangeStatus } = (0, import_interface_logic24.useChangeStatus)();
6701
+ const handleClick = async (stage_id) => {
6702
+ setDisabled(true);
6703
+ if (stage_id) {
6704
+ fetchChangeStatus(
6705
+ {
6706
+ data: {
6707
+ stage_id,
6708
+ name,
6709
+ id,
6710
+ model,
6711
+ lang: context.lang
6712
+ }
6713
+ },
6714
+ {
6715
+ onSuccess: (res) => {
6716
+ if (res) {
6717
+ setDisabled(false);
6718
+ onRefetch && onRefetch();
6719
+ }
6720
+ }
6721
+ }
6722
+ );
6723
+ }
6724
+ };
6725
+ return {
6726
+ defaultValue,
6727
+ dataResponse,
6728
+ handleClick,
6729
+ disabled,
6730
+ modelStatus,
6731
+ setModalStatus
6732
+ };
6733
+ };
6734
+
6735
+ // src/widget/basic/priority-field/controller.ts
6736
+ var import_interface_logic25 = require("@fctc/interface-logic");
6737
+ var priorityFieldController = (props) => {
6738
+ const {
6739
+ value,
6740
+ isForm,
6741
+ name,
6742
+ methods,
6743
+ onChange,
6744
+ model,
6745
+ selection,
6746
+ id,
6747
+ actionData,
6748
+ viewData,
6749
+ context
6750
+ } = props;
6751
+ const _context = { ...(0, import_interface_logic25.evalJSONContext)(actionData?.context) };
6752
+ const contextObject = { ...context, ..._context };
6753
+ const defaultPriority = parseInt(value) + 1;
6754
+ const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
6755
+ const { mutateAsync: fetchSave } = (0, import_interface_logic25.useSave)();
6756
+ const savePriorities = async ({
6757
+ value: value2,
6758
+ resetPriority
6759
+ }) => {
6760
+ const priorityValue = value2 <= 0 ? 0 : value2 - 1;
6761
+ try {
6762
+ fetchSave({
6763
+ ids: id ? [id] : [],
6764
+ data: { [name ?? ""]: String(priorityValue) },
6765
+ model: model ?? "",
6766
+ context: contextObject
6767
+ });
6768
+ if (typeof onChange === "function") {
6769
+ onChange(name ?? "", String(priorityValue));
6770
+ }
6771
+ } catch (error) {
6772
+ if (resetPriority) {
6773
+ resetPriority();
6774
+ }
6775
+ }
6776
+ };
6777
+ return {
6778
+ selection,
6779
+ isForm,
6780
+ methods,
6781
+ defaultPriority,
6782
+ savePriorities,
6783
+ label,
6784
+ id,
6785
+ onChange
6786
+ };
6787
+ };
6788
+
6789
+ // src/widget/basic/float-time-field/controller.ts
6790
+ var import_react25 = require("react");
6791
+ var import_interface_logic26 = require("@fctc/interface-logic");
6792
+ var floatTimeFiledController = ({
6793
+ onChange: fieldOnChange,
6794
+ onBlur,
6795
+ value,
6796
+ isDirty,
6797
+ props
6798
+ }) => {
6799
+ const { name, defaultValue = 0, onChange } = props;
6800
+ const [input, setInput] = (0, import_react25.useState)(
6801
+ (0, import_interface_logic26.convertFloatToTime)(value ?? defaultValue)
6802
+ );
6803
+ const [formattedTime, setFormattedTime] = (0, import_react25.useState)("");
6804
+ const [errors, setErrors] = (0, import_react25.useState)("");
6805
+ const handleInputChange = (e) => {
6806
+ const raw = e.target.value.replace(/[^\d:]/g, "");
6807
+ setInput(raw);
6808
+ const timeRegex = /^(\d{1,2}):?(\d{0,2})$/;
6809
+ const match = raw.match(timeRegex);
6810
+ if (!match) {
6811
+ setErrors("\u0110\u1ECBnh d\u1EA1ng kh\xF4ng h\u1EE3p l\u1EC7");
6812
+ setFormattedTime("");
6813
+ return;
6814
+ }
6815
+ let hours = parseInt(match[1] ?? "0", 10);
6816
+ let minutes = parseInt(match[2] ?? "0", 10);
6817
+ if (isNaN(hours)) hours = 0;
6818
+ if (isNaN(minutes)) minutes = 0;
6819
+ if (hours >= 24) {
6820
+ hours = 0;
6821
+ }
6822
+ if (minutes >= 60) {
6823
+ minutes = 0;
6824
+ }
6825
+ const formatted = `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
6826
+ setErrors("");
6827
+ setFormattedTime(formatted);
6828
+ fieldOnChange(formatted);
6829
+ };
6830
+ const handleBlur = () => {
6831
+ if (!isDirty) return;
6832
+ if (formattedTime) {
6833
+ setInput(formattedTime);
6834
+ const floatVal = (0, import_interface_logic26.convertTimeToFloat)(formattedTime);
6835
+ fieldOnChange(floatVal);
6836
+ if (onChange) {
6837
+ onChange(name ?? "", floatVal);
6838
+ }
6839
+ } else {
6840
+ setInput("00:00");
6841
+ fieldOnChange(0);
6842
+ if (onChange) {
6843
+ onChange(name ?? "", 0);
6844
+ }
6845
+ setErrors("");
6846
+ }
6847
+ onBlur();
6848
+ };
6849
+ const handleKeyDown = (e) => {
6850
+ {
6851
+ const allowed = [
6852
+ "Backspace",
6853
+ "Tab",
6854
+ "ArrowLeft",
6855
+ "ArrowRight",
6856
+ "Delete",
6857
+ "Home",
6858
+ "End",
6859
+ ":"
6860
+ ];
6861
+ const isNumber = /^[0-9]$/.test(e.key);
6862
+ if (!isNumber && !allowed.includes(e.key)) {
6863
+ e.preventDefault();
6864
+ }
6865
+ }
6866
+ };
6867
+ return {
6868
+ handleInputChange,
6869
+ handleBlur,
6870
+ handleKeyDown,
6871
+ input,
6872
+ errors
6873
+ };
6874
+ };
6875
+
6613
6876
  // src/widget/basic/float-field/controller.ts
6877
+ var import_react26 = require("react");
6614
6878
  var floatController = ({
6615
6879
  onChange,
6616
6880
  value,
@@ -6618,10 +6882,10 @@ var floatController = ({
6618
6882
  }) => {
6619
6883
  const { name, required, methods, onChange: handleOnchange, string } = props;
6620
6884
  const { setError, clearErrors } = methods;
6621
- const [inputValue, setInputValue] = (0, import_react24.useState)(
6885
+ const [inputValue, setInputValue] = (0, import_react26.useState)(
6622
6886
  value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
6623
6887
  );
6624
- (0, import_react24.useEffect)(() => {
6888
+ (0, import_react26.useEffect)(() => {
6625
6889
  if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
6626
6890
  setInputValue(useFormatFloatNumber(value));
6627
6891
  clearErrors(name);
@@ -6629,9 +6893,9 @@ var floatController = ({
6629
6893
  setInputValue("");
6630
6894
  }
6631
6895
  }, [value, name, clearErrors]);
6632
- const isDirtyRef = (0, import_react24.useRef)(false);
6633
- const inputRef = (0, import_react24.useRef)(null);
6634
- const lastCommittedValueRef = (0, import_react24.useRef)(null);
6896
+ const isDirtyRef = (0, import_react26.useRef)(false);
6897
+ const inputRef = (0, import_react26.useRef)(null);
6898
+ const lastCommittedValueRef = (0, import_react26.useRef)(null);
6635
6899
  const handleInputChange = (e) => {
6636
6900
  const newValue = e.target.value;
6637
6901
  const valueWithoutCommas = newValue.replace(/,/g, "");
@@ -6732,10 +6996,10 @@ var useFormatFloatNumber = (value) => {
6732
6996
  };
6733
6997
 
6734
6998
  // src/widget/basic/download-file-field/controller.ts
6735
- var import_react25 = require("react");
6999
+ var import_react27 = require("react");
6736
7000
  var downloadFileController = () => {
6737
- const inputId = (0, import_react25.useId)();
6738
- const [file, setFile] = (0, import_react25.useState)(null);
7001
+ const inputId = (0, import_react27.useId)();
7002
+ const [file, setFile] = (0, import_react27.useState)(null);
6739
7003
  const handleFileChange = (e) => {
6740
7004
  setFile(e.target.files[0]);
6741
7005
  };
@@ -6899,13 +7163,13 @@ var dateFieldController = (props) => {
6899
7163
  };
6900
7164
 
6901
7165
  // src/widget/basic/copy-link-button/controller.ts
6902
- var import_react26 = require("react");
6903
- var import_interface_logic24 = require("@fctc/interface-logic");
7166
+ var import_react28 = require("react");
7167
+ var import_interface_logic27 = require("@fctc/interface-logic");
6904
7168
  var copyLinkButtonController = (props) => {
6905
7169
  const { value, defaultValue } = props;
6906
- const [isCopied, setIsCopied] = (0, import_react26.useState)(false);
7170
+ const [isCopied, setIsCopied] = (0, import_react28.useState)(false);
6907
7171
  const handleCopyToClipboard = async (value2) => {
6908
- await (0, import_interface_logic24.copyTextToClipboard)(value2);
7172
+ await (0, import_interface_logic27.copyTextToClipboard)(value2);
6909
7173
  setIsCopied(true);
6910
7174
  setTimeout(() => setIsCopied(false), 2e3);
6911
7175
  };
@@ -6918,14 +7182,14 @@ var copyLinkButtonController = (props) => {
6918
7182
  };
6919
7183
 
6920
7184
  // src/widget/basic/color-field/color-controller.ts
6921
- var import_interface_logic25 = require("@fctc/interface-logic");
7185
+ var import_interface_logic28 = require("@fctc/interface-logic");
6922
7186
  var colorFieldController = (props) => {
6923
7187
  const { value, isForm, name, formValues, idForm, model, actionData } = props;
6924
- const env = (0, import_interface_logic25.getEnv)();
6925
- const _context = { ...(0, import_interface_logic25.evalJSONContext)(actionData?.context) || {} };
7188
+ const env = (0, import_interface_logic28.getEnv)();
7189
+ const _context = { ...(0, import_interface_logic28.evalJSONContext)(actionData?.context) || {} };
6926
7190
  const contextObject = { ...env.context, ..._context };
6927
7191
  const idDefault = isForm ? idForm : formValues?.id;
6928
- const { mutate: onSave } = (0, import_interface_logic25.useSave)();
7192
+ const { mutate: onSave } = (0, import_interface_logic28.useSave)();
6929
7193
  const savePickColor = async (colorObject) => {
6930
7194
  const { id } = colorObject;
6931
7195
  if (value === id) return;
@@ -6950,16 +7214,16 @@ var colorFieldController = (props) => {
6950
7214
  };
6951
7215
 
6952
7216
  // src/widget/basic/binary-field/controller.ts
6953
- var import_react27 = require("react");
6954
- var import_interface_logic26 = require("@fctc/interface-logic");
7217
+ var import_react29 = require("react");
7218
+ var import_interface_logic29 = require("@fctc/interface-logic");
6955
7219
  var binaryFieldController = (props) => {
6956
7220
  const { name, methods, readonly = false, value } = props;
6957
- const inputId = (0, import_react27.useId)();
6958
- const [selectedImage, setSelectedImage] = (0, import_react27.useState)(null);
6959
- const [initialImage, setInitialImage] = (0, import_react27.useState)(value || null);
6960
- const [isInsideTable, setIsInsideTable] = (0, import_react27.useState)(false);
7221
+ const inputId = (0, import_react29.useId)();
7222
+ const [selectedImage, setSelectedImage] = (0, import_react29.useState)(null);
7223
+ const [initialImage, setInitialImage] = (0, import_react29.useState)(value || null);
7224
+ const [isInsideTable, setIsInsideTable] = (0, import_react29.useState)(false);
6961
7225
  const { setValue } = methods;
6962
- const binaryRef = (0, import_react27.useRef)(null);
7226
+ const binaryRef = (0, import_react29.useRef)(null);
6963
7227
  const convertUrlToBase64 = async (url) => {
6964
7228
  try {
6965
7229
  const response = await fetch(url);
@@ -7008,11 +7272,11 @@ var binaryFieldController = (props) => {
7008
7272
  };
7009
7273
  const checkIsImageLink = (url) => {
7010
7274
  const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
7011
- return imageExtensions.test(url) || (0, import_interface_logic26.isBase64Image)(url) || isBlobUrl(url);
7275
+ return imageExtensions.test(url) || (0, import_interface_logic29.isBase64Image)(url) || isBlobUrl(url);
7012
7276
  };
7013
7277
  const getImageBase64WithMimeType = (base64) => {
7014
7278
  if (typeof base64 !== "string" || base64.length < 10) return null;
7015
- if ((0, import_interface_logic26.isBase64Image)(base64)) return base64;
7279
+ if ((0, import_interface_logic29.isBase64Image)(base64)) return base64;
7016
7280
  let mimeType = null;
7017
7281
  if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
7018
7282
  else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
@@ -7021,14 +7285,14 @@ var binaryFieldController = (props) => {
7021
7285
  else if (base64.startsWith("UklGR")) mimeType = "image/webp";
7022
7286
  return mimeType ? `data:${mimeType};base64,${base64}` : null;
7023
7287
  };
7024
- (0, import_react27.useEffect)(() => {
7288
+ (0, import_react29.useEffect)(() => {
7025
7289
  return () => {
7026
7290
  if (selectedImage) {
7027
7291
  URL.revokeObjectURL(selectedImage);
7028
7292
  }
7029
7293
  };
7030
7294
  }, [selectedImage]);
7031
- (0, import_react27.useEffect)(() => {
7295
+ (0, import_react29.useEffect)(() => {
7032
7296
  if (binaryRef.current) {
7033
7297
  const isInsideTable2 = !!binaryRef.current.closest("table");
7034
7298
  setIsInsideTable(isInsideTable2);
@@ -7046,272 +7310,6 @@ var binaryFieldController = (props) => {
7046
7310
  getImageBase64WithMimeType
7047
7311
  };
7048
7312
  };
7049
-
7050
- // src/widget/advance/table/table-body/controller.ts
7051
- var import_interface_logic27 = require("@fctc/interface-logic");
7052
- var import_react28 = require("react");
7053
- var tableBodyController = (props) => {
7054
- const {
7055
- checkedAll,
7056
- checkboxRef,
7057
- setIsAutoSelect,
7058
- selectedRowKeys,
7059
- row,
7060
- isAutoSelect,
7061
- selectedRowKeysRef,
7062
- onClickRow
7063
- } = props;
7064
- const appDispatch = (0, import_interface_logic27.useAppDispatch)();
7065
- const checked = (0, import_react28.useMemo)(() => {
7066
- if (!row?.id) return false;
7067
- if (selectedRowKeys?.includes(row.id)) {
7068
- return true;
7069
- }
7070
- return checkedAll;
7071
- }, [row?.id, selectedRowKeys, checkedAll]);
7072
- const handleCheckBoxSingle = (event) => {
7073
- event.stopPropagation();
7074
- if (checkedAll) {
7075
- checkboxRef.current = "uncheck";
7076
- setIsAutoSelect(true);
7077
- return;
7078
- }
7079
- const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
7080
- console.log("newSelectedRowKeys", newSelectedRowKeys);
7081
- appDispatch((0, import_interface_logic27.setSelectedRowKeys)(newSelectedRowKeys));
7082
- };
7083
- const handleClickRow = (col, row2) => {
7084
- onClickRow(col, row2);
7085
- };
7086
- (0, import_react28.useEffect)(() => {
7087
- if (!row?.id) return;
7088
- if (isAutoSelect) {
7089
- if (checkboxRef?.current === "uncheck") {
7090
- const filtered = selectedRowKeysRef.current.filter(
7091
- (id) => id !== row.id
7092
- );
7093
- selectedRowKeysRef.current = filtered;
7094
- appDispatch((0, import_interface_logic27.setSelectedRowKeys)(filtered));
7095
- } else {
7096
- const unique = Array.from(
7097
- /* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
7098
- );
7099
- selectedRowKeysRef.current = unique;
7100
- appDispatch((0, import_interface_logic27.setSelectedRowKeys)(unique));
7101
- }
7102
- }
7103
- }, [isAutoSelect]);
7104
- (0, import_react28.useEffect)(() => {
7105
- if (!checkedAll) {
7106
- checkboxRef.current = "enabled";
7107
- false;
7108
- }
7109
- }, [checkedAll]);
7110
- return {
7111
- handleCheckBoxSingle,
7112
- checked,
7113
- handleClickRow
7114
- };
7115
- };
7116
-
7117
- // src/widget/advance/table/table-head/controller.ts
7118
- var import_interface_logic28 = require("@fctc/interface-logic");
7119
- var tableHeadController = (props) => {
7120
- const { typeTable, rows, selectedRowKeysRef } = props;
7121
- const appDispatch = (0, import_interface_logic28.useAppDispatch)();
7122
- const { groupByDomain } = (0, import_interface_logic28.useAppSelector)(import_interface_logic28.selectSearch);
7123
- const handleCheckBoxAll = (event) => {
7124
- if (event?.target?.checked && typeTable === "list") {
7125
- const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
7126
- appDispatch((0, import_interface_logic28.setSelectedRowKeys)(allRowKeys));
7127
- } else if (event?.target?.checked && typeTable === "group") {
7128
- const rowsIDs = document.querySelectorAll("tr[data-row-id]");
7129
- const ids = Array.from(rowsIDs)?.map(
7130
- (row) => Number(row?.getAttribute("data-row-id"))
7131
- );
7132
- if (ids?.length > 0) {
7133
- appDispatch((0, import_interface_logic28.setSelectedRowKeys)(ids));
7134
- } else {
7135
- const sum = countSum(
7136
- rows,
7137
- typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
7138
- );
7139
- const keys = Array.from({ length: sum }, (_) => void 0);
7140
- appDispatch((0, import_interface_logic28.setSelectedRowKeys)(keys));
7141
- }
7142
- if (selectedRowKeysRef) {
7143
- selectedRowKeysRef.current = [];
7144
- }
7145
- } else {
7146
- appDispatch((0, import_interface_logic28.setSelectedRowKeys)([]));
7147
- }
7148
- };
7149
- return {
7150
- handleCheckBoxAll
7151
- };
7152
- };
7153
-
7154
- // src/widget/advance/table/table-group/controller.ts
7155
- var import_interface_logic29 = require("@fctc/interface-logic");
7156
- var import_react29 = require("react");
7157
- var tableGroupController = (props) => {
7158
- const env = (0, import_interface_logic29.getEnv)();
7159
- const {
7160
- rows,
7161
- columns,
7162
- indexRow,
7163
- row,
7164
- model,
7165
- viewData,
7166
- renderField,
7167
- level,
7168
- specification,
7169
- domain,
7170
- context,
7171
- checkedAll,
7172
- isDisplayCheckbox,
7173
- isAutoSelect,
7174
- setIsAutoSelect,
7175
- selectedRowKeysRef
7176
- } = props;
7177
- const [pageGroup, setPageGroup] = (0, import_react29.useState)(0);
7178
- const { groupByDomain, selectedTags } = (0, import_interface_logic29.useAppSelector)(import_interface_logic29.selectSearch);
7179
- const { selectedRowKeys } = (0, import_interface_logic29.useAppSelector)(import_interface_logic29.selectList);
7180
- const appDispatch = (0, import_interface_logic29.useAppDispatch)();
7181
- const { toDataJS } = (0, import_interface_logic29.useOdooDataTransform)();
7182
- const initVal = toDataJS(row, viewData, model);
7183
- const [isShowGroup, setIsShowGroup] = (0, import_react29.useState)(false);
7184
- const [colEmptyGroup, setColEmptyGroup] = (0, import_react29.useState)({
7185
- fromStart: 1,
7186
- fromEnd: 1
7187
- });
7188
- const processedData = (0, import_react29.useMemo)(() => {
7189
- const calculateColSpanEmpty = () => {
7190
- const startIndex = columns.findIndex(
7191
- (col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
7192
- );
7193
- const endIndex = columns.findLastIndex(
7194
- (col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator !== "sum"
7195
- );
7196
- const fromStart = startIndex === -1 ? columns.length : startIndex;
7197
- const fromEnd = endIndex === -1 ? columns.length : columns.length - 1 - endIndex;
7198
- setColEmptyGroup({ fromStart: fromStart + 1, fromEnd: fromEnd + 1 });
7199
- return { fromStart: fromStart + 1, fromEnd: fromEnd + 1 };
7200
- };
7201
- return calculateColSpanEmpty();
7202
- }, [columns, row]);
7203
- const shouldFetchData = (0, import_react29.useMemo)(() => {
7204
- return !!isShowGroup;
7205
- }, [isShowGroup]);
7206
- const enabled = shouldFetchData && !!processedData;
7207
- const listDataProps = {
7208
- model,
7209
- specification,
7210
- domain,
7211
- context,
7212
- offset: pageGroup * 10,
7213
- fields: groupByDomain?.fields,
7214
- groupby: [groupByDomain?.contexts[level]?.group_by]
7215
- };
7216
- const queryKey = [
7217
- `data-${model}--${level}-row${indexRow}`,
7218
- specification,
7219
- domain,
7220
- pageGroup
7221
- ];
7222
- const {
7223
- data: dataResponse,
7224
- isFetched: isQueryFetched,
7225
- isPlaceholderData,
7226
- isLoading,
7227
- isFetching
7228
- } = (0, import_interface_logic29.useGetListData)(listDataProps, queryKey, enabled);
7229
- const {
7230
- columns: columnsGroup,
7231
- rows: rowsGroup,
7232
- typeTable: typeTableGroup
7233
- } = tableController({
7234
- data: {
7235
- fields: viewData?.views?.list?.fields,
7236
- records: dataResponse?.records ?? dataResponse?.groups,
7237
- dataModel: viewData?.models?.[model],
7238
- context: env.context,
7239
- typeTable: dataResponse?.groups ? "group" : "list"
7240
- }
7241
- });
7242
- const leftPadding = level > 1 ? level * 8 + "px" : "0px";
7243
- (0, import_react29.useEffect)(() => {
7244
- if (isShowGroup && selectedTags?.length > 0) {
7245
- setIsShowGroup(false);
7246
- }
7247
- }, [selectedTags]);
7248
- const group_by_field_name = groupByDomain?.contexts[level - 1]?.group_by;
7249
- const nameGroup = Array.isArray(row[group_by_field_name]) ? row?.string ?? row[`${group_by_field_name}`][1] : viewData?.models?.[model]?.[group_by_field_name]?.selection ? viewData.models[model][group_by_field_name].selection.find(
7250
- (selectItem) => selectItem?.[0] === row[group_by_field_name]
7251
- )?.[1] : row[group_by_field_name];
7252
- const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
7253
- const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
7254
- const handleExpandChildGroup = () => {
7255
- if (isLoading || isFetching) return;
7256
- const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
7257
- if (allIdsNull || typeTableGroup === "group") {
7258
- toggleShowGroup();
7259
- return;
7260
- }
7261
- if (isShowGroup && checkedAll) {
7262
- const ids = rowsGroup?.map((item) => item?.id) || [];
7263
- const filteredIds = selectedRowKeys.filter(
7264
- (id) => !ids.includes(id)
7265
- );
7266
- appDispatch((0, import_interface_logic29.setSelectedRowKeys)(filteredIds));
7267
- } else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
7268
- const clonedKeys = [...selectedRowKeys];
7269
- appDispatch((0, import_interface_logic29.setSelectedRowKeys)([...clonedKeys, -1]));
7270
- setTimeout(() => appDispatch((0, import_interface_logic29.setSelectedRowKeys)(clonedKeys)), 500);
7271
- } else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
7272
- const filteredKeys = selectedRowKeys.filter((id) => id > -1);
7273
- appDispatch((0, import_interface_logic29.setSelectedRowKeys)(filteredKeys));
7274
- }
7275
- toggleShowGroup();
7276
- };
7277
- (0, import_react29.useEffect)(() => {
7278
- if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
7279
- return;
7280
- }
7281
- const clonedKeys = [...selectedRowKeys];
7282
- (0, import_interface_logic29.setSelectedRowKeys)([...clonedKeys, -1]);
7283
- setTimeout(() => (0, import_interface_logic29.setSelectedRowKeys)(clonedKeys), 500);
7284
- }, [isQueryFetched]);
7285
- return {
7286
- handleExpandChildGroup,
7287
- colEmptyGroup,
7288
- leftPadding,
7289
- isShowGroup,
7290
- isQueryFetched,
7291
- nameGroupWithCount,
7292
- columns,
7293
- row,
7294
- isPlaceholderData,
7295
- columnsGroup,
7296
- indexRow,
7297
- rowsGroup,
7298
- model,
7299
- viewData,
7300
- renderField,
7301
- level,
7302
- specification,
7303
- context,
7304
- checkedAll,
7305
- isDisplayCheckbox,
7306
- isAutoSelect,
7307
- setIsAutoSelect,
7308
- selectedRowKeysRef,
7309
- initVal,
7310
- dataResponse,
7311
- pageGroup,
7312
- setPageGroup
7313
- };
7314
- };
7315
7313
  // Annotate the CommonJS export names for ESM import in node:
7316
7314
  0 && (module.exports = {
7317
7315
  API_APP_URL,