@ssv/ngx.command 2.2.0 → 2.3.0-dev.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.
Files changed (38) hide show
  1. package/README.md +7 -7
  2. package/command-ref.directive.d.ts +3 -0
  3. package/command.directive.d.ts +3 -0
  4. package/esm2020/command-ref.directive.mjs +54 -0
  5. package/esm2020/command.directive.mjs +166 -0
  6. package/esm2020/command.mjs +127 -0
  7. package/esm2020/command.model.mjs +2 -0
  8. package/esm2020/command.util.mjs +29 -0
  9. package/esm2020/config.mjs +8 -0
  10. package/esm2020/index.mjs +8 -0
  11. package/esm2020/module.mjs +49 -0
  12. package/esm2020/ssv-ngx.command.mjs +5 -0
  13. package/esm2020/version.mjs +2 -0
  14. package/fesm2015/{ssv-ngx.command.js → ssv-ngx.command.mjs} +66 -45
  15. package/fesm2015/ssv-ngx.command.mjs.map +1 -0
  16. package/fesm2020/ssv-ngx.command.mjs +424 -0
  17. package/fesm2020/ssv-ngx.command.mjs.map +1 -0
  18. package/module.d.ts +6 -0
  19. package/package.json +23 -13
  20. package/version.d.ts +1 -1
  21. package/CHANGELOG.md +0 -216
  22. package/bundles/ssv-ngx.command.umd.js +0 -759
  23. package/bundles/ssv-ngx.command.umd.js.map +0 -1
  24. package/bundles/ssv-ngx.command.umd.min.js +0 -16
  25. package/bundles/ssv-ngx.command.umd.min.js.map +0 -1
  26. package/esm2015/command-ref.directive.js +0 -50
  27. package/esm2015/command.directive.js +0 -156
  28. package/esm2015/command.js +0 -127
  29. package/esm2015/command.model.js +0 -2
  30. package/esm2015/command.util.js +0 -28
  31. package/esm2015/config.js +0 -8
  32. package/esm2015/index.js +0 -8
  33. package/esm2015/module.js +0 -36
  34. package/esm2015/ssv-ngx.command.js +0 -5
  35. package/esm2015/version.js +0 -2
  36. package/fesm2015/ssv-ngx.command.js.map +0 -1
  37. package/ssv-ngx.command.d.ts +0 -4
  38. package/ssv-ngx.command.metadata.json +0 -1
@@ -1,6 +1,7 @@
1
1
  import { BehaviorSubject, Subject, Subscription, combineLatest, of, EMPTY } from 'rxjs';
2
2
  import { map, tap, filter, switchMap, finalize, take, catchError, delay, startWith, distinctUntilChanged, takeUntil } from 'rxjs/operators';
3
- import { InjectionToken, Directive, Inject, Renderer2, ElementRef, ChangeDetectorRef, Input, HostListener, NgModule, Optional } from '@angular/core';
3
+ import * as i0 from '@angular/core';
4
+ import { InjectionToken, Directive, Inject, Input, HostListener, Optional, NgModule } from '@angular/core';
4
5
 
5
6
  /* eslint-disable @typescript-eslint/no-explicit-any */
6
7
  /**
@@ -152,7 +153,8 @@ function isCommandCreator(arg) {
152
153
  function canExecuteFromNgForm(form, options) {
153
154
  const opts = Object.assign({ validity: true, dirty: true }, options);
154
155
  return form.statusChanges
155
- ? form.statusChanges.pipe(delay(0), startWith(form.valid), map(() => !!(!opts.validity || form.valid) && !!(!opts.dirty || form.dirty)), distinctUntilChanged())
156
+ ? form.statusChanges.pipe(// todo: remove cast when working correctly
157
+ delay(0), startWith(form.valid), map(() => !!(!opts.validity || form.valid) && !!(!opts.dirty || form.dirty)), distinctUntilChanged())
156
158
  : of(true);
157
159
  }
158
160
  function isAssumedType(x) {
@@ -201,7 +203,7 @@ function isAssumedType(x) {
201
203
  * ```
202
204
  *
203
205
  */
204
- const NAME_CAMEL = "ssvCommand";
206
+ const NAME_CAMEL$1 = "ssvCommand";
205
207
  // let nextUniqueId = 0;
