@fctc/widget-logic 3.7.3 → 3.7.5
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 +49 -19
- package/dist/index.mjs +50 -20
- package/dist/widget.d.mts +2 -2
- package/dist/widget.d.ts +2 -2
- package/dist/widget.js +43 -17
- package/dist/widget.mjs +43 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5320,12 +5320,6 @@ var statusDropdownController = (props) => {
|
|
|
5320
5320
|
|
|
5321
5321
|
// src/widget/basic/many2one-field/controller.ts
|
|
5322
5322
|
var import_react16 = require("react");
|
|
5323
|
-
|
|
5324
|
-
// src/store.ts
|
|
5325
|
-
var store_exports = {};
|
|
5326
|
-
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
5327
|
-
|
|
5328
|
-
// src/widget/basic/many2one-field/controller.ts
|
|
5329
5323
|
var many2oneFieldController = (props) => {
|
|
5330
5324
|
const {
|
|
5331
5325
|
methods,
|
|
@@ -5339,18 +5333,20 @@ var many2oneFieldController = (props) => {
|
|
|
5339
5333
|
options: fieldOptions,
|
|
5340
5334
|
showDetail,
|
|
5341
5335
|
service,
|
|
5342
|
-
xNode
|
|
5336
|
+
xNode,
|
|
5337
|
+
isForm
|
|
5343
5338
|
} = props;
|
|
5344
|
-
const { action } = useAppProvider();
|
|
5345
5339
|
const { env } = (0, provider_exports.useEnv)();
|
|
5346
|
-
const
|
|
5340
|
+
const { action, user } = useAppProvider();
|
|
5341
|
+
const { useGetSelection: useGetSelection3, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
|
|
5342
|
+
const [listOptions, setListOptions] = (0, import_react16.useState)([]);
|
|
5347
5343
|
const [inputValue, setInputValue] = (0, import_react16.useState)("");
|
|
5348
5344
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
5349
5345
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react16.useState)(false);
|
|
5350
5346
|
const [tempSelectedOption, setTempSelectedOption] = (0, import_react16.useState)(null);
|
|
5351
5347
|
const [domainModal, setDomainModal] = (0, import_react16.useState)(null);
|
|
5352
5348
|
const [domainObject, setDomainObject] = (0, import_react16.useState)(null);
|
|
5353
|
-
const
|
|
5349
|
+
const dataUser = user?.userProfile?.data;
|
|
5354
5350
|
const initValue = methods?.getValues(name);
|
|
5355
5351
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
5356
5352
|
const contextObject = {
|
|
@@ -5358,7 +5354,7 @@ var many2oneFieldController = (props) => {
|
|
|
5358
5354
|
...fieldContext,
|
|
5359
5355
|
...env?.context
|
|
5360
5356
|
};
|
|
5361
|
-
const
|
|
5357
|
+
const fetchGetDetail = useGetDetail2();
|
|
5362
5358
|
const data = {
|
|
5363
5359
|
model: relation,
|
|
5364
5360
|
domain: domainObject,
|
|
@@ -5388,7 +5384,7 @@ var many2oneFieldController = (props) => {
|
|
|
5388
5384
|
})) || [];
|
|
5389
5385
|
}, [dataOfSelection]);
|
|
5390
5386
|
(0, import_react16.useEffect)(() => {
|
|
5391
|
-
|
|
5387
|
+
setListOptions(selectOptions);
|
|
5392
5388
|
setDomainModal(domainObject);
|
|
5393
5389
|
}, [selectOptions]);
|
|
5394
5390
|
const parsedFormValues = (0, import_react16.useMemo)(
|
|
@@ -5413,6 +5409,34 @@ var many2oneFieldController = (props) => {
|
|
|
5413
5409
|
methods?.setValue(name, null);
|
|
5414
5410
|
setTempSelectedOption(null);
|
|
5415
5411
|
} else if (propValue) {
|
|
5412
|
+
if (isForm && fieldOptions?.includes("service") && fieldOptions?.includes("type") && fieldOptions?.includes("model")) {
|
|
5413
|
+
const optionsMany2OneField = fieldOptions ? (0, utils_exports.evalJSONContext)(fieldOptions) : null;
|
|
5414
|
+
fetchGetDetail.mutate(
|
|
5415
|
+
{
|
|
5416
|
+
model: optionsMany2OneField?.model,
|
|
5417
|
+
ids: propValue,
|
|
5418
|
+
specification: {
|
|
5419
|
+
id: {},
|
|
5420
|
+
display_name: {}
|
|
5421
|
+
},
|
|
5422
|
+
context: { ...env.context },
|
|
5423
|
+
service: optionsMany2OneField ? optionsMany2OneField?.service : service,
|
|
5424
|
+
xNode: service == "wesap" && dataUser.x_node
|
|
5425
|
+
},
|
|
5426
|
+
{
|
|
5427
|
+
onSuccess: (detailData) => {
|
|
5428
|
+
setTempSelectedOption({
|
|
5429
|
+
value: detailData?.[0]?.id,
|
|
5430
|
+
label: detailData?.[0]?.display_name
|
|
5431
|
+
});
|
|
5432
|
+
},
|
|
5433
|
+
onError: (error) => {
|
|
5434
|
+
console.log("error", error);
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
);
|
|
5438
|
+
return;
|
|
5439
|
+
}
|
|
5416
5440
|
setTempSelectedOption({
|
|
5417
5441
|
value: propValue?.id,
|
|
5418
5442
|
label: propValue?.display_name
|
|
@@ -5439,7 +5463,7 @@ var many2oneFieldController = (props) => {
|
|
|
5439
5463
|
}, [debouncedInputValue]);
|
|
5440
5464
|
const handleChooseRecord = (0, import_react16.useCallback)(
|
|
5441
5465
|
(idRecord) => {
|
|
5442
|
-
const newOption =
|
|
5466
|
+
const newOption = listOptions?.find(
|
|
5443
5467
|
(option) => option.value === idRecord
|
|
5444
5468
|
);
|
|
5445
5469
|
if (newOption) {
|
|
@@ -5460,7 +5484,7 @@ var many2oneFieldController = (props) => {
|
|
|
5460
5484
|
}
|
|
5461
5485
|
setIsShowModalMany2Many(false);
|
|
5462
5486
|
},
|
|
5463
|
-
[
|
|
5487
|
+
[listOptions, methods, name, onChange]
|
|
5464
5488
|
);
|
|
5465
5489
|
const handleClose = (0, import_react16.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
5466
5490
|
const handleSelectChange = (0, import_react16.useCallback)(
|
|
@@ -5492,7 +5516,6 @@ var many2oneFieldController = (props) => {
|
|
|
5492
5516
|
isShowModalMany2Many,
|
|
5493
5517
|
isFetching,
|
|
5494
5518
|
initValue,
|
|
5495
|
-
menuList,
|
|
5496
5519
|
handleChooseRecord,
|
|
5497
5520
|
handleClose,
|
|
5498
5521
|
handleSelectChange,
|
|
@@ -5501,11 +5524,12 @@ var many2oneFieldController = (props) => {
|
|
|
5501
5524
|
allowShowDetail,
|
|
5502
5525
|
contextObject,
|
|
5503
5526
|
tempSelectedOption,
|
|
5504
|
-
|
|
5527
|
+
listOptions,
|
|
5505
5528
|
fetchMoreOptions,
|
|
5506
5529
|
domainObject,
|
|
5507
5530
|
setIsShowModalMany2Many,
|
|
5508
|
-
setDomainObject
|
|
5531
|
+
setDomainObject,
|
|
5532
|
+
options: (0, utils_exports.evalJSONContext)(fieldOptions)
|
|
5509
5533
|
};
|
|
5510
5534
|
};
|
|
5511
5535
|
|
|
@@ -7093,7 +7117,7 @@ var tableController = ({ data }) => {
|
|
|
7093
7117
|
|
|
7094
7118
|
// src/widget/advance/table/table-group/controller.ts
|
|
7095
7119
|
var import_react25 = require("react");
|
|
7096
|
-
var
|
|
7120
|
+
var import_store = require("@fctc/interface-logic/store");
|
|
7097
7121
|
var tableGroupController = (props) => {
|
|
7098
7122
|
const { env } = (0, provider_exports.useEnv)();
|
|
7099
7123
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
@@ -7110,7 +7134,7 @@ var tableGroupController = (props) => {
|
|
|
7110
7134
|
setSelectedRowKeys
|
|
7111
7135
|
} = props;
|
|
7112
7136
|
const [pageGroup, setPageGroup] = (0, import_react25.useState)(0);
|
|
7113
|
-
const { selectedRowKeys } = (0,
|
|
7137
|
+
const { selectedRowKeys } = (0, import_store.useAppSelector)(import_store.selectList);
|
|
7114
7138
|
const [isShowGroup, setIsShowGroup] = (0, import_react25.useState)(false);
|
|
7115
7139
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react25.useState)({
|
|
7116
7140
|
fromStart: 1,
|
|
@@ -7485,6 +7509,12 @@ var searchController = ({
|
|
|
7485
7509
|
|
|
7486
7510
|
// src/index.ts
|
|
7487
7511
|
__reExport(index_exports, utils_exports, module.exports);
|
|
7512
|
+
|
|
7513
|
+
// src/store.ts
|
|
7514
|
+
var store_exports = {};
|
|
7515
|
+
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
7516
|
+
|
|
7517
|
+
// src/index.ts
|
|
7488
7518
|
__reExport(index_exports, store_exports, module.exports);
|
|
7489
7519
|
|
|
7490
7520
|
// src/constants.ts
|
package/dist/index.mjs
CHANGED
|
@@ -5400,13 +5400,6 @@ var statusDropdownController = (props) => {
|
|
|
5400
5400
|
|
|
5401
5401
|
// src/widget/basic/many2one-field/controller.ts
|
|
5402
5402
|
import { useCallback as useCallback4, useEffect as useEffect10, useMemo as useMemo8, useState as useState7 } from "react";
|
|
5403
|
-
|
|
5404
|
-
// src/store.ts
|
|
5405
|
-
var store_exports = {};
|
|
5406
|
-
__reExport(store_exports, store_star);
|
|
5407
|
-
import * as store_star from "@fctc/interface-logic/store";
|
|
5408
|
-
|
|
5409
|
-
// src/widget/basic/many2one-field/controller.ts
|
|
5410
5403
|
var many2oneFieldController = (props) => {
|
|
5411
5404
|
const {
|
|
5412
5405
|
methods,
|
|
@@ -5420,18 +5413,20 @@ var many2oneFieldController = (props) => {
|
|
|
5420
5413
|
options: fieldOptions,
|
|
5421
5414
|
showDetail,
|
|
5422
5415
|
service,
|
|
5423
|
-
xNode
|
|
5416
|
+
xNode,
|
|
5417
|
+
isForm
|
|
5424
5418
|
} = props;
|
|
5425
|
-
const { action } = useAppProvider();
|
|
5426
5419
|
const { env } = (0, provider_exports.useEnv)();
|
|
5427
|
-
const
|
|
5420
|
+
const { action, user } = useAppProvider();
|
|
5421
|
+
const { useGetSelection: useGetSelection3, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
|
|
5422
|
+
const [listOptions, setListOptions] = useState7([]);
|
|
5428
5423
|
const [inputValue, setInputValue] = useState7("");
|
|
5429
5424
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
5430
5425
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = useState7(false);
|
|
5431
5426
|
const [tempSelectedOption, setTempSelectedOption] = useState7(null);
|
|
5432
5427
|
const [domainModal, setDomainModal] = useState7(null);
|
|
5433
5428
|
const [domainObject, setDomainObject] = useState7(null);
|
|
5434
|
-
const
|
|
5429
|
+
const dataUser = user?.userProfile?.data;
|
|
5435
5430
|
const initValue = methods?.getValues(name);
|
|
5436
5431
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
5437
5432
|
const contextObject = {
|
|
@@ -5439,7 +5434,7 @@ var many2oneFieldController = (props) => {
|
|
|
5439
5434
|
...fieldContext,
|
|
5440
5435
|
...env?.context
|
|
5441
5436
|
};
|
|
5442
|
-
const
|
|
5437
|
+
const fetchGetDetail = useGetDetail2();
|
|
5443
5438
|
const data = {
|
|
5444
5439
|
model: relation,
|
|
5445
5440
|
domain: domainObject,
|
|
@@ -5469,7 +5464,7 @@ var many2oneFieldController = (props) => {
|
|
|
5469
5464
|
})) || [];
|
|
5470
5465
|
}, [dataOfSelection]);
|
|
5471
5466
|
useEffect10(() => {
|
|
5472
|
-
|
|
5467
|
+
setListOptions(selectOptions);
|
|
5473
5468
|
setDomainModal(domainObject);
|
|
5474
5469
|
}, [selectOptions]);
|
|
5475
5470
|
const parsedFormValues = useMemo8(
|
|
@@ -5494,6 +5489,34 @@ var many2oneFieldController = (props) => {
|
|
|
5494
5489
|
methods?.setValue(name, null);
|
|
5495
5490
|
setTempSelectedOption(null);
|
|
5496
5491
|
} else if (propValue) {
|
|
5492
|
+
if (isForm && fieldOptions?.includes("service") && fieldOptions?.includes("type") && fieldOptions?.includes("model")) {
|
|
5493
|
+
const optionsMany2OneField = fieldOptions ? (0, utils_exports.evalJSONContext)(fieldOptions) : null;
|
|
5494
|
+
fetchGetDetail.mutate(
|
|
5495
|
+
{
|
|
5496
|
+
model: optionsMany2OneField?.model,
|
|
5497
|
+
ids: propValue,
|
|
5498
|
+
specification: {
|
|
5499
|
+
id: {},
|
|
5500
|
+
display_name: {}
|
|
5501
|
+
},
|
|
5502
|
+
context: { ...env.context },
|
|
5503
|
+
service: optionsMany2OneField ? optionsMany2OneField?.service : service,
|
|
5504
|
+
xNode: service == "wesap" && dataUser.x_node
|
|
5505
|
+
},
|
|
5506
|
+
{
|
|
5507
|
+
onSuccess: (detailData) => {
|
|
5508
|
+
setTempSelectedOption({
|
|
5509
|
+
value: detailData?.[0]?.id,
|
|
5510
|
+
label: detailData?.[0]?.display_name
|
|
5511
|
+
});
|
|
5512
|
+
},
|
|
5513
|
+
onError: (error) => {
|
|
5514
|
+
console.log("error", error);
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
);
|
|
5518
|
+
return;
|
|
5519
|
+
}
|
|
5497
5520
|
setTempSelectedOption({
|
|
5498
5521
|
value: propValue?.id,
|
|
5499
5522
|
label: propValue?.display_name
|
|
@@ -5520,7 +5543,7 @@ var many2oneFieldController = (props) => {
|
|
|
5520
5543
|
}, [debouncedInputValue]);
|
|
5521
5544
|
const handleChooseRecord = useCallback4(
|
|
5522
5545
|
(idRecord) => {
|
|
5523
|
-
const newOption =
|
|
5546
|
+
const newOption = listOptions?.find(
|
|
5524
5547
|
(option) => option.value === idRecord
|
|
5525
5548
|
);
|
|
5526
5549
|
if (newOption) {
|
|
@@ -5541,7 +5564,7 @@ var many2oneFieldController = (props) => {
|
|
|
5541
5564
|
}
|
|
5542
5565
|
setIsShowModalMany2Many(false);
|
|
5543
5566
|
},
|
|
5544
|
-
[
|
|
5567
|
+
[listOptions, methods, name, onChange]
|
|
5545
5568
|
);
|
|
5546
5569
|
const handleClose = useCallback4(() => setIsShowModalMany2Many(false), []);
|
|
5547
5570
|
const handleSelectChange = useCallback4(
|
|
@@ -5573,7 +5596,6 @@ var many2oneFieldController = (props) => {
|
|
|
5573
5596
|
isShowModalMany2Many,
|
|
5574
5597
|
isFetching,
|
|
5575
5598
|
initValue,
|
|
5576
|
-
menuList,
|
|
5577
5599
|
handleChooseRecord,
|
|
5578
5600
|
handleClose,
|
|
5579
5601
|
handleSelectChange,
|
|
@@ -5582,11 +5604,12 @@ var many2oneFieldController = (props) => {
|
|
|
5582
5604
|
allowShowDetail,
|
|
5583
5605
|
contextObject,
|
|
5584
5606
|
tempSelectedOption,
|
|
5585
|
-
|
|
5607
|
+
listOptions,
|
|
5586
5608
|
fetchMoreOptions,
|
|
5587
5609
|
domainObject,
|
|
5588
5610
|
setIsShowModalMany2Many,
|
|
5589
|
-
setDomainObject
|
|
5611
|
+
setDomainObject,
|
|
5612
|
+
options: (0, utils_exports.evalJSONContext)(fieldOptions)
|
|
5590
5613
|
};
|
|
5591
5614
|
};
|
|
5592
5615
|
|
|
@@ -7174,7 +7197,7 @@ var tableController = ({ data }) => {
|
|
|
7174
7197
|
|
|
7175
7198
|
// src/widget/advance/table/table-group/controller.ts
|
|
7176
7199
|
import { useEffect as useEffect15, useMemo as useMemo12, useState as useState14 } from "react";
|
|
7177
|
-
import { useAppSelector
|
|
7200
|
+
import { useAppSelector, selectList } from "@fctc/interface-logic/store";
|
|
7178
7201
|
var tableGroupController = (props) => {
|
|
7179
7202
|
const { env } = (0, provider_exports.useEnv)();
|
|
7180
7203
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
@@ -7191,7 +7214,7 @@ var tableGroupController = (props) => {
|
|
|
7191
7214
|
setSelectedRowKeys
|
|
7192
7215
|
} = props;
|
|
7193
7216
|
const [pageGroup, setPageGroup] = useState14(0);
|
|
7194
|
-
const { selectedRowKeys } =
|
|
7217
|
+
const { selectedRowKeys } = useAppSelector(selectList);
|
|
7195
7218
|
const [isShowGroup, setIsShowGroup] = useState14(false);
|
|
7196
7219
|
const [colEmptyGroup, setColEmptyGroup] = useState14({
|
|
7197
7220
|
fromStart: 1,
|
|
@@ -7571,6 +7594,13 @@ var searchController = ({
|
|
|
7571
7594
|
|
|
7572
7595
|
// src/index.ts
|
|
7573
7596
|
__reExport(index_exports, utils_exports);
|
|
7597
|
+
|
|
7598
|
+
// src/store.ts
|
|
7599
|
+
var store_exports = {};
|
|
7600
|
+
__reExport(store_exports, store_star);
|
|
7601
|
+
import * as store_star from "@fctc/interface-logic/store";
|
|
7602
|
+
|
|
7603
|
+
// src/index.ts
|
|
7574
7604
|
__reExport(index_exports, store_exports);
|
|
7575
7605
|
|
|
7576
7606
|
// src/constants.ts
|
package/dist/widget.d.mts
CHANGED
|
@@ -36,7 +36,6 @@ declare const many2oneFieldController: (props: IMany2OneProps) => {
|
|
|
36
36
|
isShowModalMany2Many: boolean;
|
|
37
37
|
isFetching: boolean;
|
|
38
38
|
initValue: any;
|
|
39
|
-
menuList: any;
|
|
40
39
|
handleChooseRecord: (idRecord: number) => void;
|
|
41
40
|
handleClose: () => void;
|
|
42
41
|
handleSelectChange: (selectedOption: any) => void;
|
|
@@ -45,11 +44,12 @@ declare const many2oneFieldController: (props: IMany2OneProps) => {
|
|
|
45
44
|
allowShowDetail: any;
|
|
46
45
|
contextObject: any;
|
|
47
46
|
tempSelectedOption: any;
|
|
48
|
-
|
|
47
|
+
listOptions: never[];
|
|
49
48
|
fetchMoreOptions: () => void;
|
|
50
49
|
domainObject: null;
|
|
51
50
|
setIsShowModalMany2Many: react.Dispatch<react.SetStateAction<boolean>>;
|
|
52
51
|
setDomainObject: react.Dispatch<react.SetStateAction<null>>;
|
|
52
|
+
options: any;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
type Option = {
|
package/dist/widget.d.ts
CHANGED
|
@@ -36,7 +36,6 @@ declare const many2oneFieldController: (props: IMany2OneProps) => {
|
|
|
36
36
|
isShowModalMany2Many: boolean;
|
|
37
37
|
isFetching: boolean;
|
|
38
38
|
initValue: any;
|
|
39
|
-
menuList: any;
|
|
40
39
|
handleChooseRecord: (idRecord: number) => void;
|
|
41
40
|
handleClose: () => void;
|
|
42
41
|
handleSelectChange: (selectedOption: any) => void;
|
|
@@ -45,11 +44,12 @@ declare const many2oneFieldController: (props: IMany2OneProps) => {
|
|
|
45
44
|
allowShowDetail: any;
|
|
46
45
|
contextObject: any;
|
|
47
46
|
tempSelectedOption: any;
|
|
48
|
-
|
|
47
|
+
listOptions: never[];
|
|
49
48
|
fetchMoreOptions: () => void;
|
|
50
49
|
domainObject: null;
|
|
51
50
|
setIsShowModalMany2Many: react.Dispatch<react.SetStateAction<boolean>>;
|
|
52
51
|
setDomainObject: react.Dispatch<react.SetStateAction<null>>;
|
|
52
|
+
options: any;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
type Option = {
|
package/dist/widget.js
CHANGED
|
@@ -4556,10 +4556,6 @@ var useListData = ({
|
|
|
4556
4556
|
};
|
|
4557
4557
|
};
|
|
4558
4558
|
|
|
4559
|
-
// src/store.ts
|
|
4560
|
-
var store_exports = {};
|
|
4561
|
-
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
4562
|
-
|
|
4563
4559
|
// src/widget/basic/many2one-field/controller.ts
|
|
4564
4560
|
var many2oneFieldController = (props) => {
|
|
4565
4561
|
const {
|
|
@@ -4574,18 +4570,20 @@ var many2oneFieldController = (props) => {
|
|
|
4574
4570
|
options: fieldOptions,
|
|
4575
4571
|
showDetail,
|
|
4576
4572
|
service,
|
|
4577
|
-
xNode
|
|
4573
|
+
xNode,
|
|
4574
|
+
isForm
|
|
4578
4575
|
} = props;
|
|
4579
|
-
const { action } = useAppProvider();
|
|
4580
4576
|
const { env } = (0, provider_exports.useEnv)();
|
|
4581
|
-
const
|
|
4577
|
+
const { action, user } = useAppProvider();
|
|
4578
|
+
const { useGetSelection: useGetSelection3, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
|
|
4579
|
+
const [listOptions, setListOptions] = (0, import_react16.useState)([]);
|
|
4582
4580
|
const [inputValue, setInputValue] = (0, import_react16.useState)("");
|
|
4583
4581
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
4584
4582
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react16.useState)(false);
|
|
4585
4583
|
const [tempSelectedOption, setTempSelectedOption] = (0, import_react16.useState)(null);
|
|
4586
4584
|
const [domainModal, setDomainModal] = (0, import_react16.useState)(null);
|
|
4587
4585
|
const [domainObject, setDomainObject] = (0, import_react16.useState)(null);
|
|
4588
|
-
const
|
|
4586
|
+
const dataUser = user?.userProfile?.data;
|
|
4589
4587
|
const initValue = methods?.getValues(name);
|
|
4590
4588
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
4591
4589
|
const contextObject = {
|
|
@@ -4593,7 +4591,7 @@ var many2oneFieldController = (props) => {
|
|
|
4593
4591
|
...fieldContext,
|
|
4594
4592
|
...env?.context
|
|
4595
4593
|
};
|
|
4596
|
-
const
|
|
4594
|
+
const fetchGetDetail = useGetDetail2();
|
|
4597
4595
|
const data = {
|
|
4598
4596
|
model: relation,
|
|
4599
4597
|
domain: domainObject,
|
|
@@ -4623,7 +4621,7 @@ var many2oneFieldController = (props) => {
|
|
|
4623
4621
|
})) || [];
|
|
4624
4622
|
}, [dataOfSelection]);
|
|
4625
4623
|
(0, import_react16.useEffect)(() => {
|
|
4626
|
-
|
|
4624
|
+
setListOptions(selectOptions);
|
|
4627
4625
|
setDomainModal(domainObject);
|
|
4628
4626
|
}, [selectOptions]);
|
|
4629
4627
|
const parsedFormValues = (0, import_react16.useMemo)(
|
|
@@ -4648,6 +4646,34 @@ var many2oneFieldController = (props) => {
|
|
|
4648
4646
|
methods?.setValue(name, null);
|
|
4649
4647
|
setTempSelectedOption(null);
|
|
4650
4648
|
} else if (propValue) {
|
|
4649
|
+
if (isForm && fieldOptions?.includes("service") && fieldOptions?.includes("type") && fieldOptions?.includes("model")) {
|
|
4650
|
+
const optionsMany2OneField = fieldOptions ? (0, utils_exports.evalJSONContext)(fieldOptions) : null;
|
|
4651
|
+
fetchGetDetail.mutate(
|
|
4652
|
+
{
|
|
4653
|
+
model: optionsMany2OneField?.model,
|
|
4654
|
+
ids: propValue,
|
|
4655
|
+
specification: {
|
|
4656
|
+
id: {},
|
|
4657
|
+
display_name: {}
|
|
4658
|
+
},
|
|
4659
|
+
context: { ...env.context },
|
|
4660
|
+
service: optionsMany2OneField ? optionsMany2OneField?.service : service,
|
|
4661
|
+
xNode: service == "wesap" && dataUser.x_node
|
|
4662
|
+
},
|
|
4663
|
+
{
|
|
4664
|
+
onSuccess: (detailData) => {
|
|
4665
|
+
setTempSelectedOption({
|
|
4666
|
+
value: detailData?.[0]?.id,
|
|
4667
|
+
label: detailData?.[0]?.display_name
|
|
4668
|
+
});
|
|
4669
|
+
},
|
|
4670
|
+
onError: (error) => {
|
|
4671
|
+
console.log("error", error);
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4674
|
+
);
|
|
4675
|
+
return;
|
|
4676
|
+
}
|
|
4651
4677
|
setTempSelectedOption({
|
|
4652
4678
|
value: propValue?.id,
|
|
4653
4679
|
label: propValue?.display_name
|
|
@@ -4674,7 +4700,7 @@ var many2oneFieldController = (props) => {
|
|
|
4674
4700
|
}, [debouncedInputValue]);
|
|
4675
4701
|
const handleChooseRecord = (0, import_react16.useCallback)(
|
|
4676
4702
|
(idRecord) => {
|
|
4677
|
-
const newOption =
|
|
4703
|
+
const newOption = listOptions?.find(
|
|
4678
4704
|
(option) => option.value === idRecord
|
|
4679
4705
|
);
|
|
4680
4706
|
if (newOption) {
|
|
@@ -4695,7 +4721,7 @@ var many2oneFieldController = (props) => {
|
|
|
4695
4721
|
}
|
|
4696
4722
|
setIsShowModalMany2Many(false);
|
|
4697
4723
|
},
|
|
4698
|
-
[
|
|
4724
|
+
[listOptions, methods, name, onChange]
|
|
4699
4725
|
);
|
|
4700
4726
|
const handleClose = (0, import_react16.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
4701
4727
|
const handleSelectChange = (0, import_react16.useCallback)(
|
|
@@ -4727,7 +4753,6 @@ var many2oneFieldController = (props) => {
|
|
|
4727
4753
|
isShowModalMany2Many,
|
|
4728
4754
|
isFetching,
|
|
4729
4755
|
initValue,
|
|
4730
|
-
menuList,
|
|
4731
4756
|
handleChooseRecord,
|
|
4732
4757
|
handleClose,
|
|
4733
4758
|
handleSelectChange,
|
|
@@ -4736,11 +4761,12 @@ var many2oneFieldController = (props) => {
|
|
|
4736
4761
|
allowShowDetail,
|
|
4737
4762
|
contextObject,
|
|
4738
4763
|
tempSelectedOption,
|
|
4739
|
-
|
|
4764
|
+
listOptions,
|
|
4740
4765
|
fetchMoreOptions,
|
|
4741
4766
|
domainObject,
|
|
4742
4767
|
setIsShowModalMany2Many,
|
|
4743
|
-
setDomainObject
|
|
4768
|
+
setDomainObject,
|
|
4769
|
+
options: (0, utils_exports.evalJSONContext)(fieldOptions)
|
|
4744
4770
|
};
|
|
4745
4771
|
};
|
|
4746
4772
|
|
|
@@ -6328,7 +6354,7 @@ var tableController = ({ data }) => {
|
|
|
6328
6354
|
|
|
6329
6355
|
// src/widget/advance/table/table-group/controller.ts
|
|
6330
6356
|
var import_react25 = require("react");
|
|
6331
|
-
var
|
|
6357
|
+
var import_store = require("@fctc/interface-logic/store");
|
|
6332
6358
|
var tableGroupController = (props) => {
|
|
6333
6359
|
const { env } = (0, provider_exports.useEnv)();
|
|
6334
6360
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
@@ -6345,7 +6371,7 @@ var tableGroupController = (props) => {
|
|
|
6345
6371
|
setSelectedRowKeys
|
|
6346
6372
|
} = props;
|
|
6347
6373
|
const [pageGroup, setPageGroup] = (0, import_react25.useState)(0);
|
|
6348
|
-
const { selectedRowKeys } = (0,
|
|
6374
|
+
const { selectedRowKeys } = (0, import_store.useAppSelector)(import_store.selectList);
|
|
6349
6375
|
const [isShowGroup, setIsShowGroup] = (0, import_react25.useState)(false);
|
|
6350
6376
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react25.useState)({
|
|
6351
6377
|
fromStart: 1,
|
package/dist/widget.mjs
CHANGED
|
@@ -4613,11 +4613,6 @@ var useListData = ({
|
|
|
4613
4613
|
};
|
|
4614
4614
|
};
|
|
4615
4615
|
|
|
4616
|
-
// src/store.ts
|
|
4617
|
-
var store_exports = {};
|
|
4618
|
-
__reExport(store_exports, store_star);
|
|
4619
|
-
import * as store_star from "@fctc/interface-logic/store";
|
|
4620
|
-
|
|
4621
4616
|
// src/widget/basic/many2one-field/controller.ts
|
|
4622
4617
|
var many2oneFieldController = (props) => {
|
|
4623
4618
|
const {
|
|
@@ -4632,18 +4627,20 @@ var many2oneFieldController = (props) => {
|
|
|
4632
4627
|
options: fieldOptions,
|
|
4633
4628
|
showDetail,
|
|
4634
4629
|
service,
|
|
4635
|
-
xNode
|
|
4630
|
+
xNode,
|
|
4631
|
+
isForm
|
|
4636
4632
|
} = props;
|
|
4637
|
-
const { action } = useAppProvider();
|
|
4638
4633
|
const { env } = (0, provider_exports.useEnv)();
|
|
4639
|
-
const
|
|
4634
|
+
const { action, user } = useAppProvider();
|
|
4635
|
+
const { useGetSelection: useGetSelection3, useGetDetail: useGetDetail2 } = (0, provider_exports.useService)();
|
|
4636
|
+
const [listOptions, setListOptions] = useState7([]);
|
|
4640
4637
|
const [inputValue, setInputValue] = useState7("");
|
|
4641
4638
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
4642
4639
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = useState7(false);
|
|
4643
4640
|
const [tempSelectedOption, setTempSelectedOption] = useState7(null);
|
|
4644
4641
|
const [domainModal, setDomainModal] = useState7(null);
|
|
4645
4642
|
const [domainObject, setDomainObject] = useState7(null);
|
|
4646
|
-
const
|
|
4643
|
+
const dataUser = user?.userProfile?.data;
|
|
4647
4644
|
const initValue = methods?.getValues(name);
|
|
4648
4645
|
const optionsObject = (0, utils_exports.evalJSONContext)(fieldOptions) || {};
|
|
4649
4646
|
const contextObject = {
|
|
@@ -4651,7 +4648,7 @@ var many2oneFieldController = (props) => {
|
|
|
4651
4648
|
...fieldContext,
|
|
4652
4649
|
...env?.context
|
|
4653
4650
|
};
|
|
4654
|
-
const
|
|
4651
|
+
const fetchGetDetail = useGetDetail2();
|
|
4655
4652
|
const data = {
|
|
4656
4653
|
model: relation,
|
|
4657
4654
|
domain: domainObject,
|
|
@@ -4681,7 +4678,7 @@ var many2oneFieldController = (props) => {
|
|
|
4681
4678
|
})) || [];
|
|
4682
4679
|
}, [dataOfSelection]);
|
|
4683
4680
|
useEffect10(() => {
|
|
4684
|
-
|
|
4681
|
+
setListOptions(selectOptions);
|
|
4685
4682
|
setDomainModal(domainObject);
|
|
4686
4683
|
}, [selectOptions]);
|
|
4687
4684
|
const parsedFormValues = useMemo8(
|
|
@@ -4706,6 +4703,34 @@ var many2oneFieldController = (props) => {
|
|
|
4706
4703
|
methods?.setValue(name, null);
|
|
4707
4704
|
setTempSelectedOption(null);
|
|
4708
4705
|
} else if (propValue) {
|
|
4706
|
+
if (isForm && fieldOptions?.includes("service") && fieldOptions?.includes("type") && fieldOptions?.includes("model")) {
|
|
4707
|
+
const optionsMany2OneField = fieldOptions ? (0, utils_exports.evalJSONContext)(fieldOptions) : null;
|
|
4708
|
+
fetchGetDetail.mutate(
|
|
4709
|
+
{
|
|
4710
|
+
model: optionsMany2OneField?.model,
|
|
4711
|
+
ids: propValue,
|
|
4712
|
+
specification: {
|
|
4713
|
+
id: {},
|
|
4714
|
+
display_name: {}
|
|
4715
|
+
},
|
|
4716
|
+
context: { ...env.context },
|
|
4717
|
+
service: optionsMany2OneField ? optionsMany2OneField?.service : service,
|
|
4718
|
+
xNode: service == "wesap" && dataUser.x_node
|
|
4719
|
+
},
|
|
4720
|
+
{
|
|
4721
|
+
onSuccess: (detailData) => {
|
|
4722
|
+
setTempSelectedOption({
|
|
4723
|
+
value: detailData?.[0]?.id,
|
|
4724
|
+
label: detailData?.[0]?.display_name
|
|
4725
|
+
});
|
|
4726
|
+
},
|
|
4727
|
+
onError: (error) => {
|
|
4728
|
+
console.log("error", error);
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4731
|
+
);
|
|
4732
|
+
return;
|
|
4733
|
+
}
|
|
4709
4734
|
setTempSelectedOption({
|
|
4710
4735
|
value: propValue?.id,
|
|
4711
4736
|
label: propValue?.display_name
|
|
@@ -4732,7 +4757,7 @@ var many2oneFieldController = (props) => {
|
|
|
4732
4757
|
}, [debouncedInputValue]);
|
|
4733
4758
|
const handleChooseRecord = useCallback4(
|
|
4734
4759
|
(idRecord) => {
|
|
4735
|
-
const newOption =
|
|
4760
|
+
const newOption = listOptions?.find(
|
|
4736
4761
|
(option) => option.value === idRecord
|
|
4737
4762
|
);
|
|
4738
4763
|
if (newOption) {
|
|
@@ -4753,7 +4778,7 @@ var many2oneFieldController = (props) => {
|
|
|
4753
4778
|
}
|
|
4754
4779
|
setIsShowModalMany2Many(false);
|
|
4755
4780
|
},
|
|
4756
|
-
[
|
|
4781
|
+
[listOptions, methods, name, onChange]
|
|
4757
4782
|
);
|
|
4758
4783
|
const handleClose = useCallback4(() => setIsShowModalMany2Many(false), []);
|
|
4759
4784
|
const handleSelectChange = useCallback4(
|
|
@@ -4785,7 +4810,6 @@ var many2oneFieldController = (props) => {
|
|
|
4785
4810
|
isShowModalMany2Many,
|
|
4786
4811
|
isFetching,
|
|
4787
4812
|
initValue,
|
|
4788
|
-
menuList,
|
|
4789
4813
|
handleChooseRecord,
|
|
4790
4814
|
handleClose,
|
|
4791
4815
|
handleSelectChange,
|
|
@@ -4794,11 +4818,12 @@ var many2oneFieldController = (props) => {
|
|
|
4794
4818
|
allowShowDetail,
|
|
4795
4819
|
contextObject,
|
|
4796
4820
|
tempSelectedOption,
|
|
4797
|
-
|
|
4821
|
+
listOptions,
|
|
4798
4822
|
fetchMoreOptions,
|
|
4799
4823
|
domainObject,
|
|
4800
4824
|
setIsShowModalMany2Many,
|
|
4801
|
-
setDomainObject
|
|
4825
|
+
setDomainObject,
|
|
4826
|
+
options: (0, utils_exports.evalJSONContext)(fieldOptions)
|
|
4802
4827
|
};
|
|
4803
4828
|
};
|
|
4804
4829
|
|
|
@@ -6386,7 +6411,7 @@ var tableController = ({ data }) => {
|
|
|
6386
6411
|
|
|
6387
6412
|
// src/widget/advance/table/table-group/controller.ts
|
|
6388
6413
|
import { useEffect as useEffect15, useMemo as useMemo12, useState as useState14 } from "react";
|
|
6389
|
-
import { useAppSelector
|
|
6414
|
+
import { useAppSelector, selectList } from "@fctc/interface-logic/store";
|
|
6390
6415
|
var tableGroupController = (props) => {
|
|
6391
6416
|
const { env } = (0, provider_exports.useEnv)();
|
|
6392
6417
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
@@ -6403,7 +6428,7 @@ var tableGroupController = (props) => {
|
|
|
6403
6428
|
setSelectedRowKeys
|
|
6404
6429
|
} = props;
|
|
6405
6430
|
const [pageGroup, setPageGroup] = useState14(0);
|
|
6406
|
-
const { selectedRowKeys } =
|
|
6431
|
+
const { selectedRowKeys } = useAppSelector(selectList);
|
|
6407
6432
|
const [isShowGroup, setIsShowGroup] = useState14(false);
|
|
6408
6433
|
const [colEmptyGroup, setColEmptyGroup] = useState14({
|
|
6409
6434
|
fromStart: 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fctc/widget-logic",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.5",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"test": "jest"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@fctc/interface-logic": "^3.2.
|
|
77
|
+
"@fctc/interface-logic": "^3.2.8",
|
|
78
78
|
"@headlessui/react": "^2.2.6",
|
|
79
79
|
"@tanstack/react-query": "^5.84.0",
|
|
80
80
|
"i18next": "^25.3.2",
|