@sd-angular/core 19.0.0-beta.4 → 19.0.0-beta.41

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 (177) hide show
  1. package/assets/scss/ckeditor5.scss +60 -2
  2. package/assets/scss/core/bootstrap.scss +17 -0
  3. package/assets/scss/core/grid.scss +40 -0
  4. package/assets/scss/sd-core.scss +1 -0
  5. package/components/avatar/index.d.ts +1 -0
  6. package/components/avatar/src/avatar.component.d.ts +15 -0
  7. package/components/badge/src/badge.component.d.ts +77 -19
  8. package/components/button/src/button.component.d.ts +26 -28
  9. package/components/document-builder/index.d.ts +1 -0
  10. package/components/document-builder/src/document-builder.component.d.ts +20 -37
  11. package/components/document-builder/src/document-builder.model.d.ts +11 -10
  12. package/components/document-builder/src/plugins/block-space/block-space.plugin.d.ts +9 -0
  13. package/components/document-builder/src/plugins/ck-comment/ck-comment.plugin.d.ts +43 -0
  14. package/components/document-builder/src/plugins/ck-comment/ck-comment.plugin.model.d.ts +50 -0
  15. package/components/document-builder/src/plugins/heading/heading.plugin.d.ts +5 -0
  16. package/components/document-builder/src/plugins/highlight-range/highlight-range.plugin.d.ts +4 -0
  17. package/components/document-builder/src/plugins/image-custom/image-custom.plugin.d.ts +31 -0
  18. package/components/document-builder/src/plugins/{image-upload.plugin.d.ts → image-upload/image-upload.plugin.d.ts} +0 -4
  19. package/components/document-builder/src/plugins/index.d.ts +11 -5
  20. package/components/document-builder/src/plugins/{page-orientation.plugin.d.ts → page-orientation/page-orientation.plugin.d.ts} +2 -2
  21. package/components/document-builder/src/plugins/paste-handler/filters/bookmark.d.ts +14 -0
  22. package/components/document-builder/src/plugins/paste-handler/filters/br.d.ts +15 -0
  23. package/components/document-builder/src/plugins/paste-handler/filters/image.d.ts +25 -0
  24. package/components/document-builder/src/plugins/paste-handler/filters/list.d.ts +29 -0
  25. package/components/document-builder/src/plugins/paste-handler/filters/parse.d.ts +35 -0
  26. package/components/document-builder/src/plugins/paste-handler/filters/removeboldwrapper.d.ts +15 -0
  27. package/components/document-builder/src/plugins/paste-handler/filters/removegooglesheetstag.d.ts +15 -0
  28. package/components/document-builder/src/plugins/paste-handler/filters/removeinvalidtablewidth.d.ts +15 -0
  29. package/components/document-builder/src/plugins/paste-handler/filters/removemsattributes.d.ts +15 -0
  30. package/components/document-builder/src/plugins/paste-handler/filters/removestyleblock.d.ts +15 -0
  31. package/components/document-builder/src/plugins/paste-handler/filters/removexmlns.d.ts +15 -0
  32. package/components/document-builder/src/plugins/paste-handler/filters/replacemsfootnotes.d.ts +54 -0
  33. package/components/document-builder/src/plugins/paste-handler/filters/replacetabswithinprewithspaces.d.ts +24 -0
  34. package/components/document-builder/src/plugins/paste-handler/filters/space.d.ts +27 -0
  35. package/components/document-builder/src/plugins/paste-handler/filters/table.d.ts +16 -0
  36. package/components/document-builder/src/plugins/paste-handler/filters/utils.d.ts +25 -0
  37. package/components/document-builder/src/plugins/paste-handler/index.d.ts +35 -0
  38. package/components/document-builder/src/plugins/paste-handler/normalizers/googledocsnormalizer.d.ts +31 -0
  39. package/components/document-builder/src/plugins/paste-handler/normalizers/googlesheetsnormalizer.d.ts +31 -0
  40. package/components/document-builder/src/plugins/paste-handler/normalizers/mswordnormalizer.d.ts +29 -0
  41. package/components/document-builder/src/plugins/paste-handler/types.d.ts +30 -0
  42. package/components/document-builder/src/plugins/table-custom/index.d.ts +34 -0
  43. package/components/index.d.ts +3 -0
  44. package/components/mini-editor/index.d.ts +2 -0
  45. package/components/mini-editor/src/mini-editor.component.d.ts +90 -0
  46. package/components/mini-editor/src/mini-editor.model.d.ts +42 -0
  47. package/components/side-drawer/src/side-drawer.component.d.ts +1 -2
  48. package/components/table/src/components/selector-action/action-filter.pipe.d.ts +11 -10
  49. package/components/table/src/directives/index.d.ts +2 -0
  50. package/components/table/src/directives/sd-table-column-filter-def.directive.d.ts +9 -0
  51. package/components/table/src/directives/sticky-shadow.directive.d.ts +17 -0
  52. package/components/table/src/models/table-column.model.d.ts +32 -32
  53. package/components/table/src/models/table-command.model.d.ts +7 -3
  54. package/components/table/src/models/table-item.model.d.ts +5 -3
  55. package/components/table/src/models/table-option-export.model.d.ts +3 -2
  56. package/components/table/src/models/table-option-selector.model.d.ts +11 -10
  57. package/components/table/src/models/table-option.model.d.ts +10 -8
  58. package/components/table/src/services/table-filter/table-filter.model.d.ts +2 -2
  59. package/components/table/src/table.component.d.ts +33 -35
  60. package/components/view/index.d.ts +1 -0
  61. package/components/view/src/view.component.d.ts +16 -0
  62. package/components/workflow/src/models/index.d.ts +1 -0
  63. package/directives/index.d.ts +1 -0
  64. package/directives/src/sd-href.directive.d.ts +9 -0
  65. package/fesm2022/sd-angular-core-components-avatar.mjs +90 -0
  66. package/fesm2022/sd-angular-core-components-avatar.mjs.map +1 -0
  67. package/fesm2022/sd-angular-core-components-badge.mjs +102 -91
  68. package/fesm2022/sd-angular-core-components-badge.mjs.map +1 -1
  69. package/fesm2022/sd-angular-core-components-button.mjs +64 -96
  70. package/fesm2022/sd-angular-core-components-button.mjs.map +1 -1
  71. package/fesm2022/sd-angular-core-components-document-builder.mjs +3860 -963
  72. package/fesm2022/sd-angular-core-components-document-builder.mjs.map +1 -1
  73. package/fesm2022/sd-angular-core-components-history.mjs +1 -1
  74. package/fesm2022/sd-angular-core-components-history.mjs.map +1 -1
  75. package/fesm2022/sd-angular-core-components-import-excel.mjs +1 -1
  76. package/fesm2022/sd-angular-core-components-import-excel.mjs.map +1 -1
  77. package/fesm2022/sd-angular-core-components-mini-editor.mjs +326 -0
  78. package/fesm2022/sd-angular-core-components-mini-editor.mjs.map +1 -0
  79. package/fesm2022/sd-angular-core-components-preview.mjs +1 -1
  80. package/fesm2022/sd-angular-core-components-preview.mjs.map +1 -1
  81. package/fesm2022/sd-angular-core-components-side-drawer.mjs +21 -8
  82. package/fesm2022/sd-angular-core-components-side-drawer.mjs.map +1 -1
  83. package/fesm2022/sd-angular-core-components-tab-router.mjs +1 -1
  84. package/fesm2022/sd-angular-core-components-tab-router.mjs.map +1 -1
  85. package/fesm2022/sd-angular-core-components-table.mjs +724 -472
  86. package/fesm2022/sd-angular-core-components-table.mjs.map +1 -1
  87. package/fesm2022/sd-angular-core-components-upload-file.mjs +1 -1
  88. package/fesm2022/sd-angular-core-components-upload-file.mjs.map +1 -1
  89. package/fesm2022/sd-angular-core-components-view.mjs +45 -0
  90. package/fesm2022/sd-angular-core-components-view.mjs.map +1 -0
  91. package/fesm2022/sd-angular-core-components-workflow.mjs +33 -43
  92. package/fesm2022/sd-angular-core-components-workflow.mjs.map +1 -1
  93. package/fesm2022/sd-angular-core-components.mjs +3 -0
  94. package/fesm2022/sd-angular-core-components.mjs.map +1 -1
  95. package/fesm2022/sd-angular-core-directives.mjs +80 -27
  96. package/fesm2022/sd-angular-core-directives.mjs.map +1 -1
  97. package/fesm2022/sd-angular-core-forms-autocomplete.mjs +257 -361
  98. package/fesm2022/sd-angular-core-forms-autocomplete.mjs.map +1 -1
  99. package/fesm2022/sd-angular-core-forms-date-range.mjs +145 -245
  100. package/fesm2022/sd-angular-core-forms-date-range.mjs.map +1 -1
  101. package/fesm2022/sd-angular-core-forms-date.mjs +137 -271
  102. package/fesm2022/sd-angular-core-forms-date.mjs.map +1 -1
  103. package/fesm2022/sd-angular-core-forms-datetime.mjs +138 -276
  104. package/fesm2022/sd-angular-core-forms-datetime.mjs.map +1 -1
  105. package/fesm2022/sd-angular-core-forms-input-number.mjs +174 -336
  106. package/fesm2022/sd-angular-core-forms-input-number.mjs.map +1 -1
  107. package/fesm2022/sd-angular-core-forms-input.mjs +130 -283
  108. package/fesm2022/sd-angular-core-forms-input.mjs.map +1 -1
  109. package/fesm2022/sd-angular-core-forms-radio.mjs +5 -2
  110. package/fesm2022/sd-angular-core-forms-radio.mjs.map +1 -1
  111. package/fesm2022/sd-angular-core-forms-select.mjs +303 -419
  112. package/fesm2022/sd-angular-core-forms-select.mjs.map +1 -1
  113. package/fesm2022/sd-angular-core-forms-textarea.mjs +133 -226
  114. package/fesm2022/sd-angular-core-forms-textarea.mjs.map +1 -1
  115. package/fesm2022/sd-angular-core-modules-keycloak.mjs +126 -0
  116. package/fesm2022/sd-angular-core-modules-keycloak.mjs.map +1 -0
  117. package/fesm2022/sd-angular-core-modules-layout.mjs +54 -19
  118. package/fesm2022/sd-angular-core-modules-layout.mjs.map +1 -1
  119. package/fesm2022/sd-angular-core-modules.mjs +1 -1
  120. package/fesm2022/sd-angular-core-pipes.mjs +21 -1
  121. package/fesm2022/sd-angular-core-pipes.mjs.map +1 -1
  122. package/fesm2022/sd-angular-core-services-confirm.mjs +2 -2
  123. package/fesm2022/sd-angular-core-services-confirm.mjs.map +1 -1
  124. package/fesm2022/sd-angular-core-services-docx.mjs +173 -0
  125. package/fesm2022/sd-angular-core-services-docx.mjs.map +1 -0
  126. package/fesm2022/sd-angular-core-services-notify.mjs +2 -2
  127. package/fesm2022/sd-angular-core-services-notify.mjs.map +1 -1
  128. package/fesm2022/sd-angular-core-services.mjs +1 -0
  129. package/fesm2022/sd-angular-core-services.mjs.map +1 -1
  130. package/fesm2022/sd-angular-core-utilities-extensions.mjs +10 -6
  131. package/fesm2022/sd-angular-core-utilities-extensions.mjs.map +1 -1
  132. package/fesm2022/sd-angular-core-utilities-models.mjs +15 -1
  133. package/fesm2022/sd-angular-core-utilities-models.mjs.map +1 -1
  134. package/forms/autocomplete/src/autocomplete.component.d.ts +51 -56
  135. package/forms/date/src/date.component.d.ts +41 -45
  136. package/forms/date-range/src/date-range.component.d.ts +28 -33
  137. package/forms/datetime/src/datetime.component.d.ts +41 -45
  138. package/forms/input/src/input.component.d.ts +46 -56
  139. package/forms/input-number/src/input-number.component.d.ts +47 -54
  140. package/forms/select/src/select.component.d.ts +54 -58
  141. package/forms/textarea/src/textarea.component.d.ts +34 -41
  142. package/modules/index.d.ts +1 -1
  143. package/modules/keycloak/index.d.ts +4 -0
  144. package/modules/keycloak/keycloak.configuration.d.ts +11 -0
  145. package/modules/keycloak/keycloak.interceptor.d.ts +2 -0
  146. package/modules/keycloak/keycloak.module.d.ts +18 -0
  147. package/modules/keycloak/keycloak.service.d.ts +14 -0
  148. package/modules/layout/components/sidebar-v1/components/sidebar/sidebar.component.d.ts +1 -0
  149. package/modules/layout/components/sidebar-v1/components/user/user.component.d.ts +5 -2
  150. package/modules/layout/configurations/layout.configuration.d.ts +3 -0
  151. package/modules/layout/services/storage/storage.service.d.ts +1 -0
  152. package/package.json +96 -78
  153. package/pipes/index.d.ts +1 -0
  154. package/pipes/src/empty.pipe.d.ts +7 -0
  155. package/sd-angular-core-19.0.0-beta.41.tgz +0 -0
  156. package/services/confirm/src/lib/confirm.service.d.ts +1 -0
  157. package/services/docx/index.d.ts +1 -0
  158. package/services/docx/src/lib/docx.model.d.ts +9 -0
  159. package/services/docx/src/lib/docx.service.d.ts +13 -0
  160. package/services/docx/src/public-api.d.ts +2 -0
  161. package/services/index.d.ts +1 -0
  162. package/utilities/extensions/src/string.extension.d.ts +2 -0
  163. package/utilities/models/index.d.ts +3 -0
  164. package/utilities/models/src/filter.model.d.ts +14 -2
  165. package/utilities/models/src/icon.model.d.ts +2 -0
  166. package/utilities/models/src/nested-key-of.model.d.ts +5 -0
  167. package/utilities/models/src/pattern.model.d.ts +1 -1
  168. package/utilities/models/src/unwrap-signal.model.d.ts +6 -0
  169. package/components/document-builder/src/plugins/comment.plugin.d.ts +0 -4
  170. package/components/document-builder/src/plugins/table-fit.plugin.d.ts +0 -4
  171. package/fesm2022/sd-angular-core-modules-oidc.mjs +0 -127
  172. package/fesm2022/sd-angular-core-modules-oidc.mjs.map +0 -1
  173. package/modules/oidc/dynamic-sts.loader.d.ts +0 -11
  174. package/modules/oidc/index.d.ts +0 -2
  175. package/modules/oidc/oidc.configuration.d.ts +0 -11
  176. package/modules/oidc/oidc.module.d.ts +0 -14
  177. /package/components/document-builder/src/plugins/{variable.plugin.d.ts → variable/variable.plugin.d.ts} +0 -0
