@nanoporetech-digital/components 2.13.0 → 2.13.2
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/CHANGELOG.md +19 -0
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/nano-field-validator.cjs.entry.js +22 -12
- package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
- package/dist/collection/components/accordion/accordion.js +1 -1
- package/dist/collection/components/alert/alert.helpers.js +2 -2
- package/dist/collection/components/alert/alert.helpers.js.map +1 -1
- package/dist/collection/components/alert/alert.js +1 -1
- package/dist/collection/components/algolia/algolia-filter.js +2 -2
- package/dist/collection/components/algolia/algolia-input.js +5 -5
- package/dist/collection/components/algolia/algolia-results.js +1 -1
- package/dist/collection/components/algolia/algolia.js +6 -6
- package/dist/collection/components/checkbox/checkbox-group.js +2 -2
- package/dist/collection/components/checkbox/checkbox.js +3 -3
- package/dist/collection/components/datalist/datalist.js +1 -1
- package/dist/collection/components/date-input/date-input.js +8 -8
- package/dist/collection/components/date-picker/date-picker.js +5 -5
- package/dist/collection/components/details/details.js +1 -1
- package/dist/collection/components/dialog/dialog.js +1 -1
- package/dist/collection/components/dropdown/dropdown.js +1 -1
- package/dist/collection/components/field-validator/field-validator.js +28 -18
- package/dist/collection/components/field-validator/field-validator.js.map +1 -1
- package/dist/collection/components/file-upload/file-upload.js +4 -4
- package/dist/collection/components/global-nav/global-nav.js +4 -4
- package/dist/collection/components/grid/grid-item.js +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/input/input.js +5 -5
- package/dist/collection/components/nav-item/nav-item.js +4 -4
- package/dist/collection/components/range/range.js +4 -4
- package/dist/collection/components/resize-observe/resize-observe.js +1 -1
- package/dist/collection/components/select/select.js +7 -7
- package/dist/collection/components/slides/slides.js +7 -7
- package/dist/collection/components/tabs/tab-group.js +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/nano-field-validator.js +22 -12
- package/dist/components/nano-field-validator.js.map +1 -1
- package/dist/custom-elements/index.js +24 -14
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/nano-field-validator.entry.js +22 -12
- package/dist/esm/nano-field-validator.entry.js.map +1 -1
- package/dist/esm-es5/index.js.map +1 -1
- package/dist/esm-es5/nano-field-validator.entry.js +1 -1
- package/dist/esm-es5/nano-field-validator.entry.js.map +1 -1
- package/dist/nano-components/index.esm.js.map +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/p-3f5de726.system.entry.js +5 -0
- package/dist/nano-components/p-3f5de726.system.entry.js.map +1 -0
- package/dist/nano-components/p-53957ec6.system.js +1 -1
- package/dist/nano-components/p-db02ad4c.entry.js +5 -0
- package/dist/nano-components/p-db02ad4c.entry.js.map +1 -0
- package/dist/nano-components/{p-0d699368.system.js → p-f62a40ea.system.js} +1 -1
- package/dist/nano-components/{p-0d699368.system.js.map → p-f62a40ea.system.js.map} +1 -1
- package/dist/types/components/alert/alert.helpers.d.ts +2 -2
- package/dist/types/components/field-validator/field-validator.d.ts +7 -0
- package/docs-json.json +1 -1
- package/package.json +2 -2
- package/dist/nano-components/p-18863670.system.entry.js +0 -5
- package/dist/nano-components/p-18863670.system.entry.js.map +0 -1
- package/dist/nano-components/p-7f051c20.entry.js +0 -5
- package/dist/nano-components/p-7f051c20.entry.js.map +0 -1
@@ -722,7 +722,7 @@ export class FileUpload {
|
|
722
722
|
"references": {
|
723
723
|
"FileWithUrl": {
|
724
724
|
"location": "import",
|
725
|
-
"path": "/builds/
|
725
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
726
726
|
}
|
727
727
|
}
|
728
728
|
},
|
@@ -780,7 +780,7 @@ export class FileUpload {
|
|
780
780
|
"references": {
|
781
781
|
"FileInputChangeEventDetail": {
|
782
782
|
"location": "import",
|
783
|
-
"path": "/builds/
|
783
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
784
784
|
}
|
785
785
|
}
|
786
786
|
}
|
@@ -833,7 +833,7 @@ export class FileUpload {
|
|
833
833
|
"references": {
|
834
834
|
"ControlValidityEventDetail": {
|
835
835
|
"location": "import",
|
836
|
-
"path": "/builds/
|
836
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
837
837
|
}
|
838
838
|
}
|
839
839
|
}
|
@@ -855,7 +855,7 @@ export class FileUpload {
|
|
855
855
|
},
|
856
856
|
"ControlValidity": {
|
857
857
|
"location": "import",
|
858
|
-
"path": "/builds/
|
858
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
859
859
|
}
|
860
860
|
},
|
861
861
|
"return": "Promise<ControlValidity>"
|
@@ -1404,7 +1404,7 @@ export class GlobalNav {
|
|
1404
1404
|
},
|
1405
1405
|
"SearchIndex": {
|
1406
1406
|
"location": "import",
|
1407
|
-
"path": "/builds/
|
1407
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1408
1408
|
}
|
1409
1409
|
}
|
1410
1410
|
},
|
@@ -1653,7 +1653,7 @@ export class GlobalNav {
|
|
1653
1653
|
"references": {
|
1654
1654
|
"AloliaSearchResultDetail": {
|
1655
1655
|
"location": "import",
|
1656
|
-
"path": "/builds/
|
1656
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1657
1657
|
}
|
1658
1658
|
}
|
1659
1659
|
}
|
@@ -1673,7 +1673,7 @@ export class GlobalNav {
|
|
1673
1673
|
"references": {
|
1674
1674
|
"AlgoliaNetworkError": {
|
1675
1675
|
"location": "import",
|
1676
|
-
"path": "/builds/
|
1676
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1677
1677
|
}
|
1678
1678
|
}
|
1679
1679
|
}
|
@@ -1693,7 +1693,7 @@ export class GlobalNav {
|
|
1693
1693
|
"references": {
|
1694
1694
|
"AloliaSearchResultDetail": {
|
1695
1695
|
"location": "import",
|
1696
|
-
"path": "/builds/
|
1696
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1697
1697
|
}
|
1698
1698
|
}
|
1699
1699
|
}
|
@@ -124,7 +124,7 @@ export class GridItem {
|
|
124
124
|
},
|
125
125
|
"GridSizes": {
|
126
126
|
"location": "import",
|
127
|
-
"path": "/builds/
|
127
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
128
128
|
}
|
129
129
|
},
|
130
130
|
"return": "Promise<void>"
|
@@ -116,7 +116,7 @@ export class Icon {
|
|
116
116
|
"references": {
|
117
117
|
"Color": {
|
118
118
|
"location": "import",
|
119
|
-
"path": "/builds/
|
119
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
120
120
|
}
|
121
121
|
}
|
122
122
|
},
|
@@ -474,7 +474,7 @@ export class Input {
|
|
474
474
|
"references": {
|
475
475
|
"Color": {
|
476
476
|
"location": "import",
|
477
|
-
"path": "/builds/
|
477
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
478
478
|
}
|
479
479
|
}
|
480
480
|
},
|
@@ -1045,7 +1045,7 @@ export class Input {
|
|
1045
1045
|
"references": {
|
1046
1046
|
"TextFieldTypes": {
|
1047
1047
|
"location": "import",
|
1048
|
-
"path": "/builds/
|
1048
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1049
1049
|
}
|
1050
1050
|
}
|
1051
1051
|
},
|
@@ -1205,7 +1205,7 @@ export class Input {
|
|
1205
1205
|
"references": {
|
1206
1206
|
"InputChangeEventDetail": {
|
1207
1207
|
"location": "import",
|
1208
|
-
"path": "/builds/
|
1208
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1209
1209
|
}
|
1210
1210
|
}
|
1211
1211
|
}
|
@@ -1294,7 +1294,7 @@ export class Input {
|
|
1294
1294
|
"references": {
|
1295
1295
|
"ControlValidityEventDetail": {
|
1296
1296
|
"location": "import",
|
1297
|
-
"path": "/builds/
|
1297
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1298
1298
|
}
|
1299
1299
|
}
|
1300
1300
|
}
|
@@ -1316,7 +1316,7 @@ export class Input {
|
|
1316
1316
|
},
|
1317
1317
|
"ControlValidity": {
|
1318
1318
|
"location": "import",
|
1319
|
-
"path": "/builds/
|
1319
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1320
1320
|
}
|
1321
1321
|
},
|
1322
1322
|
"return": "Promise<ControlValidity>"
|
@@ -516,7 +516,7 @@ export class NavItem {
|
|
516
516
|
"references": {
|
517
517
|
"NavItemEventDetail": {
|
518
518
|
"location": "import",
|
519
|
-
"path": "/builds/
|
519
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
520
520
|
}
|
521
521
|
}
|
522
522
|
}
|
@@ -536,7 +536,7 @@ export class NavItem {
|
|
536
536
|
"references": {
|
537
537
|
"NavItemEventDetail": {
|
538
538
|
"location": "import",
|
539
|
-
"path": "/builds/
|
539
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
540
540
|
}
|
541
541
|
}
|
542
542
|
}
|
@@ -556,7 +556,7 @@ export class NavItem {
|
|
556
556
|
"references": {
|
557
557
|
"NavItemEventDetail": {
|
558
558
|
"location": "import",
|
559
|
-
"path": "/builds/
|
559
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
560
560
|
}
|
561
561
|
}
|
562
562
|
}
|
@@ -576,7 +576,7 @@ export class NavItem {
|
|
576
576
|
"references": {
|
577
577
|
"NavItemEventDetail": {
|
578
578
|
"location": "import",
|
579
|
-
"path": "/builds/
|
579
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
580
580
|
}
|
581
581
|
}
|
582
582
|
}
|
@@ -370,7 +370,7 @@ export class Range {
|
|
370
370
|
"references": {
|
371
371
|
"Color": {
|
372
372
|
"location": "import",
|
373
|
-
"path": "/builds/
|
373
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
374
374
|
}
|
375
375
|
}
|
376
376
|
},
|
@@ -594,7 +594,7 @@ export class Range {
|
|
594
594
|
"references": {
|
595
595
|
"RangeValue": {
|
596
596
|
"location": "import",
|
597
|
-
"path": "/builds/
|
597
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
598
598
|
}
|
599
599
|
}
|
600
600
|
},
|
@@ -632,7 +632,7 @@ export class Range {
|
|
632
632
|
"references": {
|
633
633
|
"RangeChangeEventDetail": {
|
634
634
|
"location": "import",
|
635
|
-
"path": "/builds/
|
635
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
636
636
|
}
|
637
637
|
}
|
638
638
|
}
|
@@ -655,7 +655,7 @@ export class Range {
|
|
655
655
|
"references": {
|
656
656
|
"StyleEventDetail": {
|
657
657
|
"location": "import",
|
658
|
-
"path": "/builds/
|
658
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
659
659
|
}
|
660
660
|
}
|
661
661
|
}
|
@@ -176,7 +176,7 @@ export class ResizeObserve {
|
|
176
176
|
"references": {
|
177
177
|
"ResizeStateChangeEventDetail": {
|
178
178
|
"location": "import",
|
179
|
-
"path": "/builds/
|
179
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
180
180
|
}
|
181
181
|
}
|
182
182
|
}
|
@@ -685,7 +685,7 @@ export class Select {
|
|
685
685
|
"references": {
|
686
686
|
"Color": {
|
687
687
|
"location": "import",
|
688
|
-
"path": "/builds/
|
688
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
689
689
|
}
|
690
690
|
}
|
691
691
|
},
|
@@ -1066,7 +1066,7 @@ export class Select {
|
|
1066
1066
|
},
|
1067
1067
|
"OptionInterface": {
|
1068
1068
|
"location": "import",
|
1069
|
-
"path": "/builds/
|
1069
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/components/option/option-interface.ts"
|
1070
1070
|
}
|
1071
1071
|
}
|
1072
1072
|
},
|
@@ -1151,7 +1151,7 @@ export class Select {
|
|
1151
1151
|
},
|
1152
1152
|
"Dropdown": {
|
1153
1153
|
"location": "import",
|
1154
|
-
"path": "/builds/
|
1154
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/components/dropdown/dropdown.tsx"
|
1155
1155
|
}
|
1156
1156
|
}
|
1157
1157
|
},
|
@@ -1194,7 +1194,7 @@ export class Select {
|
|
1194
1194
|
"references": {
|
1195
1195
|
"SelectChangeEventDetail": {
|
1196
1196
|
"location": "import",
|
1197
|
-
"path": "/builds/
|
1197
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1198
1198
|
}
|
1199
1199
|
}
|
1200
1200
|
}
|
@@ -1280,7 +1280,7 @@ export class Select {
|
|
1280
1280
|
"references": {
|
1281
1281
|
"InputChangeEventDetail": {
|
1282
1282
|
"location": "import",
|
1283
|
-
"path": "/builds/
|
1283
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1284
1284
|
}
|
1285
1285
|
}
|
1286
1286
|
}
|
@@ -1303,7 +1303,7 @@ export class Select {
|
|
1303
1303
|
"references": {
|
1304
1304
|
"ControlValidityEventDetail": {
|
1305
1305
|
"location": "import",
|
1306
|
-
"path": "/builds/
|
1306
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1307
1307
|
}
|
1308
1308
|
}
|
1309
1309
|
}
|
@@ -1325,7 +1325,7 @@ export class Select {
|
|
1325
1325
|
},
|
1326
1326
|
"ControlValidity": {
|
1327
1327
|
"location": "import",
|
1328
|
-
"path": "/builds/
|
1328
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1329
1329
|
}
|
1330
1330
|
},
|
1331
1331
|
"return": "Promise<ControlValidity>"
|
@@ -452,7 +452,7 @@ export class Slides {
|
|
452
452
|
"references": {
|
453
453
|
"FlickityOptions": {
|
454
454
|
"location": "import",
|
455
|
-
"path": "/builds/
|
455
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
456
456
|
}
|
457
457
|
}
|
458
458
|
},
|
@@ -555,7 +555,7 @@ export class Slides {
|
|
555
555
|
"references": {
|
556
556
|
"SlideAnimation": {
|
557
557
|
"location": "import",
|
558
|
-
"path": "/builds/
|
558
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
559
559
|
}
|
560
560
|
}
|
561
561
|
},
|
@@ -746,7 +746,7 @@ export class Slides {
|
|
746
746
|
"references": {
|
747
747
|
"DragEvent": {
|
748
748
|
"location": "import",
|
749
|
-
"path": "/builds/
|
749
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
750
750
|
}
|
751
751
|
}
|
752
752
|
}
|
@@ -766,7 +766,7 @@ export class Slides {
|
|
766
766
|
"references": {
|
767
767
|
"DragEvent": {
|
768
768
|
"location": "import",
|
769
|
-
"path": "/builds/
|
769
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
770
770
|
}
|
771
771
|
}
|
772
772
|
}
|
@@ -786,7 +786,7 @@ export class Slides {
|
|
786
786
|
"references": {
|
787
787
|
"DragEvent": {
|
788
788
|
"location": "import",
|
789
|
-
"path": "/builds/
|
789
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
790
790
|
}
|
791
791
|
}
|
792
792
|
}
|
@@ -806,7 +806,7 @@ export class Slides {
|
|
806
806
|
"references": {
|
807
807
|
"DragEvent": {
|
808
808
|
"location": "import",
|
809
|
-
"path": "/builds/
|
809
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
810
810
|
}
|
811
811
|
}
|
812
812
|
}
|
@@ -1113,7 +1113,7 @@ export class Slides {
|
|
1113
1113
|
},
|
1114
1114
|
"Flickity": {
|
1115
1115
|
"location": "import",
|
1116
|
-
"path": "/builds/
|
1116
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
1117
1117
|
}
|
1118
1118
|
},
|
1119
1119
|
"return": "Promise<Flickity>"
|
@@ -504,7 +504,7 @@ export class TabGroup {
|
|
504
504
|
"references": {
|
505
505
|
"Color": {
|
506
506
|
"location": "import",
|
507
|
-
"path": "/builds/
|
507
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
508
508
|
}
|
509
509
|
}
|
510
510
|
},
|
@@ -547,7 +547,7 @@ export class TabGroup {
|
|
547
547
|
"references": {
|
548
548
|
"StorageMethods": {
|
549
549
|
"location": "import",
|
550
|
-
"path": "/builds/
|
550
|
+
"path": "/builds/v4bvxH77/0/Digital/nano-components/packages/components/src/utils/store/component-store.ts"
|
551
551
|
}
|
552
552
|
}
|
553
553
|
},
|
package/dist/components/index.js
CHANGED
@@ -53,10 +53,10 @@ async function nanoShowToast(message, position = 'tr', icon, alertOptions, butto
|
|
53
53
|
/**
|
54
54
|
* `nano-alert` helper to create alert notifications imperatively.
|
55
55
|
* @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`
|
56
|
-
* @param buttons
|
56
|
+
* @param buttons
|
57
57
|
* @param icon - name for the `nano-icon`
|
58
58
|
* @param label - descriptive label for assitive technology
|
59
|
-
* @param alertOptions
|
59
|
+
* @param alertOptions
|
60
60
|
* @returns `Promise<void>`
|
61
61
|
*/
|
62
62
|
function nanoShowAlert(message, buttons = [], label, icon = 'light/info-circle', alertOptions = {}) {
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"index.js","mappings":";;;;;;;;;;AAeA,MAAM,YAAY,GAAG,CACnB,OAAe,EACf,UAAmC,EAAE;EAErC,OAAO,GAAG,OAAO;MAEb,OAAO,CAAC,MAAM;MACV,OAAO;OACJ,GAAG,CACF,CAAC,GAAG,EAAE,CAAC,KACL,qBAAqB,CAAC,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,GAAG,CAAC,OAAO,WAAW,CAChG;OACA,IAAI,CAAC,EAAE,CAAC;MACX,EACN,EAAE,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACrB,KAA2B,EAC3B,UAAmC,EAAE;EAErC,IAAI,OAAO,CAAC,MAAM,EAAE;IAClB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAC7D,CAAC,GAAgB;MACf,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAC3B,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;MACF,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE;QAChC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;OACjD;KACF,CACF,CAAC;GACH;AACH,CAAC,CAAC;AAEF;;;;;;;;AAQO,eAAe,aAAa,CACjC,OAAe,EACf,WAA+B,IAAI,EACnC,IAAyB,EACzB,YAAqC,EACrC,UAAmC,EAAE;EAErC,MAAM,IAAI,mBACR,KAAK,EAAE,SAAS,EAChB,QAAQ,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C,MAAM,CAAC,SAAS,CAAC;MAAsB,OAAO,KAAK,CAAC;IACzD,QAAQ,CAAC;IAGT,OAAO,IAAI,CAAC;GACb,CAAC;EAEF;IACE,IAAI,SAAS,GAAG;MACd,IAAI,UAAU,EAAE,EAAE;QAChB,SAAS,CAAC;QACV,SAAS,GAAG,IAAI,CAAC;OAClB;KACF,CAAC,CAAC;IAEH;MACE,SAAS,EAAE,KAAK;MAChB,OAAO,EAAE,KAAK;MACd,UAAU,EAAE;KACb,CAAC,CAAC;GACJ;;;;;","names":[],"sources":["./src/components/alert/alert.helpers.ts","./src/components/dialog/dialog.helpers.ts","./node_modules/focus-options-polyfill/index.js","./src/global/script/global.ts"],"sourcesContent":["import { Color, AlertToastPosition } from '../../interface';\nimport { raf } from '../../utils';\n\ninterface ImperativeAlertOptions {\n color?: Color;\n duration?: number;\n closable?: boolean;\n}\n\ninterface ImperativeAlertButton {\n classes: string;\n content: string;\n handler?: (e: MouseEvent) => void;\n}\n\nconst alertContent = (\n message: string,\n buttons: ImperativeAlertButton[] = []\n) => {\n return `${message}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`;\n};\n\nconst addBtnHandlers = (\n alert: HTMLNanoAlertElement,\n buttons: ImperativeAlertButton[] = []\n) => {\n if (buttons.length) {\n Array.from(alert.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n};\n\n/**\n * `nano-alert` helper to create toast notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param position - the position of the toast. Options are 'tr', 'tl', 'bl' & 'br'\n * @param icon - name for the `nano-icon`\n * @param alertOptions - { color: Color, duration: number, closable: boolean }\n * @returns `Promise<void>`\n */\nexport async function nanoShowToast(\n message: string,\n position: AlertToastPosition = 'tr',\n icon?: string | undefined,\n alertOptions?: ImperativeAlertOptions,\n buttons: ImperativeAlertButton[] = []\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: 3000,\n closable: true,\n ...alertOptions,\n };\n icon = icon || 'light/info-circle';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement('nano-alert'),\n {\n ...opts,\n open: false,\n innerHTML: `\n <nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n raf(async (_) => {\n await alert.toast(position);\n resolve(alert);\n });\n });\n}\n\n/**\n * `nano-alert` helper to create alert notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param icon - name for the `nano-icon`\n * @param label - descriptive label for assitive technology\n * @param alertOptions - { color: Color, duration: number, closable: boolean }\n * @returns `Promise<void>`\n */\nexport function nanoShowAlert(\n message: string,\n buttons: ImperativeAlertButton[] = [],\n label: string,\n icon: string | undefined = 'light/info-circle',\n alertOptions: ImperativeAlertOptions = {}\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: Infinity,\n closable: false,\n ...alertOptions,\n };\n icon = icon || 'light/info-circle';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement('nano-alert'),\n {\n ...opts,\n open: false,\n innerHTML: `\n ${icon ? `<nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>` : ''}\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n setTimeout(async (_) => {\n await alert.alert(label);\n resolve(alert);\n }, 100);\n });\n}\n","interface ImperativeDialogOptions {\n noUserDismiss: boolean;\n noHeader?: boolean;\n noFooter?: boolean;\n label: string;\n}\n/**\n * `nano-dialog` helper to create dialog modals imperatively.\n * @param body - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param dialogOptions - { noUserDismiss: boolean, noHeader?: boolean, noFooter?: boolean, label: string }\n * @returns `Promise<void>`\n */\nexport function nanoCreateDialog(\n body: string,\n buttons: { classes: string; content: string; handler: () => {} }[] = [],\n dialogOptions?: ImperativeDialogOptions\n) {\n const opts: ImperativeDialogOptions = {\n noUserDismiss: false,\n label: 'Dialog',\n ...dialogOptions,\n };\n const dialog: HTMLNanoDialogElement = Object.assign(\n document.createElement('nano-dialog'),\n {\n ...opts,\n open: false,\n innerHTML: `\n ${body}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`,\n }\n );\n\n if (buttons.length) {\n Array.from(dialog.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n\n document.body.appendChild(dialog);\n return dialog;\n}\n","// focus - focusOptions - preventScroll polyfill\n(function() {\n if (\n typeof window === \"undefined\" ||\n typeof document === \"undefined\" ||\n typeof HTMLElement === \"undefined\"\n ) {\n return;\n }\n\n var supportsPreventScrollOption = false;\n try {\n var focusElem = document.createElement(\"div\");\n focusElem.addEventListener(\n \"focus\",\n function(event) {\n event.preventDefault();\n event.stopPropagation();\n },\n true\n );\n focusElem.focus(\n Object.defineProperty({}, \"preventScroll\", {\n get: function() {\n // Edge v18 gives a false positive for supporting inputs\n if (\n navigator &&\n typeof navigator.userAgent !== 'undefined' &&\n navigator.userAgent &&\n navigator.userAgent.match(/Edge\\/1[7-8]/)) {\n return supportsPreventScrollOption = false\n }\n\n supportsPreventScrollOption = true;\n }\n })\n );\n } catch (e) {}\n\n if (\n HTMLElement.prototype.nativeFocus === undefined &&\n !supportsPreventScrollOption\n ) {\n HTMLElement.prototype.nativeFocus = HTMLElement.prototype.focus;\n\n var calcScrollableElements = function(element) {\n var parent = element.parentNode;\n var scrollableElements = [];\n var rootScrollingElement =\n document.scrollingElement || document.documentElement;\n\n while (parent && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push([\n parent,\n parent.scrollTop,\n parent.scrollLeft\n ]);\n }\n parent = parent.parentNode;\n }\n parent = rootScrollingElement;\n scrollableElements.push([parent, parent.scrollTop, parent.scrollLeft]);\n\n return scrollableElements;\n };\n\n var restoreScrollPosition = function(scrollableElements) {\n for (var i = 0; i < scrollableElements.length; i++) {\n scrollableElements[i][0].scrollTop = scrollableElements[i][1];\n scrollableElements[i][0].scrollLeft = scrollableElements[i][2];\n }\n scrollableElements = [];\n };\n\n var patchedFocus = function(args) {\n if (args && args.preventScroll) {\n var evScrollableElements = calcScrollableElements(this);\n if (typeof setTimeout === 'function') {\n var thisElem = this;\n setTimeout(function () {\n thisElem.nativeFocus();\n restoreScrollPosition(evScrollableElements);\n }, 0);\n } else {\n this.nativeFocus();\n restoreScrollPosition(evScrollableElements);\n }\n }\n else {\n this.nativeFocus();\n }\n };\n\n HTMLElement.prototype.focus = patchedFocus;\n }\n})();\n","import { Build } from '@stencil/core';\n\n// focus options\n\nimport 'focus-options-polyfill';\n\n// scroll-behaviour\n\nif (!('scrollBehavior' in document.documentElement.style)) {\n setTimeout((_) => {\n import(\n /* webpackChunkName: 'polyfills-scroll-behavior' */ 'scroll-behavior-polyfill'\n ).then((_) => {\n document.documentElement.style.scrollBehavior = 'smooth';\n });\n }, 0);\n} else document.documentElement.style.scrollBehavior = 'smooth';\n\n// fire global 'ready' event when everything is hydrated\n\nif (Build.isBrowser) {\n const docEle = document.documentElement;\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n document.documentElement.dispatchEvent(\n new CustomEvent('nanoComponentsReady')\n );\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (docIsReady()) {\n mutationO.disconnect();\n mutationO = null;\n }\n });\n\n mutationO.observe(document.documentElement, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n}\n"],"version":3}
|
1
|
+
{"file":"index.js","mappings":";;;;;;;;;;AAeA,MAAM,YAAY,GAAG,CACnB,OAAe,EACf,UAAmC,EAAE;EAErC,OAAO,GAAG,OAAO;MAEb,OAAO,CAAC,MAAM;MACV,OAAO;OACJ,GAAG,CACF,CAAC,GAAG,EAAE,CAAC,KACL,qBAAqB,CAAC,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,GAAG,CAAC,OAAO,WAAW,CAChG;OACA,IAAI,CAAC,EAAE,CAAC;MACX,EACN,EAAE,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACrB,KAA2B,EAC3B,UAAmC,EAAE;EAErC,IAAI,OAAO,CAAC,MAAM,EAAE;IAClB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAC7D,CAAC,GAAgB;MACf,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAC3B,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;MACF,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE;QAChC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;OACjD;KACF,CACF,CAAC;GACH;AACH,CAAC,CAAC;AAEF;;;;;;;;AAQO,eAAe,aAAa,CACjC,OAAe,EACf,WAA+B,IAA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AEP;AAEA,IAAI,KAAK,CAAC,SAAS,EAAE;EACnB,MAAM,MAAM,GAAG;EACf,MAAM,UAAU,GAAG;IACjB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;MAAsB,OAAO,KAAK,CAAC;IACzD,QAAQ,CAAC;IAGT,OAAO,IAAI,CAAC;GACb,CAAC;EAEF;IACE,IAAI,SAAS,GAAG;MACd,IAAI,UAAU,EAAE,EAAE;QAChB,SAAS,CAAC;QACV,SAAS,GAAG,IAAI,CAAC;OAClB;KACF,CAAC,CAAC;IAEH;MACE,SAAS,EAAE,KAAK;MAChB,OAAO,EAAE,KAAK;MACd,UAAU,EAAE;KACb,CAAC,CAAC;GACJ;;;;;","names":[],"sources":["./src/components/alert/alert.helpers.ts","./src/components/dialog/dialog.helpers.ts","./node_modules/focus-options-polyfill/index.js","./src/global/script/global.ts"],"sourcesContent":["import { Color, AlertToastPosition } from '../../interface';\nimport { raf } from '../../utils';\n\ninterface ImperativeAlertOptions {\n color?: Color;\n duration?: number;\n closable?: boolean;\n}\n\ninterface ImperativeAlertButton {\n classes: string;\n content: string;\n handler?: (e: MouseEvent) => void;\n}\n\nconst alertContent = (\n message: string,\n buttons: ImperativeAlertButton[] = []\n) => {\n return `${message}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`;\n};\n\nconst addBtnHandlers = (\n alert: HTMLNanoAlertElement,\n buttons: ImperativeAlertButton[] = []\n) => {\n if (buttons.length) {\n Array.from(alert.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n};\n\n/**\n * `nano-alert` helper to create toast notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param position - the position of the toast. Options are 'tr', 'tl', 'bl' & 'br'\n * @param icon - name for the `nano-icon`\n * @param alertOptions - { color: Color, duration: number, closable: boolean }\n * @returns `Promise<void>`\n */\nexport async function nanoShowToast(\n message: string,\n position: AlertToastPosition = 'tr',\n icon?: string | undefined,\n alertOptions?: ImperativeAlertOptions,\n buttons: ImperativeAlertButton[] = []\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: 3000,\n closable: true,\n ...alertOptions,\n };\n icon = icon || 'light/info-circle';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement('nano-alert'),\n {\n ...opts,\n open: false,\n innerHTML: `\n <nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n raf(async (_) => {\n await alert.toast(position);\n resolve(alert);\n });\n });\n}\n\n/**\n * `nano-alert` helper to create alert notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons\n * @param icon - name for the `nano-icon`\n * @param label - descriptive label for assitive technology\n * @param alertOptions\n * @returns `Promise<void>`\n */\nexport function nanoShowAlert(\n message: string,\n buttons: ImperativeAlertButton[] = [],\n label: string,\n icon: string | undefined = 'light/info-circle',\n alertOptions: ImperativeAlertOptions = {}\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: Infinity,\n closable: false,\n ...alertOptions,\n };\n icon = icon || 'light/info-circle';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement('nano-alert'),\n {\n ...opts,\n open: false,\n innerHTML: `\n ${icon ? `<nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>` : ''}\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n setTimeout(async (_) => {\n await alert.alert(label);\n resolve(alert);\n }, 100);\n });\n}\n","interface ImperativeDialogOptions {\n noUserDismiss: boolean;\n noHeader?: boolean;\n noFooter?: boolean;\n label: string;\n}\n/**\n * `nano-dialog` helper to create dialog modals imperatively.\n * @param body - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param dialogOptions - { noUserDismiss: boolean, noHeader?: boolean, noFooter?: boolean, label: string }\n * @returns `Promise<void>`\n */\nexport function nanoCreateDialog(\n body: string,\n buttons: { classes: string; content: string; handler: () => {} }[] = [],\n dialogOptions?: ImperativeDialogOptions\n) {\n const opts: ImperativeDialogOptions = {\n noUserDismiss: false,\n label: 'Dialog',\n ...dialogOptions,\n };\n const dialog: HTMLNanoDialogElement = Object.assign(\n document.createElement('nano-dialog'),\n {\n ...opts,\n open: false,\n innerHTML: `\n ${body}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`,\n }\n );\n\n if (buttons.length) {\n Array.from(dialog.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n\n document.body.appendChild(dialog);\n return dialog;\n}\n","// focus - focusOptions - preventScroll polyfill\n(function() {\n if (\n typeof window === \"undefined\" ||\n typeof document === \"undefined\" ||\n typeof HTMLElement === \"undefined\"\n ) {\n return;\n }\n\n var supportsPreventScrollOption = false;\n try {\n var focusElem = document.createElement(\"div\");\n focusElem.addEventListener(\n \"focus\",\n function(event) {\n event.preventDefault();\n event.stopPropagation();\n },\n true\n );\n focusElem.focus(\n Object.defineProperty({}, \"preventScroll\", {\n get: function() {\n // Edge v18 gives a false positive for supporting inputs\n if (\n navigator &&\n typeof navigator.userAgent !== 'undefined' &&\n navigator.userAgent &&\n navigator.userAgent.match(/Edge\\/1[7-8]/)) {\n return supportsPreventScrollOption = false\n }\n\n supportsPreventScrollOption = true;\n }\n })\n );\n } catch (e) {}\n\n if (\n HTMLElement.prototype.nativeFocus === undefined &&\n !supportsPreventScrollOption\n ) {\n HTMLElement.prototype.nativeFocus = HTMLElement.prototype.focus;\n\n var calcScrollableElements = function(element) {\n var parent = element.parentNode;\n var scrollableElements = [];\n var rootScrollingElement =\n document.scrollingElement || document.documentElement;\n\n while (parent && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push([\n parent,\n parent.scrollTop,\n parent.scrollLeft\n ]);\n }\n parent = parent.parentNode;\n }\n parent = rootScrollingElement;\n scrollableElements.push([parent, parent.scrollTop, parent.scrollLeft]);\n\n return scrollableElements;\n };\n\n var restoreScrollPosition = function(scrollableElements) {\n for (var i = 0; i < scrollableElements.length; i++) {\n scrollableElements[i][0].scrollTop = scrollableElements[i][1];\n scrollableElements[i][0].scrollLeft = scrollableElements[i][2];\n }\n scrollableElements = [];\n };\n\n var patchedFocus = function(args) {\n if (args && args.preventScroll) {\n var evScrollableElements = calcScrollableElements(this);\n if (typeof setTimeout === 'function') {\n var thisElem = this;\n setTimeout(function () {\n thisElem.nativeFocus();\n restoreScrollPosition(evScrollableElements);\n }, 0);\n } else {\n this.nativeFocus();\n restoreScrollPosition(evScrollableElements);\n }\n }\n else {\n this.nativeFocus();\n }\n };\n\n HTMLElement.prototype.focus = patchedFocus;\n }\n})();\n","import { Build } from '@stencil/core';\n\n// focus options\n\nimport 'focus-options-polyfill';\n\n// scroll-behaviour\n\nif (!('scrollBehavior' in document.documentElement.style)) {\n setTimeout((_) => {\n import(\n /* webpackChunkName: 'polyfills-scroll-behavior' */ 'scroll-behavior-polyfill'\n ).then((_) => {\n document.documentElement.style.scrollBehavior = 'smooth';\n });\n }, 0);\n} else document.documentElement.style.scrollBehavior = 'smooth';\n\n// fire global 'ready' event when everything is hydrated\n\nif (Build.isBrowser) {\n const docEle = document.documentElement;\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n document.documentElement.dispatchEvent(\n new CustomEvent('nanoComponentsReady')\n );\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (docIsReady()) {\n mutationO.disconnect();\n mutationO = null;\n }\n });\n\n mutationO.observe(document.documentElement, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n}\n"],"version":3}
|
@@ -224,7 +224,7 @@ let FieldValidator = class extends HTMLElement {
|
|
224
224
|
* @param newVal - the incoming, new value
|
225
225
|
*/
|
226
226
|
this.handleStoreChange = async (key, newVal) => {
|
227
|
-
const found = this.allFields.find((field) => field
|
227
|
+
const found = this.allFields.find((field) => this.getName(field) === key);
|
228
228
|
// field update has come programmatically (not from ui),
|
229
229
|
// so let's update the underlying ui field
|
230
230
|
if ((found &&
|
@@ -384,7 +384,7 @@ let FieldValidator = class extends HTMLElement {
|
|
384
384
|
// `nano-...` and plain form fields.
|
385
385
|
const validationState = [];
|
386
386
|
this.allFields.forEach(async (field) => {
|
387
|
-
const found = validationState.find((v) => v.name === field
|
387
|
+
const found = validationState.find((v) => v.name === this.getName(field));
|
388
388
|
let pf;
|
389
389
|
let nf;
|
390
390
|
if (found) {
|
@@ -425,8 +425,8 @@ let FieldValidator = class extends HTMLElement {
|
|
425
425
|
}
|
426
426
|
validationState.push({
|
427
427
|
fields: [field],
|
428
|
-
name: field
|
429
|
-
value: this._store.state[field
|
428
|
+
name: this.getName(field),
|
429
|
+
value: this._store.state[this.getName(field)],
|
430
430
|
dirty: false,
|
431
431
|
valid,
|
432
432
|
validityMessage,
|
@@ -447,7 +447,7 @@ let FieldValidator = class extends HTMLElement {
|
|
447
447
|
*/
|
448
448
|
async setCustomValidity(validity) {
|
449
449
|
return await Promise.all(Object.entries(validity).map(async ([key, err]) => {
|
450
|
-
const field = this.allFields.find((f) => f
|
450
|
+
const field = this.allFields.find((f) => this.getName(f) === key);
|
451
451
|
if (!!field)
|
452
452
|
await this.setFieldError(field, err);
|
453
453
|
}));
|
@@ -476,12 +476,21 @@ let FieldValidator = class extends HTMLElement {
|
|
476
476
|
subtree: true,
|
477
477
|
});
|
478
478
|
}
|
479
|
+
/**
|
480
|
+
* During spec tests, mockelement props aren't set - only attributes.
|
481
|
+
* This irons out that kink
|
482
|
+
* @param field
|
483
|
+
* @returns
|
484
|
+
*/
|
485
|
+
getName(field) {
|
486
|
+
return field.name || field.getAttribute('name');
|
487
|
+
}
|
479
488
|
/** Checks for new `nano-...` fields and adds them to our watch array and value store */
|
480
489
|
setupFields() {
|
481
490
|
let nanoFields = Array.from(this.host.querySelectorAll(this.nanoFieldSelector));
|
482
491
|
let plainFields = Array.from(this.host.querySelectorAll(this.extraFieldSelector)).filter((e) => !e.closest(this.nanoFieldSelector));
|
483
|
-
nanoFields = nanoFields.filter((f) => !!f
|
484
|
-
plainFields = plainFields.filter((f) => !!f
|
492
|
+
nanoFields = nanoFields.filter((f) => !!this.getName(f) && !!this.getName(f).length);
|
493
|
+
plainFields = plainFields.filter((f) => !!this.getName(f) && !!this.getName(f).length);
|
485
494
|
// do we have any currently un-watched fields?
|
486
495
|
if (![...nanoFields, ...plainFields].filter((f) => !this.allFields.includes(f)).length)
|
487
496
|
return;
|
@@ -497,7 +506,7 @@ let FieldValidator = class extends HTMLElement {
|
|
497
506
|
storeToFields(fields) {
|
498
507
|
fields.forEach((field) => {
|
499
508
|
var _a;
|
500
|
-
const fieldName = field
|
509
|
+
const fieldName = this.getName(field);
|
501
510
|
if (!fieldName.length ||
|
502
511
|
typeof this._store.state[fieldName] === 'undefined')
|
503
512
|
return;
|
@@ -543,7 +552,7 @@ let FieldValidator = class extends HTMLElement {
|
|
543
552
|
/** Loops through all `nano-...` fields and extracts their values into our store */
|
544
553
|
fieldsToStore(fields) {
|
545
554
|
fields.forEach((field) => {
|
546
|
-
const fieldName = field
|
555
|
+
const fieldName = this.getName(field);
|
547
556
|
if (!fieldName.length)
|
548
557
|
return;
|
549
558
|
if (field.tagName === 'NANO-CHECKBOX' ||
|
@@ -556,7 +565,7 @@ let FieldValidator = class extends HTMLElement {
|
|
556
565
|
if (cb.checked)
|
557
566
|
this._store.state[fieldName] = cb.value;
|
558
567
|
}
|
559
|
-
else if (this.allFields.filter((f) =>
|
568
|
+
else if (this.allFields.filter((f) => this.getName(field) === fieldName &&
|
560
569
|
(f.tagName === 'NANO-CHECKBOX' ||
|
561
570
|
f.type === 'checkbox')).length > 1) {
|
562
571
|
// multiple checkbox type control
|
@@ -622,7 +631,7 @@ let FieldValidator = class extends HTMLElement {
|
|
622
631
|
// collection loop into a promise
|
623
632
|
await Promise.all(Object.entries(res).map(async ([key, o]) => {
|
624
633
|
// switch on/off validation messages
|
625
|
-
const field = this.allFields.find((f) => f
|
634
|
+
const field = this.allFields.find((f) => this.getName(f) === key);
|
626
635
|
let validityTarget = field;
|
627
636
|
if (field.tagName === 'NANO-CHECKBOX') {
|
628
637
|
// if we have a checkbox-group, set the validation message there
|
@@ -656,8 +665,9 @@ let FieldValidator = class extends HTMLElement {
|
|
656
665
|
* @param msg
|
657
666
|
*/
|
658
667
|
async setFieldError(field, msg) {
|
659
|
-
if (field['showError'])
|
668
|
+
if (field['showError']) {
|
660
669
|
await field.showError(msg);
|
670
|
+
}
|
661
671
|
else if (field['setError'])
|
662
672
|
await field.setError(msg);
|
663
673
|
else
|