@sd-angular/core 1.0.39 → 1.0.42

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 (55) hide show
  1. package/assets/scss/quill-mention/quill-mention.css +7 -4
  2. package/bundles/sd-angular-core-comment.umd.js +2 -2
  3. package/bundles/sd-angular-core-comment.umd.js.map +1 -1
  4. package/bundles/sd-angular-core-comment.umd.min.js +2 -2
  5. package/bundles/sd-angular-core-comment.umd.min.js.map +1 -1
  6. package/bundles/sd-angular-core-form.umd.js +2 -0
  7. package/bundles/sd-angular-core-form.umd.js.map +1 -1
  8. package/bundles/sd-angular-core-form.umd.min.js +1 -1
  9. package/bundles/sd-angular-core-form.umd.min.js.map +1 -1
  10. package/bundles/sd-angular-core-input-currency.umd.js +3 -3
  11. package/bundles/sd-angular-core-input-currency.umd.js.map +1 -1
  12. package/bundles/sd-angular-core-input-currency.umd.min.js +1 -1
  13. package/bundles/sd-angular-core-input-currency.umd.min.js.map +1 -1
  14. package/bundles/sd-angular-core-input.umd.js +33 -10
  15. package/bundles/sd-angular-core-input.umd.js.map +1 -1
  16. package/bundles/sd-angular-core-input.umd.min.js +2 -2
  17. package/bundles/sd-angular-core-input.umd.min.js.map +1 -1
  18. package/bundles/sd-angular-core-notify.umd.js +72 -31
  19. package/bundles/sd-angular-core-notify.umd.js.map +1 -1
  20. package/bundles/sd-angular-core-notify.umd.min.js +2 -2
  21. package/bundles/sd-angular-core-notify.umd.min.js.map +1 -1
  22. package/bundles/sd-angular-core-utility.umd.js +3 -0
  23. package/bundles/sd-angular-core-utility.umd.js.map +1 -1
  24. package/bundles/sd-angular-core-utility.umd.min.js +1 -1
  25. package/bundles/sd-angular-core-utility.umd.min.js.map +1 -1
  26. package/comment/sd-angular-core-comment.metadata.json +1 -1
  27. package/comment/src/lib/comment.model.d.ts +2 -0
  28. package/esm2015/comment/src/lib/comment.component.js +3 -3
  29. package/esm2015/comment/src/lib/comment.model.js +1 -1
  30. package/esm2015/form/src/lib/form.module.js +4 -1
  31. package/esm2015/input/src/lib/input.component.js +25 -7
  32. package/esm2015/input/src/lib/input.module.js +4 -2
  33. package/esm2015/input-currency/src/lib/input-currency.component.js +4 -4
  34. package/esm2015/notify/src/lib/notify.service.js +71 -29
  35. package/esm2015/utility/src/lib/utility.service.js +4 -1
  36. package/fesm2015/sd-angular-core-comment.js +2 -2
  37. package/fesm2015/sd-angular-core-comment.js.map +1 -1
  38. package/fesm2015/sd-angular-core-form.js +3 -1
  39. package/fesm2015/sd-angular-core-form.js.map +1 -1
  40. package/fesm2015/sd-angular-core-input-currency.js +3 -3
  41. package/fesm2015/sd-angular-core-input-currency.js.map +1 -1
  42. package/fesm2015/sd-angular-core-input.js +27 -7
  43. package/fesm2015/sd-angular-core-input.js.map +1 -1
  44. package/fesm2015/sd-angular-core-notify.js +70 -28
  45. package/fesm2015/sd-angular-core-notify.js.map +1 -1
  46. package/fesm2015/sd-angular-core-utility.js +3 -0
  47. package/fesm2015/sd-angular-core-utility.js.map +1 -1
  48. package/form/sd-angular-core-form.metadata.json +1 -1
  49. package/input/sd-angular-core-input.metadata.json +1 -1
  50. package/input/src/lib/input.component.d.ts +7 -1
  51. package/input-currency/sd-angular-core-input-currency.metadata.json +1 -1
  52. package/notify/sd-angular-core-notify.metadata.json +1 -1
  53. package/package.json +1 -1
  54. package/{sd-angular-core-1.0.39.tgz → sd-angular-core-1.0.42.tgz} +0 -0
  55. package/utility/src/lib/utility.service.d.ts +1 -0
@@ -22,7 +22,7 @@ class SdInputCurrency {
22
22
  _form.set(this, void 0);
23
23
  _model.set(this, void 0);
24
24
  this.modelChange = new EventEmitter();
25
- _align.set(this, 'right');
25
+ _align.set(this, 'left');
26
26
  _allowNegative.set(this, true);
27
27
  _decimal.set(this, ',');
28
28
  _precision.set(this, 0);
@@ -147,7 +147,7 @@ class SdInputCurrency {
147
147
  }
148
148
  }
149
149
  set align(val) {
150
- __classPrivateFieldSet(this, _align, val || 'right');
150
+ __classPrivateFieldSet(this, _align, val || 'left');
151
151
  __classPrivateFieldGet(this, _generateOption).call(this);
152
152
  }
