@fctc/widget-logic 2.0.9 → 2.1.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 +12 -1
- package/dist/hooks.d.ts +12 -1
- package/dist/hooks.js +179 -6
- package/dist/hooks.mjs +179 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +204 -246
- package/dist/index.mjs +157 -199
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/widget.d.mts +3 -29
- package/dist/widget.d.ts +3 -29
- package/dist/widget.js +194 -238
- package/dist/widget.mjs +151 -194
- package/package.json +2 -2
package/dist/widget.js
CHANGED
|
@@ -4049,7 +4049,6 @@ __export(widget_exports, {
|
|
|
4049
4049
|
priorityFieldController: () => priorityFieldController,
|
|
4050
4050
|
searchController: () => searchController,
|
|
4051
4051
|
statusDropdownController: () => statusDropdownController,
|
|
4052
|
-
tableBodyController: () => tableBodyController,
|
|
4053
4052
|
tableController: () => tableController,
|
|
4054
4053
|
tableGroupController: () => tableGroupController,
|
|
4055
4054
|
tableHeadController: () => tableHeadController
|
|
@@ -4111,7 +4110,7 @@ var statusDropdownController = (props) => {
|
|
|
4111
4110
|
};
|
|
4112
4111
|
|
|
4113
4112
|
// src/widget/basic/many2one-field/controller.ts
|
|
4114
|
-
var
|
|
4113
|
+
var import_react15 = require("react");
|
|
4115
4114
|
|
|
4116
4115
|
// src/hooks.ts
|
|
4117
4116
|
var hooks_exports = {};
|
|
@@ -4126,6 +4125,7 @@ __export(hooks_exports, {
|
|
|
4126
4125
|
useDetail: () => useDetail,
|
|
4127
4126
|
useListData: () => useListData,
|
|
4128
4127
|
useMenu: () => useMenu,
|
|
4128
|
+
useMenuItem: () => useMenuItem,
|
|
4129
4129
|
useProfile: () => useProfile,
|
|
4130
4130
|
useUser: () => useUser,
|
|
4131
4131
|
useViewV2: () => useViewV2
|
|
@@ -4885,8 +4885,69 @@ var useAppProvider = () => {
|
|
|
4885
4885
|
return context;
|
|
4886
4886
|
};
|
|
4887
4887
|
|
|
4888
|
-
// src/hooks/
|
|
4888
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4889
|
+
var import_environment6 = require("@fctc/interface-logic/environment");
|
|
4890
|
+
var import_hooks10 = require("@fctc/interface-logic/hooks");
|
|
4889
4891
|
var import_react12 = require("react");
|
|
4892
|
+
|
|
4893
|
+
// src/utils.ts
|
|
4894
|
+
var utils_exports = {};
|
|
4895
|
+
__export(utils_exports, {
|
|
4896
|
+
API_APP_URL: () => API_APP_URL,
|
|
4897
|
+
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4898
|
+
STORAGES: () => STORAGES,
|
|
4899
|
+
combineContexts: () => combineContexts,
|
|
4900
|
+
convertFieldsToArray: () => convertFieldsToArray,
|
|
4901
|
+
countSum: () => countSum,
|
|
4902
|
+
getDateRange: () => getDateRange,
|
|
4903
|
+
languages: () => languages,
|
|
4904
|
+
mergeButtons: () => mergeButtons,
|
|
4905
|
+
setStorageItemAsync: () => setStorageItemAsync,
|
|
4906
|
+
useGetRowIds: () => useGetRowIds,
|
|
4907
|
+
useSelectionState: () => useSelectionState,
|
|
4908
|
+
useStorageState: () => useStorageState
|
|
4909
|
+
});
|
|
4910
|
+
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4911
|
+
|
|
4912
|
+
// src/hooks/core/use-menu-item.tsx
|
|
4913
|
+
var useMenuItem = (props) => {
|
|
4914
|
+
const { menu, activeMenuId } = props;
|
|
4915
|
+
const model = menu?.action?.res_model;
|
|
4916
|
+
const aid = menu?.action?.id?.id;
|
|
4917
|
+
const id = menu?.id;
|
|
4918
|
+
const context = (0, import_environment6.getEnv)().context;
|
|
4919
|
+
const queryActionDetail = (0, import_hooks10.useGetActionDetail)({
|
|
4920
|
+
aid,
|
|
4921
|
+
id,
|
|
4922
|
+
model,
|
|
4923
|
+
context,
|
|
4924
|
+
enabled: true,
|
|
4925
|
+
queryKey: [`action-${aid}`]
|
|
4926
|
+
}).data;
|
|
4927
|
+
const [path, setPath] = (0, import_react12.useState)("");
|
|
4928
|
+
const handleClick = () => {
|
|
4929
|
+
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4930
|
+
return;
|
|
4931
|
+
}
|
|
4932
|
+
const hasListView = queryActionDetail.views.some(
|
|
4933
|
+
([id2, type]) => type === "list"
|
|
4934
|
+
);
|
|
4935
|
+
const viewType = hasListView ? "list" : "form";
|
|
4936
|
+
const isAccountPayment = menu?.action?.res_model === "account.payment" && menu?.action?.id?.id === 1551;
|
|
4937
|
+
const isConvertCurrencyMenu = menu?.action?.res_model === "currency.convert" && menu?.action?.id?.id === 1562;
|
|
4938
|
+
const path2 = (0, utils_exports.formatUrlPath)({
|
|
4939
|
+
viewType,
|
|
4940
|
+
actionPath: isConvertCurrencyMenu ? "menu" : isAccountPayment ? "menu" : menu?.action?.path || "menu",
|
|
4941
|
+
aid: menu?.action?.id?.id,
|
|
4942
|
+
model: queryActionDetail.res_model
|
|
4943
|
+
});
|
|
4944
|
+
setPath(path2);
|
|
4945
|
+
};
|
|
4946
|
+
return { handleClick, path, queryActionDetail };
|
|
4947
|
+
};
|
|
4948
|
+
|
|
4949
|
+
// src/hooks/utils/use-click-outside.ts
|
|
4950
|
+
var import_react13 = require("react");
|
|
4890
4951
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
4891
4952
|
var useClickOutside = ({
|
|
4892
4953
|
handler,
|
|
@@ -4894,8 +4955,8 @@ var useClickOutside = ({
|
|
|
4894
4955
|
nodes = [],
|
|
4895
4956
|
refs
|
|
4896
4957
|
}) => {
|
|
4897
|
-
const ref = (0,
|
|
4898
|
-
(0,
|
|
4958
|
+
const ref = (0, import_react13.useRef)(null);
|
|
4959
|
+
(0, import_react13.useEffect)(() => {
|
|
4899
4960
|
const listener = (event) => {
|
|
4900
4961
|
const { target } = event;
|
|
4901
4962
|
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
@@ -4917,10 +4978,10 @@ var useClickOutside = ({
|
|
|
4917
4978
|
};
|
|
4918
4979
|
|
|
4919
4980
|
// src/hooks/utils/use-debounce.ts
|
|
4920
|
-
var
|
|
4981
|
+
var import_react14 = require("react");
|
|
4921
4982
|
function useDebounce(value, delay) {
|
|
4922
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
4923
|
-
(0,
|
|
4983
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react14.useState)(value);
|
|
4984
|
+
(0, import_react14.useEffect)(() => {
|
|
4924
4985
|
const handler = setTimeout(() => {
|
|
4925
4986
|
setDebouncedValue(value);
|
|
4926
4987
|
}, delay);
|
|
@@ -4934,25 +4995,6 @@ function useDebounce(value, delay) {
|
|
|
4934
4995
|
// src/hooks.ts
|
|
4935
4996
|
__reExport(hooks_exports, require("@fctc/interface-logic/hooks"));
|
|
4936
4997
|
|
|
4937
|
-
// src/utils.ts
|
|
4938
|
-
var utils_exports = {};
|
|
4939
|
-
__export(utils_exports, {
|
|
4940
|
-
API_APP_URL: () => API_APP_URL,
|
|
4941
|
-
API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
|
|
4942
|
-
STORAGES: () => STORAGES,
|
|
4943
|
-
combineContexts: () => combineContexts,
|
|
4944
|
-
convertFieldsToArray: () => convertFieldsToArray,
|
|
4945
|
-
countSum: () => countSum,
|
|
4946
|
-
getDateRange: () => getDateRange,
|
|
4947
|
-
languages: () => languages,
|
|
4948
|
-
mergeButtons: () => mergeButtons,
|
|
4949
|
-
setStorageItemAsync: () => setStorageItemAsync,
|
|
4950
|
-
useGetRowIds: () => useGetRowIds,
|
|
4951
|
-
useSelectionState: () => useSelectionState,
|
|
4952
|
-
useStorageState: () => useStorageState
|
|
4953
|
-
});
|
|
4954
|
-
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4955
|
-
|
|
4956
4998
|
// src/provider.ts
|
|
4957
4999
|
var provider_exports = {};
|
|
4958
5000
|
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
@@ -4973,13 +5015,13 @@ var many2oneFieldController = (props) => {
|
|
|
4973
5015
|
showDetail
|
|
4974
5016
|
} = props;
|
|
4975
5017
|
const { env } = (0, provider_exports.useEnv)();
|
|
4976
|
-
const [options, setOptions] = (0,
|
|
4977
|
-
const [inputValue, setInputValue] = (0,
|
|
5018
|
+
const [options, setOptions] = (0, import_react15.useState)([]);
|
|
5019
|
+
const [inputValue, setInputValue] = (0, import_react15.useState)("");
|
|
4978
5020
|
const [debouncedInputValue] = useDebounce(inputValue, 1e3);
|
|
4979
|
-
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0,
|
|
4980
|
-
const [tempSelectedOption, setTempSelectedOption] = (0,
|
|
4981
|
-
const [domainModal, setDomainModal] = (0,
|
|
4982
|
-
const [domainObject, setDomainObject] = (0,
|
|
5021
|
+
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react15.useState)(false);
|
|
5022
|
+
const [tempSelectedOption, setTempSelectedOption] = (0, import_react15.useState)(null);
|
|
5023
|
+
const [domainModal, setDomainModal] = (0, import_react15.useState)(null);
|
|
5024
|
+
const [domainObject, setDomainObject] = (0, import_react15.useState)(null);
|
|
4983
5025
|
const actionData = sessionStorageUtils.getActionData();
|
|
4984
5026
|
const { menuList } = (0, store_exports.useAppSelector)(store_exports.selectNavbar);
|
|
4985
5027
|
const initValue = methods?.getValues(name);
|
|
@@ -4989,7 +5031,7 @@ var many2oneFieldController = (props) => {
|
|
|
4989
5031
|
...fieldContext,
|
|
4990
5032
|
...env?.context
|
|
4991
5033
|
};
|
|
4992
|
-
const { useGetSelection:
|
|
5034
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
4993
5035
|
const data = {
|
|
4994
5036
|
model: relation,
|
|
4995
5037
|
domain: domainObject,
|
|
@@ -5005,23 +5047,23 @@ var many2oneFieldController = (props) => {
|
|
|
5005
5047
|
data: dataOfSelection,
|
|
5006
5048
|
refetch,
|
|
5007
5049
|
isFetching
|
|
5008
|
-
} =
|
|
5050
|
+
} = useGetSelection2({
|
|
5009
5051
|
data,
|
|
5010
5052
|
queryKey,
|
|
5011
5053
|
enabled: false
|
|
5012
5054
|
});
|
|
5013
|
-
const selectOptions = (0,
|
|
5055
|
+
const selectOptions = (0, import_react15.useMemo)(() => {
|
|
5014
5056
|
return dataOfSelection?.records?.map((val) => ({
|
|
5015
5057
|
value: val?.id,
|
|
5016
5058
|
label: val?.display_name || val?.name
|
|
5017
5059
|
})) || [];
|
|
5018
5060
|
}, [dataOfSelection]);
|
|
5019
|
-
(0,
|
|
5061
|
+
(0, import_react15.useEffect)(() => {
|
|
5020
5062
|
setOptions(selectOptions);
|
|
5021
5063
|
setDomainModal(domainObject);
|
|
5022
5064
|
if (relation === "student.subject") (0, store_exports.setListSubject)(selectOptions);
|
|
5023
5065
|
}, [selectOptions]);
|
|
5024
|
-
(0,
|
|
5066
|
+
(0, import_react15.useEffect)(() => {
|
|
5025
5067
|
setDomainObject(
|
|
5026
5068
|
(0, utils_exports.evalJSONDomain)(
|
|
5027
5069
|
domain,
|
|
@@ -5029,7 +5071,7 @@ var many2oneFieldController = (props) => {
|
|
|
5029
5071
|
)
|
|
5030
5072
|
);
|
|
5031
5073
|
}, [domain, formValues]);
|
|
5032
|
-
(0,
|
|
5074
|
+
(0, import_react15.useEffect)(() => {
|
|
5033
5075
|
if (!propValue && tempSelectedOption) {
|
|
5034
5076
|
methods.setValue(name, null);
|
|
5035
5077
|
setTempSelectedOption(null);
|
|
@@ -5040,10 +5082,10 @@ var many2oneFieldController = (props) => {
|
|
|
5040
5082
|
});
|
|
5041
5083
|
}
|
|
5042
5084
|
}, [propValue]);
|
|
5043
|
-
const fetchMoreOptions = (0,
|
|
5085
|
+
const fetchMoreOptions = (0, import_react15.useCallback)(() => {
|
|
5044
5086
|
refetch();
|
|
5045
5087
|
}, [refetch]);
|
|
5046
|
-
(0,
|
|
5088
|
+
(0, import_react15.useEffect)(() => {
|
|
5047
5089
|
if (debouncedInputValue) {
|
|
5048
5090
|
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
5049
5091
|
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
@@ -5058,7 +5100,7 @@ var many2oneFieldController = (props) => {
|
|
|
5058
5100
|
}, 50);
|
|
5059
5101
|
}
|
|
5060
5102
|
}, [debouncedInputValue]);
|
|
5061
|
-
const handleChooseRecord = (0,
|
|
5103
|
+
const handleChooseRecord = (0, import_react15.useCallback)(
|
|
5062
5104
|
(idRecord) => {
|
|
5063
5105
|
const newOption = options.find(
|
|
5064
5106
|
(option) => option.value === idRecord
|
|
@@ -5083,8 +5125,8 @@ var many2oneFieldController = (props) => {
|
|
|
5083
5125
|
},
|
|
5084
5126
|
[options, methods, name, onChange]
|
|
5085
5127
|
);
|
|
5086
|
-
const handleClose = (0,
|
|
5087
|
-
const handleSelectChange = (0,
|
|
5128
|
+
const handleClose = (0, import_react15.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
5129
|
+
const handleSelectChange = (0, import_react15.useCallback)(
|
|
5088
5130
|
(selectedOption) => {
|
|
5089
5131
|
if (!selectedOption) {
|
|
5090
5132
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5131,20 +5173,20 @@ var many2oneFieldController = (props) => {
|
|
|
5131
5173
|
};
|
|
5132
5174
|
|
|
5133
5175
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5134
|
-
var
|
|
5135
|
-
var
|
|
5136
|
-
var
|
|
5176
|
+
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
5177
|
+
var import_hooks13 = require("@fctc/interface-logic/hooks");
|
|
5178
|
+
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
5137
5179
|
var many2oneButtonController = (props) => {
|
|
5138
5180
|
const { domain, methods, relation } = props;
|
|
5139
5181
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5140
|
-
const env = (0,
|
|
5141
|
-
const domainObject = (0,
|
|
5182
|
+
const env = (0, import_environment7.getEnv)();
|
|
5183
|
+
const domainObject = (0, import_utils6.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5142
5184
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5143
|
-
const { data: dataOfSelection } = (0,
|
|
5185
|
+
const { data: dataOfSelection } = (0, import_hooks13.useGetSelection)({
|
|
5144
5186
|
data: {
|
|
5145
5187
|
model: relation ?? "",
|
|
5146
5188
|
domain: domainObject,
|
|
5147
|
-
context: { ...env.context, ...(0,
|
|
5189
|
+
context: { ...env.context, ...(0, import_utils6.evalJSONContext)(actionData?.context) }
|
|
5148
5190
|
},
|
|
5149
5191
|
queryKey: [`data_${relation}`, domainObject]
|
|
5150
5192
|
});
|
|
@@ -5158,8 +5200,8 @@ var many2oneButtonController = (props) => {
|
|
|
5158
5200
|
};
|
|
5159
5201
|
|
|
5160
5202
|
// src/widget/basic/many2many-field/controller.ts
|
|
5161
|
-
var
|
|
5162
|
-
var
|
|
5203
|
+
var import_react16 = require("react");
|
|
5204
|
+
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5163
5205
|
var many2manyFieldController = (props) => {
|
|
5164
5206
|
const {
|
|
5165
5207
|
relation,
|
|
@@ -5167,16 +5209,16 @@ var many2manyFieldController = (props) => {
|
|
|
5167
5209
|
context,
|
|
5168
5210
|
options,
|
|
5169
5211
|
tab,
|
|
5170
|
-
setSelectedRowKeys:
|
|
5212
|
+
setSelectedRowKeys: setSelectedRowKeys3,
|
|
5171
5213
|
groupByDomain,
|
|
5172
5214
|
enabled: enabledCallAPI,
|
|
5173
5215
|
actionData
|
|
5174
5216
|
} = props;
|
|
5175
5217
|
const { env } = (0, provider_exports.useEnv)();
|
|
5176
5218
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5177
|
-
const [order, setOrder] = (0,
|
|
5178
|
-
const [page, setPage] = (0,
|
|
5179
|
-
const [domainMany2Many, setDomainMany2Many] = (0,
|
|
5219
|
+
const [order, setOrder] = (0, import_react16.useState)();
|
|
5220
|
+
const [page, setPage] = (0, import_react16.useState)(0);
|
|
5221
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react16.useState)(null);
|
|
5180
5222
|
const [debouncedPage] = useDebounce(page, 500);
|
|
5181
5223
|
const contextObject = {
|
|
5182
5224
|
...env.context,
|
|
@@ -5191,7 +5233,7 @@ var many2manyFieldController = (props) => {
|
|
|
5191
5233
|
context: contextObject
|
|
5192
5234
|
};
|
|
5193
5235
|
const { data: viewResponse } = useGetView2(viewParams, enabledCallAPI);
|
|
5194
|
-
const baseModel = (0,
|
|
5236
|
+
const baseModel = (0, import_react16.useMemo)(
|
|
5195
5237
|
() => ({
|
|
5196
5238
|
name: String(relation),
|
|
5197
5239
|
view: viewResponse || {},
|
|
@@ -5204,23 +5246,23 @@ var many2manyFieldController = (props) => {
|
|
|
5204
5246
|
[relation, viewResponse]
|
|
5205
5247
|
);
|
|
5206
5248
|
const initModel = (0, hooks_exports.useModel)();
|
|
5207
|
-
const modelInstance = (0,
|
|
5249
|
+
const modelInstance = (0, import_react16.useMemo)(() => {
|
|
5208
5250
|
if (viewResponse) {
|
|
5209
5251
|
return initModel.initModel(baseModel);
|
|
5210
5252
|
}
|
|
5211
5253
|
return null;
|
|
5212
5254
|
}, [baseModel, viewResponse]);
|
|
5213
|
-
const specification = (0,
|
|
5255
|
+
const specification = (0, import_react16.useMemo)(() => {
|
|
5214
5256
|
if (modelInstance) {
|
|
5215
5257
|
return modelInstance.getSpecification();
|
|
5216
5258
|
}
|
|
5217
5259
|
return null;
|
|
5218
5260
|
}, [modelInstance]);
|
|
5219
5261
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5220
|
-
const optionsObject = tab?.options ? (0,
|
|
5262
|
+
const optionsObject = tab?.options ? (0, import_utils7.evalJSONContext)(tab?.options) : (options ? (0, import_utils7.evalJSONContext)(options) : {}) || {};
|
|
5221
5263
|
const fetchData = async () => {
|
|
5222
5264
|
try {
|
|
5223
|
-
const domainParse = typeof domain === "string" ? (0,
|
|
5265
|
+
const domainParse = typeof domain === "string" ? (0, import_utils7.evalJSONDomain)(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5224
5266
|
setDomainMany2Many(domainParse);
|
|
5225
5267
|
setPage(0);
|
|
5226
5268
|
} catch (err) {
|
|
@@ -5244,7 +5286,7 @@ var many2manyFieldController = (props) => {
|
|
|
5244
5286
|
context: contextObject,
|
|
5245
5287
|
fields: groupByDomain?.fields,
|
|
5246
5288
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5247
|
-
sort: order ? order : default_order ? (0,
|
|
5289
|
+
sort: order ? order : default_order ? (0, import_utils7.formatSortingString)(default_order) : ""
|
|
5248
5290
|
};
|
|
5249
5291
|
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5250
5292
|
const {
|
|
@@ -5253,13 +5295,13 @@ var many2manyFieldController = (props) => {
|
|
|
5253
5295
|
isFetched,
|
|
5254
5296
|
isPlaceholderData
|
|
5255
5297
|
} = useGetListData3(data, queryKey, enabled);
|
|
5256
|
-
(0,
|
|
5298
|
+
(0, import_react16.useEffect)(() => {
|
|
5257
5299
|
if (viewResponse) {
|
|
5258
5300
|
fetchData();
|
|
5259
5301
|
}
|
|
5260
5302
|
return () => {
|
|
5261
5303
|
setPage(0);
|
|
5262
|
-
|
|
5304
|
+
setSelectedRowKeys3([]);
|
|
5263
5305
|
setDomainMany2Many(null);
|
|
5264
5306
|
};
|
|
5265
5307
|
}, [viewResponse]);
|
|
@@ -5306,11 +5348,9 @@ var many2manyFieldController = (props) => {
|
|
|
5306
5348
|
};
|
|
5307
5349
|
|
|
5308
5350
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5309
|
-
var
|
|
5351
|
+
var import_react17 = require("react");
|
|
5310
5352
|
var import_constants4 = require("@fctc/interface-logic/constants");
|
|
5311
|
-
var
|
|
5312
|
-
var import_hooks14 = require("@fctc/interface-logic/hooks");
|
|
5313
|
-
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
5353
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5314
5354
|
var many2manyTagsController = (props) => {
|
|
5315
5355
|
const {
|
|
5316
5356
|
relation,
|
|
@@ -5321,10 +5361,11 @@ var many2manyTagsController = (props) => {
|
|
|
5321
5361
|
placeholderNoOption
|
|
5322
5362
|
} = props;
|
|
5323
5363
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5324
|
-
const env = (0,
|
|
5325
|
-
const
|
|
5326
|
-
const
|
|
5327
|
-
|
|
5364
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
5365
|
+
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5366
|
+
const addtionalFields = optionsFields ? (0, import_utils8.evalJSONContext)(optionsFields) : null;
|
|
5367
|
+
const domainObject = (0, import_react17.useMemo)(
|
|
5368
|
+
() => (0, import_utils8.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5328
5369
|
[domain, formValues]
|
|
5329
5370
|
);
|
|
5330
5371
|
const data = {
|
|
@@ -5340,7 +5381,7 @@ var many2manyTagsController = (props) => {
|
|
|
5340
5381
|
enabled: true,
|
|
5341
5382
|
context: env.context
|
|
5342
5383
|
};
|
|
5343
|
-
const { data: dataOfSelection } = (
|
|
5384
|
+
const { data: dataOfSelection } = useGetSelection2({
|
|
5344
5385
|
data,
|
|
5345
5386
|
queryKey: [`data_${relation}`, domainObject]
|
|
5346
5387
|
});
|
|
@@ -5360,16 +5401,15 @@ var many2manyTagsController = (props) => {
|
|
|
5360
5401
|
options,
|
|
5361
5402
|
customNoOptionsMessage,
|
|
5362
5403
|
tranfer,
|
|
5363
|
-
dataOfSelection,
|
|
5364
5404
|
isUser
|
|
5365
5405
|
};
|
|
5366
5406
|
};
|
|
5367
5407
|
|
|
5368
5408
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5369
|
-
var
|
|
5370
|
-
var
|
|
5409
|
+
var import_react18 = require("react");
|
|
5410
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5371
5411
|
var durationController = (props) => {
|
|
5372
|
-
const { relation, domain, formValues, name, id, model, onRefetch } = props;
|
|
5412
|
+
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5373
5413
|
const specification = {
|
|
5374
5414
|
id: 0,
|
|
5375
5415
|
name: "",
|
|
@@ -5377,13 +5417,13 @@ var durationController = (props) => {
|
|
|
5377
5417
|
};
|
|
5378
5418
|
const { useGetListData: useGetListData3, useChangeStatus } = (0, provider_exports.useService)();
|
|
5379
5419
|
const { env } = (0, provider_exports.useEnv)();
|
|
5380
|
-
const [disabled, setDisabled] = (0,
|
|
5381
|
-
const [modelStatus, setModalStatus] = (0,
|
|
5420
|
+
const [disabled, setDisabled] = (0, import_react18.useState)(false);
|
|
5421
|
+
const [modelStatus, setModalStatus] = (0, import_react18.useState)(false);
|
|
5382
5422
|
const queryKey = [`data-status-duration`, specification];
|
|
5383
5423
|
const listDataProps = {
|
|
5384
5424
|
model: relation,
|
|
5385
5425
|
specification,
|
|
5386
|
-
domain: (0,
|
|
5426
|
+
domain: (0, import_utils9.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5387
5427
|
limit: 10,
|
|
5388
5428
|
offset: 0,
|
|
5389
5429
|
fields: "",
|
|
@@ -5393,7 +5433,11 @@ var durationController = (props) => {
|
|
|
5393
5433
|
},
|
|
5394
5434
|
sort: ""
|
|
5395
5435
|
};
|
|
5396
|
-
const { data: dataResponse } = useGetListData3(
|
|
5436
|
+
const { data: dataResponse } = useGetListData3(
|
|
5437
|
+
listDataProps,
|
|
5438
|
+
queryKey,
|
|
5439
|
+
enabled
|
|
5440
|
+
);
|
|
5397
5441
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5398
5442
|
const handleClick = async (stage_id) => {
|
|
5399
5443
|
setDisabled(true);
|
|
@@ -5429,41 +5473,28 @@ var durationController = (props) => {
|
|
|
5429
5473
|
};
|
|
5430
5474
|
|
|
5431
5475
|
// src/widget/basic/priority-field/controller.ts
|
|
5432
|
-
var
|
|
5433
|
-
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5476
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
5434
5477
|
var priorityFieldController = (props) => {
|
|
5435
|
-
const {
|
|
5436
|
-
|
|
5437
|
-
isForm,
|
|
5438
|
-
name,
|
|
5439
|
-
methods,
|
|
5440
|
-
onChange,
|
|
5441
|
-
model,
|
|
5442
|
-
selection,
|
|
5443
|
-
id,
|
|
5444
|
-
actionData,
|
|
5445
|
-
viewData,
|
|
5446
|
-
context
|
|
5447
|
-
} = props;
|
|
5448
|
-
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
5478
|
+
const { name, model, id, actionData, context, onChange, specification } = props;
|
|
5479
|
+
const _context = { ...(0, import_utils10.evalJSONContext)(actionData?.context) };
|
|
5449
5480
|
const contextObject = { ...context, ..._context };
|
|
5450
|
-
const
|
|
5451
|
-
const
|
|
5452
|
-
const { mutateAsync: fetchSave } = (0, import_hooks15.useSave)();
|
|
5481
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
5482
|
+
const { mutateAsync: fetchSave } = useSave2();
|
|
5453
5483
|
const savePriorities = async ({
|
|
5454
|
-
value
|
|
5484
|
+
value,
|
|
5455
5485
|
resetPriority
|
|
5456
5486
|
}) => {
|
|
5457
|
-
const priorityValue =
|
|
5487
|
+
const priorityValue = value <= 0 ? 0 : value - 1;
|
|
5458
5488
|
try {
|
|
5459
5489
|
fetchSave({
|
|
5460
5490
|
ids: id ? [id] : [],
|
|
5461
|
-
data: { [name
|
|
5462
|
-
model: model
|
|
5463
|
-
context: contextObject
|
|
5491
|
+
data: { [String(name)]: String(priorityValue) },
|
|
5492
|
+
model: String(model),
|
|
5493
|
+
context: contextObject,
|
|
5494
|
+
specification
|
|
5464
5495
|
});
|
|
5465
5496
|
if (typeof onChange === "function") {
|
|
5466
|
-
onChange(name
|
|
5497
|
+
onChange(String(name), String(priorityValue));
|
|
5467
5498
|
}
|
|
5468
5499
|
} catch (error) {
|
|
5469
5500
|
if (resetPriority) {
|
|
@@ -5472,22 +5503,15 @@ var priorityFieldController = (props) => {
|
|
|
5472
5503
|
}
|
|
5473
5504
|
};
|
|
5474
5505
|
return {
|
|
5475
|
-
|
|
5476
|
-
isForm,
|
|
5477
|
-
methods,
|
|
5478
|
-
defaultPriority,
|
|
5479
|
-
savePriorities,
|
|
5480
|
-
label,
|
|
5481
|
-
id,
|
|
5482
|
-
onChange
|
|
5506
|
+
savePriorities
|
|
5483
5507
|
};
|
|
5484
5508
|
};
|
|
5485
5509
|
|
|
5486
5510
|
// src/widget/basic/download-file-field/controller.ts
|
|
5487
|
-
var
|
|
5511
|
+
var import_react19 = require("react");
|
|
5488
5512
|
var downloadFileController = () => {
|
|
5489
|
-
const inputId = (0,
|
|
5490
|
-
const [file, setFile] = (0,
|
|
5513
|
+
const inputId = (0, import_react19.useId)();
|
|
5514
|
+
const [file, setFile] = (0, import_react19.useState)(null);
|
|
5491
5515
|
const handleFileChange = (e) => {
|
|
5492
5516
|
setFile(e.target.files[0]);
|
|
5493
5517
|
};
|
|
@@ -6419,13 +6443,13 @@ var dateFieldController = (props) => {
|
|
|
6419
6443
|
};
|
|
6420
6444
|
|
|
6421
6445
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6422
|
-
var
|
|
6423
|
-
var
|
|
6446
|
+
var import_react20 = require("react");
|
|
6447
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
6424
6448
|
var copyLinkButtonController = (props) => {
|
|
6425
6449
|
const { value, defaultValue } = props;
|
|
6426
|
-
const [isCopied, setIsCopied] = (0,
|
|
6450
|
+
const [isCopied, setIsCopied] = (0, import_react20.useState)(false);
|
|
6427
6451
|
const handleCopyToClipboard = async (value2) => {
|
|
6428
|
-
await (0,
|
|
6452
|
+
await (0, import_utils11.copyTextToClipboard)(value2);
|
|
6429
6453
|
setIsCopied(true);
|
|
6430
6454
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
6431
6455
|
};
|
|
@@ -6438,15 +6462,15 @@ var copyLinkButtonController = (props) => {
|
|
|
6438
6462
|
};
|
|
6439
6463
|
|
|
6440
6464
|
// src/widget/basic/color-field/color-controller.ts
|
|
6441
|
-
var
|
|
6465
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
6442
6466
|
var colorFieldController = (props) => {
|
|
6443
6467
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6444
6468
|
const { env } = (0, provider_exports.useEnv)();
|
|
6445
|
-
const { useSave:
|
|
6446
|
-
const _context = { ...(0,
|
|
6469
|
+
const { useSave: useSave2 } = (0, provider_exports.useService)();
|
|
6470
|
+
const _context = { ...(0, import_utils12.evalJSONContext)(actionData?.context) || {} };
|
|
6447
6471
|
const contextObject = { ...env.context, ..._context };
|
|
6448
6472
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6449
|
-
const { mutate: onSave } =
|
|
6473
|
+
const { mutate: onSave } = useSave2();
|
|
6450
6474
|
const savePickColor = async (colorObject) => {
|
|
6451
6475
|
const { id } = colorObject;
|
|
6452
6476
|
if (value === id) return;
|
|
@@ -6471,16 +6495,16 @@ var colorFieldController = (props) => {
|
|
|
6471
6495
|
};
|
|
6472
6496
|
|
|
6473
6497
|
// src/widget/basic/binary-field/controller.ts
|
|
6474
|
-
var
|
|
6475
|
-
var
|
|
6498
|
+
var import_react21 = require("react");
|
|
6499
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6476
6500
|
var binaryFieldController = (props) => {
|
|
6477
6501
|
const { name, methods, readonly = false, value } = props;
|
|
6478
|
-
const inputId = (0,
|
|
6479
|
-
const [selectedImage, setSelectedImage] = (0,
|
|
6480
|
-
const [initialImage, setInitialImage] = (0,
|
|
6481
|
-
const [isInsideTable, setIsInsideTable] = (0,
|
|
6502
|
+
const inputId = (0, import_react21.useId)();
|
|
6503
|
+
const [selectedImage, setSelectedImage] = (0, import_react21.useState)(null);
|
|
6504
|
+
const [initialImage, setInitialImage] = (0, import_react21.useState)(value || null);
|
|
6505
|
+
const [isInsideTable, setIsInsideTable] = (0, import_react21.useState)(false);
|
|
6482
6506
|
const { setValue } = methods;
|
|
6483
|
-
const binaryRef = (0,
|
|
6507
|
+
const binaryRef = (0, import_react21.useRef)(null);
|
|
6484
6508
|
const convertUrlToBase64 = async (url) => {
|
|
6485
6509
|
try {
|
|
6486
6510
|
const response = await fetch(url);
|
|
@@ -6529,11 +6553,11 @@ var binaryFieldController = (props) => {
|
|
|
6529
6553
|
};
|
|
6530
6554
|
const checkIsImageLink = (url) => {
|
|
6531
6555
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6532
|
-
return imageExtensions.test(url) || (0,
|
|
6556
|
+
return imageExtensions.test(url) || (0, import_utils13.isBase64Image)(url) || isBlobUrl(url);
|
|
6533
6557
|
};
|
|
6534
6558
|
const getImageBase64WithMimeType = (base64) => {
|
|
6535
6559
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6536
|
-
if ((0,
|
|
6560
|
+
if ((0, import_utils13.isBase64Image)(base64)) return base64;
|
|
6537
6561
|
let mimeType = null;
|
|
6538
6562
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6539
6563
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6542,14 +6566,14 @@ var binaryFieldController = (props) => {
|
|
|
6542
6566
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
6543
6567
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
6544
6568
|
};
|
|
6545
|
-
(0,
|
|
6569
|
+
(0, import_react21.useEffect)(() => {
|
|
6546
6570
|
return () => {
|
|
6547
6571
|
if (selectedImage) {
|
|
6548
6572
|
URL.revokeObjectURL(selectedImage);
|
|
6549
6573
|
}
|
|
6550
6574
|
};
|
|
6551
6575
|
}, [selectedImage]);
|
|
6552
|
-
(0,
|
|
6576
|
+
(0, import_react21.useEffect)(() => {
|
|
6553
6577
|
if (binaryRef.current) {
|
|
6554
6578
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
6555
6579
|
setIsInsideTable(isInsideTable2);
|
|
@@ -6568,103 +6592,36 @@ var binaryFieldController = (props) => {
|
|
|
6568
6592
|
};
|
|
6569
6593
|
};
|
|
6570
6594
|
|
|
6571
|
-
// src/widget/advance/table/table-body/controller.ts
|
|
6572
|
-
var import_store8 = require("@fctc/interface-logic/store");
|
|
6573
|
-
var import_react21 = require("react");
|
|
6574
|
-
var tableBodyController = (props) => {
|
|
6575
|
-
const {
|
|
6576
|
-
checkedAll,
|
|
6577
|
-
checkboxRef,
|
|
6578
|
-
setIsAutoSelect,
|
|
6579
|
-
selectedRowKeys,
|
|
6580
|
-
row,
|
|
6581
|
-
isAutoSelect,
|
|
6582
|
-
selectedRowKeysRef,
|
|
6583
|
-
onClickRow
|
|
6584
|
-
} = props;
|
|
6585
|
-
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
6586
|
-
const checked = (0, import_react21.useMemo)(() => {
|
|
6587
|
-
if (!row?.id) return false;
|
|
6588
|
-
if (selectedRowKeys?.includes(row.id)) {
|
|
6589
|
-
return true;
|
|
6590
|
-
}
|
|
6591
|
-
return checkedAll;
|
|
6592
|
-
}, [row?.id, selectedRowKeys, checkedAll]);
|
|
6593
|
-
const handleCheckBoxSingle = (event) => {
|
|
6594
|
-
event.stopPropagation();
|
|
6595
|
-
if (checkedAll) {
|
|
6596
|
-
checkboxRef.current = "uncheck";
|
|
6597
|
-
setIsAutoSelect(true);
|
|
6598
|
-
return;
|
|
6599
|
-
}
|
|
6600
|
-
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
6601
|
-
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
6602
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(newSelectedRowKeys));
|
|
6603
|
-
};
|
|
6604
|
-
const handleClickRow = (col, row2) => {
|
|
6605
|
-
onClickRow(col, row2);
|
|
6606
|
-
};
|
|
6607
|
-
(0, import_react21.useEffect)(() => {
|
|
6608
|
-
if (!row?.id) return;
|
|
6609
|
-
if (isAutoSelect) {
|
|
6610
|
-
if (checkboxRef?.current === "uncheck") {
|
|
6611
|
-
const filtered = selectedRowKeysRef.current.filter(
|
|
6612
|
-
(id) => id !== row.id
|
|
6613
|
-
);
|
|
6614
|
-
selectedRowKeysRef.current = filtered;
|
|
6615
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(filtered));
|
|
6616
|
-
} else {
|
|
6617
|
-
const unique = Array.from(
|
|
6618
|
-
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
6619
|
-
);
|
|
6620
|
-
selectedRowKeysRef.current = unique;
|
|
6621
|
-
appDispatch((0, import_store8.setSelectedRowKeys)(unique));
|
|
6622
|
-
}
|
|
6623
|
-
}
|
|
6624
|
-
}, [isAutoSelect]);
|
|
6625
|
-
(0, import_react21.useEffect)(() => {
|
|
6626
|
-
if (!checkedAll) {
|
|
6627
|
-
checkboxRef.current = "enabled";
|
|
6628
|
-
false;
|
|
6629
|
-
}
|
|
6630
|
-
}, [checkedAll]);
|
|
6631
|
-
return {
|
|
6632
|
-
handleCheckBoxSingle,
|
|
6633
|
-
checked,
|
|
6634
|
-
handleClickRow
|
|
6635
|
-
};
|
|
6636
|
-
};
|
|
6637
|
-
|
|
6638
6595
|
// src/widget/advance/table/table-head/controller.ts
|
|
6639
|
-
var
|
|
6596
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
6640
6597
|
var tableHeadController = (props) => {
|
|
6641
6598
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
6642
|
-
const appDispatch = (0,
|
|
6643
|
-
const { groupByDomain } = (0,
|
|
6599
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
6600
|
+
const { groupByDomain } = (0, import_store8.useAppSelector)(import_store8.selectSearch);
|
|
6644
6601
|
const handleCheckBoxAll = (event) => {
|
|
6645
6602
|
if (event?.target?.checked && typeTable === "list") {
|
|
6646
6603
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
6647
|
-
appDispatch((0,
|
|
6604
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(allRowKeys));
|
|
6648
6605
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
6649
6606
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
6650
6607
|
const ids = Array.from(rowsIDs)?.map(
|
|
6651
6608
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
6652
6609
|
);
|
|
6653
6610
|
if (ids?.length > 0) {
|
|
6654
|
-
appDispatch((0,
|
|
6611
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(ids));
|
|
6655
6612
|
} else {
|
|
6656
6613
|
const sum = countSum(
|
|
6657
6614
|
rows,
|
|
6658
6615
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
6659
6616
|
);
|
|
6660
6617
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6661
|
-
appDispatch((0,
|
|
6618
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(keys));
|
|
6662
6619
|
}
|
|
6663
6620
|
if (selectedRowKeysRef) {
|
|
6664
6621
|
selectedRowKeysRef.current = [];
|
|
6665
6622
|
}
|
|
6666
6623
|
} else {
|
|
6667
|
-
appDispatch((0,
|
|
6624
|
+
appDispatch((0, import_store8.setSelectedRowKeys)([]));
|
|
6668
6625
|
}
|
|
6669
6626
|
};
|
|
6670
6627
|
return {
|
|
@@ -6674,8 +6631,8 @@ var tableHeadController = (props) => {
|
|
|
6674
6631
|
|
|
6675
6632
|
// src/widget/advance/table/table-view/controller.ts
|
|
6676
6633
|
var import_react22 = require("react");
|
|
6677
|
-
var
|
|
6678
|
-
var
|
|
6634
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
6635
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6679
6636
|
var tableController = ({ data }) => {
|
|
6680
6637
|
const [rows, setRows] = (0, import_react22.useState)(data.records || []);
|
|
6681
6638
|
const [columns, setColumns] = (0, import_react22.useState)([]);
|
|
@@ -6713,7 +6670,7 @@ var tableController = ({ data }) => {
|
|
|
6713
6670
|
let cols = [];
|
|
6714
6671
|
try {
|
|
6715
6672
|
cols = mergeFields?.filter((item) => {
|
|
6716
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
6673
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils14.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils14.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
6717
6674
|
})?.map((field) => {
|
|
6718
6675
|
return {
|
|
6719
6676
|
name: field?.name,
|
|
@@ -6753,8 +6710,8 @@ var tableController = ({ data }) => {
|
|
|
6753
6710
|
|
|
6754
6711
|
// src/widget/advance/table/table-group/controller.ts
|
|
6755
6712
|
var import_react23 = require("react");
|
|
6756
|
-
var
|
|
6757
|
-
var
|
|
6713
|
+
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
6714
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6758
6715
|
|
|
6759
6716
|
// src/environment.ts
|
|
6760
6717
|
var environment_exports = {};
|
|
@@ -6782,10 +6739,10 @@ var tableGroupController = (props) => {
|
|
|
6782
6739
|
selectedRowKeysRef
|
|
6783
6740
|
} = props;
|
|
6784
6741
|
const [pageGroup, setPageGroup] = (0, import_react23.useState)(0);
|
|
6785
|
-
const { groupByDomain, selectedTags } = (0,
|
|
6786
|
-
const { selectedRowKeys } = (0,
|
|
6787
|
-
const appDispatch = (0,
|
|
6788
|
-
const { toDataJS } = (0,
|
|
6742
|
+
const { groupByDomain, selectedTags } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
6743
|
+
const { selectedRowKeys } = (0, import_store10.useAppSelector)(import_store10.selectList);
|
|
6744
|
+
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
6745
|
+
const { toDataJS } = (0, import_hooks15.useOdooDataTransform)();
|
|
6789
6746
|
const initVal = toDataJS(row, viewData, model);
|
|
6790
6747
|
const [isShowGroup, setIsShowGroup] = (0, import_react23.useState)(false);
|
|
6791
6748
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react23.useState)({
|
|
@@ -6832,7 +6789,7 @@ var tableGroupController = (props) => {
|
|
|
6832
6789
|
isPlaceholderData,
|
|
6833
6790
|
isLoading,
|
|
6834
6791
|
isFetching
|
|
6835
|
-
} = (0,
|
|
6792
|
+
} = (0, import_hooks15.useGetListData)(listDataProps, queryKey, enabled);
|
|
6836
6793
|
const {
|
|
6837
6794
|
columns: columnsGroup,
|
|
6838
6795
|
rows: rowsGroup,
|
|
@@ -6870,14 +6827,14 @@ var tableGroupController = (props) => {
|
|
|
6870
6827
|
const filteredIds = selectedRowKeys.filter(
|
|
6871
6828
|
(id) => !ids.includes(id)
|
|
6872
6829
|
);
|
|
6873
|
-
appDispatch((0,
|
|
6830
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(filteredIds));
|
|
6874
6831
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6875
6832
|
const clonedKeys = [...selectedRowKeys];
|
|
6876
|
-
appDispatch((0,
|
|
6877
|
-
setTimeout(() => appDispatch((0,
|
|
6833
|
+
appDispatch((0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6834
|
+
setTimeout(() => appDispatch((0, import_store10.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6878
6835
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6879
6836
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6880
|
-
appDispatch((0,
|
|
6837
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(filteredKeys));
|
|
6881
6838
|
}
|
|
6882
6839
|
toggleShowGroup();
|
|
6883
6840
|
};
|
|
@@ -6886,8 +6843,8 @@ var tableGroupController = (props) => {
|
|
|
6886
6843
|
return;
|
|
6887
6844
|
}
|
|
6888
6845
|
const clonedKeys = [...selectedRowKeys];
|
|
6889
|
-
(0,
|
|
6890
|
-
setTimeout(() => (0,
|
|
6846
|
+
(0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6847
|
+
setTimeout(() => (0, import_store10.setSelectedRowKeys)(clonedKeys), 500);
|
|
6891
6848
|
}, [isQueryFetched]);
|
|
6892
6849
|
return {
|
|
6893
6850
|
handleExpandChildGroup,
|
|
@@ -6922,7 +6879,7 @@ var tableGroupController = (props) => {
|
|
|
6922
6879
|
|
|
6923
6880
|
// src/widget/advance/search/controller.ts
|
|
6924
6881
|
var import_constants5 = require("@fctc/interface-logic/constants");
|
|
6925
|
-
var
|
|
6882
|
+
var import_utils15 = require("@fctc/interface-logic/utils");
|
|
6926
6883
|
var import_moment2 = __toESM(require_moment());
|
|
6927
6884
|
var import_react24 = require("react");
|
|
6928
6885
|
var searchController = ({
|
|
@@ -6939,9 +6896,9 @@ var searchController = ({
|
|
|
6939
6896
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
6940
6897
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
6941
6898
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
6942
|
-
const actionContext = typeof context === "string" ? (0,
|
|
6899
|
+
const actionContext = typeof context === "string" ? (0, import_utils15.evalJSONContext)(context) : context;
|
|
6943
6900
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6944
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0,
|
|
6901
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils15.evalJSONDomain)(domain, contextSearch) : [];
|
|
6945
6902
|
const clearSearch = () => {
|
|
6946
6903
|
setFilterBy([]);
|
|
6947
6904
|
setGroupBy([]);
|
|
@@ -6956,7 +6913,7 @@ var searchController = ({
|
|
|
6956
6913
|
const dataModel = viewData?.models?.[model];
|
|
6957
6914
|
const searchViews = viewData?.views?.search;
|
|
6958
6915
|
const searchByItems = searchViews?.search_by?.filter(
|
|
6959
|
-
(item) => !
|
|
6916
|
+
(item) => !import_utils15.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
6960
6917
|
)?.map(
|
|
6961
6918
|
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
6962
6919
|
dataIndex: index,
|
|
@@ -6969,10 +6926,10 @@ var searchController = ({
|
|
|
6969
6926
|
})
|
|
6970
6927
|
);
|
|
6971
6928
|
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
6972
|
-
return !
|
|
6929
|
+
return !import_utils15.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
6973
6930
|
})?.map((item) => ({ ...item, active: false }));
|
|
6974
6931
|
const groupByItems = searchViews?.group_by.filter(
|
|
6975
|
-
(item) => !
|
|
6932
|
+
(item) => !import_utils15.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
6976
6933
|
).map((item) => ({
|
|
6977
6934
|
...item,
|
|
6978
6935
|
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
@@ -7049,14 +7006,14 @@ var searchController = ({
|
|
|
7049
7006
|
}
|
|
7050
7007
|
let valueDomainItem = value?.value;
|
|
7051
7008
|
if (value?.modelType === "date") {
|
|
7052
|
-
valueDomainItem = (0,
|
|
7009
|
+
valueDomainItem = (0, import_utils15.validateAndParseDate)(value?.value);
|
|
7053
7010
|
} else if (value?.modelType === "datetime") {
|
|
7054
7011
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
7055
|
-
const parsedDate = (0,
|
|
7012
|
+
const parsedDate = (0, import_utils15.validateAndParseDate)(value?.value, true);
|
|
7056
7013
|
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
7057
7014
|
valueDomainItem = hasTime ? (0, import_moment2.default)(parsedDate).format("YYYY-MM-DD HH:mm:ss") : (0, import_moment2.default)(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
7058
7015
|
} else {
|
|
7059
|
-
valueDomainItem = (0,
|
|
7016
|
+
valueDomainItem = (0, import_utils15.validateAndParseDate)(value?.value, true);
|
|
7060
7017
|
}
|
|
7061
7018
|
}
|
|
7062
7019
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
@@ -7144,7 +7101,7 @@ var searchController = ({
|
|
|
7144
7101
|
active,
|
|
7145
7102
|
dataIndex
|
|
7146
7103
|
} = tag;
|
|
7147
|
-
const domainFormat = new
|
|
7104
|
+
const domainFormat = new import_utils15.domainHelper.Domain(domain2);
|
|
7148
7105
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7149
7106
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7150
7107
|
...tag,
|
|
@@ -7202,7 +7159,6 @@ var searchController = ({
|
|
|
7202
7159
|
priorityFieldController,
|
|
7203
7160
|
searchController,
|
|
7204
7161
|
statusDropdownController,
|
|
7205
|
-
tableBodyController,
|
|
7206
7162
|
tableController,
|
|
7207
7163
|
tableGroupController,
|
|
7208
7164
|
tableHeadController
|