@sd-angular/core 1.3.214 → 1.3.217

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 (58) hide show
  1. package/bundles/sd-angular-core-checkbox.umd.js +29 -3
  2. package/bundles/sd-angular-core-checkbox.umd.js.map +1 -1
  3. package/bundles/sd-angular-core-checkbox.umd.min.js +2 -2
  4. package/bundles/sd-angular-core-checkbox.umd.min.js.map +1 -1
  5. package/bundles/sd-angular-core-date-time.umd.js +14 -6
  6. package/bundles/sd-angular-core-date-time.umd.js.map +1 -1
  7. package/bundles/sd-angular-core-date-time.umd.min.js +1 -1
  8. package/bundles/sd-angular-core-date-time.umd.min.js.map +1 -1
  9. package/bundles/sd-angular-core-input-number.umd.js +3 -0
  10. package/bundles/sd-angular-core-input-number.umd.js.map +1 -1
  11. package/bundles/sd-angular-core-input-number.umd.min.js +1 -1
  12. package/bundles/sd-angular-core-input-number.umd.min.js.map +1 -1
  13. package/bundles/sd-angular-core-input-upload-file.umd.js +54 -3
  14. package/bundles/sd-angular-core-input-upload-file.umd.js.map +1 -1
  15. package/bundles/sd-angular-core-input-upload-file.umd.min.js +2 -2
  16. package/bundles/sd-angular-core-input-upload-file.umd.min.js.map +1 -1
  17. package/bundles/sd-angular-core-radio.umd.js +22 -2
  18. package/bundles/sd-angular-core-radio.umd.js.map +1 -1
  19. package/bundles/sd-angular-core-radio.umd.min.js +2 -2
  20. package/bundles/sd-angular-core-radio.umd.min.js.map +1 -1
  21. package/bundles/sd-angular-core-switch.umd.js +34 -7
  22. package/bundles/sd-angular-core-switch.umd.js.map +1 -1
  23. package/bundles/sd-angular-core-switch.umd.min.js +2 -2
  24. package/bundles/sd-angular-core-switch.umd.min.js.map +1 -1
  25. package/checkbox/sd-angular-core-checkbox.metadata.json +1 -1
  26. package/checkbox/src/lib/checkbox.component.d.ts +4 -1
  27. package/date-time/sd-angular-core-date-time.metadata.json +1 -1
  28. package/date-time/src/lib/date-time.component.d.ts +1 -0
  29. package/esm2015/checkbox/src/lib/checkbox.component.js +26 -4
  30. package/esm2015/date-time/src/lib/date-time.component.js +8 -2
  31. package/esm2015/date-time/src/lib/date-time.module.js +6 -2
  32. package/esm2015/input-number/src/lib/input-number.component.js +4 -1
  33. package/esm2015/input-upload-file/src/lib/input-upload-file.component.js +44 -5
  34. package/esm2015/radio/src/lib/radio.component.js +19 -3
  35. package/esm2015/switch/src/lib/switch.component.js +26 -4
  36. package/esm2015/switch/src/lib/switch.module.js +3 -1
  37. package/fesm2015/sd-angular-core-checkbox.js +25 -3
  38. package/fesm2015/sd-angular-core-checkbox.js.map +1 -1
  39. package/fesm2015/sd-angular-core-date-time.js +12 -2
  40. package/fesm2015/sd-angular-core-date-time.js.map +1 -1
  41. package/fesm2015/sd-angular-core-input-number.js +3 -0
  42. package/fesm2015/sd-angular-core-input-number.js.map +1 -1
  43. package/fesm2015/sd-angular-core-input-upload-file.js +43 -4
  44. package/fesm2015/sd-angular-core-input-upload-file.js.map +1 -1
  45. package/fesm2015/sd-angular-core-radio.js +18 -2
  46. package/fesm2015/sd-angular-core-radio.js.map +1 -1
  47. package/fesm2015/sd-angular-core-switch.js +27 -3
  48. package/fesm2015/sd-angular-core-switch.js.map +1 -1
  49. package/input-number/sd-angular-core-input-number.metadata.json +1 -1
  50. package/input-number/src/lib/input-number.component.d.ts +1 -0
  51. package/input-upload-file/sd-angular-core-input-upload-file.metadata.json +1 -1
  52. package/input-upload-file/src/lib/input-upload-file.component.d.ts +8 -1
  53. package/package.json +1 -1
  54. package/radio/sd-angular-core-radio.metadata.json +1 -1
  55. package/radio/src/lib/radio.component.d.ts +4 -1
  56. package/{sd-angular-core-1.3.214.tgz → sd-angular-core-1.3.217.tgz} +0 -0
  57. package/switch/sd-angular-core-switch.metadata.json +1 -1
  58. package/switch/src/lib/switch.component.d.ts +4 -1
@@ -48,9 +48,14 @@ class SdRadio {
48
48
  if (__classPrivateFieldGet(this, _required)) {
49
49
  validators.push(Validators.required);
50
50
  }
51
+ if (this.inlineError) {
52
+ validators.push(this.customInlineErrorValidator());
53
+ }
51
54
  this.formControl.setValidators(validators);
52
55
  this.formControl.updateValueAndValidity();
53
- });
56
+ }
57
+ // Hàm tạo Validators tùy chỉnh cho inlineError
58
+ );
54
59
  this.reValidate = () => {
55
60
  this.formControl.updateValueAndValidity({ emitEvent: true });
56
61
  };
@@ -88,6 +93,10 @@ class SdRadio {
88
93
  __classPrivateFieldSet(this, _required, (val === '') || val);
89
94
  __classPrivateFieldGet(this, _updateValidator).call(this);
90
95
  }
96
+ set _inlineError(val) {
97
+ this.inlineError = val;
98
+ __classPrivateFieldGet(this, _updateValidator).call(this);
99
+ }
91
100
  // Optional