153
153
  set allowNegative(val) {
@@ -230,7 +230,7 @@ _name = new WeakMap(), _form = new WeakMap(), _model = new WeakMap(), _align = n
230
230
  SdInputCurrency.decorators = [
231
231
  { type: Component, args: [{
232
232
  selector: 'sd-input-currency',
233
- template: "<div class=\"d-flex align-items-center\">\r\n <mat-form-field class=\"sd-md\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input currencyMask [options]=\"options\" [formControl]=\"formControl\" #control matInput\r\n [placeholder]=\"placeholder || label\" (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" [required]=\"isRequired\"\r\n autocomplete=\"off\">\r\n <span matSuffix>cm</span>\r\n <ng-container *ngIf=\"sdSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern && !disableErrorMessage\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator && !disableErrorMessage\">\r\n <strong>{{formControl.errors?.customValidator}}</strong>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputCurrencyTooltipPipe:tooltip\"\r\n matSuffix #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n</div>",
233
+ template: "<div class=\"d-flex align-items-center\">\r\n <mat-form-field class=\"sd-md\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input currencyMask [options]=\"options\" [formControl]=\"formControl\" #control matInput\r\n [placeholder]=\"placeholder || label\" (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" [required]=\"isRequired\"\r\n autocomplete=\"off\">\r\n <ng-container *ngIf=\"sdSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern && !disableErrorMessage\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator && !disableErrorMessage\">\r\n <strong>{{formControl.errors?.customValidator}}</strong>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputCurrencyTooltipPipe:tooltip\"\r\n matSuffix #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n</div>",
234
234
  styles: [":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}"]
235
235
  },] }
236
236
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-input-currency.js","sources":["../../../../projects/sd-core/input-currency/src/lib/input-currency.component.ts","../../../../projects/sd-core/input-currency/src/lib/input-currency-tooltip.pipe.ts","../../../../projects/sd-core/input-currency/src/lib/input-currency.module.ts","../../../../projects/sd-core/input-currency/src/public-api.ts","../../../../projects/sd-core/input-currency/sd-angular-core-input-currency.ts"],"sourcesContent":["import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { AbstractControl, FormControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime, startWith } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { CurrencyMaskInputMode } from 'ngx-currency';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdSuffixDirective } from '@sd-angular/core/common';\r\n\r\n@Component({\r\n selector: 'sd-input-currency',\r\n templateUrl: './input-currency.component.html',\r\n styleUrls: ['./input-currency.component.scss']\r\n})\r\nexport class SdInputCurrency implements OnDestroy, OnInit, AfterViewInit {\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value);\r\n this.ref.detectChanges();\r\n }\r\n }\r\n\r\n @Output() modelChange = new EventEmitter();\r\n\r\n #align: 'left' | 'right' = 'right';\r\n @Input() set align(val: 'left' | 'right' | '') {\r\n this.#align = val || 'right';\r\n this.#generateOption();\r\n }\r\n\r\n #allowNegative = true;\r\n @Input() set allowNegative(val: boolean | '') {\r\n this.#allowNegative = (val === '') || val;\r\n this.#generateOption();\r\n }\r\n\r\n #decimal: '.' | ',' = ',';\r\n @Input() set decimal(val: '.' | ',' | '') {\r\n this.#decimal = val || ',';\r\n this.#generateOption();\r\n }\r\n\r\n #precision: number = 0;\r\n @Input() set precision(val: number) {\r\n this.#precision = val || 0;\r\n this.#generateOption();\r\n }\r\n\r\n #prefix: string;\r\n @Input() set prefix(val: string) {\r\n this.#prefix = val;\r\n this.#generateOption();\r\n }\r\n\r\n #suffix: string;\r\n @Input() set suffix(val: string) {\r\n this.#suffix = val;\r\n this.#generateOption();\r\n }\r\n\r\n #thousands: '.' | ',' = '.';\r\n @Input() set thousands(val: '.' | ',' | '') {\r\n this.#thousands = val || '.';\r\n this.#generateOption();\r\n }\r\n\r\n #nullable: boolean;\r\n @Input() set nullable(val: boolean | false) {\r\n this.#nullable = val;\r\n this.#generateOption();\r\n }\r\n\r\n #min: number;\r\n @Input() set min(val: number) {\r\n this.#min = val;\r\n this.#generateOption();\r\n }\r\n\r\n #max: number;\r\n @Input() set max(val: number) {\r\n this.#max = val;\r\n this.#generateOption();\r\n }\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @ContentChild(SdSuffixDirective) sdSuffix: SdSuffixDirective;\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n options = {};\r\n constructor(private ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.#generateOption();\r\n }\r\n\r\n #generateOption = () => {\r\n this.options = {\r\n align: this.#align || '',\r\n allowNegative: this.#allowNegative,\r\n decimal: this.#decimal,\r\n precision: this.#precision,\r\n prefix: this.#prefix || '',\r\n suffix: this.#suffix || '',\r\n thousands: this.#thousands,\r\n nullable: this.#nullable,\r\n min: this.#min,\r\n max: this.#max,\r\n inputMode: CurrencyMaskInputMode.NATURAL\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = async (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n this.keyupEnter.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.sdFocus.emit();\r\n }\r\n\r\n onBlur = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputCurrencyTooltipPipe'\r\n})\r\nexport class SdInputCurrencyTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInputCurrency } from './input-currency.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputCurrencyTooltipPipe } from './input-currency-tooltip.pipe';\r\nimport { NgxCurrencyModule } from \"ngx-currency\";\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdCommonModule,\r\n SdTranslateModule,\r\n NgxCurrencyModule\r\n ],\r\n declarations: [\r\n SdInputCurrency,\r\n SdInputCurrencyTooltipPipe\r\n ],\r\n exports: [\r\n SdInputCurrency,\r\n SdInputCurrencyTooltipPipe\r\n ]\r\n})\r\nexport class SdInputCurrencyModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input-currency.module';\r\nexport * from './lib/input-currency-tooltip.pipe';\r\nexport * from './lib/input-currency.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;MA0Ba,eAAe;IAsI1B,YAAoB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QArI1C,gBAAQA,EAAO,EAAE,EAAC;QAMlB,wBAAmB,GAAG,KAAK,CAAC;QAM5B,wBAAiB;QAajB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;QAE3C,iBAA2B,OAAO,EAAC;QAMnC,yBAAiB,IAAI,EAAC;QAMtB,mBAAsB,GAAG,EAAC;QAM1B,qBAAqB,CAAC,EAAC;QAMvB,0BAAgB;QAMhB,0BAAgB;QAMhB,qBAAwB,GAAG,EAAC;QAM5B,4BAAmB;QAMnB,uBAAa;QAMb,uBAAa;;QAOb,eAAU,GAAG,KAAK,CAAC;QAMnB,2BAAiB;QAKjB,6BAAqD;QAiB3C,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QACnC,YAAO,GAAG,IAAI,YAAY,EAAO,CAAC;QAClC,eAAU,GAAG,IAAI,YAAY,EAAE,CAAC;QA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A4B;aACnC;;;MCgCY,qBAAqB;;;YAtBjC,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,cAAc;oBACd,iBAAiB;oBACjB,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,eAAe;oBACf,0BAA0B;iBAC3B;gBACD,OAAO,EAAE;oBACP,eAAe;oBACf,0BAA0B;iBAC3B;aACF;;;AClCD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-input-currency.js","sources":["../../../../projects/sd-core/input-currency/src/lib/input-currency.component.ts","../../../../projects/sd-core/input-currency/src/lib/input-currency-tooltip.pipe.ts","../../../../projects/sd-core/input-currency/src/lib/input-currency.module.ts","../../../../projects/sd-core/input-currency/src/public-api.ts","../../../../projects/sd-core/input-currency/sd-angular-core-input-currency.ts"],"sourcesContent":["import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild\r\n} from '@angular/core';\r\nimport { AbstractControl, FormControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime, startWith } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { CurrencyMaskInputMode } from 'ngx-currency';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdSuffixDirective } from '@sd-angular/core/common';\r\n\r\n@Component({\r\n selector: 'sd-input-currency',\r\n templateUrl: './input-currency.component.html',\r\n styleUrls: ['./input-currency.component.scss']\r\n})\r\nexport class SdInputCurrency implements OnDestroy, OnInit, AfterViewInit {\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value);\r\n this.ref.detectChanges();\r\n }\r\n }\r\n\r\n @Output() modelChange = new EventEmitter();\r\n\r\n #align: 'left' | 'right' = 'left';\r\n @Input() set align(val: 'left' | 'right' | '') {\r\n this.#align = val || 'left';\r\n this.#generateOption();\r\n }\r\n\r\n #allowNegative = true;\r\n @Input() set allowNegative(val: boolean | '') {\r\n this.#allowNegative = (val === '') || val;\r\n this.#generateOption();\r\n }\r\n\r\n #decimal: '.' | ',' = ',';\r\n @Input() set decimal(val: '.' | ',' | '') {\r\n this.#decimal = val || ',';\r\n this.#generateOption();\r\n }\r\n\r\n #precision: number = 0;\r\n @Input() set precision(val: number) {\r\n this.#precision = val || 0;\r\n this.#generateOption();\r\n }\r\n\r\n #prefix: string;\r\n @Input() set prefix(val: string) {\r\n this.#prefix = val;\r\n this.#generateOption();\r\n }\r\n\r\n #suffix: string;\r\n @Input() set suffix(val: string) {\r\n this.#suffix = val;\r\n this.#generateOption();\r\n }\r\n\r\n #thousands: '.' | ',' = '.';\r\n @Input() set thousands(val: '.' | ',' | '') {\r\n this.#thousands = val || '.';\r\n this.#generateOption();\r\n }\r\n\r\n #nullable: boolean;\r\n @Input() set nullable(val: boolean | false) {\r\n this.#nullable = val;\r\n this.#generateOption();\r\n }\r\n\r\n #min: number;\r\n @Input() set min(val: number) {\r\n this.#min = val;\r\n this.#generateOption();\r\n }\r\n\r\n #max: number;\r\n @Input() set max(val: number) {\r\n this.#max = val;\r\n this.#generateOption();\r\n }\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @ContentChild(SdSuffixDirective) sdSuffix: SdSuffixDirective;\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n options = {};\r\n constructor(private ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n this.#generateOption();\r\n }\r\n\r\n #generateOption = () => {\r\n this.options = {\r\n align: this.#align || '',\r\n allowNegative: this.#allowNegative,\r\n decimal: this.#decimal,\r\n precision: this.#precision,\r\n prefix: this.#prefix || '',\r\n suffix: this.#suffix || '',\r\n thousands: this.#thousands,\r\n nullable: this.#nullable,\r\n min: this.#min,\r\n max: this.#max,\r\n inputMode: CurrencyMaskInputMode.NATURAL\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = async (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n this.keyupEnter.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.sdFocus.emit();\r\n }\r\n\r\n onBlur = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputCurrencyTooltipPipe'\r\n})\r\nexport class SdInputCurrencyTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInputCurrency } from './input-currency.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputCurrencyTooltipPipe } from './input-currency-tooltip.pipe';\r\nimport { NgxCurrencyModule } from \"ngx-currency\";\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdCommonModule,\r\n SdTranslateModule,\r\n NgxCurrencyModule\r\n ],\r\n declarations: [\r\n SdInputCurrency,\r\n SdInputCurrencyTooltipPipe\r\n ],\r\n exports: [\r\n SdInputCurrency,\r\n SdInputCurrencyTooltipPipe\r\n ]\r\n})\r\nexport class SdInputCurrencyModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input-currency.module';\r\nexport * from './lib/input-currency-tooltip.pipe';\r\nexport * from './lib/input-currency.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;MA0Ba,eAAe;IAsI1B,YAAoB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QArI1C,gBAAQA,EAAO,EAAE,EAAC;QAMlB,wBAAmB,GAAG,KAAK,CAAC;QAM5B,wBAAiB;QAajB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;QAE3C,iBAA2B,MAAM,EAAC;QAMlC,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,KAAK;sBAML,KAAK;wBAKL,KAAK;uBAML,KAAK;uBAQL,YAAY,SAAC,iBAAiB;sBAC9B,KAAK;uBACL,MAAM;sBACN,MAAM;yBACN,MAAM;sBAEN,SAAS,SAAC,SAAS;;;MCxJT,0BAA0B;IACrC,SAAS,CAAC,KAAU,EAAE,OAAkD;QACtE,IAAI,QAAQ,OAAO,CAAC,KAAK,QAAQ,EAAE;YACjC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;KACvB;;;YATF,IAAI,SAAC;gBACJ,IAAI,EAAE,4BAA4B;aACnC;;;MCgCY,qBAAqB;;;YAtBjC,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,cAAc;oBACd,iBAAiB;oBACjB,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,eAAe;oBACf,0BAA0B;iBAC3B;gBACD,OAAO,EAAE;oBACP,eAAe;oBACf,0BAA0B;iBAC3B;aACF;;;AClCD;;;;ACAA;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Directive, TemplateRef, EventEmitter, Component, ChangeDetectionStrategy, ChangeDetectorRef, Input, Output, ViewChild, ContentChild, Pipe, NgModule } from '@angular/core';
1
+ import { Directive, TemplateRef, EventEmitter, Component, ChangeDetectionStrategy, ChangeDetectorRef, Input, Output, ViewChild, ContentChild, ElementRef, Pipe, NgModule } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { MatIconModule } from '@angular/material/icon';
4
4
  import { MatTooltipModule } from '@angular/material/tooltip';
