@fctc/widget-logic 2.0.7 → 2.0.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 +159 -149
- package/dist/index.mjs +161 -142
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/widget.d.mts +19 -58
- package/dist/widget.d.ts +19 -58
- package/dist/widget.js +159 -149
- package/dist/widget.mjs +161 -142
- 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
|
-
|
|
5447
|
-
|
|
5450
|
+
page,
|
|
5451
|
+
options,
|
|
5452
|
+
sessionStorageUtils
|
|
5448
5453
|
} = 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);
|
|
5449
5460
|
const { env } = (0, provider_exports.useEnv)();
|
|
5450
5461
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5451
|
-
const [order, setOrder] = (0, import_react15.useState)();
|
|
5452
|
-
const [page, setPage] = (0, import_react15.useState)(0);
|
|
5453
|
-
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(null);
|
|
5454
|
-
const [debouncedPage] = useDebounce(page, 500);
|
|
5455
|
-
const contextObject = {
|
|
5456
|
-
...env.context,
|
|
5457
|
-
...context || {}
|
|
5458
|
-
};
|
|
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,58 +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);
|
|
5557
|
+
setIsLoadedData(false);
|
|
5538
5558
|
};
|
|
5539
5559
|
}, [viewResponse]);
|
|
5540
|
-
const { rows, columns, typeTable
|
|
5560
|
+
const { rows, columns, typeTable } = tableController({
|
|
5541
5561
|
data: {
|
|
5542
|
-
fields: viewResponse?.views?.list?.fields,
|
|
5562
|
+
fields: fields?.[`${aid}_${relation}_popupmany2many`] || viewResponse?.views?.list?.fields,
|
|
5543
5563
|
records: dataResponse?.records ?? dataResponse?.groups,
|
|
5544
5564
|
dataModel: viewResponse?.models?.[String(relation)],
|
|
5545
|
-
context:
|
|
5565
|
+
context: { ...env.context, ...context },
|
|
5546
5566
|
typeTable: dataResponse?.groups ? "group" : "list"
|
|
5547
5567
|
}
|
|
5548
5568
|
});
|
|
5549
|
-
const
|
|
5550
|
-
|
|
5551
|
-
model: relation
|
|
5552
|
-
context
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
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
|
|
5559
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]);
|
|
5589
|
+
(0, import_react15.useEffect)(() => {
|
|
5590
|
+
if (domainMany2Many && !isLoadedData) {
|
|
5591
|
+
setIsLoadedData(true);
|
|
5592
|
+
}
|
|
5593
|
+
}, [domainMany2Many]);
|
|
5560
5594
|
const handleCreateNewOnPage = async () => {
|
|
5595
|
+
try {
|
|
5596
|
+
refetch();
|
|
5597
|
+
} catch (error) {
|
|
5598
|
+
console.log(error);
|
|
5599
|
+
}
|
|
5561
5600
|
};
|
|
5562
5601
|
return {
|
|
5563
5602
|
handleCreateNewOnPage,
|
|
5564
5603
|
optionsObject,
|
|
5565
|
-
totalRows: dataResponse?.length ?? 0,
|
|
5566
5604
|
rows,
|
|
5567
5605
|
columns,
|
|
5568
|
-
onToggleColumnOptional,
|
|
5569
5606
|
typeTable,
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
isPlaceholderData
|
|
5573
|
-
setPage,
|
|
5574
|
-
page,
|
|
5575
|
-
viewData: viewResponse,
|
|
5576
|
-
domain: domainMany2Many,
|
|
5577
|
-
setDomain: setDomainMany2Many,
|
|
5578
|
-
searchController: searchControllers
|
|
5607
|
+
isDataLoading,
|
|
5608
|
+
isDataResponseFetched,
|
|
5609
|
+
isPlaceholderData
|
|
5579
5610
|
};
|
|
5580
5611
|
};
|
|
5581
5612
|
|
|
5582
5613
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5583
5614
|
var import_react16 = require("react");
|
|
5584
5615
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5585
|
-
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
5586
|
-
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5587
5616
|
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5588
5617
|
var many2manyTagsController = (props) => {
|
|
5589
5618
|
const {
|
|
@@ -5595,7 +5624,8 @@ var many2manyTagsController = (props) => {
|
|
|
5595
5624
|
placeholderNoOption
|
|
5596
5625
|
} = props;
|
|
5597
5626
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5598
|
-
const env = (0,
|
|
5627
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5628
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5599
5629
|
const addtionalFields = optionsFields ? (0, import_utils7.evalJSONContext)(optionsFields) : null;
|
|
5600
5630
|
const domainObject = (0, import_react16.useMemo)(
|
|
5601
5631
|
() => (0, import_utils7.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
@@ -5614,7 +5644,7 @@ var many2manyTagsController = (props) => {
|
|
|
5614
5644
|
enabled: true,
|
|
5615
5645
|
context: env.context
|
|
5616
5646
|
};
|
|
5617
|
-
const { data: dataOfSelection } = (
|
|
5647
|
+
const { data: dataOfSelection } = useGetSelection2({
|
|
5618
5648
|
data,
|
|
5619
5649
|
queryKey: [`data_${relation}`, domainObject]
|
|
5620
5650
|
});
|
|
@@ -5634,7 +5664,6 @@ var many2manyTagsController = (props) => {
|
|
|
5634
5664
|
options,
|
|
5635
5665
|
customNoOptionsMessage,
|
|
5636
5666
|
tranfer,
|
|
5637
|
-
dataOfSelection,
|
|
5638
5667
|
isUser
|
|
5639
5668
|
};
|
|
5640
5669
|
};
|
|
@@ -5643,7 +5672,7 @@ var many2manyTagsController = (props) => {
|
|
|
5643
5672
|
var import_react17 = require("react");
|
|
5644
5673
|
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5645
5674
|
var durationController = (props) => {
|
|
5646
|
-
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5675
|
+
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5647
5676
|
const specification = {
|
|
5648
5677
|
id: 0,
|
|
5649
5678
|
name: "",
|
|
@@ -5667,7 +5696,11 @@ var durationController = (props) => {
|
|
|
5667
5696
|
},
|
|
5668
5697
|
sort: ""
|
|
5669
5698
|
};
|
|
5670
|
-
const { data: dataResponse } = useGetListData3(
|
|
5699
|
+
const { data: dataResponse } = useGetListData3(
|
|
5700
|
+
listDataProps,
|
|
5701
|
+
queryKey,
|
|
5702
|
+
enabled
|
|
5703
|
+
);
|
|
5671
5704
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5672
5705
|
const handleClick = async (stage_id) => {
|
|
5673
5706
|
setDisabled(true);
|
|
@@ -5703,32 +5736,18 @@ var durationController = (props) => {
|
|
|
5703
5736
|
};
|
|
5704
5737
|
|
|
5705
5738
|
// src/widget/basic/priority-field/controller.ts
|
|
5706
|
-
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
5707
5739
|
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5708
5740
|
var priorityFieldController = (props) => {
|
|
5709
|
-
const {
|
|
5710
|
-
value,
|
|
5711
|
-
isForm,
|
|
5712
|
-
name,
|
|
5713
|
-
methods,
|
|
5714
|
-
onChange,
|
|
5715
|
-
model,
|
|
5716
|
-
selection,
|
|
5717
|
-
id,
|
|
5718
|
-
actionData,
|
|
5719
|
-
viewData,
|
|
5720
|
-
context
|
|
5721
|
-
} = props;
|
|
5741
|
+
const { name, model, id, actionData, context, onChange } = props;
|
|
5722
5742
|
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5723
5743
|
const contextObject = { ...context, ..._context };
|
|
5724
|
-
const
|
|
5725
|
-
const
|
|
5726
|
-
const { mutateAsync: fetchSave } = (0, import_hooks15.useSave)();
|
|
5744
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
5745
|
+
const { mutateAsync: fetchSave } = useSave2();
|
|
5727
5746
|
const savePriorities = async ({
|
|
5728
|
-
value
|
|
5747
|
+
value,
|
|
5729
5748
|
resetPriority
|
|
5730
5749
|
}) => {
|
|
5731
|
-
const priorityValue =
|
|
5750
|
+
const priorityValue = value <= 0 ? 0 : value - 1;
|
|
5732
5751
|
try {
|
|
5733
5752
|
fetchSave({
|
|
5734
5753
|
ids: id ? [id] : [],
|
|
@@ -5746,14 +5765,7 @@ var priorityFieldController = (props) => {
|
|
|
5746
5765
|
}
|
|
5747
5766
|
};
|
|
5748
5767
|
return {
|
|
5749
|
-
|
|
5750
|
-
isForm,
|
|
5751
|
-
methods,
|
|
5752
|
-
defaultPriority,
|
|
5753
|
-
savePriorities,
|
|
5754
|
-
label,
|
|
5755
|
-
id,
|
|
5756
|
-
onChange
|
|
5768
|
+
savePriorities
|
|
5757
5769
|
};
|
|
5758
5770
|
};
|
|
5759
5771
|
|
|
@@ -6716,11 +6728,11 @@ var import_utils11 = require("@fctc/interface-logic/utils");
|
|
|
6716
6728
|
var colorFieldController = (props) => {
|
|
6717
6729
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6718
6730
|
const { env } = (0, provider_exports.useEnv)();
|
|
6719
|
-
const { useSave:
|
|
6731
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
6720
6732
|
const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) || {} };
|
|
6721
6733
|
const contextObject = { ...env.context, ..._context };
|
|
6722
6734
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6723
|
-
const { mutate: onSave } =
|
|
6735
|
+
const { mutate: onSave } = useSave2();
|
|
6724
6736
|
const savePickColor = async (colorObject) => {
|
|
6725
6737
|
const { id } = colorObject;
|
|
6726
6738
|
if (value === id) return;
|
|
@@ -6843,20 +6855,20 @@ var binaryFieldController = (props) => {
|
|
|
6843
6855
|
};
|
|
6844
6856
|
|
|
6845
6857
|
// src/widget/advance/table/table-body/controller.ts
|
|
6846
|
-
var
|
|
6858
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6847
6859
|
var import_react21 = require("react");
|
|
6848
6860
|
var tableBodyController = (props) => {
|
|
6849
6861
|
const {
|
|
6850
6862
|
checkedAll,
|
|
6851
6863
|
checkboxRef,
|
|
6852
6864
|
setIsAutoSelect,
|
|
6853
|
-
selectedRowKeys,
|
|
6854
6865
|
row,
|
|
6855
6866
|
isAutoSelect,
|
|
6856
6867
|
selectedRowKeysRef,
|
|
6857
6868
|
onClickRow
|
|
6858
6869
|
} = props;
|
|
6859
|
-
const appDispatch = (0,
|
|
6870
|
+
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
6871
|
+
const { selectedRowKeys } = (0, import_store9.useAppSelector)(import_store9.selectList);
|
|
6860
6872
|
const checked = (0, import_react21.useMemo)(() => {
|
|
6861
6873
|
if (!row?.id) return false;
|
|
6862
6874
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6872,8 +6884,7 @@ var tableBodyController = (props) => {
|
|
|
6872
6884
|
return;
|
|
6873
6885
|
}
|
|
6874
6886
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6875
|
-
|
|
6876
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6887
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6877
6888
|
};
|
|
6878
6889
|
const handleClickRow = (col, row2) => {
|
|
6879
6890
|
onClickRow(col, row2);
|
|
@@ -6886,13 +6897,13 @@ var tableBodyController = (props) => {
|
|
|
6886
6897
|
(id) => id !== row.id
|
|
6887
6898
|
);
|
|
6888
6899
|
selectedRowKeysRef.current = filtered;
|
|
6889
|
-
appDispatch((0,
|
|
6900
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(filtered));
|
|
6890
6901
|
} else {
|
|
6891
6902
|
const unique = Array.from(
|
|
6892
6903
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6893
6904
|
);
|
|
6894
6905
|
selectedRowKeysRef.current = unique;
|
|
6895
|
-
appDispatch((0,
|
|
6906
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(unique));
|
|
6896
6907
|
}
|
|
6897
6908
|
}
|
|
6898
6909
|
}, [isAutoSelect]);
|
|
@@ -6910,35 +6921,35 @@ var tableBodyController = (props) => {
|
|
|
6910
6921
|
};
|
|
6911
6922
|
|
|
6912
6923
|
// src/widget/advance/table/table-head/controller.ts
|
|
6913
|
-
var
|
|
6924
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6914
6925
|
var tableHeadController = (props) => {
|
|
6915
6926
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6916
|
-
const appDispatch = (0,
|
|
6917
|
-
const { groupByDomain } = (0,
|
|
6927
|
+
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
6928
|
+
const { groupByDomain } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
6918
6929
|
const handleCheckBoxAll = (event) => {
|
|
6919
6930
|
if (event?.target?.checked && typeTable === "list") {
|
|
6920
6931
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6921
|
-
appDispatch((0,
|
|
6932
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(allRowKeys));
|
|
6922
6933
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6923
6934
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6924
6935
|
const ids = Array.from(rowsIDs)?.map(
|
|
6925
6936
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6926
6937
|
);
|
|
6927
6938
|
if (ids?.length > 0) {
|
|
6928
|
-
appDispatch((0,
|
|
6939
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(ids));
|
|
6929
6940
|
} else {
|
|
6930
6941
|
const sum = countSum(
|
|
6931
6942
|
rows,
|
|
6932
6943
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6933
6944
|
);
|
|
6934
6945
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6935
|
-
appDispatch((0,
|
|
6946
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(keys));
|
|
6936
6947
|
}
|
|
6937
6948
|
if (selectedRowKeysRef) {
|
|
6938
6949
|
selectedRowKeysRef.current = [];
|
|
6939
6950
|
}
|
|
6940
6951
|
} else {
|
|
6941
|
-
appDispatch((0,
|
|
6952
|
+
appDispatch((0, import_store10.setSelectedRowKeys)([]));
|
|
6942
6953
|
}
|
|
6943
6954
|
};
|
|
6944
6955
|
return {
|
|
@@ -6948,7 +6959,7 @@ var tableHeadController = (props) => {
|
|
|
6948
6959
|
|
|
6949
6960
|
// src/widget/advance/table/table-view/controller.ts
|
|
6950
6961
|
var import_react22 = require("react");
|
|
6951
|
-
var
|
|
6962
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
6952
6963
|
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6953
6964
|
var tableController = ({ data }) => {
|
|
6954
6965
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
@@ -7027,8 +7038,8 @@ var tableController = ({ data }) => {
|
|
|
7027
7038
|
|
|
7028
7039
|
// src/widget/advance/table/table-group/controller.ts
|
|
7029
7040
|
var import_react23 = require("react");
|
|
7030
|
-
var
|
|
7031
|
-
var
|
|
7041
|
+
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
7042
|
+
var import_store12 = require("@fctc/interface-logic/store");
|
|
7032
7043
|
|
|
7033
7044
|
// src/environment.ts
|
|
7034
7045
|
var environment_exports = {};
|
|
@@ -7056,10 +7067,10 @@ var tableGroupController = (props) => {
|
|
|
7056
7067
|
selectedRowKeysRef
|
|
7057
7068
|
} = props;
|
|
7058
7069
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
7059
|
-
const { groupByDomain, selectedTags } = (0,
|
|
7060
|
-
const { selectedRowKeys } = (0,
|
|
7061
|
-
const appDispatch = (0,
|
|
7062
|
-
const { toDataJS } = (0,
|
|
7070
|
+
const { groupByDomain, selectedTags } = (0, import_store12.useAppSelector)(import_store12.selectSearch);
|
|
7071
|
+
const { selectedRowKeys } = (0, import_store12.useAppSelector)(import_store12.selectList);
|
|
7072
|
+
const appDispatch = (0, import_store12.useAppDispatch)();
|
|
7073
|
+
const { toDataJS } = (0, import_hooks14.useOdooDataTransform)();
|
|
7063
7074
|
const initVal = toDataJS(row, viewData, model);
|
|
7064
7075
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7065
7076
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -7106,7 +7117,7 @@ var tableGroupController = (props) => {
|
|
|
7106
7117
|
isPlaceholderData,
|
|
7107
7118
|
isLoading,
|
|
7108
7119
|
isFetching
|
|
7109
|
-
} = (0,
|
|
7120
|
+
} = (0, import_hooks14.useGetListData)(listDataProps, queryKey, enabled);
|
|
7110
7121
|
const {
|
|
7111
7122
|
columns: columnsGroup,
|
|
7112
7123
|
rows: rowsGroup,
|
|
@@ -7144,14 +7155,14 @@ var tableGroupController = (props) => {
|
|
|
7144
7155
|
const filteredIds = selectedRowKeys.filter(
|
|
7145
7156
|
(id) => !ids.includes(id)
|
|
7146
7157
|
);
|
|
7147
|
-
appDispatch((0,
|
|
7158
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredIds));
|
|
7148
7159
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7149
7160
|
const clonedKeys = [...selectedRowKeys];
|
|
7150
|
-
appDispatch((0,
|
|
7151
|
-
setTimeout(() => appDispatch((0,
|
|
7161
|
+
appDispatch((0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
7162
|
+
setTimeout(() => appDispatch((0, import_store12.setSelectedRowKeys)(clonedKeys)), 500);
|
|
7152
7163
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7153
7164
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7154
|
-
appDispatch((0,
|
|
7165
|
+
appDispatch((0, import_store12.setSelectedRowKeys)(filteredKeys));
|
|
7155
7166
|
}
|
|
7156
7167
|
toggleShowGroup();
|
|
7157
7168
|
};
|
|
@@ -7160,8 +7171,8 @@ var tableGroupController = (props) => {
|
|
|
7160
7171
|
return;
|
|
7161
7172
|
}
|
|
7162
7173
|
const clonedKeys = [...selectedRowKeys];
|
|
7163
|
-
(0,
|
|
7164
|
-
setTimeout(() => (0,
|
|
7174
|
+
(0, import_store12.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
7175
|
+
setTimeout(() => (0, import_store12.setSelectedRowKeys)(clonedKeys), 500);
|
|
7165
7176
|
}, [isQueryFetched]);
|
|
7166
7177
|
return {
|
|
7167
7178
|
handleExpandChildGroup,
|
|
@@ -7201,21 +7212,20 @@ var import_moment2 = __toESM(require_moment());
|
|
|
7201
7212
|
var import_react24 = require("react");
|
|
7202
7213
|
var searchController = ({
|
|
7203
7214
|
viewData,
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7215
|
+
actionData,
|
|
7216
|
+
fieldsList,
|
|
7217
|
+
contextSearch,
|
|
7218
|
+
setSearchMap,
|
|
7219
|
+
searchMap
|
|
7208
7220
|
}) => {
|
|
7209
|
-
const { env } = (0, provider_exports.useEnv)();
|
|
7210
7221
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
7211
7222
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
7212
7223
|
const [groupBy, setGroupBy] = (0, import_react24.useState)(null);
|
|
7213
7224
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7214
7225
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7215
|
-
const [
|
|
7216
|
-
const
|
|
7217
|
-
const
|
|
7218
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
7226
|
+
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils14.evalJSONDomain)(actionData?.domain, contextSearch) : [];
|
|
7227
|
+
const aid = actionData?.id;
|
|
7228
|
+
const model = actionData?.res_model;
|
|
7219
7229
|
const clearSearch = () => {
|
|
7220
7230
|
setFilterBy([]);
|
|
7221
7231
|
setGroupBy([]);
|
|
@@ -7260,8 +7270,9 @@ var searchController = ({
|
|
|
7260
7270
|
}
|
|
7261
7271
|
};
|
|
7262
7272
|
(0, import_react24.useEffect)(() => {
|
|
7273
|
+
clearSearch();
|
|
7263
7274
|
fetchData();
|
|
7264
|
-
}, [model, viewData]);
|
|
7275
|
+
}, [aid, model, viewData]);
|
|
7265
7276
|
const onChangeSearchInput = (search_string) => {
|
|
7266
7277
|
setSearchString(search_string);
|
|
7267
7278
|
};
|
|
@@ -7298,28 +7309,27 @@ var searchController = ({
|
|
|
7298
7309
|
};
|
|
7299
7310
|
const formatDomain = () => {
|
|
7300
7311
|
if (domainAction) {
|
|
7301
|
-
|
|
7302
|
-
const domain2 = [];
|
|
7312
|
+
const domain = [];
|
|
7303
7313
|
if (domainAction?.length > 0) {
|
|
7304
7314
|
if (Object.keys(searchMap).length > 0) {
|
|
7305
|
-
|
|
7315
|
+
domain.push("&");
|
|
7306
7316
|
}
|
|
7307
7317
|
domainAction.forEach((domainItem) => {
|
|
7308
|
-
|
|
7318
|
+
domain.push(domainItem);
|
|
7309
7319
|
});
|
|
7310
7320
|
}
|
|
7311
7321
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7312
7322
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7313
7323
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7314
|
-
|
|
7324
|
+
domain.push("&");
|
|
7315
7325
|
}
|
|
7316
7326
|
const valuesOfKey = searchMap[key];
|
|
7317
7327
|
valuesOfKey.forEach((value, index) => {
|
|
7318
7328
|
if (index < valuesOfKey.length - 1) {
|
|
7319
|
-
|
|
7329
|
+
domain.push("|");
|
|
7320
7330
|
}
|
|
7321
7331
|
if (value.domain) {
|
|
7322
|
-
|
|
7332
|
+
domain.push(...value.domain);
|
|
7323
7333
|
return;
|
|
7324
7334
|
}
|
|
7325
7335
|
let valueDomainItem = value?.value;
|
|
@@ -7335,11 +7345,11 @@ var searchController = ({
|
|
|
7335
7345
|
}
|
|
7336
7346
|
}
|
|
7337
7347
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7338
|
-
|
|
7348
|
+
domain.push([value.name, operator, valueDomainItem]);
|
|
7339
7349
|
});
|
|
7340
7350
|
}
|
|
7341
7351
|
});
|
|
7342
|
-
return [...
|
|
7352
|
+
return [...domain];
|
|
7343
7353
|
}
|
|
7344
7354
|
};
|
|
7345
7355
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7370,16 +7380,16 @@ var searchController = ({
|
|
|
7370
7380
|
const contexts = [];
|
|
7371
7381
|
let groupValues = [];
|
|
7372
7382
|
objValues?.forEach((objValue) => {
|
|
7373
|
-
const { context
|
|
7383
|
+
const { context, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7374
7384
|
const indexAppend = groupIndex2 != null ? groupIndex2 : viewData?.views?.search?.filters_by?.length ?? 0;
|
|
7375
7385
|
contexts.push(
|
|
7376
|
-
...Array.isArray(
|
|
7386
|
+
...Array.isArray(context?.group_by) ? context.group_by.map((item) => ({ group_by: item })) : [context]
|
|
7377
7387
|
);
|
|
7378
7388
|
groupValues[indexAppend] = {
|
|
7379
7389
|
contexts: [
|
|
7380
|
-
...Array.isArray(
|
|
7390
|
+
...Array.isArray(context?.group_by) ? context.group_by.map((item) => ({
|
|
7381
7391
|
group_by: item
|
|
7382
|
-
})) : [
|
|
7392
|
+
})) : [context]
|
|
7383
7393
|
],
|
|
7384
7394
|
strings: isDefault ? [value] : [...groupValues[indexAppend]?.strings ?? [], value]
|
|
7385
7395
|
};
|
|
@@ -7406,38 +7416,39 @@ var searchController = ({
|
|
|
7406
7416
|
[searchMap]
|
|
7407
7417
|
);
|
|
7408
7418
|
(0, import_react24.useEffect)(() => {
|
|
7419
|
+
setSelectedTags(null);
|
|
7409
7420
|
setTagSearch(searchMap);
|
|
7410
7421
|
}, [searchMap]);
|
|
7411
7422
|
const handleAddTagSearch = (tag) => {
|
|
7412
7423
|
const {
|
|
7413
|
-
domain
|
|
7424
|
+
domain,
|
|
7414
7425
|
groupIndex,
|
|
7415
7426
|
value,
|
|
7416
7427
|
type,
|
|
7417
7428
|
title,
|
|
7418
|
-
context
|
|
7429
|
+
context,
|
|
7419
7430
|
active,
|
|
7420
7431
|
dataIndex
|
|
7421
7432
|
} = tag;
|
|
7422
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7433
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain);
|
|
7423
7434
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7424
7435
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7425
7436
|
...tag,
|
|
7426
|
-
domain:
|
|
7437
|
+
domain: domain ? domainFormat.toList(context) : null
|
|
7427
7438
|
});
|
|
7428
7439
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7429
7440
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7430
7441
|
...tag,
|
|
7431
|
-
domain:
|
|
7432
|
-
...
|
|
7442
|
+
domain: domain ? domainFormat.toList({
|
|
7443
|
+
...context,
|
|
7433
7444
|
self: value
|
|
7434
7445
|
}) : null
|
|
7435
7446
|
});
|
|
7436
7447
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7437
7448
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7438
7449
|
...tag,
|
|
7439
|
-
domain:
|
|
7440
|
-
context
|
|
7450
|
+
domain: domain ? domainFormat.toList({
|
|
7451
|
+
context,
|
|
7441
7452
|
self: value
|
|
7442
7453
|
}) : null
|
|
7443
7454
|
});
|
|
@@ -7457,8 +7468,7 @@ var searchController = ({
|
|
|
7457
7468
|
removeSearchItems,
|
|
7458
7469
|
onSearchString: onChangeSearchInput,
|
|
7459
7470
|
handleAddTagSearch,
|
|
7460
|
-
domain: formatDomain()
|
|
7461
|
-
context: contextSearch
|
|
7471
|
+
domain: formatDomain()
|
|
7462
7472
|
};
|
|
7463
7473
|
};
|
|
7464
7474
|
|