@sd-angular/core 1.3.213 → 1.3.216

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 (140) hide show
  1. package/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
  2. package/autocomplete/src/lib/autocomplete.component.d.ts +4 -1
  3. package/bundles/sd-angular-core-autocomplete.umd.js +22 -2
  4. package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
  5. package/bundles/sd-angular-core-autocomplete.umd.min.js +2 -2
  6. package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
  7. package/bundles/sd-angular-core-checkbox.umd.js +29 -3
  8. package/bundles/sd-angular-core-checkbox.umd.js.map +1 -1
  9. package/bundles/sd-angular-core-checkbox.umd.min.js +2 -2
  10. package/bundles/sd-angular-core-checkbox.umd.min.js.map +1 -1
  11. package/bundles/sd-angular-core-date-month.umd.js +23 -1
  12. package/bundles/sd-angular-core-date-month.umd.js.map +1 -1
  13. package/bundles/sd-angular-core-date-month.umd.min.js +2 -2
  14. package/bundles/sd-angular-core-date-month.umd.min.js.map +1 -1
  15. package/bundles/sd-angular-core-date-time.umd.js +24 -1
  16. package/bundles/sd-angular-core-date-time.umd.js.map +1 -1
  17. package/bundles/sd-angular-core-date-time.umd.min.js +1 -1
  18. package/bundles/sd-angular-core-date-time.umd.min.js.map +1 -1
  19. package/bundles/sd-angular-core-editor.umd.js +23 -3
  20. package/bundles/sd-angular-core-editor.umd.js.map +1 -1
  21. package/bundles/sd-angular-core-editor.umd.min.js +1 -1
  22. package/bundles/sd-angular-core-editor.umd.min.js.map +1 -1
  23. package/bundles/sd-angular-core-input-currency.umd.js +22 -2
  24. package/bundles/sd-angular-core-input-currency.umd.js.map +1 -1
  25. package/bundles/sd-angular-core-input-currency.umd.min.js +1 -1
  26. package/bundles/sd-angular-core-input-currency.umd.min.js.map +1 -1
  27. package/bundles/sd-angular-core-input-dropdown.umd.js +22 -2
  28. package/bundles/sd-angular-core-input-dropdown.umd.js.map +1 -1
  29. package/bundles/sd-angular-core-input-dropdown.umd.min.js +1 -1
  30. package/bundles/sd-angular-core-input-dropdown.umd.min.js.map +1 -1
  31. package/bundles/sd-angular-core-input-number.umd.js +25 -2
  32. package/bundles/sd-angular-core-input-number.umd.js.map +1 -1
  33. package/bundles/sd-angular-core-input-number.umd.min.js +2 -2
  34. package/bundles/sd-angular-core-input-number.umd.min.js.map +1 -1
  35. package/bundles/sd-angular-core-input.umd.js +33 -3
  36. package/bundles/sd-angular-core-input.umd.js.map +1 -1
  37. package/bundles/sd-angular-core-input.umd.min.js +2 -2
  38. package/bundles/sd-angular-core-input.umd.min.js.map +1 -1
  39. package/bundles/sd-angular-core-radio.umd.js +22 -2
  40. package/bundles/sd-angular-core-radio.umd.js.map +1 -1
  41. package/bundles/sd-angular-core-radio.umd.min.js +2 -2
  42. package/bundles/sd-angular-core-radio.umd.min.js.map +1 -1
  43. package/bundles/sd-angular-core-select-editor.umd.js +1 -1
  44. package/bundles/sd-angular-core-select-editor.umd.js.map +1 -1
  45. package/bundles/sd-angular-core-select-editor.umd.min.js +2 -2
  46. package/bundles/sd-angular-core-select-editor.umd.min.js.map +1 -1
  47. package/bundles/sd-angular-core-select.umd.js +22 -2
  48. package/bundles/sd-angular-core-select.umd.js.map +1 -1
  49. package/bundles/sd-angular-core-select.umd.min.js +2 -2
  50. package/bundles/sd-angular-core-select.umd.min.js.map +1 -1
  51. package/bundles/sd-angular-core-switch.umd.js +34 -7
  52. package/bundles/sd-angular-core-switch.umd.js.map +1 -1
  53. package/bundles/sd-angular-core-switch.umd.min.js +2 -2
  54. package/bundles/sd-angular-core-switch.umd.min.js.map +1 -1
  55. package/bundles/sd-angular-core-table.umd.js +95 -77
  56. package/bundles/sd-angular-core-table.umd.js.map +1 -1
  57. package/bundles/sd-angular-core-table.umd.min.js +1 -1
  58. package/bundles/sd-angular-core-table.umd.min.js.map +1 -1
  59. package/bundles/sd-angular-core-textarea.umd.js +22 -2
  60. package/bundles/sd-angular-core-textarea.umd.js.map +1 -1
  61. package/bundles/sd-angular-core-textarea.umd.min.js +1 -1
  62. package/bundles/sd-angular-core-textarea.umd.min.js.map +1 -1
  63. package/checkbox/sd-angular-core-checkbox.metadata.json +1 -1
  64. package/checkbox/src/lib/checkbox.component.d.ts +4 -1
  65. package/date-month/sd-angular-core-date-month.metadata.json +1 -1
  66. package/date-month/src/lib/date-month.component.d.ts +4 -1
  67. package/date-time/sd-angular-core-date-time.metadata.json +1 -1
  68. package/date-time/src/lib/date-time.component.d.ts +4 -1
  69. package/editor/sd-angular-core-editor.metadata.json +1 -1
  70. package/editor/src/lib/editor.component.d.ts +4 -1
  71. package/esm2015/autocomplete/src/lib/autocomplete.component.js +19 -3
  72. package/esm2015/checkbox/src/lib/checkbox.component.js +26 -4
  73. package/esm2015/date-month/src/lib/date-month.component.js +20 -2
  74. package/esm2015/date-time/src/lib/date-time.component.js +21 -2
  75. package/esm2015/editor/src/lib/editor.component.js +20 -4
  76. package/esm2015/input/src/lib/input.component.js +28 -3
  77. package/esm2015/input-currency/src/lib/input-currency.component.js +19 -3
  78. package/esm2015/input-dropdown/src/lib/input.component.js +19 -3
  79. package/esm2015/input-number/src/lib/input-number.component.js +22 -3
  80. package/esm2015/radio/src/lib/radio.component.js +19 -3
  81. package/esm2015/select/src/lib/select.component.js +19 -3
  82. package/esm2015/select-editor/src/lib/select-editor.component.js +2 -2
  83. package/esm2015/switch/src/lib/switch.component.js +26 -4
  84. package/esm2015/switch/src/lib/switch.module.js +3 -1
  85. package/esm2015/table/src/lib/components/column-inline-filter/column-inline-filter.component.js +1 -1
  86. package/esm2015/table/src/lib/models/table-column.model.js +1 -1
  87. package/esm2015/table/src/lib/services/table-filter/table-filter.service.js +19 -7
  88. package/esm2015/table/src/lib/table.component.js +5 -2
  89. package/esm2015/textarea/src/lib/textarea.component.js +19 -3
  90. package/fesm2015/sd-angular-core-autocomplete.js +18 -2
  91. package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
  92. package/fesm2015/sd-angular-core-checkbox.js +25 -3
  93. package/fesm2015/sd-angular-core-checkbox.js.map +1 -1
  94. package/fesm2015/sd-angular-core-date-month.js +19 -1
  95. package/fesm2015/sd-angular-core-date-month.js.map +1 -1
  96. package/fesm2015/sd-angular-core-date-time.js +20 -1
  97. package/fesm2015/sd-angular-core-date-time.js.map +1 -1
  98. package/fesm2015/sd-angular-core-editor.js +19 -3
  99. package/fesm2015/sd-angular-core-editor.js.map +1 -1
  100. package/fesm2015/sd-angular-core-input-currency.js +18 -2
  101. package/fesm2015/sd-angular-core-input-currency.js.map +1 -1
  102. package/fesm2015/sd-angular-core-input-dropdown.js +18 -2
  103. package/fesm2015/sd-angular-core-input-dropdown.js.map +1 -1
  104. package/fesm2015/sd-angular-core-input-number.js +21 -2
  105. package/fesm2015/sd-angular-core-input-number.js.map +1 -1
  106. package/fesm2015/sd-angular-core-input.js +29 -4
  107. package/fesm2015/sd-angular-core-input.js.map +1 -1
  108. package/fesm2015/sd-angular-core-radio.js +18 -2
  109. package/fesm2015/sd-angular-core-radio.js.map +1 -1
  110. package/fesm2015/sd-angular-core-select-editor.js +1 -1
  111. package/fesm2015/sd-angular-core-select-editor.js.map +1 -1
  112. package/fesm2015/sd-angular-core-select.js +18 -2
  113. package/fesm2015/sd-angular-core-select.js.map +1 -1
  114. package/fesm2015/sd-angular-core-switch.js +27 -3
  115. package/fesm2015/sd-angular-core-switch.js.map +1 -1
  116. package/fesm2015/sd-angular-core-table.js +22 -7
  117. package/fesm2015/sd-angular-core-table.js.map +1 -1
  118. package/fesm2015/sd-angular-core-textarea.js +18 -2
  119. package/fesm2015/sd-angular-core-textarea.js.map +1 -1
  120. package/input/sd-angular-core-input.metadata.json +1 -1
  121. package/input/src/lib/input.component.d.ts +5 -1
  122. package/input-currency/sd-angular-core-input-currency.metadata.json +1 -1
  123. package/input-currency/src/lib/input-currency.component.d.ts +4 -1
  124. package/input-dropdown/sd-angular-core-input-dropdown.metadata.json +1 -1
  125. package/input-dropdown/src/lib/input.component.d.ts +4 -1
  126. package/input-number/sd-angular-core-input-number.metadata.json +1 -1
  127. package/input-number/src/lib/input-number.component.d.ts +5 -1
  128. package/package.json +1 -1
  129. package/radio/sd-angular-core-radio.metadata.json +1 -1
  130. package/radio/src/lib/radio.component.d.ts +4 -1
  131. package/{sd-angular-core-1.3.213.tgz → sd-angular-core-1.3.216.tgz} +0 -0
  132. package/select/sd-angular-core-select.metadata.json +1 -1
  133. package/select/src/lib/select.component.d.ts +4 -1
  134. package/select-editor/sd-angular-core-select-editor.metadata.json +1 -1
  135. package/switch/sd-angular-core-switch.metadata.json +1 -1
  136. package/switch/src/lib/switch.component.d.ts +4 -1
  137. package/table/sd-angular-core-table.metadata.json +1 -1
  138. package/table/src/lib/models/table-column.model.d.ts +1 -0
  139. package/textarea/sd-angular-core-textarea.metadata.json +1 -1
  140. package/textarea/src/lib/textarea.component.d.ts +4 -1
