@fctc/widget-logic 1.3.3 → 1.3.5
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/config.d.mts +1 -2
- package/dist/config.d.ts +1 -2
- package/dist/config.js +2 -2
- package/dist/config.mjs +1 -1
- package/dist/hooks.d.mts +7 -8
- package/dist/hooks.d.ts +7 -8
- package/dist/hooks.js +50 -41
- package/dist/hooks.mjs +30 -33
- package/dist/index.d.mts +31 -7
- package/dist/index.d.ts +31 -7
- package/dist/index.js +154 -141
- package/dist/index.mjs +101 -125
- package/package.json +2 -12
- package/dist/model.d.mts +0 -1
- package/dist/model.d.ts +0 -1
- package/dist/model.js +0 -24
- package/dist/model.mjs +0 -2
- package/dist/types.d.mts +0 -31
- package/dist/types.d.ts +0 -31
- package/dist/types.js +0 -24
- package/dist/types.mjs +0 -2
package/dist/index.js
CHANGED
|
@@ -4104,17 +4104,18 @@ __export(hooks_exports, {
|
|
|
4104
4104
|
});
|
|
4105
4105
|
|
|
4106
4106
|
// src/hooks/core/use-call-action.ts
|
|
4107
|
-
var import_interface_logic = require("@fctc/interface-logic");
|
|
4108
4107
|
var import_react = require("react");
|
|
4108
|
+
var import_environment = require("@fctc/interface-logic/environment");
|
|
4109
|
+
var import_hooks = require("@fctc/interface-logic/hooks");
|
|
4109
4110
|
var useCallAction = () => {
|
|
4110
|
-
const queryLoadAction = (0,
|
|
4111
|
-
const queryRunAction = (0,
|
|
4111
|
+
const queryLoadAction = (0, import_hooks.useLoadAction)();
|
|
4112
|
+
const queryRunAction = (0, import_hooks.useRunAction)();
|
|
4112
4113
|
const [data, setData] = (0, import_react.useState)(void 0);
|
|
4113
4114
|
const callAction = async ({
|
|
4114
4115
|
aid,
|
|
4115
4116
|
actionType = "ir.actions.act_window"
|
|
4116
4117
|
}) => {
|
|
4117
|
-
const context = (0,
|
|
4118
|
+
const context = (0, import_environment.getEnv)().context;
|
|
4118
4119
|
let res = void 0;
|
|
4119
4120
|
if (actionType === "ir.actions.act_window") {
|
|
4120
4121
|
res = await queryLoadAction.mutateAsync({
|
|
@@ -4134,10 +4135,11 @@ var useCallAction = () => {
|
|
|
4134
4135
|
};
|
|
4135
4136
|
|
|
4136
4137
|
// src/hooks/core/use-config.ts
|
|
4137
|
-
var import_interface_logic2 = require("@fctc/interface-logic");
|
|
4138
4138
|
var import_react2 = require("react");
|
|
4139
|
+
var import_environment2 = require("@fctc/interface-logic/environment");
|
|
4140
|
+
var import_store = require("@fctc/interface-logic/store");
|
|
4139
4141
|
var useConfig = ({ localStorageUtils, sessionStorageUtils }) => {
|
|
4140
|
-
const dispatch = (0,
|
|
4142
|
+
const dispatch = (0, import_store.useAppDispatch)();
|
|
4141
4143
|
const envConfig = (0, import_react2.useMemo)(() => {
|
|
4142
4144
|
return {
|
|
4143
4145
|
mode: "development",
|
|
@@ -4164,7 +4166,7 @@ var useConfig = ({ localStorageUtils, sessionStorageUtils }) => {
|
|
|
4164
4166
|
}, []);
|
|
4165
4167
|
(0, import_react2.useEffect)(() => {
|
|
4166
4168
|
try {
|
|
4167
|
-
const env = (0,
|
|
4169
|
+
const env = (0, import_environment2.getEnv)();
|
|
4168
4170
|
env.setupEnv({
|
|
4169
4171
|
baseUrl: envConfig.baseUrl,
|
|
4170
4172
|
port: 3e3,
|
|
@@ -4177,7 +4179,7 @@ var useConfig = ({ localStorageUtils, sessionStorageUtils }) => {
|
|
|
4177
4179
|
localStorageUtils: localStorageUtils(),
|
|
4178
4180
|
sessionStorageUtils: sessionStorageUtils()
|
|
4179
4181
|
});
|
|
4180
|
-
dispatch((0,
|
|
4182
|
+
dispatch((0, import_store.setEnvFile)(config));
|
|
4181
4183
|
} catch (error) {
|
|
4182
4184
|
console.error("Error loading env or config:", error);
|
|
4183
4185
|
}
|
|
@@ -4186,12 +4188,13 @@ var useConfig = ({ localStorageUtils, sessionStorageUtils }) => {
|
|
|
4186
4188
|
};
|
|
4187
4189
|
|
|
4188
4190
|
// src/hooks/core/use-detail.ts
|
|
4189
|
-
var
|
|
4191
|
+
var import_store2 = require("@fctc/interface-logic/store");
|
|
4190
4192
|
var import_react_query = require("@tanstack/react-query");
|
|
4191
4193
|
var import_react3 = require("react");
|
|
4194
|
+
var import_hooks2 = require("@fctc/interface-logic/hooks");
|
|
4192
4195
|
var useDetail = (accessToken, sub) => {
|
|
4193
|
-
const dispatch = (0,
|
|
4194
|
-
const fetchGetDetail = (0,
|
|
4196
|
+
const dispatch = (0, import_store2.useAppDispatch)();
|
|
4197
|
+
const fetchGetDetail = (0, import_hooks2.useGetDetail)();
|
|
4195
4198
|
const userDetailQuery = (0, import_react_query.useQuery)({
|
|
4196
4199
|
queryKey: ["userDetailQuery", sub && accessToken],
|
|
4197
4200
|
queryFn: () => {
|
|
@@ -4207,7 +4210,7 @@ var useDetail = (accessToken, sub) => {
|
|
|
4207
4210
|
if (userDetailQuery.data) {
|
|
4208
4211
|
const userPicture = userDetailQuery.data;
|
|
4209
4212
|
dispatch(
|
|
4210
|
-
(0,
|
|
4213
|
+
(0, import_store2.setProfile)({ ...userPicture, image: userPicture?.[0]?.image_256 })
|
|
4211
4214
|
);
|
|
4212
4215
|
}
|
|
4213
4216
|
}, [userDetailQuery.data, dispatch]);
|
|
@@ -4216,7 +4219,6 @@ var useDetail = (accessToken, sub) => {
|
|
|
4216
4219
|
|
|
4217
4220
|
// src/hooks/core/use-list-data.ts
|
|
4218
4221
|
var import_react5 = require("react");
|
|
4219
|
-
var import_interface_logic4 = require("@fctc/interface-logic");
|
|
4220
4222
|
|
|
4221
4223
|
// src/utils/function.ts
|
|
4222
4224
|
var import_react4 = require("react");
|
|
@@ -4431,17 +4433,20 @@ function useStorageState(key) {
|
|
|
4431
4433
|
}
|
|
4432
4434
|
|
|
4433
4435
|
// src/hooks/core/use-list-data.ts
|
|
4436
|
+
var import_hooks3 = require("@fctc/interface-logic/hooks");
|
|
4437
|
+
var import_store3 = require("@fctc/interface-logic/store");
|
|
4438
|
+
var import_utils = require("@fctc/interface-logic/utils");
|
|
4434
4439
|
var useListData = ({
|
|
4435
4440
|
action,
|
|
4436
4441
|
context,
|
|
4437
4442
|
viewResponse
|
|
4438
4443
|
}) => {
|
|
4439
|
-
const { groupByDomain } = (0,
|
|
4440
|
-
const initModel = (0,
|
|
4444
|
+
const { groupByDomain } = (0, import_store3.useAppSelector)(import_store3.selectSearch);
|
|
4445
|
+
const initModel = (0, import_hooks3.useModel)();
|
|
4441
4446
|
const [type, setType] = (0, import_react5.useState)("list");
|
|
4442
4447
|
const [mode, setMode] = (0, import_react5.useState)("month");
|
|
4443
4448
|
const [currentDate, setCurrentDate] = (0, import_react5.useState)(/* @__PURE__ */ new Date());
|
|
4444
|
-
const { pageLimit, page, order } = (0,
|
|
4449
|
+
const { pageLimit, page, order } = (0, import_store3.useAppSelector)(import_store3.selectList);
|
|
4445
4450
|
const listDataProps = (0, import_react5.useMemo)(() => {
|
|
4446
4451
|
const actData = action?.result;
|
|
4447
4452
|
if (!viewResponse || !actData || !context) {
|
|
@@ -4453,12 +4458,12 @@ var useListData = ({
|
|
|
4453
4458
|
actContext: context,
|
|
4454
4459
|
fields: type === "kanban" ? viewResponse?.views?.kanban?.fields : type === "calendar" ? viewResponse?.views?.calendar?.fields : viewResponse?.views?.list?.fields
|
|
4455
4460
|
}).getSpecification();
|
|
4456
|
-
const domain = type === "calendar" ? getDateRange(currentDate, mode) : actData?.domain ? Array.isArray(actData?.domain) ? [...actData?.domain] : (0,
|
|
4461
|
+
const domain = type === "calendar" ? getDateRange(currentDate, mode) : actData?.domain ? Array.isArray(actData?.domain) ? [...actData?.domain] : (0, import_utils.evalJSONDomain)(actData?.domain, context) : [];
|
|
4457
4462
|
const limit = type === "calendar" ? 2500 : pageLimit;
|
|
4458
4463
|
const offset = page * pageLimit;
|
|
4459
4464
|
const fields = type === "calendar" ? convertFieldsToArray(viewResponse?.views?.calendar?.fields) || [] : typeof groupByDomain === "object" ? groupByDomain?.fields : void 0;
|
|
4460
4465
|
const groupby = typeof groupByDomain === "object" ? [groupByDomain?.contexts?.[0]?.group_by] : [];
|
|
4461
|
-
const sort = order ? order : viewResponse?.views?.list?.default_order ? (0,
|
|
4466
|
+
const sort = order ? order : viewResponse?.views?.list?.default_order ? (0, import_utils.formatSortingString)(viewResponse?.views?.list?.default_order) : "";
|
|
4462
4467
|
return {
|
|
4463
4468
|
model: actData.res_model,
|
|
4464
4469
|
specification,
|
|
@@ -4484,7 +4489,7 @@ var useListData = ({
|
|
|
4484
4489
|
type,
|
|
4485
4490
|
viewResponse
|
|
4486
4491
|
]);
|
|
4487
|
-
const list = (0,
|
|
4492
|
+
const list = (0, import_hooks3.useGetListData)(
|
|
4488
4493
|
listDataProps,
|
|
4489
4494
|
[listDataProps],
|
|
4490
4495
|
!!listDataProps
|
|
@@ -4504,7 +4509,6 @@ var useListData = ({
|
|
|
4504
4509
|
|
|
4505
4510
|
// src/hooks/core/use-menu.ts
|
|
4506
4511
|
var import_react6 = require("react");
|
|
4507
|
-
var import_interface_logic5 = require("@fctc/interface-logic");
|
|
4508
4512
|
|
|
4509
4513
|
// src/utils/constants.ts
|
|
4510
4514
|
var languages = [
|
|
@@ -4521,8 +4525,9 @@ var API_APP_URL = {
|
|
|
4521
4525
|
};
|
|
4522
4526
|
|
|
4523
4527
|
// src/hooks/core/use-menu.ts
|
|
4528
|
+
var import_hooks4 = require("@fctc/interface-logic/hooks");
|
|
4524
4529
|
var useMenu = ({ context }) => {
|
|
4525
|
-
const menuData = (0,
|
|
4530
|
+
const menuData = (0, import_hooks4.useGetMenu)(context, !!context);
|
|
4526
4531
|
const [menuid, setMenuId] = (0, import_react6.useState)(void 0);
|
|
4527
4532
|
const [action, setAction] = useCallAction();
|
|
4528
4533
|
const configedIconData = (0, import_react6.useMemo)(() => {
|
|
@@ -4574,10 +4579,12 @@ var useMenu = ({ context }) => {
|
|
|
4574
4579
|
var import_react_query2 = require("@tanstack/react-query");
|
|
4575
4580
|
var import_react7 = require("react");
|
|
4576
4581
|
var import_react_i18next = require("react-i18next");
|
|
4577
|
-
var
|
|
4582
|
+
var import_environment3 = require("@fctc/interface-logic/environment");
|
|
4583
|
+
var import_hooks5 = require("@fctc/interface-logic/hooks");
|
|
4584
|
+
var import_store4 = require("@fctc/interface-logic/store");
|
|
4578
4585
|
var useProfile = (accessToken) => {
|
|
4579
|
-
const getProfile = (0,
|
|
4580
|
-
const dispatch = (0,
|
|
4586
|
+
const getProfile = (0, import_hooks5.useGetProfile)();
|
|
4587
|
+
const dispatch = (0, import_store4.useAppDispatch)();
|
|
4581
4588
|
const { i18n: i18n2 } = (0, import_react_i18next.useTranslation)();
|
|
4582
4589
|
const fetchUserProfile = async () => {
|
|
4583
4590
|
return await getProfile.mutateAsync();
|
|
@@ -4590,9 +4597,9 @@ var useProfile = (accessToken) => {
|
|
|
4590
4597
|
(0, import_react7.useEffect)(() => {
|
|
4591
4598
|
if (userInfoQuery.data) {
|
|
4592
4599
|
const userInfo = userInfoQuery.data;
|
|
4593
|
-
const env = (0,
|
|
4600
|
+
const env = (0, import_environment3.getEnv)();
|
|
4594
4601
|
env.setUid(userInfo?.sub);
|
|
4595
|
-
dispatch((0,
|
|
4602
|
+
dispatch((0, import_store4.setDataUser)(userInfo));
|
|
4596
4603
|
const userLocale = languages.find((lang) => lang?.id === userInfo?.locale);
|
|
4597
4604
|
env.setLang(userLocale?.id);
|
|
4598
4605
|
i18n2.changeLanguage(userLocale?.id.split("_")[0]);
|
|
@@ -4621,7 +4628,7 @@ var useUser = (accessToken) => {
|
|
|
4621
4628
|
|
|
4622
4629
|
// src/hooks/core/use-view-v2.ts
|
|
4623
4630
|
var import_react8 = require("react");
|
|
4624
|
-
var
|
|
4631
|
+
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
4625
4632
|
var useViewV2 = ({
|
|
4626
4633
|
action,
|
|
4627
4634
|
context
|
|
@@ -4645,7 +4652,7 @@ var useViewV2 = ({
|
|
|
4645
4652
|
context
|
|
4646
4653
|
};
|
|
4647
4654
|
}, [action, context]);
|
|
4648
|
-
const view = (0,
|
|
4655
|
+
const view = (0, import_hooks6.useGetView)(
|
|
4649
4656
|
viewParams || {},
|
|
4650
4657
|
!!viewParams
|
|
4651
4658
|
);
|
|
@@ -4656,11 +4663,12 @@ var useViewV2 = ({
|
|
|
4656
4663
|
};
|
|
4657
4664
|
|
|
4658
4665
|
// src/hooks/core/use-auth.ts
|
|
4659
|
-
var
|
|
4666
|
+
var import_hooks7 = require("@fctc/interface-logic/hooks");
|
|
4667
|
+
var import_store5 = require("@fctc/interface-logic/store");
|
|
4660
4668
|
var useAuth = () => {
|
|
4661
4669
|
const [[isLoading, accessToken], setAccessToken] = useStorageState("TOKEN");
|
|
4662
|
-
const loginMutate = (0,
|
|
4663
|
-
const dispatch = (0,
|
|
4670
|
+
const loginMutate = (0, import_hooks7.useLoginCredential)();
|
|
4671
|
+
const dispatch = (0, import_store5.useAppDispatch)();
|
|
4664
4672
|
const signIn = async (email, password) => {
|
|
4665
4673
|
try {
|
|
4666
4674
|
loginMutate.mutate(
|
|
@@ -4682,9 +4690,9 @@ var useAuth = () => {
|
|
|
4682
4690
|
}
|
|
4683
4691
|
};
|
|
4684
4692
|
const signOut = async () => {
|
|
4685
|
-
dispatch((0,
|
|
4686
|
-
dispatch((0,
|
|
4687
|
-
dispatch((0,
|
|
4693
|
+
dispatch((0, import_store5.setMenuList)([]));
|
|
4694
|
+
dispatch((0, import_store5.setDataUser)({}));
|
|
4695
|
+
dispatch((0, import_store5.setProfile)({}));
|
|
4688
4696
|
setAccessToken(null);
|
|
4689
4697
|
};
|
|
4690
4698
|
return {
|
|
@@ -4699,11 +4707,12 @@ var useAuth = () => {
|
|
|
4699
4707
|
var import_react10 = require("react");
|
|
4700
4708
|
|
|
4701
4709
|
// src/hooks/core/use-company.ts
|
|
4702
|
-
var import_interface_logic9 = require("@fctc/interface-logic");
|
|
4703
4710
|
var import_react_query3 = require("@tanstack/react-query");
|
|
4704
4711
|
var import_react9 = require("react");
|
|
4712
|
+
var import_environment4 = require("@fctc/interface-logic/environment");
|
|
4713
|
+
var import_hooks8 = require("@fctc/interface-logic/hooks");
|
|
4705
4714
|
var useCompany = (accessToken) => {
|
|
4706
|
-
const getCurrentCompany = (0,
|
|
4715
|
+
const getCurrentCompany = (0, import_hooks8.useGetCurrentCompany)();
|
|
4707
4716
|
const fetchCurrentCompany = async () => {
|
|
4708
4717
|
return await getCurrentCompany.mutateAsync();
|
|
4709
4718
|
};
|
|
@@ -4718,12 +4727,12 @@ var useCompany = (accessToken) => {
|
|
|
4718
4727
|
(0, import_react9.useEffect)(() => {
|
|
4719
4728
|
if (current_company_id) {
|
|
4720
4729
|
const companyIDs = [current_company_id];
|
|
4721
|
-
const env = (0,
|
|
4730
|
+
const env = (0, import_environment4.getEnv)();
|
|
4722
4731
|
env.setAllowCompanies([...companyIDs]);
|
|
4723
4732
|
env.setCompanies(companyIDs);
|
|
4724
4733
|
}
|
|
4725
4734
|
}, [current_company_id]);
|
|
4726
|
-
const getCompanyInfo = (0,
|
|
4735
|
+
const getCompanyInfo = (0, import_hooks8.useGetCompanyInfo)();
|
|
4727
4736
|
const companyInfo = (0, import_react_query3.useQuery)({
|
|
4728
4737
|
queryKey: ["companyInfoQuery", current_company_id, accessToken],
|
|
4729
4738
|
queryFn: () => getCompanyInfo.mutateAsync(Number(current_company_id)),
|
|
@@ -4733,7 +4742,7 @@ var useCompany = (accessToken) => {
|
|
|
4733
4742
|
if (companyInfo.data) {
|
|
4734
4743
|
const companyInfoData = companyInfo.data;
|
|
4735
4744
|
if (companyInfoData?.length) {
|
|
4736
|
-
const env = (0,
|
|
4745
|
+
const env = (0, import_environment4.getEnv)();
|
|
4737
4746
|
env.setDefaultCompany(companyInfoData[0]);
|
|
4738
4747
|
}
|
|
4739
4748
|
}
|
|
@@ -4747,7 +4756,7 @@ var useCompany = (accessToken) => {
|
|
|
4747
4756
|
var use_company_default = useCompany;
|
|
4748
4757
|
|
|
4749
4758
|
// src/hooks/core/use-app-provider.tsx
|
|
4750
|
-
var
|
|
4759
|
+
var import_utils2 = require("@fctc/interface-logic/utils");
|
|
4751
4760
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
4752
4761
|
var AppProviderInitialValue = {
|
|
4753
4762
|
config: {},
|
|
@@ -4775,7 +4784,7 @@ var AppProvider = ({ children }) => {
|
|
|
4775
4784
|
const viewContext = (0, import_react10.useMemo)(() => {
|
|
4776
4785
|
return combineContexts([
|
|
4777
4786
|
menuContext,
|
|
4778
|
-
{ ...(0,
|
|
4787
|
+
{ ...(0, import_utils2.evalJSONContext)(action?.result?.context) }
|
|
4779
4788
|
]);
|
|
4780
4789
|
}, [menuContext, action?.result?.context]);
|
|
4781
4790
|
const view = useViewV2({
|
|
@@ -4866,7 +4875,7 @@ __reExport(index_exports, hooks_exports, module.exports);
|
|
|
4866
4875
|
|
|
4867
4876
|
// src/config.ts
|
|
4868
4877
|
var config_exports = {};
|
|
4869
|
-
__reExport(config_exports, require("@fctc/interface-logic/
|
|
4878
|
+
__reExport(config_exports, require("@fctc/interface-logic/configs"));
|
|
4870
4879
|
|
|
4871
4880
|
// src/index.ts
|
|
4872
4881
|
__reExport(index_exports, config_exports, module.exports);
|
|
@@ -4979,10 +4988,11 @@ var CloseIcon = ({ className = "" }) => {
|
|
|
4979
4988
|
|
|
4980
4989
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
4981
4990
|
var import_react13 = require("react");
|
|
4982
|
-
var
|
|
4991
|
+
var import_environment5 = require("@fctc/interface-logic/environment");
|
|
4992
|
+
var import_hooks10 = require("@fctc/interface-logic/hooks");
|
|
4983
4993
|
var statusDropdownController = (props) => {
|
|
4984
4994
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
4985
|
-
const env = (0,
|
|
4995
|
+
const env = (0, import_environment5.getEnv)();
|
|
4986
4996
|
const colors = {
|
|
4987
4997
|
normal: "bg-[#e9ecef]",
|
|
4988
4998
|
done: "bg-primary",
|
|
@@ -5001,7 +5011,7 @@ var statusDropdownController = (props) => {
|
|
|
5001
5011
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
5002
5012
|
};
|
|
5003
5013
|
}, []);
|
|
5004
|
-
const { mutate: onSave } = (0,
|
|
5014
|
+
const { mutate: onSave } = (0, import_hooks10.useSave)();
|
|
5005
5015
|
const handleClick = async (status) => {
|
|
5006
5016
|
setIsOpen(!isOpen);
|
|
5007
5017
|
onSave(
|
|
@@ -5032,7 +5042,9 @@ var statusDropdownController = (props) => {
|
|
|
5032
5042
|
|
|
5033
5043
|
// src/widget/basic/many2one-field/controller.ts
|
|
5034
5044
|
var import_react14 = require("react");
|
|
5035
|
-
var
|
|
5045
|
+
var import_hooks11 = require("@fctc/interface-logic/hooks");
|
|
5046
|
+
var import_store6 = require("@fctc/interface-logic/store");
|
|
5047
|
+
var import_utils3 = require("@fctc/interface-logic/utils");
|
|
5036
5048
|
var many2oneFieldController = (props) => {
|
|
5037
5049
|
const {
|
|
5038
5050
|
name,
|
|
@@ -5050,17 +5062,17 @@ var many2oneFieldController = (props) => {
|
|
|
5050
5062
|
const [options, setOptions] = (0, import_react14.useState)([]);
|
|
5051
5063
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react14.useState)(false);
|
|
5052
5064
|
const [tempSelectedOption, setTempSelectedOption] = (0, import_react14.useState)(null);
|
|
5053
|
-
const { menuList } = (0,
|
|
5054
|
-
const { context } = (0,
|
|
5065
|
+
const { menuList } = (0, import_store6.useAppSelector)(import_store6.selectNavbar);
|
|
5066
|
+
const { context } = (0, import_store6.useAppSelector)(import_store6.selectEnv);
|
|
5055
5067
|
const [domainModal, setDomainModal] = (0, import_react14.useState)(null);
|
|
5056
5068
|
const initValue = methods?.getValues(name);
|
|
5057
5069
|
const domainObject = (0, import_react14.useMemo)(
|
|
5058
|
-
() => (0,
|
|
5070
|
+
() => (0, import_utils3.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
|
|
5059
5071
|
[domain, formValues]
|
|
5060
5072
|
);
|
|
5061
|
-
const optionsObject = (0,
|
|
5073
|
+
const optionsObject = (0, import_utils3.evalJSONContext)(fieldOptions) || {};
|
|
5062
5074
|
const contextObject = {
|
|
5063
|
-
...(0,
|
|
5075
|
+
...(0, import_utils3.evalJSONContext)(actionData?.context) || {},
|
|
5064
5076
|
...fieldContext,
|
|
5065
5077
|
...context
|
|
5066
5078
|
};
|
|
@@ -5087,7 +5099,7 @@ var many2oneFieldController = (props) => {
|
|
|
5087
5099
|
data: dataOfSelection,
|
|
5088
5100
|
// refetch,
|
|
5089
5101
|
isFetching
|
|
5090
|
-
} = (0,
|
|
5102
|
+
} = (0, import_hooks11.useGetSelection)({
|
|
5091
5103
|
data,
|
|
5092
5104
|
queryKey,
|
|
5093
5105
|
enabled: false
|
|
@@ -5101,7 +5113,7 @@ var many2oneFieldController = (props) => {
|
|
|
5101
5113
|
(0, import_react14.useEffect)(() => {
|
|
5102
5114
|
setOptions(selectOptions);
|
|
5103
5115
|
setDomainModal(domainObject);
|
|
5104
|
-
if (relation === "student.subject") (0,
|
|
5116
|
+
if (relation === "student.subject") (0, import_store6.setListSubject)(selectOptions);
|
|
5105
5117
|
}, [selectOptions]);
|
|
5106
5118
|
(0, import_react14.useEffect)(() => {
|
|
5107
5119
|
if (!propValue && tempSelectedOption) {
|
|
@@ -5202,18 +5214,20 @@ var many2oneFieldController = (props) => {
|
|
|
5202
5214
|
};
|
|
5203
5215
|
|
|
5204
5216
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5205
|
-
var
|
|
5217
|
+
var import_environment6 = require("@fctc/interface-logic/environment");
|
|
5218
|
+
var import_hooks12 = require("@fctc/interface-logic/hooks");
|
|
5219
|
+
var import_utils4 = require("@fctc/interface-logic/utils");
|
|
5206
5220
|
var many2oneButtonController = (props) => {
|
|
5207
5221
|
const { domain, methods, relation } = props;
|
|
5208
5222
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5209
|
-
const env = (0,
|
|
5210
|
-
const domainObject = (0,
|
|
5223
|
+
const env = (0, import_environment6.getEnv)();
|
|
5224
|
+
const domainObject = (0, import_utils4.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5211
5225
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5212
|
-
const { data: dataOfSelection } = (0,
|
|
5226
|
+
const { data: dataOfSelection } = (0, import_hooks12.useGetSelection)({
|
|
5213
5227
|
data: {
|
|
5214
5228
|
model: relation ?? "",
|
|
5215
5229
|
domain: domainObject,
|
|
5216
|
-
context: { ...env.context, ...(0,
|
|
5230
|
+
context: { ...env.context, ...(0, import_utils4.evalJSONContext)(actionData?.context) }
|
|
5217
5231
|
},
|
|
5218
5232
|
queryKey: [`data_${relation}`, domainObject]
|
|
5219
5233
|
});
|
|
@@ -5228,10 +5242,9 @@ var many2oneButtonController = (props) => {
|
|
|
5228
5242
|
|
|
5229
5243
|
// src/widget/basic/many2many-field/controller.ts
|
|
5230
5244
|
var import_react18 = require("react");
|
|
5231
|
-
var import_interface_logic18 = require("@fctc/interface-logic");
|
|
5232
5245
|
|
|
5233
5246
|
// src/widget/advance/table/table-body/controller.ts
|
|
5234
|
-
var
|
|
5247
|
+
var import_store7 = require("@fctc/interface-logic/store");
|
|
5235
5248
|
var import_react15 = require("react");
|
|
5236
5249
|
var tableBodyController = (props) => {
|
|
5237
5250
|
const {
|
|
@@ -5244,7 +5257,7 @@ var tableBodyController = (props) => {
|
|
|
5244
5257
|
selectedRowKeysRef,
|
|
5245
5258
|
onClickRow
|
|
5246
5259
|
} = props;
|
|
5247
|
-
const appDispatch = (0,
|
|
5260
|
+
const appDispatch = (0, import_store7.useAppDispatch)();
|
|
5248
5261
|
const checked = (0, import_react15.useMemo)(() => {
|
|
5249
5262
|
if (!row?.id) return false;
|
|
5250
5263
|
if (selectedRowKeys?.includes(row.id)) {
|
|
@@ -5261,7 +5274,7 @@ var tableBodyController = (props) => {
|
|
|
5261
5274
|
}
|
|
5262
5275
|
const newSelectedRowKeys = selectedRowKeys?.includes(row.id) ? selectedRowKeys?.filter((key) => key !== row.id) : [...selectedRowKeys, row.id];
|
|
5263
5276
|
console.log("newSelectedRowKeys", newSelectedRowKeys);
|
|
5264
|
-
appDispatch((0,
|
|
5277
|
+
appDispatch((0, import_store7.setSelectedRowKeys)(newSelectedRowKeys));
|
|
5265
5278
|
};
|
|
5266
5279
|
const handleClickRow = (col, row2) => {
|
|
5267
5280
|
onClickRow(col, row2);
|
|
@@ -5274,13 +5287,13 @@ var tableBodyController = (props) => {
|
|
|
5274
5287
|
(id) => id !== row.id
|
|
5275
5288
|
);
|
|
5276
5289
|
selectedRowKeysRef.current = filtered;
|
|
5277
|
-
appDispatch((0,
|
|
5290
|
+
appDispatch((0, import_store7.setSelectedRowKeys)(filtered));
|
|
5278
5291
|
} else {
|
|
5279
5292
|
const unique = Array.from(
|
|
5280
5293
|
/* @__PURE__ */ new Set([...selectedRowKeysRef?.current, row?.id])
|
|
5281
5294
|
);
|
|
5282
5295
|
selectedRowKeysRef.current = unique;
|
|
5283
|
-
appDispatch((0,
|
|
5296
|
+
appDispatch((0, import_store7.setSelectedRowKeys)(unique));
|
|
5284
5297
|
}
|
|
5285
5298
|
}
|
|
5286
5299
|
}, [isAutoSelect]);
|
|
@@ -5298,35 +5311,35 @@ var tableBodyController = (props) => {
|
|
|
5298
5311
|
};
|
|
5299
5312
|
|
|
5300
5313
|
// src/widget/advance/table/table-head/controller.ts
|
|
5301
|
-
var
|
|
5314
|
+
var import_store8 = require("@fctc/interface-logic/store");
|
|
5302
5315
|
var tableHeadController = (props) => {
|
|
5303
5316
|
const { typeTable, rows, selectedRowKeysRef } = props;
|
|
5304
|
-
const appDispatch = (0,
|
|
5305
|
-
const { groupByDomain } = (0,
|
|
5317
|
+
const appDispatch = (0, import_store8.useAppDispatch)();
|
|
5318
|
+
const { groupByDomain } = (0, import_store8.useAppSelector)(import_store8.selectSearch);
|
|
5306
5319
|
const handleCheckBoxAll = (event) => {
|
|
5307
5320
|
if (event?.target?.checked && typeTable === "list") {
|
|
5308
5321
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
5309
|
-
appDispatch((0,
|
|
5322
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(allRowKeys));
|
|
5310
5323
|
} else if (event?.target?.checked && typeTable === "group") {
|
|
5311
5324
|
const rowsIDs = document.querySelectorAll("tr[data-row-id]");
|
|
5312
5325
|
const ids = Array.from(rowsIDs)?.map(
|
|
5313
5326
|
(row) => Number(row?.getAttribute("data-row-id"))
|
|
5314
5327
|
);
|
|
5315
5328
|
if (ids?.length > 0) {
|
|
5316
|
-
appDispatch((0,
|
|
5329
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(ids));
|
|
5317
5330
|
} else {
|
|
5318
5331
|
const sum = countSum(
|
|
5319
5332
|
rows,
|
|
5320
5333
|
typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0
|
|
5321
5334
|
);
|
|
5322
5335
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
5323
|
-
appDispatch((0,
|
|
5336
|
+
appDispatch((0, import_store8.setSelectedRowKeys)(keys));
|
|
5324
5337
|
}
|
|
5325
5338
|
if (selectedRowKeysRef) {
|
|
5326
5339
|
selectedRowKeysRef.current = [];
|
|
5327
5340
|
}
|
|
5328
5341
|
} else {
|
|
5329
|
-
appDispatch((0,
|
|
5342
|
+
appDispatch((0, import_store8.setSelectedRowKeys)([]));
|
|
5330
5343
|
}
|
|
5331
5344
|
};
|
|
5332
5345
|
return {
|
|
@@ -5335,8 +5348,9 @@ var tableHeadController = (props) => {
|
|
|
5335
5348
|
};
|
|
5336
5349
|
|
|
5337
5350
|
// src/widget/advance/table/table-view/controller.ts
|
|
5338
|
-
var import_interface_logic16 = require("@fctc/interface-logic");
|
|
5339
5351
|
var import_react16 = require("react");
|
|
5352
|
+
var import_store9 = require("@fctc/interface-logic/store");
|
|
5353
|
+
var import_utils5 = require("@fctc/interface-logic/utils");
|
|
5340
5354
|
var tableController = ({ data }) => {
|
|
5341
5355
|
const [rows, setRows] = (0, import_react16.useState)(data.records || []);
|
|
5342
5356
|
const [columns, setColumns] = (0, import_react16.useState)([]);
|
|
@@ -5374,7 +5388,7 @@ var tableController = ({ data }) => {
|
|
|
5374
5388
|
let cols = [];
|
|
5375
5389
|
try {
|
|
5376
5390
|
cols = mergeFields?.filter((item) => {
|
|
5377
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
5391
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils5.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils5.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
5378
5392
|
})?.map((field) => {
|
|
5379
5393
|
return {
|
|
5380
5394
|
name: field?.name,
|
|
@@ -5413,7 +5427,6 @@ var tableController = ({ data }) => {
|
|
|
5413
5427
|
};
|
|
5414
5428
|
|
|
5415
5429
|
// src/widget/advance/table/table-group/controller.ts
|
|
5416
|
-
var import_interface_logic17 = require("@fctc/interface-logic");
|
|
5417
5430
|
var import_react17 = require("react");
|
|
5418
5431
|
|
|
5419
5432
|
// src/utils/i18n.ts
|
|
@@ -6183,8 +6196,11 @@ import_i18next.default.use(import_i18next_browser_languagedetector.default).use(
|
|
|
6183
6196
|
var i18n_default = import_i18next.default;
|
|
6184
6197
|
|
|
6185
6198
|
// src/widget/advance/table/table-group/controller.ts
|
|
6199
|
+
var import_environment7 = require("@fctc/interface-logic/environment");
|
|
6200
|
+
var import_hooks13 = require("@fctc/interface-logic/hooks");
|
|
6201
|
+
var import_store10 = require("@fctc/interface-logic/store");
|
|
6186
6202
|
var tableGroupController = (props) => {
|
|
6187
|
-
const env = (0,
|
|
6203
|
+
const env = (0, import_environment7.getEnv)();
|
|
6188
6204
|
const {
|
|
6189
6205
|
rows,
|
|
6190
6206
|
columns,
|
|
@@ -6204,10 +6220,10 @@ var tableGroupController = (props) => {
|
|
|
6204
6220
|
selectedRowKeysRef
|
|
6205
6221
|
} = props;
|
|
6206
6222
|
const [pageGroup, setPageGroup] = (0, import_react17.useState)(0);
|
|
6207
|
-
const { groupByDomain, selectedTags } = (0,
|
|
6208
|
-
const { selectedRowKeys } = (0,
|
|
6209
|
-
const appDispatch = (0,
|
|
6210
|
-
const { toDataJS } = (0,
|
|
6223
|
+
const { groupByDomain, selectedTags } = (0, import_store10.useAppSelector)(import_store10.selectSearch);
|
|
6224
|
+
const { selectedRowKeys } = (0, import_store10.useAppSelector)(import_store10.selectList);
|
|
6225
|
+
const appDispatch = (0, import_store10.useAppDispatch)();
|
|
6226
|
+
const { toDataJS } = (0, import_hooks13.useOdooDataTransform)();
|
|
6211
6227
|
const initVal = toDataJS(row, viewData, model);
|
|
6212
6228
|
const [isShowGroup, setIsShowGroup] = (0, import_react17.useState)(false);
|
|
6213
6229
|
const [colEmptyGroup, setColEmptyGroup] = (0, import_react17.useState)({
|
|
@@ -6254,7 +6270,7 @@ var tableGroupController = (props) => {
|
|
|
6254
6270
|
isPlaceholderData,
|
|
6255
6271
|
isLoading,
|
|
6256
6272
|
isFetching
|
|
6257
|
-
} = (0,
|
|
6273
|
+
} = (0, import_hooks13.useGetListData)(listDataProps, queryKey, enabled);
|
|
6258
6274
|
const {
|
|
6259
6275
|
columns: columnsGroup,
|
|
6260
6276
|
rows: rowsGroup,
|
|
@@ -6292,14 +6308,14 @@ var tableGroupController = (props) => {
|
|
|
6292
6308
|
const filteredIds = selectedRowKeys.filter(
|
|
6293
6309
|
(id) => !ids.includes(id)
|
|
6294
6310
|
);
|
|
6295
|
-
appDispatch((0,
|
|
6311
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(filteredIds));
|
|
6296
6312
|
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull && isQueryFetched) {
|
|
6297
6313
|
const clonedKeys = [...selectedRowKeys];
|
|
6298
|
-
appDispatch((0,
|
|
6299
|
-
setTimeout(() => appDispatch((0,
|
|
6314
|
+
appDispatch((0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]));
|
|
6315
|
+
setTimeout(() => appDispatch((0, import_store10.setSelectedRowKeys)(clonedKeys)), 500);
|
|
6300
6316
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
6301
6317
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
6302
|
-
appDispatch((0,
|
|
6318
|
+
appDispatch((0, import_store10.setSelectedRowKeys)(filteredKeys));
|
|
6303
6319
|
}
|
|
6304
6320
|
toggleShowGroup();
|
|
6305
6321
|
};
|
|
@@ -6308,8 +6324,8 @@ var tableGroupController = (props) => {
|
|
|
6308
6324
|
return;
|
|
6309
6325
|
}
|
|
6310
6326
|
const clonedKeys = [...selectedRowKeys];
|
|
6311
|
-
(0,
|
|
6312
|
-
setTimeout(() => (0,
|
|
6327
|
+
(0, import_store10.setSelectedRowKeys)([...clonedKeys, -1]);
|
|
6328
|
+
setTimeout(() => (0, import_store10.setSelectedRowKeys)(clonedKeys), 500);
|
|
6313
6329
|
}, [isQueryFetched]);
|
|
6314
6330
|
return {
|
|
6315
6331
|
handleExpandChildGroup,
|
|
@@ -6343,6 +6359,9 @@ var tableGroupController = (props) => {
|
|
|
6343
6359
|
};
|
|
6344
6360
|
|
|
6345
6361
|
// src/widget/basic/many2many-field/controller.ts
|
|
6362
|
+
var import_environment8 = require("@fctc/interface-logic/environment");
|
|
6363
|
+
var import_store11 = require("@fctc/interface-logic/store");
|
|
6364
|
+
var import_utils6 = require("@fctc/interface-logic/utils");
|
|
6346
6365
|
var many2manyFieldController = (props) => {
|
|
6347
6366
|
const {
|
|
6348
6367
|
relation,
|
|
@@ -6359,14 +6378,14 @@ var many2manyFieldController = (props) => {
|
|
|
6359
6378
|
options,
|
|
6360
6379
|
sessionStorageUtils
|
|
6361
6380
|
} = props;
|
|
6362
|
-
const appDispatch = (0,
|
|
6381
|
+
const appDispatch = (0, import_store11.useAppDispatch)();
|
|
6363
6382
|
const actionData = sessionStorageUtils.getActionData();
|
|
6364
6383
|
const [debouncedPage] = useDebounce(page, 500);
|
|
6365
6384
|
const [order, setOrder] = (0, import_react18.useState)();
|
|
6366
6385
|
const [isLoadedData, setIsLoadedData] = (0, import_react18.useState)(false);
|
|
6367
6386
|
const [domainMany2Many, setDomainMany2Many] = (0, import_react18.useState)(domain);
|
|
6368
|
-
const env = (0,
|
|
6369
|
-
const { selectedTags } = (0,
|
|
6387
|
+
const env = (0, import_environment8.getEnv)();
|
|
6388
|
+
const { selectedTags } = (0, import_store11.useAppSelector)(import_store11.selectSearch);
|
|
6370
6389
|
const viewParams = {
|
|
6371
6390
|
model: relation,
|
|
6372
6391
|
views: [
|
|
@@ -6375,7 +6394,7 @@ var many2manyFieldController = (props) => {
|
|
|
6375
6394
|
],
|
|
6376
6395
|
context
|
|
6377
6396
|
};
|
|
6378
|
-
const { data: viewResponse, isFetched: isViewReponseFetched } = (0,
|
|
6397
|
+
const { data: viewResponse, isFetched: isViewReponseFetched } = (0, hooks_exports.useGetView)(
|
|
6379
6398
|
viewParams,
|
|
6380
6399
|
actionData
|
|
6381
6400
|
);
|
|
@@ -6391,7 +6410,7 @@ var many2manyFieldController = (props) => {
|
|
|
6391
6410
|
}),
|
|
6392
6411
|
[model, viewResponse]
|
|
6393
6412
|
);
|
|
6394
|
-
const initModel = (0,
|
|
6413
|
+
const initModel = (0, hooks_exports.useModel)();
|
|
6395
6414
|
const modelInstance = (0, import_react18.useMemo)(() => {
|
|
6396
6415
|
if (viewResponse) {
|
|
6397
6416
|
return initModel.initModel(baseModel);
|
|
@@ -6405,12 +6424,12 @@ var many2manyFieldController = (props) => {
|
|
|
6405
6424
|
return null;
|
|
6406
6425
|
}, [modelInstance]);
|
|
6407
6426
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
6408
|
-
const optionsObject = tab?.options ? (0,
|
|
6427
|
+
const optionsObject = tab?.options ? (0, import_utils6.evalJSONContext)(tab?.options) : (options ? (0, import_utils6.evalJSONContext)(options) : {}) || {};
|
|
6409
6428
|
const fetchData = async () => {
|
|
6410
6429
|
try {
|
|
6411
6430
|
setDomainMany2Many(domain);
|
|
6412
|
-
appDispatch((0,
|
|
6413
|
-
appDispatch((0,
|
|
6431
|
+
appDispatch((0, import_store11.setFirstDomain)(domain));
|
|
6432
|
+
appDispatch((0, import_store11.setViewDataStore)(viewResponse));
|
|
6414
6433
|
const modalData = viewResponse?.views?.list?.fields.map((field) => ({
|
|
6415
6434
|
...viewResponse?.models?.[String(model)]?.[field?.name],
|
|
6416
6435
|
...field
|
|
@@ -6421,7 +6440,7 @@ var many2manyFieldController = (props) => {
|
|
|
6421
6440
|
[`${aid}_${relation}_popupmany2many`]: modalData
|
|
6422
6441
|
});
|
|
6423
6442
|
}
|
|
6424
|
-
appDispatch((0,
|
|
6443
|
+
appDispatch((0, import_store11.setPage)(0));
|
|
6425
6444
|
} catch (err) {
|
|
6426
6445
|
console.log(err);
|
|
6427
6446
|
}
|
|
@@ -6443,7 +6462,7 @@ var many2manyFieldController = (props) => {
|
|
|
6443
6462
|
context,
|
|
6444
6463
|
fields: groupByDomain?.fields,
|
|
6445
6464
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
6446
|
-
sort: order ? order : default_order ? (0,
|
|
6465
|
+
sort: order ? order : default_order ? (0, import_utils6.formatSortingString)(default_order) : ""
|
|
6447
6466
|
};
|
|
6448
6467
|
const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
6449
6468
|
const {
|
|
@@ -6451,18 +6470,18 @@ var many2manyFieldController = (props) => {
|
|
|
6451
6470
|
isLoading: isDataLoading,
|
|
6452
6471
|
isFetched: isDataResponseFetched,
|
|
6453
6472
|
isPlaceholderData
|
|
6454
|
-
} = (0,
|
|
6473
|
+
} = (0, hooks_exports.useGetListData)(data, queryKey, enabled);
|
|
6455
6474
|
(0, import_react18.useEffect)(() => {
|
|
6456
6475
|
if (viewResponse) {
|
|
6457
6476
|
fetchData();
|
|
6458
6477
|
}
|
|
6459
6478
|
return () => {
|
|
6460
|
-
appDispatch((0,
|
|
6479
|
+
appDispatch((0, import_store11.setGroupByDomain)(null));
|
|
6461
6480
|
setFields((prevFields) => ({
|
|
6462
6481
|
...prevFields,
|
|
6463
6482
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
6464
6483
|
}));
|
|
6465
|
-
appDispatch((0,
|
|
6484
|
+
appDispatch((0, import_store11.setPage)(0));
|
|
6466
6485
|
setSelectedRowKeys4([]);
|
|
6467
6486
|
setDomainMany2Many(null);
|
|
6468
6487
|
setIsLoadedData(false);
|
|
@@ -6486,7 +6505,7 @@ var many2manyFieldController = (props) => {
|
|
|
6486
6505
|
refetch,
|
|
6487
6506
|
data: dataFormViewResponse,
|
|
6488
6507
|
isSuccess
|
|
6489
|
-
} = (0,
|
|
6508
|
+
} = (0, hooks_exports.useGetFormView)({
|
|
6490
6509
|
data: dataFormView,
|
|
6491
6510
|
queryKey: [`form-view-action-${relation}`],
|
|
6492
6511
|
enabled: false
|
|
@@ -6514,7 +6533,10 @@ var many2manyFieldController = (props) => {
|
|
|
6514
6533
|
|
|
6515
6534
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
6516
6535
|
var import_react19 = require("react");
|
|
6517
|
-
var
|
|
6536
|
+
var import_constants3 = require("@fctc/interface-logic/constants");
|
|
6537
|
+
var import_environment9 = require("@fctc/interface-logic/environment");
|
|
6538
|
+
var import_hooks15 = require("@fctc/interface-logic/hooks");
|
|
6539
|
+
var import_utils7 = require("@fctc/interface-logic/utils");
|
|
6518
6540
|
var many2manyTagsController = (props) => {
|
|
6519
6541
|
const {
|
|
6520
6542
|
relation,
|
|
@@ -6525,10 +6547,10 @@ var many2manyTagsController = (props) => {
|
|
|
6525
6547
|
placeholderNoOption
|
|
6526
6548
|
} = props;
|
|
6527
6549
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
6528
|
-
const env = (0,
|
|
6529
|
-
const addtionalFields = optionsFields ? (0,
|
|
6550
|
+
const env = (0, import_environment9.getEnv)();
|
|
6551
|
+
const addtionalFields = optionsFields ? (0, import_utils7.evalJSONContext)(optionsFields) : null;
|
|
6530
6552
|
const domainObject = (0, import_react19.useMemo)(
|
|
6531
|
-
() => (0,
|
|
6553
|
+
() => (0, import_utils7.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
6532
6554
|
[domain, formValues]
|
|
6533
6555
|
);
|
|
6534
6556
|
const data = {
|
|
@@ -6538,13 +6560,13 @@ var many2manyTagsController = (props) => {
|
|
|
6538
6560
|
id: {},
|
|
6539
6561
|
name: {},
|
|
6540
6562
|
display_name: {},
|
|
6541
|
-
...widget &&
|
|
6542
|
-
...widget &&
|
|
6563
|
+
...widget && import_constants3.WIDGETAVATAR[widget] ? { image_256: {} } : {},
|
|
6564
|
+
...widget && import_constants3.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
|
|
6543
6565
|
},
|
|
6544
6566
|
enabled: true,
|
|
6545
6567
|
context: env.context
|
|
6546
6568
|
};
|
|
6547
|
-
const { data: dataOfSelection } = (0,
|
|
6569
|
+
const { data: dataOfSelection } = (0, import_hooks15.useGetSelection)({
|
|
6548
6570
|
data,
|
|
6549
6571
|
queryKey: [`data_${relation}`, domainObject]
|
|
6550
6572
|
});
|
|
@@ -6571,7 +6593,9 @@ var many2manyTagsController = (props) => {
|
|
|
6571
6593
|
|
|
6572
6594
|
// src/widget/basic/status-bar-field/controller.ts
|
|
6573
6595
|
var import_react20 = require("react");
|
|
6574
|
-
var
|
|
6596
|
+
var import_hooks16 = require("@fctc/interface-logic/hooks");
|
|
6597
|
+
var import_store12 = require("@fctc/interface-logic/store");
|
|
6598
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
6575
6599
|
var durationController = (props) => {
|
|
6576
6600
|
const {
|
|
6577
6601
|
relation,
|
|
@@ -6590,12 +6614,12 @@ var durationController = (props) => {
|
|
|
6590
6614
|
};
|
|
6591
6615
|
const [disabled, setDisabled] = (0, import_react20.useState)(false);
|
|
6592
6616
|
const [modelStatus, setModalStatus] = (0, import_react20.useState)(false);
|
|
6593
|
-
const { context } = (0,
|
|
6617
|
+
const { context } = (0, import_store12.useAppSelector)(import_store12.selectEnv);
|
|
6594
6618
|
const queryKey = [`data-status-duration`, specification];
|
|
6595
6619
|
const listDataProps = {
|
|
6596
6620
|
model: relation,
|
|
6597
6621
|
specification,
|
|
6598
|
-
domain: (0,
|
|
6622
|
+
domain: (0, import_utils8.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
6599
6623
|
limit: 10,
|
|
6600
6624
|
offset: 0,
|
|
6601
6625
|
fields: "",
|
|
@@ -6605,8 +6629,8 @@ var durationController = (props) => {
|
|
|
6605
6629
|
},
|
|
6606
6630
|
sort: ""
|
|
6607
6631
|
};
|
|
6608
|
-
const { data: dataResponse } = (0,
|
|
6609
|
-
const { mutate: fetchChangeStatus } = (0,
|
|
6632
|
+
const { data: dataResponse } = (0, import_hooks16.useGetListData)(listDataProps, queryKey);
|
|
6633
|
+
const { mutate: fetchChangeStatus } = (0, import_hooks16.useChangeStatus)();
|
|
6610
6634
|
const handleClick = async (stage_id) => {
|
|
6611
6635
|
setDisabled(true);
|
|
6612
6636
|
if (stage_id) {
|
|
@@ -6642,7 +6666,8 @@ var durationController = (props) => {
|
|
|
6642
6666
|
};
|
|
6643
6667
|
|
|
6644
6668
|
// src/widget/basic/priority-field/controller.ts
|
|
6645
|
-
var
|
|
6669
|
+
var import_hooks17 = require("@fctc/interface-logic/hooks");
|
|
6670
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
6646
6671
|
var priorityFieldController = (props) => {
|
|
6647
6672
|
const {
|
|
6648
6673
|
value,
|
|
@@ -6657,11 +6682,11 @@ var priorityFieldController = (props) => {
|
|
|
6657
6682
|
viewData,
|
|
6658
6683
|
context
|
|
6659
6684
|
} = props;
|
|
6660
|
-
const _context = { ...(0,
|
|
6685
|
+
const _context = { ...(0, import_utils9.evalJSONContext)(actionData?.context) };
|
|
6661
6686
|
const contextObject = { ...context, ..._context };
|
|
6662
6687
|
const defaultPriority = parseInt(value) + 1;
|
|
6663
6688
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
6664
|
-
const { mutateAsync: fetchSave } = (0,
|
|
6689
|
+
const { mutateAsync: fetchSave } = (0, import_hooks17.useSave)();
|
|
6665
6690
|
const savePriorities = async ({
|
|
6666
6691
|
value: value2,
|
|
6667
6692
|
resetPriority
|
|
@@ -6697,7 +6722,7 @@ var priorityFieldController = (props) => {
|
|
|
6697
6722
|
|
|
6698
6723
|
// src/widget/basic/float-time-field/controller.ts
|
|
6699
6724
|
var import_react21 = require("react");
|
|
6700
|
-
var
|
|
6725
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
6701
6726
|
var floatTimeFiledController = ({
|
|
6702
6727
|
onChange: fieldOnChange,
|
|
6703
6728
|
onBlur,
|
|
@@ -6707,7 +6732,7 @@ var floatTimeFiledController = ({
|
|
|
6707
6732
|
}) => {
|
|
6708
6733
|
const { name, defaultValue = 0, onChange } = props;
|
|
6709
6734
|
const [input, setInput] = (0, import_react21.useState)(
|
|
6710
|
-
(0,
|
|
6735
|
+
(0, import_utils10.convertFloatToTime)(value ?? defaultValue)
|
|
6711
6736
|
);
|
|
6712
6737
|
const [formattedTime, setFormattedTime] = (0, import_react21.useState)("");
|
|
6713
6738
|
const [errors, setErrors] = (0, import_react21.useState)("");
|
|
@@ -6740,7 +6765,7 @@ var floatTimeFiledController = ({
|
|
|
6740
6765
|
if (!isDirty) return;
|
|
6741
6766
|
if (formattedTime) {
|
|
6742
6767
|
setInput(formattedTime);
|
|
6743
|
-
const floatVal = (0,
|
|
6768
|
+
const floatVal = (0, import_utils10.convertTimeToFloat)(formattedTime);
|
|
6744
6769
|
fieldOnChange(floatVal);
|
|
6745
6770
|
if (onChange) {
|
|
6746
6771
|
onChange(name ?? "", floatVal);
|
|
@@ -7073,12 +7098,12 @@ var dateFieldController = (props) => {
|
|
|
7073
7098
|
|
|
7074
7099
|
// src/widget/basic/copy-link-button/controller.ts
|
|
7075
7100
|
var import_react24 = require("react");
|
|
7076
|
-
var
|
|
7101
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
7077
7102
|
var copyLinkButtonController = (props) => {
|
|
7078
7103
|
const { value, defaultValue } = props;
|
|
7079
7104
|
const [isCopied, setIsCopied] = (0, import_react24.useState)(false);
|
|
7080
7105
|
const handleCopyToClipboard = async (value2) => {
|
|
7081
|
-
await (0,
|
|
7106
|
+
await (0, import_utils11.copyTextToClipboard)(value2);
|
|
7082
7107
|
setIsCopied(true);
|
|
7083
7108
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
7084
7109
|
};
|
|
@@ -7091,14 +7116,16 @@ var copyLinkButtonController = (props) => {
|
|
|
7091
7116
|
};
|
|
7092
7117
|
|
|
7093
7118
|
// src/widget/basic/color-field/color-controller.ts
|
|
7094
|
-
var
|
|
7119
|
+
var import_environment10 = require("@fctc/interface-logic/environment");
|
|
7120
|
+
var import_hooks18 = require("@fctc/interface-logic/hooks");
|
|
7121
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
7095
7122
|
var colorFieldController = (props) => {
|
|
7096
7123
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
7097
|
-
const env = (0,
|
|
7098
|
-
const _context = { ...(0,
|
|
7124
|
+
const env = (0, import_environment10.getEnv)();
|
|
7125
|
+
const _context = { ...(0, import_utils12.evalJSONContext)(actionData?.context) || {} };
|
|
7099
7126
|
const contextObject = { ...env.context, ..._context };
|
|
7100
7127
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
7101
|
-
const { mutate: onSave } = (0,
|
|
7128
|
+
const { mutate: onSave } = (0, import_hooks18.useSave)();
|
|
7102
7129
|
const savePickColor = async (colorObject) => {
|
|
7103
7130
|
const { id } = colorObject;
|
|
7104
7131
|
if (value === id) return;
|
|
@@ -7124,7 +7151,7 @@ var colorFieldController = (props) => {
|
|
|
7124
7151
|
|
|
7125
7152
|
// src/widget/basic/binary-field/controller.ts
|
|
7126
7153
|
var import_react25 = require("react");
|
|
7127
|
-
var
|
|
7154
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
7128
7155
|
var binaryFieldController = (props) => {
|
|
7129
7156
|
const { name, methods, readonly = false, value } = props;
|
|
7130
7157
|
const inputId = (0, import_react25.useId)();
|
|
@@ -7181,11 +7208,11 @@ var binaryFieldController = (props) => {
|
|
|
7181
7208
|
};
|
|
7182
7209
|
const checkIsImageLink = (url) => {
|
|
7183
7210
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
7184
|
-
return imageExtensions.test(url) || (0,
|
|
7211
|
+
return imageExtensions.test(url) || (0, import_utils13.isBase64Image)(url) || isBlobUrl(url);
|
|
7185
7212
|
};
|
|
7186
7213
|
const getImageBase64WithMimeType = (base64) => {
|
|
7187
7214
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
7188
|
-
if ((0,
|
|
7215
|
+
if ((0, import_utils13.isBase64Image)(base64)) return base64;
|
|
7189
7216
|
let mimeType = null;
|
|
7190
7217
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
7191
7218
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -7220,13 +7247,6 @@ var binaryFieldController = (props) => {
|
|
|
7220
7247
|
};
|
|
7221
7248
|
};
|
|
7222
7249
|
|
|
7223
|
-
// src/types.ts
|
|
7224
|
-
var types_exports = {};
|
|
7225
|
-
__reExport(types_exports, require("@fctc/interface-logic/types"));
|
|
7226
|
-
|
|
7227
|
-
// src/index.ts
|
|
7228
|
-
__reExport(index_exports, types_exports, module.exports);
|
|
7229
|
-
|
|
7230
7250
|
// src/utils.ts
|
|
7231
7251
|
var utils_exports = {};
|
|
7232
7252
|
__export(utils_exports, {
|
|
@@ -7269,13 +7289,6 @@ __reExport(environment_exports, require("@fctc/interface-logic/environment"));
|
|
|
7269
7289
|
// src/index.ts
|
|
7270
7290
|
__reExport(index_exports, environment_exports, module.exports);
|
|
7271
7291
|
|
|
7272
|
-
// src/model.ts
|
|
7273
|
-
var model_exports = {};
|
|
7274
|
-
__reExport(model_exports, require("@fctc/interface-logic/model"));
|
|
7275
|
-
|
|
7276
|
-
// src/index.ts
|
|
7277
|
-
__reExport(index_exports, model_exports, module.exports);
|
|
7278
|
-
|
|
7279
7292
|
// src/provider.ts
|
|
7280
7293
|
var provider_exports = {};
|
|
7281
7294
|
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|