@fctc/widget-logic 2.8.7 → 2.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks.d.mts +8 -23
- package/dist/hooks.d.ts +8 -23
- package/dist/hooks.js +60 -101
- package/dist/hooks.mjs +55 -96
- package/dist/index.js +93 -134
- package/dist/index.mjs +67 -108
- package/dist/widget.js +39 -39
- package/dist/widget.mjs +15 -15
- package/package.json +96 -96
package/dist/index.js
CHANGED
|
@@ -4167,12 +4167,51 @@ var import_react8 = require("react");
|
|
|
4167
4167
|
var import_react3 = require("react");
|
|
4168
4168
|
|
|
4169
4169
|
// src/hooks/core/use-call-action.ts
|
|
4170
|
-
var
|
|
4170
|
+
var import_react = require("react");
|
|
4171
4171
|
|
|
4172
4172
|
// src/provider.ts
|
|
4173
4173
|
var provider_exports = {};
|
|
4174
4174
|
__reExport(provider_exports, require("@fctc/interface-logic/provider"));
|
|
4175
4175
|
|
|
4176
|
+
// src/hooks/core/use-call-action.ts
|
|
4177
|
+
var useCallAction = () => {
|
|
4178
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
4179
|
+
const { useLoadAction: useLoadAction2, useRunAction: useRunAction2 } = (0, provider_exports.useService)();
|
|
4180
|
+
const queryLoadAction = useLoadAction2();
|
|
4181
|
+
const queryRunAction = useRunAction2();
|
|
4182
|
+
const [actionData, setActionData] = (0, import_react.useState)(
|
|
4183
|
+
void 0
|
|
4184
|
+
);
|
|
4185
|
+
const callAction = (0, import_react.useCallback)(
|
|
4186
|
+
async ({
|
|
4187
|
+
aid
|
|
4188
|
+
}) => {
|
|
4189
|
+
try {
|
|
4190
|
+
const loadRes = await queryLoadAction.mutateAsync({
|
|
4191
|
+
idAction: aid,
|
|
4192
|
+
context: env.context
|
|
4193
|
+
});
|
|
4194
|
+
if (loadRes?.result?.type === "ir.actions.server") {
|
|
4195
|
+
const runRes = await queryRunAction.mutateAsync({
|
|
4196
|
+
idAction: aid,
|
|
4197
|
+
context: env.context
|
|
4198
|
+
});
|
|
4199
|
+
setActionData(runRes?.result);
|
|
4200
|
+
return runRes?.result;
|
|
4201
|
+
} else {
|
|
4202
|
+
setActionData(loadRes?.result);
|
|
4203
|
+
return loadRes?.result;
|
|
4204
|
+
}
|
|
4205
|
+
} catch (err) {
|
|
4206
|
+
console.error("callAction error:", err);
|
|
4207
|
+
return void 0;
|
|
4208
|
+
}
|
|
4209
|
+
},
|
|
4210
|
+
[env?.context?.lang]
|
|
4211
|
+
);
|
|
4212
|
+
return [actionData, callAction];
|
|
4213
|
+
};
|
|
4214
|
+
|
|
4176
4215
|
// src/utils.ts
|
|
4177
4216
|
var utils_exports = {};
|
|
4178
4217
|
__export(utils_exports, {
|
|
@@ -4194,7 +4233,7 @@ var languages = [
|
|
|
4194
4233
|
];
|
|
4195
4234
|
|
|
4196
4235
|
// src/utils/function.ts
|
|
4197
|
-
var
|
|
4236
|
+
var import_react2 = require("react");
|
|
4198
4237
|
var countSum = (data, field) => {
|
|
4199
4238
|
if (!data || !field) return 0;
|
|
4200
4239
|
return data.reduce(
|
|
@@ -4315,7 +4354,7 @@ var STORAGES = {
|
|
|
4315
4354
|
USER_INFO: "USER_INFO"
|
|
4316
4355
|
};
|
|
4317
4356
|
function useAsyncState(initialValue = [true, null]) {
|
|
4318
|
-
return (0,
|
|
4357
|
+
return (0, import_react2.useReducer)(
|
|
4319
4358
|
(_state, action = null) => [false, action],
|
|
4320
4359
|
initialValue
|
|
4321
4360
|
);
|
|
@@ -4333,7 +4372,7 @@ async function setStorageItemAsync(key, value) {
|
|
|
4333
4372
|
}
|
|
4334
4373
|
function useStorageState(key) {
|
|
4335
4374
|
const [state, setState] = useAsyncState();
|
|
4336
|
-
(0,
|
|
4375
|
+
(0, import_react2.useEffect)(() => {
|
|
4337
4376
|
try {
|
|
4338
4377
|
const storedValue = localStorage.getItem(key);
|
|
4339
4378
|
setState(storedValue);
|
|
@@ -4341,7 +4380,7 @@ function useStorageState(key) {
|
|
|
4341
4380
|
console.error("Local storage is unavailable:", e);
|
|
4342
4381
|
}
|
|
4343
4382
|
}, [key]);
|
|
4344
|
-
const setValue = (0,
|
|
4383
|
+
const setValue = (0, import_react2.useCallback)(
|
|
4345
4384
|
(value) => {
|
|
4346
4385
|
setState(value);
|
|
4347
4386
|
setStorageItemAsync(key, value);
|
|
@@ -4354,74 +4393,18 @@ function useStorageState(key) {
|
|
|
4354
4393
|
// src/utils.ts
|
|
4355
4394
|
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4356
4395
|
|
|
4357
|
-
// src/hooks/core/use-call-action.ts
|
|
4358
|
-
var useCallAction = () => {
|
|
4359
|
-
const { env } = (0, provider_exports.useEnv)();
|
|
4360
|
-
const { useLoadAction: useLoadAction2, useRunAction: useRunAction2 } = (0, provider_exports.useService)();
|
|
4361
|
-
const queryLoadAction = useLoadAction2();
|
|
4362
|
-
const queryRunAction = useRunAction2();
|
|
4363
|
-
const [actionData, setActionData] = (0, import_react2.useState)(
|
|
4364
|
-
void 0
|
|
4365
|
-
);
|
|
4366
|
-
const callAction = (0, import_react2.useCallback)(
|
|
4367
|
-
async ({
|
|
4368
|
-
aid,
|
|
4369
|
-
service,
|
|
4370
|
-
xNode,
|
|
4371
|
-
context
|
|
4372
|
-
}) => {
|
|
4373
|
-
try {
|
|
4374
|
-
const loadRes = await queryLoadAction.mutateAsync({
|
|
4375
|
-
idAction: aid,
|
|
4376
|
-
context: {
|
|
4377
|
-
...env?.context,
|
|
4378
|
-
...context ? (0, utils_exports.evalJSONContext)(context, { ...env?.context }) || {} : {}
|
|
4379
|
-
},
|
|
4380
|
-
service,
|
|
4381
|
-
xNode
|
|
4382
|
-
});
|
|
4383
|
-
if (loadRes?.result?.type === "ir.actions.server") {
|
|
4384
|
-
const runRes = await queryRunAction.mutateAsync({
|
|
4385
|
-
idAction: aid,
|
|
4386
|
-
context: {
|
|
4387
|
-
...env?.context,
|
|
4388
|
-
...context ? (0, utils_exports.evalJSONContext)(context, { ...env?.context }) || {} : {}
|
|
4389
|
-
},
|
|
4390
|
-
service,
|
|
4391
|
-
xNode
|
|
4392
|
-
});
|
|
4393
|
-
setActionData(runRes?.result);
|
|
4394
|
-
return runRes?.result;
|
|
4395
|
-
} else {
|
|
4396
|
-
setActionData(loadRes?.result);
|
|
4397
|
-
return loadRes?.result;
|
|
4398
|
-
}
|
|
4399
|
-
} catch (err) {
|
|
4400
|
-
console.error("callAction error:", err);
|
|
4401
|
-
return void 0;
|
|
4402
|
-
}
|
|
4403
|
-
},
|
|
4404
|
-
[env?.context?.lang]
|
|
4405
|
-
);
|
|
4406
|
-
return [actionData, callAction];
|
|
4407
|
-
};
|
|
4408
|
-
|
|
4409
4396
|
// src/hooks/core/use-menu.ts
|
|
4410
4397
|
var useMenu = ({
|
|
4411
4398
|
context,
|
|
4412
|
-
specification
|
|
4413
|
-
domain
|
|
4399
|
+
specification
|
|
4414
4400
|
}) => {
|
|
4415
4401
|
const { env } = (0, provider_exports.useEnv)();
|
|
4416
4402
|
const { useGetMenu: useGetMenu2 } = (0, provider_exports.useService)();
|
|
4417
4403
|
const [action, callAction] = useCallAction();
|
|
4418
|
-
const [service, setService] = (0, import_react3.useState)("");
|
|
4419
|
-
const [xNode, setXNode] = (0, import_react3.useState)("");
|
|
4420
4404
|
const menuData = useGetMenu2(
|
|
4421
4405
|
context,
|
|
4422
4406
|
specification,
|
|
4423
|
-
!!context && !(0, utils_exports.isObjectEmpty)(context)
|
|
4424
|
-
domain
|
|
4407
|
+
!!context && !(0, utils_exports.isObjectEmpty)(context)
|
|
4425
4408
|
);
|
|
4426
4409
|
const [menuId, setMenuId] = (0, import_react3.useState)(void 0);
|
|
4427
4410
|
const configedIconData = (0, import_react3.useMemo)(() => {
|
|
@@ -4439,30 +4422,20 @@ var useMenu = ({
|
|
|
4439
4422
|
};
|
|
4440
4423
|
});
|
|
4441
4424
|
}, [menuData.data, env?.envFile?.VITE_APP_DOMAIN]);
|
|
4442
|
-
const handleChangeMenu = async ({
|
|
4443
|
-
menu,
|
|
4444
|
-
service: service2,
|
|
4445
|
-
xNode: xNode2
|
|
4446
|
-
}) => {
|
|
4425
|
+
const handleChangeMenu = async ({ menu }) => {
|
|
4447
4426
|
const aidMenu = menu?.action?.id?.id;
|
|
4448
4427
|
if (menu) {
|
|
4449
4428
|
setMenuId(menu.id?.toString() ?? "");
|
|
4450
4429
|
}
|
|
4451
4430
|
if (aidMenu) {
|
|
4452
4431
|
const actionResponse = await callAction({
|
|
4453
|
-
aid: Number(aidMenu)
|
|
4454
|
-
service: service2 ?? "",
|
|
4455
|
-
xNode: xNode2
|
|
4432
|
+
aid: Number(aidMenu)
|
|
4456
4433
|
});
|
|
4457
|
-
if (service2 && service2 !== "") setService(service2);
|
|
4458
|
-
if (xNode2 && xNode2 !== "") setXNode(xNode2);
|
|
4459
4434
|
return actionResponse;
|
|
4460
4435
|
}
|
|
4461
4436
|
};
|
|
4462
4437
|
return {
|
|
4463
4438
|
...menuData,
|
|
4464
|
-
service,
|
|
4465
|
-
xNode,
|
|
4466
4439
|
data: configedIconData,
|
|
4467
4440
|
action: { handleChangeMenu },
|
|
4468
4441
|
state: { menuId, action },
|
|
@@ -4554,9 +4527,7 @@ var import_react6 = require("react");
|
|
|
4554
4527
|
var useViewV2 = ({
|
|
4555
4528
|
action,
|
|
4556
4529
|
context,
|
|
4557
|
-
aid
|
|
4558
|
-
service,
|
|
4559
|
-
xNode
|
|
4530
|
+
aid
|
|
4560
4531
|
}) => {
|
|
4561
4532
|
const { useGetView: useGetView2 } = (0, provider_exports.useService)();
|
|
4562
4533
|
const viewParams = (0, import_react6.useMemo)(() => {
|
|
@@ -4576,9 +4547,7 @@ var useViewV2 = ({
|
|
|
4576
4547
|
]
|
|
4577
4548
|
],
|
|
4578
4549
|
context,
|
|
4579
|
-
id: isNaN(Number(aid)) ? action?.id : aid
|
|
4580
|
-
service,
|
|
4581
|
-
xNode
|
|
4550
|
+
id: isNaN(Number(aid)) ? action?.id : aid
|
|
4582
4551
|
};
|
|
4583
4552
|
}, [action, context, aid]);
|
|
4584
4553
|
const view = useGetView2({
|
|
@@ -4650,7 +4619,7 @@ var AppProviderInitialValue = {
|
|
|
4650
4619
|
var ReactContext = (0, import_react8.createContext)(AppProviderInitialValue);
|
|
4651
4620
|
var AppProvider = ({
|
|
4652
4621
|
children,
|
|
4653
|
-
|
|
4622
|
+
menuSpecification,
|
|
4654
4623
|
aid
|
|
4655
4624
|
}) => {
|
|
4656
4625
|
const { env } = (0, provider_exports.useEnv)();
|
|
@@ -4660,8 +4629,7 @@ var AppProvider = ({
|
|
|
4660
4629
|
return combineContexts([
|
|
4661
4630
|
{
|
|
4662
4631
|
...user?.context,
|
|
4663
|
-
...!(0, utils_exports.isObjectEmpty)(env?.user) && company?.context?.allowed_company_ids ? { lang: env?.context?.lang } : {}
|
|
4664
|
-
...menuParams?.context ?? {}
|
|
4632
|
+
...!(0, utils_exports.isObjectEmpty)(env?.user) && company?.context?.allowed_company_ids ? { lang: env?.context?.lang } : {}
|
|
4665
4633
|
},
|
|
4666
4634
|
company?.context
|
|
4667
4635
|
]);
|
|
@@ -4670,8 +4638,7 @@ var AppProvider = ({
|
|
|
4670
4638
|
context: {
|
|
4671
4639
|
...menuContext
|
|
4672
4640
|
},
|
|
4673
|
-
specification:
|
|
4674
|
-
domain: menuParams?.domain
|
|
4641
|
+
specification: menuSpecification
|
|
4675
4642
|
});
|
|
4676
4643
|
const action = (0, import_react8.useMemo)(() => {
|
|
4677
4644
|
return menu?.state?.action;
|
|
@@ -4685,9 +4652,7 @@ var AppProvider = ({
|
|
|
4685
4652
|
const view = useViewV2({
|
|
4686
4653
|
action,
|
|
4687
4654
|
context: viewContext,
|
|
4688
|
-
aid
|
|
4689
|
-
service: menu?.service,
|
|
4690
|
-
xNode: menu?.xNode
|
|
4655
|
+
aid
|
|
4691
4656
|
});
|
|
4692
4657
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4693
4658
|
ReactContext.Provider,
|
|
@@ -4812,7 +4777,7 @@ var useGetSpecification = ({
|
|
|
4812
4777
|
|
|
4813
4778
|
// src/hooks/core/use-list-data.ts
|
|
4814
4779
|
var import_react14 = require("react");
|
|
4815
|
-
var
|
|
4780
|
+
var import_utils5 = require("@fctc/interface-logic/utils");
|
|
4816
4781
|
|
|
4817
4782
|
// src/hooks/utils/use-click-outside.ts
|
|
4818
4783
|
var import_react11 = require("react");
|
|
@@ -4931,9 +4896,7 @@ var useListData = ({
|
|
|
4931
4896
|
action,
|
|
4932
4897
|
context,
|
|
4933
4898
|
viewData,
|
|
4934
|
-
model
|
|
4935
|
-
service,
|
|
4936
|
-
xNode
|
|
4899
|
+
model
|
|
4937
4900
|
}) => {
|
|
4938
4901
|
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
4939
4902
|
const [page, setPage] = (0, import_react14.useState)(0);
|
|
@@ -4956,12 +4919,12 @@ var useListData = ({
|
|
|
4956
4919
|
if (!viewData || !action || !context) {
|
|
4957
4920
|
return null;
|
|
4958
4921
|
}
|
|
4959
|
-
const domainParse = type === "calendar" ? getDateRange(currentDate, mode) : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0,
|
|
4922
|
+
const domainParse = type === "calendar" ? getDateRange(currentDate, mode) : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, import_utils5.evalJSONDomain)(action?.domain, context) : [];
|
|
4960
4923
|
const limit = type === "calendar" ? 2500 : pageLimit;
|
|
4961
4924
|
const offset = debouncedPage * pageLimit;
|
|
4962
4925
|
const fields = type === "calendar" ? convertFieldsToArray(viewData?.views?.calendar?.fields) || [] : typeof groupByList === "object" ? groupByList?.fields : void 0;
|
|
4963
4926
|
const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
|
|
4964
|
-
const sort = order ? order : viewData?.views?.list?.default_order ? (0,
|
|
4927
|
+
const sort = order ? order : viewData?.views?.list?.default_order ? (0, import_utils5.formatSortingString)(viewData?.views?.list?.default_order) : "";
|
|
4965
4928
|
return {
|
|
4966
4929
|
model: action.res_model,
|
|
4967
4930
|
specification,
|
|
@@ -4972,9 +4935,7 @@ var useListData = ({
|
|
|
4972
4935
|
groupby,
|
|
4973
4936
|
context,
|
|
4974
4937
|
sort,
|
|
4975
|
-
type
|
|
4976
|
-
service,
|
|
4977
|
-
xNode
|
|
4938
|
+
type
|
|
4978
4939
|
};
|
|
4979
4940
|
}, [
|
|
4980
4941
|
action,
|
|
@@ -4991,9 +4952,7 @@ var useListData = ({
|
|
|
4991
4952
|
const list = useGetListData2(
|
|
4992
4953
|
listDataProps,
|
|
4993
4954
|
[listDataProps],
|
|
4994
|
-
!!listDataProps && !!specification && !(0,
|
|
4995
|
-
service,
|
|
4996
|
-
xNode
|
|
4955
|
+
!!listDataProps && !!specification && !(0, import_utils5.isObjectEmpty)(specification)
|
|
4997
4956
|
);
|
|
4998
4957
|
return {
|
|
4999
4958
|
...list,
|
|
@@ -5499,18 +5458,18 @@ var many2oneFieldController = (props) => {
|
|
|
5499
5458
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5500
5459
|
var import_environment2 = require("@fctc/interface-logic/environment");
|
|
5501
5460
|
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
5502
|
-
var
|
|
5461
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5503
5462
|
var many2oneButtonController = (props) => {
|
|
5504
5463
|
const { domain, methods, relation, service, xNode } = props;
|
|
5505
5464
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5506
5465
|
const env = (0, import_environment2.getEnv)();
|
|
5507
|
-
const domainObject = (0,
|
|
5466
|
+
const domainObject = (0, import_utils8.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5508
5467
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5509
5468
|
const { data: dataOfSelection } = (0, import_hooks6.useGetSelection)({
|
|
5510
5469
|
data: {
|
|
5511
5470
|
model: relation ?? "",
|
|
5512
5471
|
domain: domainObject,
|
|
5513
|
-
context: { ...env.context, ...(0,
|
|
5472
|
+
context: { ...env.context, ...(0, import_utils8.evalJSONContext)(actionData?.context) }
|
|
5514
5473
|
},
|
|
5515
5474
|
queryKey: [`data_${relation}`, domainObject],
|
|
5516
5475
|
service,
|
|
@@ -5527,7 +5486,7 @@ var many2oneButtonController = (props) => {
|
|
|
5527
5486
|
|
|
5528
5487
|
// src/widget/basic/many2many-field/controller.ts
|
|
5529
5488
|
var import_react17 = require("react");
|
|
5530
|
-
var
|
|
5489
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5531
5490
|
var many2manyFieldController = (props) => {
|
|
5532
5491
|
const {
|
|
5533
5492
|
relation,
|
|
@@ -5570,10 +5529,10 @@ var many2manyFieldController = (props) => {
|
|
|
5570
5529
|
]
|
|
5571
5530
|
});
|
|
5572
5531
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5573
|
-
const optionsObject = tab?.options ? (0,
|
|
5532
|
+
const optionsObject = tab?.options ? (0, import_utils9.evalJSONContext)(tab?.options) : (options ? (0, import_utils9.evalJSONContext)(options) : {}) || {};
|
|
5574
5533
|
const fetchData = async () => {
|
|
5575
5534
|
try {
|
|
5576
|
-
const domainParse = typeof domain === "string" ? (0,
|
|
5535
|
+
const domainParse = typeof domain === "string" ? (0, import_utils9.evalJSONDomain)(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5577
5536
|
setDomainMany2Many(domainParse);
|
|
5578
5537
|
setPage(0);
|
|
5579
5538
|
} catch (err) {
|
|
@@ -5597,7 +5556,7 @@ var many2manyFieldController = (props) => {
|
|
|
5597
5556
|
context: contextObject,
|
|
5598
5557
|
fields: groupByDomain?.fields,
|
|
5599
5558
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5600
|
-
sort: order ? order : default_order ? (0,
|
|
5559
|
+
sort: order ? order : default_order ? (0, import_utils9.formatSortingString)(default_order) : ""
|
|
5601
5560
|
};
|
|
5602
5561
|
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5603
5562
|
const {
|
|
@@ -5661,7 +5620,7 @@ var many2manyFieldController = (props) => {
|
|
|
5661
5620
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5662
5621
|
var import_react18 = require("react");
|
|
5663
5622
|
var import_constants2 = require("@fctc/interface-logic/constants");
|
|
5664
|
-
var
|
|
5623
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
5665
5624
|
var many2manyTagsController = (props) => {
|
|
5666
5625
|
const {
|
|
5667
5626
|
relation,
|
|
@@ -5676,9 +5635,9 @@ var many2manyTagsController = (props) => {
|
|
|
5676
5635
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5677
5636
|
const { env } = (0, provider_exports.useEnv)();
|
|
5678
5637
|
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
5679
|
-
const addtionalFields = optionsFields ? (0,
|
|
5638
|
+
const addtionalFields = optionsFields ? (0, import_utils10.evalJSONContext)(optionsFields) : null;
|
|
5680
5639
|
const domainObject = (0, import_react18.useMemo)(
|
|
5681
|
-
() => (0,
|
|
5640
|
+
() => (0, import_utils10.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5682
5641
|
[domain, formValues]
|
|
5683
5642
|
);
|
|
5684
5643
|
const data = {
|
|
@@ -5722,7 +5681,7 @@ var many2manyTagsController = (props) => {
|
|
|
5722
5681
|
|
|
5723
5682
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5724
5683
|
var import_react19 = require("react");
|
|
5725
|
-
var
|
|
5684
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
5726
5685
|
var durationController = (props) => {
|
|
5727
5686
|
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5728
5687
|
const specification = {
|
|
@@ -5738,7 +5697,7 @@ var durationController = (props) => {
|
|
|
5738
5697
|
const listDataProps = {
|
|
5739
5698
|
model: relation,
|
|
5740
5699
|
specification,
|
|
5741
|
-
domain: (0,
|
|
5700
|
+
domain: (0, import_utils11.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5742
5701
|
limit: 10,
|
|
5743
5702
|
offset: 0,
|
|
5744
5703
|
fields: "",
|
|
@@ -5788,10 +5747,10 @@ var durationController = (props) => {
|
|
|
5788
5747
|
};
|
|
5789
5748
|
|
|
5790
5749
|
// src/widget/basic/priority-field/controller.ts
|
|
5791
|
-
var
|
|
5750
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
5792
5751
|
var priorityFieldController = (props) => {
|
|
5793
5752
|
const { name, model, index, actionData, context, onChange, specification } = props;
|
|
5794
|
-
const _context = { ...(0,
|
|
5753
|
+
const _context = { ...(0, import_utils12.evalJSONContext)(actionData?.context) };
|
|
5795
5754
|
const contextObject = { ...context, ..._context };
|
|
5796
5755
|
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
5797
5756
|
const { mutateAsync: fetchSave } = useSave3();
|
|
@@ -6759,12 +6718,12 @@ var dateFieldController = (props) => {
|
|
|
6759
6718
|
|
|
6760
6719
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6761
6720
|
var import_react21 = require("react");
|
|
6762
|
-
var
|
|
6721
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6763
6722
|
var copyLinkButtonController = (props) => {
|
|
6764
6723
|
const { value, defaultValue } = props;
|
|
6765
6724
|
const [isCopied, setIsCopied] = (0, import_react21.useState)(false);
|
|
6766
6725
|
const handleCopyToClipboard = async (value2) => {
|
|
6767
|
-
await (0,
|
|
6726
|
+
await (0, import_utils13.copyTextToClipboard)(value2);
|
|
6768
6727
|
setIsCopied(true);
|
|
6769
6728
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
6770
6729
|
};
|
|
@@ -6777,12 +6736,12 @@ var copyLinkButtonController = (props) => {
|
|
|
6777
6736
|
};
|
|
6778
6737
|
|
|
6779
6738
|
// src/widget/basic/color-field/color-controller.ts
|
|
6780
|
-
var
|
|
6739
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6781
6740
|
var colorFieldController = (props) => {
|
|
6782
6741
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6783
6742
|
const { env } = (0, provider_exports.useEnv)();
|
|
6784
6743
|
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
6785
|
-
const _context = { ...(0,
|
|
6744
|
+
const _context = { ...(0, import_utils14.evalJSONContext)(actionData?.context) || {} };
|
|
6786
6745
|
const contextObject = { ...env.context, ..._context };
|
|
6787
6746
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6788
6747
|
const { mutate: onSave } = useSave3();
|
|
@@ -6811,7 +6770,7 @@ var colorFieldController = (props) => {
|
|
|
6811
6770
|
|
|
6812
6771
|
// src/widget/basic/binary-field/controller.ts
|
|
6813
6772
|
var import_react22 = require("react");
|
|
6814
|
-
var
|
|
6773
|
+
var import_utils15 = require("@fctc/interface-logic/utils");
|
|
6815
6774
|
var binaryFieldController = (props) => {
|
|
6816
6775
|
const { name, methods, readonly = false, value } = props;
|
|
6817
6776
|
const inputId = (0, import_react22.useId)();
|
|
@@ -6868,11 +6827,11 @@ var binaryFieldController = (props) => {
|
|
|
6868
6827
|
};
|
|
6869
6828
|
const checkIsImageLink = (url) => {
|
|
6870
6829
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6871
|
-
return imageExtensions.test(url) || (0,
|
|
6830
|
+
return imageExtensions.test(url) || (0, import_utils15.isBase64Image)(url) || isBlobUrl(url);
|
|
6872
6831
|
};
|
|
6873
6832
|
const getImageBase64WithMimeType = (base64) => {
|
|
6874
6833
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6875
|
-
if ((0,
|
|
6834
|
+
if ((0, import_utils15.isBase64Image)(base64)) return base64;
|
|
6876
6835
|
let mimeType = null;
|
|
6877
6836
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6878
6837
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6975,7 +6934,7 @@ var tableHeadController = (props) => {
|
|
|
6975
6934
|
|
|
6976
6935
|
// src/widget/advance/table/table-view/controller.ts
|
|
6977
6936
|
var import_react24 = require("react");
|
|
6978
|
-
var
|
|
6937
|
+
var import_utils17 = require("@fctc/interface-logic/utils");
|
|
6979
6938
|
var tableController = ({ data }) => {
|
|
6980
6939
|
const [rows, setRows] = (0, import_react24.useState)(null);
|
|
6981
6940
|
const [columns, setColumns] = (0, import_react24.useState)(null);
|
|
@@ -7013,7 +6972,7 @@ var tableController = ({ data }) => {
|
|
|
7013
6972
|
let cols = [];
|
|
7014
6973
|
try {
|
|
7015
6974
|
cols = mergeFields?.filter((item) => {
|
|
7016
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
6975
|
+
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_utils17.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_utils17.domainHelper.matchDomains(data.context, item?.invisible) : false);
|
|
7017
6976
|
})?.map((field) => {
|
|
7018
6977
|
return {
|
|
7019
6978
|
name: field?.name,
|
|
@@ -7197,7 +7156,7 @@ var tableGroupController = (props) => {
|
|
|
7197
7156
|
|
|
7198
7157
|
// src/widget/advance/search/controller.ts
|
|
7199
7158
|
var import_constants3 = require("@fctc/interface-logic/constants");
|
|
7200
|
-
var
|
|
7159
|
+
var import_utils19 = require("@fctc/interface-logic/utils");
|
|
7201
7160
|
var import_moment2 = __toESM(require_moment());
|
|
7202
7161
|
var import_react26 = require("react");
|
|
7203
7162
|
var searchController = ({
|
|
@@ -7214,9 +7173,9 @@ var searchController = ({
|
|
|
7214
7173
|
const [selectedTags, setSelectedTags] = (0, import_react26.useState)(null);
|
|
7215
7174
|
const [searchString, setSearchString] = (0, import_react26.useState)("");
|
|
7216
7175
|
const [searchMap, setSearchMap] = (0, import_react26.useState)({});
|
|
7217
|
-
const actionContext = typeof context === "string" ? (0,
|
|
7176
|
+
const actionContext = typeof context === "string" ? (0, import_utils19.evalJSONContext)(context) : context;
|
|
7218
7177
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7219
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0,
|
|
7178
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils19.evalJSONDomain)(domain, contextSearch) : [];
|
|
7220
7179
|
const clearSearch = () => {
|
|
7221
7180
|
setFilterBy([]);
|
|
7222
7181
|
setGroupBy([]);
|
|
@@ -7231,7 +7190,7 @@ var searchController = ({
|
|
|
7231
7190
|
const dataModel = viewData?.models?.[model];
|
|
7232
7191
|
const searchViews = viewData?.views?.search;
|
|
7233
7192
|
const searchByItems = searchViews?.search_by?.filter(
|
|
7234
|
-
(item) => !
|
|
7193
|
+
(item) => !import_utils19.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
7235
7194
|
)?.map(
|
|
7236
7195
|
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
7237
7196
|
dataIndex: index,
|
|
@@ -7244,10 +7203,10 @@ var searchController = ({
|
|
|
7244
7203
|
})
|
|
7245
7204
|
);
|
|
7246
7205
|
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
7247
|
-
return !
|
|
7206
|
+
return !import_utils19.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
7248
7207
|
})?.map((item) => ({ ...item, active: false }));
|
|
7249
7208
|
const groupByItems = searchViews?.group_by.filter(
|
|
7250
|
-
(item) => !
|
|
7209
|
+
(item) => !import_utils19.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
7251
7210
|
).map((item) => ({
|
|
7252
7211
|
...item,
|
|
7253
7212
|
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
@@ -7324,14 +7283,14 @@ var searchController = ({
|
|
|
7324
7283
|
}
|
|
7325
7284
|
let valueDomainItem = value?.value;
|
|
7326
7285
|
if (value?.modelType === "date") {
|
|
7327
|
-
valueDomainItem = (0,
|
|
7286
|
+
valueDomainItem = (0, import_utils19.validateAndParseDate)(value?.value);
|
|
7328
7287
|
} else if (value?.modelType === "datetime") {
|
|
7329
7288
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
7330
|
-
const parsedDate = (0,
|
|
7289
|
+
const parsedDate = (0, import_utils19.validateAndParseDate)(value?.value, true);
|
|
7331
7290
|
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
7332
7291
|
valueDomainItem = hasTime ? (0, import_moment2.default)(parsedDate).format("YYYY-MM-DD HH:mm:ss") : (0, import_moment2.default)(parsedDate).add(1, "day").subtract(1, "second").format("YYYY-MM-DD HH:mm:ss");
|
|
7333
7292
|
} else {
|
|
7334
|
-
valueDomainItem = (0,
|
|
7293
|
+
valueDomainItem = (0, import_utils19.validateAndParseDate)(value?.value, true);
|
|
7335
7294
|
}
|
|
7336
7295
|
}
|
|
7337
7296
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
@@ -7410,7 +7369,7 @@ var searchController = ({
|
|
|
7410
7369
|
}, [searchMap]);
|
|
7411
7370
|
const handleAddTagSearch = (tag) => {
|
|
7412
7371
|
const { domain: domain2, groupIndex, value, type, context: context2, dataIndex } = tag;
|
|
7413
|
-
const domainFormat = new
|
|
7372
|
+
const domainFormat = new import_utils19.domainHelper.Domain(domain2);
|
|
7414
7373
|
if (type === import_constants3.SearchType.FILTER) {
|
|
7415
7374
|
addSearchItems(`${import_constants3.SearchType.FILTER}_${groupIndex}`, {
|
|
7416
7375
|
...tag,
|