@nanoporetech-digital/components 2.10.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/dist/cjs/{date-utils-0ae9a12d.js → date-utils-b3af910d.js} +2 -2
- package/dist/cjs/date-utils-b3af910d.js.map +1 -0
- package/dist/cjs/{global-0d4f3b77.js → global-989678ec.js} +1 -8
- package/dist/cjs/global-989678ec.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/nano-algolia.cjs.entry.js +5 -1
- package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-components.cjs.js +2 -2
- package/dist/cjs/nano-datalist_3.cjs.entry.js +3 -1
- package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-date-input.cjs.entry.js +16 -5
- package/dist/cjs/nano-date-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/nano-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-details.cjs.entry.js +1 -2
- package/dist/cjs/nano-details.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-field-validator.cjs.entry.js +292 -96
- package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-file-upload.cjs.entry.js +5 -2
- package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +21 -6
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-grid_3.cjs.entry.js +1 -2
- package/dist/cjs/nano-grid_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon-button.cjs.entry.js +4 -0
- package/dist/cjs/nano-icon-button.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-input.cjs.entry.js +16 -3
- package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-nav-item_2.cjs.entry.js +2 -0
- package/dist/cjs/nano-nav-item_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js +1 -2
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-slides.cjs.entry.js +1 -2
- package/dist/cjs/nano-slides.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sticker.cjs.entry.js +2 -3
- package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-group.cjs.entry.js +4 -2
- package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js +5 -1
- package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/nano-tooltip.cjs.entry.js.map +1 -1
- package/dist/collection/components/accordion/accordion.js +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 +12 -6
- package/dist/collection/components/algolia/algolia.js.map +1 -1
- 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 +4 -2
- package/dist/collection/components/datalist/datalist.js.map +1 -1
- package/dist/collection/components/date-input/date-input.js +65 -11
- package/dist/collection/components/date-input/date-input.js.map +1 -1
- package/dist/collection/components/date-picker/date-picker.css +1 -1
- package/dist/collection/components/date-picker/date-picker.js +5 -5
- package/dist/collection/components/details/details.js +1 -2
- package/dist/collection/components/details/details.js.map +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-interface.js +5 -0
- package/dist/collection/components/field-validator/field-validator-interface.js.map +1 -0
- package/dist/collection/components/field-validator/field-validator.js +434 -113
- package/dist/collection/components/field-validator/field-validator.js.map +1 -1
- package/dist/collection/components/file-upload/file-upload.css +0 -1
- package/dist/collection/components/file-upload/file-upload.js +10 -7
- package/dist/collection/components/file-upload/file-upload.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +4 -4
- package/dist/collection/components/global-search-results/global-search-results.css +7 -0
- package/dist/collection/components/global-search-results/global-search-results.js +19 -4
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/components/grid/grid-item.js +1 -1
- package/dist/collection/components/grid/grid.js +0 -1
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon-button/icon-button.js +23 -1
- package/dist/collection/components/icon-button/icon-button.js.map +1 -1
- package/dist/collection/components/input/input.js +37 -8
- package/dist/collection/components/input/input.js.map +1 -1
- 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 -2
- package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
- package/dist/collection/components/select/select.js +9 -7
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/slides/slides.js +7 -8
- package/dist/collection/components/slides/slides.js.map +1 -1
- package/dist/collection/components/sticker/sticker.js +0 -1
- package/dist/collection/components/sticker/sticker.js.map +1 -1
- package/dist/collection/components/tabs/tab-group.js +5 -3
- package/dist/collection/components/tabs/tab-group.js.map +1 -1
- package/dist/collection/components/tabs/tab.js +5 -1
- package/dist/collection/components/tabs/tab.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip.css +0 -1
- package/dist/collection/global/script/global.js +0 -7
- package/dist/collection/global/script/global.js.map +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utils/date-utils.js +1 -1
- package/dist/collection/utils/date-utils.js.map +1 -1
- package/dist/components/algolia.js +5 -1
- package/dist/components/algolia.js.map +1 -1
- package/dist/components/datalist.js +3 -1
- package/dist/components/datalist.js.map +1 -1
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/grid.js +1 -2
- package/dist/components/grid.js.map +1 -1
- package/dist/components/icon-button.js +6 -1
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/index.js +1 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/input.js +17 -3
- package/dist/components/input.js.map +1 -1
- package/dist/components/nano-date-input.js +17 -4
- package/dist/components/nano-date-input.js.map +1 -1
- package/dist/components/nano-details.js +1 -2
- package/dist/components/nano-details.js.map +1 -1
- package/dist/components/nano-field-validator.js +300 -99
- package/dist/components/nano-field-validator.js.map +1 -1
- package/dist/components/nano-file-upload.js +6 -3
- package/dist/components/nano-file-upload.js.map +1 -1
- package/dist/components/nano-global-search-results.js +21 -6
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/nano-slides.js +1 -2
- package/dist/components/nano-slides.js.map +1 -1
- package/dist/components/nano-tab-group.js +4 -2
- package/dist/components/nano-tab-group.js.map +1 -1
- package/dist/components/nano-tab.js +5 -1
- package/dist/components/nano-tab.js.map +1 -1
- package/dist/components/resize-observe.js +1 -2
- package/dist/components/resize-observe.js.map +1 -1
- package/dist/components/select.js +2 -0
- package/dist/components/select.js.map +1 -1
- package/dist/components/sticker.js +2 -3
- package/dist/components/sticker.js.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/custom-elements/index.js +386 -2046
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/{date-utils-e4b757ff.js → date-utils-839cb010.js} +2 -2
- package/dist/esm/date-utils-839cb010.js.map +1 -0
- package/dist/esm/{global-d5ec4d53.js → global-8047b4ff.js} +1 -8
- package/dist/esm/global-8047b4ff.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/nano-algolia.entry.js +5 -1
- package/dist/esm/nano-algolia.entry.js.map +1 -1
- package/dist/esm/nano-components.js +2 -2
- package/dist/esm/nano-datalist_3.entry.js +3 -1
- package/dist/esm/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm/nano-date-input.entry.js +16 -5
- package/dist/esm/nano-date-input.entry.js.map +1 -1
- package/dist/esm/nano-date-picker.entry.js +2 -2
- package/dist/esm/nano-date-picker.entry.js.map +1 -1
- package/dist/esm/nano-details.entry.js +1 -2
- package/dist/esm/nano-details.entry.js.map +1 -1
- package/dist/esm/nano-field-validator.entry.js +292 -96
- package/dist/esm/nano-field-validator.entry.js.map +1 -1
- package/dist/esm/nano-file-upload.entry.js +5 -2
- package/dist/esm/nano-file-upload.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +21 -6
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-grid_3.entry.js +1 -2
- package/dist/esm/nano-grid_3.entry.js.map +1 -1
- package/dist/esm/nano-icon-button.entry.js +4 -0
- package/dist/esm/nano-icon-button.entry.js.map +1 -1
- package/dist/esm/nano-input.entry.js +16 -3
- package/dist/esm/nano-input.entry.js.map +1 -1
- package/dist/esm/nano-nav-item_2.entry.js +2 -0
- package/dist/esm/nano-nav-item_2.entry.js.map +1 -1
- package/dist/esm/nano-resize-observe_2.entry.js +1 -2
- package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/esm/nano-slides.entry.js +1 -2
- package/dist/esm/nano-slides.entry.js.map +1 -1
- package/dist/esm/nano-sticker.entry.js +2 -3
- package/dist/esm/nano-sticker.entry.js.map +1 -1
- package/dist/esm/nano-tab-group.entry.js +4 -2
- package/dist/esm/nano-tab-group.entry.js.map +1 -1
- package/dist/esm/nano-tab.entry.js +5 -1
- package/dist/esm/nano-tab.entry.js.map +1 -1
- package/dist/esm/nano-tooltip.entry.js +1 -1
- package/dist/esm/nano-tooltip.entry.js.map +1 -1
- package/dist/esm-es5/date-utils-839cb010.js +5 -0
- package/dist/esm-es5/date-utils-839cb010.js.map +1 -0
- package/dist/esm-es5/{global-d5ec4d53.js → global-8047b4ff.js} +2 -2
- package/dist/esm-es5/global-8047b4ff.js.map +1 -0
- package/dist/esm-es5/index.js +2 -2
- package/dist/esm-es5/index.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/nano-algolia.entry.js +1 -1
- package/dist/esm-es5/nano-algolia.entry.js.map +1 -1
- package/dist/esm-es5/nano-components.js +1 -1
- package/dist/esm-es5/nano-components.js.map +1 -1
- package/dist/esm-es5/nano-datalist_3.entry.js +1 -1
- package/dist/esm-es5/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm-es5/nano-date-input.entry.js +1 -1
- package/dist/esm-es5/nano-date-input.entry.js.map +1 -1
- package/dist/esm-es5/nano-date-picker.entry.js +1 -1
- package/dist/esm-es5/nano-date-picker.entry.js.map +1 -1
- package/dist/esm-es5/nano-details.entry.js +1 -1
- package/dist/esm-es5/nano-details.entry.js.map +1 -1
- package/dist/esm-es5/nano-field-validator.entry.js +2 -2
- package/dist/esm-es5/nano-field-validator.entry.js.map +1 -1
- package/dist/esm-es5/nano-file-upload.entry.js +1 -1
- package/dist/esm-es5/nano-file-upload.entry.js.map +1 -1
- package/dist/esm-es5/nano-global-search-results.entry.js +1 -1
- package/dist/esm-es5/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm-es5/nano-grid_3.entry.js +1 -1
- package/dist/esm-es5/nano-grid_3.entry.js.map +1 -1
- package/dist/esm-es5/nano-icon-button.entry.js +2 -2
- package/dist/esm-es5/nano-icon-button.entry.js.map +1 -1
- package/dist/esm-es5/nano-input.entry.js +1 -1
- package/dist/esm-es5/nano-input.entry.js.map +1 -1
- package/dist/esm-es5/nano-nav-item_2.entry.js +1 -1
- package/dist/esm-es5/nano-nav-item_2.entry.js.map +1 -1
- package/dist/esm-es5/nano-resize-observe_2.entry.js +1 -1
- package/dist/esm-es5/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/esm-es5/nano-slides.entry.js +2 -2
- package/dist/esm-es5/nano-slides.entry.js.map +1 -1
- package/dist/esm-es5/nano-sticker.entry.js +1 -1
- package/dist/esm-es5/nano-sticker.entry.js.map +1 -1
- package/dist/esm-es5/nano-tab-group.entry.js +2 -2
- package/dist/esm-es5/nano-tab-group.entry.js.map +1 -1
- package/dist/esm-es5/nano-tab.entry.js +2 -2
- package/dist/esm-es5/nano-tab.entry.js.map +1 -1
- package/dist/esm-es5/nano-tooltip.entry.js +1 -1
- package/dist/esm-es5/nano-tooltip.entry.js.map +1 -1
- package/dist/nano-components/index.esm.js +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/nano-components.esm.js.map +1 -1
- package/dist/nano-components/nano-components.js +1 -1
- package/dist/nano-components/p-018b7047.entry.js +5 -0
- package/dist/nano-components/p-018b7047.entry.js.map +1 -0
- package/dist/nano-components/p-0193a282.entry.js +5 -0
- package/dist/nano-components/p-0193a282.entry.js.map +1 -0
- package/dist/nano-components/p-0320410c.entry.js +5 -0
- package/dist/nano-components/p-0320410c.entry.js.map +1 -0
- package/dist/nano-components/p-0d699368.system.js +5 -0
- package/dist/nano-components/{p-3258c568.system.js.map → p-0d699368.system.js.map} +1 -1
- package/dist/nano-components/p-18863670.system.entry.js +5 -0
- package/dist/nano-components/p-18863670.system.entry.js.map +1 -0
- package/dist/nano-components/p-32900c91.entry.js +5 -0
- package/dist/nano-components/p-32900c91.entry.js.map +1 -0
- package/dist/nano-components/p-33fce1a6.js +5 -0
- package/dist/nano-components/p-33fce1a6.js.map +1 -0
- package/dist/nano-components/p-371aebe7.system.entry.js +23 -0
- package/dist/nano-components/p-371aebe7.system.entry.js.map +1 -0
- package/dist/nano-components/p-41899a31.system.entry.js +5 -0
- package/dist/nano-components/p-41899a31.system.entry.js.map +1 -0
- package/dist/nano-components/p-53957ec6.system.js +5 -0
- package/dist/nano-components/{p-e7140887.system.js.map → p-53957ec6.system.js.map} +1 -1
- package/dist/nano-components/p-561500f0.system.entry.js +5 -0
- package/dist/nano-components/p-561500f0.system.entry.js.map +1 -0
- package/dist/nano-components/p-596c1711.system.entry.js +5 -0
- package/dist/nano-components/p-596c1711.system.entry.js.map +1 -0
- package/dist/nano-components/{p-01667573.entry.js → p-634a58f7.entry.js} +2 -2
- package/dist/nano-components/p-634a58f7.entry.js.map +1 -0
- package/dist/nano-components/p-6a949280.system.entry.js +5 -0
- package/dist/nano-components/p-6a949280.system.entry.js.map +1 -0
- package/dist/nano-components/{p-bf9aa89d.system.entry.js → p-6af10533.system.entry.js} +3 -3
- package/dist/nano-components/p-6af10533.system.entry.js.map +1 -0
- package/dist/nano-components/p-70272eae.js +5 -0
- package/dist/nano-components/p-70272eae.js.map +1 -0
- package/dist/nano-components/p-755d9227.entry.js +5 -0
- package/dist/nano-components/p-755d9227.entry.js.map +1 -0
- package/dist/nano-components/p-7bd25494.entry.js +5 -0
- package/dist/nano-components/p-7bd25494.entry.js.map +1 -0
- package/dist/nano-components/p-7c837460.entry.js +5 -0
- package/dist/nano-components/p-7c837460.entry.js.map +1 -0
- package/dist/nano-components/p-7f051c20.entry.js +5 -0
- package/dist/nano-components/p-7f051c20.entry.js.map +1 -0
- package/dist/nano-components/{p-93880c28.system.js → p-82e28afd.system.js} +2 -2
- package/dist/nano-components/p-82e28afd.system.js.map +1 -0
- package/dist/nano-components/p-8378428e.system.js +5 -0
- package/dist/nano-components/p-8378428e.system.js.map +1 -0
- package/dist/nano-components/p-8df4f125.system.entry.js +5 -0
- package/dist/nano-components/p-8df4f125.system.entry.js.map +1 -0
- package/dist/nano-components/{p-d0385948.system.entry.js → p-93596c3d.system.entry.js} +2 -2
- package/dist/nano-components/p-93596c3d.system.entry.js.map +1 -0
- package/dist/nano-components/{p-3e930ac7.entry.js → p-9d9b0b66.entry.js} +2 -2
- package/dist/nano-components/p-9d9b0b66.entry.js.map +1 -0
- package/dist/nano-components/p-9ffdf6cc.entry.js +5 -0
- package/dist/nano-components/{p-222d8095.entry.js.map → p-9ffdf6cc.entry.js.map} +1 -1
- package/dist/nano-components/p-a07cf44c.system.entry.js +5 -0
- package/dist/nano-components/p-a07cf44c.system.entry.js.map +1 -0
- package/dist/nano-components/p-a1444980.entry.js +5 -0
- package/dist/nano-components/p-a1444980.entry.js.map +1 -0
- package/dist/nano-components/p-aa84c727.system.entry.js +5 -0
- package/dist/nano-components/p-aa84c727.system.entry.js.map +1 -0
- package/dist/nano-components/p-ac5e3775.system.entry.js +5 -0
- package/dist/nano-components/p-ac5e3775.system.entry.js.map +1 -0
- package/dist/nano-components/p-b85cf493.system.entry.js +5 -0
- package/dist/nano-components/{p-e817ab4a.system.entry.js.map → p-b85cf493.system.entry.js.map} +1 -1
- package/dist/nano-components/{p-96d9b8b9.system.entry.js → p-c2bbf0fb.system.entry.js} +2 -2
- package/dist/nano-components/p-c2bbf0fb.system.entry.js.map +1 -0
- package/dist/nano-components/{p-f780d2f6.system.entry.js → p-cb512cff.system.entry.js} +2 -2
- package/dist/nano-components/p-cb512cff.system.entry.js.map +1 -0
- package/dist/nano-components/{p-4e2c0abb.entry.js → p-ccd6c206.entry.js} +2 -2
- package/dist/nano-components/p-ccd6c206.entry.js.map +1 -0
- package/dist/nano-components/{p-1030797a.entry.js → p-d37e1489.entry.js} +2 -2
- package/dist/nano-components/p-d37e1489.entry.js.map +1 -0
- package/dist/nano-components/p-da88981f.entry.js +23 -0
- package/dist/nano-components/p-da88981f.entry.js.map +1 -0
- package/dist/nano-components/p-e8a913ac.system.entry.js +5 -0
- package/dist/nano-components/p-e8a913ac.system.entry.js.map +1 -0
- package/dist/nano-components/p-e9fddc1a.entry.js +5 -0
- package/dist/nano-components/p-e9fddc1a.entry.js.map +1 -0
- package/dist/nano-components/p-ea54ee12.entry.js +5 -0
- package/dist/nano-components/p-ea54ee12.entry.js.map +1 -0
- package/dist/nano-components/{p-86bd5194.entry.js → p-ed0bdea9.entry.js} +2 -2
- package/dist/nano-components/p-ed0bdea9.entry.js.map +1 -0
- package/dist/nano-components/p-faba2fc1.system.entry.js +5 -0
- package/dist/nano-components/p-faba2fc1.system.entry.js.map +1 -0
- package/dist/nano-components/p-ff026352.system.entry.js +5 -0
- package/dist/nano-components/p-ff026352.system.entry.js.map +1 -0
- package/dist/themes/nanopore.css +1 -1
- package/dist/themes/nanopore.css.map +1 -1
- package/dist/types/components/algolia/algolia.d.ts +1 -0
- package/dist/types/components/date-input/date-input.d.ts +6 -1
- package/dist/types/components/field-validator/field-validator-interface.d.ts +19 -0
- package/dist/types/components/field-validator/field-validator.d.ts +77 -31
- package/dist/types/components/file-upload/file-upload.d.ts +2 -1
- package/dist/types/components/global-search-results/global-search-results.d.ts +1 -0
- package/dist/types/components/icon-button/icon-button.d.ts +2 -0
- package/dist/types/components/input/input.d.ts +6 -1
- package/dist/types/components/tabs/tab.d.ts +1 -0
- package/dist/types/components.d.ts +67 -12
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interface.d.ts +1 -0
- package/docs-json.json +161 -13
- package/docs-vscode.json +6 -2
- package/package.json +2 -4
- package/dist/cjs/ResizeObserver.es-09b81a1b.js +0 -935
- package/dist/cjs/ResizeObserver.es-09b81a1b.js.map +0 -1
- package/dist/cjs/date-utils-0ae9a12d.js.map +0 -1
- package/dist/cjs/global-0d4f3b77.js.map +0 -1
- package/dist/cjs/intersection-observer-1822c787.js +0 -987
- package/dist/cjs/intersection-observer-1822c787.js.map +0 -1
- package/dist/components/ResizeObserver.es.js +0 -933
- package/dist/components/ResizeObserver.es.js.map +0 -1
- package/dist/components/intersection-observer.js +0 -985
- package/dist/components/intersection-observer.js.map +0 -1
- package/dist/esm/ResizeObserver.es-724af9fd.js +0 -933
- package/dist/esm/ResizeObserver.es-724af9fd.js.map +0 -1
- package/dist/esm/date-utils-e4b757ff.js.map +0 -1
- package/dist/esm/global-d5ec4d53.js.map +0 -1
- package/dist/esm/intersection-observer-dff9fb5b.js +0 -985
- package/dist/esm/intersection-observer-dff9fb5b.js.map +0 -1
- package/dist/esm-es5/ResizeObserver.es-724af9fd.js +0 -5
- package/dist/esm-es5/ResizeObserver.es-724af9fd.js.map +0 -1
- package/dist/esm-es5/date-utils-e4b757ff.js +0 -5
- package/dist/esm-es5/date-utils-e4b757ff.js.map +0 -1
- package/dist/esm-es5/global-d5ec4d53.js.map +0 -1
- package/dist/esm-es5/intersection-observer-dff9fb5b.js +0 -5
- package/dist/esm-es5/intersection-observer-dff9fb5b.js.map +0 -1
- package/dist/nano-components/p-00eaa36a.entry.js +0 -5
- package/dist/nano-components/p-00eaa36a.entry.js.map +0 -1
- package/dist/nano-components/p-01667573.entry.js.map +0 -1
- package/dist/nano-components/p-1030797a.entry.js.map +0 -1
- package/dist/nano-components/p-11a2dcce.js +0 -5
- package/dist/nano-components/p-11a2dcce.js.map +0 -1
- package/dist/nano-components/p-1a30dfdd.system.entry.js +0 -5
- package/dist/nano-components/p-1a30dfdd.system.entry.js.map +0 -1
- package/dist/nano-components/p-1b120f53.entry.js +0 -5
- package/dist/nano-components/p-1b120f53.entry.js.map +0 -1
- package/dist/nano-components/p-21d6d31e.system.entry.js +0 -5
- package/dist/nano-components/p-21d6d31e.system.entry.js.map +0 -1
- package/dist/nano-components/p-222d8095.entry.js +0 -5
- package/dist/nano-components/p-241d90eb.system.entry.js +0 -5
- package/dist/nano-components/p-241d90eb.system.entry.js.map +0 -1
- package/dist/nano-components/p-2c8d7273.entry.js +0 -5
- package/dist/nano-components/p-2c8d7273.entry.js.map +0 -1
- package/dist/nano-components/p-3093915f.entry.js +0 -5
- package/dist/nano-components/p-3093915f.entry.js.map +0 -1
- package/dist/nano-components/p-3258c568.system.js +0 -5
- package/dist/nano-components/p-325c1cad.entry.js +0 -5
- package/dist/nano-components/p-325c1cad.entry.js.map +0 -1
- package/dist/nano-components/p-32f396c0.system.entry.js +0 -5
- package/dist/nano-components/p-32f396c0.system.entry.js.map +0 -1
- package/dist/nano-components/p-35108e08.entry.js +0 -5
- package/dist/nano-components/p-35108e08.entry.js.map +0 -1
- package/dist/nano-components/p-3ccb176c.system.entry.js +0 -5
- package/dist/nano-components/p-3ccb176c.system.entry.js.map +0 -1
- package/dist/nano-components/p-3e930ac7.entry.js.map +0 -1
- package/dist/nano-components/p-42cebbfe.system.entry.js +0 -5
- package/dist/nano-components/p-42cebbfe.system.entry.js.map +0 -1
- package/dist/nano-components/p-4e2c0abb.entry.js.map +0 -1
- package/dist/nano-components/p-5d17cfbb.system.entry.js +0 -23
- package/dist/nano-components/p-5d17cfbb.system.entry.js.map +0 -1
- package/dist/nano-components/p-5d5ea4ab.system.entry.js +0 -5
- package/dist/nano-components/p-5d5ea4ab.system.entry.js.map +0 -1
- package/dist/nano-components/p-6722447c.entry.js +0 -5
- package/dist/nano-components/p-6722447c.entry.js.map +0 -1
- package/dist/nano-components/p-6d138abf.entry.js +0 -5
- package/dist/nano-components/p-6d138abf.entry.js.map +0 -1
- package/dist/nano-components/p-76d9d1d4.entry.js +0 -5
- package/dist/nano-components/p-76d9d1d4.entry.js.map +0 -1
- package/dist/nano-components/p-866f083f.system.entry.js +0 -5
- package/dist/nano-components/p-866f083f.system.entry.js.map +0 -1
- package/dist/nano-components/p-86bd5194.entry.js.map +0 -1
- package/dist/nano-components/p-88779174.system.entry.js +0 -5
- package/dist/nano-components/p-88779174.system.entry.js.map +0 -1
- package/dist/nano-components/p-93880c28.system.js.map +0 -1
- package/dist/nano-components/p-96d9b8b9.system.entry.js.map +0 -1
- package/dist/nano-components/p-97b13ad2.entry.js +0 -5
- package/dist/nano-components/p-97b13ad2.entry.js.map +0 -1
- package/dist/nano-components/p-b430a9b6.system.js +0 -5
- package/dist/nano-components/p-b430a9b6.system.js.map +0 -1
- package/dist/nano-components/p-bc394857.system.entry.js +0 -5
- package/dist/nano-components/p-bc394857.system.entry.js.map +0 -1
- package/dist/nano-components/p-bf9aa89d.system.entry.js.map +0 -1
- package/dist/nano-components/p-c3830c43.entry.js +0 -5
- package/dist/nano-components/p-c3830c43.entry.js.map +0 -1
- package/dist/nano-components/p-d0385948.system.entry.js.map +0 -1
- package/dist/nano-components/p-debd9efc.js +0 -5
- package/dist/nano-components/p-debd9efc.js.map +0 -1
- package/dist/nano-components/p-e195ab77.system.js +0 -5
- package/dist/nano-components/p-e195ab77.system.js.map +0 -1
- package/dist/nano-components/p-e7140887.system.js +0 -5
- package/dist/nano-components/p-e817ab4a.system.entry.js +0 -5
- package/dist/nano-components/p-f5d4d13b.system.js +0 -5
- package/dist/nano-components/p-f5d4d13b.system.js.map +0 -1
- package/dist/nano-components/p-f66958c1.js +0 -5
- package/dist/nano-components/p-f66958c1.js.map +0 -1
- package/dist/nano-components/p-f710c763.system.entry.js +0 -5
- package/dist/nano-components/p-f710c763.system.entry.js.map +0 -1
- package/dist/nano-components/p-f780d2f6.system.entry.js.map +0 -1
- package/dist/nano-components/p-f9c7d961.js +0 -5
- package/dist/nano-components/p-f9c7d961.js.map +0 -1
- package/dist/nano-components/p-ffc2063a.entry.js +0 -23
- package/dist/nano-components/p-ffc2063a.entry.js.map +0 -1
- package/dist/nano-components/p-fff27907.system.entry.js +0 -5
- package/dist/nano-components/p-fff27907.system.entry.js.map +0 -1
@@ -195,8 +195,15 @@ let FieldValidator = class extends HTMLElement {
|
|
195
195
|
this.nanoSubmit = createEvent(this, "nanoSubmit", 7);
|
196
196
|
this.nanoInvalid = createEvent(this, "nanoInvalid", 7);
|
197
197
|
this.submitted = false;
|
198
|
-
this.
|
199
|
-
|
198
|
+
this.allFields = [];
|
199
|
+
this.nanoFieldSelector = `
|
200
|
+
nano-input,
|
201
|
+
nano-select,
|
202
|
+
nano-file-upload,
|
203
|
+
nano-date-input,
|
204
|
+
nano-checkbox
|
205
|
+
`;
|
206
|
+
// annoyingly, whenever we attempt to `checkValidty()` it fires `invalid` events.
|
200
207
|
// this is used to prevent infinite loops / multiple calls
|
201
208
|
this.internalValidate = false;
|
202
209
|
// Public API
|
@@ -205,39 +212,80 @@ let FieldValidator = class extends HTMLElement {
|
|
205
212
|
/** Tries to scroll to the first invalid field on submit */
|
206
213
|
this.scrollToInvalid = true;
|
207
214
|
this._dirty = false;
|
215
|
+
/** By default, `nano-field-validator` will also track all native form field elements.
|
216
|
+
* You can add extra web-component form fields to listen to
|
217
|
+
* (as long as they match the standard form field spec) by using the `fieldSelector` prop.
|
218
|
+
*/
|
219
|
+
this.extraFieldSelector = 'input, select, textarea';
|
208
220
|
// Event handlers
|
209
|
-
/**
|
210
|
-
|
221
|
+
/**
|
222
|
+
* Fired whenever store values change and potentially checks validity
|
223
|
+
* @param key - the key of the store that's just changed
|
224
|
+
* @param newVal - the incoming, new value
|
225
|
+
*/
|
226
|
+
this.handleStoreChange = async (key, newVal) => {
|
227
|
+
const found = this.allFields.find((field) => field.name === key);
|
228
|
+
// field update has come programmatically (not from ui),
|
229
|
+
// so let's update the underlying ui field
|
230
|
+
if ((found &&
|
231
|
+
found.tagName === 'NANO-FILE-UPLOAD' &&
|
232
|
+
!this.fileStateEqual(key, found)) ||
|
233
|
+
(found.tagName !== 'NANO-FILE-UPLOAD' && found.value !== newVal)) {
|
234
|
+
this.storeToFields([found]);
|
235
|
+
}
|
211
236
|
if (this.validateOn === 'dirty' && this.dirty) {
|
212
237
|
this.internalValidate = true;
|
213
238
|
await this.validateAllFields();
|
214
239
|
this._valid = this.activeForm.checkValidity();
|
215
240
|
this.internalValidate = false;
|
216
241
|
}
|
217
|
-
this.nanoPayloadChange.emit(this.
|
242
|
+
this.nanoPayloadChange.emit(this._store.state);
|
218
243
|
};
|
219
|
-
/**
|
244
|
+
/**
|
245
|
+
* Handles nano field value changes and passes to store
|
246
|
+
* @param ev - the incoming change event
|
247
|
+
*/
|
220
248
|
this.handleFieldChange = (ev) => {
|
249
|
+
if (!this.nanoFields.includes(ev.target))
|
250
|
+
return;
|
221
251
|
this._dirty = true;
|
222
|
-
this.
|
252
|
+
this.fieldsToStore([ev.target]);
|
223
253
|
};
|
224
|
-
/**
|
254
|
+
/**
|
255
|
+
* Handles non-nano field value changes and passes to store
|
256
|
+
* @param ev - the incoming change event
|
257
|
+
*/
|
258
|
+
this.handlePlainFieldChange = (ev) => {
|
259
|
+
if (!this.plainFields.includes(ev.target))
|
260
|
+
return;
|
261
|
+
this.fieldsToStore([ev.target]);
|
262
|
+
};
|
263
|
+
/**
|
264
|
+
* Handles default field validation events
|
265
|
+
* @param ev - the invalid event
|
266
|
+
*/
|
225
267
|
this.handleFormInvalid = async (ev) => {
|
226
|
-
|
268
|
+
// if it's a non-nano field, we'll let default html5 validation do it's thing
|
269
|
+
if (!this.plainFields.includes(ev.target)) {
|
270
|
+
ev.preventDefault();
|
271
|
+
}
|
227
272
|
this._valid = false;
|
273
|
+
// whenever `checkValidity` is called, this handler is in-turn called.
|
274
|
+
// this flag is used to stop infinite loops
|
228
275
|
if (this.internalValidate)
|
229
276
|
return;
|
277
|
+
// a submit must have happened to if 'submitThenDirty' turn on 'dirty' checking now
|
230
278
|
if (this.validateOn === 'submitThenDirty')
|
231
279
|
this.validateOn = 'dirty';
|
232
280
|
this.submitted = true;
|
233
281
|
await this.validateAllFields();
|
282
|
+
this.internalValidate = true;
|
283
|
+
this._valid = this.activeForm.checkValidity();
|
284
|
+
this.internalValidate = false;
|
234
285
|
// kinda insane...but if we're only validating on submit, then if the form is currently
|
235
286
|
// in an invalid state, when submitting, it will fire an invalid event and not
|
236
287
|
// submit the form. So let's test to make sure it is really invalid, and submit if not
|
237
288
|
if (this.validateOn === 'submit') {
|
238
|
-
this.internalValidate = true;
|
239
|
-
this._valid = this.activeForm.checkValidity();
|
240
|
-
this.internalValidate = false;
|
241
289
|
if (this._valid) {
|
242
290
|
this.submitForm();
|
243
291
|
return;
|
@@ -246,7 +294,10 @@ let FieldValidator = class extends HTMLElement {
|
|
246
294
|
this.scrollToFirstInvalid();
|
247
295
|
this.nanoInvalid.emit();
|
248
296
|
};
|
249
|
-
/**
|
297
|
+
/**
|
298
|
+
* stops default form submission, checks if valid, then submits manually
|
299
|
+
* @param e - a submit event from the nested form element
|
300
|
+
*/
|
250
301
|
this.handleSubmit = async (e) => {
|
251
302
|
e.preventDefault();
|
252
303
|
if (this.validateOn === 'submitThenDirty')
|
@@ -271,15 +322,18 @@ let FieldValidator = class extends HTMLElement {
|
|
271
322
|
return this._activeForm;
|
272
323
|
}
|
273
324
|
set activeForm(form) {
|
274
|
-
|
325
|
+
// manages event listners on whatever form is used (slotted on created here)
|
326
|
+
if (!form)
|
327
|
+
return;
|
328
|
+
if (this._activeForm) {
|
275
329
|
this._activeForm.removeEventListener('invalid', this.handleFormInvalid, true);
|
276
|
-
|
277
|
-
|
330
|
+
}
|
331
|
+
form.addEventListener('invalid', this.handleFormInvalid, true);
|
278
332
|
this._activeForm = form;
|
279
333
|
}
|
280
334
|
/** Sync up validateOn with all fields */
|
281
335
|
validateOnChange() {
|
282
|
-
this.
|
336
|
+
this.nanoFields.forEach((field) => {
|
283
337
|
if (field.tagName === 'NANO-CHECKBOX') {
|
284
338
|
const cbg = field.closest('nano-checkbox-group');
|
285
339
|
if (cbg)
|
@@ -299,11 +353,15 @@ let FieldValidator = class extends HTMLElement {
|
|
299
353
|
get valid() {
|
300
354
|
return this._valid;
|
301
355
|
}
|
302
|
-
/** The current form
|
356
|
+
/** The current form state as a stencil store. */
|
357
|
+
get store() {
|
358
|
+
return this._store;
|
359
|
+
}
|
360
|
+
/** The current form payload as a reactive proxy. @readonly */
|
303
361
|
get payload() {
|
304
|
-
return this.
|
362
|
+
return this._store.state;
|
305
363
|
}
|
306
|
-
/** Returns true if validation errors will be displayed to the user */
|
364
|
+
/** Returns true if validation errors will be displayed to the user. @readonly */
|
307
365
|
get showValidation() {
|
308
366
|
return (this.validateOn === 'dirty' && this.dirty) || this.submitted;
|
309
367
|
}
|
@@ -320,37 +378,94 @@ let FieldValidator = class extends HTMLElement {
|
|
320
378
|
```
|
321
379
|
*/
|
322
380
|
get validationState() {
|
381
|
+
// TODO - migrate nano-fields away from using proprietary methods in a bid to be closer to the spec
|
382
|
+
// this is big and ugly.
|
383
|
+
// why? Cos' it must unify checking validity state for both
|
384
|
+
// `nano-...` and plain form fields.
|
323
385
|
const validationState = [];
|
324
|
-
this.
|
386
|
+
this.allFields.forEach(async (field) => {
|
325
387
|
const found = validationState.find((v) => v.name === field.name);
|
388
|
+
let pf;
|
389
|
+
let nf;
|
326
390
|
if (found) {
|
327
|
-
|
328
|
-
|
329
|
-
|
391
|
+
if (field.validationMessage) {
|
392
|
+
pf = field;
|
393
|
+
found.validityMessage = pf.validationMessage.length
|
394
|
+
? pf.validationMessage
|
395
|
+
: found.validityMessage;
|
396
|
+
this.internalValidate = true;
|
397
|
+
if (found.valid && !pf.checkValidity())
|
398
|
+
found.valid = false;
|
399
|
+
this.internalValidate = false;
|
400
|
+
}
|
401
|
+
else if (field.validityMessage) {
|
402
|
+
nf = field;
|
403
|
+
found.validityMessage = nf.validityMessage.length
|
404
|
+
? nf.validityMessage
|
405
|
+
: nf.validityMessage;
|
406
|
+
if (found.valid && nf.invalid)
|
407
|
+
found.valid = false;
|
408
|
+
}
|
330
409
|
if (!found.fields.find((f) => f === field))
|
331
410
|
found.fields.push(field);
|
332
|
-
|
333
|
-
|
334
|
-
|
411
|
+
}
|
412
|
+
let valid;
|
413
|
+
let validityMessage;
|
414
|
+
if (field.checkValidity) {
|
415
|
+
pf = field;
|
416
|
+
this.internalValidate = true;
|
417
|
+
valid = pf.checkValidity();
|
418
|
+
this.internalValidate = false;
|
419
|
+
validityMessage = pf.validationMessage;
|
420
|
+
}
|
421
|
+
else {
|
422
|
+
nf = field;
|
423
|
+
valid = !nf.invalid;
|
424
|
+
validityMessage = nf.validityMessage;
|
335
425
|
}
|
336
426
|
validationState.push({
|
337
427
|
fields: [field],
|
338
428
|
name: field.name,
|
339
|
-
|
340
|
-
value: this.store.state[field.name],
|
429
|
+
value: this._store.state[field.name],
|
341
430
|
dirty: false,
|
342
|
-
|
431
|
+
valid,
|
432
|
+
validityMessage,
|
343
433
|
});
|
344
434
|
});
|
345
435
|
return validationState;
|
346
436
|
}
|
437
|
+
/**
|
438
|
+
* Sets the state of the form using an object of key / value pairs.
|
439
|
+
* @param state - the state to load in the store
|
440
|
+
*/
|
441
|
+
async setStore(state) {
|
442
|
+
Object.entries(state).forEach(([key, val]) => (this.store.state[key] = val));
|
443
|
+
}
|
444
|
+
/**
|
445
|
+
* Sets custom validity for all / some form fields.
|
446
|
+
* @param validity - a validity object of `{fieldName: errorString}` pairs. Set as an empty string to clear the error.
|
447
|
+
*/
|
448
|
+
async setCustomValidity(validity) {
|
449
|
+
return await Promise.all(Object.entries(validity).map(async ([key, err]) => {
|
450
|
+
const field = this.allFields.find((f) => f.name === key);
|
451
|
+
if (!!field)
|
452
|
+
await this.setFieldError(field, err);
|
453
|
+
}));
|
454
|
+
}
|
455
|
+
/**
|
456
|
+
* Clear all custom validation.
|
457
|
+
* @param validity
|
458
|
+
*/
|
459
|
+
async resetValidity() {
|
460
|
+
return await Promise.all(this.allFields.map(async (field) => await this.setFieldError(field, '')));
|
461
|
+
}
|
347
462
|
// private methods
|
348
463
|
attachSlotObserver() {
|
349
464
|
if (!!this.mo)
|
350
465
|
return;
|
351
466
|
const mo = (this.mo = new MutationObserver((_entries) => {
|
352
467
|
const form = this.host.querySelector('form');
|
353
|
-
if (form !== this.activeForm)
|
468
|
+
if (form && form !== this.activeForm)
|
354
469
|
this.activeForm = form;
|
355
470
|
this.setupFields();
|
356
471
|
}));
|
@@ -363,95 +478,177 @@ let FieldValidator = class extends HTMLElement {
|
|
363
478
|
}
|
364
479
|
/** Checks for new `nano-...` fields and adds them to our watch array and value store */
|
365
480
|
setupFields() {
|
366
|
-
let
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
nano-date-input,
|
371
|
-
nano-checkbox
|
372
|
-
`));
|
373
|
-
fields = fields.filter((f) => !!f.name && !!f.name.length);
|
481
|
+
let nanoFields = Array.from(this.host.querySelectorAll(this.nanoFieldSelector));
|
482
|
+
let plainFields = Array.from(this.host.querySelectorAll(this.extraFieldSelector)).filter((e) => !e.closest(this.nanoFieldSelector));
|
483
|
+
nanoFields = nanoFields.filter((f) => !!f.name && !!f.name.length);
|
484
|
+
plainFields = plainFields.filter((f) => !!f.name && !!f.name.length);
|
374
485
|
// do we have any currently un-watched fields?
|
375
|
-
if (!
|
486
|
+
if (![...nanoFields, ...plainFields].filter((f) => !this.allFields.includes(f)).length)
|
376
487
|
return;
|
377
488
|
// setup the initial store state / refresh on new fields
|
378
|
-
this.
|
489
|
+
this.nanoFields = nanoFields;
|
490
|
+
this.plainFields = plainFields;
|
491
|
+
this.allFields = [...nanoFields, ...plainFields];
|
492
|
+
this.storeToFields(this.allFields);
|
379
493
|
this.validateOnChange();
|
380
|
-
this.
|
381
|
-
this.nanoPayloadChange.emit(this.
|
494
|
+
this.fieldsToStore(this.allFields);
|
495
|
+
this.nanoPayloadChange.emit(this._store.state);
|
496
|
+
}
|
497
|
+
storeToFields(fields) {
|
498
|
+
fields.forEach((field) => {
|
499
|
+
var _a;
|
500
|
+
const fieldName = field.name;
|
501
|
+
if (!fieldName.length ||
|
502
|
+
typeof this._store.state[fieldName] === 'undefined')
|
503
|
+
return;
|
504
|
+
if (field.tagName === 'NANO-CHECKBOX' ||
|
505
|
+
['radio', 'checkbox'].includes(field.type)) {
|
506
|
+
let cb = field;
|
507
|
+
if (cb.type === 'radio' ||
|
508
|
+
cb.type === 'segment' ||
|
509
|
+
cb.type === 'segment-pill') {
|
510
|
+
// single radio type control
|
511
|
+
if (this._store.state[fieldName] === cb.value)
|
512
|
+
cb.checked = true;
|
513
|
+
else
|
514
|
+
cb.checked = false;
|
515
|
+
}
|
516
|
+
else if (Array.isArray(this._store.state[fieldName])) {
|
517
|
+
// multiple checkbox like controls
|
518
|
+
if (this._store.state[fieldName].includes(cb.value))
|
519
|
+
cb.checked = true;
|
520
|
+
else
|
521
|
+
cb.checked = false;
|
522
|
+
}
|
523
|
+
else {
|
524
|
+
// single checkbox like control
|
525
|
+
if (this._store.state[fieldName] === cb.value)
|
526
|
+
cb.checked = true;
|
527
|
+
else
|
528
|
+
cb.checked = false;
|
529
|
+
}
|
530
|
+
return;
|
531
|
+
}
|
532
|
+
if (field.tagName === 'NANO-FILE-UPLOAD') {
|
533
|
+
const ff = field;
|
534
|
+
// this can only work if the field is empty rn... a one-time deal
|
535
|
+
if (!((_a = ff.files) === null || _a === void 0 ? void 0 : _a.length))
|
536
|
+
ff.files = this._store.state[fieldName];
|
537
|
+
return;
|
538
|
+
}
|
539
|
+
// default
|
540
|
+
field.value = this._store.state[fieldName];
|
541
|
+
});
|
382
542
|
}
|
383
543
|
/** Loops through all `nano-...` fields and extracts their values into our store */
|
384
|
-
|
544
|
+
fieldsToStore(fields) {
|
385
545
|
fields.forEach((field) => {
|
386
546
|
const fieldName = field.name;
|
387
547
|
if (!fieldName.length)
|
388
548
|
return;
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
}
|
411
|
-
else {
|
412
|
-
this.store.state[fieldName] = currentArr.filter((v) => v !== cb.value);
|
549
|
+
if (field.tagName === 'NANO-CHECKBOX' ||
|
550
|
+
['radio', 'checkbox'].includes(field.type)) {
|
551
|
+
let cb = field;
|
552
|
+
if (cb.type === 'radio' ||
|
553
|
+
cb.type === 'segment' ||
|
554
|
+
cb.type === 'segment-pill') {
|
555
|
+
// radio type control - only one can be checked
|
556
|
+
if (cb.checked)
|
557
|
+
this._store.state[fieldName] = cb.value;
|
558
|
+
}
|
559
|
+
else if (this.allFields.filter((f) => f.name === fieldName &&
|
560
|
+
(f.tagName === 'NANO-CHECKBOX' ||
|
561
|
+
f.type === 'checkbox')).length > 1) {
|
562
|
+
// multiple checkbox type control
|
563
|
+
const currentArr = Array.isArray(this._store.state[fieldName])
|
564
|
+
? this._store.state[fieldName]
|
565
|
+
: [];
|
566
|
+
if (cb.checked) {
|
567
|
+
// checked
|
568
|
+
if (!this._store.state[fieldName].includes(cb.value)) {
|
569
|
+
this._store.state[fieldName] = [...currentArr, cb.value];
|
413
570
|
}
|
414
571
|
}
|
572
|
+
else {
|
573
|
+
// unchecked
|
574
|
+
this._store.state[fieldName] = currentArr.filter((v) => v !== cb.value);
|
575
|
+
}
|
576
|
+
}
|
577
|
+
else {
|
578
|
+
// single checkbox - on or off
|
579
|
+
if (cb.checked)
|
580
|
+
this._store.state[fieldName] = cb.value;
|
415
581
|
else
|
416
|
-
this.
|
417
|
-
|
418
|
-
|
419
|
-
this.store.state[fieldName] = field.files;
|
420
|
-
break;
|
421
|
-
default:
|
422
|
-
this.store.state[fieldName] = field.value;
|
423
|
-
break;
|
582
|
+
this._store.state[fieldName] = '';
|
583
|
+
}
|
584
|
+
return;
|
424
585
|
}
|
586
|
+
if (field.tagName === 'NANO-FILE-UPLOAD') {
|
587
|
+
const ff = field;
|
588
|
+
if (!this.fileStateEqual(fieldName, ff))
|
589
|
+
this._store.state[fieldName] = ff.files;
|
590
|
+
return;
|
591
|
+
}
|
592
|
+
// default
|
593
|
+
this._store.state[fieldName] = field.value;
|
425
594
|
});
|
426
595
|
}
|
427
|
-
/**
|
596
|
+
/**
|
597
|
+
* Tries to ascertain whether the current model
|
598
|
+
* value is the same as the `nano-file-upload` value
|
599
|
+
* @param fieldName - the key to access from the data store
|
600
|
+
* @param field - the nano-file-upload field to assess against
|
601
|
+
* @returns true for equal, false for not equal
|
602
|
+
*/
|
603
|
+
fileStateEqual(fieldName, field) {
|
604
|
+
return (JSON.stringify(this._store.state[fieldName]) ===
|
605
|
+
JSON.stringify(field.files) ||
|
606
|
+
this._store.state[fieldName] == field.files);
|
607
|
+
}
|
608
|
+
/**
|
609
|
+
* Checks for user defined validations
|
610
|
+
* @param key - current key of the data model to validate
|
611
|
+
* @param newVal - the newly set, incoming value to validate
|
612
|
+
*/
|
428
613
|
async validate(key, newVal) {
|
429
614
|
if (!this.validation)
|
430
615
|
return;
|
431
|
-
const res = this.validation(key, newVal, this.
|
616
|
+
const res = this.validation(key, newVal, this._store.state);
|
432
617
|
// no nothing - return
|
433
618
|
if (!res)
|
434
619
|
return;
|
435
620
|
// stencil public methods are async
|
436
|
-
// so we must
|
621
|
+
// so we must coerce our validation
|
437
622
|
// collection loop into a promise
|
438
623
|
await Promise.all(Object.entries(res).map(async ([key, o]) => {
|
439
624
|
// switch on/off validation messages
|
440
|
-
const field = this.
|
625
|
+
const field = this.allFields.find((f) => f.name === key);
|
441
626
|
let validityTarget = field;
|
442
627
|
if (field.tagName === 'NANO-CHECKBOX') {
|
628
|
+
// if we have a checkbox-group, set the validation message there
|
443
629
|
const cbg = field.closest('nano-checkbox-group');
|
444
630
|
validityTarget = cbg || field;
|
445
631
|
}
|
446
|
-
|
447
|
-
|
632
|
+
if ((validityTarget.validityMessage ||
|
633
|
+
validityTarget.validationMessage) === o.msg &&
|
634
|
+
o.valid) {
|
635
|
+
// status is now valid - clear the error
|
448
636
|
await this.setFieldError(validityTarget, '');
|
449
|
-
|
637
|
+
}
|
450
638
|
else if (!o.valid) {
|
639
|
+
// status is invalid. Set the error
|
451
640
|
await this.setFieldError(validityTarget, o.msg);
|
452
641
|
}
|
453
642
|
}));
|
454
643
|
}
|
644
|
+
/** Loops through all store entries and checks custom validation */
|
645
|
+
async validateAllFields() {
|
646
|
+
// This forces our loop to `await` and finish sequentially ... silly async stencil methods
|
647
|
+
await Object.entries(this._store.state).reduce(async (memo, [key, value]) => {
|
648
|
+
await memo;
|
649
|
+
await this.validate(key, value);
|
650
|
+
}, undefined);
|
651
|
+
}
|
455
652
|
/**
|
456
653
|
* Utility to smooth out setting error messages
|
457
654
|
* (it's a different method on `nano-checkbox` 'cos they don't show errors themselves)
|
@@ -461,16 +658,10 @@ let FieldValidator = class extends HTMLElement {
|
|
461
658
|
async setFieldError(field, msg) {
|
462
659
|
if (field['showError'])
|
463
660
|
await field.showError(msg);
|
464
|
-
else
|
661
|
+
else if (field['setError'])
|
465
662
|
await field.setError(msg);
|
466
|
-
|
467
|
-
|
468
|
-
async validateAllFields() {
|
469
|
-
// This forces our loop to `await` and finish sequentially ... silly async stencil methods
|
470
|
-
await Object.entries(this.store.state).reduce(async (memo, [key, value]) => {
|
471
|
-
await memo;
|
472
|
-
await this.validate(key, value);
|
473
|
-
}, undefined);
|
663
|
+
else
|
664
|
+
field.setCustomValidity(msg);
|
474
665
|
}
|
475
666
|
scrollToFirstInvalid() {
|
476
667
|
if (!this.scrollToInvalid)
|
@@ -493,23 +684,27 @@ let FieldValidator = class extends HTMLElement {
|
|
493
684
|
}
|
494
685
|
connectedCallback() {
|
495
686
|
this.userForm = this.host.querySelector('form');
|
687
|
+
this._store = createStore({});
|
496
688
|
}
|
497
689
|
componentDidLoad() {
|
498
690
|
requestAnimationFrame(() => {
|
499
|
-
this.store = createStore({});
|
500
691
|
this.setupFields();
|
501
692
|
this.attachSlotObserver();
|
502
|
-
this.store.on('set', (key, value) => this.handleStoreChange(key, value));
|
503
693
|
this.host.addEventListener('nanoChange', this.handleFieldChange);
|
694
|
+
this.host.addEventListener('input', this.handlePlainFieldChange);
|
695
|
+
this.host.addEventListener('change', this.handlePlainFieldChange);
|
504
696
|
this.host.addEventListener('submit', this.handleSubmit);
|
697
|
+
this._store.on('set', this.handleStoreChange);
|
505
698
|
});
|
506
699
|
}
|
507
700
|
disconnectedCallback() {
|
508
701
|
if (this.mo)
|
509
702
|
this.mo.disconnect();
|
510
|
-
this.store.dispose();
|
511
703
|
this.host.removeEventListener('nanoChange', this.handleFieldChange);
|
704
|
+
this.host.removeEventListener('input', this.handlePlainFieldChange);
|
705
|
+
this.host.removeEventListener('change', this.handlePlainFieldChange);
|
512
706
|
this.host.removeEventListener('submit', this.handleSubmit);
|
707
|
+
this._store.reset();
|
513
708
|
if (this.activeForm)
|
514
709
|
this.activeForm.removeEventListener('invalid', this.handleFormInvalid, true);
|
515
710
|
}
|
@@ -519,7 +714,8 @@ let FieldValidator = class extends HTMLElement {
|
|
519
714
|
get host() { return this; }
|
520
715
|
static get watchers() { return {
|
521
716
|
"userForm": ["userFormChange"],
|
522
|
-
"validateOn": ["validateOnChange"]
|
717
|
+
"validateOn": ["validateOnChange"],
|
718
|
+
"extraFieldSelector": ["attachSlotObserver"]
|
523
719
|
}; }
|
524
720
|
};
|
525
721
|
FieldValidator = /*@__PURE__*/ proxyCustomElement(FieldValidator, [4, "nano-field-validator", {
|
@@ -527,15 +723,20 @@ FieldValidator = /*@__PURE__*/ proxyCustomElement(FieldValidator, [4, "nano-fiel
|
|
527
723
|
"scrollToInvalid": [4, "scroll-to-invalid"],
|
528
724
|
"dirty": [2564],
|
529
725
|
"valid": [2564],
|
726
|
+
"store": [2064],
|
530
727
|
"payload": [2064],
|
531
728
|
"showValidation": [2052, "show-validation"],
|
532
729
|
"validationState": [2064],
|
730
|
+
"extraFieldSelector": [1, "extra-field-selector"],
|
533
731
|
"validation": [16],
|
534
|
-
"store": [32],
|
535
|
-
"userForm": [32],
|
536
732
|
"submitted": [32],
|
733
|
+
"userForm": [32],
|
537
734
|
"_dirty": [32],
|
538
|
-
"_valid": [32]
|
735
|
+
"_valid": [32],
|
736
|
+
"_store": [32],
|
737
|
+
"setStore": [64],
|
738
|
+
"setCustomValidity": [64],
|
739
|
+
"resetValidity": [64]
|
539
740
|
}]);
|
540
741
|
function defineCustomElement$1() {
|
541
742
|
if (typeof customElements === "undefined") {
|