92
101
  set disabled(val) {
93
102
  val = (val === '') || val;
@@ -126,12 +135,18 @@ class SdRadio {
126
135
  __classPrivateFieldGet(this, _subscription).unsubscribe();
127
136
  (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
128
137
  }
138
+ // Hàm tạo Validators tùy chỉnh cho inlineError
139
+ customInlineErrorValidator() {
140
+ return (control) => {
141
+ return { inlineError: true };
142
+ };
143
+ }
129
144
  }
130
145
  _name = new WeakMap(), _form = new WeakMap(), _model = new WeakMap(), _required = new WeakMap(), _subscription = new WeakMap(), _updateValidator = new WeakMap();
131
146
  SdRadio.decorators = [
132
147
  { type: Component, args: [{
133
148
  selector: 'sd-radio',
134
- template: "<section [ngClass]=\"{'c-section': display == 'row'}\">\r\n <ng-container *ngIf=\"sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <label *ngIf=\"label&&!sdLabelDef?.templateRef\" class=\"d-block T14M\" [class.mb-0]=\"display === 'row'\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n <mat-radio-group [ngClass]=\"{'c-radio-group-column': display === 'column', 'c-radio-group-row': display === 'row'}\"\r\n [formControl]=\"formControl\">\r\n <mat-radio-button color=\"primary\" [ngClass]=\"{'m-0': display === 'column', 'mr-16': display === 'row'}\"\r\n *ngFor=\"let item of items\" [value]=\"item[valueField]\">\r\n {{item[displayField]}}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n</section>",
149
+ template: "<section [ngClass]=\"{'c-section': display == 'row'}\">\r\n <ng-container *ngIf=\"sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <label *ngIf=\"label&&!sdLabelDef?.templateRef\" class=\"d-block T14M\" [class.mb-0]=\"display === 'row'\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n <mat-radio-group [ngClass]=\"{'c-radio-group-column': display === 'column', 'c-radio-group-row': display === 'row'}\"\r\n [formControl]=\"formControl\">\r\n <mat-radio-button color=\"primary\" [ngClass]=\"{'m-0': display === 'column', 'mr-16': display === 'row'}\"\r\n *ngFor=\"let item of items\" [value]=\"item[valueField]\">\r\n {{item[displayField]}}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n \r\n <mat-error *ngIf=\"formControl.errors?.inlineError && formControl?.touched\">\r\n {{inlineError}}\r\n </mat-error>\r\n</section>",
135
150
  changeDetection: ChangeDetectionStrategy.OnPush,
136
151
  styles: [":host{display:flex;flex-direction:column;height:100%}.c-section{align-content:center;align-items:center}.c-radio-group-column{align-items:flex-start;display:flex;flex:1;flex-direction:column}.c-radio-group-row{align-items:center;display:flex;flex:1;flex-direction:row}"]
137
152
  },] }
@@ -150,6 +165,7 @@ SdRadio.propDecorators = {
150
165
  valueField: [{ type: Input }],
151
166
  displayField: [{ type: Input }],
152
167
  required: [{ type: Input }],
168
+ _inlineError: [{ type: Input, args: ['inlineError',] }],
153
169
  disabled: [{ type: Input }],
154
170
  sdLabelDef: [{ type: ContentChild, args: [SdLabelDefDirective,] }],
155
171
  modelChange: [{ type: Output }],
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-radio.js","sources":["../../../../projects/sd-core/radio/src/lib/radio.component.ts","../../../../projects/sd-core/radio/src/lib/radio.module.ts","../../../../projects/sd-core/radio/sd-angular-core-radio.ts"],"sourcesContent":["import { Component, Input, Output, EventEmitter, ChangeDetectorRef, AfterViewInit, OnDestroy, OnInit, ChangeDetectionStrategy, ContentChild } from '@angular/core';\r\nimport { NgForm, Validators, ValidatorFn, FormGroup } from '@angular/forms';\r\nimport { SdLabelDefDirective } from '@sd-angular/core/common';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { Subscription } from 'rxjs';\r\nimport * as uuid from 'uuid';\r\n\r\n@Component({\r\n selector: 'sd-radio',\r\n templateUrl: './radio.component.html',\r\n styleUrls: ['./radio.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdRadio implements OnInit, AfterViewInit, OnDestroy {\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 formControl = new SdFormControl();\r\n // get isNumber() {\r\n // if (this.#model || this.#model === 0) {\r\n // return typeof (this.#model) === 'number';\r\n // }\r\n // if (this.items?.length) {\r\n // if (this.valueField) {\r\n // return typeof (this.items[0][this.valueField]) === 'number';\r\n // } else {\r\n // return typeof (this.items[0]) === 'number';\r\n // }\r\n // }\r\n // return false;\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 @Input() placeholder: string;\r\n @Input() display: 'row' | 'column' = 'row';\r\n // Model\r\n #model: number | string | boolean;\r\n @Input() set model(value: number | string | boolean) {\r\n this.#model = value;\r\n if (value !== this.formControl.value) {\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n // Items\r\n items: any[] = [];\r\n @Input('items') set pItems(items: any[]) {\r\n if (!Array.isArray(items)) {\r\n this.items = [];\r\n }\r\n this.items = items;\r\n }\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n\r\n // Validator\r\n #required = false;\r\n @Input() set required(val: boolean | '') {\r\n this.#required = (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 @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n @Output() sdSelection = new EventEmitter<{ value: any | any[], item?: any }>();\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.formControl.updateValueAndValidity();\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(value => {\r\n let val = value;\r\n // if (this.isNumber && Number.isNumber(value)) {\r\n // val = +value;\r\n // }\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(val);\r\n this.sdSelection.emit({\r\n value: val,\r\n item: this.items?.find(e => val?.toString() === e?.[this.valueField]?.toString())\r\n });\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#subscription.unsubscribe();\r\n this.#form?.removeControl(this.#name);\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n const validators: ValidatorFn[] = [];\r\n if (this.#required) {\r\n validators.push(Validators.required);\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity({ emitEvent: true });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdRadio } from './radio.component';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatRadioModule } from '@angular/material/radio';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n ReactiveFormsModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatRadioModule,\r\n SdTranslateModule\r\n ],\r\n declarations: [\r\n SdRadio\r\n ],\r\n exports: [\r\n SdRadio\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdRadioModule {\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;MAaa,OAAO;IA2ElB,YACS,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QA3E/B,gBAAQA,EAAO,EAAE,EAAC;QAMlB,gBAAW,GAAG,IAAI,aAAa,EAAE,CAAC;;;;;;;;;;;;;;QAclC,wBAAiB;QAYR,YAAO,GAAqB,KAAK,CAAC;;QAE3C,yBAAkC;;QAUlC,UAAK,GAAU,EAAE,CAAC;;QAWlB,oBAAY,KAAK,EAAC;QAeR,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;QACjC,aAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC9B,gBAAW,GAAG,IAAI,YAAY,EAAsC,CAAC;QAC/E,wBAAgB,IAAI,YAAY,EAAE,EAAC;QAiCnC,2BAAmB;YACjB,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;YACnC,MAAM,UAAU,GAAkB,EAAE,CAAC;YACrC,6CAAoB;gBAClB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;aACtC;YACD,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K,SAAC,OAAO;yBAMb,KAAK;2BACL,KAAK;uBAIL,KAAK;uBAKL,KAAK;yBAQL,YAAY,SAAC,mBAAmB;0BAChC,MAAM;uBACN,MAAM;0BACN,MAAM;;;MCzDI,aAAa;;;YAnBzB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,mBAAmB;oBACnB,gBAAgB;oBAChB,kBAAkB;oBAClB,aAAa;oBACb,cAAc;oBACd,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,OAAO;iBACR;gBACD,OAAO,EAAE;oBACP,OAAO;iBACR;gBACD,SAAS,EAAE,EACV;aACF;;;AC5BD;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-radio.js","sources":["../../../../projects/sd-core/radio/src/lib/radio.component.ts","../../../../projects/sd-core/radio/src/lib/radio.module.ts","../../../../projects/sd-core/radio/sd-angular-core-radio.ts"],"sourcesContent":["import { Component, Input, Output, EventEmitter, ChangeDetectorRef, AfterViewInit, OnDestroy, OnInit, ChangeDetectionStrategy, ContentChild } from '@angular/core';\r\nimport { NgForm, Validators, ValidatorFn, FormGroup, AbstractControl } from '@angular/forms';\r\nimport { SdLabelDefDirective } from '@sd-angular/core/common';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { Subscription } from 'rxjs';\r\nimport * as uuid from 'uuid';\r\n\r\n@Component({\r\n selector: 'sd-radio',\r\n templateUrl: './radio.component.html',\r\n styleUrls: ['./radio.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdRadio implements OnInit, AfterViewInit, OnDestroy {\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 formControl = new SdFormControl();\r\n // get isNumber() {\r\n // if (this.#model || this.#model === 0) {\r\n // return typeof (this.#model) === 'number';\r\n // }\r\n // if (this.items?.length) {\r\n // if (this.valueField) {\r\n // return typeof (this.items[0][this.valueField]) === 'number';\r\n // } else {\r\n // return typeof (this.items[0]) === 'number';\r\n // }\r\n // }\r\n // return false;\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 @Input() placeholder: string;\r\n @Input() display: 'row' | 'column' = 'row';\r\n // Model\r\n #model: number | string | boolean;\r\n @Input() set model(value: number | string | boolean) {\r\n this.#model = value;\r\n if (value !== this.formControl.value) {\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n // Items\r\n items: any[] = [];\r\n @Input('items') set pItems(items: any[]) {\r\n if (!Array.isArray(items)) {\r\n this.items = [];\r\n }\r\n this.items = items;\r\n }\r\n @Input() valueField: string;\r\n @Input() displayField: string;\r\n\r\n // Validator\r\n #required = false;\r\n @Input() set required(val: boolean | '') {\r\n this.#required = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n \r\n inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\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(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n @Output() sdSelection = new EventEmitter<{ value: any | any[], item?: any }>();\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.formControl.updateValueAndValidity();\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(value => {\r\n let val = value;\r\n // if (this.isNumber && Number.isNumber(value)) {\r\n // val = +value;\r\n // }\r\n this.modelChange.emit(val);\r\n this.sdChange.emit(val);\r\n this.sdSelection.emit({\r\n value: val,\r\n item: this.items?.find(e => val?.toString() === e?.[this.valueField]?.toString())\r\n });\r\n }));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#subscription.unsubscribe();\r\n this.#form?.removeControl(this.#name);\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n const validators: ValidatorFn[] = [];\r\n if (this.#required) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.inlineError) {\r\n validators.push(this.customInlineErrorValidator());\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity({ emitEvent: true });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdRadio } from './radio.component';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatRadioModule } from '@angular/material/radio';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n ReactiveFormsModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatRadioModule,\r\n SdTranslateModule\r\n ],\r\n declarations: [\r\n SdRadio\r\n ],\r\n exports: [\r\n SdRadio\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdRadioModule {\r\n\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport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AO,EAAE;oBACP,YAAY;oBACZ,mBAAmB;oBACnB,gBAAgB;oBAChB,kBAAkB;oBAClB,aAAa;oBACb,cAAc;oBACd,iBAAiB;iBAClB;gBACD,YAAY,EAAE;oBACZ,OAAO;iBACR;gBACD,OAAO,EAAE;oBACP,OAAO;iBACR;gBACD,SAAS,EAAE,EACV;aACF;;;AC5BD;;;;;;"}
@@ -5,8 +5,9 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
5
5
  import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
6
6
  import { Subscription } from 'rxjs';
7
7
  import { v4 } from 'uuid';
8
+ import { MatFormFieldModule } from '@angular/material/form-field';
8
9
 
9
- var _name, _form, _subscription, _onChange;
10
+ var _name, _form, _subscription, _onChange, _updateValidator;
10
11
  class SdSwitch {
11
12
  constructor(ref) {
12
13
  this.ref = ref;
@@ -21,6 +22,17 @@ class SdSwitch {
21
22
  this.modelChange.emit(value);
22
23
  this.sdChange.emit(value);
23
24
  });
25
+ _updateValidator.set(this, () => {
26
+ this.formControl.clearValidators();
27
+ const validators = [];
28
+ if (this.inlineError) {
29
+ validators.push(this.customInlineErrorValidator());
30
+ }
31
+ this.formControl.setValidators(validators);
32
+ this.formControl.updateValueAndValidity();
33
+ }
34
+ // Hàm tạo Validators tùy chỉnh cho inlineError
35
+ );
24
36
  }
25
37
  set form(val) {
26
38
  if (val) {
@@ -48,6 +60,10 @@ class SdSwitch {
48
60
  });
49
61
  }
50
62
  }
63
+ set _inlineError(val) {
64
+ this.inlineError = val;
65
+ __classPrivateFieldGet(this, _updateValidator).call(this);
66
+ }
51
67
  ngOnInit() {
52
68
  }
53
69
  ngAfterViewInit() {
@@ -61,12 +77,18 @@ class SdSwitch {
61
77
  (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
62
78
  __classPrivateFieldGet(this, _subscription).unsubscribe();
63
79
  }
80
+ // Hàm tạo Validators tùy chỉnh cho inlineError
81
+ customInlineErrorValidator() {
82
+ return (control) => {
83
+ return { inlineError: true };
84
+ };
85
+ }
64
86
  }
65
- _name = new WeakMap(), _form = new WeakMap(), _subscription = new WeakMap(), _onChange = new WeakMap();
87
+ _name = new WeakMap(), _form = new WeakMap(), _subscription = new WeakMap(), _onChange = new WeakMap(), _updateValidator = new WeakMap();
66
88
  SdSwitch.decorators = [
67
89
  { type: Component, args: [{
68
90
  selector: 'sd-switch',
69
- template: "<mat-slide-toggle [formControl]=\"formControl\" [color]=\"color\"><span\r\n class=\"c-label\">{{label}}</span></mat-slide-toggle>",
91
+ template: "<mat-slide-toggle [formControl]=\"formControl\" [color]=\"color\"><span\r\n class=\"c-label\">{{label}}</span></mat-slide-toggle>\r\n <mat-error *ngIf=\"formControl.errors?.inlineError && formControl?.touched\">\r\n {{inlineError}}\r\n </mat-error>",
70
92
  changeDetection: ChangeDetectionStrategy.OnPush,
71
93
  styles: [""]
72
94
  },] }
@@ -81,6 +103,7 @@ SdSwitch.propDecorators = {
81
103
  color: [{ type: Input }],
82
104
  disabled: [{ type: Input }],
83
105
  model: [{ type: Input }],
106
+ _inlineError: [{ type: Input, args: ['inlineError',] }],
84
107
  modelChange: [{ type: Output }],
85
108
  sdChange: [{ type: Output }]
86
109
  };
@@ -94,6 +117,7 @@ SdSwitchModule.decorators = [
94
117
  FormsModule,
95
118
  ReactiveFormsModule,
96
119
  MatSlideToggleModule,
120
+ MatFormFieldModule
97
121
  ],
98
122
  declarations: [
99
123
  SdSwitch
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-switch.js","sources":["../../../../projects/sd-core/switch/src/lib/switch.component.ts","../../../../projects/sd-core/switch/src/lib/switch.module.ts","../../../../projects/sd-core/switch/src/public-api.ts","../../../../projects/sd-core/switch/sd-angular-core-switch.ts"],"sourcesContent":["import { Component, Input, Output, EventEmitter, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';\r\nimport { FormControl, FormGroup, NgForm } from '@angular/forms';\r\nimport { Subscription } from 'rxjs';\r\nimport * as uuid from 'uuid';\r\n\r\n@Component({\r\n selector: 'sd-switch',\r\n templateUrl: './switch.component.html',\r\n styleUrls: ['./switch.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdSwitch {\r\n #name = uuid.v4();\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() color: 'primary' | 'warn' = 'primary';\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\r\n @Input() set model(value: any) {\r\n if (this.formControl.value !== value) {\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n formControl = new FormControl();\r\n #subscription = new Subscription();\r\n constructor(private ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n }\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.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 #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 { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\nimport { SdSwitch } from './switch.component';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatSlideToggleModule,\r\n ],\r\n declarations: [\r\n SdSwitch\r\n ],\r\n exports: [\r\n SdSwitch\r\n ]\r\n})\r\nexport class SdSwitchModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/switch.module';\r\nexport * from './lib/switch.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;MAWa,QAAQ;IAoCnB,YAAoB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAnC1C,gBAAQA,EAAO,EAAE,EAAC;QAElB,wBAAiB;QAWR,UAAK,GAAuB,SAAS,CAAC;QAkBrC,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;QACjC,aAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACxC,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,wBAAgB,IAAI,YAAY,EAAE,EAAC;QAiBnC,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;KAlBA;IAjCD,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,QAAQ,CAAC,GAAiB;QACrC,GAAG,GAAG,CAAC,GAAG,KAAK,EAAE,KAAK,GAAG,CAAC;QAC1B,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;SAC5B;aAAM;YACL,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;SAC3B;KACF;IAED,IAAa,KAAK,CAAC,KAAU;QAC3B,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,KAAK,KAAK,EAAE;YACpC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE;gBAC/B,SAAS,EAAE,KAAK;aACjB,CAAC,CAAC;SACJ;KACF;IASD,QAAQ;KACP;IACD,eAAe;;QACb,4CAAmB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,yCAAgB,CAAC,CAAC;QAChF,mFAAY,UAAU,sCAAa,IAAI,CAAC,WAAW,EAAE;QACrD,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;KAC1B;IAED,WAAW;;QACT,mFAAY,aAAa,sCAAa;QACtC,4CAAmB,WAAW,EAAE,CAAC;KAClC;;;;YAxDF,SAAS,SAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,gJAAsC;gBAEtC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YAVgD,iBAAiB;;;mBAa/D,KAAK;mBAEL,KAAK;oBASL,KAAK;oBACL,KAAK;uBACL,KAAK;oBASL,KAAK;0BAQL,MAAM;uBACN,MAAM;;;MCxBI,cAAc;;;YAd1B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,oBAAoB;iBACrB;gBACD,YAAY,EAAE;oBACZ,QAAQ;iBACT;gBACD,OAAO,EAAE;oBACP,QAAQ;iBACT;aACF;;;ACnBD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-switch.js","sources":["../../../../projects/sd-core/switch/src/lib/switch.component.ts","../../../../projects/sd-core/switch/src/lib/switch.module.ts","../../../../projects/sd-core/switch/src/public-api.ts","../../../../projects/sd-core/switch/sd-angular-core-switch.ts"],"sourcesContent":["import { Component, Input, Output, EventEmitter, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';\r\nimport { AbstractControl, FormControl, FormGroup, NgForm, ValidatorFn } from '@angular/forms';\r\nimport { Subscription } from 'rxjs';\r\nimport * as uuid from 'uuid';\r\n\r\n@Component({\r\n selector: 'sd-switch',\r\n templateUrl: './switch.component.html',\r\n styleUrls: ['./switch.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdSwitch {\r\n #name = uuid.v4();\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() color: 'primary' | 'warn' = 'primary';\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\r\n @Input() set model(value: any) {\r\n if (this.formControl.value !== value) {\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n\r\n inlineError: string;\r\n @Input('inlineError') set _inlineError(val: string) {\r\n this.inlineError = val;\r\n this.#updateValidator();\r\n }\r\n\r\n @Output() modelChange = new EventEmitter();\r\n @Output() sdChange = new EventEmitter();\r\n formControl = new FormControl();\r\n #subscription = new Subscription();\r\n constructor(private ref: ChangeDetectorRef) {\r\n }\r\n\r\n ngOnInit() {\r\n }\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.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 #onChange = (value: any) => {\r\n this.modelChange.emit(value);\r\n this.sdChange.emit(value);\r\n }\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n const validators: ValidatorFn[] = [];\r\n \r\n if (this.inlineError) {\r\n validators.push(this.customInlineErrorValidator());\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n // Hàm tạo Validators tùy chỉnh cho inlineError\r\n customInlineErrorValidator(): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n return { inlineError: true };\r\n };\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\nimport { SdSwitch } from './switch.component';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatSlideToggleModule,\r\n MatFormFieldModule\r\n ],\r\n declarations: [\r\n SdSwitch\r\n ],\r\n exports: [\r\n SdSwitch\r\n ]\r\n})\r\nexport class SdSwitchModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/switch.module';\r\nexport * from './lib/switch.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;MAWa,QAAQ;IA0CnB,YAAoB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAzC1C,gBAAQA,EAAO,EAAE,EAAC;QAElB,wBAAiB;QAWR,UAAK,GAAuB,SAAS,CAAC;QAwBrC,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;QACjC,aAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QACxC,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,wBAAgB,IAAI,YAAY,EAAE,EAAC;QAiBnC,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;QACD,2BAAmB;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AAI,CAAC,WAAW,EAAE;QACrD,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;KAC1B;IAED,WAAW;;QACT,mFAAY,aAAa,sCAAa;QACtC,4CAAmB,WAAW,EAAE,CAAC;KAClC;;IAiBE,0BAA0B;QACzB,OAAO,CAAC,OAAwB;YAC9B,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;SAC9B,CAAC;KACH;;;;YAnFJ,SAAS,SAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,kRAAsC;gBAEtC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YAVgD,iBAAiB;;;mBAa/D,KAAK;mBAEL,KAAK;oBASL,KAAK;oBACL,KAAK;uBACL,KAAK;oBASL,KAAK;2BASL,KAAK,SAAC,aAAa;0BAKnB,MAAM;uBACN,MAAM;;;MC5BI,cAAc;;;YAf1B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,oBAAoB;oBACpB,kBAAkB;iBACnB;gBACD,YAAY,EAAE;oBACZ,QAAQ;iBACT;gBACD,OAAO,EAAE;oBACP,QAAQ;iBACT;aACF;;;ACrBD;;;;ACAA;;;;;;"}
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"SdInputNumberModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":13,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"SdInputNumber"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":17,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":20,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":21,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":22,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":23,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdCommonModule","line":24,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/popover","name":"SdPopoverModule","line":25,"character":4},{"__symbolic":"reference","module":"@angular/material/button","name":"MatButtonModule","line":26,"character":4}],"exports":[{"__symbolic":"reference","name":"SdInputNumber"}]}]}],"members":{}},"SdInputNumber":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":39,"character":1},"arguments":[{"selector":"sd-input-number","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":43,"character":19},"member":"OnPush"},"template":"<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</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\" [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 <input aria-hidden=\"true\" [id]=\"id\" [formControl]=\"inputControl\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" (keydown)=\"onKeydown($event)\"\r\n [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" (paste)=\"onPaste($event)\" autocorrect=\"off\"\r\n [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\"\r\n [sdPopoverTriggerFor]=\"null\" [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\">\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 <svg \r\n #copyTooltip=\"matTooltip\" \r\n *ngIf=\"copyable\" \r\n matSuffix \r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\" \r\n class=\"icon-copy\" \r\n focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\" \r\n (click)=\"onCopyText()\">\r\n <path d=\"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z\"></path>\r\n </svg>\r\n <mat-error *ngIf=\"formControl?.errors?.required\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.min\"> \r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Không nhập bé hơn '}} <strong>{{minNumber}}</strong></ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.max\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Không nhập lớn hơn '}} <strong>{{maxNumber}}</strong></ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{formControl.errors?.customValidator}}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.inlineError\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{inlineError}}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>\r\n<!-- <sd-popover #error=\"sdPopover\" type=\"danger\" width=\"300px\">\r\n <span *ngIf=\"formControl.errors?.required\">\r\n {{ \"This field is required\" | sdTranslate }}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->","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}:host ::ng-deep .mat-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-form-field .icon-copy{cursor:pointer;fill:rgba(0,0,0,.5);height:.9em;opacity:0;transition:opacity .2s linear;width:.9em}.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}"]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":48,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":53,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":55,"character":3}}]}],"_label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":66,"character":3},"arguments":["label"]}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":73,"character":3}}]}],"_disableErrorMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":75,"character":3},"arguments":["disableErrorMessage"]}]}],"_blurOnEnter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":79,"character":3},"arguments":["blurOnEnter"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":83,"character":3}}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":101,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":105,"character":3}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":109,"character":3}}]}],"precision":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":110,"character":3}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":113,"character":3}}]}],"min":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":118,"character":3}}]}],"max":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":124,"character":3}}]}],"validator":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":130,"character":3}}]}],"_inlineError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":136,"character":3},"arguments":["inlineError"]}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":141,"character":3}}]}],"appearance":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":151,"character":3}}]}],"copyTooltip":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":153,"character":3},"arguments":["copyTooltip"]}]}],"_copyable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":155,"character":3},"arguments":["copyable"]}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":160,"character":3}}]}],"sdFocus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":161,"character":3}}]}],"sdFocusForceBlur":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":162,"character":3}}]}],"keyupEnter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":163,"character":3}}]}],"control":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":165,"character":3},"arguments":["control"]}]}],"sdView":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":171,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdViewDefDirective","line":171,"character":16}]}]}],"sdSuffix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":172,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdSuffixDirective","line":172,"character":16}]}]}],"sdLabelDef":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":173,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdLabelDefDirective","line":173,"character":16}]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":177,"character":5},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"FORM_CONFIG","line":177,"character":12}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":177,"character":26}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":176,"character":17},{"__symbolic":"reference","module":"@sd-angular/core/common","name":"IFormConfiguration","line":177,"character":57}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"customInlineErrorValidator":[{"__symbolic":"method"}],"onPaste":[{"__symbolic":"method"}],"onCopyText":[{"__symbolic":"method"}]}}},"origins":{"SdInputNumberModule":"./src/lib/input-number.module","SdInputNumber":"./src/lib/input-number.component"},"importAs":"@sd-angular/core/input-number"}
1
+ {"__symbolic":"module","version":4,"metadata":{"SdInputNumberModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":13,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"SdInputNumber"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":17,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":20,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":21,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":22,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":23,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdCommonModule","line":24,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/popover","name":"SdPopoverModule","line":25,"character":4},{"__symbolic":"reference","module":"@angular/material/button","name":"MatButtonModule","line":26,"character":4}],"exports":[{"__symbolic":"reference","name":"SdInputNumber"}]}]}],"members":{}},"SdInputNumber":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":39,"character":1},"arguments":[{"selector":"sd-input-number","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":43,"character":19},"member":"OnPush"},"template":"<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" class=\"d-block mb-0 T14M\">{{label}} <span class=\"text-danger mb-2\"\r\n *ngIf=\"isRequired\">*</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\" [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 <input aria-hidden=\"true\" [id]=\"id\" [formControl]=\"inputControl\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" (keydown)=\"onKeydown($event)\"\r\n [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" (paste)=\"onPaste($event)\" autocorrect=\"off\"\r\n [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\"\r\n [sdPopoverTriggerFor]=\"null\" [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\">\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 <svg \r\n #copyTooltip=\"matTooltip\" \r\n *ngIf=\"copyable\" \r\n matSuffix \r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\" \r\n class=\"icon-copy\" \r\n focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\" \r\n (click)=\"onCopyText()\">\r\n <path d=\"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z\"></path>\r\n </svg>\r\n <mat-error *ngIf=\"formControl?.errors?.required\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.min\"> \r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Không nhập bé hơn '}} <strong>{{minNumber}}</strong></ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.max\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Không nhập lớn hơn '}} <strong>{{maxNumber}}</strong></ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.customValidator\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{formControl.errors?.customValidator}}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.inlineError\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{inlineError}}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>\r\n<!-- <sd-popover #error=\"sdPopover\" type=\"danger\" width=\"300px\">\r\n <span *ngIf=\"formControl.errors?.required\">\r\n {{ \"This field is required\" | sdTranslate }}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->","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}:host ::ng-deep .mat-form-field:hover .icon-copy{opacity:1}:host ::ng-deep .mat-form-field .icon-copy{cursor:pointer;fill:rgba(0,0,0,.5);height:.9em;opacity:0;transition:opacity .2s linear;width:.9em}.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}"]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":48,"character":3}}]}],"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":53,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":55,"character":3}}]}],"_label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":66,"character":3},"arguments":["label"]}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":73,"character":3}}]}],"_disableErrorMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":75,"character":3},"arguments":["disableErrorMessage"]}]}],"_blurOnEnter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":79,"character":3},"arguments":["blurOnEnter"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":83,"character":3}}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":101,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":105,"character":3}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":109,"character":3}}]}],"precision":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":110,"character":3}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":113,"character":3}}]}],"min":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":118,"character":3}}]}],"max":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":124,"character":3}}]}],"validator":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":130,"character":3}}]}],"_inlineError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":136,"character":3},"arguments":["inlineError"]}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":141,"character":3}}]}],"appearance":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":151,"character":3}}]}],"copyTooltip":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":153,"character":3},"arguments":["copyTooltip"]}]}],"_copyable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":155,"character":3},"arguments":["copyable"]}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":160,"character":3}}]}],"sdFocus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":161,"character":3}}]}],"sdBlur":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":162,"character":3}}]}],"sdFocusForceBlur":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":163,"character":3}}]}],"keyupEnter":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":164,"character":3}}]}],"control":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":166,"character":3},"arguments":["control"]}]}],"sdView":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":172,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdViewDefDirective","line":172,"character":16}]}]}],"sdSuffix":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":173,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdSuffixDirective","line":173,"character":16}]}]}],"sdLabelDef":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":174,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdLabelDefDirective","line":174,"character":16}]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":178,"character":5},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"FORM_CONFIG","line":178,"character":12}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":178,"character":26}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":177,"character":17},{"__symbolic":"reference","module":"@sd-angular/core/common","name":"IFormConfiguration","line":178,"character":57}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"customInlineErrorValidator":[{"__symbolic":"method"}],"onPaste":[{"__symbolic":"method"}],"onCopyText":[{"__symbolic":"method"}]}}},"origins":{"SdInputNumberModule":"./src/lib/input-number.module","SdInputNumber":"./src/lib/input-number.component"},"importAs":"@sd-angular/core/input-number"}
@@ -50,6 +50,7 @@ export declare class SdInputNumber implements OnDestroy, OnInit, AfterViewInit {
50
50
  copied: boolean;
51
51
  sdChange: EventEmitter<any>;
52
52
  sdFocus: EventEmitter<any>;
53
+ sdBlur: EventEmitter<any>;
53
54
  sdFocusForceBlur: EventEmitter<any>;
54
55
  keyupEnter: EventEmitter<any>;
55
56
  control: ElementRef;
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"SdInputUploadFileModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":12,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":14,"character":4},{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"ngx-device-detector","name":"DeviceDetectorModule","line":15,"character":4},"member":"forRoot"}},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":17,"character":4},{"__symbolic":"reference","module":"@angular/material/chips","name":"MatChipsModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":20,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":21,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/notify","name":"SdNotifyModule","line":22,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":23,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdInputUploadFile"}],"exports":[{"__symbolic":"reference","name":"SdInputUploadFile"}],"providers":[]}]}],"members":{}},"SdInputUploadFile":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":25,"character":1},"arguments":[{"selector":"sd-input-upload-file","template":"<mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-chip-list [formControl]=\"formControl\" #chipList>\r\n <ng-container *ngFor=\"let item of previewFiles\">\r\n <mat-chip *ngIf=\"item\" [removable]=\"!formControl.disabled\" (removed)=\"onRemove(item)\"\r\n [removable]=\"formControl.disabled\">\r\n <span>{{item.fileName || item.src}}</span>\r\n <mat-icon matChipRemove *ngIf=\"!formControl.disabled\">cancel</mat-icon>\r\n </mat-chip>\r\n </ng-container>\r\n <input [formControl]=\"inputControl\" [placeholder]=\"placeholder || label\" [matChipInputFor]=\"chipList\"\r\n autocomplete=\"off\" [errorStateMatcher]=\"matcher\" matInput>\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"onUpload()\" matSuffix>file_upload\r\n </mat-icon>\r\n </mat-chip-list>\r\n <mat-error *ngIf=\"formControl?.errors?.min\">\r\n {{formControl?.errors?.min}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.max\">\r\n {{formControl?.errors?.max}}\r\n </mat-error>\r\n</mat-form-field>","styles":[":host{display:block;padding-top:5px}"]}]}],"members":{"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"extensions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"min":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"max":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"maxSize":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"maxWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"maxHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":41,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":3}}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":52,"character":3}}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":58,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":59,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":66,"character":17},{"__symbolic":"reference","module":"@sd-angular/core/notify","name":"SdNotifyService","line":67,"character":27},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateService","line":68,"character":30}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"SdPreviewFile":{"__symbolic":"interface"}},"origins":{"SdInputUploadFileModule":"./src/lib/input-upload-file.module","SdInputUploadFile":"./src/lib/input-upload-file.component","SdPreviewFile":"./src/lib/input-upload-file.component"},"importAs":"@sd-angular/core/input-upload-file"}
1
+ {"__symbolic":"module","version":4,"metadata":{"SdInputUploadFileModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":12,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":14,"character":4},{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"ngx-device-detector","name":"DeviceDetectorModule","line":15,"character":4},"member":"forRoot"}},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/material/input","name":"MatInputModule","line":17,"character":4},{"__symbolic":"reference","module":"@angular/material/chips","name":"MatChipsModule","line":18,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":19,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":20,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":21,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/notify","name":"SdNotifyModule","line":22,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":23,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdInputUploadFile"}],"exports":[{"__symbolic":"reference","name":"SdInputUploadFile"}],"providers":[]}]}],"members":{}},"SdInputUploadFile":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":25,"character":1},"arguments":[{"selector":"sd-input-upload-file","template":"<mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-chip-list [formControl]=\"formControl\" #chipList>\r\n <ng-container *ngFor=\"let item of previewFiles\">\r\n <mat-chip *ngIf=\"item\" [removable]=\"!formControl.disabled\" (removed)=\"onRemove(item)\"\r\n [removable]=\"formControl.disabled\">\r\n <span>{{item.fileName || item.src}}</span>\r\n <mat-icon matChipRemove *ngIf=\"!formControl.disabled\">cancel</mat-icon>\r\n </mat-chip>\r\n </ng-container>\r\n <input [formControl]=\"inputControl\" [placeholder]=\"placeholder || label\" [matChipInputFor]=\"chipList\"\r\n autocomplete=\"off\" [errorStateMatcher]=\"matcher\" matInput>\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"onUpload()\" matSuffix>file_upload\r\n </mat-icon>\r\n </mat-chip-list>\r\n <mat-error *ngIf=\"formControl.errors?.required\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.min\">\r\n {{formControl?.errors?.min}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.max\">\r\n {{formControl?.errors?.max}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.inlineError\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{inlineError}}</ng-container>\r\n </mat-error>\r\n</mat-form-field>","styles":[":host{display:block;padding-top:5px}"]}]}],"members":{"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"extensions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"min":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":3}}]}],"max":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"maxSize":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"maxWidth":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":3}}]}],"maxHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":41,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":3}}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":52,"character":3}}]}],"_disableErrorMessage":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":59,"character":3},"arguments":["disableErrorMessage"]}]}],"_inlineError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":63,"character":3},"arguments":["inlineError"]}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":69,"character":3}}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":74,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":75,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":82,"character":17},{"__symbolic":"reference","module":"@sd-angular/core/notify","name":"SdNotifyService","line":83,"character":27},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateService","line":84,"character":30}]}],"ngOnInit":[{"__symbolic":"method"}],"customInlineErrorValidator":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"SdPreviewFile":{"__symbolic":"interface"}},"origins":{"SdInputUploadFileModule":"./src/lib/input-upload-file.module","SdInputUploadFile":"./src/lib/input-upload-file.component","SdPreviewFile":"./src/lib/input-upload-file.component"},"importAs":"@sd-angular/core/input-upload-file"}
@@ -2,7 +2,7 @@ import { EventEmitter, ChangeDetectorRef, AfterViewInit, OnInit, OnDestroy } fro
2
2
  import { SdNotifyService } from '@sd-angular/core/notify';
