@sd-angular/core 1.1.9 → 1.1.12

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 (87) hide show
  1. package/api/src/lib/api.model.d.ts +3 -1
  2. package/api/src/lib/token.service.d.ts +3 -1
  3. package/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
  4. package/autocomplete/src/lib/autocomplete.component.d.ts +5 -2
  5. package/bundles/sd-angular-core-api.umd.js +37 -19
  6. package/bundles/sd-angular-core-api.umd.js.map +1 -1
  7. package/bundles/sd-angular-core-api.umd.min.js +1 -1
  8. package/bundles/sd-angular-core-api.umd.min.js.map +1 -1
  9. package/bundles/sd-angular-core-autocomplete.umd.js +8 -4
  10. package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
  11. package/bundles/sd-angular-core-autocomplete.umd.min.js +1 -1
  12. package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
  13. package/bundles/sd-angular-core-common.umd.js +4 -1
  14. package/bundles/sd-angular-core-common.umd.js.map +1 -1
  15. package/bundles/sd-angular-core-common.umd.min.js +1 -1
  16. package/bundles/sd-angular-core-common.umd.min.js.map +1 -1
  17. package/bundles/sd-angular-core-date-time.umd.js +9 -5
  18. package/bundles/sd-angular-core-date-time.umd.js.map +1 -1
  19. package/bundles/sd-angular-core-date-time.umd.min.js +2 -2
  20. package/bundles/sd-angular-core-date-time.umd.min.js.map +1 -1
  21. package/bundles/sd-angular-core-grid-material.umd.js +2 -2
  22. package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
  23. package/bundles/sd-angular-core-grid-material.umd.min.js +1 -1
  24. package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
  25. package/bundles/sd-angular-core-input-currency.umd.js +8 -4
  26. package/bundles/sd-angular-core-input-currency.umd.js.map +1 -1
  27. package/bundles/sd-angular-core-input-currency.umd.min.js +2 -2
  28. package/bundles/sd-angular-core-input-currency.umd.min.js.map +1 -1
  29. package/bundles/sd-angular-core-input.umd.js +7 -2
  30. package/bundles/sd-angular-core-input.umd.js.map +1 -1
  31. package/bundles/sd-angular-core-input.umd.min.js +1 -1
  32. package/bundles/sd-angular-core-input.umd.min.js.map +1 -1
  33. package/bundles/sd-angular-core-json-editor.umd.js +9 -5
  34. package/bundles/sd-angular-core-json-editor.umd.js.map +1 -1
  35. package/bundles/sd-angular-core-json-editor.umd.min.js +2 -2
  36. package/bundles/sd-angular-core-json-editor.umd.min.js.map +1 -1
  37. package/bundles/sd-angular-core-select.umd.js +8 -3
  38. package/bundles/sd-angular-core-select.umd.js.map +1 -1
  39. package/bundles/sd-angular-core-select.umd.min.js +2 -2
  40. package/bundles/sd-angular-core-select.umd.min.js.map +1 -1
  41. package/common/sd-angular-core-common.metadata.json +1 -1
  42. package/common/src/lib/configurations/form.configuration.d.ts +6 -0
  43. package/common/src/public-api.d.ts +1 -0
  44. package/date-time/sd-angular-core-date-time.metadata.json +1 -1
  45. package/date-time/src/lib/date-time.component.d.ts +5 -2
  46. package/esm2015/api/src/lib/api.model.js +1 -1
  47. package/esm2015/api/src/lib/api.service.js +19 -7
  48. package/esm2015/api/src/lib/http.service.js +16 -6
  49. package/esm2015/api/src/lib/token.service.js +5 -5
  50. package/esm2015/autocomplete/src/lib/autocomplete.component.js +11 -7
  51. package/esm2015/common/src/lib/configurations/firebase.configuration.js +2 -2
  52. package/esm2015/common/src/lib/configurations/form.configuration.js +3 -0
  53. package/esm2015/common/src/public-api.js +2 -1
  54. package/esm2015/date-time/src/lib/date-time.component.js +12 -8
  55. package/esm2015/grid-material/src/lib/grid-material.component.js +3 -3
  56. package/esm2015/input/src/lib/input.component.js +10 -4
  57. package/esm2015/input-currency/src/lib/input-currency.component.js +11 -7
  58. package/esm2015/json-editor/src/lib/json-editor.component.js +10 -6
  59. package/esm2015/select/src/lib/select.component.js +11 -6
  60. package/fesm2015/sd-angular-core-api.js +37 -15
  61. package/fesm2015/sd-angular-core-api.js.map +1 -1
  62. package/fesm2015/sd-angular-core-autocomplete.js +10 -6
  63. package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
  64. package/fesm2015/sd-angular-core-common.js +4 -2
  65. package/fesm2015/sd-angular-core-common.js.map +1 -1
  66. package/fesm2015/sd-angular-core-date-time.js +11 -7
  67. package/fesm2015/sd-angular-core-date-time.js.map +1 -1
  68. package/fesm2015/sd-angular-core-grid-material.js +2 -2
  69. package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
  70. package/fesm2015/sd-angular-core-input-currency.js +10 -6
  71. package/fesm2015/sd-angular-core-input-currency.js.map +1 -1
  72. package/fesm2015/sd-angular-core-input.js +9 -4
  73. package/fesm2015/sd-angular-core-input.js.map +1 -1
  74. package/fesm2015/sd-angular-core-json-editor.js +9 -5
  75. package/fesm2015/sd-angular-core-json-editor.js.map +1 -1
  76. package/fesm2015/sd-angular-core-select.js +10 -5
  77. package/fesm2015/sd-angular-core-select.js.map +1 -1
  78. package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
  79. package/input/sd-angular-core-input.metadata.json +1 -1
  80. package/input/src/lib/input.component.d.ts +6 -2
  81. package/input-currency/sd-angular-core-input-currency.metadata.json +1 -1
  82. package/input-currency/src/lib/input-currency.component.d.ts +5 -2
  83. package/json-editor/sd-angular-core-json-editor.metadata.json +1 -1
  84. package/package.json +1 -1
  85. package/{sd-angular-core-1.1.9.tgz → sd-angular-core-1.1.12.tgz} +0 -0
  86. package/select/sd-angular-core-select.metadata.json +1 -1
  87. package/select/src/lib/select.component.d.ts +5 -2
