mn-angular-lib 2.0.34 → 2.0.35
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/fesm2022/mn-angular-lib-alert.mjs +515 -527
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +264 -357
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-button.mjs +819 -382
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar-core.mjs +240 -365
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar.mjs +1691 -1545
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +2367 -2796
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +693 -1241
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-display.mjs +679 -712
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +3671 -4647
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +221 -190
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-core.mjs +711 -896
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2089 -2035
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal.mjs +76 -121
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +289 -277
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-segmented.mjs +189 -241
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tab.mjs +409 -642
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
- package/fesm2022/mn-angular-lib.mjs +16 -29
- package/package.json +1 -1
- package/types/mn-angular-lib-alert.d.ts +239 -241
- package/types/mn-angular-lib-bottom-sheet.d.ts +190 -150
- package/types/mn-angular-lib-button.d.ts +319 -317
- package/types/mn-angular-lib-calendar-core.d.ts +199 -209
- package/types/mn-angular-lib-calendar.d.ts +656 -511
- package/types/mn-angular-lib-collection.d.ts +1649 -1585
- package/types/mn-angular-lib-core.d.ts +524 -535
- package/types/mn-angular-lib-display.d.ts +946 -886
- package/types/mn-angular-lib-forms.d.ts +3012 -3013
- package/types/mn-angular-lib-keyboard.d.ts +125 -85
- package/types/mn-angular-lib-modal-core.d.ts +978 -994
- package/types/mn-angular-lib-modal-ui.d.ts +541 -493
- package/types/mn-angular-lib-modal.d.ts +24 -27
- package/types/mn-angular-lib-rich-text-editor.d.ts +131 -98
- package/types/mn-angular-lib-segmented.d.ts +354 -341
- package/types/mn-angular-lib-tab.d.ts +345 -336
- package/types/mn-angular-lib.d.ts +16 -16
- package/fesm2022/mn-angular-lib.mjs.map +0 -1
|
@@ -1,903 +1,937 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import * as i1 from
|
|
4
|
-
import { CommonModule } from
|
|
5
|
-
import {
|
|
6
|
-
import * as i2 from
|
|
7
|
-
import { NG_VALUE_ACCESSOR,
|
|
8
|
-
import { MnButton } from
|
|
9
|
-
import {
|
|
10
|
-
import { MnLanguageService, lucideIcons
|
|
11
|
-
import { MnTable } from
|
|
12
|
-
import { LucideDynamicIcon } from
|
|
13
|
-
import * as lucide from
|
|
14
|
-
import { MnBottomSheet } from
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
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
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnFormBodyComponent, isStandalone: true, selector: "mn-form-body", inputs: { config: "config", modalRef: "modalRef", hideFooter: "hideFooter", hideCustomBody: "hideCustomBody" }, outputs: { formStatusChange: "formStatusChange" }, viewQueries: [{ propertyName: "inputFields", predicate: MnInputField, descendants: true }, { propertyName: "textareas", predicate: MnTextarea, descendants: true }], ngImport: i0, template: "@if ((config.component || config.template) && !hideCustomBody) {\n <mn-custom-body-host\n [config]=\"asAny(config)\"\n [modalRef]=\"asAny(modalRef)\"\n class=\"mb-6 block\"\n ></mn-custom-body-host>\n}\n\n<form (ngSubmit)=\"submit()\" [formGroup]=\"form\" class=\"flex flex-col gap-6 h-full\">\n <!-- Shared field rendering template (must be inside form for formControlName) -->\n <ng-template #fieldTemplate let-rowField>\n @switch (rowField.field.kind) {\n @case (FieldKind.TEXT) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'text',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mask: asField(rowField.field).mask,\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.NUMBER) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'number',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n decimals: asField(rowField.field).decimals,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.PASSWORD) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'password',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.SELECT) {\n <div class=\"flex flex-col\">\n <mn-lib-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"getSelectProps(rowField.field)\"\n ></mn-lib-select>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-1 pl-2 pt-1\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n </div>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.CHECKBOX) {\n <div>\n <mn-lib-checkbox\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-checkbox>\n </div>\n }\n\n @case (FieldKind.DATE) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'date',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n startDate: asField(rowField.field).minDate,\n endDate: asField(rowField.field).maxDate,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.DATETIME) {\n <div>\n <mn-lib-datetime\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mode: asField(rowField.field).mode || 'datetime-local',\n min: asField(rowField.field).min,\n max: asField(rowField.field).max,\n step: asField(rowField.field).step,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-datetime>\n </div>\n }\n\n @case (FieldKind.TEXTAREA) {\n <div>\n <mn-lib-textarea\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n rows: asField(rowField.field).rows || 4,\n resize: 'vertical',\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-textarea>\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT) {\n <div>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-2 py-2 text-sm text-base-content/50\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n {{ labels.loadingOptions }}\n </div>\n }\n @if (!isFieldLoading(asKey(rowField.field.key))) {\n <mn-lib-multi-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n options: getFieldOptions(rowField.field),\n placeholder: asField(rowField.field).placeholder,\n searchable: asField(rowField.field).searchable,\n searchPlaceholder: asField(rowField.field).searchPlaceholder,\n maxSelections: asField(rowField.field).maxSelections,\n collapseThreshold: asField(rowField.field).collapseThreshold,\n collapsePlaceholder: asField(rowField.field).collapsePlaceholder,\n allSelectedPlaceholder: asField(rowField.field).allSelectedPlaceholder,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-multi-select>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.SINGLE_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.COLOR) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"color\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"w-10 h-10 rounded-lg border border-base-300 cursor-pointer p-0.5\"\n [value]=\"getColorValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onColorChange(rowField.field, $event)\"\n />\n <span class=\"text-sm text-base-content/60 font-mono\">{{ getColorValue(rowField.field) }}</span>\n </div>\n @if (asField(rowField.field).swatches) {\n <div class=\"flex gap-1.5 mt-1\">\n @for (swatch of asField(rowField.field).swatches; track swatch) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"w-6 h-6 rounded-md border border-base-300 cursor-pointer transition-transform hover:scale-110\"\n [style.background-color]=\"swatch\"\n [class.ring-2]=\"getColorValue(rowField.field) === swatch\"\n [class.ring-blue-500]=\"getColorValue(rowField.field) === swatch\"\n (click)=\"setColorFromSwatch(rowField.field, swatch)\"\n [attr.aria-label]=\"'Select color ' + swatch\"\n ></button>\n }\n </div>\n }\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.RATING) {\n <div class=\"flex flex-col gap-1\">\n <span [id]=\"'rating-label-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n <div [attr.aria-labelledby]=\"'rating-label-' + asKey(rowField.field.key)\" class=\"flex items-center gap-1\"\n role=\"group\">\n @for (star of getRatingRange(rowField.field); track star) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"text-2xl cursor-pointer transition-colors focus:outline-none\"\n [class.text-yellow-400]=\"star <= getRatingValue(rowField.field)\"\n [class.text-base-300]=\"star > getRatingValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (click)=\"setRating(rowField.field, star)\"\n >\n ★\n </button>\n }\n <span class=\"text-sm text-base-content/50 ml-2\">{{ getRatingValue(rowField.field) }} / {{ asField(rowField.field).max || 5 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.SLIDER) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"range\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"flex-1 h-2 bg-base-200 rounded-lg appearance-none cursor-pointer accent-blue-500\"\n [attr.min]=\"asField(rowField.field).min ?? 0\"\n [attr.max]=\"asField(rowField.field).max ?? 100\"\n [attr.step]=\"asField(rowField.field).step ?? 1\"\n [value]=\"getSliderValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onSliderChange(rowField.field, $event)\"\n />\n @if (asField(rowField.field).showValue !== false) {\n <span class=\"text-sm text-base-content/60 min-w-[3rem] text-right\">\n {{ getSliderValue(rowField.field) }}{{ asField(rowField.field).unit || '' }}\n </span>\n }\n </div>\n <div class=\"flex justify-between text-xs text-base-content/40 px-1\">\n <span>{{ asField(rowField.field).min ?? 0 }}</span>\n <span>{{ asField(rowField.field).max ?? 100 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.FILE) {\n <div>\n <mn-lib-file-input\n (cleared)=\"onFileCleared(rowField.field)\"\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n accept: asField(rowField.field).accept,\n multiple: asField(rowField.field).multiple,\n maxFiles: asField(rowField.field).maxFiles,\n maxSize: asField(rowField.field).maxSize,\n displayMode: asField(rowField.field).displayMode,\n dropzoneHint: asField(rowField.field).dropzoneHint,\n dropActiveHint: asField(rowField.field).dropActiveHint,\n replaceLabel: asField(rowField.field).replaceLabel,\n removeLabel: asField(rowField.field).removeLabel,\n currentUrl: asField(rowField.field).currentUrl,\n currentUrls: asField(rowField.field).currentUrls,\n disabled: isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\n })\"\n ></mn-lib-file-input>\n </div>\n }\n\n @case (FieldKind.CUSTOM) {\n <div>\n <ng-container\n mnCustomFieldHost\n [component]=\"asField(rowField.field).component\"\n [inputs]=\"asField(rowField.field).inputs\"\n [formControlName]=\"asKey(rowField.field.key)\"\n ></ng-container>\n </div>\n }\n\n @default {\n <div></div>\n }\n }\n\n <!-- Show cross-field error below any field that has one -->\n @if (getFieldError(asKey(rowField.field.key)) && rowField.field.kind !== FieldKind.SELECT && rowField.field.kind !== FieldKind.MULTI_SELECT) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </ng-template>\n\n <!-- Shared template for MULTI_SELECT_TABLE and SINGLE_SELECT_TABLE -->\n <ng-template #selectTableTemplate let-rowField>\n <div class=\"flex flex-col gap-1\">\n @if (asField(rowField.field).label) {\n <span class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n }\n <mn-table\n [dataSource]=\"tableDataSources[asKey(rowField.field.key)]\"\n [attr.aria-label]=\"asField(rowField.field).label || null\"\n (selectionChange)=\"onTableSelectionChange(rowField.field, $event)\"\n ></mn-table>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Field Groups (sections with headers) -->\n @if (fieldGroups.length > 0) {\n <div class=\"flex flex-col gap-6\">\n @for (group of fieldGroups; track group.title) {\n <div class=\"flex flex-col gap-4\" [style.display]=\"isGroupVisible(group) ? '' : 'none'\">\n <div class=\"border-b border-base-300 pb-2\">\n <h3 class=\"text-base font-semibold text-base-content\">{{ group.title }}</h3>\n @if (group.description) {\n <p class=\"text-sm text-base-content/50 mt-0.5\">{{ group.description }}</p>\n }\n </div>\n @for (row of group.rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Standard rows (no groups) -->\n @if (rows.length > 0) {\n <div class=\"flex flex-col gap-4\">\n @for (row of rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Form-level errors (not tied to a specific field) -->\n @if (formErrors['_form']) {\n <div class=\"text-red-500 text-sm px-2 py-1 bg-red-50 rounded-md\">\n {{ formErrors['_form'] }}\n </div>\n }\n\n @if (!hideFooter) {\n <!-- -mx-6 bleeds the footer to the modal edges over the body's px-6, so its line runs the full\n width like a custom or wizard modal's footer instead of stopping at the padding. -->\n <div class=\"flex gap-3 -mx-6 px-6 pt-4 pb-6 border-t border-base-300 mt-auto sticky bottom-0 bg-base-100 z-10\">\n <button\n mnButton\n type=\"button\"\n [data]=\"{ variant: 'outline', color: 'secondary' }\"\n (mousedown)=\"modalRef.dismiss(ModalCloseReason.CANCELLED)\"\n >\n @if (cancelIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ labels.cancel }}\n </button>\n\n <div class=\"flex-1\"></div>\n\n <button\n mnButton\n type=\"submit\"\n [data]=\"{ variant: 'fill', color: 'primary', disabled: form.invalid || isSubmitting }\"\n [disabled]=\"form.invalid || isSubmitting\"\n >\n @if (submitIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ isSubmitting ? labels.submitting : labels.submit }}\n </button>\n </div>\n }\n</form>\n", styles: [".select-arrow{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .75rem center}.mn-form-row{grid-template-columns:repeat(var(--mn-form-cols, 1),minmax(0,1fr))}.mn-form-cell{grid-column:span var(--mn-form-span, 1)}@media(max-width:639.98px){.mn-form-row{grid-template-columns:1fr}.mn-form-cell{grid-column:auto}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "component", type: MnInputField, selector: "mn-lib-input-field", inputs: ["props"] }, { kind: "component", type: MnCheckbox, selector: "mn-lib-checkbox", inputs: ["props", "checked"], outputs: ["checkedChange"] }, { kind: "component", type: MnDatetime, selector: "mn-lib-datetime", inputs: ["props"] }, { kind: "component", type: MnMultiSelect, selector: "mn-lib-multi-select", inputs: ["props"] }, { kind: "component", type: MnTextarea, selector: "mn-lib-textarea", inputs: ["props"] }, { kind: "component", type: MnFileInput, selector: "mn-lib-file-input", inputs: ["props"], outputs: ["filesChange", "cleared"] }, { kind: "component", type: MnSelect, selector: "mn-lib-select", inputs: ["props"] }, { kind: "directive", type: MnCustomFieldHostDirective, selector: "[mnCustomFieldHost]", inputs: ["component", "inputs"] }, { kind: "component", type: MnTable, selector: "mn-table", outputs: ["sortChange", "rowClick"] }, { kind: "component", type: MnCustomBodyHostComponent, selector: "mn-custom-body-host", inputs: ["config", "modalRef"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
|
|
826
|
-
}
|
|
827
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
], template: "@if ((config.component || config.template) && !hideCustomBody) {\n <mn-custom-body-host\n [config]=\"asAny(config)\"\n [modalRef]=\"asAny(modalRef)\"\n class=\"mb-6 block\"\n ></mn-custom-body-host>\n}\n\n<form (ngSubmit)=\"submit()\" [formGroup]=\"form\" class=\"flex flex-col gap-6 h-full\">\n <!-- Shared field rendering template (must be inside form for formControlName) -->\n <ng-template #fieldTemplate let-rowField>\n @switch (rowField.field.kind) {\n @case (FieldKind.TEXT) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'text',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mask: asField(rowField.field).mask,\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.NUMBER) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'number',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n decimals: asField(rowField.field).decimals,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.PASSWORD) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'password',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.SELECT) {\n <div class=\"flex flex-col\">\n <mn-lib-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"getSelectProps(rowField.field)\"\n ></mn-lib-select>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-1 pl-2 pt-1\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n </div>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.CHECKBOX) {\n <div>\n <mn-lib-checkbox\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-checkbox>\n </div>\n }\n\n @case (FieldKind.DATE) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'date',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n startDate: asField(rowField.field).minDate,\n endDate: asField(rowField.field).maxDate,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.DATETIME) {\n <div>\n <mn-lib-datetime\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mode: asField(rowField.field).mode || 'datetime-local',\n min: asField(rowField.field).min,\n max: asField(rowField.field).max,\n step: asField(rowField.field).step,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-datetime>\n </div>\n }\n\n @case (FieldKind.TEXTAREA) {\n <div>\n <mn-lib-textarea\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n rows: asField(rowField.field).rows || 4,\n resize: 'vertical',\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-textarea>\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT) {\n <div>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-2 py-2 text-sm text-base-content/50\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n {{ labels.loadingOptions }}\n </div>\n }\n @if (!isFieldLoading(asKey(rowField.field.key))) {\n <mn-lib-multi-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n options: getFieldOptions(rowField.field),\n placeholder: asField(rowField.field).placeholder,\n searchable: asField(rowField.field).searchable,\n searchPlaceholder: asField(rowField.field).searchPlaceholder,\n maxSelections: asField(rowField.field).maxSelections,\n collapseThreshold: asField(rowField.field).collapseThreshold,\n collapsePlaceholder: asField(rowField.field).collapsePlaceholder,\n allSelectedPlaceholder: asField(rowField.field).allSelectedPlaceholder,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-multi-select>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.SINGLE_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.COLOR) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"color\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"w-10 h-10 rounded-lg border border-base-300 cursor-pointer p-0.5\"\n [value]=\"getColorValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onColorChange(rowField.field, $event)\"\n />\n <span class=\"text-sm text-base-content/60 font-mono\">{{ getColorValue(rowField.field) }}</span>\n </div>\n @if (asField(rowField.field).swatches) {\n <div class=\"flex gap-1.5 mt-1\">\n @for (swatch of asField(rowField.field).swatches; track swatch) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"w-6 h-6 rounded-md border border-base-300 cursor-pointer transition-transform hover:scale-110\"\n [style.background-color]=\"swatch\"\n [class.ring-2]=\"getColorValue(rowField.field) === swatch\"\n [class.ring-blue-500]=\"getColorValue(rowField.field) === swatch\"\n (click)=\"setColorFromSwatch(rowField.field, swatch)\"\n [attr.aria-label]=\"'Select color ' + swatch\"\n ></button>\n }\n </div>\n }\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.RATING) {\n <div class=\"flex flex-col gap-1\">\n <span [id]=\"'rating-label-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n <div [attr.aria-labelledby]=\"'rating-label-' + asKey(rowField.field.key)\" class=\"flex items-center gap-1\"\n role=\"group\">\n @for (star of getRatingRange(rowField.field); track star) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"text-2xl cursor-pointer transition-colors focus:outline-none\"\n [class.text-yellow-400]=\"star <= getRatingValue(rowField.field)\"\n [class.text-base-300]=\"star > getRatingValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (click)=\"setRating(rowField.field, star)\"\n >\n ★\n </button>\n }\n <span class=\"text-sm text-base-content/50 ml-2\">{{ getRatingValue(rowField.field) }} / {{ asField(rowField.field).max || 5 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.SLIDER) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"range\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"flex-1 h-2 bg-base-200 rounded-lg appearance-none cursor-pointer accent-blue-500\"\n [attr.min]=\"asField(rowField.field).min ?? 0\"\n [attr.max]=\"asField(rowField.field).max ?? 100\"\n [attr.step]=\"asField(rowField.field).step ?? 1\"\n [value]=\"getSliderValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onSliderChange(rowField.field, $event)\"\n />\n @if (asField(rowField.field).showValue !== false) {\n <span class=\"text-sm text-base-content/60 min-w-[3rem] text-right\">\n {{ getSliderValue(rowField.field) }}{{ asField(rowField.field).unit || '' }}\n </span>\n }\n </div>\n <div class=\"flex justify-between text-xs text-base-content/40 px-1\">\n <span>{{ asField(rowField.field).min ?? 0 }}</span>\n <span>{{ asField(rowField.field).max ?? 100 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.FILE) {\n <div>\n <mn-lib-file-input\n (cleared)=\"onFileCleared(rowField.field)\"\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n accept: asField(rowField.field).accept,\n multiple: asField(rowField.field).multiple,\n maxFiles: asField(rowField.field).maxFiles,\n maxSize: asField(rowField.field).maxSize,\n displayMode: asField(rowField.field).displayMode,\n dropzoneHint: asField(rowField.field).dropzoneHint,\n dropActiveHint: asField(rowField.field).dropActiveHint,\n replaceLabel: asField(rowField.field).replaceLabel,\n removeLabel: asField(rowField.field).removeLabel,\n currentUrl: asField(rowField.field).currentUrl,\n currentUrls: asField(rowField.field).currentUrls,\n disabled: isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\n })\"\n ></mn-lib-file-input>\n </div>\n }\n\n @case (FieldKind.CUSTOM) {\n <div>\n <ng-container\n mnCustomFieldHost\n [component]=\"asField(rowField.field).component\"\n [inputs]=\"asField(rowField.field).inputs\"\n [formControlName]=\"asKey(rowField.field.key)\"\n ></ng-container>\n </div>\n }\n\n @default {\n <div></div>\n }\n }\n\n <!-- Show cross-field error below any field that has one -->\n @if (getFieldError(asKey(rowField.field.key)) && rowField.field.kind !== FieldKind.SELECT && rowField.field.kind !== FieldKind.MULTI_SELECT) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </ng-template>\n\n <!-- Shared template for MULTI_SELECT_TABLE and SINGLE_SELECT_TABLE -->\n <ng-template #selectTableTemplate let-rowField>\n <div class=\"flex flex-col gap-1\">\n @if (asField(rowField.field).label) {\n <span class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n }\n <mn-table\n [dataSource]=\"tableDataSources[asKey(rowField.field.key)]\"\n [attr.aria-label]=\"asField(rowField.field).label || null\"\n (selectionChange)=\"onTableSelectionChange(rowField.field, $event)\"\n ></mn-table>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Field Groups (sections with headers) -->\n @if (fieldGroups.length > 0) {\n <div class=\"flex flex-col gap-6\">\n @for (group of fieldGroups; track group.title) {\n <div class=\"flex flex-col gap-4\" [style.display]=\"isGroupVisible(group) ? '' : 'none'\">\n <div class=\"border-b border-base-300 pb-2\">\n <h3 class=\"text-base font-semibold text-base-content\">{{ group.title }}</h3>\n @if (group.description) {\n <p class=\"text-sm text-base-content/50 mt-0.5\">{{ group.description }}</p>\n }\n </div>\n @for (row of group.rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Standard rows (no groups) -->\n @if (rows.length > 0) {\n <div class=\"flex flex-col gap-4\">\n @for (row of rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Form-level errors (not tied to a specific field) -->\n @if (formErrors['_form']) {\n <div class=\"text-red-500 text-sm px-2 py-1 bg-red-50 rounded-md\">\n {{ formErrors['_form'] }}\n </div>\n }\n\n @if (!hideFooter) {\n <!-- -mx-6 bleeds the footer to the modal edges over the body's px-6, so its line runs the full\n width like a custom or wizard modal's footer instead of stopping at the padding. -->\n <div class=\"flex gap-3 -mx-6 px-6 pt-4 pb-6 border-t border-base-300 mt-auto sticky bottom-0 bg-base-100 z-10\">\n <button\n mnButton\n type=\"button\"\n [data]=\"{ variant: 'outline', color: 'secondary' }\"\n (mousedown)=\"modalRef.dismiss(ModalCloseReason.CANCELLED)\"\n >\n @if (cancelIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ labels.cancel }}\n </button>\n\n <div class=\"flex-1\"></div>\n\n <button\n mnButton\n type=\"submit\"\n [data]=\"{ variant: 'fill', color: 'primary', disabled: form.invalid || isSubmitting }\"\n [disabled]=\"form.invalid || isSubmitting\"\n >\n @if (submitIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ isSubmitting ? labels.submitting : labels.submit }}\n </button>\n </div>\n }\n</form>\n", styles: [".select-arrow{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .75rem center}.mn-form-row{grid-template-columns:repeat(var(--mn-form-cols, 1),minmax(0,1fr))}.mn-form-cell{grid-column:span var(--mn-form-span, 1)}@media(max-width:639.98px){.mn-form-row{grid-template-columns:1fr}.mn-form-cell{grid-column:auto}}\n"] }]
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}], formStatusChange: [{
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectorRef, Component, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input, Output, TemplateRef, ViewChild, ViewChildren, ViewContainerRef, computed, forwardRef, inject, signal, viewChild } from "@angular/core";
|
|
3
|
+
import * as i1 from "@angular/common";
|
|
4
|
+
import { CommonModule } from "@angular/common";
|
|
5
|
+
import { ActionStyle, BackdropMode, CloseMode, ConfirmationTone, FieldKind, KeyboardMode, MN_HAPTICS, MN_MODAL_ACTION_ICONS, MODAL_ACTION_ICON_SIZE, ModalCloseReason, ModalKind, ModalSize, NavigationDirection, SubmitMode, WizardFlowMode, defaultIconForStyle } from "mn-angular-lib/modal-core";
|
|
6
|
+
import * as i2 from "@angular/forms";
|
|
7
|
+
import { FormBuilder, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from "@angular/forms";
|
|
8
|
+
import { MnButton } from "mn-angular-lib/button";
|
|
9
|
+
import { MnCheckbox, MnDatetime, MnFileInput, MnInputField, MnMultiSelect, MnSelect, MnTextarea } from "mn-angular-lib/forms";
|
|
10
|
+
import { MN_IN_MODAL, MnLanguageService, lucideIcons } from "mn-angular-lib/core";
|
|
11
|
+
import { MnTable } from "mn-angular-lib/collection";
|
|
12
|
+
import { LucideDynamicIcon } from "@lucide/angular";
|
|
13
|
+
import * as lucide from "lucide";
|
|
14
|
+
import { MnBottomSheet } from "mn-angular-lib/bottom-sheet";
|
|
15
|
+
var MnCustomFieldHostDirective = class MnCustomFieldHostDirective {
|
|
16
|
+
vcr = inject(ViewContainerRef);
|
|
17
|
+
component;
|
|
18
|
+
inputs;
|
|
19
|
+
componentRef;
|
|
20
|
+
onChange = () => {};
|
|
21
|
+
onTouched = () => {};
|
|
22
|
+
ngOnInit() {
|
|
23
|
+
if (!this.component) return;
|
|
24
|
+
this.vcr.clear();
|
|
25
|
+
this.componentRef = this.vcr.createComponent(this.component);
|
|
26
|
+
if (this.inputs) Object.entries(this.inputs).forEach(([key, value]) => {
|
|
27
|
+
this.componentRef.instance[key] = value;
|
|
28
|
+
});
|
|
29
|
+
const instance = this.componentRef.instance;
|
|
30
|
+
if (typeof instance.registerOnChange === "function") instance.registerOnChange((val) => this.onChange(val));
|
|
31
|
+
if (typeof instance.registerOnTouched === "function") instance.registerOnTouched(() => this.onTouched());
|
|
32
|
+
}
|
|
33
|
+
ngOnDestroy() {
|
|
34
|
+
this.componentRef?.destroy();
|
|
35
|
+
}
|
|
36
|
+
writeValue(val) {
|
|
37
|
+
const instance = this.componentRef?.instance;
|
|
38
|
+
if (instance && typeof instance.writeValue === "function") instance.writeValue(val);
|
|
39
|
+
}
|
|
40
|
+
registerOnChange(fn) {
|
|
41
|
+
this.onChange = fn;
|
|
42
|
+
}
|
|
43
|
+
registerOnTouched(fn) {
|
|
44
|
+
this.onTouched = fn;
|
|
45
|
+
}
|
|
46
|
+
setDisabledState(isDisabled) {
|
|
47
|
+
const instance = this.componentRef?.instance;
|
|
48
|
+
if (instance && typeof instance.setDisabledState === "function") instance.setDisabledState(isDisabled);
|
|
49
|
+
}
|
|
50
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
51
|
+
minVersion: "12.0.0",
|
|
52
|
+
version: "22.2.2",
|
|
53
|
+
ngImport: i0,
|
|
54
|
+
type: MnCustomFieldHostDirective,
|
|
55
|
+
deps: [],
|
|
56
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
57
|
+
});
|
|
58
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
59
|
+
minVersion: "14.0.0",
|
|
60
|
+
version: "22.2.2",
|
|
61
|
+
type: MnCustomFieldHostDirective,
|
|
62
|
+
isStandalone: true,
|
|
63
|
+
selector: "[mnCustomFieldHost]",
|
|
64
|
+
inputs: {
|
|
65
|
+
component: "component",
|
|
66
|
+
inputs: "inputs"
|
|
67
|
+
},
|
|
68
|
+
providers: [{
|
|
69
|
+
provide: NG_VALUE_ACCESSOR,
|
|
70
|
+
useExisting: forwardRef(() => MnCustomFieldHostDirective),
|
|
71
|
+
multi: true
|
|
72
|
+
}],
|
|
73
|
+
ngImport: i0
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
77
|
+
minVersion: "12.0.0",
|
|
78
|
+
version: "22.2.2",
|
|
79
|
+
ngImport: i0,
|
|
80
|
+
type: MnCustomFieldHostDirective,
|
|
81
|
+
decorators: [{
|
|
82
|
+
type: Directive,
|
|
83
|
+
args: [{
|
|
84
|
+
selector: "[mnCustomFieldHost]",
|
|
85
|
+
standalone: true,
|
|
86
|
+
providers: [{
|
|
87
|
+
provide: NG_VALUE_ACCESSOR,
|
|
88
|
+
useExisting: forwardRef(() => MnCustomFieldHostDirective),
|
|
89
|
+
multi: true
|
|
90
|
+
}]
|
|
91
|
+
}]
|
|
92
|
+
}],
|
|
93
|
+
propDecorators: {
|
|
94
|
+
component: [{ type: Input }],
|
|
95
|
+
inputs: [{ type: Input }]
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
var MnCustomBodyHostComponent = class MnCustomBodyHostComponent {
|
|
99
|
+
config;
|
|
100
|
+
modalRef;
|
|
101
|
+
container;
|
|
102
|
+
componentRef;
|
|
103
|
+
ngOnInit() {
|
|
104
|
+
setTimeout(() => this.loadContent(), 0);
|
|
105
|
+
}
|
|
106
|
+
loadContent() {
|
|
107
|
+
if (!this.container) return;
|
|
108
|
+
this.container.clear();
|
|
109
|
+
if (this.config.component) this.attachComponent(this.config.component);
|
|
110
|
+
else if (this.config.template) this.attachTemplate(this.config.template);
|
|
111
|
+
}
|
|
112
|
+
attachComponent(component) {
|
|
113
|
+
this.componentRef = this.container.createComponent(component);
|
|
114
|
+
if (this.config.inputs) Object.entries(this.config.inputs).forEach(([key, value]) => {
|
|
115
|
+
this.componentRef.instance[key] = value;
|
|
116
|
+
});
|
|
117
|
+
const instance = this.componentRef.instance;
|
|
118
|
+
if (instance && "modalRef" in instance) instance["modalRef"] = this.modalRef;
|
|
119
|
+
}
|
|
120
|
+
attachTemplate(template) {
|
|
121
|
+
this.container.createEmbeddedView(template, {
|
|
122
|
+
$implicit: this.modalRef,
|
|
123
|
+
modalRef: this.modalRef
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
127
|
+
minVersion: "12.0.0",
|
|
128
|
+
version: "22.2.2",
|
|
129
|
+
ngImport: i0,
|
|
130
|
+
type: MnCustomBodyHostComponent,
|
|
131
|
+
deps: [],
|
|
132
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
133
|
+
});
|
|
134
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
135
|
+
minVersion: "14.0.0",
|
|
136
|
+
version: "22.2.2",
|
|
137
|
+
type: MnCustomBodyHostComponent,
|
|
138
|
+
isStandalone: true,
|
|
139
|
+
selector: "mn-custom-body-host",
|
|
140
|
+
inputs: {
|
|
141
|
+
config: "config",
|
|
142
|
+
modalRef: "modalRef"
|
|
143
|
+
},
|
|
144
|
+
viewQueries: [{
|
|
145
|
+
propertyName: "container",
|
|
146
|
+
first: true,
|
|
147
|
+
predicate: ["container"],
|
|
148
|
+
descendants: true,
|
|
149
|
+
read: ViewContainerRef
|
|
150
|
+
}],
|
|
151
|
+
ngImport: i0,
|
|
152
|
+
template: "<ng-container #container></ng-container>",
|
|
153
|
+
isInline: true,
|
|
154
|
+
dependencies: [{
|
|
155
|
+
kind: "ngmodule",
|
|
156
|
+
type: CommonModule
|
|
157
|
+
}]
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
161
|
+
minVersion: "12.0.0",
|
|
162
|
+
version: "22.2.2",
|
|
163
|
+
ngImport: i0,
|
|
164
|
+
type: MnCustomBodyHostComponent,
|
|
165
|
+
decorators: [{
|
|
166
|
+
type: Component,
|
|
167
|
+
args: [{
|
|
168
|
+
selector: "mn-custom-body-host",
|
|
169
|
+
standalone: true,
|
|
170
|
+
imports: [CommonModule],
|
|
171
|
+
template: "<ng-container #container></ng-container>"
|
|
172
|
+
}]
|
|
173
|
+
}],
|
|
174
|
+
propDecorators: {
|
|
175
|
+
config: [{ type: Input }],
|
|
176
|
+
modalRef: [{ type: Input }],
|
|
177
|
+
container: [{
|
|
178
|
+
type: ViewChild,
|
|
179
|
+
args: ["container", { read: ViewContainerRef }]
|
|
180
|
+
}]
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
var MnFormBodyComponent = class MnFormBodyComponent {
|
|
184
|
+
fb = inject(FormBuilder);
|
|
185
|
+
cdr = inject(ChangeDetectorRef);
|
|
186
|
+
config;
|
|
187
|
+
modalRef;
|
|
188
|
+
hideFooter = false;
|
|
189
|
+
hideCustomBody = false;
|
|
190
|
+
formStatusChange = new EventEmitter();
|
|
191
|
+
inputFields;
|
|
192
|
+
textareas;
|
|
193
|
+
form;
|
|
194
|
+
rows = [];
|
|
195
|
+
fieldGroups = [];
|
|
196
|
+
isSubmitting = false;
|
|
197
|
+
FieldKind = FieldKind;
|
|
198
|
+
ModalCloseReason = ModalCloseReason;
|
|
199
|
+
formErrors = {};
|
|
200
|
+
fieldVisibility = {};
|
|
201
|
+
fieldConditionallyRequired = {};
|
|
202
|
+
fieldLoading = {};
|
|
203
|
+
fieldOptions = {};
|
|
204
|
+
valueChangesSubscription;
|
|
205
|
+
asField(field) {
|
|
206
|
+
return field;
|
|
207
|
+
}
|
|
208
|
+
asKey(key) {
|
|
209
|
+
return key;
|
|
210
|
+
}
|
|
211
|
+
asAny(val) {
|
|
212
|
+
return val;
|
|
213
|
+
}
|
|
214
|
+
hasRequiredValidator(field) {
|
|
215
|
+
const view = field;
|
|
216
|
+
if (view.conditionallyRequired) {
|
|
217
|
+
const formValue = this.form?.value ?? {};
|
|
218
|
+
if (view.conditionallyRequired(formValue)) return true;
|
|
219
|
+
}
|
|
220
|
+
const validators = view.validators;
|
|
221
|
+
if (!validators) return false;
|
|
222
|
+
const errors = this.fb.control(null, validators).errors;
|
|
223
|
+
return errors != null && "required" in errors;
|
|
224
|
+
}
|
|
225
|
+
tableDataSources = {};
|
|
226
|
+
languageService = inject(MnLanguageService);
|
|
227
|
+
static DEFAULT_LABELS = {
|
|
228
|
+
submit: "Submit",
|
|
229
|
+
cancel: "Cancel",
|
|
230
|
+
submitting: "Submitting...",
|
|
231
|
+
selectPlaceholder: "Select...",
|
|
232
|
+
loading: "Loading...",
|
|
233
|
+
fileUploadPrompt: "Click or drag files here",
|
|
234
|
+
fieldRequired: "This field is required",
|
|
235
|
+
loadingOptions: "Loading options...",
|
|
236
|
+
accepted: "Accepted:",
|
|
237
|
+
maxSize: "Max size:"
|
|
238
|
+
};
|
|
239
|
+
resolveLabel(i18nValue, key) {
|
|
240
|
+
if (i18nValue) return i18nValue;
|
|
241
|
+
const translated = this.languageService.translate(`common.${key}`);
|
|
242
|
+
return translated === `common.${key}` ? MnFormBodyComponent.DEFAULT_LABELS[key] : translated;
|
|
243
|
+
}
|
|
244
|
+
get labels() {
|
|
245
|
+
const i18n = this.config.i18n || {};
|
|
246
|
+
return {
|
|
247
|
+
submit: this.resolveLabel(i18n.submit, "submit"),
|
|
248
|
+
cancel: this.resolveLabel(i18n.cancel, "cancel"),
|
|
249
|
+
submitting: this.resolveLabel(i18n.submitting, "submitting"),
|
|
250
|
+
selectPlaceholder: this.resolveLabel(i18n.selectPlaceholder, "selectPlaceholder"),
|
|
251
|
+
loading: this.resolveLabel(i18n.loading, "loading"),
|
|
252
|
+
fileUploadPrompt: this.resolveLabel(i18n.fileUploadPrompt, "fileUploadPrompt"),
|
|
253
|
+
fieldRequired: this.resolveLabel(i18n.fieldRequired, "fieldRequired"),
|
|
254
|
+
loadingOptions: this.resolveLabel(i18n.loadingOptions, "loadingOptions"),
|
|
255
|
+
accepted: this.resolveLabel(i18n.accepted, "accepted"),
|
|
256
|
+
maxSize: this.resolveLabel(i18n.maxSize, "maxSize")
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
ngOnInit() {
|
|
260
|
+
this.initializeForm();
|
|
261
|
+
this.buildRows();
|
|
262
|
+
this.initializeVisibility();
|
|
263
|
+
this.initializeDataSources();
|
|
264
|
+
this.initializeTableFields();
|
|
265
|
+
this.subscribeToValueChanges();
|
|
266
|
+
if (this.config.disabled || this.config.readOnly) this.form.disable();
|
|
267
|
+
setTimeout(() => {
|
|
268
|
+
this.formStatusChange.emit(this.form.status);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
ngAfterViewInit() {
|
|
272
|
+
setTimeout(() => {
|
|
273
|
+
this.applyAutoFocus();
|
|
274
|
+
}, 100);
|
|
275
|
+
}
|
|
276
|
+
applyAutoFocus() {
|
|
277
|
+
const autoFocusField = this.config.fields.find((f) => f.autoFocus);
|
|
278
|
+
if (!autoFocusField) return;
|
|
279
|
+
const key = autoFocusField.key;
|
|
280
|
+
setTimeout(() => {
|
|
281
|
+
const inputField = this.inputFields?.find((f) => f.props.id === key);
|
|
282
|
+
if (inputField) {
|
|
283
|
+
inputField.focus();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const textarea = this.textareas?.find((f) => f.props?.id === key);
|
|
287
|
+
if (textarea) {
|
|
288
|
+
textarea.focus();
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const el = document.getElementById(key);
|
|
292
|
+
if (el) el.focus();
|
|
293
|
+
}, 50);
|
|
294
|
+
}
|
|
295
|
+
ngOnDestroy() {
|
|
296
|
+
this.valueChangesSubscription?.unsubscribe();
|
|
297
|
+
}
|
|
298
|
+
initializeForm() {
|
|
299
|
+
const formControls = {};
|
|
300
|
+
this.config.fields.forEach((field) => {
|
|
301
|
+
const fieldConfig = field;
|
|
302
|
+
let initialValue = this.config.initialValue?.[field.key] ?? null;
|
|
303
|
+
if (field.kind === FieldKind.CHECKBOX && initialValue === null) initialValue = fieldConfig.defaultValue ?? false;
|
|
304
|
+
const validators = fieldConfig.validators || [];
|
|
305
|
+
const asyncValidators = fieldConfig.asyncValidators || [];
|
|
306
|
+
const updateOn = fieldConfig.updateOn || "change";
|
|
307
|
+
formControls[field.key] = [initialValue, {
|
|
308
|
+
validators,
|
|
309
|
+
asyncValidators,
|
|
310
|
+
updateOn
|
|
311
|
+
}];
|
|
312
|
+
});
|
|
313
|
+
this.form = this.fb.group(formControls);
|
|
314
|
+
if (this.config.groupValidators && this.config.groupValidators.length > 0) {
|
|
315
|
+
this.form.setValidators(this.config.groupValidators);
|
|
316
|
+
this.form.updateValueAndValidity();
|
|
317
|
+
}
|
|
318
|
+
this.config.fields.forEach((field) => {
|
|
319
|
+
const fieldView = field;
|
|
320
|
+
const control = this.form.get(field.key);
|
|
321
|
+
if (control && (fieldView.disabled || fieldView.readOnly)) control.disable();
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
isFieldReadOnly(field) {
|
|
325
|
+
return this.config.readOnly === true || field.readOnly === true;
|
|
326
|
+
}
|
|
327
|
+
isFieldDisabled(field) {
|
|
328
|
+
return this.config.disabled === true || field.disabled === true;
|
|
329
|
+
}
|
|
330
|
+
groupVisibility = {};
|
|
331
|
+
buildRows() {
|
|
332
|
+
if (this.config.rows && this.config.rows.length > 0) this.rows = this.config.rows;
|
|
333
|
+
else {
|
|
334
|
+
const fieldsInGroups = /* @__PURE__ */ new Set();
|
|
335
|
+
(this.config.fieldGroups || []).forEach((g) => {
|
|
336
|
+
(g.rows || []).forEach((r) => r.fields.forEach((f) => fieldsInGroups.add(f.field.key)));
|
|
337
|
+
if (g.fields) g.fields.forEach((f) => fieldsInGroups.add(f.key));
|
|
338
|
+
});
|
|
339
|
+
const fieldsInRows = /* @__PURE__ */ new Set();
|
|
340
|
+
(this.config.rows || []).forEach((r) => r.fields.forEach((f) => fieldsInRows.add(f.field.key)));
|
|
341
|
+
const standaloneFields = this.config.fields.filter((f) => !fieldsInGroups.has(f.key) && !fieldsInRows.has(f.key));
|
|
342
|
+
if (standaloneFields.length > 0) this.rows = standaloneFields.map((field) => ({
|
|
343
|
+
columns: 1,
|
|
344
|
+
fields: [{
|
|
345
|
+
field,
|
|
346
|
+
span: 1
|
|
347
|
+
}]
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
this.fieldGroups = this.config.fieldGroups || [];
|
|
351
|
+
this.initializeGroupVisibility();
|
|
352
|
+
}
|
|
353
|
+
initializeGroupVisibility() {
|
|
354
|
+
this.fieldGroups.forEach((group, index) => {
|
|
355
|
+
const key = group.title || `group-${index}`;
|
|
356
|
+
const isVisible = group.visible ? group.visible(this.form.value) : true;
|
|
357
|
+
this.groupVisibility[key] = isVisible;
|
|
358
|
+
if (!isVisible) group.fields.forEach((field) => {
|
|
359
|
+
const control = this.form.get(field.key);
|
|
360
|
+
if (control) {
|
|
361
|
+
control.clearValidators();
|
|
362
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
updateGroupVisibility() {
|
|
368
|
+
const formValue = this.form.value;
|
|
369
|
+
this.fieldGroups.forEach((group, index) => {
|
|
370
|
+
const key = group.title || `group-${index}`;
|
|
371
|
+
const wasVisible = this.groupVisibility[key];
|
|
372
|
+
const isVisible = group.visible ? group.visible(formValue) : true;
|
|
373
|
+
this.groupVisibility[key] = isVisible;
|
|
374
|
+
if (!isVisible && wasVisible) group.fields.forEach((field) => {
|
|
375
|
+
const control = this.form.get(field.key);
|
|
376
|
+
if (control) {
|
|
377
|
+
control.clearValidators();
|
|
378
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
else if (isVisible && !wasVisible) group.fields.forEach((field) => {
|
|
382
|
+
const validators = field.validators || [];
|
|
383
|
+
const control = this.form.get(field.key);
|
|
384
|
+
if (control) {
|
|
385
|
+
control.setValidators(validators);
|
|
386
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
isGroupVisible(group) {
|
|
392
|
+
const key = group.title || `group-${this.fieldGroups.indexOf(group)}`;
|
|
393
|
+
return this.groupVisibility[key];
|
|
394
|
+
}
|
|
395
|
+
initializeVisibility() {
|
|
396
|
+
const formValue = this.form.value;
|
|
397
|
+
this.config.fields.forEach((field) => {
|
|
398
|
+
const key = field.key;
|
|
399
|
+
const fieldView = field;
|
|
400
|
+
const isVisible = fieldView.visible ? fieldView.visible(formValue) : true;
|
|
401
|
+
this.fieldVisibility[key] = isVisible;
|
|
402
|
+
if (!isVisible) {
|
|
403
|
+
const control = this.form.get(key);
|
|
404
|
+
if (control) {
|
|
405
|
+
control.clearValidators();
|
|
406
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
407
|
+
}
|
|
408
|
+
} else if (fieldView.conditionallyRequired) {
|
|
409
|
+
const isRequired = fieldView.conditionallyRequired(formValue);
|
|
410
|
+
this.fieldConditionallyRequired[key] = isRequired;
|
|
411
|
+
if (isRequired) {
|
|
412
|
+
const control = this.form.get(key);
|
|
413
|
+
if (control) {
|
|
414
|
+
const validators = this.buildValidators(fieldView, formValue);
|
|
415
|
+
control.setValidators(validators);
|
|
416
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
updateVisibility() {
|
|
423
|
+
const formValue = this.form.value;
|
|
424
|
+
this.config.fields.forEach((field) => {
|
|
425
|
+
const key = field.key;
|
|
426
|
+
const fieldView = field;
|
|
427
|
+
const wasVisible = this.fieldVisibility[key];
|
|
428
|
+
const isVisible = fieldView.visible ? fieldView.visible(formValue) : true;
|
|
429
|
+
this.fieldVisibility[key] = isVisible;
|
|
430
|
+
const control = this.form.get(key);
|
|
431
|
+
if (control) {
|
|
432
|
+
if (!isVisible && wasVisible) {
|
|
433
|
+
control.clearValidators();
|
|
434
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
435
|
+
} else if (isVisible && !wasVisible) {
|
|
436
|
+
const validators = this.buildValidators(fieldView, formValue);
|
|
437
|
+
control.setValidators(validators);
|
|
438
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
439
|
+
} else if (isVisible) this.updateConditionallyRequired(fieldView, formValue);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
buildValidators(field, formValue) {
|
|
444
|
+
const baseValidators = field.validators ? [...field.validators] : [];
|
|
445
|
+
if (field.conditionallyRequired && field.conditionallyRequired(formValue)) {
|
|
446
|
+
if (!baseValidators.includes(Validators.required)) baseValidators.push(Validators.required);
|
|
447
|
+
}
|
|
448
|
+
return baseValidators;
|
|
449
|
+
}
|
|
450
|
+
updateConditionallyRequired(field, formValue) {
|
|
451
|
+
if (!field.conditionallyRequired) return;
|
|
452
|
+
const key = field.key;
|
|
453
|
+
const wasRequired = this.fieldConditionallyRequired[key] ?? false;
|
|
454
|
+
const isRequired = field.conditionallyRequired(formValue);
|
|
455
|
+
this.fieldConditionallyRequired[key] = isRequired;
|
|
456
|
+
if (isRequired !== wasRequired) {
|
|
457
|
+
const control = this.form.get(key);
|
|
458
|
+
if (control) {
|
|
459
|
+
const validators = this.buildValidators(field, formValue);
|
|
460
|
+
control.setValidators(validators);
|
|
461
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
isFieldVisible(field) {
|
|
466
|
+
return this.fieldVisibility[field.key];
|
|
467
|
+
}
|
|
468
|
+
runFormValidators() {
|
|
469
|
+
this.formErrors = {};
|
|
470
|
+
if (!this.config.formValidators) return;
|
|
471
|
+
const formValue = this.form.value;
|
|
472
|
+
for (const validator of this.config.formValidators) {
|
|
473
|
+
const errors = validator(formValue);
|
|
474
|
+
if (errors) Object.assign(this.formErrors, errors);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
getFieldError(key) {
|
|
478
|
+
return this.formErrors[key] || null;
|
|
479
|
+
}
|
|
480
|
+
get hasFormErrors() {
|
|
481
|
+
return Object.keys(this.formErrors).length > 0;
|
|
482
|
+
}
|
|
483
|
+
initializeDataSources() {
|
|
484
|
+
this.config.fields.forEach((field) => {
|
|
485
|
+
const fieldView = field;
|
|
486
|
+
if (fieldView.dataSource) this.loadFieldOptions(field.key, fieldView.dataSource, this.form.value);
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
isFieldLoading(key) {
|
|
490
|
+
return this.fieldLoading[key];
|
|
491
|
+
}
|
|
492
|
+
getFieldOptions(field) {
|
|
493
|
+
const key = field.key;
|
|
494
|
+
if (this.fieldOptions[key] !== void 0) return this.fieldOptions[key];
|
|
495
|
+
return field.options || [];
|
|
496
|
+
}
|
|
497
|
+
getSelectOptions(field) {
|
|
498
|
+
return this.getFieldOptions(field).map((o) => ({
|
|
499
|
+
label: o.label,
|
|
500
|
+
value: o.value,
|
|
501
|
+
disabled: o.state === "disabled"
|
|
502
|
+
}));
|
|
503
|
+
}
|
|
504
|
+
getSelectProps(field) {
|
|
505
|
+
return {
|
|
506
|
+
id: field.key,
|
|
507
|
+
label: this.asField(field).label,
|
|
508
|
+
placeholder: this.isFieldLoading(field.key) ? this.labels.loading : this.labels.selectPlaceholder,
|
|
509
|
+
options: this.getSelectOptions(field),
|
|
510
|
+
fullWidth: true
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
async loadFieldOptions(key, dataSource, formValue) {
|
|
514
|
+
this.fieldLoading[key] = true;
|
|
515
|
+
this.cdr.markForCheck();
|
|
516
|
+
try {
|
|
517
|
+
this.fieldOptions[key] = await dataSource.load(formValue);
|
|
518
|
+
} catch (error) {
|
|
519
|
+
console.error(`Failed to load options for field '${key}':`, error);
|
|
520
|
+
this.fieldOptions[key] = [];
|
|
521
|
+
} finally {
|
|
522
|
+
this.fieldLoading[key] = false;
|
|
523
|
+
this.cdr.markForCheck();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
initializeTableFields() {
|
|
527
|
+
this.config.fields.forEach((field) => {
|
|
528
|
+
if (field.kind === FieldKind.MULTI_SELECT_TABLE) {
|
|
529
|
+
const ds = field.tableDataSource;
|
|
530
|
+
ds.selectionMode = "multi";
|
|
531
|
+
ds.selectionSummary ??= true;
|
|
532
|
+
ds.pageSizeOptions = [ds.pageSize ?? 10];
|
|
533
|
+
const control = this.form.get(field.key);
|
|
534
|
+
if (control && Array.isArray(control.value) && control.value.length > 0) ds.initialSelectedIds = control.value.map((v) => String(v));
|
|
535
|
+
else if (control && control.value === null) control.setValue([], { emitEvent: false });
|
|
536
|
+
this.tableDataSources[field.key] = ds;
|
|
537
|
+
} else if (field.kind === FieldKind.SINGLE_SELECT_TABLE) {
|
|
538
|
+
const ds = field.tableDataSource;
|
|
539
|
+
ds.selectionMode = "single";
|
|
540
|
+
const control = this.form.get(field.key);
|
|
541
|
+
if (control && control.value != null) ds.initialSelectedIds = [String(control.value)];
|
|
542
|
+
this.tableDataSources[field.key] = ds;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
onTableSelectionChange(field, selectedRows) {
|
|
547
|
+
if (field.kind === FieldKind.SINGLE_SELECT_TABLE) {
|
|
548
|
+
const tableField = field;
|
|
549
|
+
const getVal = tableField.getRowValue || tableField.tableDataSource.getID;
|
|
550
|
+
const value = selectedRows.length > 0 ? getVal(selectedRows[0]) : null;
|
|
551
|
+
const control = this.form.get(field.key);
|
|
552
|
+
if (control) {
|
|
553
|
+
control.setValue(value);
|
|
554
|
+
control.markAsTouched();
|
|
555
|
+
}
|
|
556
|
+
} else {
|
|
557
|
+
const tableField = field;
|
|
558
|
+
const getVal = tableField.getRowValue || tableField.tableDataSource.getID;
|
|
559
|
+
const values = selectedRows.map((row) => getVal(row));
|
|
560
|
+
const control = this.form.get(field.key);
|
|
561
|
+
if (control) {
|
|
562
|
+
control.setValue(values);
|
|
563
|
+
control.markAsTouched();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
getRatingRange(field) {
|
|
568
|
+
const max = field.max || 5;
|
|
569
|
+
return Array.from({ length: max }, (_, i) => i + 1);
|
|
570
|
+
}
|
|
571
|
+
setRating(field, value) {
|
|
572
|
+
const control = this.form.get(field.key);
|
|
573
|
+
if (control) {
|
|
574
|
+
control.setValue(value);
|
|
575
|
+
control.markAsTouched();
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
getRatingValue(field) {
|
|
579
|
+
return this.form.get(field.key)?.value || 0;
|
|
580
|
+
}
|
|
581
|
+
onSliderChange(field, event) {
|
|
582
|
+
const input = event.target;
|
|
583
|
+
const value = parseFloat(input.value);
|
|
584
|
+
const control = this.form.get(field.key);
|
|
585
|
+
if (control) {
|
|
586
|
+
control.setValue(value);
|
|
587
|
+
control.markAsTouched();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
getSliderValue(field) {
|
|
591
|
+
const f = field;
|
|
592
|
+
return this.form.get(field.key)?.value ?? f.min ?? 0;
|
|
593
|
+
}
|
|
594
|
+
onColorChange(field, event) {
|
|
595
|
+
const input = event.target;
|
|
596
|
+
const control = this.form.get(field.key);
|
|
597
|
+
if (control) {
|
|
598
|
+
control.setValue(input.value);
|
|
599
|
+
control.markAsTouched();
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
setColorFromSwatch(field, color) {
|
|
603
|
+
const control = this.form.get(field.key);
|
|
604
|
+
if (control) {
|
|
605
|
+
control.setValue(color);
|
|
606
|
+
control.markAsTouched();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
getColorValue(field) {
|
|
610
|
+
return this.form.get(field.key)?.value || "#000000";
|
|
611
|
+
}
|
|
612
|
+
subscribeToValueChanges() {
|
|
613
|
+
this.previousFormValue = { ...this.form.value };
|
|
614
|
+
this.valueChangesSubscription = this.form.valueChanges.subscribe((formValue) => {
|
|
615
|
+
this.updateVisibility();
|
|
616
|
+
this.updateGroupVisibility();
|
|
617
|
+
this.runFormValidators();
|
|
618
|
+
this.reloadDependentDataSources(formValue);
|
|
619
|
+
this.formStatusChange.emit(this.form.status);
|
|
620
|
+
this.cdr.markForCheck();
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
previousFormValue = {};
|
|
624
|
+
reloadDependentDataSources(formValue) {
|
|
625
|
+
this.config.fields.forEach((field) => {
|
|
626
|
+
const dataSource = field.dataSource;
|
|
627
|
+
if (!dataSource?.dependsOn) return;
|
|
628
|
+
if (dataSource.dependsOn.some((depKey) => {
|
|
629
|
+
return formValue[depKey] !== this.previousFormValue[depKey];
|
|
630
|
+
})) this.loadFieldOptions(field.key, dataSource, formValue);
|
|
631
|
+
});
|
|
632
|
+
this.previousFormValue = { ...formValue };
|
|
633
|
+
}
|
|
634
|
+
onFileCleared(field) {
|
|
635
|
+
field.onClear?.();
|
|
636
|
+
}
|
|
637
|
+
actionIconSize = MODAL_ACTION_ICON_SIZE;
|
|
638
|
+
get showActionIcons() {
|
|
639
|
+
return this.config.showActionIcons !== false;
|
|
640
|
+
}
|
|
641
|
+
get submitIcon() {
|
|
642
|
+
return this.showActionIcons ? MN_MODAL_ACTION_ICONS.confirm : null;
|
|
643
|
+
}
|
|
644
|
+
get cancelIcon() {
|
|
645
|
+
return this.showActionIcons ? MN_MODAL_ACTION_ICONS.cancel : null;
|
|
646
|
+
}
|
|
647
|
+
async submit() {
|
|
648
|
+
this.runFormValidators();
|
|
649
|
+
if (this.form.invalid || this.isSubmitting || this.hasFormErrors) {
|
|
650
|
+
this.form.markAllAsTouched();
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
if (this.config.submitMode === SubmitMode.ONCE) this.isSubmitting = true;
|
|
654
|
+
const formValue = this.form.value;
|
|
655
|
+
try {
|
|
656
|
+
if (this.config.onComplete) await this.config.onComplete.handle(formValue);
|
|
657
|
+
this.modalRef.close(formValue);
|
|
658
|
+
} catch (error) {
|
|
659
|
+
this.isSubmitting = false;
|
|
660
|
+
this.cdr.markForCheck();
|
|
661
|
+
console.error("Form submission error:", error);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
665
|
+
minVersion: "12.0.0",
|
|
666
|
+
version: "22.2.2",
|
|
667
|
+
ngImport: i0,
|
|
668
|
+
type: MnFormBodyComponent,
|
|
669
|
+
deps: [],
|
|
670
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
671
|
+
});
|
|
672
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
673
|
+
minVersion: "17.0.0",
|
|
674
|
+
version: "22.2.2",
|
|
675
|
+
type: MnFormBodyComponent,
|
|
676
|
+
isStandalone: true,
|
|
677
|
+
selector: "mn-form-body",
|
|
678
|
+
inputs: {
|
|
679
|
+
config: "config",
|
|
680
|
+
modalRef: "modalRef",
|
|
681
|
+
hideFooter: "hideFooter",
|
|
682
|
+
hideCustomBody: "hideCustomBody"
|
|
683
|
+
},
|
|
684
|
+
outputs: { formStatusChange: "formStatusChange" },
|
|
685
|
+
viewQueries: [{
|
|
686
|
+
propertyName: "inputFields",
|
|
687
|
+
predicate: MnInputField,
|
|
688
|
+
descendants: true
|
|
689
|
+
}, {
|
|
690
|
+
propertyName: "textareas",
|
|
691
|
+
predicate: MnTextarea,
|
|
692
|
+
descendants: true
|
|
693
|
+
}],
|
|
694
|
+
ngImport: i0,
|
|
695
|
+
template: "@if ((config.component || config.template) && !hideCustomBody) {\n <mn-custom-body-host\n [config]=\"asAny(config)\"\n [modalRef]=\"asAny(modalRef)\"\n class=\"mb-6 block\"\n ></mn-custom-body-host>\n}\n\n<form (ngSubmit)=\"submit()\" [formGroup]=\"form\" class=\"flex flex-col gap-6 h-full\">\n <!-- Shared field rendering template (must be inside form for formControlName) -->\n <ng-template #fieldTemplate let-rowField>\n @switch (rowField.field.kind) {\n @case (FieldKind.TEXT) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'text',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mask: asField(rowField.field).mask,\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.NUMBER) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'number',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n decimals: asField(rowField.field).decimals,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.PASSWORD) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'password',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.SELECT) {\n <div class=\"flex flex-col\">\n <mn-lib-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"getSelectProps(rowField.field)\"\n ></mn-lib-select>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-1 pl-2 pt-1\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n </div>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.CHECKBOX) {\n <div>\n <mn-lib-checkbox\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-checkbox>\n </div>\n }\n\n @case (FieldKind.DATE) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'date',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n startDate: asField(rowField.field).minDate,\n endDate: asField(rowField.field).maxDate,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.DATETIME) {\n <div>\n <mn-lib-datetime\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mode: asField(rowField.field).mode || 'datetime-local',\n min: asField(rowField.field).min,\n max: asField(rowField.field).max,\n step: asField(rowField.field).step,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-datetime>\n </div>\n }\n\n @case (FieldKind.TEXTAREA) {\n <div>\n <mn-lib-textarea\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n rows: asField(rowField.field).rows || 4,\n resize: 'vertical',\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-textarea>\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT) {\n <div>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-2 py-2 text-sm text-base-content/50\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n {{ labels.loadingOptions }}\n </div>\n }\n @if (!isFieldLoading(asKey(rowField.field.key))) {\n <mn-lib-multi-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n options: getFieldOptions(rowField.field),\n placeholder: asField(rowField.field).placeholder,\n searchable: asField(rowField.field).searchable,\n searchPlaceholder: asField(rowField.field).searchPlaceholder,\n maxSelections: asField(rowField.field).maxSelections,\n collapseThreshold: asField(rowField.field).collapseThreshold,\n collapsePlaceholder: asField(rowField.field).collapsePlaceholder,\n allSelectedPlaceholder: asField(rowField.field).allSelectedPlaceholder,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-multi-select>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.SINGLE_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.COLOR) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"color\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"w-10 h-10 rounded-lg border border-base-300 cursor-pointer p-0.5\"\n [value]=\"getColorValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onColorChange(rowField.field, $event)\"\n />\n <span class=\"text-sm text-base-content/60 font-mono\">{{ getColorValue(rowField.field) }}</span>\n </div>\n @if (asField(rowField.field).swatches) {\n <div class=\"flex gap-1.5 mt-1\">\n @for (swatch of asField(rowField.field).swatches; track swatch) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"w-6 h-6 rounded-md border border-base-300 cursor-pointer transition-transform hover:scale-110\"\n [style.background-color]=\"swatch\"\n [class.ring-2]=\"getColorValue(rowField.field) === swatch\"\n [class.ring-blue-500]=\"getColorValue(rowField.field) === swatch\"\n (click)=\"setColorFromSwatch(rowField.field, swatch)\"\n [attr.aria-label]=\"'Select color ' + swatch\"\n ></button>\n }\n </div>\n }\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.RATING) {\n <div class=\"flex flex-col gap-1\">\n <span [id]=\"'rating-label-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n <div [attr.aria-labelledby]=\"'rating-label-' + asKey(rowField.field.key)\" class=\"flex items-center gap-1\"\n role=\"group\">\n @for (star of getRatingRange(rowField.field); track star) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"text-2xl cursor-pointer transition-colors focus:outline-none\"\n [class.text-yellow-400]=\"star <= getRatingValue(rowField.field)\"\n [class.text-base-300]=\"star > getRatingValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (click)=\"setRating(rowField.field, star)\"\n >\n ★\n </button>\n }\n <span class=\"text-sm text-base-content/50 ml-2\">{{ getRatingValue(rowField.field) }} / {{ asField(rowField.field).max || 5 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.SLIDER) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"range\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"flex-1 h-2 bg-base-200 rounded-lg appearance-none cursor-pointer accent-blue-500\"\n [attr.min]=\"asField(rowField.field).min ?? 0\"\n [attr.max]=\"asField(rowField.field).max ?? 100\"\n [attr.step]=\"asField(rowField.field).step ?? 1\"\n [value]=\"getSliderValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onSliderChange(rowField.field, $event)\"\n />\n @if (asField(rowField.field).showValue !== false) {\n <span class=\"text-sm text-base-content/60 min-w-[3rem] text-right\">\n {{ getSliderValue(rowField.field) }}{{ asField(rowField.field).unit || '' }}\n </span>\n }\n </div>\n <div class=\"flex justify-between text-xs text-base-content/40 px-1\">\n <span>{{ asField(rowField.field).min ?? 0 }}</span>\n <span>{{ asField(rowField.field).max ?? 100 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.FILE) {\n <div>\n <mn-lib-file-input\n (cleared)=\"onFileCleared(rowField.field)\"\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n accept: asField(rowField.field).accept,\n multiple: asField(rowField.field).multiple,\n maxFiles: asField(rowField.field).maxFiles,\n maxSize: asField(rowField.field).maxSize,\n displayMode: asField(rowField.field).displayMode,\n dropzoneHint: asField(rowField.field).dropzoneHint,\n dropActiveHint: asField(rowField.field).dropActiveHint,\n replaceLabel: asField(rowField.field).replaceLabel,\n removeLabel: asField(rowField.field).removeLabel,\n currentUrl: asField(rowField.field).currentUrl,\n currentUrls: asField(rowField.field).currentUrls,\n disabled: isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\n })\"\n ></mn-lib-file-input>\n </div>\n }\n\n @case (FieldKind.CUSTOM) {\n <div>\n <ng-container\n mnCustomFieldHost\n [component]=\"asField(rowField.field).component\"\n [inputs]=\"asField(rowField.field).inputs\"\n [formControlName]=\"asKey(rowField.field.key)\"\n ></ng-container>\n </div>\n }\n\n @default {\n <div></div>\n }\n }\n\n <!-- Show cross-field error below any field that has one -->\n @if (getFieldError(asKey(rowField.field.key)) && rowField.field.kind !== FieldKind.SELECT && rowField.field.kind !== FieldKind.MULTI_SELECT) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </ng-template>\n\n <!-- Shared template for MULTI_SELECT_TABLE and SINGLE_SELECT_TABLE -->\n <ng-template #selectTableTemplate let-rowField>\n <div class=\"flex flex-col gap-1\">\n @if (asField(rowField.field).label) {\n <span class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n }\n <mn-table\n [dataSource]=\"tableDataSources[asKey(rowField.field.key)]\"\n [attr.aria-label]=\"asField(rowField.field).label || null\"\n (selectionChange)=\"onTableSelectionChange(rowField.field, $event)\"\n ></mn-table>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Field Groups (sections with headers) -->\n @if (fieldGroups.length > 0) {\n <div class=\"flex flex-col gap-6\">\n @for (group of fieldGroups; track group.title) {\n <div class=\"flex flex-col gap-4\" [style.display]=\"isGroupVisible(group) ? '' : 'none'\">\n <div class=\"border-b border-base-300 pb-2\">\n <h3 class=\"text-base font-semibold text-base-content\">{{ group.title }}</h3>\n @if (group.description) {\n <p class=\"text-sm text-base-content/50 mt-0.5\">{{ group.description }}</p>\n }\n </div>\n @for (row of group.rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Standard rows (no groups) -->\n @if (rows.length > 0) {\n <div class=\"flex flex-col gap-4\">\n @for (row of rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Form-level errors (not tied to a specific field) -->\n @if (formErrors['_form']) {\n <div class=\"text-red-500 text-sm px-2 py-1 bg-red-50 rounded-md\">\n {{ formErrors['_form'] }}\n </div>\n }\n\n @if (!hideFooter) {\n <!-- -mx-6 bleeds the footer to the modal edges over the body's px-6, so its line runs the full\n width like a custom or wizard modal's footer instead of stopping at the padding. -->\n <div class=\"flex gap-3 -mx-6 px-6 pt-4 pb-6 border-t border-base-300 mt-auto sticky bottom-0 bg-base-100 z-10\">\n <button\n mnButton\n type=\"button\"\n [data]=\"{ variant: 'outline', color: 'secondary' }\"\n (mousedown)=\"modalRef.dismiss(ModalCloseReason.CANCELLED)\"\n >\n @if (cancelIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ labels.cancel }}\n </button>\n\n <div class=\"flex-1\"></div>\n\n <button\n mnButton\n type=\"submit\"\n [data]=\"{ variant: 'fill', color: 'primary', disabled: form.invalid || isSubmitting }\"\n [disabled]=\"form.invalid || isSubmitting\"\n >\n @if (submitIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ isSubmitting ? labels.submitting : labels.submit }}\n </button>\n </div>\n }\n</form>\n",
|
|
696
|
+
styles: [".select-arrow{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .75rem center}.mn-form-row{grid-template-columns:repeat(var(--mn-form-cols, 1),minmax(0,1fr))}.mn-form-cell{grid-column:span var(--mn-form-span, 1)}@media(max-width:639.98px){.mn-form-row{grid-template-columns:1fr}.mn-form-cell{grid-column:auto}}\n"],
|
|
697
|
+
dependencies: [
|
|
698
|
+
{
|
|
699
|
+
kind: "ngmodule",
|
|
700
|
+
type: CommonModule
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
kind: "directive",
|
|
704
|
+
type: i1.NgTemplateOutlet,
|
|
705
|
+
selector: "[ngTemplateOutlet]",
|
|
706
|
+
inputs: [
|
|
707
|
+
"ngTemplateOutletContext",
|
|
708
|
+
"ngTemplateOutlet",
|
|
709
|
+
"ngTemplateOutletInjector"
|
|
710
|
+
]
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
kind: "ngmodule",
|
|
714
|
+
type: ReactiveFormsModule
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
kind: "directive",
|
|
718
|
+
type: i2.ɵNgNoValidate,
|
|
719
|
+
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
kind: "directive",
|
|
723
|
+
type: i2.NgControlStatus,
|
|
724
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
kind: "directive",
|
|
728
|
+
type: i2.NgControlStatusGroup,
|
|
729
|
+
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
kind: "directive",
|
|
733
|
+
type: i2.FormGroupDirective,
|
|
734
|
+
selector: "[formGroup]",
|
|
735
|
+
inputs: ["formGroup"],
|
|
736
|
+
outputs: ["ngSubmit"],
|
|
737
|
+
exportAs: ["ngForm"]
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
kind: "directive",
|
|
741
|
+
type: i2.FormControlName,
|
|
742
|
+
selector: "[formControlName]",
|
|
743
|
+
inputs: [
|
|
744
|
+
"formControlName",
|
|
745
|
+
"disabled",
|
|
746
|
+
"ngModel"
|
|
747
|
+
],
|
|
748
|
+
outputs: ["ngModelChange"]
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
kind: "component",
|
|
752
|
+
type: MnButton,
|
|
753
|
+
selector: "button[mnButton], a[mnButton]",
|
|
754
|
+
inputs: ["data"]
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
kind: "component",
|
|
758
|
+
type: MnInputField,
|
|
759
|
+
selector: "mn-lib-input-field",
|
|
760
|
+
inputs: ["props"]
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
kind: "component",
|
|
764
|
+
type: MnCheckbox,
|
|
765
|
+
selector: "mn-lib-checkbox",
|
|
766
|
+
inputs: ["props", "checked"],
|
|
767
|
+
outputs: ["checkedChange"]
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
kind: "component",
|
|
771
|
+
type: MnDatetime,
|
|
772
|
+
selector: "mn-lib-datetime",
|
|
773
|
+
inputs: ["props"]
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
kind: "component",
|
|
777
|
+
type: MnMultiSelect,
|
|
778
|
+
selector: "mn-lib-multi-select",
|
|
779
|
+
inputs: ["props"]
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
kind: "component",
|
|
783
|
+
type: MnTextarea,
|
|
784
|
+
selector: "mn-lib-textarea",
|
|
785
|
+
inputs: ["props"]
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
kind: "component",
|
|
789
|
+
type: MnFileInput,
|
|
790
|
+
selector: "mn-lib-file-input",
|
|
791
|
+
inputs: ["props"],
|
|
792
|
+
outputs: ["filesChange", "cleared"]
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
kind: "component",
|
|
796
|
+
type: MnSelect,
|
|
797
|
+
selector: "mn-lib-select",
|
|
798
|
+
inputs: ["props"]
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
kind: "directive",
|
|
802
|
+
type: MnCustomFieldHostDirective,
|
|
803
|
+
selector: "[mnCustomFieldHost]",
|
|
804
|
+
inputs: ["component", "inputs"]
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
kind: "component",
|
|
808
|
+
type: MnTable,
|
|
809
|
+
selector: "mn-table",
|
|
810
|
+
outputs: ["sortChange", "rowClick"]
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
kind: "component",
|
|
814
|
+
type: MnCustomBodyHostComponent,
|
|
815
|
+
selector: "mn-custom-body-host",
|
|
816
|
+
inputs: ["config", "modalRef"]
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
kind: "component",
|
|
820
|
+
type: LucideDynamicIcon,
|
|
821
|
+
selector: "svg[lucideIcon]",
|
|
822
|
+
inputs: ["lucideIcon"]
|
|
823
|
+
}
|
|
824
|
+
]
|
|
825
|
+
});
|
|
826
|
+
};
|
|
827
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
828
|
+
minVersion: "12.0.0",
|
|
829
|
+
version: "22.2.2",
|
|
830
|
+
ngImport: i0,
|
|
831
|
+
type: MnFormBodyComponent,
|
|
832
|
+
decorators: [{
|
|
833
|
+
type: Component,
|
|
834
|
+
args: [{
|
|
835
|
+
selector: "mn-form-body",
|
|
836
|
+
standalone: true,
|
|
837
|
+
imports: [
|
|
838
|
+
CommonModule,
|
|
839
|
+
ReactiveFormsModule,
|
|
840
|
+
MnButton,
|
|
841
|
+
MnInputField,
|
|
842
|
+
MnCheckbox,
|
|
843
|
+
MnDatetime,
|
|
844
|
+
MnMultiSelect,
|
|
845
|
+
MnTextarea,
|
|
846
|
+
MnFileInput,
|
|
847
|
+
MnSelect,
|
|
848
|
+
MnCustomFieldHostDirective,
|
|
849
|
+
MnTable,
|
|
850
|
+
MnCustomBodyHostComponent,
|
|
851
|
+
LucideDynamicIcon
|
|
852
|
+
],
|
|
853
|
+
template: "@if ((config.component || config.template) && !hideCustomBody) {\n <mn-custom-body-host\n [config]=\"asAny(config)\"\n [modalRef]=\"asAny(modalRef)\"\n class=\"mb-6 block\"\n ></mn-custom-body-host>\n}\n\n<form (ngSubmit)=\"submit()\" [formGroup]=\"form\" class=\"flex flex-col gap-6 h-full\">\n <!-- Shared field rendering template (must be inside form for formControlName) -->\n <ng-template #fieldTemplate let-rowField>\n @switch (rowField.field.kind) {\n @case (FieldKind.TEXT) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'text',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mask: asField(rowField.field).mask,\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.NUMBER) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'number',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n decimals: asField(rowField.field).decimals,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.PASSWORD) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'password',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.SELECT) {\n <div class=\"flex flex-col\">\n <mn-lib-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"getSelectProps(rowField.field)\"\n ></mn-lib-select>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-1 pl-2 pt-1\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n </div>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.CHECKBOX) {\n <div>\n <mn-lib-checkbox\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-checkbox>\n </div>\n }\n\n @case (FieldKind.DATE) {\n <div>\n <mn-lib-input-field\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n type: 'date',\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n startDate: asField(rowField.field).minDate,\n endDate: asField(rowField.field).maxDate,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-input-field>\n </div>\n }\n\n @case (FieldKind.DATETIME) {\n <div>\n <mn-lib-datetime\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n mode: asField(rowField.field).mode || 'datetime-local',\n min: asField(rowField.field).min,\n max: asField(rowField.field).max,\n step: asField(rowField.field).step,\n readonly: isFieldReadOnly(rowField.field),\n fullWidth: true\n })\"\n ></mn-lib-datetime>\n </div>\n }\n\n @case (FieldKind.TEXTAREA) {\n <div>\n <mn-lib-textarea\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n placeholder: asField(rowField.field).placeholder,\n rows: asField(rowField.field).rows || 4,\n resize: 'vertical',\n autocomplete: asField(rowField.field).autocomplete,\n readonly: isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-textarea>\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT) {\n <div>\n @if (isFieldLoading(asKey(rowField.field.key))) {\n <div class=\"flex items-center gap-2 py-2 text-sm text-base-content/50\">\n <div class=\"w-4 h-4 border-2 border-base-300 border-t-blue-500 rounded-full animate-spin\"></div>\n {{ labels.loadingOptions }}\n </div>\n }\n @if (!isFieldLoading(asKey(rowField.field.key))) {\n <mn-lib-multi-select\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n options: getFieldOptions(rowField.field),\n placeholder: asField(rowField.field).placeholder,\n searchable: asField(rowField.field).searchable,\n searchPlaceholder: asField(rowField.field).searchPlaceholder,\n maxSelections: asField(rowField.field).maxSelections,\n collapseThreshold: asField(rowField.field).collapseThreshold,\n collapsePlaceholder: asField(rowField.field).collapsePlaceholder,\n allSelectedPlaceholder: asField(rowField.field).allSelectedPlaceholder,\n disabled: isFieldDisabled(rowField.field) || isFieldReadOnly(rowField.field)\n })\"\n ></mn-lib-multi-select>\n }\n @if (getFieldError(asKey(rowField.field.key))) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.MULTI_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.SINGLE_SELECT_TABLE) {\n <ng-container [ngTemplateOutlet]=\"selectTableTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n }\n\n @case (FieldKind.COLOR) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"color\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"w-10 h-10 rounded-lg border border-base-300 cursor-pointer p-0.5\"\n [value]=\"getColorValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onColorChange(rowField.field, $event)\"\n />\n <span class=\"text-sm text-base-content/60 font-mono\">{{ getColorValue(rowField.field) }}</span>\n </div>\n @if (asField(rowField.field).swatches) {\n <div class=\"flex gap-1.5 mt-1\">\n @for (swatch of asField(rowField.field).swatches; track swatch) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"w-6 h-6 rounded-md border border-base-300 cursor-pointer transition-transform hover:scale-110\"\n [style.background-color]=\"swatch\"\n [class.ring-2]=\"getColorValue(rowField.field) === swatch\"\n [class.ring-blue-500]=\"getColorValue(rowField.field) === swatch\"\n (click)=\"setColorFromSwatch(rowField.field, swatch)\"\n [attr.aria-label]=\"'Select color ' + swatch\"\n ></button>\n }\n </div>\n }\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.RATING) {\n <div class=\"flex flex-col gap-1\">\n <span [id]=\"'rating-label-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n <div [attr.aria-labelledby]=\"'rating-label-' + asKey(rowField.field.key)\" class=\"flex items-center gap-1\"\n role=\"group\">\n @for (star of getRatingRange(rowField.field); track star) {\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'secondary' }\"\n type=\"button\"\n class=\"text-2xl cursor-pointer transition-colors focus:outline-none\"\n [class.text-yellow-400]=\"star <= getRatingValue(rowField.field)\"\n [class.text-base-300]=\"star > getRatingValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (click)=\"setRating(rowField.field, star)\"\n >\n ★\n </button>\n }\n <span class=\"text-sm text-base-content/50 ml-2\">{{ getRatingValue(rowField.field) }} / {{ asField(rowField.field).max || 5 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.SLIDER) {\n <div class=\"flex flex-col gap-1\">\n <label [for]=\"'field-' + asKey(rowField.field.key)\"\n class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n <div class=\"flex items-center gap-3\">\n <input\n type=\"range\"\n [id]=\"'field-' + asKey(rowField.field.key)\"\n class=\"flex-1 h-2 bg-base-200 rounded-lg appearance-none cursor-pointer accent-blue-500\"\n [attr.min]=\"asField(rowField.field).min ?? 0\"\n [attr.max]=\"asField(rowField.field).max ?? 100\"\n [attr.step]=\"asField(rowField.field).step ?? 1\"\n [value]=\"getSliderValue(rowField.field)\"\n [disabled]=\"isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\"\n (input)=\"onSliderChange(rowField.field, $event)\"\n />\n @if (asField(rowField.field).showValue !== false) {\n <span class=\"text-sm text-base-content/60 min-w-[3rem] text-right\">\n {{ getSliderValue(rowField.field) }}{{ asField(rowField.field).unit || '' }}\n </span>\n }\n </div>\n <div class=\"flex justify-between text-xs text-base-content/40 px-1\">\n <span>{{ asField(rowField.field).min ?? 0 }}</span>\n <span>{{ asField(rowField.field).max ?? 100 }}</span>\n </div>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n }\n\n @case (FieldKind.FILE) {\n <div>\n <mn-lib-file-input\n (cleared)=\"onFileCleared(rowField.field)\"\n [formControlName]=\"asKey(rowField.field.key)\"\n [props]=\"asAny({\n id: asKey(rowField.field.key),\n label: asField(rowField.field).label,\n accept: asField(rowField.field).accept,\n multiple: asField(rowField.field).multiple,\n maxFiles: asField(rowField.field).maxFiles,\n maxSize: asField(rowField.field).maxSize,\n displayMode: asField(rowField.field).displayMode,\n dropzoneHint: asField(rowField.field).dropzoneHint,\n dropActiveHint: asField(rowField.field).dropActiveHint,\n replaceLabel: asField(rowField.field).replaceLabel,\n removeLabel: asField(rowField.field).removeLabel,\n currentUrl: asField(rowField.field).currentUrl,\n currentUrls: asField(rowField.field).currentUrls,\n disabled: isFieldReadOnly(rowField.field) || isFieldDisabled(rowField.field)\n })\"\n ></mn-lib-file-input>\n </div>\n }\n\n @case (FieldKind.CUSTOM) {\n <div>\n <ng-container\n mnCustomFieldHost\n [component]=\"asField(rowField.field).component\"\n [inputs]=\"asField(rowField.field).inputs\"\n [formControlName]=\"asKey(rowField.field.key)\"\n ></ng-container>\n </div>\n }\n\n @default {\n <div></div>\n }\n }\n\n <!-- Show cross-field error below any field that has one -->\n @if (getFieldError(asKey(rowField.field.key)) && rowField.field.kind !== FieldKind.SELECT && rowField.field.kind !== FieldKind.MULTI_SELECT) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ getFieldError(asKey(rowField.field.key)) }}\n </div>\n }\n </ng-template>\n\n <!-- Shared template for MULTI_SELECT_TABLE and SINGLE_SELECT_TABLE -->\n <ng-template #selectTableTemplate let-rowField>\n <div class=\"flex flex-col gap-1\">\n @if (asField(rowField.field).label) {\n <span class=\"pl-2 pb-1 flex flex-row gap-0.5 text-base font-medium text-base-content\">\n {{ asField(rowField.field).label }}\n @if (hasRequiredValidator(rowField.field)) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n }\n <mn-table\n [dataSource]=\"tableDataSources[asKey(rowField.field.key)]\"\n [attr.aria-label]=\"asField(rowField.field).label || null\"\n (selectionChange)=\"onTableSelectionChange(rowField.field, $event)\"\n ></mn-table>\n @if (form.get(asKey(rowField.field.key))?.invalid && form.get(asKey(rowField.field.key))?.touched) {\n <div class=\"text-red-500 text-xs pl-2 pt-1\">\n {{ labels.fieldRequired }}\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Field Groups (sections with headers) -->\n @if (fieldGroups.length > 0) {\n <div class=\"flex flex-col gap-6\">\n @for (group of fieldGroups; track group.title) {\n <div class=\"flex flex-col gap-4\" [style.display]=\"isGroupVisible(group) ? '' : 'none'\">\n <div class=\"border-b border-base-300 pb-2\">\n <h3 class=\"text-base font-semibold text-base-content\">{{ group.title }}</h3>\n @if (group.description) {\n <p class=\"text-sm text-base-content/50 mt-0.5\">{{ group.description }}</p>\n }\n </div>\n @for (row of group.rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Standard rows (no groups) -->\n @if (rows.length > 0) {\n <div class=\"flex flex-col gap-4\">\n @for (row of rows; track $index) {\n <div [style.--mn-form-cols]=\"row.columns || 1\" class=\"grid gap-4 mn-form-row\">\n @for (rowField of row.fields; track rowField.field.key) {\n <div [style.--mn-form-span]=\"rowField.span || 1\" [style.display]=\"isFieldVisible(rowField.field) ? '' : 'none'\"\n class=\"flex flex-col gap-2 mn-form-cell\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplate\" [ngTemplateOutletContext]=\"{ $implicit: rowField }\"></ng-container>\n </div>\n }\n </div>\n }\n </div>\n }\n\n <!-- Form-level errors (not tied to a specific field) -->\n @if (formErrors['_form']) {\n <div class=\"text-red-500 text-sm px-2 py-1 bg-red-50 rounded-md\">\n {{ formErrors['_form'] }}\n </div>\n }\n\n @if (!hideFooter) {\n <!-- -mx-6 bleeds the footer to the modal edges over the body's px-6, so its line runs the full\n width like a custom or wizard modal's footer instead of stopping at the padding. -->\n <div class=\"flex gap-3 -mx-6 px-6 pt-4 pb-6 border-t border-base-300 mt-auto sticky bottom-0 bg-base-100 z-10\">\n <button\n mnButton\n type=\"button\"\n [data]=\"{ variant: 'outline', color: 'secondary' }\"\n (mousedown)=\"modalRef.dismiss(ModalCloseReason.CANCELLED)\"\n >\n @if (cancelIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ labels.cancel }}\n </button>\n\n <div class=\"flex-1\"></div>\n\n <button\n mnButton\n type=\"submit\"\n [data]=\"{ variant: 'fill', color: 'primary', disabled: form.invalid || isSubmitting }\"\n [disabled]=\"form.invalid || isSubmitting\"\n >\n @if (submitIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ isSubmitting ? labels.submitting : labels.submit }}\n </button>\n </div>\n }\n</form>\n",
|
|
854
|
+
styles: [".select-arrow{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-position:right .75rem center}.mn-form-row{grid-template-columns:repeat(var(--mn-form-cols, 1),minmax(0,1fr))}.mn-form-cell{grid-column:span var(--mn-form-span, 1)}@media(max-width:639.98px){.mn-form-row{grid-template-columns:1fr}.mn-form-cell{grid-column:auto}}\n"]
|
|
855
|
+
}]
|
|
856
|
+
}],
|
|
857
|
+
propDecorators: {
|
|
858
|
+
config: [{ type: Input }],
|
|
859
|
+
modalRef: [{ type: Input }],
|
|
860
|
+
hideFooter: [{ type: Input }],
|
|
861
|
+
hideCustomBody: [{ type: Input }],
|
|
862
|
+
formStatusChange: [{ type: Output }],
|
|
863
|
+
inputFields: [{
|
|
864
|
+
type: ViewChildren,
|
|
865
|
+
args: [MnInputField]
|
|
866
|
+
}],
|
|
867
|
+
textareas: [{
|
|
868
|
+
type: ViewChildren,
|
|
869
|
+
args: [MnTextarea]
|
|
870
|
+
}]
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
var MnFooterActionsComponent = class MnFooterActionsComponent {
|
|
874
|
+
actions = [];
|
|
875
|
+
showIcons = true;
|
|
876
|
+
actionClick = new EventEmitter();
|
|
877
|
+
actionIconSize = MODAL_ACTION_ICON_SIZE;
|
|
878
|
+
iconFor(action) {
|
|
879
|
+
if (!this.showIcons) return null;
|
|
880
|
+
return action.icon ?? defaultIconForStyle(action.style);
|
|
881
|
+
}
|
|
882
|
+
get leftActions() {
|
|
883
|
+
return this.actions.filter((a) => a.position === "left");
|
|
884
|
+
}
|
|
885
|
+
get rightActions() {
|
|
886
|
+
return this.actions.filter((a) => a.position !== "left");
|
|
887
|
+
}
|
|
888
|
+
getButtonData(action) {
|
|
889
|
+
switch (action.style) {
|
|
890
|
+
case ActionStyle.PRIMARY: return {
|
|
891
|
+
variant: "fill",
|
|
892
|
+
color: "primary",
|
|
893
|
+
disabled: action.disabled
|
|
894
|
+
};
|
|
895
|
+
case ActionStyle.DANGER: return {
|
|
896
|
+
variant: "fill",
|
|
897
|
+
color: "danger",
|
|
898
|
+
disabled: action.disabled
|
|
899
|
+
};
|
|
900
|
+
case ActionStyle.GHOST: return {
|
|
901
|
+
variant: "text",
|
|
902
|
+
color: "gray",
|
|
903
|
+
disabled: action.disabled
|
|
904
|
+
};
|
|
905
|
+
case ActionStyle.SECONDARY:
|
|
906
|
+
default: return {
|
|
907
|
+
variant: "outline",
|
|
908
|
+
color: "secondary",
|
|
909
|
+
disabled: action.disabled
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
914
|
+
minVersion: "12.0.0",
|
|
915
|
+
version: "22.2.2",
|
|
916
|
+
ngImport: i0,
|
|
917
|
+
type: MnFooterActionsComponent,
|
|
918
|
+
deps: [],
|
|
919
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
920
|
+
});
|
|
921
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
922
|
+
minVersion: "17.0.0",
|
|
923
|
+
version: "22.2.2",
|
|
924
|
+
type: MnFooterActionsComponent,
|
|
925
|
+
isStandalone: true,
|
|
926
|
+
selector: "mn-footer-actions",
|
|
927
|
+
inputs: {
|
|
928
|
+
actions: "actions",
|
|
929
|
+
showIcons: "showIcons"
|
|
930
|
+
},
|
|
931
|
+
outputs: { actionClick: "actionClick" },
|
|
932
|
+
host: { classAttribute: "contents" },
|
|
933
|
+
ngImport: i0,
|
|
934
|
+
template: `
|
|
901
935
|
@for (action of leftActions; track action.label) {
|
|
902
936
|
<button
|
|
903
937
|
mnButton
|
|
@@ -941,16 +975,45 @@ class MnFooterActionsComponent {
|
|
|
941
975
|
}
|
|
942
976
|
</button>
|
|
943
977
|
}
|
|
944
|
-
`,
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
978
|
+
`,
|
|
979
|
+
isInline: true,
|
|
980
|
+
dependencies: [
|
|
981
|
+
{
|
|
982
|
+
kind: "ngmodule",
|
|
983
|
+
type: CommonModule
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
kind: "component",
|
|
987
|
+
type: MnButton,
|
|
988
|
+
selector: "button[mnButton], a[mnButton]",
|
|
989
|
+
inputs: ["data"]
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
kind: "component",
|
|
993
|
+
type: LucideDynamicIcon,
|
|
994
|
+
selector: "svg[lucideIcon]",
|
|
995
|
+
inputs: ["lucideIcon"]
|
|
996
|
+
}
|
|
997
|
+
]
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1001
|
+
minVersion: "12.0.0",
|
|
1002
|
+
version: "22.2.2",
|
|
1003
|
+
ngImport: i0,
|
|
1004
|
+
type: MnFooterActionsComponent,
|
|
1005
|
+
decorators: [{
|
|
1006
|
+
type: Component,
|
|
1007
|
+
args: [{
|
|
1008
|
+
selector: "mn-footer-actions",
|
|
1009
|
+
standalone: true,
|
|
1010
|
+
imports: [
|
|
1011
|
+
CommonModule,
|
|
1012
|
+
MnButton,
|
|
1013
|
+
LucideDynamicIcon
|
|
1014
|
+
],
|
|
1015
|
+
host: { class: "contents" },
|
|
1016
|
+
template: `
|
|
954
1017
|
@for (action of leftActions; track action.label) {
|
|
955
1018
|
<button
|
|
956
1019
|
mnButton
|
|
@@ -994,1130 +1057,1121 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
994
1057
|
}
|
|
995
1058
|
</button>
|
|
996
1059
|
}
|
|
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
|
-
|
|
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
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1060
|
+
`
|
|
1061
|
+
}]
|
|
1062
|
+
}],
|
|
1063
|
+
propDecorators: {
|
|
1064
|
+
actions: [{ type: Input }],
|
|
1065
|
+
showIcons: [{ type: Input }],
|
|
1066
|
+
actionClick: [{ type: Output }]
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
var MnWizardBodyComponent = class MnWizardBodyComponent {
|
|
1070
|
+
cdr = inject(ChangeDetectorRef);
|
|
1071
|
+
config;
|
|
1072
|
+
modalRef;
|
|
1073
|
+
formBodies;
|
|
1074
|
+
stepWrappers;
|
|
1075
|
+
stepScroller;
|
|
1076
|
+
currentStepId;
|
|
1077
|
+
currentStepTitle = signal(void 0, ...ngDevMode ? [{ debugName: "currentStepTitle" }] : /* istanbul ignore next */ []);
|
|
1078
|
+
visitedStepIds = [];
|
|
1079
|
+
isCurrentStepValid = true;
|
|
1080
|
+
isCompleting = false;
|
|
1081
|
+
wizardErrors = {};
|
|
1082
|
+
measuredMinHeight = 0;
|
|
1083
|
+
languageService = inject(MnLanguageService);
|
|
1084
|
+
static DEFAULT_LABELS = {
|
|
1085
|
+
next: "Next",
|
|
1086
|
+
back: "Back",
|
|
1087
|
+
close: "Close",
|
|
1088
|
+
complete: "Complete",
|
|
1089
|
+
completing: "Completing..."
|
|
1090
|
+
};
|
|
1091
|
+
resolveLabel(i18nValue, key) {
|
|
1092
|
+
if (i18nValue) return i18nValue;
|
|
1093
|
+
const translated = this.languageService.translate(`common.${key}`);
|
|
1094
|
+
return translated === `common.${key}` ? MnWizardBodyComponent.DEFAULT_LABELS[key] : translated;
|
|
1095
|
+
}
|
|
1096
|
+
get labels() {
|
|
1097
|
+
const i18n = this.config.i18n || {};
|
|
1098
|
+
return {
|
|
1099
|
+
next: this.resolveLabel(i18n["next"], "next"),
|
|
1100
|
+
back: this.resolveLabel(i18n["back"], "back"),
|
|
1101
|
+
close: this.resolveLabel(i18n["close"], "close"),
|
|
1102
|
+
complete: this.resolveLabel(i18n["complete"], "complete"),
|
|
1103
|
+
completing: this.resolveLabel(i18n["completing"], "completing")
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
stepFormConfigs = {};
|
|
1107
|
+
stepBodyConfigs = {};
|
|
1108
|
+
statusSubscription;
|
|
1109
|
+
formBodiesSubscription;
|
|
1110
|
+
ngOnInit() {
|
|
1111
|
+
for (const step of this.config.steps) if (step.fields && step.fields.length > 0) {
|
|
1112
|
+
const mergedInitialValue = {
|
|
1113
|
+
...this.config.initialValue || {},
|
|
1114
|
+
...step.initialValue || {}
|
|
1115
|
+
};
|
|
1116
|
+
this.stepFormConfigs[step.id] = {
|
|
1117
|
+
kind: ModalKind.FORM,
|
|
1118
|
+
fields: step.fields,
|
|
1119
|
+
rows: step.rows,
|
|
1120
|
+
fieldGroups: step.fieldGroups,
|
|
1121
|
+
formValidators: step.formValidators,
|
|
1122
|
+
groupValidators: step.groupValidators,
|
|
1123
|
+
initialValue: mergedInitialValue,
|
|
1124
|
+
readOnly: this.config.readOnly,
|
|
1125
|
+
disabled: this.config.disabled
|
|
1126
|
+
};
|
|
1127
|
+
} else {
|
|
1128
|
+
const bodyConfig = this.buildStepBodyConfig(step);
|
|
1129
|
+
if (bodyConfig) this.stepBodyConfigs[step.id] = bodyConfig;
|
|
1130
|
+
}
|
|
1131
|
+
this.setCurrentStep(this.config.startStepId || this.config.steps[0]?.id);
|
|
1132
|
+
if (this.currentStepId) this.visitedStepIds.push(this.currentStepId);
|
|
1133
|
+
}
|
|
1134
|
+
ngAfterViewInit() {
|
|
1135
|
+
this.formBodiesSubscription = this.formBodies.changes.subscribe(() => {
|
|
1136
|
+
this.trackCurrentStepValidity();
|
|
1137
|
+
setTimeout(() => {
|
|
1138
|
+
this.getCurrentFormBody()?.applyAutoFocus();
|
|
1139
|
+
}, 100);
|
|
1140
|
+
this.measureTallestStep();
|
|
1141
|
+
});
|
|
1142
|
+
this.trackCurrentStepValidity();
|
|
1143
|
+
setTimeout(() => this.measureTallestStep(), 0);
|
|
1144
|
+
setTimeout(() => this.measureTallestStep(), 300);
|
|
1145
|
+
}
|
|
1146
|
+
isTextBody(step) {
|
|
1147
|
+
return typeof step.body === "string";
|
|
1148
|
+
}
|
|
1149
|
+
buildStepBodyConfig(step) {
|
|
1150
|
+
const body = step.body;
|
|
1151
|
+
if (!body || typeof body === "string") return void 0;
|
|
1152
|
+
const config = {
|
|
1153
|
+
kind: ModalKind.CUSTOM,
|
|
1154
|
+
inputs: step.bodyInputs
|
|
1155
|
+
};
|
|
1156
|
+
if (body instanceof TemplateRef) config.template = body;
|
|
1157
|
+
else config.component = body;
|
|
1158
|
+
return config;
|
|
1159
|
+
}
|
|
1160
|
+
async goToStep(step) {
|
|
1161
|
+
if (!this.canNavigateToStep(step)) return;
|
|
1162
|
+
if (step.id === this.currentStepId) return;
|
|
1163
|
+
const formBody = this.getCurrentFormBody();
|
|
1164
|
+
if (formBody && formBody.form.invalid) {
|
|
1165
|
+
formBody.form.markAllAsTouched();
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
const previousStepId = this.currentStepId;
|
|
1169
|
+
this.setCurrentStep(step.id);
|
|
1170
|
+
if (!this.visitedStepIds.includes(this.currentStepId)) this.visitedStepIds.push(this.currentStepId);
|
|
1171
|
+
await this.notifyStepChange(previousStepId, NavigationDirection.DIRECT);
|
|
1172
|
+
this.trackCurrentStepValidity();
|
|
1173
|
+
}
|
|
1174
|
+
ngOnDestroy() {
|
|
1175
|
+
this.statusSubscription?.unsubscribe();
|
|
1176
|
+
this.formBodiesSubscription?.unsubscribe();
|
|
1177
|
+
}
|
|
1178
|
+
measureTallestStep() {
|
|
1179
|
+
if (this.config.sizeHeight || this.config.sizeWidth === ModalSize.FULL) return;
|
|
1180
|
+
const wrappers = this.stepWrappers?.toArray().map((ref) => ref.nativeElement) ?? [];
|
|
1181
|
+
if (wrappers.length === 0) return;
|
|
1182
|
+
const originalDisplay = wrappers.map((el) => el.style.display);
|
|
1183
|
+
let tallest = 0;
|
|
1184
|
+
for (let i = 0; i < wrappers.length; i++) {
|
|
1185
|
+
for (let j = 0; j < wrappers.length; j++) wrappers[j].style.display = i === j ? "block" : "none";
|
|
1186
|
+
tallest = Math.max(tallest, wrappers[i].offsetHeight);
|
|
1187
|
+
}
|
|
1188
|
+
wrappers.forEach((el, i) => el.style.display = originalDisplay[i]);
|
|
1189
|
+
if (tallest > this.measuredMinHeight) {
|
|
1190
|
+
this.measuredMinHeight = tallest;
|
|
1191
|
+
this.cdr.detectChanges();
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
get visibleSteps() {
|
|
1195
|
+
return this.config.steps.filter((s) => this.isStepVisible(s));
|
|
1196
|
+
}
|
|
1197
|
+
isStepVisible(step) {
|
|
1198
|
+
if (!step.visible) return true;
|
|
1199
|
+
return step.visible(this.getAggregatedData());
|
|
1200
|
+
}
|
|
1201
|
+
get currentStep() {
|
|
1202
|
+
return this.config.steps.find((s) => s.id === this.currentStepId);
|
|
1203
|
+
}
|
|
1204
|
+
get currentVisibleIndex() {
|
|
1205
|
+
return this.visibleSteps.findIndex((s) => s.id === this.currentStepId);
|
|
1206
|
+
}
|
|
1207
|
+
get currentStepIndex() {
|
|
1208
|
+
return this.config.steps.findIndex((s) => s.id === this.currentStepId);
|
|
1209
|
+
}
|
|
1210
|
+
get canGoBack() {
|
|
1211
|
+
return this.currentVisibleIndex > 0;
|
|
1212
|
+
}
|
|
1213
|
+
get canGoNext() {
|
|
1214
|
+
return this.currentVisibleIndex < this.visibleSteps.length - 1;
|
|
1215
|
+
}
|
|
1216
|
+
get isLastStep() {
|
|
1217
|
+
return this.currentVisibleIndex === this.visibleSteps.length - 1;
|
|
1218
|
+
}
|
|
1219
|
+
actionIconSize = MODAL_ACTION_ICON_SIZE;
|
|
1220
|
+
get showActionIcons() {
|
|
1221
|
+
return this.config.showActionIcons !== false;
|
|
1222
|
+
}
|
|
1223
|
+
get backIcon() {
|
|
1224
|
+
if (!this.showActionIcons) return null;
|
|
1225
|
+
return this.canGoBack ? MN_MODAL_ACTION_ICONS.back : MN_MODAL_ACTION_ICONS.cancel;
|
|
1226
|
+
}
|
|
1227
|
+
get nextIcon() {
|
|
1228
|
+
return this.showActionIcons ? MN_MODAL_ACTION_ICONS.next : null;
|
|
1229
|
+
}
|
|
1230
|
+
get completeIcon() {
|
|
1231
|
+
return this.showActionIcons ? MN_MODAL_ACTION_ICONS.confirm : null;
|
|
1232
|
+
}
|
|
1233
|
+
get currentProgressIndex() {
|
|
1234
|
+
return this.currentVisibleIndex;
|
|
1235
|
+
}
|
|
1236
|
+
get isFreeFlow() {
|
|
1237
|
+
return this.config.flow === WizardFlowMode.FREE;
|
|
1238
|
+
}
|
|
1239
|
+
canNavigateToStep(step) {
|
|
1240
|
+
if (!this.isFreeFlow) return false;
|
|
1241
|
+
return this.isStepVisible(step);
|
|
1242
|
+
}
|
|
1243
|
+
async next() {
|
|
1244
|
+
if (!this.canGoNext) return;
|
|
1245
|
+
const currentStep = this.currentStep;
|
|
1246
|
+
const formBody = this.getCurrentFormBody();
|
|
1247
|
+
if (formBody && formBody.form.invalid) {
|
|
1248
|
+
formBody.form.markAllAsTouched();
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
if (currentStep?.guard?.canExit) {
|
|
1252
|
+
if (!await currentStep.guard.canExit()) return;
|
|
1253
|
+
}
|
|
1254
|
+
if (currentStep?.validators) {
|
|
1255
|
+
for (const validator of currentStep.validators) if ((await validator.validate()).status === "invalid") return;
|
|
1256
|
+
}
|
|
1257
|
+
const nextStep = this.visibleSteps[this.currentVisibleIndex + 1];
|
|
1258
|
+
if (!nextStep) return;
|
|
1259
|
+
if (nextStep.guard?.canEnter) {
|
|
1260
|
+
if (!await nextStep.guard.canEnter()) return;
|
|
1261
|
+
}
|
|
1262
|
+
const previousStepId = this.currentStepId;
|
|
1263
|
+
this.setCurrentStep(nextStep.id);
|
|
1264
|
+
if (!this.visitedStepIds.includes(this.currentStepId)) this.visitedStepIds.push(this.currentStepId);
|
|
1265
|
+
await this.notifyStepChange(previousStepId, NavigationDirection.FORWARD);
|
|
1266
|
+
this.trackCurrentStepValidity();
|
|
1267
|
+
}
|
|
1268
|
+
getCurrentFormBody() {
|
|
1269
|
+
if (!this.formBodies) return void 0;
|
|
1270
|
+
const formIndex = this.config.steps.filter((s) => this.stepFormConfigs[s.id]).map((s) => s.id).indexOf(this.currentStepId);
|
|
1271
|
+
if (formIndex === -1) return void 0;
|
|
1272
|
+
return this.formBodies.toArray()[formIndex];
|
|
1273
|
+
}
|
|
1274
|
+
trackCurrentStepValidity() {
|
|
1275
|
+
this.statusSubscription?.unsubscribe();
|
|
1276
|
+
this.statusSubscription = void 0;
|
|
1277
|
+
const formBody = this.getCurrentFormBody();
|
|
1278
|
+
if (formBody && formBody.form) {
|
|
1279
|
+
this.isCurrentStepValid = formBody.form.valid;
|
|
1280
|
+
this.statusSubscription = formBody.form.statusChanges.subscribe(() => {
|
|
1281
|
+
this.isCurrentStepValid = formBody.form.valid;
|
|
1282
|
+
this.cdr.detectChanges();
|
|
1283
|
+
});
|
|
1284
|
+
} else this.isCurrentStepValid = true;
|
|
1285
|
+
this.cdr.detectChanges();
|
|
1286
|
+
}
|
|
1287
|
+
async back() {
|
|
1288
|
+
if (!this.canGoBack) {
|
|
1289
|
+
if (this.config.onCancel) await this.config.onCancel(ModalCloseReason.CANCELLED);
|
|
1290
|
+
this.modalRef.dismiss(ModalCloseReason.CANCELLED);
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
const prevStep = this.visibleSteps[this.currentVisibleIndex - 1];
|
|
1294
|
+
const previousStepId = this.currentStepId;
|
|
1295
|
+
this.visitedStepIds = this.visitedStepIds.filter((id) => id !== this.currentStepId);
|
|
1296
|
+
this.setCurrentStep(prevStep.id);
|
|
1297
|
+
await this.notifyStepChange(previousStepId, NavigationDirection.BACKWARD);
|
|
1298
|
+
this.trackCurrentStepValidity();
|
|
1299
|
+
}
|
|
1300
|
+
setCurrentStep(stepId) {
|
|
1301
|
+
this.currentStepId = stepId;
|
|
1302
|
+
this.currentStepTitle.set(this.config.steps.find((s) => s.id === stepId)?.title);
|
|
1303
|
+
if (this.stepScroller) this.stepScroller.nativeElement.scrollTop = 0;
|
|
1304
|
+
}
|
|
1305
|
+
async complete() {
|
|
1306
|
+
if (this.isCompleting) return;
|
|
1307
|
+
const currentStep = this.currentStep;
|
|
1308
|
+
const formBody = this.getCurrentFormBody();
|
|
1309
|
+
if (formBody && formBody.form.invalid) {
|
|
1310
|
+
formBody.form.markAllAsTouched();
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
if (currentStep?.validators) {
|
|
1314
|
+
for (const validator of currentStep.validators) if ((await validator.validate()).status === "invalid") return;
|
|
1315
|
+
}
|
|
1316
|
+
this.isCompleting = true;
|
|
1317
|
+
this.wizardErrors = {};
|
|
1318
|
+
this.cdr.detectChanges();
|
|
1319
|
+
try {
|
|
1320
|
+
const aggregatedData = this.getAggregatedData();
|
|
1321
|
+
if (this.config.onBeforeComplete) {
|
|
1322
|
+
for (const validator of this.config.onBeforeComplete) {
|
|
1323
|
+
const errors = await validator(aggregatedData);
|
|
1324
|
+
if (errors) this.wizardErrors = {
|
|
1325
|
+
...this.wizardErrors,
|
|
1326
|
+
...errors
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
if (Object.keys(this.wizardErrors).length > 0) {
|
|
1330
|
+
this.isCompleting = false;
|
|
1331
|
+
this.cdr.detectChanges();
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
const result = {
|
|
1336
|
+
status: ModalCloseReason.COMPLETED,
|
|
1337
|
+
visitedStepIds: this.visitedStepIds,
|
|
1338
|
+
payload: aggregatedData
|
|
1339
|
+
};
|
|
1340
|
+
if (this.config.onComplete) await this.config.onComplete.handle(result);
|
|
1341
|
+
this.modalRef.close(result);
|
|
1342
|
+
} catch (error) {
|
|
1343
|
+
this.isCompleting = false;
|
|
1344
|
+
this.cdr.detectChanges();
|
|
1345
|
+
console.error("Wizard completion error:", error);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
getAggregatedData() {
|
|
1349
|
+
const aggregated = {};
|
|
1350
|
+
if (!this.formBodies) return aggregated;
|
|
1351
|
+
const formStepIds = this.config.steps.filter((s) => this.stepFormConfigs[s.id]).map((s) => s.id);
|
|
1352
|
+
this.formBodies.toArray().forEach((fb, index) => {
|
|
1353
|
+
if (fb.form && formStepIds[index]) aggregated[formStepIds[index]] = { ...fb.form.value };
|
|
1354
|
+
});
|
|
1355
|
+
return aggregated;
|
|
1356
|
+
}
|
|
1357
|
+
getFooterActionButtonData(action) {
|
|
1358
|
+
switch (action.style) {
|
|
1359
|
+
case ActionStyle.DANGER: return {
|
|
1360
|
+
variant: "outline",
|
|
1361
|
+
color: "danger"
|
|
1362
|
+
};
|
|
1363
|
+
case ActionStyle.PRIMARY: return {
|
|
1364
|
+
variant: "fill",
|
|
1365
|
+
color: "primary"
|
|
1366
|
+
};
|
|
1367
|
+
case ActionStyle.SECONDARY: return {
|
|
1368
|
+
variant: "outline",
|
|
1369
|
+
color: "secondary"
|
|
1370
|
+
};
|
|
1371
|
+
case ActionStyle.GHOST: return {
|
|
1372
|
+
variant: "text",
|
|
1373
|
+
color: "gray"
|
|
1374
|
+
};
|
|
1375
|
+
default: return {
|
|
1376
|
+
variant: "outline",
|
|
1377
|
+
color: "secondary"
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
async handleFooterAction(action) {
|
|
1382
|
+
if (action.handler) await action.handler(this.modalRef);
|
|
1383
|
+
if (action.closesModal) this.modalRef.close(action.closeReason || ModalCloseReason.PROGRAMMATIC);
|
|
1384
|
+
}
|
|
1385
|
+
async notifyStepChange(previousStepId, direction) {
|
|
1386
|
+
if (this.config.onStepChange) await this.config.onStepChange.handle({
|
|
1387
|
+
previousStepId,
|
|
1388
|
+
currentStepId: this.currentStepId,
|
|
1389
|
+
direction
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1393
|
+
minVersion: "12.0.0",
|
|
1394
|
+
version: "22.2.2",
|
|
1395
|
+
ngImport: i0,
|
|
1396
|
+
type: MnWizardBodyComponent,
|
|
1397
|
+
deps: [],
|
|
1398
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1399
|
+
});
|
|
1400
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1401
|
+
minVersion: "17.0.0",
|
|
1402
|
+
version: "22.2.2",
|
|
1403
|
+
type: MnWizardBodyComponent,
|
|
1404
|
+
isStandalone: true,
|
|
1405
|
+
selector: "mn-wizard-body",
|
|
1406
|
+
inputs: {
|
|
1407
|
+
config: "config",
|
|
1408
|
+
modalRef: "modalRef"
|
|
1409
|
+
},
|
|
1410
|
+
viewQueries: [
|
|
1411
|
+
{
|
|
1412
|
+
propertyName: "stepScroller",
|
|
1413
|
+
first: true,
|
|
1414
|
+
predicate: ["stepScroller"],
|
|
1415
|
+
descendants: true
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
propertyName: "formBodies",
|
|
1419
|
+
predicate: MnFormBodyComponent,
|
|
1420
|
+
descendants: true
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
propertyName: "stepWrappers",
|
|
1424
|
+
predicate: ["stepWrapper"],
|
|
1425
|
+
descendants: true
|
|
1426
|
+
}
|
|
1427
|
+
],
|
|
1428
|
+
ngImport: i0,
|
|
1429
|
+
template: "<div class=\"flex flex-col flex-auto min-h-0\">\n @if (config.component || config.template) {\n <mn-custom-body-host\n [config]=\"$any(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block flex-none px-6 pt-6\"\n ></mn-custom-body-host>\n }\n\n <!-- Steps header — fixed (does not scroll with the step body) -->\n <div class=\"flex-none px-6 pt-2 pb-4 border-b border-base-300 bg-base-100\">\n <div class=\"relative flex items-start\">\n <!-- Background line spanning from first circle center to last circle center -->\n <div\n [style.left]=\"'calc(' + 100 / (2 * visibleSteps.length) + '%)'\"\n [style.right]=\"'calc(' + 100 / (2 * visibleSteps.length) + '%)'\"\n class=\"absolute top-3.75 h-1 bg-base-300 z-0\"\n ></div>\n\n <!-- Progress fill line -->\n @if (visibleSteps.length > 1) {\n <div\n [style.left]=\"'calc(' + 100 / (2 * visibleSteps.length) + '%)'\"\n [style.width]=\"'calc(' + (currentProgressIndex / (visibleSteps.length - 1)) * (100 - 100 / visibleSteps.length) + '%)'\"\n class=\"absolute top-3.75 h-1 bg-success z-1 transition-[left,width] duration-500\"\n ></div>\n }\n\n @for (step of visibleSteps; track step.id; let i = $index; ) {\n <div\n (keyup.enter)=\"isFreeFlow ? goToStep(step) : null\"\n (click)=\"isFreeFlow ? goToStep(step) : null\"\n [attr.tabindex]=\"isFreeFlow && canNavigateToStep(step) ? 0 : null\"\n [class.cursor-pointer]=\"isFreeFlow && canNavigateToStep(step)\"\n class=\"relative flex flex-col items-center gap-1 z-10 w-0 flex-1\"\n >\n <div\n [ngClass]=\"{\n 'bg-primary text-primary-content': step.id === currentStepId,\n 'bg-success text-success-content': visitedStepIds.includes(step.id) && step.id !== currentStepId,\n 'bg-base-200 text-base-content/50': !visitedStepIds.includes(step.id) && step.id !== currentStepId\n }\"\n class=\"w-8 h-8 rounded-full flex items-center justify-center font-semibold transition-colors text-sm\"\n >{{ i + 1 }}\n </div>\n <div\n [ngClass]=\"{\n 'text-base-content font-semibold': step.id === currentStepId,\n 'text-base-content/50': step.id !== currentStepId\n }\"\n class=\"text-xs text-center whitespace-nowrap hidden sm:block\"\n >{{ step.title }}\n </div>\n\n </div>\n }\n </div>\n </div>\n\n <!-- Step body — the only scrolling region in the wizard, shared by every step -->\n <div #stepScroller class=\"flex-auto min-h-0 overflow-y-auto px-6 py-6\">\n <div [style.min-height]=\"measuredMinHeight ? measuredMinHeight + 'px' : null\" class=\"min-h-48\">\n @for (step of config.steps; track step.id) {\n <div #stepWrapper [style.display]=\"step.id === currentStepId ? 'block' : 'none'\">\n <h3 class=\"text-lg font-semibold text-base-content mb-4\">{{ step.title }}</h3>\n <div class=\"text-base-content/80\">\n <!-- Form step -->\n @if (stepFormConfigs[step.id]) {\n <mn-form-body\n [config]=\"stepFormConfigs[step.id]\"\n [modalRef]=\"$any(modalRef)\"\n [hideFooter]=\"true\"\n [hideCustomBody]=\"true\"\n ></mn-form-body>\n }\n\n <!-- Text body -->\n @if (!stepFormConfigs[step.id] && isTextBody(step)) {\n <div>\n {{ step.body }}\n </div>\n }\n\n <!-- Component / template body -->\n @if (stepBodyConfigs[step.id]) {\n <mn-custom-body-host\n [config]=\"stepBodyConfigs[step.id]\"\n [modalRef]=\"$any(modalRef)\"\n ></mn-custom-body-host>\n }\n </div>\n </div>\n }\n </div>\n </div>\n\n <!-- Wizard-level errors (from onBeforeComplete) — fixed, above the footer -->\n @if (wizardErrors && (wizardErrors | keyvalue).length > 0) {\n <div class=\"flex flex-col gap-1 mx-6 mb-2 px-2 py-2 bg-red-50 rounded-md\">\n @for (err of wizardErrors | keyvalue; track err.key) {\n <div class=\"text-red-500 text-sm\">\n {{ err.value }}\n </div>\n }\n </div>\n }\n\n <!-- Footer — fixed (does not scroll with the step body) -->\n <div class=\"flex-none flex gap-3 px-6 pt-4 pb-6 border-t border-base-300 bg-base-100\">\n @if (!currentStep?.hideBack) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'secondary' }\"\n (click)=\"back()\"\n >\n @if (backIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ currentStep?.backLabel || (canGoBack ? labels.back : labels.close) }}\n </button>\n }\n\n <!-- Custom footer actions -->\n @if (config.footerActions) {\n <mn-footer-actions\n [actions]=\"config.footerActions\"\n [showIcons]=\"showActionIcons\"\n (actionClick)=\"handleFooterAction($any($event))\"\n ></mn-footer-actions>\n } @else {\n <div class=\"flex-1\"></div>\n }\n\n @if (!isLastStep) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', disabled: !isCurrentStepValid }\"\n (click)=\"next()\"\n >\n {{ currentStep?.nextLabel || labels.next }}\n @if (nextIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"ml-2\"></svg>\n }\n </button>\n }\n\n @if (isLastStep) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', disabled: !isCurrentStepValid || isCompleting }\"\n [disabled]=\"!isCurrentStepValid || isCompleting\"\n (click)=\"complete()\"\n >\n @if (completeIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ currentStep?.nextLabel || (isCompleting ? labels.completing : labels.complete) }}\n </button>\n }\n </div>\n</div>\n",
|
|
1430
|
+
styles: [""],
|
|
1431
|
+
dependencies: [
|
|
1432
|
+
{
|
|
1433
|
+
kind: "ngmodule",
|
|
1434
|
+
type: CommonModule
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
kind: "directive",
|
|
1438
|
+
type: i1.NgClass,
|
|
1439
|
+
selector: "[ngClass]",
|
|
1440
|
+
inputs: ["class", "ngClass"]
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
kind: "ngmodule",
|
|
1444
|
+
type: ReactiveFormsModule
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
kind: "component",
|
|
1448
|
+
type: MnButton,
|
|
1449
|
+
selector: "button[mnButton], a[mnButton]",
|
|
1450
|
+
inputs: ["data"]
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
kind: "component",
|
|
1454
|
+
type: MnFormBodyComponent,
|
|
1455
|
+
selector: "mn-form-body",
|
|
1456
|
+
inputs: [
|
|
1457
|
+
"config",
|
|
1458
|
+
"modalRef",
|
|
1459
|
+
"hideFooter",
|
|
1460
|
+
"hideCustomBody"
|
|
1461
|
+
],
|
|
1462
|
+
outputs: ["formStatusChange"]
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
kind: "component",
|
|
1466
|
+
type: MnCustomBodyHostComponent,
|
|
1467
|
+
selector: "mn-custom-body-host",
|
|
1468
|
+
inputs: ["config", "modalRef"]
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
kind: "component",
|
|
1472
|
+
type: MnFooterActionsComponent,
|
|
1473
|
+
selector: "mn-footer-actions",
|
|
1474
|
+
inputs: ["actions", "showIcons"],
|
|
1475
|
+
outputs: ["actionClick"]
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
kind: "component",
|
|
1479
|
+
type: LucideDynamicIcon,
|
|
1480
|
+
selector: "svg[lucideIcon]",
|
|
1481
|
+
inputs: ["lucideIcon"]
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
kind: "pipe",
|
|
1485
|
+
type: i1.KeyValuePipe,
|
|
1486
|
+
name: "keyvalue"
|
|
1487
|
+
}
|
|
1488
|
+
]
|
|
1489
|
+
});
|
|
1490
|
+
};
|
|
1491
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1492
|
+
minVersion: "12.0.0",
|
|
1493
|
+
version: "22.2.2",
|
|
1494
|
+
ngImport: i0,
|
|
1495
|
+
type: MnWizardBodyComponent,
|
|
1496
|
+
decorators: [{
|
|
1497
|
+
type: Component,
|
|
1498
|
+
args: [{
|
|
1499
|
+
selector: "mn-wizard-body",
|
|
1500
|
+
standalone: true,
|
|
1501
|
+
imports: [
|
|
1502
|
+
CommonModule,
|
|
1503
|
+
ReactiveFormsModule,
|
|
1504
|
+
MnButton,
|
|
1505
|
+
MnFormBodyComponent,
|
|
1506
|
+
MnCustomBodyHostComponent,
|
|
1507
|
+
MnFooterActionsComponent,
|
|
1508
|
+
LucideDynamicIcon
|
|
1509
|
+
],
|
|
1510
|
+
template: "<div class=\"flex flex-col flex-auto min-h-0\">\n @if (config.component || config.template) {\n <mn-custom-body-host\n [config]=\"$any(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block flex-none px-6 pt-6\"\n ></mn-custom-body-host>\n }\n\n <!-- Steps header — fixed (does not scroll with the step body) -->\n <div class=\"flex-none px-6 pt-2 pb-4 border-b border-base-300 bg-base-100\">\n <div class=\"relative flex items-start\">\n <!-- Background line spanning from first circle center to last circle center -->\n <div\n [style.left]=\"'calc(' + 100 / (2 * visibleSteps.length) + '%)'\"\n [style.right]=\"'calc(' + 100 / (2 * visibleSteps.length) + '%)'\"\n class=\"absolute top-3.75 h-1 bg-base-300 z-0\"\n ></div>\n\n <!-- Progress fill line -->\n @if (visibleSteps.length > 1) {\n <div\n [style.left]=\"'calc(' + 100 / (2 * visibleSteps.length) + '%)'\"\n [style.width]=\"'calc(' + (currentProgressIndex / (visibleSteps.length - 1)) * (100 - 100 / visibleSteps.length) + '%)'\"\n class=\"absolute top-3.75 h-1 bg-success z-1 transition-[left,width] duration-500\"\n ></div>\n }\n\n @for (step of visibleSteps; track step.id; let i = $index; ) {\n <div\n (keyup.enter)=\"isFreeFlow ? goToStep(step) : null\"\n (click)=\"isFreeFlow ? goToStep(step) : null\"\n [attr.tabindex]=\"isFreeFlow && canNavigateToStep(step) ? 0 : null\"\n [class.cursor-pointer]=\"isFreeFlow && canNavigateToStep(step)\"\n class=\"relative flex flex-col items-center gap-1 z-10 w-0 flex-1\"\n >\n <div\n [ngClass]=\"{\n 'bg-primary text-primary-content': step.id === currentStepId,\n 'bg-success text-success-content': visitedStepIds.includes(step.id) && step.id !== currentStepId,\n 'bg-base-200 text-base-content/50': !visitedStepIds.includes(step.id) && step.id !== currentStepId\n }\"\n class=\"w-8 h-8 rounded-full flex items-center justify-center font-semibold transition-colors text-sm\"\n >{{ i + 1 }}\n </div>\n <div\n [ngClass]=\"{\n 'text-base-content font-semibold': step.id === currentStepId,\n 'text-base-content/50': step.id !== currentStepId\n }\"\n class=\"text-xs text-center whitespace-nowrap hidden sm:block\"\n >{{ step.title }}\n </div>\n\n </div>\n }\n </div>\n </div>\n\n <!-- Step body — the only scrolling region in the wizard, shared by every step -->\n <div #stepScroller class=\"flex-auto min-h-0 overflow-y-auto px-6 py-6\">\n <div [style.min-height]=\"measuredMinHeight ? measuredMinHeight + 'px' : null\" class=\"min-h-48\">\n @for (step of config.steps; track step.id) {\n <div #stepWrapper [style.display]=\"step.id === currentStepId ? 'block' : 'none'\">\n <h3 class=\"text-lg font-semibold text-base-content mb-4\">{{ step.title }}</h3>\n <div class=\"text-base-content/80\">\n <!-- Form step -->\n @if (stepFormConfigs[step.id]) {\n <mn-form-body\n [config]=\"stepFormConfigs[step.id]\"\n [modalRef]=\"$any(modalRef)\"\n [hideFooter]=\"true\"\n [hideCustomBody]=\"true\"\n ></mn-form-body>\n }\n\n <!-- Text body -->\n @if (!stepFormConfigs[step.id] && isTextBody(step)) {\n <div>\n {{ step.body }}\n </div>\n }\n\n <!-- Component / template body -->\n @if (stepBodyConfigs[step.id]) {\n <mn-custom-body-host\n [config]=\"stepBodyConfigs[step.id]\"\n [modalRef]=\"$any(modalRef)\"\n ></mn-custom-body-host>\n }\n </div>\n </div>\n }\n </div>\n </div>\n\n <!-- Wizard-level errors (from onBeforeComplete) — fixed, above the footer -->\n @if (wizardErrors && (wizardErrors | keyvalue).length > 0) {\n <div class=\"flex flex-col gap-1 mx-6 mb-2 px-2 py-2 bg-red-50 rounded-md\">\n @for (err of wizardErrors | keyvalue; track err.key) {\n <div class=\"text-red-500 text-sm\">\n {{ err.value }}\n </div>\n }\n </div>\n }\n\n <!-- Footer — fixed (does not scroll with the step body) -->\n <div class=\"flex-none flex gap-3 px-6 pt-4 pb-6 border-t border-base-300 bg-base-100\">\n @if (!currentStep?.hideBack) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'outline', color: 'secondary' }\"\n (click)=\"back()\"\n >\n @if (backIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ currentStep?.backLabel || (canGoBack ? labels.back : labels.close) }}\n </button>\n }\n\n <!-- Custom footer actions -->\n @if (config.footerActions) {\n <mn-footer-actions\n [actions]=\"config.footerActions\"\n [showIcons]=\"showActionIcons\"\n (actionClick)=\"handleFooterAction($any($event))\"\n ></mn-footer-actions>\n } @else {\n <div class=\"flex-1\"></div>\n }\n\n @if (!isLastStep) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', disabled: !isCurrentStepValid }\"\n (click)=\"next()\"\n >\n {{ currentStep?.nextLabel || labels.next }}\n @if (nextIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"ml-2\"></svg>\n }\n </button>\n }\n\n @if (isLastStep) {\n <button\n type=\"button\"\n mnButton\n [data]=\"{ variant: 'fill', color: 'primary', disabled: !isCurrentStepValid || isCompleting }\"\n [disabled]=\"!isCurrentStepValid || isCompleting\"\n (click)=\"complete()\"\n >\n @if (completeIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ currentStep?.nextLabel || (isCompleting ? labels.completing : labels.complete) }}\n </button>\n }\n </div>\n</div>\n"
|
|
1511
|
+
}]
|
|
1512
|
+
}],
|
|
1513
|
+
propDecorators: {
|
|
1514
|
+
config: [{ type: Input }],
|
|
1515
|
+
modalRef: [{ type: Input }],
|
|
1516
|
+
formBodies: [{
|
|
1517
|
+
type: ViewChildren,
|
|
1518
|
+
args: [MnFormBodyComponent]
|
|
1519
|
+
}],
|
|
1520
|
+
stepWrappers: [{
|
|
1521
|
+
type: ViewChildren,
|
|
1522
|
+
args: ["stepWrapper"]
|
|
1523
|
+
}],
|
|
1524
|
+
stepScroller: [{
|
|
1525
|
+
type: ViewChild,
|
|
1526
|
+
args: ["stepScroller"]
|
|
1527
|
+
}]
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
const ICONS$1 = lucideIcons({
|
|
1531
|
+
CircleAlert: lucide.CircleAlert,
|
|
1532
|
+
TriangleAlert: lucide.TriangleAlert
|
|
1533
|
+
});
|
|
1534
|
+
var MnConfirmationBodyComponent = class MnConfirmationBodyComponent {
|
|
1535
|
+
icons = ICONS$1;
|
|
1536
|
+
cdr = inject(ChangeDetectorRef);
|
|
1537
|
+
config;
|
|
1538
|
+
modalRef;
|
|
1539
|
+
formBody;
|
|
1540
|
+
confirmButtonStatus = "VALID";
|
|
1541
|
+
hasFormFields = false;
|
|
1542
|
+
languageService = inject(MnLanguageService);
|
|
1543
|
+
ngOnInit() {
|
|
1544
|
+
this.hasFormFields = !!(this.config.fields && this.config.fields.length > 0 || this.config.fieldGroups && this.config.fieldGroups.length > 0 || this.config.rows && this.config.rows.length > 0);
|
|
1545
|
+
}
|
|
1546
|
+
onFormStatusChange(status) {
|
|
1547
|
+
this.confirmButtonStatus = status;
|
|
1548
|
+
this.cdr.markForCheck();
|
|
1549
|
+
this.cdr.detectChanges();
|
|
1550
|
+
}
|
|
1551
|
+
async confirm() {
|
|
1552
|
+
if (this.hasFormFields && this.formBody?.form.invalid) {
|
|
1553
|
+
this.formBody.form.markAllAsTouched();
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
const result = this.hasFormFields ? this.formBody?.form.value : true;
|
|
1557
|
+
if (this.config.confirm?.handler) await this.config.confirm.handler.handle(result);
|
|
1558
|
+
this.modalRef.close(result);
|
|
1559
|
+
}
|
|
1560
|
+
cancel() {
|
|
1561
|
+
const reason = this.config.cancel?.reason || ModalCloseReason.CANCELLED;
|
|
1562
|
+
this.modalRef.dismiss(reason);
|
|
1563
|
+
}
|
|
1564
|
+
resolveLabel(value, key, fallback) {
|
|
1565
|
+
if (value) return value;
|
|
1566
|
+
const translated = this.languageService.translate(`common.${key}`);
|
|
1567
|
+
return translated === `common.${key}` ? fallback : translated;
|
|
1568
|
+
}
|
|
1569
|
+
get confirmLabel() {
|
|
1570
|
+
return this.resolveLabel(this.config.confirm?.label, "confirm", "Confirm");
|
|
1571
|
+
}
|
|
1572
|
+
get cancelLabel() {
|
|
1573
|
+
return this.resolveLabel(this.config.cancel?.label, "cancel", "Cancel");
|
|
1574
|
+
}
|
|
1575
|
+
get confirmStyle() {
|
|
1576
|
+
return this.config.confirm?.style || ActionStyle.PRIMARY;
|
|
1577
|
+
}
|
|
1578
|
+
get cancelStyle() {
|
|
1579
|
+
return this.config.cancel?.style || ActionStyle.SECONDARY;
|
|
1580
|
+
}
|
|
1581
|
+
get toneClass() {
|
|
1582
|
+
switch (this.config.tone) {
|
|
1583
|
+
case ConfirmationTone.WARNING: return "tone-warning";
|
|
1584
|
+
case ConfirmationTone.DANGER: return "tone-danger";
|
|
1585
|
+
default: return "tone-default";
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
getButtonColor(style) {
|
|
1589
|
+
switch (style) {
|
|
1590
|
+
case ActionStyle.PRIMARY: return "primary";
|
|
1591
|
+
case ActionStyle.DANGER: return "danger";
|
|
1592
|
+
case ActionStyle.GHOST: return "secondary";
|
|
1593
|
+
default: return "secondary";
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
getButtonVariant(style) {
|
|
1597
|
+
switch (style) {
|
|
1598
|
+
case ActionStyle.PRIMARY:
|
|
1599
|
+
case ActionStyle.DANGER: return "fill";
|
|
1600
|
+
case ActionStyle.GHOST: return "text";
|
|
1601
|
+
default: return "outline";
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
get isConfirmDisabled() {
|
|
1605
|
+
if (this.hasFormFields) return this.confirmButtonStatus !== "VALID";
|
|
1606
|
+
return false;
|
|
1607
|
+
}
|
|
1608
|
+
actionIconSize = MODAL_ACTION_ICON_SIZE;
|
|
1609
|
+
get showActionIcons() {
|
|
1610
|
+
return this.config.showActionIcons !== false;
|
|
1611
|
+
}
|
|
1612
|
+
get confirmIcon() {
|
|
1613
|
+
if (!this.showActionIcons) return null;
|
|
1614
|
+
if (this.config.confirm?.icon) return this.config.confirm.icon;
|
|
1615
|
+
return this.confirmStyle === ActionStyle.DANGER ? MN_MODAL_ACTION_ICONS.danger : MN_MODAL_ACTION_ICONS.confirm;
|
|
1616
|
+
}
|
|
1617
|
+
get cancelIcon() {
|
|
1618
|
+
if (!this.showActionIcons) return null;
|
|
1619
|
+
return this.config.cancel?.icon ?? MN_MODAL_ACTION_ICONS.cancel;
|
|
1620
|
+
}
|
|
1621
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1622
|
+
minVersion: "12.0.0",
|
|
1623
|
+
version: "22.2.2",
|
|
1624
|
+
ngImport: i0,
|
|
1625
|
+
type: MnConfirmationBodyComponent,
|
|
1626
|
+
deps: [],
|
|
1627
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1628
|
+
});
|
|
1629
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1630
|
+
minVersion: "17.0.0",
|
|
1631
|
+
version: "22.2.2",
|
|
1632
|
+
type: MnConfirmationBodyComponent,
|
|
1633
|
+
isStandalone: true,
|
|
1634
|
+
selector: "mn-confirmation-body",
|
|
1635
|
+
inputs: {
|
|
1636
|
+
config: "config",
|
|
1637
|
+
modalRef: "modalRef"
|
|
1638
|
+
},
|
|
1639
|
+
viewQueries: [{
|
|
1640
|
+
propertyName: "formBody",
|
|
1641
|
+
first: true,
|
|
1642
|
+
predicate: MnFormBodyComponent,
|
|
1643
|
+
descendants: true
|
|
1644
|
+
}],
|
|
1645
|
+
ngImport: i0,
|
|
1646
|
+
template: "<div class=\"flex flex-col gap-6\" [ngClass]=\"toneClass\">\n <!-- Custom Content (Component or Template) -->\n @if (config.component || config.template) {\n <mn-custom-body-host\n [config]=\"$any(config)\"\n [modalRef]=\"$any(modalRef)\"\n ></mn-custom-body-host>\n }\n\n <div class=\"flex flex-col items-center text-center gap-6\">\n @if (config.tone === 'warning' || config.tone === 'danger') {\n <div\n class=\"w-12 h-12 rounded-full flex items-center justify-center\"\n [ngClass]=\"{\n 'bg-blue-100 text-blue-500': config.tone !== 'warning' && config.tone !== 'danger',\n 'bg-amber-100 text-amber-500': config.tone === 'warning',\n 'bg-red-100 text-red-500': config.tone === 'danger'\n }\">\n @if (config.tone === 'warning') {\n <svg [size]=\"24\" [lucideIcon]=\"icons.TriangleAlert\"></svg>\n }\n @if (config.tone === 'danger') {\n <svg [size]=\"24\" [lucideIcon]=\"icons.CircleAlert\"></svg>\n }\n </div>\n }\n\n @if (config.message) {\n <div class=\"text-base text-base-content/80 leading-relaxed max-w-[28rem]\">\n {{ config.message }}\n </div>\n }\n </div>\n\n <!-- Form Fields / Rows -->\n @if (hasFormFields) {\n <mn-form-body\n [config]=\"$any(config)\"\n [modalRef]=\"$any(modalRef)\"\n [hideFooter]=\"true\"\n [hideCustomBody]=\"true\"\n (formStatusChange)=\"onFormStatusChange($event)\"\n ></mn-form-body>\n }\n\n <div class=\"flex gap-3 w-full pb-6 sticky bottom-0 bg-base-100 z-10\">\n <button\n type=\"button\"\n mnButton\n [data]=\"{\n variant: getButtonVariant(cancelStyle),\n color: getButtonColor(cancelStyle)\n }\"\n (click)=\"cancel()\"\n >\n @if (cancelIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ cancelLabel }}\n </button>\n\n <div class=\"flex-1\"></div>\n\n <button\n type=\"button\"\n mnButton\n [data]=\"{\n variant: getButtonVariant(confirmStyle),\n color: getButtonColor(confirmStyle),\n disabled: isConfirmDisabled\n }\"\n [disabled]=\"isConfirmDisabled\"\n (click)=\"confirm()\"\n >\n @if (confirmIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ confirmLabel }}\n </button>\n </div>\n</div>\n",
|
|
1647
|
+
styles: [""],
|
|
1648
|
+
dependencies: [
|
|
1649
|
+
{
|
|
1650
|
+
kind: "ngmodule",
|
|
1651
|
+
type: CommonModule
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
kind: "directive",
|
|
1655
|
+
type: i1.NgClass,
|
|
1656
|
+
selector: "[ngClass]",
|
|
1657
|
+
inputs: ["class", "ngClass"]
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
kind: "component",
|
|
1661
|
+
type: MnButton,
|
|
1662
|
+
selector: "button[mnButton], a[mnButton]",
|
|
1663
|
+
inputs: ["data"]
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
kind: "component",
|
|
1667
|
+
type: MnFormBodyComponent,
|
|
1668
|
+
selector: "mn-form-body",
|
|
1669
|
+
inputs: [
|
|
1670
|
+
"config",
|
|
1671
|
+
"modalRef",
|
|
1672
|
+
"hideFooter",
|
|
1673
|
+
"hideCustomBody"
|
|
1674
|
+
],
|
|
1675
|
+
outputs: ["formStatusChange"]
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
kind: "component",
|
|
1679
|
+
type: MnCustomBodyHostComponent,
|
|
1680
|
+
selector: "mn-custom-body-host",
|
|
1681
|
+
inputs: ["config", "modalRef"]
|
|
1682
|
+
},
|
|
1683
|
+
{
|
|
1684
|
+
kind: "ngmodule",
|
|
1685
|
+
type: ReactiveFormsModule
|
|
1686
|
+
},
|
|
1687
|
+
{
|
|
1688
|
+
kind: "component",
|
|
1689
|
+
type: LucideDynamicIcon,
|
|
1690
|
+
selector: "svg[lucideIcon]",
|
|
1691
|
+
inputs: ["lucideIcon"]
|
|
1692
|
+
}
|
|
1693
|
+
]
|
|
1694
|
+
});
|
|
1695
|
+
};
|
|
1696
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1697
|
+
minVersion: "12.0.0",
|
|
1698
|
+
version: "22.2.2",
|
|
1699
|
+
ngImport: i0,
|
|
1700
|
+
type: MnConfirmationBodyComponent,
|
|
1701
|
+
decorators: [{
|
|
1702
|
+
type: Component,
|
|
1703
|
+
args: [{
|
|
1704
|
+
selector: "mn-confirmation-body",
|
|
1705
|
+
standalone: true,
|
|
1706
|
+
imports: [
|
|
1707
|
+
CommonModule,
|
|
1708
|
+
MnButton,
|
|
1709
|
+
MnFormBodyComponent,
|
|
1710
|
+
MnCustomBodyHostComponent,
|
|
1711
|
+
ReactiveFormsModule,
|
|
1712
|
+
LucideDynamicIcon
|
|
1713
|
+
],
|
|
1714
|
+
template: "<div class=\"flex flex-col gap-6\" [ngClass]=\"toneClass\">\n <!-- Custom Content (Component or Template) -->\n @if (config.component || config.template) {\n <mn-custom-body-host\n [config]=\"$any(config)\"\n [modalRef]=\"$any(modalRef)\"\n ></mn-custom-body-host>\n }\n\n <div class=\"flex flex-col items-center text-center gap-6\">\n @if (config.tone === 'warning' || config.tone === 'danger') {\n <div\n class=\"w-12 h-12 rounded-full flex items-center justify-center\"\n [ngClass]=\"{\n 'bg-blue-100 text-blue-500': config.tone !== 'warning' && config.tone !== 'danger',\n 'bg-amber-100 text-amber-500': config.tone === 'warning',\n 'bg-red-100 text-red-500': config.tone === 'danger'\n }\">\n @if (config.tone === 'warning') {\n <svg [size]=\"24\" [lucideIcon]=\"icons.TriangleAlert\"></svg>\n }\n @if (config.tone === 'danger') {\n <svg [size]=\"24\" [lucideIcon]=\"icons.CircleAlert\"></svg>\n }\n </div>\n }\n\n @if (config.message) {\n <div class=\"text-base text-base-content/80 leading-relaxed max-w-[28rem]\">\n {{ config.message }}\n </div>\n }\n </div>\n\n <!-- Form Fields / Rows -->\n @if (hasFormFields) {\n <mn-form-body\n [config]=\"$any(config)\"\n [modalRef]=\"$any(modalRef)\"\n [hideFooter]=\"true\"\n [hideCustomBody]=\"true\"\n (formStatusChange)=\"onFormStatusChange($event)\"\n ></mn-form-body>\n }\n\n <div class=\"flex gap-3 w-full pb-6 sticky bottom-0 bg-base-100 z-10\">\n <button\n type=\"button\"\n mnButton\n [data]=\"{\n variant: getButtonVariant(cancelStyle),\n color: getButtonColor(cancelStyle)\n }\"\n (click)=\"cancel()\"\n >\n @if (cancelIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ cancelLabel }}\n </button>\n\n <div class=\"flex-1\"></div>\n\n <button\n type=\"button\"\n mnButton\n [data]=\"{\n variant: getButtonVariant(confirmStyle),\n color: getButtonColor(confirmStyle),\n disabled: isConfirmDisabled\n }\"\n [disabled]=\"isConfirmDisabled\"\n (click)=\"confirm()\"\n >\n @if (confirmIcon; as icon) {\n <svg [lucideIcon]=\"icon\" [size]=\"actionIconSize\" class=\"mr-2\"></svg>\n }\n {{ confirmLabel }}\n </button>\n </div>\n</div>\n"
|
|
1715
|
+
}]
|
|
1716
|
+
}],
|
|
1717
|
+
propDecorators: {
|
|
1718
|
+
config: [{ type: Input }],
|
|
1719
|
+
modalRef: [{ type: Input }],
|
|
1720
|
+
formBody: [{
|
|
1721
|
+
type: ViewChild,
|
|
1722
|
+
args: [MnFormBodyComponent]
|
|
1723
|
+
}]
|
|
1724
|
+
}
|
|
1725
|
+
});
|
|
1645
1726
|
const ICONS = lucideIcons({ X: lucide.X });
|
|
1646
|
-
class MnModalShellComponent {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
MnButton,
|
|
2095
|
-
MnBottomSheet,
|
|
2096
|
-
LucideDynamicIcon,
|
|
2097
|
-
], providers: [{ provide: MN_IN_MODAL, useValue: true }], template: "@if (showBackdrop) {\n <!-- The backdrop is a visual overlay \u2014 keyboard dismiss is handled at component level via Escape key -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div class=\"modal-backdrop absolute inset-0 bg-black/50 animate-[fadeIn_0.2s_ease-in-out]\" (click)=\"onBackdropClick()\"></div>\n}\n\n@if (showMobileSheet) {\n <!-- Mobile: the shared bottom sheet owns the anchoring, grabber, swipe/flick-to-dismiss\n and slide animation. The shell keeps its own backdrop (so the sheet renders none),\n and its close animation delegates to the sheet's startClosing(). `modal-container`\n is kept as a class hook so the host app's keyboard-lift CSS still matches. -->\n <mn-bottom-sheet\n (dismiss)=\"onSheetDismiss()\"\n [ariaLabelledby]=\"config.title ? 'mn-modal-title' : undefined\"\n [containerClass]=\"'modal-container'\"\n [dismissGuard]=\"sheetDismissGuard\"\n [dismissible]=\"canClose\"\n [growWithKeyboard]=\"true\"\n [maxHeightVh]=\"92\"\n [showBackdrop]=\"false\"\n >\n <ng-container [ngTemplateOutlet]=\"modalBody\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <!--\n Desktop centered dialog. The container deliberately does NOT stop click propagation.\n The backdrop is a *sibling* element (absolutely positioned behind this one), never an\n ancestor, so clicks in here can't reach `onBackdropClick()` anyway. Swallowing them\n instead broke every \"click outside me\" handler inside a modal.\n -->\n <div\n [attr.aria-describedby]=\"config.description ? 'mn-modal-description' : null\"\n [attr.aria-labelledby]=\"config.title ? 'mn-modal-title' : null\"\n [ngClass]=\"containerSizeClass\"\n [style.height]=\"containerHeightStyle\"\n aria-modal=\"true\"\n class=\"modal-container relative bg-base-100 rounded-lg shadow-xl max-h-[90vh] max-w-[calc(100vw-2rem)] overflow-hidden flex flex-col\"\n role=\"dialog\"\n tabindex=\"-1\"\n >\n <ng-container [ngTemplateOutlet]=\"modalBody\"></ng-container>\n </div>\n}\n\n<ng-template #modalBody>\n <div [class.border-b]=\"config.kind !== ModalKind.WIZARD\"\n [class.border-base-300]=\"config.kind !== ModalKind.WIZARD\"\n class=\"flex items-center justify-between p-6\">\n <div class=\"flex flex-col gap-0.5\">\n @if (config.title) {\n <!-- On small screens the wizard's step labels (under the progress circles) are hidden,\n so surface the active step name here as \"Title - Step\" instead. -->\n <h2 class=\"m-0 text-xl font-semibold text-base-content\"\n id=\"mn-modal-title\">{{ config.title }}@if (config.kind === ModalKind.WIZARD && wizardStepTitle()) {\n <span class=\"sm:hidden font-normal text-base-content/60\"> - {{ wizardStepTitle() }}</span>\n }</h2>\n }\n @if (config.subtitle) {\n <p class=\"m-0 text-sm text-base-content/60 font-normal\">{{ config.subtitle }}</p>\n }\n </div>\n @if (showCloseButton) {\n <div [class]=\"showMobileSheet ? 'hidden sm:flex' : ''\">\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'gray', hover: true, borderRadius: 'md' }\"\n type=\"button\"\n class=\"w-8 h-8\"\n (click)=\"onCloseButtonClick()\"\n [attr.aria-label]=\"closeModalLabel\"\n >\n <svg [lucideIcon]=\"icons.X\" [size]=\"18\"></svg>\n </button>\n </div>\n }\n </div>\n @if (config.description) {\n <p class=\"m-0 px-6 text-sm text-base-content/60 leading-relaxed\" id=\"mn-modal-description\">{{ config.description }}</p>\n }\n\n @if (config.kind === ModalKind.WIZARD) {\n <!-- Wizard manages its own internal scrolling so the steps header and footer\n stay fixed while only the step body scrolls. No padding/scroll here. -->\n <div class=\"flex-auto min-h-0 overflow-hidden flex flex-col\">\n <mn-wizard-body\n [config]=\"asWizard(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"flex-auto min-h-0 flex flex-col\"\n ></mn-wizard-body>\n </div>\n } @else {\n <div class=\"flex-1 overflow-y-auto px-6 pt-6\">\n @if (config.kind === ModalKind.FORM) {\n <mn-form-body\n [config]=\"asForm(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block h-full\"\n ></mn-form-body>\n }\n\n @if (config.kind === ModalKind.CONFIRMATION) {\n <mn-confirmation-body\n [config]=\"asConfirmation(config)\"\n [modalRef]=\"$any(modalRef)\"\n ></mn-confirmation-body>\n }\n\n @if (config.kind === ModalKind.CUSTOM) {\n <mn-custom-body-host\n [config]=\"asCustom(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block pb-6\"\n ></mn-custom-body-host>\n }\n </div>\n }\n\n <!-- Custom Footer Actions (not for wizard modals, they render their own) -->\n @if (hasCustomFooterActions && config.kind !== ModalKind.WIZARD) {\n <div class=\"flex gap-3 px-6 pt-4 pb-6 border-t border-base-300\">\n <mn-footer-actions\n [actions]=\"config.footerActions || []\"\n [showIcons]=\"config.showActionIcons !== false\"\n (actionClick)=\"onFooterAction($event)\"\n ></mn-footer-actions>\n </div>\n }\n</ng-template>\n", styles: [":host{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;transition:transform .3s ease-in-out,filter .3s ease-in-out,opacity .3s ease-in-out}:host(.mobile-sheet){align-items:flex-end}:host(.is-stacked){transform:scale(.96) translateY(-1rem);filter:brightness(.9) blur(1px);pointer-events:none;opacity:.8}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes slideIn{0%{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}@keyframes zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes slideOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(1rem)}}@keyframes zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}:host(.anim-slide) .modal-container{animation:slideIn .2s ease-in-out}:host(.anim-fade) .modal-container{animation:fadeIn .2s ease-in-out}:host(.anim-zoom) .modal-container{animation:zoomIn .2s ease-in-out}:host(.closing) .modal-backdrop{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-slide .modal-container{animation:slideOut .15s ease-in-out forwards}:host(.closing).anim-fade .modal-container{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-zoom .modal-container{animation:zoomOut .15s ease-in-out forwards}@media(prefers-reduced-motion:reduce){:host,:host .modal-backdrop,:host .modal-container{animation-duration:.01ms!important;animation-delay:0ms!important;transition-duration:.01ms!important}}\n"] }]
|
|
2098
|
-
}], propDecorators: { config: [{
|
|
2099
|
-
type: Input
|
|
2100
|
-
}], modalRef: [{
|
|
2101
|
-
type: Input
|
|
2102
|
-
}], wizardBody: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MnWizardBodyComponent), { isSignal: true }] }], bottomSheet: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MnBottomSheet), { isSignal: true }] }], hostClasses: [{
|
|
2103
|
-
type: HostBinding,
|
|
2104
|
-
args: ['class']
|
|
2105
|
-
}], onEscapeKey: [{
|
|
2106
|
-
type: HostListener,
|
|
2107
|
-
args: ['document:keydown.escape', ['$event']]
|
|
2108
|
-
}] } });
|
|
2109
|
-
|
|
2110
|
-
/**
|
|
2111
|
-
* Public API of the `mn-angular-lib/modal-ui` entry point: the modal shell and body components. `MnModalService` loads this entry point on demand, so it is not part of a consumer's startup bundle.
|
|
2112
|
-
*
|
|
2113
|
-
* Each entry point is its own module in the published package, so a consumer's bundler
|
|
2114
|
-
* splits it into the chunk that uses it instead of loading the whole library at startup.
|
|
2115
|
-
* The root `mn-angular-lib` entry re-exports every entry point.
|
|
2116
|
-
*/
|
|
2117
|
-
|
|
2118
|
-
/**
|
|
2119
|
-
* Generated bundle index. Do not edit.
|
|
2120
|
-
*/
|
|
2121
|
-
|
|
1727
|
+
var MnModalShellComponent = class MnModalShellComponent {
|
|
1728
|
+
icons = ICONS;
|
|
1729
|
+
lang = inject(MnLanguageService);
|
|
1730
|
+
get closeModalLabel() {
|
|
1731
|
+
return this.lang.translateIfPresent("mnModal.close") ?? "Close modal";
|
|
1732
|
+
}
|
|
1733
|
+
el = inject(ElementRef);
|
|
1734
|
+
cdr = inject(ChangeDetectorRef);
|
|
1735
|
+
config;
|
|
1736
|
+
modalRef;
|
|
1737
|
+
isClosing = false;
|
|
1738
|
+
isStacked = signal(false, ...ngDevMode ? [{ debugName: "isStacked" }] : /* istanbul ignore next */ []);
|
|
1739
|
+
ModalKind = ModalKind;
|
|
1740
|
+
wizardBody = viewChild(MnWizardBodyComponent, ...ngDevMode ? [{ debugName: "wizardBody" }] : /* istanbul ignore next */ []);
|
|
1741
|
+
static SHEET_MAX_WIDTH = 639.98;
|
|
1742
|
+
wizardStepTitle = computed(() => this.wizardBody()?.currentStepTitle(), ...ngDevMode ? [{ debugName: "wizardStepTitle" }] : /* istanbul ignore next */ []);
|
|
1743
|
+
previouslyFocusedElement = null;
|
|
1744
|
+
focusTrapListener = null;
|
|
1745
|
+
pollingTimer = null;
|
|
1746
|
+
pollAttempts = 0;
|
|
1747
|
+
static CLOSE_FALLBACK_MS = 700;
|
|
1748
|
+
isNarrow = signal(false, ...ngDevMode ? [{ debugName: "isNarrow" }] : /* istanbul ignore next */ []);
|
|
1749
|
+
bottomSheet = viewChild(MnBottomSheet, ...ngDevMode ? [{ debugName: "bottomSheet" }] : /* istanbul ignore next */ []);
|
|
1750
|
+
haptics = inject(MN_HAPTICS, { optional: true });
|
|
1751
|
+
sheetMedia = null;
|
|
1752
|
+
sheetMediaListener = null;
|
|
1753
|
+
get isMobileSheet() {
|
|
1754
|
+
return this.config.mobileBottomSheet !== false;
|
|
1755
|
+
}
|
|
1756
|
+
get showMobileSheet() {
|
|
1757
|
+
return this.isMobileSheet && this.isNarrow();
|
|
1758
|
+
}
|
|
1759
|
+
get hostClasses() {
|
|
1760
|
+
return `modal-shell modal-${this.config.sizeWidth || ModalSize.MD}${` anim-${typeof this.config.animation === "string" ? this.config.animation : this.config.animation?.type || "slide"}`}${this.isStacked() ? " is-stacked" : ""}${this.showMobileSheet ? " mobile-sheet" : ""}`;
|
|
1761
|
+
}
|
|
1762
|
+
setupFocusTrap() {
|
|
1763
|
+
this.focusTrapListener = (e) => {
|
|
1764
|
+
if (e.key !== "Tab") return;
|
|
1765
|
+
const focusable = this.el.nativeElement.querySelectorAll("button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])");
|
|
1766
|
+
if (focusable.length === 0) return;
|
|
1767
|
+
const first = focusable[0];
|
|
1768
|
+
const last = focusable[focusable.length - 1];
|
|
1769
|
+
if (e.shiftKey) {
|
|
1770
|
+
if (document.activeElement === first) {
|
|
1771
|
+
e.preventDefault();
|
|
1772
|
+
last.focus();
|
|
1773
|
+
}
|
|
1774
|
+
} else if (document.activeElement === last) {
|
|
1775
|
+
e.preventDefault();
|
|
1776
|
+
first.focus();
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1779
|
+
this.el.nativeElement.addEventListener("keydown", this.focusTrapListener);
|
|
1780
|
+
}
|
|
1781
|
+
removeFocusTrap() {
|
|
1782
|
+
if (this.focusTrapListener) {
|
|
1783
|
+
this.el.nativeElement.removeEventListener("keydown", this.focusTrapListener);
|
|
1784
|
+
this.focusTrapListener = null;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
asWizard(config) {
|
|
1788
|
+
return config;
|
|
1789
|
+
}
|
|
1790
|
+
asForm(config) {
|
|
1791
|
+
return config;
|
|
1792
|
+
}
|
|
1793
|
+
asConfirmation(config) {
|
|
1794
|
+
return config;
|
|
1795
|
+
}
|
|
1796
|
+
asCustom(config) {
|
|
1797
|
+
return config;
|
|
1798
|
+
}
|
|
1799
|
+
get canClose() {
|
|
1800
|
+
return this.config.closeMode !== CloseMode.DISABLED;
|
|
1801
|
+
}
|
|
1802
|
+
ngOnInit() {
|
|
1803
|
+
this.startWatchingViewport();
|
|
1804
|
+
this.startPollingIfConfigured();
|
|
1805
|
+
}
|
|
1806
|
+
ngOnDestroy() {
|
|
1807
|
+
this.removeFocusTrap();
|
|
1808
|
+
this.stopPolling();
|
|
1809
|
+
this.stopWatchingViewport();
|
|
1810
|
+
if (this.previouslyFocusedElement && typeof this.previouslyFocusedElement.focus === "function") this.previouslyFocusedElement.focus();
|
|
1811
|
+
}
|
|
1812
|
+
startClosing() {
|
|
1813
|
+
return new Promise((resolve) => {
|
|
1814
|
+
setTimeout(async () => {
|
|
1815
|
+
this.isClosing = true;
|
|
1816
|
+
this.el.nativeElement.classList.add("closing");
|
|
1817
|
+
this.cdr.detectChanges();
|
|
1818
|
+
if (this.prefersReducedMotion()) {
|
|
1819
|
+
resolve();
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
const sheet = this.bottomSheet();
|
|
1823
|
+
if (sheet) {
|
|
1824
|
+
await sheet.startClosing();
|
|
1825
|
+
resolve();
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
const container = this.el.nativeElement.querySelector(".modal-container");
|
|
1829
|
+
if (!container) {
|
|
1830
|
+
resolve();
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
let settled = false;
|
|
1834
|
+
const done = (event) => {
|
|
1835
|
+
if (event && event.target !== container) return;
|
|
1836
|
+
if (settled) return;
|
|
1837
|
+
settled = true;
|
|
1838
|
+
container.removeEventListener("animationend", done);
|
|
1839
|
+
container.removeEventListener("transitionend", done);
|
|
1840
|
+
clearTimeout(fallback);
|
|
1841
|
+
resolve();
|
|
1842
|
+
};
|
|
1843
|
+
container.addEventListener("animationend", done);
|
|
1844
|
+
container.addEventListener("transitionend", done);
|
|
1845
|
+
const fallback = setTimeout(done, MnModalShellComponent.CLOSE_FALLBACK_MS);
|
|
1846
|
+
});
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
prefersReducedMotion() {
|
|
1850
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1851
|
+
}
|
|
1852
|
+
onEscapeKey(event) {
|
|
1853
|
+
if (!this.closesOnEscape(event)) return;
|
|
1854
|
+
this.handleClose(ModalCloseReason.ESCAPE);
|
|
1855
|
+
event?.preventDefault?.();
|
|
1856
|
+
}
|
|
1857
|
+
closesOnEscape(event) {
|
|
1858
|
+
if (this.config.keyboard === KeyboardMode.DISABLED) return false;
|
|
1859
|
+
if (this.isStacked()) return false;
|
|
1860
|
+
if (event?.defaultPrevented) return false;
|
|
1861
|
+
return !this.el.nativeElement.querySelector("[aria-expanded=\"true\"]");
|
|
1862
|
+
}
|
|
1863
|
+
onBackdropClick() {
|
|
1864
|
+
if (this.config.backdrop === BackdropMode.CLOSABLE || this.isMobileSheet && this.config.backdrop !== BackdropMode.STATIC) this.handleClose(ModalCloseReason.BACKDROP);
|
|
1865
|
+
}
|
|
1866
|
+
onCloseButtonClick() {
|
|
1867
|
+
this.handleClose(ModalCloseReason.DISMISSED);
|
|
1868
|
+
}
|
|
1869
|
+
sheetDismissGuard = async () => {
|
|
1870
|
+
if (this.config.closeMode === CloseMode.DISABLED) return false;
|
|
1871
|
+
if (this.config.closeMode === CloseMode.GUARDED && this.config.closeGuard) return await this.config.closeGuard();
|
|
1872
|
+
return true;
|
|
1873
|
+
};
|
|
1874
|
+
onSheetDismiss() {
|
|
1875
|
+
this.haptics?.impact("medium");
|
|
1876
|
+
this.modalRef.dismiss(ModalCloseReason.DISMISSED);
|
|
1877
|
+
}
|
|
1878
|
+
ngAfterViewInit() {
|
|
1879
|
+
this.previouslyFocusedElement = document.activeElement;
|
|
1880
|
+
this.setupFocusTrap();
|
|
1881
|
+
const container = this.el.nativeElement.querySelector(".modal-container");
|
|
1882
|
+
if (container) container.focus();
|
|
1883
|
+
}
|
|
1884
|
+
startWatchingViewport() {
|
|
1885
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1886
|
+
this.sheetMedia = window.matchMedia(`(max-width: ${MnModalShellComponent.SHEET_MAX_WIDTH}px)`);
|
|
1887
|
+
this.isNarrow.set(this.sheetMedia.matches);
|
|
1888
|
+
this.sheetMediaListener = (event) => this.isNarrow.set(event.matches);
|
|
1889
|
+
this.sheetMedia.addEventListener("change", this.sheetMediaListener);
|
|
1890
|
+
}
|
|
1891
|
+
stopWatchingViewport() {
|
|
1892
|
+
if (this.sheetMedia && this.sheetMediaListener) this.sheetMedia.removeEventListener("change", this.sheetMediaListener);
|
|
1893
|
+
this.sheetMedia = null;
|
|
1894
|
+
this.sheetMediaListener = null;
|
|
1895
|
+
}
|
|
1896
|
+
async handleClose(reason) {
|
|
1897
|
+
if (this.config.closeMode === CloseMode.DISABLED) return false;
|
|
1898
|
+
if (this.config.closeMode === CloseMode.GUARDED) {
|
|
1899
|
+
if (this.config.closeGuard) {
|
|
1900
|
+
if (!await this.config.closeGuard()) return false;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
this.modalRef.dismiss(reason);
|
|
1904
|
+
return true;
|
|
1905
|
+
}
|
|
1906
|
+
get showBackdrop() {
|
|
1907
|
+
return this.config.backdrop !== BackdropMode.HIDE;
|
|
1908
|
+
}
|
|
1909
|
+
get containerSizeClass() {
|
|
1910
|
+
switch (this.config.sizeWidth || ModalSize.MD) {
|
|
1911
|
+
case ModalSize.SM: return "w-96";
|
|
1912
|
+
case ModalSize.MD: return "w-[32rem]";
|
|
1913
|
+
case ModalSize.LG: return "w-[48rem]";
|
|
1914
|
+
case ModalSize.XL: return "w-[64rem]";
|
|
1915
|
+
case ModalSize.FULL: return "w-[95vw]";
|
|
1916
|
+
default: return "w-[32rem]";
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
get containerHeightStyle() {
|
|
1920
|
+
if (this.config.sizeWidth === ModalSize.FULL && !this.config.sizeHeight) return "95vh";
|
|
1921
|
+
if (!this.config.sizeHeight) return null;
|
|
1922
|
+
switch (this.config.sizeHeight) {
|
|
1923
|
+
case ModalSize.SM: return "30vh";
|
|
1924
|
+
case ModalSize.MD: return "50vh";
|
|
1925
|
+
case ModalSize.LG: return "70vh";
|
|
1926
|
+
case ModalSize.XL: return "85vh";
|
|
1927
|
+
case ModalSize.FULL: return "95vh";
|
|
1928
|
+
default: return null;
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
get showCloseButton() {
|
|
1932
|
+
return this.config.closeMode !== CloseMode.DISABLED;
|
|
1933
|
+
}
|
|
1934
|
+
get hasCustomFooterActions() {
|
|
1935
|
+
return !!this.config.footerActions && this.config.footerActions.length > 0;
|
|
1936
|
+
}
|
|
1937
|
+
get leftFooterActions() {
|
|
1938
|
+
return (this.config.footerActions || []).filter((a) => a.position === "left");
|
|
1939
|
+
}
|
|
1940
|
+
get rightFooterActions() {
|
|
1941
|
+
return (this.config.footerActions || []).filter((a) => a.position !== "left");
|
|
1942
|
+
}
|
|
1943
|
+
async onFooterAction(action) {
|
|
1944
|
+
if (action.disabled) return;
|
|
1945
|
+
if (action.handler) await action.handler(this.modalRef);
|
|
1946
|
+
if (action.closesModal) {
|
|
1947
|
+
if (action.closeReason === ModalCloseReason.COMPLETED) this.modalRef.close();
|
|
1948
|
+
else this.modalRef.dismiss(action.closeReason || ModalCloseReason.DISMISSED);
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
getActionButtonColor(style) {
|
|
1952
|
+
switch (style) {
|
|
1953
|
+
case ActionStyle.PRIMARY: return "primary";
|
|
1954
|
+
case ActionStyle.DANGER: return "danger";
|
|
1955
|
+
case ActionStyle.GHOST: return "secondary";
|
|
1956
|
+
default: return "secondary";
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
getActionButtonVariant(style) {
|
|
1960
|
+
switch (style) {
|
|
1961
|
+
case ActionStyle.PRIMARY:
|
|
1962
|
+
case ActionStyle.DANGER: return "fill";
|
|
1963
|
+
case ActionStyle.GHOST: return "text";
|
|
1964
|
+
default: return "outline";
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
startPollingIfConfigured() {
|
|
1968
|
+
const polling = this.config.polling;
|
|
1969
|
+
if (!polling) return;
|
|
1970
|
+
if (polling.autoStart === false) return;
|
|
1971
|
+
this.startPolling();
|
|
1972
|
+
}
|
|
1973
|
+
startPolling() {
|
|
1974
|
+
const polling = this.config.polling;
|
|
1975
|
+
if (!polling) return;
|
|
1976
|
+
this.pollingTimer = setInterval(async () => {
|
|
1977
|
+
this.pollAttempts++;
|
|
1978
|
+
try {
|
|
1979
|
+
if (await polling.onPoll(this.modalRef) === true) this.stopPolling();
|
|
1980
|
+
} catch (e) {
|
|
1981
|
+
console.error("Polling error:", e);
|
|
1982
|
+
}
|
|
1983
|
+
if (polling.maxAttempts && this.pollAttempts >= polling.maxAttempts) this.stopPolling();
|
|
1984
|
+
}, polling.interval);
|
|
1985
|
+
}
|
|
1986
|
+
stopPolling() {
|
|
1987
|
+
if (this.pollingTimer) {
|
|
1988
|
+
clearInterval(this.pollingTimer);
|
|
1989
|
+
this.pollingTimer = null;
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1993
|
+
minVersion: "12.0.0",
|
|
1994
|
+
version: "22.2.2",
|
|
1995
|
+
ngImport: i0,
|
|
1996
|
+
type: MnModalShellComponent,
|
|
1997
|
+
deps: [],
|
|
1998
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1999
|
+
});
|
|
2000
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2001
|
+
minVersion: "17.0.0",
|
|
2002
|
+
version: "22.2.2",
|
|
2003
|
+
type: MnModalShellComponent,
|
|
2004
|
+
isStandalone: true,
|
|
2005
|
+
selector: "mn-modal-shell",
|
|
2006
|
+
inputs: {
|
|
2007
|
+
config: "config",
|
|
2008
|
+
modalRef: "modalRef"
|
|
2009
|
+
},
|
|
2010
|
+
host: {
|
|
2011
|
+
listeners: { "document:keydown.escape": "onEscapeKey($event)" },
|
|
2012
|
+
properties: { "class": "this.hostClasses" }
|
|
2013
|
+
},
|
|
2014
|
+
providers: [{
|
|
2015
|
+
provide: MN_IN_MODAL,
|
|
2016
|
+
useValue: true
|
|
2017
|
+
}],
|
|
2018
|
+
viewQueries: [{
|
|
2019
|
+
propertyName: "wizardBody",
|
|
2020
|
+
first: true,
|
|
2021
|
+
predicate: MnWizardBodyComponent,
|
|
2022
|
+
descendants: true,
|
|
2023
|
+
isSignal: true
|
|
2024
|
+
}, {
|
|
2025
|
+
propertyName: "bottomSheet",
|
|
2026
|
+
first: true,
|
|
2027
|
+
predicate: MnBottomSheet,
|
|
2028
|
+
descendants: true,
|
|
2029
|
+
isSignal: true
|
|
2030
|
+
}],
|
|
2031
|
+
ngImport: i0,
|
|
2032
|
+
template: "@if (showBackdrop) {\n <!-- The backdrop is a visual overlay — keyboard dismiss is handled at component level via Escape key -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div class=\"modal-backdrop absolute inset-0 bg-black/50 animate-[fadeIn_0.2s_ease-in-out]\" (click)=\"onBackdropClick()\"></div>\n}\n\n@if (showMobileSheet) {\n <!-- Mobile: the shared bottom sheet owns the anchoring, grabber, swipe/flick-to-dismiss\n and slide animation. The shell keeps its own backdrop (so the sheet renders none),\n and its close animation delegates to the sheet's startClosing(). `modal-container`\n is kept as a class hook so the host app's keyboard-lift CSS still matches. -->\n <mn-bottom-sheet\n (dismiss)=\"onSheetDismiss()\"\n [ariaLabelledby]=\"config.title ? 'mn-modal-title' : undefined\"\n [containerClass]=\"'modal-container'\"\n [dismissGuard]=\"sheetDismissGuard\"\n [dismissible]=\"canClose\"\n [growWithKeyboard]=\"true\"\n [maxHeightVh]=\"92\"\n [showBackdrop]=\"false\"\n >\n <ng-container [ngTemplateOutlet]=\"modalBody\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <!--\n Desktop centered dialog. The container deliberately does NOT stop click propagation.\n The backdrop is a *sibling* element (absolutely positioned behind this one), never an\n ancestor, so clicks in here can't reach `onBackdropClick()` anyway. Swallowing them\n instead broke every \"click outside me\" handler inside a modal.\n -->\n <div\n [attr.aria-describedby]=\"config.description ? 'mn-modal-description' : null\"\n [attr.aria-labelledby]=\"config.title ? 'mn-modal-title' : null\"\n [ngClass]=\"containerSizeClass\"\n [style.height]=\"containerHeightStyle\"\n aria-modal=\"true\"\n class=\"modal-container relative bg-base-100 rounded-lg shadow-xl max-h-[90vh] max-w-[calc(100vw-2rem)] overflow-hidden flex flex-col\"\n role=\"dialog\"\n tabindex=\"-1\"\n >\n <ng-container [ngTemplateOutlet]=\"modalBody\"></ng-container>\n </div>\n}\n\n<ng-template #modalBody>\n <div [class.border-b]=\"config.kind !== ModalKind.WIZARD\"\n [class.border-base-300]=\"config.kind !== ModalKind.WIZARD\"\n class=\"flex items-center justify-between p-6\">\n <div class=\"flex flex-col gap-0.5\">\n @if (config.title) {\n <!-- On small screens the wizard's step labels (under the progress circles) are hidden,\n so surface the active step name here as \"Title - Step\" instead. -->\n <h2 class=\"m-0 text-xl font-semibold text-base-content\"\n id=\"mn-modal-title\">{{ config.title }}@if (config.kind === ModalKind.WIZARD && wizardStepTitle()) {\n <span class=\"sm:hidden font-normal text-base-content/60\"> - {{ wizardStepTitle() }}</span>\n }</h2>\n }\n @if (config.subtitle) {\n <p class=\"m-0 text-sm text-base-content/60 font-normal\">{{ config.subtitle }}</p>\n }\n </div>\n @if (showCloseButton) {\n <div [class]=\"showMobileSheet ? 'hidden sm:flex' : ''\">\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'gray', hover: true, borderRadius: 'md' }\"\n type=\"button\"\n class=\"w-8 h-8\"\n (click)=\"onCloseButtonClick()\"\n [attr.aria-label]=\"closeModalLabel\"\n >\n <svg [lucideIcon]=\"icons.X\" [size]=\"18\"></svg>\n </button>\n </div>\n }\n </div>\n @if (config.description) {\n <p class=\"m-0 px-6 text-sm text-base-content/60 leading-relaxed\" id=\"mn-modal-description\">{{ config.description }}</p>\n }\n\n @if (config.kind === ModalKind.WIZARD) {\n <!-- Wizard manages its own internal scrolling so the steps header and footer\n stay fixed while only the step body scrolls. No padding/scroll here. -->\n <div class=\"flex-auto min-h-0 overflow-hidden flex flex-col\">\n <mn-wizard-body\n [config]=\"asWizard(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"flex-auto min-h-0 flex flex-col\"\n ></mn-wizard-body>\n </div>\n } @else {\n <div class=\"flex-1 overflow-y-auto px-6 pt-6\">\n @if (config.kind === ModalKind.FORM) {\n <mn-form-body\n [config]=\"asForm(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block h-full\"\n ></mn-form-body>\n }\n\n @if (config.kind === ModalKind.CONFIRMATION) {\n <mn-confirmation-body\n [config]=\"asConfirmation(config)\"\n [modalRef]=\"$any(modalRef)\"\n ></mn-confirmation-body>\n }\n\n @if (config.kind === ModalKind.CUSTOM) {\n <mn-custom-body-host\n [config]=\"asCustom(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block pb-6\"\n ></mn-custom-body-host>\n }\n </div>\n }\n\n <!-- Custom Footer Actions (not for wizard modals, they render their own) -->\n @if (hasCustomFooterActions && config.kind !== ModalKind.WIZARD) {\n <div class=\"flex gap-3 px-6 pt-4 pb-6 border-t border-base-300\">\n <mn-footer-actions\n [actions]=\"config.footerActions || []\"\n [showIcons]=\"config.showActionIcons !== false\"\n (actionClick)=\"onFooterAction($event)\"\n ></mn-footer-actions>\n </div>\n }\n</ng-template>\n",
|
|
2033
|
+
styles: [":host{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;transition:transform .3s ease-in-out,filter .3s ease-in-out,opacity .3s ease-in-out}:host(.mobile-sheet){align-items:flex-end}:host(.is-stacked){transform:scale(.96) translateY(-1rem);filter:brightness(.9) blur(1px);pointer-events:none;opacity:.8}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes slideIn{0%{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}@keyframes zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes slideOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(1rem)}}@keyframes zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}:host(.anim-slide) .modal-container{animation:slideIn .2s ease-in-out}:host(.anim-fade) .modal-container{animation:fadeIn .2s ease-in-out}:host(.anim-zoom) .modal-container{animation:zoomIn .2s ease-in-out}:host(.closing) .modal-backdrop{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-slide .modal-container{animation:slideOut .15s ease-in-out forwards}:host(.closing).anim-fade .modal-container{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-zoom .modal-container{animation:zoomOut .15s ease-in-out forwards}@media(prefers-reduced-motion:reduce){:host,:host .modal-backdrop,:host .modal-container{animation-duration:.01ms!important;animation-delay:0ms!important;transition-duration:.01ms!important}}\n"],
|
|
2034
|
+
dependencies: [
|
|
2035
|
+
{
|
|
2036
|
+
kind: "ngmodule",
|
|
2037
|
+
type: CommonModule
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
kind: "directive",
|
|
2041
|
+
type: i1.NgClass,
|
|
2042
|
+
selector: "[ngClass]",
|
|
2043
|
+
inputs: ["class", "ngClass"]
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
kind: "directive",
|
|
2047
|
+
type: i1.NgTemplateOutlet,
|
|
2048
|
+
selector: "[ngTemplateOutlet]",
|
|
2049
|
+
inputs: [
|
|
2050
|
+
"ngTemplateOutletContext",
|
|
2051
|
+
"ngTemplateOutlet",
|
|
2052
|
+
"ngTemplateOutletInjector"
|
|
2053
|
+
]
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
kind: "component",
|
|
2057
|
+
type: MnWizardBodyComponent,
|
|
2058
|
+
selector: "mn-wizard-body",
|
|
2059
|
+
inputs: ["config", "modalRef"]
|
|
2060
|
+
},
|
|
2061
|
+
{
|
|
2062
|
+
kind: "component",
|
|
2063
|
+
type: MnFormBodyComponent,
|
|
2064
|
+
selector: "mn-form-body",
|
|
2065
|
+
inputs: [
|
|
2066
|
+
"config",
|
|
2067
|
+
"modalRef",
|
|
2068
|
+
"hideFooter",
|
|
2069
|
+
"hideCustomBody"
|
|
2070
|
+
],
|
|
2071
|
+
outputs: ["formStatusChange"]
|
|
2072
|
+
},
|
|
2073
|
+
{
|
|
2074
|
+
kind: "component",
|
|
2075
|
+
type: MnConfirmationBodyComponent,
|
|
2076
|
+
selector: "mn-confirmation-body",
|
|
2077
|
+
inputs: ["config", "modalRef"]
|
|
2078
|
+
},
|
|
2079
|
+
{
|
|
2080
|
+
kind: "component",
|
|
2081
|
+
type: MnCustomBodyHostComponent,
|
|
2082
|
+
selector: "mn-custom-body-host",
|
|
2083
|
+
inputs: ["config", "modalRef"]
|
|
2084
|
+
},
|
|
2085
|
+
{
|
|
2086
|
+
kind: "component",
|
|
2087
|
+
type: MnFooterActionsComponent,
|
|
2088
|
+
selector: "mn-footer-actions",
|
|
2089
|
+
inputs: ["actions", "showIcons"],
|
|
2090
|
+
outputs: ["actionClick"]
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
kind: "component",
|
|
2094
|
+
type: MnButton,
|
|
2095
|
+
selector: "button[mnButton], a[mnButton]",
|
|
2096
|
+
inputs: ["data"]
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
kind: "component",
|
|
2100
|
+
type: MnBottomSheet,
|
|
2101
|
+
selector: "mn-bottom-sheet",
|
|
2102
|
+
inputs: [
|
|
2103
|
+
"showBackdrop",
|
|
2104
|
+
"showGrabber",
|
|
2105
|
+
"dismissible",
|
|
2106
|
+
"minHeightPx",
|
|
2107
|
+
"maxHeightVh",
|
|
2108
|
+
"containerClass",
|
|
2109
|
+
"ariaLabel",
|
|
2110
|
+
"ariaLabelledby",
|
|
2111
|
+
"growWithKeyboard",
|
|
2112
|
+
"dismissGuard"
|
|
2113
|
+
],
|
|
2114
|
+
outputs: ["dismiss"]
|
|
2115
|
+
},
|
|
2116
|
+
{
|
|
2117
|
+
kind: "component",
|
|
2118
|
+
type: LucideDynamicIcon,
|
|
2119
|
+
selector: "svg[lucideIcon]",
|
|
2120
|
+
inputs: ["lucideIcon"]
|
|
2121
|
+
}
|
|
2122
|
+
]
|
|
2123
|
+
});
|
|
2124
|
+
};
|
|
2125
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2126
|
+
minVersion: "12.0.0",
|
|
2127
|
+
version: "22.2.2",
|
|
2128
|
+
ngImport: i0,
|
|
2129
|
+
type: MnModalShellComponent,
|
|
2130
|
+
decorators: [{
|
|
2131
|
+
type: Component,
|
|
2132
|
+
args: [{
|
|
2133
|
+
selector: "mn-modal-shell",
|
|
2134
|
+
standalone: true,
|
|
2135
|
+
imports: [
|
|
2136
|
+
CommonModule,
|
|
2137
|
+
MnWizardBodyComponent,
|
|
2138
|
+
MnFormBodyComponent,
|
|
2139
|
+
MnConfirmationBodyComponent,
|
|
2140
|
+
MnCustomBodyHostComponent,
|
|
2141
|
+
MnFooterActionsComponent,
|
|
2142
|
+
MnButton,
|
|
2143
|
+
MnBottomSheet,
|
|
2144
|
+
LucideDynamicIcon
|
|
2145
|
+
],
|
|
2146
|
+
providers: [{
|
|
2147
|
+
provide: MN_IN_MODAL,
|
|
2148
|
+
useValue: true
|
|
2149
|
+
}],
|
|
2150
|
+
template: "@if (showBackdrop) {\n <!-- The backdrop is a visual overlay — keyboard dismiss is handled at component level via Escape key -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <div class=\"modal-backdrop absolute inset-0 bg-black/50 animate-[fadeIn_0.2s_ease-in-out]\" (click)=\"onBackdropClick()\"></div>\n}\n\n@if (showMobileSheet) {\n <!-- Mobile: the shared bottom sheet owns the anchoring, grabber, swipe/flick-to-dismiss\n and slide animation. The shell keeps its own backdrop (so the sheet renders none),\n and its close animation delegates to the sheet's startClosing(). `modal-container`\n is kept as a class hook so the host app's keyboard-lift CSS still matches. -->\n <mn-bottom-sheet\n (dismiss)=\"onSheetDismiss()\"\n [ariaLabelledby]=\"config.title ? 'mn-modal-title' : undefined\"\n [containerClass]=\"'modal-container'\"\n [dismissGuard]=\"sheetDismissGuard\"\n [dismissible]=\"canClose\"\n [growWithKeyboard]=\"true\"\n [maxHeightVh]=\"92\"\n [showBackdrop]=\"false\"\n >\n <ng-container [ngTemplateOutlet]=\"modalBody\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <!--\n Desktop centered dialog. The container deliberately does NOT stop click propagation.\n The backdrop is a *sibling* element (absolutely positioned behind this one), never an\n ancestor, so clicks in here can't reach `onBackdropClick()` anyway. Swallowing them\n instead broke every \"click outside me\" handler inside a modal.\n -->\n <div\n [attr.aria-describedby]=\"config.description ? 'mn-modal-description' : null\"\n [attr.aria-labelledby]=\"config.title ? 'mn-modal-title' : null\"\n [ngClass]=\"containerSizeClass\"\n [style.height]=\"containerHeightStyle\"\n aria-modal=\"true\"\n class=\"modal-container relative bg-base-100 rounded-lg shadow-xl max-h-[90vh] max-w-[calc(100vw-2rem)] overflow-hidden flex flex-col\"\n role=\"dialog\"\n tabindex=\"-1\"\n >\n <ng-container [ngTemplateOutlet]=\"modalBody\"></ng-container>\n </div>\n}\n\n<ng-template #modalBody>\n <div [class.border-b]=\"config.kind !== ModalKind.WIZARD\"\n [class.border-base-300]=\"config.kind !== ModalKind.WIZARD\"\n class=\"flex items-center justify-between p-6\">\n <div class=\"flex flex-col gap-0.5\">\n @if (config.title) {\n <!-- On small screens the wizard's step labels (under the progress circles) are hidden,\n so surface the active step name here as \"Title - Step\" instead. -->\n <h2 class=\"m-0 text-xl font-semibold text-base-content\"\n id=\"mn-modal-title\">{{ config.title }}@if (config.kind === ModalKind.WIZARD && wizardStepTitle()) {\n <span class=\"sm:hidden font-normal text-base-content/60\"> - {{ wizardStepTitle() }}</span>\n }</h2>\n }\n @if (config.subtitle) {\n <p class=\"m-0 text-sm text-base-content/60 font-normal\">{{ config.subtitle }}</p>\n }\n </div>\n @if (showCloseButton) {\n <div [class]=\"showMobileSheet ? 'hidden sm:flex' : ''\">\n <button\n mnButton\n [data]=\"{ size: 'sm', variant: 'text', color: 'gray', hover: true, borderRadius: 'md' }\"\n type=\"button\"\n class=\"w-8 h-8\"\n (click)=\"onCloseButtonClick()\"\n [attr.aria-label]=\"closeModalLabel\"\n >\n <svg [lucideIcon]=\"icons.X\" [size]=\"18\"></svg>\n </button>\n </div>\n }\n </div>\n @if (config.description) {\n <p class=\"m-0 px-6 text-sm text-base-content/60 leading-relaxed\" id=\"mn-modal-description\">{{ config.description }}</p>\n }\n\n @if (config.kind === ModalKind.WIZARD) {\n <!-- Wizard manages its own internal scrolling so the steps header and footer\n stay fixed while only the step body scrolls. No padding/scroll here. -->\n <div class=\"flex-auto min-h-0 overflow-hidden flex flex-col\">\n <mn-wizard-body\n [config]=\"asWizard(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"flex-auto min-h-0 flex flex-col\"\n ></mn-wizard-body>\n </div>\n } @else {\n <div class=\"flex-1 overflow-y-auto px-6 pt-6\">\n @if (config.kind === ModalKind.FORM) {\n <mn-form-body\n [config]=\"asForm(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block h-full\"\n ></mn-form-body>\n }\n\n @if (config.kind === ModalKind.CONFIRMATION) {\n <mn-confirmation-body\n [config]=\"asConfirmation(config)\"\n [modalRef]=\"$any(modalRef)\"\n ></mn-confirmation-body>\n }\n\n @if (config.kind === ModalKind.CUSTOM) {\n <mn-custom-body-host\n [config]=\"asCustom(config)\"\n [modalRef]=\"$any(modalRef)\"\n class=\"block pb-6\"\n ></mn-custom-body-host>\n }\n </div>\n }\n\n <!-- Custom Footer Actions (not for wizard modals, they render their own) -->\n @if (hasCustomFooterActions && config.kind !== ModalKind.WIZARD) {\n <div class=\"flex gap-3 px-6 pt-4 pb-6 border-t border-base-300\">\n <mn-footer-actions\n [actions]=\"config.footerActions || []\"\n [showIcons]=\"config.showActionIcons !== false\"\n (actionClick)=\"onFooterAction($event)\"\n ></mn-footer-actions>\n </div>\n }\n</ng-template>\n",
|
|
2151
|
+
styles: [":host{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;transition:transform .3s ease-in-out,filter .3s ease-in-out,opacity .3s ease-in-out}:host(.mobile-sheet){align-items:flex-end}:host(.is-stacked){transform:scale(.96) translateY(-1rem);filter:brightness(.9) blur(1px);pointer-events:none;opacity:.8}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes slideIn{0%{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}@keyframes zoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes slideOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(1rem)}}@keyframes zoomOut{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}:host(.anim-slide) .modal-container{animation:slideIn .2s ease-in-out}:host(.anim-fade) .modal-container{animation:fadeIn .2s ease-in-out}:host(.anim-zoom) .modal-container{animation:zoomIn .2s ease-in-out}:host(.closing) .modal-backdrop{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-slide .modal-container{animation:slideOut .15s ease-in-out forwards}:host(.closing).anim-fade .modal-container{animation:fadeOut .15s ease-in-out forwards}:host(.closing).anim-zoom .modal-container{animation:zoomOut .15s ease-in-out forwards}@media(prefers-reduced-motion:reduce){:host,:host .modal-backdrop,:host .modal-container{animation-duration:.01ms!important;animation-delay:0ms!important;transition-duration:.01ms!important}}\n"]
|
|
2152
|
+
}]
|
|
2153
|
+
}],
|
|
2154
|
+
propDecorators: {
|
|
2155
|
+
config: [{ type: Input }],
|
|
2156
|
+
modalRef: [{ type: Input }],
|
|
2157
|
+
wizardBody: [{
|
|
2158
|
+
type: i0.ViewChild,
|
|
2159
|
+
args: [i0.forwardRef(() => MnWizardBodyComponent), { isSignal: true }]
|
|
2160
|
+
}],
|
|
2161
|
+
bottomSheet: [{
|
|
2162
|
+
type: i0.ViewChild,
|
|
2163
|
+
args: [i0.forwardRef(() => MnBottomSheet), { isSignal: true }]
|
|
2164
|
+
}],
|
|
2165
|
+
hostClasses: [{
|
|
2166
|
+
type: HostBinding,
|
|
2167
|
+
args: ["class"]
|
|
2168
|
+
}],
|
|
2169
|
+
onEscapeKey: [{
|
|
2170
|
+
type: HostListener,
|
|
2171
|
+
args: ["document:keydown.escape", ["$event"]]
|
|
2172
|
+
}]
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2122
2175
|
export { MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnFormBodyComponent, MnModalShellComponent, MnWizardBodyComponent };
|
|
2123
|
-
|
|
2176
|
+
|
|
2177
|
+
//# sourceMappingURL=mn-angular-lib-modal-ui.mjs.map
|