3
3
  import { SdTranslateService } from '@sd-angular/core/translate';
4
4
  import { ErrorStateMatcher } from '@angular/material/core';
5
- import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
5
+ import { FormControl, FormGroupDirective, NgForm, ValidatorFn } from '@angular/forms';
6
6
  declare class SdInputUploadFiletStateMatcher implements ErrorStateMatcher {
7
7
  private formControl;
8
8
  constructor(formControl: FormControl);
@@ -26,6 +26,12 @@ export declare class SdInputUploadFile implements OnInit, AfterViewInit, OnDestr
26
26
  maxHeight: number;
27
27
  set disabled(val: boolean | '');
28
28
  set model(model: (string | SdPreviewFile)[]);
29
+ disableErrorMessage: boolean;
30
+ set _disableErrorMessage(val: boolean | '');
31
+ inlineError: string;
32
+ set _inlineError(val: string);
33
+ isRequired: boolean;
34
+ set required(val: boolean | '');
29
35
  modelChange: EventEmitter<(string | SdPreviewFile)[]>;
30
36
  sdChange: EventEmitter<(string | SdPreviewFile)[]>;
31
37
  inputControl: FormControl;
@@ -33,6 +39,7 @@ export declare class SdInputUploadFile implements OnInit, AfterViewInit, OnDestr
33
39
  matcher: SdInputUploadFiletStateMatcher;
34
40
  constructor(ref: ChangeDetectorRef, notifyService: SdNotifyService, translateService: SdTranslateService);
35
41
  ngOnInit(): void;
42
+ customInlineErrorValidator(): ValidatorFn;
36
43
  ngAfterViewInit(): void;
37
44
  ngOnDestroy(): void;
38
45
  onUpload: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sd-angular/core",
3
- "version": "1.3.214",
3
+ "version": "1.3.217",
4
4
  "homepage": "https://www.facebook.com/DarkP3ter",
5
5
  "author": {
6
6
  "name": "darkpeter",
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"SdRadioModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":12,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":13,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":14,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":15,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/material/radio","name":"MatRadioModule","line":17,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":18,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdRadio"}],"exports":[{"__symbolic":"reference","name":"SdRadio"}],"providers":[]}]}],"members":{}},"SdRadio":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":7,"character":1},"arguments":[{"selector":"sd-radio","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":11,"character":19},"member":"OnPush"},"template":"<section [ngClass]=\"{'c-section': display == 'row'}\">\r\n <ng-container *ngIf=\"sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <label *ngIf=\"label&&!sdLabelDef?.templateRef\" class=\"d-block T14M\" [class.mb-0]=\"display === 'row'\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n <mat-radio-group [ngClass]=\"{'c-radio-group-column': display === 'column', 'c-radio-group-row': display === 'row'}\"\r\n [formControl]=\"formControl\">\r\n <mat-radio-button color=\"primary\" [ngClass]=\"{'m-0': display === 'column', 'mr-16': display === 'row'}\"\r\n *ngFor=\"let item of items\" [value]=\"item[valueField]\">\r\n {{item[displayField]}}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n</section>","styles":[":host{display:flex;flex-direction:column;height:100%}.c-section{align-content:center;align-items:center}.c-radio-group-column{align-items:flex-start;display:flex;flex:1;flex-direction:column}.c-radio-group-row{align-items:center;display:flex;flex:1;flex-direction:row}"]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":45,"character":3}}]}],"display":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":46,"character":3}}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3}}]}],"pItems":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":59,"character":3},"arguments":["items"]}]}],"valueField":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":65,"character":3}}]}],"displayField":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":66,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":70,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":75,"character":3}}]}],"sdLabelDef":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":83,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdLabelDefDirective","line":83,"character":16}]}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":84,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":85,"character":3}}]}],"sdSelection":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":86,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":89,"character":16}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}},"origins":{"SdRadioModule":"./src/lib/radio.module","SdRadio":"./src/lib/radio.component"},"importAs":"@sd-angular/core/radio"}
1
+ {"__symbolic":"module","version":4,"metadata":{"SdRadioModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":10,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":12,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":13,"character":4},{"__symbolic":"reference","module":"@angular/material/tooltip","name":"MatTooltipModule","line":14,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":15,"character":4},{"__symbolic":"reference","module":"@angular/material/icon","name":"MatIconModule","line":16,"character":4},{"__symbolic":"reference","module":"@angular/material/radio","name":"MatRadioModule","line":17,"character":4},{"__symbolic":"reference","module":"@sd-angular/core/translate","name":"SdTranslateModule","line":18,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdRadio"}],"exports":[{"__symbolic":"reference","name":"SdRadio"}],"providers":[]}]}],"members":{}},"SdRadio":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":7,"character":1},"arguments":[{"selector":"sd-radio","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":11,"character":19},"member":"OnPush"},"template":"<section [ngClass]=\"{'c-section': display == 'row'}\">\r\n <ng-container *ngIf=\"sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <label *ngIf=\"label&&!sdLabelDef?.templateRef\" class=\"d-block T14M\" [class.mb-0]=\"display === 'row'\">{{label}} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label>\r\n <mat-radio-group [ngClass]=\"{'c-radio-group-column': display === 'column', 'c-radio-group-row': display === 'row'}\"\r\n [formControl]=\"formControl\">\r\n <mat-radio-button color=\"primary\" [ngClass]=\"{'m-0': display === 'column', 'mr-16': display === 'row'}\"\r\n *ngFor=\"let item of items\" [value]=\"item[valueField]\">\r\n {{item[displayField]}}\r\n </mat-radio-button>\r\n </mat-radio-group>\r\n \r\n <mat-error *ngIf=\"formControl.errors?.inlineError && formControl?.touched\">\r\n {{inlineError}}\r\n </mat-error>\r\n</section>","styles":[":host{display:flex;flex-direction:column;height:100%}.c-section{align-content:center;align-items:center}.c-radio-group-column{align-items:flex-start;display:flex;flex:1;flex-direction:column}.c-radio-group-row{align-items:center;display:flex;flex:1;flex-direction:row}"]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":3}}]}],"placeholder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":45,"character":3}}]}],"display":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":46,"character":3}}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3}}]}],"pItems":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":59,"character":3},"arguments":["items"]}]}],"valueField":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":65,"character":3}}]}],"displayField":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":66,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":70,"character":3}}]}],"_inlineError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":76,"character":3},"arguments":["inlineError"]}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":82,"character":3}}]}],"sdLabelDef":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChild","line":90,"character":3},"arguments":[{"__symbolic":"reference","module":"@sd-angular/core/common","name":"SdLabelDefDirective","line":90,"character":16}]}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":91,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":92,"character":3}}]}],"sdSelection":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":93,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":96,"character":16}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"customInlineErrorValidator":[{"__symbolic":"method"}]}}},"origins":{"SdRadioModule":"./src/lib/radio.module","SdRadio":"./src/lib/radio.component"},"importAs":"@sd-angular/core/radio"}
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter, ChangeDetectorRef, AfterViewInit, OnDestroy, OnInit } from '@angular/core';
2
- import { NgForm, FormGroup } from '@angular/forms';
2
+ import { NgForm, ValidatorFn, FormGroup } from '@angular/forms';
3
3
  import { SdLabelDefDirective } from '@sd-angular/core/common';