206
208
  class CommandDirective {
207
209
  constructor(config, renderer, element, cdr) {
@@ -223,7 +225,7 @@ class CommandDirective {
223
225
  ngOnInit() {
224
226
  // console.log("[ssvCommand::init]", this.config);
225
227
  if (!this.commandOrCreator) {
226
- throw new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] should be defined!`);
228
+ throw new Error(`${NAME_CAMEL$1}: [${NAME_CAMEL$1}] should be defined!`);
227
229
  }
228
230
  else if (isCommand(this.commandOrCreator)) {
229
231
  this._command = this.commandOrCreator;
@@ -244,7 +246,7 @@ class CommandDirective {
244
246
  this._command = new Command(execFn, canExec, isAsync);
245
247
  }
246
248
  else {
247
- throw new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);
249
+ throw new Error(`${NAME_CAMEL$1}: [${NAME_CAMEL$1}] is not defined properly!`);
248
250
  }
249
251
  this._command.subscribe();
250
252
  this._command.canExecute$.pipe(this.commandOptions.hasDisabledDelay
@@ -290,26 +292,34 @@ class CommandDirective {
290
292
  }
291
293
  }
292
294
  }
293
- CommandDirective.decorators = [
294
- { type: Directive, args: [{
295
- selector: `[${NAME_CAMEL}]`,
296
- exportAs: NAME_CAMEL
297
- },] }
298
- ];
299
- CommandDirective.ctorParameters = () => [
300
- { type: undefined, decorators: [{ type: Inject, args: [COMMAND_CONFIG,] }] },
301
- { type: Renderer2 },
302
- { type: ElementRef },
303
- { type: ChangeDetectorRef }
304
- ];
305
- CommandDirective.propDecorators = {
306
- commandOrCreator: [{ type: Input, args: [NAME_CAMEL,] }],
307
- commandOptions: [{ type: Input, args: [`${NAME_CAMEL}Options`,] }],
308
- commandParams: [{ type: Input, args: [`${NAME_CAMEL}Params`,] }],
309
- onClick: [{ type: HostListener, args: ["click",] }]
310
- };
295
+ CommandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CommandDirective, deps: [{ token: COMMAND_CONFIG }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
296
+ CommandDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CommandDirective, selector: "[ssvCommand]", inputs: { commandOrCreator: ["ssvCommand", "commandOrCreator"], commandOptions: ["ssvCommandOptions", "commandOptions"], commandParams: ["ssvCommandParams", "commandParams"] }, host: { listeners: { "click": "onClick()" } }, exportAs: ["ssvCommand"], ngImport: i0 });
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CommandDirective, decorators: [{
298
+ type: Directive,
299
+ args: [{
300
+ selector: `[${NAME_CAMEL$1}]`,
301
+ exportAs: NAME_CAMEL$1
302
+ }]
303
+ }], ctorParameters: function () {
304
+ return [{ type: undefined, decorators: [{
305
+ type: Inject,
306
+ args: [COMMAND_CONFIG]
307
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
308
+ }, propDecorators: { commandOrCreator: [{
309
+ type: Input,
310
+ args: [NAME_CAMEL$1]
311
+ }], commandOptions: [{
312
+ type: Input,
313
+ args: [`${NAME_CAMEL$1}Options`]
314
+ }], commandParams: [{
315
+ type: Input,
316
+ args: [`${NAME_CAMEL$1}Params`]
317
+ }], onClick: [{
318
+ type: HostListener,
319
+ args: ["click"]
320
+ }] } });
311
321
 
312
- const NAME_CAMEL$1 = "ssvCommandRef";
322
+ const NAME_CAMEL = "ssvCommandRef";
313
323
  /**
314
324
  * Command creator ref, directive which allows creating Command in the template
315
325
  * and associate it to a command (in order to share executions).
@@ -336,7 +346,7 @@ class CommandRefDirective {
336
346
  this._command = new Command(execFn, this.commandCreator.canExecute, isAsync);
337
347
  }
338
348
  else {
339
- throw new Error(`${NAME_CAMEL$1}: [${NAME_CAMEL$1}] is not defined properly!`);
349
+ throw new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);
340
350
  }
341
351
  }
342
352
  ngOnDestroy() {
@@ -346,15 +356,18 @@ class CommandRefDirective {
346
356
  }
347
357
  }
348
358
  }
349
- CommandRefDirective.decorators = [
350
- { type: Directive, args: [{
351
- selector: `[${NAME_CAMEL$1}]`,
352
- exportAs: NAME_CAMEL$1
353
- },] }
354
- ];
355
- CommandRefDirective.propDecorators = {
356
- commandCreator: [{ type: Input, args: [NAME_CAMEL$1,] }]
357
- };
359
+ CommandRefDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CommandRefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
360
+ CommandRefDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CommandRefDirective, selector: "[ssvCommandRef]", inputs: { commandCreator: ["ssvCommandRef", "commandCreator"] }, exportAs: ["ssvCommandRef"], ngImport: i0 });
361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CommandRefDirective, decorators: [{
362
+ type: Directive,
363
+ args: [{
364
+ selector: `[${NAME_CAMEL}]`,
365
+ exportAs: NAME_CAMEL
366
+ }]
367
+ }], propDecorators: { commandCreator: [{
368
+ type: Input,
369
+ args: [NAME_CAMEL]
370
+ }] } });
358
371
 
359
372
  /** @internal */
360
373
  const MODULE_CONFIG_DATA = new InjectionToken("@ssv/ngx.command/configData");
@@ -372,15 +385,23 @@ class SsvCommandModule {
372
385
  };
373
386
  }
374
387
  }
375
- SsvCommandModule.decorators = [
376
- { type: NgModule, args: [{
377
- declarations: components,
378
- providers: [
379
- { provide: COMMAND_CONFIG, useFactory: _moduleConfigFactory, deps: [[MODULE_CONFIG_DATA, new Optional()]] },
380
- ],
381
- exports: [...components],
382
- },] }
383
- ];
388
+ SsvCommandModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SsvCommandModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
389
+ SsvCommandModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SsvCommandModule, declarations: [CommandDirective,
390
+ CommandRefDirective], exports: [CommandDirective,
391
+ CommandRefDirective] });
392
+ SsvCommandModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SsvCommandModule, providers: [
393
+ { provide: COMMAND_CONFIG, useFactory: _moduleConfigFactory, deps: [[MODULE_CONFIG_DATA, new Optional()]] },
394
+ ] });
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SsvCommandModule, decorators: [{
396
+ type: NgModule,
397
+ args: [{
398
+ declarations: components,
399
+ providers: [
400
+ { provide: COMMAND_CONFIG, useFactory: _moduleConfigFactory, deps: [[MODULE_CONFIG_DATA, new Optional()]] },
401
+ ],
402
+ exports: [...components],
403
+ }]
404
+ }] });
384
405
  /** @internal */
385
406
  function _moduleConfigFactory(config) {
386
407
  const cfg = typeof config === "function" ? config() : config;
@@ -388,11 +409,11 @@ function _moduleConfigFactory(config) {
388
409
  ? Object.assign(Object.assign({}, COMMAND_DEFAULT_CONFIG), cfg) : COMMAND_DEFAULT_CONFIG;
389
410
  }
390
411
 
391
- const VERSION = "2.2.0";
412
+ const VERSION = "0.0.0-PLACEHOLDER";
392
413
 
393
414
  /**
394
415
  * Generated bundle index. Do not edit.
395
416
  */
396
417
 
397
418
  export { COMMAND_CONFIG, COMMAND_DEFAULT_CONFIG, Command, CommandAsync, CommandDirective, CommandRefDirective, MODULE_CONFIG_DATA, SsvCommandModule, VERSION, _moduleConfigFactory, canExecuteFromNgForm, isCommand, isCommandCreator };
398
- //# sourceMappingURL=ssv-ngx.command.js.map
419
+ //# sourceMappingURL=ssv-ngx.command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssv-ngx.command.mjs","sources":["../../src/command.ts","../../src/config.ts","../../src/command.util.ts","../../src/command.directive.ts","../../src/command-ref.directive.ts","../../src/module.ts","../../src/version.ts","../../src/ssv-ngx.command.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Observable, combineLatest, Subscription, Subject, BehaviorSubject, of, EMPTY } from \"rxjs\";\nimport { tap, map, filter, switchMap, catchError, finalize, take } from \"rxjs/operators\";\nimport { ICommand } from \"./command.model\";\n\n/**\n * Command object used to encapsulate information which is needed to perform an action.\n */\nexport class Command implements ICommand {\n\n\t/** Determines whether the command is currently executing, as a snapshot value. */\n\tget isExecuting(): boolean {\n\t\treturn this._isExecuting;\n\t}\n\n\t/** Determines whether the command can execute or not, as a snapshot value. */\n\tget canExecute(): boolean {\n\t\treturn this._canExecute;\n\t}\n\n\t/** Determines whether the command is currently executing, as an observable. */\n\tget isExecuting$(): Observable<boolean> {\n\t\treturn this._isExecuting$.asObservable();\n\t}\n\n\t/** Determines whether to auto destroy when having 0 subscribers. */\n\tautoDestroy = true;\n\n\t/** Determines whether the command can execute or not, as an observable. */\n\treadonly canExecute$: Observable<boolean>;\n\n\tprivate _isExecuting$ = new BehaviorSubject<boolean>(false);\n\tprivate _isExecuting = false;\n\tprivate _canExecute = true;\n\tprivate executionPipe$ = new Subject<unknown[] | undefined>();\n\tprivate isExecuting$$ = Subscription.EMPTY;\n\tprivate canExecute$$ = Subscription.EMPTY;\n\tprivate executionPipe$$ = Subscription.EMPTY;\n\tprivate subscribersCount = 0;\n\n\t/**\n\t * Creates an instance of Command.\n\t *\n\t * @param execute Execute function to invoke - use `isAsync: true` when `Observable<any>`.\n\t * @param canExecute Observable which determines whether it can execute or not.\n\t * @param isAsync Indicates that the execute function is async e.g. Observable.\n\t */\n\tconstructor(\n\t\texecute: (...args: unknown[]) => unknown,\n\t\tcanExecute$?: Observable<boolean>,\n\t\tisAsync?: boolean,\n\t) {\n\t\tif (canExecute$) {\n\t\t\tthis.canExecute$ = combineLatest([\n\t\t\t\tthis._isExecuting$,\n\t\t\t\tcanExecute$\n\t\t\t]).pipe(\n\t\t\t\tmap(([isExecuting, canExecuteResult]) => {\n\t\t\t\t\t// console.log(\"[command::combineLatest$] update!\", { isExecuting, canExecuteResult });\n\t\t\t\t\tthis._isExecuting = isExecuting;\n\t\t\t\t\tthis._canExecute = !isExecuting && !!canExecuteResult;\n\t\t\t\t\treturn this._canExecute;\n\t\t\t\t}),\n\t\t\t);\n\t\t\tthis.canExecute$$ = this.canExecute$.subscribe();\n\t\t} else {\n\t\t\tthis.canExecute$ = this._isExecuting$.pipe(\n\t\t\t\tmap(x => {\n\t\t\t\t\tconst canExecute = !x;\n\t\t\t\t\tthis._canExecute = canExecute;\n\t\t\t\t\treturn canExecute;\n\t\t\t\t})\n\t\t\t);\n\t\t\tthis.isExecuting$$ = this._isExecuting$\n\t\t\t\t.pipe(tap(x => this._isExecuting = x))\n\t\t\t\t.subscribe();\n\t\t}\n\t\tthis.executionPipe$$ = this.buildExecutionPipe(execute, isAsync).subscribe();\n\t}\n\n\t/** Execute function to invoke. */\n\texecute(...args: unknown[]): void {\n\t\t// console.warn(\"[command::execute]\", args);\n\t\tthis.executionPipe$.next(args);\n\t}\n\n\t/** Disposes all resources held by subscriptions. */\n\tdestroy(): void {\n\t\t// console.warn(\"[command::destroy]\");\n\t\tthis.executionPipe$$.unsubscribe();\n\t\tthis.canExecute$$.unsubscribe();\n\t\tthis.isExecuting$$.unsubscribe();\n\t}\n\n\tsubscribe(): void {\n\t\tthis.subscribersCount++;\n\t}\n\n\tunsubscribe(): void {\n\t\tthis.subscribersCount--;\n\t\t// console.log(\"[command::unsubscribe]\", { autoDestroy: this.autoDestroy, subscribersCount: this.subscribersCount });\n\t\tif (this.autoDestroy && this.subscribersCount <= 0) {\n\t\t\tthis.destroy();\n\t\t}\n\t}\n\n\tprivate buildExecutionPipe(execute: (...args: unknown[]) => any, isAsync?: boolean): Observable<unknown> {\n\t\tlet pipe$ = this.executionPipe$.pipe(\n\t\t\t// tap(x => console.warn(\">>>> executionPipe\", this._canExecute)),\n\t\t\tfilter(() => this._canExecute),\n\t\t\ttap(() => {\n\t\t\t\t// console.log(\"[command::executionPipe$] do#1 - set execute\", { args: x });\n\t\t\t\tthis._isExecuting$.next(true);\n\t\t\t})\n\t\t);\n\n\t\tconst execFn = isAsync\n\t\t\t? switchMap<unknown[] | undefined, any[]>(args => {\n\t\t\t\tif (args) {\n\t\t\t\t\treturn execute(...args);\n\t\t\t\t}\n\t\t\t\treturn execute();\n\t\t\t})\n\t\t\t: tap((args: unknown[] | undefined) => {\n\t\t\t\tif (args) {\n\t\t\t\t\texecute(...args);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\texecute();\n\t\t\t});\n\n\t\tpipe$ = pipe$.pipe(\n\t\t\tswitchMap(args => of(args).pipe(\n\t\t\t\texecFn,\n\t\t\t\tfinalize(() => {\n\t\t\t\t\t// console.log(\"[command::executionPipe$] finalize inner#1 - set idle\");\n\t\t\t\t\tthis._isExecuting$.next(false);\n\t\t\t\t}),\n\t\t\t\ttake(1),\n\t\t\t\tcatchError(error => {\n\t\t\t\t\tconsole.error(\"Unhandled execute error\", error);\n\t\t\t\t\treturn EMPTY;\n\t\t\t\t}),\n\t\t\t)),\n\t\t\ttap(\n\t\t\t\t() => {\n\t\t\t\t\t// console.log(\"[command::executionPipe$] tap#2 - set idle\");\n\t\t\t\t\tthis._isExecuting$.next(false);\n\t\t\t\t},\n\t\t\t)\n\t\t);\n\t\treturn pipe$;\n\t}\n\n}\n\n/**\n * Async Command object used to encapsulate information which is needed to perform an action,\n * which takes an execute function as Observable/Promise.\n */\nexport class CommandAsync extends Command {\n\n\tconstructor(\n\t\texecute: (...args: unknown[]) => Observable<unknown> | Promise<unknown>,\n\t\tcanExecute$?: Observable<boolean>,\n\t) {\n\t\tsuper(execute, canExecute$, true);\n\t}\n\n}\n","import { InjectionToken } from \"@angular/core\";\n\nexport interface CommandOptions {\n\t/**\n\t * Css Class which gets added/removed on the Command element's host while Command `isExecuting$`.\n\t */\n\texecutingCssClass: string;\n\n\t/** Determines whether the disabled will be handled by the directive or not.\n\t * Disable handled by directive's doesn't always play nice when used with other component/pipe/directive and they also handle disabled.\n\t * This disables the handling manually and need to pass explicitly `[disabled]=\"!saveCmd.canExecute\"`.\n\t */\n\thandleDisabled: boolean;\n\n\t/** Determine whether to set a `delay(1)` when setting the disabled. Which might be needed when working with external\n\t * components/directives (such as material button)\n\t */\n\thasDisabledDelay: boolean;\n}\n\nexport const COMMAND_DEFAULT_CONFIG = Object.freeze({\n\texecutingCssClass: \"executing\",\n\thandleDisabled: true,\n\thasDisabledDelay: false,\n} as CommandOptions);\n\nexport const COMMAND_CONFIG = new InjectionToken<CommandOptions>(\"command-config\");\n","import { AbstractControl, AbstractControlDirective, FormControlStatus } from \"@angular/forms\";\nimport { Observable, of } from \"rxjs\";\nimport { map, distinctUntilChanged, startWith, delay } from \"rxjs/operators\";\n\nimport { CommandCreator, ICommand } from \"./command.model\";\nimport { Command } from \"./command\";\n\n/** Determines whether the arg object is of type `Command`. */\nexport function isCommand(arg: unknown): arg is ICommand {\n\treturn arg instanceof Command;\n}\n\n/** Determines whether the arg object is of type `CommandCreator`. */\nexport function isCommandCreator(arg: unknown): arg is CommandCreator {\n\tif (arg instanceof Command) {\n\t\treturn false;\n\t} else if (isAssumedType<CommandCreator>(arg) && arg.execute && arg.host) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport interface CanExecuteFormOptions {\n\t/** Determines whether to check for validity. (defaults: true) */\n\tvalidity?: boolean;\n\n\t/** Determines whether to check whether UI has been touched. (defaults: true) */\n\tdirty?: boolean;\n}\n\n/** Get form is valid as an observable. */\nexport function canExecuteFromNgForm(\n\tform: AbstractControl | AbstractControlDirective,\n\toptions?: CanExecuteFormOptions\n): Observable<boolean> {\n\tconst opts: CanExecuteFormOptions = { validity: true, dirty: true, ...options };\n\n\treturn form.statusChanges\n\t\t? (form.statusChanges as Observable<FormControlStatus>).pipe( // todo: remove cast when working correctly\n\t\t\tdelay(0),\n\t\t\tstartWith(form.valid),\n\t\t\tmap(() => !!(!opts.validity || form.valid) && !!(!opts.dirty || form.dirty)),\n\t\t\tdistinctUntilChanged(),\n\t\t)\n\t\t: of(true);\n}\n\nfunction isAssumedType<T = Record<string, unknown>>(x: unknown): x is Partial<T> {\n\treturn x !== null && typeof x === \"object\";\n}\n","import {\n\tDirective,\n\tOnInit,\n\tOnDestroy,\n\tInput,\n\tHostListener,\n\tElementRef,\n\tInject,\n\tRenderer2,\n\tChangeDetectorRef,\n} from \"@angular/core\";\nimport { Subject } from \"rxjs\";\nimport { tap, delay, takeUntil } from \"rxjs/operators\";\n\nimport { CommandOptions, COMMAND_CONFIG } from \"./config\";\nimport { Command } from \"./command\";\nimport { isCommand, isCommandCreator } from \"./command.util\";\nimport { CommandCreator, ICommand } from \"./command.model\";\n\n/**\n * Controls the state of a component in sync with `Command`.\n *\n * @example\n * ### Most common usage\n * ```html\n * <button [ssvCommand]=\"saveCmd\">Save</button>\n * ```\n *\n *\n * ### Usage with options\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandOptions]=\"{executingCssClass: 'in-progress'}\">Save</button>\n * ```\n *\n *\n * ### Usage with params\n * This is useful for collections (loops) or using multiple actions with different args.\n * *NOTE: This will share the `isExecuting` when used with multiple controls.*\n *\n * #### With single param\n *\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandParams]=\"{id: 1}\">Save</button>\n * ```\n * *NOTE: if you have only 1 argument as an array, it should be enclosed within an array e.g. `[['apple', 'banana']]`,\n * else it will spread and you will `arg1: \"apple\", arg2: \"banana\"`*\n *\n * #### With multi params\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandParams]=\"[{id: 1}, 'hello', hero]\">Save</button>\n * ```\n *\n * ### Usage with Command Creator\n * This is useful for collections (loops) or using multiple actions with different args, whilst not sharing `isExecuting`.\n *\n *\n * ```html\n * <button [ssvCommand]=\"{host: this, execute: removeHero$, canExecute: isValid$, params: [hero, 1337, 'xx']}\">Save</button>\n * ```\n *\n */\n\nconst NAME_CAMEL = \"ssvCommand\";\n\n// let nextUniqueId = 0;\n\n@Directive({\n\tselector: `[${NAME_CAMEL}]`,\n\texportAs: NAME_CAMEL\n})\nexport class CommandDirective implements OnInit, OnDestroy {\n\n\t// readonly id = `${NAME_CAMEL}-${nextUniqueId++}`;\n\n\t@Input(NAME_CAMEL) commandOrCreator: ICommand | CommandCreator | undefined;\n\n\t@Input(`${NAME_CAMEL}Options`)\n\tget commandOptions(): CommandOptions { return this._commandOptions; }\n\tset commandOptions(value: CommandOptions) {\n\t\tif (value === this._commandOptions) {\n\t\t\treturn;\n\t\t}\n\t\tthis._commandOptions = {\n\t\t\t...this.config,\n\t\t\t...value,\n\t\t};\n\t}\n\n\t@Input(`${NAME_CAMEL}Params`) commandParams: unknown | unknown[];\n\n\tget command(): ICommand { return this._command; }\n\tprivate _command!: ICommand;\n\tprivate _commandOptions: CommandOptions = this.config;\n\tprivate _destroy$ = new Subject<void>();\n\n\tconstructor(\n\t\t@Inject(COMMAND_CONFIG) private config: CommandOptions,\n\t\tprivate renderer: Renderer2,\n\t\tprivate element: ElementRef,\n\t\tprivate cdr: ChangeDetectorRef,\n\t) { }\n\n\tngOnInit(): void {\n\t\t// console.log(\"[ssvCommand::init]\", this.config);\n\t\tif (!this.commandOrCreator) {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] should be defined!`);\n\t\t} else if (isCommand(this.commandOrCreator)) {\n\t\t\tthis._command = this.commandOrCreator;\n\t\t} else if (isCommandCreator(this.commandOrCreator)) {\n\t\t\tconst isAsync = this.commandOrCreator.isAsync || this.commandOrCreator.isAsync === undefined;\n\n\t\t\t// todo: find something like this for ivy (or angular10+)\n\t\t\t// const hostComponent = (this.viewContainer as any)._view.component;\n\n\t\t\tconst execFn = this.commandOrCreator.execute.bind(this.commandOrCreator.host);\n\t\t\tthis.commandParams = this.commandParams || this.commandOrCreator.params;\n\n\t\t\tconst canExec = this.commandOrCreator.canExecute instanceof Function\n\t\t\t\t? this.commandOrCreator.canExecute.bind(this.commandOrCreator.host, this.commandParams)()\n\t\t\t\t: this.commandOrCreator.canExecute;\n\n\t\t\t// console.log(\"[ssvCommand::init] command creator\", {\n\t\t\t// \tfirstParam: this.commandParams ? this.commandParams[0] : null,\n\t\t\t// \tparams: this.commandParams\n\t\t\t// });\n\t\t\tthis._command = new Command(execFn, canExec, isAsync);\n\t\t} else {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);\n\t\t}\n\n\t\tthis._command.subscribe();\n\t\tthis._command.canExecute$.pipe(\n\t\t\tthis.commandOptions.hasDisabledDelay\n\t\t\t\t? delay(1)\n\t\t\t\t: tap(() => { /* stub */ }),\n\t\t\ttap(x => {\n\t\t\t\tthis.trySetDisabled(!x);\n\t\t\t\t// console.log(\"[ssvCommand::canExecute$]\", { canExecute: x });\n\t\t\t\tthis.cdr.markForCheck();\n\t\t\t}),\n\t\t\ttakeUntil(this._destroy$),\n\t\t).subscribe();\n\n\t\tif (this._command.isExecuting$) {\n\t\t\tthis._command.isExecuting$.pipe(\n\t\t\t\ttap(x => {\n\t\t\t\t\t// console.log(\"[ssvCommand::isExecuting$]\", x, this.commandOptions);\n\t\t\t\t\tif (x) {\n\t\t\t\t\t\tthis.renderer.addClass(\n\t\t\t\t\t\t\tthis.element.nativeElement,\n\t\t\t\t\t\t\tthis.commandOptions.executingCssClass\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.renderer.removeClass(\n\t\t\t\t\t\t\tthis.element.nativeElement,\n\t\t\t\t\t\t\tthis.commandOptions.executingCssClass\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this._destroy$),\n\t\t\t).subscribe();\n\t\t}\n\t}\n\n\t@HostListener(\"click\")\n\tonClick(): void {\n\t\t// console.log(\"[ssvCommand::onClick]\", this.commandParams);\n\t\tif (Array.isArray(this.commandParams)) {\n\t\t\tthis._command.execute(...this.commandParams);\n\t\t} else {\n\t\t\tthis._command.execute(this.commandParams);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\t// console.log(\"[ssvCommand::destroy]\");\n\t\tthis._destroy$.next();\n\t\tthis._destroy$.complete();\n\t\tif (this._command) {\n\t\t\tthis._command.unsubscribe();\n\t\t}\n\t}\n\n\tprivate trySetDisabled(disabled: boolean) {\n\t\tif (this.commandOptions.handleDisabled) {\n\t\t\t// console.warn(\">>>> disabled\", { id: this.id, disabled });\n\t\t\tthis.renderer.setProperty(this.element.nativeElement, \"disabled\", disabled);\n\t\t}\n\t}\n\n}\n\n","import { Observable } from \"rxjs\";\nimport { Directive, OnInit, OnDestroy, Input } from \"@angular/core\";\n\nimport { ICommand, CommandCreator } from \"./command.model\";\nimport { isCommandCreator } from \"./command.util\";\nimport { Command } from \"./command\";\n\nconst NAME_CAMEL = \"ssvCommandRef\";\n\n/**\n * Command creator ref, directive which allows creating Command in the template\n * and associate it to a command (in order to share executions).\n * @example\n * ### Most common usage\n * ```html\n * <div #actionCmd=\"ssvCommandRef\" [ssvCommandRef]=\"{host: this, execute: removeHero$, canExecute: isValid$}\">\n * <button [ssvCommand]=\"actionCmd.command\" [ssvCommandParams]=\"hero\">\n * Remove\n * </button>\n * <button [ssvCommand]=\"actionCmd.command\" [ssvCommandParams]=\"hero\">\n * Remove\n * </button>\n * </div>\n * ```\n *\n */\n@Directive({\n\tselector: `[${NAME_CAMEL}]`,\n\texportAs: NAME_CAMEL\n})\nexport class CommandRefDirective implements OnInit, OnDestroy {\n\n\t@Input(NAME_CAMEL) commandCreator: CommandCreator | undefined;\n\n\tget command(): ICommand { return this._command; }\n\tprivate _command!: ICommand;\n\n\tngOnInit(): void {\n\t\tif (isCommandCreator(this.commandCreator)) {\n\t\t\tconst isAsync = this.commandCreator.isAsync || this.commandCreator.isAsync === undefined;\n\n\t\t\tconst execFn = this.commandCreator.execute.bind(this.commandCreator.host);\n\t\t\tthis._command = new Command(execFn, this.commandCreator.canExecute as Observable<boolean> | undefined, isAsync);\n\t\t} else {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\t// console.log(\"[commandRef::destroy]\");\n\t\tif (this._command) {\n\t\t\tthis._command.destroy();\n\t\t}\n\t}\n\n}\n","import { NgModule, ModuleWithProviders, InjectionToken, Optional } from \"@angular/core\";\n\nimport { CommandDirective } from \"./command.directive\";\nimport { CommandRefDirective } from \"./command-ref.directive\";\nimport { CommandOptions, COMMAND_DEFAULT_CONFIG, COMMAND_CONFIG } from \"./config\";\n\n/** @internal */\nexport const MODULE_CONFIG_DATA = new InjectionToken<CommandOptions>(\"@ssv/ngx.command/configData\");\n\nconst components = [\n\tCommandDirective,\n\tCommandRefDirective\n];\n\n@NgModule({\n\tdeclarations: components,\n\tproviders: [\n\t\t{ provide: COMMAND_CONFIG, useFactory: _moduleConfigFactory, deps: [[MODULE_CONFIG_DATA, new Optional()]] },\n\t],\n\texports: [...components],\n})\nexport class SsvCommandModule {\n\n\tstatic forRoot(config?: Partial<CommandOptions> | (() => Partial<CommandOptions>)): ModuleWithProviders<SsvCommandModule> {\n\t\treturn {\n\t\t\tngModule: SsvCommandModule,\n\t\t\tproviders: [\n\t\t\t\t{ provide: MODULE_CONFIG_DATA, useValue: config },\n\t\t\t],\n\t\t};\n\t}\n\n}\n\n/** @internal */\nexport function _moduleConfigFactory(config: CommandOptions | (() => CommandOptions)): CommandOptions {\n\tconst cfg = typeof config === \"function\" ? config() : config;\n\treturn cfg\n\t\t? {\n\t\t\t...COMMAND_DEFAULT_CONFIG,\n\t\t\t...cfg,\n\t\t}\n\t\t: COMMAND_DEFAULT_CONFIG;\n}\n","export const VERSION = \"0.0.0-PLACEHOLDER\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["NAME_CAMEL"],"mappings":";;;;;AAAA;AAKA;;AAEG;MACU,OAAO,CAAA;AAgCnB;;;;;;AAMG;AACH,IAAA,WAAA,CACC,OAAwC,EACxC,WAAiC,EACjC,OAAiB,EAAA;;AAxBlB,QAAA,IAAW,CAAA,WAAA,GAAG,IAAI,CAAC;QAKX,IAAA,CAAA,aAAa,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC,CAAC;AACpD,QAAA,IAAY,CAAA,YAAA,GAAG,KAAK,CAAC;AACrB,QAAA,IAAW,CAAA,WAAA,GAAG,IAAI,CAAC;AACnB,QAAA,IAAA,CAAA,cA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