@fctc/widget-logic 1.9.7 → 1.9.8
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 +115 -75
- package/dist/index.mjs +104 -59
- package/dist/types.d.mts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/widget.d.mts +9 -11
- package/dist/widget.d.ts +9 -11
- package/dist/widget.js +115 -75
- package/dist/widget.mjs +104 -59
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5246,7 +5246,6 @@ var many2oneFieldController = (props) => {
|
|
|
5246
5246
|
options: fieldOptions,
|
|
5247
5247
|
showDetail
|
|
5248
5248
|
} = props;
|
|
5249
|
-
const { env } = (0, provider_exports.useEnv)();
|
|
5250
5249
|
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
5251
5250
|
const [inputValue, setInputValue] = (0, import_react14.useState)("");
|
|
5252
5251
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
@@ -5256,14 +5255,15 @@ var many2oneFieldController = (props) => {
|
|
|
5256
5255
|
const [domainObject, setDomainObject] = (0, import_react14.useState)(null);
|
|
5257
5256
|
const actionData = sessionStorageUtils.getActionData();
|
|
5258
5257
|
const { menuList } = (0, store_exports.useAppSelector)(store_exports.selectNavbar);
|
|
5258
|
+
const { context } = (0, store_exports.useAppSelector)(store_exports.selectEnv);
|
|
5259
5259
|
const initValue = methods?.getValues(name);
|
|
5260
5260
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
5261
5261
|
const contextObject = {
|
|
5262
5262
|
...(0, utils_exports.evalJSONContext)(actionData?.context) || {},
|
|
5263
5263
|
...fieldContext,
|
|
5264
|
-
...
|
|
5264
|
+
...context
|
|
5265
5265
|
};
|
|
5266
|
-
const { useGetSelection:
|
|
5266
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5267
5267
|
const data = {
|
|
5268
5268
|
model: relation,
|
|
5269
5269
|
domain: domainObject,
|
|
@@ -5279,7 +5279,7 @@ var many2oneFieldController = (props) => {
|
|
|
5279
5279
|
data: dataOfSelection,
|
|
5280
5280
|
refetch,
|
|
5281
5281
|
isFetching
|
|
5282
|
-
} =
|
|
5282
|
+
} = useGetSelection2({
|
|
5283
5283
|
data,
|
|
5284
5284
|
queryKey,
|
|
5285
5285
|
enabled: false
|
|
@@ -5433,49 +5433,52 @@ var many2oneButtonController = (props) => {
|
|
|
5433
5433
|
|
|
5434
5434
|
// src/widget/basic/many2many-field/controller.ts
|
|
5435
5435
|
var import_react15 = require("react");
|
|
5436
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
5436
5437
|
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
5437
5438
|
var many2manyFieldController = (props) => {
|
|
5438
5439
|
const {
|
|
5439
5440
|
relation,
|
|
5440
5441
|
domain,
|
|
5441
5442
|
context,
|
|
5442
|
-
options,
|
|
5443
5443
|
tab,
|
|
5444
|
+
model,
|
|
5445
|
+
aid,
|
|
5444
5446
|
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5447
|
+
fields,
|
|
5448
|
+
setFields,
|
|
5445
5449
|
groupByDomain,
|
|
5446
|
-
|
|
5450
|
+
page,
|
|
5451
|
+
options,
|
|
5452
|
+
sessionStorageUtils
|
|
5447
5453
|
} = props;
|
|
5448
|
-
const
|
|
5449
|
-
const
|
|
5454
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
5455
|
+
const actionData = sessionStorageUtils.getActionData();
|
|
5456
|
+
const [debouncedPage] = useDebounce(page, 500);
|
|
5450
5457
|
const [order, setOrder] = (0, import_react15.useState)();
|
|
5451
5458
|
const [isLoadedData, setIsLoadedData] = (0, import_react15.useState)(false);
|
|
5452
|
-
const [
|
|
5453
|
-
const
|
|
5454
|
-
const
|
|
5455
|
-
const contextObject = {
|
|
5456
|
-
...env.context,
|
|
5457
|
-
...context || {}
|
|
5458
|
-
};
|
|
5459
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(domain);
|
|
5460
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5461
|
+
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5459
5462
|
const viewParams = {
|
|
5460
5463
|
model: relation,
|
|
5461
5464
|
views: [
|
|
5462
5465
|
[false, "list"],
|
|
5463
5466
|
[false, "search"]
|
|
5464
5467
|
],
|
|
5465
|
-
context
|
|
5468
|
+
context
|
|
5466
5469
|
};
|
|
5467
|
-
const { data: viewResponse } = useGetView2(viewParams,
|
|
5470
|
+
const { data: viewResponse } = useGetView2(viewParams, actionData);
|
|
5468
5471
|
const baseModel = (0, import_react15.useMemo)(
|
|
5469
5472
|
() => ({
|
|
5470
5473
|
name: String(relation),
|
|
5471
5474
|
view: viewResponse || {},
|
|
5472
|
-
actContext:
|
|
5475
|
+
actContext: context,
|
|
5473
5476
|
fields: [
|
|
5474
5477
|
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5475
5478
|
...tab?.fields ? tab.fields : []
|
|
5476
5479
|
]
|
|
5477
5480
|
}),
|
|
5478
|
-
[
|
|
5481
|
+
[model, viewResponse]
|
|
5479
5482
|
);
|
|
5480
5483
|
const initModel = (0, hooks_exports.useModel)();
|
|
5481
5484
|
const modelInstance = (0, import_react15.useMemo)(() => {
|
|
@@ -5494,15 +5497,26 @@ var many2manyFieldController = (props) => {
|
|
|
5494
5497
|
const optionsObject = tab?.options ? (0, import_utils6.evalJSONContext)(tab?.options) : (options ? (0, import_utils6.evalJSONContext)(options) : {}) || {};
|
|
5495
5498
|
const fetchData = async () => {
|
|
5496
5499
|
try {
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
+
setDomainMany2Many(domain);
|
|
5501
|
+
appDispatch((0, import_store8.setFirstDomain)(domain));
|
|
5502
|
+
appDispatch((0, import_store8.setViewDataStore)(viewResponse));
|
|
5503
|
+
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
5504
|
+
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
5505
|
+
...field
|
|
5506
|
+
}));
|
|
5507
|
+
if (!fields?.[`${aid}_${relation}_popupmany2many`] && modalData) {
|
|
5508
|
+
setFields({
|
|
5509
|
+
...fields,
|
|
5510
|
+
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
5511
|
+
});
|
|
5512
|
+
}
|
|
5513
|
+
appDispatch((0, import_store8.setPage)(0));
|
|
5500
5514
|
} catch (err) {
|
|
5501
5515
|
console.log(err);
|
|
5502
5516
|
}
|
|
5503
5517
|
};
|
|
5504
5518
|
const queryKey = [
|
|
5505
|
-
`view-${relation}`,
|
|
5519
|
+
`view-${relation}-${aid}`,
|
|
5506
5520
|
specification,
|
|
5507
5521
|
domainMany2Many,
|
|
5508
5522
|
debouncedPage,
|
|
@@ -5515,16 +5529,16 @@ var many2manyFieldController = (props) => {
|
|
|
5515
5529
|
domain: domainMany2Many,
|
|
5516
5530
|
offset: debouncedPage * 10,
|
|
5517
5531
|
limit: 10,
|
|
5518
|
-
context
|
|
5532
|
+
context,
|
|
5519
5533
|
fields: groupByDomain?.fields,
|
|
5520
5534
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5521
5535
|
sort: order ? order : default_order ? (0, import_utils6.formatSortingString)(default_order) : ""
|
|
5522
5536
|
};
|
|
5523
|
-
const enabled =
|
|
5537
|
+
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5524
5538
|
const {
|
|
5525
5539
|
data: dataResponse,
|
|
5526
|
-
isLoading,
|
|
5527
|
-
isFetched,
|
|
5540
|
+
isLoading: isDataLoading,
|
|
5541
|
+
isFetched: isDataResponseFetched,
|
|
5528
5542
|
isPlaceholderData
|
|
5529
5543
|
} = useGetListData3(data, queryKey, enabled);
|
|
5530
5544
|
(0, import_react15.useEffect)(() => {
|
|
@@ -5532,51 +5546,73 @@ var many2manyFieldController = (props) => {
|
|
|
5532
5546
|
fetchData();
|
|
5533
5547
|
}
|
|
5534
5548
|
return () => {
|
|
5535
|
-
|
|
5549
|
+
appDispatch((0, import_store8.setGroupByDomain)(null));
|
|
5550
|
+
setFields((prevFields) => ({
|
|
5551
|
+
...prevFields,
|
|
5552
|
+
[`${aid}_${relation}_popupmany2many`]: null
|
|
5553
|
+
}));
|
|
5554
|
+
appDispatch((0, import_store8.setPage)(0));
|
|
5536
5555
|
setSelectedRowKeys4([]);
|
|
5537
5556
|
setDomainMany2Many(null);
|
|
5538
5557
|
setIsLoadedData(false);
|
|
5539
5558
|
};
|
|
5540
5559
|
}, [viewResponse]);
|
|
5541
|
-
const { rows, columns, typeTable
|
|
5560
|
+
const { rows, columns, typeTable } = tableController({
|
|
5542
5561
|
data: {
|
|
5543
|
-
fields: viewResponse?.views?.list?.fields,
|
|
5562
|
+
fields: fields?.[`${aid}_${relation}_popupmany2many`] || viewResponse?.views?.list?.fields,
|
|
5544
5563
|
records: dataResponse?.records ?? dataResponse?.groups,
|
|
5545
5564
|
dataModel: viewResponse?.models?.[String(relation)],
|
|
5546
|
-
context:
|
|
5565
|
+
context: { ...env.context, ...context },
|
|
5547
5566
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
5548
5567
|
}
|
|
5549
5568
|
});
|
|
5569
|
+
const dataFormView = {
|
|
5570
|
+
id: null,
|
|
5571
|
+
model: relation,
|
|
5572
|
+
context
|
|
5573
|
+
};
|
|
5574
|
+
const {
|
|
5575
|
+
refetch,
|
|
5576
|
+
data: dataFormViewResponse,
|
|
5577
|
+
isSuccess
|
|
5578
|
+
} = useGetFormView({
|
|
5579
|
+
data: dataFormView,
|
|
5580
|
+
queryKey: [`form-view-action-${relation}`],
|
|
5581
|
+
enabled: false
|
|
5582
|
+
});
|
|
5583
|
+
(0, import_react15.useEffect)(() => {
|
|
5584
|
+
if (isSuccess && dataFormViewResponse) {
|
|
5585
|
+
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5586
|
+
window.location.href = `/form/menu?model=${relation}`;
|
|
5587
|
+
}
|
|
5588
|
+
}, [isSuccess]);
|
|
5550
5589
|
(0, import_react15.useEffect)(() => {
|
|
5551
5590
|
if (domainMany2Many && !isLoadedData) {
|
|
5552
5591
|
setIsLoadedData(true);
|
|
5553
5592
|
}
|
|
5554
5593
|
}, [domainMany2Many]);
|
|
5555
5594
|
const handleCreateNewOnPage = async () => {
|
|
5595
|
+
try {
|
|
5596
|
+
refetch();
|
|
5597
|
+
} catch (error) {
|
|
5598
|
+
console.log(error);
|
|
5599
|
+
}
|
|
5556
5600
|
};
|
|
5557
5601
|
return {
|
|
5558
5602
|
handleCreateNewOnPage,
|
|
5559
5603
|
optionsObject,
|
|
5560
|
-
totalRows: dataResponse?.length ?? 0,
|
|
5561
5604
|
rows,
|
|
5562
5605
|
columns,
|
|
5563
|
-
onToggleColumnOptional,
|
|
5564
5606
|
typeTable,
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
isPlaceholderData
|
|
5568
|
-
setPage,
|
|
5569
|
-
page,
|
|
5570
|
-
domain: domainMany2Many,
|
|
5571
|
-
setDomain: setDomainMany2Many
|
|
5607
|
+
isDataLoading,
|
|
5608
|
+
isDataResponseFetched,
|
|
5609
|
+
isPlaceholderData
|
|
5572
5610
|
};
|
|
5573
5611
|
};
|
|
5574
5612
|
|
|
5575
5613
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5576
5614
|
var import_react16 = require("react");
|
|
5577
5615
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5578
|
-
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
5579
|
-
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5580
5616
|
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5581
5617
|
var many2manyTagsController = (props) => {
|
|
5582
5618
|
const {
|
|
@@ -5588,7 +5624,8 @@ var many2manyTagsController = (props) => {
|
|
|
5588
5624
|
placeholderNoOption
|
|
5589
5625
|
} = props;
|
|
5590
5626
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5591
|
-
const env = (0,
|
|
5627
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5628
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5592
5629
|
const addtionalFields = optionsFields ? (0, import_utils7.evalJSONContext)(optionsFields) : null;
|
|
5593
5630
|
const domainObject = (0, import_react16.useMemo)(
|
|
5594
5631
|
() => (0, import_utils7.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
@@ -5607,7 +5644,7 @@ var many2manyTagsController = (props) => {
|
|
|
5607
5644
|
enabled: true,
|
|
5608
5645
|
context: env.context
|
|
5609
5646
|
};
|
|
5610
|
-
const { data: dataOfSelection } = (
|
|
5647
|
+
const { data: dataOfSelection } = useGetSelection2({
|
|
5611
5648
|
data,
|
|
5612
5649
|
queryKey: [`data_${relation}`, domainObject]
|
|
5613
5650
|
});
|
|
@@ -5627,7 +5664,6 @@ var many2manyTagsController = (props) => {
|
|
|
5627
5664
|
options,
|
|
5628
5665
|
customNoOptionsMessage,
|
|
5629
5666
|
tranfer,
|
|
5630
|
-
dataOfSelection,
|
|
5631
5667
|
isUser
|
|
5632
5668
|
};
|
|
5633
5669
|
};
|
|
@@ -5636,7 +5672,7 @@ var many2manyTagsController = (props) => {
|
|
|
5636
5672
|
var import_react17 = require("react");
|
|
5637
5673
|
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5638
5674
|
var durationController = (props) => {
|
|
5639
|
-
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5675
|
+
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5640
5676
|
const specification = {
|
|
5641
5677
|
id: 0,
|
|
5642
5678
|
name: "",
|
|
@@ -5660,7 +5696,11 @@ var durationController = (props) => {
|
|
|
5660
5696
|
},
|
|
5661
5697
|
sort: ""
|
|
5662
5698
|
};
|
|
5663
|
-
const { data: dataResponse } = useGetListData3(
|
|
5699
|
+
const { data: dataResponse } = useGetListData3(
|
|
5700
|
+
listDataProps,
|
|
5701
|
+
queryKey,
|
|
5702
|
+
enabled
|
|
5703
|
+
);
|
|
5664
5704
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5665
5705
|
const handleClick = async (stage_id) => {
|
|
5666
5706
|
setDisabled(true);
|
|
@@ -5696,7 +5736,7 @@ var durationController = (props) => {
|
|
|
5696
5736
|
};
|
|
5697
5737
|
|
|
5698
5738
|
// src/widget/basic/priority-field/controller.ts
|
|
5699
|
-
var
|
|
5739
|
+
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5700
5740
|
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5701
5741
|
var priorityFieldController = (props) => {
|
|
5702
5742
|
const {
|
|
@@ -5716,7 +5756,7 @@ var priorityFieldController = (props) => {
|
|
|
5716
5756
|
const contextObject = { ...context, ..._context };
|
|
5717
5757
|
const defaultPriority = parseInt(value) + 1;
|
|
5718
5758
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
5719
|
-
const { mutateAsync: fetchSave } = (0,
|
|
5759
|
+
const { mutateAsync: fetchSave } = (0, import_hooks14.useSave)();
|
|
5720
5760
|
const savePriorities = async ({
|
|
5721
5761
|
value: value2,
|
|
5722
5762
|
resetPriority
|
|
@@ -6836,7 +6876,7 @@ var binaryFieldController = (props) => {
|
|
|
6836
6876
|
};
|
|
6837
6877
|
|
|
6838
6878
|
// src/widget/advance/table/table-body/controller.ts
|
|
6839
|
-
var
|
|
6879
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6840
6880
|
var import_react21 = require("react");
|
|
6841
6881
|
var tableBodyController = (props) => {
|
|
6842
6882
|
const {
|
|
@@ -6849,7 +6889,7 @@ var tableBodyController = (props) => {
|
|
|
6849
6889
|
selectedRowKeysRef,
|
|
6850
6890
|
onClickRow
|
|
6851
6891
|
} = props;
|
|
6852
|
-
const appDispatch = (0,
|
|
6892
|
+
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
6853
6893
|
const checked = (0, import_react21.useMemo)(() => {
|
|
6854
6894
|
if (!row?.id) return false;
|
|
6855
6895
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6866,7 +6906,7 @@ var tableBodyController = (props) => {
|
|
|
6866
6906
|
}
|
|
6867
6907
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6868
6908
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6869
|
-
appDispatch((0,
|
|
6909
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6870
6910
|
};
|
|
6871
6911
|
const handleClickRow = (col, row2) => {
|
|
6872
6912
|
onClickRow(col, row2);
|
|
@@ -6879,13 +6919,13 @@ var tableBodyController = (props) => {
|
|
|
6879
6919
|
(id) => id !== row.id
|
|
6880
6920
|
);
|
|
6881
6921
|
selectedRowKeysRef.current = filtered;
|
|
6882
|
-
appDispatch((0,
|
|
6922
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(filtered));
|
|
6883
6923
|
} else {
|
|
6884
6924
|
const unique = Array.from(
|
|
6885
6925
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6886
6926
|
);
|
|
6887
6927
|
selectedRowKeysRef.current = unique;
|
|
6888
|
-
appDispatch((0,
|
|
6928
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(unique));
|
|
6889
6929
|
}
|
|
6890
6930
|
}
|
|
6891
6931
|
}, [isAutoSelect]);
|
|
@@ -6903,35 +6943,35 @@ var tableBodyController = (props) => {
|
|
|
6903
6943
|
};
|
|
6904
6944
|
|
|
6905
6945
|
// src/widget/advance/table/table-head/controller.ts
|
|
6906
|
-
var
|
|
6946
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6907
6947
|
var tableHeadController = (props) => {
|
|
6908
6948
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6909
|
-
const appDispatch = (0,
|
|
6910
|
-
const { groupByDomain } = (0,
|
|
6949
|
+
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
6950
|
+
const { groupByDomain } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
6911
6951
|
const handleCheckBoxAll = (event) => {
|
|
6912
6952
|
if (event?.target?.checked && typeTable === "list") {
|
|
6913
6953
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6914
|
-
appDispatch((0,
|
|
6954
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(allRowKeys));
|
|
6915
6955
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6916
6956
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6917
6957
|
const ids = Array.from(rowsIDs)?.map(
|
|
6918
6958
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6919
6959
|
);
|
|
6920
6960
|
if (ids?.length > 0) {
|
|
6921
|
-
appDispatch((0,
|
|
6961
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(ids));
|
|
6922
6962
|
} else {
|
|
6923
6963
|
const sum = countSum(
|
|
6924
6964
|
rows,
|
|
6925
6965
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6926
6966
|
);
|
|
6927
6967
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6928
|
-
appDispatch((0,
|
|
6968
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(keys));
|
|
6929
6969
|
}
|
|
6930
6970
|
if (selectedRowKeysRef) {
|
|
6931
6971
|
selectedRowKeysRef.current = [];
|
|
6932
6972
|
}
|
|
6933
6973
|
} else {
|
|
6934
|
-
appDispatch((0,
|
|
6974
|
+
appDispatch((0, import_store10.setSelectedRowKeys)([]));
|
|
6935
6975
|
}
|
|
6936
6976
|
};
|
|
6937
6977
|
return {
|
|
@@ -6941,7 +6981,7 @@ var tableHeadController = (props) => {
|
|
|
6941
6981
|
|
|
6942
6982
|
// src/widget/advance/table/table-view/controller.ts
|
|
6943
6983
|
var import_react22 = require("react");
|
|
6944
|
-
var
|
|
6984
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
6945
6985
|
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6946
6986
|
var tableController = ({ data }) => {
|
|
6947
6987
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
@@ -7020,8 +7060,8 @@ var tableController = ({ data }) => {
|
|
|
7020
7060
|
|
|
7021
7061
|
// src/widget/advance/table/table-group/controller.ts
|
|
7022
7062
|
var import_react23 = require("react");
|
|
7023
|
-
var
|
|
7024
|
-
var
|
|
7063
|
+
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
7064
|
+
var import_store12 = require("@fctc/interface-logic/store");
|
|
7025
7065
|
|
|
7026
7066
|
// src/environment.ts
|
|
7027
7067
|
var environment_exports = {};
|
|
@@ -7049,10 +7089,10 @@ var tableGroupController = (props) => {
|
|
|
7049
7089
|
selectedRowKeysRef
|
|
7050
7090
|
} = props;
|
|
7051
7091
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
7052
|
-
const { groupByDomain, selectedTags } = (0,
|
|
7053
|
-
const { selectedRowKeys } = (0,
|
|
7054
|
-
const appDispatch = (0,
|
|
7055
|
-
const { toDataJS } = (0,
|
|
7092
|
+
const { groupByDomain, selectedTags } = (0, import_store12.useAppSelector)(import_store12.selectSearch);
|
|
7093
|
+
const { selectedRowKeys } = (0, import_store12.useAppSelector)(import_store12.selectList);
|
|
7094
|
+
const appDispatch = (0, import_store12.useAppDispatch)();
|
|
7095
|
+
const { toDataJS } = (0, import_hooks15.useOdooDataTransform)();
|
|
7056
7096
|
const initVal = toDataJS(row, viewData, model);
|
|
7057
7097
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7058
7098
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -7099,7 +7139,7 @@ var tableGroupController = (props) => {
|
|
|
7099
7139
|
isPlaceholderData,
|
|
7100
7140
|
isLoading,
|
|
7101
7141
|
isFetching
|
|
7102
|
-
} = (0,
|
|
7142
|
+
} = (0, import_hooks15.useGetListData)(listDataProps, queryKey, enabled);
|
|
7103
7143
|
const {
|
|
7104
7144
|
columns: columnsGroup,
|
|
7105
7145
|
rows: rowsGroup,
|
|
@@ -7137,14 +7177,14 @@ var tableGroupController = (props) => {
|
|
|
7137
7177
|
const filteredIds = selectedRowKeys.filter(
|
|
7138
7178
|
(id) => !ids.includes(id)
|
|
7139
7179
|
);
|
|
7140
|
-
appDispatch((0,
|
|
7180
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredIds));
|
|
7141
7181
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7142
7182
|
const clonedKeys = [...selectedRowKeys];
|
|
7143
|
-
appDispatch((0,
|
|
7144
|
-
setTimeout(() => appDispatch((0,
|
|
7183
|
+
appDispatch((0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
7184
|
+
setTimeout(() => appDispatch((0, import_store12.setSelectedRowKeys)(clonedKeys)), 500);
|
|
7145
7185
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7146
7186
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7147
|
-
appDispatch((0,
|
|
7187
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredKeys));
|
|
7148
7188
|
}
|
|
7149
7189
|
toggleShowGroup();
|
|
7150
7190
|
};
|
|
@@ -7153,8 +7193,8 @@ var tableGroupController = (props) => {
|
|
|
7153
7193
|
return;
|
|
7154
7194
|
}
|
|
7155
7195
|
const clonedKeys = [...selectedRowKeys];
|
|
7156
|
-
(0,
|
|
7157
|
-
setTimeout(() => (0,
|
|
7196
|
+
(0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
7197
|
+
setTimeout(() => (0, import_store12.setSelectedRowKeys)(clonedKeys), 500);
|
|
7158
7198
|
}, [isQueryFetched]);
|
|
7159
7199
|
return {
|
|
7160
7200
|
handleExpandChildGroup,
|