@acorex/platform 20.9.0 → 20.9.1

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.
@@ -5149,6 +5149,7 @@ class AXPEntityMasterListViewQueryViewModel {
5149
5149
  this.conditions = this.view.conditions;
5150
5150
  this.indexCol = this.view.indexCol;
5151
5151
  this.pageSize = this.view.pageSize;
5152
+ this.visible = this.view.visible;
5152
5153
  }
5153
5154
  }
5154
5155
  class AXPEntityMasterListViewModel {
@@ -5249,6 +5250,24 @@ class AXPEntityMasterListViewModel {
5249
5250
  },
5250
5251
  };
5251
5252
  }
5253
+ /**
5254
+ * Evaluates each view's `visible` expression and updates the filtered view list.
5255
+ */
5256
+ async refreshVisibleViews() {
5257
+ const scope = this.createLogicExpressionScope(null);
5258
+ const evaluated = await Promise.all(this.allViews().map(async (viewModel) => {
5259
+ const visible = viewModel.visible;
5260
+ if (visible === undefined || visible === null || visible === '') {
5261
+ return viewModel;
5262
+ }
5263
+ if (typeof visible === 'boolean') {
5264
+ return visible ? viewModel : null;
5265
+ }
5266
+ const isVisible = await this.expressionEvaluator.evaluate(visible, scope);
5267
+ return isVisible !== false ? viewModel : null;
5268
+ }));
5269
+ this.visibleViews.set(evaluated.filter((viewModel) => viewModel != null));
5270
+ }
5252
5271
  async resolveCommandNameExpression(commandName, data) {
5253
5272
  if (!commandName || !commandName.includes('{{')) {
5254
5273
  return commandName;
@@ -5379,13 +5398,24 @@ class AXPEntityMasterListViewModel {
5379
5398
  return `${resolvedCommand}${suffix}`;
5380
5399
  }
5381
5400
  async setView(viewName = null) {
5401
+ await this.refreshVisibleViews();
5402
+ const availableViews = this.views();
5403
+ if (!availableViews.length) {
5404
+ return;
5405
+ }
5382
5406
  let selectedViewName;
5383
5407
  if (await this.shouldLoadPersistedListState()) {
5384
5408
  const entitySetting = await this.settings.get(this.settingEntityKey);
5385
5409
  selectedViewName = entitySetting?.list?.currentView;
5386
5410
  }
5387
- if (viewName != this.view().name) {
5388
- this.view.set(this.views().find((c) => c.name == (viewName || selectedViewName)) ?? this.views()[0]);
5411
+ const resolvedViewName = viewName ?? selectedViewName;
5412
+ const currentViewName = this.view().name;
5413
+ const currentViewUnavailable = !availableViews.some((v) => v.name === currentViewName);
5414
+ const nextView = availableViews.find((c) => c.name == resolvedViewName) ??
5415
+ (currentViewUnavailable ? availableViews[0] : this.view());
5416
+ const shouldApplyViewState = viewName != currentViewName || nextView.name !== currentViewName || currentViewUnavailable;
5417
+ if (shouldApplyViewState) {
5418
+ this.view.set(nextView);
5389
5419
  this.applyViewSorts();
5390
5420
  this.applyViewColumns();
5391
5421
  this.applyCardFields();
@@ -5428,13 +5458,18 @@ class AXPEntityMasterListViewModel {
5428
5458
  this.listPersistenceMode = null;
5429
5459
  this.events$ = new Subject();
5430
5460
  //****************** Views ******************//
5431
- this.views = computed(() => {
5461
+ this.allViews = computed(() => {
5432
5462
  const views = this.entityDef.interfaces?.master?.list?.views ?? [];
5433
5463
  return views.map((v) => {
5434
5464
  return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
5435
5465
  });
5466
+ }, ...(ngDevMode ? [{ debugName: "allViews" }] : /* istanbul ignore next */ []));
5467
+ this.visibleViews = signal([], ...(ngDevMode ? [{ debugName: "visibleViews" }] : /* istanbul ignore next */ []));
5468
+ this.views = computed(() => {
5469
+ const visible = this.visibleViews();
5470
+ return visible.length > 0 ? visible : this.allViews();
5436
5471
  }, ...(ngDevMode ? [{ debugName: "views" }] : /* istanbul ignore next */ []));
5437
- this.view = signal(this.views()[0], ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
5472
+ this.view = signal(this.allViews()[0], ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
5438
5473
  this.showRowIndexColumnEnabled = signal(false, ...(ngDevMode ? [{ debugName: "showRowIndexColumnEnabled" }] : /* istanbul ignore next */ []));
5439
5474
  /**
5440
5475
  * Row index column: if the list view defines `indexCol` (true/false), that overrides the user setting;
@@ -6716,6 +6751,7 @@ class AXPEntityListViewModelFactory {
6716
6751
  await vm.loadFilterDefinitions();
6717
6752
  await vm.loadSortableFields();
6718
6753
  await vm.initializeListPersistence();
6754
+ await vm.refreshVisibleViews();
6719
6755
  return vm;
6720
6756
  }
6721
6757
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPEntityListViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -14824,6 +14860,7 @@ class AXPLookupWidgetSelectComponent extends LookupWidgetLookBase {
14824
14860
  this.allowCreate = input('none', ...(ngDevMode ? [{ debugName: "allowCreate" }] : /* istanbul ignore next */ []));
14825
14861
  this.showItemTooltip = input(false, ...(ngDevMode ? [{ debugName: "showItemTooltip" }] : /* istanbul ignore next */ []));
14826
14862
  this.isItemTruncated = input(true, ...(ngDevMode ? [{ debugName: "isItemTruncated" }] : /* istanbul ignore next */ []));
14863
+ this.textTemplate = input(null, ...(ngDevMode ? [{ debugName: "textTemplate" }] : /* istanbul ignore next */ []));
14827
14864
  //#endregion
14828
14865
  //#region ---- Outputs ----
14829
14866
  this.valueChanged = output();
@@ -14979,7 +15016,7 @@ class AXPLookupWidgetSelectComponent extends LookupWidgetLookBase {
14979
15016
  this.dataSource()?.refresh();
14980
15017
  }
14981
15018
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLookupWidgetSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
14982
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPLookupWidgetSelectComponent, isStandalone: true, selector: "axp-lookup-widget-select", inputs: { entityDef: { classPropertyName: "entityDef", publicName: "entityDef", isSignal: true, isRequired: true, transformFunction: null }, customFilter: { classPropertyName: "customFilter", publicName: "customFilter", isSignal: true, isRequired: true, transformFunction: null }, selectedItems: { classPropertyName: "selectedItems", publicName: "selectedItems", isSignal: true, isRequired: true, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: true, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: true, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: true, transformFunction: null }, validationRules: { classPropertyName: "validationRules", publicName: "validationRules", isSignal: true, isRequired: true, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, hasClearButton: { classPropertyName: "hasClearButton", publicName: "hasClearButton", isSignal: true, isRequired: false, transformFunction: null }, allowCreate: { classPropertyName: "allowCreate", publicName: "allowCreate", isSignal: true, isRequired: false, transformFunction: null }, showItemTooltip: { classPropertyName: "showItemTooltip", publicName: "showItemTooltip", isSignal: true, isRequired: false, transformFunction: null }, isItemTruncated: { classPropertyName: "isItemTruncated", publicName: "isItemTruncated", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChanged: "valueChanged" }, providers: [
15019
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPLookupWidgetSelectComponent, isStandalone: true, selector: "axp-lookup-widget-select", inputs: { entityDef: { classPropertyName: "entityDef", publicName: "entityDef", isSignal: true, isRequired: true, transformFunction: null }, customFilter: { classPropertyName: "customFilter", publicName: "customFilter", isSignal: true, isRequired: true, transformFunction: null }, selectedItems: { classPropertyName: "selectedItems", publicName: "selectedItems", isSignal: true, isRequired: true, transformFunction: null }, displayField: { classPropertyName: "displayField", publicName: "displayField", isSignal: true, isRequired: true, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: true, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: true, transformFunction: null }, validationRules: { classPropertyName: "validationRules", publicName: "validationRules", isSignal: true, isRequired: true, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, hasClearButton: { classPropertyName: "hasClearButton", publicName: "hasClearButton", isSignal: true, isRequired: false, transformFunction: null }, allowCreate: { classPropertyName: "allowCreate", publicName: "allowCreate", isSignal: true, isRequired: false, transformFunction: null }, showItemTooltip: { classPropertyName: "showItemTooltip", publicName: "showItemTooltip", isSignal: true, isRequired: false, transformFunction: null }, isItemTruncated: { classPropertyName: "isItemTruncated", publicName: "isItemTruncated", isSignal: true, isRequired: false, transformFunction: null }, textTemplate: { classPropertyName: "textTemplate", publicName: "textTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChanged: "valueChanged" }, providers: [
14983
15020
  {
14984
15021
  provide: LookupWidgetLookBase,
14985
15022
  useExisting: AXPLookupWidgetSelectComponent,
@@ -14999,6 +15036,7 @@ class AXPLookupWidgetSelectComponent extends LookupWidgetLookBase {
14999
15036
  [multiple]="multipleValue()"
15000
15037
  [showItemTooltip]="showItemTooltip()"
15001
15038
  [isItemTruncated]="isItemTruncated()"
15039
+ [textTemplate]="textTemplate()"
15002
15040
  (onValueChanged)="handleValueChanged($event)"
15003
15041
  >
15004
15042
  @if (hasClearButton()) {
@@ -15038,6 +15076,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
15038
15076
  [multiple]="multipleValue()"
15039
15077
  [showItemTooltip]="showItemTooltip()"
15040
15078
  [isItemTruncated]="isItemTruncated()"
15079
+ [textTemplate]="textTemplate()"
15041
15080
  (onValueChanged)="handleValueChanged($event)"
15042
15081
  >
15043
15082
  @if (hasClearButton()) {
@@ -15076,7 +15115,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
15076
15115
  },
15077
15116
  ],
15078
15117
  }]
15079
- }], propDecorators: { entityDef: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDef", required: true }] }], customFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "customFilter", required: true }] }], selectedItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItems", required: true }] }], displayField: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayField", required: true }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: true }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: true }] }], validationRules: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationRules", required: true }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], hasClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasClearButton", required: false }] }], allowCreate: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCreate", required: false }] }], showItemTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "showItemTooltip", required: false }] }], isItemTruncated: [{ type: i0.Input, args: [{ isSignal: true, alias: "isItemTruncated", required: false }] }], valueChanged: [{ type: i0.Output, args: ["valueChanged"] }], selectBox: [{ type: i0.ViewChild, args: ['selectBox', { isSignal: true }] }] } });
15118
+ }], propDecorators: { entityDef: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDef", required: true }] }], customFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "customFilter", required: true }] }], selectedItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItems", required: true }] }], displayField: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayField", required: true }] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: true }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: true }] }], validationRules: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationRules", required: true }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], hasClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasClearButton", required: false }] }], allowCreate: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCreate", required: false }] }], showItemTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "showItemTooltip", required: false }] }], isItemTruncated: [{ type: i0.Input, args: [{ isSignal: true, alias: "isItemTruncated", required: false }] }], textTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "textTemplate", required: false }] }], valueChanged: [{ type: i0.Output, args: ["valueChanged"] }], selectBox: [{ type: i0.ViewChild, args: ['selectBox', { isSignal: true }] }] } });
15080
15119
 
