@fctc/widget-logic 1.10.2 → 1.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +129 -133
- package/dist/index.mjs +115 -123
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/widget.d.mts +50 -18
- package/dist/widget.d.ts +50 -18
- package/dist/widget.js +129 -133
- package/dist/widget.mjs +115 -123
- 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,62 @@ 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
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
isSuccess
|
|
5578
|
-
} = useGetFormView({
|
|
5579
|
-
data: dataFormView,
|
|
5580
|
-
queryKey: [`form-view-action-${relation}`],
|
|
5581
|
-
enabled: false
|
|
5551
|
+
const searchControllers = searchController({
|
|
5552
|
+
viewData: viewResponse,
|
|
5553
|
+
actionData,
|
|
5554
|
+
fieldsList: [
|
|
5555
|
+
...columns?.filter(
|
|
5556
|
+
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
5557
|
+
)?.map((col) => ({ ...col.field })) ?? []
|
|
5558
|
+
]
|
|
5582
5559
|
});
|
|
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
5560
|
(0, import_react15.useEffect)(() => {
|
|
5590
5561
|
if (domainMany2Many && !isLoadedData) {
|
|
5591
5562
|
setIsLoadedData(true);
|
|
5592
5563
|
}
|
|
5593
5564
|
}, [domainMany2Many]);
|
|
5594
5565
|
const handleCreateNewOnPage = async () => {
|
|
5595
|
-
try {
|
|
5596
|
-
refetch();
|
|
5597
|
-
} catch (error) {
|
|
5598
|
-
console.log(error);
|
|
5599
|
-
}
|
|
5600
5566
|
};
|
|
5601
5567
|
return {
|
|
5602
5568
|
handleCreateNewOnPage,
|
|
5603
5569
|
optionsObject,
|
|
5570
|
+
totalRows: dataResponse?.length ?? 0,
|
|
5604
5571
|
rows,
|
|
5605
5572
|
columns,
|
|
5573
|
+
onToggleColumnOptional,
|
|
5606
5574
|
typeTable,
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
isPlaceholderData
|
|
5575
|
+
isLoading,
|
|
5576
|
+
isFetched,
|
|
5577
|
+
isPlaceholderData,
|
|
5578
|
+
setPage,
|
|
5579
|
+
page,
|
|
5580
|
+
viewData: viewResponse,
|
|
5581
|
+
domain: domainMany2Many,
|
|
5582
|
+
setDomain: setDomainMany2Many,
|
|
5583
|
+
searchController: searchControllers
|
|
5610
5584
|
};
|
|
5611
5585
|
};
|
|
5612
5586
|
|
|
5613
5587
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5614
5588
|
var import_react16 = require("react");
|
|
5615
5589
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5590
|
+
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
5591
|
+
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5616
5592
|
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5617
5593
|
var many2manyTagsController = (props) => {
|
|
5618
5594
|
const {
|
|
@@ -5624,8 +5600,7 @@ var many2manyTagsController = (props) => {
|
|
|
5624
5600
|
placeholderNoOption
|
|
5625
5601
|
} = props;
|
|
5626
5602
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5627
|
-
const
|
|
5628
|
-
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5603
|
+
const env = (0, import_environment7.getEnv)();
|
|
5629
5604
|
const addtionalFields = optionsFields ? (0, import_utils7.evalJSONContext)(optionsFields) : null;
|
|
5630
5605
|
const domainObject = (0, import_react16.useMemo)(
|
|
5631
5606
|
() => (0, import_utils7.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
@@ -5644,7 +5619,7 @@ var many2manyTagsController = (props) => {
|
|
|
5644
5619
|
enabled: true,
|
|
5645
5620
|
context: env.context
|
|
5646
5621
|
};
|
|
5647
|
-
const { data: dataOfSelection } =
|
|
5622
|
+
const { data: dataOfSelection } = (0, import_hooks14.useGetSelection)({
|
|
5648
5623
|
data,
|
|
5649
5624
|
queryKey: [`data_${relation}`, domainObject]
|
|
5650
5625
|
});
|
|
@@ -5664,6 +5639,7 @@ var many2manyTagsController = (props) => {
|
|
|
5664
5639
|
options,
|
|
5665
5640
|
customNoOptionsMessage,
|
|
5666
5641
|
tranfer,
|
|
5642
|
+
dataOfSelection,
|
|
5667
5643
|
isUser
|
|
5668
5644
|
};
|
|
5669
5645
|
};
|
|
@@ -5672,7 +5648,7 @@ var many2manyTagsController = (props) => {
|
|
|
5672
5648
|
var import_react17 = require("react");
|
|
5673
5649
|
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5674
5650
|
var durationController = (props) => {
|
|
5675
|
-
const { relation, domain, formValues, name, id, model, onRefetch
|
|
5651
|
+
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5676
5652
|
const specification = {
|
|
5677
5653
|
id: 0,
|
|
5678
5654
|
name: "",
|
|
@@ -5696,11 +5672,7 @@ var durationController = (props) => {
|
|
|
5696
5672
|
},
|
|
5697
5673
|
sort: ""
|
|
5698
5674
|
};
|
|
5699
|
-
const { data: dataResponse } = useGetListData3(
|
|
5700
|
-
listDataProps,
|
|
5701
|
-
queryKey,
|
|
5702
|
-
enabled
|
|
5703
|
-
);
|
|
5675
|
+
const { data: dataResponse } = useGetListData3(listDataProps, queryKey);
|
|
5704
5676
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5705
5677
|
const handleClick = async (stage_id) => {
|
|
5706
5678
|
setDisabled(true);
|
|
@@ -5736,18 +5708,32 @@ var durationController = (props) => {
|
|
|
5736
5708
|
};
|
|
5737
5709
|
|
|
5738
5710
|
// src/widget/basic/priority-field/controller.ts
|
|
5711
|
+
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
5739
5712
|
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5740
5713
|
var priorityFieldController = (props) => {
|
|
5741
|
-
const {
|
|
5714
|
+
const {
|
|
5715
|
+
value,
|
|
5716
|
+
isForm,
|
|
5717
|
+
name,
|
|
5718
|
+
methods,
|
|
5719
|
+
onChange,
|
|
5720
|
+
model,
|
|
5721
|
+
selection,
|
|
5722
|
+
id,
|
|
5723
|
+
actionData,
|
|
5724
|
+
viewData,
|
|
5725
|
+
context
|
|
5726
|
+
} = props;
|
|
5742
5727
|
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5743
5728
|
const contextObject = { ...context, ..._context };
|
|
5744
|
-
const
|
|
5745
|
-
const
|
|
5729
|
+
const defaultPriority = parseInt(value) + 1;
|
|
5730
|
+
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
5731
|
+
const { mutateAsync: fetchSave } = (0, import_hooks15.useSave)();
|
|
5746
5732
|
const savePriorities = async ({
|
|
5747
|
-
value,
|
|
5733
|
+
value: value2,
|
|
5748
5734
|
resetPriority
|
|
5749
5735
|
}) => {
|
|
5750
|
-
const priorityValue =
|
|
5736
|
+
const priorityValue = value2 <= 0 ? 0 : value2 - 1;
|
|
5751
5737
|
try {
|
|
5752
5738
|
fetchSave({
|
|
5753
5739
|
ids: id ? [id] : [],
|
|
@@ -5765,7 +5751,14 @@ var priorityFieldController = (props) => {
|
|
|
5765
5751
|
}
|
|
5766
5752
|
};
|
|
5767
5753
|
return {
|
|
5768
|
-
|
|
5754
|
+
selection,
|
|
5755
|
+
isForm,
|
|
5756
|
+
methods,
|
|
5757
|
+
defaultPriority,
|
|
5758
|
+
savePriorities,
|
|
5759
|
+
label,
|
|
5760
|
+
id,
|
|
5761
|
+
onChange
|
|
5769
5762
|
};
|
|
5770
5763
|
};
|
|
5771
5764
|
|
|
@@ -6728,11 +6721,11 @@ var import_utils11 = require("@fctc/interface-logic/utils");
|
|
|
6728
6721
|
var colorFieldController = (props) => {
|
|
6729
6722
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6730
6723
|
const { env } = (0, provider_exports.useEnv)();
|
|
6731
|
-
const { useSave:
|
|
6724
|
+
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
6732
6725
|
const _context = { ...(0, import_utils11.evalJSONContext)(actionData?.context) || {} };
|
|
6733
6726
|
const contextObject = { ...env.context, ..._context };
|
|
6734
6727
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6735
|
-
const { mutate: onSave } =
|
|
6728
|
+
const { mutate: onSave } = useSave3();
|
|
6736
6729
|
const savePickColor = async (colorObject) => {
|
|
6737
6730
|
const { id } = colorObject;
|
|
6738
6731
|
if (value === id) return;
|
|
@@ -6855,7 +6848,7 @@ var binaryFieldController = (props) => {
|
|
|
6855
6848
|
};
|
|
6856
6849
|
|
|
6857
6850
|
// src/widget/advance/table/table-body/controller.ts
|
|
6858
|
-
var
|
|
6851
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
6859
6852
|
var import_react21 = require("react");
|
|
6860
6853
|
var tableBodyController = (props) => {
|
|
6861
6854
|
const {
|
|
@@ -6868,7 +6861,7 @@ var tableBodyController = (props) => {
|
|
|
6868
6861
|
selectedRowKeysRef,
|
|
6869
6862
|
onClickRow
|
|
6870
6863
|
} = props;
|
|
6871
|
-
const appDispatch = (0,
|
|
6864
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
6872
6865
|
const checked = (0, import_react21.useMemo)(() => {
|
|
6873
6866
|
if (!row?.id) return false;
|
|
6874
6867
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -6885,7 +6878,7 @@ var tableBodyController = (props) => {
|
|
|
6885
6878
|
}
|
|
6886
6879
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6887
6880
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6888
|
-
appDispatch((0,
|
|
6881
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6889
6882
|
};
|
|
6890
6883
|
const handleClickRow = (col, row2) => {
|
|
6891
6884
|
onClickRow(col, row2);
|
|
@@ -6898,13 +6891,13 @@ var tableBodyController = (props) => {
|
|
|
6898
6891
|
(id) => id !== row.id
|
|
6899
6892
|
);
|
|
6900
6893
|
selectedRowKeysRef.current = filtered;
|
|
6901
|
-
appDispatch((0,
|
|
6894
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(filtered));
|
|
6902
6895
|
} else {
|
|
6903
6896
|
const unique = Array.from(
|
|
6904
6897
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6905
6898
|
);
|
|
6906
6899
|
selectedRowKeysRef.current = unique;
|
|
6907
|
-
appDispatch((0,
|
|
6900
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(unique));
|
|
6908
6901
|
}
|
|
6909
6902
|
}
|
|
6910
6903
|
}, [isAutoSelect]);
|
|
@@ -6922,35 +6915,35 @@ var tableBodyController = (props) => {
|
|
|
6922
6915
|
};
|
|
6923
6916
|
|
|
6924
6917
|
// src/widget/advance/table/table-head/controller.ts
|
|
6925
|
-
var
|
|
6918
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6926
6919
|
var tableHeadController = (props) => {
|
|
6927
6920
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6928
|
-
const appDispatch = (0,
|
|
6929
|
-
const { groupByDomain } = (0,
|
|
6921
|
+
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
6922
|
+
const { groupByDomain } = (0, import_store9.useAppSelector)(import_store9.selectSearch);
|
|
6930
6923
|
const handleCheckBoxAll = (event) => {
|
|
6931
6924
|
if (event?.target?.checked && typeTable === "list") {
|
|
6932
6925
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6933
|
-
appDispatch((0,
|
|
6926
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(allRowKeys));
|
|
6934
6927
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6935
6928
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6936
6929
|
const ids = Array.from(rowsIDs)?.map(
|
|
6937
6930
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6938
6931
|
);
|
|
6939
6932
|
if (ids?.length > 0) {
|
|
6940
|
-
appDispatch((0,
|
|
6933
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(ids));
|
|
6941
6934
|
} else {
|
|
6942
6935
|
const sum = countSum(
|
|
6943
6936
|
rows,
|
|
6944
6937
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6945
6938
|
);
|
|
6946
6939
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6947
|
-
appDispatch((0,
|
|
6940
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(keys));
|
|
6948
6941
|
}
|
|
6949
6942
|
if (selectedRowKeysRef) {
|
|
6950
6943
|
selectedRowKeysRef.current = [];
|
|
6951
6944
|
}
|
|
6952
6945
|
} else {
|
|
6953
|
-
appDispatch((0,
|
|
6946
|
+
appDispatch((0, import_store9.setSelectedRowKeys)([]));
|
|
6954
6947
|
}
|
|
6955
6948
|
};
|
|
6956
6949
|
return {
|
|
@@ -6960,7 +6953,7 @@ var tableHeadController = (props) => {
|
|
|
6960
6953
|
|
|
6961
6954
|
// src/widget/advance/table/table-view/controller.ts
|
|
6962
6955
|
var import_react22 = require("react");
|
|
6963
|
-
var
|
|
6956
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6964
6957
|
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6965
6958
|
var tableController = ({ data }) => {
|
|
6966
6959
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
@@ -7039,8 +7032,8 @@ var tableController = ({ data }) => {
|
|
|
7039
7032
|
|
|
7040
7033
|
// src/widget/advance/table/table-group/controller.ts
|
|
7041
7034
|
var import_react23 = require("react");
|
|
7042
|
-
var
|
|
7043
|
-
var
|
|
7035
|
+
var import_hooks16 = require("@fctc/interface-logic/hooks");
|
|
7036
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
7044
7037
|
|
|
7045
7038
|
// src/environment.ts
|
|
7046
7039
|
var environment_exports = {};
|
|
@@ -7068,10 +7061,10 @@ var tableGroupController = (props) => {
|
|
|
7068
7061
|
selectedRowKeysRef
|
|
7069
7062
|
} = props;
|
|
7070
7063
|
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,
|
|
7064
|
+
const { groupByDomain, selectedTags } = (0, import_store11.useAppSelector)(import_store11.selectSearch);
|
|
7065
|
+
const { selectedRowKeys } = (0, import_store11.useAppSelector)(import_store11.selectList);
|
|
7066
|
+
const appDispatch = (0, import_store11.useAppDispatch)();
|
|
7067
|
+
const { toDataJS } = (0, import_hooks16.useOdooDataTransform)();
|
|
7075
7068
|
const initVal = toDataJS(row, viewData, model);
|
|
7076
7069
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
7077
7070
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -7118,7 +7111,7 @@ var tableGroupController = (props) => {
|
|
|
7118
7111
|
isPlaceholderData,
|
|
7119
7112
|
isLoading,
|
|
7120
7113
|
isFetching
|
|
7121
|
-
} = (0,
|
|
7114
|
+
} = (0, import_hooks16.useGetListData)(listDataProps, queryKey, enabled);
|
|
7122
7115
|
const {
|
|
7123
7116
|
columns: columnsGroup,
|
|
7124
7117
|
rows: rowsGroup,
|
|
@@ -7156,14 +7149,14 @@ var tableGroupController = (props) => {
|
|
|
7156
7149
|
const filteredIds = selectedRowKeys.filter(
|
|
7157
7150
|
(id) => !ids.includes(id)
|
|
7158
7151
|
);
|
|
7159
|
-
appDispatch((0,
|
|
7152
|
+
appDispatch((0, import_store11.setSelectedRowKeys)(filteredIds));
|
|
7160
7153
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
7161
7154
|
const clonedKeys = [...selectedRowKeys];
|
|
7162
|
-
appDispatch((0,
|
|
7163
|
-
setTimeout(() => appDispatch((0,
|
|
7155
|
+
appDispatch((0, import_store11.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
7156
|
+
setTimeout(() => appDispatch((0, import_store11.setSelectedRowKeys)(clonedKeys)), 500);
|
|
7164
7157
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7165
7158
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7166
|
-
appDispatch((0,
|
|
7159
|
+
appDispatch((0, import_store11.setSelectedRowKeys)(filteredKeys));
|
|
7167
7160
|
}
|
|
7168
7161
|
toggleShowGroup();
|
|
7169
7162
|
};
|
|
@@ -7172,8 +7165,8 @@ var tableGroupController = (props) => {
|
|
|
7172
7165
|
return;
|
|
7173
7166
|
}
|
|
7174
7167
|
const clonedKeys = [...selectedRowKeys];
|
|
7175
|
-
(0,
|
|
7176
|
-
setTimeout(() => (0,
|
|
7168
|
+
(0, import_store11.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
7169
|
+
setTimeout(() => (0, import_store11.setSelectedRowKeys)(clonedKeys), 500);
|
|
7177
7170
|
}, [isQueryFetched]);
|
|
7178
7171
|
return {
|
|
7179
7172
|
handleExpandChildGroup,
|
|
@@ -7214,16 +7207,18 @@ var import_react24 = require("react");
|
|
|
7214
7207
|
var searchController = ({
|
|
7215
7208
|
viewData,
|
|
7216
7209
|
actionData,
|
|
7217
|
-
fieldsList
|
|
7218
|
-
contextSearch,
|
|
7219
|
-
setSearchMap,
|
|
7220
|
-
searchMap
|
|
7210
|
+
fieldsList
|
|
7221
7211
|
}) => {
|
|
7212
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
7222
7213
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
7223
7214
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
7224
7215
|
const [groupBy, setGroupBy] = (0, import_react24.useState)(null);
|
|
7225
7216
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7226
7217
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7218
|
+
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
7219
|
+
const { context } = actionData || {};
|
|
7220
|
+
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
7221
|
+
const contextSearch = { ...env.context, ...actionContext };
|
|
7227
7222
|
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : (0, import_utils14.evalJSONDomain)(actionData?.domain, contextSearch) : [];
|
|
7228
7223
|
const aid = actionData?.id;
|
|
7229
7224
|
const model = actionData?.res_model;
|
|
@@ -7381,16 +7376,16 @@ var searchController = ({
|
|
|
7381
7376
|
const contexts = [];
|
|
7382
7377
|
let groupValues = [];
|
|
7383
7378
|
objValues?.forEach((objValue) => {
|
|
7384
|
-
const { context, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7379
|
+
const { context: context2, value, active, groupIndex: groupIndex2, isDefault } = objValue;
|
|
7385
7380
|
const indexAppend = groupIndex2 != null ? groupIndex2 : viewData?.views?.search?.filters_by?.length ?? 0;
|
|
7386
7381
|
contexts.push(
|
|
7387
|
-
...Array.isArray(
|
|
7382
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({ group_by: item })) : [context2]
|
|
7388
7383
|
);
|
|
7389
7384
|
groupValues[indexAppend] = {
|
|
7390
7385
|
contexts: [
|
|
7391
|
-
...Array.isArray(
|
|
7386
|
+
...Array.isArray(context2?.group_by) ? context2.group_by.map((item) => ({
|
|
7392
7387
|
group_by: item
|
|
7393
|
-
})) : [
|
|
7388
|
+
})) : [context2]
|
|
7394
7389
|
],
|
|
7395
7390
|
strings: isDefault ? [value] : [...groupValues[indexAppend]?.strings ?? [], value]
|
|
7396
7391
|
};
|
|
@@ -7427,7 +7422,7 @@ var searchController = ({
|
|
|
7427
7422
|
value,
|
|
7428
7423
|
type,
|
|
7429
7424
|
title,
|
|
7430
|
-
context,
|
|
7425
|
+
context: context2,
|
|
7431
7426
|
active,
|
|
7432
7427
|
dataIndex
|
|
7433
7428
|
} = tag;
|
|
@@ -7435,13 +7430,13 @@ var searchController = ({
|
|
|
7435
7430
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7436
7431
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7437
7432
|
...tag,
|
|
7438
|
-
domain: domain ? domainFormat.toList(
|
|
7433
|
+
domain: domain ? domainFormat.toList(context2) : null
|
|
7439
7434
|
});
|
|
7440
7435
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7441
7436
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7442
7437
|
...tag,
|
|
7443
7438
|
domain: domain ? domainFormat.toList({
|
|
7444
|
-
...
|
|
7439
|
+
...context2,
|
|
7445
7440
|
self: value
|
|
7446
7441
|
}) : null
|
|
7447
7442
|
});
|
|
@@ -7449,7 +7444,7 @@ var searchController = ({
|
|
|
7449
7444
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7450
7445
|
...tag,
|
|
7451
7446
|
domain: domain ? domainFormat.toList({
|
|
7452
|
-
context,
|
|
7447
|
+
context: context2,
|
|
7453
7448
|
self: value
|
|
7454
7449
|
}) : null
|
|
7455
7450
|
});
|
|
@@ -7469,7 +7464,8 @@ var searchController = ({
|
|
|
7469
7464
|
removeSearchItems,
|
|
7470
7465
|
onSearchString: onChangeSearchInput,
|
|
7471
7466
|
handleAddTagSearch,
|
|
7472
|
-
domain: formatDomain()
|
|
7467
|
+
domain: formatDomain(),
|
|
7468
|
+
context: contextSearch
|
|
7473
7469
|
};
|
|
7474
7470
|
};
|
|
7475
7471
|
|