@stemy/ngx-utils 19.5.13 → 19.5.15

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.
@@ -5328,20 +5328,17 @@ class AsyncMethodBase {
5328
5328
  this.loading.set(true);
5329
5329
  const method = this.getMethod();
5330
5330
  const result = !method ? null : method(this.context(), ev);
5331
- console.log("Call", result);
5332
5331
  if (!(result instanceof Promise)) {
5333
5332
  this.loading.set(false);
5334
5333
  return false;
5335
5334
  }
5336
5335
  result.then(result => {
5337
- console.log("result", result);
5338
5336
  this.loading.set(false);
5339
5337
  if (result) {
5340
5338
  this.onSuccess.emit(result);
5341
5339
  this.toaster.success(result.message, result.context);
5342
5340
  }
5343
5341
  }, reason => {
5344
- console.log("result", reason);
5345
5342
  if (!reason || !reason.message)
5346
5343
  throw new Error("Reason must implement IAsyncMessage interface");
5347
5344
  this.loading.set(false);
@@ -6352,10 +6349,11 @@ class TabsItemDirective {
6352
6349
  this.tooltip = input("");
6353
6350
  this.icon = input("");
6354
6351
  this.disabled = input(false);
6352
+ this.classes = input("");
6355
6353
  this.element = inject(ElementRef);
6356
6354
  }
6357
6355
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
6358
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: TabsItemDirective, isStandalone: false, selector: "[tabsItem]", inputs: { value: { classPropertyName: "value", publicName: "tabsItem", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
6356
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: TabsItemDirective, isStandalone: false, selector: "[tabsItem]", inputs: { value: { classPropertyName: "value", publicName: "tabsItem", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
6359
6357
  }
6360
6358
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsItemDirective, decorators: [{
6361
6359
  type: Directive,
@@ -7846,6 +7844,7 @@ class TabsComponent {
7846
7844
  return;
7847
7845
  options.push({
7848
7846
  value,
7847
+ classes: item.classes(),
7849
7848
  label: item.label(),
7850
7849
  tooltip: item.tooltip(),
7851
7850
  icon: item.icon(),
@@ -7853,21 +7852,32 @@ class TabsComponent {
7853
7852
  });
7854
7853
  });
7855
7854
  options.forEach(o => {
7856
- o.active = current === o.value;
7855
+ const active = current === o.value;
7856
+ const classes = (Array.isArray(o.classes) ? o.classes : [o.classes || ""]).filter(c => !!c);
7857
+ classes.push(active ? "active" : "inactive");
7858
+ o.active = active;
7859
+ o.className = classes.join(" ");
7857
7860
  });
7858
7861
  return options;
7859
7862
  });
7863
+ effect(() => {
7864
+ const tabOptions = this.tabs();
7865
+ const selectedOption = tabOptions.find(o => o.active);
7866
+ if (tabOptions.length && !selectedOption) {
7867
+ this.value.set(tabOptions[0].value);
7868
+ }
7869
+ });
7860
7870
  }
7861
- select(value) {
7862
- this.value.set(value);
7871
+ select(option) {
7872
+ this.value.set(option.value);
7863
7873
  }
7864
7874
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7865
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: TabsComponent, isStandalone: false, selector: "tabs", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, queries: [{ propertyName: "tabItems", predicate: TabsItemDirective, isSignal: true }], ngImport: i0, template: "<ul class=\"ui-tabs\" [ngClass]=\"'type-' + type()\">\n @for (option of tabs(); track option.value) {\n <li [ngClass]=\"option.active ? 'active' : 'inactive'\">\n <btn [label]=\"option.label\"\n [tooltip]=\"option.tooltip\"\n [icon]=\"option.icon\"\n [disabled]=\"option.disabled\"\n [type]=\"option.active ? type() : 'transparent'\"\n [size]=\"size()\"\n (click)=\"select(option.value)\"></btn>\n </li>\n }\n</ul>\n<ng-content></ng-content>\n", styles: [".ui-tabs{--tabs-bg: var(--primary-color, var(--bs-primary, #666666));--tabs-margin: 5px;--tabs-padding: 5px;display:flex;gap:5px;margin:0 0 var(--tabs-margin) 0;padding:var(--tabs-padding);position:relative;list-style-type:none}.ui-tabs:before{content:\"\";position:absolute;inset:0;background:var(--tabs-bg);opacity:.25;border-radius:5px;z-index:0}.ui-tabs li{position:relative;z-index:1}.ui-tabs *{box-sizing:border-box}.ui-tabs.type-secondary{--tabs-bg: var(--secondary-color, var(--bs-secondary, #666666))}\n"], dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "type", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
7875
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: TabsComponent, isStandalone: false, selector: "tabs", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, queries: [{ propertyName: "tabItems", predicate: TabsItemDirective, isSignal: true }], ngImport: i0, template: "@let tabList = tabs();\n@let tabType = type();\n@let tabSize = size();\n@if (tabList.length) {\n <ul class=\"ui-tabs\" [ngClass]=\"'type-' + tabType\">\n @for (option of tabList; track option.value) {\n <li [ngClass]=\"option.className\">\n <btn [label]=\"option.label\"\n [tooltip]=\"option.tooltip\"\n [icon]=\"option.icon\"\n [disabled]=\"option.disabled\"\n [type]=\"option.active ? tabType : 'transparent'\"\n [size]=\"tabSize\"\n (click)=\"select(option)\"></btn>\n </li>\n }\n </ul>\n}\n<ng-content></ng-content>\n", styles: [".ui-tabs{--tabs-bg: var(--primary-color, var(--bs-primary, #666666));--tabs-margin: 5px;--tabs-padding: 5px;display:flex;gap:5px;margin:0 0 var(--tabs-margin) 0;padding:var(--tabs-padding);position:relative;list-style-type:none}.ui-tabs:before{content:\"\";position:absolute;inset:0;background:var(--tabs-bg);opacity:.25;border-radius:5px;z-index:0}.ui-tabs li{position:relative;z-index:1}.ui-tabs *{box-sizing:border-box}.ui-tabs.type-secondary{--tabs-bg: var(--secondary-color, var(--bs-secondary, #666666))}\n"], dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "type", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
7866
7876
  }
7867
7877
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TabsComponent, decorators: [{
7868
7878
  type: Component,
7869
- args: [{ standalone: false, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, selector: "tabs", template: "<ul class=\"ui-tabs\" [ngClass]=\"'type-' + type()\">\n @for (option of tabs(); track option.value) {\n <li [ngClass]=\"option.active ? 'active' : 'inactive'\">\n <btn [label]=\"option.label\"\n [tooltip]=\"option.tooltip\"\n [icon]=\"option.icon\"\n [disabled]=\"option.disabled\"\n [type]=\"option.active ? type() : 'transparent'\"\n [size]=\"size()\"\n (click)=\"select(option.value)\"></btn>\n </li>\n }\n</ul>\n<ng-content></ng-content>\n", styles: [".ui-tabs{--tabs-bg: var(--primary-color, var(--bs-primary, #666666));--tabs-margin: 5px;--tabs-padding: 5px;display:flex;gap:5px;margin:0 0 var(--tabs-margin) 0;padding:var(--tabs-padding);position:relative;list-style-type:none}.ui-tabs:before{content:\"\";position:absolute;inset:0;background:var(--tabs-bg);opacity:.25;border-radius:5px;z-index:0}.ui-tabs li{position:relative;z-index:1}.ui-tabs *{box-sizing:border-box}.ui-tabs.type-secondary{--tabs-bg: var(--secondary-color, var(--bs-secondary, #666666))}\n"] }]
7870
- }] });
7879
+ args: [{ standalone: false, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, selector: "tabs", template: "@let tabList = tabs();\n@let tabType = type();\n@let tabSize = size();\n@if (tabList.length) {\n <ul class=\"ui-tabs\" [ngClass]=\"'type-' + tabType\">\n @for (option of tabList; track option.value) {\n <li [ngClass]=\"option.className\">\n <btn [label]=\"option.label\"\n [tooltip]=\"option.tooltip\"\n [icon]=\"option.icon\"\n [disabled]=\"option.disabled\"\n [type]=\"option.active ? tabType : 'transparent'\"\n [size]=\"tabSize\"\n (click)=\"select(option)\"></btn>\n </li>\n }\n </ul>\n}\n<ng-content></ng-content>\n", styles: [".ui-tabs{--tabs-bg: var(--primary-color, var(--bs-primary, #666666));--tabs-margin: 5px;--tabs-padding: 5px;display:flex;gap:5px;margin:0 0 var(--tabs-margin) 0;padding:var(--tabs-padding);position:relative;list-style-type:none}.ui-tabs:before{content:\"\";position:absolute;inset:0;background:var(--tabs-bg);opacity:.25;border-radius:5px;z-index:0}.ui-tabs li{position:relative;z-index:1}.ui-tabs *{box-sizing:border-box}.ui-tabs.type-secondary{--tabs-bg: var(--secondary-color, var(--bs-secondary, #666666))}\n"] }]
7880
+ }], ctorParameters: () => [] });
7871
7881
 
7872
7882
  class UnorderedListComponent {
7873
7883
  constructor(cdr) {