@@ -1,31 +1,28 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, ContentChild, ViewChild, Output, Input, Inject, Optional, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import * as i3 from '@angular/forms';
2
+ import { viewChild, contentChild, inject, ChangeDetectorRef, input, computed, booleanAttribute, model, output, EventEmitter, effect, untracked, Output, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import * as i2 from '@angular/forms';
4
4
  import { NgForm, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import * as uuid from 'uuid';
6
- import * as i2 from '@angular/common';
6
+ import * as i1 from '@angular/common';
7
7
  import { CommonModule } from '@angular/common';
8
8
  import { MatButtonModule } from '@angular/material/button';
9
- import * as i4 from '@angular/material/form-field';
9
+ import * as i3 from '@angular/material/form-field';
10
10
  import { MatFormFieldModule } from '@angular/material/form-field';
11
- import * as i6 from '@angular/material/icon';
11
+ import * as i5 from '@angular/material/icon';
12
12
  import { MatIconModule } from '@angular/material/icon';
13
- import * as i5 from '@angular/material/input';
13
+ import * as i4 from '@angular/material/input';
14
14
  import { MatInputModule } from '@angular/material/input';
15
- import * as i7 from '@angular/material/tooltip';
15
+ import * as i6 from '@angular/material/tooltip';
16
16
  import { MatTooltipModule } from '@angular/material/tooltip';
17
- import { SdViewDefDirective, SdSuffixDefDirective, SdLabelDefDirective } from '@sd-angular/core/forms/directives';
18
- import { SdFormControl, HandleSdCustomValidator, SD_FORM_CONFIGURATION } from '@sd-angular/core/forms/models';
19
- import { NumberUtilities } from '@sd-angular/core/utilities/extensions';
20
- import { Subscription } from 'rxjs';
21
- import * as i1 from '@sd-angular/core/pipes';
22
- import { SdFormatNumberPipe } from '@sd-angular/core/pipes';
17
+ import { SdView } from '@sd-angular/core/components/view';
23
18
  import { SD_CORE_CONFIGURATION } from '@sd-angular/core/configurations';
19
+ import { SdViewDefDirective, SdSuffixDefDirective } from '@sd-angular/core/forms/directives';
24
20
  import { SdLabel } from '@sd-angular/core/forms/label';
21
+ import { SD_FORM_CONFIGURATION, SdFormControl, HandleSdCustomValidator } from '@sd-angular/core/forms/models';
22
+ import { SdFormatNumberPipe } from '@sd-angular/core/pipes';
23
+ import { NumberUtilities } from '@sd-angular/core/utilities/extensions';
24
+ import { Subscription } from 'rxjs';
25
25
 
26
- /* eslint-disable @angular-eslint/component-class-suffix */
27
- /* eslint-disable @angular-eslint/no-input-rename */
28
- /* eslint-disable @typescript-eslint/no-explicit-any */
29
26
  class SdInputNumberErrotStateMatcher {
30
27
  formControl;
31
28
  constructor(formControl) {
@@ -37,146 +34,125 @@ class SdInputNumberErrotStateMatcher {
37
34
  }
38
35
  }
39
36
  class SdInputNumber {
40
- ref;
41
- coreConfiguration;
42
- formatNumberPipe;
43
- formConfig;
44
37
  id = `I${uuid.v4()}`;
45
- autoId;
46
- set _autoId(val) {
47
- if (!val) {
48
- return;
49
- }
50
- this.autoId = `forms-input-number-${val}`;
51
- }
52
- #name = uuid.v4();
53
- set name(val) {
54
- if (val) {
55
- this.#name = val;
56
- }
57
- }
58
- size = 'md';
59
- #form;
60
- set form(val) {
61
- if (val) {
62
- if (val instanceof NgForm) {
63
- this.#form = val.form;
64
- }
65
- else {
66
- this.#form = val;
67
- }
68
- }
69
- }
70
- label;
71
- set _label(val) {
72
- this.label = val;
73
- }
74
- helperText;
75
- set _helperText(val) {
76
- this.helperText = val;
77
- }
78
- placeholder;
79
- hideInlineError = false;
80
- set _hideInlineError(val) {
81
- this.hideInlineError = val === '' || val;
82
- }
83
- #blurOnEnter = false;
84
- set _blurOnEnter(val) {
85
- this.#blurOnEnter = val === '' || val;
86
- }
87
- #model;
88
- set model(value) {
89
- if (this.#model !== value) {
90
- this.#model = value;
91
- this.formControl.setValue(this.#model, {
92
- emitEvent: false,
93
- });
94
- if (value || value === 0) {
95
- const val = value.toString().replace(/\./g, this.#decimalSeparator);
96
- this.inputControl.setValue(this.#getValueWithFormat(val), {
97
- emitEvent: false,
98
- });
99
- }
100
- else {
101
- this.inputControl.setValue('', {
102
- emitEvent: false,
103
- });
104
- }
105
- }
106
- }
107
- modelChange = new EventEmitter();
108
- // Validator
109
- required = false;
110
- set _required(val) {
111
- this.required = val === '' || !!val;
112
- this.#updateValidator();
113
- }
114
- type; //negative: chỉ nhập số âm, positive: chỉ số dương
115
- precision = 3; //số chữ số thập phân
116
- readonly = false;
117
- set _readonly(val) {
118
- this.readonly = val === '' || val;
119
- }
120
- min;
121
- set _min(val) {
122
- this.min = val ?? undefined;
123
- this.#updateValidator();
124
- }
125
- max;
126
- set _max(val) {
127
- this.max = val ?? undefined;
128
- this.#updateValidator();
129
- }
130
- #validator;
131
- set validator(validator) {
132
- this.#validator = validator;
133
- this.#updateValidator();
134
- }
135
- inlineError;
136
- set _inlineError(val) {
137
- this.inlineError = val;
138
- this.#updateValidator();
139
- }
140
- set disabled(val) {
141
- val = val === '' || val;
142
- if (val) {
143
- this.inputControl.disable();
144
- this.formControl.disable();
145
- }
146
- else {
147
- this.inputControl.enable();
148
- this.formControl.enable();
149
- }
150
- }
151
- viewed = false;
152
- set _viewed(val) {
153
- this.viewed = val === '' || !!val;
154
- }
155
- hyperlink;
156
- appearance = 'outline';
157
- sdChange = new EventEmitter();
158
- sdFocus = new EventEmitter();
159
- sdBlur = new EventEmitter();
38
+ // ==========================================
39
+ // 1. SIGNAL QUERIES
40
+ // ==========================================
41
+ control = viewChild('control');
42
+ sdLabelTemplate = contentChild('sdLabel');
43
+ sdValueTemplate = contentChild('sdValue');
44
+ sdViewDef = contentChild(SdViewDefDirective);
45
+ sdSuffixDef = contentChild(SdSuffixDefDirective);
46
+ // ==========================================
47
+ // 2. INJECTS
48
+ // ==========================================
49
+ ref = inject(ChangeDetectorRef);
50
+ coreConfiguration = inject(SD_CORE_CONFIGURATION, { optional: true });
51
+ formatNumberPipe = inject(SdFormatNumberPipe);
52
+ formConfig = inject(SD_FORM_CONFIGURATION, { optional: true });
53
+ // ==========================================
54
+ // 3. SIGNAL INPUTS & MODEL
55
+ // ==========================================
56
+ autoIdInput = input(undefined, { alias: 'autoId' });
57
+ autoId = computed(() => (this.autoIdInput() ? `forms-input-number-${this.autoIdInput()}` : undefined));
58
+ name = input(uuid.v4());
59
+ size = input('md');
60
+ // Chấp nhận mọi loại Form cha truyền xuống (FormGroup<{}>, FormGroup<any>, NgForm...)
61
+ form = input();
62
+ label = input();
63
+ helperText = input();
64
+ placeholder = input();
65
+ hideInlineError = input(false, { transform: booleanAttribute });
66
+ blurOnEnter = input(false, { transform: booleanAttribute });
67
+ required = input(false, { transform: booleanAttribute });
68
+ readonly = input(false, { transform: booleanAttribute });
69
+ disabled = input(false, { transform: booleanAttribute });
70
+ viewed = input(false, { transform: booleanAttribute });
71
+ type = input();
72
+ precision = input(3);
73
+ min = input(undefined, { transform: v => (v == null ? undefined : Number(v)) });
74
+ max = input(undefined, { transform: v => (v == null ? undefined : Number(v)) });
75
+ validator = input();
76
+ inlineError = input();
77
+ hyperlink = input();
78
+ appearanceInput = input(undefined, { alias: 'appearance' });
79
+ appearance = computed(() => this.appearanceInput() ?? this.formConfig?.appearance ?? 'outline');
80
+ valueModel = model(undefined, { alias: 'model' });
81
+ // ==========================================
82
+ // 4. SIGNAL OUTPUTS (Giữ lại sdFocusForceBlur)
83
+ // ==========================================
84
+ sdChange = output();
85
+ sdFocus = output();
86
+ sdBlur = output();
87
+ keyupEnter = output();
160
88
  sdFocusForceBlur = new EventEmitter();
161
- keyupEnter = new EventEmitter();
162
- control;
89
+ // ==========================================
90
+ // 5. INTERNAL STATE & COMPUTED
91
+ // ==========================================
163
92
  formControl = new SdFormControl();
164
93
  inputControl = new SdFormControl();
165
94
  #subscription = new Subscription();
166
95
  matcher = new SdInputNumberErrotStateMatcher(this.formControl);
167
96
  #preCompositionValue;
168
- sdViewDef;
169
- sdSuffixDef;
170
- sdLabelDef;
171
97
  isFocused = false;
172
- constructor(ref, coreConfiguration, formatNumberPipe, formConfig) {
173
- this.ref = ref;
174
- this.coreConfiguration = coreConfiguration;
175
- this.formatNumberPipe = formatNumberPipe;
176
- this.formConfig = formConfig;
98
+ // Dùng computed thay cho getter cũ để tận dụng cache
99
+ decimalSeparator = computed(() => (this.coreConfiguration?.format?.number === '1.234.567,89' ? ',' : '.'));
100
+ thousandsSeparator = computed(() => (this.coreConfiguration?.format?.number === '1.234.567,89' ? '.' : ','));
101
+ regexPattern = computed(() => {
102
+ const decimal = this.decimalSeparator();
103
+ const thousand = this.thousandsSeparator();
104
+ const escDecimal = decimal === '.' ? '\\.' : decimal;
105
+ const escThousand = thousand === '.' ? '\\.' : thousand;
106
+ const integerPart = `(([0-9]+(${escThousand}[0-9])?)+)`;
107
+ const decimalPart = this.precision() > 0 ? `(${escDecimal}[0-9]{0,${this.precision()}})?` : '';
108
+ const baseReg = `${integerPart}${decimalPart}$`;
109
+ if (this.type() === 'negative')
110
+ return `[-]${baseReg}`;
111
+ if (!this.type())
112
+ return `[-]?${baseReg}`;
113
+ return baseReg;
114
+ });
115
+ constructor() {
116
+ // EFFECT 1: Sync model thay đổi từ bên ngoài (Parent -> Component)
117
+ effect(() => {
118
+ const val = this.valueModel();
119
+ untracked(() => {
120
+ if (this.formControl.value !== val) {
121
+ this.formControl.setValue(val, { emitEvent: false });
122
+ if (val != null && val !== '') {
123
+ const strVal = val.toString().replace(/\./g, this.decimalSeparator());
124
+ this.inputControl.setValue(this.#getValueWithFormat(strVal), { emitEvent: false });
125
+ }
126
+ else {
127
+ this.inputControl.setValue('', { emitEvent: false });
128
+ }
129
+ }
130
+ });
131
+ });
132
+ // EFFECT 2: Sync Disable
133
+ effect(() => {
134
+ if (this.disabled()) {
135
+ this.inputControl.disable({ emitEvent: false });
136
+ this.formControl.disable({ emitEvent: false });
137
+ }
138
+ else {
139
+ this.inputControl.enable({ emitEvent: false });
140
+ this.formControl.enable({ emitEvent: false });
141
+ }
142
+ });
143
+ // EFFECT 3: Update Validator
144
+ effect(() => {
145
+ const req = this.required();
146
+ const minVal = this.min();
147
+ const maxVal = this.max();
148
+ const val = this.validator();
149
+ const inl = this.inlineError();
150
+ untracked(() => {
151
+ this.#updateValidator(req, minVal, maxVal, val, inl);
152
+ });
153
+ });
177
154
  }
178
155
  ngOnInit() {
179
- this.appearance = this.appearance || this.formConfig?.appearance;
180
156
  this.#subscription.add(this.inputControl.touchChanges.subscribe(() => {
181
157
  this.formControl.markAsTouched();
182
158
  this.ref.markForCheck();
@@ -188,36 +164,6 @@ class SdInputNumber {
188
164
  this.ref.markForCheck();
189
165
  }));
190
166
  }
191
- get #decimalSeparator() {
192
- if (this.coreConfiguration?.format?.number === '1.234.567,89') {
193
- return ',';
194
- }
195
- return '.';
196
- }
197
- get #thousandsSeparator() {
198
- if (this.coreConfiguration?.format?.number === '1.234.567,89') {
199
- return '.';
200
- }
201
- return ',';
202
- }
203
- get #regex() {
204
- const decimal = this.#decimalSeparator;
205
- const thousand = this.#thousandsSeparator;
206
- const escDecimal = decimal === '.' ? '\\.' : decimal;
207
- const escThousand = thousand === '.' ? '\\.' : thousand;
208
- // Phần nguyên: có thể có hoặc không có phân cách hàng nghìn
209
- const integerPart = `(([0-9]+(${escThousand}[0-9])?)+)`; //`([0-9]{1,3}(${escThousand}[0-9]{3})*|[0-9]+)`;
210
- // Phần thập phân: có hoặc không, tùy theo precision
211
- const decimalPart = this.precision > 0 ? `(${escDecimal}[0-9]{0,${this.precision}})?` : '';
212
- let result = `${integerPart}${decimalPart}$`;
213
- if (this.type === 'negative') {
214
- result = `[-]${integerPart}${decimalPart}$`;
215
- }
216
- else if (!this.type) {
217
- result = `[-]?${integerPart}${decimalPart}$`;
218
- }
219
- return result;
220
- }
221
167
  ngAfterViewInit() {
222
168
  this.#subscription.add(this.inputControl.valueChanges.subscribe(() => {
223
169
  const val = this.inputControl.value;
@@ -227,19 +173,23 @@ class SdInputNumber {
227
173
  }
228
174
  const value = this.#toNumber(val);
229
175
  if (!isNaN(value)) {
230
- this.inputControl.setValue(this.#getValueWithFormat(val), {
231
- emitEvent: false,
232
- });
176
+ this.inputControl.setValue(this.#getValueWithFormat(val), { emitEvent: false });
233
177
  this.#onChange(value);
234
178
  }
235
179
  }));
