@fctc/widget-logic 1.2.5 → 1.2.7
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 +1 -45
- package/dist/hooks.d.ts +1 -45
- package/dist/hooks.js +28 -140
- package/dist/hooks.mjs +46 -140
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +186 -298
- package/dist/index.mjs +65 -172
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
25
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
26
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -4040,7 +4041,6 @@ __export(index_exports, {
|
|
|
4040
4041
|
CloseIcon: () => CloseIcon,
|
|
4041
4042
|
EyeIcon: () => EyeIcon,
|
|
4042
4043
|
LoadingIcon: () => LoadingIcon,
|
|
4043
|
-
MainAppProvider: () => MainAppProvider,
|
|
4044
4044
|
STORAGES: () => STORAGES,
|
|
4045
4045
|
binaryFieldController: () => binaryFieldController,
|
|
4046
4046
|
colorFieldController: () => colorFieldController,
|
|
@@ -4075,20 +4075,34 @@ __export(index_exports, {
|
|
|
4075
4075
|
useConfig: () => useConfig,
|
|
4076
4076
|
useDebounce: () => useDebounce,
|
|
4077
4077
|
useDetail: () => useDetail,
|
|
4078
|
-
useForgotPasswordHandler: () => useForgotPasswordHandler,
|
|
4079
4078
|
useGetRowIds: () => useGetRowIds,
|
|
4080
4079
|
useListData: () => useListData,
|
|
4081
|
-
useLoginHandler: () => useLoginHandler,
|
|
4082
4080
|
useMenu: () => useMenu,
|
|
4083
4081
|
useProfile: () => useProfile,
|
|
4084
|
-
useResetPasswordHandler: () => useResetPasswordHandler,
|
|
4085
4082
|
useStorageState: () => useStorageState,
|
|
4086
|
-
useSwitchLocaleHandler: () => useSwitchLocaleHandler,
|
|
4087
4083
|
useUser: () => useUser,
|
|
4088
4084
|
useViewV2: () => useViewV2
|
|
4089
4085
|
});
|
|
4090
4086
|
module.exports = __toCommonJS(index_exports);
|
|
4091
4087
|
|
|
4088
|
+
// src/hooks/index.ts
|
|
4089
|
+
var hooks_exports = {};
|
|
4090
|
+
__export(hooks_exports, {
|
|
4091
|
+
AppProvider: () => AppProvider,
|
|
4092
|
+
useAppProvider: () => useAppProvider,
|
|
4093
|
+
useAuth: () => useAuth,
|
|
4094
|
+
useCallAction: () => useCallAction,
|
|
4095
|
+
useClickOutside: () => useClickOutside,
|
|
4096
|
+
useConfig: () => useConfig,
|
|
4097
|
+
useDebounce: () => useDebounce,
|
|
4098
|
+
useDetail: () => useDetail,
|
|
4099
|
+
useListData: () => useListData,
|
|
4100
|
+
useMenu: () => useMenu,
|
|
4101
|
+
useProfile: () => useProfile,
|
|
4102
|
+
useUser: () => useUser,
|
|
4103
|
+
useViewV2: () => useViewV2
|
|
4104
|
+
});
|
|
4105
|
+
|
|
4092
4106
|
// src/hooks/core/use-call-action.ts
|
|
4093
4107
|
var import_interface_logic = require("@fctc/interface-logic");
|
|
4094
4108
|
var import_react = require("react");
|
|
@@ -4755,7 +4769,9 @@ var AppProvider = ({ children }) => {
|
|
|
4755
4769
|
return combineContexts([user.context, company.context]);
|
|
4756
4770
|
}, [user.context, company.context]);
|
|
4757
4771
|
const menu = useMenu({ context: menuContext });
|
|
4758
|
-
const action = (0, import_react10.useMemo)(() =>
|
|
4772
|
+
const action = (0, import_react10.useMemo)(() => {
|
|
4773
|
+
return menu.state.action;
|
|
4774
|
+
}, [menu.state.action]);
|
|
4759
4775
|
const viewContext = (0, import_react10.useMemo)(() => {
|
|
4760
4776
|
return combineContexts([
|
|
4761
4777
|
menuContext,
|
|
@@ -4788,14 +4804,11 @@ var AppProvider = ({ children }) => {
|
|
|
4788
4804
|
}
|
|
4789
4805
|
);
|
|
4790
4806
|
};
|
|
4791
|
-
var MainAppProvider = ({
|
|
4792
|
-
children
|
|
4793
|
-
}) => {
|
|
4794
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface_logic10.MainProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppProvider, { children }) });
|
|
4795
|
-
};
|
|
4796
4807
|
var useAppProvider = () => {
|
|
4797
4808
|
const context = (0, import_react10.useContext)(ReactContext);
|
|
4798
|
-
if (!context)
|
|
4809
|
+
if (!context) {
|
|
4810
|
+
return AppProviderInitialValue;
|
|
4811
|
+
}
|
|
4799
4812
|
return context;
|
|
4800
4813
|
};
|
|
4801
4814
|
|
|
@@ -4845,128 +4858,8 @@ function useDebounce(value, delay) {
|
|
|
4845
4858
|
return [debouncedValue];
|
|
4846
4859
|
}
|
|
4847
4860
|
|
|
4848
|
-
// src/hooks/
|
|
4849
|
-
|
|
4850
|
-
var import_react13 = require("react");
|
|
4851
|
-
var useSwitchLocaleHandler = () => {
|
|
4852
|
-
const switchUserLocale = (0, import_interface_logic11.useSwitchLocale)();
|
|
4853
|
-
const env = (0, import_interface_logic11.getEnv)();
|
|
4854
|
-
const { context } = (0, import_interface_logic11.useAppSelector)(import_interface_logic11.selectEnv);
|
|
4855
|
-
const switchLocale = (0, import_react13.useCallback)(
|
|
4856
|
-
async (langId) => {
|
|
4857
|
-
if (!langId) return;
|
|
4858
|
-
await switchUserLocale.mutateAsync({
|
|
4859
|
-
data: {
|
|
4860
|
-
id: parseInt(context?.uid),
|
|
4861
|
-
values: { lang: langId }
|
|
4862
|
-
}
|
|
4863
|
-
});
|
|
4864
|
-
env.setLang(langId);
|
|
4865
|
-
},
|
|
4866
|
-
[switchUserLocale]
|
|
4867
|
-
);
|
|
4868
|
-
return {
|
|
4869
|
-
switchLocale,
|
|
4870
|
-
isLoading: switchUserLocale.isPending,
|
|
4871
|
-
error: switchUserLocale.error
|
|
4872
|
-
};
|
|
4873
|
-
};
|
|
4874
|
-
|
|
4875
|
-
// src/hooks/api/use-login.ts
|
|
4876
|
-
var import_interface_logic12 = require("@fctc/interface-logic");
|
|
4877
|
-
var import_react14 = require("react");
|
|
4878
|
-
var useLoginHandler = () => {
|
|
4879
|
-
const loginMutate = (0, import_interface_logic12.useLoginCredential)();
|
|
4880
|
-
const login = (0, import_react14.useCallback)(
|
|
4881
|
-
({
|
|
4882
|
-
email,
|
|
4883
|
-
password,
|
|
4884
|
-
path
|
|
4885
|
-
}, {
|
|
4886
|
-
onSuccess,
|
|
4887
|
-
onError
|
|
4888
|
-
}) => {
|
|
4889
|
-
loginMutate.mutate(
|
|
4890
|
-
{
|
|
4891
|
-
email,
|
|
4892
|
-
password,
|
|
4893
|
-
path
|
|
4894
|
-
},
|
|
4895
|
-
{
|
|
4896
|
-
onSuccess,
|
|
4897
|
-
onError
|
|
4898
|
-
}
|
|
4899
|
-
);
|
|
4900
|
-
},
|
|
4901
|
-
[loginMutate]
|
|
4902
|
-
);
|
|
4903
|
-
return {
|
|
4904
|
-
login,
|
|
4905
|
-
isLoading: loginMutate.isPending,
|
|
4906
|
-
error: loginMutate.error
|
|
4907
|
-
};
|
|
4908
|
-
};
|
|
4909
|
-
|
|
4910
|
-
// src/hooks/api/use-forgot-password.ts
|
|
4911
|
-
var import_interface_logic13 = require("@fctc/interface-logic");
|
|
4912
|
-
var import_react15 = require("react");
|
|
4913
|
-
var useForgotPasswordHandler = () => {
|
|
4914
|
-
const forgotPasswordMutate = (0, import_interface_logic13.useForgotPassword)();
|
|
4915
|
-
const sendForgotPassword = (0, import_react15.useCallback)(
|
|
4916
|
-
(email, {
|
|
4917
|
-
onSuccess,
|
|
4918
|
-
onError
|
|
4919
|
-
} = {}) => {
|
|
4920
|
-
forgotPasswordMutate.mutate(email, {
|
|
4921
|
-
onSuccess,
|
|
4922
|
-
onError
|
|
4923
|
-
});
|
|
4924
|
-
},
|
|
4925
|
-
[forgotPasswordMutate]
|
|
4926
|
-
);
|
|
4927
|
-
return {
|
|
4928
|
-
sendForgotPassword,
|
|
4929
|
-
isLoading: forgotPasswordMutate.isPending,
|
|
4930
|
-
error: forgotPasswordMutate.error
|
|
4931
|
-
};
|
|
4932
|
-
};
|
|
4933
|
-
|
|
4934
|
-
// src/hooks/api/use-reset-password.ts
|
|
4935
|
-
var import_interface_logic14 = require("@fctc/interface-logic");
|
|
4936
|
-
var import_react16 = require("react");
|
|
4937
|
-
var useResetPasswordHandler = () => {
|
|
4938
|
-
const resetPasswordMutate = (0, import_interface_logic14.useResetPassword)();
|
|
4939
|
-
const resetPassword = (0, import_react16.useCallback)(
|
|
4940
|
-
({
|
|
4941
|
-
password,
|
|
4942
|
-
confirmPassword,
|
|
4943
|
-
token
|
|
4944
|
-
}, {
|
|
4945
|
-
onSuccess,
|
|
4946
|
-
onError
|
|
4947
|
-
}) => {
|
|
4948
|
-
resetPasswordMutate.mutate(
|
|
4949
|
-
{
|
|
4950
|
-
data: {
|
|
4951
|
-
password,
|
|
4952
|
-
confirmPassword
|
|
4953
|
-
},
|
|
4954
|
-
token
|
|
4955
|
-
},
|
|
4956
|
-
{
|
|
4957
|
-
onSuccess,
|
|
4958
|
-
onError
|
|
4959
|
-
}
|
|
4960
|
-
);
|
|
4961
|
-
},
|
|
4962
|
-
[resetPasswordMutate]
|
|
4963
|
-
);
|
|
4964
|
-
return {
|
|
4965
|
-
resetPassword,
|
|
4966
|
-
isLoading: resetPasswordMutate.isPending,
|
|
4967
|
-
error: resetPasswordMutate.error
|
|
4968
|
-
};
|
|
4969
|
-
};
|
|
4861
|
+
// src/hooks/index.ts
|
|
4862
|
+
__reExport(hooks_exports, require("@fctc/interface-logic/hook"));
|
|
4970
4863
|
|
|
4971
4864
|
// src/icons/eye-icon.tsx
|
|
4972
4865
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -5075,19 +4968,19 @@ var CloseIcon = ({ className = "" }) => {
|
|
|
5075
4968
|
};
|
|
5076
4969
|
|
|
5077
4970
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
5078
|
-
var
|
|
5079
|
-
var
|
|
4971
|
+
var import_react13 = require("react");
|
|
4972
|
+
var import_interface_logic11 = require("@fctc/interface-logic");
|
|
5080
4973
|
var statusDropdownController = (props) => {
|
|
5081
4974
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
5082
|
-
const env = (0,
|
|
4975
|
+
const env = (0, import_interface_logic11.getEnv)();
|
|
5083
4976
|
const colors = {
|
|
5084
4977
|
normal: "bg-[#e9ecef]",
|
|
5085
4978
|
done: "bg-primary",
|
|
5086
4979
|
blocked: "bg-red-500"
|
|
5087
4980
|
};
|
|
5088
|
-
const [isOpen, setIsOpen] = (0,
|
|
5089
|
-
const buttonRef = (0,
|
|
5090
|
-
(0,
|
|
4981
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
4982
|
+
const buttonRef = (0, import_react13.useRef)(null);
|
|
4983
|
+
(0, import_react13.useEffect)(() => {
|
|
5091
4984
|
const handleClickOutside = (event) => {
|
|
5092
4985
|
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
5093
4986
|
setIsOpen(false);
|
|
@@ -5098,7 +4991,7 @@ var statusDropdownController = (props) => {
|
|
|
5098
4991
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5099
4992
|
};
|
|
5100
4993
|
}, []);
|
|
5101
|
-
const { mutate: onSave } = (0,
|
|
4994
|
+
const { mutate: onSave } = (0, import_interface_logic11.useSave)();
|
|
5102
4995
|
const handleClick = async (status) => {
|
|
5103
4996
|
setIsOpen(!isOpen);
|
|
5104
4997
|
onSave(
|
|
@@ -5128,8 +5021,8 @@ var statusDropdownController = (props) => {
|
|
|
5128
5021
|
};
|
|
5129
5022
|
|
|
5130
5023
|
// src/widget/basic/many2one-field/controller.ts
|
|
5131
|
-
var
|
|
5132
|
-
var
|
|
5024
|
+
var import_react14 = require("react");
|
|
5025
|
+
var import_interface_logic12 = require("@fctc/interface-logic");
|
|
5133
5026
|
var many2oneFieldController = (props) => {
|
|
5134
5027
|
const {
|
|
5135
5028
|
name,
|
|
@@ -5144,24 +5037,24 @@ var many2oneFieldController = (props) => {
|
|
|
5144
5037
|
showDetail = true,
|
|
5145
5038
|
actionData
|
|
5146
5039
|
} = props;
|
|
5147
|
-
const [options, setOptions] = (0,
|
|
5148
|
-
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0,
|
|
5149
|
-
const [tempSelectedOption, setTempSelectedOption] = (0,
|
|
5150
|
-
const { menuList } = (0,
|
|
5151
|
-
const { context } = (0,
|
|
5152
|
-
const [domainModal, setDomainModal] = (0,
|
|
5040
|
+
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
5041
|
+
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react14.useState)(false);
|
|
5042
|
+
const [tempSelectedOption, setTempSelectedOption] = (0, import_react14.useState)(null);
|
|
5043
|
+
const { menuList } = (0, import_interface_logic12.useAppSelector)(import_interface_logic12.selectNavbar);
|
|
5044
|
+
const { context } = (0, import_interface_logic12.useAppSelector)(import_interface_logic12.selectEnv);
|
|
5045
|
+
const [domainModal, setDomainModal] = (0, import_react14.useState)(null);
|
|
5153
5046
|
const initValue = methods?.getValues(name);
|
|
5154
|
-
const domainObject = (0,
|
|
5155
|
-
() => (0,
|
|
5047
|
+
const domainObject = (0, import_react14.useMemo)(
|
|
5048
|
+
() => (0, import_interface_logic12.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
|
|
5156
5049
|
[domain, formValues]
|
|
5157
5050
|
);
|
|
5158
|
-
const optionsObject = (0,
|
|
5051
|
+
const optionsObject = (0, import_interface_logic12.evalJSONContext)(fieldOptions) || {};
|
|
5159
5052
|
const contextObject = {
|
|
5160
|
-
...(0,
|
|
5053
|
+
...(0, import_interface_logic12.evalJSONContext)(actionData?.context) || {},
|
|
5161
5054
|
...fieldContext,
|
|
5162
5055
|
...context
|
|
5163
5056
|
};
|
|
5164
|
-
const actionId = (0,
|
|
5057
|
+
const actionId = (0, import_react14.useMemo)(
|
|
5165
5058
|
() => menuList?.flatMap(
|
|
5166
5059
|
(item) => item?.child_id.filter(
|
|
5167
5060
|
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
@@ -5184,23 +5077,23 @@ var many2oneFieldController = (props) => {
|
|
|
5184
5077
|
data: dataOfSelection,
|
|
5185
5078
|
// refetch,
|
|
5186
5079
|
isFetching
|
|
5187
|
-
} = (0,
|
|
5080
|
+
} = (0, import_interface_logic12.useGetSelection)({
|
|
5188
5081
|
data,
|
|
5189
5082
|
queryKey,
|
|
5190
5083
|
enabled: false
|
|
5191
5084
|
});
|
|
5192
|
-
const selectOptions = (0,
|
|
5085
|
+
const selectOptions = (0, import_react14.useMemo)(() => {
|
|
5193
5086
|
return dataOfSelection?.records?.map((val) => ({
|
|
5194
5087
|
value: val?.id,
|
|
5195
5088
|
label: val?.display_name || val?.name
|
|
5196
5089
|
})) || [];
|
|
5197
5090
|
}, [dataOfSelection]);
|
|
5198
|
-
(0,
|
|
5091
|
+
(0, import_react14.useEffect)(() => {
|
|
5199
5092
|
setOptions(selectOptions);
|
|
5200
5093
|
setDomainModal(domainObject);
|
|
5201
|
-
if (relation === "student.subject") (0,
|
|
5094
|
+
if (relation === "student.subject") (0, import_interface_logic12.setListSubject)(selectOptions);
|
|
5202
5095
|
}, [selectOptions]);
|
|
5203
|
-
(0,
|
|
5096
|
+
(0, import_react14.useEffect)(() => {
|
|
5204
5097
|
if (!propValue && tempSelectedOption) {
|
|
5205
5098
|
methods.setValue(name, null);
|
|
5206
5099
|
setTempSelectedOption(null);
|
|
@@ -5211,12 +5104,12 @@ var many2oneFieldController = (props) => {
|
|
|
5211
5104
|
});
|
|
5212
5105
|
}
|
|
5213
5106
|
}, [propValue]);
|
|
5214
|
-
(0,
|
|
5107
|
+
(0, import_react14.useEffect)(() => {
|
|
5215
5108
|
if (actionId) {
|
|
5216
5109
|
localStorage.setItem("aid", actionId);
|
|
5217
5110
|
}
|
|
5218
5111
|
}, [actionId]);
|
|
5219
|
-
const handleChooseRecord = (0,
|
|
5112
|
+
const handleChooseRecord = (0, import_react14.useCallback)(
|
|
5220
5113
|
(idRecord) => {
|
|
5221
5114
|
const newOption = options.find(
|
|
5222
5115
|
(option) => option.value === idRecord
|
|
@@ -5241,8 +5134,8 @@ var many2oneFieldController = (props) => {
|
|
|
5241
5134
|
},
|
|
5242
5135
|
[options, methods, name, onChange]
|
|
5243
5136
|
);
|
|
5244
|
-
const handleClose = (0,
|
|
5245
|
-
const handleSelectChange = (0,
|
|
5137
|
+
const handleClose = (0, import_react14.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
5138
|
+
const handleSelectChange = (0, import_react14.useCallback)(
|
|
5246
5139
|
(selectedOption) => {
|
|
5247
5140
|
if (!selectedOption) {
|
|
5248
5141
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5267,7 +5160,7 @@ var many2oneFieldController = (props) => {
|
|
|
5267
5160
|
[methods, name, onChange]
|
|
5268
5161
|
);
|
|
5269
5162
|
const allowShowDetail = showDetail && contextObject?.form_view_ref && (!("no_open" in optionsObject) || optionsObject?.no_open === false);
|
|
5270
|
-
const fetchMoreOptions = (0,
|
|
5163
|
+
const fetchMoreOptions = (0, import_react14.useCallback)(() => {
|
|
5271
5164
|
if (typeof dataOfSelection?.refetch === "function") {
|
|
5272
5165
|
;
|
|
5273
5166
|
dataOfSelection.refetch();
|
|
@@ -5299,18 +5192,18 @@ var many2oneFieldController = (props) => {
|
|
|
5299
5192
|
};
|
|
5300
5193
|
|
|
5301
5194
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5302
|
-
var
|
|
5195
|
+
var import_interface_logic13 = require("@fctc/interface-logic");
|
|
5303
5196
|
var many2oneButtonController = (props) => {
|
|
5304
5197
|
const { domain, methods, relation } = props;
|
|
5305
5198
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5306
|
-
const env = (0,
|
|
5307
|
-
const domainObject = (0,
|
|
5199
|
+
const env = (0, import_interface_logic13.getEnv)();
|
|
5200
|
+
const domainObject = (0, import_interface_logic13.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5308
5201
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5309
|
-
const { data: dataOfSelection } = (0,
|
|
5202
|
+
const { data: dataOfSelection } = (0, import_interface_logic13.useGetSelection)({
|
|
5310
5203
|
data: {
|
|
5311
5204
|
model: relation ?? "",
|
|
5312
5205
|
domain: domainObject,
|
|
5313
|
-
context: { ...env.context, ...(0,
|
|
5206
|
+
context: { ...env.context, ...(0, import_interface_logic13.evalJSONContext)(actionData?.context) }
|
|
5314
5207
|
},
|
|
5315
5208
|
queryKey: [`data_${relation}`, domainObject]
|
|
5316
5209
|
});
|
|
@@ -5324,12 +5217,12 @@ var many2oneButtonController = (props) => {
|
|
|
5324
5217
|
};
|
|
5325
5218
|
|
|
5326
5219
|
// src/widget/basic/many2many-field/controller.ts
|
|
5327
|
-
var
|
|
5328
|
-
var
|
|
5220
|
+
var import_react18 = require("react");
|
|
5221
|
+
var import_interface_logic18 = require("@fctc/interface-logic");
|
|
5329
5222
|
|
|
5330
5223
|
// src/widget/advance/table/table-body/controller.ts
|
|
5331
|
-
var
|
|
5332
|
-
var
|
|
5224
|
+
var import_interface_logic14 = require("@fctc/interface-logic");
|
|
5225
|
+
var import_react15 = require("react");
|
|
5333
5226
|
var tableBodyController = (props) => {
|
|
5334
5227
|
const {
|
|
5335
5228
|
checkedAll,
|
|
@@ -5341,8 +5234,8 @@ var tableBodyController = (props) => {
|
|
|
5341
5234
|
selectedRowKeysRef,
|
|
5342
5235
|
onClickRow
|
|
5343
5236
|
} = props;
|
|
5344
|
-
const appDispatch = (0,
|
|
5345
|
-
const checked = (0,
|
|
5237
|
+
const appDispatch = (0, import_interface_logic14.useAppDispatch)();
|
|
5238
|
+
const checked = (0, import_react15.useMemo)(() => {
|
|
5346
5239
|
if (!row?.id) return false;
|
|
5347
5240
|
if (selectedRowKeys?.includes(row.id)) {
|
|
5348
5241
|
return true;
|
|
@@ -5358,12 +5251,12 @@ var tableBodyController = (props) => {
|
|
|
5358
5251
|
}
|
|
5359
5252
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
5360
5253
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
5361
|
-
appDispatch((0,
|
|
5254
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(newSelectedRowKeys));
|
|
5362
5255
|
};
|
|
5363
5256
|
const handleClickRow = (col, row2) => {
|
|
5364
5257
|
onClickRow(col, row2);
|
|
5365
5258
|
};
|
|
5366
|
-
(0,
|
|
5259
|
+
(0, import_react15.useEffect)(() => {
|
|
5367
5260
|
if (!row?.id) return;
|
|
5368
5261
|
if (isAutoSelect) {
|
|
5369
5262
|
if (checkboxRef?.current === "uncheck") {
|
|
@@ -5371,17 +5264,17 @@ var tableBodyController = (props) => {
|
|
|
5371
5264
|
(id) => id !== row.id
|
|
5372
5265
|
);
|
|
5373
5266
|
selectedRowKeysRef.current = filtered;
|
|
5374
|
-
appDispatch((0,
|
|
5267
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(filtered));
|
|
5375
5268
|
} else {
|
|
5376
5269
|
const unique = Array.from(
|
|
5377
5270
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
5378
5271
|
);
|
|
5379
5272
|
selectedRowKeysRef.current = unique;
|
|
5380
|
-
appDispatch((0,
|
|
5273
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(unique));
|
|
5381
5274
|
}
|
|
5382
5275
|
}
|
|
5383
5276
|
}, [isAutoSelect]);
|
|
5384
|
-
(0,
|
|
5277
|
+
(0, import_react15.useEffect)(() => {
|
|
5385
5278
|
if (!checkedAll) {
|
|
5386
5279
|
checkboxRef.current = "enabled";
|
|
5387
5280
|
false;
|
|
@@ -5395,35 +5288,35 @@ var tableBodyController = (props) => {
|
|
|
5395
5288
|
};
|
|
5396
5289
|
|
|
5397
5290
|
// src/widget/advance/table/table-head/controller.ts
|
|
5398
|
-
var
|
|
5291
|
+
var import_interface_logic15 = require("@fctc/interface-logic");
|
|
5399
5292
|
var tableHeadController = (props) => {
|
|
5400
5293
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
5401
|
-
const appDispatch = (0,
|
|
5402
|
-
const { groupByDomain } = (0,
|
|
5294
|
+
const appDispatch = (0, import_interface_logic15.useAppDispatch)();
|
|
5295
|
+
const { groupByDomain } = (0, import_interface_logic15.useAppSelector)(import_interface_logic15.selectSearch);
|
|
5403
5296
|
const handleCheckBoxAll = (event) => {
|
|
5404
5297
|
if (event?.target?.checked && typeTable === "list") {
|
|
5405
5298
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
5406
|
-
appDispatch((0,
|
|
5299
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(allRowKeys));
|
|
5407
5300
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
5408
5301
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
5409
5302
|
const ids = Array.from(rowsIDs)?.map(
|
|
5410
5303
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
5411
5304
|
);
|
|
5412
5305
|
if (ids?.length > 0) {
|
|
5413
|
-
appDispatch((0,
|
|
5306
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(ids));
|
|
5414
5307
|
} else {
|
|
5415
5308
|
const sum = countSum(
|
|
5416
5309
|
rows,
|
|
5417
5310
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
5418
5311
|
);
|
|
5419
5312
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
5420
|
-
appDispatch((0,
|
|
5313
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(keys));
|
|
5421
5314
|
}
|
|
5422
5315
|
if (selectedRowKeysRef) {
|
|
5423
5316
|
selectedRowKeysRef.current = [];
|
|
5424
5317
|
}
|
|
5425
5318
|
} else {
|
|
5426
|
-
appDispatch((0,
|
|
5319
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)([]));
|
|
5427
5320
|
}
|
|
5428
5321
|
};
|
|
5429
5322
|
return {
|
|
@@ -5432,11 +5325,11 @@ var tableHeadController = (props) => {
|
|
|
5432
5325
|
};
|
|
5433
5326
|
|
|
5434
5327
|
// src/widget/advance/table/table-view/controller.ts
|
|
5435
|
-
var
|
|
5436
|
-
var
|
|
5328
|
+
var import_interface_logic16 = require("@fctc/interface-logic");
|
|
5329
|
+
var import_react16 = require("react");
|
|
5437
5330
|
var tableController = ({ data }) => {
|
|
5438
|
-
const [rows, setRows] = (0,
|
|
5439
|
-
const [columns, setColumns] = (0,
|
|
5331
|
+
const [rows, setRows] = (0, import_react16.useState)(data.records || []);
|
|
5332
|
+
const [columns, setColumns] = (0, import_react16.useState)([]);
|
|
5440
5333
|
const dataModelFields = data.fields?.map((field) => {
|
|
5441
5334
|
return {
|
|
5442
5335
|
...data.dataModel?.[field?.name],
|
|
@@ -5464,14 +5357,14 @@ var tableController = ({ data }) => {
|
|
|
5464
5357
|
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
5465
5358
|
});
|
|
5466
5359
|
};
|
|
5467
|
-
(0,
|
|
5360
|
+
(0, import_react16.useEffect)(() => {
|
|
5468
5361
|
setRows(transformData(data.records || null));
|
|
5469
5362
|
}, [data.records]);
|
|
5470
5363
|
const handleGetColumns = () => {
|
|
5471
5364
|
let cols = [];
|
|
5472
5365
|
try {
|
|
5473
5366
|
cols = mergeFields?.filter((item) => {
|
|
5474
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
5367
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic16.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic16.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
5475
5368
|
})?.map((field) => {
|
|
5476
5369
|
return {
|
|
5477
5370
|
name: field?.name,
|
|
@@ -5485,7 +5378,7 @@ var tableController = ({ data }) => {
|
|
|
5485
5378
|
}
|
|
5486
5379
|
return cols;
|
|
5487
5380
|
};
|
|
5488
|
-
(0,
|
|
5381
|
+
(0, import_react16.useEffect)(() => {
|
|
5489
5382
|
const columns2 = handleGetColumns();
|
|
5490
5383
|
setColumns(columns2);
|
|
5491
5384
|
}, [data.records]);
|
|
@@ -5510,8 +5403,8 @@ var tableController = ({ data }) => {
|
|
|
5510
5403
|
};
|
|
5511
5404
|
|
|
5512
5405
|
// src/widget/advance/table/table-group/controller.ts
|
|
5513
|
-
var
|
|
5514
|
-
var
|
|
5406
|
+
var import_interface_logic17 = require("@fctc/interface-logic");
|
|
5407
|
+
var import_react17 = require("react");
|
|
5515
5408
|
|
|
5516
5409
|
// src/utils/i18n.ts
|
|
5517
5410
|
var import_react_i18next2 = require("react-i18next");
|
|
@@ -6281,7 +6174,7 @@ var i18n_default = import_i18next.default;
|
|
|
6281
6174
|
|
|
6282
6175
|
// src/widget/advance/table/table-group/controller.ts
|
|
6283
6176
|
var tableGroupController = (props) => {
|
|
6284
|
-
const env = (0,
|
|
6177
|
+
const env = (0, import_interface_logic17.getEnv)();
|
|
6285
6178
|
const {
|
|
6286
6179
|
rows,
|
|
6287
6180
|
columns,
|
|
@@ -6300,18 +6193,18 @@ var tableGroupController = (props) => {
|
|
|
6300
6193
|
setIsAutoSelect,
|
|
6301
6194
|
selectedRowKeysRef
|
|
6302
6195
|
} = props;
|
|
6303
|
-
const [pageGroup, setPageGroup] = (0,
|
|
6304
|
-
const { groupByDomain, selectedTags } = (0,
|
|
6305
|
-
const { selectedRowKeys } = (0,
|
|
6306
|
-
const appDispatch = (0,
|
|
6307
|
-
const { toDataJS } = (0,
|
|
6196
|
+
const [pageGroup, setPageGroup] = (0, import_react17.useState)(0);
|
|
6197
|
+
const { groupByDomain, selectedTags } = (0, import_interface_logic17.useAppSelector)(import_interface_logic17.selectSearch);
|
|
6198
|
+
const { selectedRowKeys } = (0, import_interface_logic17.useAppSelector)(import_interface_logic17.selectList);
|
|
6199
|
+
const appDispatch = (0, import_interface_logic17.useAppDispatch)();
|
|
6200
|
+
const { toDataJS } = (0, import_interface_logic17.useOdooDataTransform)();
|
|
6308
6201
|
const initVal = toDataJS(row, viewData, model);
|
|
6309
|
-
const [isShowGroup, setIsShowGroup] = (0,
|
|
6310
|
-
const [colEmptyGroup, setColEmptyGroup] = (0,
|
|
6202
|
+
const [isShowGroup, setIsShowGroup] = (0, import_react17.useState)(false);
|
|
6203
|
+
const [colEmptyGroup, setColEmptyGroup] = (0, import_react17.useState)({
|
|
6311
6204
|
fromStart: 1,
|
|
6312
6205
|
fromEnd: 1
|
|
6313
6206
|
});
|
|
6314
|
-
const processedData = (0,
|
|
6207
|
+
const processedData = (0, import_react17.useMemo)(() => {
|
|
6315
6208
|
const calculateColSpanEmpty = () => {
|
|
6316
6209
|
const startIndex = columns.findIndex(
|
|
6317
6210
|
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
@@ -6326,7 +6219,7 @@ var tableGroupController = (props) => {
|
|
|
6326
6219
|
};
|
|
6327
6220
|
return calculateColSpanEmpty();
|
|
6328
6221
|
}, [columns, row]);
|
|
6329
|
-
const shouldFetchData = (0,
|
|
6222
|
+
const shouldFetchData = (0, import_react17.useMemo)(() => {
|
|
6330
6223
|
return !!isShowGroup;
|
|
6331
6224
|
}, [isShowGroup]);
|
|
6332
6225
|
const enabled = shouldFetchData && !!processedData;
|
|
@@ -6351,7 +6244,7 @@ var tableGroupController = (props) => {
|
|
|
6351
6244
|
isPlaceholderData,
|
|
6352
6245
|
isLoading,
|
|
6353
6246
|
isFetching
|
|
6354
|
-
} = (0,
|
|
6247
|
+
} = (0, import_interface_logic17.useGetListData)(listDataProps, queryKey, enabled);
|
|
6355
6248
|
const {
|
|
6356
6249
|
columns: columnsGroup,
|
|
6357
6250
|
rows: rowsGroup,
|
|
@@ -6366,7 +6259,7 @@ var tableGroupController = (props) => {
|
|
|
6366
6259
|
}
|
|
6367
6260
|
});
|
|
6368
6261
|
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
6369
|
-
(0,
|
|
6262
|
+
(0, import_react17.useEffect)(() => {
|
|
6370
6263
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
6371
6264
|
setIsShowGroup(false);
|
|
6372
6265
|
}
|
|
@@ -6389,24 +6282,24 @@ var tableGroupController = (props) => {
|
|
|
6389
6282
|
const filteredIds = selectedRowKeys.filter(
|
|
6390
6283
|
(id) => !ids.includes(id)
|
|
6391
6284
|
);
|
|
6392
|
-
appDispatch((0,
|
|
6285
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)(filteredIds));
|
|
6393
6286
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6394
6287
|
const clonedKeys = [...selectedRowKeys];
|
|
6395
|
-
appDispatch((0,
|
|
6396
|
-
setTimeout(() => appDispatch((0,
|
|
6288
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6289
|
+
setTimeout(() => appDispatch((0, import_interface_logic17.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6397
6290
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6398
6291
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6399
|
-
appDispatch((0,
|
|
6292
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)(filteredKeys));
|
|
6400
6293
|
}
|
|
6401
6294
|
toggleShowGroup();
|
|
6402
6295
|
};
|
|
6403
|
-
(0,
|
|
6296
|
+
(0, import_react17.useEffect)(() => {
|
|
6404
6297
|
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
6405
6298
|
return;
|
|
6406
6299
|
}
|
|
6407
6300
|
const clonedKeys = [...selectedRowKeys];
|
|
6408
|
-
(0,
|
|
6409
|
-
setTimeout(() => (0,
|
|
6301
|
+
(0, import_interface_logic17.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6302
|
+
setTimeout(() => (0, import_interface_logic17.setSelectedRowKeys)(clonedKeys), 500);
|
|
6410
6303
|
}, [isQueryFetched]);
|
|
6411
6304
|
return {
|
|
6412
6305
|
handleExpandChildGroup,
|
|
@@ -6456,14 +6349,14 @@ var many2manyFieldController = (props) => {
|
|
|
6456
6349
|
options,
|
|
6457
6350
|
sessionStorageUtils
|
|
6458
6351
|
} = props;
|
|
6459
|
-
const appDispatch = (0,
|
|
6352
|
+
const appDispatch = (0, import_interface_logic18.useAppDispatch)();
|
|
6460
6353
|
const actionData = sessionStorageUtils.getActionData();
|
|
6461
6354
|
const [debouncedPage] = useDebounce(page, 500);
|
|
6462
|
-
const [order, setOrder] = (0,
|
|
6463
|
-
const [isLoadedData, setIsLoadedData] = (0,
|
|
6464
|
-
const [domainMany2Many, setDomainMany2Many] = (0,
|
|
6465
|
-
const env = (0,
|
|
6466
|
-
const { selectedTags } = (0,
|
|
6355
|
+
const [order, setOrder] = (0, import_react18.useState)();
|
|
6356
|
+
const [isLoadedData, setIsLoadedData] = (0, import_react18.useState)(false);
|
|
6357
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react18.useState)(domain);
|
|
6358
|
+
const env = (0, import_interface_logic18.getEnv)();
|
|
6359
|
+
const { selectedTags } = (0, import_interface_logic18.useAppSelector)(import_interface_logic18.selectSearch);
|
|
6467
6360
|
const viewParams = {
|
|
6468
6361
|
model: relation,
|
|
6469
6362
|
views: [
|
|
@@ -6472,11 +6365,11 @@ var many2manyFieldController = (props) => {
|
|
|
6472
6365
|
],
|
|
6473
6366
|
context
|
|
6474
6367
|
};
|
|
6475
|
-
const { data: viewResponse, isFetched: isViewReponseFetched } = (0,
|
|
6368
|
+
const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic18.useGetView)(
|
|
6476
6369
|
viewParams,
|
|
6477
6370
|
actionData
|
|
6478
6371
|
);
|
|
6479
|
-
const baseModel = (0,
|
|
6372
|
+
const baseModel = (0, import_react18.useMemo)(
|
|
6480
6373
|
() => ({
|
|
6481
6374
|
name: String(relation),
|
|
6482
6375
|
view: viewResponse || {},
|
|
@@ -6488,26 +6381,26 @@ var many2manyFieldController = (props) => {
|
|
|
6488
6381
|
}),
|
|
6489
6382
|
[model, viewResponse]
|
|
6490
6383
|
);
|
|
6491
|
-
const initModel = (0,
|
|
6492
|
-
const modelInstance = (0,
|
|
6384
|
+
const initModel = (0, import_interface_logic18.useModel)();
|
|
6385
|
+
const modelInstance = (0, import_react18.useMemo)(() => {
|
|
6493
6386
|
if (viewResponse) {
|
|
6494
6387
|
return initModel.initModel(baseModel);
|
|
6495
6388
|
}
|
|
6496
6389
|
return null;
|
|
6497
6390
|
}, [baseModel, viewResponse]);
|
|
6498
|
-
const specification = (0,
|
|
6391
|
+
const specification = (0, import_react18.useMemo)(() => {
|
|
6499
6392
|
if (modelInstance) {
|
|
6500
6393
|
return modelInstance.getSpecification();
|
|
6501
6394
|
}
|
|
6502
6395
|
return null;
|
|
6503
6396
|
}, [modelInstance]);
|
|
6504
6397
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
6505
|
-
const optionsObject = tab?.options ? (0,
|
|
6398
|
+
const optionsObject = tab?.options ? (0, import_interface_logic18.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic18.evalJSONContext)(options) : {}) || {};
|
|
6506
6399
|
const fetchData = async () => {
|
|
6507
6400
|
try {
|
|
6508
6401
|
setDomainMany2Many(domain);
|
|
6509
|
-
appDispatch((0,
|
|
6510
|
-
appDispatch((0,
|
|
6402
|
+
appDispatch((0, import_interface_logic18.setFirstDomain)(domain));
|
|
6403
|
+
appDispatch((0, import_interface_logic18.setViewDataStore)(viewResponse));
|
|
6511
6404
|
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
6512
6405
|
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
6513
6406
|
...field
|
|
@@ -6518,7 +6411,7 @@ var many2manyFieldController = (props) => {
|
|
|
6518
6411
|
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
6519
6412
|
});
|
|
6520
6413
|
}
|
|
6521
|
-
appDispatch((0,
|
|
6414
|
+
appDispatch((0, import_interface_logic18.setPage)(0));
|
|
6522
6415
|
} catch (err) {
|
|
6523
6416
|
console.log(err);
|
|
6524
6417
|
}
|
|
@@ -6540,7 +6433,7 @@ var many2manyFieldController = (props) => {
|
|
|
6540
6433
|
context,
|
|
6541
6434
|
fields: groupByDomain?.fields,
|
|
6542
6435
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
6543
|
-
sort: order ? order : default_order ? (0,
|
|
6436
|
+
sort: order ? order : default_order ? (0, import_interface_logic18.formatSortingString)(default_order) : ""
|
|
6544
6437
|
};
|
|
6545
6438
|
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
6546
6439
|
const {
|
|
@@ -6548,18 +6441,18 @@ var many2manyFieldController = (props) => {
|
|
|
6548
6441
|
isLoading: isDataLoading,
|
|
6549
6442
|
isFetched: isDataResponseFetched,
|
|
6550
6443
|
isPlaceholderData
|
|
6551
|
-
} = (0,
|
|
6552
|
-
(0,
|
|
6444
|
+
} = (0, import_interface_logic18.useGetListData)(data, queryKey, enabled);
|
|
6445
|
+
(0, import_react18.useEffect)(() => {
|
|
6553
6446
|
if (viewResponse) {
|
|
6554
6447
|
fetchData();
|
|
6555
6448
|
}
|
|
6556
6449
|
return () => {
|
|
6557
|
-
appDispatch((0,
|
|
6450
|
+
appDispatch((0, import_interface_logic18.setGroupByDomain)(null));
|
|
6558
6451
|
setFields((prevFields) => ({
|
|
6559
6452
|
...prevFields,
|
|
6560
6453
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
6561
6454
|
}));
|
|
6562
|
-
appDispatch((0,
|
|
6455
|
+
appDispatch((0, import_interface_logic18.setPage)(0));
|
|
6563
6456
|
setSelectedRowKeys4([]);
|
|
6564
6457
|
setDomainMany2Many(null);
|
|
6565
6458
|
setIsLoadedData(false);
|
|
@@ -6583,18 +6476,18 @@ var many2manyFieldController = (props) => {
|
|
|
6583
6476
|
refetch,
|
|
6584
6477
|
data: dataFormViewResponse,
|
|
6585
6478
|
isSuccess
|
|
6586
|
-
} = (0,
|
|
6479
|
+
} = (0, import_interface_logic18.useGetFormView)({
|
|
6587
6480
|
data: dataFormView,
|
|
6588
6481
|
queryKey: [`form-view-action-${relation}`],
|
|
6589
6482
|
enabled: false
|
|
6590
6483
|
});
|
|
6591
|
-
(0,
|
|
6484
|
+
(0, import_react18.useEffect)(() => {
|
|
6592
6485
|
if (isSuccess && dataFormViewResponse) {
|
|
6593
6486
|
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
6594
6487
|
window.location.href = `/form/menu?model=${relation}`;
|
|
6595
6488
|
}
|
|
6596
6489
|
}, [isSuccess]);
|
|
6597
|
-
(0,
|
|
6490
|
+
(0, import_react18.useEffect)(() => {
|
|
6598
6491
|
if (domainMany2Many && !isLoadedData) {
|
|
6599
6492
|
setIsLoadedData(true);
|
|
6600
6493
|
}
|
|
@@ -6610,8 +6503,8 @@ var many2manyFieldController = (props) => {
|
|
|
6610
6503
|
};
|
|
6611
6504
|
|
|
6612
6505
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
6613
|
-
var
|
|
6614
|
-
var
|
|
6506
|
+
var import_react19 = require("react");
|
|
6507
|
+
var import_interface_logic19 = require("@fctc/interface-logic");
|
|
6615
6508
|
var many2manyTagsController = (props) => {
|
|
6616
6509
|
const {
|
|
6617
6510
|
relation,
|
|
@@ -6622,10 +6515,10 @@ var many2manyTagsController = (props) => {
|
|
|
6622
6515
|
placeholderNoOption
|
|
6623
6516
|
} = props;
|
|
6624
6517
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
6625
|
-
const env = (0,
|
|
6626
|
-
const addtionalFields = optionsFields ? (0,
|
|
6627
|
-
const domainObject = (0,
|
|
6628
|
-
() => (0,
|
|
6518
|
+
const env = (0, import_interface_logic19.getEnv)();
|
|
6519
|
+
const addtionalFields = optionsFields ? (0, import_interface_logic19.evalJSONContext)(optionsFields) : null;
|
|
6520
|
+
const domainObject = (0, import_react19.useMemo)(
|
|
6521
|
+
() => (0, import_interface_logic19.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
6629
6522
|
[domain, formValues]
|
|
6630
6523
|
);
|
|
6631
6524
|
const data = {
|
|
@@ -6635,13 +6528,13 @@ var many2manyTagsController = (props) => {
|
|
|
6635
6528
|
id: {},
|
|
6636
6529
|
name: {},
|
|
6637
6530
|
display_name: {},
|
|
6638
|
-
...widget &&
|
|
6639
|
-
...widget &&
|
|
6531
|
+
...widget && import_interface_logic19.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
6532
|
+
...widget && import_interface_logic19.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
6640
6533
|
},
|
|
6641
6534
|
enabled: true,
|
|
6642
6535
|
context: env.context
|
|
6643
6536
|
};
|
|
6644
|
-
const { data: dataOfSelection } = (0,
|
|
6537
|
+
const { data: dataOfSelection } = (0, import_interface_logic19.useGetSelection)({
|
|
6645
6538
|
data,
|
|
6646
6539
|
queryKey: [`data_${relation}`, domainObject]
|
|
6647
6540
|
});
|
|
@@ -6667,8 +6560,8 @@ var many2manyTagsController = (props) => {
|
|
|
6667
6560
|
};
|
|
6668
6561
|
|
|
6669
6562
|
// src/widget/basic/status-bar-field/controller.ts
|
|
6670
|
-
var
|
|
6671
|
-
var
|
|
6563
|
+
var import_react20 = require("react");
|
|
6564
|
+
var import_interface_logic20 = require("@fctc/interface-logic");
|
|
6672
6565
|
var durationController = (props) => {
|
|
6673
6566
|
const {
|
|
6674
6567
|
relation,
|
|
@@ -6685,14 +6578,14 @@ var durationController = (props) => {
|
|
|
6685
6578
|
name: "",
|
|
6686
6579
|
fold: ""
|
|
6687
6580
|
};
|
|
6688
|
-
const [disabled, setDisabled] = (0,
|
|
6689
|
-
const [modelStatus, setModalStatus] = (0,
|
|
6690
|
-
const { context } = (0,
|
|
6581
|
+
const [disabled, setDisabled] = (0, import_react20.useState)(false);
|
|
6582
|
+
const [modelStatus, setModalStatus] = (0, import_react20.useState)(false);
|
|
6583
|
+
const { context } = (0, import_interface_logic20.useAppSelector)(import_interface_logic20.selectEnv);
|
|
6691
6584
|
const queryKey = [`data-status-duration`, specification];
|
|
6692
6585
|
const listDataProps = {
|
|
6693
6586
|
model: relation,
|
|
6694
6587
|
specification,
|
|
6695
|
-
domain: (0,
|
|
6588
|
+
domain: (0, import_interface_logic20.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
6696
6589
|
limit: 10,
|
|
6697
6590
|
offset: 0,
|
|
6698
6591
|
fields: "",
|
|
@@ -6702,8 +6595,8 @@ var durationController = (props) => {
|
|
|
6702
6595
|
},
|
|
6703
6596
|
sort: ""
|
|
6704
6597
|
};
|
|
6705
|
-
const { data: dataResponse } = (0,
|
|
6706
|
-
const { mutate: fetchChangeStatus } = (0,
|
|
6598
|
+
const { data: dataResponse } = (0, import_interface_logic20.useGetListData)(listDataProps, queryKey);
|
|
6599
|
+
const { mutate: fetchChangeStatus } = (0, import_interface_logic20.useChangeStatus)();
|
|
6707
6600
|
const handleClick = async (stage_id) => {
|
|
6708
6601
|
setDisabled(true);
|
|
6709
6602
|
if (stage_id) {
|
|
@@ -6739,7 +6632,7 @@ var durationController = (props) => {
|
|
|
6739
6632
|
};
|
|
6740
6633
|
|
|
6741
6634
|
// src/widget/basic/priority-field/controller.ts
|
|
6742
|
-
var
|
|
6635
|
+
var import_interface_logic21 = require("@fctc/interface-logic");
|
|
6743
6636
|
var priorityFieldController = (props) => {
|
|
6744
6637
|
const {
|
|
6745
6638
|
value,
|
|
@@ -6754,11 +6647,11 @@ var priorityFieldController = (props) => {
|
|
|
6754
6647
|
viewData,
|
|
6755
6648
|
context
|
|
6756
6649
|
} = props;
|
|
6757
|
-
const _context = { ...(0,
|
|
6650
|
+
const _context = { ...(0, import_interface_logic21.evalJSONContext)(actionData?.context) };
|
|
6758
6651
|
const contextObject = { ...context, ..._context };
|
|
6759
6652
|
const defaultPriority = parseInt(value) + 1;
|
|
6760
6653
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
6761
|
-
const { mutateAsync: fetchSave } = (0,
|
|
6654
|
+
const { mutateAsync: fetchSave } = (0, import_interface_logic21.useSave)();
|
|
6762
6655
|
const savePriorities = async ({
|
|
6763
6656
|
value: value2,
|
|
6764
6657
|
resetPriority
|
|
@@ -6793,8 +6686,8 @@ var priorityFieldController = (props) => {
|
|
|
6793
6686
|
};
|
|
6794
6687
|
|
|
6795
6688
|
// src/widget/basic/float-time-field/controller.ts
|
|
6796
|
-
var
|
|
6797
|
-
var
|
|
6689
|
+
var import_react21 = require("react");
|
|
6690
|
+
var import_interface_logic22 = require("@fctc/interface-logic");
|
|
6798
6691
|
var floatTimeFiledController = ({
|
|
6799
6692
|
onChange: fieldOnChange,
|
|
6800
6693
|
onBlur,
|
|
@@ -6803,11 +6696,11 @@ var floatTimeFiledController = ({
|
|
|
6803
6696
|
props
|
|
6804
6697
|
}) => {
|
|
6805
6698
|
const { name, defaultValue = 0, onChange } = props;
|
|
6806
|
-
const [input, setInput] = (0,
|
|
6807
|
-
(0,
|
|
6699
|
+
const [input, setInput] = (0, import_react21.useState)(
|
|
6700
|
+
(0, import_interface_logic22.convertFloatToTime)(value ?? defaultValue)
|
|
6808
6701
|
);
|
|
6809
|
-
const [formattedTime, setFormattedTime] = (0,
|
|
6810
|
-
const [errors, setErrors] = (0,
|
|
6702
|
+
const [formattedTime, setFormattedTime] = (0, import_react21.useState)("");
|
|
6703
|
+
const [errors, setErrors] = (0, import_react21.useState)("");
|
|
6811
6704
|
const handleInputChange = (e) => {
|
|
6812
6705
|
const raw = e.target.value.replace(/[^\d:]/g, "");
|
|
6813
6706
|
setInput(raw);
|
|
@@ -6837,7 +6730,7 @@ var floatTimeFiledController = ({
|
|
|
6837
6730
|
if (!isDirty) return;
|
|
6838
6731
|
if (formattedTime) {
|
|
6839
6732
|
setInput(formattedTime);
|
|
6840
|
-
const floatVal = (0,
|
|
6733
|
+
const floatVal = (0, import_interface_logic22.convertTimeToFloat)(formattedTime);
|
|
6841
6734
|
fieldOnChange(floatVal);
|
|
6842
6735
|
if (onChange) {
|
|
6843
6736
|
onChange(name ?? "", floatVal);
|
|
@@ -6880,7 +6773,7 @@ var floatTimeFiledController = ({
|
|
|
6880
6773
|
};
|
|
6881
6774
|
|
|
6882
6775
|
// src/widget/basic/float-field/controller.ts
|
|
6883
|
-
var
|
|
6776
|
+
var import_react22 = require("react");
|
|
6884
6777
|
var floatController = ({
|
|
6885
6778
|
onChange,
|
|
6886
6779
|
value,
|
|
@@ -6888,10 +6781,10 @@ var floatController = ({
|
|
|
6888
6781
|
}) => {
|
|
6889
6782
|
const { name, required, methods, onChange: handleOnchange, string } = props;
|
|
6890
6783
|
const { setError, clearErrors } = methods;
|
|
6891
|
-
const [inputValue, setInputValue] = (0,
|
|
6784
|
+
const [inputValue, setInputValue] = (0, import_react22.useState)(
|
|
6892
6785
|
value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
|
|
6893
6786
|
);
|
|
6894
|
-
(0,
|
|
6787
|
+
(0, import_react22.useEffect)(() => {
|
|
6895
6788
|
if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
|
|
6896
6789
|
setInputValue(useFormatFloatNumber(value));
|
|
6897
6790
|
clearErrors(name);
|
|
@@ -6899,9 +6792,9 @@ var floatController = ({
|
|
|
6899
6792
|
setInputValue("");
|
|
6900
6793
|
}
|
|
6901
6794
|
}, [value, name, clearErrors]);
|
|
6902
|
-
const isDirtyRef = (0,
|
|
6903
|
-
const inputRef = (0,
|
|
6904
|
-
const lastCommittedValueRef = (0,
|
|
6795
|
+
const isDirtyRef = (0, import_react22.useRef)(false);
|
|
6796
|
+
const inputRef = (0, import_react22.useRef)(null);
|
|
6797
|
+
const lastCommittedValueRef = (0, import_react22.useRef)(null);
|
|
6905
6798
|
const handleInputChange = (e) => {
|
|
6906
6799
|
const newValue = e.target.value;
|
|
6907
6800
|
const valueWithoutCommas = newValue.replace(/,/g, "");
|
|
@@ -7002,10 +6895,10 @@ var useFormatFloatNumber = (value) => {
|
|
|
7002
6895
|
};
|
|
7003
6896
|
|
|
7004
6897
|
// src/widget/basic/download-file-field/controller.ts
|
|
7005
|
-
var
|
|
6898
|
+
var import_react23 = require("react");
|
|
7006
6899
|
var downloadFileController = () => {
|
|
7007
|
-
const inputId = (0,
|
|
7008
|
-
const [file, setFile] = (0,
|
|
6900
|
+
const inputId = (0, import_react23.useId)();
|
|
6901
|
+
const [file, setFile] = (0, import_react23.useState)(null);
|
|
7009
6902
|
const handleFileChange = (e) => {
|
|
7010
6903
|
setFile(e.target.files[0]);
|
|
7011
6904
|
};
|
|
@@ -7169,13 +7062,13 @@ var dateFieldController = (props) => {
|
|
|
7169
7062
|
};
|
|
7170
7063
|
|
|
7171
7064
|
// src/widget/basic/copy-link-button/controller.ts
|
|
7172
|
-
var
|
|
7173
|
-
var
|
|
7065
|
+
var import_react24 = require("react");
|
|
7066
|
+
var import_interface_logic23 = require("@fctc/interface-logic");
|
|
7174
7067
|
var copyLinkButtonController = (props) => {
|
|
7175
7068
|
const { value, defaultValue } = props;
|
|
7176
|
-
const [isCopied, setIsCopied] = (0,
|
|
7069
|
+
const [isCopied, setIsCopied] = (0, import_react24.useState)(false);
|
|
7177
7070
|
const handleCopyToClipboard = async (value2) => {
|
|
7178
|
-
await (0,
|
|
7071
|
+
await (0, import_interface_logic23.copyTextToClipboard)(value2);
|
|
7179
7072
|
setIsCopied(true);
|
|
7180
7073
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
7181
7074
|
};
|
|
@@ -7188,14 +7081,14 @@ var copyLinkButtonController = (props) => {
|
|
|
7188
7081
|
};
|
|
7189
7082
|
|
|
7190
7083
|
// src/widget/basic/color-field/color-controller.ts
|
|
7191
|
-
var
|
|
7084
|
+
var import_interface_logic24 = require("@fctc/interface-logic");
|
|
7192
7085
|
var colorFieldController = (props) => {
|
|
7193
7086
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
7194
|
-
const env = (0,
|
|
7195
|
-
const _context = { ...(0,
|
|
7087
|
+
const env = (0, import_interface_logic24.getEnv)();
|
|
7088
|
+
const _context = { ...(0, import_interface_logic24.evalJSONContext)(actionData?.context) || {} };
|
|
7196
7089
|
const contextObject = { ...env.context, ..._context };
|
|
7197
7090
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
7198
|
-
const { mutate: onSave } = (0,
|
|
7091
|
+
const { mutate: onSave } = (0, import_interface_logic24.useSave)();
|
|
7199
7092
|
const savePickColor = async (colorObject) => {
|
|
7200
7093
|
const { id } = colorObject;
|
|
7201
7094
|
if (value === id) return;
|
|
@@ -7220,16 +7113,16 @@ var colorFieldController = (props) => {
|
|
|
7220
7113
|
};
|
|
7221
7114
|
|
|
7222
7115
|
// src/widget/basic/binary-field/controller.ts
|
|
7223
|
-
var
|
|
7224
|
-
var
|
|
7116
|
+
var import_react25 = require("react");
|
|
7117
|
+
var import_interface_logic25 = require("@fctc/interface-logic");
|
|
7225
7118
|
var binaryFieldController = (props) => {
|
|
7226
7119
|
const { name, methods, readonly = false, value } = props;
|
|
7227
|
-
const inputId = (0,
|
|
7228
|
-
const [selectedImage, setSelectedImage] = (0,
|
|
7229
|
-
const [initialImage, setInitialImage] = (0,
|
|
7230
|
-
const [isInsideTable, setIsInsideTable] = (0,
|
|
7120
|
+
const inputId = (0, import_react25.useId)();
|
|
7121
|
+
const [selectedImage, setSelectedImage] = (0, import_react25.useState)(null);
|
|
7122
|
+
const [initialImage, setInitialImage] = (0, import_react25.useState)(value || null);
|
|
7123
|
+
const [isInsideTable, setIsInsideTable] = (0, import_react25.useState)(false);
|
|
7231
7124
|
const { setValue } = methods;
|
|
7232
|
-
const binaryRef = (0,
|
|
7125
|
+
const binaryRef = (0, import_react25.useRef)(null);
|
|
7233
7126
|
const convertUrlToBase64 = async (url) => {
|
|
7234
7127
|
try {
|
|
7235
7128
|
const response = await fetch(url);
|
|
@@ -7278,11 +7171,11 @@ var binaryFieldController = (props) => {
|
|
|
7278
7171
|
};
|
|
7279
7172
|
const checkIsImageLink = (url) => {
|
|
7280
7173
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
7281
|
-
return imageExtensions.test(url) || (0,
|
|
7174
|
+
return imageExtensions.test(url) || (0, import_interface_logic25.isBase64Image)(url) || isBlobUrl(url);
|
|
7282
7175
|
};
|
|
7283
7176
|
const getImageBase64WithMimeType = (base64) => {
|
|
7284
7177
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
7285
|
-
if ((0,
|
|
7178
|
+
if ((0, import_interface_logic25.isBase64Image)(base64)) return base64;
|
|
7286
7179
|
let mimeType = null;
|
|
7287
7180
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
7288
7181
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -7291,14 +7184,14 @@ var binaryFieldController = (props) => {
|
|
|
7291
7184
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
7292
7185
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
7293
7186
|
};
|
|
7294
|
-
(0,
|
|
7187
|
+
(0, import_react25.useEffect)(() => {
|
|
7295
7188
|
return () => {
|
|
7296
7189
|
if (selectedImage) {
|
|
7297
7190
|
URL.revokeObjectURL(selectedImage);
|
|
7298
7191
|
}
|
|
7299
7192
|
};
|
|
7300
7193
|
}, [selectedImage]);
|
|
7301
|
-
(0,
|
|
7194
|
+
(0, import_react25.useEffect)(() => {
|
|
7302
7195
|
if (binaryRef.current) {
|
|
7303
7196
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
7304
7197
|
setIsInsideTable(isInsideTable2);
|
|
@@ -7324,7 +7217,6 @@ var binaryFieldController = (props) => {
|
|
|
7324
7217
|
CloseIcon,
|
|
7325
7218
|
EyeIcon,
|
|
7326
7219
|
LoadingIcon,
|
|
7327
|
-
MainAppProvider,
|
|
7328
7220
|
STORAGES,
|
|
7329
7221
|
binaryFieldController,
|
|
7330
7222
|
colorFieldController,
|
|
@@ -7359,15 +7251,11 @@ var binaryFieldController = (props) => {
|
|
|
7359
7251
|
useConfig,
|
|
7360
7252
|
useDebounce,
|
|
7361
7253
|
useDetail,
|
|
7362
|
-
useForgotPasswordHandler,
|
|
7363
7254
|
useGetRowIds,
|
|
7364
7255
|
useListData,
|
|
7365
|
-
useLoginHandler,
|
|
7366
7256
|
useMenu,
|
|
7367
7257
|
useProfile,
|
|
7368
|
-
useResetPasswordHandler,
|
|
7369
7258
|
useStorageState,
|
|
7370
|
-
useSwitchLocaleHandler,
|
|
7371
7259
|
useUser,
|
|
7372
7260
|
useViewV2
|
|
7373
7261
|
});
|