@acorex/platform 20.9.37 → 20.9.39

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.
@@ -32,7 +32,7 @@ import { FormsModule } from '@angular/forms';
32
32
  import * as i3 from '@acorex/components/select-box';
33
33
  import { AXSelectBoxComponent, AXSelectBoxModule } from '@acorex/components/select-box';
34
34
  import { setSmart, extractValue, AXPRegionalSetting, shouldUseLocaleMapShape, buildLocaleTextMapValue, isSelectionValueEqual, AXPWidgetsCatalog, AXPDataGenerator, AXP_INTEGRATION_AUTH_METHOD_TYPE, sortByMultiLanguageString, isFormValueEqual, normalizeDefinitionCategories } from '@acorex/platform/contracts';
35
- import { set, get, castArray, isNil, isNull, isEmpty, first, isPlainObject, isString, cloneDeep, isEqual, isNumber, defaultTo, has } from 'lodash-es';
35
+ import { set, get, castArray, isNil, isNull, isEmpty, first, isPlainObject, isString, cloneDeep, isEqual, isNumber, defaultTo, isArray, has } from 'lodash-es';
36
36
  import * as i2$2 from '@acorex/components/loading';
37
37
  import { AXLoadingModule } from '@acorex/components/loading';
38
38
  import { AXPCommandService, AXPQueryService, provideQuerySetups } from '@acorex/platform/runtime';
@@ -7373,6 +7373,7 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
7373
7373
  /**
7374
7374
  * Bind resolved row object(s) when available so ax-select-box can render textField labels.
7375
7375
  * Falls back to primitive key(s) while selectedItems are still loading.
7376
+ * In filterMode, prefer stored `displayText` when byKey has not resolved a real label yet.
7376
7377
  * Label translation is handled by ax-select-box (`getDisplayText(item) | translate`).
7377
7378
  */