4
4
  import { SdFormControl } from '@sd-angular/core/common';
5
5
  export declare class SdRadio implements OnInit, AfterViewInit, OnDestroy {
@@ -17,6 +17,8 @@ export declare class SdRadio implements OnInit, AfterViewInit, OnDestroy {
17
17
  valueField: string;
18
18
  displayField: string;
19
19
  set required(val: boolean | '');
20
+ inlineError: string;
21
+ set _inlineError(val: string);
20
22
  set disabled(val: boolean | '');
21
23
  sdLabelDef: SdLabelDefDirective;
22
24
  modelChange: EventEmitter<any>;
@@ -29,5 +31,6 @@ export declare class SdRadio implements OnInit, AfterViewInit, OnDestroy {
29
31
  ngOnInit(): void;
30
32
  ngAfterViewInit(): void;
31
33
  ngOnDestroy(): void;
34
+ customInlineErrorValidator(): ValidatorFn;
32
35
  reValidate: () => void;
33
36
  }
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"SdSwitchModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":6,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":8,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":9,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":10,"character":4},{"__symbolic":"reference","module":"@angular/material/slide-toggle","name":"MatSlideToggleModule","line":11,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdSwitch"}],"exports":[{"__symbolic":"reference","name":"SdSwitch"}]}]}],"members":{}},"SdSwitch":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"sd-switch","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":9,"character":19},"member":"OnPush"},"template":"<mat-slide-toggle [formControl]=\"formControl\" [color]=\"color\"><span\r\n class=\"c-label\">{{label}}</span></mat-slide-toggle>","styles":[""]}]}],"members":{"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":3}}]}],"color":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":43,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":44,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":47,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}},"origins":{"SdSwitchModule":"./src/lib/switch.module","SdSwitch":"./src/lib/switch.component"},"importAs":"@sd-angular/core/switch"}
1
+ {"__symbolic":"module","version":4,"metadata":{"SdSwitchModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":9,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":10,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":11,"character":4},{"__symbolic":"reference","module":"@angular/material/slide-toggle","name":"MatSlideToggleModule","line":12,"character":4},{"__symbolic":"reference","module":"@angular/material/form-field","name":"MatFormFieldModule","line":13,"character":4}],"declarations":[{"__symbolic":"reference","name":"SdSwitch"}],"exports":[{"__symbolic":"reference","name":"SdSwitch"}]}]}],"members":{}},"SdSwitch":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":5,"character":1},"arguments":[{"selector":"sd-switch","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":9,"character":19},"member":"OnPush"},"template":"<mat-slide-toggle [formControl]=\"formControl\" [color]=\"color\"><span\r\n class=\"c-label\">{{label}}</span></mat-slide-toggle>\r\n <mat-error *ngIf=\"formControl.errors?.inlineError && formControl?.touched\">\r\n {{inlineError}}\r\n </mat-error>","styles":[""]}]}],"members":{"size":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":3}}]}],"color":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":26,"character":3}}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"_inlineError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":3},"arguments":["inlineError"]}]}],"modelChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":49,"character":3}}]}],"sdChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":50,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":53,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"customInlineErrorValidator":[{"__symbolic":"method"}]}}},"origins":{"SdSwitchModule":"./src/lib/switch.module","SdSwitch":"./src/lib/switch.component"},"importAs":"@sd-angular/core/switch"}
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter, ChangeDetectorRef } from '@angular/core';
2
- import { FormControl, FormGroup, NgForm } from '@angular/forms';
2
+ import { FormControl, FormGroup, NgForm, ValidatorFn } from '@angular/forms';
3
3
  export declare class SdSwitch {
4
4
  #private;
5
5
  private ref;
@@ -9,6 +9,8 @@ export declare class SdSwitch {
9
9
  color: 'primary' | 'warn';
10
10
  set disabled(val: boolean | '');
11
11
  set model(value: any);
12
+ inlineError: string;
13
+ set _inlineError(val: string);
12
14
  modelChange: EventEmitter<any>;
13
15
  sdChange: EventEmitter<any>;
14
16
  formControl: FormControl;
@@ -16,4 +18,5 @@ export declare class SdSwitch {
16
18
  ngOnInit(): void;
17
19
  ngAfterViewInit(): void;
18
20
  ngOnDestroy(): void;
21
+ customInlineErrorValidator(): ValidatorFn;
19
22
  }