comand-component-library 4.3.28 → 5.0.0
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/dist/comand-component-library.css +1 -1
- package/dist/comand-component-library.js +9587 -9482
- package/dist/styles/demopage-only.css +12 -2
- package/package.json +47 -46
- package/src/ComponentLibrary.vue +2697 -2688
- package/src/assets/data/component-structure.json +1 -1
- package/src/assets/data/form-elements.json +224 -224
- package/src/assets/data/social-networks-page-by-json.json +43 -43
- package/src/assets/styles/component-library-global-styles.scss +296 -295
- package/src/componentSettingsDataAndControls.vue +1 -18
- package/src/components/CmdAccordion.vue +1 -1
- package/src/components/CmdAddressData.vue +6 -1
- package/src/components/CmdAddressDataItem.vue +6 -1
- package/src/components/CmdBasicForm.vue +2 -2
- package/src/components/CmdBox.vue +1103 -1092
- package/src/components/CmdBoxWrapper.vue +7 -1
- package/src/components/CmdBreadcrumbs.vue +2 -2
- package/src/components/CmdCodeOutput.vue +1 -1
- package/src/components/CmdCookieDisclaimer.vue +480 -480
- package/src/components/CmdFakeSelect.vue +930 -916
- package/src/components/CmdFlexibleScrollContainer.vue +42 -42
- package/src/components/CmdForm.vue +481 -481
- package/src/components/CmdFormElement.vue +1110 -1091
- package/src/components/CmdFormFilters.vue +146 -146
- package/src/components/CmdGoogleMaps.vue +1 -1
- package/src/components/CmdHeadline.vue +21 -4
- package/src/components/CmdIcon.vue +8 -2
- package/src/components/CmdImage.vue +14 -16
- package/src/components/CmdImageZoom.vue +9 -8
- package/src/components/CmdInputGroup.vue +436 -435
- package/src/components/CmdLink.vue +1 -1
- package/src/components/CmdList.vue +1 -1
- package/src/components/CmdListOfRequirements.vue +192 -192
- package/src/components/CmdLoginForm.vue +618 -618
- package/src/components/CmdMailToolFilter.vue +217 -217
- package/src/components/CmdMainNavigation.vue +581 -572
- package/src/components/CmdMultistepFormProgressBar.vue +9 -9
- package/src/components/CmdNewsletterSubscription.vue +199 -199
- package/src/components/CmdPagination.vue +4 -2
- package/src/components/CmdParagraph.vue +10 -4
- package/src/components/CmdProgressBar.vue +72 -72
- package/src/components/CmdSiteHeader.vue +382 -389
- package/src/components/CmdSiteSearch.vue +420 -420
- package/src/components/CmdSiteWrapper.vue +12 -5
- package/src/components/CmdSlideshow.vue +519 -519
- package/src/components/CmdSmartSearch.vue +291 -291
- package/src/components/CmdSystemMessage.vue +3 -2
- package/src/components/CmdTable.vue +401 -401
- package/src/components/CmdTabs.vue +262 -262
- package/src/components/CmdTag.vue +1 -1
- package/src/components/CmdTextImageBlock.vue +8 -2
- package/src/components/CmdThumbnailScroller.vue +0 -7
- package/src/components/CmdToggleDarkMode.vue +13 -11
- package/src/components/CmdTooltip.vue +305 -301
- package/src/components/CmdUploadForm.vue +1299 -1305
- package/src/components/CmdWidthLimitationWrapper.vue +1 -1
- package/src/components/EditComponentWrapper.vue +5 -5
- package/src/index.js +5 -0
- package/src/main.js +4 -3
- package/src/utils/template.js +57 -0
- package/src/assets/styles/template.css +0 -1
|
@@ -1,1091 +1,1110 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- begin CmdFormElement ---------------------------------------------------------------------------------------- -->
|
|
3
|
-
<label v-if="(element === 'input' || element === 'select' || element === 'textarea')" :class="[
|
|
4
|
-
'cmd-form-element',
|
|
5
|
-
$attrs.class,
|
|
6
|
-
$attrs.required ? validationStatus : null,
|
|
7
|
-
{
|
|
8
|
-
disabled: $attrs.disabled,
|
|
9
|
-
inline: displayLabelInline,
|
|
10
|
-
'stretch-field': stretchField,
|
|
11
|
-
'toggle-switch': toggleSwitch,
|
|
12
|
-
colored: colored,
|
|
13
|
-
'has-state': validationStatus
|
|
14
|
-
}
|
|
15
|
-
]" :for="htmlId" :title="$attrs.title" ref="label">
|
|
16
|
-
|
|
17
|
-
<!-- begin label-text (+ required asterisk) -->
|
|
18
|
-
<span v-if="(labelText || $slots.labeltext) && $attrs.type !== 'checkbox' && $attrs.type !== 'radio'"
|
|
19
|
-
:class="['label-text', { hidden: !showLabel }]">
|
|
20
|
-
<span>
|
|
21
|
-
<span v-if="labelText" v-html="labelText"></span>
|
|
22
|
-
|
|
23
|
-
<!-- begin slot 'labeltext' -->
|
|
24
|
-
<slot v-else name="labeltext" />
|
|
25
|
-
<!-- end slot 'labeltext' -->
|
|
26
|
-
|
|
27
|
-
<!-- begin required asterisk -->
|
|
28
|
-
<sup v-if="$attrs.required != null && $attrs.required !== false" aria-hidden="true">*</sup>
|
|
29
|
-
<!-- end required asterisk -->
|
|
30
|
-
</span>
|
|
31
|
-
|
|
32
|
-
<!-- begin status-icon (linked with tooltip) -->
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
aria-
|
|
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
|
-
<!-- begin
|
|
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
|
-
<!-- begin slot 'labeltext' -->
|
|
131
|
-
<slot
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
<
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
<span
|
|
152
|
-
</span>
|
|
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
|
-
import
|
|
237
|
-
import
|
|
238
|
-
import
|
|
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
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
value === "
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
*
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
*
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
*
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
},
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
},
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
if (typeof this.modelValue === "
|
|
723
|
-
return this.modelValue
|
|
724
|
-
}
|
|
725
|
-
if (this.modelValue
|
|
726
|
-
return this.modelValue
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
if (this
|
|
750
|
-
return this.
|
|
751
|
-
}
|
|
752
|
-
return
|
|
753
|
-
},
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
this.$emit("update:modelValue",
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
//
|
|
888
|
-
passwordField.
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
this.$emit("
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
.
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
:
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
a.
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<!-- begin CmdFormElement ---------------------------------------------------------------------------------------- -->
|
|
3
|
+
<label v-if="(element === 'input' || element === 'select' || element === 'textarea')" :class="[
|
|
4
|
+
'cmd-form-element',
|
|
5
|
+
$attrs.class,
|
|
6
|
+
$attrs.required ? validationStatus : null,
|
|
7
|
+
{
|
|
8
|
+
disabled: $attrs.disabled,
|
|
9
|
+
inline: displayLabelInline,
|
|
10
|
+
'stretch-field': stretchField,
|
|
11
|
+
'toggle-switch': toggleSwitch,
|
|
12
|
+
colored: colored,
|
|
13
|
+
'has-state': validationStatus
|
|
14
|
+
}
|
|
15
|
+
]" :for="htmlId" :title="$attrs.title" ref="label">
|
|
16
|
+
|
|
17
|
+
<!-- begin label-text (+ required asterisk) -->
|
|
18
|
+
<span v-if="(labelText || $slots.labeltext) && $attrs.type !== 'checkbox' && $attrs.type !== 'radio'"
|
|
19
|
+
:class="['label-text', { 'visually-hidden': !showLabel }]">
|
|
20
|
+
<span>
|
|
21
|
+
<span v-if="labelText" v-html="labelText"></span>
|
|
22
|
+
|
|
23
|
+
<!-- begin slot 'labeltext' -->
|
|
24
|
+
<slot v-else name="labeltext" />
|
|
25
|
+
<!-- end slot 'labeltext' -->
|
|
26
|
+
|
|
27
|
+
<!-- begin required asterisk -->
|
|
28
|
+
<sup v-if="$attrs.required != null && $attrs.required !== false" aria-hidden="true">*</sup>
|
|
29
|
+
<!-- end required asterisk -->
|
|
30
|
+
</span>
|
|
31
|
+
|
|
32
|
+
<!-- begin status-icon (linked with tooltip) -->
|
|
33
|
+
<!-- (span with role="button" instead of <button>: a <label> must not contain a second labelable control) -->
|
|
34
|
+
<span v-if="($attrs.required || inputRequirements.length) && showStatusIcon"
|
|
35
|
+
role="button"
|
|
36
|
+
tabindex="0"
|
|
37
|
+
class="no-style status-icon-button"
|
|
38
|
+
:aria-label="validationTooltip"
|
|
39
|
+
:title="validationTooltip"
|
|
40
|
+
@click.prevent.stop="toggleStatusTooltip"
|
|
41
|
+
@keydown.enter.prevent.stop="toggleStatusTooltip"
|
|
42
|
+
@keydown.space.prevent.stop="toggleStatusTooltip"
|
|
43
|
+
aria-haspopup="true"
|
|
44
|
+
:style="'anchor-name: --tooltip-anchor-' + htmlId"
|
|
45
|
+
>
|
|
46
|
+
<!-- begin CmdIcon -->
|
|
47
|
+
<CmdIcon :iconClass="getStatusIconClass" />
|
|
48
|
+
<!-- end CmdIcon -->
|
|
49
|
+
</span>
|
|
50
|
+
<!-- end status-icon (linked with tooltip) -->
|
|
51
|
+
|
|
52
|
+
<!-- begin CmdTooltip -->
|
|
53
|
+
<CmdTooltip
|
|
54
|
+
ref="tooltip"
|
|
55
|
+
class="cmd-tooltip-for-form-elements box"
|
|
56
|
+
:id="'tooltip-target-' + htmlId"
|
|
57
|
+
:scrollContainer="scrollContainerForTooltip"
|
|
58
|
+
:popoverTargetName="'tooltip-target-' + htmlId"
|
|
59
|
+
:validationStatus="validationStatus"
|
|
60
|
+
:role="validationStatus === 'error' ? 'alert' : 'dialog'"
|
|
61
|
+
:toggle-visibility-by-click="true"
|
|
62
|
+
:style="'position-anchor: --tooltip-anchor-' + htmlId"
|
|
63
|
+
>
|
|
64
|
+
|
|
65
|
+
<!-- begin CmdListOfRequirements -->
|
|
66
|
+
<CmdListOfRequirements
|
|
67
|
+
v-if="cmdListOfRequirementsProperties.showRequirements"
|
|
68
|
+
v-bind="cmdListOfRequirementsProperties"
|
|
69
|
+
/>
|
|
70
|
+
<!-- end CmdListOfRequirements -->
|
|
71
|
+
</CmdTooltip>
|
|
72
|
+
<!-- end CmdTooltip -->
|
|
73
|
+
</span>
|
|
74
|
+
<!-- end label-text (+ required asterisk) -->
|
|
75
|
+
|
|
76
|
+
<!-- begin element 'input' -->
|
|
77
|
+
<template v-if="element === 'input'">
|
|
78
|
+
<span v-if="$attrs.type !== 'checkbox' && $attrs.type !== 'radio' && $attrs.type !== 'search'"
|
|
79
|
+
class="flex-container inner-input-wrapper"><!-- container required to place inner icons correctly -->
|
|
80
|
+
<!-- begin CmdIcon (for icon inside field) -->
|
|
81
|
+
<CmdIcon v-if="fieldIconClass" class="place-inside" :iconClass="fieldIconClass" />
|
|
82
|
+
<!-- end CmdIcon (for icon inside field) -->
|
|
83
|
+
|
|
84
|
+
<!-- begin inputfield -->
|
|
85
|
+
<template v-if="element === 'input' && $attrs.type !== 'search'">
|
|
86
|
+
<input :id="htmlId" :class="inputClass" @focus="tooltip = true" @blur="onBlur" @input="onInput"
|
|
87
|
+
@mouseover="datalistFocus" @keyup="checkForCapsLock" @change="$emit('change', $event)"
|
|
88
|
+
:autocomplete="autocomplete" :list="datalist ? datalist.id : null"
|
|
89
|
+
:value="modelValue"
|
|
90
|
+
:minlength="$attrs.type === 'password' ? '8' : null"
|
|
91
|
+
:maxlength="getMaxLength()"
|
|
92
|
+
ref="input"
|
|
93
|
+
v-bind="elementAttributes" />
|
|
94
|
+
<!-- begin delete-icon -->
|
|
95
|
+
<a v-if="iconDelete?.show && !$attrs.disabled && ($attrs.type === 'text' || $attrs.type === 'email' || $attrs.type === 'tel' || $attrs.type === 'phone')"
|
|
96
|
+
class="deleteicon" href="#" @click.prevent="deleteInput" :title="iconDelete?.tooltip">
|
|
97
|
+
<CmdIcon :iconClass="iconDelete?.iconClass" :type="iconDelete?.iconType" />
|
|
98
|
+
</a>
|
|
99
|
+
<!-- end delete-icon -->
|
|
100
|
+
</template>
|
|
101
|
+
<!-- end inputfield -->
|
|
102
|
+
|
|
103
|
+
<!-- begin show-password-icon -->
|
|
104
|
+
<a v-if="$attrs.type === 'password'" href="#" class="place-inside" @mousedown.prevent="showPassword"
|
|
105
|
+
@mouseup.prevent="hidePassword" @mouseleave.prevent="hidePassword" @click.prevent
|
|
106
|
+
:title="iconPasswordVisible.tooltip">
|
|
107
|
+
<CmdIcon :iconClass="iconPasswordVisible.iconClass" />
|
|
108
|
+
</a>
|
|
109
|
+
<!-- end show-password-icon -->
|
|
110
|
+
</span>
|
|
111
|
+
|
|
112
|
+
<!-- begin datalist -->
|
|
113
|
+
<template v-if="datalist && datalist.options.length">
|
|
114
|
+
<datalist :id="datalist.id">
|
|
115
|
+
<option v-for="(option, index) in datalist.options" :key="index" :value="option"></option>
|
|
116
|
+
</datalist>
|
|
117
|
+
</template>
|
|
118
|
+
<!-- end datalist -->
|
|
119
|
+
|
|
120
|
+
<!-- begin checkbox and radiobutton -->
|
|
121
|
+
<template v-else-if="$attrs.type === 'checkbox' || $attrs.type === 'radio'">
|
|
122
|
+
<!-- begin default checkbox/radiobutton -->
|
|
123
|
+
<template v-if="!(onLabel && offLabel)">
|
|
124
|
+
<input v-bind="elementAttributes" @change="onChange" @blur="onBlur" :checked="isChecked"
|
|
125
|
+
:value="inputValue"
|
|
126
|
+
:class="[inputClass, validationStatus, toggleSwitchIconClass, { 'replace-input-type': replaceInputType }]"
|
|
127
|
+
:id="htmlId" :disabled="$attrs.disabled" :aria-invalid="validationStatus === 'error'" />
|
|
128
|
+
<span v-if="labelText || $slots.labeltext" :class="['label-text', { 'visually-hidden': !showLabel }]">
|
|
129
|
+
<span>
|
|
130
|
+
<!-- begin slot 'labeltext' -->
|
|
131
|
+
<slot name="labeltext">
|
|
132
|
+
<!-- begin labelText for checkbox/radio/toggle-switch (without switch-label) -->
|
|
133
|
+
<span v-html="labelText"></span>
|
|
134
|
+
<!-- end labelText for checkbox/radio/toggle-switch (without switch-label) -->
|
|
135
|
+
|
|
136
|
+
<sup v-if="$attrs.required">*</sup>
|
|
137
|
+
</slot>
|
|
138
|
+
<!-- end slot 'labeltext' -->
|
|
139
|
+
</span>
|
|
140
|
+
</span>
|
|
141
|
+
</template>
|
|
142
|
+
<!-- end default checkbox/radiobutton -->
|
|
143
|
+
|
|
144
|
+
<!-- begin labels for toggle-switch with switch-label -->
|
|
145
|
+
<template v-else-if="onLabel && offLabel">
|
|
146
|
+
<span class="switch-label-wrapper">
|
|
147
|
+
<input v-bind="elementAttributes" @change="onChange" @blur="onBlur" :checked="isChecked"
|
|
148
|
+
:value="inputValue" :class="[inputClass, validationStatus]" :id="htmlId"
|
|
149
|
+
:disabled="$attrs.disabled" :aria-invalid="validationStatus === 'error'" />
|
|
150
|
+
<span class="label-text">{{ onLabel }}</span>
|
|
151
|
+
<span class="label-text">{{ offLabel }}</span>
|
|
152
|
+
</span>
|
|
153
|
+
<!-- begin labelText for checkbox/radio/toggle-switch (with switch-label) -->
|
|
154
|
+
<span v-if="labelText" :class="['label-text', { 'visually-hidden': !showLabel }]">
|
|
155
|
+
<span v-html="labelText"></span><sup v-if="$attrs.required">*</sup>
|
|
156
|
+
</span>
|
|
157
|
+
<!-- end labelText for checkbox/radio/toggle-switch (with switch-label) -->
|
|
158
|
+
</template>
|
|
159
|
+
<!-- end labels for toggle-switch with switch-label -->
|
|
160
|
+
</template>
|
|
161
|
+
<!-- end checkbox and radiobutton -->
|
|
162
|
+
</template>
|
|
163
|
+
<!-- end element 'input' -->
|
|
164
|
+
|
|
165
|
+
<!-- begin selectbox -->
|
|
166
|
+
<select v-if="element === 'select'" v-bind="elementAttributes" :id="htmlId" @blur="onBlur" @change="onChange">
|
|
167
|
+
<option v-if="!groupSelectOptionsByInitialLetters" v-for="(option, index) in selectOptions" :key="index"
|
|
168
|
+
:value="option.value" :selected="option.value === modelValue">
|
|
169
|
+
{{ option.text }}
|
|
170
|
+
</option>
|
|
171
|
+
<optgroup v-else :label="key" v-for="(options, key) in initialLetters" :key="key">
|
|
172
|
+
<option v-for="(option, optionIndex) in options" :key="optionIndex" :value="option.value"
|
|
173
|
+
:selected="option.value === modelValue">
|
|
174
|
+
{{ option.text }}
|
|
175
|
+
</option>
|
|
176
|
+
</optgroup>
|
|
177
|
+
</select>
|
|
178
|
+
<!-- end selectbox -->
|
|
179
|
+
|
|
180
|
+
<!-- begin textarea -->
|
|
181
|
+
<textarea v-if="element === 'textarea'" v-bind="elementAttributes" :id="htmlId" :value="modelValue"
|
|
182
|
+
:maxlength="getMaxLength()" @input="onInput" @focus="tooltip = true"
|
|
183
|
+
@blur="onBlur"></textarea><!-- no line-break to avoid empty spaces inside textarea -->
|
|
184
|
+
<span v-if="element === 'textarea' && showCharactersTextarea" class="characters-left-wrapper">
|
|
185
|
+
<span v-if="textCharactersLeft">{{ textCharactersLeft }}</span>
|
|
186
|
+
<span :class="['characters-left', { error: charactersLeft === 0 }]">{{ charactersLeft }}</span>
|
|
187
|
+
</span>
|
|
188
|
+
<!-- end textarea -->
|
|
189
|
+
|
|
190
|
+
<!-- begin searchfield -->
|
|
191
|
+
<template v-else-if="element === 'input' && $attrs.type === 'search'">
|
|
192
|
+
<span class="inner-input-wrapper flex-container no-gap">
|
|
193
|
+
<!-- begin CmdIcon (for icon inside field) -->
|
|
194
|
+
<CmdIcon v-if="fieldIconClass" class="place-inside" :iconClass="fieldIconClass" />
|
|
195
|
+
<!-- end CmdIcon (for icon inside field) -->
|
|
196
|
+
<input v-bind="elementAttributes" :id="htmlId" @input="onInput" :maxlength="getMaxLength()"
|
|
197
|
+
:value="modelValue" />
|
|
198
|
+
<a v-if="showSearchButton" href="#" :class="['button flex-none', { disabled: $attrs.disabled }]"
|
|
199
|
+
:title="iconSearch.tooltip" @click.prevent="executeSearch">
|
|
200
|
+
<!-- begin CmdIcon -->
|
|
201
|
+
<CmdIcon :iconClass="iconSearch.iconClass" />
|
|
202
|
+
<!-- end CmdIcon -->
|
|
203
|
+
</a>
|
|
204
|
+
<a v-if="iconDelete?.show && !$attrs.disabled" class="deleteicon" href="#" @click.prevent="deleteInput"
|
|
205
|
+
:title="iconDelete?.tooltip">
|
|
206
|
+
<!-- begin CmdIcon -->
|
|
207
|
+
<CmdIcon :iconClass="iconDelete?.iconClass" :type="iconDelete?.iconType" />
|
|
208
|
+
<!-- end CmdIcon -->
|
|
209
|
+
</a>
|
|
210
|
+
</span>
|
|
211
|
+
</template>
|
|
212
|
+
</label>
|
|
213
|
+
<!-- end searchfield -->
|
|
214
|
+
|
|
215
|
+
<!-- begin button -->
|
|
216
|
+
<button v-else-if="element === 'button'" class="button" v-bind="buttonAttrs" @click="submit">
|
|
217
|
+
<!-- begin CmdIcon -->
|
|
218
|
+
<CmdIcon
|
|
219
|
+
v-if="nativeButton?.icon?.show && (nativeButton?.icon?.position === 'before' || !nativeButton?.icon?.position)"
|
|
220
|
+
:iconClass="nativeButton?.icon?.iconClass" :type="nativeButton?.icon?.iconType" />
|
|
221
|
+
<!-- end CmdIcon -->
|
|
222
|
+
<span v-if="nativeButton?.icon && nativeButton?.text">{{ nativeButton.text }}</span>
|
|
223
|
+
<template v-else>
|
|
224
|
+
{{ nativeButton.text }}
|
|
225
|
+
</template>
|
|
226
|
+
<!-- begin CmdIcon -->
|
|
227
|
+
<CmdIcon v-if="nativeButton?.icon?.show && nativeButton?.icon?.position === 'after'"
|
|
228
|
+
:iconClass="nativeButton?.icon?.iconClass" :type="nativeButton?.icon?.iconType" />
|
|
229
|
+
<!-- end CmdIcon -->
|
|
230
|
+
</button>
|
|
231
|
+
<!-- end button -->
|
|
232
|
+
<!-- end CmdFormElement ---------------------------------------------------------------------------------------- -->
|
|
233
|
+
</template>
|
|
234
|
+
|
|
235
|
+
<script>
|
|
236
|
+
// import mixins
|
|
237
|
+
import I18n from "../mixins/I18n"
|
|
238
|
+
import DefaultMessageProperties from "../mixins/CmdFormElement/DefaultMessageProperties"
|
|
239
|
+
import FieldValidation from "../mixins/FieldValidation.js"
|
|
240
|
+
import Identifier from "../mixins/Identifier.js"
|
|
241
|
+
import Tooltip from "../mixins/Tooltip.js"
|
|
242
|
+
|
|
243
|
+
const TYPES_WITHOUT_MAXLENGTH = ["color", "date", "datetime-local", "file", "number", "range"]
|
|
244
|
+
|
|
245
|
+
export default {
|
|
246
|
+
inheritAttrs: false,
|
|
247
|
+
name: "CmdFormElement",
|
|
248
|
+
mixins: [
|
|
249
|
+
I18n,
|
|
250
|
+
DefaultMessageProperties,
|
|
251
|
+
FieldValidation,
|
|
252
|
+
Identifier,
|
|
253
|
+
Tooltip
|
|
254
|
+
],
|
|
255
|
+
emits: ["blur", "change", "validation-status-change", "update:modelValue"],
|
|
256
|
+
data() {
|
|
257
|
+
return {
|
|
258
|
+
errorOccurred: 0
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
props: {
|
|
262
|
+
/**
|
|
263
|
+
* set value for v-model (must be named modelValue in vue3 if default v-model should be used)
|
|
264
|
+
*/
|
|
265
|
+
modelValue: {
|
|
266
|
+
type: [String, Boolean, Array, Number],
|
|
267
|
+
default: ""
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* group entries of selectbox by first letter of its options
|
|
271
|
+
*/
|
|
272
|
+
groupSelectOptionsByInitialLetters: {
|
|
273
|
+
type: Boolean,
|
|
274
|
+
default: false
|
|
275
|
+
},
|
|
276
|
+
/**
|
|
277
|
+
* specify a scroll-container which scrolling hides the tooltip
|
|
278
|
+
*/
|
|
279
|
+
scrollContainerForTooltip: {
|
|
280
|
+
type: String,
|
|
281
|
+
required: false
|
|
282
|
+
},
|
|
283
|
+
/**
|
|
284
|
+
* set type of native form-element
|
|
285
|
+
*
|
|
286
|
+
* @allowedValues: input, select, textarea, button
|
|
287
|
+
*/
|
|
288
|
+
element: {
|
|
289
|
+
type: String,
|
|
290
|
+
validator(value) {
|
|
291
|
+
return value === "input" ||
|
|
292
|
+
value === "select" ||
|
|
293
|
+
value === "textarea" ||
|
|
294
|
+
value === "button"
|
|
295
|
+
},
|
|
296
|
+
default() {
|
|
297
|
+
return "input"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
/**
|
|
301
|
+
* hide label (and asterisk if mandatory)
|
|
302
|
+
*
|
|
303
|
+
* label may not be removed, because it is required for accessibility
|
|
304
|
+
*/
|
|
305
|
+
showLabel: {
|
|
306
|
+
type: Boolean,
|
|
307
|
+
default: true
|
|
308
|
+
},
|
|
309
|
+
/**
|
|
310
|
+
* text for label
|
|
311
|
+
*
|
|
312
|
+
* @requiredForAccessibility: true
|
|
313
|
+
* @canContainHtml: true
|
|
314
|
+
*/
|
|
315
|
+
labelText: {
|
|
316
|
+
type: String,
|
|
317
|
+
required: false
|
|
318
|
+
},
|
|
319
|
+
/**
|
|
320
|
+
* set to activate to use toggle-switch-styling
|
|
321
|
+
*
|
|
322
|
+
* element-prop must be set to "input" and type-attribute must be set to "checkbox" or "radio"
|
|
323
|
+
*
|
|
324
|
+
* @affectsStyling: true
|
|
325
|
+
*/
|
|
326
|
+
toggleSwitch: {
|
|
327
|
+
type: Boolean,
|
|
328
|
+
default: false
|
|
329
|
+
},
|
|
330
|
+
/**
|
|
331
|
+
* text for on-label
|
|
332
|
+
*
|
|
333
|
+
* set to activate switch-label (=label is placed on toggle-switch (not behind))
|
|
334
|
+
* toggleSwitch-prop must be set to "true"
|
|
335
|
+
* element-prop must be set to "input" and type-attribute must be set to "checkbox" or "radio"
|
|
336
|
+
*/
|
|
337
|
+
onLabel: {
|
|
338
|
+
type: String,
|
|
339
|
+
required: false
|
|
340
|
+
},
|
|
341
|
+
/**
|
|
342
|
+
* text for off-label
|
|
343
|
+
*
|
|
344
|
+
* set to activate switch-label (=label is placed on toggle-switch (not behind))
|
|
345
|
+
* toggleSwitch-prop must be set to "true"
|
|
346
|
+
* element-prop must be set to "input" and type-attribute must be set to "checkbox" or "radio"
|
|
347
|
+
*/
|
|
348
|
+
offLabel: {
|
|
349
|
+
type: String,
|
|
350
|
+
required: false
|
|
351
|
+
},
|
|
352
|
+
/**
|
|
353
|
+
* on/off-, yes/no-color-styling
|
|
354
|
+
*
|
|
355
|
+
* set to true, if checkbox/radio-buttons should have green/checked and red/unchecked color-coding
|
|
356
|
+
* toggleSwitch-prop must be set to "true"
|
|
357
|
+
* element-prop must be set to "input" and type-attribute must be set to "checkbox" or "radio"
|
|
358
|
+
*
|
|
359
|
+
* @affectsStyling: true
|
|
360
|
+
*/
|
|
361
|
+
colored: {
|
|
362
|
+
type: Boolean,
|
|
363
|
+
required: false
|
|
364
|
+
},
|
|
365
|
+
/**
|
|
366
|
+
* allow checkbox/radio-buttons to get value from outside
|
|
367
|
+
*/
|
|
368
|
+
inputValue: {
|
|
369
|
+
type: [String, Number],
|
|
370
|
+
required: false
|
|
371
|
+
},
|
|
372
|
+
/**
|
|
373
|
+
* for replacing native checkboxes/radio-buttons by custom ones (based on frontend-framework)
|
|
374
|
+
*
|
|
375
|
+
* @affectsStyling: true
|
|
376
|
+
*/
|
|
377
|
+
replaceInputType: {
|
|
378
|
+
type: Boolean,
|
|
379
|
+
default: false
|
|
380
|
+
},
|
|
381
|
+
/**
|
|
382
|
+
* set an optional class on native form-element (use native class="" on component ot set class on outer-component-element)
|
|
383
|
+
*
|
|
384
|
+
* may not be named as 'class' because it is a reserved keyword in JavaScript
|
|
385
|
+
*/
|
|
386
|
+
inputClass: {
|
|
387
|
+
type: String,
|
|
388
|
+
required: false
|
|
389
|
+
},
|
|
390
|
+
/**
|
|
391
|
+
* set if a native datalist should be used
|
|
392
|
+
*/
|
|
393
|
+
datalist: {
|
|
394
|
+
type: Object,
|
|
395
|
+
required: false
|
|
396
|
+
},
|
|
397
|
+
/**
|
|
398
|
+
* list of options for selectbox
|
|
399
|
+
*
|
|
400
|
+
* element-property must be 'select'
|
|
401
|
+
*/
|
|
402
|
+
selectOptions: {
|
|
403
|
+
type: Array,
|
|
404
|
+
required: false
|
|
405
|
+
},
|
|
406
|
+
/**
|
|
407
|
+
* activate if interactive status-icon (to show requirements) should be shown inline with label
|
|
408
|
+
*/
|
|
409
|
+
showStatusIcon: {
|
|
410
|
+
type: Boolean,
|
|
411
|
+
default: true
|
|
412
|
+
},
|
|
413
|
+
/**
|
|
414
|
+
* native button
|
|
415
|
+
*/
|
|
416
|
+
nativeButton: {
|
|
417
|
+
type: Object,
|
|
418
|
+
default() {
|
|
419
|
+
return {
|
|
420
|
+
text: "",
|
|
421
|
+
icon: {
|
|
422
|
+
show: true,
|
|
423
|
+
iconClass: "",
|
|
424
|
+
position: "left",
|
|
425
|
+
tooltip: ""
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
/**
|
|
431
|
+
* set class for inner icon (icon placed 'inside' input/ left of input-text)
|
|
432
|
+
*
|
|
433
|
+
* element-property must be 'input' and type-property may not be checkbox or radio
|
|
434
|
+
*/
|
|
435
|
+
fieldIconClass: {
|
|
436
|
+
type: String,
|
|
437
|
+
required: false
|
|
438
|
+
},
|
|
439
|
+
/**
|
|
440
|
+
* activate if label-text should be place inline/left of form-element (and not above)
|
|
441
|
+
*
|
|
442
|
+
* type-property may not be checkbox or radio
|
|
443
|
+
*/
|
|
444
|
+
displayLabelInline: {
|
|
445
|
+
type: Boolean,
|
|
446
|
+
required: false
|
|
447
|
+
},
|
|
448
|
+
/**
|
|
449
|
+
* activate if field should be stretch over remaining (horizontal) space if inline
|
|
450
|
+
*
|
|
451
|
+
* displayLabelInline-property must be activated
|
|
452
|
+
*/
|
|
453
|
+
stretchField: {
|
|
454
|
+
type: Boolean,
|
|
455
|
+
default: false
|
|
456
|
+
},
|
|
457
|
+
/**
|
|
458
|
+
* set status for label and form-element
|
|
459
|
+
*
|
|
460
|
+
* @allowedValues: "", error, warning, success, info
|
|
461
|
+
*
|
|
462
|
+
* @affectsStyling: true
|
|
463
|
+
*/
|
|
464
|
+
status: {
|
|
465
|
+
type: String,
|
|
466
|
+
required: false,
|
|
467
|
+
validator(value) {
|
|
468
|
+
return value === "" ||
|
|
469
|
+
value === "error" ||
|
|
470
|
+
value === "warning" ||
|
|
471
|
+
value === "success" ||
|
|
472
|
+
value === "info"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
/**
|
|
476
|
+
* toggle display of number of used and allowed characters for textarea
|
|
477
|
+
*
|
|
478
|
+
* type-property must be set to textarea
|
|
479
|
+
*/
|
|
480
|
+
showCharactersTextarea: {
|
|
481
|
+
type: Boolean,
|
|
482
|
+
default: true
|
|
483
|
+
},
|
|
484
|
+
/**
|
|
485
|
+
* text shown in front of character-count below textarea
|
|
486
|
+
*
|
|
487
|
+
* type-property must be set to textarea
|
|
488
|
+
* showCharactersTextarea-property must be activated
|
|
489
|
+
*/
|
|
490
|
+
textCharactersLeft: {
|
|
491
|
+
type: String,
|
|
492
|
+
default: "Characters left:"
|
|
493
|
+
},
|
|
494
|
+
/**
|
|
495
|
+
* toggle visibility of search-button (next to search-field)
|
|
496
|
+
*/
|
|
497
|
+
showSearchButton: {
|
|
498
|
+
type: Boolean,
|
|
499
|
+
default: true
|
|
500
|
+
},
|
|
501
|
+
/**
|
|
502
|
+
* icon to delete search term
|
|
503
|
+
*
|
|
504
|
+
* element-property must be set to 'input'
|
|
505
|
+
* type-property must be set to 'search'
|
|
506
|
+
*
|
|
507
|
+
*/
|
|
508
|
+
iconDelete: {
|
|
509
|
+
type: Object,
|
|
510
|
+
default() {
|
|
511
|
+
return {
|
|
512
|
+
show: true,
|
|
513
|
+
iconClass: "icon-cancel-circle",
|
|
514
|
+
tooltip: "Delete term"
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
/**
|
|
519
|
+
* icon to search term
|
|
520
|
+
*
|
|
521
|
+
* element-property must be set to 'input'
|
|
522
|
+
* type-property must be set to 'search'
|
|
523
|
+
*
|
|
524
|
+
*/
|
|
525
|
+
iconSearch: {
|
|
526
|
+
type: Object,
|
|
527
|
+
default() {
|
|
528
|
+
return {
|
|
529
|
+
show: true,
|
|
530
|
+
iconClass: "icon-search",
|
|
531
|
+
tooltip: "Search"
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
/**
|
|
536
|
+
* icon for error-validated items in list-of-requirements
|
|
537
|
+
*
|
|
538
|
+
* element-property must be set to 'input'
|
|
539
|
+
* showRequirements-subproperty (of CmdListOfRequirements) must be set to 'true'
|
|
540
|
+
*
|
|
541
|
+
*/
|
|
542
|
+
iconHasStateError: {
|
|
543
|
+
type: Object,
|
|
544
|
+
default() {
|
|
545
|
+
return {
|
|
546
|
+
show: true,
|
|
547
|
+
iconClass: "icon-error-circle",
|
|
548
|
+
tooltip: "Error"
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
/**
|
|
553
|
+
* icon for warning-validated items in list-of-requirements
|
|
554
|
+
*
|
|
555
|
+
* element-property must be set to 'input'
|
|
556
|
+
* showRequirements-subproperty (of CmdListOfRequirements) must be set to 'true'
|
|
557
|
+
*
|
|
558
|
+
*/
|
|
559
|
+
iconHasStateWarning: {
|
|
560
|
+
type: Object,
|
|
561
|
+
default() {
|
|
562
|
+
return {
|
|
563
|
+
show: true,
|
|
564
|
+
iconClass: "icon-warning-circle",
|
|
565
|
+
tooltip: "Warning"
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
/**
|
|
570
|
+
* icon for success-validated items in list-of-requirements
|
|
571
|
+
*
|
|
572
|
+
* element-property must be set to 'input'
|
|
573
|
+
* showRequirements-subproperty (of CmdListOfRequirements) must be set to 'true'
|
|
574
|
+
*
|
|
575
|
+
*/
|
|
576
|
+
iconHasStateSuccess: {
|
|
577
|
+
type: Object,
|
|
578
|
+
default() {
|
|
579
|
+
return {
|
|
580
|
+
show: true,
|
|
581
|
+
iconClass: "icon-check-circle",
|
|
582
|
+
tooltip: "Success"
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
/**
|
|
587
|
+
* icon for info-validated items in list-of-requirements
|
|
588
|
+
*
|
|
589
|
+
* element-property must be set to 'input'
|
|
590
|
+
* showRequirements-sub-property (of CmdListOfRequirements) must be set to 'true'
|
|
591
|
+
*
|
|
592
|
+
*/
|
|
593
|
+
iconHasStateInfo: {
|
|
594
|
+
type: Object,
|
|
595
|
+
default() {
|
|
596
|
+
return {
|
|
597
|
+
show: true,
|
|
598
|
+
iconClass: "icon-info-circle",
|
|
599
|
+
tooltip: "Info"
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
/**
|
|
604
|
+
* toggle if toggle-switch shows icons for checked/unchecked-status
|
|
605
|
+
*/
|
|
606
|
+
useIconsForToggleSwitch: {
|
|
607
|
+
type: Boolean,
|
|
608
|
+
default: false
|
|
609
|
+
},
|
|
610
|
+
/**
|
|
611
|
+
* icon for toggle-switch checked
|
|
612
|
+
*
|
|
613
|
+
* toggle-switch-property must be activated
|
|
614
|
+
* use-icons-for-toggle-switch-property must be activated
|
|
615
|
+
*/
|
|
616
|
+
toggleSwitchCheckedIconClass: {
|
|
617
|
+
type: String,
|
|
618
|
+
default: "icon-check-circle"
|
|
619
|
+
},
|
|
620
|
+
/**
|
|
621
|
+
* icon for toggle-switch unchecked
|
|
622
|
+
*
|
|
623
|
+
* toggle-switch-property must be activated
|
|
624
|
+
* use-icons-for-toggle-switch-property must be activated
|
|
625
|
+
*/
|
|
626
|
+
toggleSwitchUncheckedIconClass: {
|
|
627
|
+
type: String,
|
|
628
|
+
default: "icon-cancel-circle"
|
|
629
|
+
},
|
|
630
|
+
/**
|
|
631
|
+
* icon to toggle password-visibility
|
|
632
|
+
*
|
|
633
|
+
* element-property must be set to 'input'
|
|
634
|
+
* type-property must be set to 'password'
|
|
635
|
+
*
|
|
636
|
+
*/
|
|
637
|
+
iconPasswordVisible: {
|
|
638
|
+
type: Object,
|
|
639
|
+
default() {
|
|
640
|
+
return {
|
|
641
|
+
show: true,
|
|
642
|
+
iconClass: "icon-visible",
|
|
643
|
+
tooltip: "Show password"
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
/**
|
|
648
|
+
* icon to toggle password-visibility
|
|
649
|
+
*
|
|
650
|
+
* element-property must be set to 'input'
|
|
651
|
+
* type-property must be set to 'password'
|
|
652
|
+
*
|
|
653
|
+
*/
|
|
654
|
+
iconPasswordInvisible: {
|
|
655
|
+
type: Object,
|
|
656
|
+
default() {
|
|
657
|
+
return {
|
|
658
|
+
show: true,
|
|
659
|
+
iconClass: "icon-not-visible"
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
/**
|
|
664
|
+
* properties for CmdListOfRequirements-component
|
|
665
|
+
*/
|
|
666
|
+
cmdListOfRequirements: {
|
|
667
|
+
type: Object,
|
|
668
|
+
required: false
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
computed: {
|
|
672
|
+
cmdListOfRequirementsProperties() {
|
|
673
|
+
return {
|
|
674
|
+
showRequirements: true,
|
|
675
|
+
validationTooltip: "",
|
|
676
|
+
inputRequirements: [],
|
|
677
|
+
inputAttributes: {},
|
|
678
|
+
showHeadline: true,
|
|
679
|
+
inputModelValue: "",
|
|
680
|
+
helplink: {},
|
|
681
|
+
labelText: "",
|
|
682
|
+
...this.cmdListOfRequirements
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
initialLetters() {
|
|
686
|
+
return this.getInitialLetters(this.selectOptions)
|
|
687
|
+
},
|
|
688
|
+
elementAttributes() {
|
|
689
|
+
const commonAttributes = ["name", "required", "readonly", "disabled", "autofocus"]
|
|
690
|
+
const attributes = {
|
|
691
|
+
input: [...commonAttributes, "type", "minlength", "pattern", "min", "max", "multiple", "step", "autocomplete", "placeholder"],
|
|
692
|
+
select: [...commonAttributes, "multiple"],
|
|
693
|
+
textarea: [...commonAttributes, "placeholder"]
|
|
694
|
+
}
|
|
695
|
+
const attrs = {}
|
|
696
|
+
if (attributes[this.element]) {
|
|
697
|
+
Object.entries(this.$attrs).filter(([name]) => attributes[this.element].includes(name)).forEach(([name, value]) => attrs[name] = value)
|
|
698
|
+
}
|
|
699
|
+
if (this.element === "input" && !attrs.type) {
|
|
700
|
+
attrs.type = "text" // explicit default
|
|
701
|
+
}
|
|
702
|
+
return attrs
|
|
703
|
+
},
|
|
704
|
+
buttonAttrs() {
|
|
705
|
+
// copy all native attributes
|
|
706
|
+
const allAttrs = { ...this.$attrs }
|
|
707
|
+
|
|
708
|
+
// check if specific tooltip for icon is set (and add as title-attribute)
|
|
709
|
+
if (this.nativeButton.icon?.tooltip) {
|
|
710
|
+
allAttrs.title = this.nativeButton.icon?.tooltip
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
return allAttrs
|
|
714
|
+
},
|
|
715
|
+
tooltipHeadline() {
|
|
716
|
+
return {
|
|
717
|
+
text: this.labelText,
|
|
718
|
+
level: "5"
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
isChecked() {
|
|
722
|
+
if (typeof this.modelValue === "boolean") {
|
|
723
|
+
return this.modelValue
|
|
724
|
+
}
|
|
725
|
+
if (typeof this.modelValue === "string") {
|
|
726
|
+
return this.modelValue === this.inputValue
|
|
727
|
+
}
|
|
728
|
+
if (typeof this.modelValue === "number") {
|
|
729
|
+
return this.modelValue === this.inputValue
|
|
730
|
+
}
|
|
731
|
+
if (this.modelValue !== undefined) {
|
|
732
|
+
return this.modelValue.includes(this.inputValue)
|
|
733
|
+
}
|
|
734
|
+
return false
|
|
735
|
+
},
|
|
736
|
+
charactersLeft() {
|
|
737
|
+
return this.getMaxLength() - this.modelValue.length
|
|
738
|
+
},
|
|
739
|
+
validationTooltip() {
|
|
740
|
+
if (!this.useCustomTooltip) {
|
|
741
|
+
return this.getValidationMessage
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// set default-tooltip if customTooltip is not set
|
|
745
|
+
if (this.validationStatus === 'error') {
|
|
746
|
+
return this.getMessage("form_element.validation_tooltip.an_error_occurred")
|
|
747
|
+
} else if (this.validationStatus === 'success') {
|
|
748
|
+
return this.getMessage("form_element.validation_tooltip.information_is_filled_correctly")
|
|
749
|
+
} else if (this.capsLockActivated) {
|
|
750
|
+
return this.getMessage("form_element.validation_tooltip.caps_lock_is_activated")
|
|
751
|
+
}
|
|
752
|
+
return this.getMessage("form_element.validation_tooltip.open_field_requirements")
|
|
753
|
+
},
|
|
754
|
+
autocomplete() {
|
|
755
|
+
if (this.$attrs.type !== 'file') {
|
|
756
|
+
return this.datalist ? 'off' : 'on'
|
|
757
|
+
}
|
|
758
|
+
return null
|
|
759
|
+
},
|
|
760
|
+
// toggle icons for toggle-switch
|
|
761
|
+
toggleSwitchIconClass() {
|
|
762
|
+
if (this.toggleSwitch && this.useIconsForToggleSwitch && this.toggleSwitchUncheckedIconClass && this.toggleSwitchCheckedIconClass) {
|
|
763
|
+
if (this.isChecked) {
|
|
764
|
+
return this.toggleSwitchCheckedIconClass
|
|
765
|
+
}
|
|
766
|
+
return this.toggleSwitchUncheckedIconClass
|
|
767
|
+
}
|
|
768
|
+
return null
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
methods: {
|
|
772
|
+
toggleStatusTooltip() {
|
|
773
|
+
// shows/hides the status-tooltip (popover) by the status-icon (span[role=button])
|
|
774
|
+
this.$refs.tooltip?.$refs.tooltip?.togglePopover()
|
|
775
|
+
},
|
|
776
|
+
deleteInput() {
|
|
777
|
+
this.setFocus()
|
|
778
|
+
this.$emit("update:modelValue", '')
|
|
779
|
+
},
|
|
780
|
+
getInitialLetters(listOfOptions) {
|
|
781
|
+
const groupedListOfOptions = {}
|
|
782
|
+
// compare the text-keys (in lower case) and sort them
|
|
783
|
+
listOfOptions.sort((a, b) => a.text.toLowerCase().localeCompare(b.text.toLowerCase()))
|
|
784
|
+
|
|
785
|
+
for (let i = 0; i < listOfOptions.length; i++) {
|
|
786
|
+
const initialLetter = listOfOptions[i].text.slice(0, 1)
|
|
787
|
+
if (!groupedListOfOptions[initialLetter]) {
|
|
788
|
+
groupedListOfOptions[initialLetter] = []
|
|
789
|
+
}
|
|
790
|
+
groupedListOfOptions[initialLetter].push(listOfOptions[i])
|
|
791
|
+
}
|
|
792
|
+
return groupedListOfOptions
|
|
793
|
+
},
|
|
794
|
+
setFocus() {
|
|
795
|
+
this.$refs.label.querySelector("input, select, textarea")?.focus()
|
|
796
|
+
},
|
|
797
|
+
additionalStandardRequirements() {
|
|
798
|
+
const requirements = []
|
|
799
|
+
// check if field is type "email"
|
|
800
|
+
if (this.$attrs.type === "email") {
|
|
801
|
+
requirements.push({
|
|
802
|
+
message: this.getMessage("form_element.validation_tooltip.is_valid_email"),
|
|
803
|
+
valid: () => this.$refs.input?.checkValidity()
|
|
804
|
+
})
|
|
805
|
+
}
|
|
806
|
+
return requirements
|
|
807
|
+
},
|
|
808
|
+
getDomElement() {
|
|
809
|
+
return this.$refs.label
|
|
810
|
+
},
|
|
811
|
+
// define max-length for different input-types
|
|
812
|
+
getMaxLength() {
|
|
813
|
+
if (this.$attrs.element === 'textarea') {
|
|
814
|
+
return this.$attrs.maxlength > 0 ? this.$attrs.maxlength : 5000
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (!TYPES_WITHOUT_MAXLENGTH.includes(this.$attrs.type)) {
|
|
818
|
+
return this.$attrs.maxlength > 0 ? this.$attrs.maxlength : 255
|
|
819
|
+
}
|
|
820
|
+
return null
|
|
821
|
+
},
|
|
822
|
+
validateInput(event) {
|
|
823
|
+
// check if surrounding form with data-use-validation exists
|
|
824
|
+
const useValidation = event.target.closest("form")?.dataset.useValidation === "true"
|
|
825
|
+
|
|
826
|
+
if (useValidation) {
|
|
827
|
+
// get value from input-element
|
|
828
|
+
const value = event.target.value
|
|
829
|
+
|
|
830
|
+
// if input is filled, set status to success (expect for checkboxes and radiobuttons)
|
|
831
|
+
//if (!["checkbox", "radio"].includes(this.$attrs.type) && value) {
|
|
832
|
+
this.validationStatus = "success"
|
|
833
|
+
//}
|
|
834
|
+
|
|
835
|
+
if (typeof event.target.checkValidity === "function" && !event.target.checkValidity()) {
|
|
836
|
+
this.validationStatus = "error"
|
|
837
|
+
} else {
|
|
838
|
+
if (this.customRequirements) {
|
|
839
|
+
// check if customRequirement returns invalid result
|
|
840
|
+
const invalidCustomRequirement = this.customRequirements.some(requirement => {
|
|
841
|
+
return !requirement.valid(value)
|
|
842
|
+
})
|
|
843
|
+
|
|
844
|
+
// set validation-status if invalidCustomRequirement returns at least one invalid entry
|
|
845
|
+
if (invalidCustomRequirement) {
|
|
846
|
+
this.validationStatus = "error"
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
this.$emit("validation-status-change", this.validationStatus)
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
onBlur(event) {
|
|
855
|
+
this.validateInput(event)
|
|
856
|
+
this.closeTooltipOnBlur()
|
|
857
|
+
this.$emit("blur", event)
|
|
858
|
+
},
|
|
859
|
+
onInput(event) {
|
|
860
|
+
this.validateInput(event)
|
|
861
|
+
this.$emit("update:modelValue", event.target.value)
|
|
862
|
+
},
|
|
863
|
+
onChange(event) {
|
|
864
|
+
this.validateInput(event)
|
|
865
|
+
|
|
866
|
+
if (typeof this.modelValue === "boolean") {
|
|
867
|
+
this.$emit("update:modelValue", event.target.checked)
|
|
868
|
+
} else if (typeof this.modelValue === "string") {
|
|
869
|
+
this.$emit("update:modelValue", event.target.value)
|
|
870
|
+
} else if (this.modelValue !== undefined) {
|
|
871
|
+
let values = [...this.modelValue]
|
|
872
|
+
if (event.target.checked) {
|
|
873
|
+
values.push(event.target.value)
|
|
874
|
+
} else {
|
|
875
|
+
values = values.filter(value => value !== event.target.value)
|
|
876
|
+
}
|
|
877
|
+
this.$emit("update:modelValue", values)
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
datalistFocus() {
|
|
881
|
+
/* corrects focus-bug for datalist in firefox */
|
|
882
|
+
if (this.datalist) {
|
|
883
|
+
this.$refs.label.focus()
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
showPassword() {
|
|
887
|
+
// get password-field
|
|
888
|
+
const passwordField = this.$refs.input
|
|
889
|
+
|
|
890
|
+
// get value of password field (to save it temporary)
|
|
891
|
+
const password = passwordField.value
|
|
892
|
+
|
|
893
|
+
// toggle input-type to make password visible
|
|
894
|
+
passwordField.nextElementSibling.classList.replace(this.iconPasswordVisible.iconClass, this.iconPasswordInvisible.iconClass)
|
|
895
|
+
passwordField.setAttribute("type", "text")
|
|
896
|
+
|
|
897
|
+
// assign saved password back to field
|
|
898
|
+
passwordField.setAttribute("value", password)
|
|
899
|
+
},
|
|
900
|
+
hidePassword() {
|
|
901
|
+
this.$refs.input.nextElementSibling.classList.replace(this.iconPasswordInvisible.iconClass, this.iconPasswordVisible.iconClass)
|
|
902
|
+
this.$refs.input.setAttribute("type", "password")
|
|
903
|
+
},
|
|
904
|
+
executeSearch() {
|
|
905
|
+
this.$emit("search", this.value)
|
|
906
|
+
},
|
|
907
|
+
closeTooltipOnBlur() {
|
|
908
|
+
// close tooltip by calling function from CmdTooltipForInputElements using $refs
|
|
909
|
+
if (this.$refs.tooltip) {
|
|
910
|
+
this.$refs.tooltip.hideTooltip()
|
|
911
|
+
}
|
|
912
|
+
},
|
|
913
|
+
// (submit-)button is clicked
|
|
914
|
+
submit(event) {
|
|
915
|
+
this.$emit("submit", event)
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
watch: {
|
|
919
|
+
status: {
|
|
920
|
+
handler() {
|
|
921
|
+
this.validationStatus = this.status || ""
|
|
922
|
+
},
|
|
923
|
+
immediate: true
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
</script>
|
|
928
|
+
|
|
929
|
+
<style>
|
|
930
|
+
/* begin cmd-form-element ------------------------------------------------------------------------------------------ */
|
|
931
|
+
.cmd-form-element {
|
|
932
|
+
& input.replace-input-type {
|
|
933
|
+
&:checked {
|
|
934
|
+
&::after {
|
|
935
|
+
top: 0;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/* icon right aligned in input */
|
|
941
|
+
input+.place-inside {
|
|
942
|
+
left: auto;
|
|
943
|
+
right: .5rem;
|
|
944
|
+
color: var(--hyperlink-color);
|
|
945
|
+
|
|
946
|
+
span {
|
|
947
|
+
color: inherit;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.label-text .status-icon-button {
|
|
952
|
+
cursor: pointer;
|
|
953
|
+
|
|
954
|
+
&:focus-visible {
|
|
955
|
+
outline: .2rem solid currentColor;
|
|
956
|
+
outline-offset: .2rem;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
.label-text {
|
|
961
|
+
:is(a, span)[class*="icon-"] {
|
|
962
|
+
top: .09rem;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
.toggle-switch {
|
|
967
|
+
.label-text {
|
|
968
|
+
justify-content: center;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
&:has([required]) {
|
|
973
|
+
&.has-state,
|
|
974
|
+
&+.cmd-tooltip {
|
|
975
|
+
&.error {
|
|
976
|
+
* {
|
|
977
|
+
--status-color: var(--error-color-text);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
::placeholder {
|
|
982
|
+
color: var(--status-color);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
span {
|
|
986
|
+
color: var(--status-color);
|
|
987
|
+
|
|
988
|
+
&.place-inside {
|
|
989
|
+
color: inherit;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
&.success {
|
|
994
|
+
* {
|
|
995
|
+
--status-color: var(--success-color-text);
|
|
996
|
+
--form-input-text-color: var(--success-color-text);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
&:has(input[type="checkbox"], input[type="radio"]) {
|
|
1000
|
+
* {
|
|
1001
|
+
--status-color: var(--color-scheme-text-color);
|
|
1002
|
+
/* overwrite --status-color (success) for chekcboxes and radiobuttons */
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
:is(input[type="checkbox"], input[type="radio"]):checked {
|
|
1010
|
+
~.label-text span {
|
|
1011
|
+
color: var(--hyperlink-color);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
&:hover,
|
|
1015
|
+
&:active,
|
|
1016
|
+
&:focus {
|
|
1017
|
+
~.label-text span {
|
|
1018
|
+
color: var(--hyperlink-color-highlighted);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
&.inline {
|
|
1024
|
+
.inner-input-wrapper {
|
|
1025
|
+
&>a:not(.button) {
|
|
1026
|
+
margin-left: calc(var(--default-margin) / 2);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
&.stretch-field {
|
|
1031
|
+
.inner-input-wrapper {
|
|
1032
|
+
width: 100%;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
.label-text {
|
|
1037
|
+
[class*="icon-"] {
|
|
1038
|
+
top: -.2rem;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
.inner-input-wrapper {
|
|
1044
|
+
margin: 0;
|
|
1045
|
+
|
|
1046
|
+
&:has(.button, button) {
|
|
1047
|
+
input {
|
|
1048
|
+
border-top-right-radius: 0;
|
|
1049
|
+
border-bottom-right-radius: 0;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
a.deleteicon {
|
|
1054
|
+
position: absolute;
|
|
1055
|
+
top: 50%;
|
|
1056
|
+
right: 1rem;
|
|
1057
|
+
transform: translateY(-50%);
|
|
1058
|
+
z-index: 100;
|
|
1059
|
+
width: auto;
|
|
1060
|
+
/* avoid to be stretched to keep correct position */
|
|
1061
|
+
|
|
1062
|
+
/* set styles to avoid overwriting by has-state-colors */
|
|
1063
|
+
&.button {
|
|
1064
|
+
span {
|
|
1065
|
+
color: var(--color-scheme-background);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
&:hover,
|
|
1069
|
+
&:active,
|
|
1070
|
+
&:focus {
|
|
1071
|
+
span {
|
|
1072
|
+
color: var(--color-scheme-text-color);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
a.button {
|
|
1079
|
+
right: 0;
|
|
1080
|
+
align-self: stretch;
|
|
1081
|
+
aspect-ratio: 1 / 1;
|
|
1082
|
+
|
|
1083
|
+
/* square */
|
|
1084
|
+
&+a {
|
|
1085
|
+
right: 5rem;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.characters-left-wrapper {
|
|
1091
|
+
margin-top: calc(var(--default-margin) / 2);
|
|
1092
|
+
display: block;
|
|
1093
|
+
|
|
1094
|
+
span:not(:only-child):first-child {
|
|
1095
|
+
margin-right: calc(var(--default-margin) / 2);
|
|
1096
|
+
color: var(--color-scheme-text-color);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
.characters-left {
|
|
1100
|
+
color: var(--color-scheme-text-color);
|
|
1101
|
+
|
|
1102
|
+
&.error {
|
|
1103
|
+
color: var(--error-color-text);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/* end cmd-form-element------------------------------------------------------------------------------------------ */
|
|
1110
|
+
</style>
|