@@ -8,9 +8,11 @@ import { v4 } from 'uuid';
8
8
  import { debounceTime } from 'rxjs/operators';
9
9
  import { Subscription } from 'rxjs';
10
10
  import { SdFormControl, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
11
+ import { SdUtilityService } from '@sd-angular/core/utility';
11
12
  import { MatInputModule } from '@angular/material/input';
12
13
  import { MatFormFieldModule } from '@angular/material/form-field';
13
14
  import { SdTranslateModule } from '@sd-angular/core/translate';
15
+ import { MatButtonModule } from '@angular/material/button';
14
16
 
15
17
  class SdInputSuffixDirective {
16
18
  constructor(templateRef) {
@@ -28,8 +30,9 @@ SdInputSuffixDirective.ctorParameters = () => [
28
30
 
29
31
  var _name, _form, _blurOnEnter_1, _model, _pattern, _validator, _subscription, _updateValidator, _onChange, _customValidator;
30
32
  class SdInput {
31
- constructor(ref) {
33
+ constructor(ref, utilityService) {
32
34
  this.ref = ref;
35
+ this.utilityService = utilityService;
33
36
  this.id = `I${v4()}`;
34
37
  _name.set(this, v4());
35
38
  _form.set(this, void 0);
@@ -53,6 +56,7 @@ class SdInput {
53
56
  this.formControl = new SdFormControl();
54
57
  _subscription.set(this, new Subscription());
55
58
  this.isFocused = false;
59
+ this.copyable = false;
56
60
  this.reValidate = () => {
57
61
  this.formControl.updateValueAndValidity();
58
62
  };
@@ -228,6 +232,9 @@ class SdInput {
228
232
  this.hideIcon = (val === '') || val;
229
233
  val = (val === '') || val;
230
234
  }
235
+ set _copyable(val) {
236
+ this.copyable = (val === '') || val;
237
+ }
231
238
  ngOnInit() {
232
239
  __classPrivateFieldGet(this, _subscription).add(this.formControl.touchedChanges.subscribe(() => {
233
240
  this.ref.markForCheck();
@@ -244,18 +251,28 @@ class SdInput {
244
251
  (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
245
252
  __classPrivateFieldGet(this, _subscription).unsubscribe();
246
253
  }
254
+ copyText() {
255
+ this.utilityService.copyToClipboard(__classPrivateFieldGet(this, _model));
256
+ this.btnCopy.nativeElement.innerText = 'Copied';
257
+ this.btnCopy.nativeElement.setAttribute('style', 'color: #4caf50;');
258
+ setTimeout(() => {
259
+ this.btnCopy.nativeElement.innerText = 'Copy';
260
+ this.btnCopy.nativeElement.removeAttribute('style');
261
+ }, 2000);
262
+ }
247
263
  }
248
264
  _name = new WeakMap(), _form = new WeakMap(), _blurOnEnter_1 = new WeakMap(), _model = new WeakMap(), _pattern = new WeakMap(), _validator = new WeakMap(), _subscription = new WeakMap(), _updateValidator = new WeakMap(), _onChange = new WeakMap(), _customValidator = new WeakMap();
249
265
  SdInput.decorators = [
250
266
  { type: Component, args: [{
251
267
  selector: 'sd-input',
252
- template: "<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput [placeholder]=\"placeholder || label\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" [required]=\"isRequired\"\r\n [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\">\r\n <span class=\"mr-1\" *ngIf=\"maxlength\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.maxlength && !disableErrorMessage\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern && !disableErrorMessage\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator && !disableErrorMessage\">\r\n <strong>{{formControl.errors?.customValidator}}</strong>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n </ng-template>\r\n</div>",
268
+ template: "<div class=\"d-flex align-items-center\" [class.sd-view]=\"sdView?.templateRef\" [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\" (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput [placeholder]=\"placeholder || label\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" [required]=\"isRequired\"\r\n [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\">\r\n <button #btnCopy *ngIf=\"copyable\" matSuffix mat-flat-button aria-label=\"Clear\" class=\"btn-copy\"\r\n (click)=\"copyText()\">\r\n Copy\r\n </button>\r\n <span class=\"mr-1\" *ngIf=\"maxlength\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.maxlength && !disableErrorMessage\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern && !disableErrorMessage\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator && !disableErrorMessage\">\r\n <strong>{{formControl.errors?.customValidator}}</strong>\r\n </mat-error>\r\n </mat-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n </ng-template>\r\n</div>",
253
269
  changeDetection: ChangeDetectionStrategy.OnPush,
254
- styles: [":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}"]
270
+ styles: [":host ::ng-deep .mat-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field input.mat-input-element:disabled{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;margin:auto;text-align:center;width:30px}:host{display:block;padding-top:5px}.sd-md:hover .btn-copy{visibility:visible}.btn-copy{background:#e9e9e9!important;font-size:12px;line-height:26px!important;margin-bottom:3px;visibility:hidden}"]
255
271
  },] }
256
272
  ];
257
273
  SdInput.ctorParameters = () => [
258
- { type: ChangeDetectorRef }
274
+ { type: ChangeDetectorRef },
275
+ { type: SdUtilityService }
259
276
  ];
260
277
  SdInput.propDecorators = {
261
278
  name: [{ type: Input }],
@@ -285,7 +302,9 @@ SdInput.propDecorators = {
285
302
  keyupEnter: [{ type: Output }],
286
303
  control: [{ type: ViewChild, args: ['control',] }],
287
304
  sdInputSuffix: [{ type: ContentChild, args: [SdInputSuffixDirective,] }],
288
- sdView: [{ type: ContentChild, args: [SdViewDefDirective,] }]
305
+ sdView: [{ type: ContentChild, args: [SdViewDefDirective,] }],
306
+ btnCopy: [{ type: ViewChild, args: ['btnCopy', { read: ElementRef },] }],
307
+ _copyable: [{ type: Input, args: ['copyable',] }]
289
308
  };
290
309
 
291
310
  class SdInputTooltipPipe {
@@ -333,7 +352,8 @@ SdInputModule.decorators = [
333
352
  MatIconModule,
334
353
  MatTooltipModule,
335
354
  SdTranslateModule,
336
- SdCommonModule
355
+ SdCommonModule,
356
+ MatButtonModule
337
357
  ],
338
358
  declarations: [
339
359
  SdInput,
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-input.js","sources":["../../../../projects/sd-core/input/src/lib/directives/input-suffix.directive.ts","../../../../projects/sd-core/input/src/lib/input.component.ts","../../../../projects/sd-core/input/src/lib/input-tooltip.pipe.ts","../../../../projects/sd-core/input/src/lib/directives/touch.directive.ts","../../../../projects/sd-core/input/src/lib/input.module.ts","../../../../projects/sd-core/input/src/public-api.ts","../../../../projects/sd-core/input/sd-angular-core-input.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdInputSuffix]'\r\n})\r\nexport class SdInputSuffixDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\n@Component({\r\n selector: 'sd-input',\r\n templateUrl: './input.component.html',\r\n styleUrls: ['./input.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInput implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' = 'text';\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n constructor(public ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n if(this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onClickIcon = (event: Event) => {\r\n event?.preventDefault();\r\n event?.stopPropagation();\r\n this.sdClickIcon.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n onClick = () => {\r\n if(this.sdView?.templateRef) {\r\n if(!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n console.log(changes);\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule\r\n ],\r\n declarations: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n TouchDirective\r\n ],\r\n exports: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n SdCommonModule\r\n ]\r\n})\r\nexport class SdInputModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input.module';\r\nexport * from './lib/input-tooltip.pipe';\r\nexport * from './lib/directives/input-suffix.directive';\r\nexport * from './lib/input.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {TouchDirective as ɵa} from './src/lib/directives/touch.directive';"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;MAKa,sBAAsB;IACjC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,iBAAiB;aAC5B;;;YAJmB,WAAW;;;;MC4BlB,OAAO;IAsGlB,YAAmB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QArGzC,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAOlB,wBAAiB;QAYR,SAAI,GAA6C,MAAM,CAAC;QACjE,wBAAmB,GAAG,KAAK,CAAC;QAI5B,yBAAe,KAAK,EAAC;QAIrB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAG3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAAU,GAAG,KAAK,CAAC;QAenB,2BAAiB;QAKjB,6BAAqD;QAe5C,SAAI,GAAG,QAAQ,CAAC;QACzB,aAAQ,GAAG,KAAK,CAAC;QAKP,gBAAW,GAAG,IAAI,YAAY,EAAO,CAAC;QAEtC,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QACnC,YAAO,GAAG,IAAI,YAAY,EAAO,CAAC;QAClC,qBAAgB,GAAG,IAAI,YAAY,EAAO,CAAC;QAC3C,eAAU,GAAG,IAAI,YAAY,EAAE,CAAC;QAI1C,gBAAW,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,wBAAgB,IAAI,YAAY,EAAE,EAAC;QAEnC,cAAS,GAAG,KAAK,CAAC;QAqBlB,eAAU,GAAG;YACX,IAAI,CAAC,WAAW,CAAC,s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;;"}
1
+ {"version":3,"file":"sd-angular-core-input.js","sources":["../../../../projects/sd-core/input/src/lib/directives/input-suffix.directive.ts","../../../../projects/sd-core/input/src/lib/input.component.ts","../../../../projects/sd-core/input/src/lib/input-tooltip.pipe.ts","../../../../projects/sd-core/input/src/lib/directives/touch.directive.ts","../../../../projects/sd-core/input/src/lib/input.module.ts","../../../../projects/sd-core/input/src/public-api.ts","../../../../projects/sd-core/input/sd-angular-core-input.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdInputSuffix]'\r\n})\r\nexport class SdInputSuffixDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\n@Component({\r\n selector: 'sd-input',\r\n templateUrl: './input.component.html',\r\n styleUrls: ['./input.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInput implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n @Input() label: string;\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' = 'text';\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n @ViewChild('btnCopy', { read: ElementRef }) btnCopy: ElementRef;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n constructor(\r\n public ref: ChangeDetectorRef,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.touchedChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n if (this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onClickIcon = (event: Event) => {\r\n event?.preventDefault();\r\n event?.stopPropagation();\r\n this.sdClickIcon.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n copyText() {\r\n this.utilityService.copyToClipboard(this.#model);\r\n this.btnCopy.nativeElement.innerText = 'Copied';\r\n this.btnCopy.nativeElement.setAttribute('style', 'color: #4caf50;');\r\n setTimeout(() => {\r\n this.btnCopy.nativeElement.innerText = 'Copy';\r\n this.btnCopy.nativeElement.removeAttribute('style');\r\n }, 2000);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n console.log(changes);\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { MatButtonModule } from '@angular/material/button';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n MatButtonModule\r\n ],\r\n declarations: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n TouchDirective\r\n ],\r\n exports: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n SdCommonModule\r\n ]\r\n})\r\nexport class SdInputModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input.module';\r\nexport * from './lib/input-tooltip.pipe';\r\nexport * from './lib/directives/input-suffix.directive';\r\nexport * from './lib/input.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {TouchDirective as ɵa} from './src/lib/directives/touch.directive';"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;MAKa,sBAAsB;IACjC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,iBAAiB;aAC5B;;;YAJmB,WAAW;;;;MC6BlB,OAAO;IA2GlB,YACS,GAAsB,EACrB,cAAgC;QADjC,QAAG,GAAH,GAAG,CAAmB;QACrB,mBAAc,GAAd,cAAc,CAAkB;QA5G1C,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAOlB,wBAAiB;QAYR,SAAI,GAA6C,MAAM,CAAC;QACjE,wBAAmB,GAAG,KAAK,CAAC;QAI5B,yBAAe,KAAK,EAAC;QAIrB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAG3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAAU,GAAG,KAAK,CAAC;QAenB,2BAAiB;QAKjB,6BAAqD;QAe5C,SAAI,GAAG,QAAQ,CAAC;QACzB,aA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AM;yBACN,MAAM;sBAEN,SAAS,SAAC,SAAS;4BACnB,YAAY,SAAC,sBAAsB;qBAGnC,YAAY,SAAC,kBAAkB;sBAE/B,SAAS,SAAC,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;wBAEzC,KAAK,SAAC,UAAU;;;MCjIN,kBAAkB;IAC7B,SAAS,CAAC,KAAU,EAAE,OAAkD;QACtE,IAAI,QAAQ,OAAO,CAAC,KAAK,QAAQ,EAAE;YACjC,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;KACvB;;;YATF,IAAI,SAAC;gBACJ,IAAI,EAAE,oBAAoB;aAC3B;;;MCEY,cAAc;IAIzB,WAAW,CAAC,OAAsB;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,IAAG,OAAO,CAAC,KAAK,EAAC;YACf,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;SACzB;KACF;;;YAZF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;aACpB;;;oBAEE,KAAK;kBACL,KAAK;;;MCkCK,aAAa;;;YA1BzB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;oBACd,eAAe;iBAChB;gBACD,YAAY,EAAE;oBACZ,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;aACF;;;ACxCD;;;;ACAA;;;;;;"}
@@ -11,7 +11,8 @@ import { SdButtonModule } from '@sd-angular/core/button';
11
11
  import { __classPrivateFieldGet } from 'tslib';
12
12
  import '@sd-angular/core/common';
13
13
  import { SdTranslateService } from '@sd-angular/core/translate';
14
- import { takeUntil } from 'rxjs/operators';
14
+ import { take, takeUntil } from 'rxjs/operators';
15
+ import { timer } from 'rxjs';
15
16
  import { v4 } from 'uuid';
16
17
 
17
18
  class DialogConfirmComponent {
@@ -36,14 +37,15 @@ DialogConfirmComponent.ctorParameters = () => [
36
37
  { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
37
38
  ];
38
39
 
39
- var _delayDuration, _cache, _buildToastMultiMesssage;
40
- let notifyId = 0;
40
+ var _delayDuration, _warningKey, _errorKey, _cache, _notifyWarning, _notifyError, _buildToastMultiMesssage;
41
41
  class SdNotifyService {
42
42
  constructor(dialog, toastr, translateService) {
43
43
  this.dialog = dialog;
44
44
  this.toastr = toastr;
45
45
  this.translateService = translateService;
46
46
  _delayDuration.set(this, 500); // Các error/warning message sẽ tự động gộp sau khoảng thời gian trên
47
+ _warningKey.set(this, v4());
48
+ _errorKey.set(this, v4());
47
49
  _cache.set(this, {});
48
50
  this.alert = {
49
51
  info: (message, title, yesTitle, icon) => {
@@ -106,42 +108,82 @@ class SdNotifyService {
106
108
  });
107
109
  },
108
110
  warning: (message, delay, title) => {
109
- // tslint:disable-next-line: max-line-length
110
- // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #9F6000; background-color: #FEEFB3`;
111
- // tslint:disable-next-line: max-line-length
112
- // const html = `<div id="${this.notifyId}" style="${style}"><i class="fa fa-exclamation-triangle"></i> ${message || this.translate('Warning')}</div>`;
113
- // this.showNotify(html, delay);
111
+ if (!__classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)] || Date.addMiliseconds(__classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)].createdDate, __classPrivateFieldGet(this, _delayDuration)) < new Date()) {
112
+ __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)] = {
113
+ createdDate: new Date(),
114
+ data: {
115
+ title: title,
116
+ messages: [],
117
+ }
118
+ };
119
+ timer(__classPrivateFieldGet(this, _delayDuration)).pipe(take(1)).subscribe(() => {
120
+ __classPrivateFieldGet(this, _notifyWarning).call(this, {
121
+ title: __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)].data.title,
122
+ message: __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)].data.messages,
123
+ delay: delay
124
+ });
125
+ });
126
+ }
114
127
  if (Array.isArray(message)) {
115
- __classPrivateFieldGet(this, _buildToastMultiMesssage).call(this, 'warning', message, delay, title);
128
+ __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)].data.messages = [...__classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)].data.messages, ...message];
116
129
  }
117
130
  else {
118
- const content = message || this.translate("Warning");
119
- this.toastr.warning(content, title, {
120
- enableHtml: true,
121
- timeOut: delay || 3000,
122
- closeButton: true,
123
- });
131
+ __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _warningKey)].data.messages.push(message);
124
132
  }
125
133
  },
126
134
  error: (message, delay, title) => {
127
- // tslint:disable-next-line: max-line-length
128
- // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #D8000C; background-color: #FFD2D2`;
129
- // tslint:disable-next-line: max-line-length
130
- // const html = `<div id="${this.notifyId}" style="${style}"><i class="fa fa-times"></i> ${message || this.translate('Error')}</div>`;
131
- // this.showNotify(html, delay);
135
+ if (!__classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)] || Date.addMiliseconds(__classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)].createdDate, __classPrivateFieldGet(this, _delayDuration)) < new Date()) {
136
+ __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)] = {
137
+ createdDate: new Date(),
138
+ data: {
139
+ title: title,
140
+ messages: [],
141
+ }
142
+ };
143
+ timer(__classPrivateFieldGet(this, _delayDuration)).pipe(take(1)).subscribe(() => {
144
+ __classPrivateFieldGet(this, _notifyError).call(this, {
145
+ title: __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)].data.title,
146
+ message: __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)].data.messages,
147
+ delay: delay
148
+ });
149
+ });
150
+ }
132
151
  if (Array.isArray(message)) {
133
- __classPrivateFieldGet(this, _buildToastMultiMesssage).call(this, 'error', message, delay, title);
152
+ __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)].data.messages = [...__classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)].data.messages, ...message];
134
153
  }
