@fctc/widget-logic 1.9.7 → 1.9.9
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 +119 -100
- package/dist/index.mjs +108 -84
- package/dist/types.d.mts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/widget.d.mts +9 -20
- package/dist/widget.d.ts +9 -20
- package/dist/widget.js +119 -100
- package/dist/widget.mjs +108 -84
- 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,32 +5736,18 @@ 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
|
-
const {
|
|
5703
|
-
value,
|
|
5704
|
-
isForm,
|
|
5705
|
-
name,
|
|
5706
|
-
methods,
|
|
5707
|
-
onChange,
|
|
5708
|
-
model,
|
|
5709
|
-
selection,
|
|
5710
|
-
id,
|
|
5711
|
-
actionData,
|
|
5712
|
-
viewData,
|
|
5713
|
-
context
|
|
5714
|
-
} = props;
|
|
5742
|
+
const { name, model, id, actionData, context, onChange } = props;
|
|
5715
5743
|
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5716
5744
|
const contextObject = { ...context, ..._context };
|
|
5717
|
-
const
|
|
5718
|
-
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
5719
|
-
const { mutateAsync: fetchSave } = (0, import_hooks15.useSave)();
|
|
5745
|
+
const { mutateAsync: fetchSave } = (0, import_hooks14.useSave)();
|
|
5720
5746
|
const savePriorities = async ({
|
|
5721
|
-
value
|
|
5747
|
+
value,
|
|
5722
5748
|
resetPriority
|
|
5723
5749
|
}) => {
|
|
5724
|
-
const priorityValue =
|
|
5750
|
+
const priorityValue = value <= 0 ? 0 : value - 1;
|
|
5725
5751
|
try {
|
|
5726
5752
|
fetchSave({
|
|
5727
5753
|
ids: id ? [id] : [],
|
|
@@ -5739,14 +5765,7 @@ var priorityFieldController = (props) => {
|
|
|
5739
5765
|
}
|
|
5740
5766
|
};
|
|
5741
5767
|
return {
|
|
5742
|
-
|
|
5743
|
-
isForm,
|
|
5744
|
-
methods,
|
|
5745
|
-
defaultPriority,
|
|
5746
|
-
savePriorities,
|
|
5747
|
-
label,
|
|
5748
|
-
id,
|
|
5749
|
-
onChange
|
|
5768
|
+
savePriorities
|
|
5750
5769
|
};
|
|
5751
5770
|
};
|
|
5752
5771
|
|
|
@@ -6836,7 +6855,7 @@ var binaryFieldController = (props) => {
|
|
|
6836
6855
|
};
|
|
6837
6856
|
|
|
6838
6857
|
// src/widget/advance/table/table-body/controller.ts
|
|
6839
|
-
var
|
|
6858
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6840
6859
|
var import_react21 = require("react");
|
|
6841
6860
|
var tableBodyController = (props) => {
|
|
6842
6861
|
const {
|
|
@@ -6849,7 +6868,7 @@ var tableBodyController = (props) => {
|
|
|
6849
6868
|
selectedRowKeysRef,
|
|
6850
6869
|
onClickRow
|
|
6851
6870
|
} = props;
|
|
6852
|
-
const appDispatch = (0,
|
|
6871
|
+
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
6853
6872
|
const checked = (0, import_react21.useMemo)(() => {
|
|
6854
6873
|
if (!row?.id) return false;
|
|
6855
6874
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6866,7 +6885,7 @@ var tableBodyController = (props) => {
|
|
|
6866
6885
|
}
|
|
6867
6886
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6868
6887
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6869
|
-
appDispatch((0,
|
|
6888
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6870
6889
|
};
|
|
6871
6890
|
const handleClickRow = (col, row2) => {
|
|
6872
6891
|
onClickRow(col, row2);
|
|
@@ -6879,13 +6898,13 @@ var tableBodyController = (props) => {
|
|
|
6879
6898
|
(id) => id !== row.id
|
|
6880
6899
|
);
|
|
6881
6900
|
selectedRowKeysRef.current = filtered;
|
|
6882
|
-
appDispatch((0,
|
|
6901
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(filtered));
|
|
6883
6902
|
} else {
|
|
6884
6903
|
const unique = Array.from(
|
|
6885
6904
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6886
6905
|
);
|
|
6887
6906
|
selectedRowKeysRef.current = unique;
|
|
6888
|
-
appDispatch((0,
|
|
6907
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(unique));
|
|
6889
6908
|
}
|
|
6890
6909
|
}
|
|
6891
6910
|
}, [isAutoSelect]);
|
|
@@ -6903,35 +6922,35 @@ var tableBodyController = (props) => {
|
|
|
6903
6922
|
};
|
|
6904
6923
|
|
|
6905
6924
|
// src/widget/advance/table/table-head/controller.ts
|
|
6906
|
-
var
|
|
6925
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6907
6926
|
var tableHeadController = (props) => {
|
|
6908
6927
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6909
|
-
const appDispatch = (0,
|
|
6910
|
-
const { groupByDomain } = (0,
|
|
6928
|
+
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
6929
|
+
const { groupByDomain } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
6911
6930
|
const handleCheckBoxAll = (event) => {
|
|
6912
6931
|
if (event?.target?.checked && typeTable === "list") {
|
|
6913
6932
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6914
|
-
appDispatch((0,
|
|
6933
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(allRowKeys));
|
|
6915
6934
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6916
6935
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6917
6936
|
const ids = Array.from(rowsIDs)?.map(
|
|
6918
6937
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6919
6938
|
);
|
|
6920
6939
|
if (ids?.length > 0) {
|
|
6921
|
-
appDispatch((0,
|
|
6940
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(ids));
|
|
6922
6941
|
} else {
|
|
6923
6942
|
const sum = countSum(
|
|
6924
6943
|
rows,
|
|
6925
6944
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6926
6945
|
);
|
|
6927
6946
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6928
|
-
appDispatch((0,
|
|
6947
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(keys));
|
|
6929
6948
|
}
|
|
6930
6949
|
if (selectedRowKeysRef) {
|
|
6931
6950
|
selectedRowKeysRef.current = [];
|
|
6932
6951
|
}
|
|
6933
6952
|
} else {
|
|
6934
|
-
appDispatch((0,
|
|
6953
|
+
appDispatch((0, import_store10.setSelectedRowKeys)([]));
|
|
6935
6954
|
}
|
|
6936
6955
|
};
|
|
6937
6956
|
return {
|
|
@@ -6941,7 +6960,7 @@ var tableHeadController = (props) => {
|
|
|
6941
6960
|
|
|
6942
6961
|
// src/widget/advance/table/table-view/controller.ts
|
|
6943
6962
|
var import_react22 = require("react");
|
|
6944
|
-
var
|
|
6963
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
6945
6964
|
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6946
6965
|
var tableController = ({ data }) => {
|
|
6947
6966
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
@@ -7020,8 +7039,8 @@ var tableController = ({ data }) => {
|
|
|
7020
7039
|
|
|
7021
7040
|
// src/widget/advance/table/table-group/controller.ts
|
|
7022
7041
|
var import_react23 = require("react");
|
|
7023
|
-
var
|
|
7024
|
-
var
|
|
7042
|
+
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
7043
|
+
var import_store12 = require("@fctc/interface-logic/store");
|
|
7025
7044
|
|
|
7026
7045
|
// src/environment.ts
|
|
7027
7046
|
var environment_exports = {};
|
|
@@ -7049,10 +7068,10 @@ var tableGroupController = (props) => {
|
|
|
7049
7068
|
selectedRowKeysRef
|
|
7050
7069
|
} = props;
|
|
7051
7070
|
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,
|
|
7071
|
+
const { groupByDomain, selectedTags } = (0, import_store12.useAppSelector)(import_store12.selectSearch);
|
|
7072
|
+
const { selectedRowKeys } = (0, import_store12.useAppSelector)(import_store12.selectList);
|
|
7073
|
+
const appDispatch = (0, import_store12.useAppDispatch)();
|
|
7074
|
+
const { toDataJS } = (0, import_hooks15.useOdooDataTransform)();
|
|
7056
7075
|
const initVal = toDataJS(row, viewData, model);
|
|
7057
7076
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7058
7077
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -7099,7 +7118,7 @@ var tableGroupController = (props) => {
|
|
|
7099
7118
|
isPlaceholderData,
|
|
7100
7119
|
isLoading,
|
|
7101
7120
|
isFetching
|
|
7102
|
-
} = (0,
|
|
7121
|
+
} = (0, import_hooks15.useGetListData)(listDataProps, queryKey, enabled);
|
|
7103
7122
|
const {
|
|
7104
7123
|
columns: columnsGroup,
|
|
7105
7124
|
rows: rowsGroup,
|
|
@@ -7137,14 +7156,14 @@ var tableGroupController = (props) => {
|
|
|
7137
7156
|
const filteredIds = selectedRowKeys.filter(
|
|
7138
7157
|
(id) => !ids.includes(id)
|
|
7139
7158
|
);
|
|
7140
|
-
appDispatch((0,
|
|
7159
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredIds));
|
|
7141
7160
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7142
7161
|
const clonedKeys = [...selectedRowKeys];
|
|
7143
|
-
appDispatch((0,
|
|
7144
|
-
setTimeout(() => appDispatch((0,
|
|
7162
|
+
appDispatch((0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
7163
|
+
setTimeout(() => appDispatch((0, import_store12.setSelectedRowKeys)(clonedKeys)), 500);
|
|
7145
7164
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7146
7165
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7147
|
-
appDispatch((0,
|
|
7166
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredKeys));
|
|
7148
7167
|
}
|
|
7149
7168
|
toggleShowGroup();
|
|
7150
7169
|
};
|
|
@@ -7153,8 +7172,8 @@ var tableGroupController = (props) => {
|
|
|
7153
7172
|
return;
|
|
7154
7173
|
}
|
|
7155
7174
|
const clonedKeys = [...selectedRowKeys];
|
|
7156
|
-
(0,
|
|
7157
|
-
setTimeout(() => (0,
|
|
7175
|
+
(0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
7176
|
+
setTimeout(() => (0, import_store12.setSelectedRowKeys)(clonedKeys), 500);
|
|
7158
7177
|
}, [isQueryFetched]);
|
|
7159
7178
|
return {
|
|
7160
7179
|
handleExpandChildGroup,
|