15081
15120
  class AXPLookupWidgetTagboxComponent extends LookupWidgetLookBase {
15082
15121
  constructor() {
@@ -15614,9 +15653,7 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
15614
15653
  const newValue = this.singleOrMultiple(keys);
15615
15654
  const widgetPath = this.fullPath();
15616
15655
  const savedWidgetValue = widgetPath ? this.contextService.getSavedValue(widgetPath) : undefined;
15617
- const selectionMatchesSaved = this.contextService.isSavedCommitted() &&
15618
- widgetPath != null &&
15619
- isSelectionValueEqual(newValue, savedWidgetValue);
15656
+ const selectionMatchesSaved = this.contextService.isSavedCommitted() && widgetPath != null && isSelectionValueEqual(newValue, savedWidgetValue);
15620
15657
  if (this.expose()) {
15621
15658
  AXPDebugService.instance?.trace(FORM_DIRTY_TRACE_NS, 'lookup-widget', 'setItems expose', () => ({
15622
15659
  path: this.fullPath(),
@@ -15860,6 +15897,7 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
15860
15897
  [selectedItems]="selectedItems"
15861
15898
  [displayField]="displayField"
15862
15899
  [valueField]="valueField"
15900
+ [textTemplate]="textTemplate()"
15863
15901
  [disabled]="disabled"
15864
15902
  [multiple]="multiple"
15865
15903
  [placeholder]="placeholder"
@@ -15910,7 +15948,7 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
15910
15948
  }
15911
15949
  </div>
15912
15950
  }
15913
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3$2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: AXPLookupWidgetSelectComponent, selector: "axp-lookup-widget-select", inputs: ["entityDef", "customFilter", "selectedItems", "displayField", "valueField", "disabled", "multiple", "validationRules", "placeholder", "hasClearButton", "allowCreate", "showItemTooltip", "isItemTruncated"], outputs: ["valueChanged"] }, { kind: "component", type: AXPLookupWidgetTagboxComponent, selector: "axp-lookup-widget-tagbox", inputs: ["selectedItems", "displayField", "valueField", "displayFormat", "disabled", "multiple", "isLoading", "validationRules", "placeholder", "hasClearButton", "resolvedCreate", "allowUnselect", "entityDef", "customFilter", "columns", "parentFilters", "rowActions", "onSetLoading"], outputs: ["valueChanged"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i3$1.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
15951
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3$2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: AXPLookupWidgetSelectComponent, selector: "axp-lookup-widget-select", inputs: ["entityDef", "customFilter", "selectedItems", "displayField", "valueField", "disabled", "multiple", "validationRules", "placeholder", "hasClearButton", "allowCreate", "showItemTooltip", "isItemTruncated", "textTemplate"], outputs: ["valueChanged"] }, { kind: "component", type: AXPLookupWidgetTagboxComponent, selector: "axp-lookup-widget-tagbox", inputs: ["selectedItems", "displayField", "valueField", "displayFormat", "disabled", "multiple", "isLoading", "validationRules", "placeholder", "hasClearButton", "resolvedCreate", "allowUnselect", "entityDef", "customFilter", "columns", "parentFilters", "rowActions", "onSetLoading"], outputs: ["valueChanged"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i3$1.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
15914
15952
  }
15915
15953
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLookupWidgetEditComponent, decorators: [{
15916
15954
  type: Component,
@@ -15928,6 +15966,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
15928
15966
  [selectedItems]="selectedItems"
15929
15967
  [displayField]="displayField"
15930
15968
  [valueField]="valueField"
15969
+ [textTemplate]="textTemplate()"
15931
15970
  [disabled]="disabled"
15932
15971
  [multiple]="multiple"
15933
15972
  [placeholder]="placeholder"