135
154
  else {
136
- const content = message || this.translate("Error");
137
- this.toastr.error(content, title, {
138
- enableHtml: true,
139
- timeOut: delay || 3000,
140
- closeButton: true,
141
- });
155
+ __classPrivateFieldGet(this, _cache)[__classPrivateFieldGet(this, _errorKey)].data.messages.push(message);
142
156
  }
143
157
  },
144
158
  };
159
+ _notifyWarning.set(this, (args) => {
160
+ const { message, delay, title } = args;
161
+ if (Array.isArray(message)) {
162
+ __classPrivateFieldGet(this, _buildToastMultiMesssage).call(this, 'warning', message, delay, title);
163
+ }
164
+ else {
165
+ const content = message || this.translate('Warning');
166
+ this.toastr.warning(content, title, {
167
+ enableHtml: true,
168
+ timeOut: delay || 3000,
169
+ closeButton: true,
170
+ });
171
+ }
172
+ });
173
+ _notifyError.set(this, (args) => {
174
+ const { message, delay, title } = args;
175
+ if (Array.isArray(message)) {
176
+ __classPrivateFieldGet(this, _buildToastMultiMesssage).call(this, 'error', message, delay, title);
177
+ }
178
+ else {
179
+ const content = message || this.translate('Error');
180
+ this.toastr.error(content, title, {
181
+ enableHtml: true,
182
+ timeOut: delay || 3000,
183
+ closeButton: true,
184
+ });
185
+ }
186
+ });
145
187
  _buildToastMultiMesssage.set(this, (type, messages, delay, title) => {
146
188
  /** số lượng item hiển thị mặc định */
147
189
  const showNum = 2;
@@ -283,7 +325,7 @@ class SdNotifyService {
283
325
  };
284
326
  }
285
327
  }
