@fctc/widget-logic 1.10.4 → 1.10.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/index.js +21 -21
- package/dist/index.mjs +21 -21
- package/dist/widget.d.mts +7 -1
- package/dist/widget.d.ts +7 -1
- package/dist/widget.js +21 -21
- package/dist/widget.mjs +21 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5550,7 +5550,9 @@ var many2manyFieldController = (props) => {
|
|
|
5550
5550
|
});
|
|
5551
5551
|
const searchControllers = searchController({
|
|
5552
5552
|
viewData: viewResponse,
|
|
5553
|
-
|
|
5553
|
+
model: relation ?? "",
|
|
5554
|
+
context: contextObject,
|
|
5555
|
+
domain: domainMany2Many,
|
|
5554
5556
|
fieldsList: [
|
|
5555
5557
|
...columns?.filter(
|
|
5556
5558
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
@@ -7206,7 +7208,9 @@ var import_moment2 = __toESM(require_moment());
|
|
|
7206
7208
|
var import_react24 = require("react");
|
|
7207
7209
|
var searchController = ({
|
|
7208
7210
|
viewData,
|
|
7209
|
-
|
|
7211
|
+
model,
|
|
7212
|
+
domain,
|
|
7213
|
+
context,
|
|
7210
7214
|
fieldsList
|
|
7211
7215
|
}) => {
|
|
7212
7216
|
const { env } = (0, provider_exports.useEnv)();
|
|
@@ -7216,12 +7220,9 @@ var searchController = ({
|
|
|
7216
7220
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7217
7221
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7218
7222
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
7219
|
-
const { context } = actionData || {};
|
|
7220
7223
|
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
7221
7224
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7222
|
-
const domainAction =
|
|
7223
|
-
const aid = actionData?.id;
|
|
7224
|
-
const model = actionData?.res_model;
|
|
7225
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
7225
7226
|
const clearSearch = () => {
|
|
7226
7227
|
setFilterBy([]);
|
|
7227
7228
|
setGroupBy([]);
|
|
@@ -7266,9 +7267,8 @@ var searchController = ({
|
|
|
7266
7267
|
}
|
|
7267
7268
|
};
|
|
7268
7269
|
(0, import_react24.useEffect)(() => {
|
|
7269
|
-
clearSearch();
|
|
7270
7270
|
fetchData();
|
|
7271
|
-
}, [
|
|
7271
|
+
}, [model, viewData]);
|
|
7272
7272
|
const onChangeSearchInput = (search_string) => {
|
|
7273
7273
|
setSearchString(search_string);
|
|
7274
7274
|
};
|
|
@@ -7305,27 +7305,27 @@ var searchController = ({
|
|
|
7305
7305
|
};
|
|
7306
7306
|
const formatDomain = () => {
|
|
7307
7307
|
if (domainAction) {
|
|
7308
|
-
const
|
|
7308
|
+
const domain2 = [];
|
|
7309
7309
|
if (domainAction?.length > 0) {
|
|
7310
7310
|
if (Object.keys(searchMap).length > 0) {
|
|
7311
|
-
|
|
7311
|
+
domain2.push("&");
|
|
7312
7312
|
}
|
|
7313
7313
|
domainAction.forEach((domainItem) => {
|
|
7314
|
-
|
|
7314
|
+
domain2.push(domainItem);
|
|
7315
7315
|
});
|
|
7316
7316
|
}
|
|
7317
7317
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7318
7318
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7319
7319
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7320
|
-
|
|
7320
|
+
domain2.push("&");
|
|
7321
7321
|
}
|
|
7322
7322
|
const valuesOfKey = searchMap[key];
|
|
7323
7323
|
valuesOfKey.forEach((value, index) => {
|
|
7324
7324
|
if (index < valuesOfKey.length - 1) {
|
|
7325
|
-
|
|
7325
|
+
domain2.push("|");
|
|
7326
7326
|
}
|
|
7327
7327
|
if (value.domain) {
|
|
7328
|
-
|
|
7328
|
+
domain2.push(...value.domain);
|
|
7329
7329
|
return;
|
|
7330
7330
|
}
|
|
7331
7331
|
let valueDomainItem = value?.value;
|
|
@@ -7341,11 +7341,11 @@ var searchController = ({
|
|
|
7341
7341
|
}
|
|
7342
7342
|
}
|
|
7343
7343
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7344
|
-
|
|
7344
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7345
7345
|
});
|
|
7346
7346
|
}
|
|
7347
7347
|
});
|
|
7348
|
-
return [...
|
|
7348
|
+
return [...domain2];
|
|
7349
7349
|
}
|
|
7350
7350
|
};
|
|
7351
7351
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7417,7 +7417,7 @@ var searchController = ({
|
|
|
7417
7417
|
}, [searchMap]);
|
|
7418
7418
|
const handleAddTagSearch = (tag) => {
|
|
7419
7419
|
const {
|
|
7420
|
-
domain,
|
|
7420
|
+
domain: domain2,
|
|
7421
7421
|
groupIndex,
|
|
7422
7422
|
value,
|
|
7423
7423
|
type,
|
|
@@ -7426,16 +7426,16 @@ var searchController = ({
|
|
|
7426
7426
|
active,
|
|
7427
7427
|
dataIndex
|
|
7428
7428
|
} = tag;
|
|
7429
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7429
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain2);
|
|
7430
7430
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7431
7431
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7432
7432
|
...tag,
|
|
7433
|
-
domain:
|
|
7433
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7434
7434
|
});
|
|
7435
7435
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7436
7436
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7437
7437
|
...tag,
|
|
7438
|
-
domain:
|
|
7438
|
+
domain: domain2 ? domainFormat.toList({
|
|
7439
7439
|
...context2,
|
|
7440
7440
|
self: value
|
|
7441
7441
|
}) : null
|
|
@@ -7443,7 +7443,7 @@ var searchController = ({
|
|
|
7443
7443
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7444
7444
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7445
7445
|
...tag,
|
|
7446
|
-
domain:
|
|
7446
|
+
domain: domain2 ? domainFormat.toList({
|
|
7447
7447
|
context: context2,
|
|
7448
7448
|
self: value
|
|
7449
7449
|
}) : null
|
package/dist/index.mjs
CHANGED
|
@@ -5584,7 +5584,9 @@ var many2manyFieldController = (props) => {
|
|
|
5584
5584
|
});
|
|
5585
5585
|
const searchControllers = searchController({
|
|
5586
5586
|
viewData: viewResponse,
|
|
5587
|
-
|
|
5587
|
+
model: relation ?? "",
|
|
5588
|
+
context: contextObject,
|
|
5589
|
+
domain: domainMany2Many,
|
|
5588
5590
|
fieldsList: [
|
|
5589
5591
|
...columns?.filter(
|
|
5590
5592
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
@@ -7264,7 +7266,9 @@ import {
|
|
|
7264
7266
|
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
7265
7267
|
var searchController = ({
|
|
7266
7268
|
viewData,
|
|
7267
|
-
|
|
7269
|
+
model,
|
|
7270
|
+
domain,
|
|
7271
|
+
context,
|
|
7268
7272
|
fieldsList
|
|
7269
7273
|
}) => {
|
|
7270
7274
|
const { env } = (0, provider_exports.useEnv)();
|
|
@@ -7274,12 +7278,9 @@ var searchController = ({
|
|
|
7274
7278
|
const [selectedTags, setSelectedTags] = useState15(null);
|
|
7275
7279
|
const [searchString, setSearchString] = useState15("");
|
|
7276
7280
|
const [searchMap, setSearchMap] = useState15({});
|
|
7277
|
-
const { context } = actionData || {};
|
|
7278
7281
|
const actionContext = typeof context === "string" ? evalJSONContext8(context) : context;
|
|
7279
7282
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7280
|
-
const domainAction =
|
|
7281
|
-
const aid = actionData?.id;
|
|
7282
|
-
const model = actionData?.res_model;
|
|
7283
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : evalJSONDomain7(domain, contextSearch) : [];
|
|
7283
7284
|
const clearSearch = () => {
|
|
7284
7285
|
setFilterBy([]);
|
|
7285
7286
|
setGroupBy([]);
|
|
@@ -7324,9 +7325,8 @@ var searchController = ({
|
|
|
7324
7325
|
}
|
|
7325
7326
|
};
|
|
7326
7327
|
useEffect16(() => {
|
|
7327
|
-
clearSearch();
|
|
7328
7328
|
fetchData();
|
|
7329
|
-
}, [
|
|
7329
|
+
}, [model, viewData]);
|
|
7330
7330
|
const onChangeSearchInput = (search_string) => {
|
|
7331
7331
|
setSearchString(search_string);
|
|
7332
7332
|
};
|
|
@@ -7363,27 +7363,27 @@ var searchController = ({
|
|
|
7363
7363
|
};
|
|
7364
7364
|
const formatDomain = () => {
|
|
7365
7365
|
if (domainAction) {
|
|
7366
|
-
const
|
|
7366
|
+
const domain2 = [];
|
|
7367
7367
|
if (domainAction?.length > 0) {
|
|
7368
7368
|
if (Object.keys(searchMap).length > 0) {
|
|
7369
|
-
|
|
7369
|
+
domain2.push("&");
|
|
7370
7370
|
}
|
|
7371
7371
|
domainAction.forEach((domainItem) => {
|
|
7372
|
-
|
|
7372
|
+
domain2.push(domainItem);
|
|
7373
7373
|
});
|
|
7374
7374
|
}
|
|
7375
7375
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7376
7376
|
if (!key?.includes(SearchType.GROUP)) {
|
|
7377
7377
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7378
|
-
|
|
7378
|
+
domain2.push("&");
|
|
7379
7379
|
}
|
|
7380
7380
|
const valuesOfKey = searchMap[key];
|
|
7381
7381
|
valuesOfKey.forEach((value, index) => {
|
|
7382
7382
|
if (index < valuesOfKey.length - 1) {
|
|
7383
|
-
|
|
7383
|
+
domain2.push("|");
|
|
7384
7384
|
}
|
|
7385
7385
|
if (value.domain) {
|
|
7386
|
-
|
|
7386
|
+
domain2.push(...value.domain);
|
|
7387
7387
|
return;
|
|
7388
7388
|
}
|
|
7389
7389
|
let valueDomainItem = value?.value;
|
|
@@ -7399,11 +7399,11 @@ var searchController = ({
|
|
|
7399
7399
|
}
|
|
7400
7400
|
}
|
|
7401
7401
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7402
|
-
|
|
7402
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7403
7403
|
});
|
|
7404
7404
|
}
|
|
7405
7405
|
});
|
|
7406
|
-
return [...
|
|
7406
|
+
return [...domain2];
|
|
7407
7407
|
}
|
|
7408
7408
|
};
|
|
7409
7409
|
const setTagSearch = useCallback3(
|
|
@@ -7475,7 +7475,7 @@ var searchController = ({
|
|
|
7475
7475
|
}, [searchMap]);
|
|
7476
7476
|
const handleAddTagSearch = (tag) => {
|
|
7477
7477
|
const {
|
|
7478
|
-
domain,
|
|
7478
|
+
domain: domain2,
|
|
7479
7479
|
groupIndex,
|
|
7480
7480
|
value,
|
|
7481
7481
|
type,
|
|
@@ -7484,16 +7484,16 @@ var searchController = ({
|
|
|
7484
7484
|
active,
|
|
7485
7485
|
dataIndex
|
|
7486
7486
|
} = tag;
|
|
7487
|
-
const domainFormat = new domainHelper2.Domain(
|
|
7487
|
+
const domainFormat = new domainHelper2.Domain(domain2);
|
|
7488
7488
|
if (type === SearchType.FILTER) {
|
|
7489
7489
|
addSearchItems(`${SearchType.FILTER}_${groupIndex}`, {
|
|
7490
7490
|
...tag,
|
|
7491
|
-
domain:
|
|
7491
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7492
7492
|
});
|
|
7493
7493
|
} else if (type === SearchType.SEARCH) {
|
|
7494
7494
|
addSearchItems(`${SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7495
7495
|
...tag,
|
|
7496
|
-
domain:
|
|
7496
|
+
domain: domain2 ? domainFormat.toList({
|
|
7497
7497
|
...context2,
|
|
7498
7498
|
self: value
|
|
7499
7499
|
}) : null
|
|
@@ -7501,7 +7501,7 @@ var searchController = ({
|
|
|
7501
7501
|
} else if (type === SearchType.GROUP) {
|
|
7502
7502
|
addSearchItems(`${SearchType.GROUP}`, {
|
|
7503
7503
|
...tag,
|
|
7504
|
-
domain:
|
|
7504
|
+
domain: domain2 ? domainFormat.toList({
|
|
7505
7505
|
context: context2,
|
|
7506
7506
|
self: value
|
|
7507
7507
|
}) : 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
|
@@ -5276,7 +5276,9 @@ var many2manyFieldController = (props) => {
|
|
|
5276
5276
|
});
|
|
5277
5277
|
const searchControllers = searchController({
|
|
5278
5278
|
viewData: viewResponse,
|
|
5279
|
-
|
|
5279
|
+
model: relation ?? "",
|
|
5280
|
+
context: contextObject,
|
|
5281
|
+
domain: domainMany2Many,
|
|
5280
5282
|
fieldsList: [
|
|
5281
5283
|
...columns?.filter(
|
|
5282
5284
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
@@ -6932,7 +6934,9 @@ var import_moment2 = __toESM(require_moment());
|
|
|
6932
6934
|
var import_react24 = require("react");
|
|
6933
6935
|
var searchController = ({
|
|
6934
6936
|
viewData,
|
|
6935
|
-
|
|
6937
|
+
model,
|
|
6938
|
+
domain,
|
|
6939
|
+
context,
|
|
6936
6940
|
fieldsList
|
|
6937
6941
|
}) => {
|
|
6938
6942
|
const { env } = (0, provider_exports.useEnv)();
|
|
@@ -6942,12 +6946,9 @@ var searchController = ({
|
|
|
6942
6946
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
6943
6947
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
6944
6948
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
6945
|
-
const { context } = actionData || {};
|
|
6946
6949
|
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
6947
6950
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6948
|
-
const domainAction =
|
|
6949
|
-
const aid = actionData?.id;
|
|
6950
|
-
const model = actionData?.res_model;
|
|
6951
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
6951
6952
|
const clearSearch = () => {
|
|
6952
6953
|
setFilterBy([]);
|
|
6953
6954
|
setGroupBy([]);
|
|
@@ -6992,9 +6993,8 @@ var searchController = ({
|
|
|
6992
6993
|
}
|
|
6993
6994
|
};
|
|
6994
6995
|
(0, import_react24.useEffect)(() => {
|
|
6995
|
-
clearSearch();
|
|
6996
6996
|
fetchData();
|
|
6997
|
-
}, [
|
|
6997
|
+
}, [model, viewData]);
|
|
6998
6998
|
const onChangeSearchInput = (search_string) => {
|
|
6999
6999
|
setSearchString(search_string);
|
|
7000
7000
|
};
|
|
@@ -7031,27 +7031,27 @@ var searchController = ({
|
|
|
7031
7031
|
};
|
|
7032
7032
|
const formatDomain = () => {
|
|
7033
7033
|
if (domainAction) {
|
|
7034
|
-
const
|
|
7034
|
+
const domain2 = [];
|
|
7035
7035
|
if (domainAction?.length > 0) {
|
|
7036
7036
|
if (Object.keys(searchMap).length > 0) {
|
|
7037
|
-
|
|
7037
|
+
domain2.push("&");
|
|
7038
7038
|
}
|
|
7039
7039
|
domainAction.forEach((domainItem) => {
|
|
7040
|
-
|
|
7040
|
+
domain2.push(domainItem);
|
|
7041
7041
|
});
|
|
7042
7042
|
}
|
|
7043
7043
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7044
7044
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7045
7045
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7046
|
-
|
|
7046
|
+
domain2.push("&");
|
|
7047
7047
|
}
|
|
7048
7048
|
const valuesOfKey = searchMap[key];
|
|
7049
7049
|
valuesOfKey.forEach((value, index) => {
|
|
7050
7050
|
if (index < valuesOfKey.length - 1) {
|
|
7051
|
-
|
|
7051
|
+
domain2.push("|");
|
|
7052
7052
|
}
|
|
7053
7053
|
if (value.domain) {
|
|
7054
|
-
|
|
7054
|
+
domain2.push(...value.domain);
|
|
7055
7055
|
return;
|
|
7056
7056
|
}
|
|
7057
7057
|
let valueDomainItem = value?.value;
|
|
@@ -7067,11 +7067,11 @@ var searchController = ({
|
|
|
7067
7067
|
}
|
|
7068
7068
|
}
|
|
7069
7069
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7070
|
-
|
|
7070
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7071
7071
|
});
|
|
7072
7072
|
}
|
|
7073
7073
|
});
|
|
7074
|
-
return [...
|
|
7074
|
+
return [...domain2];
|
|
7075
7075
|
}
|
|
7076
7076
|
};
|
|
7077
7077
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7143,7 +7143,7 @@ var searchController = ({
|
|
|
7143
7143
|
}, [searchMap]);
|
|
7144
7144
|
const handleAddTagSearch = (tag) => {
|
|
7145
7145
|
const {
|
|
7146
|
-
domain,
|
|
7146
|
+
domain: domain2,
|
|
7147
7147
|
groupIndex,
|
|
7148
7148
|
value,
|
|
7149
7149
|
type,
|
|
@@ -7152,16 +7152,16 @@ var searchController = ({
|
|
|
7152
7152
|
active,
|
|
7153
7153
|
dataIndex
|
|
7154
7154
|
} = tag;
|
|
7155
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7155
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain2);
|
|
7156
7156
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7157
7157
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7158
7158
|
...tag,
|
|
7159
|
-
domain:
|
|
7159
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7160
7160
|
});
|
|
7161
7161
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7162
7162
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7163
7163
|
...tag,
|
|
7164
|
-
domain:
|
|
7164
|
+
domain: domain2 ? domainFormat.toList({
|
|
7165
7165
|
...context2,
|
|
7166
7166
|
self: value
|
|
7167
7167
|
}) : null
|
|
@@ -7169,7 +7169,7 @@ var searchController = ({
|
|
|
7169
7169
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7170
7170
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7171
7171
|
...tag,
|
|
7172
|
-
domain:
|
|
7172
|
+
domain: domain2 ? domainFormat.toList({
|
|
7173
7173
|
context: context2,
|
|
7174
7174
|
self: value
|
|
7175
7175
|
}) : null
|
package/dist/widget.mjs
CHANGED
|
@@ -5286,7 +5286,9 @@ var many2manyFieldController = (props) => {
|
|
|
5286
5286
|
});
|
|
5287
5287
|
const searchControllers = searchController({
|
|
5288
5288
|
viewData: viewResponse,
|
|
5289
|
-
|
|
5289
|
+
model: relation ?? "",
|
|
5290
|
+
context: contextObject,
|
|
5291
|
+
domain: domainMany2Many,
|
|
5290
5292
|
fieldsList: [
|
|
5291
5293
|
...columns?.filter(
|
|
5292
5294
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
@@ -6966,7 +6968,9 @@ import {
|
|
|
6966
6968
|
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
6967
6969
|
var searchController = ({
|
|
6968
6970
|
viewData,
|
|
6969
|
-
|
|
6971
|
+
model,
|
|
6972
|
+
domain,
|
|
6973
|
+
context,
|
|
6970
6974
|
fieldsList
|
|
6971
6975
|
}) => {
|
|
6972
6976
|
const { env } = (0, provider_exports.useEnv)();
|
|
@@ -6976,12 +6980,9 @@ var searchController = ({
|
|
|
6976
6980
|
const [selectedTags, setSelectedTags] = useState15(null);
|
|
6977
6981
|
const [searchString, setSearchString] = useState15("");
|
|
6978
6982
|
const [searchMap, setSearchMap] = useState15({});
|
|
6979
|
-
const { context } = actionData || {};
|
|
6980
6983
|
const actionContext = typeof context === "string" ? evalJSONContext8(context) : context;
|
|
6981
6984
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6982
|
-
const domainAction =
|
|
6983
|
-
const aid = actionData?.id;
|
|
6984
|
-
const model = actionData?.res_model;
|
|
6985
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : evalJSONDomain7(domain, contextSearch) : [];
|
|
6985
6986
|
const clearSearch = () => {
|
|
6986
6987
|
setFilterBy([]);
|
|
6987
6988
|
setGroupBy([]);
|
|
@@ -7026,9 +7027,8 @@ var searchController = ({
|
|
|
7026
7027
|
}
|
|
7027
7028
|
};
|
|
7028
7029
|
useEffect16(() => {
|
|
7029
|
-
clearSearch();
|
|
7030
7030
|
fetchData();
|
|
7031
|
-
}, [
|
|
7031
|
+
}, [model, viewData]);
|
|
7032
7032
|
const onChangeSearchInput = (search_string) => {
|
|
7033
7033
|
setSearchString(search_string);
|
|
7034
7034
|
};
|
|
@@ -7065,27 +7065,27 @@ var searchController = ({
|
|
|
7065
7065
|
};
|
|
7066
7066
|
const formatDomain = () => {
|
|
7067
7067
|
if (domainAction) {
|
|
7068
|
-
const
|
|
7068
|
+
const domain2 = [];
|
|
7069
7069
|
if (domainAction?.length > 0) {
|
|
7070
7070
|
if (Object.keys(searchMap).length > 0) {
|
|
7071
|
-
|
|
7071
|
+
domain2.push("&");
|
|
7072
7072
|
}
|
|
7073
7073
|
domainAction.forEach((domainItem) => {
|
|
7074
|
-
|
|
7074
|
+
domain2.push(domainItem);
|
|
7075
7075
|
});
|
|
7076
7076
|
}
|
|
7077
7077
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7078
7078
|
if (!key?.includes(SearchType.GROUP)) {
|
|
7079
7079
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7080
|
-
|
|
7080
|
+
domain2.push("&");
|
|
7081
7081
|
}
|
|
7082
7082
|
const valuesOfKey = searchMap[key];
|
|
7083
7083
|
valuesOfKey.forEach((value, index) => {
|
|
7084
7084
|
if (index < valuesOfKey.length - 1) {
|
|
7085
|
-
|
|
7085
|
+
domain2.push("|");
|
|
7086
7086
|
}
|
|
7087
7087
|
if (value.domain) {
|
|
7088
|
-
|
|
7088
|
+
domain2.push(...value.domain);
|
|
7089
7089
|
return;
|
|
7090
7090
|
}
|
|
7091
7091
|
let valueDomainItem = value?.value;
|
|
@@ -7101,11 +7101,11 @@ var searchController = ({
|
|
|
7101
7101
|
}
|
|
7102
7102
|
}
|
|
7103
7103
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7104
|
-
|
|
7104
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7105
7105
|
});
|
|
7106
7106
|
}
|
|
7107
7107
|
});
|
|
7108
|
-
return [...
|
|
7108
|
+
return [...domain2];
|
|
7109
7109
|
}
|
|
7110
7110
|
};
|
|
7111
7111
|
const setTagSearch = useCallback3(
|
|
@@ -7177,7 +7177,7 @@ var searchController = ({
|
|
|
7177
7177
|
}, [searchMap]);
|
|
7178
7178
|
const handleAddTagSearch = (tag) => {
|
|
7179
7179
|
const {
|
|
7180
|
-
domain,
|
|
7180
|
+
domain: domain2,
|
|
7181
7181
|
groupIndex,
|
|
7182
7182
|
value,
|
|
7183
7183
|
type,
|
|
@@ -7186,16 +7186,16 @@ var searchController = ({
|
|
|
7186
7186
|
active,
|
|
7187
7187
|
dataIndex
|
|
7188
7188
|
} = tag;
|
|
7189
|
-
const domainFormat = new domainHelper2.Domain(
|
|
7189
|
+
const domainFormat = new domainHelper2.Domain(domain2);
|
|
7190
7190
|
if (type === SearchType.FILTER) {
|
|
7191
7191
|
addSearchItems(`${SearchType.FILTER}_${groupIndex}`, {
|
|
7192
7192
|
...tag,
|
|
7193
|
-
domain:
|
|
7193
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7194
7194
|
});
|
|
7195
7195
|
} else if (type === SearchType.SEARCH) {
|
|
7196
7196
|
addSearchItems(`${SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7197
7197
|
...tag,
|
|
7198
|
-
domain:
|
|
7198
|
+
domain: domain2 ? domainFormat.toList({
|
|
7199
7199
|
...context2,
|
|
7200
7200
|
self: value
|
|
7201
7201
|
}) : null
|
|
@@ -7203,7 +7203,7 @@ var searchController = ({
|
|
|
7203
7203
|
} else if (type === SearchType.GROUP) {
|
|
7204
7204
|
addSearchItems(`${SearchType.GROUP}`, {
|
|
7205
7205
|
...tag,
|
|
7206
|
-
domain:
|
|
7206
|
+
domain: domain2 ? domainFormat.toList({
|
|
7207
7207
|
context: context2,
|
|
7208
7208
|
self: value
|
|
7209
7209
|
}) : null
|