@fctc/widget-logic 1.2.4 → 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 +4 -37
- package/dist/hooks.d.ts +4 -37
- package/dist/hooks.js +18 -101
- package/dist/hooks.mjs +19 -107
- package/dist/index.js +177 -260
- package/dist/index.mjs +51 -139
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4754,7 +4754,9 @@ var AppProvider = ({ children }) => {
|
|
|
4754
4754
|
return combineContexts([user.context, company.context]);
|
|
4755
4755
|
}, [user.context, company.context]);
|
|
4756
4756
|
const menu = useMenu({ context: menuContext });
|
|
4757
|
-
const action = (0, import_react10.useMemo)(() =>
|
|
4757
|
+
const action = (0, import_react10.useMemo)(() => {
|
|
4758
|
+
return menu.state.action;
|
|
4759
|
+
}, [menu.state.action]);
|
|
4758
4760
|
const viewContext = (0, import_react10.useMemo)(() => {
|
|
4759
4761
|
return combineContexts([
|
|
4760
4762
|
menuContext,
|
|
@@ -4789,7 +4791,9 @@ var AppProvider = ({ children }) => {
|
|
|
4789
4791
|
};
|
|
4790
4792
|
var useAppProvider = () => {
|
|
4791
4793
|
const context = (0, import_react10.useContext)(ReactContext);
|
|
4792
|
-
if (!context)
|
|
4794
|
+
if (!context) {
|
|
4795
|
+
return AppProviderInitialValue;
|
|
4796
|
+
}
|
|
4793
4797
|
return context;
|
|
4794
4798
|
};
|
|
4795
4799
|
|
|
@@ -4840,125 +4844,38 @@ function useDebounce(value, delay) {
|
|
|
4840
4844
|
}
|
|
4841
4845
|
|
|
4842
4846
|
// src/hooks/api/use-switch-locale.ts
|
|
4843
|
-
var import_interface_logic11 = require("@fctc/interface-logic");
|
|
4844
|
-
var import_react13 = require("react");
|
|
4845
4847
|
var useSwitchLocaleHandler = () => {
|
|
4846
|
-
const switchUserLocale = (0, import_interface_logic11.useSwitchLocale)();
|
|
4847
|
-
const env = (0, import_interface_logic11.getEnv)();
|
|
4848
|
-
const { context } = (0, import_interface_logic11.useAppSelector)(import_interface_logic11.selectEnv);
|
|
4849
|
-
const switchLocale = (0, import_react13.useCallback)(
|
|
4850
|
-
async (langId) => {
|
|
4851
|
-
if (!langId) return;
|
|
4852
|
-
await switchUserLocale.mutateAsync({
|
|
4853
|
-
data: {
|
|
4854
|
-
id: parseInt(context?.uid),
|
|
4855
|
-
values: { lang: langId }
|
|
4856
|
-
}
|
|
4857
|
-
});
|
|
4858
|
-
env.setLang(langId);
|
|
4859
|
-
},
|
|
4860
|
-
[switchUserLocale]
|
|
4861
|
-
);
|
|
4862
4848
|
return {
|
|
4863
|
-
switchLocale,
|
|
4864
|
-
isLoading: switchUserLocale.isPending,
|
|
4865
|
-
error: switchUserLocale.error
|
|
4849
|
+
// switchLocale,
|
|
4850
|
+
// isLoading: switchUserLocale.isPending,
|
|
4851
|
+
// error: switchUserLocale.error,
|
|
4866
4852
|
};
|
|
4867
4853
|
};
|
|
4868
4854
|
|
|
4869
4855
|
// src/hooks/api/use-login.ts
|
|
4870
|
-
var import_interface_logic12 = require("@fctc/interface-logic");
|
|
4871
|
-
var import_react14 = require("react");
|
|
4872
4856
|
var useLoginHandler = () => {
|
|
4873
|
-
const loginMutate = (0, import_interface_logic12.useLoginCredential)();
|
|
4874
|
-
const login = (0, import_react14.useCallback)(
|
|
4875
|
-
({
|
|
4876
|
-
email,
|
|
4877
|
-
password,
|
|
4878
|
-
path
|
|
4879
|
-
}, {
|
|
4880
|
-
onSuccess,
|
|
4881
|
-
onError
|
|
4882
|
-
}) => {
|
|
4883
|
-
loginMutate.mutate(
|
|
4884
|
-
{
|
|
4885
|
-
email,
|
|
4886
|
-
password,
|
|
4887
|
-
path
|
|
4888
|
-
},
|
|
4889
|
-
{
|
|
4890
|
-
onSuccess,
|
|
4891
|
-
onError
|
|
4892
|
-
}
|
|
4893
|
-
);
|
|
4894
|
-
},
|
|
4895
|
-
[loginMutate]
|
|
4896
|
-
);
|
|
4897
4857
|
return {
|
|
4898
|
-
login,
|
|
4899
|
-
isLoading: loginMutate.isPending,
|
|
4900
|
-
error: loginMutate.error
|
|
4858
|
+
// login,
|
|
4859
|
+
// isLoading: loginMutate.isPending,
|
|
4860
|
+
// error: loginMutate.error,
|
|
4901
4861
|
};
|
|
4902
4862
|
};
|
|
4903
4863
|
|
|
4904
4864
|
// src/hooks/api/use-forgot-password.ts
|
|
4905
|
-
var import_interface_logic13 = require("@fctc/interface-logic");
|
|
4906
|
-
var import_react15 = require("react");
|
|
4907
4865
|
var useForgotPasswordHandler = () => {
|
|
4908
|
-
const forgotPasswordMutate = (0, import_interface_logic13.useForgotPassword)();
|
|
4909
|
-
const sendForgotPassword = (0, import_react15.useCallback)(
|
|
4910
|
-
(email, {
|
|
4911
|
-
onSuccess,
|
|
4912
|
-
onError
|
|
4913
|
-
} = {}) => {
|
|
4914
|
-
forgotPasswordMutate.mutate(email, {
|
|
4915
|
-
onSuccess,
|
|
4916
|
-
onError
|
|
4917
|
-
});
|
|
4918
|
-
},
|
|
4919
|
-
[forgotPasswordMutate]
|
|
4920
|
-
);
|
|
4921
4866
|
return {
|
|
4922
|
-
sendForgotPassword,
|
|
4923
|
-
isLoading: forgotPasswordMutate.isPending,
|
|
4924
|
-
error: forgotPasswordMutate.error
|
|
4867
|
+
// sendForgotPassword,
|
|
4868
|
+
// isLoading: forgotPasswordMutate.isPending,
|
|
4869
|
+
// error: forgotPasswordMutate.error,
|
|
4925
4870
|
};
|
|
4926
4871
|
};
|
|
4927
4872
|
|
|
4928
4873
|
// src/hooks/api/use-reset-password.ts
|
|
4929
|
-
var import_interface_logic14 = require("@fctc/interface-logic");
|
|
4930
|
-
var import_react16 = require("react");
|
|
4931
4874
|
var useResetPasswordHandler = () => {
|
|
4932
|
-
const resetPasswordMutate = (0, import_interface_logic14.useResetPassword)();
|
|
4933
|
-
const resetPassword = (0, import_react16.useCallback)(
|
|
4934
|
-
({
|
|
4935
|
-
password,
|
|
4936
|
-
confirmPassword,
|
|
4937
|
-
token
|
|
4938
|
-
}, {
|
|
4939
|
-
onSuccess,
|
|
4940
|
-
onError
|
|
4941
|
-
}) => {
|
|
4942
|
-
resetPasswordMutate.mutate(
|
|
4943
|
-
{
|
|
4944
|
-
data: {
|
|
4945
|
-
password,
|
|
4946
|
-
confirmPassword
|
|
4947
|
-
},
|
|
4948
|
-
token
|
|
4949
|
-
},
|
|
4950
|
-
{
|
|
4951
|
-
onSuccess,
|
|
4952
|
-
onError
|
|
4953
|
-
}
|
|
4954
|
-
);
|
|
4955
|
-
},
|
|
4956
|
-
[resetPasswordMutate]
|
|
4957
|
-
);
|
|
4958
4875
|
return {
|
|
4959
|
-
resetPassword,
|
|
4960
|
-
isLoading: resetPasswordMutate.isPending,
|
|
4961
|
-
error: resetPasswordMutate.error
|
|
4876
|
+
// resetPassword,
|
|
4877
|
+
// isLoading: resetPasswordMutate.isPending,
|
|
4878
|
+
// error: resetPasswordMutate.error,
|
|
4962
4879
|
};
|
|
4963
4880
|
};
|
|
4964
4881
|
|
|
@@ -5069,19 +4986,19 @@ var CloseIcon = ({ className = "" }) => {
|
|
|
5069
4986
|
};
|
|
5070
4987
|
|
|
5071
4988
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
5072
|
-
var
|
|
5073
|
-
var
|
|
4989
|
+
var import_react13 = require("react");
|
|
4990
|
+
var import_interface_logic11 = require("@fctc/interface-logic");
|
|
5074
4991
|
var statusDropdownController = (props) => {
|
|
5075
4992
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
5076
|
-
const env = (0,
|
|
4993
|
+
const env = (0, import_interface_logic11.getEnv)();
|
|
5077
4994
|
const colors = {
|
|
5078
4995
|
normal: "bg-[#e9ecef]",
|
|
5079
4996
|
done: "bg-primary",
|
|
5080
4997
|
blocked: "bg-red-500"
|
|
5081
4998
|
};
|
|
5082
|
-
const [isOpen, setIsOpen] = (0,
|
|
5083
|
-
const buttonRef = (0,
|
|
5084
|
-
(0,
|
|
4999
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
5000
|
+
const buttonRef = (0, import_react13.useRef)(null);
|
|
5001
|
+
(0, import_react13.useEffect)(() => {
|
|
5085
5002
|
const handleClickOutside = (event) => {
|
|
5086
5003
|
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
5087
5004
|
setIsOpen(false);
|
|
@@ -5092,7 +5009,7 @@ var statusDropdownController = (props) => {
|
|
|
5092
5009
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5093
5010
|
};
|
|
5094
5011
|
}, []);
|
|
5095
|
-
const { mutate: onSave } = (0,
|
|
5012
|
+
const { mutate: onSave } = (0, import_interface_logic11.useSave)();
|
|
5096
5013
|
const handleClick = async (status) => {
|
|
5097
5014
|
setIsOpen(!isOpen);
|
|
5098
5015
|
onSave(
|
|
@@ -5122,8 +5039,8 @@ var statusDropdownController = (props) => {
|
|
|
5122
5039
|
};
|
|
5123
5040
|
|
|
5124
5041
|
// src/widget/basic/many2one-field/controller.ts
|
|
5125
|
-
var
|
|
5126
|
-
var
|
|
5042
|
+
var import_react14 = require("react");
|
|
5043
|
+
var import_interface_logic12 = require("@fctc/interface-logic");
|
|
5127
5044
|
var many2oneFieldController = (props) => {
|
|
5128
5045
|
const {
|
|
5129
5046
|
name,
|
|
@@ -5138,24 +5055,24 @@ var many2oneFieldController = (props) => {
|
|
|
5138
5055
|
showDetail = true,
|
|
5139
5056
|
actionData
|
|
5140
5057
|
} = props;
|
|
5141
|
-
const [options, setOptions] = (0,
|
|
5142
|
-
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0,
|
|
5143
|
-
const [tempSelectedOption, setTempSelectedOption] = (0,
|
|
5144
|
-
const { menuList } = (0,
|
|
5145
|
-
const { context } = (0,
|
|
5146
|
-
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);
|
|
5147
5064
|
const initValue = methods?.getValues(name);
|
|
5148
|
-
const domainObject = (0,
|
|
5149
|
-
() => (0,
|
|
5065
|
+
const domainObject = (0, import_react14.useMemo)(
|
|
5066
|
+
() => (0, import_interface_logic12.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
|
|
5150
5067
|
[domain, formValues]
|
|
5151
5068
|
);
|
|
5152
|
-
const optionsObject = (0,
|
|
5069
|
+
const optionsObject = (0, import_interface_logic12.evalJSONContext)(fieldOptions) || {};
|
|
5153
5070
|
const contextObject = {
|
|
5154
|
-
...(0,
|
|
5071
|
+
...(0, import_interface_logic12.evalJSONContext)(actionData?.context) || {},
|
|
5155
5072
|
...fieldContext,
|
|
5156
5073
|
...context
|
|
5157
5074
|
};
|
|
5158
|
-
const actionId = (0,
|
|
5075
|
+
const actionId = (0, import_react14.useMemo)(
|
|
5159
5076
|
() => menuList?.flatMap(
|
|
5160
5077
|
(item) => item?.child_id.filter(
|
|
5161
5078
|
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
@@ -5178,23 +5095,23 @@ var many2oneFieldController = (props) => {
|
|
|
5178
5095
|
data: dataOfSelection,
|
|
5179
5096
|
// refetch,
|
|
5180
5097
|
isFetching
|
|
5181
|
-
} = (0,
|
|
5098
|
+
} = (0, import_interface_logic12.useGetSelection)({
|
|
5182
5099
|
data,
|
|
5183
5100
|
queryKey,
|
|
5184
5101
|
enabled: false
|
|
5185
5102
|
});
|
|
5186
|
-
const selectOptions = (0,
|
|
5103
|
+
const selectOptions = (0, import_react14.useMemo)(() => {
|
|
5187
5104
|
return dataOfSelection?.records?.map((val) => ({
|
|
5188
5105
|
value: val?.id,
|
|
5189
5106
|
label: val?.display_name || val?.name
|
|
5190
5107
|
})) || [];
|
|
5191
5108
|
}, [dataOfSelection]);
|
|
5192
|
-
(0,
|
|
5109
|
+
(0, import_react14.useEffect)(() => {
|
|
5193
5110
|
setOptions(selectOptions);
|
|
5194
5111
|
setDomainModal(domainObject);
|
|
5195
|
-
if (relation === "student.subject") (0,
|
|
5112
|
+
if (relation === "student.subject") (0, import_interface_logic12.setListSubject)(selectOptions);
|
|
5196
5113
|
}, [selectOptions]);
|
|
5197
|
-
(0,
|
|
5114
|
+
(0, import_react14.useEffect)(() => {
|
|
5198
5115
|
if (!propValue && tempSelectedOption) {
|
|
5199
5116
|
methods.setValue(name, null);
|
|
5200
5117
|
setTempSelectedOption(null);
|
|
@@ -5205,12 +5122,12 @@ var many2oneFieldController = (props) => {
|
|
|
5205
5122
|
});
|
|
5206
5123
|
}
|
|
5207
5124
|
}, [propValue]);
|
|
5208
|
-
(0,
|
|
5125
|
+
(0, import_react14.useEffect)(() => {
|
|
5209
5126
|
if (actionId) {
|
|
5210
5127
|
localStorage.setItem("aid", actionId);
|
|
5211
5128
|
}
|
|
5212
5129
|
}, [actionId]);
|
|
5213
|
-
const handleChooseRecord = (0,
|
|
5130
|
+
const handleChooseRecord = (0, import_react14.useCallback)(
|
|
5214
5131
|
(idRecord) => {
|
|
5215
5132
|
const newOption = options.find(
|
|
5216
5133
|
(option) => option.value === idRecord
|
|
@@ -5235,8 +5152,8 @@ var many2oneFieldController = (props) => {
|
|
|
5235
5152
|
},
|
|
5236
5153
|
[options, methods, name, onChange]
|
|
5237
5154
|
);
|
|
5238
|
-
const handleClose = (0,
|
|
5239
|
-
const handleSelectChange = (0,
|
|
5155
|
+
const handleClose = (0, import_react14.useCallback)(() => setIsShowModalMany2Many(false), []);
|
|
5156
|
+
const handleSelectChange = (0, import_react14.useCallback)(
|
|
5240
5157
|
(selectedOption) => {
|
|
5241
5158
|
if (!selectedOption) {
|
|
5242
5159
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5261,7 +5178,7 @@ var many2oneFieldController = (props) => {
|
|
|
5261
5178
|
[methods, name, onChange]
|
|
5262
5179
|
);
|
|
5263
5180
|
const allowShowDetail = showDetail && contextObject?.form_view_ref && (!("no_open" in optionsObject) || optionsObject?.no_open === false);
|
|
5264
|
-
const fetchMoreOptions = (0,
|
|
5181
|
+
const fetchMoreOptions = (0, import_react14.useCallback)(() => {
|
|
5265
5182
|
if (typeof dataOfSelection?.refetch === "function") {
|
|
5266
5183
|
;
|
|
5267
5184
|
dataOfSelection.refetch();
|
|
@@ -5293,18 +5210,18 @@ var many2oneFieldController = (props) => {
|
|
|
5293
5210
|
};
|
|
5294
5211
|
|
|
5295
5212
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5296
|
-
var
|
|
5213
|
+
var import_interface_logic13 = require("@fctc/interface-logic");
|
|
5297
5214
|
var many2oneButtonController = (props) => {
|
|
5298
5215
|
const { domain, methods, relation } = props;
|
|
5299
5216
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5300
|
-
const env = (0,
|
|
5301
|
-
const domainObject = (0,
|
|
5217
|
+
const env = (0, import_interface_logic13.getEnv)();
|
|
5218
|
+
const domainObject = (0, import_interface_logic13.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5302
5219
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5303
|
-
const { data: dataOfSelection } = (0,
|
|
5220
|
+
const { data: dataOfSelection } = (0, import_interface_logic13.useGetSelection)({
|
|
5304
5221
|
data: {
|
|
5305
5222
|
model: relation ?? "",
|
|
5306
5223
|
domain: domainObject,
|
|
5307
|
-
context: { ...env.context, ...(0,
|
|
5224
|
+
context: { ...env.context, ...(0, import_interface_logic13.evalJSONContext)(actionData?.context) }
|
|
5308
5225
|
},
|
|
5309
5226
|
queryKey: [`data_${relation}`, domainObject]
|
|
5310
5227
|
});
|
|
@@ -5318,12 +5235,12 @@ var many2oneButtonController = (props) => {
|
|
|
5318
5235
|
};
|
|
5319
5236
|
|
|
5320
5237
|
// src/widget/basic/many2many-field/controller.ts
|
|
5321
|
-
var
|
|
5322
|
-
var
|
|
5238
|
+
var import_react18 = require("react");
|
|
5239
|
+
var import_interface_logic18 = require("@fctc/interface-logic");
|
|
5323
5240
|
|
|
5324
5241
|
// src/widget/advance/table/table-body/controller.ts
|
|
5325
|
-
var
|
|
5326
|
-
var
|
|
5242
|
+
var import_interface_logic14 = require("@fctc/interface-logic");
|
|
5243
|
+
var import_react15 = require("react");
|
|
5327
5244
|
var tableBodyController = (props) => {
|
|
5328
5245
|
const {
|
|
5329
5246
|
checkedAll,
|
|
@@ -5335,8 +5252,8 @@ var tableBodyController = (props) => {
|
|
|
5335
5252
|
selectedRowKeysRef,
|
|
5336
5253
|
onClickRow
|
|
5337
5254
|
} = props;
|
|
5338
|
-
const appDispatch = (0,
|
|
5339
|
-
const checked = (0,
|
|
5255
|
+
const appDispatch = (0, import_interface_logic14.useAppDispatch)();
|
|
5256
|
+
const checked = (0, import_react15.useMemo)(() => {
|
|
5340
5257
|
if (!row?.id) return false;
|
|
5341
5258
|
if (selectedRowKeys?.includes(row.id)) {
|
|
5342
5259
|
return true;
|
|
@@ -5352,12 +5269,12 @@ var tableBodyController = (props) => {
|
|
|
5352
5269
|
}
|
|
5353
5270
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
5354
5271
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
5355
|
-
appDispatch((0,
|
|
5272
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(newSelectedRowKeys));
|
|
5356
5273
|
};
|
|
5357
5274
|
const handleClickRow = (col, row2) => {
|
|
5358
5275
|
onClickRow(col, row2);
|
|
5359
5276
|
};
|
|
5360
|
-
(0,
|
|
5277
|
+
(0, import_react15.useEffect)(() => {
|
|
5361
5278
|
if (!row?.id) return;
|
|
5362
5279
|
if (isAutoSelect) {
|
|
5363
5280
|
if (checkboxRef?.current === "uncheck") {
|
|
@@ -5365,17 +5282,17 @@ var tableBodyController = (props) => {
|
|
|
5365
5282
|
(id) => id !== row.id
|
|
5366
5283
|
);
|
|
5367
5284
|
selectedRowKeysRef.current = filtered;
|
|
5368
|
-
appDispatch((0,
|
|
5285
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(filtered));
|
|
5369
5286
|
} else {
|
|
5370
5287
|
const unique = Array.from(
|
|
5371
5288
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
5372
5289
|
);
|
|
5373
5290
|
selectedRowKeysRef.current = unique;
|
|
5374
|
-
appDispatch((0,
|
|
5291
|
+
appDispatch((0, import_interface_logic14.setSelectedRowKeys)(unique));
|
|
5375
5292
|
}
|
|
5376
5293
|
}
|
|
5377
5294
|
}, [isAutoSelect]);
|
|
5378
|
-
(0,
|
|
5295
|
+
(0, import_react15.useEffect)(() => {
|
|
5379
5296
|
if (!checkedAll) {
|
|
5380
5297
|
checkboxRef.current = "enabled";
|
|
5381
5298
|
false;
|
|
@@ -5389,35 +5306,35 @@ var tableBodyController = (props) => {
|
|
|
5389
5306
|
};
|
|
5390
5307
|
|
|
5391
5308
|
// src/widget/advance/table/table-head/controller.ts
|
|
5392
|
-
var
|
|
5309
|
+
var import_interface_logic15 = require("@fctc/interface-logic");
|
|
5393
5310
|
var tableHeadController = (props) => {
|
|
5394
5311
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
5395
|
-
const appDispatch = (0,
|
|
5396
|
-
const { groupByDomain } = (0,
|
|
5312
|
+
const appDispatch = (0, import_interface_logic15.useAppDispatch)();
|
|
5313
|
+
const { groupByDomain } = (0, import_interface_logic15.useAppSelector)(import_interface_logic15.selectSearch);
|
|
5397
5314
|
const handleCheckBoxAll = (event) => {
|
|
5398
5315
|
if (event?.target?.checked && typeTable === "list") {
|
|
5399
5316
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
5400
|
-
appDispatch((0,
|
|
5317
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(allRowKeys));
|
|
5401
5318
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
5402
5319
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
5403
5320
|
const ids = Array.from(rowsIDs)?.map(
|
|
5404
5321
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
5405
5322
|
);
|
|
5406
5323
|
if (ids?.length > 0) {
|
|
5407
|
-
appDispatch((0,
|
|
5324
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(ids));
|
|
5408
5325
|
} else {
|
|
5409
5326
|
const sum = countSum(
|
|
5410
5327
|
rows,
|
|
5411
5328
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
5412
5329
|
);
|
|
5413
5330
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
5414
|
-
appDispatch((0,
|
|
5331
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)(keys));
|
|
5415
5332
|
}
|
|
5416
5333
|
if (selectedRowKeysRef) {
|
|
5417
5334
|
selectedRowKeysRef.current = [];
|
|
5418
5335
|
}
|
|
5419
5336
|
} else {
|
|
5420
|
-
appDispatch((0,
|
|
5337
|
+
appDispatch((0, import_interface_logic15.setSelectedRowKeys)([]));
|
|
5421
5338
|
}
|
|
5422
5339
|
};
|
|
5423
5340
|
return {
|
|
@@ -5426,11 +5343,11 @@ var tableHeadController = (props) => {
|
|
|
5426
5343
|
};
|
|
5427
5344
|
|
|
5428
5345
|
// src/widget/advance/table/table-view/controller.ts
|
|
5429
|
-
var
|
|
5430
|
-
var
|
|
5346
|
+
var import_interface_logic16 = require("@fctc/interface-logic");
|
|
5347
|
+
var import_react16 = require("react");
|
|
5431
5348
|
var tableController = ({ data }) => {
|
|
5432
|
-
const [rows, setRows] = (0,
|
|
5433
|
-
const [columns, setColumns] = (0,
|
|
5349
|
+
const [rows, setRows] = (0, import_react16.useState)(data.records || []);
|
|
5350
|
+
const [columns, setColumns] = (0, import_react16.useState)([]);
|
|
5434
5351
|
const dataModelFields = data.fields?.map((field) => {
|
|
5435
5352
|
return {
|
|
5436
5353
|
...data.dataModel?.[field?.name],
|
|
@@ -5458,14 +5375,14 @@ var tableController = ({ data }) => {
|
|
|
5458
5375
|
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
5459
5376
|
});
|
|
5460
5377
|
};
|
|
5461
|
-
(0,
|
|
5378
|
+
(0, import_react16.useEffect)(() => {
|
|
5462
5379
|
setRows(transformData(data.records || null));
|
|
5463
5380
|
}, [data.records]);
|
|
5464
5381
|
const handleGetColumns = () => {
|
|
5465
5382
|
let cols = [];
|
|
5466
5383
|
try {
|
|
5467
5384
|
cols = mergeFields?.filter((item) => {
|
|
5468
|
-
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);
|
|
5469
5386
|
})?.map((field) => {
|
|
5470
5387
|
return {
|
|
5471
5388
|
name: field?.name,
|
|
@@ -5479,7 +5396,7 @@ var tableController = ({ data }) => {
|
|
|
5479
5396
|
}
|
|
5480
5397
|
return cols;
|
|
5481
5398
|
};
|
|
5482
|
-
(0,
|
|
5399
|
+
(0, import_react16.useEffect)(() => {
|
|
5483
5400
|
const columns2 = handleGetColumns();
|
|
5484
5401
|
setColumns(columns2);
|
|
5485
5402
|
}, [data.records]);
|
|
@@ -5504,8 +5421,8 @@ var tableController = ({ data }) => {
|
|
|
5504
5421
|
};
|
|
5505
5422
|
|
|
5506
5423
|
// src/widget/advance/table/table-group/controller.ts
|
|
5507
|
-
var
|
|
5508
|
-
var
|
|
5424
|
+
var import_interface_logic17 = require("@fctc/interface-logic");
|
|
5425
|
+
var import_react17 = require("react");
|
|
5509
5426
|
|
|
5510
5427
|
// src/utils/i18n.ts
|
|
5511
5428
|
var import_react_i18next2 = require("react-i18next");
|
|
@@ -6275,7 +6192,7 @@ var i18n_default = import_i18next.default;
|
|
|
6275
6192
|
|
|
6276
6193
|
// src/widget/advance/table/table-group/controller.ts
|
|
6277
6194
|
var tableGroupController = (props) => {
|
|
6278
|
-
const env = (0,
|
|
6195
|
+
const env = (0, import_interface_logic17.getEnv)();
|
|
6279
6196
|
const {
|
|
6280
6197
|
rows,
|
|
6281
6198
|
columns,
|
|
@@ -6294,18 +6211,18 @@ var tableGroupController = (props) => {
|
|
|
6294
6211
|
setIsAutoSelect,
|
|
6295
6212
|
selectedRowKeysRef
|
|
6296
6213
|
} = props;
|
|
6297
|
-
const [pageGroup, setPageGroup] = (0,
|
|
6298
|
-
const { groupByDomain, selectedTags } = (0,
|
|
6299
|
-
const { selectedRowKeys } = (0,
|
|
6300
|
-
const appDispatch = (0,
|
|
6301
|
-
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)();
|
|
6302
6219
|
const initVal = toDataJS(row, viewData, model);
|
|
6303
|
-
const [isShowGroup, setIsShowGroup] = (0,
|
|
6304
|
-
const [colEmptyGroup, setColEmptyGroup] = (0,
|
|
6220
|
+
const [isShowGroup, setIsShowGroup] = (0, import_react17.useState)(false);
|
|
6221
|
+
const [colEmptyGroup, setColEmptyGroup] = (0, import_react17.useState)({
|
|
6305
6222
|
fromStart: 1,
|
|
6306
6223
|
fromEnd: 1
|
|
6307
6224
|
});
|
|
6308
|
-
const processedData = (0,
|
|
6225
|
+
const processedData = (0, import_react17.useMemo)(() => {
|
|
6309
6226
|
const calculateColSpanEmpty = () => {
|
|
6310
6227
|
const startIndex = columns.findIndex(
|
|
6311
6228
|
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
@@ -6320,7 +6237,7 @@ var tableGroupController = (props) => {
|
|
|
6320
6237
|
};
|
|
6321
6238
|
return calculateColSpanEmpty();
|
|
6322
6239
|
}, [columns, row]);
|
|
6323
|
-
const shouldFetchData = (0,
|
|
6240
|
+
const shouldFetchData = (0, import_react17.useMemo)(() => {
|
|
6324
6241
|
return !!isShowGroup;
|
|
6325
6242
|
}, [isShowGroup]);
|
|
6326
6243
|
const enabled = shouldFetchData && !!processedData;
|
|
@@ -6345,7 +6262,7 @@ var tableGroupController = (props) => {
|
|
|
6345
6262
|
isPlaceholderData,
|
|
6346
6263
|
isLoading,
|
|
6347
6264
|
isFetching
|
|
6348
|
-
} = (0,
|
|
6265
|
+
} = (0, import_interface_logic17.useGetListData)(listDataProps, queryKey, enabled);
|
|
6349
6266
|
const {
|
|
6350
6267
|
columns: columnsGroup,
|
|
6351
6268
|
rows: rowsGroup,
|
|
@@ -6360,7 +6277,7 @@ var tableGroupController = (props) => {
|
|
|
6360
6277
|
}
|
|
6361
6278
|
});
|
|
6362
6279
|
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
6363
|
-
(0,
|
|
6280
|
+
(0, import_react17.useEffect)(() => {
|
|
6364
6281
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
6365
6282
|
setIsShowGroup(false);
|
|
6366
6283
|
}
|
|
@@ -6383,24 +6300,24 @@ var tableGroupController = (props) => {
|
|
|
6383
6300
|
const filteredIds = selectedRowKeys.filter(
|
|
6384
6301
|
(id) => !ids.includes(id)
|
|
6385
6302
|
);
|
|
6386
|
-
appDispatch((0,
|
|
6303
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)(filteredIds));
|
|
6387
6304
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6388
6305
|
const clonedKeys = [...selectedRowKeys];
|
|
6389
|
-
appDispatch((0,
|
|
6390
|
-
setTimeout(() => appDispatch((0,
|
|
6306
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6307
|
+
setTimeout(() => appDispatch((0, import_interface_logic17.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6391
6308
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6392
6309
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6393
|
-
appDispatch((0,
|
|
6310
|
+
appDispatch((0, import_interface_logic17.setSelectedRowKeys)(filteredKeys));
|
|
6394
6311
|
}
|
|
6395
6312
|
toggleShowGroup();
|
|
6396
6313
|
};
|
|
6397
|
-
(0,
|
|
6314
|
+
(0, import_react17.useEffect)(() => {
|
|
6398
6315
|
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
6399
6316
|
return;
|
|
6400
6317
|
}
|
|
6401
6318
|
const clonedKeys = [...selectedRowKeys];
|
|
6402
|
-
(0,
|
|
6403
|
-
setTimeout(() => (0,
|
|
6319
|
+
(0, import_interface_logic17.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6320
|
+
setTimeout(() => (0, import_interface_logic17.setSelectedRowKeys)(clonedKeys), 500);
|
|
6404
6321
|
}, [isQueryFetched]);
|
|
6405
6322
|
return {
|
|
6406
6323
|
handleExpandChildGroup,
|
|
@@ -6450,14 +6367,14 @@ var many2manyFieldController = (props) => {
|
|
|
6450
6367
|
options,
|
|
6451
6368
|
sessionStorageUtils
|
|
6452
6369
|
} = props;
|
|
6453
|
-
const appDispatch = (0,
|
|
6370
|
+
const appDispatch = (0, import_interface_logic18.useAppDispatch)();
|
|
6454
6371
|
const actionData = sessionStorageUtils.getActionData();
|
|
6455
6372
|
const [debouncedPage] = useDebounce(page, 500);
|
|
6456
|
-
const [order, setOrder] = (0,
|
|
6457
|
-
const [isLoadedData, setIsLoadedData] = (0,
|
|
6458
|
-
const [domainMany2Many, setDomainMany2Many] = (0,
|
|
6459
|
-
const env = (0,
|
|
6460
|
-
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);
|
|
6461
6378
|
const viewParams = {
|
|
6462
6379
|
model: relation,
|
|
6463
6380
|
views: [
|
|
@@ -6466,11 +6383,11 @@ var many2manyFieldController = (props) => {
|
|
|
6466
6383
|
],
|
|
6467
6384
|
context
|
|
6468
6385
|
};
|
|
6469
|
-
const { data: viewResponse, isFetched: isViewReponseFetched } = (0,
|
|
6386
|
+
const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic18.useGetView)(
|
|
6470
6387
|
viewParams,
|
|
6471
6388
|
actionData
|
|
6472
6389
|
);
|
|
6473
|
-
const baseModel = (0,
|
|
6390
|
+
const baseModel = (0, import_react18.useMemo)(
|
|
6474
6391
|
() => ({
|
|
6475
6392
|
name: String(relation),
|
|
6476
6393
|
view: viewResponse || {},
|
|
@@ -6482,26 +6399,26 @@ var many2manyFieldController = (props) => {
|
|
|
6482
6399
|
}),
|
|
6483
6400
|
[model, viewResponse]
|
|
6484
6401
|
);
|
|
6485
|
-
const initModel = (0,
|
|
6486
|
-
const modelInstance = (0,
|
|
6402
|
+
const initModel = (0, import_interface_logic18.useModel)();
|
|
6403
|
+
const modelInstance = (0, import_react18.useMemo)(() => {
|
|
6487
6404
|
if (viewResponse) {
|
|
6488
6405
|
return initModel.initModel(baseModel);
|
|
6489
6406
|
}
|
|
6490
6407
|
return null;
|
|
6491
6408
|
}, [baseModel, viewResponse]);
|
|
6492
|
-
const specification = (0,
|
|
6409
|
+
const specification = (0, import_react18.useMemo)(() => {
|
|
6493
6410
|
if (modelInstance) {
|
|
6494
6411
|
return modelInstance.getSpecification();
|
|
6495
6412
|
}
|
|
6496
6413
|
return null;
|
|
6497
6414
|
}, [modelInstance]);
|
|
6498
6415
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
6499
|
-
const optionsObject = tab?.options ? (0,
|
|
6416
|
+
const optionsObject = tab?.options ? (0, import_interface_logic18.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic18.evalJSONContext)(options) : {}) || {};
|
|
6500
6417
|
const fetchData = async () => {
|
|
6501
6418
|
try {
|
|
6502
6419
|
setDomainMany2Many(domain);
|
|
6503
|
-
appDispatch((0,
|
|
6504
|
-
appDispatch((0,
|
|
6420
|
+
appDispatch((0, import_interface_logic18.setFirstDomain)(domain));
|
|
6421
|
+
appDispatch((0, import_interface_logic18.setViewDataStore)(viewResponse));
|
|
6505
6422
|
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
6506
6423
|
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
6507
6424
|
...field
|
|
@@ -6512,7 +6429,7 @@ var many2manyFieldController = (props) => {
|
|
|
6512
6429
|
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
6513
6430
|
});
|
|
6514
6431
|
}
|
|
6515
|
-
appDispatch((0,
|
|
6432
|
+
appDispatch((0, import_interface_logic18.setPage)(0));
|
|
6516
6433
|
} catch (err) {
|
|
6517
6434
|
console.log(err);
|
|
6518
6435
|
}
|
|
@@ -6534,7 +6451,7 @@ var many2manyFieldController = (props) => {
|
|
|
6534
6451
|
context,
|
|
6535
6452
|
fields: groupByDomain?.fields,
|
|
6536
6453
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
6537
|
-
sort: order ? order : default_order ? (0,
|
|
6454
|
+
sort: order ? order : default_order ? (0, import_interface_logic18.formatSortingString)(default_order) : ""
|
|
6538
6455
|
};
|
|
6539
6456
|
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
6540
6457
|
const {
|
|
@@ -6542,18 +6459,18 @@ var many2manyFieldController = (props) => {
|
|
|
6542
6459
|
isLoading: isDataLoading,
|
|
6543
6460
|
isFetched: isDataResponseFetched,
|
|
6544
6461
|
isPlaceholderData
|
|
6545
|
-
} = (0,
|
|
6546
|
-
(0,
|
|
6462
|
+
} = (0, import_interface_logic18.useGetListData)(data, queryKey, enabled);
|
|
6463
|
+
(0, import_react18.useEffect)(() => {
|
|
6547
6464
|
if (viewResponse) {
|
|
6548
6465
|
fetchData();
|
|
6549
6466
|
}
|
|
6550
6467
|
return () => {
|
|
6551
|
-
appDispatch((0,
|
|
6468
|
+
appDispatch((0, import_interface_logic18.setGroupByDomain)(null));
|
|
6552
6469
|
setFields((prevFields) => ({
|
|
6553
6470
|
...prevFields,
|
|
6554
6471
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
6555
6472
|
}));
|
|
6556
|
-
appDispatch((0,
|
|
6473
|
+
appDispatch((0, import_interface_logic18.setPage)(0));
|
|
6557
6474
|
setSelectedRowKeys4([]);
|
|
6558
6475
|
setDomainMany2Many(null);
|
|
6559
6476
|
setIsLoadedData(false);
|
|
@@ -6577,18 +6494,18 @@ var many2manyFieldController = (props) => {
|
|
|
6577
6494
|
refetch,
|
|
6578
6495
|
data: dataFormViewResponse,
|
|
6579
6496
|
isSuccess
|
|
6580
|
-
} = (0,
|
|
6497
|
+
} = (0, import_interface_logic18.useGetFormView)({
|
|
6581
6498
|
data: dataFormView,
|
|
6582
6499
|
queryKey: [`form-view-action-${relation}`],
|
|
6583
6500
|
enabled: false
|
|
6584
6501
|
});
|
|
6585
|
-
(0,
|
|
6502
|
+
(0, import_react18.useEffect)(() => {
|
|
6586
6503
|
if (isSuccess && dataFormViewResponse) {
|
|
6587
6504
|
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
6588
6505
|
window.location.href = `/form/menu?model=${relation}`;
|
|
6589
6506
|
}
|
|
6590
6507
|
}, [isSuccess]);
|
|
6591
|
-
(0,
|
|
6508
|
+
(0, import_react18.useEffect)(() => {
|
|
6592
6509
|
if (domainMany2Many && !isLoadedData) {
|
|
6593
6510
|
setIsLoadedData(true);
|
|
6594
6511
|
}
|
|
@@ -6604,8 +6521,8 @@ var many2manyFieldController = (props) => {
|
|
|
6604
6521
|
};
|
|
6605
6522
|
|
|
6606
6523
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
6607
|
-
var
|
|
6608
|
-
var
|
|
6524
|
+
var import_react19 = require("react");
|
|
6525
|
+
var import_interface_logic19 = require("@fctc/interface-logic");
|
|
6609
6526
|
var many2manyTagsController = (props) => {
|
|
6610
6527
|
const {
|
|
6611
6528
|
relation,
|
|
@@ -6616,10 +6533,10 @@ var many2manyTagsController = (props) => {
|
|
|
6616
6533
|
placeholderNoOption
|
|
6617
6534
|
} = props;
|
|
6618
6535
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
6619
|
-
const env = (0,
|
|
6620
|
-
const addtionalFields = optionsFields ? (0,
|
|
6621
|
-
const domainObject = (0,
|
|
6622
|
-
() => (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 || {}))),
|
|
6623
6540
|
[domain, formValues]
|
|
6624
6541
|
);
|
|
6625
6542
|
const data = {
|
|
@@ -6629,13 +6546,13 @@ var many2manyTagsController = (props) => {
|
|
|
6629
6546
|
id: {},
|
|
6630
6547
|
name: {},
|
|
6631
6548
|
display_name: {},
|
|
6632
|
-
...widget &&
|
|
6633
|
-
...widget &&
|
|
6549
|
+
...widget && import_interface_logic19.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
6550
|
+
...widget && import_interface_logic19.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
6634
6551
|
},
|
|
6635
6552
|
enabled: true,
|
|
6636
6553
|
context: env.context
|
|
6637
6554
|
};
|
|
6638
|
-
const { data: dataOfSelection } = (0,
|
|
6555
|
+
const { data: dataOfSelection } = (0, import_interface_logic19.useGetSelection)({
|
|
6639
6556
|
data,
|
|
6640
6557
|
queryKey: [`data_${relation}`, domainObject]
|
|
6641
6558
|
});
|
|
@@ -6661,8 +6578,8 @@ var many2manyTagsController = (props) => {
|
|
|
6661
6578
|
};
|
|
6662
6579
|
|
|
6663
6580
|
// src/widget/basic/status-bar-field/controller.ts
|
|
6664
|
-
var
|
|
6665
|
-
var
|
|
6581
|
+
var import_react20 = require("react");
|
|
6582
|
+
var import_interface_logic20 = require("@fctc/interface-logic");
|
|
6666
6583
|
var durationController = (props) => {
|
|
6667
6584
|
const {
|
|
6668
6585
|
relation,
|
|
@@ -6679,14 +6596,14 @@ var durationController = (props) => {
|
|
|
6679
6596
|
name: "",
|
|
6680
6597
|
fold: ""
|
|
6681
6598
|
};
|
|
6682
|
-
const [disabled, setDisabled] = (0,
|
|
6683
|
-
const [modelStatus, setModalStatus] = (0,
|
|
6684
|
-
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);
|
|
6685
6602
|
const queryKey = [`data-status-duration`, specification];
|
|
6686
6603
|
const listDataProps = {
|
|
6687
6604
|
model: relation,
|
|
6688
6605
|
specification,
|
|
6689
|
-
domain: (0,
|
|
6606
|
+
domain: (0, import_interface_logic20.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
6690
6607
|
limit: 10,
|
|
6691
6608
|
offset: 0,
|
|
6692
6609
|
fields: "",
|
|
@@ -6696,8 +6613,8 @@ var durationController = (props) => {
|
|
|
6696
6613
|
},
|
|
6697
6614
|
sort: ""
|
|
6698
6615
|
};
|
|
6699
|
-
const { data: dataResponse } = (0,
|
|
6700
|
-
const { mutate: fetchChangeStatus } = (0,
|
|
6616
|
+
const { data: dataResponse } = (0, import_interface_logic20.useGetListData)(listDataProps, queryKey);
|
|
6617
|
+
const { mutate: fetchChangeStatus } = (0, import_interface_logic20.useChangeStatus)();
|
|
6701
6618
|
const handleClick = async (stage_id) => {
|
|
6702
6619
|
setDisabled(true);
|
|
6703
6620
|
if (stage_id) {
|
|
@@ -6733,7 +6650,7 @@ var durationController = (props) => {
|
|
|
6733
6650
|
};
|
|
6734
6651
|
|
|
6735
6652
|
// src/widget/basic/priority-field/controller.ts
|
|
6736
|
-
var
|
|
6653
|
+
var import_interface_logic21 = require("@fctc/interface-logic");
|
|
6737
6654
|
var priorityFieldController = (props) => {
|
|
6738
6655
|
const {
|
|
6739
6656
|
value,
|
|
@@ -6748,11 +6665,11 @@ var priorityFieldController = (props) => {
|
|
|
6748
6665
|
viewData,
|
|
6749
6666
|
context
|
|
6750
6667
|
} = props;
|
|
6751
|
-
const _context = { ...(0,
|
|
6668
|
+
const _context = { ...(0, import_interface_logic21.evalJSONContext)(actionData?.context) };
|
|
6752
6669
|
const contextObject = { ...context, ..._context };
|
|
6753
6670
|
const defaultPriority = parseInt(value) + 1;
|
|
6754
6671
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
6755
|
-
const { mutateAsync: fetchSave } = (0,
|
|
6672
|
+
const { mutateAsync: fetchSave } = (0, import_interface_logic21.useSave)();
|
|
6756
6673
|
const savePriorities = async ({
|
|
6757
6674
|
value: value2,
|
|
6758
6675
|
resetPriority
|
|
@@ -6787,8 +6704,8 @@ var priorityFieldController = (props) => {
|
|
|
6787
6704
|
};
|
|
6788
6705
|
|
|
6789
6706
|
// src/widget/basic/float-time-field/controller.ts
|
|
6790
|
-
var
|
|
6791
|
-
var
|
|
6707
|
+
var import_react21 = require("react");
|
|
6708
|
+
var import_interface_logic22 = require("@fctc/interface-logic");
|
|
6792
6709
|
var floatTimeFiledController = ({
|
|
6793
6710
|
onChange: fieldOnChange,
|
|
6794
6711
|
onBlur,
|
|
@@ -6797,11 +6714,11 @@ var floatTimeFiledController = ({
|
|
|
6797
6714
|
props
|
|
6798
6715
|
}) => {
|
|
6799
6716
|
const { name, defaultValue = 0, onChange } = props;
|
|
6800
|
-
const [input, setInput] = (0,
|
|
6801
|
-
(0,
|
|
6717
|
+
const [input, setInput] = (0, import_react21.useState)(
|
|
6718
|
+
(0, import_interface_logic22.convertFloatToTime)(value ?? defaultValue)
|
|
6802
6719
|
);
|
|
6803
|
-
const [formattedTime, setFormattedTime] = (0,
|
|
6804
|
-
const [errors, setErrors] = (0,
|
|
6720
|
+
const [formattedTime, setFormattedTime] = (0, import_react21.useState)("");
|
|
6721
|
+
const [errors, setErrors] = (0, import_react21.useState)("");
|
|
6805
6722
|
const handleInputChange = (e) => {
|
|
6806
6723
|
const raw = e.target.value.replace(/[^\d:]/g, "");
|
|
6807
6724
|
setInput(raw);
|
|
@@ -6831,7 +6748,7 @@ var floatTimeFiledController = ({
|
|
|
6831
6748
|
if (!isDirty) return;
|
|
6832
6749
|
if (formattedTime) {
|
|
6833
6750
|
setInput(formattedTime);
|
|
6834
|
-
const floatVal = (0,
|
|
6751
|
+
const floatVal = (0, import_interface_logic22.convertTimeToFloat)(formattedTime);
|
|
6835
6752
|
fieldOnChange(floatVal);
|
|
6836
6753
|
if (onChange) {
|
|
6837
6754
|
onChange(name ?? "", floatVal);
|
|
@@ -6874,7 +6791,7 @@ var floatTimeFiledController = ({
|
|
|
6874
6791
|
};
|
|
6875
6792
|
|
|
6876
6793
|
// src/widget/basic/float-field/controller.ts
|
|
6877
|
-
var
|
|
6794
|
+
var import_react22 = require("react");
|
|
6878
6795
|
var floatController = ({
|
|
6879
6796
|
onChange,
|
|
6880
6797
|
value,
|
|
@@ -6882,10 +6799,10 @@ var floatController = ({
|
|
|
6882
6799
|
}) => {
|
|
6883
6800
|
const { name, required, methods, onChange: handleOnchange, string } = props;
|
|
6884
6801
|
const { setError, clearErrors } = methods;
|
|
6885
|
-
const [inputValue, setInputValue] = (0,
|
|
6802
|
+
const [inputValue, setInputValue] = (0, import_react22.useState)(
|
|
6886
6803
|
value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
|
|
6887
6804
|
);
|
|
6888
|
-
(0,
|
|
6805
|
+
(0, import_react22.useEffect)(() => {
|
|
6889
6806
|
if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
|
|
6890
6807
|
setInputValue(useFormatFloatNumber(value));
|
|
6891
6808
|
clearErrors(name);
|
|
@@ -6893,9 +6810,9 @@ var floatController = ({
|
|
|
6893
6810
|
setInputValue("");
|
|
6894
6811
|
}
|
|
6895
6812
|
}, [value, name, clearErrors]);
|
|
6896
|
-
const isDirtyRef = (0,
|
|
6897
|
-
const inputRef = (0,
|
|
6898
|
-
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);
|
|
6899
6816
|
const handleInputChange = (e) => {
|
|
6900
6817
|
const newValue = e.target.value;
|
|
6901
6818
|
const valueWithoutCommas = newValue.replace(/,/g, "");
|
|
@@ -6996,10 +6913,10 @@ var useFormatFloatNumber = (value) => {
|
|
|
6996
6913
|
};
|
|
6997
6914
|
|
|
6998
6915
|
// src/widget/basic/download-file-field/controller.ts
|
|
6999
|
-
var
|
|
6916
|
+
var import_react23 = require("react");
|
|
7000
6917
|
var downloadFileController = () => {
|
|
7001
|
-
const inputId = (0,
|
|
7002
|
-
const [file, setFile] = (0,
|
|
6918
|
+
const inputId = (0, import_react23.useId)();
|
|
6919
|
+
const [file, setFile] = (0, import_react23.useState)(null);
|
|
7003
6920
|
const handleFileChange = (e) => {
|
|
7004
6921
|
setFile(e.target.files[0]);
|
|
7005
6922
|
};
|
|
@@ -7163,13 +7080,13 @@ var dateFieldController = (props) => {
|
|
|
7163
7080
|
};
|
|
7164
7081
|
|
|
7165
7082
|
// src/widget/basic/copy-link-button/controller.ts
|
|
7166
|
-
var
|
|
7167
|
-
var
|
|
7083
|
+
var import_react24 = require("react");
|
|
7084
|
+
var import_interface_logic23 = require("@fctc/interface-logic");
|
|
7168
7085
|
var copyLinkButtonController = (props) => {
|
|
7169
7086
|
const { value, defaultValue } = props;
|
|
7170
|
-
const [isCopied, setIsCopied] = (0,
|
|
7087
|
+
const [isCopied, setIsCopied] = (0, import_react24.useState)(false);
|
|
7171
7088
|
const handleCopyToClipboard = async (value2) => {
|
|
7172
|
-
await (0,
|
|
7089
|
+
await (0, import_interface_logic23.copyTextToClipboard)(value2);
|
|
7173
7090
|
setIsCopied(true);
|
|
7174
7091
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
7175
7092
|
};
|
|
@@ -7182,14 +7099,14 @@ var copyLinkButtonController = (props) => {
|
|
|
7182
7099
|
};
|
|
7183
7100
|
|
|
7184
7101
|
// src/widget/basic/color-field/color-controller.ts
|
|
7185
|
-
var
|
|
7102
|
+
var import_interface_logic24 = require("@fctc/interface-logic");
|
|
7186
7103
|
var colorFieldController = (props) => {
|
|
7187
7104
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
7188
|
-
const env = (0,
|
|
7189
|
-
const _context = { ...(0,
|
|
7105
|
+
const env = (0, import_interface_logic24.getEnv)();
|
|
7106
|
+
const _context = { ...(0, import_interface_logic24.evalJSONContext)(actionData?.context) || {} };
|
|
7190
7107
|
const contextObject = { ...env.context, ..._context };
|
|
7191
7108
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
7192
|
-
const { mutate: onSave } = (0,
|
|
7109
|
+
const { mutate: onSave } = (0, import_interface_logic24.useSave)();
|
|
7193
7110
|
const savePickColor = async (colorObject) => {
|
|
7194
7111
|
const { id } = colorObject;
|
|
7195
7112
|
if (value === id) return;
|
|
@@ -7214,16 +7131,16 @@ var colorFieldController = (props) => {
|
|
|
7214
7131
|
};
|
|
7215
7132
|
|
|
7216
7133
|
// src/widget/basic/binary-field/controller.ts
|
|
7217
|
-
var
|
|
7218
|
-
var
|
|
7134
|
+
var import_react25 = require("react");
|
|
7135
|
+
var import_interface_logic25 = require("@fctc/interface-logic");
|
|
7219
7136
|
var binaryFieldController = (props) => {
|
|
7220
7137
|
const { name, methods, readonly = false, value } = props;
|
|
7221
|
-
const inputId = (0,
|
|
7222
|
-
const [selectedImage, setSelectedImage] = (0,
|
|
7223
|
-
const [initialImage, setInitialImage] = (0,
|
|
7224
|
-
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);
|
|
7225
7142
|
const { setValue } = methods;
|
|
7226
|
-
const binaryRef = (0,
|
|
7143
|
+
const binaryRef = (0, import_react25.useRef)(null);
|
|
7227
7144
|
const convertUrlToBase64 = async (url) => {
|
|
7228
7145
|
try {
|
|
7229
7146
|
const response = await fetch(url);
|
|
@@ -7272,11 +7189,11 @@ var binaryFieldController = (props) => {
|
|
|
7272
7189
|
};
|
|
7273
7190
|
const checkIsImageLink = (url) => {
|
|
7274
7191
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
7275
|
-
return imageExtensions.test(url) || (0,
|
|
7192
|
+
return imageExtensions.test(url) || (0, import_interface_logic25.isBase64Image)(url) || isBlobUrl(url);
|
|
7276
7193
|
};
|
|
7277
7194
|
const getImageBase64WithMimeType = (base64) => {
|
|
7278
7195
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
7279
|
-
if ((0,
|
|
7196
|
+
if ((0, import_interface_logic25.isBase64Image)(base64)) return base64;
|
|
7280
7197
|
let mimeType = null;
|
|
7281
7198
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
7282
7199
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -7285,14 +7202,14 @@ var binaryFieldController = (props) => {
|
|
|
7285
7202
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
7286
7203
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
7287
7204
|
};
|
|
7288
|
-
(0,
|
|
7205
|
+
(0, import_react25.useEffect)(() => {
|
|
7289
7206
|
return () => {
|
|
7290
7207
|
if (selectedImage) {
|
|
7291
7208
|
URL.revokeObjectURL(selectedImage);
|
|
7292
7209
|
}
|
|
7293
7210
|
};
|
|
7294
7211
|
}, [selectedImage]);
|
|
7295
|
-
(0,
|
|
7212
|
+
(0, import_react25.useEffect)(() => {
|
|
7296
7213
|
if (binaryRef.current) {
|
|
7297
7214
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
7298
7215
|
setIsInsideTable(isInsideTable2);
|