@fctc/widget-logic 1.2.5 → 1.2.6
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 +5 -41
- package/dist/hooks.d.ts +5 -41
- package/dist/hooks.js +18 -108
- package/dist/hooks.mjs +19 -113
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +177 -267
- package/dist/index.mjs +51 -145
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4040,7 +4040,6 @@ __export(index_exports, {
|
|
|
4040
4040
|
CloseIcon: () => CloseIcon,
|
|
4041
4041
|
EyeIcon: () => EyeIcon,
|
|
4042
4042
|
LoadingIcon: () => LoadingIcon,
|
|
4043
|
-
MainAppProvider: () => MainAppProvider,
|
|
4044
4043
|
STORAGES: () => STORAGES,
|
|
4045
4044
|
binaryFieldController: () => binaryFieldController,
|
|
4046
4045
|
colorFieldController: () => colorFieldController,
|
|
@@ -4755,7 +4754,9 @@ var AppProvider = ({ children }) => {
|
|
|
4755
4754
|
return combineContexts([user.context, company.context]);
|
|
4756
4755
|
}, [user.context, company.context]);
|
|
4757
4756
|
const menu = useMenu({ context: menuContext });
|
|
4758
|
-
const action = (0, import_react10.useMemo)(() =>
|
|
4757
|
+
const action = (0, import_react10.useMemo)(() => {
|
|
4758
|
+
return menu.state.action;
|
|
4759
|
+
}, [menu.state.action]);
|
|
4759
4760
|
const viewContext = (0, import_react10.useMemo)(() => {
|
|
4760
4761
|
return combineContexts([
|
|
4761
4762
|
menuContext,
|
|
@@ -4788,14 +4789,11 @@ var AppProvider = ({ children }) => {
|
|
|
4788
4789
|
}
|
|
4789
4790
|
);
|
|
4790
4791
|
};
|
|
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
4792
|
var useAppProvider = () => {
|
|
4797
4793
|
const context = (0, import_react10.useContext)(ReactContext);
|
|
4798
|
-
if (!context)
|
|
4794
|
+
if (!context) {
|
|
4795
|
+
return AppProviderInitialValue;
|
|
4796
|
+
}
|
|
4799
4797
|
return context;
|
|
4800
4798
|
};
|
|
4801
4799
|
|
|
@@ -4846,125 +4844,38 @@ function useDebounce(value, delay) {
|
|
|
4846
4844
|
}
|
|
4847
4845
|
|
|
4848
4846
|
// src/hooks/api/use-switch-locale.ts
|
|
4849
|
-
var import_interface_logic11 = require("@fctc/interface-logic");
|
|
4850
|
-
var import_react13 = require("react");
|
|
4851
4847
|
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
4848
|
return {
|
|
4869
|
-
switchLocale,
|
|
4870
|
-
isLoading: switchUserLocale.isPending,
|
|
4871
|
-
error: switchUserLocale.error
|
|
4849
|
+
// switchLocale,
|
|
4850
|
+
// isLoading: switchUserLocale.isPending,
|
|
4851
|
+
// error: switchUserLocale.error,
|
|
4872
4852
|
};
|
|
4873
4853
|
};
|
|
4874
4854
|
|
|
4875
4855
|
// src/hooks/api/use-login.ts
|
|
4876
|
-
var import_interface_logic12 = require("@fctc/interface-logic");
|
|
4877
|
-
var import_react14 = require("react");
|
|
4878
4856
|
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
4857
|
return {
|
|
4904
|
-
login,
|
|
4905
|
-
isLoading: loginMutate.isPending,
|
|
4906
|
-
error: loginMutate.error
|
|
4858
|
+
// login,
|
|
4859
|
+
// isLoading: loginMutate.isPending,
|
|
4860
|
+
// error: loginMutate.error,
|
|
4907
4861
|
};
|
|
4908
4862
|
};
|
|
4909
4863
|
|
|
4910
4864
|
// src/hooks/api/use-forgot-password.ts
|
|
4911
|
-
var import_interface_logic13 = require("@fctc/interface-logic");
|
|
4912
|
-
var import_react15 = require("react");
|
|
4913
4865
|
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
4866
|
return {
|
|
4928
|
-
sendForgotPassword,
|
|
4929
|
-
isLoading: forgotPasswordMutate.isPending,
|
|
4930
|
-
error: forgotPasswordMutate.error
|
|
4867
|
+
// sendForgotPassword,
|
|
4868
|
+
// isLoading: forgotPasswordMutate.isPending,
|
|
4869
|
+
// error: forgotPasswordMutate.error,
|
|
4931
4870
|
};
|
|
4932
4871
|
};
|
|
4933
4872
|
|
|
4934
4873
|
// src/hooks/api/use-reset-password.ts
|
|
4935
|
-
var import_interface_logic14 = require("@fctc/interface-logic");
|
|
4936
|
-
var import_react16 = require("react");
|
|
4937
4874
|
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
4875
|
return {
|
|
4965
|
-
resetPassword,
|
|
4966
|
-
isLoading: resetPasswordMutate.isPending,
|
|
4967
|
-
error: resetPasswordMutate.error
|
|
4876
|
+
// resetPassword,
|
|
4877
|
+
// isLoading: resetPasswordMutate.isPending,
|
|
4878
|
+
// error: resetPasswordMutate.error,
|
|
4968
4879
|
};
|
|
4969
4880
|
};
|
|
4970
4881
|
|
|
@@ -5075,19 +4986,19 @@ var CloseIcon = ({ className = "" }) => {
|
|
|
5075
4986
|
};
|
|
5076
4987
|
|
|
5077
4988
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
5078
|
-
var
|
|
5079
|
-
var
|
|
4989
|
+
var import_react13 = require("react");
|
|
4990
|
+
var import_interface_logic11 = require("@fctc/interface-logic");
|
|
5080
4991
|
var statusDropdownController = (props) => {
|
|
5081
4992
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
5082
|
-
const env = (0,
|
|
4993
|
+
const env = (0, import_interface_logic11.getEnv)();
|
|
5083
4994
|
const colors = {
|
|
5084
4995
|
normal: "bg-[#e9ecef]",
|
|
5085
4996
|
done: "bg-primary",
|
|
5086
4997
|
blocked: "bg-red-500"
|
|
5087
4998
|
};
|
|
5088
|
-
const [isOpen, setIsOpen] = (0,
|
|
5089
|
-
const buttonRef = (0,
|
|
5090
|
-
(0,
|
|
4999
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
5000
|
+
const buttonRef = (0, import_react13.useRef)(null);
|
|
5001
|
+
(0, import_react13.useEffect)(() => {
|
|
5091
5002
|
const handleClickOutside = (event) => {
|
|
5092
5003
|
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
5093
5004
|
setIsOpen(false);
|
|
@@ -5098,7 +5009,7 @@ var statusDropdownController = (props) => {
|
|
|
5098
5009
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5099
5010
|
};
|
|
5100
5011
|
}, []);
|
|
5101
|
-
const { mutate: onSave } = (0,
|
|
5012
|
+
const { mutate: onSave } = (0, import_interface_logic11.useSave)();
|
|
5102
5013
|
const handleClick = async (status) => {
|
|
5103
5014
|
setIsOpen(!isOpen);
|
|
5104
5015
|
onSave(
|
|
@@ -5128,8 +5039,8 @@ var statusDropdownController = (props) => {
|
|
|
5128
5039
|
};
|
|
5129
5040
|
|
|
5130
5041
|
// src/widget/basic/many2one-field/controller.ts
|
|
5131
|
-
var
|
|
5132
|
-
var
|
|
5042
|
+
var import_react14 = require("react");
|
|
5043
|
+
var import_interface_logic12 = require("@fctc/interface-logic");
|
|
5133
5044
|
var many2oneFieldController = (props) => {
|
|
5134
5045
|
const {
|
|
5135
5046
|
name,
|
|
@@ -5144,24 +5055,24 @@ var many2oneFieldController = (props) => {
|
|
|
5144
5055
|
showDetail = true,
|
|
5145
5056
|
actionData
|
|
5146
5057
|
} = 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,
|
|
5058
|
+
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
5059
|
+
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react14.useState)(false);
|
|
5060
|
+
const [tempSelectedOption, setTempSelectedOption] = (0, import_react14.useState)(null);
|
|
5061
|
+
const { menuList } = (0, import_interface_logic12.useAppSelector)(import_interface_logic12.selectNavbar);
|
|
5062
|
+
const { context } = (0, import_interface_logic12.useAppSelector)(import_interface_logic12.selectEnv);
|
|
5063
|
+
const [domainModal, setDomainModal] = (0, import_react14.useState)(null);
|
|
5153
5064
|
const initValue = methods?.getValues(name);
|
|
5154
|
-
const domainObject = (0,
|
|
5155
|
-
() => (0,
|
|
5065
|
+
const domainObject = (0, import_react14.useMemo)(
|
|
5066
|
+
() => (0, import_interface_logic12.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
|
|
5156
5067
|
[domain, formValues]
|
|
5157
5068
|
);
|
|
5158
|
-
const optionsObject = (0,
|
|
5069
|
+
const optionsObject = (0, import_interface_logic12.evalJSONContext)(fieldOptions) || {};
|
|
5159
5070
|
const contextObject = {
|
|
5160
|
-
...(0,
|
|
5071
|
+
...(0, import_interface_logic12.evalJSONContext)(actionData?.context) || {},
|
|
5161
5072
|
...fieldContext,
|
|
5162
5073
|
...context
|
|
5163
5074
|
};
|
|
5164
|
-
const actionId = (0,
|
|
5075
|
+
const actionId = (0, import_react14.useMemo)(
|
|
5165
5076
|
() => menuList?.flatMap(
|
|
5166
5077
|
(item) => item?.child_id.filter(
|
|
5167
5078
|
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
@@ -5184,23 +5095,23 @@ var many2oneFieldController = (props) => {
|
|
|
5184
5095
|
data: dataOfSelection,
|
|
5185
5096
|
// refetch,
|
|
5186
5097
|
isFetching
|
|
5187
|
-
} = (0,
|
|
5098
|
+
} = (0, import_interface_logic12.useGetSelection)({
|
|
5188
5099
|
data,
|
|
5189
5100
|
queryKey,
|
|
5190
5101
|
enabled: false
|
|
5191
5102
|
});
|
|
5192
|
-
const selectOptions = (0,
|
|
5103
|
+
const selectOptions = (0, import_react14.useMemo)(() => {
|
|
5193
5104
|
return dataOfSelection?.records?.map((val) => ({
|
|
5194
5105
|
value: val?.id,
|
|
5195
5106
|
label: val?.display_name || val?.name
|
|
5196
5107
|
})) || [];
|
|
5197
5108
|
}, [dataOfSelection]);
|
|
5198
|
-
(0,
|
|
5109
|
+
(0, import_react14.useEffect)(() => {
|
|
5199
5110
|
setOptions(selectOptions);
|
|
5200
5111
|
setDomainModal(domainObject);
|
|
5201
|
-
if (relation === "student.subject") (0,
|
|
5112
|
+
if (relation === "student.subject") (0, import_interface_logic12.setListSubject)(selectOptions);
|
|
5202
5113
|
}, [selectOptions]);
|
|
5203
|
-
(0,
|
|
5114
|
+
(0, import_react14.useEffect)(() => {
|
|
5204
5115
|
if (!propValue && tempSelectedOption) {
|
|
5205
5116
|
methods.setValue(name, null);
|
|
5206
5117
|
setTempSelectedOption(null);
|
|
@@ -5211,12 +5122,12 @@ var many2oneFieldController = (props) => {
|
|
|
5211
5122
|
});
|
|
5212
5123
|
}
|
|
5213
5124
|
}, [propValue]);
|
|
5214
|
-
(0,
|
|
5125
|
+
(0, import_react14.useEffect)(() => {
|
|
5215
5126
|
if (actionId) {
|
|
5216
5127
|
localStorage.setItem("aid", actionId);
|
|
5217
5128
|
}
|
|
5218
5129
|
}, [actionId]);
|
|
5219
|
-
const handleChooseRecord = (0,
|
|
5130
|
+
const handleChooseRecord = (0, import_react14.useCallback)(
|
|
5220
5131
|
(idRecord) => {
|
|
5221
5132
|
const newOption = options.find(
|
|
5222
5133
|
(option) => option.value === idRecord
|
|
@@ -5241,8 +5152,8 @@ var many2oneFieldController = (props) => {
|
|
|
5241
5152
|
},
|
|
5242
5153
|
[options, methods, name, onChange]
|
|
5243
5154
|
);
|
|
5244
|
-
const handleClose = (0,
|
|
5245
|
-
const handleSelectChange = (0,
|
|
5155
|
+
const handleClose = (0, import_react14.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
5156
|
+
const handleSelectChange = (0, import_react14.useCallback)(
|
|
5246
5157
|
(selectedOption) => {
|
|
5247
5158
|
if (!selectedOption) {
|
|
5248
5159
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5267,7 +5178,7 @@ var many2oneFieldController = (props) => {
|
|
|
5267
5178
|
[methods, name, onChange]
|
|
5268
5179
|
);
|
|
5269
5180
|
const allowShowDetail = showDetail && contextObject?.form_view_ref && (!("no_open" in optionsObject) || optionsObject?.no_open === false);
|
|
5270
|
-
const fetchMoreOptions = (0,
|
|
5181
|
+
const fetchMoreOptions = (0, import_react14.useCallback)(() => {
|
|
5271
5182
|
if (typeof dataOfSelection?.refetch === "function") {
|
|
5272
5183
|
;
|
|
5273
5184
|
dataOfSelection.refetch();
|
|
@@ -5299,18 +5210,18 @@ var many2oneFieldController = (props) => {
|
|
|
5299
5210
|
};
|
|
5300
5211
|
|
|
5301
5212
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5302
|
-
var
|
|
5213
|
+
var import_interface_logic13 = require("@fctc/interface-logic");
|
|
5303
5214
|
var many2oneButtonController = (props) => {
|
|
5304
5215
|
const { domain, methods, relation } = props;
|
|
5305
5216
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5306
|
-
const env = (0,
|
|
5307
|
-
const domainObject = (0,
|
|
5217
|
+
const env = (0, import_interface_logic13.getEnv)();
|
|
5218
|
+
const domainObject = (0, import_interface_logic13.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5308
5219
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5309
|
-
const { data: dataOfSelection } = (0,
|
|
5220
|
+
const { data: dataOfSelection } = (0, import_interface_logic13.useGetSelection)({
|
|
5310
5221
|
data: {
|
|
5311
5222
|
model: relation ?? "",
|
|
5312
5223
|
domain: domainObject,
|
|
5313
|
-
context: { ...env.context, ...(0,
|
|
5224
|
+
context: { ...env.context, ...(0, import_interface_logic13.evalJSONContext)(actionData?.context) }
|
|
5314
5225
|
},
|
|
5315
5226
|
queryKey: [`data_${relation}`, domainObject]
|
|
5316
5227
|
});
|
|
@@ -5324,12 +5235,12 @@ var many2oneButtonController = (props) => {
|
|
|
5324
5235
|
};
|
|
5325
5236
|
|
|
5326
5237
|
// src/widget/basic/many2many-field/controller.ts
|
|
5327
|
-
var
|
|
5328
|
-
var
|
|
5238
|
+
var import_react18 = require("react");
|
|
5239
|
+
var import_interface_logic18 = require("@fctc/interface-logic");
|
|
5329
5240
|
|
|
5330
5241
|
// src/widget/advance/table/table-body/controller.ts
|
|
5331
|
-
var
|
|
5332
|
-
var
|
|
5242
|
+
var import_interface_logic14 = require("@fctc/interface-logic");
|
|
5243
|
+
var import_react15 = require("react");
|
|
5333
5244
|
var tableBodyController = (props) => {
|
|
5334
5245
|
const {
|
|
5335
5246
|
checkedAll,
|
|
@@ -5341,8 +5252,8 @@ var tableBodyController = (props) => {
|
|
|
5341
5252
|
selectedRowKeysRef,
|
|
5342
5253
|
onClickRow
|
|
5343
5254
|
} = props;
|
|
5344
|
-
const appDispatch = (0,
|
|
5345
|
-
const checked = (0,
|
|
5255
|
+
const appDispatch = (0, import_interface_logic14.useAppDispatch)();
|
|
5256
|
+
const checked = (0, import_react15.useMemo)(() => {
|
|
5346
5257
|
if (!row?.id) return false;
|
|
5347
5258
|
if (selectedRowKeys?.includes(row.id)) {
|
|
5348
5259
|
return true;
|
|
@@ -5358,12 +5269,12 @@ var tableBodyController = (props) => {
|
|
|
5358
5269
|
}
|
|
5359
5270
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
5360
5271
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
5361
|
-
appDispatch((0,
|
|
5272
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(newSelectedRowKeys));
|
|
5362
5273
|
};
|
|
5363
5274
|
const handleClickRow = (col, row2) => {
|
|
5364
5275
|
onClickRow(col, row2);
|
|
5365
5276
|
};
|
|
5366
|
-
(0,
|
|
5277
|
+
(0, import_react15.useEffect)(() => {
|
|
5367
5278
|
if (!row?.id) return;
|
|
5368
5279
|
if (isAutoSelect) {
|
|
5369
5280
|
if (checkboxRef?.current === "uncheck") {
|
|
@@ -5371,17 +5282,17 @@ var tableBodyController = (props) => {
|
|
|
5371
5282
|
(id) => id !== row.id
|
|
5372
5283
|
);
|
|
5373
5284
|
selectedRowKeysRef.current = filtered;
|
|
5374
|
-
appDispatch((0,
|
|
5285
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(filtered));
|
|
5375
5286
|
} else {
|
|
5376
5287
|
const unique = Array.from(
|
|
5377
5288
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
5378
5289
|
);
|
|
5379
5290
|
selectedRowKeysRef.current = unique;
|
|
5380
|
-
appDispatch((0,
|
|
5291
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(unique));
|
|
5381
5292
|
}
|
|
5382
5293
|
}
|
|
5383
5294
|
}, [isAutoSelect]);
|
|
5384
|
-
(0,
|
|
5295
|
+
(0, import_react15.useEffect)(() => {
|
|
5385
5296
|
if (!checkedAll) {
|
|
5386
5297
|
checkboxRef.current = "enabled";
|
|
5387
5298
|
false;
|
|
@@ -5395,35 +5306,35 @@ var tableBodyController = (props) => {
|
|
|
5395
5306
|
};
|
|
5396
5307
|
|
|
5397
5308
|
// src/widget/advance/table/table-head/controller.ts
|
|
5398
|
-
var
|
|
5309
|
+
var import_interface_logic15 = require("@fctc/interface-logic");
|
|
5399
5310
|
var tableHeadController = (props) => {
|
|
5400
5311
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
5401
|
-
const appDispatch = (0,
|
|
5402
|
-
const { groupByDomain } = (0,
|
|
5312
|
+
const appDispatch = (0, import_interface_logic15.useAppDispatch)();
|
|
5313
|
+
const { groupByDomain } = (0, import_interface_logic15.useAppSelector)(import_interface_logic15.selectSearch);
|
|
5403
5314
|
const handleCheckBoxAll = (event) => {
|
|
5404
5315
|
if (event?.target?.checked && typeTable === "list") {
|
|
5405
5316
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
5406
|
-
appDispatch((0,
|
|
5317
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(allRowKeys));
|
|
5407
5318
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
5408
5319
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
5409
5320
|
const ids = Array.from(rowsIDs)?.map(
|
|
5410
5321
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
5411
5322
|
);
|
|
5412
5323
|
if (ids?.length > 0) {
|
|
5413
|
-
appDispatch((0,
|
|
5324
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(ids));
|
|
5414
5325
|
} else {
|
|
5415
5326
|
const sum = countSum(
|
|
5416
5327
|
rows,
|
|
5417
5328
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
5418
5329
|
);
|
|
5419
5330
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
5420
|
-
appDispatch((0,
|
|
5331
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(keys));
|
|
5421
5332
|
}
|
|
5422
5333
|
if (selectedRowKeysRef) {
|
|
5423
5334
|
selectedRowKeysRef.current = [];
|
|
5424
5335
|
}
|
|
5425
5336
|
} else {
|
|
5426
|
-
appDispatch((0,
|
|
5337
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)([]));
|
|
5427
5338
|
}
|
|
5428
5339
|
};
|
|
5429
5340
|
return {
|
|
@@ -5432,11 +5343,11 @@ var tableHeadController = (props) => {
|
|
|
5432
5343
|
};
|
|
5433
5344
|
|
|
5434
5345
|
// src/widget/advance/table/table-view/controller.ts
|
|
5435
|
-
var
|
|
5436
|
-
var
|
|
5346
|
+
var import_interface_logic16 = require("@fctc/interface-logic");
|
|
5347
|
+
var import_react16 = require("react");
|
|
5437
5348
|
var tableController = ({ data }) => {
|
|
5438
|
-
const [rows, setRows] = (0,
|
|
5439
|
-
const [columns, setColumns] = (0,
|
|
5349
|
+
const [rows, setRows] = (0, import_react16.useState)(data.records || []);
|
|
5350
|
+
const [columns, setColumns] = (0, import_react16.useState)([]);
|
|
5440
5351
|
const dataModelFields = data.fields?.map((field) => {
|
|
5441
5352
|
return {
|
|
5442
5353
|
...data.dataModel?.[field?.name],
|
|
@@ -5464,14 +5375,14 @@ var tableController = ({ data }) => {
|
|
|
5464
5375
|
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
5465
5376
|
});
|
|
5466
5377
|
};
|
|
5467
|
-
(0,
|
|
5378
|
+
(0, import_react16.useEffect)(() => {
|
|
5468
5379
|
setRows(transformData(data.records || null));
|
|
5469
5380
|
}, [data.records]);
|
|
5470
5381
|
const handleGetColumns = () => {
|
|
5471
5382
|
let cols = [];
|
|
5472
5383
|
try {
|
|
5473
5384
|
cols = mergeFields?.filter((item) => {
|
|
5474
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
5385
|
+
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
5386
|
})?.map((field) => {
|
|
5476
5387
|
return {
|
|
5477
5388
|
name: field?.name,
|
|
@@ -5485,7 +5396,7 @@ var tableController = ({ data }) => {
|
|
|
5485
5396
|
}
|
|
5486
5397
|
return cols;
|
|
5487
5398
|
};
|
|
5488
|
-
(0,
|
|
5399
|
+
(0, import_react16.useEffect)(() => {
|
|
5489
5400
|
const columns2 = handleGetColumns();
|
|
5490
5401
|
setColumns(columns2);
|
|
5491
5402
|
}, [data.records]);
|
|
@@ -5510,8 +5421,8 @@ var tableController = ({ data }) => {
|
|
|
5510
5421
|
};
|
|
5511
5422
|
|
|
5512
5423
|
// src/widget/advance/table/table-group/controller.ts
|
|
5513
|
-
var
|
|
5514
|
-
var
|
|
5424
|
+
var import_interface_logic17 = require("@fctc/interface-logic");
|
|
5425
|
+
var import_react17 = require("react");
|
|
5515
5426
|
|
|
5516
5427
|
// src/utils/i18n.ts
|
|
5517
5428
|
var import_react_i18next2 = require("react-i18next");
|
|
@@ -6281,7 +6192,7 @@ var i18n_default = import_i18next.default;
|
|
|
6281
6192
|
|
|
6282
6193
|
// src/widget/advance/table/table-group/controller.ts
|
|
6283
6194
|
var tableGroupController = (props) => {
|
|
6284
|
-
const env = (0,
|
|
6195
|
+
const env = (0, import_interface_logic17.getEnv)();
|
|
6285
6196
|
const {
|
|
6286
6197
|
rows,
|
|
6287
6198
|
columns,
|
|
@@ -6300,18 +6211,18 @@ var tableGroupController = (props) => {
|
|
|
6300
6211
|
setIsAutoSelect,
|
|
6301
6212
|
selectedRowKeysRef
|
|
6302
6213
|
} = props;
|
|
6303
|
-
const [pageGroup, setPageGroup] = (0,
|
|
6304
|
-
const { groupByDomain, selectedTags } = (0,
|
|
6305
|
-
const { selectedRowKeys } = (0,
|
|
6306
|
-
const appDispatch = (0,
|
|
6307
|
-
const { toDataJS } = (0,
|
|
6214
|
+
const [pageGroup, setPageGroup] = (0, import_react17.useState)(0);
|
|
6215
|
+
const { groupByDomain, selectedTags } = (0, import_interface_logic17.useAppSelector)(import_interface_logic17.selectSearch);
|
|
6216
|
+
const { selectedRowKeys } = (0, import_interface_logic17.useAppSelector)(import_interface_logic17.selectList);
|
|
6217
|
+
const appDispatch = (0, import_interface_logic17.useAppDispatch)();
|
|
6218
|
+
const { toDataJS } = (0, import_interface_logic17.useOdooDataTransform)();
|
|
6308
6219
|
const initVal = toDataJS(row, viewData, model);
|
|
6309
|
-
const [isShowGroup, setIsShowGroup] = (0,
|
|
6310
|
-
const [colEmptyGroup, setColEmptyGroup] = (0,
|
|
6220
|
+
const [isShowGroup, setIsShowGroup] = (0, import_react17.useState)(false);
|
|
6221
|
+
const [colEmptyGroup, setColEmptyGroup] = (0, import_react17.useState)({
|
|
6311
6222
|
fromStart: 1,
|
|
6312
6223
|
fromEnd: 1
|
|
6313
6224
|
});
|
|
6314
|
-
const processedData = (0,
|
|
6225
|
+
const processedData = (0, import_react17.useMemo)(() => {
|
|
6315
6226
|
const calculateColSpanEmpty = () => {
|
|
6316
6227
|
const startIndex = columns.findIndex(
|
|
6317
6228
|
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
@@ -6326,7 +6237,7 @@ var tableGroupController = (props) => {
|
|
|
6326
6237
|
};
|
|
6327
6238
|
return calculateColSpanEmpty();
|
|
6328
6239
|
}, [columns, row]);
|
|
6329
|
-
const shouldFetchData = (0,
|
|
6240
|
+
const shouldFetchData = (0, import_react17.useMemo)(() => {
|
|
6330
6241
|
return !!isShowGroup;
|
|
6331
6242
|
}, [isShowGroup]);
|
|
6332
6243
|
const enabled = shouldFetchData && !!processedData;
|
|
@@ -6351,7 +6262,7 @@ var tableGroupController = (props) => {
|
|
|
6351
6262
|
isPlaceholderData,
|
|
6352
6263
|
isLoading,
|
|
6353
6264
|
isFetching
|
|
6354
|
-
} = (0,
|
|
6265
|
+
} = (0, import_interface_logic17.useGetListData)(listDataProps, queryKey, enabled);
|
|
6355
6266
|
const {
|
|
6356
6267
|
columns: columnsGroup,
|
|
6357
6268
|
rows: rowsGroup,
|
|
@@ -6366,7 +6277,7 @@ var tableGroupController = (props) => {
|
|
|
6366
6277
|
}
|
|
6367
6278
|
});
|
|
6368
6279
|
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
6369
|
-
(0,
|
|
6280
|
+
(0, import_react17.useEffect)(() => {
|
|
6370
6281
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
6371
6282
|
setIsShowGroup(false);
|
|
6372
6283
|
}
|
|
@@ -6389,24 +6300,24 @@ var tableGroupController = (props) => {
|
|
|
6389
6300
|
const filteredIds = selectedRowKeys.filter(
|
|
6390
6301
|
(id) => !ids.includes(id)
|
|
6391
6302
|
);
|
|
6392
|
-
appDispatch((0,
|
|
6303
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)(filteredIds));
|
|
6393
6304
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6394
6305
|
const clonedKeys = [...selectedRowKeys];
|
|
6395
|
-
appDispatch((0,
|
|
6396
|
-
setTimeout(() => appDispatch((0,
|
|
6306
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6307
|
+
setTimeout(() => appDispatch((0, import_interface_logic17.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6397
6308
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6398
6309
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6399
|
-
appDispatch((0,
|
|
6310
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)(filteredKeys));
|
|
6400
6311
|
}
|
|
6401
6312
|
toggleShowGroup();
|
|
6402
6313
|
};
|
|
6403
|
-
(0,
|
|
6314
|
+
(0, import_react17.useEffect)(() => {
|
|
6404
6315
|
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
6405
6316
|
return;
|
|
6406
6317
|
}
|
|
6407
6318
|
const clonedKeys = [...selectedRowKeys];
|
|
6408
|
-
(0,
|
|
6409
|
-
setTimeout(() => (0,
|
|
6319
|
+
(0, import_interface_logic17.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6320
|
+
setTimeout(() => (0, import_interface_logic17.setSelectedRowKeys)(clonedKeys), 500);
|
|
6410
6321
|
}, [isQueryFetched]);
|
|
6411
6322
|
return {
|
|
6412
6323
|
handleExpandChildGroup,
|
|
@@ -6456,14 +6367,14 @@ var many2manyFieldController = (props) => {
|
|
|
6456
6367
|
options,
|
|
6457
6368
|
sessionStorageUtils
|
|
6458
6369
|
} = props;
|
|
6459
|
-
const appDispatch = (0,
|
|
6370
|
+
const appDispatch = (0, import_interface_logic18.useAppDispatch)();
|
|
6460
6371
|
const actionData = sessionStorageUtils.getActionData();
|
|
6461
6372
|
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,
|
|
6373
|
+
const [order, setOrder] = (0, import_react18.useState)();
|
|
6374
|
+
const [isLoadedData, setIsLoadedData] = (0, import_react18.useState)(false);
|
|
6375
|
+
const [domainMany2Many, setDomainMany2Many] = (0, import_react18.useState)(domain);
|
|
6376
|
+
const env = (0, import_interface_logic18.getEnv)();
|
|
6377
|
+
const { selectedTags } = (0, import_interface_logic18.useAppSelector)(import_interface_logic18.selectSearch);
|
|
6467
6378
|
const viewParams = {
|
|
6468
6379
|
model: relation,
|
|
6469
6380
|
views: [
|
|
@@ -6472,11 +6383,11 @@ var many2manyFieldController = (props) => {
|
|
|
6472
6383
|
],
|
|
6473
6384
|
context
|
|
6474
6385
|
};
|
|
6475
|
-
const { data: viewResponse, isFetched: isViewReponseFetched } = (0,
|
|
6386
|
+
const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic18.useGetView)(
|
|
6476
6387
|
viewParams,
|
|
6477
6388
|
actionData
|
|
6478
6389
|
);
|
|
6479
|
-
const baseModel = (0,
|
|
6390
|
+
const baseModel = (0, import_react18.useMemo)(
|
|
6480
6391
|
() => ({
|
|
6481
6392
|
name: String(relation),
|
|
6482
6393
|
view: viewResponse || {},
|
|
@@ -6488,26 +6399,26 @@ var many2manyFieldController = (props) => {
|
|
|
6488
6399
|
}),
|
|
6489
6400
|
[model, viewResponse]
|
|
6490
6401
|
);
|
|
6491
|
-
const initModel = (0,
|
|
6492
|
-
const modelInstance = (0,
|
|
6402
|
+
const initModel = (0, import_interface_logic18.useModel)();
|
|
6403
|
+
const modelInstance = (0, import_react18.useMemo)(() => {
|
|
6493
6404
|
if (viewResponse) {
|
|
6494
6405
|
return initModel.initModel(baseModel);
|
|
6495
6406
|
}
|
|
6496
6407
|
return null;
|
|
6497
6408
|
}, [baseModel, viewResponse]);
|
|
6498
|
-
const specification = (0,
|
|
6409
|
+
const specification = (0, import_react18.useMemo)(() => {
|
|
6499
6410
|
if (modelInstance) {
|
|
6500
6411
|
return modelInstance.getSpecification();
|
|
6501
6412
|
}
|
|
6502
6413
|
return null;
|
|
6503
6414
|
}, [modelInstance]);
|
|
6504
6415
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
6505
|
-
const optionsObject = tab?.options ? (0,
|
|
6416
|
+
const optionsObject = tab?.options ? (0, import_interface_logic18.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic18.evalJSONContext)(options) : {}) || {};
|
|
6506
6417
|
const fetchData = async () => {
|
|
6507
6418
|
try {
|
|
6508
6419
|
setDomainMany2Many(domain);
|
|
6509
|
-
appDispatch((0,
|
|
6510
|
-
appDispatch((0,
|
|
6420
|
+
appDispatch((0, import_interface_logic18.setFirstDomain)(domain));
|
|
6421
|
+
appDispatch((0, import_interface_logic18.setViewDataStore)(viewResponse));
|
|
6511
6422
|
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
6512
6423
|
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
6513
6424
|
...field
|
|
@@ -6518,7 +6429,7 @@ var many2manyFieldController = (props) => {
|
|
|
6518
6429
|
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
6519
6430
|
});
|
|
6520
6431
|
}
|
|
6521
|
-
appDispatch((0,
|
|
6432
|
+
appDispatch((0, import_interface_logic18.setPage)(0));
|
|
6522
6433
|
} catch (err) {
|
|
6523
6434
|
console.log(err);
|
|
6524
6435
|
}
|
|
@@ -6540,7 +6451,7 @@ var many2manyFieldController = (props) => {
|
|
|
6540
6451
|
context,
|
|
6541
6452
|
fields: groupByDomain?.fields,
|
|
6542
6453
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
6543
|
-
sort: order ? order : default_order ? (0,
|
|
6454
|
+
sort: order ? order : default_order ? (0, import_interface_logic18.formatSortingString)(default_order) : ""
|
|
6544
6455
|
};
|
|
6545
6456
|
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
6546
6457
|
const {
|
|
@@ -6548,18 +6459,18 @@ var many2manyFieldController = (props) => {
|
|
|
6548
6459
|
isLoading: isDataLoading,
|
|
6549
6460
|
isFetched: isDataResponseFetched,
|
|
6550
6461
|
isPlaceholderData
|
|
6551
|
-
} = (0,
|
|
6552
|
-
(0,
|
|
6462
|
+
} = (0, import_interface_logic18.useGetListData)(data, queryKey, enabled);
|
|
6463
|
+
(0, import_react18.useEffect)(() => {
|
|
6553
6464
|
if (viewResponse) {
|
|
6554
6465
|
fetchData();
|
|
6555
6466
|
}
|
|
6556
6467
|
return () => {
|
|
6557
|
-
appDispatch((0,
|
|
6468
|
+
appDispatch((0, import_interface_logic18.setGroupByDomain)(null));
|
|
6558
6469
|
setFields((prevFields) => ({
|
|
6559
6470
|
...prevFields,
|
|
6560
6471
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
6561
6472
|
}));
|
|
6562
|
-
appDispatch((0,
|
|
6473
|
+
appDispatch((0, import_interface_logic18.setPage)(0));
|
|
6563
6474
|
setSelectedRowKeys4([]);
|
|
6564
6475
|
setDomainMany2Many(null);
|
|
6565
6476
|
setIsLoadedData(false);
|
|
@@ -6583,18 +6494,18 @@ var many2manyFieldController = (props) => {
|
|
|
6583
6494
|
refetch,
|
|
6584
6495
|
data: dataFormViewResponse,
|
|
6585
6496
|
isSuccess
|
|
6586
|
-
} = (0,
|
|
6497
|
+
} = (0, import_interface_logic18.useGetFormView)({
|
|
6587
6498
|
data: dataFormView,
|
|
6588
6499
|
queryKey: [`form-view-action-${relation}`],
|
|
6589
6500
|
enabled: false
|
|
6590
6501
|
});
|
|
6591
|
-
(0,
|
|
6502
|
+
(0, import_react18.useEffect)(() => {
|
|
6592
6503
|
if (isSuccess && dataFormViewResponse) {
|
|
6593
6504
|
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
6594
6505
|
window.location.href = `/form/menu?model=${relation}`;
|
|
6595
6506
|
}
|
|
6596
6507
|
}, [isSuccess]);
|
|
6597
|
-
(0,
|
|
6508
|
+
(0, import_react18.useEffect)(() => {
|
|
6598
6509
|
if (domainMany2Many && !isLoadedData) {
|
|
6599
6510
|
setIsLoadedData(true);
|
|
6600
6511
|
}
|
|
@@ -6610,8 +6521,8 @@ var many2manyFieldController = (props) => {
|
|
|
6610
6521
|
};
|
|
6611
6522
|
|
|
6612
6523
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
6613
|
-
var
|
|
6614
|
-
var
|
|
6524
|
+
var import_react19 = require("react");
|
|
6525
|
+
var import_interface_logic19 = require("@fctc/interface-logic");
|
|
6615
6526
|
var many2manyTagsController = (props) => {
|
|
6616
6527
|
const {
|
|
6617
6528
|
relation,
|
|
@@ -6622,10 +6533,10 @@ var many2manyTagsController = (props) => {
|
|
|
6622
6533
|
placeholderNoOption
|
|
6623
6534
|
} = props;
|
|
6624
6535
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
6625
|
-
const env = (0,
|
|
6626
|
-
const addtionalFields = optionsFields ? (0,
|
|
6627
|
-
const domainObject = (0,
|
|
6628
|
-
() => (0,
|
|
6536
|
+
const env = (0, import_interface_logic19.getEnv)();
|
|
6537
|
+
const addtionalFields = optionsFields ? (0, import_interface_logic19.evalJSONContext)(optionsFields) : null;
|
|
6538
|
+
const domainObject = (0, import_react19.useMemo)(
|
|
6539
|
+
() => (0, import_interface_logic19.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
6629
6540
|
[domain, formValues]
|
|
6630
6541
|
);
|
|
6631
6542
|
const data = {
|
|
@@ -6635,13 +6546,13 @@ var many2manyTagsController = (props) => {
|
|
|
6635
6546
|
id: {},
|
|
6636
6547
|
name: {},
|
|
6637
6548
|
display_name: {},
|
|
6638
|
-
...widget &&
|
|
6639
|
-
...widget &&
|
|
6549
|
+
...widget && import_interface_logic19.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
6550
|
+
...widget && import_interface_logic19.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
6640
6551
|
},
|
|
6641
6552
|
enabled: true,
|
|
6642
6553
|
context: env.context
|
|
6643
6554
|
};
|
|
6644
|
-
const { data: dataOfSelection } = (0,
|
|
6555
|
+
const { data: dataOfSelection } = (0, import_interface_logic19.useGetSelection)({
|
|
6645
6556
|
data,
|
|
6646
6557
|
queryKey: [`data_${relation}`, domainObject]
|
|
6647
6558
|
});
|
|
@@ -6667,8 +6578,8 @@ var many2manyTagsController = (props) => {
|
|
|
6667
6578
|
};
|
|
6668
6579
|
|
|
6669
6580
|
// src/widget/basic/status-bar-field/controller.ts
|
|
6670
|
-
var
|
|
6671
|
-
var
|
|
6581
|
+
var import_react20 = require("react");
|
|
6582
|
+
var import_interface_logic20 = require("@fctc/interface-logic");
|
|
6672
6583
|
var durationController = (props) => {
|
|
6673
6584
|
const {
|
|
6674
6585
|
relation,
|
|
@@ -6685,14 +6596,14 @@ var durationController = (props) => {
|
|
|
6685
6596
|
name: "",
|
|
6686
6597
|
fold: ""
|
|
6687
6598
|
};
|
|
6688
|
-
const [disabled, setDisabled] = (0,
|
|
6689
|
-
const [modelStatus, setModalStatus] = (0,
|
|
6690
|
-
const { context } = (0,
|
|
6599
|
+
const [disabled, setDisabled] = (0, import_react20.useState)(false);
|
|
6600
|
+
const [modelStatus, setModalStatus] = (0, import_react20.useState)(false);
|
|
6601
|
+
const { context } = (0, import_interface_logic20.useAppSelector)(import_interface_logic20.selectEnv);
|
|
6691
6602
|
const queryKey = [`data-status-duration`, specification];
|
|
6692
6603
|
const listDataProps = {
|
|
6693
6604
|
model: relation,
|
|
6694
6605
|
specification,
|
|
6695
|
-
domain: (0,
|
|
6606
|
+
domain: (0, import_interface_logic20.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
6696
6607
|
limit: 10,
|
|
6697
6608
|
offset: 0,
|
|
6698
6609
|
fields: "",
|
|
@@ -6702,8 +6613,8 @@ var durationController = (props) => {
|
|
|
6702
6613
|
},
|
|
6703
6614
|
sort: ""
|
|
6704
6615
|
};
|
|
6705
|
-
const { data: dataResponse } = (0,
|
|
6706
|
-
const { mutate: fetchChangeStatus } = (0,
|
|
6616
|
+
const { data: dataResponse } = (0, import_interface_logic20.useGetListData)(listDataProps, queryKey);
|
|
6617
|
+
const { mutate: fetchChangeStatus } = (0, import_interface_logic20.useChangeStatus)();
|
|
6707
6618
|
const handleClick = async (stage_id) => {
|
|
6708
6619
|
setDisabled(true);
|
|
6709
6620
|
if (stage_id) {
|
|
@@ -6739,7 +6650,7 @@ var durationController = (props) => {
|
|
|
6739
6650
|
};
|
|
6740
6651
|
|
|
6741
6652
|
// src/widget/basic/priority-field/controller.ts
|
|
6742
|
-
var
|
|
6653
|
+
var import_interface_logic21 = require("@fctc/interface-logic");
|
|
6743
6654
|
var priorityFieldController = (props) => {
|
|
6744
6655
|
const {
|
|
6745
6656
|
value,
|
|
@@ -6754,11 +6665,11 @@ var priorityFieldController = (props) => {
|
|
|
6754
6665
|
viewData,
|
|
6755
6666
|
context
|
|
6756
6667
|
} = props;
|
|
6757
|
-
const _context = { ...(0,
|
|
6668
|
+
const _context = { ...(0, import_interface_logic21.evalJSONContext)(actionData?.context) };
|
|
6758
6669
|
const contextObject = { ...context, ..._context };
|
|
6759
6670
|
const defaultPriority = parseInt(value) + 1;
|
|
6760
6671
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
6761
|
-
const { mutateAsync: fetchSave } = (0,
|
|
6672
|
+
const { mutateAsync: fetchSave } = (0, import_interface_logic21.useSave)();
|
|
6762
6673
|
const savePriorities = async ({
|
|
6763
6674
|
value: value2,
|
|
6764
6675
|
resetPriority
|
|
@@ -6793,8 +6704,8 @@ var priorityFieldController = (props) => {
|
|
|
6793
6704
|
};
|
|
6794
6705
|
|
|
6795
6706
|
// src/widget/basic/float-time-field/controller.ts
|
|
6796
|
-
var
|
|
6797
|
-
var
|
|
6707
|
+
var import_react21 = require("react");
|
|
6708
|
+
var import_interface_logic22 = require("@fctc/interface-logic");
|
|
6798
6709
|
var floatTimeFiledController = ({
|
|
6799
6710
|
onChange: fieldOnChange,
|
|
6800
6711
|
onBlur,
|
|
@@ -6803,11 +6714,11 @@ var floatTimeFiledController = ({
|
|
|
6803
6714
|
props
|
|
6804
6715
|
}) => {
|
|
6805
6716
|
const { name, defaultValue = 0, onChange } = props;
|
|
6806
|
-
const [input, setInput] = (0,
|
|
6807
|
-
(0,
|
|
6717
|
+
const [input, setInput] = (0, import_react21.useState)(
|
|
6718
|
+
(0, import_interface_logic22.convertFloatToTime)(value ?? defaultValue)
|
|
6808
6719
|
);
|
|
6809
|
-
const [formattedTime, setFormattedTime] = (0,
|
|
6810
|
-
const [errors, setErrors] = (0,
|
|
6720
|
+
const [formattedTime, setFormattedTime] = (0, import_react21.useState)("");
|
|
6721
|
+
const [errors, setErrors] = (0, import_react21.useState)("");
|
|
6811
6722
|
const handleInputChange = (e) => {
|
|
6812
6723
|
const raw = e.target.value.replace(/[^\d:]/g, "");
|
|
6813
6724
|
setInput(raw);
|
|
@@ -6837,7 +6748,7 @@ var floatTimeFiledController = ({
|
|
|
6837
6748
|
if (!isDirty) return;
|
|
6838
6749
|
if (formattedTime) {
|
|
6839
6750
|
setInput(formattedTime);
|
|
6840
|
-
const floatVal = (0,
|
|
6751
|
+
const floatVal = (0, import_interface_logic22.convertTimeToFloat)(formattedTime);
|
|
6841
6752
|
fieldOnChange(floatVal);
|
|
6842
6753
|
if (onChange) {
|
|
6843
6754
|
onChange(name ?? "", floatVal);
|
|
@@ -6880,7 +6791,7 @@ var floatTimeFiledController = ({
|
|
|
6880
6791
|
};
|
|
6881
6792
|
|
|
6882
6793
|
// src/widget/basic/float-field/controller.ts
|
|
6883
|
-
var
|
|
6794
|
+
var import_react22 = require("react");
|
|
6884
6795
|
var floatController = ({
|
|
6885
6796
|
onChange,
|
|
6886
6797
|
value,
|
|
@@ -6888,10 +6799,10 @@ var floatController = ({
|
|
|
6888
6799
|
}) => {
|
|
6889
6800
|
const { name, required, methods, onChange: handleOnchange, string } = props;
|
|
6890
6801
|
const { setError, clearErrors } = methods;
|
|
6891
|
-
const [inputValue, setInputValue] = (0,
|
|
6802
|
+
const [inputValue, setInputValue] = (0, import_react22.useState)(
|
|
6892
6803
|
value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
|
|
6893
6804
|
);
|
|
6894
|
-
(0,
|
|
6805
|
+
(0, import_react22.useEffect)(() => {
|
|
6895
6806
|
if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
|
|
6896
6807
|
setInputValue(useFormatFloatNumber(value));
|
|
6897
6808
|
clearErrors(name);
|
|
@@ -6899,9 +6810,9 @@ var floatController = ({
|
|
|
6899
6810
|
setInputValue("");
|
|
6900
6811
|
}
|
|
6901
6812
|
}, [value, name, clearErrors]);
|
|
6902
|
-
const isDirtyRef = (0,
|
|
6903
|
-
const inputRef = (0,
|
|
6904
|
-
const lastCommittedValueRef = (0,
|
|
6813
|
+
const isDirtyRef = (0, import_react22.useRef)(false);
|
|
6814
|
+
const inputRef = (0, import_react22.useRef)(null);
|
|
6815
|
+
const lastCommittedValueRef = (0, import_react22.useRef)(null);
|
|
6905
6816
|
const handleInputChange = (e) => {
|
|
6906
6817
|
const newValue = e.target.value;
|
|
6907
6818
|
const valueWithoutCommas = newValue.replace(/,/g, "");
|
|
@@ -7002,10 +6913,10 @@ var useFormatFloatNumber = (value) => {
|
|
|
7002
6913
|
};
|
|
7003
6914
|
|
|
7004
6915
|
// src/widget/basic/download-file-field/controller.ts
|
|
7005
|
-
var
|
|
6916
|
+
var import_react23 = require("react");
|
|
7006
6917
|
var downloadFileController = () => {
|
|
7007
|
-
const inputId = (0,
|
|
7008
|
-
const [file, setFile] = (0,
|
|
6918
|
+
const inputId = (0, import_react23.useId)();
|
|
6919
|
+
const [file, setFile] = (0, import_react23.useState)(null);
|
|
7009
6920
|
const handleFileChange = (e) => {
|
|
7010
6921
|
setFile(e.target.files[0]);
|
|
7011
6922
|
};
|
|
@@ -7169,13 +7080,13 @@ var dateFieldController = (props) => {
|
|
|
7169
7080
|
};
|
|
7170
7081
|
|
|
7171
7082
|
// src/widget/basic/copy-link-button/controller.ts
|
|
7172
|
-
var
|
|
7173
|
-
var
|
|
7083
|
+
var import_react24 = require("react");
|
|
7084
|
+
var import_interface_logic23 = require("@fctc/interface-logic");
|
|
7174
7085
|
var copyLinkButtonController = (props) => {
|
|
7175
7086
|
const { value, defaultValue } = props;
|
|
7176
|
-
const [isCopied, setIsCopied] = (0,
|
|
7087
|
+
const [isCopied, setIsCopied] = (0, import_react24.useState)(false);
|
|
7177
7088
|
const handleCopyToClipboard = async (value2) => {
|
|
7178
|
-
await (0,
|
|
7089
|
+
await (0, import_interface_logic23.copyTextToClipboard)(value2);
|
|
7179
7090
|
setIsCopied(true);
|
|
7180
7091
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
7181
7092
|
};
|
|
@@ -7188,14 +7099,14 @@ var copyLinkButtonController = (props) => {
|
|
|
7188
7099
|
};
|
|
7189
7100
|
|
|
7190
7101
|
// src/widget/basic/color-field/color-controller.ts
|
|
7191
|
-
var
|
|
7102
|
+
var import_interface_logic24 = require("@fctc/interface-logic");
|
|
7192
7103
|
var colorFieldController = (props) => {
|
|
7193
7104
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
7194
|
-
const env = (0,
|
|
7195
|
-
const _context = { ...(0,
|
|
7105
|
+
const env = (0, import_interface_logic24.getEnv)();
|
|
7106
|
+
const _context = { ...(0, import_interface_logic24.evalJSONContext)(actionData?.context) || {} };
|
|
7196
7107
|
const contextObject = { ...env.context, ..._context };
|
|
7197
7108
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
7198
|
-
const { mutate: onSave } = (0,
|
|
7109
|
+
const { mutate: onSave } = (0, import_interface_logic24.useSave)();
|
|
7199
7110
|
const savePickColor = async (colorObject) => {
|
|
7200
7111
|
const { id } = colorObject;
|
|
7201
7112
|
if (value === id) return;
|
|
@@ -7220,16 +7131,16 @@ var colorFieldController = (props) => {
|
|
|
7220
7131
|
};
|
|
7221
7132
|
|
|
7222
7133
|
// src/widget/basic/binary-field/controller.ts
|
|
7223
|
-
var
|
|
7224
|
-
var
|
|
7134
|
+
var import_react25 = require("react");
|
|
7135
|
+
var import_interface_logic25 = require("@fctc/interface-logic");
|
|
7225
7136
|
var binaryFieldController = (props) => {
|
|
7226
7137
|
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,
|
|
7138
|
+
const inputId = (0, import_react25.useId)();
|
|
7139
|
+
const [selectedImage, setSelectedImage] = (0, import_react25.useState)(null);
|
|
7140
|
+
const [initialImage, setInitialImage] = (0, import_react25.useState)(value || null);
|
|
7141
|
+
const [isInsideTable, setIsInsideTable] = (0, import_react25.useState)(false);
|
|
7231
7142
|
const { setValue } = methods;
|
|
7232
|
-
const binaryRef = (0,
|
|
7143
|
+
const binaryRef = (0, import_react25.useRef)(null);
|
|
7233
7144
|
const convertUrlToBase64 = async (url) => {
|
|
7234
7145
|
try {
|
|
7235
7146
|
const response = await fetch(url);
|
|
@@ -7278,11 +7189,11 @@ var binaryFieldController = (props) => {
|
|
|
7278
7189
|
};
|
|
7279
7190
|
const checkIsImageLink = (url) => {
|
|
7280
7191
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
7281
|
-
return imageExtensions.test(url) || (0,
|
|
7192
|
+
return imageExtensions.test(url) || (0, import_interface_logic25.isBase64Image)(url) || isBlobUrl(url);
|
|
7282
7193
|
};
|
|
7283
7194
|
const getImageBase64WithMimeType = (base64) => {
|
|
7284
7195
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
7285
|
-
if ((0,
|
|
7196
|
+
if ((0, import_interface_logic25.isBase64Image)(base64)) return base64;
|
|
7286
7197
|
let mimeType = null;
|
|
7287
7198
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
7288
7199
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -7291,14 +7202,14 @@ var binaryFieldController = (props) => {
|
|
|
7291
7202
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
7292
7203
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
7293
7204
|
};
|
|
7294
|
-
(0,
|
|
7205
|
+
(0, import_react25.useEffect)(() => {
|
|
7295
7206
|
return () => {
|
|
7296
7207
|
if (selectedImage) {
|
|
7297
7208
|
URL.revokeObjectURL(selectedImage);
|
|
7298
7209
|
}
|
|
7299
7210
|
};
|
|
7300
7211
|
}, [selectedImage]);
|
|
7301
|
-
(0,
|
|
7212
|
+
(0, import_react25.useEffect)(() => {
|
|
7302
7213
|
if (binaryRef.current) {
|
|
7303
7214
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
7304
7215
|
setIsInsideTable(isInsideTable2);
|
|
@@ -7324,7 +7235,6 @@ var binaryFieldController = (props) => {
|
|
|
7324
7235
|
CloseIcon,
|
|
7325
7236
|
EyeIcon,
|
|
7326
7237
|
LoadingIcon,
|
|
7327
|
-
MainAppProvider,
|
|
7328
7238
|
STORAGES,
|
|
7329
7239
|
binaryFieldController,
|
|
7330
7240
|
colorFieldController,
|