@@ -1,4 +1,4 @@
1
- import { EventEmitter, Component, ChangeDetectorRef, Input, Output, ContentChild, ViewChild, Pipe, NgModule } from '@angular/core';
1
+ import { EventEmitter, Component, ChangeDetectorRef, Inject, Optional, Input, Output, ContentChild, ViewChild, 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,15 +8,16 @@ import { v4 } from 'uuid';
8
8
  import { debounceTime } from 'rxjs/operators';
9
9
  import { Subscription } from 'rxjs';
10
10
  import { CurrencyMaskInputMode, NgxCurrencyModule } from 'ngx-currency';
11
- import { SdFormControl, SdSuffixDirective, SdCommonModule } from '@sd-angular/core/common';
11
+ import { SdFormControl, FORM_CONFIG, SdSuffixDirective, SdCommonModule } from '@sd-angular/core/common';
12
12
  import { MatInputModule } from '@angular/material/input';
13
13
  import { MatFormFieldModule } from '@angular/material/form-field';
14
14
  import { SdTranslateModule } from '@sd-angular/core/translate';
15
15
 
16
16
  var _name, _form, _model, _align, _allowNegative, _decimal, _precision, _prefix, _suffix, _thousands, _nullable, _min, _max, _pattern, _validator, _subscription, _generateOption, _updateValidator, _onChange, _customValidator;
17
17
  class SdInputCurrency {
18
- constructor(ref) {
18
+ constructor(ref, formConfig) {
19
19
  this.ref = ref;
20
+ this.formConfig = formConfig;
20
21
  _name.set(this, v4());
21
22
  this.disableErrorMessage = false;
22
23
  _form.set(this, void 0);
@@ -209,8 +210,9 @@ class SdInputCurrency {
209
210
  }
210
211
  }
211
212
  ngOnInit() {
213
+ var _a;
214
+ this.appearance = this.appearance || ((_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.appearance);
212
215
  __classPrivateFieldGet(this, _subscription).add(this.formControl.sdChanges.subscribe(() => {
213
- // this.formControl.updateValueAndValidity();
214
216
  this.ref.markForCheck();
215
217
  }));
216
218
  __classPrivateFieldGet(this, _generateOption).call(this);
@@ -231,15 +233,17 @@ _name = new WeakMap(), _form = new WeakMap(), _model = new WeakMap(), _align = n
231
233
  SdInputCurrency.decorators = [
232
234
  { type: Component, args: [{
233
235
  selector: 'sd-input-currency',
234
- 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>",
236
+ template: "<label *ngIf=\"!appearance && label\" class=\"d-block pb-0 T14M\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n<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]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && 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>",
235
237
  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}"]
236
238
  },] }
237
239
  ];
238
240
  SdInputCurrency.ctorParameters = () => [
239
- { type: ChangeDetectorRef }
241
+ { type: ChangeDetectorRef },
242
+ { type: undefined, decorators: [{ type: Inject, args: [FORM_CONFIG,] }, { type: Optional }] }
240
243
  ];
241
244
  SdInputCurrency.propDecorators = {
242
245
  name: [{ type: Input }],
246
+ appearance: [{ type: Input }],
243
247
  _disableErrorMessage: [{ type: Input, args: ['disableErrorMessage',] }],
244
248
  size: [{ type: Input }],
245
249
  form: [{ type: Input }],
@@ -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' = '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.sdChanges.subscribe(() => {\r\n // this.formControl.updateValueAndValidity();\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,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,Y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ACJ,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
+ {"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 Inject,\r\n Optional\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 { FORM_CONFIG, IFormConfiguration, SdFormControl } from '@sd-angular/core/common';\r\nimport { SdSuffixDirective } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\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 @Input() appearance: MatFormFieldAppearance;\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(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.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":";;;;;;;;;;;;;;;;MA6Ba,eAAe;IAuI1B,YACU,GA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AAC;KAClC;;;;YAlLF,SAAS,SAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,0nDAA8C;;aAE/C;;;YAtBC,iBAAiB;4CAgKd,MAAM,SAAC,WAAW,cAAG,QAAQ;;;mBAvI/B,KAAK;yBAKL,KAAK;mCAEL,KAAK,SAAC,qBAAqB;mBAI3B,KAAK;mBAEL,KAAK;oBASL,KAAK;0BACL,KAAK;oBAGL,KAAK;0BAQL,MAAM;oBAGN,KAAK;4BAML,KAAK;sBAML,KAAK;wBAML,KAAK;qBAML,KAAK;qBAML,KAAK;wBAML,KAAK;uBAML,KAAK;kBAML,KAAK;kBAML,KAAK;uBAOL,KAAK;sBAML,KAAK;wBAKL,KAAK;uBAML,KAAK;uBAQL,YAAY,SAAC,iBAAiB;sBAC9B,KAAK;uBACL,MAAM;sBACN,MAAM;yBACN,MAAM;sBAEN,SAAS,SAAC,SAAS;;;MC5JT,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, ElementRef, Pipe, NgModule } from '@angular/core';
1
+ import { Directive, TemplateRef, EventEmitter, Component, ChangeDetectionStrategy, ChangeDetectorRef, Inject, Optional, 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';
@@ -7,7 +7,7 @@ import { Validators, NgForm, FormsModule, ReactiveFormsModule } from '@angular/f
7
7
  import { v4 } from 'uuid';
8
8
  import { debounceTime } from 'rxjs/operators';
9
9
  import { Subscription } from 'rxjs';
10
- import { SdFormControl, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
10
+ import { SdFormControl, FORM_CONFIG, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
11
11
  import { SdUtilityService } from '@sd-angular/core/utility';
12
12
  import { MatInputModule } from '@angular/material/input';
13
13
  import { MatFormFieldModule } from '@angular/material/form-field';
@@ -30,8 +30,9 @@ SdInputSuffixDirective.ctorParameters = () => [
30
30
 
31
31
  var _name, _form, _blurOnEnter_1, _model, _pattern, _validator, _subscription, _updateValidator, _onChange, _customValidator;
32
32
  class SdInput {
33
- constructor(ref, utilityService) {
33
+ constructor(ref, formConfig, utilityService) {
34
34
  this.ref = ref;
35
+ this.formConfig = formConfig;
35
36
  this.utilityService = utilityService;
36
37
  this.id = `I${v4()}`;
37
38
  _name.set(this, v4());
@@ -236,6 +237,8 @@ class SdInput {
236
237
  this.copyable = (val === '') || val;
237
238
  }
238
239
  ngOnInit() {
240
+ var _a;
241
+ this.appearance = this.appearance || ((_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.appearance);
239
242
  __classPrivateFieldGet(this, _subscription).add(this.formControl.sdChanges.subscribe(() => {
240
243
  this.ref.markForCheck();
241
244
  }));
@@ -265,17 +268,19 @@ _name = new WeakMap(), _form = new WeakMap(), _blurOnEnter_1 = new WeakMap(), _m
265
268
  SdInput.decorators = [
266
269
  { type: Component, args: [{
267
270
  selector: 'sd-input',
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\" [step]=\"1\">\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=\"!disableErrorMessage && formControl.touched && formControl.errors?.required\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"!disableErrorMessage && formControl.touched && formControl.errors?.maxlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </mat-error>\r\n <mat-error *ngIf=\"!disableErrorMessage && formControl.touched && formControl.errors?.pattern\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"!disableErrorMessage && formControl.touched && formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\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>",
271
+ template: "<label *ngIf=\"!appearance && label\" class=\"d-block pb-0 T14M\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n<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]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && 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\" [step]=\"1\">\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=\"!disableErrorMessage && formControl.touched && formControl.errors?.required\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"!disableErrorMessage && formControl.touched && formControl.errors?.maxlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </mat-error>\r\n <mat-error *ngIf=\"!disableErrorMessage && formControl.touched && formControl.errors?.pattern\">\r\n {{'Pattern error' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"!disableErrorMessage && formControl.touched && formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\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>",
269
272
  changeDetection: ChangeDetectionStrategy.OnPush,
270
273
  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}"]
271
274
  },] }
272
275
  ];
273
276
  SdInput.ctorParameters = () => [
274
277
  { type: ChangeDetectorRef },
278
+ { type: undefined, decorators: [{ type: Inject, args: [FORM_CONFIG,] }, { type: Optional }] },
275
279
  { type: SdUtilityService }
276
280
  ];
277
281
  SdInput.propDecorators = {
278
282
  name: [{ type: Input }],
283
+ appearance: [{ type: Input }],
279
284
  size: [{ type: Input }],
280
285
  form: [{ type: Input }],
281
286
  label: [{ type: Input }],
@@ -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\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' | 'datetime-local' | 'month' = '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.sdChanges.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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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;;;;;;"}
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 Inject,\r\n Optional\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\nimport { FORM_CONFIG } from '@sd-angular/core/common';\r\nimport { IFormConfiguration } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\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() appearance: MatFormFieldAppearance;\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' | 'datetime-local' | 'month' = '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 private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.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/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AO,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;;;;;;"}
@@ -14,7 +14,7 @@ import { debounceTime } from 'rxjs/operators';
14
14
  import { Subscription } from 'rxjs';
15
15
  import JSONEditor from 'jsoneditor';
16
16
 
17
- var _name, _form, _model, _subscription, _onChange;
17
+ var _name, _form, _model, _subscription, _onChange, _updateJson;
18
18
  class SdJsonEditor {
19
19
  constructor(ref) {
20
20
  this.ref = ref;
@@ -35,6 +35,10 @@ class SdJsonEditor {
35
35
  this.modelChange.emit(value);
36
36
  this.sdChange.emit(value);
37
37
  });
38
+ _updateJson.set(this, () => {
39
+ var _a, _b;
40
+ (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.set) === null || _b === void 0 ? void 0 : _b.call(_a, this.formControl.value);
41
+ });
38
42
  }
39
43
  set name(val) {
40
44
  if (val) {
@@ -57,6 +61,7 @@ class SdJsonEditor {
57
61
  this.formControl.setValue(value, {
58
62
  emitEvent: false
59
63
  });
64
+ __classPrivateFieldGet(this, _updateJson).call(this);
60
65
  }
61
66
  }
62
67
  set required(val) {
@@ -87,10 +92,9 @@ class SdJsonEditor {
87
92
  },
88
93
  };
89
94
  this.editor = new JSONEditor(container, option);
90
- this.editor.set(this.formControl.value);
91
- __classPrivateFieldGet(this, _subscription).add(this.formControl.valueChanges.pipe(debounceTime(200)).subscribe(__classPrivateFieldGet(this, _onChange)));
95
+ __classPrivateFieldGet(this, _updateJson).call(this);
96
+ __classPrivateFieldGet(this, _subscription).add(this.formControl.valueChanges.pipe(debounceTime(100)).subscribe(__classPrivateFieldGet(this, _onChange)));
92
97
  (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.addControl(__classPrivateFieldGet(this, _name), this.formControl);
93
- this.ref.detectChanges();
94
98
  }
95
99
  ngOnDestroy() {
96
100
  var _a;
@@ -98,7 +102,7 @@ class SdJsonEditor {
98
102
  __classPrivateFieldGet(this, _subscription).unsubscribe();
99
103
  }
100
104
  }
101
- _name = new WeakMap(), _form = new WeakMap(), _model = new WeakMap(), _subscription = new WeakMap(), _onChange = new WeakMap();
105
+ _name = new WeakMap(), _form = new WeakMap(), _model = new WeakMap(), _subscription = new WeakMap(), _onChange = new WeakMap(), _updateJson = new WeakMap();
102
106
  SdJsonEditor.decorators = [
103
107
  { type: Component, args: [{
104
108
  selector: 'sd-json-editor',
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-json-editor.js","sources":["../../../../projects/sd-core/json-editor/src/lib/json-editor.component.ts","../../../../projects/sd-core/json-editor/src/lib/json-editor.module.ts","../../../../projects/sd-core/json-editor/src/public-api.ts","../../../../projects/sd-core/json-editor/sd-angular-core-json-editor.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 ChangeDetectionStrategy,\r\n HostListener\r\n} from '@angular/core';\r\nimport { NgForm, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport 'jsoneditor';\r\nimport JSONEditor, { JSONEditorOptions } from 'jsoneditor';\r\n@Component({\r\n selector: 'sd-json-editor',\r\n templateUrl: './json-editor.component.html',\r\n styleUrls: ['./json-editor.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdJsonEditor implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n editor: JSONEditor;\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 #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 #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 // 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() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n constructor(\r\n public ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n const container = document.getElementById(this.id);\r\n const option: JSONEditorOptions = {\r\n onChange: () => {\r\n this.formControl.setValue(this.editor.get());\r\n },\r\n };\r\n this.editor = new JSONEditor(container, option);\r\n this.editor.set(this.formControl.value);\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 #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(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 { 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 { SdCommonModule } from '@sd-angular/core/common';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdJsonEditor } from './json-editor.component';\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 SdJsonEditor,\r\n ],\r\n exports: [\r\n SdJsonEditor\r\n ]\r\n})\r\nexport class SdJsonEditorModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/json-editor.module';\r\nexport * from './lib/json-editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;MA6Ba,YAAY;IAmDvB,YACS,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAnD/B,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QAErB,gBAAQA,EAAO,EAAE,EAAC;QAMlB,wBAAiB;QAWjB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAG3C,eAAU,GAAG,KAAK,CAAC;QAeT,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QAE7C,gBAAW,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,wBAAgB,IAAI,YAAY,EAAE,EAAC;QA8BnC,eAAU,GAAG;YACX,IAAI,CAAC,WAAW,CAAC,sBAAsB,EAAE,CAAC;SAC3C,CAAA;QAED,oBAAY,CAAC,KAAU;YACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC3B,EAAA;KAlCA;IAjDD,IAAa,IAAI,CAAC,GAAW;QAC3B,IAAI,GAAG,EAAE;YACP,uBAAA,IAAI,SAAS,GAAG,EAAC;SAClB;KACF;IAED,IAAa,IAAI,CAAC,GAAuB;QACvC,IAAI,GAAG,EAAE;YACP,IAAI,GAAG,YAAY,MAAM,EAAE;gBACzB,uBAAA,IAAI,SAAS,GAAG,CAAC,IAAI,EAAC;aACvB;iBAAM;gBACL,uBAAA,IAAI,SAAS,GAAG,EAAC;aAClB;SACF;KACF;IAGD,IAAa,KAAK,CAAC,KAAU;QAC3B,IAAI,yCAAgB,KAAK,EAAE;YACzB,uBAAA,IAAI,UAAU,KAAK,EAAC;YACpB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE;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ACT,mFAAY,aAAa,sCAAa;QACtC,4CAAmB,WAAW,EAAE,CAAC;KAClC;;;;YApFF,SAAS,SAAC;gBACT,QAAQ,EAAE,gBAAgB;gBAC1B,uKAA2C;gBAE3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YAtBC,iBAAiB;;;mBA2BhB,KAAK;mBAML,KAAK;oBASL,KAAK;oBAEL,KAAK;0BAQL,MAAM;uBAIN,KAAK;uBAKL,KAAK;sBAQL,KAAK;uBACL,MAAM;;;MC5CI,kBAAkB;;;YApB9B,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,YAAY;iBACb;gBACD,OAAO,EAAE;oBACP,YAAY;iBACb;aACF;;;AC/BD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-json-editor.js","sources":["../../../../projects/sd-core/json-editor/src/lib/json-editor.component.ts","../../../../projects/sd-core/json-editor/src/lib/json-editor.module.ts","../../../../projects/sd-core/json-editor/src/public-api.ts","../../../../projects/sd-core/json-editor/sd-angular-core-json-editor.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 ChangeDetectionStrategy,\r\n HostListener\r\n} from '@angular/core';\r\nimport { NgForm, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport { debounceTime } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport 'jsoneditor';\r\nimport JSONEditor, { JSONEditorOptions } from 'jsoneditor';\r\n@Component({\r\n selector: 'sd-json-editor',\r\n templateUrl: './json-editor.component.html',\r\n styleUrls: ['./json-editor.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdJsonEditor implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n editor: JSONEditor;\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 #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 #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 this.#updateJson();\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 // 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() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n constructor(\r\n public ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n const container = document.getElementById(this.id);\r\n const option: JSONEditorOptions = {\r\n onChange: () => {\r\n this.formControl.setValue(this.editor.get());\r\n },\r\n };\r\n this.editor = new JSONEditor(container, option);\r\n this.#updateJson();\r\n this.#subscription.add(this.formControl.valueChanges.pipe(debounceTime(100)).subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\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 #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n\r\n #updateJson = () => {\r\n this.editor?.set?.(this.formControl.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 { 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 { SdCommonModule } from '@sd-angular/core/common';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdJsonEditor } from './json-editor.component';\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 SdJsonEditor,\r\n ],\r\n exports: [\r\n SdJsonEditor\r\n ]\r\n})\r\nexport class SdJsonEditorModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/json-editor.module';\r\nexport * from './lib/json-editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;MA6Ba,YAAY;IAoDvB,YACS,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QApD/B,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QAErB,gBAAQA,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BASL,KAAK;oBAEL,KAAK;0BASL,MAAM;uBAIN,KAAK;uBAKL,KAAK;sBAQL,KAAK;uBACL,MAAM;;;MC7CI,kBAAkB;;;YApB9B,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,YAAY;iBACb;gBACD,OAAO,EAAE;oBACP,YAAY;iBACb;aACF;;;AC/BD;;;;ACAA;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Directive, TemplateRef, EventEmitter, Component, ChangeDetectionStrategy, ChangeDetectorRef, ViewChild, Input, ContentChild, Output, NgModule } from '@angular/core';
1
+ import { Directive, TemplateRef, EventEmitter, Component, ChangeDetectionStrategy, ChangeDetectorRef, Inject, Optional, ViewChild, Input, ContentChild, Output, NgModule } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { Validators, NgForm, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatFormFieldModule } from '@angular/material/form-field';
@@ -10,7 +10,7 @@ import { __classPrivateFieldGet, __awaiter, __classPrivateFieldSet } from 'tslib
10
10
  import { v4 } from 'uuid';
11
11
  import { Subject, BehaviorSubject, Subscription, combineLatest } from 'rxjs';
12
12
  import { startWith, debounceTime, switchMap, map } from 'rxjs/operators';
13
- import { SdFormControl, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
13
+ import { SdFormControl, FORM_CONFIG, SdViewDefDirective, SdCommonModule } from '@sd-angular/core/common';
14
14
  import { MatSelectModule } from '@angular/material/select';
15
15
  import { SdTranslateModule } from '@sd-angular/core/translate';
16
16
  import { MatCheckboxModule } from '@angular/material/checkbox';
@@ -31,8 +31,9 @@ SdSelectDisplayDefDirective.ctorParameters = () => [
31
31
 
32
32
  var _input, _name, _form, _itemsChanges, _delay, _validator, _subscription, _allItems, _allItem, _cache, _updateValidator, _loadSelectedItems, _loadItems, _onChange, _customValidator;
33
33
  class SdSelect {
34
- constructor(ref) {
34
+ constructor(ref, formConfig) {
35
35
  this.ref = ref;
36
+ this.formConfig = formConfig;
36
37
  _input.set(this, void 0);
37
38
  _name.set(this, v4());
38
39
  this.disableErrorMessage = false;
@@ -294,6 +295,8 @@ class SdSelect {
294
295
  this.selectAll = (val === '') || val;
295
296
  }
296
297
  ngOnInit() {
298
+ var _a;
299
+ this.appearance = this.appearance || ((_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.appearance);
297
300
  __classPrivateFieldGet(this, _subscription).add(this.formControl.sdChanges.subscribe(() => {
298
301
  this.ref.markForCheck();
299
302
  }));
@@ -390,18 +393,20 @@ _input = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _itemsChan
390
393
  SdSelect.decorators = [
391
394
  { type: Component, args: [{
392
395
  selector: 'sd-select',
393
- 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, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\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?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>",
396
+ template: "<label *ngIf=\"!appearance && label\" class=\"d-block pb-0 T14M\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n<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, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" placeholder=\"{{placeholder || label}}\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\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?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>",
394
397
  changeDetection: ChangeDetectionStrategy.OnPush,
395
398
  styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:none}:host ::ng-deep .sd-selected .mat-select-arrow{border:none}: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 mat-select.mat-select-disabled .mat-select-value{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}::ng-deep .sd-select-panel .mat-option.sd-filtered-input{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:10}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline{width:100%}::ng-deep .sd-select-panel .mat-option.sd-filtered-input mat-pseudo-checkbox{display:none}::ng-deep .mat-select-panel .mat-option.sd-filtered-input{height:auto}::ng-deep .sd-select-panel .mat-option.sd-filtered-input input{color:#000}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field-prefix .mat-icon{margin-right:0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding:10px 0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper .mat-form-field-outline{background-color:rgba(0,0,0,.04)}"]
396
399
  },] }
397
400
  ];
398
401
  SdSelect.ctorParameters = () => [
399
- { type: ChangeDetectorRef }
402
+ { type: ChangeDetectorRef },
403
+ { type: undefined, decorators: [{ type: Inject, args: [FORM_CONFIG,] }, { type: Optional }] }
400
404
  ];
401
405
  SdSelect.propDecorators = {
402
406
  input: [{ type: ViewChild, args: [MatInput,] }],
403
407
  select: [{ type: ViewChild, args: ['select',] }],
404
408
  name: [{ type: Input }],
409
+ appearance: [{ type: Input }],
405
410
  _disableErrorMessage: [{ type: Input, args: ['disableErrorMessage',] }],
406
411
  size: [{ type: Input }],
407
412
  form: [{ type: Input }],