@fctc/widget-logic 1.10.2 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +152 -132
- package/dist/index.mjs +138 -122
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/widget.d.mts +42 -18
- package/dist/widget.d.ts +42 -18
- package/dist/widget.js +152 -132
- package/dist/widget.mjs +138 -122
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5246,6 +5246,7 @@ var many2oneFieldController = (props) => {
|
|
|
5246
5246
|
options: fieldOptions,
|
|
5247
5247
|
showDetail
|
|
5248
5248
|
} = props;
|
|
5249
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5249
5250
|
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
5250
5251
|
const [inputValue, setInputValue] = (0, import_react14.useState)("");
|
|
5251
5252
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
@@ -5255,15 +5256,14 @@ var many2oneFieldController = (props) => {
|
|
|
5255
5256
|
const [domainObject, setDomainObject] = (0, import_react14.useState)(null);
|
|
5256
5257
|
const actionData = sessionStorageUtils.getActionData();
|
|
5257
5258
|
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
|
-
...context
|
|
5264
|
+
...env?.context
|
|
5265
5265
|
};
|
|
5266
|
-
const { useGetSelection:
|
|
5266
|
+
const { useGetSelection: useGetSelection3 } = (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
|
+
} = useGetSelection3({
|
|
5283
5283
|
data,
|
|
5284
5284
|
queryKey,
|
|
5285
5285
|
enabled: false
|
|
@@ -5433,52 +5433,50 @@ 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");
|
|
5437
5436
|
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
5438
5437
|
var many2manyFieldController = (props) => {
|
|
5439
5438
|
const {
|
|
5440
5439
|
relation,
|
|
5441
5440
|
domain,
|
|
5442
5441
|
context,
|
|
5442
|
+
options,
|
|
5443
5443
|
tab,
|
|
5444
|
-
model,
|
|
5445
|
-
aid,
|
|
5446
5444
|
setSelectedRowKeys: setSelectedRowKeys4,
|
|
5447
|
-
fields,
|
|
5448
|
-
setFields,
|
|
5449
5445
|
groupByDomain,
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
sessionStorageUtils
|
|
5446
|
+
enabled: enabledCallAPI,
|
|
5447
|
+
actionData
|
|
5453
5448
|
} = props;
|
|
5454
|
-
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
5455
|
-
const actionData = sessionStorageUtils.getActionData();
|
|
5456
|
-
const [debouncedPage] = useDebounce(page, 500);
|
|
5457
|
-
const [order, setOrder] = (0, import_react15.useState)();
|
|
5458
|
-
const [isLoadedData, setIsLoadedData] = (0, import_react15.useState)(false);
|
|
5459
|
-
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(domain);
|
|
5460
5449
|
const { env } = (0, provider_exports.useEnv)();
|
|
5461
5450
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5451
|
+
const [order, setOrder] = (0, import_react15.useState)();
|
|
5452
|
+
const [isLoadedData, setIsLoadedData] = (0, import_react15.useState)(false);
|
|
5453
|
+
const [page, setPage] = (0, import_react15.useState)(0);
|
|
5454
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(null);
|
|
5455
|
+
const [debouncedPage] = useDebounce(page, 500);
|
|
5456
|
+
const contextObject = {
|
|
5457
|
+
...env.context,
|
|
5458
|
+
...context || {}
|
|
5459
|
+
};
|
|
5462
5460
|
const viewParams = {
|
|
5463
5461
|
model: relation,
|
|
5464
5462
|
views: [
|
|
5465
5463
|
[false, "list"],
|
|
5466
5464
|
[false, "search"]
|
|
5467
5465
|
],
|
|
5468
|
-
context
|
|
5466
|
+
context: contextObject
|
|
5469
5467
|
};
|
|
5470
|
-
const { data: viewResponse } = useGetView2(viewParams,
|
|
5468
|
+
const { data: viewResponse } = useGetView2(viewParams, enabledCallAPI);
|
|
5471
5469
|
const baseModel = (0, import_react15.useMemo)(
|
|
5472
5470
|
() => ({
|
|
5473
5471
|
name: String(relation),
|
|
5474
5472
|
view: viewResponse || {},
|
|
5475
|
-
actContext:
|
|
5473
|
+
actContext: contextObject,
|
|
5476
5474
|
fields: [
|
|
5477
5475
|
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5478
5476
|
...tab?.fields ? tab.fields : []
|
|
5479
5477
|
]
|
|
5480
5478
|
}),
|
|
5481
|
-
[
|
|
5479
|
+
[relation, viewResponse]
|
|
5482
5480
|
);
|
|
5483
5481
|
const initModel = (0, hooks_exports.useModel)();
|
|
5484
5482
|
const modelInstance = (0, import_react15.useMemo)(() => {
|
|
@@ -5497,26 +5495,15 @@ var many2manyFieldController = (props) => {
|
|
|
5497
5495
|
const optionsObject = tab?.options ? (0, import_utils6.evalJSONContext)(tab?.options) : (options ? (0, import_utils6.evalJSONContext)(options) : {}) || {};
|
|
5498
5496
|
const fetchData = async () => {
|
|
5499
5497
|
try {
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
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));
|
|
5498
|
+
const domainParse = typeof domain === "string" ? (0, import_utils6.evalJSONDomain)(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5499
|
+
setDomainMany2Many(domainParse);
|
|
5500
|
+
setPage(0);
|
|
5514
5501
|
} catch (err) {
|
|
5515
5502
|
console.log(err);
|
|
5516
5503
|
}
|
|
5517
5504
|
};
|
|
5518
5505
|
const queryKey = [
|
|
5519
|
-
`view-${relation}
|
|
5506
|
+
`view-${relation}`,
|
|
5520
5507
|
specification,
|
|
5521
5508
|
domainMany2Many,
|
|
5522
5509
|
debouncedPage,
|
|
@@ -5529,16 +5516,16 @@ var many2manyFieldController = (props) => {
|
|
|
5529
5516
|
domain: domainMany2Many,
|
|
5530
5517
|
offset: debouncedPage * 10,
|
|
5531
5518
|
limit: 10,
|
|
5532
|
-
context,
|
|
5519
|
+
context: contextObject,
|
|
5533
5520
|
fields: groupByDomain?.fields,
|
|
5534
5521
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5535
5522
|
sort: order ? order : default_order ? (0, import_utils6.formatSortingString)(default_order) : ""
|
|
5536
5523
|
};
|
|
5537
|
-
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5524
|
+
const enabled = enabledCallAPI && isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5538
5525
|
const {
|
|
5539
5526
|
data: dataResponse,
|
|
5540
|
-
isLoading
|
|
5541
|
-
isFetched
|
|
5527
|
+
isLoading,
|
|
5528
|
+
isFetched,
|
|
5542
5529
|
isPlaceholderData
|
|
5543
5530
|
} = useGetListData3(data, queryKey, enabled);
|
|
5544
5531
|
(0, import_react15.useEffect)(() => {
|
|
@@ -5546,73 +5533,86 @@ var many2manyFieldController = (props) => {
|
|
|
5546
5533
|
fetchData();
|
|
5547
5534
|
}
|
|
5548
5535
|
return () => {
|
|
5549
|
-
|
|
5550
|
-
setFields((prevFields) => ({
|
|
5551
|
-
...prevFields,
|
|
5552
|
-
[`${aid}_${relation}_popupmany2many`]: null
|
|
5553
|
-
}));
|
|
5554
|
-
appDispatch((0, import_store8.setPage)(0));
|
|
5536
|
+
setPage(0);
|
|
5555
5537
|
setSelectedRowKeys4([]);
|
|
5556
5538
|
setDomainMany2Many(null);
|
|
5557
5539
|
setIsLoadedData(false);
|
|
5558
5540
|
};
|
|
5559
5541
|
}, [viewResponse]);
|
|
5560
|
-
const { rows, columns, typeTable } = tableController({
|
|
5542
|
+
const { rows, columns, typeTable, onToggleColumnOptional } = tableController({
|
|
5561
5543
|
data: {
|
|
5562
|
-
fields:
|
|
5544
|
+
fields: viewResponse?.views?.list?.fields,
|
|
5563
5545
|
records: dataResponse?.records ?? dataResponse?.groups,
|
|
5564
5546
|
dataModel: viewResponse?.models?.[String(relation)],
|
|
5565
|
-
context:
|
|
5547
|
+
context: contextObject,
|
|
5566
5548
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
5567
5549
|
}
|
|
5568
5550
|
});
|
|
5569
|
-
const dataFormView = {
|
|
5570
|
-
id: null,
|
|
5571
|
-
model: relation,
|
|
5572
|
-
context
|
|
5573
|
-
};
|
|
5574
5551
|
const {
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5552
|
+
removeSearchItems,
|
|
5553
|
+
selectedTags,
|
|
5554
|
+
filterBy,
|
|
5555
|
+
setFilterBy,
|
|
5556
|
+
searchString,
|
|
5557
|
+
onSearchString,
|
|
5558
|
+
handleAddTagSearch,
|
|
5559
|
+
searchBy,
|
|
5560
|
+
groupBy,
|
|
5561
|
+
setGroupBy,
|
|
5562
|
+
domain: domainSearch
|
|
5563
|
+
} = searchController({
|
|
5564
|
+
viewData: viewResponse,
|
|
5565
|
+
actionData,
|
|
5566
|
+
fieldsList: [
|
|
5567
|
+
...columns?.filter(
|
|
5568
|
+
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
5569
|
+
)?.map((col) => ({ ...col.field })) ?? []
|
|
5570
|
+
]
|
|
5582
5571
|
});
|
|
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]);
|
|
5589
5572
|
(0, import_react15.useEffect)(() => {
|
|
5590
5573
|
if (domainMany2Many && !isLoadedData) {
|
|
5591
5574
|
setIsLoadedData(true);
|
|
5592
5575
|
}
|
|
5593
5576
|
}, [domainMany2Many]);
|
|
5577
|
+
(0, import_react15.useEffect)(() => {
|
|
5578
|
+
setDomainMany2Many(domainSearch);
|
|
5579
|
+
}, [domainSearch]);
|
|
5594
5580
|
const handleCreateNewOnPage = async () => {
|
|
5595
|
-
try {
|
|
5596
|
-
refetch();
|
|
5597
|
-
} catch (error) {
|
|
5598
|
-
console.log(error);
|
|
5599
|
-
}
|
|
5600
5581
|
};
|
|
5601
5582
|
return {
|
|
5602
5583
|
handleCreateNewOnPage,
|
|
5603
5584
|
optionsObject,
|
|
5585
|
+
totalRows: dataResponse?.length ?? 0,
|
|
5604
5586
|
rows,
|
|
5605
5587
|
columns,
|
|
5588
|
+
onToggleColumnOptional,
|
|
5606
5589
|
typeTable,
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
isPlaceholderData
|
|
5590
|
+
isLoading,
|
|
5591
|
+
isFetched,
|
|
5592
|
+
isPlaceholderData,
|
|
5593
|
+
setPage,
|
|
5594
|
+
page,
|
|
5595
|
+
viewData: viewResponse,
|
|
5596
|
+
domain: domainMany2Many,
|
|
5597
|
+
// search
|
|
5598
|
+
removeSearchItems,
|
|
5599
|
+
selectedTags,
|
|
5600
|
+
filterBy,
|
|
5601
|
+
setFilterBy,
|
|
5602
|
+
searchString,
|
|
5603
|
+
onSearchString,
|
|
5604
|
+
handleAddTagSearch,
|
|
5605
|
+
searchBy,
|
|
5606
|
+
groupBy,
|
|
5607
|
+
setGroupBy
|
|
5610
5608
|
};
|
|
5611
5609
|
};
|
|
5612
5610
|
|
|
5613
5611
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5614
5612
|
var import_react16 = require("react");
|
|
5615
5613
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5614
|
+
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
5615
|
+
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5616
5616
|
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5617
5617
|
var many2manyTagsController = (props) => {
|
|
5618
5618
|
const {
|
|
@@ -5624,8 +5624,7 @@ var many2manyTagsController = (props) => {
|
|
|
5624
5624
|
placeholderNoOption
|
|
5625
5625
|
} = props;
|
|
5626
5626
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5627
|
-
const
|
|
5628
|
-
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5627
|
+
const env = (0, import_environment7.getEnv)();
|
|
5629
5628
|
const addtionalFields = optionsFields ? (0, import_utils7.evalJSONContext)(optionsFields) : null;
|
|
5630
5629
|
const domainObject = (0, import_react16.useMemo)(
|
|
5631
5630
|
() => (0, import_utils7.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
@@ -5644,7 +5643,7 @@ var many2manyTagsController = (props) => {
|
|
|
5644
5643
|
enabled: true,
|
|
5645
5644
|
context: env.context
|
|
5646
5645
|
};
|
|
5647
|
-
const { data: dataOfSelection } =
|
|
5646
|
+
const { data: dataOfSelection } = (0, import_hooks14.useGetSelection)({
|
|
5648
5647
|
data,
|
|
5649
5648
|
queryKey: [`data_${relation}`, domainObject]
|
|
5650
5649
|
});
|
|
@@ -5664,6 +5663,7 @@ var many2manyTagsController = (props) => {
|
|
|
5664
5663
|
options,
|
|
5665
5664
|
customNoOptionsMessage,
|
|
5666
5665
|
tranfer,
|
|
5666
|
+
dataOfSelection,
|
|
5667
5667
|
isUser
|
|
5668
5668
|
};
|
|
5669
5669
|
};
|
|
@@ -5672,7 +5672,7 @@ var many2manyTagsController = (props) => {
|
|
|
5672
5672
|
var import_react17 = require("react");
|
|
5673
5673
|
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5674
5674
|
var durationController = (props) => {
|
|
5675
|
-
const { relation, domain, formValues, name, id, model, onRefetch
|
|
5675
|
+
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5676
5676
|
const specification = {
|
|
5677
5677
|
id: 0,
|
|
5678
5678
|
name: "",
|
|
@@ -5696,11 +5696,7 @@ var durationController = (props) => {
|
|
|
5696
5696
|
},
|
|
5697
5697
|
sort: ""
|
|
5698
5698
|
};
|
|
5699
|
-
const { data: dataResponse } = useGetListData3(
|
|
5700
|
-
listDataProps,
|
|
5701
|
-
queryKey,
|
|
5702
|
-
enabled
|
|
5703
|
-
);
|
|
5699
|
+
const { data: dataResponse } = useGetListData3(listDataProps, queryKey);
|
|
5704
5700
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5705
5701
|
const handleClick = async (stage_id) => {
|
|
5706
5702
|
setDisabled(true);
|
|
@@ -5736,18 +5732,32 @@ var durationController = (props) => {
|
|
|
5736
5732
|
};
|
|
5737
5733
|
|
|
5738
5734
|
// src/widget/basic/priority-field/controller.ts
|
|
5735
|
+
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
5739
5736
|
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5740
5737
|
var priorityFieldController = (props) => {
|
|
5741
|
-
const {
|
|
5738
|
+
const {
|
|
5739
|
+
value,
|
|
5740
|
+
isForm,
|
|
5741
|
+
name,
|
|
5742
|
+
methods,
|
|
5743
|
+
onChange,
|
|
5744
|
+
model,
|
|
5745
|
+
selection,
|
|
5746
|
+
id,
|
|
5747
|
+
actionData,
|
|
5748
|
+
viewData,
|
|
5749
|
+
context
|
|
5750
|
+
} = props;
|
|
5742
5751
|
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5743
5752
|
const contextObject = { ...context, ..._context };
|
|
5744
|
-
const
|
|
5745
|
-
const
|
|
5753
|
+
const defaultPriority = parseInt(value) + 1;
|
|
5754
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
5755
|
+
const { mutateAsync: fetchSave } = (0, import_hooks15.useSave)();
|
|
5746
5756
|
const savePriorities = async ({
|
|
5747
|
-
value,
|
|
5757
|
+
value: value2,
|
|
5748
5758
|
resetPriority
|
|
5749
5759
|
}) => {
|
|
5750
|
-
const priorityValue =
|
|
5760
|
+
const priorityValue = value2 <= 0 ? 0 : value2 - 1;
|
|
5751
5761
|
try {
|
|
5752
5762
|
fetchSave({
|
|
5753
5763
|
ids: id ? [id] : [],
|
|
@@ -5765,7 +5775,14 @@ var priorityFieldController = (props) => {
|
|
|
5765
5775
|
}
|
|
5766
5776
|
};
|
|
5767
5777
|
return {
|
|
5768
|
-
|
|
5778
|
+
selection,
|
|
5779
|
+
isForm,
|
|
5780
|
+
methods,
|
|
5781
|
+
defaultPriority,
|
|
5782
|
+
savePriorities,
|
|
5783
|
+
label,
|
|
5784
|
+
id,
|
|
5785
|
+
onChange
|
|
5769
5786
|
};
|
|
5770
5787
|
};
|
|
5771
5788
|
|
|
@@ -6728,11 +6745,11 @@ var import_utils11 = require("@fctc/interface-logic/utils");
|
|
|
6728
6745
|
var colorFieldController = (props) => {
|
|
6729
6746
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6730
6747
|
const { env } = (0, provider_exports.useEnv)();
|
|
6731
|
-
const { useSave:
|
|
6748
|
+
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
6732
6749
|
const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) || {} };
|
|
6733
6750
|
const contextObject = { ...env.context, ..._context };
|
|
6734
6751
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6735
|
-
const { mutate: onSave } =
|
|
6752
|
+
const { mutate: onSave } = useSave3();
|
|
6736
6753
|
const savePickColor = async (colorObject) => {
|
|
6737
6754
|
const { id } = colorObject;
|
|
6738
6755
|
if (value === id) return;
|
|
@@ -6855,7 +6872,7 @@ var binaryFieldController = (props) => {
|
|
|
6855
6872
|
};
|
|
6856
6873
|
|
|
6857
6874
|
// src/widget/advance/table/table-body/controller.ts
|
|
6858
|
-
var
|
|
6875
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
6859
6876
|
var import_react21 = require("react");
|
|
6860
6877
|
var tableBodyController = (props) => {
|
|
6861
6878
|
const {
|
|
@@ -6868,7 +6885,7 @@ var tableBodyController = (props) => {
|
|
|
6868
6885
|
selectedRowKeysRef,
|
|
6869
6886
|
onClickRow
|
|
6870
6887
|
} = props;
|
|
6871
|
-
const appDispatch = (0,
|
|
6888
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
6872
6889
|
const checked = (0, import_react21.useMemo)(() => {
|
|
6873
6890
|
if (!row?.id) return false;
|
|
6874
6891
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6885,7 +6902,7 @@ var tableBodyController = (props) => {
|
|
|
6885
6902
|
}
|
|
6886
6903
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6887
6904
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6888
|
-
appDispatch((0,
|
|
6905
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6889
6906
|
};
|
|
6890
6907
|
const handleClickRow = (col, row2) => {
|
|
6891
6908
|
onClickRow(col, row2);
|
|
@@ -6898,13 +6915,13 @@ var tableBodyController = (props) => {
|
|
|
6898
6915
|
(id) => id !== row.id
|
|
6899
6916
|
);
|
|
6900
6917
|
selectedRowKeysRef.current = filtered;
|
|
6901
|
-
appDispatch((0,
|
|
6918
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(filtered));
|
|
6902
6919
|
} else {
|
|
6903
6920
|
const unique = Array.from(
|
|
6904
6921
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6905
6922
|
);
|
|
6906
6923
|
selectedRowKeysRef.current = unique;
|
|
6907
|
-
appDispatch((0,
|
|
6924
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(unique));
|
|
6908
6925
|
}
|
|
6909
6926
|
}
|
|
6910
6927
|
}, [isAutoSelect]);
|
|
@@ -6922,35 +6939,35 @@ var tableBodyController = (props) => {
|
|
|
6922
6939
|
};
|
|
6923
6940
|
|
|
6924
6941
|
// src/widget/advance/table/table-head/controller.ts
|
|
6925
|
-
var
|
|
6942
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6926
6943
|
var tableHeadController = (props) => {
|
|
6927
6944
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6928
|
-
const appDispatch = (0,
|
|
6929
|
-
const { groupByDomain } = (0,
|
|
6945
|
+
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
6946
|
+
const { groupByDomain } = (0, import_store9.useAppSelector)(import_store9.selectSearch);
|
|
6930
6947
|
const handleCheckBoxAll = (event) => {
|
|
6931
6948
|
if (event?.target?.checked && typeTable === "list") {
|
|
6932
6949
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6933
|
-
appDispatch((0,
|
|
6950
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(allRowKeys));
|
|
6934
6951
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6935
6952
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6936
6953
|
const ids = Array.from(rowsIDs)?.map(
|
|
6937
6954
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6938
6955
|
);
|
|
6939
6956
|
if (ids?.length > 0) {
|
|
6940
|
-
appDispatch((0,
|
|
6957
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(ids));
|
|
6941
6958
|
} else {
|
|
6942
6959
|
const sum = countSum(
|
|
6943
6960
|
rows,
|
|
6944
6961
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6945
6962
|
);
|
|
6946
6963
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6947
|
-
appDispatch((0,
|
|
6964
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(keys));
|
|
6948
6965
|
}
|
|
6949
6966
|
if (selectedRowKeysRef) {
|
|
6950
6967
|
selectedRowKeysRef.current = [];
|
|
6951
6968
|
}
|
|
6952
6969
|
} else {
|
|
6953
|
-
appDispatch((0,
|
|
6970
|
+
appDispatch((0, import_store9.setSelectedRowKeys)([]));
|
|
6954
6971
|
}
|
|
6955
6972
|
};
|
|
6956
6973
|
return {
|
|
@@ -6960,7 +6977,7 @@ var tableHeadController = (props) => {
|
|
|
6960
6977
|
|
|
6961
6978
|
// src/widget/advance/table/table-view/controller.ts
|
|
6962
6979
|
var import_react22 = require("react");
|
|
6963
|
-
var
|
|
6980
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6964
6981
|
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6965
6982
|
var tableController = ({ data }) => {
|
|
6966
6983
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
@@ -7039,8 +7056,8 @@ var tableController = ({ data }) => {
|
|
|
7039
7056
|
|
|
7040
7057
|
// src/widget/advance/table/table-group/controller.ts
|
|
7041
7058
|
var import_react23 = require("react");
|
|
7042
|
-
var
|
|
7043
|
-
var
|
|
7059
|
+
var import_hooks16 = require("@fctc/interface-logic/hooks");
|
|
7060
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
7044
7061
|
|
|
7045
7062
|
// src/environment.ts
|
|
7046
7063
|
var environment_exports = {};
|
|
@@ -7068,10 +7085,10 @@ var tableGroupController = (props) => {
|
|
|
7068
7085
|
selectedRowKeysRef
|
|
7069
7086
|
} = props;
|
|
7070
7087
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
7071
|
-
const { groupByDomain, selectedTags } = (0,
|
|
7072
|
-
const { selectedRowKeys } = (0,
|
|
7073
|
-
const appDispatch = (0,
|
|
7074
|
-
const { toDataJS } = (0,
|
|
7088
|
+
const { groupByDomain, selectedTags } = (0, import_store11.useAppSelector)(import_store11.selectSearch);
|
|
7089
|
+
const { selectedRowKeys } = (0, import_store11.useAppSelector)(import_store11.selectList);
|
|
7090
|
+
const appDispatch = (0, import_store11.useAppDispatch)();
|
|
7091
|
+
const { toDataJS } = (0, import_hooks16.useOdooDataTransform)();
|
|
7075
7092
|
const initVal = toDataJS(row, viewData, model);
|
|
7076
7093
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7077
7094
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -7118,7 +7135,7 @@ var tableGroupController = (props) => {
|
|
|
7118
7135
|
isPlaceholderData,
|
|
7119
7136
|
isLoading,
|
|
7120
7137
|
isFetching
|
|
7121
|
-
} = (0,
|
|
7138
|
+
} = (0, import_hooks16.useGetListData)(listDataProps, queryKey, enabled);
|
|
7122
7139
|
const {
|
|
7123
7140
|
columns: columnsGroup,
|
|
7124
7141
|
rows: rowsGroup,
|
|
@@ -7156,14 +7173,14 @@ var tableGroupController = (props) => {
|
|
|
7156
7173
|
const filteredIds = selectedRowKeys.filter(
|
|
7157
7174
|
(id) => !ids.includes(id)
|
|
7158
7175
|
);
|
|
7159
|
-
appDispatch((0,
|
|
7176
|
+
appDispatch((0, import_store11.setSelectedRowKeys)(filteredIds));
|
|
7160
7177
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7161
7178
|
const clonedKeys = [...selectedRowKeys];
|
|
7162
|
-
appDispatch((0,
|
|
7163
|
-
setTimeout(() => appDispatch((0,
|
|
7179
|
+
appDispatch((0, import_store11.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
7180
|
+
setTimeout(() => appDispatch((0, import_store11.setSelectedRowKeys)(clonedKeys)), 500);
|
|
7164
7181
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7165
7182
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7166
|
-
appDispatch((0,
|
|
7183
|
+
appDispatch((0, import_store11.setSelectedRowKeys)(filteredKeys));
|
|
7167
7184
|
}
|
|
7168
7185
|
toggleShowGroup();
|
|
7169
7186
|
};
|
|
@@ -7172,8 +7189,8 @@ var tableGroupController = (props) => {
|
|
|
7172
7189
|
return;
|
|
7173
7190
|
}
|
|
7174
7191
|
const clonedKeys = [...selectedRowKeys];
|
|
7175
|
-
(0,
|
|
7176
|
-
setTimeout(() => (0,
|
|
7192
|
+
(0, import_store11.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
7193
|
+
setTimeout(() => (0, import_store11.setSelectedRowKeys)(clonedKeys), 500);
|
|
7177
7194
|
}, [isQueryFetched]);
|
|
7178
7195
|
return {
|
|
7179
7196
|
handleExpandChildGroup,
|
|
@@ -7214,16 +7231,18 @@ var import_react24 = require("react");
|
|
|
7214
7231
|
var searchController = ({
|
|
7215
7232
|
viewData,
|
|
7216
7233
|
actionData,
|
|
7217
|
-
fieldsList
|
|
7218
|
-
contextSearch,
|
|
7219
|
-
setSearchMap,
|
|
7220
|
-
searchMap
|
|
7234
|
+
fieldsList
|
|
7221
7235
|
}) => {
|
|
7236
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
7222
7237
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
7223
7238
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
7224
7239
|
const [groupBy, setGroupBy] = (0, import_react24.useState)(null);
|
|
7225
7240
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7226
7241
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7242
|
+
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
7243
|
+
const { context } = actionData || {};
|
|
7244
|
+
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
7245
|
+
const contextSearch = { ...env.context, ...actionContext };
|
|
7227
7246
|
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils14.evalJSONDomain)(actionData?.domain, contextSearch) : [];
|
|
7228
7247
|
const aid = actionData?.id;
|
|
7229
7248
|
const model = actionData?.res_model;
|
|
@@ -7381,16 +7400,16 @@ var searchController = ({
|
|
|
7381
7400
|
const contexts = [];
|
|
7382
7401
|
let groupValues = [];
|
|
7383
7402
|
objValues?.forEach((objValue) => {
|
|
7384
|
-
const { context, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7403
|
+
const { context: context2, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7385
7404
|
const indexAppend = groupIndex2 != null ? groupIndex2 : viewData?.views?.search?.filters_by?.length ?? 0;
|
|
7386
7405
|
contexts.push(
|
|
7387
|
-
...Array.isArray(
|
|
7406
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({ group_by: item })) : [context2]
|
|
7388
7407
|
);
|
|
7389
7408
|
groupValues[indexAppend] = {
|
|
7390
7409
|
contexts: [
|
|
7391
|
-
...Array.isArray(
|
|
7410
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({
|
|
7392
7411
|
group_by: item
|
|
7393
|
-
})) : [
|
|
7412
|
+
})) : [context2]
|
|
7394
7413
|
],
|
|
7395
7414
|
strings: isDefault ? [value] : [...groupValues[indexAppend]?.strings ?? [], value]
|
|
7396
7415
|
};
|
|
@@ -7427,7 +7446,7 @@ var searchController = ({
|
|
|
7427
7446
|
value,
|
|
7428
7447
|
type,
|
|
7429
7448
|
title,
|
|
7430
|
-
context,
|
|
7449
|
+
context: context2,
|
|
7431
7450
|
active,
|
|
7432
7451
|
dataIndex
|
|
7433
7452
|
} = tag;
|
|
@@ -7435,13 +7454,13 @@ var searchController = ({
|
|
|
7435
7454
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7436
7455
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7437
7456
|
...tag,
|
|
7438
|
-
domain: domain ? domainFormat.toList(
|
|
7457
|
+
domain: domain ? domainFormat.toList(context2) : null
|
|
7439
7458
|
});
|
|
7440
7459
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7441
7460
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7442
7461
|
...tag,
|
|
7443
7462
|
domain: domain ? domainFormat.toList({
|
|
7444
|
-
...
|
|
7463
|
+
...context2,
|
|
7445
7464
|
self: value
|
|
7446
7465
|
}) : null
|
|
7447
7466
|
});
|
|
@@ -7449,7 +7468,7 @@ var searchController = ({
|
|
|
7449
7468
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7450
7469
|
...tag,
|
|
7451
7470
|
domain: domain ? domainFormat.toList({
|
|
7452
|
-
context,
|
|
7471
|
+
context: context2,
|
|
7453
7472
|
self: value
|
|
7454
7473
|
}) : null
|
|
7455
7474
|
});
|
|
@@ -7469,7 +7488,8 @@ var searchController = ({
|
|
|
7469
7488
|
removeSearchItems,
|
|
7470
7489
|
onSearchString: onChangeSearchInput,
|
|
7471
7490
|
handleAddTagSearch,
|
|
7472
|
-
domain: formatDomain()
|
|
7491
|
+
domain: formatDomain(),
|
|
7492
|
+
context: contextSearch
|
|
7473
7493
|
};
|
|
7474
7494
|
};
|
|
7475
7495
|
|