286
- _delayDuration = new WeakMap(), _cache = new WeakMap(), _buildToastMultiMesssage = new WeakMap();
328
+ _delayDuration = new WeakMap(), _warningKey = new WeakMap(), _errorKey = new WeakMap(), _cache = new WeakMap(), _notifyWarning = new WeakMap(), _notifyError = new WeakMap(), _buildToastMultiMesssage = new WeakMap();
287
329
  SdNotifyService.decorators = [
288
330
  { type: Injectable }
289
331
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-notify.js","sources":["../../../../projects/sd-core/notify/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../../projects/sd-core/notify/src/lib/notify.service.ts","../../../../projects/sd-core/notify/src/lib/notify.module.ts","../../../../projects/sd-core/notify/src/public-api.ts","../../../../projects/sd-core/notify/sd-angular-core-notify.ts"],"sourcesContent":["import { Component, Inject } from \"@angular/core\";\r\nimport { MatDialogRef, MAT_DIALOG_DATA } from \"@angular/material/dialog\";\r\n\r\nexport interface DialogData {\r\n icon?: string;\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\r\n input?: {\r\n placeholder?: string;\r\n minlength?: number;\r\n maxlength?: number;\r\n required?: boolean;\r\n defaultValue?: string;\r\n };\r\n}\r\n\r\n@Component({\r\n selector: \"sd-dialog-confirm\",\r\n templateUrl: \"dialog-confirm.component.html\",\r\n styleUrls: [\"./dialog-confirm.component.css\"],\r\n})\r\nexport class DialogConfirmComponent {\r\n value: string;\r\n isString = false;\r\n constructor(\r\n public dialogRef: MatDialogRef<DialogConfirmComponent>,\r\n @Inject(MAT_DIALOG_DATA) public data: DialogData\r\n ) {\r\n this.isString = typeof this.data?.message === \"string\";\r\n this.value = data?.input?.defaultValue ?? '';\r\n }\r\n}\r\n","import \"@sd-angular/core/common\";\r\nimport { Injectable } from \"@angular/core\";\r\nimport { MatDialog } from \"@angular/material/dialog\";\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\nimport { ActiveToast, ToastrService } from \"ngx-toastr\";\r\nimport { SdTranslateService } from \"@sd-angular/core/translate\";\r\nimport { takeUntil } from \"rxjs/operators\";\r\nimport { Subject } from \"rxjs\";\r\nimport * as uuid from 'uuid';\r\n\r\nlet notifyId = 0;\r\n\r\n@Injectable()\r\nexport class SdNotifyService {\r\n #delayDuration = 500; // Các error/warning message sẽ tự động gộp sau khoảng thời gian trên\r\n #cache: {\r\n [key: string]: {\r\n createdDate: Date;\r\n subject: Subject<any>;\r\n response?: {\r\n status?: 'success' | 'error';\r\n result: any,\r\n }\r\n }\r\n } = {};\r\n constructor(\r\n private dialog: MatDialog,\r\n private toastr: ToastrService,\r\n private translateService: SdTranslateService\r\n ) {}\r\n\r\n alert = {\r\n info: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"info\",\r\n title: title || this.translate(\"Notice\"),\r\n message: message || \"Done!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n success: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"done\",\r\n title: title || this.translate(\"Success\"),\r\n message: message || \"Done!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n warning: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"warning\",\r\n title: title || this.translate(\"Warning\"),\r\n message: message || \"Something went wrong!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n error: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"error\",\r\n title: title || this.translate(\"Error\"),\r\n message: message || \"Something went wrong!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n };\r\n\r\n notify = {\r\n success: (message?: string, delay?: number, title?: string) => {\r\n // tslint:disable-next-line: max-line-length\r\n // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #4F8A10; background-color: #DFF2BF`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-check\"></i> ${message || this.translate('Success')}</div>`;\r\n // this.showNotify(html, delay);\r\n const content = message || this.translate(\"Success\");\r\n this.toastr.success(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n },\r\n warning: (message?: string | string[], delay?: number, title?: string) => {\r\n // tslint:disable-next-line: max-line-length\r\n // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #9F6000; background-color: #FEEFB3`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-exclamation-triangle\"></i> ${message || this.translate('Warning')}</div>`;\r\n // this.showNotify(html, delay);\r\n if (Array.isArray(message)){\r\n this.#buildToastMultiMesssage('warning', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate(\"Warning\");\r\n this.toastr.warning(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n },\r\n error: (message?: string | string[], delay?: number, title?: string) => {\r\n // tslint:disable-next-line: max-line-length\r\n // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #D8000C; background-color: #FFD2D2`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-times\"></i> ${message || this.translate('Error')}</div>`;\r\n // this.showNotify(html, delay);\r\n if (Array.isArray(message)){\r\n this.#buildToastMultiMesssage('error', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate(\"Error\");\r\n this.toastr.error(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n },\r\n };\r\n\r\n #buildToastMultiMesssage = (type: 'warning' | 'error', messages: string[], delay?: number, title?: string) => {\r\n /** số lượng item hiển thị mặc định */\r\n const showNum = 2;\r\n const id = `sd-notify-ckb-${uuid.v4()}`;\r\n const messageLength = messages.length;\r\n const messageRests = messages.splice(showNum);\r\n const messageContainer = `<ul class=\"sd-notify__list\">{0}{1}</ul>`;\r\n const messageTemp = `<li class=\"sd-notify__item\">- {0}</li>`;\r\n let contentRest = '';\r\n if (messageRests?.length) {\r\n contentRest = `<input id=\"${id}\" class=\"cdk-visually-hidden sd-notify__checkbox\" type=\"checkbox\" />\r\n <label class=\"sd-notify__text sd-notify__text--show text-secondary\" for=\"${id}\">${this.translate('Show more')}</label>\r\n <div class=\"sd-notify__item--rest\">\r\n ${messageRests.map(m => String.format(messageTemp, m)).join('')}\r\n </div>\r\n <label class=\"sd-notify__text sd-notify__text--less text-secondary\" for=\"${id}\">${this.translate('Show less')}</label>`;\r\n }\r\n const content = String.format(messageContainer, messages.map(m => String.format(messageTemp, m)).join(''), contentRest);\r\n let toast: ActiveToast<any>;\r\n // khi truyền message html sẽ bị sanitize nên phải truyền innerHTML khi toast hiện lên\r\n // @see https://github.com/scttcper/ngx-toastr/blob/v12.1.0/src/lib/toastr/toastr.service.ts#L271\r\n switch (type) {\r\n case 'error':\r\n toast = this.toastr.error(content, `${title || this.translate('Error')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n case 'warning':\r\n toast = this.toastr.warning(content, `${title || this.translate('Warning')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n }\r\n \r\n if (toast) {\r\n toast.onShown\r\n .pipe(\r\n takeUntil(toast.onHidden)\r\n )\r\n .subscribe(() => {\r\n const messageEle: HTMLDivElement = document.querySelector(`.toast-message-${id}`);\r\n messageEle.innerHTML = content;\r\n })\r\n }\r\n }\r\n\r\n handle = {\r\n error: (err: any) => {\r\n if (typeof err === \"string\") {\r\n this.notify.warning(err);\r\n } else if (typeof err === \"object\") {\r\n let message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n \"Unknown error\";\r\n if (typeof err.json === \"function\") {\r\n err = err.json();\r\n if (err) {\r\n message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n \"Unknown error\";\r\n }\r\n }\r\n this.notify.warning(message);\r\n } else {\r\n this.notify.warning(\"Unknown error\");\r\n }\r\n },\r\n };\r\n\r\n confirm = (\r\n message: string,\r\n option: {\r\n title?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\r\n } = {}\r\n ) => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n title: option?.title || this.translate(\"Confirm\"),\r\n message,\r\n yesTitle: option?.yesTitle || this.translate(\"Yes\"),\r\n noTitle: option?.noTitle || this.translate(\"No\"),\r\n noButtonColor: option?.noButtonColor || \"secondary\",\r\n yesButtonColor: option?.yesButtonColor || \"primary\",\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === \"ACCEPT\") {\r\n resolve(null);\r\n } else if (result === \"CANCEL\") {\r\n reject(result);\r\n } else {\r\n resolve(null);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n confirmDelete = () => this.confirm(this.translate(\"Delete record(s)\"));\r\n\r\n confirmApprove = () => this.confirm(this.translate(\"Approve record(s)\"));\r\n\r\n confirmWithInput = (\r\n title: string,\r\n option: {\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n required?: boolean;\r\n maxlength?: number;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\r\n defaultValue?: string;\r\n } = {}\r\n ): Promise<string> => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n title: title || this.translate(\"Confirm\"),\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || this.translate(\"Yes\"),\r\n noTitle: option?.noTitle || this.translate(\"No\"),\r\n noButtonColor: option?.noButtonColor || \"secondary\",\r\n yesButtonColor: option?.yesButtonColor || \"primary\",\r\n input: {\r\n maxlength: option?.maxlength || 255,\r\n required: option?.required,\r\n defaultValue: option?.defaultValue || ''\r\n },\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === \"ACCEPT\") {\r\n resolve(result);\r\n } else if (result === \"CANCEL\") {\r\n reject(result);\r\n } else {\r\n resolve(result);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n private translate = (value: string): string => {\r\n return this.translateService.translate(value);\r\n };\r\n}\r\n","import { NgModule } from \"@angular/core\";\r\nimport { CommonModule } from \"@angular/common\";\r\nimport { MatDialogModule } from \"@angular/material/dialog\";\r\nimport { MatIconModule } from \"@angular/material/icon\";\r\nimport { MatButtonModule } from \"@angular/material/button\";\r\nimport { MatFormFieldModule } from \"@angular/material/form-field\";\r\nimport { MatInputModule } from \"@angular/material/input\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { ToastrService, ToastrModule } from \"ngx-toastr\";\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\nimport { SdNotifyService } from \"./notify.service\";\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatDialogModule,\r\n ToastrModule.forRoot(),\r\n\r\n SdButtonModule,\r\n ],\r\n declarations: [DialogConfirmComponent],\r\n entryComponents: [DialogConfirmComponent],\r\n exports: [],\r\n providers: [SdNotifyService],\r\n})\r\nexport class SdNotifyModule {}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport { SdNotifyModule } from './lib/notify.module';\r\nexport * from './lib/notify.service';\r\nexport * from './lib/components/dialog-confirm/dialog-confirm.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;MAyBa,sBAAsB;IAGjC,YACS,SAA+C,EACtB,IAAgB;;QADzC,cAAS,GAAT,SAAS,CAAsC;QACtB,SAAI,GAAJ,IAAI,CAAY;QAHlD,aAAQ,GAAG,KAAK,CAAC;QAKf,IAAI,CAAC,QAAQ,GAAG,cAAO,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAA,KAAK,QAAQ,CAAC;QACvD,IAAI,CAAC,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,YAAY,mCAAI,EAAE,CAAC;KAC9C;;;YAdF,SAAS,SAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,m+CAA4C;;aAE7C;;;YAvBQ,YAAY;4CA6BhB,MAAM,SAAC,eAAe;;;;ACpB3B,IAAI,QAAQ,GAAG,CAAC,CAAC;MAGJ,eAAe;IAY1B,YACU,MAAiB,EACjB,MAAqB,EACrB,gBAAoC;QAFpC,WAAM,GAAN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,IAAI,MAAM,KAAK,QAAQ,EAAE;4BAC9B,MAAM,CAAC,MAAM,CAAC,CAAC;yBAChB;6BAAM;4BACL,OAAO,CAAC,MAAM,CAAC,CAAC;yBACjB;qBACF;iBACF,CAAC,CAAC;aACJ,CAAC,CAAC;SACJ,CAAC;QAEM,cAAS,GAAG,CAAC,KAAa;YAChC,OAAO,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SAC/C,CAAC;KAlSE;;;;YAjBL,UAAU;;;YAVF,SAAS;YAEI,aAAa;YAC1B,kBAAkB;;;MC2Bd,cAAc;;;YAlB1B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,eAAe;oBACf,eAAe;oBACf,YAAY,CAAC,OAAO,EAAE;oBAEtB,cAAc;iBACf;gBACD,YAAY,EAAE,CAAC,sBAAsB,CAAC;gBACtC,eAAe,EAAE,CAAC,sBAAsB,CAAC;gBACzC,OAAO,EAAE,EAAE;gBACX,SAAS,EAAE,CAAC,eAAe,CAAC;aAC7B;;;AC/BD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-notify.js","sources":["../../../../projects/sd-core/notify/src/lib/components/dialog-confirm/dialog-confirm.component.ts","../../../../projects/sd-core/notify/src/lib/notify.service.ts","../../../../projects/sd-core/notify/src/lib/notify.module.ts","../../../../projects/sd-core/notify/src/public-api.ts","../../../../projects/sd-core/notify/sd-angular-core-notify.ts"],"sourcesContent":["import { Component, Inject } from \"@angular/core\";\r\nimport { MatDialogRef, MAT_DIALOG_DATA } from \"@angular/material/dialog\";\r\n\r\nexport interface DialogData {\r\n icon?: string;\r\n title?: string;\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\r\n input?: {\r\n placeholder?: string;\r\n minlength?: number;\r\n maxlength?: number;\r\n required?: boolean;\r\n defaultValue?: string;\r\n };\r\n}\r\n\r\n@Component({\r\n selector: \"sd-dialog-confirm\",\r\n templateUrl: \"dialog-confirm.component.html\",\r\n styleUrls: [\"./dialog-confirm.component.css\"],\r\n})\r\nexport class DialogConfirmComponent {\r\n value: string;\r\n isString = false;\r\n constructor(\r\n public dialogRef: MatDialogRef<DialogConfirmComponent>,\r\n @Inject(MAT_DIALOG_DATA) public data: DialogData\r\n ) {\r\n this.isString = typeof this.data?.message === \"string\";\r\n this.value = data?.input?.defaultValue ?? '';\r\n }\r\n}\r\n","import \"@sd-angular/core/common\";\r\nimport { Injectable } from \"@angular/core\";\r\nimport { MatDialog } from \"@angular/material/dialog\";\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\nimport { ActiveToast, ToastrService } from \"ngx-toastr\";\r\nimport { SdTranslateService } from \"@sd-angular/core/translate\";\r\nimport { debounceTime, take, takeUntil } from \"rxjs/operators\";\r\nimport { Subject, timer } from \"rxjs\";\r\nimport * as uuid from 'uuid';\r\n\r\n@Injectable()\r\nexport class SdNotifyService {\r\n #delayDuration = 500; // Các error/warning message sẽ tự động gộp sau khoảng thời gian trên\r\n #warningKey = uuid.v4();\r\n #errorKey = uuid.v4();\r\n #cache: {\r\n [key: string]: {\r\n createdDate: Date;\r\n data?: {\r\n title: string,\r\n messages: string[]\r\n }\r\n }\r\n } = {};\r\n constructor(\r\n private dialog: MatDialog,\r\n private toastr: ToastrService,\r\n private translateService: SdTranslateService\r\n ) { }\r\n\r\n alert = {\r\n info: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"info\",\r\n title: title || this.translate(\"Notice\"),\r\n message: message || \"Done!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n success: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"done\",\r\n title: title || this.translate(\"Success\"),\r\n message: message || \"Done!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n warning: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"warning\",\r\n title: title || this.translate(\"Warning\"),\r\n message: message || \"Something went wrong!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n error: (\r\n message?: string,\r\n title?: string,\r\n yesTitle?: string,\r\n icon?: string\r\n ) => {\r\n this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n icon: icon || \"error\",\r\n title: title || this.translate(\"Error\"),\r\n message: message || \"Something went wrong!\",\r\n yesTitle: yesTitle || this.translate(\"Ok\"),\r\n },\r\n });\r\n },\r\n };\r\n\r\n notify = {\r\n success: (message?: string, delay?: number, title?: string) => {\r\n // tslint:disable-next-line: max-line-length\r\n // const style = `border-radius: 5px; margin: 0; padding: 12px; z-index: 99999; top: 5px; right: 5px; display: none; position: fixed;color: #4F8A10; background-color: #DFF2BF`;\r\n // tslint:disable-next-line: max-line-length\r\n // const html = `<div id=\"${this.notifyId}\" style=\"${style}\"><i class=\"fa fa-check\"></i> ${message || this.translate('Success')}</div>`;\r\n // this.showNotify(html, delay);\r\n const content = message || this.translate(\"Success\");\r\n this.toastr.success(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n },\r\n warning: (message?: string | string[], delay?: number, title?: string) => {\r\n if (!this.#cache[this.#warningKey] || Date.addMiliseconds(this.#cache[this.#warningKey].createdDate, this.#delayDuration) < new Date()) {\r\n this.#cache[this.#warningKey] = {\r\n createdDate: new Date(),\r\n data: {\r\n title: title,\r\n messages: [],\r\n }\r\n };\r\n timer(this.#delayDuration).pipe(take(1)).subscribe(() => {\r\n this.#notifyWarning({\r\n title: this.#cache[this.#warningKey].data.title,\r\n message: this.#cache[this.#warningKey].data.messages,\r\n delay: delay\r\n })\r\n });\r\n }\r\n if (Array.isArray(message)) {\r\n this.#cache[this.#warningKey].data.messages = [...this.#cache[this.#warningKey].data.messages, ...message];\r\n } else {\r\n this.#cache[this.#warningKey].data.messages.push(message);\r\n }\r\n },\r\n error: (message?: string | string[], delay?: number, title?: string) => {\r\n if (!this.#cache[this.#errorKey] || Date.addMiliseconds(this.#cache[this.#errorKey].createdDate, this.#delayDuration) < new Date()) {\r\n this.#cache[this.#errorKey] = {\r\n createdDate: new Date(),\r\n data: {\r\n title: title,\r\n messages: [],\r\n }\r\n };\r\n timer(this.#delayDuration).pipe(take(1)).subscribe(() => {\r\n this.#notifyError({\r\n title: this.#cache[this.#errorKey].data.title,\r\n message: this.#cache[this.#errorKey].data.messages,\r\n delay: delay\r\n })\r\n });\r\n }\r\n if (Array.isArray(message)) {\r\n this.#cache[this.#errorKey].data.messages = [...this.#cache[this.#errorKey].data.messages, ...message];\r\n } else {\r\n this.#cache[this.#errorKey].data.messages.push(message);\r\n }\r\n },\r\n };\r\n\r\n #notifyWarning = (args: {\r\n message?: string | string[],\r\n delay?: number,\r\n title?: string\r\n }) => {\r\n const { message, delay, title } = args;\r\n if (Array.isArray(message)) {\r\n this.#buildToastMultiMesssage('warning', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate('Warning');\r\n this.toastr.warning(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n }\r\n\r\n #notifyError = (args: {\r\n message?: string | string[],\r\n delay?: number,\r\n title?: string\r\n }) => {\r\n const { message, delay, title } = args;\r\n if (Array.isArray(message)) {\r\n this.#buildToastMultiMesssage('error', message, delay, title);\r\n }\r\n else {\r\n const content = message || this.translate('Error');\r\n this.toastr.error(content, title, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n closeButton: true,\r\n });\r\n }\r\n }\r\n\r\n #buildToastMultiMesssage = (type: 'warning' | 'error', messages: string[], delay?: number, title?: string) => {\r\n /** số lượng item hiển thị mặc định */\r\n const showNum = 2;\r\n const id = `sd-notify-ckb-${uuid.v4()}`;\r\n const messageLength = messages.length;\r\n const messageRests = messages.splice(showNum);\r\n const messageContainer = `<ul class=\"sd-notify__list\">{0}{1}</ul>`;\r\n const messageTemp = `<li class=\"sd-notify__item\">- {0}</li>`;\r\n let contentRest = '';\r\n if (messageRests?.length) {\r\n contentRest = `<input id=\"${id}\" class=\"cdk-visually-hidden sd-notify__checkbox\" type=\"checkbox\" />\r\n <label class=\"sd-notify__text sd-notify__text--show text-secondary\" for=\"${id}\">${this.translate('Show more')}</label>\r\n <div class=\"sd-notify__item--rest\">\r\n ${messageRests.map(m => String.format(messageTemp, m)).join('')}\r\n </div>\r\n <label class=\"sd-notify__text sd-notify__text--less text-secondary\" for=\"${id}\">${this.translate('Show less')}</label>`;\r\n }\r\n const content = String.format(messageContainer, messages.map(m => String.format(messageTemp, m)).join(''), contentRest);\r\n let toast: ActiveToast<any>;\r\n // khi truyền message html sẽ bị sanitize nên phải truyền innerHTML khi toast hiện lên\r\n // @see https://github.com/scttcper/ngx-toastr/blob/v12.1.0/src/lib/toastr/toastr.service.ts#L271\r\n switch (type) {\r\n case 'error':\r\n toast = this.toastr.error(content, `${title || this.translate('Error')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n case 'warning':\r\n toast = this.toastr.warning(content, `${title || this.translate('Warning')} (${messageLength})`, {\r\n enableHtml: true,\r\n timeOut: delay || 3000,\r\n messageClass: `toast-message toast-message-${id}`,\r\n closeButton: true,\r\n tapToDismiss: false\r\n });\r\n break;\r\n }\r\n\r\n if (toast) {\r\n toast.onShown\r\n .pipe(\r\n takeUntil(toast.onHidden)\r\n )\r\n .subscribe(() => {\r\n const messageEle: HTMLDivElement = document.querySelector(`.toast-message-${id}`);\r\n messageEle.innerHTML = content;\r\n })\r\n }\r\n }\r\n\r\n handle = {\r\n error: (err: any) => {\r\n if (typeof err === \"string\") {\r\n this.notify.warning(err);\r\n } else if (typeof err === \"object\") {\r\n let message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n \"Unknown error\";\r\n if (typeof err.json === \"function\") {\r\n err = err.json();\r\n if (err) {\r\n message =\r\n err?.error ||\r\n err?.message ||\r\n err?.ExceptionMessage ||\r\n err?.Message ||\r\n \"Unknown error\";\r\n }\r\n }\r\n this.notify.warning(message);\r\n } else {\r\n this.notify.warning(\"Unknown error\");\r\n }\r\n },\r\n };\r\n\r\n confirm = (\r\n message: string,\r\n option: {\r\n title?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\r\n } = {}\r\n ) => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n title: option?.title || this.translate(\"Confirm\"),\r\n message,\r\n yesTitle: option?.yesTitle || this.translate(\"Yes\"),\r\n noTitle: option?.noTitle || this.translate(\"No\"),\r\n noButtonColor: option?.noButtonColor || \"secondary\",\r\n yesButtonColor: option?.yesButtonColor || \"primary\",\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === \"ACCEPT\") {\r\n resolve(null);\r\n } else if (result === \"CANCEL\") {\r\n reject(result);\r\n } else {\r\n resolve(null);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n confirmDelete = () => this.confirm(this.translate(\"Delete record(s)\"));\r\n\r\n confirmApprove = () => this.confirm(this.translate(\"Approve record(s)\"));\r\n\r\n confirmWithInput = (\r\n title: string,\r\n option: {\r\n message?: string;\r\n yesTitle?: string;\r\n noTitle?: string;\r\n required?: boolean;\r\n maxlength?: number;\r\n yesButtonColor?: string;\r\n noButtonColor?: string;\r\n defaultValue?: string;\r\n } = {}\r\n ): Promise<string> => {\r\n const dialogRef = this.dialog.open(DialogConfirmComponent, {\r\n width: \"400px\",\r\n data: {\r\n title: title || this.translate(\"Confirm\"),\r\n message: option?.message,\r\n yesTitle: option?.yesTitle || this.translate(\"Yes\"),\r\n noTitle: option?.noTitle || this.translate(\"No\"),\r\n noButtonColor: option?.noButtonColor || \"secondary\",\r\n yesButtonColor: option?.yesButtonColor || \"primary\",\r\n input: {\r\n maxlength: option?.maxlength || 255,\r\n required: option?.required,\r\n defaultValue: option?.defaultValue || ''\r\n },\r\n },\r\n });\r\n return new Promise((resolve, reject) => {\r\n dialogRef.afterClosed().subscribe((result) => {\r\n if (result) {\r\n if (result === \"ACCEPT\") {\r\n resolve(result);\r\n } else if (result === \"CANCEL\") {\r\n reject(result);\r\n } else {\r\n resolve(result);\r\n }\r\n }\r\n });\r\n });\r\n };\r\n\r\n private translate = (value: string): string => {\r\n return this.translateService.translate(value);\r\n };\r\n}\r\n","import { NgModule } from \"@angular/core\";\r\nimport { CommonModule } from \"@angular/common\";\r\nimport { MatDialogModule } from \"@angular/material/dialog\";\r\nimport { MatIconModule } from \"@angular/material/icon\";\r\nimport { MatButtonModule } from \"@angular/material/button\";\r\nimport { MatFormFieldModule } from \"@angular/material/form-field\";\r\nimport { MatInputModule } from \"@angular/material/input\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { ToastrService, ToastrModule } from \"ngx-toastr\";\r\nimport { SdButtonModule } from \"@sd-angular/core/button\";\r\n\r\nimport { SdNotifyService } from \"./notify.service\";\r\nimport { DialogConfirmComponent } from \"./components/dialog-confirm/dialog-confirm.component\";\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatDialogModule,\r\n ToastrModule.forRoot(),\r\n\r\n SdButtonModule,\r\n ],\r\n declarations: [DialogConfirmComponent],\r\n entryComponents: [DialogConfirmComponent],\r\n exports: [],\r\n providers: [SdNotifyService],\r\n})\r\nexport class SdNotifyModule {}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport { SdNotifyModule } from './lib/notify.module';\r\nexport * from './lib/notify.service';\r\nexport * from './lib/components/dialog-confirm/dialog-confirm.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;MAyBa,sBAAsB;IAGjC,YACS,SAA+C,EACtB,IAAgB;;QADzC,cAAS,GAAT,SAAS,CAAsC;QACtB,SAAI,GAAJ,IAAI,CAAY;QAHlD,aAAQ,GAAG,KAAK,CAAC;QAKf,IAAI,CAAC,QAAQ,GAAG,cAAO,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAA,KAAK,QAAQ,CAAC;QACvD,IAAI,CAAC,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,YAAY,mCAAI,EAAE,CAAC;KAC9C;;;YAdF,SAAS,SAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,m+CAA4C;;aAE7C;;;YAvBQ,YAAY;4CA6BhB,MAAM,SAAC,eAAe;;;;MCnBd,eAAe;IAa1B,YACU,MAAiB,EACjB,MAAqB,EACrB,gBAAoC;QAFpC,WAAM,GAAN,MAAM,CAAW;QACjB,WAAM,GAAN,MAAM,CAAe;QACrB,qBAAgB,GAAhB,gBAAgB,CAAoB;QAf9C,yBAAiB,GAAG,EAAC;QACrB,sBAAcA,EAAO,EAAE,EAAC;QACxB,oBAAYA,EAAO,EAAE,EAAC;QACtB,iBAQI,EAAE,EAAC;QAOP,UAAK,GAAG;YACN,IAAI,EAAE,CACJ,OAAgB,EAChB,KAAc,EACd,QAAiB,EACjB,IAAa;gBAEb,IAAI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AAQ,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ;wBAC1B,YAAY,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,KAAI,EAAE;qBACzC;iBACF;aACF,CAAC,CAAC;YACH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM;gBACjC,SAAS,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,MAAM;oBACvC,IAAI,MAAM,EAAE;wBACV,IAAI,MAAM,KAAK,QAAQ,EAAE;4BACvB,OAAO,CAAC,MAAM,CAAC,CAAC;yBACjB;6BAAM,IAAI,MAAM,KAAK,QAAQ,EAAE;4BAC9B,MAAM,CAAC,MAAM,CAAC,CAAC;yBAChB;6BAAM;4BACL,OAAO,CAAC,MAAM,CAAC,CAAC;yBACjB;qBACF;iBACF,CAAC,CAAC;aACJ,CAAC,CAAC;SACJ,CAAC;QAEM,cAAS,GAAG,CAAC,KAAa;YAChC,OAAO,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SAC/C,CAAC;KAlVG;;;;YAlBN,UAAU;;;YARF,SAAS;YAEI,aAAa;YAC1B,kBAAkB;;;MC2Bd,cAAc;;;YAlB1B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,eAAe;oBACf,eAAe;oBACf,YAAY,CAAC,OAAO,EAAE;oBAEtB,cAAc;iBACf;gBACD,YAAY,EAAE,CAAC,sBAAsB,CAAC;gBACtC,eAAe,EAAE,CAAC,sBAAsB,CAAC;gBACzC,OAAO,EAAE,EAAE;gBACX,SAAS,EAAE,CAAC,eAAe,CAAC;aAC7B;;;AC/BD;;;;ACAA;;;;;;"}
@@ -226,6 +226,9 @@ class SdUtilityService {
226
226
  link.click();
227
227
  document.body.removeChild(link);
228
228
  };
229
+ this.copyToClipboard = (text) => {
230
+ navigator.clipboard.writeText(text);
231
+ };
229
232
  }
230
233
  }
231
234
  _uploadId = new WeakMap(), _translate = new WeakMap();