shirkasoft-ui-components 1.14.0 → 2.0.1
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.
- package/README.md +12 -9
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +363 -69
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +905 -843
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1697 -1440
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +555 -300
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1028 -533
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-knob.mjs +389 -201
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -314
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +585 -327
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1076 -819
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1916 -1698
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -175
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +175 -49
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +749 -402
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +310 -124
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +141 -174
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -203
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +179 -109
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +129 -133
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -165
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +5 -5
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +193 -204
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -66
- package/types/shirkasoft-ui-components-date-picker.d.ts +561 -398
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -60
- package/types/shirkasoft-ui-components-file-upload.d.ts +210 -112
- package/types/shirkasoft-ui-components-icons.d.ts +1302 -1294
- package/types/shirkasoft-ui-components-knob.d.ts +144 -78
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -136
- package/types/shirkasoft-ui-components-notification.d.ts +63 -59
- package/types/shirkasoft-ui-components-price-input.d.ts +232 -113
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +335 -196
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -93
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -660
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +263 -127
- package/types/shirkasoft-ui-components-theme-picker.d.ts +92 -58
- package/types/shirkasoft-ui-components-theme.d.ts +56 -64
- package/types/shirkasoft-ui-components-timeline.d.ts +325 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +73 -49
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +47 -15
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -87
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,403 +1,750 @@
|
|
|
1
|
-
import * as i1 from
|
|
2
|
-
import { CommonModule } from
|
|
3
|
-
import * as i0 from
|
|
4
|
-
import {
|
|
5
|
-
import * as i2 from
|
|
6
|
-
import { FormControl,
|
|
7
|
-
import { takeUntilDestroyed } from
|
|
8
|
-
import { merge } from
|
|
9
|
-
import { TranslocoService } from
|
|
10
|
-
import { LucideEye, ShkIconDirective } from
|
|
11
|
-
import { getIcon } from
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
1
|
+
import * as i1 from "@angular/common";
|
|
2
|
+
import { CommonModule } from "@angular/common";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, computed, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
5
|
+
import * as i2 from "@angular/forms";
|
|
6
|
+
import { FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule } from "@angular/forms";
|
|
7
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
8
|
+
import { merge } from "rxjs";
|
|
9
|
+
import { TranslocoService } from "@jsverse/transloco";
|
|
10
|
+
import { LucideEye, ShkIconDirective } from "shirkasoft-ui-components/icons";
|
|
11
|
+
import { errorMessagesFromMap, getIcon, signalErrorsToMap } from "shirkasoft-ui-components/utils";
|
|
12
|
+
var TextFieldComponent = class TextFieldComponent {
|
|
13
|
+
get _value() {
|
|
14
|
+
return this.value;
|
|
15
|
+
}
|
|
16
|
+
constructor() {
|
|
17
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
18
|
+
this.id = input("", ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
19
|
+
this.formatCard = input(false, ...ngDevMode ? [{ debugName: "formatCard" }] : /* istanbul ignore next */ []);
|
|
20
|
+
this.preventNegative = input(false, ...ngDevMode ? [{ debugName: "preventNegative" }] : /* istanbul ignore next */ []);
|
|
21
|
+
this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
22
|
+
this.type = input("text", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
23
|
+
this.numbersOnly = input(false, ...ngDevMode ? [{ debugName: "numbersOnly" }] : /* istanbul ignore next */ []);
|
|
24
|
+
this.allowDecimals = input(false, ...ngDevMode ? [{ debugName: "allowDecimals" }] : /* istanbul ignore next */ []);
|
|
25
|
+
this.maxLength = input(void 0, ...ngDevMode ? [{ debugName: "maxLength" }] : /* istanbul ignore next */ []);
|
|
26
|
+
this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
27
|
+
this.errorMessages = input({}, ...ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []);
|
|
28
|
+
this.formGroup = input(void 0, ...ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []);
|
|
29
|
+
this.control = input(void 0, ...ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []);
|
|
30
|
+
this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
31
|
+
this.errors = input([], ...ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []);
|
|
32
|
+
this.invalid = input(false, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
|
|
33
|
+
this.touched = input(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
|
|
34
|
+
this.dirty = input(false, ...ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []);
|
|
35
|
+
this.errorMessage = input("", ...ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []);
|
|
36
|
+
this.isTextArea = input(false, ...ngDevMode ? [{ debugName: "isTextArea" }] : /* istanbul ignore next */ []);
|
|
37
|
+
this.textAreaHeight = input("h-28", ...ngDevMode ? [{ debugName: "textAreaHeight" }] : /* istanbul ignore next */ []);
|
|
38
|
+
this.searchMode = input(false, ...ngDevMode ? [{ debugName: "searchMode" }] : /* istanbul ignore next */ []);
|
|
39
|
+
this.displayValue = input("", ...ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []);
|
|
40
|
+
this.autocomplete = input("", ...ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []);
|
|
41
|
+
this.searchButtonClick = output();
|
|
42
|
+
this.touch = output();
|
|
43
|
+
this.getIcon = (name) => getIcon(name, LucideEye);
|
|
44
|
+
this.inputElement = viewChild("input", ...ngDevMode ? [{ debugName: "inputElement" }] : /* istanbul ignore next */ []);
|
|
45
|
+
this.textareaElement = viewChild("textarea", ...ngDevMode ? [{ debugName: "textareaElement" }] : /* istanbul ignore next */ []);
|
|
46
|
+
this.value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
47
|
+
this._disabledState = signal(false, ...ngDevMode ? [{ debugName: "_disabledState" }] : /* istanbul ignore next */ []);
|
|
48
|
+
this.showPassword = signal(false, ...ngDevMode ? [{ debugName: "showPassword" }] : /* istanbul ignore next */ []);
|
|
49
|
+
this.hadError = signal(false, ...ngDevMode ? [{ debugName: "hadError" }] : /* istanbul ignore next */ []);
|
|
50
|
+
this.errorTracker = signal(0, ...ngDevMode ? [{ debugName: "errorTracker" }] : /* istanbul ignore next */ []);
|
|
51
|
+
this.displayLabel = computed(() => {
|
|
52
|
+
if (this.searchMode() && this.displayValue()) return this.displayValue();
|
|
53
|
+
return "";
|
|
54
|
+
}, ...ngDevMode ? [{ debugName: "displayLabel" }] : /* istanbul ignore next */ []);
|
|
55
|
+
this.observedControl = null;
|
|
56
|
+
this.isDisabled = computed(() => this.disabled() || this._disabledState(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
57
|
+
this.innerControl = new FormControl("");
|
|
58
|
+
this.externalControl = computed(() => {
|
|
59
|
+
const ctrl = this.control();
|
|
60
|
+
if (ctrl) return ctrl;
|
|
61
|
+
const fg = this.formGroup();
|
|
62
|
+
const lbl = this.label();
|
|
63
|
+
if (fg && lbl) return fg.get(lbl) ?? void 0;
|
|
64
|
+
}, ...ngDevMode ? [{ debugName: "externalControl" }] : /* istanbul ignore next */ []);
|
|
65
|
+
this.usesSignalForms = computed(() => !this.externalControl(), ...ngDevMode ? [{ debugName: "usesSignalForms" }] : /* istanbul ignore next */ []);
|
|
66
|
+
this.actualControl = computed(() => this.externalControl() ?? this.innerControl, ...ngDevMode ? [{ debugName: "actualControl" }] : /* istanbul ignore next */ []);
|
|
67
|
+
this.shouldShowError = computed(() => {
|
|
68
|
+
if (this.usesSignalForms()) return this.invalid() && (this.touched() || this.dirty());
|
|
69
|
+
this.errorTracker();
|
|
70
|
+
const ctrl = this.actualControl();
|
|
71
|
+
return ctrl?.invalid && (ctrl?.dirty || ctrl?.touched);
|
|
72
|
+
}, ...ngDevMode ? [{ debugName: "shouldShowError" }] : /* istanbul ignore next */ []);
|
|
73
|
+
this.wasFixedError = computed(() => {
|
|
74
|
+
if (this.usesSignalForms()) return this.hadError() && !this.invalid() && this.touched();
|
|
75
|
+
this.errorTracker();
|
|
76
|
+
const ctrl = this.actualControl();
|
|
77
|
+
return this.hadError() && ctrl?.valid && ctrl?.touched;
|
|
78
|
+
}, ...ngDevMode ? [{ debugName: "wasFixedError" }] : /* istanbul ignore next */ []);
|
|
79
|
+
this.getErrorMessages = computed(() => {
|
|
80
|
+
this.errorTracker();
|
|
81
|
+
const customError = this.errorMessage();
|
|
82
|
+
if (customError) return [customError];
|
|
83
|
+
const customErrors = this.errorMessages();
|
|
84
|
+
const translate = (key, params) => this.transloco.translate(key, params);
|
|
85
|
+
if (this.usesSignalForms()) return errorMessagesFromMap(signalErrorsToMap(this.errors()), customErrors, translate);
|
|
86
|
+
const ctrl = this.actualControl();
|
|
87
|
+
if (!ctrl?.errors) return [];
|
|
88
|
+
return errorMessagesFromMap(ctrl.errors, customErrors, translate);
|
|
89
|
+
}, ...ngDevMode ? [{ debugName: "getErrorMessages" }] : /* istanbul ignore next */ []);
|
|
90
|
+
this.effectiveType = computed(() => {
|
|
91
|
+
if (this.isTextArea()) return "text";
|
|
92
|
+
if (this.type() === "password" && this.showPassword()) return "text";
|
|
93
|
+
return this.type();
|
|
94
|
+
}, ...ngDevMode ? [{ debugName: "effectiveType" }] : /* istanbul ignore next */ []);
|
|
95
|
+
this.transloco = inject(TranslocoService);
|
|
96
|
+
this.onChange = () => {};
|
|
97
|
+
this.onTouched = () => {};
|
|
98
|
+
this.destroyRef = inject(DestroyRef);
|
|
99
|
+
effect(() => {
|
|
100
|
+
if (!this.usesSignalForms()) return;
|
|
101
|
+
const value = this.value() ?? "";
|
|
102
|
+
const disabled = this.isDisabled();
|
|
103
|
+
untracked(() => {
|
|
104
|
+
if (this.innerControl.value !== value) this.innerControl.setValue(value, { emitEvent: false });
|
|
105
|
+
if (disabled && this.innerControl.enabled) this.innerControl.disable({ emitEvent: false });
|
|
106
|
+
if (!disabled && this.innerControl.disabled) this.innerControl.enable({ emitEvent: false });
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
effect(() => {
|
|
110
|
+
if (!this.usesSignalForms()) return;
|
|
111
|
+
if (this.invalid() && (this.touched() || this.dirty())) this.hadError.set(true);
|
|
112
|
+
});
|
|
113
|
+
effect(() => {
|
|
114
|
+
const ctrl = this.actualControl();
|
|
115
|
+
const shouldDisable = this.isDisabled();
|
|
116
|
+
if (ctrl && shouldDisable) Promise.resolve().then(() => {
|
|
117
|
+
ctrl.disable();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
effect(() => {
|
|
121
|
+
const ctrl = this.actualControl();
|
|
122
|
+
if (ctrl === this.observedControl) return;
|
|
123
|
+
this.controlSubscription?.unsubscribe();
|
|
124
|
+
this.observedControl = ctrl;
|
|
125
|
+
if (ctrl.invalid && ctrl.touched) this.hadError.set(true);
|
|
126
|
+
this.controlSubscription = merge(ctrl.statusChanges, ctrl.valueChanges).subscribe(() => {
|
|
127
|
+
this.errorTracker.update((v) => v + 1);
|
|
128
|
+
if (ctrl.invalid && ctrl.touched) this.hadError.set(true);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
this.destroyRef.onDestroy(() => this.controlSubscription?.unsubscribe());
|
|
132
|
+
this.transloco.langChanges$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
133
|
+
this.errorTracker.update((v) => v + 1);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
numberValidation(event) {
|
|
137
|
+
const allowedKeys = [
|
|
138
|
+
"Backspace",
|
|
139
|
+
"Tab",
|
|
140
|
+
"End",
|
|
141
|
+
"Home",
|
|
142
|
+
"ArrowLeft",
|
|
143
|
+
"ArrowRight",
|
|
144
|
+
"Delete"
|
|
145
|
+
];
|
|
146
|
+
if (this.numbersOnly()) {
|
|
147
|
+
if (!/^\d$/.test(event.key) && !allowedKeys.includes(event.key)) event.preventDefault();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (this.allowDecimals() || this.type() === "number") allowedKeys.push(".");
|
|
151
|
+
const isDecimal = event.key === "." || event.key === ",";
|
|
152
|
+
const isNumber = !isNaN(Number(event.key));
|
|
153
|
+
if (allowedKeys.includes(event.key)) {
|
|
154
|
+
if (isDecimal) {
|
|
155
|
+
const currentValue = event.target.value;
|
|
156
|
+
if (currentValue.includes(".") || currentValue.includes(",")) event.preventDefault();
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (isNumber) return;
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
}
|
|
163
|
+
onBlur() {
|
|
164
|
+
this.onTouched();
|
|
165
|
+
this.touch.emit();
|
|
166
|
+
this.errorTracker.update((v) => v + 1);
|
|
167
|
+
if (this.usesSignalForms()) return;
|
|
168
|
+
const ctrl = this.actualControl();
|
|
169
|
+
if (ctrl?.invalid && ctrl?.touched) this.hadError.set(true);
|
|
170
|
+
}
|
|
171
|
+
onCardInput(event) {
|
|
172
|
+
const input = event.target;
|
|
173
|
+
let value = input.value.replace(/[^0-9]/g, "");
|
|
174
|
+
if (value.length > 16) value = value.substring(0, 16);
|
|
175
|
+
let formatted = "";
|
|
176
|
+
for (let i = 0; i < value.length; i++) {
|
|
177
|
+
if (i > 0 && i % 4 === 0) formatted += "-";
|
|
178
|
+
formatted += value[i];
|
|
179
|
+
}
|
|
180
|
+
input.value = formatted;
|
|
181
|
+
this._value.set(formatted);
|
|
182
|
+
this.onChange(formatted);
|
|
183
|
+
}
|
|
184
|
+
onInput(event) {
|
|
185
|
+
const input = event.target;
|
|
186
|
+
let newValue = input.value;
|
|
187
|
+
if (this.allowDecimals()) {
|
|
188
|
+
newValue = newValue.replace(/,/g, ".");
|
|
189
|
+
const parts = newValue.split(".");
|
|
190
|
+
if (parts.length > 2) newValue = parts[0] + "." + parts.slice(1).join("");
|
|
191
|
+
if (parts.length > 1 && parts[1].length > 2) newValue = parts[0] + "." + parts[1].substring(0, 2);
|
|
192
|
+
}
|
|
193
|
+
if (this.numbersOnly()) newValue = newValue.replace(/[^0-9]/g, "");
|
|
194
|
+
const maxLen = this.maxLength();
|
|
195
|
+
if (maxLen && newValue.length > maxLen) {
|
|
196
|
+
newValue = newValue.substring(0, maxLen);
|
|
197
|
+
input.value = newValue;
|
|
198
|
+
const ctrl = this.actualControl();
|
|
199
|
+
setTimeout(() => {
|
|
200
|
+
ctrl?.updateValueAndValidity();
|
|
201
|
+
this.errorTracker.update((v) => v + 1);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
if (this.formatCard()) this.onCardInput(event);
|
|
205
|
+
else {
|
|
206
|
+
this._value.set(newValue);
|
|
207
|
+
this.onChange(newValue);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
togglePasswordVisibility() {
|
|
211
|
+
this.showPassword.update((v) => !v);
|
|
212
|
+
}
|
|
213
|
+
writeValue(value) {
|
|
214
|
+
let processedValue = value;
|
|
215
|
+
if (this.allowDecimals() && value) processedValue = String(value).replace(/,/g, ".");
|
|
216
|
+
if (this.numbersOnly() && value) processedValue = value.toString().replace(/[^0-9]/g, "");
|
|
217
|
+
const maxLen = this.maxLength();
|
|
218
|
+
if (maxLen && processedValue?.length > maxLen) processedValue = processedValue.substring(0, maxLen);
|
|
219
|
+
if (this.formatCard() && processedValue) {
|
|
220
|
+
const cleaned = processedValue.replace(/[^0-9]/g, "");
|
|
221
|
+
let formatted = "";
|
|
222
|
+
for (let i = 0; i < cleaned.length; i++) {
|
|
223
|
+
if (i > 0 && i % 4 === 0) formatted += "-";
|
|
224
|
+
formatted += cleaned[i];
|
|
225
|
+
}
|
|
226
|
+
this._value.set(formatted);
|
|
227
|
+
} else this._value.set(processedValue);
|
|
228
|
+
}
|
|
229
|
+
registerOnChange(fn) {
|
|
230
|
+
this.onChange = fn;
|
|
231
|
+
}
|
|
232
|
+
registerOnTouched(fn) {
|
|
233
|
+
this.onTouched = fn;
|
|
234
|
+
}
|
|
235
|
+
setDisabledState(isDisabled) {
|
|
236
|
+
this._disabledState.set(isDisabled);
|
|
237
|
+
this.cdr.markForCheck();
|
|
238
|
+
}
|
|
239
|
+
static {
|
|
240
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
241
|
+
minVersion: "12.0.0",
|
|
242
|
+
version: "22.3.2",
|
|
243
|
+
ngImport: i0,
|
|
244
|
+
type: TextFieldComponent,
|
|
245
|
+
deps: [],
|
|
246
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
static {
|
|
250
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
251
|
+
minVersion: "17.0.0",
|
|
252
|
+
version: "22.3.2",
|
|
253
|
+
type: TextFieldComponent,
|
|
254
|
+
isStandalone: true,
|
|
255
|
+
selector: "shk-text-field",
|
|
256
|
+
inputs: {
|
|
257
|
+
id: {
|
|
258
|
+
classPropertyName: "id",
|
|
259
|
+
publicName: "id",
|
|
260
|
+
isSignal: true,
|
|
261
|
+
isRequired: false,
|
|
262
|
+
transformFunction: null
|
|
263
|
+
},
|
|
264
|
+
formatCard: {
|
|
265
|
+
classPropertyName: "formatCard",
|
|
266
|
+
publicName: "formatCard",
|
|
267
|
+
isSignal: true,
|
|
268
|
+
isRequired: false,
|
|
269
|
+
transformFunction: null
|
|
270
|
+
},
|
|
271
|
+
preventNegative: {
|
|
272
|
+
classPropertyName: "preventNegative",
|
|
273
|
+
publicName: "preventNegative",
|
|
274
|
+
isSignal: true,
|
|
275
|
+
isRequired: false,
|
|
276
|
+
transformFunction: null
|
|
277
|
+
},
|
|
278
|
+
label: {
|
|
279
|
+
classPropertyName: "label",
|
|
280
|
+
publicName: "label",
|
|
281
|
+
isSignal: true,
|
|
282
|
+
isRequired: false,
|
|
283
|
+
transformFunction: null
|
|
284
|
+
},
|
|
285
|
+
type: {
|
|
286
|
+
classPropertyName: "type",
|
|
287
|
+
publicName: "type",
|
|
288
|
+
isSignal: true,
|
|
289
|
+
isRequired: false,
|
|
290
|
+
transformFunction: null
|
|
291
|
+
},
|
|
292
|
+
numbersOnly: {
|
|
293
|
+
classPropertyName: "numbersOnly",
|
|
294
|
+
publicName: "numbersOnly",
|
|
295
|
+
isSignal: true,
|
|
296
|
+
isRequired: false,
|
|
297
|
+
transformFunction: null
|
|
298
|
+
},
|
|
299
|
+
allowDecimals: {
|
|
300
|
+
classPropertyName: "allowDecimals",
|
|
301
|
+
publicName: "allowDecimals",
|
|
302
|
+
isSignal: true,
|
|
303
|
+
isRequired: false,
|
|
304
|
+
transformFunction: null
|
|
305
|
+
},
|
|
306
|
+
maxLength: {
|
|
307
|
+
classPropertyName: "maxLength",
|
|
308
|
+
publicName: "maxLength",
|
|
309
|
+
isSignal: true,
|
|
310
|
+
isRequired: false,
|
|
311
|
+
transformFunction: null
|
|
312
|
+
},
|
|
313
|
+
placeholder: {
|
|
314
|
+
classPropertyName: "placeholder",
|
|
315
|
+
publicName: "placeholder",
|
|
316
|
+
isSignal: true,
|
|
317
|
+
isRequired: false,
|
|
318
|
+
transformFunction: null
|
|
319
|
+
},
|
|
320
|
+
errorMessages: {
|
|
321
|
+
classPropertyName: "errorMessages",
|
|
322
|
+
publicName: "errorMessages",
|
|
323
|
+
isSignal: true,
|
|
324
|
+
isRequired: false,
|
|
325
|
+
transformFunction: null
|
|
326
|
+
},
|
|
327
|
+
formGroup: {
|
|
328
|
+
classPropertyName: "formGroup",
|
|
329
|
+
publicName: "formGroup",
|
|
330
|
+
isSignal: true,
|
|
331
|
+
isRequired: false,
|
|
332
|
+
transformFunction: null
|
|
333
|
+
},
|
|
334
|
+
control: {
|
|
335
|
+
classPropertyName: "control",
|
|
336
|
+
publicName: "control",
|
|
337
|
+
isSignal: true,
|
|
338
|
+
isRequired: false,
|
|
339
|
+
transformFunction: null
|
|
340
|
+
},
|
|
341
|
+
disabled: {
|
|
342
|
+
classPropertyName: "disabled",
|
|
343
|
+
publicName: "disabled",
|
|
344
|
+
isSignal: true,
|
|
345
|
+
isRequired: false,
|
|
346
|
+
transformFunction: null
|
|
347
|
+
},
|
|
348
|
+
errors: {
|
|
349
|
+
classPropertyName: "errors",
|
|
350
|
+
publicName: "errors",
|
|
351
|
+
isSignal: true,
|
|
352
|
+
isRequired: false,
|
|
353
|
+
transformFunction: null
|
|
354
|
+
},
|
|
355
|
+
invalid: {
|
|
356
|
+
classPropertyName: "invalid",
|
|
357
|
+
publicName: "invalid",
|
|
358
|
+
isSignal: true,
|
|
359
|
+
isRequired: false,
|
|
360
|
+
transformFunction: null
|
|
361
|
+
},
|
|
362
|
+
touched: {
|
|
363
|
+
classPropertyName: "touched",
|
|
364
|
+
publicName: "touched",
|
|
365
|
+
isSignal: true,
|
|
366
|
+
isRequired: false,
|
|
367
|
+
transformFunction: null
|
|
368
|
+
},
|
|
369
|
+
dirty: {
|
|
370
|
+
classPropertyName: "dirty",
|
|
371
|
+
publicName: "dirty",
|
|
372
|
+
isSignal: true,
|
|
373
|
+
isRequired: false,
|
|
374
|
+
transformFunction: null
|
|
375
|
+
},
|
|
376
|
+
errorMessage: {
|
|
377
|
+
classPropertyName: "errorMessage",
|
|
378
|
+
publicName: "errorMessage",
|
|
379
|
+
isSignal: true,
|
|
380
|
+
isRequired: false,
|
|
381
|
+
transformFunction: null
|
|
382
|
+
},
|
|
383
|
+
isTextArea: {
|
|
384
|
+
classPropertyName: "isTextArea",
|
|
385
|
+
publicName: "isTextArea",
|
|
386
|
+
isSignal: true,
|
|
387
|
+
isRequired: false,
|
|
388
|
+
transformFunction: null
|
|
389
|
+
},
|
|
390
|
+
textAreaHeight: {
|
|
391
|
+
classPropertyName: "textAreaHeight",
|
|
392
|
+
publicName: "textAreaHeight",
|
|
393
|
+
isSignal: true,
|
|
394
|
+
isRequired: false,
|
|
395
|
+
transformFunction: null
|
|
396
|
+
},
|
|
397
|
+
searchMode: {
|
|
398
|
+
classPropertyName: "searchMode",
|
|
399
|
+
publicName: "searchMode",
|
|
400
|
+
isSignal: true,
|
|
401
|
+
isRequired: false,
|
|
402
|
+
transformFunction: null
|
|
403
|
+
},
|
|
404
|
+
displayValue: {
|
|
405
|
+
classPropertyName: "displayValue",
|
|
406
|
+
publicName: "displayValue",
|
|
407
|
+
isSignal: true,
|
|
408
|
+
isRequired: false,
|
|
409
|
+
transformFunction: null
|
|
410
|
+
},
|
|
411
|
+
autocomplete: {
|
|
412
|
+
classPropertyName: "autocomplete",
|
|
413
|
+
publicName: "autocomplete",
|
|
414
|
+
isSignal: true,
|
|
415
|
+
isRequired: false,
|
|
416
|
+
transformFunction: null
|
|
417
|
+
},
|
|
418
|
+
value: {
|
|
419
|
+
classPropertyName: "value",
|
|
420
|
+
publicName: "value",
|
|
421
|
+
isSignal: true,
|
|
422
|
+
isRequired: false,
|
|
423
|
+
transformFunction: null
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
outputs: {
|
|
427
|
+
searchButtonClick: "searchButtonClick",
|
|
428
|
+
touch: "touch",
|
|
429
|
+
value: "valueChange"
|
|
430
|
+
},
|
|
431
|
+
providers: [{
|
|
432
|
+
provide: NG_VALUE_ACCESSOR,
|
|
433
|
+
useExisting: forwardRef(() => TextFieldComponent),
|
|
434
|
+
multi: true
|
|
435
|
+
}],
|
|
436
|
+
viewQueries: [{
|
|
437
|
+
propertyName: "inputElement",
|
|
438
|
+
first: true,
|
|
439
|
+
predicate: ["input"],
|
|
440
|
+
descendants: true,
|
|
441
|
+
isSignal: true
|
|
442
|
+
}, {
|
|
443
|
+
propertyName: "textareaElement",
|
|
444
|
+
first: true,
|
|
445
|
+
predicate: ["textarea"],
|
|
446
|
+
descendants: true,
|
|
447
|
+
isSignal: true
|
|
448
|
+
}],
|
|
449
|
+
ngImport: i0,
|
|
450
|
+
template: "<div class=\"relative mb-4\">\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 mb-1\">\n {{ label() }}\n </div>\n }\n\n <div class=\"relative\">\n @if (!isTextArea()) {\n <div class=\"flex\">\n @if (searchMode()) {\n @let isDisabledSearch = actualControl().disabled || isDisabled();\n <input\n #input\n [id]=\"id()\"\n type=\"text\"\n [value]=\"displayValue() || ''\"\n [placeholder]=\"placeholder() || label()\"\n [readOnly]=\"true\"\n [disabled]=\"isDisabledSearch\"\n (click)=\"!isDisabledSearch && searchButtonClick.emit()\"\n (keydown.enter)=\"!isDisabledSearch && searchButtonClick.emit()\"\n (blur)=\"onBlur()\"\n autocomplete=\"off\"\n [attr.aria-invalid]=\"(shouldShowError() && !isDisabledSearch) || null\"\n [class.cursor-pointer]=\"!isDisabledSearch\"\n [class.cursor-not-allowed]=\"isDisabledSearch\"\n [class._shk-bg-surface-50]=\"isDisabledSearch\"\n [class._shk-text-surface-400]=\"isDisabledSearch\"\n class=\"shk-control shk-control-addon block w-full px-3 py-2 _shk-text-surface-700 _shk-bg-surface-50 border rounded-l-lg transition-colors placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-400)] focus:[background-color:var(--shk-surface-50)] dark:focus:[background-color:var(--shk-surface-100)] sm:text-sm\"\n [ngClass]=\"{\n 'border-red-500': shouldShowError() && !isDisabledSearch,\n '_shk-border': !shouldShowError() || isDisabledSearch,\n 'cursor-pointer': !isDisabledSearch,\n 'cursor-not-allowed _shk-text-surface-400 dark:[color:var(--shk-surface-400)]': isDisabledSearch\n }\"\n />\n <button\n type=\"button\"\n (click)=\"searchButtonClick.emit()\"\n tabindex=\"-1\"\n [disabled]=\"isDisabledSearch\"\n class=\"px-3 flex items-center justify-center shrink-0 _shk-bg-primary hover:[background-color:var(--shk-primary-700)] text-white border _shk-border-primary rounded-r-lg transition-colors duration-200 disabled:[background-color:var(--shk-surface-300)] dark:disabled:[background-color:var(--shk-surface-200)] disabled:[border-color:var(--shk-surface-300)] dark:disabled:[border-color:var(--shk-surface-200)] disabled:cursor-not-allowed\"\n >\n <svg [shkIcon]=\"getIcon('search')\" class=\"w-4 h-4\"></svg>\n </button>\n }\n\n @if (!searchMode()) {\n <input\n #input\n [id]=\"id()\"\n [maxlength]=\"maxLength() || (formatCard() ? 19 : null)\"\n [min]=\"type() === 'number' && preventNegative() ? '0' : null\"\n (keypress)=\"type() === 'number' || numbersOnly() ? numberValidation($event) : null\"\n [type]=\"effectiveType()\"\n [formControl]=\"$any(actualControl())\"\n [placeholder]=\"placeholder() || label()\"\n (input)=\"onInput($event)\"\n [autocomplete]=\"autocomplete()\"\n (blur)=\"onBlur()\"\n [attr.aria-invalid]=\"shouldShowError() || null\"\n [class.shk-control-valid]=\"wasFixedError()\"\n class=\"shk-control block w-full px-3 py-2 _shk-text-surface-700 _shk-bg-surface-50 border rounded-lg transition-colors placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-400)] focus:outline-none focus:[background-color:var(--shk-surface-50)] dark:focus:[background-color:var(--shk-surface-100)] focus:ring-1 disabled:[background-color:var(--shk-surface-50)] dark:disabled:[background-color:var(--shk-surface-100)] disabled:cursor-not-allowed sm:text-sm\"\n [ngClass]=\"{\n 'border-red-500 focus:border-red-500 focus:ring-red-500': shouldShowError(),\n 'border-green-500 focus:border-green-500 focus:ring-green-500': wasFixedError(),\n '_shk-border focus:[border-color:var(--shk-primary-500)] focus:[--tw-ring-color:var(--shk-primary-500)]': !shouldShowError() && !wasFixedError()\n }\"\n [class.pr-8]=\"type() === 'password' && actualControl().value?.length > 0\"\n [class.pr-3]=\"type() !== 'password' || !actualControl().value?.length\"\n />\n\n @if (type() === 'password' && actualControl().value?.length > 0) {\n <button\n type=\"button\"\n (click)=\"togglePasswordVisibility()\"\n [disabled]=\"actualControl().disabled\"\n class=\"absolute right-3 top-1/2 -translate-y-1/2 _shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-600)] focus:outline-none\"\n >\n @if (showPassword()) {\n <svg [shkIcon]=\"getIcon('eye-off')\" class=\"w-4 h-4\"></svg>\n } @else {\n <svg [shkIcon]=\"getIcon('eye')\" class=\"w-4 h-4\"></svg>\n }\n </button>\n }\n }\n </div>\n }\n\n @if (isTextArea()) {\n <textarea\n #textarea\n [id]=\"id()\"\n [formControl]=\"$any(actualControl())\"\n [placeholder]=\"placeholder() || label()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n [class]=\"isTextArea() ? textAreaHeight() : 'h-28'\"\n [attr.aria-invalid]=\"shouldShowError() || null\"\n [class.shk-control-valid]=\"wasFixedError()\"\n class=\"shk-control block w-full px-3 py-2 _shk-text-surface-700 _shk-bg-surface-50 border rounded-lg transition-colors placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-400)] focus:outline-none focus:[background-color:var(--shk-surface-50)] dark:focus:[background-color:var(--shk-surface-100)] focus:ring-1 resize-none disabled:[background-color:var(--shk-surface-50)] dark:disabled:[background-color:var(--shk-surface-100)] disabled:cursor-not-allowed disabled:[color:var(--shk-surface-400)] dark:disabled:[color:var(--shk-surface-400)] sm:text-sm\"\n [ngClass]=\"{\n 'border-red-500 focus:border-red-500 focus:ring-red-500': shouldShowError(),\n 'border-green-500 focus:border-green-500 focus:ring-green-500': wasFixedError(),\n '_shk-border focus:[border-color:var(--shk-primary-500)] focus:[--tw-ring-color:var(--shk-primary-500)]': !shouldShowError() && !wasFixedError()\n }\"\n ></textarea>\n }\n </div>\n\n @if (shouldShowError()) {\n <div class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\" tabindex=\"-1\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>\n",
|
|
451
|
+
dependencies: [
|
|
452
|
+
{
|
|
453
|
+
kind: "ngmodule",
|
|
454
|
+
type: CommonModule
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
kind: "directive",
|
|
458
|
+
type: i1.NgClass,
|
|
459
|
+
selector: "[ngClass]",
|
|
460
|
+
inputs: ["class", "ngClass"]
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
kind: "ngmodule",
|
|
464
|
+
type: ReactiveFormsModule
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
kind: "directive",
|
|
468
|
+
type: i2.DefaultValueAccessor,
|
|
469
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
kind: "directive",
|
|
473
|
+
type: i2.NgControlStatus,
|
|
474
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
kind: "directive",
|
|
478
|
+
type: i2.MaxLengthValidator,
|
|
479
|
+
selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
|
|
480
|
+
inputs: ["maxlength"]
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
kind: "directive",
|
|
484
|
+
type: i2.FormControlDirective,
|
|
485
|
+
selector: "[formControl]",
|
|
486
|
+
inputs: [
|
|
487
|
+
"formControl",
|
|
488
|
+
"disabled",
|
|
489
|
+
"ngModel"
|
|
490
|
+
],
|
|
491
|
+
outputs: ["ngModelChange"],
|
|
492
|
+
exportAs: ["ngForm"]
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
kind: "directive",
|
|
496
|
+
type: ShkIconDirective,
|
|
497
|
+
selector: "svg[shkIcon]",
|
|
498
|
+
inputs: [
|
|
499
|
+
"shkIcon",
|
|
500
|
+
"size",
|
|
501
|
+
"strokeWidth",
|
|
502
|
+
"color"
|
|
503
|
+
]
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
511
|
+
minVersion: "12.0.0",
|
|
512
|
+
version: "22.3.2",
|
|
513
|
+
ngImport: i0,
|
|
514
|
+
type: TextFieldComponent,
|
|
515
|
+
decorators: [{
|
|
516
|
+
type: Component,
|
|
517
|
+
args: [{
|
|
518
|
+
selector: "shk-text-field",
|
|
519
|
+
imports: [
|
|
520
|
+
CommonModule,
|
|
521
|
+
ReactiveFormsModule,
|
|
522
|
+
ShkIconDirective
|
|
523
|
+
],
|
|
524
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
525
|
+
providers: [{
|
|
526
|
+
provide: NG_VALUE_ACCESSOR,
|
|
527
|
+
useExisting: forwardRef(() => TextFieldComponent),
|
|
528
|
+
multi: true
|
|
529
|
+
}],
|
|
530
|
+
template: "<div class=\"relative mb-4\">\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 mb-1\">\n {{ label() }}\n </div>\n }\n\n <div class=\"relative\">\n @if (!isTextArea()) {\n <div class=\"flex\">\n @if (searchMode()) {\n @let isDisabledSearch = actualControl().disabled || isDisabled();\n <input\n #input\n [id]=\"id()\"\n type=\"text\"\n [value]=\"displayValue() || ''\"\n [placeholder]=\"placeholder() || label()\"\n [readOnly]=\"true\"\n [disabled]=\"isDisabledSearch\"\n (click)=\"!isDisabledSearch && searchButtonClick.emit()\"\n (keydown.enter)=\"!isDisabledSearch && searchButtonClick.emit()\"\n (blur)=\"onBlur()\"\n autocomplete=\"off\"\n [attr.aria-invalid]=\"(shouldShowError() && !isDisabledSearch) || null\"\n [class.cursor-pointer]=\"!isDisabledSearch\"\n [class.cursor-not-allowed]=\"isDisabledSearch\"\n [class._shk-bg-surface-50]=\"isDisabledSearch\"\n [class._shk-text-surface-400]=\"isDisabledSearch\"\n class=\"shk-control shk-control-addon block w-full px-3 py-2 _shk-text-surface-700 _shk-bg-surface-50 border rounded-l-lg transition-colors placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-400)] focus:[background-color:var(--shk-surface-50)] dark:focus:[background-color:var(--shk-surface-100)] sm:text-sm\"\n [ngClass]=\"{\n 'border-red-500': shouldShowError() && !isDisabledSearch,\n '_shk-border': !shouldShowError() || isDisabledSearch,\n 'cursor-pointer': !isDisabledSearch,\n 'cursor-not-allowed _shk-text-surface-400 dark:[color:var(--shk-surface-400)]': isDisabledSearch\n }\"\n />\n <button\n type=\"button\"\n (click)=\"searchButtonClick.emit()\"\n tabindex=\"-1\"\n [disabled]=\"isDisabledSearch\"\n class=\"px-3 flex items-center justify-center shrink-0 _shk-bg-primary hover:[background-color:var(--shk-primary-700)] text-white border _shk-border-primary rounded-r-lg transition-colors duration-200 disabled:[background-color:var(--shk-surface-300)] dark:disabled:[background-color:var(--shk-surface-200)] disabled:[border-color:var(--shk-surface-300)] dark:disabled:[border-color:var(--shk-surface-200)] disabled:cursor-not-allowed\"\n >\n <svg [shkIcon]=\"getIcon('search')\" class=\"w-4 h-4\"></svg>\n </button>\n }\n\n @if (!searchMode()) {\n <input\n #input\n [id]=\"id()\"\n [maxlength]=\"maxLength() || (formatCard() ? 19 : null)\"\n [min]=\"type() === 'number' && preventNegative() ? '0' : null\"\n (keypress)=\"type() === 'number' || numbersOnly() ? numberValidation($event) : null\"\n [type]=\"effectiveType()\"\n [formControl]=\"$any(actualControl())\"\n [placeholder]=\"placeholder() || label()\"\n (input)=\"onInput($event)\"\n [autocomplete]=\"autocomplete()\"\n (blur)=\"onBlur()\"\n [attr.aria-invalid]=\"shouldShowError() || null\"\n [class.shk-control-valid]=\"wasFixedError()\"\n class=\"shk-control block w-full px-3 py-2 _shk-text-surface-700 _shk-bg-surface-50 border rounded-lg transition-colors placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-400)] focus:outline-none focus:[background-color:var(--shk-surface-50)] dark:focus:[background-color:var(--shk-surface-100)] focus:ring-1 disabled:[background-color:var(--shk-surface-50)] dark:disabled:[background-color:var(--shk-surface-100)] disabled:cursor-not-allowed sm:text-sm\"\n [ngClass]=\"{\n 'border-red-500 focus:border-red-500 focus:ring-red-500': shouldShowError(),\n 'border-green-500 focus:border-green-500 focus:ring-green-500': wasFixedError(),\n '_shk-border focus:[border-color:var(--shk-primary-500)] focus:[--tw-ring-color:var(--shk-primary-500)]': !shouldShowError() && !wasFixedError()\n }\"\n [class.pr-8]=\"type() === 'password' && actualControl().value?.length > 0\"\n [class.pr-3]=\"type() !== 'password' || !actualControl().value?.length\"\n />\n\n @if (type() === 'password' && actualControl().value?.length > 0) {\n <button\n type=\"button\"\n (click)=\"togglePasswordVisibility()\"\n [disabled]=\"actualControl().disabled\"\n class=\"absolute right-3 top-1/2 -translate-y-1/2 _shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-600)] focus:outline-none\"\n >\n @if (showPassword()) {\n <svg [shkIcon]=\"getIcon('eye-off')\" class=\"w-4 h-4\"></svg>\n } @else {\n <svg [shkIcon]=\"getIcon('eye')\" class=\"w-4 h-4\"></svg>\n }\n </button>\n }\n }\n </div>\n }\n\n @if (isTextArea()) {\n <textarea\n #textarea\n [id]=\"id()\"\n [formControl]=\"$any(actualControl())\"\n [placeholder]=\"placeholder() || label()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n [class]=\"isTextArea() ? textAreaHeight() : 'h-28'\"\n [attr.aria-invalid]=\"shouldShowError() || null\"\n [class.shk-control-valid]=\"wasFixedError()\"\n class=\"shk-control block w-full px-3 py-2 _shk-text-surface-700 _shk-bg-surface-50 border rounded-lg transition-colors placeholder:[color:var(--shk-surface-400)] dark:placeholder:[color:var(--shk-surface-400)] focus:outline-none focus:[background-color:var(--shk-surface-50)] dark:focus:[background-color:var(--shk-surface-100)] focus:ring-1 resize-none disabled:[background-color:var(--shk-surface-50)] dark:disabled:[background-color:var(--shk-surface-100)] disabled:cursor-not-allowed disabled:[color:var(--shk-surface-400)] dark:disabled:[color:var(--shk-surface-400)] sm:text-sm\"\n [ngClass]=\"{\n 'border-red-500 focus:border-red-500 focus:ring-red-500': shouldShowError(),\n 'border-green-500 focus:border-green-500 focus:ring-green-500': wasFixedError(),\n '_shk-border focus:[border-color:var(--shk-primary-500)] focus:[--tw-ring-color:var(--shk-primary-500)]': !shouldShowError() && !wasFixedError()\n }\"\n ></textarea>\n }\n </div>\n\n @if (shouldShowError()) {\n <div class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\" tabindex=\"-1\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>\n"
|
|
531
|
+
}]
|
|
532
|
+
}],
|
|
533
|
+
ctorParameters: () => [],
|
|
534
|
+
propDecorators: {
|
|
535
|
+
id: [{
|
|
536
|
+
type: i0.Input,
|
|
537
|
+
args: [{
|
|
538
|
+
isSignal: true,
|
|
539
|
+
alias: "id",
|
|
540
|
+
required: false
|
|
541
|
+
}]
|
|
542
|
+
}],
|
|
543
|
+
formatCard: [{
|
|
544
|
+
type: i0.Input,
|
|
545
|
+
args: [{
|
|
546
|
+
isSignal: true,
|
|
547
|
+
alias: "formatCard",
|
|
548
|
+
required: false
|
|
549
|
+
}]
|
|
550
|
+
}],
|
|
551
|
+
preventNegative: [{
|
|
552
|
+
type: i0.Input,
|
|
553
|
+
args: [{
|
|
554
|
+
isSignal: true,
|
|
555
|
+
alias: "preventNegative",
|
|
556
|
+
required: false
|
|
557
|
+
}]
|
|
558
|
+
}],
|
|
559
|
+
label: [{
|
|
560
|
+
type: i0.Input,
|
|
561
|
+
args: [{
|
|
562
|
+
isSignal: true,
|
|
563
|
+
alias: "label",
|
|
564
|
+
required: false
|
|
565
|
+
}]
|
|
566
|
+
}],
|
|
567
|
+
type: [{
|
|
568
|
+
type: i0.Input,
|
|
569
|
+
args: [{
|
|
570
|
+
isSignal: true,
|
|
571
|
+
alias: "type",
|
|
572
|
+
required: false
|
|
573
|
+
}]
|
|
574
|
+
}],
|
|
575
|
+
numbersOnly: [{
|
|
576
|
+
type: i0.Input,
|
|
577
|
+
args: [{
|
|
578
|
+
isSignal: true,
|
|
579
|
+
alias: "numbersOnly",
|
|
580
|
+
required: false
|
|
581
|
+
}]
|
|
582
|
+
}],
|
|
583
|
+
allowDecimals: [{
|
|
584
|
+
type: i0.Input,
|
|
585
|
+
args: [{
|
|
586
|
+
isSignal: true,
|
|
587
|
+
alias: "allowDecimals",
|
|
588
|
+
required: false
|
|
589
|
+
}]
|
|
590
|
+
}],
|
|
591
|
+
maxLength: [{
|
|
592
|
+
type: i0.Input,
|
|
593
|
+
args: [{
|
|
594
|
+
isSignal: true,
|
|
595
|
+
alias: "maxLength",
|
|
596
|
+
required: false
|
|
597
|
+
}]
|
|
598
|
+
}],
|
|
599
|
+
placeholder: [{
|
|
600
|
+
type: i0.Input,
|
|
601
|
+
args: [{
|
|
602
|
+
isSignal: true,
|
|
603
|
+
alias: "placeholder",
|
|
604
|
+
required: false
|
|
605
|
+
}]
|
|
606
|
+
}],
|
|
607
|
+
errorMessages: [{
|
|
608
|
+
type: i0.Input,
|
|
609
|
+
args: [{
|
|
610
|
+
isSignal: true,
|
|
611
|
+
alias: "errorMessages",
|
|
612
|
+
required: false
|
|
613
|
+
}]
|
|
614
|
+
}],
|
|
615
|
+
formGroup: [{
|
|
616
|
+
type: i0.Input,
|
|
617
|
+
args: [{
|
|
618
|
+
isSignal: true,
|
|
619
|
+
alias: "formGroup",
|
|
620
|
+
required: false
|
|
621
|
+
}]
|
|
622
|
+
}],
|
|
623
|
+
control: [{
|
|
624
|
+
type: i0.Input,
|
|
625
|
+
args: [{
|
|
626
|
+
isSignal: true,
|
|
627
|
+
alias: "control",
|
|
628
|
+
required: false
|
|
629
|
+
}]
|
|
630
|
+
}],
|
|
631
|
+
disabled: [{
|
|
632
|
+
type: i0.Input,
|
|
633
|
+
args: [{
|
|
634
|
+
isSignal: true,
|
|
635
|
+
alias: "disabled",
|
|
636
|
+
required: false
|
|
637
|
+
}]
|
|
638
|
+
}],
|
|
639
|
+
errors: [{
|
|
640
|
+
type: i0.Input,
|
|
641
|
+
args: [{
|
|
642
|
+
isSignal: true,
|
|
643
|
+
alias: "errors",
|
|
644
|
+
required: false
|
|
645
|
+
}]
|
|
646
|
+
}],
|
|
647
|
+
invalid: [{
|
|
648
|
+
type: i0.Input,
|
|
649
|
+
args: [{
|
|
650
|
+
isSignal: true,
|
|
651
|
+
alias: "invalid",
|
|
652
|
+
required: false
|
|
653
|
+
}]
|
|
654
|
+
}],
|
|
655
|
+
touched: [{
|
|
656
|
+
type: i0.Input,
|
|
657
|
+
args: [{
|
|
658
|
+
isSignal: true,
|
|
659
|
+
alias: "touched",
|
|
660
|
+
required: false
|
|
661
|
+
}]
|
|
662
|
+
}],
|
|
663
|
+
dirty: [{
|
|
664
|
+
type: i0.Input,
|
|
665
|
+
args: [{
|
|
666
|
+
isSignal: true,
|
|
667
|
+
alias: "dirty",
|
|
668
|
+
required: false
|
|
669
|
+
}]
|
|
670
|
+
}],
|
|
671
|
+
errorMessage: [{
|
|
672
|
+
type: i0.Input,
|
|
673
|
+
args: [{
|
|
674
|
+
isSignal: true,
|
|
675
|
+
alias: "errorMessage",
|
|
676
|
+
required: false
|
|
677
|
+
}]
|
|
678
|
+
}],
|
|
679
|
+
isTextArea: [{
|
|
680
|
+
type: i0.Input,
|
|
681
|
+
args: [{
|
|
682
|
+
isSignal: true,
|
|
683
|
+
alias: "isTextArea",
|
|
684
|
+
required: false
|
|
685
|
+
}]
|
|
686
|
+
}],
|
|
687
|
+
textAreaHeight: [{
|
|
688
|
+
type: i0.Input,
|
|
689
|
+
args: [{
|
|
690
|
+
isSignal: true,
|
|
691
|
+
alias: "textAreaHeight",
|
|
692
|
+
required: false
|
|
693
|
+
}]
|
|
694
|
+
}],
|
|
695
|
+
searchMode: [{
|
|
696
|
+
type: i0.Input,
|
|
697
|
+
args: [{
|
|
698
|
+
isSignal: true,
|
|
699
|
+
alias: "searchMode",
|
|
700
|
+
required: false
|
|
701
|
+
}]
|
|
702
|
+
}],
|
|
703
|
+
displayValue: [{
|
|
704
|
+
type: i0.Input,
|
|
705
|
+
args: [{
|
|
706
|
+
isSignal: true,
|
|
707
|
+
alias: "displayValue",
|
|
708
|
+
required: false
|
|
709
|
+
}]
|
|
710
|
+
}],
|
|
711
|
+
autocomplete: [{
|
|
712
|
+
type: i0.Input,
|
|
713
|
+
args: [{
|
|
714
|
+
isSignal: true,
|
|
715
|
+
alias: "autocomplete",
|
|
716
|
+
required: false
|
|
717
|
+
}]
|
|
718
|
+
}],
|
|
719
|
+
searchButtonClick: [{
|
|
720
|
+
type: i0.Output,
|
|
721
|
+
args: ["searchButtonClick"]
|
|
722
|
+
}],
|
|
723
|
+
touch: [{
|
|
724
|
+
type: i0.Output,
|
|
725
|
+
args: ["touch"]
|
|
726
|
+
}],
|
|
727
|
+
inputElement: [{
|
|
728
|
+
type: i0.ViewChild,
|
|
729
|
+
args: ["input", { isSignal: true }]
|
|
730
|
+
}],
|
|
731
|
+
textareaElement: [{
|
|
732
|
+
type: i0.ViewChild,
|
|
733
|
+
args: ["textarea", { isSignal: true }]
|
|
734
|
+
}],
|
|
735
|
+
value: [{
|
|
736
|
+
type: i0.Input,
|
|
737
|
+
args: [{
|
|
738
|
+
isSignal: true,
|
|
739
|
+
alias: "value",
|
|
740
|
+
required: false
|
|
741
|
+
}]
|
|
742
|
+
}, {
|
|
743
|
+
type: i0.Output,
|
|
744
|
+
args: ["valueChange"]
|
|
745
|
+
}]
|
|
746
|
+
}
|
|
747
|
+
});
|
|
402
748
|
export { TextFieldComponent };
|
|
403
|
-
|
|
749
|
+
|
|
750
|
+
//# sourceMappingURL=shirkasoft-ui-components-text-field.mjs.map
|