@fctc/widget-logic 3.0.4 → 3.0.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/hooks.d.mts +3 -1
- package/dist/hooks.d.ts +3 -1
- package/dist/hooks.js +63 -63
- package/dist/hooks.mjs +57 -57
- package/dist/index.js +144 -157
- package/dist/index.mjs +150 -167
- package/dist/widget.d.mts +17 -11
- package/dist/widget.d.ts +17 -11
- package/dist/widget.js +172 -100
- package/dist/widget.mjs +181 -113
- package/package.json +96 -96
package/dist/index.js
CHANGED
|
@@ -4167,12 +4167,62 @@ 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
|
+
service,
|
|
4189
|
+
xNode,
|
|
4190
|
+
context
|
|
4191
|
+
}) => {
|
|
4192
|
+
try {
|
|
4193
|
+
const menuContext = {
|
|
4194
|
+
...env?.context,
|
|
4195
|
+
...context
|
|
4196
|
+
};
|
|
4197
|
+
const loadRes = await queryLoadAction.mutateAsync({
|
|
4198
|
+
idAction: aid,
|
|
4199
|
+
context: menuContext,
|
|
4200
|
+
service,
|
|
4201
|
+
xNode
|
|
4202
|
+
});
|
|
4203
|
+
if (loadRes?.result?.type === "ir.actions.server") {
|
|
4204
|
+
const runRes = await queryRunAction.mutateAsync({
|
|
4205
|
+
idAction: aid,
|
|
4206
|
+
context: menuContext,
|
|
4207
|
+
service,
|
|
4208
|
+
xNode
|
|
4209
|
+
});
|
|
4210
|
+
setActionData(runRes?.result);
|
|
4211
|
+
return runRes?.result;
|
|
4212
|
+
} else {
|
|
4213
|
+
setActionData(loadRes?.result);
|
|
4214
|
+
return loadRes?.result;
|
|
4215
|
+
}
|
|
4216
|
+
} catch (err) {
|
|
4217
|
+
console.error("callAction error:", err);
|
|
4218
|
+
return void 0;
|
|
4219
|
+
}
|
|
4220
|
+
},
|
|
4221
|
+
[env?.context?.lang]
|
|
4222
|
+
);
|
|
4223
|
+
return [actionData, callAction];
|
|
4224
|
+
};
|
|
4225
|
+
|
|
4176
4226
|
// src/utils.ts
|
|
4177
4227
|
var utils_exports = {};
|
|
4178
4228
|
__export(utils_exports, {
|
|
@@ -4194,7 +4244,7 @@ var languages = [
|
|
|
4194
4244
|
];
|
|
4195
4245
|
|
|
4196
4246
|
// src/utils/function.ts
|
|
4197
|
-
var
|
|
4247
|
+
var import_react2 = require("react");
|
|
4198
4248
|
var countSum = (data, field) => {
|
|
4199
4249
|
if (!data || !field) return 0;
|
|
4200
4250
|
return data.reduce(
|
|
@@ -4315,7 +4365,7 @@ var STORAGES = {
|
|
|
4315
4365
|
USER_INFO: "USER_INFO"
|
|
4316
4366
|
};
|
|
4317
4367
|
function useAsyncState(initialValue = [true, null]) {
|
|
4318
|
-
return (0,
|
|
4368
|
+
return (0, import_react2.useReducer)(
|
|
4319
4369
|
(_state, action = null) => [false, action],
|
|
4320
4370
|
initialValue
|
|
4321
4371
|
);
|
|
@@ -4333,7 +4383,7 @@ async function setStorageItemAsync(key, value) {
|
|
|
4333
4383
|
}
|
|
4334
4384
|
function useStorageState(key) {
|
|
4335
4385
|
const [state, setState] = useAsyncState();
|
|
4336
|
-
(0,
|
|
4386
|
+
(0, import_react2.useEffect)(() => {
|
|
4337
4387
|
try {
|
|
4338
4388
|
const storedValue = localStorage.getItem(key);
|
|
4339
4389
|
setState(storedValue);
|
|
@@ -4341,7 +4391,7 @@ function useStorageState(key) {
|
|
|
4341
4391
|
console.error("Local storage is unavailable:", e);
|
|
4342
4392
|
}
|
|
4343
4393
|
}, [key]);
|
|
4344
|
-
const setValue = (0,
|
|
4394
|
+
const setValue = (0, import_react2.useCallback)(
|
|
4345
4395
|
(value) => {
|
|
4346
4396
|
setState(value);
|
|
4347
4397
|
setStorageItemAsync(key, value);
|
|
@@ -4354,58 +4404,6 @@ function useStorageState(key) {
|
|
|
4354
4404
|
// src/utils.ts
|
|
4355
4405
|
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
4356
4406
|
|
|
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
4407
|
// src/hooks/core/use-menu.ts
|
|
4410
4408
|
var useMenu = ({
|
|
4411
4409
|
context,
|
|
@@ -4442,7 +4440,8 @@ var useMenu = ({
|
|
|
4442
4440
|
const handleChangeMenu = async ({
|
|
4443
4441
|
menu,
|
|
4444
4442
|
service: service2,
|
|
4445
|
-
xNode: xNode2
|
|
4443
|
+
xNode: xNode2,
|
|
4444
|
+
context: context2
|
|
4446
4445
|
}) => {
|
|
4447
4446
|
const aidMenu = menu?.action?.id?.id;
|
|
4448
4447
|
if (menu) {
|
|
@@ -4452,7 +4451,8 @@ var useMenu = ({
|
|
|
4452
4451
|
const actionResponse = await callAction({
|
|
4453
4452
|
aid: Number(aidMenu),
|
|
4454
4453
|
service: service2 ?? "",
|
|
4455
|
-
xNode: xNode2
|
|
4454
|
+
xNode: xNode2,
|
|
4455
|
+
context: context2
|
|
4456
4456
|
});
|
|
4457
4457
|
setService(service2 ?? "");
|
|
4458
4458
|
setXNode(xNode2 ?? "");
|
|
@@ -4812,7 +4812,7 @@ var useGetSpecification = ({
|
|
|
4812
4812
|
|
|
4813
4813
|
// src/hooks/core/use-list-data.ts
|
|
4814
4814
|
var import_react14 = require("react");
|
|
4815
|
-
var
|
|
4815
|
+
var import_utils5 = require("@fctc/interface-logic/utils");
|
|
4816
4816
|
|
|
4817
4817
|
// src/hooks/utils/use-click-outside.ts
|
|
4818
4818
|
var import_react11 = require("react");
|
|
@@ -4953,12 +4953,12 @@ var useListData = ({
|
|
|
4953
4953
|
if (!viewData || !action || !context) {
|
|
4954
4954
|
return null;
|
|
4955
4955
|
}
|
|
4956
|
-
const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0,
|
|
4956
|
+
const domainParse = domain ? [...domain] : action?.domain ? Array.isArray(action?.domain) ? [...action?.domain] : (0, import_utils5.evalJSONDomain)(action?.domain, context) : [];
|
|
4957
4957
|
const limit = pageLimit;
|
|
4958
4958
|
const offset = debouncedPage * pageLimit;
|
|
4959
4959
|
const fields = typeof groupByList === "object" ? groupByList?.fields : void 0;
|
|
4960
4960
|
const groupby = typeof groupByList === "object" ? [groupByList?.contexts?.[0]?.group_by] : [];
|
|
4961
|
-
const sort = order ? order : viewData?.views?.list?.default_order ? (0,
|
|
4961
|
+
const sort = order ? order : viewData?.views?.list?.default_order ? (0, import_utils5.formatSortingString)(viewData?.views?.list?.default_order) : "";
|
|
4962
4962
|
return {
|
|
4963
4963
|
model: action?.res_model,
|
|
4964
4964
|
specification,
|
|
@@ -4980,7 +4980,7 @@ var useListData = ({
|
|
|
4980
4980
|
listDataProps?.offset,
|
|
4981
4981
|
listDataProps?.sort
|
|
4982
4982
|
],
|
|
4983
|
-
!!listDataProps && !!specification && !(0,
|
|
4983
|
+
!!listDataProps && !!specification && !(0, import_utils5.isObjectEmpty)(specification) && !!domain,
|
|
4984
4984
|
service,
|
|
4985
4985
|
xNode
|
|
4986
4986
|
);
|
|
@@ -5482,18 +5482,18 @@ var many2oneFieldController = (props) => {
|
|
|
5482
5482
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5483
5483
|
var import_environment2 = require("@fctc/interface-logic/environment");
|
|
5484
5484
|
var import_hooks6 = require("@fctc/interface-logic/hooks");
|
|
5485
|
-
var
|
|
5485
|
+
var import_utils8 = require("@fctc/interface-logic/utils");
|
|
5486
5486
|
var many2oneButtonController = (props) => {
|
|
5487
5487
|
const { domain, methods, relation, service, xNode } = props;
|
|
5488
5488
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5489
5489
|
const env = (0, import_environment2.getEnv)();
|
|
5490
|
-
const domainObject = (0,
|
|
5490
|
+
const domainObject = (0, import_utils8.evalJSONDomain)(domain, methods?.getValues() || {});
|
|
5491
5491
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5492
5492
|
const { data: dataOfSelection } = (0, import_hooks6.useGetSelection)({
|
|
5493
5493
|
data: {
|
|
5494
5494
|
model: relation ?? "",
|
|
5495
5495
|
domain: domainObject,
|
|
5496
|
-
context: { ...env.context, ...(0,
|
|
5496
|
+
context: { ...env.context, ...(0, import_utils8.evalJSONContext)(actionData?.context) }
|
|
5497
5497
|
},
|
|
5498
5498
|
queryKey: [`data_${relation}`, domainObject],
|
|
5499
5499
|
service,
|
|
@@ -5510,24 +5510,20 @@ var many2oneButtonController = (props) => {
|
|
|
5510
5510
|
|
|
5511
5511
|
// src/widget/basic/many2many-field/controller.ts
|
|
5512
5512
|
var import_react17 = require("react");
|
|
5513
|
-
var
|
|
5513
|
+
var import_utils9 = require("@fctc/interface-logic/utils");
|
|
5514
5514
|
var many2manyFieldController = (props) => {
|
|
5515
5515
|
const {
|
|
5516
5516
|
relation,
|
|
5517
5517
|
domain,
|
|
5518
5518
|
context,
|
|
5519
5519
|
options,
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
groupByDomain,
|
|
5523
|
-
enabled: enabledCallAPI
|
|
5520
|
+
enabled: enabledCallAPI,
|
|
5521
|
+
service
|
|
5524
5522
|
} = props;
|
|
5525
5523
|
const { env } = (0, provider_exports.useEnv)();
|
|
5526
|
-
const {
|
|
5527
|
-
const
|
|
5528
|
-
const
|
|
5529
|
-
const [domainMany2Many, setDomainMany2Many] = (0, import_react17.useState)(null);
|
|
5530
|
-
const [debouncedPage] = useDebounce(page, 500);
|
|
5524
|
+
const { user } = useAppProvider();
|
|
5525
|
+
const { useGetView: useGetView2 } = (0, provider_exports.useService)();
|
|
5526
|
+
const dataUser = user?.userProfile?.data;
|
|
5531
5527
|
const contextObject = {
|
|
5532
5528
|
...env.context,
|
|
5533
5529
|
...context || {}
|
|
@@ -5544,61 +5540,46 @@ var many2manyFieldController = (props) => {
|
|
|
5544
5540
|
viewParams,
|
|
5545
5541
|
enabled: enabledCallAPI
|
|
5546
5542
|
});
|
|
5547
|
-
const { specification } = useGetSpecification({
|
|
5548
|
-
model: String(relation),
|
|
5549
|
-
viewData: viewResponse || {},
|
|
5550
|
-
fields: [
|
|
5551
|
-
...Object.values(viewResponse?.views?.list?.fields ?? {}),
|
|
5552
|
-
...tab?.fields ? tab.fields : []
|
|
5553
|
-
]
|
|
5554
|
-
});
|
|
5555
5543
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5556
|
-
const optionsObject =
|
|
5557
|
-
const fetchData = async () => {
|
|
5558
|
-
try {
|
|
5559
|
-
const domainParse = typeof domain === "string" ? (0, import_utils10.evalJSONDomain)(domain, contextObject) : Array.isArray(domain) ? domain : [];
|
|
5560
|
-
setDomainMany2Many(domainParse);
|
|
5561
|
-
setPage(0);
|
|
5562
|
-
} catch (err) {
|
|
5563
|
-
console.log(err);
|
|
5564
|
-
}
|
|
5565
|
-
};
|
|
5566
|
-
const queryKey = [
|
|
5567
|
-
`view-${relation}`,
|
|
5568
|
-
specification,
|
|
5569
|
-
domainMany2Many,
|
|
5570
|
-
debouncedPage,
|
|
5571
|
-
groupByDomain,
|
|
5572
|
-
order
|
|
5573
|
-
];
|
|
5574
|
-
const data = {
|
|
5575
|
-
model: relation,
|
|
5576
|
-
specification,
|
|
5577
|
-
domain: domainMany2Many,
|
|
5578
|
-
offset: debouncedPage * 10,
|
|
5579
|
-
limit: 10,
|
|
5580
|
-
context: contextObject,
|
|
5581
|
-
fields: groupByDomain?.fields,
|
|
5582
|
-
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5583
|
-
sort: order ? order : default_order ? (0, import_utils10.formatSortingString)(default_order) : ""
|
|
5584
|
-
};
|
|
5585
|
-
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5544
|
+
const optionsObject = (options && typeof options === "string" ? (0, import_utils9.evalJSONContext)(options) : options) || {};
|
|
5586
5545
|
const {
|
|
5587
5546
|
data: dataResponse,
|
|
5588
|
-
isLoading,
|
|
5589
5547
|
isFetched,
|
|
5548
|
+
isLoading,
|
|
5549
|
+
state,
|
|
5590
5550
|
isPlaceholderData
|
|
5591
|
-
} =
|
|
5551
|
+
} = useListData({
|
|
5552
|
+
action: {
|
|
5553
|
+
domain,
|
|
5554
|
+
res_model: relation
|
|
5555
|
+
},
|
|
5556
|
+
context: contextObject,
|
|
5557
|
+
model: relation ?? "",
|
|
5558
|
+
viewData: viewResponse,
|
|
5559
|
+
service,
|
|
5560
|
+
xNode: service == "wesap" && dataUser.x_node
|
|
5561
|
+
});
|
|
5562
|
+
const {
|
|
5563
|
+
selectedRowKeys,
|
|
5564
|
+
groupByList,
|
|
5565
|
+
domain: domainList,
|
|
5566
|
+
page,
|
|
5567
|
+
pageLimit,
|
|
5568
|
+
setDomain,
|
|
5569
|
+
setOrder,
|
|
5570
|
+
setPage,
|
|
5571
|
+
setSelectedRowKeys,
|
|
5572
|
+
setGroupByList,
|
|
5573
|
+
setPageLimit
|
|
5574
|
+
} = state;
|
|
5592
5575
|
(0, import_react17.useEffect)(() => {
|
|
5593
|
-
if (viewResponse) {
|
|
5594
|
-
fetchData();
|
|
5595
|
-
}
|
|
5596
5576
|
return () => {
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5577
|
+
setDomain(null);
|
|
5578
|
+
setOrder("");
|
|
5579
|
+
setGroupByList(null);
|
|
5580
|
+
setPageLimit(10);
|
|
5600
5581
|
};
|
|
5601
|
-
}, [
|
|
5582
|
+
}, []);
|
|
5602
5583
|
const { rows, columns, typeTable, onToggleColumnOptional } = tableController({
|
|
5603
5584
|
data: {
|
|
5604
5585
|
fields: viewResponse?.views?.list?.fields,
|
|
@@ -5622,29 +5603,35 @@ var many2manyFieldController = (props) => {
|
|
|
5622
5603
|
const handleCreateNewOnPage = async () => {
|
|
5623
5604
|
};
|
|
5624
5605
|
return {
|
|
5625
|
-
handleCreateNewOnPage,
|
|
5626
|
-
optionsObject,
|
|
5627
|
-
totalRows: dataResponse?.length ?? 0,
|
|
5628
5606
|
rows,
|
|
5629
5607
|
columns,
|
|
5608
|
+
optionsObject,
|
|
5609
|
+
viewData: viewResponse,
|
|
5610
|
+
totalRows: dataResponse?.length ?? 0,
|
|
5630
5611
|
onToggleColumnOptional,
|
|
5631
5612
|
typeTable,
|
|
5632
5613
|
isLoading,
|
|
5633
5614
|
isFetched,
|
|
5634
5615
|
isPlaceholderData,
|
|
5635
|
-
setPage,
|
|
5636
5616
|
page,
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5617
|
+
pageLimit,
|
|
5618
|
+
groupByList,
|
|
5619
|
+
selectedRowKeys,
|
|
5620
|
+
domain: domainList,
|
|
5621
|
+
setPage,
|
|
5622
|
+
setDomain,
|
|
5623
|
+
setPageLimit,
|
|
5624
|
+
setGroupByList,
|
|
5625
|
+
setSelectedRowKeys,
|
|
5626
|
+
searchController: searchControllers,
|
|
5627
|
+
handleCreateNewOnPage
|
|
5641
5628
|
};
|
|
5642
5629
|
};
|
|
5643
5630
|
|
|
5644
5631
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5645
5632
|
var import_react18 = require("react");
|
|
5646
5633
|
var import_constants2 = require("@fctc/interface-logic/constants");
|
|
5647
|
-
var
|
|
5634
|
+
var import_utils10 = require("@fctc/interface-logic/utils");
|
|
5648
5635
|
var many2manyTagsController = (props) => {
|
|
5649
5636
|
const {
|
|
5650
5637
|
relation,
|
|
@@ -5659,9 +5646,9 @@ var many2manyTagsController = (props) => {
|
|
|
5659
5646
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5660
5647
|
const { env } = (0, provider_exports.useEnv)();
|
|
5661
5648
|
const { useGetSelection: useGetSelection3 } = (0, provider_exports.useService)();
|
|
5662
|
-
const addtionalFields = optionsFields ? (0,
|
|
5649
|
+
const addtionalFields = optionsFields ? (0, import_utils10.evalJSONContext)(optionsFields) : null;
|
|
5663
5650
|
const domainObject = (0, import_react18.useMemo)(
|
|
5664
|
-
() => (0,
|
|
5651
|
+
() => (0, import_utils10.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5665
5652
|
[domain, formValues]
|
|
5666
5653
|
);
|
|
5667
5654
|
const data = {
|
|
@@ -5705,7 +5692,7 @@ var many2manyTagsController = (props) => {
|
|
|
5705
5692
|
|
|
5706
5693
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5707
5694
|
var import_react19 = require("react");
|
|
5708
|
-
var
|
|
5695
|
+
var import_utils11 = require("@fctc/interface-logic/utils");
|
|
5709
5696
|
var durationController = (props) => {
|
|
5710
5697
|
const { relation, domain, formValues, name, id, model, onRefetch, enabled } = props;
|
|
5711
5698
|
const specification = {
|
|
@@ -5721,7 +5708,7 @@ var durationController = (props) => {
|
|
|
5721
5708
|
const listDataProps = {
|
|
5722
5709
|
model: relation,
|
|
5723
5710
|
specification,
|
|
5724
|
-
domain: (0,
|
|
5711
|
+
domain: (0, import_utils11.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
|
|
5725
5712
|
limit: 10,
|
|
5726
5713
|
offset: 0,
|
|
5727
5714
|
fields: "",
|
|
@@ -5771,10 +5758,10 @@ var durationController = (props) => {
|
|
|
5771
5758
|
};
|
|
5772
5759
|
|
|
5773
5760
|
// src/widget/basic/priority-field/controller.ts
|
|
5774
|
-
var
|
|
5761
|
+
var import_utils12 = require("@fctc/interface-logic/utils");
|
|
5775
5762
|
var priorityFieldController = (props) => {
|
|
5776
5763
|
const { name, model, index, actionData, context, onChange, specification } = props;
|
|
5777
|
-
const _context = { ...(0,
|
|
5764
|
+
const _context = { ...(0, import_utils12.evalJSONContext)(actionData?.context) };
|
|
5778
5765
|
const contextObject = { ...context, ..._context };
|
|
5779
5766
|
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
5780
5767
|
const { mutateAsync: fetchSave } = useSave3();
|
|
@@ -6742,12 +6729,12 @@ var dateFieldController = (props) => {
|
|
|
6742
6729
|
|
|
6743
6730
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6744
6731
|
var import_react21 = require("react");
|
|
6745
|
-
var
|
|
6732
|
+
var import_utils13 = require("@fctc/interface-logic/utils");
|
|
6746
6733
|
var copyLinkButtonController = (props) => {
|
|
6747
6734
|
const { value, defaultValue } = props;
|
|
6748
6735
|
const [isCopied, setIsCopied] = (0, import_react21.useState)(false);
|
|
6749
6736
|
const handleCopyToClipboard = async (value2) => {
|
|
6750
|
-
await (0,
|
|
6737
|
+
await (0, import_utils13.copyTextToClipboard)(value2);
|
|
6751
6738
|
setIsCopied(true);
|
|
6752
6739
|
setTimeout(() => setIsCopied(false), 2e3);
|
|
6753
6740
|
};
|
|
@@ -6760,12 +6747,12 @@ var copyLinkButtonController = (props) => {
|
|
|
6760
6747
|
};
|
|
6761
6748
|
|
|
6762
6749
|
// src/widget/basic/color-field/color-controller.ts
|
|
6763
|
-
var
|
|
6750
|
+
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6764
6751
|
var colorFieldController = (props) => {
|
|
6765
6752
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6766
6753
|
const { env } = (0, provider_exports.useEnv)();
|
|
6767
6754
|
const { useSave: useSave3 } = (0, provider_exports.useService)();
|
|
6768
|
-
const _context = { ...(0,
|
|
6755
|
+
const _context = { ...(0, import_utils14.evalJSONContext)(actionData?.context) || {} };
|
|
6769
6756
|
const contextObject = { ...env.context, ..._context };
|
|
6770
6757
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6771
6758
|
const { mutate: onSave } = useSave3();
|
|
@@ -6794,7 +6781,7 @@ var colorFieldController = (props) => {
|
|
|
6794
6781
|
|
|
6795
6782
|
// src/widget/basic/binary-field/controller.ts
|
|
6796
6783
|
var import_react22 = require("react");
|
|
6797
|
-
var
|
|
6784
|
+
var import_utils15 = require("@fctc/interface-logic/utils");
|
|
6798
6785
|
var binaryFieldController = (props) => {
|
|
6799
6786
|
const { name, methods, readonly = false, value } = props;
|
|
6800
6787
|
const inputId = (0, import_react22.useId)();
|
|
@@ -6851,11 +6838,11 @@ var binaryFieldController = (props) => {
|
|
|
6851
6838
|
};
|
|
6852
6839
|
const checkIsImageLink = (url) => {
|
|
6853
6840
|
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
6854
|
-
return imageExtensions.test(url) || (0,
|
|
6841
|
+
return imageExtensions.test(url) || (0, import_utils15.isBase64Image)(url) || isBlobUrl(url);
|
|
6855
6842
|
};
|
|
6856
6843
|
const getImageBase64WithMimeType = (base64) => {
|
|
6857
6844
|
if (typeof base64 !== "string" || base64.length < 10) return null;
|
|
6858
|
-
if ((0,
|
|
6845
|
+
if ((0, import_utils15.isBase64Image)(base64)) return base64;
|
|
6859
6846
|
let mimeType = null;
|
|
6860
6847
|
if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
|
|
6861
6848
|
else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
|
|
@@ -6958,7 +6945,7 @@ var tableHeadController = (props) => {
|
|
|
6958
6945
|
|
|
6959
6946
|
// src/widget/advance/table/table-view/controller.ts
|
|
6960
6947
|
var import_react24 = require("react");
|
|
6961
|
-
var
|
|
6948
|
+
var import_utils17 = require("@fctc/interface-logic/utils");
|
|
6962
6949
|
var tableController = ({ data }) => {
|
|
6963
6950
|
const [rows, setRows] = (0, import_react24.useState)(null);
|
|
6964
6951
|
const [columns, setColumns] = (0, import_react24.useState)(null);
|
|
@@ -6996,7 +6983,7 @@ var tableController = ({ data }) => {
|
|
|
6996
6983
|
let cols = [];
|
|
6997
6984
|
try {
|
|
6998
6985
|
cols = mergeFields?.filter((item) => {
|
|
6999
|
-
return item?.widget !== "details_Receive_money" && !(item?.column_invisible ?
|
|
6986
|
+
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);
|
|
7000
6987
|
})?.map((field) => {
|
|
7001
6988
|
return {
|
|
7002
6989
|
name: field?.name,
|
|
@@ -7181,7 +7168,7 @@ var tableGroupController = (props) => {
|
|
|
7181
7168
|
|
|
7182
7169
|
// src/widget/advance/search/controller.ts
|
|
7183
7170
|
var import_constants3 = require("@fctc/interface-logic/constants");
|
|
7184
|
-
var
|
|
7171
|
+
var import_utils19 = require("@fctc/interface-logic/utils");
|
|
7185
7172
|
var import_moment2 = __toESM(require_moment());
|
|
7186
7173
|
var import_react26 = require("react");
|
|
7187
7174
|
var searchController = ({
|
|
@@ -7198,9 +7185,9 @@ var searchController = ({
|
|
|
7198
7185
|
const [selectedTags, setSelectedTags] = (0, import_react26.useState)(null);
|
|
7199
7186
|
const [searchString, setSearchString] = (0, import_react26.useState)("");
|
|
7200
7187
|
const [searchMap, setSearchMap] = (0, import_react26.useState)({});
|
|
7201
|
-
const actionContext = typeof context === "string" ? (0,
|
|
7188
|
+
const actionContext = typeof context === "string" ? (0, import_utils19.evalJSONContext)(context) : context;
|
|
7202
7189
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7203
|
-
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0,
|
|
7190
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils19.evalJSONDomain)(domain, contextSearch) : [];
|
|
7204
7191
|
const clearSearch = () => {
|
|
7205
7192
|
setFilterBy([]);
|
|
7206
7193
|
setGroupBy([]);
|
|
@@ -7215,7 +7202,7 @@ var searchController = ({
|
|
|
7215
7202
|
const dataModel = viewData?.models?.[model];
|
|
7216
7203
|
const searchViews = viewData?.views?.search;
|
|
7217
7204
|
const searchByItems = searchViews?.search_by?.filter(
|
|
7218
|
-
(item) => !
|
|
7205
|
+
(item) => !import_utils19.domainHelper.matchDomains(contextSearch, item.invisible)
|
|
7219
7206
|
)?.map(
|
|
7220
7207
|
({ string, name, filter_domain, operator, widget }, index) => ({
|
|
7221
7208
|
dataIndex: index,
|
|
@@ -7228,10 +7215,10 @@ var searchController = ({
|
|
|
7228
7215
|
})
|
|
7229
7216
|
);
|
|
7230
7217
|
const filterByItems = searchViews?.filter_by.filter((item) => {
|
|
7231
|
-
return !
|
|
7218
|
+
return !import_utils19.domainHelper.matchDomains(contextSearch, item?.invisible);
|
|
7232
7219
|
})?.map((item) => ({ ...item, active: false }));
|
|
7233
7220
|
const groupByItems = searchViews?.group_by.filter(
|
|
7234
|
-
(item) => !
|
|
7221
|
+
(item) => !import_utils19.domainHelper.matchDomains(contextSearch, item?.invisible)
|
|
7235
7222
|
).map((item) => ({
|
|
7236
7223
|
...item,
|
|
7237
7224
|
string: item.string ?? viewData?.models?.[model]?.[item?.name?.split("group_by_")?.[1]]?.string
|
|
@@ -7308,14 +7295,14 @@ var searchController = ({
|
|
|
7308
7295
|
}
|
|
7309
7296
|
let valueDomainItem = value?.value;
|
|
7310
7297
|
if (value?.modelType === "date") {
|
|
7311
|
-
valueDomainItem = (0,
|
|
7298
|
+
valueDomainItem = (0, import_utils19.validateAndParseDate)(value?.value);
|
|
7312
7299
|
} else if (value?.modelType === "datetime") {
|
|
7313
7300
|
if (value?.operator === "<=" || value?.operator === "<") {
|
|
7314
|
-
const parsedDate = (0,
|
|
7301
|
+
const parsedDate = (0, import_utils19.validateAndParseDate)(value?.value, true);
|
|
7315
7302
|
const hasTime = (0, import_moment2.default)(value?.value).format("HH:mm:ss") !== "00:00:00";
|
|
7316
7303
|
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");
|
|
7317
7304
|
} else {
|
|
7318
|
-
valueDomainItem = (0,
|
|
7305
|
+
valueDomainItem = (0, import_utils19.validateAndParseDate)(value?.value, true);
|
|
7319
7306
|
}
|
|
7320
7307
|
}
|
|
7321
7308
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
@@ -7394,7 +7381,7 @@ var searchController = ({
|
|
|
7394
7381
|
}, [searchMap]);
|
|
7395
7382
|
const handleAddTagSearch = (tag) => {
|
|
7396
7383
|
const { domain: domain2, groupIndex, value, type, context: context2, dataIndex } = tag;
|
|
7397
|
-
const domainFormat = new
|
|
7384
|
+
const domainFormat = new import_utils19.domainHelper.Domain(domain2);
|
|
7398
7385
|
if (type === import_constants3.SearchType.FILTER) {
|
|
7399
7386
|
addSearchItems(`${import_constants3.SearchType.FILTER}_${groupIndex}`, {
|
|
7400
7387
|
...tag,
|