@@ -81,13 +81,18 @@ class SdInput {
81
81
  if (__classPrivateFieldGet(this, _pattern)) {
82
82
  validators.push(Validators.pattern(__classPrivateFieldGet(this, _pattern)));
83
83
  }
84
+ if (this.inlineError) {
85
+ validators.push(this.customInlineErrorValidator());
86
+ }
84
87
  if (__classPrivateFieldGet(this, _validator)) {
85
88
  asyncValidators.push(__classPrivateFieldGet(this, _customValidator).call(this, __classPrivateFieldGet(this, _validator)));
86
89
  }
87
90
  this.formControl.setValidators(validators);
88
91
  this.formControl.setAsyncValidators(asyncValidators);
89
92
  this.formControl.updateValueAndValidity();
90
- });
93
+ }
94
+ // Hàm tạo Validators tùy chỉnh cho inlineError
95
+ );
91
96
  _onChange.set(this, (value) => {
92
97
  this.modelChange.emit(this.formControl.value);
93
98
  this.sdChange.emit(this.formControl.value);
@@ -231,6 +236,10 @@ class SdInput {
231
236
  __classPrivateFieldSet(this, _validator, validator);
232
237
  __classPrivateFieldGet(this, _updateValidator).call(this);
233
238
  }
239
+ set _inlineError(val) {
240
+ this.inlineError = val;
241
+ __classPrivateFieldGet(this, _updateValidator).call(this);
242
+ }
234
243
  // Optional
235
244
  set disabled(val) {
236
245
  val = (val === '') || val;
@@ -266,6 +275,12 @@ class SdInput {
266
275
  (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
267
276
  __classPrivateFieldGet(this, _subscription).unsubscribe();
268
277
  }
278
+ // Hàm tạo Validators tùy chỉnh cho inlineError
279
+ customInlineErrorValidator() {
280
+ return (control) => {
281
+ return { inlineError: true };
282
+ };
283
+ }
269
284
  onCopyText() {
270
285
  SdUtility.copyToClipboard(__classPrivateFieldGet(this, _model));
271
286
  this.copied = true;
@@ -278,7 +293,7 @@ _name = new WeakMap(), _form = new WeakMap(), _blurOnEnter_1 = new WeakMap(), _m
278
293
  SdInput.decorators = [
279
294
  { type: Component, args: [{
280
295
  selector: 'sd-input',
281
- 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\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <input aria-hidden=\"true\" [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\"\r\n [step]=\"1\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" [sdPopoverTriggerFor]=\"null\"\r\n [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\">\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 <span class=\"mr-1\" *ngIf=\"maxlength && !formControl.disabled\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\" formControl.errors?.maxlength\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Max length' | sdTranslate}} {{maxlength}}\r\n </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Pattern error' | sdTranslate}}</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-form-field>\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n </ng-template>\r\n</div>\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?.maxlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </span>\r\n <span *ngIf=\"formControl.errors?.pattern\">\r\n {{'Pattern error' | sdTranslate}}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->",
296
+ 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\"\r\n [ngClass]=\"{'sd-form-tooltip':tooltip, 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <input aria-hidden=\"true\" [id]=\"id\" [formControl]=\"formControl\" [type]=\"type\" #control matInput\r\n [placeholder]=\"placeholder || (appearance ? label : '')\" (keyup.enter)=\"onKeyupEnter()\" (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\" [required]=\"isRequired\" [readonly]=\"isReadonly\" [autocomplete]=\"id\" autocorrect=\"off\"\r\n [step]=\"1\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" [sdPopoverTriggerFor]=\"null\"\r\n [sdPopoverDisabled]=\"!disableErrorMessage || formControl.valid\">\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 <span class=\"mr-1\" *ngIf=\"maxlength && !formControl.disabled\" matSuffix>{{formControl.value?.length || 0}}/{{maxlength}}</span>\r\n <ng-container *ngIf=\"sdInputSuffix?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdInputSuffix.templateRef\">\r\n </ng-container>\r\n </ng-container>\r\n <mat-icon *ngIf=\"!hideIcon && sdClickIcon?.observers?.length\" (click)=\"onClickIcon($event)\"\r\n class=\"pointer sd-suffix-icon\" matSuffix>\r\n {{icon}}\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ \"This field is required\" | sdTranslate }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\" formControl.errors?.maxlength\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Max length' | sdTranslate}} {{maxlength}}\r\n </ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.pattern\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{'Pattern error' | sdTranslate}}</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\r\n <div *ngIf=\"tooltip\" class=\"sd-tooltip\">\r\n <mat-icon (click)=\"sdTooltip.toggle()\" [matTooltip]=\"formControl.value | sdInputTooltipPipe:tooltip\" matSuffix\r\n #sdTooltip=\"matTooltip\">info</mat-icon>\r\n </div>\r\n </ng-template>\r\n</div>\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?.maxlength\">\r\n {{'Max length' | sdTranslate}} <strong>{{maxlength}}</strong>\r\n </span>\r\n <span *ngIf=\"formControl.errors?.pattern\">\r\n {{'Pattern error' | sdTranslate}}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->",
282
297
  changeDetection: ChangeDetectionStrategy.OnPush,
283
298
  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}"]
284
299
  },] }
@@ -306,6 +321,7 @@ SdInput.propDecorators = {
306
321
  pMaxlength: [{ type: Input, args: ['maxlength',] }],
307
322
  pattern: [{ type: Input }],
308
323
  validator: [{ type: Input }],
324
+ _inlineError: [{ type: Input, args: ['inlineError',] }],
309
325
  disabled: [{ type: Input }],
310
326
  icon: [{ type: Input }],
311
327
  _hideIcon: [{ type: Input, args: ['hideIcon',] }],
@@ -322,7 +338,16 @@ SdInput.propDecorators = {
322
338
  sdView: [{ type: ContentChild, args: [SdViewDefDirective,] }],
323
339
  copyTooltip: [{ type: ViewChild, args: ['copyTooltip',] }],
324
340
  _copyable: [{ type: Input, args: ['copyable',] }]
325
- };
341
+ };
342
+ function backendErrorValidator(backendErrorMessage) {
343
+ return (control) => {
344
+ const value = control.value;
345
+ if (value === backendErrorMessage) {
346
+ return { backendError: true };
347
+ }
348
+ return null;
349
+ };
350
+ }
326
351
 
327
352
  class SdInputTooltipPipe {
328
353
  transform(value, tooltip) {
@@ -395,5 +420,5 @@ SdInputModule.decorators = [
395
420
  * Generated bundle index. Do not edit.
396
421
  */
397
422
 
398
- export { SdInput, SdInputModule, SdInputSuffixDirective, SdInputTooltipPipe, TouchDirective as ɵa };
423
+ export { SdInput, SdInputModule, SdInputSuffixDirective, SdInputTooltipPipe, backendErrorValidator, TouchDirective as ɵa };
399
424
  //# sourceMappingURL=sd-angular-core-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-input.js","sources":["../../../../projects/sd-core/input/src/lib/directives/input-suffix.directive.ts","../../../../projects/sd-core/input/src/lib/input.component.ts","../../../../projects/sd-core/input/src/lib/input-tooltip.pipe.ts","../../../../projects/sd-core/input/src/lib/directives/touch.directive.ts","../../../../projects/sd-core/input/src/lib/input.module.ts","../../../../projects/sd-core/input/src/public-api.ts","../../../../projects/sd-core/input/sd-angular-core-input.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdInputSuffix]'\r\n})\r\nexport class SdInputSuffixDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport { debounceTime, filter } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective, SdLabelDefDirective } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FORM_CONFIG } from '@sd-angular/core/common';\r\nimport { IFormConfiguration } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\n@Component({\r\n selector: 'sd-input',\r\n templateUrl: './input.component.html',\r\n styleUrls: ['./input.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInput implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() appearance: MatFormFieldAppearance;\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n qcId: string;\r\n label: string;\r\n @Input('label') set _label(val: string) {\r\n this.label = val;\r\n this.qcId = hash({\r\n selector: 'sd-input',\r\n label: val\r\n });\r\n };\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' | 'datetime-local' | 'month' = 'text';\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n // Optional\r\n @Input() set disabled(val: boolean | '') {\r\n val = (val === '') || val;\r\n if (val) {\r\n this.formControl.disable();\r\n } else {\r\n this.formControl.enable();\r\n }\r\n }\r\n @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdBlur = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n @ViewChild('copyTooltip') copyTooltip: MatTooltip;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n copied = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #onChange = (value: any) => {\r\n this.modelChange.emit(this.formControl.value);\r\n this.sdChange.emit(this.formControl.value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n if (this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onClickIcon = (event: Event) => {\r\n event?.preventDefault();\r\n event?.stopPropagation();\r\n this.sdClickIcon.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.sdBlur.emit(this.formControl.value);\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n onCopyText() {\r\n SdUtility.copyToClipboard(this.#model);\r\n this.copied = true;\r\n setTimeout(() => {\r\n this.copied = false;\r\n }, 2000);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n MatButtonModule\r\n ],\r\n declarations: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n TouchDirective\r\n ],\r\n exports: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n SdCommonModule\r\n ]\r\n})\r\nexport class SdInputModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input.module';\r\nexport * from './lib/input-tooltip.pipe';\r\nexport * from './lib/directives/input-suffix.directive';\r\nexport * from './lib/input.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {TouchDirective as ɵa} from './src/lib/directives/touch.directive';"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;MAKa,sBAAsB;IACjC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,iBAAiB;aAC5B;;;YAJmB,WAAW;;;;MCoClB,OAAO;IAwHlB,YACU,GAAsB,EACW,UAA8B,EAC/D,cAAgC;QAFhC,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QAC/D,mBAAc,GAAd,cAAc,CAAkB;QA1H1C,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAQlB,wBAAiB;QAoBR,SAAI,GAA0E,MAAM,CAAC;QAC9F,wBAAmB,GAAG,KAAK,CAAC;QAI5B,yBAAe,KAAK,EAAC;QAIrB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAG3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAAU,GAAG,KAAK,CAAC;QAenB,2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BACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;aACF;;;AC1CD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-input.js","sources":["../../../../projects/sd-core/input/src/lib/directives/input-suffix.directive.ts","../../../../projects/sd-core/input/src/lib/input.component.ts","../../../../projects/sd-core/input/src/lib/input-tooltip.pipe.ts","../../../../projects/sd-core/input/src/lib/directives/touch.directive.ts","../../../../projects/sd-core/input/src/lib/input.module.ts","../../../../projects/sd-core/input/src/public-api.ts","../../../../projects/sd-core/input/sd-angular-core-input.ts"],"sourcesContent":["import { Directive, TemplateRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[sdInputSuffix]'\r\n})\r\nexport class SdInputSuffixDirective {\r\n constructor(public templateRef: TemplateRef<any>) { }\r\n}\r\n","import {\r\n Component,\r\n Input,\r\n ViewChild,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n AfterViewInit,\r\n ElementRef,\r\n OnInit,\r\n ContentChild,\r\n ChangeDetectionStrategy,\r\n HostListener,\r\n Inject,\r\n Optional\r\n} from '@angular/core';\r\nimport { AbstractControl, NgForm, ValidatorFn, Validators, AsyncValidatorFn, FormGroup } from '@angular/forms';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport { debounceTime, filter } from 'rxjs/operators';\r\nimport { Subscription } from 'rxjs';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { SdFormControl } from '@sd-angular/core/common';\r\nimport { SdViewDefDirective, SdLabelDefDirective } from '@sd-angular/core/common';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FORM_CONFIG } from '@sd-angular/core/common';\r\nimport { IFormConfiguration } from '@sd-angular/core/common';\r\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\n@Component({\r\n selector: 'sd-input',\r\n templateUrl: './input.component.html',\r\n styleUrls: ['./input.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdInput implements OnDestroy, OnInit, AfterViewInit {\r\n id = `I${uuid.v4()}`;\r\n #name = uuid.v4();\r\n @Input() set name(val: string) {\r\n if (val) {\r\n this.#name = val;\r\n }\r\n }\r\n @Input() appearance: MatFormFieldAppearance;\r\n @Input() size: 'sm' | 'lg';\r\n #form: FormGroup;\r\n @Input() set form(val: NgForm | FormGroup) {\r\n if (val) {\r\n if (val instanceof NgForm) {\r\n this.#form = val.form;\r\n } else {\r\n this.#form = val;\r\n }\r\n }\r\n }\r\n qcId: string;\r\n label: string;\r\n @Input('label') set _label(val: string) {\r\n this.label = val;\r\n this.qcId = hash({\r\n selector: 'sd-input',\r\n label: val\r\n });\r\n };\r\n @Input() placeholder: string;\r\n @Input() type: 'text' | 'number' | 'password' | 'email' | 'datetime-local' | 'month' = 'text';\r\n disableErrorMessage = false;\r\n @Input('disableErrorMessage') set _disableErrorMessage(val: boolean | '') {\r\n this.disableErrorMessage = (val === '') || val;\r\n }\r\n #blurOnEnter = false;\r\n @Input('blurOnEnter') set _blurOnEnter(val: boolean | '') {\r\n this.#blurOnEnter = (val === '') || val;\r\n }\r\n #model: any;\r\n @Input() set model(value: any) {\r\n if (this.#model !== value) {\r\n this.#model = value;\r\n this.formControl.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n @Output() modelChange = new EventEmitter();\r\n\r\n // Validator\r\n \r\n isRequired = false;\r\n @Input() set required(val: boolean | '') {\r\n this.isRequired = (val === '') || val;\r\n this.#updateValidator();\r\n }\r\n\r\n isReadonly = false;\r\n @Input() set readonly(val: boolean | '') {\r\n this.isReadonly = (val === '') || val;\r\n }\r\n\r\n minlength: number;\r\n @Input('minlength') set pMinlength(val: number) {\r\n this.minlength = +val;\r\n this.#updateValidator();\r\n }\r\n maxlength: number;\r\n @Input('maxlength') set pMaxlength(val: number) {\r\n this.maxlength = +val;\r\n this.#updateValidator();\r\n }\r\n #pattern: string;\r\n @Input() set pattern(val: string) {\r\n this.#pattern = val;\r\n this.#updateValidator();\r\n }\r\n #validator: (value: any) => string | Promise<string>;\r\n @Input() set validator(validator: (value: any) => string | Promise<string>) {\r\n this.#validator = validator;\r\n this.#updateValidator();\r\n }\r\n\r\n 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 @Input() icon = 'search';\r\n hideIcon = false;\r\n @Input('hideIcon') set _hideIcon(val: boolean | '') {\r\n this.hideIcon = (val === '') || val;\r\n val = (val === '') || val;\r\n }\r\n @Output() sdClickIcon = new EventEmitter<any>();\r\n @Input() tooltip: string | ((inputValue: string) => string);\r\n @Output() sdChange = new EventEmitter<any>();\r\n @Output() sdFocus = new EventEmitter<any>();\r\n @Output() sdBlur = new EventEmitter<any>();\r\n @Output() sdFocusForceBlur = new EventEmitter<any>();\r\n @Output() keyupEnter = new EventEmitter();\r\n\r\n @ViewChild('control') control: ElementRef;\r\n @ContentChild(SdInputSuffixDirective) sdInputSuffix: SdInputSuffixDirective;\r\n @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n\r\n formControl = new SdFormControl();\r\n #subscription = new Subscription();\r\n @ContentChild(SdViewDefDirective) sdView: SdViewDefDirective;\r\n isFocused = false;\r\n @ViewChild('copyTooltip') copyTooltip: MatTooltip;\r\n copyable = false;\r\n @Input('copyable') set _copyable(val: boolean | '') {\r\n this.copyable = (val === '') || val;\r\n }\r\n copied = false;\r\n constructor(\r\n private ref: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG) @Optional() private formConfig: IFormConfiguration,\r\n private utilityService: SdUtilityService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.appearance = this.appearance || this.formConfig?.appearance;\r\n this.#subscription.add(this.formControl.sdChanges.subscribe(() => {\r\n this.ref.markForCheck();\r\n }));\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.#subscription.add(this.formControl.valueChanges.subscribe(this.#onChange));\r\n this.#form?.addControl(this.#name, this.formControl);\r\n this.ref.detectChanges();\r\n }\r\n\r\n ngOnDestroy() {\r\n this.#form?.removeControl(this.#name);\r\n this.#subscription.unsubscribe();\r\n }\r\n\r\n reValidate = () => {\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n #updateValidator = () => {\r\n\r\n this.formControl.clearValidators();\r\n this.formControl.clearAsyncValidators();\r\n const validators: ValidatorFn[] = [];\r\n const asyncValidators: AsyncValidatorFn[] = [];\r\n if (this.isRequired) {\r\n validators.push(Validators.required);\r\n }\r\n if (this.minlength > 0) {\r\n validators.push(Validators.minLength(this.minlength));\r\n }\r\n if (this.maxlength > 0) {\r\n validators.push(Validators.maxLength(this.maxlength));\r\n }\r\n if (this.#pattern) {\r\n validators.push(Validators.pattern(this.#pattern));\r\n }\r\n if (this.inlineError) {\r\n validators.push(this.customInlineErrorValidator());\r\n }\r\n if (this.#validator) {\r\n asyncValidators.push(this.#customValidator(this.#validator));\r\n }\r\n this.formControl.setValidators(validators);\r\n this.formControl.setAsyncValidators(asyncValidators);\r\n this.formControl.updateValueAndValidity();\r\n }\r\n\r\n \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 #onChange = (value: any) => {\r\n this.modelChange.emit(this.formControl.value);\r\n this.sdChange.emit(this.formControl.value);\r\n }\r\n\r\n onKeyupEnter = () => {\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.keyupEnter.emit(this.formControl.value);\r\n if (this.#blurOnEnter) {\r\n this.blur();\r\n }\r\n }\r\n\r\n onClickIcon = (event: Event) => {\r\n event?.preventDefault();\r\n event?.stopPropagation();\r\n this.sdClickIcon.emit(this.formControl.value);\r\n }\r\n\r\n onFocus = () => {\r\n this.isFocused = true;\r\n this.sdFocus.emit();\r\n \r\n if (this.sdFocusForceBlur.observers?.length > 0) {\r\n this.blur();\r\n this.sdFocusForceBlur.emit();\r\n }\r\n }\r\n\r\n onBlur = () => {\r\n this.isFocused = false;\r\n const val: string = (this.formControl.value ?? '').toString();\r\n if (val.length > val.trim().length) {\r\n this.formControl.setValue(val.trim());\r\n }\r\n this.sdBlur.emit(this.formControl.value);\r\n }\r\n\r\n onClick = () => {\r\n if (this.sdView?.templateRef) {\r\n if (!this.formControl.disabled && !this.isFocused) {\r\n this.focus();\r\n }\r\n }\r\n }\r\n\r\n blur = () => {\r\n this.isFocused = false;\r\n this.control?.nativeElement?.blur();\r\n }\r\n\r\n focus = () => {\r\n this.isFocused = true;\r\n setTimeout(() => {\r\n this.control?.nativeElement?.focus();\r\n }, 100);\r\n }\r\n\r\n #customValidator = (func: (value: any) => string | Promise<string>): AsyncValidatorFn => {\r\n return async (c: AbstractControl): Promise<{ [key: string]: any } | null> => {\r\n const value = c.value || null;\r\n if (func && typeof (func) === 'function') {\r\n const result = func(value);\r\n if (result instanceof Promise) {\r\n const message = await result;\r\n if (message) {\r\n return {\r\n customValidator: message\r\n };\r\n }\r\n return null;\r\n }\r\n if (result) {\r\n return {\r\n customValidator: result\r\n };\r\n }\r\n return null;\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n onCopyText() {\r\n SdUtility.copyToClipboard(this.#model);\r\n this.copied = true;\r\n setTimeout(() => {\r\n this.copied = false;\r\n }, 2000);\r\n }\r\n}\r\n\r\nexport function backendErrorValidator(backendErrorMessage: string): ValidatorFn {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n const value = control.value as string;\r\n\r\n if (value === backendErrorMessage) {\r\n return { backendError: true };\r\n }\r\n\r\n return null;\r\n };\r\n}","import { Pipe, PipeTransform } from '@angular/core';\r\n@Pipe({\r\n name: 'sdInputTooltipPipe'\r\n})\r\nexport class SdInputTooltipPipe implements PipeTransform {\r\n transform(value: any, tooltip: string | ((inputValue: string) => string)): string {\r\n if (typeof (tooltip) === 'string') {\r\n return tooltip;\r\n }\r\n return tooltip(value);\r\n }\r\n}\r\n","import { ChangeDetectorRef, Directive, Input, OnChanges, SimpleChanges } from \"@angular/core\";\r\n\r\n@Directive({\r\n selector: '[touch]'\r\n})\r\nexport class TouchDirective implements OnChanges {\r\n @Input() public touch: any;\r\n @Input() public ref: ChangeDetectorRef;\r\n\r\n ngOnChanges(changes: SimpleChanges){\r\n if(changes.touch){\r\n this.ref.markForCheck();\r\n }\r\n }\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdInput } from './input.component';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { SdInputTooltipPipe } from './input-tooltip.pipe';\r\nimport { SdInputSuffixDirective } from './directives/input-suffix.directive';\r\nimport { TouchDirective } from './directives/touch.directive';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { SdPopoverModule } from '@sd-angular/core/popover';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatInputModule,\r\n MatIconModule,\r\n MatTooltipModule,\r\n SdTranslateModule,\r\n SdCommonModule,\r\n SdPopoverModule,\r\n MatButtonModule\r\n ],\r\n declarations: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n TouchDirective\r\n ],\r\n exports: [\r\n SdInput,\r\n SdInputTooltipPipe,\r\n SdInputSuffixDirective,\r\n SdCommonModule\r\n ]\r\n})\r\nexport class SdInputModule { }\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/input.module';\r\nexport * from './lib/input-tooltip.pipe';\r\nexport * from './lib/directives/input-suffix.directive';\r\nexport * from './lib/input.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {TouchDirective as ɵa} from './src/lib/directives/touch.directive';"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;;;;MAKa,sBAAsB;IACjC,YAAmB,WAA6B;QAA7B,gBAAW,GAAX,WAAW,CAAkB;KAAK;;;YAJtD,SAAS,SAAC;gBACT,QAAQ,EAAE,iBAAiB;aAC5B;;;YAJmB,WAAW;;;;MCoClB,OAAO;IA+HlB,YACU,GAAsB,EACW,UAA8B,EAC/D,cAAgC;QAFhC,QAAG,GAAH,GAAG,CAAmB;QACW,eAAU,GAAV,UAAU,CAAoB;QAC/D,mBAAc,GAAd,cAAc,CAAkB;QAjI1C,OAAE,GAAG,IAAIA,EAAO,EAAE,EAAE,CAAC;QACrB,gBAAQA,EAAO,EAAE,EAAC;QAQlB,wBAAiB;QAoBR,SAAI,GAA0E,MAAM,CAAC;QAC9F,wBAAmB,GAAG,KAAK,CAAC;QAI5B,yBAAe,KAAK,EAAC;QAIrB,yBAAY;QASF,gBAAW,GAAG,IAAI,YAAY,EAAE,CAAC;;QAI3C,eAAU,GAAG,KAAK,CAAC;QAMnB,eAAU,GAAG,KAAK,CAAC;QAenB,2BAAiB;QAKjB,6BAAqD;QAqB5C,SAAI,GAAG,QAAQ,CAAC;QACzB,aAAQ,GAAG,KAAK,CAAC;QAKP,gBAAW,GAAG,IAAI,YAAY,EAAO,CAAC;QAEtC,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QACnC,YAAO,GAAG,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,IAAG,OAAO,CAAC,KAAK,EAAC;YACf,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;SACzB;KACF;;;YAXF,SAAS,SAAC;gBACT,QAAQ,EAAE,SAAS;aACpB;;;oBAEE,KAAK;kBACL,KAAK;;;MCoCK,aAAa;;;YA3BzB,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,kBAAkB;oBAClB,cAAc;oBACd,aAAa;oBACb,gBAAgB;oBAChB,iBAAiB;oBACjB,cAAc;oBACd,eAAe;oBACf,eAAe;iBAChB;gBACD,YAAY,EAAE;oBACZ,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,kBAAkB;oBAClB,sBAAsB;oBACtB,cAAc;iBACf;aACF;;;AC1CD;;;;ACAA;;;;;;"}
@@ -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":";;;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,IAAI,CAAC;gBACpB,KAAK,EAAE,GAAG;gBACV,IAAI,QAAE,IAAI,CAAC,KAAK,0CAAE,IAAI,CAAC,CAAC,cAAI,OAAA,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,eAAO,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,IAAI,CAAC,UAAU,2CAAG,QAAQ,GAAE,CAAA,EAAA,CAAC;aAClF,CAAC,CAAC;SACJ,CAAC,CAAC,CAAC;QACJ,mFAAY,UAAU,sCAAa,IAAI,CAAC,WAAW,EAAE;KACtD;IAED,WAAW;;QACT,4CAAmB,WAAW,EAAE,CAAC;QACjC,mFAAY,aAAa,sCAAa;KACvC;;;;YA/GF,SAAS,SAAC;gBACT,QAAQ,EAAE,UAAU;gBACpB,g2BAAqC;gBAErC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YAZgD,iBAAiB;;;mBAe/D,KAAK;mBAoBL,KAAK;oBASL,KAAK;0BACL,KAAK;sBACL,KAAK;oBAGL,KAAK;qBAUL,KAAK,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 * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;;;;MAaa,OAAO;IAkFlB,YACS,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QAlF/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;QAsBR,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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AY,UAAU,sCAAa,IAAI,CAAC,WAAW,EAAE;KACtD;IAED,WAAW;;QACT,4CAAmB,WAAW,EAAE,CAAC;QACjC,mFAAY,aAAa,sCAAa;KACvC;;IAgBC,0BAA0B;QACxB,OAAO,CAAC,OAAwB;YAC9B,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;SAC9B,CAAC;KACH;;;;YA1IJ,SAAS,SAAC;gBACT,QAAQ,EAAE,UAAU;gBACpB,i+BAAqC;gBAErC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YAZgD,iBAAiB;;;mBAe/D,KAAK;mBAoBL,KAAK;oBASL,KAAK;0BACL,KAAK;sBACL,KAAK;oBAGL,KAAK;qBAUL,KAAK,SAAC,OAAO;yBAMb,KAAK;2BACL,KAAK;uBAIL,KAAK;2BAML,KAAK,SAAC,aAAa;uBAMnB,KAAK;yBAQL,YAAY,SAAC,mBAAmB;0BAChC,MAAM;uBACN,MAAM;0BACN,MAAM;;;MChEI,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;;;;;;"}
@@ -49,7 +49,7 @@ class SdSelectEditor extends SdSelect {
49
49
  SdSelectEditor.decorators = [
50
50
  { type: Component, args: [{
51
51
  selector: "sd-select-editor",
52
- 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\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n</ng-container>\r\n<ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value != null)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"addable && sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value != null}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"addable && sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value != null) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n </mat-form-field>\r\n</ng-template>\r\n</div>",
52
+ 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\r\n *ngTemplateOutlet=\"sdView.templateRef;context: { value: formControl.value, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n</ng-container>\r\n<ng-template #default>\r\n <mat-form-field class=\"sd-md\" [ngClass]=\"{'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage}\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{label}}</mat-label>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\" multiple\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value != null)}\"\r\n [required]=\"isRequired\" (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\" *ngIf=\"multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{standalone: true}\"\r\n (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox>\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"addable && sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-select #select [formControl]=\"formControl\" [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n (selectionChange)=\"onSelectionChange($event)\" disableOptionCentering=\"true\" panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{'sd-selected': !isRequired && formControl?.value != null}\" [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\" [attr.data-qclabel]=\"label\" [attr.data-qcid]=\"qcId\" *ngIf=\"!multiple\">\r\n <mat-select-trigger>\r\n {{display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input #input placeholder=\"{{'Search' | sdTranslate}}\" matInput autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\" (keyup)=\"searchTerm$.next($event.target.value)\">\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\" class=\"d-flex justify-content-between\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef;context:{item: item}\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n <div>\r\n <mat-icon *ngIf=\"editable && sdEdit?.observers?.length\" class=\"mr-1 c-fa-icon\" (click)=\"onEdit($event, item)\">\r\n edit</mat-icon>\r\n <mat-icon *ngIf=\"deletable && sdDelete?.observers?.length\" class=\"mr-0 c-fa-icon\" (click)=\"onDelete($event, item)\">\r\n delete</mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <mat-option class=\"sd__option--add\" *ngIf=\"addable && sdAdd?.observers?.length\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <div (click)=\"onAdd($event)\">\r\n <mat-icon class=\"mr-1\">add</mat-icon>\r\n {{'New item' | sdTranslate}}\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n <mat-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value != null) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel\r\n </mat-icon>\r\n <mat-error *ngIf=\"formControl.errors?.required && !disableErrorMessage\">\r\n {{'This field is required' | sdTranslate}}\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl?.errors?.customValidator && !disableErrorMessage\">\r\n {{formControl?.errors?.customValidator}}\r\n </mat-error>\r\n\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>",
53
53
  changeDetection: ChangeDetectionStrategy.OnPush,
54
54
  styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:none}:host ::ng-deep .sd-selected .mat-select-arrow{border:none}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field mat-select.mat-select-disabled .mat-select-value{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:10}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline{width:100%}::ng-deep .sd-select-panel .mat-option.sd-filtered-input mat-pseudo-checkbox{display:none}::ng-deep .mat-select-panel .mat-option.sd-filtered-input{height:auto}::ng-deep .sd-select-panel .mat-option.sd-filtered-input input{color:#000}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field-prefix .mat-icon{margin-right:0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding:10px 0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper .mat-form-field-outline{background-color:rgba(0,0,0,.04)}.sd__option--add{background-color:#fff;bottom:0;color:rgba(0,0,0,.87);cursor:pointer;position:-webkit-sticky;position:sticky;z-index:10}.sd__option--add ::ng-deep mat-pseudo-checkbox{display:none}"]
55
55
  },] }
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-select-editor.js","sources":["../../../../projects/sd-core/select-editor/src/lib/select-editor.component.ts","../../../../projects/sd-core/select-editor/src/lib/select-editor.module.ts","../../../../projects/sd-core/select-editor/src/public-api.ts","../../../../projects/sd-core/select-editor/sd-angular-core-select-editor.ts"],"sourcesContent":["import {\r\n Component,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n OnInit,\r\n ViewChild,\r\n Optional,\r\n Inject,\r\n Input,\r\n ChangeDetectionStrategy,\r\n ContentChild,\r\n} from \"@angular/core\";\r\nimport { MatSelect } from \"@angular/material/select\";\r\nimport { SdLabelDefDirective } from \"@sd-angular/core/common\";\r\nimport {\r\n FORM_CONFIG,\r\n IFormConfiguration\r\n} from \"@sd-angular/core/common\";\r\nimport { SdSelect } from \"@sd-angular/core/select\";\r\n\r\n@Component({\r\n selector: \"sd-select-editor\",\r\n templateUrl: \"./select-editor.component.html\",\r\n styleUrls: [\"./select-editor.component.scss\"],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdSelectEditor extends SdSelect implements OnInit, OnDestroy {\r\n @ViewChild(MatSelect) matSelect: MatSelect;\r\n\r\n @Input() addable: boolean = true;\r\n @Input() editable: boolean = true;\r\n @Input() deletable: boolean = true;\r\n\r\n @Output() sdAdd = new EventEmitter();\r\n @Output() sdEdit = new EventEmitter<any>();\r\n @Output() sdDelete = new EventEmitter<any>();\r\n @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n\r\n constructor(\r\n private cdRef: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG)\r\n @Optional()\r\n private formConfiguration: IFormConfiguration\r\n ) {\r\n super(cdRef, formConfiguration);\r\n }\r\n\r\n onAdd = ($event: Event) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdAdd.emit();\r\n };\r\n\r\n onEdit = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdEdit.emit(item);\r\n };\r\n\r\n onDelete = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdDelete.emit(item);\r\n };\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdSelectEditor } from './select-editor.component';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdSelectModule } from '@sd-angular/core/select';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatSelectModule,\r\n SdTranslateModule,\r\n MatCheckboxModule,\r\n MatProgressSpinnerModule,\r\n SdCommonModule,\r\n SdSelectModule\r\n ],\r\n declarations: [\r\n SdSelectEditor\r\n ],\r\n exports: [\r\n SdSelectEditor\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdSelectEditorModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/select-editor.module';\r\nexport * from './lib/select-editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MA4Ba,cAAe,SAAQ,QAAQ;IAY1C,YACU,KAAwB,EAGxB,iBAAqC;QAE7C,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QALxB,UAAK,GAAL,KAAK,CAAmB;QAGxB,sBAAiB,GAAjB,iBAAiB,CAAoB;QAbtC,YAAO,GAAY,IAAI,CAAC;QACxB,aAAQ,GAAY,IAAI,CAAC;QACzB,cAAS,GAAY,IAAI,CAAC;QAEzB,UAAK,GAAG,IAAI,YAAY,EAAE,CAAC;QAC3B,WAAM,GAAG,IAAI,YAAY,EAAO,CAAC;QACjC,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QAY7C,UAAK,GAAG,CAAC,MAAa;;YACpB,MAAM,CAAC,eAAe,EAAE,CAAC;YACzB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,GAAG;YACzB,MAAA,IAAI,CAAC,SAAS,0CAAE,KAAK,GAAG;YACxB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SACnB,CAAC;QAEF,WAAM,GAAG,CAAC,MAAa,EAAE,IAAS;;YAChC,MAAM,CAAC,eAAe,EAAE,CAAC;YACzB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,GAAG;YACzB,MAAA,IAAI,CAAC,SAAS,0CAAE,KAAK,GAAG;YACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACxB,CAAC;QAEF,aAAQ,GAAG,CAAC,MAAa,EAAE,IAAS;;YAClC,MAAM,CAAC,eAAe,EAAE,CAAC;YACzB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,GAAG;YACzB,MAAA,IAAI,CAAC,SAAS,0CAAE,KAAK,GAAG;YACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC1B,CAAC;KArBD;;;YAzBF,SAAS,SAAC;gBACT,QAAQ,EAAE,kBAAkB;gBAC5B,iqSAA6C;gBAE7C,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YAvBC,iBAAiB;4CAsCd,MAAM,SAAC,WAAW,cAClB,QAAQ;;;wBAdV,SAAS,SAAC,SAAS;sBAEnB,KAAK;uBACL,KAAK;wBACL,KAAK;oBAEL,MAAM;qBACN,MAAM;uBACN,MAAM;yBACN,YAAY,SAAC,mBAAmB;;;MCEtB,oBAAoB;;;YAzBhC,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,mBAAmB;oBACnB,cAAc;oBACd,gBAAgB;oBAChB,kBAAkB;oBAClB,aAAa;oBACb,eAAe;oBACf,iBAAiB;oBACjB,iBAAiB;oBACjB,wBAAwB;oBACxB,cAAc;oBACd,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,cAAc;iBACf;gBACD,SAAS,EAAE,EACV;aACF;;;ACvCD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-select-editor.js","sources":["../../../../projects/sd-core/select-editor/src/lib/select-editor.component.ts","../../../../projects/sd-core/select-editor/src/lib/select-editor.module.ts","../../../../projects/sd-core/select-editor/src/public-api.ts","../../../../projects/sd-core/select-editor/sd-angular-core-select-editor.ts"],"sourcesContent":["import {\r\n Component,\r\n Output,\r\n EventEmitter,\r\n ChangeDetectorRef,\r\n OnDestroy,\r\n OnInit,\r\n ViewChild,\r\n Optional,\r\n Inject,\r\n Input,\r\n ChangeDetectionStrategy,\r\n ContentChild,\r\n} from \"@angular/core\";\r\nimport { MatSelect } from \"@angular/material/select\";\r\nimport { SdLabelDefDirective } from \"@sd-angular/core/common\";\r\nimport {\r\n FORM_CONFIG,\r\n IFormConfiguration\r\n} from \"@sd-angular/core/common\";\r\nimport { SdSelect } from \"@sd-angular/core/select\";\r\n\r\n@Component({\r\n selector: \"sd-select-editor\",\r\n templateUrl: \"./select-editor.component.html\",\r\n styleUrls: [\"./select-editor.component.scss\"],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SdSelectEditor extends SdSelect implements OnInit, OnDestroy {\r\n @ViewChild(MatSelect) matSelect: MatSelect;\r\n\r\n @Input() addable: boolean = true;\r\n @Input() editable: boolean = true;\r\n @Input() deletable: boolean = true;\r\n\r\n @Output() sdAdd = new EventEmitter();\r\n @Output() sdEdit = new EventEmitter<any>();\r\n @Output() sdDelete = new EventEmitter<any>();\r\n @ContentChild(SdLabelDefDirective) sdLabelDef: SdLabelDefDirective;\r\n\r\n constructor(\r\n private cdRef: ChangeDetectorRef,\r\n @Inject(FORM_CONFIG)\r\n @Optional()\r\n private formConfiguration: IFormConfiguration\r\n ) {\r\n super(cdRef, formConfiguration);\r\n }\r\n\r\n onAdd = ($event: Event) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdAdd.emit();\r\n };\r\n\r\n onEdit = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdEdit.emit(item);\r\n };\r\n\r\n onDelete = ($event: Event, item: any) => {\r\n $event.stopPropagation();\r\n $event?.preventDefault();\r\n this.matSelect?.close();\r\n this.sdDelete.emit(item);\r\n };\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { SdSelectEditor } from './select-editor.component';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { SdTranslateModule } from '@sd-angular/core/translate';\r\nimport { MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { SdCommonModule } from '@sd-angular/core/common';\r\nimport { SdSelectModule } from '@sd-angular/core/select';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormsModule,\r\n ReactiveFormsModule,\r\n MatInputModule,\r\n MatTooltipModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatSelectModule,\r\n SdTranslateModule,\r\n MatCheckboxModule,\r\n MatProgressSpinnerModule,\r\n SdCommonModule,\r\n SdSelectModule\r\n ],\r\n declarations: [\r\n SdSelectEditor\r\n ],\r\n exports: [\r\n SdSelectEditor\r\n ],\r\n providers: [\r\n ]\r\n})\r\nexport class SdSelectEditorModule {\r\n\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/select-editor.module';\r\nexport * from './lib/select-editor.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MA4Ba,cAAe,SAAQ,QAAQ;IAY1C,YACU,KAAwB,EAGxB,iBAAqC;QAE7C,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QALxB,UAAK,GAAL,KAAK,CAAmB;QAGxB,sBAAiB,GAAjB,iBAAiB,CAAoB;QAbtC,YAAO,GAAY,IAAI,CAAC;QACxB,aAAQ,GAAY,IAAI,CAAC;QACzB,cAAS,GAAY,IAAI,CAAC;QAEzB,UAAK,GAAG,IAAI,YAAY,EAAE,CAAC;QAC3B,WAAM,GAAG,IAAI,YAAY,EAAO,CAAC;QACjC,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC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,iBAAiB;oBACjB,iBAAiB;oBACjB,wBAAwB;oBACxB,cAAc;oBACd,cAAc;iBACf;gBACD,YAAY,EAAE;oBACZ,cAAc;iBACf;gBACD,OAAO,EAAE;oBACP,cAAc;iBACf;gBACD,SAAS,EAAE,EACV;aACF;;;ACvCD;;;;ACAA;;;;;;"}
@@ -76,10 +76,15 @@ class SdSelect {
76
76
  if (__classPrivateFieldGet(this, _validator)) {
77
77
  asyncValidators.push(__classPrivateFieldGet(this, _customValidator).call(this, __classPrivateFieldGet(this, _validator)));
78
78
  }
79
+ if (this.inlineError) {
80
+ validators.push(this.customInlineErrorValidator());
81
+ }
79
82
  this.formControl.setValidators(validators);
80
83
  this.formControl.setAsyncValidators(asyncValidators);
81
84
  this.formControl.updateValueAndValidity();
82
- });
85
+ }
86
+ // Hàm tạo Validators tùy chỉnh cho inlineError
87
+ );
83
88
  _loadSelectedItems.set(this, (value, items) => __awaiter(this, void 0, void 0, function* () {
84
89
  if (!(value === null || value === void 0 ? void 0 : value.toString())) {
85
90
  return [];
@@ -326,6 +331,10 @@ class SdSelect {
326
331
  __classPrivateFieldSet(this, _validator, validator);
327
332
  __classPrivateFieldGet(this, _updateValidator).call(this);
328
333
  }
334
+ set _inlineError(val) {
335
+ this.inlineError = val;
336
+ __classPrivateFieldGet(this, _updateValidator).call(this);
337
+ }
329
338
  // Optional
330
339
  set disabled(val) {
331
340
  val = (val === '') || val;
@@ -433,6 +442,12 @@ class SdSelect {
433
442
  (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
434
443
  __classPrivateFieldGet(this, _subscription).unsubscribe();
435
444
  }
445
+ // Hàm tạo Validators tùy chỉnh cho inlineError
446
+ customInlineErrorValidator() {
447
+ return (control) => {
448
+ return { inlineError: true };
449
+ };
450
+ }
436
451
  onSelectAll() {
437
452
  if (this.allSelected) {
438
453
  this.formControl.setValue(this.select.options.map(e => e.value));
@@ -447,7 +462,7 @@ _input = new WeakMap(), _name = new WeakMap(), _form = new WeakMap(), _itemsChan
447
462
  SdSelect.decorators = [
448
463
  { type: Component, args: [{
449
464
  selector: 'sd-select',
450
- template: "<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\"> </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" class=\"d-block mb-0 T14M\"\r\n >{{ label }} <span class=\"text-danger mb-2\" *ngIf=\"isRequired\">*</span></label\r\n>\r\n<div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"sdView?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef; context: { value: formControl.value, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field\r\n class=\"sd-md\"\r\n [ngClass]=\"{ 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage }\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{ label }}</mat-label>\r\n <mat-select\r\n *ngIf=\"multiple\"\r\n #select\r\n [formControl]=\"formControl\"\r\n [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n multiple\r\n (selectionChange)=\"onSelectionChange($event)\"\r\n disableOptionCentering=\"true\"\r\n panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{ 'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value != null) }\"\r\n [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\"\r\n [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\"\r\n [sdPopoverDisabled]=\"!formControl.disabled || !formControl?.value?.length\"\r\n [sdPopoverTriggerFor]=\"popoverValues\">\r\n <mat-select-trigger>\r\n {{ display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input\r\n aria-hidden=\"true\"\r\n #input\r\n placeholder=\"{{ 'Search' | sdTranslate }}\"\r\n matInput\r\n autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (keyup)=\"searchTerm$.next($event.target.value)\" />\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{ standalone: true }\" (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox\r\n >\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-select\r\n *ngIf=\"!multiple\"\r\n #select\r\n [formControl]=\"formControl\"\r\n [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n (selectionChange)=\"onSelectionChange($event)\"\r\n disableOptionCentering=\"true\"\r\n panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{ 'sd-selected': !isRequired && formControl?.value != null }\"\r\n [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\"\r\n [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\">\r\n <mat-select-trigger>\r\n {{ display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input\r\n aria-hidden=\"true\"\r\n #input\r\n placeholder=\"{{ 'Search' | sdTranslate }}\"\r\n matInput\r\n autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (keyup)=\"searchTerm$.next($event.target.value)\" />\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <svg\r\n #copyTooltip=\"matTooltip\"\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value != null) && copyable\"\r\n matSuffix\r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\"\r\n class=\"icon-copy\"\r\n focusable=\"false\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 448 512\"\r\n (click)=\"onCopyText($event)\">\r\n <path\r\n 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-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value != null) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\"\r\n (click)=\"clear($event)\"\r\n matSuffix\r\n >cancel\r\n </mat-icon>\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?.customValidator\">\r\n <ng-container *ngIf=\"!disableErrorMessage\">{{ formControl?.errors?.customValidator }}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n </ng-template>\r\n</div>\r\n<sd-popover #popoverValues=\"sdPopover\" width=\"auto\">\r\n <ng-container *ngIf=\"formControl?.value?.length\">\r\n <ng-container *sdLet=\"selectedItems | async as items\">\r\n <div *ngFor=\"let item of items\">\r\n <strong>{{ item[valueField] }}</strong> - {{ item[displayField] }}\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n</sd-popover>\r\n",
465
+ template: "<ng-container *ngIf=\"!appearance && sdLabelDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\"> </ng-container>\r\n</ng-container>\r\n<label *ngIf=\"!appearance && label && !sdLabelDef?.templateRef\" class=\"d-block mb-0 T14M\"\r\n >{{ label }} <span class=\"text-danger mb-2\" *ngIf=\"isRequired\">*</span></label\r\n>\r\n<div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"sdView?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\">\r\n <ng-container *ngIf=\"sdView?.templateRef && !isFocused; else default\">\r\n <ng-container *ngTemplateOutlet=\"sdView.templateRef; context: { value: formControl.value, selectedItems: selectedItems | async }\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #default>\r\n <mat-form-field\r\n class=\"sd-md\"\r\n [ngClass]=\"{ 'sd-sm': size === 'sm', 'no-padding-wrapper': disableErrorMessage }\"\r\n [appearance]=\"appearance || 'outline'\">\r\n <mat-label *ngIf=\"appearance && label\">{{ label }}</mat-label>\r\n <mat-select\r\n *ngIf=\"multiple\"\r\n #select\r\n [formControl]=\"formControl\"\r\n [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n multiple\r\n (selectionChange)=\"onSelectionChange($event)\"\r\n disableOptionCentering=\"true\"\r\n panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{ 'sd-selected': !isRequired && (multiple ? formControl?.value?.length : formControl?.value != null) }\"\r\n [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\"\r\n [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\"\r\n [sdPopoverDisabled]=\"!formControl.disabled || !formControl?.value?.length\"\r\n [sdPopoverTriggerFor]=\"popoverValues\">\r\n <mat-select-trigger>\r\n {{ display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input\r\n aria-hidden=\"true\"\r\n #input\r\n placeholder=\"{{ 'Search' | sdTranslate }}\"\r\n matInput\r\n autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (keyup)=\"searchTerm$.next($event.target.value)\" />\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"multiple && selectAll\">\r\n <mat-checkbox class=\"mat-option\" [(ngModel)]=\"allSelected\" [ngModelOptions]=\"{ standalone: true }\" (change)=\"onSelectAll()\">\r\n T\u1EA5t c\u1EA3</mat-checkbox\r\n >\r\n </ng-container>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-select\r\n *ngIf=\"!multiple\"\r\n #select\r\n [formControl]=\"formControl\"\r\n [placeholder]=\"placeholder || (appearance ? label : '')\"\r\n (selectionChange)=\"onSelectionChange($event)\"\r\n disableOptionCentering=\"true\"\r\n panelClass=\"sd-select-panel\"\r\n [ngClass]=\"{ 'sd-selected': !isRequired && formControl?.value != null }\"\r\n [required]=\"isRequired\"\r\n (openedChange)=\"onOpenChange($event)\"\r\n [attr.data-qclabel]=\"label\"\r\n [attr.data-qcid]=\"qcId\">\r\n <mat-select-trigger>\r\n {{ display | async }}\r\n </mat-select-trigger>\r\n <mat-option *ngIf=\"filtered\" class=\"sd-filtered-input\" (keyup.Space)=\"$event.stopPropagation()\" disabled=\"true\">\r\n <mat-form-field class=\"sd-md\" appearance=\"outline\">\r\n <mat-icon matPrefix>search</mat-icon>\r\n <input\r\n aria-hidden=\"true\"\r\n #input\r\n placeholder=\"{{ 'Search' | sdTranslate }}\"\r\n matInput\r\n autocomplete=\"off\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (keyup)=\"searchTerm$.next($event.target.value)\" />\r\n </mat-form-field>\r\n </mat-option>\r\n <ng-container *ngIf=\"valueField && displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item[valueField]\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item[displayField]\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item[displayField] }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n <ng-container *ngIf=\"!valueField && !displayField\">\r\n <mat-option *ngFor=\"let item of filteredItems | async; trackBy: trackByKey\" [value]=\"item\">\r\n <div matTooltipPosition=\"above\" [matTooltip]=\"item\">\r\n <ng-container *ngIf=\"selectDisplayDef?.templateRef\">\r\n <ng-container *ngTemplateOutlet=\"selectDisplayDef.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!selectDisplayDef?.templateRef\">\r\n {{ item }}\r\n </ng-container>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <svg\r\n #copyTooltip=\"matTooltip\"\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value != null) && copyable\"\r\n matSuffix\r\n [matTooltip]=\"copied ? 'Copied' : 'Copy'\"\r\n class=\"icon-copy\"\r\n focusable=\"false\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n viewBox=\"0 0 448 512\"\r\n (click)=\"onCopyText($event)\">\r\n <path\r\n 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-icon\r\n *ngIf=\"(multiple ? formControl?.value?.length : formControl?.value != null) && !isRequired && !formControl.disabled\"\r\n class=\"pointer sd-suffix-icon\"\r\n (click)=\"clear($event)\"\r\n matSuffix\r\n >cancel\r\n </mat-icon>\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?.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 #popoverValues=\"sdPopover\" width=\"auto\">\r\n <ng-container *ngIf=\"formControl?.value?.length\">\r\n <ng-container *sdLet=\"selectedItems | async as items\">\r\n <div *ngFor=\"let item of items\">\r\n <strong>{{ item[valueField] }}</strong> - {{ item[displayField] }}\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n</sd-popover>\r\n",
451
466
  changeDetection: ChangeDetectionStrategy.OnPush,
452
467
  styles: [":host{display:block;padding-top:5px}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline .mat-select-arrow-wrapper{transform:none}:host ::ng-deep .sd-selected .mat-select-arrow{border:none}:host ::ng-deep .mat-form-field.no-padding-wrapper .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-form-field-outline{background:#f6f6f6;color:#e9e9e9}:host ::ng-deep .mat-form-field mat-select.mat-select-disabled .mat-select-value{color:#4d4d4d!important}:host ::ng-deep .mat-form-field .mat-placeholder-required{color:#f82c13}: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}::ng-deep .sd-select-panel .mat-option.sd-filtered-input{background-color:#fff;position:-webkit-sticky;position:sticky;top:0;z-index:10}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline{width:100%}::ng-deep .sd-select-panel .mat-option.sd-filtered-input mat-pseudo-checkbox{display:none}::ng-deep .mat-select-panel .mat-option.sd-filtered-input{height:auto}::ng-deep .sd-select-panel .mat-option.sd-filtered-input input{color:#000}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field-prefix .mat-icon{margin-right:0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding:10px 0}::ng-deep .sd-select-panel .mat-option.sd-filtered-input .mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper .mat-form-field-outline{background-color:rgba(0,0,0,.04)}"]
453
468
  },] }
@@ -473,6 +488,7 @@ SdSelect.propDecorators = {
473
488
  cacheChecksum: [{ type: Input }],
474
489
  required: [{ type: Input }],
475
490
  validator: [{ type: Input }],
491
+ _inlineError: [{ type: Input, args: ['inlineError',] }],
476
492
  disabled: [{ type: Input }],
477
493
  _multiple: [{ type: Input, args: ['multiple',] }],
478
494
  limit: [{ type: Input }],