236
- this.#form?.addControl(this.#name, this.formControl);
180
+ const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
181
+ formGroup?.addControl(this.name(), this.formControl);
237
182
  this.ref.detectChanges();
238
183
  }
184
+ ngOnDestroy() {
185
+ const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
186
+ formGroup?.removeControl(this.name());
187
+ this.#subscription.unsubscribe();
188
+ }
239
189
  #getValueWithFormat = (value) => {
240
- const arrayNext = value.split(this.#decimalSeparator);
190
+ const arrayNext = value.split(this.decimalSeparator());
241
191
  if (arrayNext.length >= 2) {
242
- return `${this.#formatNumber(arrayNext[0])}${this.#decimalSeparator}${arrayNext[1]}`;
192
+ return `${this.#formatNumber(arrayNext[0])}${this.decimalSeparator()}${arrayNext[1]}`;
243
193
  }
244
194
  return this.#formatNumber(value);
245
195
  };
@@ -253,54 +203,36 @@ class SdInputNumber {
253
203
  };
254
204
  #toNumber = (text) => {
255
205
  const raw = text?.toString() || '';
256
- const value = raw
257
- .split(this.#thousandsSeparator)
258
- .join('') // Xóa dấu phân cách phần nghìn
259
- .replace(this.#decimalSeparator, '.'); // Chuyển dấu phân cách thập phân về dấu .
206
+ const value = raw.split(this.thousandsSeparator()).join('').replace(this.decimalSeparator(), '.');
260
207
  return +value;
261
208
  };
262
- ngOnDestroy() {
263
- this.#form?.removeControl(this.#name);
264
- this.#subscription.unsubscribe();
265
- }
266
209
  reValidate = () => {
267
210
  this.formControl.updateValueAndValidity();
268
211
  };
269
- #updateValidator = () => {
270
- this.formControl.clearValidators();
271
- this.formControl.clearAsyncValidators();
212
+ #updateValidator = (req, minVal, maxVal, val, inl) => {
272
213
  const validators = [];
273
214
  const asyncValidators = [];
274
- if (this.required) {
215
+ if (req)
275
216
  validators.push(Validators.required);
276
- }
277
- if (this.min || this.min === 0) {
278
- validators.push(Validators.min(this.min));
279
- }
280
- if (this.max || this.max === 0) {
281
- validators.push(Validators.max(this.max));
282
- }
283
- if (this.#validator) {
284
- asyncValidators.push(HandleSdCustomValidator(this.#validator));
285
- }
286
- if (this.inlineError) {
217
+ if (minVal != null)
218
+ validators.push(Validators.min(minVal));
219
+ if (maxVal != null)
220
+ validators.push(Validators.max(maxVal));
221
+ if (val)
222
+ asyncValidators.push(HandleSdCustomValidator(val));
223
+ if (inl)
287
224
  validators.push(this.customInlineErrorValidator());
288
- }
289
- this.formControl.setValidators(validators);
290
- this.formControl.setAsyncValidators(asyncValidators);
291
- this.formControl.updateValueAndValidity();
225
+ this.formControl.setValidators(validators.length ? validators : null);
226
+ this.formControl.setAsyncValidators(asyncValidators.length ? asyncValidators : null);
227
+ this.formControl.updateValueAndValidity({ emitEvent: false });
292
228
  };
293
- // Hàm tạo Validators tùy chỉnh cho inlineError
294
229
  customInlineErrorValidator() {
295
- return () => {
296
- return { inlineError: true };
297
- };
230
+ return () => ({ inlineError: true });
298
231
  }
299
232
  #onChange = (value) => {
300
- this.#model = value ?? null;
301
- this.modelChange.emit(this.#model);
302
- this.sdChange.emit(this.#model);
303
- this.formControl.setValue(this.#model);
233
+ this.valueModel.set(value ?? null);
234
+ this.sdChange.emit(value ?? null);
235
+ this.formControl.setValue(value ?? null, { emitEvent: false });
304
236
  };
305
237
  onKeyupEnter = () => {
306
238
  const val = (this.inputControl.value ?? '').toString();
@@ -308,7 +240,7 @@ class SdInputNumber {
308
240
  this.inputControl.setValue(val.trim());
309
241
  }
310
242
  this.keyupEnter.emit(this.inputControl.value);
311
- if (this.#blurOnEnter) {
243
+ if (this.blurOnEnter()) {
312
244
  this.blur();
313
245
  }
314
246
  };
@@ -318,15 +250,12 @@ class SdInputNumber {
318
250
  return;
319
251
  }
320
252
  const key = event.keyCode || event.charCode;
321
- if (key == 8 || key == 46 || key == 37 || key == 39 || key == 35 || key == 36 || key == 9) {
253
+ if (key == 8 || key == 46 || key == 37 || key == 39 || key == 35 || key == 36 || key == 9)
322
254
  return;
323
- }
324
- if (event.ctrlKey && (event.key == 'c' || event.key == 'x' || event.key == 'a')) {
255
+ if (event.ctrlKey && (event.key == 'c' || event.key == 'x' || event.key == 'a'))
325
256
  return;
326
- }
327
- if (event.shiftKey && key == 9) {
257
+ if (event.shiftKey && key == 9)
328
258
  return;
329
- }
330
259
  this.#checkValue(event, event.key);
331
260
  };
332
261
  onPaste(event) {
@@ -335,7 +264,7 @@ class SdInputNumber {
335
264
  }
336
265
  onCompositionEnd(event) {
337
266
  const compositionValue = event.data;
338
- const regExp = new RegExp(`^${this.#regex}`, 'g');
267
+ const regExp = new RegExp(`^${this.regexPattern()}`, 'g');
339
268
  if (compositionValue && !String(compositionValue).match(regExp)) {
340
269
  this.inputControl.setValue(this.#preCompositionValue || '');
341
270
  }
@@ -346,33 +275,22 @@ class SdInputNumber {
346
275
  }
347
276
  #checkValue = (event, nextKey) => {
348
277
  const current = event?.target?.value;
349
- // if(this.maxNumber === +current.toString().replace(/\./g, '').replace(/,/g, '.')){
350
- // event.preventDefault();
351
- // return;
352
- // }
353
278
  const curval_arr = current.split('');
354
279
  curval_arr.splice(event.target.selectionStart, event.target.selectionEnd - event.target.selectionStart, nextKey || '');
355
280
  const newval = curval_arr.join('');
356
- if (this.type !== 'positive' && newval === '-') {
281
+ if (this.type() !== 'positive' && newval === '-')
357
282
  return;
358
- }
359
- const regExp = new RegExp(`^${this.#regex}`, 'g');
283
+ const regExp = new RegExp(`^${this.regexPattern()}`, 'g');
360
284
  if (newval && !String(newval).match(regExp)) {
361
285
  event.preventDefault();
362
286
  return;
363
287
  }
364
- // const value = (newval.toString().replace(/\./g, '').replace(/,/g, '.'));
365
- // if ((this.maxNumber || this.maxNumber === 0) && +value > this.maxNumber) {
366
- // setTimeout(() => {
367
- // this.inputControl.setValue(this.#getValueWithFormat(this.maxNumber.toString().replace(/\./g, ',')));
368
- // }, 10);
369
- // event.preventDefault();
370
- // }
371
288
  };
372
289
  onFocus = () => {
373
290
  this.isFocused = true;
374
291
  this.sdFocus.emit();
375
- if (this.sdFocusForceBlur.observers?.length > 0) {
292
+ // RxJS 7 chuẩn bài
293
+ if (this.sdFocusForceBlur.observed) {
376
294
  this.blur();
377
295
  this.sdFocusForceBlur.emit();
378
296
  }
@@ -380,7 +298,13 @@ class SdInputNumber {
380
298
  onBlur = () => {
381
299
  this.isFocused = false;
382
300
  const val = (this.inputControl.value ?? '').toString();
383
- const arrayValue = val.split(this.#decimalSeparator);
301
+ if (!val || val.trim() === '') {
302
+ this.inputControl.setValue('', { emitEvent: false });
303
+ this.#onChange(null);
304
+ this.sdBlur.emit(null);
305
+ return;
306
+ }
307
+ const arrayValue = val.split(this.decimalSeparator());
384
308
  if (arrayValue.length >= 2 && arrayValue[1] == '') {
385
309
  this.inputControl.setValue(this.#formatNumber(arrayValue[0]));
386
310
  return;
@@ -391,7 +315,7 @@ class SdInputNumber {
391
315
  this.sdBlur.emit(this.formControl.value);
392
316
  };
393
317
  onClick = () => {
394
- if (this.sdViewDef?.templateRef) {
318
+ if (this.sdViewDef()?.templateRef) {
395
319
  if (!this.formControl.disabled && !this.isFocused) {
396
320
  this.focus();
397
321
  }
@@ -399,16 +323,16 @@ class SdInputNumber {
399
323
  };
400
324
  blur = () => {
401
325
  this.isFocused = false;
402
- this.control?.nativeElement?.blur();
326
+ this.control()?.nativeElement?.blur();
403
327
  };
404
328
  focus = () => {
405
329
  this.isFocused = true;
406
330
  setTimeout(() => {
407
- this.control?.nativeElement?.focus();
331
+ this.control()?.nativeElement?.focus();
408
332
  }, 100);
409
333
  };
410
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdInputNumber, deps: [{ token: i0.ChangeDetectorRef }, { token: SD_CORE_CONFIGURATION, optional: true }, { token: i1.SdFormatNumberPipe }, { token: SD_FORM_CONFIGURATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
411
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdInputNumber, isStandalone: true, selector: "sd-input-number", inputs: { _autoId: ["autoId", "_autoId"], name: "name", size: "size", form: "form", _label: ["label", "_label"], _helperText: ["helperText", "_helperText"], placeholder: "placeholder", _hideInlineError: ["hideInlineError", "_hideInlineError"], _blurOnEnter: ["blurOnEnter", "_blurOnEnter"], model: "model", _required: ["required", "_required"], type: "type", precision: "precision", _readonly: ["readonly", "_readonly"], _min: ["min", "_min"], _max: ["max", "_max"], validator: "validator", _inlineError: ["inlineError", "_inlineError"], disabled: "disabled", _viewed: ["viewed", "_viewed"], hyperlink: "hyperlink", appearance: "appearance" }, outputs: { modelChange: "modelChange", sdChange: "sdChange", sdFocus: "sdFocus", sdBlur: "sdBlur", sdFocusForceBlur: "sdFocusForceBlur", keyupEnter: "keyupEnter" }, queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true }], viewQueries: [{ propertyName: "control", first: true, predicate: ["control"], descendants: true }], ngImport: i0, template: "@if (viewed) {\r\n @if (sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef!.templateRef\"> </ng-container>\r\n } @else if (label) {\r\n <div class=\"text-secondary\">{{ label }}</div>\r\n }\r\n @if (hyperlink) {\r\n <!-- N\u1EBFu c\u00F3 hyperlink th\u00EC d\u00F9ng th\u1EBB a -->\r\n <a [href]=\"hyperlink\">{{ formControl.value }}</a>\r\n } @else {\r\n <!-- Ngo\u00E0i ra d\u00F9ng th\u1EBB m\u1EB7c \u0111\u1ECBnh -->\r\n <div class=\"T16M\">{{ formControl.value | sdFormatNumber }}</div>\r\n }\r\n} @else {\r\n @if (!appearance && sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!appearance && label && !sdLabelDef?.templateRef) {\r\n <sd-label [label]=\"label\" [required]=\"required\"></sd-label>\r\n }\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!sdViewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n @if (sdViewDef?.templateRef && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n sdViewDef!.templateRef;\r\n context: {\r\n value: formControl.value\r\n }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size === 'md'\"\r\n [class.sd-sm]=\"size === 'sm'\"\r\n [class.hide-inline-error]=\"hideInlineError\"\r\n [appearance]=\"appearance\">\r\n @if (appearance && label) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ label }}</span>\r\n @if (helperText) {\r\n <mat-icon [matTooltip]=\"helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n #control\r\n matInput\r\n [placeholder]=\"placeholder || label || ''\"\r\n [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n (keydown)=\"onKeydown($event)\"\r\n (compositionstart)=\"onCompositionStart($event)\"\r\n (compositionend)=\"onCompositionEnd($event)\"\r\n [required]=\"required\"\r\n [readonly]=\"readonly\"\r\n [autocomplete]=\"id\"\r\n (paste)=\"onPaste($event)\"\r\n autocorrect=\"off\"\r\n [attr.data-autoId]=\"autoId\" />\r\n <ng-container *ngIf=\"sdSuffixDef?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdSuffixDef?.templateRef ?? null\"> </ng-container>\r\n </ng-container>\r\n <mat-error *ngIf=\"formControl?.errors?.['required']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['min']\">\r\n <ng-container *ngIf=\"!hideInlineError\"\r\n >{{ 'Kh\u00F4ng nh\u1EADp b\u00E9 h\u01A1n ' }} <strong>{{ min }}</strong></ng-container\r\n >\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['max']\">\r\n <ng-container *ngIf=\"!hideInlineError\"\r\n >{{ 'Kh\u00F4ng nh\u1EADp l\u1EDBn h\u01A1n ' }} <strong>{{ max }}</strong></ng-container\r\n >\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['customValidator']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ formControl.errors?.['customValidator'] }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['inlineError']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ inlineError }}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- <sd-popover #error=\"sdPopover\" type=\"danger\" width=\"300px\">\r\n <span *ngIf=\"formControl.errors?.required\">\r\n {{ \"Vui l\u00F2ng nh\u1EADp th\u00F4ng tin\" | sdTranslate }}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep .mat-mdc-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;text-align:center;margin:auto;width:30px}:host{padding-top:5px;display:block}.sd-md:hover .btn-copy{visibility:visible}.btn-copy{visibility:hidden;background:#e9e9e9!important;line-height:26px!important;margin-bottom:3px;font-size:12px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "pipe", type: SdFormatNumberPipe, name: "sdFormatNumber" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
334
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdInputNumber, deps: [], target: i0.ɵɵFactoryTarget.Component });
335
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdInputNumber, isStandalone: true, selector: "sd-input-number", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, helperText: { classPropertyName: "helperText", publicName: "helperText", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, hideInlineError: { classPropertyName: "hideInlineError", publicName: "hideInlineError", isSignal: true, isRequired: false, transformFunction: null }, blurOnEnter: { classPropertyName: "blurOnEnter", publicName: "blurOnEnter", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, viewed: { classPropertyName: "viewed", publicName: "viewed", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, precision: { classPropertyName: "precision", publicName: "precision", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, inlineError: { classPropertyName: "inlineError", publicName: "inlineError", isSignal: true, isRequired: false, transformFunction: null }, hyperlink: { classPropertyName: "hyperlink", publicName: "hyperlink", isSignal: true, isRequired: false, transformFunction: null }, appearanceInput: { classPropertyName: "appearanceInput", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdFocus: "sdFocus", sdBlur: "sdBlur", keyupEnter: "keyupEnter", sdFocusForceBlur: "sdFocusForceBlur" }, queries: [{ propertyName: "sdLabelTemplate", first: true, predicate: ["sdLabel"], descendants: true, isSignal: true }, { propertyName: "sdValueTemplate", first: true, predicate: ["sdValue"], descendants: true, isSignal: true }, { propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true, isSignal: true }, { propertyName: "sdSuffixDef", first: true, predicate: SdSuffixDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "control", first: true, predicate: ["control"], descendants: true, isSignal: true }], ngImport: i0, template: "@let lbl = label();\r\n@let app = appearance();\r\n@let hideErr = hideInlineError();\r\n@let viewDef = sdViewDef();\r\n@let hText = helperText();\r\n\r\n@if (viewed()) {\r\n <sd-view\r\n [label]=\"lbl\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value | sdFormatNumber\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!app) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (lbl) {\r\n <sd-label [label]=\"lbl\" [required]=\"required()\"></sd-label>\r\n }\r\n </ng-content>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (viewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"viewDef!.templateRef; context: { value: formControl.value }\"> </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"hideErr\"\r\n [appearance]=\"app!\">\r\n \r\n @if (app && lbl) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ lbl }}</span>\r\n @if (hText) {\r\n <mat-icon [matTooltip]=\"hText\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n\r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n #control\r\n matInput\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n (keydown)=\"onKeydown($event)\"\r\n (compositionstart)=\"onCompositionStart($event)\"\r\n (compositionend)=\"onCompositionEnd($event)\"\r\n [required]=\"required()\"\r\n [readonly]=\"readonly()\"\r\n [autocomplete]=\"id\"\r\n (paste)=\"onPaste($event)\"\r\n autocorrect=\"off\"\r\n [attr.data-autoId]=\"autoId()\" />\r\n\r\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\r\n <ng-container matSuffix>\r\n <ng-container [ngTemplateOutlet]=\"suffixRef\"></ng-container>\r\n </ng-container>\r\n }\r\n\r\n @if (formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['min']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Gi\u00E1 tr\u1ECB kh\u00F4ng \u0111\u01B0\u1EE3c nh\u1ECF h\u01A1n ' }} <strong>{{ min() }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['max']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Gi\u00E1 tr\u1ECB kh\u00F4ng \u0111\u01B0\u1EE3c l\u1EDBn h\u01A1n ' }} <strong>{{ max() }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['inlineError']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ inlineError() }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep .mat-mdc-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;text-align:center;margin:auto;width:30px}:host{padding-top:5px;display:block}.sd-md:hover .btn-copy{visibility:visible}.btn-copy{visibility:hidden;background:#e9e9e9!important;line-height:26px!important;margin-bottom:3px;font-size:12px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "pipe", type: SdFormatNumberPipe, name: "sdFormatNumber" }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
412
336
  }
413
337
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdInputNumber, decorators: [{
414
338
  type: Component,
@@ -422,97 +346,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
422
346
  MatTooltipModule,
423
347
  MatButtonModule,
424
348
  SdLabel,
425
- SdFormatNumberPipe
426
- ], template: "@if (viewed) {\r\n @if (sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef!.templateRef\"> </ng-container>\r\n } @else if (label) {\r\n <div class=\"text-secondary\">{{ label }}</div>\r\n }\r\n @if (hyperlink) {\r\n <!-- N\u1EBFu c\u00F3 hyperlink th\u00EC d\u00F9ng th\u1EBB a -->\r\n <a [href]=\"hyperlink\">{{ formControl.value }}</a>\r\n } @else {\r\n <!-- Ngo\u00E0i ra d\u00F9ng th\u1EBB m\u1EB7c \u0111\u1ECBnh -->\r\n <div class=\"T16M\">{{ formControl.value | sdFormatNumber }}</div>\r\n }\r\n} @else {\r\n @if (!appearance && sdLabelDef?.templateRef) {\r\n <ng-container *ngTemplateOutlet=\"sdLabelDef!.templateRef\"> </ng-container>\r\n }\r\n @if (!appearance && label && !sdLabelDef?.templateRef) {\r\n <sd-label [label]=\"label\" [required]=\"required\"></sd-label>\r\n }\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!sdViewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n @if (sdViewDef?.templateRef && !isFocused) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n sdViewDef!.templateRef;\r\n context: {\r\n value: formControl.value\r\n }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size === 'md'\"\r\n [class.sd-sm]=\"size === 'sm'\"\r\n [class.hide-inline-error]=\"hideInlineError\"\r\n [appearance]=\"appearance\">\r\n @if (appearance && label) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ label }}</span>\r\n @if (helperText) {\r\n <mat-icon [matTooltip]=\"helperText\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n #control\r\n matInput\r\n [placeholder]=\"placeholder || label || ''\"\r\n [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n (keydown)=\"onKeydown($event)\"\r\n (compositionstart)=\"onCompositionStart($event)\"\r\n (compositionend)=\"onCompositionEnd($event)\"\r\n [required]=\"required\"\r\n [readonly]=\"readonly\"\r\n [autocomplete]=\"id\"\r\n (paste)=\"onPaste($event)\"\r\n autocorrect=\"off\"\r\n [attr.data-autoId]=\"autoId\" />\r\n <ng-container *ngIf=\"sdSuffixDef?.templateRef\" matSuffix>\r\n <ng-container *ngTemplateOutlet=\"sdSuffixDef?.templateRef ?? null\"> </ng-container>\r\n </ng-container>\r\n <mat-error *ngIf=\"formControl?.errors?.['required']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['min']\">\r\n <ng-container *ngIf=\"!hideInlineError\"\r\n >{{ 'Kh\u00F4ng nh\u1EADp b\u00E9 h\u01A1n ' }} <strong>{{ min }}</strong></ng-container\r\n >\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['max']\">\r\n <ng-container *ngIf=\"!hideInlineError\"\r\n >{{ 'Kh\u00F4ng nh\u1EADp l\u1EDBn h\u01A1n ' }} <strong>{{ max }}</strong></ng-container\r\n >\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['customValidator']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ formControl.errors?.['customValidator'] }}</ng-container>\r\n </mat-error>\r\n <mat-error *ngIf=\"formControl.errors?.['inlineError']\">\r\n <ng-container *ngIf=\"!hideInlineError\">{{ inlineError }}</ng-container>\r\n </mat-error>\r\n </mat-form-field>\r\n }\r\n </div>\r\n <!-- <sd-popover #error=\"sdPopover\" type=\"danger\" width=\"300px\">\r\n <span *ngIf=\"formControl.errors?.required\">\r\n {{ \"Vui l\u00F2ng nh\u1EADp th\u00F4ng tin\" | sdTranslate }}\r\n </span>\r\n <span *ngIf=\"formControl.errors?.customValidator\">\r\n {{formControl.errors?.customValidator}}\r\n </span>\r\n</sd-popover> -->\r\n}\r\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep .mat-mdc-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;text-align:center;margin:auto;width:30px}:host{padding-top:5px;display:block}.sd-md:hover .btn-copy{visibility:visible}.btn-copy{visibility:hidden;background:#e9e9e9!important;line-height:26px!important;margin-bottom:3px;font-size:12px}\n"] }]
427
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
428
- type: Inject,
429
- args: [SD_CORE_CONFIGURATION]
430
- }, {
431
- type: Optional
432
- }] }, { type: i1.SdFormatNumberPipe }, { type: undefined, decorators: [{
433
- type: Inject,
434
- args: [SD_FORM_CONFIGURATION]
435
- }, {
436
- type: Optional
437
- }] }], propDecorators: { _autoId: [{
438
- type: Input,
439
- args: ['autoId']
440
- }], name: [{
441
- type: Input
442
- }], size: [{
443
- type: Input
444
- }], form: [{
445
- type: Input
446
- }], _label: [{
447
- type: Input,
448
- args: ['label']
449
- }], _helperText: [{
450
- type: Input,
451
- args: ['helperText']
452
- }], placeholder: [{
453
- type: Input
454
- }], _hideInlineError: [{
455
- type: Input,
456
- args: ['hideInlineError']
457
- }], _blurOnEnter: [{
458
- type: Input,
459
- args: ['blurOnEnter']
460
- }], model: [{
461
- type: Input
462
- }], modelChange: [{
463
- type: Output
464
- }], _required: [{
465
- type: Input,
466
- args: ['required']
467
- }], type: [{
468
- type: Input
469
- }], precision: [{
470
- type: Input
471
- }], _readonly: [{
472
- type: Input,
473
- args: ['readonly']
474
- }], _min: [{
475
- type: Input,
476
- args: ['min']
477
- }], _max: [{
478
- type: Input,
479
- args: ['max']
480
- }], validator: [{
481
- type: Input
482
- }], _inlineError: [{
483
- type: Input,
484
- args: ['inlineError']
485
- }], disabled: [{
486
- type: Input
487
- }], _viewed: [{
488
- type: Input,
489
- args: ['viewed']
490
- }], hyperlink: [{
491
- type: Input
492
- }], appearance: [{
493
- type: Input
494
- }], sdChange: [{
495
- type: Output
496
- }], sdFocus: [{
497
- type: Output
498
- }], sdBlur: [{
499
- type: Output
500
- }], sdFocusForceBlur: [{
501
- type: Output
502
- }], keyupEnter: [{
349
+ SdFormatNumberPipe,
350
+ SdView,
351
+ ], template: "@let lbl = label();\r\n@let app = appearance();\r\n@let hideErr = hideInlineError();\r\n@let viewDef = sdViewDef();\r\n@let hText = helperText();\r\n\r\n@if (viewed()) {\r\n <sd-view\r\n [label]=\"lbl\"\r\n [labelTemplate]=\"sdLabelTemplate()\"\r\n [value]=\"formControl.value\"\r\n [display]=\"formControl.value | sdFormatNumber\"\r\n [hyperlink]=\"hyperlink()\"\r\n [valueTemplate]=\"sdValueTemplate()\">\r\n </sd-view>\r\n} @else {\r\n @if (!app) {\r\n <ng-content select=\"[sdLabel]\">\r\n @if (lbl) {\r\n <sd-label [label]=\"lbl\" [required]=\"required()\"></sd-label>\r\n }\r\n </ng-content>\r\n }\r\n\r\n <div\r\n class=\"d-flex align-items-center\"\r\n [class.sd-view]=\"!!viewDef?.templateRef\"\r\n [class.c-focused]=\"isFocused\"\r\n [class.c-disabled]=\"formControl.disabled\"\r\n (click)=\"onClick()\"\r\n aria-hidden=\"true\">\r\n \r\n @if (viewDef?.templateRef && !isFocused) {\r\n <ng-container *ngTemplateOutlet=\"viewDef!.templateRef; context: { value: formControl.value }\"> </ng-container>\r\n } @else {\r\n <mat-form-field\r\n [class.sd-md]=\"size() === 'md'\"\r\n [class.sd-sm]=\"size() === 'sm'\"\r\n [class.hide-inline-error]=\"hideErr\"\r\n [appearance]=\"app!\">\r\n \r\n @if (app && lbl) {\r\n <mat-label style=\"display: inline-block\">\r\n <div style=\"display: flex; align-items: center; gap: 4px\">\r\n <span>{{ lbl }}</span>\r\n @if (hText) {\r\n <mat-icon [matTooltip]=\"hText\" matTooltipPosition=\"below\">info_outline</mat-icon>\r\n }\r\n </div>\r\n </mat-label>\r\n }\r\n\r\n <input\r\n aria-hidden=\"true\"\r\n [id]=\"id\"\r\n [formControl]=\"inputControl\"\r\n #control\r\n matInput\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n [errorStateMatcher]=\"matcher\"\r\n (keyup.enter)=\"onKeyupEnter()\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n (keydown)=\"onKeydown($event)\"\r\n (compositionstart)=\"onCompositionStart($event)\"\r\n (compositionend)=\"onCompositionEnd($event)\"\r\n [required]=\"required()\"\r\n [readonly]=\"readonly()\"\r\n [autocomplete]=\"id\"\r\n (paste)=\"onPaste($event)\"\r\n autocorrect=\"off\"\r\n [attr.data-autoId]=\"autoId()\" />\r\n\r\n @if (sdSuffixDef()?.templateRef; as suffixRef) {\r\n <ng-container matSuffix>\r\n <ng-container [ngTemplateOutlet]=\"suffixRef\"></ng-container>\r\n </ng-container>\r\n }\r\n\r\n @if (formControl.errors?.['required']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['min']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Gi\u00E1 tr\u1ECB kh\u00F4ng \u0111\u01B0\u1EE3c nh\u1ECF h\u01A1n ' }} <strong>{{ min() }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['max']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Gi\u00E1 tr\u1ECB kh\u00F4ng \u0111\u01B0\u1EE3c l\u1EDBn h\u01A1n ' }} <strong>{{ max() }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['customValidator']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n\r\n @if (formControl.errors?.['inlineError']) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ inlineError() }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n}", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-light{color:var(--sd-light)!important}.bg-light{background:var(--sd-light)!important}.border-light{border-color:var(--sd-light)!important}.text-dark{color:var(--sd-dark)!important}.bg-dark{background:var(--sd-dark)!important}.border-dark{border-color:var(--sd-dark)!important}.text-black500{color:var(--sd-black500)!important}.bg-black500{background:var(--sd-black500)!important}.border-black500{border-color:var(--sd-black500)!important}.text-black400{color:var(--sd-black400)!important}.bg-black400{background:var(--sd-black400)!important}.border-black400{border-color:var(--sd-black400)!important}.text-black300{color:var(--sd-black300)!important}.bg-black300{background:var(--sd-black300)!important}.border-black300{border-color:var(--sd-black300)!important}.text-black200{color:var(--sd-black200)!important}.bg-black200{background:var(--sd-black200)!important}.border-black200{border-color:var(--sd-black200)!important}.text-black100{color:var(--sd-black100)!important}.bg-black100{background:var(--sd-black100)!important}.border-black100{border-color:var(--sd-black100)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}:host ::ng-deep .mat-mdc-form-field.sd-form-tooltip{width:calc(100% - 30px)}:host ::ng-deep .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled .mat-mdc-text-field-wrapper{background:var(--sd-black100)}:host ::ng-deep .mat-mdc-form-field input.mat-mdc-input-element:disabled{color:var(--sd-black400)!important}:host ::ng-deep .mat-mdc-form-field .mat-mdc-placeholder-required{color:var(--sd-error)}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}.sd-tooltip{display:inline-block;text-align:center;margin:auto;width:30px}:host{padding-top:5px;display:block}.sd-md:hover .btn-copy{visibility:visible}.btn-copy{visibility:hidden;background:#e9e9e9!important;line-height:26px!important;margin-bottom:3px;font-size:12px}\n"] }]
352
+ }], ctorParameters: () => [], propDecorators: { sdFocusForceBlur: [{
503
353
  type: Output
504
- }], control: [{
505
- type: ViewChild,
506
- args: ['control']
507
- }], sdViewDef: [{
508
- type: ContentChild,
509
- args: [SdViewDefDirective]
510
- }], sdSuffixDef: [{
511
- type: ContentChild,
512
- args: [SdSuffixDefDirective]
513
- }], sdLabelDef: [{
514
- type: ContentChild,
515
- args: [SdLabelDefDirective]
516
354
  }] } });
517
355
 
518
356
  /**