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

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 +211 -357
  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 +241 -416
  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 +50 -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 +50 -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 +89 -71
  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.40.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,12 +1,12 @@
1
1
  import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, ViewChild, ContentChild, Output, Input, Inject, Optional, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { viewChild, contentChild, inject, ChangeDetectorRef, input, computed, booleanAttribute, model, output, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
5
5
  import * as i2 from '@angular/forms';
6
- import { NgForm, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
+ import { Validators, NgForm, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
7
  import { provideMomentDateAdapter } from '@angular/material-moment-adapter';
8
8
  import * as i6 from '@angular/material/datepicker';
9
- import { MatDatepickerModule, MatDatepicker } from '@angular/material/datepicker';
9
+ import { MatDatepicker, MatDatepickerModule } from '@angular/material/datepicker';
10
10
  import { MatFormFieldModule } from '@angular/material/form-field';
11
11
  import * as i4 from '@angular/material/icon';
12
12
  import { MatIconModule } from '@angular/material/icon';
@@ -14,183 +14,137 @@ import * as i3 from '@angular/material/input';
14
14
  import { MatInputModule } from '@angular/material/input';
15
15
  import * as i5 from '@angular/material/tooltip';
16
16
  import { MatTooltipModule } from '@angular/material/tooltip';
17
+ import { SdView } from '@sd-angular/core/components/view';
17
18
  import { SdViewDefDirective, SdLabelDefDirective } from '@sd-angular/core/forms/directives';
18
19
  import { SdLabel } from '@sd-angular/core/forms/label';
19
- import { SdFormControl, SD_FORM_CONFIGURATION } from '@sd-angular/core/forms/models';
20
- import { DateUtilities, SdUtilities } from '@sd-angular/core/utilities/extensions';
20
+ import { SD_FORM_CONFIGURATION, SdFormControl } from '@sd-angular/core/forms/models';
21
+ import { SdUtilities, DateUtilities } from '@sd-angular/core/utilities/extensions';
21
22
  import moment from 'moment';
22
23
  import { Subscription } from 'rxjs';
23
24
  import * as uuid from 'uuid';
24
25
 
25
26
  /* eslint-disable @typescript-eslint/no-explicit-any */
26
27
  /* eslint-disable @angular-eslint/no-input-rename */
27
- // eslint-disable-next-line @angular-eslint/component-class-suffix
28
28
  class SdDate {
29
- ref;
30
- formConfig;
31
29
  id = `I${uuid.v4()}`;
32
- autoId;
33
- set _autoId(val) {
34
- if (!val) {
35
- return;
36
- }
37
- this.autoId = `forms-date-${val}`;
38
- }
39
- isMobileOrTablet = false;
40
- #date;
41
- #name = uuid.v4();
42
- set name(val) {
43
- if (val) {
44
- this.#name = val;
45
- }
46
- }
47
- appearance = 'outline';
48
- hideInlineError = false;
49
- set _hideInlineError(val) {
50
- this.hideInlineError = val === '' || val;
51
- val = val === '' || val;
52
- }
30
+ // ==========================================
31
+ // 1. SIGNAL QUERIES
32
+ // ==========================================
33
+ inputRef = viewChild('input');
34
+ datePicker = viewChild(MatDatepicker);
35
+ sdLabelTemplate = contentChild('sdLabel');
36
+ sdValueTemplate = contentChild('sdValue');
37
+ sdViewDef = contentChild(SdViewDefDirective);
38
+ sdLabelDef = contentChild(SdLabelDefDirective);
39
+ // ==========================================
40
+ // 2. INJECTS
41
+ // ==========================================
42
+ ref = inject(ChangeDetectorRef);
43
+ formConfig = inject(SD_FORM_CONFIGURATION, { optional: true });
44
+ // ==========================================
45
+ // 3. SIGNAL INPUTS & MODEL
46
+ // ==========================================
47
+ autoIdInput = input(undefined, { alias: 'autoId' });
48
+ autoId = computed(() => this.autoIdInput() ? `forms-date-${this.autoIdInput()}` : undefined);
49
+ name = input(uuid.v4());
50
+ size = input('md');
51
+ // Chấp nhận mọi loại Form cha truyền xuống (FormGroup<{}>, FormGroup<any>, NgForm...)
52
+ form = input();
53
+ label = input();
54
+ helperText = input();
55
+ placeholder = input();
56
+ hideInlineError = input(false, { transform: booleanAttribute });
57
+ required = input(false, { transform: booleanAttribute });
58
+ disabled = input(false, { transform: booleanAttribute });
59
+ viewed = input(false, { transform: booleanAttribute });
60
+ inlineError = input();
61
+ hyperlink = input();
62
+ appearanceInput = input(undefined, { alias: 'appearance' });
63
+ appearance = computed(() => this.appearanceInput() ?? this.formConfig?.appearance ?? 'outline');
64
+ // Xử lý thông minh Gom min/minDate và max/maxDate
65
+ minInput = input(undefined, { alias: 'min' });
66
+ minDateInput = input(undefined, { alias: 'minDate' });
67
+ resolvedMin = computed(() => this.#parseDateBoundary(this.minInput() ?? this.minDateInput()));
68
+ maxInput = input(undefined, { alias: 'max' });
69
+ maxDateInput = input(undefined, { alias: 'maxDate' });
70
+ resolvedMax = computed(() => this.#parseDateBoundary(this.maxInput() ?? this.maxDateInput()));
71
+ valueModel = model(undefined, { alias: 'model' });
72
+ // ==========================================
73
+ // 4. SIGNAL OUTPUTS
74
+ // ==========================================
75
+ sdChange = output();
76
+ sdFocus = output();
77
+ // ==========================================
78
+ // 5. INTERNAL STATE & STREAMS
79
+ // ==========================================
80
+ isMobileOrTablet = SdUtilities.isMobile();
53
81
  formControl = new SdFormControl();
54
- min;
55
- set _min(val) {
56
- if (val === 'TODAY') {
57
- this.min = new Date();
58
- }
59
- else if (val && DateUtilities.isDate(val)) {
60
- this.min = new Date(val);
61
- }
62
- else {
63
- this.min = null;
64
- }
65
- }
66
- max;
67
- set _max(val) {
68
- if (val === 'TODAY') {
69
- this.max = new Date();
70
- }
71
- else if (val && DateUtilities.isDate(val)) {
72
- this.max = new Date(val);
73
- }
74
- else {
75
- this.max = null;
76
- }
77
- }
78
- size = 'md';
79
- #form;
80
- set form(val) {
81
- if (val) {
82
- if (val instanceof NgForm) {
83
- this.#form = val.form;
84
- }
85
- else {
86
- this.#form = val;
87
- }
88
- }
89
- }
90
- set disabled(val) {
91
- val = val === '' || !!val;
92
- if (val) {
93
- this.formControl.disable();
94
- }
95
- else {
96
- this.formControl.enable();
97
- }
98
- }
99
- viewed = false;
100
- set _viewed(val) {
101
- this.viewed = val === '' || !!val;
102
- }
103
- hyperlink;
104
- required = false;
105
- set _required(val) {
106
- this.required = val === '' || !!val;
107
- if (this.required) {
108
- this.formControl.setValidators([Validators.required]);
109
- }
110
- else {
111
- this.formControl.clearValidators();
112
- }
113
- }
114
- inlineError;
115
- set _inlineError(val) {
116
- this.inlineError = val;
117
- // this.#updateValidator();
118
- if (this.inlineError) {
119
- this.formControl.setValidators([this.customInlineErrorValidator()]);
120
- this.formControl.updateValueAndValidity();
121
- }
122
- else {
123
- this.formControl.clearValidators();
124
- this.formControl.updateValueAndValidity();
125
- }
126
- }
127
- label;
128
- set _label(val) {
129
- this.label = val;
130
- }
131
- helperText;
132
- set _helperText(val) {
133
- this.helperText = val;
134
- }
135
- placeholder;
136
- set minDate(val) {
137
- if (DateUtilities.isDate(val)) {
138
- this.min = new Date(val);
139
- }
140
- else {
141
- this.min = null;
142
- }
143
- }
144
- set maxDate(val) {
145
- if (DateUtilities.isDate(val)) {
146
- this.max = new Date(val);
147
- }
148
- else {
149
- this.max = null;
150
- }
151
- }
152
- sdChange = new EventEmitter();
153
- sdFocus = new EventEmitter();
154
- set model(val) {
155
- if (!DateUtilities.isDate(val)) {
156
- val = null;
157
- }
158
- val = DateUtilities.toFormat(val, 'yyyy/MM/dd');
159
- if (this.#date !== val) {
160
- this.#date = val;
161
- const date = DateUtilities.isDate(this.#date) ? moment(DateUtilities.toFormat(this.#date, 'yyyy/MM/dd'), 'YYYY/MM/DD') : null;
162
- this.formControl.setValue(date);
163
- }
164
- }
165
- modelChange = new EventEmitter();
166
- #subscription = new Subscription();
167
- sdViewDef;
168
- sdLabelDef;
169
- input;
170
- datePicker;
171
82
  isFocused = false;
172
- constructor(ref, formConfig) {
173
- this.ref = ref;
174
- this.formConfig = formConfig;
175
- this.isMobileOrTablet = SdUtilities.isMobile();
176
- }
177
- ngOnDestroy() {
178
- this.#form?.removeControl(this.#name);
179
- this.#subscription.unsubscribe();
83
+ isValid;
84
+ #date;
85
+ #subscription = new Subscription();
86
+ constructor() {
87
+ // EFFECT 1: Sync model thay đổi từ bên ngoài (String/Date -> Moment)
88
+ effect(() => {
89
+ let val = this.valueModel();
90
+ untracked(() => {
91
+ if (!DateUtilities.isDate(val)) {
92
+ val = null;
93
+ }
94
+ val = DateUtilities.toFormat(val, 'yyyy/MM/dd');
95
+ if (this.#date !== val) {
96
+ this.#date = val;
97
+ const dateObj = DateUtilities.isDate(this.#date)
98
+ ? moment(DateUtilities.toFormat(this.#date, 'yyyy/MM/dd'), 'YYYY/MM/DD')
99
+ : null;
100
+ this.formControl.setValue(dateObj, { emitEvent: false });
101
+ }
102
+ });
103
+ });
104
+ // EFFECT 2: Sync Disable
105
+ effect(() => {
106
+ if (this.disabled())
107
+ this.formControl.disable({ emitEvent: false });
108
+ else
109
+ this.formControl.enable({ emitEvent: false });
110
+ });
111
+ // EFFECT 3: Update Validators
112
+ effect(() => {
113
+ const req = this.required();
114
+ const inl = this.inlineError();
115
+ untracked(() => {
116
+ const validators = [];
117
+ if (req)
118
+ validators.push(Validators.required);
119
+ if (inl)
120
+ validators.push(this.customInlineErrorValidator());
121
+ this.formControl.setValidators(validators.length ? validators : null);
122
+ this.formControl.updateValueAndValidity({ emitEvent: false });
123
+ });
124
+ });
180
125
  }
181
126
  ngOnInit() {
182
- this.appearance = this.appearance || this.formConfig?.appearance;
183
127
  this.#subscription.add(this.formControl.sdChanges.subscribe(() => {
184
- // this.formControl.updateValueAndValidity();
185
128
  this.ref.markForCheck();
186
129
  }));
187
- this.#form?.addControl(this.#name, this.formControl);
130
+ const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
131
+ formGroup?.addControl(this.name(), this.formControl);
132
+ }
133
+ ngOnDestroy() {
134
+ const formGroup = this.form() instanceof NgForm ? this.form().form : this.form();
135
+ formGroup?.removeControl(this.name());
136
+ this.#subscription.unsubscribe();
137
+ }
138
+ // Hàm private tái sử dụng cho parse Min/Max Date
139
+ #parseDateBoundary(val) {
140
+ if (val === 'TODAY')
141
+ return new Date();
142
+ if (val && DateUtilities.isDate(val))
143
+ return new Date(val);
144
+ return null;
188
145
  }
189
- // Hàm tạo Validators tùy chỉnh cho inlineError
190
146
  customInlineErrorValidator() {
191
- return () => {
192
- return { inlineError: true };
193
- };
147
+ return () => ({ inlineError: true });
194
148
  }
195
149
  onFocus = () => {
196
150
  this.isFocused = true;
@@ -200,38 +154,30 @@ class SdDate {
200
154
  this.isFocused = false;
201
155
  };
202
156
  onClick = () => {
203
- if (this.sdViewDef?.templateRef) {
157
+ if (this.sdViewDef()?.templateRef) {
204
158
  if (!this.formControl.disabled && !this.isFocused) {
205
159
  this.focus();
206
160
  }
207
161
  }
208
162
  };
209
163
  blur = () => {
210
- this.input?.nativeElement?.blur();
164
+ this.inputRef()?.nativeElement?.blur();
211
165
  };
212
166
  focus = () => {
213
167
  this.isFocused = true;
214
168
  setTimeout(() => {
215
- this.input?.nativeElement?.focus();
216
- this.datePicker?.open();
217
- //
169
+ this.inputRef()?.nativeElement?.focus();
170
+ this.datePicker()?.open();
218
171
  }, 100);
219
172
  };
220
173
  focusInputElement() {
221
- this.input?.nativeElement?.focus();
174
+ this.inputRef()?.nativeElement?.focus();
222
175
  }
223
- isValid;
224
176
  onKeyDown = (event) => {
225
177
  const key = event.keyCode || event.charCode;
226
- let isShift = false;
227
- if (key === 16) {
228
- isShift = true;
229
- }
230
- // cho phép copy parse
231
- if (event.ctrlKey && (key === 67 || key === 86)) {
178
+ const isShift = key === 16;
179
+ if (event.ctrlKey && (key === 67 || key === 86))
232
180
  return true;
233
- }
234
- // Allow only Numeric Keys.
235
181
  if (((key >= 48 && key <= 57) ||
236
182
  key === 8 ||
237
183
  key <= 37 ||
@@ -240,12 +186,10 @@ class SdDate {
240
186
  key === 191 ||
241
187
  key === 186 ||
242
188
  key === 59) &&
243
- isShift === false) {
189
+ !isShift) {
244
190
  return true;
245
191
  }
246
- else {
247
- return false;
248
- }
192
+ return false;
249
193
  };
250
194
  onKeyup = (event) => {
251
195
  const currentVal = event.target.value;
@@ -256,10 +200,7 @@ class SdDate {
256
200
  this.isValid = true;
257
201
  formControl.markAsDirty();
258
202
  formControl.markAsTouched();
259
- formControl.setErrors({
260
- ...formControl.errors,
261
- date: `Sai định dạng`,
262
- });
203
+ formControl.setErrors({ ...formControl.errors, date: `Sai định dạng` });
263
204
  }, 0);
264
205
  }
265
206
  else {
@@ -271,20 +212,18 @@ class SdDate {
271
212
  }
272
213
  };
273
214
  onChange = (event) => {
274
- // const value = event.value?.toDate();
275
- //
276
215
  const value = DateUtilities.toFormat(event.value?.toDate(), 'yyyy/MM/dd');
277
- this.input?.nativeElement?.focus();
216
+ this.inputRef()?.nativeElement?.focus();
278
217
  if (!this.isValid) {
279
218
  if (this.#date !== value) {
280
- this.modelChange.emit(value);
219
+ this.valueModel.set(value);
281
220
  this.sdChange.emit(value);
282
221
  }
283
222
  }
284
223
  else {
285
224
  this.isValid = false;
286
225
  this.formControl.setValue(null);
287
- this.modelChange.emit(null);
226
+ this.valueModel.set(null);
288
227
  this.sdChange.emit(null);
289
228
  }
290
229
  };
@@ -292,16 +231,14 @@ class SdDate {
292
231
  $event?.stopPropagation();
293
232
  if (this.formControl.value) {
294
233
  this.formControl.setValue(null);
295
- this.modelChange.emit(null);
234
+ this.valueModel.set(null);
296
235
  this.sdChange.emit(null);
297
236
  }
298
237
  };
299
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdDate, deps: [{ token: i0.ChangeDetectorRef }, { token: SD_FORM_CONFIGURATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
300
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdDate, isStandalone: true, selector: "sd-date", inputs: { _autoId: ["autoId", "_autoId"], name: "name", appearance: "appearance", _hideInlineError: ["hideInlineError", "_hideInlineError"], _min: ["min", "_min"], _max: ["max", "_max"], size: "size", form: "form", disabled: "disabled", _viewed: ["viewed", "_viewed"], hyperlink: "hyperlink", _required: ["required", "_required"], _inlineError: ["inlineError", "_inlineError"], _label: ["label", "_label"], _helperText: ["helperText", "_helperText"], placeholder: "placeholder", minDate: "minDate", maxDate: "maxDate", model: "model" }, outputs: { sdChange: "sdChange", sdFocus: "sdFocus", modelChange: "modelChange" }, providers: [
238
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdDate, deps: [], target: i0.ɵɵFactoryTarget.Component });
239
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: SdDate, isStandalone: true, selector: "sd-date", 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 }, required: { classPropertyName: "required", publicName: "required", 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 }, 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 }, minInput: { classPropertyName: "minInput", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, minDateInput: { classPropertyName: "minDateInput", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxInput: { classPropertyName: "maxInput", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, maxDateInput: { classPropertyName: "maxDateInput", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, valueModel: { classPropertyName: "valueModel", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueModel: "modelChange", sdChange: "sdChange", sdFocus: "sdFocus" }, providers: [
301
240
  provideMomentDateAdapter({
302
- parse: {
303
- dateInput: 'DD/MM/YYYY',
304
- },
241
+ parse: { dateInput: 'DD/MM/YYYY' },
305
242
  display: {
306
243
  dateInput: 'DD/MM/YYYY',
307
244
  monthYearLabel: 'MMM YYYY',
@@ -309,15 +246,13 @@ class SdDate {
309
246
  monthYearA11yLabel: 'MMMM YYYY',
310
247
  },
311
248
  }),
312
- ], queries: [{ propertyName: "sdViewDef", first: true, predicate: SdViewDefDirective, descendants: true }, { propertyName: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }, { propertyName: "datePicker", first: true, predicate: MatDatepicker, 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 }}</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 <!-- Th\u00EAm area-hidden=true \u0111\u1EC3 kh\u00F4ng b\u1ECB c\u1EA3nh b\u00E1o g\u1EAFn s\u1EF1 ki\u1EC7n click th\u1EBB div -->\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 && !datePicker?.opened) {\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=\"c-form-field-date-input\"\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 matInput\r\n (keyup)=\"onKeyup($event)\"\r\n (keydown)=\"onKeyDown($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [formControl]=\"formControl\"\r\n [required]=\"required\"\r\n [matDatepicker]=\"picker2\"\r\n [placeholder]=\"placeholder || label || ''\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [attr.data-autoId]=\"autoId\"\r\n #input\r\n [maxLength]=\"10\" />\r\n @if (formControl.value && !required && !formControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel </mat-icon>\r\n }\r\n\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl.disabled && picker2.open()\" #btn matSuffix>today </mat-icon>\r\n\r\n <mat-datepicker #picker2 [touchUi]=\"isMobileOrTablet\"></mat-datepicker>\r\n\r\n @if (formControl.errors?.['required'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatepickerMin'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Ng\u00E0y nh\u1ECF nh\u1EA5t' }}: <strong>{{ min | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatepickerMax'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Ng\u00E0y l\u1EDBn nh\u1EA5t' }}: <strong>{{ max | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatetimePickerParse'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Parse error' }}: <strong>{{ formControl.errors?.['matDatetimePickerParse']?.text }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['date'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ formControl.errors?.['date'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['inlineError'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ inlineError }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\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{padding-top:5px;display:block}: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)}:host ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { 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: MatInputModule }, { kind: "directive", type: i3.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: "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: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i6.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i6.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
249
+ ], 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: "sdLabelDef", first: true, predicate: SdLabelDefDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "datePicker", first: true, predicate: MatDatepicker, 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@let req = required();\r\n\r\n@let minD = resolvedMin();\r\n@let maxD = resolvedMax();\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 | date: 'dd/MM/yyyy'\"\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]=\"req\"></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 && !datePicker()?.opened) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n viewDef!.templateRef;\r\n context: { value: formControl.value }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n class=\"c-form-field-date-input\"\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 matInput\r\n (keyup)=\"onKeyup($event)\"\r\n (keydown)=\"onKeyDown($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [formControl]=\"formControl\"\r\n [required]=\"req\"\r\n [matDatepicker]=\"picker\"\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n [min]=\"minD\"\r\n [max]=\"maxD\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n #input\r\n [maxLength]=\"10\" />\r\n \r\n @if (formControl.value && !req && !formControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel</mat-icon>\r\n }\r\n\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl.disabled && picker.open()\" #btn matSuffix>today</mat-icon>\r\n\r\n <mat-datepicker #picker [touchUi]=\"isMobileOrTablet\"></mat-datepicker>\r\n\r\n @if (formControl.errors?.['required'] && formControl.touched) {\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 @if (formControl.errors?.['matDatepickerMin'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Ng\u00E0y nh\u1ECF nh\u1EA5t' }}: <strong>{{ minD | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatepickerMax'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Ng\u00E0y l\u1EDBn nh\u1EA5t' }}: <strong>{{ maxD | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatetimePickerParse'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Parse error' }}: <strong>{{ formControl.errors?.['matDatetimePickerParse']?.text }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['date'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['date'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['inlineError'] && formControl.touched) {\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{padding-top:5px;display:block}: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)}:host ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { 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: MatInputModule }, { kind: "directive", type: i3.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: "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: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i6.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i6.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: SdLabel, selector: "sd-label", inputs: ["label", "description", "required", "helperText"] }, { kind: "component", type: SdView, selector: "sd-view", inputs: ["label", "value", "display", "hyperlink", "labelTemplate", "valueTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
313
250
  }
314
251
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SdDate, decorators: [{
315
252
  type: Component,
316
253
  args: [{ selector: 'sd-date', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
317
254
  provideMomentDateAdapter({
318
- parse: {
319
- dateInput: 'DD/MM/YYYY',
320
- },
255
+ parse: { dateInput: 'DD/MM/YYYY' },
321
256
  display: {
322
257
  dateInput: 'DD/MM/YYYY',
323
258
  monthYearLabel: 'MMM YYYY',
@@ -335,78 +270,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
335
270
  MatFormFieldModule,
336
271
  MatDatepickerModule,
337
272
  SdLabel,
338
- ], 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 }}</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 <!-- Th\u00EAm area-hidden=true \u0111\u1EC3 kh\u00F4ng b\u1ECB c\u1EA3nh b\u00E1o g\u1EAFn s\u1EF1 ki\u1EC7n click th\u1EBB div -->\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 && !datePicker?.opened) {\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=\"c-form-field-date-input\"\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 matInput\r\n (keyup)=\"onKeyup($event)\"\r\n (keydown)=\"onKeyDown($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [formControl]=\"formControl\"\r\n [required]=\"required\"\r\n [matDatepicker]=\"picker2\"\r\n [placeholder]=\"placeholder || label || ''\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [attr.data-autoId]=\"autoId\"\r\n #input\r\n [maxLength]=\"10\" />\r\n @if (formControl.value && !required && !formControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel </mat-icon>\r\n }\r\n\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl.disabled && picker2.open()\" #btn matSuffix>today </mat-icon>\r\n\r\n <mat-datepicker #picker2 [touchUi]=\"isMobileOrTablet\"></mat-datepicker>\r\n\r\n @if (formControl.errors?.['required'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Vui l\u00F2ng nh\u1EADp th\u00F4ng tin' }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatepickerMin'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Ng\u00E0y nh\u1ECF nh\u1EA5t' }}: <strong>{{ min | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatepickerMax'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Ng\u00E0y l\u1EDBn nh\u1EA5t' }}: <strong>{{ max | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatetimePickerParse'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ 'Parse error' }}: <strong>{{ formControl.errors?.['matDatetimePickerParse']?.text }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['date'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ formControl.errors?.['date'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['inlineError'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideInlineError) {\r\n {{ inlineError }}\r\n }\r\n </mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\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{padding-top:5px;display:block}: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)}:host ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"] }]
339
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
340
- type: Inject,
341
- args: [SD_FORM_CONFIGURATION]
342
- }, {
343
- type: Optional
344
- }] }], propDecorators: { _autoId: [{
345
- type: Input,
346
- args: ['autoId']
347
- }], name: [{
348
- type: Input
349
- }], appearance: [{
350
- type: Input
351
- }], _hideInlineError: [{
352
- type: Input,
353
- args: ['hideInlineError']
354
- }], _min: [{
355
- type: Input,
356
- args: ['min']
357
- }], _max: [{
358
- type: Input,
359
- args: ['max']
360
- }], size: [{
361
- type: Input
362
- }], form: [{
363
- type: Input
364
- }], disabled: [{
365
- type: Input
366
- }], _viewed: [{
367
- type: Input,
368
- args: ['viewed']
369
- }], hyperlink: [{
370
- type: Input
371
- }], _required: [{
372
- type: Input,
373
- args: ['required']
374
- }], _inlineError: [{
375
- type: Input,
376
- args: ['inlineError']
377
- }], _label: [{
378
- type: Input,
379
- args: ['label']
380
- }], _helperText: [{
381
- type: Input,
382
- args: ['helperText']
383
- }], placeholder: [{
384
- type: Input
385
- }], minDate: [{
386
- type: Input
387
- }], maxDate: [{
388
- type: Input
389
- }], sdChange: [{
390
- type: Output
391
- }], sdFocus: [{
392
- type: Output
393
- }], model: [{
394
- type: Input
395
- }], modelChange: [{
396
- type: Output
397
- }], sdViewDef: [{
398
- type: ContentChild,
399
- args: [SdViewDefDirective]
400
- }], sdLabelDef: [{
401
- type: ContentChild,
402
- args: [SdLabelDefDirective]
403
- }], input: [{
404
- type: ViewChild,
405
- args: ['input']
406
- }], datePicker: [{
407
- type: ViewChild,
408
- args: [MatDatepicker]
409
- }] } });
273
+ SdView
274
+ ], 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@let req = required();\r\n\r\n@let minD = resolvedMin();\r\n@let maxD = resolvedMax();\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 | date: 'dd/MM/yyyy'\"\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]=\"req\"></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 && !datePicker()?.opened) {\r\n <ng-container\r\n *ngTemplateOutlet=\"\r\n viewDef!.templateRef;\r\n context: { value: formControl.value }\r\n \">\r\n </ng-container>\r\n } @else {\r\n <mat-form-field\r\n class=\"c-form-field-date-input\"\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 matInput\r\n (keyup)=\"onKeyup($event)\"\r\n (keydown)=\"onKeyDown($event)\"\r\n (dateChange)=\"onChange($event)\"\r\n [autocomplete]=\"id\"\r\n autocorrect=\"off\"\r\n [formControl]=\"formControl\"\r\n [required]=\"req\"\r\n [matDatepicker]=\"picker\"\r\n [placeholder]=\"placeholder() || lbl || ''\"\r\n [min]=\"minD\"\r\n [max]=\"maxD\"\r\n (focus)=\"onFocus()\"\r\n (blur)=\"onBlur()\"\r\n [attr.data-autoId]=\"autoId()\"\r\n #input\r\n [maxLength]=\"10\" />\r\n \r\n @if (formControl.value && !req && !formControl.disabled) {\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"clear($event)\" matSuffix>cancel</mat-icon>\r\n }\r\n\r\n <mat-icon class=\"pointer sd-suffix-icon\" (click)=\"!formControl.disabled && picker.open()\" #btn matSuffix>today</mat-icon>\r\n\r\n <mat-datepicker #picker [touchUi]=\"isMobileOrTablet\"></mat-datepicker>\r\n\r\n @if (formControl.errors?.['required'] && formControl.touched) {\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 @if (formControl.errors?.['matDatepickerMin'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Ng\u00E0y nh\u1ECF nh\u1EA5t' }}: <strong>{{ minD | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatepickerMax'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Ng\u00E0y l\u1EDBn nh\u1EA5t' }}: <strong>{{ maxD | date: 'dd/MM/yyyy' }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['matDatetimePickerParse'] && formControl.touched && !isFocused) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ 'Parse error' }}: <strong>{{ formControl.errors?.['matDatetimePickerParse']?.text }}</strong>\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['customValidator'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['customValidator'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['date'] && formControl.touched) {\r\n <mat-error>\r\n @if (!hideErr) {\r\n {{ formControl.errors?.['date'] }}\r\n }\r\n </mat-error>\r\n }\r\n @if (formControl.errors?.['inlineError'] && formControl.touched) {\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{padding-top:5px;display:block}: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)}:host ::ng-deep .mat-mdc-form-field-icon-suffix{display:flex}.sd-view:not(.c-focused):not(.c-disabled):hover{background-color:#ebecf0}\n"] }]
275
+ }], ctorParameters: () => [] });
410
276
 
411
277
  /**
412
278
  * Generated bundle index. Do not edit.