@fctc/widget-logic 1.10.5 → 1.10.7
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/index.js +27 -29
- package/dist/index.mjs +27 -29
- package/dist/widget.d.mts +7 -1
- package/dist/widget.d.ts +7 -1
- package/dist/widget.js +27 -29
- package/dist/widget.mjs +27 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5449,7 +5449,6 @@ var many2manyFieldController = (props) => {
|
|
|
5449
5449
|
const { env } = (0, provider_exports.useEnv)();
|
|
5450
5450
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5451
5451
|
const [order, setOrder] = (0, import_react15.useState)();
|
|
5452
|
-
const [isLoadedData, setIsLoadedData] = (0, import_react15.useState)(false);
|
|
5453
5452
|
const [page, setPage] = (0, import_react15.useState)(0);
|
|
5454
5453
|
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(null);
|
|
5455
5454
|
const [debouncedPage] = useDebounce(page, 500);
|
|
@@ -5521,7 +5520,7 @@ var many2manyFieldController = (props) => {
|
|
|
5521
5520
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5522
5521
|
sort: order ? order : default_order ? (0, import_utils6.formatSortingString)(default_order) : ""
|
|
5523
5522
|
};
|
|
5524
|
-
const enabled = enabledCallAPI &&
|
|
5523
|
+
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5525
5524
|
const {
|
|
5526
5525
|
data: dataResponse,
|
|
5527
5526
|
isLoading,
|
|
@@ -5536,7 +5535,6 @@ var many2manyFieldController = (props) => {
|
|
|
5536
5535
|
setPage(0);
|
|
5537
5536
|
setSelectedRowKeys4([]);
|
|
5538
5537
|
setDomainMany2Many(null);
|
|
5539
|
-
setIsLoadedData(false);
|
|
5540
5538
|
};
|
|
5541
5539
|
}, [viewResponse]);
|
|
5542
5540
|
const { rows, columns, typeTable, onToggleColumnOptional } = tableController({
|
|
@@ -5550,18 +5548,15 @@ var many2manyFieldController = (props) => {
|
|
|
5550
5548
|
});
|
|
5551
5549
|
const searchControllers = searchController({
|
|
5552
5550
|
viewData: viewResponse,
|
|
5553
|
-
|
|
5551
|
+
model: relation ?? "",
|
|
5552
|
+
context: contextObject,
|
|
5553
|
+
domain,
|
|
5554
5554
|
fieldsList: [
|
|
5555
5555
|
...columns?.filter(
|
|
5556
5556
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
5557
5557
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
5558
5558
|
]
|
|
5559
5559
|
});
|
|
5560
|
-
(0, import_react15.useEffect)(() => {
|
|
5561
|
-
if (domainMany2Many && !isLoadedData) {
|
|
5562
|
-
setIsLoadedData(true);
|
|
5563
|
-
}
|
|
5564
|
-
}, [domainMany2Many]);
|
|
5565
5560
|
const handleCreateNewOnPage = async () => {
|
|
5566
5561
|
};
|
|
5567
5562
|
return {
|
|
@@ -7204,7 +7199,13 @@ var import_constants5 = require("@fctc/interface-logic/constants");
|
|
|
7204
7199
|
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
7205
7200
|
var import_moment2 = __toESM(require_moment());
|
|
7206
7201
|
var import_react24 = require("react");
|
|
7207
|
-
var searchController = ({
|
|
7202
|
+
var searchController = ({
|
|
7203
|
+
viewData,
|
|
7204
|
+
model,
|
|
7205
|
+
domain,
|
|
7206
|
+
context,
|
|
7207
|
+
fieldsList
|
|
7208
|
+
}) => {
|
|
7208
7209
|
const { env } = (0, provider_exports.useEnv)();
|
|
7209
7210
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
7210
7211
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
@@ -7212,12 +7213,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7212
7213
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7213
7214
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7214
7215
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
7215
|
-
const { context } = actionData || {};
|
|
7216
7216
|
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
7217
7217
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7218
|
-
const domainAction =
|
|
7219
|
-
const aid = actionData?.id;
|
|
7220
|
-
const model = actionData?.res_model;
|
|
7218
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
7221
7219
|
const clearSearch = () => {
|
|
7222
7220
|
setFilterBy([]);
|
|
7223
7221
|
setGroupBy([]);
|
|
@@ -7263,7 +7261,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7263
7261
|
};
|
|
7264
7262
|
(0, import_react24.useEffect)(() => {
|
|
7265
7263
|
fetchData();
|
|
7266
|
-
}, [
|
|
7264
|
+
}, [model, viewData]);
|
|
7267
7265
|
const onChangeSearchInput = (search_string) => {
|
|
7268
7266
|
setSearchString(search_string);
|
|
7269
7267
|
};
|
|
@@ -7300,27 +7298,28 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7300
7298
|
};
|
|
7301
7299
|
const formatDomain = () => {
|
|
7302
7300
|
if (domainAction) {
|
|
7303
|
-
|
|
7301
|
+
console.log("domainAction", domainAction);
|
|
7302
|
+
const domain2 = [];
|
|
7304
7303
|
if (domainAction?.length > 0) {
|
|
7305
7304
|
if (Object.keys(searchMap).length > 0) {
|
|
7306
|
-
|
|
7305
|
+
domain2.push("&");
|
|
7307
7306
|
}
|
|
7308
7307
|
domainAction.forEach((domainItem) => {
|
|
7309
|
-
|
|
7308
|
+
domain2.push(domainItem);
|
|
7310
7309
|
});
|
|
7311
7310
|
}
|
|
7312
7311
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7313
7312
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7314
7313
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7315
|
-
|
|
7314
|
+
domain2.push("&");
|
|
7316
7315
|
}
|
|
7317
7316
|
const valuesOfKey = searchMap[key];
|
|
7318
7317
|
valuesOfKey.forEach((value, index) => {
|
|
7319
7318
|
if (index < valuesOfKey.length - 1) {
|
|
7320
|
-
|
|
7319
|
+
domain2.push("|");
|
|
7321
7320
|
}
|
|
7322
7321
|
if (value.domain) {
|
|
7323
|
-
|
|
7322
|
+
domain2.push(...value.domain);
|
|
7324
7323
|
return;
|
|
7325
7324
|
}
|
|
7326
7325
|
let valueDomainItem = value?.value;
|
|
@@ -7336,11 +7335,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7336
7335
|
}
|
|
7337
7336
|
}
|
|
7338
7337
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7339
|
-
|
|
7338
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7340
7339
|
});
|
|
7341
7340
|
}
|
|
7342
7341
|
});
|
|
7343
|
-
return [...
|
|
7342
|
+
return [...domain2];
|
|
7344
7343
|
}
|
|
7345
7344
|
};
|
|
7346
7345
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7407,12 +7406,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7407
7406
|
[searchMap]
|
|
7408
7407
|
);
|
|
7409
7408
|
(0, import_react24.useEffect)(() => {
|
|
7410
|
-
setSelectedTags(null);
|
|
7411
7409
|
setTagSearch(searchMap);
|
|
7412
7410
|
}, [searchMap]);
|
|
7413
7411
|
const handleAddTagSearch = (tag) => {
|
|
7414
7412
|
const {
|
|
7415
|
-
domain,
|
|
7413
|
+
domain: domain2,
|
|
7416
7414
|
groupIndex,
|
|
7417
7415
|
value,
|
|
7418
7416
|
type,
|
|
@@ -7421,16 +7419,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7421
7419
|
active,
|
|
7422
7420
|
dataIndex
|
|
7423
7421
|
} = tag;
|
|
7424
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7422
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain2);
|
|
7425
7423
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7426
7424
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7427
7425
|
...tag,
|
|
7428
|
-
domain:
|
|
7426
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7429
7427
|
});
|
|
7430
7428
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7431
7429
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7432
7430
|
...tag,
|
|
7433
|
-
domain:
|
|
7431
|
+
domain: domain2 ? domainFormat.toList({
|
|
7434
7432
|
...context2,
|
|
7435
7433
|
self: value
|
|
7436
7434
|
}) : null
|
|
@@ -7438,7 +7436,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7438
7436
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7439
7437
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7440
7438
|
...tag,
|
|
7441
|
-
domain:
|
|
7439
|
+
domain: domain2 ? domainFormat.toList({
|
|
7442
7440
|
context: context2,
|
|
7443
7441
|
self: value
|
|
7444
7442
|
}) : null
|
package/dist/index.mjs
CHANGED
|
@@ -5483,7 +5483,6 @@ var many2manyFieldController = (props) => {
|
|
|
5483
5483
|
const { env } = (0, provider_exports.useEnv)();
|
|
5484
5484
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5485
5485
|
const [order, setOrder] = useState8();
|
|
5486
|
-
const [isLoadedData, setIsLoadedData] = useState8(false);
|
|
5487
5486
|
const [page, setPage] = useState8(0);
|
|
5488
5487
|
const [domainMany2Many, setDomainMany2Many] = useState8(null);
|
|
5489
5488
|
const [debouncedPage] = useDebounce(page, 500);
|
|
@@ -5555,7 +5554,7 @@ var many2manyFieldController = (props) => {
|
|
|
5555
5554
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5556
5555
|
sort: order ? order : default_order ? formatSortingString2(default_order) : ""
|
|
5557
5556
|
};
|
|
5558
|
-
const enabled = enabledCallAPI &&
|
|
5557
|
+
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5559
5558
|
const {
|
|
5560
5559
|
data: dataResponse,
|
|
5561
5560
|
isLoading,
|
|
@@ -5570,7 +5569,6 @@ var many2manyFieldController = (props) => {
|
|
|
5570
5569
|
setPage(0);
|
|
5571
5570
|
setSelectedRowKeys4([]);
|
|
5572
5571
|
setDomainMany2Many(null);
|
|
5573
|
-
setIsLoadedData(false);
|
|
5574
5572
|
};
|
|
5575
5573
|
}, [viewResponse]);
|
|
5576
5574
|
const { rows, columns, typeTable, onToggleColumnOptional } = tableController({
|
|
@@ -5584,18 +5582,15 @@ var many2manyFieldController = (props) => {
|
|
|
5584
5582
|
});
|
|
5585
5583
|
const searchControllers = searchController({
|
|
5586
5584
|
viewData: viewResponse,
|
|
5587
|
-
|
|
5585
|
+
model: relation ?? "",
|
|
5586
|
+
context: contextObject,
|
|
5587
|
+
domain,
|
|
5588
5588
|
fieldsList: [
|
|
5589
5589
|
...columns?.filter(
|
|
5590
5590
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
5591
5591
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
5592
5592
|
]
|
|
5593
5593
|
});
|
|
5594
|
-
useEffect11(() => {
|
|
5595
|
-
if (domainMany2Many && !isLoadedData) {
|
|
5596
|
-
setIsLoadedData(true);
|
|
5597
|
-
}
|
|
5598
|
-
}, [domainMany2Many]);
|
|
5599
5594
|
const handleCreateNewOnPage = async () => {
|
|
5600
5595
|
};
|
|
5601
5596
|
return {
|
|
@@ -7262,7 +7257,13 @@ import {
|
|
|
7262
7257
|
validateAndParseDate
|
|
7263
7258
|
} from "@fctc/interface-logic/utils";
|
|
7264
7259
|
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
7265
|
-
var searchController = ({
|
|
7260
|
+
var searchController = ({
|
|
7261
|
+
viewData,
|
|
7262
|
+
model,
|
|
7263
|
+
domain,
|
|
7264
|
+
context,
|
|
7265
|
+
fieldsList
|
|
7266
|
+
}) => {
|
|
7266
7267
|
const { env } = (0, provider_exports.useEnv)();
|
|
7267
7268
|
const [filterBy, setFilterBy] = useState15(null);
|
|
7268
7269
|
const [searchBy, setSearchBy] = useState15(null);
|
|
@@ -7270,12 +7271,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7270
7271
|
const [selectedTags, setSelectedTags] = useState15(null);
|
|
7271
7272
|
const [searchString, setSearchString] = useState15("");
|
|
7272
7273
|
const [searchMap, setSearchMap] = useState15({});
|
|
7273
|
-
const { context } = actionData || {};
|
|
7274
7274
|
const actionContext = typeof context === "string" ? evalJSONContext8(context) : context;
|
|
7275
7275
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7276
|
-
const domainAction =
|
|
7277
|
-
const aid = actionData?.id;
|
|
7278
|
-
const model = actionData?.res_model;
|
|
7276
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : evalJSONDomain7(domain, contextSearch) : [];
|
|
7279
7277
|
const clearSearch = () => {
|
|
7280
7278
|
setFilterBy([]);
|
|
7281
7279
|
setGroupBy([]);
|
|
@@ -7321,7 +7319,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7321
7319
|
};
|
|
7322
7320
|
useEffect16(() => {
|
|
7323
7321
|
fetchData();
|
|
7324
|
-
}, [
|
|
7322
|
+
}, [model, viewData]);
|
|
7325
7323
|
const onChangeSearchInput = (search_string) => {
|
|
7326
7324
|
setSearchString(search_string);
|
|
7327
7325
|
};
|
|
@@ -7358,27 +7356,28 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7358
7356
|
};
|
|
7359
7357
|
const formatDomain = () => {
|
|
7360
7358
|
if (domainAction) {
|
|
7361
|
-
|
|
7359
|
+
console.log("domainAction", domainAction);
|
|
7360
|
+
const domain2 = [];
|
|
7362
7361
|
if (domainAction?.length > 0) {
|
|
7363
7362
|
if (Object.keys(searchMap).length > 0) {
|
|
7364
|
-
|
|
7363
|
+
domain2.push("&");
|
|
7365
7364
|
}
|
|
7366
7365
|
domainAction.forEach((domainItem) => {
|
|
7367
|
-
|
|
7366
|
+
domain2.push(domainItem);
|
|
7368
7367
|
});
|
|
7369
7368
|
}
|
|
7370
7369
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7371
7370
|
if (!key?.includes(SearchType.GROUP)) {
|
|
7372
7371
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7373
|
-
|
|
7372
|
+
domain2.push("&");
|
|
7374
7373
|
}
|
|
7375
7374
|
const valuesOfKey = searchMap[key];
|
|
7376
7375
|
valuesOfKey.forEach((value, index) => {
|
|
7377
7376
|
if (index < valuesOfKey.length - 1) {
|
|
7378
|
-
|
|
7377
|
+
domain2.push("|");
|
|
7379
7378
|
}
|
|
7380
7379
|
if (value.domain) {
|
|
7381
|
-
|
|
7380
|
+
domain2.push(...value.domain);
|
|
7382
7381
|
return;
|
|
7383
7382
|
}
|
|
7384
7383
|
let valueDomainItem = value?.value;
|
|
@@ -7394,11 +7393,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7394
7393
|
}
|
|
7395
7394
|
}
|
|
7396
7395
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7397
|
-
|
|
7396
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7398
7397
|
});
|
|
7399
7398
|
}
|
|
7400
7399
|
});
|
|
7401
|
-
return [...
|
|
7400
|
+
return [...domain2];
|
|
7402
7401
|
}
|
|
7403
7402
|
};
|
|
7404
7403
|
const setTagSearch = useCallback3(
|
|
@@ -7465,12 +7464,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7465
7464
|
[searchMap]
|
|
7466
7465
|
);
|
|
7467
7466
|
useEffect16(() => {
|
|
7468
|
-
setSelectedTags(null);
|
|
7469
7467
|
setTagSearch(searchMap);
|
|
7470
7468
|
}, [searchMap]);
|
|
7471
7469
|
const handleAddTagSearch = (tag) => {
|
|
7472
7470
|
const {
|
|
7473
|
-
domain,
|
|
7471
|
+
domain: domain2,
|
|
7474
7472
|
groupIndex,
|
|
7475
7473
|
value,
|
|
7476
7474
|
type,
|
|
@@ -7479,16 +7477,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7479
7477
|
active,
|
|
7480
7478
|
dataIndex
|
|
7481
7479
|
} = tag;
|
|
7482
|
-
const domainFormat = new domainHelper2.Domain(
|
|
7480
|
+
const domainFormat = new domainHelper2.Domain(domain2);
|
|
7483
7481
|
if (type === SearchType.FILTER) {
|
|
7484
7482
|
addSearchItems(`${SearchType.FILTER}_${groupIndex}`, {
|
|
7485
7483
|
...tag,
|
|
7486
|
-
domain:
|
|
7484
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7487
7485
|
});
|
|
7488
7486
|
} else if (type === SearchType.SEARCH) {
|
|
7489
7487
|
addSearchItems(`${SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7490
7488
|
...tag,
|
|
7491
|
-
domain:
|
|
7489
|
+
domain: domain2 ? domainFormat.toList({
|
|
7492
7490
|
...context2,
|
|
7493
7491
|
self: value
|
|
7494
7492
|
}) : null
|
|
@@ -7496,7 +7494,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7496
7494
|
} else if (type === SearchType.GROUP) {
|
|
7497
7495
|
addSearchItems(`${SearchType.GROUP}`, {
|
|
7498
7496
|
...tag,
|
|
7499
|
-
domain:
|
|
7497
|
+
domain: domain2 ? domainFormat.toList({
|
|
7500
7498
|
context: context2,
|
|
7501
7499
|
self: value
|
|
7502
7500
|
}) : null
|
package/dist/widget.d.mts
CHANGED
|
@@ -297,7 +297,13 @@ declare const tableGroupController: (props: any) => {
|
|
|
297
297
|
setPageGroup: react.Dispatch<any>;
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
-
declare const searchController: ({ viewData,
|
|
300
|
+
declare const searchController: ({ viewData, model, domain, context, fieldsList, }: {
|
|
301
|
+
viewData: any;
|
|
302
|
+
model: string;
|
|
303
|
+
context: any;
|
|
304
|
+
domain: any;
|
|
305
|
+
fieldsList: any[];
|
|
306
|
+
}) => {
|
|
301
307
|
groupBy: any[] | null;
|
|
302
308
|
searchBy: any[] | null;
|
|
303
309
|
filterBy: any[] | null;
|
package/dist/widget.d.ts
CHANGED
|
@@ -297,7 +297,13 @@ declare const tableGroupController: (props: any) => {
|
|
|
297
297
|
setPageGroup: react.Dispatch<any>;
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
-
declare const searchController: ({ viewData,
|
|
300
|
+
declare const searchController: ({ viewData, model, domain, context, fieldsList, }: {
|
|
301
|
+
viewData: any;
|
|
302
|
+
model: string;
|
|
303
|
+
context: any;
|
|
304
|
+
domain: any;
|
|
305
|
+
fieldsList: any[];
|
|
306
|
+
}) => {
|
|
301
307
|
groupBy: any[] | null;
|
|
302
308
|
searchBy: any[] | null;
|
|
303
309
|
filterBy: any[] | null;
|
package/dist/widget.js
CHANGED
|
@@ -5175,7 +5175,6 @@ var many2manyFieldController = (props) => {
|
|
|
5175
5175
|
const { env } = (0, provider_exports.useEnv)();
|
|
5176
5176
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5177
5177
|
const [order, setOrder] = (0, import_react15.useState)();
|
|
5178
|
-
const [isLoadedData, setIsLoadedData] = (0, import_react15.useState)(false);
|
|
5179
5178
|
const [page, setPage] = (0, import_react15.useState)(0);
|
|
5180
5179
|
const [domainMany2Many, setDomainMany2Many] = (0, import_react15.useState)(null);
|
|
5181
5180
|
const [debouncedPage] = useDebounce(page, 500);
|
|
@@ -5247,7 +5246,7 @@ var many2manyFieldController = (props) => {
|
|
|
5247
5246
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5248
5247
|
sort: order ? order : default_order ? (0, import_utils6.formatSortingString)(default_order) : ""
|
|
5249
5248
|
};
|
|
5250
|
-
const enabled = enabledCallAPI &&
|
|
5249
|
+
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5251
5250
|
const {
|
|
5252
5251
|
data: dataResponse,
|
|
5253
5252
|
isLoading,
|
|
@@ -5262,7 +5261,6 @@ var many2manyFieldController = (props) => {
|
|
|
5262
5261
|
setPage(0);
|
|
5263
5262
|
setSelectedRowKeys4([]);
|
|
5264
5263
|
setDomainMany2Many(null);
|
|
5265
|
-
setIsLoadedData(false);
|
|
5266
5264
|
};
|
|
5267
5265
|
}, [viewResponse]);
|
|
5268
5266
|
const { rows, columns, typeTable, onToggleColumnOptional } = tableController({
|
|
@@ -5276,18 +5274,15 @@ var many2manyFieldController = (props) => {
|
|
|
5276
5274
|
});
|
|
5277
5275
|
const searchControllers = searchController({
|
|
5278
5276
|
viewData: viewResponse,
|
|
5279
|
-
|
|
5277
|
+
model: relation ?? "",
|
|
5278
|
+
context: contextObject,
|
|
5279
|
+
domain,
|
|
5280
5280
|
fieldsList: [
|
|
5281
5281
|
...columns?.filter(
|
|
5282
5282
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
5283
5283
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
5284
5284
|
]
|
|
5285
5285
|
});
|
|
5286
|
-
(0, import_react15.useEffect)(() => {
|
|
5287
|
-
if (domainMany2Many && !isLoadedData) {
|
|
5288
|
-
setIsLoadedData(true);
|
|
5289
|
-
}
|
|
5290
|
-
}, [domainMany2Many]);
|
|
5291
5286
|
const handleCreateNewOnPage = async () => {
|
|
5292
5287
|
};
|
|
5293
5288
|
return {
|
|
@@ -6930,7 +6925,13 @@ var import_constants5 = require("@fctc/interface-logic/constants");
|
|
|
6930
6925
|
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6931
6926
|
var import_moment2 = __toESM(require_moment());
|
|
6932
6927
|
var import_react24 = require("react");
|
|
6933
|
-
var searchController = ({
|
|
6928
|
+
var searchController = ({
|
|
6929
|
+
viewData,
|
|
6930
|
+
model,
|
|
6931
|
+
domain,
|
|
6932
|
+
context,
|
|
6933
|
+
fieldsList
|
|
6934
|
+
}) => {
|
|
6934
6935
|
const { env } = (0, provider_exports.useEnv)();
|
|
6935
6936
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
6936
6937
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
@@ -6938,12 +6939,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
6938
6939
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
6939
6940
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
6940
6941
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
6941
|
-
const { context } = actionData || {};
|
|
6942
6942
|
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
6943
6943
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6944
|
-
const domainAction =
|
|
6945
|
-
const aid = actionData?.id;
|
|
6946
|
-
const model = actionData?.res_model;
|
|
6944
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
6947
6945
|
const clearSearch = () => {
|
|
6948
6946
|
setFilterBy([]);
|
|
6949
6947
|
setGroupBy([]);
|
|
@@ -6989,7 +6987,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
6989
6987
|
};
|
|
6990
6988
|
(0, import_react24.useEffect)(() => {
|
|
6991
6989
|
fetchData();
|
|
6992
|
-
}, [
|
|
6990
|
+
}, [model, viewData]);
|
|
6993
6991
|
const onChangeSearchInput = (search_string) => {
|
|
6994
6992
|
setSearchString(search_string);
|
|
6995
6993
|
};
|
|
@@ -7026,27 +7024,28 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7026
7024
|
};
|
|
7027
7025
|
const formatDomain = () => {
|
|
7028
7026
|
if (domainAction) {
|
|
7029
|
-
|
|
7027
|
+
console.log("domainAction", domainAction);
|
|
7028
|
+
const domain2 = [];
|
|
7030
7029
|
if (domainAction?.length > 0) {
|
|
7031
7030
|
if (Object.keys(searchMap).length > 0) {
|
|
7032
|
-
|
|
7031
|
+
domain2.push("&");
|
|
7033
7032
|
}
|
|
7034
7033
|
domainAction.forEach((domainItem) => {
|
|
7035
|
-
|
|
7034
|
+
domain2.push(domainItem);
|
|
7036
7035
|
});
|
|
7037
7036
|
}
|
|
7038
7037
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7039
7038
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7040
7039
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7041
|
-
|
|
7040
|
+
domain2.push("&");
|
|
7042
7041
|
}
|
|
7043
7042
|
const valuesOfKey = searchMap[key];
|
|
7044
7043
|
valuesOfKey.forEach((value, index) => {
|
|
7045
7044
|
if (index < valuesOfKey.length - 1) {
|
|
7046
|
-
|
|
7045
|
+
domain2.push("|");
|
|
7047
7046
|
}
|
|
7048
7047
|
if (value.domain) {
|
|
7049
|
-
|
|
7048
|
+
domain2.push(...value.domain);
|
|
7050
7049
|
return;
|
|
7051
7050
|
}
|
|
7052
7051
|
let valueDomainItem = value?.value;
|
|
@@ -7062,11 +7061,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7062
7061
|
}
|
|
7063
7062
|
}
|
|
7064
7063
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7065
|
-
|
|
7064
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7066
7065
|
});
|
|
7067
7066
|
}
|
|
7068
7067
|
});
|
|
7069
|
-
return [...
|
|
7068
|
+
return [...domain2];
|
|
7070
7069
|
}
|
|
7071
7070
|
};
|
|
7072
7071
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7133,12 +7132,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7133
7132
|
[searchMap]
|
|
7134
7133
|
);
|
|
7135
7134
|
(0, import_react24.useEffect)(() => {
|
|
7136
|
-
setSelectedTags(null);
|
|
7137
7135
|
setTagSearch(searchMap);
|
|
7138
7136
|
}, [searchMap]);
|
|
7139
7137
|
const handleAddTagSearch = (tag) => {
|
|
7140
7138
|
const {
|
|
7141
|
-
domain,
|
|
7139
|
+
domain: domain2,
|
|
7142
7140
|
groupIndex,
|
|
7143
7141
|
value,
|
|
7144
7142
|
type,
|
|
@@ -7147,16 +7145,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7147
7145
|
active,
|
|
7148
7146
|
dataIndex
|
|
7149
7147
|
} = tag;
|
|
7150
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7148
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain2);
|
|
7151
7149
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7152
7150
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7153
7151
|
...tag,
|
|
7154
|
-
domain:
|
|
7152
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7155
7153
|
});
|
|
7156
7154
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7157
7155
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7158
7156
|
...tag,
|
|
7159
|
-
domain:
|
|
7157
|
+
domain: domain2 ? domainFormat.toList({
|
|
7160
7158
|
...context2,
|
|
7161
7159
|
self: value
|
|
7162
7160
|
}) : null
|
|
@@ -7164,7 +7162,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7164
7162
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7165
7163
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7166
7164
|
...tag,
|
|
7167
|
-
domain:
|
|
7165
|
+
domain: domain2 ? domainFormat.toList({
|
|
7168
7166
|
context: context2,
|
|
7169
7167
|
self: value
|
|
7170
7168
|
}) : null
|
package/dist/widget.mjs
CHANGED
|
@@ -5185,7 +5185,6 @@ var many2manyFieldController = (props) => {
|
|
|
5185
5185
|
const { env } = (0, provider_exports.useEnv)();
|
|
5186
5186
|
const { useGetView: useGetView2, useGetListData: useGetListData3, useGetFormView } = (0, provider_exports.useService)();
|
|
5187
5187
|
const [order, setOrder] = useState8();
|
|
5188
|
-
const [isLoadedData, setIsLoadedData] = useState8(false);
|
|
5189
5188
|
const [page, setPage] = useState8(0);
|
|
5190
5189
|
const [domainMany2Many, setDomainMany2Many] = useState8(null);
|
|
5191
5190
|
const [debouncedPage] = useDebounce(page, 500);
|
|
@@ -5257,7 +5256,7 @@ var many2manyFieldController = (props) => {
|
|
|
5257
5256
|
groupby: [groupByDomain?.contexts[0]?.group_by],
|
|
5258
5257
|
sort: order ? order : default_order ? formatSortingString2(default_order) : ""
|
|
5259
5258
|
};
|
|
5260
|
-
const enabled = enabledCallAPI &&
|
|
5259
|
+
const enabled = enabledCallAPI && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
|
|
5261
5260
|
const {
|
|
5262
5261
|
data: dataResponse,
|
|
5263
5262
|
isLoading,
|
|
@@ -5272,7 +5271,6 @@ var many2manyFieldController = (props) => {
|
|
|
5272
5271
|
setPage(0);
|
|
5273
5272
|
setSelectedRowKeys4([]);
|
|
5274
5273
|
setDomainMany2Many(null);
|
|
5275
|
-
setIsLoadedData(false);
|
|
5276
5274
|
};
|
|
5277
5275
|
}, [viewResponse]);
|
|
5278
5276
|
const { rows, columns, typeTable, onToggleColumnOptional } = tableController({
|
|
@@ -5286,18 +5284,15 @@ var many2manyFieldController = (props) => {
|
|
|
5286
5284
|
});
|
|
5287
5285
|
const searchControllers = searchController({
|
|
5288
5286
|
viewData: viewResponse,
|
|
5289
|
-
|
|
5287
|
+
model: relation ?? "",
|
|
5288
|
+
context: contextObject,
|
|
5289
|
+
domain,
|
|
5290
5290
|
fieldsList: [
|
|
5291
5291
|
...columns?.filter(
|
|
5292
5292
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
5293
5293
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
5294
5294
|
]
|
|
5295
5295
|
});
|
|
5296
|
-
useEffect11(() => {
|
|
5297
|
-
if (domainMany2Many && !isLoadedData) {
|
|
5298
|
-
setIsLoadedData(true);
|
|
5299
|
-
}
|
|
5300
|
-
}, [domainMany2Many]);
|
|
5301
5296
|
const handleCreateNewOnPage = async () => {
|
|
5302
5297
|
};
|
|
5303
5298
|
return {
|
|
@@ -6964,7 +6959,13 @@ import {
|
|
|
6964
6959
|
validateAndParseDate
|
|
6965
6960
|
} from "@fctc/interface-logic/utils";
|
|
6966
6961
|
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
6967
|
-
var searchController = ({
|
|
6962
|
+
var searchController = ({
|
|
6963
|
+
viewData,
|
|
6964
|
+
model,
|
|
6965
|
+
domain,
|
|
6966
|
+
context,
|
|
6967
|
+
fieldsList
|
|
6968
|
+
}) => {
|
|
6968
6969
|
const { env } = (0, provider_exports.useEnv)();
|
|
6969
6970
|
const [filterBy, setFilterBy] = useState15(null);
|
|
6970
6971
|
const [searchBy, setSearchBy] = useState15(null);
|
|
@@ -6972,12 +6973,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
6972
6973
|
const [selectedTags, setSelectedTags] = useState15(null);
|
|
6973
6974
|
const [searchString, setSearchString] = useState15("");
|
|
6974
6975
|
const [searchMap, setSearchMap] = useState15({});
|
|
6975
|
-
const { context } = actionData || {};
|
|
6976
6976
|
const actionContext = typeof context === "string" ? evalJSONContext8(context) : context;
|
|
6977
6977
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6978
|
-
const domainAction =
|
|
6979
|
-
const aid = actionData?.id;
|
|
6980
|
-
const model = actionData?.res_model;
|
|
6978
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : evalJSONDomain7(domain, contextSearch) : [];
|
|
6981
6979
|
const clearSearch = () => {
|
|
6982
6980
|
setFilterBy([]);
|
|
6983
6981
|
setGroupBy([]);
|
|
@@ -7023,7 +7021,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7023
7021
|
};
|
|
7024
7022
|
useEffect16(() => {
|
|
7025
7023
|
fetchData();
|
|
7026
|
-
}, [
|
|
7024
|
+
}, [model, viewData]);
|
|
7027
7025
|
const onChangeSearchInput = (search_string) => {
|
|
7028
7026
|
setSearchString(search_string);
|
|
7029
7027
|
};
|
|
@@ -7060,27 +7058,28 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7060
7058
|
};
|
|
7061
7059
|
const formatDomain = () => {
|
|
7062
7060
|
if (domainAction) {
|
|
7063
|
-
|
|
7061
|
+
console.log("domainAction", domainAction);
|
|
7062
|
+
const domain2 = [];
|
|
7064
7063
|
if (domainAction?.length > 0) {
|
|
7065
7064
|
if (Object.keys(searchMap).length > 0) {
|
|
7066
|
-
|
|
7065
|
+
domain2.push("&");
|
|
7067
7066
|
}
|
|
7068
7067
|
domainAction.forEach((domainItem) => {
|
|
7069
|
-
|
|
7068
|
+
domain2.push(domainItem);
|
|
7070
7069
|
});
|
|
7071
7070
|
}
|
|
7072
7071
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7073
7072
|
if (!key?.includes(SearchType.GROUP)) {
|
|
7074
7073
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7075
|
-
|
|
7074
|
+
domain2.push("&");
|
|
7076
7075
|
}
|
|
7077
7076
|
const valuesOfKey = searchMap[key];
|
|
7078
7077
|
valuesOfKey.forEach((value, index) => {
|
|
7079
7078
|
if (index < valuesOfKey.length - 1) {
|
|
7080
|
-
|
|
7079
|
+
domain2.push("|");
|
|
7081
7080
|
}
|
|
7082
7081
|
if (value.domain) {
|
|
7083
|
-
|
|
7082
|
+
domain2.push(...value.domain);
|
|
7084
7083
|
return;
|
|
7085
7084
|
}
|
|
7086
7085
|
let valueDomainItem = value?.value;
|
|
@@ -7096,11 +7095,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7096
7095
|
}
|
|
7097
7096
|
}
|
|
7098
7097
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7099
|
-
|
|
7098
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7100
7099
|
});
|
|
7101
7100
|
}
|
|
7102
7101
|
});
|
|
7103
|
-
return [...
|
|
7102
|
+
return [...domain2];
|
|
7104
7103
|
}
|
|
7105
7104
|
};
|
|
7106
7105
|
const setTagSearch = useCallback3(
|
|
@@ -7167,12 +7166,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7167
7166
|
[searchMap]
|
|
7168
7167
|
);
|
|
7169
7168
|
useEffect16(() => {
|
|
7170
|
-
setSelectedTags(null);
|
|
7171
7169
|
setTagSearch(searchMap);
|
|
7172
7170
|
}, [searchMap]);
|
|
7173
7171
|
const handleAddTagSearch = (tag) => {
|
|
7174
7172
|
const {
|
|
7175
|
-
domain,
|
|
7173
|
+
domain: domain2,
|
|
7176
7174
|
groupIndex,
|
|
7177
7175
|
value,
|
|
7178
7176
|
type,
|
|
@@ -7181,16 +7179,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7181
7179
|
active,
|
|
7182
7180
|
dataIndex
|
|
7183
7181
|
} = tag;
|
|
7184
|
-
const domainFormat = new domainHelper2.Domain(
|
|
7182
|
+
const domainFormat = new domainHelper2.Domain(domain2);
|
|
7185
7183
|
if (type === SearchType.FILTER) {
|
|
7186
7184
|
addSearchItems(`${SearchType.FILTER}_${groupIndex}`, {
|
|
7187
7185
|
...tag,
|
|
7188
|
-
domain:
|
|
7186
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7189
7187
|
});
|
|
7190
7188
|
} else if (type === SearchType.SEARCH) {
|
|
7191
7189
|
addSearchItems(`${SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7192
7190
|
...tag,
|
|
7193
|
-
domain:
|
|
7191
|
+
domain: domain2 ? domainFormat.toList({
|
|
7194
7192
|
...context2,
|
|
7195
7193
|
self: value
|
|
7196
7194
|
}) : null
|
|
@@ -7198,7 +7196,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7198
7196
|
} else if (type === SearchType.GROUP) {
|
|
7199
7197
|
addSearchItems(`${SearchType.GROUP}`, {
|
|
7200
7198
|
...tag,
|
|
7201
|
-
domain:
|
|
7199
|
+
domain: domain2 ? domainFormat.toList({
|
|
7202
7200
|
context: context2,
|
|
7203
7201
|
self: value
|
|
7204
7202
|
}) : null
|