@xiriframework/xiri-ng 0.2.43 → 0.2.44

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.
@@ -2989,6 +2989,8 @@ class XiriButtonComponent {
2989
2989
  this.dialogRef = undefined;
2990
2990
  this.destroyRef = inject(DestroyRef);
2991
2991
  this.loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
2992
+ // Guards the one-shot auto-load trigger (see constructor) so it fires only once.
2993
+ this._autoTriggered = false;
2992
2994
  this.polling = signal(null, ...(ngDevMode ? [{ debugName: "polling" }] : /* istanbul ignore next */ []));
2993
2995
  this._now = signal(Date.now(), ...(ngDevMode ? [{ debugName: "_now" }] : /* istanbul ignore next */ []));
2994
2996
  this.countdown = computed(() => {
@@ -3026,9 +3028,22 @@ class XiriButtonComponent {
3026
3028
  return this.url();
3027
3029
  return this.displayButton().url;
3028
3030
  }, ...(ngDevMode ? [{ debugName: "_url" }] : /* istanbul ignore next */ []));
3031
+ // Auto-load: when the button opts in via autoLoad, run its action once as soon
3032
+ // as it becomes enabled (filter valid/present). Subsequent filter changes do not
3033
+ // re-trigger it — only the initial load is automatic.
3034
+ effect(() => {
3035
+ this.filterData(); // track filter changes so the effect re-evaluates
3036
+ if (this.button().autoLoad && !this._autoTriggered && !this._disabled()) {
3037
+ this._autoTriggered = true;
3038
+ this.runAction();
3039
+ }
3040
+ });
3029
3041
  }
3030
3042
  clicked(event) {
3031
3043
  event.stopPropagation();
3044
+ this.runAction();
3045
+ }
3046
+ runAction() {
3032
3047
  if (this._disabled()) {
3033
3048
  this.result.emit({
3034
3049
  button: this.button(),
@@ -3241,7 +3256,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
3241
3256
  MatMenu, MatMenuItem, MatMenuTrigger,
3242
3257
  MatIcon, MatIconButton, MatTooltip
3243
3258
  ], changeDetection: ChangeDetectionStrategy.OnPush, template: "@switch (button().action) {\n\t@case ('link') {\n\t\t<a [routerLink]=\"_url()\" [href]=\"_url()\" (click)=\"clicked($event)\">\n\t\t\t<xiri-buttonstyle [button]=\"displayButton()\" [disabled]=\"_disabled()\" [loading]=\"loading()\" [countdown]=\"countdown()\" [pollText]=\"pollText()\"></xiri-buttonstyle>\n\t\t</a>\n\t}\n\t@case ('href') {\n\t\t<a [href]=\"_url()\" [target]=\"button().target\" (click)=\"clicked($event)\">\n\t\t\t<xiri-buttonstyle [button]=\"displayButton()\" [disabled]=\"_disabled()\" [loading]=\"loading()\" [countdown]=\"countdown()\" [pollText]=\"pollText()\"></xiri-buttonstyle>\n\t\t</a>\n\t}\n\t@case ('menu') {\n\t\t<button mat-icon-button [matMenuTriggerFor]=\"menuRef\"\n\t\t [class]=\"displayButton().color || 'primary'\"\n\t\t [matTooltip]=\"button().hint\"\n\t\t [matTooltipDisabled]=\"!button().hint\"\n\t\t (click)=\"$event.stopPropagation()\">\n\t\t\t<mat-icon>{{ displayButton().icon }}</mat-icon>\n\t\t</button>\n\t\t<mat-menu #menuRef=\"matMenu\">\n\t\t\t@for (item of button().menuItems; track item) {\n\t\t\t\t@switch (item.action) {\n\t\t\t\t\t@case ('link') {\n\t\t\t\t\t\t<a mat-menu-item [routerLink]=\"item.url\">\n\t\t\t\t\t\t\t@if (item.icon) {\n\t\t\t\t\t\t\t\t<mat-icon [class]=\"item.color || 'primary'\">{{ item.icon }}</mat-icon>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t<span>{{ item.text }}</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t}\n\t\t\t\t\t@case ('href') {\n\t\t\t\t\t\t<a mat-menu-item [href]=\"item.url\" target=\"_blank\">\n\t\t\t\t\t\t\t@if (item.icon) {\n\t\t\t\t\t\t\t\t<mat-icon [class]=\"item.color || 'primary'\">{{ item.icon }}</mat-icon>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t<span>{{ item.text }}</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t}\n\t\t\t\t\t@case ('dialog') {\n\t\t\t\t\t\t<button mat-menu-item (click)=\"openMenuDialog($event, item)\">\n\t\t\t\t\t\t\t@if (item.icon) {\n\t\t\t\t\t\t\t\t<mat-icon [class]=\"item.color || 'primary'\">{{ item.icon }}</mat-icon>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t<span>{{ item.text }}</span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t</mat-menu>\n\t}\n\t@default {\n\t\t<xiri-buttonstyle [button]=\"displayButton()\" [disabled]=\"_disabled()\" [loading]=\"loading()\" [countdown]=\"countdown()\" [pollText]=\"pollText()\" (click)=\"clicked($event)\"></xiri-buttonstyle>\n\t}\n}\n" }]
3244
- }], propDecorators: { button: [{ type: i0.Input, args: [{ isSignal: true, alias: "button", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filterData: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterData", required: false }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], result: [{ type: i0.Output, args: ["result"] }] } });
3259
+ }], ctorParameters: () => [], propDecorators: { button: [{ type: i0.Input, args: [{ isSignal: true, alias: "button", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filterData: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterData", required: false }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }], result: [{ type: i0.Output, args: ["result"] }] } });
3245
3260
 
3246
3261
  class XiriTableInlineEditService {
3247
3262
  constructor() {