@fctc/widget-logic 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks.js +17 -11
- package/dist/hooks.mjs +48 -20
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +88 -52
- package/dist/index.mjs +103 -60
- package/dist/utils.d.mts +10 -1
- package/dist/utils.d.ts +10 -1
- package/dist/utils.js +39 -0
- package/dist/utils.mjs +61 -1
- package/dist/widget.d.mts +1 -1
- package/dist/widget.d.ts +1 -1
- package/dist/widget.js +50 -48
- package/dist/widget.mjs +62 -53
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -4452,6 +4452,12 @@ var import_react7 = require("react");
|
|
|
4452
4452
|
|
|
4453
4453
|
// src/utils/function.ts
|
|
4454
4454
|
var import_react6 = require("react");
|
|
4455
|
+
|
|
4456
|
+
// src/store.ts
|
|
4457
|
+
var store_exports = {};
|
|
4458
|
+
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
4459
|
+
|
|
4460
|
+
// src/utils/function.ts
|
|
4455
4461
|
var countSum = (data, field) => {
|
|
4456
4462
|
if (!data || !field) return 0;
|
|
4457
4463
|
return data.reduce(
|
|
@@ -4606,19 +4612,19 @@ function useStorageState(key) {
|
|
|
4606
4612
|
|
|
4607
4613
|
// src/hooks/core/use-list-data.ts
|
|
4608
4614
|
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
4609
|
-
var
|
|
4615
|
+
var import_store5 = require("@fctc/interface-logic/store");
|
|
4610
4616
|
var import_utils3 = require("@fctc/interface-logic/utils");
|
|
4611
4617
|
var useListData = ({
|
|
4612
4618
|
action,
|
|
4613
4619
|
context,
|
|
4614
4620
|
viewResponse
|
|
4615
4621
|
}) => {
|
|
4616
|
-
const { groupByDomain } = (0,
|
|
4622
|
+
const { groupByDomain } = (0, import_store5.useAppSelector)(import_store5.selectSearch);
|
|
4617
4623
|
const initModel = (0, import_hooks6.useModel)();
|
|
4618
4624
|
const [type, setType] = (0, import_react7.useState)("list");
|
|
4619
4625
|
const [mode, setMode] = (0, import_react7.useState)("month");
|
|
4620
4626
|
const [currentDate, setCurrentDate] = (0, import_react7.useState)(/* @__PURE__ */ new Date());
|
|
4621
|
-
const { pageLimit, page, order } = (0,
|
|
4627
|
+
const { pageLimit, page, order } = (0, import_store5.useAppSelector)(import_store5.selectList);
|
|
4622
4628
|
const listDataProps = (0, import_react7.useMemo)(() => {
|
|
4623
4629
|
const actData = action?.result;
|
|
4624
4630
|
if (!viewResponse || !actData || !context) {
|
|
@@ -4750,10 +4756,10 @@ var import_react9 = require("react");
|
|
|
4750
4756
|
var import_react_i18next = require("react-i18next");
|
|
4751
4757
|
var import_environment5 = require("@fctc/interface-logic/environment");
|
|
4752
4758
|
var import_hooks8 = require("@fctc/interface-logic/hooks");
|
|
4753
|
-
var
|
|
4759
|
+
var import_store6 = require("@fctc/interface-logic/store");
|
|
4754
4760
|
var useProfile = (accessToken) => {
|
|
4755
4761
|
const getProfile = (0, import_hooks8.useGetProfile)();
|
|
4756
|
-
const dispatch = (0,
|
|
4762
|
+
const dispatch = (0, import_store6.useAppDispatch)();
|
|
4757
4763
|
const { i18n: i18n2 } = (0, import_react_i18next.useTranslation)();
|
|
4758
4764
|
const fetchUserProfile = async () => {
|
|
4759
4765
|
return await getProfile.mutateAsync();
|
|
@@ -4768,7 +4774,7 @@ var useProfile = (accessToken) => {
|
|
|
4768
4774
|
const userInfo = userInfoQuery.data;
|
|
4769
4775
|
const env = (0, import_environment5.getEnv)();
|
|
4770
4776
|
env.setUid(userInfo?.sub);
|
|
4771
|
-
dispatch((0,
|
|
4777
|
+
dispatch((0, import_store6.setDataUser)(userInfo));
|
|
4772
4778
|
const userLocale = languages.find((lang) => lang?.id === userInfo?.locale);
|
|
4773
4779
|
env.setLang(userLocale?.id);
|
|
4774
4780
|
i18n2.changeLanguage(userLocale?.id.split("_")[0]);
|
|
@@ -4833,11 +4839,11 @@ var useViewV2 = ({
|
|
|
4833
4839
|
|
|
4834
4840
|
// src/hooks/core/use-auth.ts
|
|
4835
4841
|
var import_hooks10 = require("@fctc/interface-logic/hooks");
|
|
4836
|
-
var
|
|
4842
|
+
var import_store7 = require("@fctc/interface-logic/store");
|
|
4837
4843
|
var useAuth = () => {
|
|
4838
4844
|
const [[isLoading, accessToken], setAccessToken] = useStorageState("TOKEN");
|
|
4839
4845
|
const loginMutate = (0, import_hooks10.useLoginCredential)();
|
|
4840
|
-
const dispatch = (0,
|
|
4846
|
+
const dispatch = (0, import_store7.useAppDispatch)();
|
|
4841
4847
|
const signIn = async (email, password) => {
|
|
4842
4848
|
try {
|
|
4843
4849
|
loginMutate.mutate(
|
|
@@ -4858,9 +4864,9 @@ var useAuth = () => {
|
|
|
4858
4864
|
}
|
|
4859
4865
|
};
|
|
4860
4866
|
const signOut = async () => {
|
|
4861
|
-
dispatch((0,
|
|
4862
|
-
dispatch((0,
|
|
4863
|
-
dispatch((0,
|
|
4867
|
+
dispatch((0, import_store7.setMenuList)([]));
|
|
4868
|
+
dispatch((0, import_store7.setDataUser)({}));
|
|
4869
|
+
dispatch((0, import_store7.setProfile)({}));
|
|
4864
4870
|
setAccessToken(null);
|
|
4865
4871
|
};
|
|
4866
4872
|
return {
|
|
@@ -5039,7 +5045,7 @@ function useDebounce(value, delay) {
|
|
|
5039
5045
|
__reExport(hooks_exports, require("@fctc/interface-logic/hooks"));
|
|
5040
5046
|
|
|
5041
5047
|
// src/widget/advance/table/table-body/controller.ts
|
|
5042
|
-
var
|
|
5048
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
5043
5049
|
var import_react15 = require("react");
|
|
5044
5050
|
var tableBodyController = (props) => {
|
|
5045
5051
|
const {
|
|
@@ -5052,7 +5058,7 @@ var tableBodyController = (props) => {
|
|
|
5052
5058
|
selectedRowKeysRef,
|
|
5053
5059
|
onClickRow
|
|
5054
5060
|
} = props;
|
|
5055
|
-
const appDispatch = (0,
|
|
5061
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
5056
5062
|
const checked = (0, import_react15.useMemo)(() => {
|
|
5057
5063
|
if (!row?.id) return false;
|
|
5058
5064
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -5069,7 +5075,7 @@ var tableBodyController = (props) => {
|
|
|
5069
5075
|
}
|
|
5070
5076
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
5071
5077
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
5072
|
-
appDispatch((0,
|
|
5078
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(newSelectedRowKeys));
|
|
5073
5079
|
};
|
|
5074
5080
|
const handleClickRow = (col, row2) => {
|
|
5075
5081
|
onClickRow(col, row2);
|
|
@@ -5082,13 +5088,13 @@ var tableBodyController = (props) => {
|
|
|
5082
5088
|
(id) => id !== row.id
|
|
5083
5089
|
);
|
|
5084
5090
|
selectedRowKeysRef.current = filtered;
|
|
5085
|
-
appDispatch((0,
|
|
5091
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(filtered));
|
|
5086
5092
|
} else {
|
|
5087
5093
|
const unique = Array.from(
|
|
5088
5094
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
5089
5095
|
);
|
|
5090
5096
|
selectedRowKeysRef.current = unique;
|
|
5091
|
-
appDispatch((0,
|
|
5097
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(unique));
|
|
5092
5098
|
}
|
|
5093
5099
|
}
|
|
5094
5100
|
}, [isAutoSelect]);
|
|
@@ -5106,35 +5112,35 @@ var tableBodyController = (props) => {
|
|
|
5106
5112
|
};
|
|
5107
5113
|
|
|
5108
5114
|
// src/widget/advance/table/table-head/controller.ts
|
|
5109
|
-
var
|
|
5115
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
5110
5116
|
var tableHeadController = (props) => {
|
|
5111
5117
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
5112
|
-
const appDispatch = (0,
|
|
5113
|
-
const { groupByDomain } = (0,
|
|
5118
|
+
const appDispatch = (0, import_store9.useAppDispatch)();
|
|
5119
|
+
const { groupByDomain } = (0, import_store9.useAppSelector)(import_store9.selectSearch);
|
|
5114
5120
|
const handleCheckBoxAll = (event) => {
|
|
5115
5121
|
if (event?.target?.checked && typeTable === "list") {
|
|
5116
5122
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
5117
|
-
appDispatch((0,
|
|
5123
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(allRowKeys));
|
|
5118
5124
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
5119
5125
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
5120
5126
|
const ids = Array.from(rowsIDs)?.map(
|
|
5121
5127
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
5122
5128
|
);
|
|
5123
5129
|
if (ids?.length > 0) {
|
|
5124
|
-
appDispatch((0,
|
|
5130
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(ids));
|
|
5125
5131
|
} else {
|
|
5126
5132
|
const sum = countSum(
|
|
5127
5133
|
rows,
|
|
5128
5134
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
5129
5135
|
);
|
|
5130
5136
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
5131
|
-
appDispatch((0,
|
|
5137
|
+
appDispatch((0, import_store9.setSelectedRowKeys)(keys));
|
|
5132
5138
|
}
|
|
5133
5139
|
if (selectedRowKeysRef) {
|
|
5134
5140
|
selectedRowKeysRef.current = [];
|
|
5135
5141
|
}
|
|
5136
5142
|
} else {
|
|
5137
|
-
appDispatch((0,
|
|
5143
|
+
appDispatch((0, import_store9.setSelectedRowKeys)([]));
|
|
5138
5144
|
}
|
|
5139
5145
|
};
|
|
5140
5146
|
return {
|
|
@@ -5144,7 +5150,7 @@ var tableHeadController = (props) => {
|
|
|
5144
5150
|
|
|
5145
5151
|
// src/widget/advance/table/table-view/controller.ts
|
|
5146
5152
|
var import_react16 = require("react");
|
|
5147
|
-
var
|
|
5153
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
5148
5154
|
var import_utils5 = require("@fctc/interface-logic/utils");
|
|
5149
5155
|
var tableController = ({ data }) => {
|
|
5150
5156
|
const [rows, setRows] = (0, import_react16.useState)(data.records || []);
|
|
@@ -5992,7 +5998,7 @@ var i18n_default = import_i18next.default;
|
|
|
5992
5998
|
|
|
5993
5999
|
// src/widget/advance/table/table-group/controller.ts
|
|
5994
6000
|
var import_hooks13 = require("@fctc/interface-logic/hooks");
|
|
5995
|
-
var
|
|
6001
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
5996
6002
|
|
|
5997
6003
|
// src/environment.ts
|
|
5998
6004
|
var environment_exports = {};
|
|
@@ -6020,9 +6026,9 @@ var tableGroupController = (props) => {
|
|
|
6020
6026
|
selectedRowKeysRef
|
|
6021
6027
|
} = props;
|
|
6022
6028
|
const [pageGroup, setPageGroup] = (0, import_react17.useState)(0);
|
|
6023
|
-
const { groupByDomain, selectedTags } = (0,
|
|
6024
|
-
const { selectedRowKeys } = (0,
|
|
6025
|
-
const appDispatch = (0,
|
|
6029
|
+
const { groupByDomain, selectedTags } = (0, import_store11.useAppSelector)(import_store11.selectSearch);
|
|
6030
|
+
const { selectedRowKeys } = (0, import_store11.useAppSelector)(import_store11.selectList);
|
|
6031
|
+
const appDispatch = (0, import_store11.useAppDispatch)();
|
|
6026
6032
|
const { toDataJS } = (0, import_hooks13.useOdooDataTransform)();
|
|
6027
6033
|
const initVal = toDataJS(row, viewData, model);
|
|
6028
6034
|
const [isShowGroup, setIsShowGroup] = (0, import_react17.useState)(false);
|
|
@@ -6108,14 +6114,14 @@ var tableGroupController = (props) => {
|
|
|
6108
6114
|
const filteredIds = selectedRowKeys.filter(
|
|
6109
6115
|
(id) => !ids.includes(id)
|
|
6110
6116
|
);
|
|
6111
|
-
appDispatch((0,
|
|
6117
|
+
appDispatch((0, import_store11.setSelectedRowKeys)(filteredIds));
|
|
6112
6118
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6113
6119
|
const clonedKeys = [...selectedRowKeys];
|
|
6114
|
-
appDispatch((0,
|
|
6115
|
-
setTimeout(() => appDispatch((0,
|
|
6120
|
+
appDispatch((0, import_store11.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6121
|
+
setTimeout(() => appDispatch((0, import_store11.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6116
6122
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6117
6123
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6118
|
-
appDispatch((0,
|
|
6124
|
+
appDispatch((0, import_store11.setSelectedRowKeys)(filteredKeys));
|
|
6119
6125
|
}
|
|
6120
6126
|
toggleShowGroup();
|
|
6121
6127
|
};
|
|
@@ -6124,8 +6130,8 @@ var tableGroupController = (props) => {
|
|
|
6124
6130
|
return;
|
|
6125
6131
|
}
|
|
6126
6132
|
const clonedKeys = [...selectedRowKeys];
|
|
6127
|
-
(0,
|
|
6128
|
-
setTimeout(() => (0,
|
|
6133
|
+
(0, import_store11.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6134
|
+
setTimeout(() => (0, import_store11.setSelectedRowKeys)(clonedKeys), 500);
|
|
6129
6135
|
}, [isQueryFetched]);
|
|
6130
6136
|
return {
|
|
6131
6137
|
handleExpandChildGroup,
|
|
@@ -6168,10 +6174,6 @@ var import_react18 = require("react");
|
|
|
6168
6174
|
var provider_exports = {};
|
|
6169
6175
|
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
6170
6176
|
|
|
6171
|
-
// src/store.ts
|
|
6172
|
-
var store_exports = {};
|
|
6173
|
-
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
6174
|
-
|
|
6175
6177
|
// src/widget/advance/search/controller.ts
|
|
6176
6178
|
var searchController = ({
|
|
6177
6179
|
viewData,
|
|
@@ -6502,7 +6504,7 @@ var searchController = ({
|
|
|
6502
6504
|
|
|
6503
6505
|
// src/widget/basic/many2many-field/controller.ts
|
|
6504
6506
|
var import_environment8 = require("@fctc/interface-logic/environment");
|
|
6505
|
-
var
|
|
6507
|
+
var import_store13 = require("@fctc/interface-logic/store");
|
|
6506
6508
|
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
6507
6509
|
var many2manyFieldController = (props) => {
|
|
6508
6510
|
const {
|
|
@@ -6520,14 +6522,14 @@ var many2manyFieldController = (props) => {
|
|
|
6520
6522
|
options,
|
|
6521
6523
|
sessionStorageUtils
|
|
6522
6524
|
} = props;
|
|
6523
|
-
const appDispatch = (0,
|
|
6525
|
+
const appDispatch = (0, import_store13.useAppDispatch)();
|
|
6524
6526
|
const actionData = sessionStorageUtils.getActionData();
|
|
6525
6527
|
const [debouncedPage] = useDebounce(page, 500);
|
|
6526
6528
|
const [order, setOrder] = (0, import_react19.useState)();
|
|
6527
6529
|
const [isLoadedData, setIsLoadedData] = (0, import_react19.useState)(false);
|
|
6528
6530
|
const [domainMany2Many, setDomainMany2Many] = (0, import_react19.useState)(domain);
|
|
6529
6531
|
const env = (0, import_environment8.getEnv)();
|
|
6530
|
-
const { selectedTags } = (0,
|
|
6532
|
+
const { selectedTags } = (0, import_store13.useAppSelector)(import_store13.selectSearch);
|
|
6531
6533
|
const viewParams = {
|
|
6532
6534
|
model: relation,
|
|
6533
6535
|
views: [
|
|
@@ -6570,8 +6572,8 @@ var many2manyFieldController = (props) => {
|
|
|
6570
6572
|
const fetchData = async () => {
|
|
6571
6573
|
try {
|
|
6572
6574
|
setDomainMany2Many(domain);
|
|
6573
|
-
appDispatch((0,
|
|
6574
|
-
appDispatch((0,
|
|
6575
|
+
appDispatch((0, import_store13.setFirstDomain)(domain));
|
|
6576
|
+
appDispatch((0, import_store13.setViewDataStore)(viewResponse));
|
|
6575
6577
|
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
6576
6578
|
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
6577
6579
|
...field
|
|
@@ -6582,7 +6584,7 @@ var many2manyFieldController = (props) => {
|
|
|
6582
6584
|
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
6583
6585
|
});
|
|
6584
6586
|
}
|
|
6585
|
-
appDispatch((0,
|
|
6587
|
+
appDispatch((0, import_store13.setPage)(0));
|
|
6586
6588
|
} catch (err) {
|
|
6587
6589
|
console.log(err);
|
|
6588
6590
|
}
|
|
@@ -6618,12 +6620,12 @@ var many2manyFieldController = (props) => {
|
|
|
6618
6620
|
fetchData();
|
|
6619
6621
|
}
|
|
6620
6622
|
return () => {
|
|
6621
|
-
appDispatch((0,
|
|
6623
|
+
appDispatch((0, import_store13.setGroupByDomain)(null));
|
|
6622
6624
|
setFields((prevFields) => ({
|
|
6623
6625
|
...prevFields,
|
|
6624
6626
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
6625
6627
|
}));
|
|
6626
|
-
appDispatch((0,
|
|
6628
|
+
appDispatch((0, import_store13.setPage)(0));
|
|
6627
6629
|
setSelectedRowKeys5([]);
|
|
6628
6630
|
setDomainMany2Many(null);
|
|
6629
6631
|
setIsLoadedData(false);
|
|
@@ -6736,7 +6738,7 @@ var many2manyTagsController = (props) => {
|
|
|
6736
6738
|
// src/widget/basic/status-bar-field/controller.ts
|
|
6737
6739
|
var import_react21 = require("react");
|
|
6738
6740
|
var import_hooks16 = require("@fctc/interface-logic/hooks");
|
|
6739
|
-
var
|
|
6741
|
+
var import_store14 = require("@fctc/interface-logic/store");
|
|
6740
6742
|
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
6741
6743
|
var durationController = (props) => {
|
|
6742
6744
|
const {
|
|
@@ -6756,7 +6758,7 @@ var durationController = (props) => {
|
|
|
6756
6758
|
};
|
|
6757
6759
|
const [disabled, setDisabled] = (0, import_react21.useState)(false);
|
|
6758
6760
|
const [modelStatus, setModalStatus] = (0, import_react21.useState)(false);
|
|
6759
|
-
const { context } = (0,
|
|
6761
|
+
const { context } = (0, import_store14.useAppSelector)(import_store14.selectEnv);
|
|
6760
6762
|
const queryKey = [`data-status-duration`, specification];
|
|
6761
6763
|
const listDataProps = {
|
|
6762
6764
|
model: relation,
|
package/dist/widget.mjs
CHANGED
|
@@ -4296,7 +4296,7 @@ var many2oneButtonController = (props) => {
|
|
|
4296
4296
|
};
|
|
4297
4297
|
|
|
4298
4298
|
// src/widget/basic/many2many-field/controller.ts
|
|
4299
|
-
import { useEffect as useEffect15, useMemo as
|
|
4299
|
+
import { useEffect as useEffect15, useMemo as useMemo13, useState as useState11 } from "react";
|
|
4300
4300
|
|
|
4301
4301
|
// src/hooks.ts
|
|
4302
4302
|
var hooks_exports = {};
|
|
@@ -4431,10 +4431,24 @@ var useDetail = (accessToken, sub) => {
|
|
|
4431
4431
|
};
|
|
4432
4432
|
|
|
4433
4433
|
// src/hooks/core/use-list-data.ts
|
|
4434
|
-
import { useMemo as
|
|
4434
|
+
import { useMemo as useMemo4, useState as useState5 } from "react";
|
|
4435
|
+
|
|
4436
|
+
// src/utils/function.ts
|
|
4437
|
+
import {
|
|
4438
|
+
useCallback as useCallback2,
|
|
4439
|
+
useEffect as useEffect5,
|
|
4440
|
+
useMemo as useMemo3,
|
|
4441
|
+
useReducer,
|
|
4442
|
+
useRef as useRef2,
|
|
4443
|
+
useState as useState4
|
|
4444
|
+
} from "react";
|
|
4445
|
+
|
|
4446
|
+
// src/store.ts
|
|
4447
|
+
var store_exports = {};
|
|
4448
|
+
__reExport(store_exports, store_star);
|
|
4449
|
+
import * as store_star from "@fctc/interface-logic/store";
|
|
4435
4450
|
|
|
4436
4451
|
// src/utils/function.ts
|
|
4437
|
-
import { useCallback as useCallback2, useEffect as useEffect5, useReducer, useRef as useRef2, useState as useState4 } from "react";
|
|
4438
4452
|
var countSum = (data, field) => {
|
|
4439
4453
|
if (!data || !field) return 0;
|
|
4440
4454
|
return data.reduce(
|
|
@@ -4590,9 +4604,9 @@ function useStorageState(key) {
|
|
|
4590
4604
|
// src/hooks/core/use-list-data.ts
|
|
4591
4605
|
import { useModel, useGetListData } from "@fctc/interface-logic/hooks";
|
|
4592
4606
|
import {
|
|
4593
|
-
useAppSelector as
|
|
4594
|
-
selectSearch,
|
|
4595
|
-
selectList
|
|
4607
|
+
useAppSelector as useAppSelector3,
|
|
4608
|
+
selectSearch as selectSearch2,
|
|
4609
|
+
selectList as selectList2
|
|
4596
4610
|
} from "@fctc/interface-logic/store";
|
|
4597
4611
|
import {
|
|
4598
4612
|
evalJSONDomain as evalJSONDomain3,
|
|
@@ -4603,13 +4617,13 @@ var useListData = ({
|
|
|
4603
4617
|
context,
|
|
4604
4618
|
viewResponse
|
|
4605
4619
|
}) => {
|
|
4606
|
-
const { groupByDomain } =
|
|
4620
|
+
const { groupByDomain } = useAppSelector3(selectSearch2);
|
|
4607
4621
|
const initModel = useModel();
|
|
4608
4622
|
const [type, setType] = useState5("list");
|
|
4609
4623
|
const [mode, setMode] = useState5("month");
|
|
4610
4624
|
const [currentDate, setCurrentDate] = useState5(/* @__PURE__ */ new Date());
|
|
4611
|
-
const { pageLimit, page, order } =
|
|
4612
|
-
const listDataProps =
|
|
4625
|
+
const { pageLimit, page, order } = useAppSelector3(selectList2);
|
|
4626
|
+
const listDataProps = useMemo4(() => {
|
|
4613
4627
|
const actData = action?.result;
|
|
4614
4628
|
if (!viewResponse || !actData || !context) {
|
|
4615
4629
|
return null;
|
|
@@ -4670,7 +4684,7 @@ var useListData = ({
|
|
|
4670
4684
|
};
|
|
4671
4685
|
|
|
4672
4686
|
// src/hooks/core/use-menu.ts
|
|
4673
|
-
import { useEffect as useEffect6, useMemo as
|
|
4687
|
+
import { useEffect as useEffect6, useMemo as useMemo5, useState as useState6 } from "react";
|
|
4674
4688
|
|
|
4675
4689
|
// src/utils/constants.ts
|
|
4676
4690
|
var languages = [
|
|
@@ -4689,7 +4703,7 @@ var useMenu = ({ context }) => {
|
|
|
4689
4703
|
const menuData = useGetMenu(context, !!context);
|
|
4690
4704
|
const [menuid, setMenuId] = useState6(void 0);
|
|
4691
4705
|
const [action, setAction] = useCallAction();
|
|
4692
|
-
const configedIconData =
|
|
4706
|
+
const configedIconData = useMemo5(() => {
|
|
4693
4707
|
const data = menuData.data;
|
|
4694
4708
|
return data?.map((item) => {
|
|
4695
4709
|
return {
|
|
@@ -4736,7 +4750,7 @@ var useMenu = ({ context }) => {
|
|
|
4736
4750
|
|
|
4737
4751
|
// src/hooks/core/use-profile.ts
|
|
4738
4752
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
4739
|
-
import { useEffect as useEffect7, useMemo as
|
|
4753
|
+
import { useEffect as useEffect7, useMemo as useMemo6 } from "react";
|
|
4740
4754
|
import { useTranslation } from "react-i18next";
|
|
4741
4755
|
import { getEnv as getEnv5 } from "@fctc/interface-logic/environment";
|
|
4742
4756
|
import { useGetProfile } from "@fctc/interface-logic/hooks";
|
|
@@ -4764,7 +4778,7 @@ var useProfile = (accessToken) => {
|
|
|
4764
4778
|
i18n2.changeLanguage(userLocale?.id.split("_")[0]);
|
|
4765
4779
|
}
|
|
4766
4780
|
}, [dispatch, userInfoQuery.data]);
|
|
4767
|
-
const context =
|
|
4781
|
+
const context = useMemo6(() => {
|
|
4768
4782
|
if (userInfoQuery.data?.sub && userInfoQuery.data?.locale) {
|
|
4769
4783
|
return {
|
|
4770
4784
|
uid: Number(userInfoQuery.data.sub),
|
|
@@ -4786,13 +4800,13 @@ var useUser = (accessToken) => {
|
|
|
4786
4800
|
};
|
|
4787
4801
|
|
|
4788
4802
|
// src/hooks/core/use-view-v2.ts
|
|
4789
|
-
import { useMemo as
|
|
4803
|
+
import { useMemo as useMemo7 } from "react";
|
|
4790
4804
|
import { useGetView } from "@fctc/interface-logic/hooks";
|
|
4791
4805
|
var useViewV2 = ({
|
|
4792
4806
|
action,
|
|
4793
4807
|
context
|
|
4794
4808
|
}) => {
|
|
4795
|
-
const viewParams =
|
|
4809
|
+
const viewParams = useMemo7(() => {
|
|
4796
4810
|
if (!action?.result) {
|
|
4797
4811
|
return void 0;
|
|
4798
4812
|
}
|
|
@@ -4867,11 +4881,11 @@ var useAuth = () => {
|
|
|
4867
4881
|
};
|
|
4868
4882
|
|
|
4869
4883
|
// src/hooks/core/use-app-provider.tsx
|
|
4870
|
-
import { createContext, useContext, useMemo as
|
|
4884
|
+
import { createContext, useContext, useMemo as useMemo9 } from "react";
|
|
4871
4885
|
|
|
4872
4886
|
// src/hooks/core/use-company.ts
|
|
4873
4887
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4874
|
-
import { useEffect as useEffect8, useMemo as
|
|
4888
|
+
import { useEffect as useEffect8, useMemo as useMemo8 } from "react";
|
|
4875
4889
|
import { getEnv as getEnv6 } from "@fctc/interface-logic/environment";
|
|
4876
4890
|
import {
|
|
4877
4891
|
useGetCurrentCompany,
|
|
@@ -4887,7 +4901,7 @@ var useCompany = (accessToken) => {
|
|
|
4887
4901
|
queryFn: fetchCurrentCompany,
|
|
4888
4902
|
enabled: !!accessToken
|
|
4889
4903
|
});
|
|
4890
|
-
const current_company_id =
|
|
4904
|
+
const current_company_id = useMemo8(() => {
|
|
4891
4905
|
return currentCompany.data?.current_company_id;
|
|
4892
4906
|
}, [currentCompany.data]);
|
|
4893
4907
|
useEffect8(() => {
|
|
@@ -4940,14 +4954,14 @@ var AppProvider = ({ children }) => {
|
|
|
4940
4954
|
const auth = useAuth();
|
|
4941
4955
|
const user = useUser(auth.accessToken);
|
|
4942
4956
|
const company = use_company_default(auth.accessToken);
|
|
4943
|
-
const menuContext =
|
|
4957
|
+
const menuContext = useMemo9(() => {
|
|
4944
4958
|
return combineContexts([user.context, company.context]);
|
|
4945
4959
|
}, [user.context, company.context]);
|
|
4946
4960
|
const menu = useMenu({ context: menuContext });
|
|
4947
|
-
const action =
|
|
4961
|
+
const action = useMemo9(() => {
|
|
4948
4962
|
return menu.state.action;
|
|
4949
4963
|
}, [menu.state.action]);
|
|
4950
|
-
const viewContext =
|
|
4964
|
+
const viewContext = useMemo9(() => {
|
|
4951
4965
|
return combineContexts([
|
|
4952
4966
|
menuContext,
|
|
4953
4967
|
{ ...evalJSONContext3(action?.result?.context) }
|
|
@@ -5039,7 +5053,7 @@ import * as hooks_star from "@fctc/interface-logic/hooks";
|
|
|
5039
5053
|
|
|
5040
5054
|
// src/widget/advance/table/table-body/controller.ts
|
|
5041
5055
|
import { useAppDispatch as useAppDispatch5, setSelectedRowKeys } from "@fctc/interface-logic/store";
|
|
5042
|
-
import { useEffect as useEffect11, useMemo as
|
|
5056
|
+
import { useEffect as useEffect11, useMemo as useMemo10 } from "react";
|
|
5043
5057
|
var tableBodyController = (props) => {
|
|
5044
5058
|
const {
|
|
5045
5059
|
checkedAll,
|
|
@@ -5052,7 +5066,7 @@ var tableBodyController = (props) => {
|
|
|
5052
5066
|
onClickRow
|
|
5053
5067
|
} = props;
|
|
5054
5068
|
const appDispatch = useAppDispatch5();
|
|
5055
|
-
const checked =
|
|
5069
|
+
const checked = useMemo10(() => {
|
|
5056
5070
|
if (!row?.id) return false;
|
|
5057
5071
|
if (selectedRowKeys?.includes(row.id)) {
|
|
5058
5072
|
return true;
|
|
@@ -5107,14 +5121,14 @@ var tableBodyController = (props) => {
|
|
|
5107
5121
|
// src/widget/advance/table/table-head/controller.ts
|
|
5108
5122
|
import {
|
|
5109
5123
|
useAppDispatch as useAppDispatch6,
|
|
5110
|
-
useAppSelector as
|
|
5111
|
-
selectSearch as
|
|
5124
|
+
useAppSelector as useAppSelector4,
|
|
5125
|
+
selectSearch as selectSearch3,
|
|
5112
5126
|
setSelectedRowKeys as setSelectedRowKeys2
|
|
5113
5127
|
} from "@fctc/interface-logic/store";
|
|
5114
5128
|
var tableHeadController = (props) => {
|
|
5115
5129
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
5116
5130
|
const appDispatch = useAppDispatch6();
|
|
5117
|
-
const { groupByDomain } =
|
|
5131
|
+
const { groupByDomain } = useAppSelector4(selectSearch3);
|
|
5118
5132
|
const handleCheckBoxAll = (event) => {
|
|
5119
5133
|
if (event?.target?.checked && typeTable === "list") {
|
|
5120
5134
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
@@ -5147,11 +5161,11 @@ var tableHeadController = (props) => {
|
|
|
5147
5161
|
};
|
|
5148
5162
|
|
|
5149
5163
|
// src/widget/advance/table/table-view/controller.ts
|
|
5150
|
-
import { useEffect as useEffect12, useMemo as
|
|
5164
|
+
import { useEffect as useEffect12, useMemo as useMemo11, useRef as useRef4, useState as useState8 } from "react";
|
|
5151
5165
|
import {
|
|
5152
|
-
useAppSelector as
|
|
5153
|
-
selectSearch as
|
|
5154
|
-
selectList as
|
|
5166
|
+
useAppSelector as useAppSelector5,
|
|
5167
|
+
selectSearch as selectSearch4,
|
|
5168
|
+
selectList as selectList3
|
|
5155
5169
|
} from "@fctc/interface-logic/store";
|
|
5156
5170
|
import { domainHelper } from "@fctc/interface-logic/utils";
|
|
5157
5171
|
var tableController = ({ data }) => {
|
|
@@ -5230,7 +5244,7 @@ var tableController = ({ data }) => {
|
|
|
5230
5244
|
};
|
|
5231
5245
|
|
|
5232
5246
|
// src/widget/advance/table/table-group/controller.ts
|
|
5233
|
-
import { useEffect as useEffect13, useMemo as
|
|
5247
|
+
import { useEffect as useEffect13, useMemo as useMemo12, useState as useState9 } from "react";
|
|
5234
5248
|
|
|
5235
5249
|
// src/utils/i18n.ts
|
|
5236
5250
|
import { initReactI18next } from "react-i18next";
|
|
@@ -6004,9 +6018,9 @@ import {
|
|
|
6004
6018
|
useGetListData as useGetListData2
|
|
6005
6019
|
} from "@fctc/interface-logic/hooks";
|
|
6006
6020
|
import {
|
|
6007
|
-
useAppSelector as
|
|
6008
|
-
selectSearch as
|
|
6009
|
-
selectList as
|
|
6021
|
+
useAppSelector as useAppSelector6,
|
|
6022
|
+
selectSearch as selectSearch5,
|
|
6023
|
+
selectList as selectList4,
|
|
6010
6024
|
useAppDispatch as useAppDispatch7,
|
|
6011
6025
|
setSelectedRowKeys as setSelectedRowKeys3
|
|
6012
6026
|
} from "@fctc/interface-logic/store";
|
|
@@ -6038,8 +6052,8 @@ var tableGroupController = (props) => {
|
|
|
6038
6052
|
selectedRowKeysRef
|
|
6039
6053
|
} = props;
|
|
6040
6054
|
const [pageGroup, setPageGroup] = useState9(0);
|
|
6041
|
-
const { groupByDomain, selectedTags } =
|
|
6042
|
-
const { selectedRowKeys } =
|
|
6055
|
+
const { groupByDomain, selectedTags } = useAppSelector6(selectSearch5);
|
|
6056
|
+
const { selectedRowKeys } = useAppSelector6(selectList4);
|
|
6043
6057
|
const appDispatch = useAppDispatch7();
|
|
6044
6058
|
const { toDataJS } = useOdooDataTransform();
|
|
6045
6059
|
const initVal = toDataJS(row, viewData, model);
|
|
@@ -6048,7 +6062,7 @@ var tableGroupController = (props) => {
|
|
|
6048
6062
|
fromStart: 1,
|
|
6049
6063
|
fromEnd: 1
|
|
6050
6064
|
});
|
|
6051
|
-
const processedData =
|
|
6065
|
+
const processedData = useMemo12(() => {
|
|
6052
6066
|
const calculateColSpanEmpty = () => {
|
|
6053
6067
|
const startIndex = columns.findIndex(
|
|
6054
6068
|
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
@@ -6063,7 +6077,7 @@ var tableGroupController = (props) => {
|
|
|
6063
6077
|
};
|
|
6064
6078
|
return calculateColSpanEmpty();
|
|
6065
6079
|
}, [columns, row]);
|
|
6066
|
-
const shouldFetchData =
|
|
6080
|
+
const shouldFetchData = useMemo12(() => {
|
|
6067
6081
|
return !!isShowGroup;
|
|
6068
6082
|
}, [isShowGroup]);
|
|
6069
6083
|
const enabled = shouldFetchData && !!processedData;
|
|
@@ -6192,11 +6206,6 @@ var provider_exports = {};
|
|
|
6192
6206
|
__reExport(provider_exports, provider_star);
|
|
6193
6207
|
import * as provider_star from "@fctc/interface-logic/provider";
|
|
6194
6208
|
|
|
6195
|
-
// src/store.ts
|
|
6196
|
-
var store_exports = {};
|
|
6197
|
-
__reExport(store_exports, store_star);
|
|
6198
|
-
import * as store_star from "@fctc/interface-logic/store";
|
|
6199
|
-
|
|
6200
6209
|
// src/widget/advance/search/controller.ts
|
|
6201
6210
|
var searchController = ({
|
|
6202
6211
|
viewData,
|
|
@@ -6529,8 +6538,8 @@ var searchController = ({
|
|
|
6529
6538
|
import { getEnv as getEnv8 } from "@fctc/interface-logic/environment";
|
|
6530
6539
|
import {
|
|
6531
6540
|
useAppDispatch as useAppDispatch8,
|
|
6532
|
-
useAppSelector as
|
|
6533
|
-
selectSearch as
|
|
6541
|
+
useAppSelector as useAppSelector7,
|
|
6542
|
+
selectSearch as selectSearch6,
|
|
6534
6543
|
setFirstDomain,
|
|
6535
6544
|
setViewDataStore,
|
|
6536
6545
|
setPage as setPage2,
|
|
@@ -6563,7 +6572,7 @@ var many2manyFieldController = (props) => {
|
|
|
6563
6572
|
const [isLoadedData, setIsLoadedData] = useState11(false);
|
|
6564
6573
|
const [domainMany2Many, setDomainMany2Many] = useState11(domain);
|
|
6565
6574
|
const env = getEnv8();
|
|
6566
|
-
const { selectedTags } =
|
|
6575
|
+
const { selectedTags } = useAppSelector7(selectSearch6);
|
|
6567
6576
|
const viewParams = {
|
|
6568
6577
|
model: relation,
|
|
6569
6578
|
views: [
|
|
@@ -6576,7 +6585,7 @@ var many2manyFieldController = (props) => {
|
|
|
6576
6585
|
viewParams,
|
|
6577
6586
|
actionData
|
|
6578
6587
|
);
|
|
6579
|
-
const baseModel =
|
|
6588
|
+
const baseModel = useMemo13(
|
|
6580
6589
|
() => ({
|
|
6581
6590
|
name: String(relation),
|
|
6582
6591
|
view: viewResponse || {},
|
|
@@ -6589,13 +6598,13 @@ var many2manyFieldController = (props) => {
|
|
|
6589
6598
|
[model, viewResponse]
|
|
6590
6599
|
);
|
|
6591
6600
|
const initModel = (0, hooks_exports.useModel)();
|
|
6592
|
-
const modelInstance =
|
|
6601
|
+
const modelInstance = useMemo13(() => {
|
|
6593
6602
|
if (viewResponse) {
|
|
6594
6603
|
return initModel.initModel(baseModel);
|
|
6595
6604
|
}
|
|
6596
6605
|
return null;
|
|
6597
6606
|
}, [baseModel, viewResponse]);
|
|
6598
|
-
const specification =
|
|
6607
|
+
const specification = useMemo13(() => {
|
|
6599
6608
|
if (modelInstance) {
|
|
6600
6609
|
return modelInstance.getSpecification();
|
|
6601
6610
|
}
|
|
@@ -6710,7 +6719,7 @@ var many2manyFieldController = (props) => {
|
|
|
6710
6719
|
};
|
|
6711
6720
|
|
|
6712
6721
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
6713
|
-
import { useMemo as
|
|
6722
|
+
import { useMemo as useMemo14 } from "react";
|
|
6714
6723
|
import { WIDGETAVATAR, WIDGETCOLOR } from "@fctc/interface-logic/constants";
|
|
6715
6724
|
import { getEnv as getEnv9 } from "@fctc/interface-logic/environment";
|
|
6716
6725
|
import { useGetSelection as useGetSelection3 } from "@fctc/interface-logic/hooks";
|
|
@@ -6727,7 +6736,7 @@ var many2manyTagsController = (props) => {
|
|
|
6727
6736
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
6728
6737
|
const env = getEnv9();
|
|
6729
6738
|
const addtionalFields = optionsFields ? evalJSONContext6(optionsFields) : null;
|
|
6730
|
-
const domainObject =
|
|
6739
|
+
const domainObject = useMemo14(
|
|
6731
6740
|
() => evalJSONDomain5(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
6732
6741
|
[domain, formValues]
|
|
6733
6742
|
);
|
|
@@ -6772,7 +6781,7 @@ var many2manyTagsController = (props) => {
|
|
|
6772
6781
|
// src/widget/basic/status-bar-field/controller.ts
|
|
6773
6782
|
import { useState as useState12 } from "react";
|
|
6774
6783
|
import { useGetListData as useGetListData4, useChangeStatus } from "@fctc/interface-logic/hooks";
|
|
6775
|
-
import { useAppSelector as
|
|
6784
|
+
import { useAppSelector as useAppSelector8, selectEnv as selectEnv2 } from "@fctc/interface-logic/store";
|
|
6776
6785
|
import { evalJSONDomain as evalJSONDomain6 } from "@fctc/interface-logic/utils";
|
|
6777
6786
|
var durationController = (props) => {
|
|
6778
6787
|
const {
|
|
@@ -6792,7 +6801,7 @@ var durationController = (props) => {
|
|
|
6792
6801
|
};
|
|
6793
6802
|
const [disabled, setDisabled] = useState12(false);
|
|
6794
6803
|
const [modelStatus, setModalStatus] = useState12(false);
|
|
6795
|
-
const { context } =
|
|
6804
|
+
const { context } = useAppSelector8(selectEnv2);
|
|
6796
6805
|
const queryKey = [`data-status-duration`, specification];
|
|
6797
6806
|
const listDataProps = {
|
|
6798
6807
|
model: relation,
|