@fctc/widget-logic 2.4.10 → 2.5.0
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/hooks.d.mts +3 -220
- package/dist/hooks.d.ts +3 -220
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +56 -73
- package/dist/index.mjs +67 -88
- package/dist/use-view-v2-BWHqxo3S.d.mts +222 -0
- package/dist/use-view-v2-BWHqxo3S.d.ts +222 -0
- package/dist/widget.d.mts +7 -1
- package/dist/widget.d.ts +7 -1
- package/dist/widget.js +208 -73
- package/dist/widget.mjs +219 -88
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5296,7 +5296,9 @@ var many2oneFieldController = (props) => {
|
|
|
5296
5296
|
name,
|
|
5297
5297
|
context: fieldContext,
|
|
5298
5298
|
options: fieldOptions,
|
|
5299
|
-
showDetail
|
|
5299
|
+
showDetail,
|
|
5300
|
+
service,
|
|
5301
|
+
xNode
|
|
5300
5302
|
} = props;
|
|
5301
5303
|
const { env } = (0, provider_exports.useEnv)();
|
|
5302
5304
|
const [options, setOptions] = (0, import_react16.useState)([]);
|
|
@@ -5327,6 +5329,7 @@ var many2oneFieldController = (props) => {
|
|
|
5327
5329
|
}
|
|
5328
5330
|
};
|
|
5329
5331
|
const queryKey = [`data_${relation}`, domainObject];
|
|
5332
|
+
console.log("data", data);
|
|
5330
5333
|
const {
|
|
5331
5334
|
data: dataOfSelection,
|
|
5332
5335
|
refetch,
|
|
@@ -5334,7 +5337,9 @@ var many2oneFieldController = (props) => {
|
|
|
5334
5337
|
} = useGetSelection3({
|
|
5335
5338
|
data,
|
|
5336
5339
|
queryKey,
|
|
5337
|
-
enabled: false
|
|
5340
|
+
enabled: false,
|
|
5341
|
+
service,
|
|
5342
|
+
xNode
|
|
5338
5343
|
});
|
|
5339
5344
|
const selectOptions = (0, import_react16.useMemo)(() => {
|
|
5340
5345
|
return dataOfSelection?.records?.map((val) => ({
|
|
@@ -5461,7 +5466,7 @@ var import_environment2 = require("@fctc/interface-logic/environment");
|
|
|
5461
5466
|
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
5462
5467
|
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5463
5468
|
var many2oneButtonController = (props) => {
|
|
5464
|
-
const { domain, methods, relation } = props;
|
|
5469
|
+
const { domain, methods, relation, service, xNode } = props;
|
|
5465
5470
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5466
5471
|
const env = (0, import_environment2.getEnv)();
|
|
5467
5472
|
const domainObject = (0, import_utils7.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
@@ -5472,7 +5477,9 @@ var many2oneButtonController = (props) => {
|
|
|
5472
5477
|
domain: domainObject,
|
|
5473
5478
|
context: { ...env.context, ...(0, import_utils7.evalJSONContext)(actionData?.context) }
|
|
5474
5479
|
},
|
|
5475
|
-
queryKey: [`data_${relation}`, domainObject]
|
|
5480
|
+
queryKey: [`data_${relation}`, domainObject],
|
|
5481
|
+
service,
|
|
5482
|
+
xNode
|
|
5476
5483
|
});
|
|
5477
5484
|
const options = dataOfSelection?.records?.map((val) => ({
|
|
5478
5485
|
value: val.id,
|
|
@@ -5487,62 +5494,24 @@ var many2oneButtonController = (props) => {
|
|
|
5487
5494
|
var import_react17 = require("react");
|
|
5488
5495
|
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5489
5496
|
var many2manyFieldController = (props) => {
|
|
5490
|
-
const {
|
|
5491
|
-
relation,
|
|
5492
|
-
domain,
|
|
5493
|
-
context,
|
|
5494
|
-
options,
|
|
5495
|
-
tab,
|
|
5496
|
-
setSelectedRowKeys: setSelectedRowKeys2,
|
|
5497
|
-
groupByDomain,
|
|
5498
|
-
enabled: enabledCallAPI,
|
|
5499
|
-
actionData
|
|
5500
|
-
} = props;
|
|
5497
|
+
const { relation, domain, context, options, tab, setSelectedRowKeys: setSelectedRowKeys2 } = props;
|
|
5501
5498
|
const { env } = (0, provider_exports.useEnv)();
|
|
5502
|
-
const {
|
|
5503
|
-
const [order, setOrder] = (0, import_react17.useState)();
|
|
5499
|
+
const { useGetFormView: useGetFormView2 } = (0, provider_exports.useService)();
|
|
5504
5500
|
const [page, setPage] = (0, import_react17.useState)(0);
|
|
5505
5501
|
const [domainMany2Many, setDomainMany2Many] = (0, import_react17.useState)(null);
|
|
5506
|
-
const
|
|
5502
|
+
const { action } = useAppProvider();
|
|
5507
5503
|
const contextObject = {
|
|
5508
5504
|
...env.context,
|
|
5509
5505
|
...context || {}
|
|
5510
5506
|
};
|
|
5511
|
-
const
|
|
5512
|
-
model: relation,
|
|
5507
|
+
const { data: viewResponse } = useViewV2({
|
|
5508
|
+
model: String(relation),
|
|
5513
5509
|
views: [
|
|
5514
5510
|
[false, "list"],
|
|
5515
5511
|
[false, "search"]
|
|
5516
5512
|
],
|
|
5517
5513
|
context: contextObject
|
|
5518
|
-
};
|
|
5519
|
-
const { data: viewResponse } = useGetView2(viewParams, enabledCallAPI);
|
|
5520
|
-
const baseModel = (0, import_react17.useMemo)(
|
|
5521
|
-
() => ({
|
|
5522
|
-
name: String(relation),
|
|
5523
|
-
view: viewResponse || {},
|
|
5524
|
-
actContext: contextObject,
|
|
5525
|
-
fields: [
|
|
5526
|
-
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5527
|
-
...tab?.fields ? tab.fields : []
|
|
5528
|
-
]
|
|
5529
|
-
}),
|
|
5530
|
-
[relation, viewResponse]
|
|
5531
|
-
);
|
|
5532
|
-
const initModel = (0, import_hooks2.useModel)();
|
|
5533
|
-
const modelInstance = (0, import_react17.useMemo)(() => {
|
|
5534
|
-
if (viewResponse) {
|
|
5535
|
-
return initModel.initModel(baseModel);
|
|
5536
|
-
}
|
|
5537
|
-
return null;
|
|
5538
|
-
}, [baseModel, viewResponse]);
|
|
5539
|
-
const specification = (0, import_react17.useMemo)(() => {
|
|
5540
|
-
if (modelInstance) {
|
|
5541
|
-
return modelInstance.getSpecification();
|
|
5542
|
-
}
|
|
5543
|
-
return null;
|
|
5544
|
-
}, [modelInstance]);
|
|
5545
|
-
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5514
|
+
});
|
|
5546
5515
|
const optionsObject = tab?.options ? (0, import_utils8.evalJSONContext)(tab?.options) : (options ? (0, import_utils8.evalJSONContext)(options) : {}) || {};
|
|
5547
5516
|
const fetchData = async () => {
|
|
5548
5517
|
try {
|
|
@@ -5553,32 +5522,17 @@ var many2manyFieldController = (props) => {
|
|
|
5553
5522
|
console.log(err);
|
|
5554
5523
|
}
|
|
5555
5524
|
};
|
|
5556
|
-
const queryKey = [
|
|
5557
|
-
`view-${relation}`,
|
|
5558
|
-
specification,
|
|
5559
|
-
domainMany2Many,
|
|
5560
|
-
debouncedPage,
|
|
5561
|
-
groupByDomain,
|
|
5562
|
-
order
|
|
5563
|
-
];
|
|
5564
|
-
const data = {
|
|
5565
|
-
model: relation,
|
|
5566
|
-
specification,
|
|
5567
|
-
domain: domainMany2Many,
|
|
5568
|
-
offset: debouncedPage * 10,
|
|
5569
|
-
limit: 10,
|
|
5570
|
-
context: contextObject,
|
|
5571
|
-
fields: groupByDomain?.fields,
|
|
5572
|
-
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5573
|
-
sort: order ? order : default_order ? (0, import_utils8.formatSortingString)(default_order) : ""
|
|
5574
|
-
};
|
|
5575
|
-
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5576
5525
|
const {
|
|
5577
5526
|
data: dataResponse,
|
|
5578
|
-
isLoading,
|
|
5579
5527
|
isFetched,
|
|
5580
|
-
isPlaceholderData
|
|
5581
|
-
|
|
5528
|
+
isPlaceholderData,
|
|
5529
|
+
isLoading
|
|
5530
|
+
} = useListData({
|
|
5531
|
+
action,
|
|
5532
|
+
context,
|
|
5533
|
+
model: String(relation),
|
|
5534
|
+
viewData: viewResponse
|
|
5535
|
+
});
|
|
5582
5536
|
(0, import_react17.useEffect)(() => {
|
|
5583
5537
|
if (viewResponse) {
|
|
5584
5538
|
fetchData();
|
|
@@ -5609,7 +5563,31 @@ var many2manyFieldController = (props) => {
|
|
|
5609
5563
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
5610
5564
|
]
|
|
5611
5565
|
});
|
|
5566
|
+
const {
|
|
5567
|
+
refetch,
|
|
5568
|
+
data: dataFormViewResponse,
|
|
5569
|
+
isSuccess
|
|
5570
|
+
} = useGetFormView2({
|
|
5571
|
+
data: {
|
|
5572
|
+
id: null,
|
|
5573
|
+
model: relation ?? "",
|
|
5574
|
+
context: contextObject
|
|
5575
|
+
},
|
|
5576
|
+
queryKey: [`form-view-action-${relation}`],
|
|
5577
|
+
enabled: false
|
|
5578
|
+
});
|
|
5579
|
+
(0, import_react17.useEffect)(() => {
|
|
5580
|
+
if (isSuccess && dataFormViewResponse) {
|
|
5581
|
+
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5582
|
+
window.location.href = `/form/menu?model=${relation}`;
|
|
5583
|
+
}
|
|
5584
|
+
}, [isSuccess]);
|
|
5612
5585
|
const handleCreateNewOnPage = async () => {
|
|
5586
|
+
try {
|
|
5587
|
+
refetch();
|
|
5588
|
+
} catch (error) {
|
|
5589
|
+
console.log(error);
|
|
5590
|
+
}
|
|
5613
5591
|
};
|
|
5614
5592
|
return {
|
|
5615
5593
|
handleCreateNewOnPage,
|
|
@@ -5642,7 +5620,9 @@ var many2manyTagsController = (props) => {
|
|
|
5642
5620
|
options: optionsFields,
|
|
5643
5621
|
widget,
|
|
5644
5622
|
formValues,
|
|
5645
|
-
placeholderNoOption
|
|
5623
|
+
placeholderNoOption,
|
|
5624
|
+
service,
|
|
5625
|
+
xNode
|
|
5646
5626
|
} = props;
|
|
5647
5627
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5648
5628
|
const { env } = (0, provider_exports.useEnv)();
|
|
@@ -5665,9 +5645,12 @@ var many2manyTagsController = (props) => {
|
|
|
5665
5645
|
enabled: true,
|
|
5666
5646
|
context: env.context
|
|
5667
5647
|
};
|
|
5648
|
+
console.log("data", data);
|
|
5668
5649
|
const { data: dataOfSelection } = useGetSelection3({
|
|
5669
5650
|
data,
|
|
5670
|
-
queryKey: [`data_${relation}`, domainObject]
|
|
5651
|
+
queryKey: [`data_${relation}`, domainObject],
|
|
5652
|
+
service,
|
|
5653
|
+
xNode
|
|
5671
5654
|
});
|
|
5672
5655
|
const customNoOptionsMessage = () => placeholderNoOption;
|
|
5673
5656
|
const tranfer = (data2) => {
|
package/dist/index.mjs
CHANGED
|
@@ -5377,7 +5377,9 @@ var many2oneFieldController = (props) => {
|
|
|
5377
5377
|
name,
|
|
5378
5378
|
context: fieldContext,
|
|
5379
5379
|
options: fieldOptions,
|
|
5380
|
-
showDetail
|
|
5380
|
+
showDetail,
|
|
5381
|
+
service,
|
|
5382
|
+
xNode
|
|
5381
5383
|
} = props;
|
|
5382
5384
|
const { env } = (0, provider_exports.useEnv)();
|
|
5383
5385
|
const [options, setOptions] = useState7([]);
|
|
@@ -5408,6 +5410,7 @@ var many2oneFieldController = (props) => {
|
|
|
5408
5410
|
}
|
|
5409
5411
|
};
|
|
5410
5412
|
const queryKey = [`data_${relation}`, domainObject];
|
|
5413
|
+
console.log("data", data);
|
|
5411
5414
|
const {
|
|
5412
5415
|
data: dataOfSelection,
|
|
5413
5416
|
refetch,
|
|
@@ -5415,7 +5418,9 @@ var many2oneFieldController = (props) => {
|
|
|
5415
5418
|
} = useGetSelection3({
|
|
5416
5419
|
data,
|
|
5417
5420
|
queryKey,
|
|
5418
|
-
enabled: false
|
|
5421
|
+
enabled: false,
|
|
5422
|
+
service,
|
|
5423
|
+
xNode
|
|
5419
5424
|
});
|
|
5420
5425
|
const selectOptions = useMemo8(() => {
|
|
5421
5426
|
return dataOfSelection?.records?.map((val) => ({
|
|
@@ -5542,7 +5547,7 @@ import { getEnv as getEnv2 } from "@fctc/interface-logic/environment";
|
|
|
5542
5547
|
import { useGetSelection as useGetSelection2 } from "@fctc/interface-logic/hooks";
|
|
5543
5548
|
import { evalJSONDomain as evalJSONDomain3, evalJSONContext as evalJSONContext3 } from "@fctc/interface-logic/utils";
|
|
5544
5549
|
var many2oneButtonController = (props) => {
|
|
5545
|
-
const { domain, methods, relation } = props;
|
|
5550
|
+
const { domain, methods, relation, service, xNode } = props;
|
|
5546
5551
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5547
5552
|
const env = getEnv2();
|
|
5548
5553
|
const domainObject = evalJSONDomain3(domain, methods?.getValues() || {});
|
|
@@ -5553,7 +5558,9 @@ var many2oneButtonController = (props) => {
|
|
|
5553
5558
|
domain: domainObject,
|
|
5554
5559
|
context: { ...env.context, ...evalJSONContext3(actionData?.context) }
|
|
5555
5560
|
},
|
|
5556
|
-
queryKey: [`data_${relation}`, domainObject]
|
|
5561
|
+
queryKey: [`data_${relation}`, domainObject],
|
|
5562
|
+
service,
|
|
5563
|
+
xNode
|
|
5557
5564
|
});
|
|
5558
5565
|
const options = dataOfSelection?.records?.map((val) => ({
|
|
5559
5566
|
value: val.id,
|
|
@@ -5565,69 +5572,27 @@ var many2oneButtonController = (props) => {
|
|
|
5565
5572
|
};
|
|
5566
5573
|
|
|
5567
5574
|
// src/widget/basic/many2many-field/controller.ts
|
|
5568
|
-
import { useEffect as useEffect11,
|
|
5569
|
-
import {
|
|
5570
|
-
evalJSONContext as evalJSONContext4,
|
|
5571
|
-
evalJSONDomain as evalJSONDomain4,
|
|
5572
|
-
formatSortingString as formatSortingString2
|
|
5573
|
-
} from "@fctc/interface-logic/utils";
|
|
5575
|
+
import { useEffect as useEffect11, useState as useState8 } from "react";
|
|
5576
|
+
import { evalJSONContext as evalJSONContext4, evalJSONDomain as evalJSONDomain4 } from "@fctc/interface-logic/utils";
|
|
5574
5577
|
var many2manyFieldController = (props) => {
|
|
5575
|
-
const {
|
|
5576
|
-
relation,
|
|
5577
|
-
domain,
|
|
5578
|
-
context,
|
|
5579
|
-
options,
|
|
5580
|
-
tab,
|
|
5581
|
-
setSelectedRowKeys: setSelectedRowKeys2,
|
|
5582
|
-
groupByDomain,
|
|
5583
|
-
enabled: enabledCallAPI,
|
|
5584
|
-
actionData
|
|
5585
|
-
} = props;
|
|
5578
|
+
const { relation, domain, context, options, tab, setSelectedRowKeys: setSelectedRowKeys2 } = props;
|
|
5586
5579
|
const { env } = (0, provider_exports.useEnv)();
|
|
5587
|
-
const {
|
|
5588
|
-
const [order, setOrder] = useState8();
|
|
5580
|
+
const { useGetFormView: useGetFormView2 } = (0, provider_exports.useService)();
|
|
5589
5581
|
const [page, setPage] = useState8(0);
|
|
5590
5582
|
const [domainMany2Many, setDomainMany2Many] = useState8(null);
|
|
5591
|
-
const
|
|
5583
|
+
const { action } = useAppProvider();
|
|
5592
5584
|
const contextObject = {
|
|
5593
5585
|
...env.context,
|
|
5594
5586
|
...context || {}
|
|
5595
5587
|
};
|
|
5596
|
-
const
|
|
5597
|
-
model: relation,
|
|
5588
|
+
const { data: viewResponse } = useViewV2({
|
|
5589
|
+
model: String(relation),
|
|
5598
5590
|
views: [
|
|
5599
5591
|
[false, "list"],
|
|
5600
5592
|
[false, "search"]
|
|
5601
5593
|
],
|
|
5602
5594
|
context: contextObject
|
|
5603
|
-
};
|
|
5604
|
-
const { data: viewResponse } = useGetView2(viewParams, enabledCallAPI);
|
|
5605
|
-
const baseModel = useMemo9(
|
|
5606
|
-
() => ({
|
|
5607
|
-
name: String(relation),
|
|
5608
|
-
view: viewResponse || {},
|
|
5609
|
-
actContext: contextObject,
|
|
5610
|
-
fields: [
|
|
5611
|
-
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5612
|
-
...tab?.fields ? tab.fields : []
|
|
5613
|
-
]
|
|
5614
|
-
}),
|
|
5615
|
-
[relation, viewResponse]
|
|
5616
|
-
);
|
|
5617
|
-
const initModel = useModel();
|
|
5618
|
-
const modelInstance = useMemo9(() => {
|
|
5619
|
-
if (viewResponse) {
|
|
5620
|
-
return initModel.initModel(baseModel);
|
|
5621
|
-
}
|
|
5622
|
-
return null;
|
|
5623
|
-
}, [baseModel, viewResponse]);
|
|
5624
|
-
const specification = useMemo9(() => {
|
|
5625
|
-
if (modelInstance) {
|
|
5626
|
-
return modelInstance.getSpecification();
|
|
5627
|
-
}
|
|
5628
|
-
return null;
|
|
5629
|
-
}, [modelInstance]);
|
|
5630
|
-
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5595
|
+
});
|
|
5631
5596
|
const optionsObject = tab?.options ? evalJSONContext4(tab?.options) : (options ? evalJSONContext4(options) : {}) || {};
|
|
5632
5597
|
const fetchData = async () => {
|
|
5633
5598
|
try {
|
|
@@ -5638,32 +5603,17 @@ var many2manyFieldController = (props) => {
|
|
|
5638
5603
|
console.log(err);
|
|
5639
5604
|
}
|
|
5640
5605
|
};
|
|
5641
|
-
const queryKey = [
|
|
5642
|
-
`view-${relation}`,
|
|
5643
|
-
specification,
|
|
5644
|
-
domainMany2Many,
|
|
5645
|
-
debouncedPage,
|
|
5646
|
-
groupByDomain,
|
|
5647
|
-
order
|
|
5648
|
-
];
|
|
5649
|
-
const data = {
|
|
5650
|
-
model: relation,
|
|
5651
|
-
specification,
|
|
5652
|
-
domain: domainMany2Many,
|
|
5653
|
-
offset: debouncedPage * 10,
|
|
5654
|
-
limit: 10,
|
|
5655
|
-
context: contextObject,
|
|
5656
|
-
fields: groupByDomain?.fields,
|
|
5657
|
-
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5658
|
-
sort: order ? order : default_order ? formatSortingString2(default_order) : ""
|
|
5659
|
-
};
|
|
5660
|
-
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5661
5606
|
const {
|
|
5662
5607
|
data: dataResponse,
|
|
5663
|
-
isLoading,
|
|
5664
5608
|
isFetched,
|
|
5665
|
-
isPlaceholderData
|
|
5666
|
-
|
|
5609
|
+
isPlaceholderData,
|
|
5610
|
+
isLoading
|
|
5611
|
+
} = useListData({
|
|
5612
|
+
action,
|
|
5613
|
+
context,
|
|
5614
|
+
model: String(relation),
|
|
5615
|
+
viewData: viewResponse
|
|
5616
|
+
});
|
|
5667
5617
|
useEffect11(() => {
|
|
5668
5618
|
if (viewResponse) {
|
|
5669
5619
|
fetchData();
|
|
@@ -5694,7 +5644,31 @@ var many2manyFieldController = (props) => {
|
|
|
5694
5644
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
5695
5645
|
]
|
|
5696
5646
|
});
|
|
5647
|
+
const {
|
|
5648
|
+
refetch,
|
|
5649
|
+
data: dataFormViewResponse,
|
|
5650
|
+
isSuccess
|
|
5651
|
+
} = useGetFormView2({
|
|
5652
|
+
data: {
|
|
5653
|
+
id: null,
|
|
5654
|
+
model: relation ?? "",
|
|
5655
|
+
context: contextObject
|
|
5656
|
+
},
|
|
5657
|
+
queryKey: [`form-view-action-${relation}`],
|
|
5658
|
+
enabled: false
|
|
5659
|
+
});
|
|
5660
|
+
useEffect11(() => {
|
|
5661
|
+
if (isSuccess && dataFormViewResponse) {
|
|
5662
|
+
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5663
|
+
window.location.href = `/form/menu?model=${relation}`;
|
|
5664
|
+
}
|
|
5665
|
+
}, [isSuccess]);
|
|
5697
5666
|
const handleCreateNewOnPage = async () => {
|
|
5667
|
+
try {
|
|
5668
|
+
refetch();
|
|
5669
|
+
} catch (error) {
|
|
5670
|
+
console.log(error);
|
|
5671
|
+
}
|
|
5698
5672
|
};
|
|
5699
5673
|
return {
|
|
5700
5674
|
handleCreateNewOnPage,
|
|
@@ -5717,7 +5691,7 @@ var many2manyFieldController = (props) => {
|
|
|
5717
5691
|
};
|
|
5718
5692
|
|
|
5719
5693
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5720
|
-
import { useMemo as
|
|
5694
|
+
import { useMemo as useMemo9 } from "react";
|
|
5721
5695
|
import { WIDGETAVATAR, WIDGETCOLOR } from "@fctc/interface-logic/constants";
|
|
5722
5696
|
import { evalJSONContext as evalJSONContext5, evalJSONDomain as evalJSONDomain5 } from "@fctc/interface-logic/utils";
|
|
5723
5697
|
var many2manyTagsController = (props) => {
|
|
@@ -5727,13 +5701,15 @@ var many2manyTagsController = (props) => {
|
|
|
5727
5701
|
options: optionsFields,
|
|
5728
5702
|
widget,
|
|
5729
5703
|
formValues,
|
|
5730
|
-
placeholderNoOption
|
|
5704
|
+
placeholderNoOption,
|
|
5705
|
+
service,
|
|
5706
|
+
xNode
|
|
5731
5707
|
} = props;
|
|
5732
5708
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5733
5709
|
const { env } = (0, provider_exports.useEnv)();
|
|
5734
5710
|
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
5735
5711
|
const addtionalFields = optionsFields ? evalJSONContext5(optionsFields) : null;
|
|
5736
|
-
const domainObject =
|
|
5712
|
+
const domainObject = useMemo9(
|
|
5737
5713
|
() => evalJSONDomain5(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5738
5714
|
[domain, formValues]
|
|
5739
5715
|
);
|
|
@@ -5750,9 +5726,12 @@ var many2manyTagsController = (props) => {
|
|
|
5750
5726
|
enabled: true,
|
|
5751
5727
|
context: env.context
|
|
5752
5728
|
};
|
|
5729
|
+
console.log("data", data);
|
|
5753
5730
|
const { data: dataOfSelection } = useGetSelection3({
|
|
5754
5731
|
data,
|
|
5755
|
-
queryKey: [`data_${relation}`, domainObject]
|
|
5732
|
+
queryKey: [`data_${relation}`, domainObject],
|
|
5733
|
+
service,
|
|
5734
|
+
xNode
|
|
5756
5735
|
});
|
|
5757
5736
|
const customNoOptionsMessage = () => placeholderNoOption;
|
|
5758
5737
|
const tranfer = (data2) => {
|
|
@@ -6962,7 +6941,7 @@ var binaryFieldController = (props) => {
|
|
|
6962
6941
|
};
|
|
6963
6942
|
|
|
6964
6943
|
// src/widget/advance/table/table-head/controller.ts
|
|
6965
|
-
import { useMemo as
|
|
6944
|
+
import { useMemo as useMemo10, useRef as useRef5 } from "react";
|
|
6966
6945
|
var tableHeadController = (props) => {
|
|
6967
6946
|
const {
|
|
6968
6947
|
typeTable,
|
|
@@ -6975,19 +6954,19 @@ var tableHeadController = (props) => {
|
|
|
6975
6954
|
const { rowIds: recordIds } = useGetRowIds(tableRef);
|
|
6976
6955
|
const selectedRowKeysRef = useRef5(recordIds);
|
|
6977
6956
|
const isGroupTable = typeTable === "group";
|
|
6978
|
-
const recordsCheckedGroup =
|
|
6957
|
+
const recordsCheckedGroup = useMemo10(() => {
|
|
6979
6958
|
if (!rows || !groupByList) return 0;
|
|
6980
6959
|
const groupBy = typeof groupByList === "object" ? groupByList?.contexts?.[0]?.group_by : void 0;
|
|
6981
6960
|
return countSum(rows, groupBy);
|
|
6982
6961
|
}, [rows, groupByList]);
|
|
6983
|
-
const isAllGroupChecked =
|
|
6962
|
+
const isAllGroupChecked = useMemo10(() => {
|
|
6984
6963
|
if (!isGroupTable || !selectedRowKeys?.length) return false;
|
|
6985
6964
|
const selectedLength = selectedRowKeys.filter((id) => id !== -1).length;
|
|
6986
6965
|
const allRecordsSelected = recordIds.length === selectedRowKeys.length ? recordIds.length === selectedLength : false;
|
|
6987
6966
|
const allGroupsSelected = recordsCheckedGroup === selectedRowKeys.length;
|
|
6988
6967
|
return allGroupsSelected || allRecordsSelected;
|
|
6989
6968
|
}, [isGroupTable, selectedRowKeys, recordIds, recordsCheckedGroup]);
|
|
6990
|
-
const isAllNormalChecked =
|
|
6969
|
+
const isAllNormalChecked = useMemo10(() => {
|
|
6991
6970
|
if (isGroupTable || !selectedRowKeys?.length || !rows?.length) return false;
|
|
6992
6971
|
return selectedRowKeys.length === rows.length && selectedRowKeys.every(
|
|
6993
6972
|
(id) => rows.some((record) => record.id === id)
|
|
@@ -7117,7 +7096,7 @@ var tableController = ({ data }) => {
|
|
|
7117
7096
|
};
|
|
7118
7097
|
|
|
7119
7098
|
// src/widget/advance/table/table-group/controller.ts
|
|
7120
|
-
import { useEffect as useEffect14, useMemo as
|
|
7099
|
+
import { useEffect as useEffect14, useMemo as useMemo11, useState as useState14 } from "react";
|
|
7121
7100
|
import {
|
|
7122
7101
|
useAppSelector as useAppSelector2,
|
|
7123
7102
|
selectList
|
|
@@ -7145,7 +7124,7 @@ var tableGroupController = (props) => {
|
|
|
7145
7124
|
fromEnd: 1
|
|
7146
7125
|
});
|
|
7147
7126
|
const domain = row?.__domain;
|
|
7148
|
-
const processedData =
|
|
7127
|
+
const processedData = useMemo11(() => {
|
|
7149
7128
|
const calculateColSpanEmpty = () => {
|
|
7150
7129
|
const startIndex = columns.findIndex(
|
|
7151
7130
|
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
@@ -7160,7 +7139,7 @@ var tableGroupController = (props) => {
|
|
|
7160
7139
|
};
|
|
7161
7140
|
return calculateColSpanEmpty();
|
|
7162
7141
|
}, [columns, row]);
|
|
7163
|
-
const shouldFetchData =
|
|
7142
|
+
const shouldFetchData = useMemo11(() => {
|
|
7164
7143
|
return !!isShowGroup;
|
|
7165
7144
|
}, [isShowGroup]);
|
|
7166
7145
|
const enabled = shouldFetchData && !!processedData;
|