@stemy/ngx-utils 19.8.0 → 19.8.2

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.
@@ -6005,34 +6005,27 @@ class AsyncMethodBase {
6005
6005
  switchClass(previous, "loading", false);
6006
6006
  });
6007
6007
  }
6008
- getMethod() {
6009
- return async () => null;
6010
- }
6011
6008
  ngOnChanges() {
6012
6009
  this.cdr.detectChanges();
6013
6010
  }
6014
- click(ev) {
6015
- ev?.preventDefault();
6016
- if (this.disabled())
6017
- return true;
6018
- this.callMethod(ev);
6019
- return true;
6011
+ onClick(ev) {
6012
+ return this.handleClick(ev);
6020
6013
  }
6021
6014
  callMethod(ev) {
6022
6015
  if (this.loading())
6023
6016
  return true;
6024
6017
  this.loading.set(true);
6025
6018
  const method = this.getMethod();
6026
- const result = !method ? null : method(this.context(), ev);
6019
+ const result = !method ? null : method(...this.getArgs(ev));
6027
6020
  if (!(result instanceof Promise)) {
6028
6021
  this.loading.set(false);
6029
6022
  return false;
6030
6023
  }
6031
- result.then(result => {
6024
+ result.then(msg => {
6032
6025
  this.loading.set(false);
6033
- if (result) {
6034
- this.onSuccess.emit(result);
6035
- this.toaster.success(result.message, result.context);
6026
+ if (msg) {
6027
+ this.onSuccess.emit(msg);
6028
+ this.toaster.success(msg.message, msg.context);
6036
6029
  }
6037
6030
  }, reason => {
6038
6031
  if (!reason || !reason.message)
@@ -6047,8 +6040,21 @@ class AsyncMethodBase {
6047
6040
  });
6048
6041
  return true;
6049
6042
  }
6043
+ handleClick(ev) {
6044
+ ev?.preventDefault();
6045
+ if (this.disabled())
6046
+ return true;
6047
+ this.callMethod(ev);
6048
+ return true;
6049
+ }
6050
+ getMethod() {
6051
+ return null;
6052
+ }
6053
+ getArgs(ev) {
6054
+ return untracked(() => [this.context(), ev]);
6055
+ }
6050
6056
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncMethodBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
6051
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncMethodBase, isStandalone: false, selector: "[__asmb__]", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "click($event)" } }, usesOnChanges: true, ngImport: i0 }); }
6057
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncMethodBase, isStandalone: false, selector: "[__asmb__]", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "onClick($event)" } }, usesOnChanges: true, ngImport: i0 }); }
6052
6058
  }
6053
6059
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncMethodBase, decorators: [{
6054
6060
  type: Directive,
@@ -6056,7 +6062,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
6056
6062
  standalone: false,
6057
6063
  selector: "[__asmb__]"
6058
6064
  }]
6059
- }], ctorParameters: () => [], propDecorators: { click: [{
6065
+ }], ctorParameters: () => [], propDecorators: { onClick: [{
6060
6066
  type: HostListener,
6061
6067
  args: ["click", ["$event"]]
6062
6068
  }] } });
@@ -6067,7 +6073,7 @@ class AsyncMethodDirective extends AsyncMethodBase {
6067
6073
  this.method = input(null, { alias: "async-method" });
6068
6074
  }
6069
6075
  getMethod() {
6070
- return this.method();
6076
+ return untracked(() => this.method());
6071
6077
  }
6072
6078
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
6073
6079
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncMethodDirective, isStandalone: false, selector: "[async-method]", inputs: { method: { classPropertyName: "method", publicName: "async-method", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
@@ -7010,7 +7016,7 @@ class DropdownToggleDirective extends AsyncMethodBase {
7010
7016
  this.dropdown = inject(DropdownDirective);
7011
7017
  }
7012
7018
  getMethod() {
7013
- return this.beforeOpen();
7019
+ return untracked(() => this.beforeOpen());
7014
7020
  }
7015
7021
  callMethod(ev) {
7016
7022
  if (this.dropdown.isOpened) {