@fctc/widget-logic 1.10.5 → 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 +25 -20
- package/dist/index.mjs +25 -20
- package/dist/widget.d.mts +7 -1
- package/dist/widget.d.ts +7 -1
- package/dist/widget.js +25 -20
- package/dist/widget.mjs +25 -20
- 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"
|
|
@@ -7204,7 +7206,13 @@ var import_constants5 = require("@fctc/interface-logic/constants");
|
|
|
7204
7206
|
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
7205
7207
|
var import_moment2 = __toESM(require_moment());
|
|
7206
7208
|
var import_react24 = require("react");
|
|
7207
|
-
var searchController = ({
|
|
7209
|
+
var searchController = ({
|
|
7210
|
+
viewData,
|
|
7211
|
+
model,
|
|
7212
|
+
domain,
|
|
7213
|
+
context,
|
|
7214
|
+
fieldsList
|
|
7215
|
+
}) => {
|
|
7208
7216
|
const { env } = (0, provider_exports.useEnv)();
|
|
7209
7217
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
7210
7218
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
@@ -7212,12 +7220,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7212
7220
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
7213
7221
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
7214
7222
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
7215
|
-
const { context } = actionData || {};
|
|
7216
7223
|
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
7217
7224
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7218
|
-
const domainAction =
|
|
7219
|
-
const aid = actionData?.id;
|
|
7220
|
-
const model = actionData?.res_model;
|
|
7225
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
7221
7226
|
const clearSearch = () => {
|
|
7222
7227
|
setFilterBy([]);
|
|
7223
7228
|
setGroupBy([]);
|
|
@@ -7263,7 +7268,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7263
7268
|
};
|
|
7264
7269
|
(0, import_react24.useEffect)(() => {
|
|
7265
7270
|
fetchData();
|
|
7266
|
-
}, [
|
|
7271
|
+
}, [model, viewData]);
|
|
7267
7272
|
const onChangeSearchInput = (search_string) => {
|
|
7268
7273
|
setSearchString(search_string);
|
|
7269
7274
|
};
|
|
@@ -7300,27 +7305,27 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7300
7305
|
};
|
|
7301
7306
|
const formatDomain = () => {
|
|
7302
7307
|
if (domainAction) {
|
|
7303
|
-
const
|
|
7308
|
+
const domain2 = [];
|
|
7304
7309
|
if (domainAction?.length > 0) {
|
|
7305
7310
|
if (Object.keys(searchMap).length > 0) {
|
|
7306
|
-
|
|
7311
|
+
domain2.push("&");
|
|
7307
7312
|
}
|
|
7308
7313
|
domainAction.forEach((domainItem) => {
|
|
7309
|
-
|
|
7314
|
+
domain2.push(domainItem);
|
|
7310
7315
|
});
|
|
7311
7316
|
}
|
|
7312
7317
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7313
7318
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7314
7319
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7315
|
-
|
|
7320
|
+
domain2.push("&");
|
|
7316
7321
|
}
|
|
7317
7322
|
const valuesOfKey = searchMap[key];
|
|
7318
7323
|
valuesOfKey.forEach((value, index) => {
|
|
7319
7324
|
if (index < valuesOfKey.length - 1) {
|
|
7320
|
-
|
|
7325
|
+
domain2.push("|");
|
|
7321
7326
|
}
|
|
7322
7327
|
if (value.domain) {
|
|
7323
|
-
|
|
7328
|
+
domain2.push(...value.domain);
|
|
7324
7329
|
return;
|
|
7325
7330
|
}
|
|
7326
7331
|
let valueDomainItem = value?.value;
|
|
@@ -7336,11 +7341,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7336
7341
|
}
|
|
7337
7342
|
}
|
|
7338
7343
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7339
|
-
|
|
7344
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7340
7345
|
});
|
|
7341
7346
|
}
|
|
7342
7347
|
});
|
|
7343
|
-
return [...
|
|
7348
|
+
return [...domain2];
|
|
7344
7349
|
}
|
|
7345
7350
|
};
|
|
7346
7351
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7412,7 +7417,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7412
7417
|
}, [searchMap]);
|
|
7413
7418
|
const handleAddTagSearch = (tag) => {
|
|
7414
7419
|
const {
|
|
7415
|
-
domain,
|
|
7420
|
+
domain: domain2,
|
|
7416
7421
|
groupIndex,
|
|
7417
7422
|
value,
|
|
7418
7423
|
type,
|
|
@@ -7421,16 +7426,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7421
7426
|
active,
|
|
7422
7427
|
dataIndex
|
|
7423
7428
|
} = tag;
|
|
7424
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7429
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain2);
|
|
7425
7430
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7426
7431
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7427
7432
|
...tag,
|
|
7428
|
-
domain:
|
|
7433
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7429
7434
|
});
|
|
7430
7435
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7431
7436
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7432
7437
|
...tag,
|
|
7433
|
-
domain:
|
|
7438
|
+
domain: domain2 ? domainFormat.toList({
|
|
7434
7439
|
...context2,
|
|
7435
7440
|
self: value
|
|
7436
7441
|
}) : null
|
|
@@ -7438,7 +7443,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7438
7443
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7439
7444
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7440
7445
|
...tag,
|
|
7441
|
-
domain:
|
|
7446
|
+
domain: domain2 ? domainFormat.toList({
|
|
7442
7447
|
context: context2,
|
|
7443
7448
|
self: value
|
|
7444
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"
|
|
@@ -7262,7 +7264,13 @@ import {
|
|
|
7262
7264
|
validateAndParseDate
|
|
7263
7265
|
} from "@fctc/interface-logic/utils";
|
|
7264
7266
|
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
7265
|
-
var searchController = ({
|
|
7267
|
+
var searchController = ({
|
|
7268
|
+
viewData,
|
|
7269
|
+
model,
|
|
7270
|
+
domain,
|
|
7271
|
+
context,
|
|
7272
|
+
fieldsList
|
|
7273
|
+
}) => {
|
|
7266
7274
|
const { env } = (0, provider_exports.useEnv)();
|
|
7267
7275
|
const [filterBy, setFilterBy] = useState15(null);
|
|
7268
7276
|
const [searchBy, setSearchBy] = useState15(null);
|
|
@@ -7270,12 +7278,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7270
7278
|
const [selectedTags, setSelectedTags] = useState15(null);
|
|
7271
7279
|
const [searchString, setSearchString] = useState15("");
|
|
7272
7280
|
const [searchMap, setSearchMap] = useState15({});
|
|
7273
|
-
const { context } = actionData || {};
|
|
7274
7281
|
const actionContext = typeof context === "string" ? evalJSONContext8(context) : context;
|
|
7275
7282
|
const contextSearch = { ...env.context, ...actionContext };
|
|
7276
|
-
const domainAction =
|
|
7277
|
-
const aid = actionData?.id;
|
|
7278
|
-
const model = actionData?.res_model;
|
|
7283
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : evalJSONDomain7(domain, contextSearch) : [];
|
|
7279
7284
|
const clearSearch = () => {
|
|
7280
7285
|
setFilterBy([]);
|
|
7281
7286
|
setGroupBy([]);
|
|
@@ -7321,7 +7326,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7321
7326
|
};
|
|
7322
7327
|
useEffect16(() => {
|
|
7323
7328
|
fetchData();
|
|
7324
|
-
}, [
|
|
7329
|
+
}, [model, viewData]);
|
|
7325
7330
|
const onChangeSearchInput = (search_string) => {
|
|
7326
7331
|
setSearchString(search_string);
|
|
7327
7332
|
};
|
|
@@ -7358,27 +7363,27 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7358
7363
|
};
|
|
7359
7364
|
const formatDomain = () => {
|
|
7360
7365
|
if (domainAction) {
|
|
7361
|
-
const
|
|
7366
|
+
const domain2 = [];
|
|
7362
7367
|
if (domainAction?.length > 0) {
|
|
7363
7368
|
if (Object.keys(searchMap).length > 0) {
|
|
7364
|
-
|
|
7369
|
+
domain2.push("&");
|
|
7365
7370
|
}
|
|
7366
7371
|
domainAction.forEach((domainItem) => {
|
|
7367
|
-
|
|
7372
|
+
domain2.push(domainItem);
|
|
7368
7373
|
});
|
|
7369
7374
|
}
|
|
7370
7375
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7371
7376
|
if (!key?.includes(SearchType.GROUP)) {
|
|
7372
7377
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7373
|
-
|
|
7378
|
+
domain2.push("&");
|
|
7374
7379
|
}
|
|
7375
7380
|
const valuesOfKey = searchMap[key];
|
|
7376
7381
|
valuesOfKey.forEach((value, index) => {
|
|
7377
7382
|
if (index < valuesOfKey.length - 1) {
|
|
7378
|
-
|
|
7383
|
+
domain2.push("|");
|
|
7379
7384
|
}
|
|
7380
7385
|
if (value.domain) {
|
|
7381
|
-
|
|
7386
|
+
domain2.push(...value.domain);
|
|
7382
7387
|
return;
|
|
7383
7388
|
}
|
|
7384
7389
|
let valueDomainItem = value?.value;
|
|
@@ -7394,11 +7399,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7394
7399
|
}
|
|
7395
7400
|
}
|
|
7396
7401
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7397
|
-
|
|
7402
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7398
7403
|
});
|
|
7399
7404
|
}
|
|
7400
7405
|
});
|
|
7401
|
-
return [...
|
|
7406
|
+
return [...domain2];
|
|
7402
7407
|
}
|
|
7403
7408
|
};
|
|
7404
7409
|
const setTagSearch = useCallback3(
|
|
@@ -7470,7 +7475,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7470
7475
|
}, [searchMap]);
|
|
7471
7476
|
const handleAddTagSearch = (tag) => {
|
|
7472
7477
|
const {
|
|
7473
|
-
domain,
|
|
7478
|
+
domain: domain2,
|
|
7474
7479
|
groupIndex,
|
|
7475
7480
|
value,
|
|
7476
7481
|
type,
|
|
@@ -7479,16 +7484,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7479
7484
|
active,
|
|
7480
7485
|
dataIndex
|
|
7481
7486
|
} = tag;
|
|
7482
|
-
const domainFormat = new domainHelper2.Domain(
|
|
7487
|
+
const domainFormat = new domainHelper2.Domain(domain2);
|
|
7483
7488
|
if (type === SearchType.FILTER) {
|
|
7484
7489
|
addSearchItems(`${SearchType.FILTER}_${groupIndex}`, {
|
|
7485
7490
|
...tag,
|
|
7486
|
-
domain:
|
|
7491
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7487
7492
|
});
|
|
7488
7493
|
} else if (type === SearchType.SEARCH) {
|
|
7489
7494
|
addSearchItems(`${SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7490
7495
|
...tag,
|
|
7491
|
-
domain:
|
|
7496
|
+
domain: domain2 ? domainFormat.toList({
|
|
7492
7497
|
...context2,
|
|
7493
7498
|
self: value
|
|
7494
7499
|
}) : null
|
|
@@ -7496,7 +7501,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7496
7501
|
} else if (type === SearchType.GROUP) {
|
|
7497
7502
|
addSearchItems(`${SearchType.GROUP}`, {
|
|
7498
7503
|
...tag,
|
|
7499
|
-
domain:
|
|
7504
|
+
domain: domain2 ? domainFormat.toList({
|
|
7500
7505
|
context: context2,
|
|
7501
7506
|
self: value
|
|
7502
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"
|
|
@@ -6930,7 +6932,13 @@ var import_constants5 = require("@fctc/interface-logic/constants");
|
|
|
6930
6932
|
var import_utils14 = require("@fctc/interface-logic/utils");
|
|
6931
6933
|
var import_moment2 = __toESM(require_moment());
|
|
6932
6934
|
var import_react24 = require("react");
|
|
6933
|
-
var searchController = ({
|
|
6935
|
+
var searchController = ({
|
|
6936
|
+
viewData,
|
|
6937
|
+
model,
|
|
6938
|
+
domain,
|
|
6939
|
+
context,
|
|
6940
|
+
fieldsList
|
|
6941
|
+
}) => {
|
|
6934
6942
|
const { env } = (0, provider_exports.useEnv)();
|
|
6935
6943
|
const [filterBy, setFilterBy] = (0, import_react24.useState)(null);
|
|
6936
6944
|
const [searchBy, setSearchBy] = (0, import_react24.useState)(null);
|
|
@@ -6938,12 +6946,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
6938
6946
|
const [selectedTags, setSelectedTags] = (0, import_react24.useState)(null);
|
|
6939
6947
|
const [searchString, setSearchString] = (0, import_react24.useState)("");
|
|
6940
6948
|
const [searchMap, setSearchMap] = (0, import_react24.useState)({});
|
|
6941
|
-
const { context } = actionData || {};
|
|
6942
6949
|
const actionContext = typeof context === "string" ? (0, import_utils14.evalJSONContext)(context) : context;
|
|
6943
6950
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6944
|
-
const domainAction =
|
|
6945
|
-
const aid = actionData?.id;
|
|
6946
|
-
const model = actionData?.res_model;
|
|
6951
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : (0, import_utils14.evalJSONDomain)(domain, contextSearch) : [];
|
|
6947
6952
|
const clearSearch = () => {
|
|
6948
6953
|
setFilterBy([]);
|
|
6949
6954
|
setGroupBy([]);
|
|
@@ -6989,7 +6994,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
6989
6994
|
};
|
|
6990
6995
|
(0, import_react24.useEffect)(() => {
|
|
6991
6996
|
fetchData();
|
|
6992
|
-
}, [
|
|
6997
|
+
}, [model, viewData]);
|
|
6993
6998
|
const onChangeSearchInput = (search_string) => {
|
|
6994
6999
|
setSearchString(search_string);
|
|
6995
7000
|
};
|
|
@@ -7026,27 +7031,27 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7026
7031
|
};
|
|
7027
7032
|
const formatDomain = () => {
|
|
7028
7033
|
if (domainAction) {
|
|
7029
|
-
const
|
|
7034
|
+
const domain2 = [];
|
|
7030
7035
|
if (domainAction?.length > 0) {
|
|
7031
7036
|
if (Object.keys(searchMap).length > 0) {
|
|
7032
|
-
|
|
7037
|
+
domain2.push("&");
|
|
7033
7038
|
}
|
|
7034
7039
|
domainAction.forEach((domainItem) => {
|
|
7035
|
-
|
|
7040
|
+
domain2.push(domainItem);
|
|
7036
7041
|
});
|
|
7037
7042
|
}
|
|
7038
7043
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7039
7044
|
if (!key?.includes(import_constants5.SearchType.GROUP)) {
|
|
7040
7045
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7041
|
-
|
|
7046
|
+
domain2.push("&");
|
|
7042
7047
|
}
|
|
7043
7048
|
const valuesOfKey = searchMap[key];
|
|
7044
7049
|
valuesOfKey.forEach((value, index) => {
|
|
7045
7050
|
if (index < valuesOfKey.length - 1) {
|
|
7046
|
-
|
|
7051
|
+
domain2.push("|");
|
|
7047
7052
|
}
|
|
7048
7053
|
if (value.domain) {
|
|
7049
|
-
|
|
7054
|
+
domain2.push(...value.domain);
|
|
7050
7055
|
return;
|
|
7051
7056
|
}
|
|
7052
7057
|
let valueDomainItem = value?.value;
|
|
@@ -7062,11 +7067,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7062
7067
|
}
|
|
7063
7068
|
}
|
|
7064
7069
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7065
|
-
|
|
7070
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7066
7071
|
});
|
|
7067
7072
|
}
|
|
7068
7073
|
});
|
|
7069
|
-
return [...
|
|
7074
|
+
return [...domain2];
|
|
7070
7075
|
}
|
|
7071
7076
|
};
|
|
7072
7077
|
const setTagSearch = (0, import_react24.useCallback)(
|
|
@@ -7138,7 +7143,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7138
7143
|
}, [searchMap]);
|
|
7139
7144
|
const handleAddTagSearch = (tag) => {
|
|
7140
7145
|
const {
|
|
7141
|
-
domain,
|
|
7146
|
+
domain: domain2,
|
|
7142
7147
|
groupIndex,
|
|
7143
7148
|
value,
|
|
7144
7149
|
type,
|
|
@@ -7147,16 +7152,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7147
7152
|
active,
|
|
7148
7153
|
dataIndex
|
|
7149
7154
|
} = tag;
|
|
7150
|
-
const domainFormat = new import_utils14.domainHelper.Domain(
|
|
7155
|
+
const domainFormat = new import_utils14.domainHelper.Domain(domain2);
|
|
7151
7156
|
if (type === import_constants5.SearchType.FILTER) {
|
|
7152
7157
|
addSearchItems(`${import_constants5.SearchType.FILTER}_${groupIndex}`, {
|
|
7153
7158
|
...tag,
|
|
7154
|
-
domain:
|
|
7159
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7155
7160
|
});
|
|
7156
7161
|
} else if (type === import_constants5.SearchType.SEARCH) {
|
|
7157
7162
|
addSearchItems(`${import_constants5.SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7158
7163
|
...tag,
|
|
7159
|
-
domain:
|
|
7164
|
+
domain: domain2 ? domainFormat.toList({
|
|
7160
7165
|
...context2,
|
|
7161
7166
|
self: value
|
|
7162
7167
|
}) : null
|
|
@@ -7164,7 +7169,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7164
7169
|
} else if (type === import_constants5.SearchType.GROUP) {
|
|
7165
7170
|
addSearchItems(`${import_constants5.SearchType.GROUP}`, {
|
|
7166
7171
|
...tag,
|
|
7167
|
-
domain:
|
|
7172
|
+
domain: domain2 ? domainFormat.toList({
|
|
7168
7173
|
context: context2,
|
|
7169
7174
|
self: value
|
|
7170
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"
|
|
@@ -6964,7 +6966,13 @@ import {
|
|
|
6964
6966
|
validateAndParseDate
|
|
6965
6967
|
} from "@fctc/interface-logic/utils";
|
|
6966
6968
|
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
6967
|
-
var searchController = ({
|
|
6969
|
+
var searchController = ({
|
|
6970
|
+
viewData,
|
|
6971
|
+
model,
|
|
6972
|
+
domain,
|
|
6973
|
+
context,
|
|
6974
|
+
fieldsList
|
|
6975
|
+
}) => {
|
|
6968
6976
|
const { env } = (0, provider_exports.useEnv)();
|
|
6969
6977
|
const [filterBy, setFilterBy] = useState15(null);
|
|
6970
6978
|
const [searchBy, setSearchBy] = useState15(null);
|
|
@@ -6972,12 +6980,9 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
6972
6980
|
const [selectedTags, setSelectedTags] = useState15(null);
|
|
6973
6981
|
const [searchString, setSearchString] = useState15("");
|
|
6974
6982
|
const [searchMap, setSearchMap] = useState15({});
|
|
6975
|
-
const { context } = actionData || {};
|
|
6976
6983
|
const actionContext = typeof context === "string" ? evalJSONContext8(context) : context;
|
|
6977
6984
|
const contextSearch = { ...env.context, ...actionContext };
|
|
6978
|
-
const domainAction =
|
|
6979
|
-
const aid = actionData?.id;
|
|
6980
|
-
const model = actionData?.res_model;
|
|
6985
|
+
const domainAction = domain ? Array.isArray(domain) ? [...domain] : evalJSONDomain7(domain, contextSearch) : [];
|
|
6981
6986
|
const clearSearch = () => {
|
|
6982
6987
|
setFilterBy([]);
|
|
6983
6988
|
setGroupBy([]);
|
|
@@ -7023,7 +7028,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7023
7028
|
};
|
|
7024
7029
|
useEffect16(() => {
|
|
7025
7030
|
fetchData();
|
|
7026
|
-
}, [
|
|
7031
|
+
}, [model, viewData]);
|
|
7027
7032
|
const onChangeSearchInput = (search_string) => {
|
|
7028
7033
|
setSearchString(search_string);
|
|
7029
7034
|
};
|
|
@@ -7060,27 +7065,27 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7060
7065
|
};
|
|
7061
7066
|
const formatDomain = () => {
|
|
7062
7067
|
if (domainAction) {
|
|
7063
|
-
const
|
|
7068
|
+
const domain2 = [];
|
|
7064
7069
|
if (domainAction?.length > 0) {
|
|
7065
7070
|
if (Object.keys(searchMap).length > 0) {
|
|
7066
|
-
|
|
7071
|
+
domain2.push("&");
|
|
7067
7072
|
}
|
|
7068
7073
|
domainAction.forEach((domainItem) => {
|
|
7069
|
-
|
|
7074
|
+
domain2.push(domainItem);
|
|
7070
7075
|
});
|
|
7071
7076
|
}
|
|
7072
7077
|
Object.keys(searchMap).forEach((key, keyIndex, keys) => {
|
|
7073
7078
|
if (!key?.includes(SearchType.GROUP)) {
|
|
7074
7079
|
if (keys.length > 1 && keyIndex < keys.length - 1) {
|
|
7075
|
-
|
|
7080
|
+
domain2.push("&");
|
|
7076
7081
|
}
|
|
7077
7082
|
const valuesOfKey = searchMap[key];
|
|
7078
7083
|
valuesOfKey.forEach((value, index) => {
|
|
7079
7084
|
if (index < valuesOfKey.length - 1) {
|
|
7080
|
-
|
|
7085
|
+
domain2.push("|");
|
|
7081
7086
|
}
|
|
7082
7087
|
if (value.domain) {
|
|
7083
|
-
|
|
7088
|
+
domain2.push(...value.domain);
|
|
7084
7089
|
return;
|
|
7085
7090
|
}
|
|
7086
7091
|
let valueDomainItem = value?.value;
|
|
@@ -7096,11 +7101,11 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7096
7101
|
}
|
|
7097
7102
|
}
|
|
7098
7103
|
const operator = value?.modelType === "date" || value?.modelType === "datetime" || value?.modelType === "boolean" || value?.modelType === "integer" ? value?.operator ?? "=" : value.operator ?? "ilike";
|
|
7099
|
-
|
|
7104
|
+
domain2.push([value.name, operator, valueDomainItem]);
|
|
7100
7105
|
});
|
|
7101
7106
|
}
|
|
7102
7107
|
});
|
|
7103
|
-
return [...
|
|
7108
|
+
return [...domain2];
|
|
7104
7109
|
}
|
|
7105
7110
|
};
|
|
7106
7111
|
const setTagSearch = useCallback3(
|
|
@@ -7172,7 +7177,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7172
7177
|
}, [searchMap]);
|
|
7173
7178
|
const handleAddTagSearch = (tag) => {
|
|
7174
7179
|
const {
|
|
7175
|
-
domain,
|
|
7180
|
+
domain: domain2,
|
|
7176
7181
|
groupIndex,
|
|
7177
7182
|
value,
|
|
7178
7183
|
type,
|
|
@@ -7181,16 +7186,16 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7181
7186
|
active,
|
|
7182
7187
|
dataIndex
|
|
7183
7188
|
} = tag;
|
|
7184
|
-
const domainFormat = new domainHelper2.Domain(
|
|
7189
|
+
const domainFormat = new domainHelper2.Domain(domain2);
|
|
7185
7190
|
if (type === SearchType.FILTER) {
|
|
7186
7191
|
addSearchItems(`${SearchType.FILTER}_${groupIndex}`, {
|
|
7187
7192
|
...tag,
|
|
7188
|
-
domain:
|
|
7193
|
+
domain: domain2 ? domainFormat.toList(context2) : null
|
|
7189
7194
|
});
|
|
7190
7195
|
} else if (type === SearchType.SEARCH) {
|
|
7191
7196
|
addSearchItems(`${SearchType.SEARCH}_${String(dataIndex)}`, {
|
|
7192
7197
|
...tag,
|
|
7193
|
-
domain:
|
|
7198
|
+
domain: domain2 ? domainFormat.toList({
|
|
7194
7199
|
...context2,
|
|
7195
7200
|
self: value
|
|
7196
7201
|
}) : null
|
|
@@ -7198,7 +7203,7 @@ var searchController = ({ viewData, actionData, fieldsList }) => {
|
|
|
7198
7203
|
} else if (type === SearchType.GROUP) {
|
|
7199
7204
|
addSearchItems(`${SearchType.GROUP}`, {
|
|
7200
7205
|
...tag,
|
|
7201
|
-
domain:
|
|
7206
|
+
domain: domain2 ? domainFormat.toList({
|
|
7202
7207
|
context: context2,
|
|
7203
7208
|
self: value
|
|
7204
7209
|
}) : null
|