@acorex/platform 20.6.0-next.11 → 20.6.0-next.12
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.
|
@@ -5146,23 +5146,18 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
|
|
|
5146
5146
|
this.hasClearButton = computed(() => this.options()['hasClearButton'], ...(ngDevMode ? [{ debugName: "hasClearButton" }] : []));
|
|
5147
5147
|
this.allowSearch = computed(() => this.options()['allowSearch'] ?? false, ...(ngDevMode ? [{ debugName: "allowSearch" }] : []));
|
|
5148
5148
|
this.filter = computed(() => this.options()['filter'], ...(ngDevMode ? [{ debugName: "filter" }] : []));
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
const searchFilter = this.searchFilter();
|
|
5161
|
-
const baseFilter = untracked(() => this.filter());
|
|
5162
|
-
this.applyFilters(baseFilter, searchFilter, 'dataSource');
|
|
5163
|
-
}, ...(ngDevMode ? [{ debugName: "#searchFilterEffect" }] : []));
|
|
5149
|
+
this.searchValue = signal(undefined, ...(ngDevMode ? [{ debugName: "searchValue" }] : []));
|
|
5150
|
+
this.#effect = effect(() => {
|
|
5151
|
+
if (this.filter()) {
|
|
5152
|
+
const cleanedFilters = AXPCleanNestedFilters([this.filter()]);
|
|
5153
|
+
if (cleanedFilters.length > 0) {
|
|
5154
|
+
untracked(() => {
|
|
5155
|
+
this.dataSource()?.filter(this.filterOperatorMiddleware.transformFilter(cleanedFilters[0]));
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5158
|
+
}
|
|
5159
|
+
}, ...(ngDevMode ? [{ debugName: "#effect" }] : []));
|
|
5164
5160
|
}
|
|
5165
|
-
//#endregion
|
|
5166
5161
|
outputs() {
|
|
5167
5162
|
return [
|
|
5168
5163
|
{
|
|
@@ -5175,23 +5170,6 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
|
|
|
5175
5170
|
},
|
|
5176
5171
|
];
|
|
5177
5172
|
}
|
|
5178
|
-
handleSearchValueChange(e) {
|
|
5179
|
-
if (!e) {
|
|
5180
|
-
return;
|
|
5181
|
-
}
|
|
5182
|
-
const normalizedValue = typeof e.value === 'string' ? e.value.trim() : e.value === undefined ? undefined : String(e.value);
|
|
5183
|
-
if (normalizedValue === undefined || normalizedValue === null || normalizedValue === '') {
|
|
5184
|
-
this.searchFilter.set(null);
|
|
5185
|
-
return;
|
|
5186
|
-
}
|
|
5187
|
-
this.searchFilter.set({
|
|
5188
|
-
field: this.textField(),
|
|
5189
|
-
operator: {
|
|
5190
|
-
type: 'contains',
|
|
5191
|
-
},
|
|
5192
|
-
value: normalizedValue,
|
|
5193
|
-
});
|
|
5194
|
-
}
|
|
5195
5173
|
handleValueChange(e) {
|
|
5196
5174
|
this.selectedItems.set(e.component.selectedItems);
|
|
5197
5175
|
if (e.isUserInteraction) {
|
|
@@ -5228,14 +5206,39 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
|
|
|
5228
5206
|
}
|
|
5229
5207
|
}
|
|
5230
5208
|
}
|
|
5231
|
-
|
|
5232
|
-
|
|
5209
|
+
handleSearchValueChange(e) {
|
|
5210
|
+
if (e.isUserInteraction) {
|
|
5211
|
+
this.searchValue.set(e.value);
|
|
5212
|
+
const searchFilter = this.filterOperatorMiddleware.transformFilter({
|
|
5213
|
+
field: this.textField(),
|
|
5214
|
+
operator: { type: 'contains' },
|
|
5215
|
+
value: e.value,
|
|
5216
|
+
});
|
|
5217
|
+
const baseFilter = this.filter() ? AXPCleanNestedFilters([this.filter()])[0] : null;
|
|
5218
|
+
let mergedFilter = searchFilter;
|
|
5219
|
+
if (baseFilter) {
|
|
5220
|
+
if (this.searchValue() !== undefined) {
|
|
5221
|
+
mergedFilter = {
|
|
5222
|
+
logic: 'and',
|
|
5223
|
+
filters: [baseFilter, searchFilter],
|
|
5224
|
+
};
|
|
5225
|
+
}
|
|
5226
|
+
else {
|
|
5227
|
+
mergedFilter = baseFilter;
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
else if (this.searchValue() === undefined) {
|
|
5231
|
+
mergedFilter = {};
|
|
5232
|
+
}
|
|
5233
|
+
this.dataSource()?.filter(mergedFilter);
|
|
5234
|
+
this.dataSource()?.refresh();
|
|
5235
|
+
}
|
|
5236
|
+
}
|
|
5237
|
+
#effect;
|
|
5233
5238
|
refresh() {
|
|
5234
|
-
//TODO: why do we need this?
|
|
5235
|
-
const value = this.getValue();
|
|
5236
5239
|
setTimeout(() => {
|
|
5240
|
+
this.searchValue.set(undefined);
|
|
5237
5241
|
this.selectBox()?.refresh();
|
|
5238
|
-
this.selectBox()?.writeValue(value);
|
|
5239
5242
|
}, 0);
|
|
5240
5243
|
}
|
|
5241
5244
|
clear() {
|
|
@@ -5258,54 +5261,6 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
|
|
|
5258
5261
|
singleOrMultiple(values) {
|
|
5259
5262
|
return this.multiple() ? values : values[0];
|
|
5260
5263
|
}
|
|
5261
|
-
/**
|
|
5262
|
-
* Applies merged filters to the data source and triggers appropriate refresh behavior.
|
|
5263
|
-
*/
|
|
5264
|
-
applyFilters(baseFilter, textFilter, refreshTarget) {
|
|
5265
|
-
const dataSource = this.dataSource();
|
|
5266
|
-
if (!dataSource) {
|
|
5267
|
-
return;
|
|
5268
|
-
}
|
|
5269
|
-
const mergedFilter = this.mergeFilters(baseFilter, textFilter);
|
|
5270
|
-
if (mergedFilter) {
|
|
5271
|
-
dataSource.filter(this.filterOperatorMiddleware.transformFilter(mergedFilter));
|
|
5272
|
-
}
|
|
5273
|
-
else if (typeof dataSource.clearFilter === 'function') {
|
|
5274
|
-
dataSource.clearFilter();
|
|
5275
|
-
}
|
|
5276
|
-
else {
|
|
5277
|
-
dataSource.filter(undefined);
|
|
5278
|
-
}
|
|
5279
|
-
if (refreshTarget === 'component') {
|
|
5280
|
-
this.refresh();
|
|
5281
|
-
}
|
|
5282
|
-
else if (refreshTarget === 'dataSource') {
|
|
5283
|
-
const ds = dataSource;
|
|
5284
|
-
if (typeof ds.refresh === 'function') {
|
|
5285
|
-
ds.refresh();
|
|
5286
|
-
}
|
|
5287
|
-
}
|
|
5288
|
-
}
|
|
5289
|
-
/**
|
|
5290
|
-
* Merges provided filters using logical AND while cleaning invalid entries.
|
|
5291
|
-
*/
|
|
5292
|
-
mergeFilters(...filters) {
|
|
5293
|
-
const validFilters = filters.filter(Boolean);
|
|
5294
|
-
if (!validFilters.length) {
|
|
5295
|
-
return null;
|
|
5296
|
-
}
|
|
5297
|
-
const cleanedFilters = AXPCleanNestedFilters(validFilters);
|
|
5298
|
-
if (cleanedFilters.length === 0) {
|
|
5299
|
-
return null;
|
|
5300
|
-
}
|
|
5301
|
-
if (cleanedFilters.length === 1) {
|
|
5302
|
-
return cleanedFilters[0];
|
|
5303
|
-
}
|
|
5304
|
-
return {
|
|
5305
|
-
logic: 'and',
|
|
5306
|
-
filters: cleanedFilters,
|
|
5307
|
-
};
|
|
5308
|
-
}
|
|
5309
5264
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPSelectBoxWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
5310
5265
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: AXPSelectBoxWidgetEditComponent, isStandalone: true, selector: "axp-select-box-widget-edit", host: { properties: { "class": "this.__class" } }, viewQueries: [{ propertyName: "selectBox", first: true, predicate: AXSelectBoxComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
5311
5266
|
<ax-select-box
|
|
@@ -5321,7 +5276,7 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
|
|
|
5321
5276
|
(onValueChanged)="handleValueChange($event)"
|
|
5322
5277
|
>
|
|
5323
5278
|
@if (allowSearch()) {
|
|
5324
|
-
<ax-search-box [autoSearch]="false" (onValueChanged)="handleSearchValueChange($event)"
|
|
5279
|
+
<ax-search-box [autoSearch]="false" [ngModel]="searchValue()" (onValueChanged)="handleSearchValueChange($event)"
|
|
5325
5280
|
><ax-clear-button></ax-clear-button
|
|
5326
5281
|
></ax-search-box>
|
|
5327
5282
|
}
|
|
@@ -5356,7 +5311,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
5356
5311
|
(onValueChanged)="handleValueChange($event)"
|
|
5357
5312
|
>
|
|
5358
5313
|
@if (allowSearch()) {
|
|
5359
|
-
<ax-search-box [autoSearch]="false" (onValueChanged)="handleSearchValueChange($event)"
|
|
5314
|
+
<ax-search-box [autoSearch]="false" [ngModel]="searchValue()" (onValueChanged)="handleSearchValueChange($event)"
|
|
5360
5315
|
><ax-clear-button></ax-clear-button
|
|
5361
5316
|
></ax-search-box>
|
|
5362
5317
|
}
|