7378
7379
  this.selectBoxModel = computed(() => {
@@ -7380,22 +7381,23 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
7380
7381
  if (this.filterMode()) {
7381
7382
  if (this.multiple()) {
7382
7383
  if (items.length) {
7383
- return items;
7384
+ return items.map((item, index) => this.withFilterDisplayText(item, index));
7384
7385
  }
7385
7386
  const val = this.selectFilterDisplayValue();
7386
- return Array.isArray(val) ? val : castArray(val ?? []);
7387
+ const values = isArray(val) ? val : castArray(val ?? []);
7388
+ return values.map((value, index) => this.withFilterDisplayText(value, index));
7387
7389
  }
7388
7390
  if (items[0] != null) {
7389
- return items[0];
7391
+ return this.withFilterDisplayText(items[0]);
7390
7392
  }
7391
- return this.selectFilterDisplayValue();
7393
+ return this.withFilterDisplayText(this.selectFilterDisplayValue());
7392
7394
  }
7393
7395
  if (this.multiple()) {
7394
7396
  if (items.length) {
7395
7397
  return items;
7396
7398
  }
7397
7399
  const value = this.getValue();
7398
- return Array.isArray(value) ? value : castArray(value ?? []);
7400
+ return isArray(value) ? value : castArray(value ?? []);
7399
7401
  }
7400
7402
  if (items[0] != null) {
7401
7403
  return items[0];
@@ -7474,6 +7476,60 @@ class AXPSelectBoxWidgetEditComponent extends AXPDataListWidgetComponent {
7474
7476
  resolveSelectedItemsValue() {
7475
7477
  return this.filterMode() ? this.selectFilterDisplayValue() : this.getValue();
7476
7478
  }
7479
+ /** Reads `displayText` from filterMode payload `{ value, operation, displayText }`. */
7480
+ getFilterDisplayText(index) {
7481
+ const raw = this.getValue();
7482
+ if (isNil(raw) || typeof raw !== 'object' || !('displayText' in raw)) {
7483
+ return undefined;
7484
+ }
7485
+ const displayText = raw.displayText;
7486
+ if (isArray(displayText)) {
7487
+ const text = displayText[index ?? 0];
7488
+ if (isString(text)) {
7489
+ return text;
7490
+ }
7491
+ return isNil(text) ? undefined : String(text);
7492
+ }
7493
+ if (isString(displayText)) {
7494
+ return displayText;
7495
+ }
7496
+ if (isNil(displayText) || displayText === '') {
7497
+ return undefined;
7498
+ }
7499
+ return String(displayText);
7500
+ }
7501
+ /**
7502
+ * Ensures filterMode select shows a label: when selectedItems/byKey only have the raw key
7503
+ * (or are missing), synthesize/enrich the model with stored `displayText`.
7504
+ */
7505
+ withFilterDisplayText(item, index) {
7506
+ const displayText = this.getFilterDisplayText(index);
7507
+ if (isNil(displayText) || displayText === '') {
7508
+ return item;
7509
+ }
7510
+ const valueField = this.valueField();
7511
+ const textField = this.textField();
7512
+ if (item != null && typeof item === 'object') {
7513
+ const record = item;
7514
+ const currentText = get(record, textField);
7515
+ const currentValue = get(record, valueField);
7516
+ const looksUnresolved = isNil(currentText) ||
7517
+ currentText === '' ||
7518
+ currentText === currentValue ||
7519
+ String(currentText) === String(currentValue);
7520
+ if (!looksUnresolved) {
7521
+ return item;
7522
+ }
7523
+ return {
7524
+ ...record,
7525
+ [textField]: displayText,
7526
+ };
7527
+ }
7528
+ return {
7529
+ [valueField]: item,
7530
+ [textField]: displayText,
7531
+ };
7532
+ }
7477
7533
  #focusEffect;
7478
7534
  focus() {
7479
7535
  this.shouldFocus.set(true);
@@ -10823,9 +10879,18 @@ class AXPDataListWidgetViewComponent extends AXPValueWidgetComponent {
10823
10879
  };
10824
10880
  }
10825
10881
  //#region ---- Public Methods ----
10882
+ /**
10883
+ * Returns true when the data-table view child accepted the refresh.
10884
+ * Callers must retry while this is false (grid may not be ready yet after remount).
10885
+ */
10826
10886
  refresh() {
10827
- this.grid()?.refresh();
10887
+ const grid = this.grid();
10888
+ if (!grid) {
10889
+ return false;
10890
+ }
10891
+ grid.refresh();
10828
10892
  this.selectedRows.set([]);
10893
+ return true;
10829
10894
  }
10830
10895
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPDataListWidgetViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
10831
10896
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPDataListWidgetViewComponent, isStandalone: true, selector: "axp-data-list-widget-view", host: { properties: { "style.min-height": "minHeight() + \"px\"", "class": "\"ax-h-full ax-flex ax-flex-col\"" } }, viewQueries: [{ propertyName: "grid", first: true, predicate: ["grid"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
@@ -24212,8 +24277,9 @@ class AXPListToolbarWidgetViewComponent extends AXPValueWidgetComponent {
24212
24277
  this.columnDefinitions = computed(() => this.options()['columnDefinitions'] || [], ...(ngDevMode ? [{ debugName: "columnDefinitions" }] : /* istanbul ignore next */ []));
24213
24278
  // sorts
24214
24279
  this.sortDefinitions = computed(() => this.options()['sortDefinitions'] || [], ...(ngDevMode ? [{ debugName: "sortDefinitions" }] : /* istanbul ignore next */ []));
24215
- //initials
24216
- this.initialFilters = computed(() => this.getValue()?.filters || [], ...(ngDevMode ? [{ debugName: "initialFilters" }] : /* istanbul ignore next */ []));
24280
+ //initials — seed once (like master toolbar); do not live-bind getValue().filters
24281
+ // or every emit resets axp-query-filters context and select labels fall back to raw keys.
24282
+ this.initialFilters = signal(this.getValue()?.filters || [], ...(ngDevMode ? [{ debugName: "initialFilters" }] : /* istanbul ignore next */ []));
24217
24283
  this.initialColumns = computed(() => this.getValue()?.columns ?? [], ...(ngDevMode ? [{ debugName: "initialColumns" }] : /* istanbul ignore next */ []));
24218
24284
  this.initialSorts = computed(() => this.getValue()?.sorts ?? [], ...(ngDevMode ? [{ debugName: "initialSorts" }] : /* istanbul ignore next */ []));
24219
24285
  this.isFiltersDirty = computed(() => !isEqual(this.currentFilterQueries(), this.previousFilterQueries()), ...(ngDevMode ? [{ debugName: "isFiltersDirty" }] : /* istanbul ignore next */ []));