@acorex/platform 20.9.24 → 20.9.26
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.
|
@@ -15158,6 +15158,7 @@ class AXPLookupWidgetSelectComponent extends LookupWidgetLookBase {
|
|
|
15158
15158
|
throw new Error(`Entity ${entity.name} does not have a list query`);
|
|
15159
15159
|
}
|
|
15160
15160
|
this.mergeFilter(e, this.customFilter()());
|
|
15161
|
+
this.expandSearchToInlineFields(e, entity, this.displayField()());
|
|
15161
15162
|
// Apply default sort order if no sort is already specified
|
|
15162
15163
|
if (defaultSorts.length > 0 && (!e.sort || e.sort.length === 0)) {
|
|
15163
15164
|
e.sort = defaultSorts;
|
|
@@ -15208,6 +15209,67 @@ class AXPLookupWidgetSelectComponent extends LookupWidgetLookBase {
|
|
|
15208
15209
|
}
|
|
15209
15210
|
return item;
|
|
15210
15211
|
}
|
|
15212
|
+
/**
|
|
15213
|
+
* Expands ax-select-box search (contains on displayField) to OR across entity inline filter fields.
|
|
15214
|
+
*/
|
|
15215
|
+
expandSearchToInlineFields(request, entity, displayField) {
|
|
15216
|
+
const inlineFields = entity.properties
|
|
15217
|
+
.filter((p) => p.options?.filter?.inline?.enabled)
|
|
15218
|
+
.map((p) => p.name);
|
|
15219
|
+
if (!request.filter || inlineFields.length === 0) {
|
|
15220
|
+
return;
|
|
15221
|
+
}
|
|
15222
|
+
const searchTerm = this.extractDisplayFieldContainsValue(request.filter, displayField);
|
|
15223
|
+
if (searchTerm == null || `${searchTerm}`.trim() === '') {
|
|
15224
|
+
return;
|
|
15225
|
+
}
|
|
15226
|
+
const inlineSearchFilter = inlineFields.length === 1
|
|
15227
|
+
? {
|
|
15228
|
+
field: inlineFields[0],
|
|
15229
|
+
operator: { type: 'contains' },
|
|
15230
|
+
value: searchTerm,
|
|
15231
|
+
}
|
|
15232
|
+
: {
|
|
15233
|
+
field: null,
|
|
15234
|
+
logic: 'or',
|
|
15235
|
+
operator: null,
|
|
15236
|
+
filters: inlineFields.map((field) => ({
|
|
15237
|
+
field,
|
|
15238
|
+
operator: { type: 'contains' },
|
|
15239
|
+
value: searchTerm,
|
|
15240
|
+
})),
|
|
15241
|
+
};
|
|
15242
|
+
request.filter = this.replaceDisplayFieldContainsFilter(request.filter, displayField, inlineSearchFilter);
|
|
15243
|
+
}
|
|
15244
|
+
isDisplayFieldContainsFilter(filter, displayField) {
|
|
15245
|
+
return (filter.field === displayField &&
|
|
15246
|
+
filter.operator?.type === 'contains' &&
|
|
15247
|
+
!filter.filters?.length);
|
|
15248
|
+
}
|
|
15249
|
+
extractDisplayFieldContainsValue(filter, displayField) {
|
|
15250
|
+
if (this.isDisplayFieldContainsFilter(filter, displayField)) {
|
|
15251
|
+
return filter.value;
|
|
15252
|
+
}
|
|
15253
|
+
for (const child of filter.filters ?? []) {
|
|
15254
|
+
const value = this.extractDisplayFieldContainsValue(child, displayField);
|
|
15255
|
+
if (value != null) {
|
|
15256
|
+
return value;
|
|
15257
|
+
}
|
|
15258
|
+
}
|
|
15259
|
+
return undefined;
|
|
15260
|
+
}
|
|
15261
|
+
replaceDisplayFieldContainsFilter(filter, displayField, replacement) {
|
|
15262
|
+
if (this.isDisplayFieldContainsFilter(filter, displayField)) {
|
|
15263
|
+
return replacement;
|
|
15264
|
+
}
|
|
15265
|
+
if (filter.filters?.length) {
|
|
15266
|
+
return {
|
|
15267
|
+
...filter,
|
|
15268
|
+
filters: filter.filters.map((child) => this.replaceDisplayFieldContainsFilter(child, displayField, replacement)),
|
|
15269
|
+
};
|
|
15270
|
+
}
|
|
15271
|
+
return filter;
|
|
15272
|
+
}
|
|
15211
15273
|
/**
|
|
15212
15274
|
* Merge custom filter into data source query
|
|
15213
15275
|
*/
|