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