@wordpress/dataviews 9.1.1-next.233ccab9b.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -1
- package/README.md +137 -36
- package/build/components/dataform/index.js +52 -28
- package/build/components/dataform/index.js.map +7 -1
- package/build/components/dataform-context/index.js +33 -25
- package/build/components/dataform-context/index.js.map +7 -1
- package/build/components/dataviews/index.js +193 -154
- package/build/components/dataviews/index.js.map +7 -1
- package/build/components/dataviews-bulk-actions/index.js +264 -155
- package/build/components/dataviews-bulk-actions/index.js.map +7 -1
- package/build/components/dataviews-context/index.js +40 -36
- package/build/components/dataviews-context/index.js.map +7 -1
- package/build/components/dataviews-filters/add-filter.js +78 -73
- package/build/components/dataviews-filters/add-filter.js.map +7 -1
- package/build/components/dataviews-filters/filter.js +473 -263
- package/build/components/dataviews-filters/filter.js.map +7 -1
- package/build/components/dataviews-filters/filters-toggled.js +39 -25
- package/build/components/dataviews-filters/filters-toggled.js.map +7 -1
- package/build/components/dataviews-filters/filters.js +95 -67
- package/build/components/dataviews-filters/filters.js.map +7 -1
- package/build/components/dataviews-filters/index.js +44 -31
- package/build/components/dataviews-filters/index.js.map +7 -1
- package/build/components/dataviews-filters/input-widget.js +88 -89
- package/build/components/dataviews-filters/input-widget.js.map +7 -1
- package/build/components/dataviews-filters/reset-filters.js +50 -34
- package/build/components/dataviews-filters/reset-filters.js.map +7 -1
- package/build/components/dataviews-filters/search-widget.js +301 -205
- package/build/components/dataviews-filters/search-widget.js.map +7 -1
- package/build/components/dataviews-filters/toggle.js +88 -63
- package/build/components/dataviews-filters/toggle.js.map +7 -1
- package/build/components/dataviews-filters/use-filters.js +40 -29
- package/build/components/dataviews-filters/use-filters.js.map +7 -1
- package/build/components/dataviews-filters/utils.js +26 -10
- package/build/components/dataviews-filters/utils.js.map +7 -1
- package/build/components/dataviews-footer/index.js +54 -33
- package/build/components/dataviews-footer/index.js.map +7 -1
- package/build/components/dataviews-item-actions/index.js +188 -150
- package/build/components/dataviews-item-actions/index.js.map +7 -1
- package/build/components/dataviews-layout/index.js +64 -49
- package/build/components/dataviews-layout/index.js.map +7 -1
- package/build/components/dataviews-pagination/index.js +143 -99
- package/build/components/dataviews-pagination/index.js.map +7 -1
- package/build/components/dataviews-picker/footer.js +152 -101
- package/build/components/dataviews-picker/footer.js.map +7 -1
- package/build/components/dataviews-picker/index.js +173 -145
- package/build/components/dataviews-picker/index.js.map +7 -1
- package/build/components/dataviews-search/index.js +63 -46
- package/build/components/dataviews-search/index.js.map +7 -1
- package/build/components/dataviews-selection-checkbox/index.js +45 -35
- package/build/components/dataviews-selection-checkbox/index.js.map +7 -1
- package/build/components/dataviews-view-config/index.js +587 -512
- package/build/components/dataviews-view-config/index.js.map +7 -1
- package/build/components/dataviews-view-config/infinite-scroll-toggle.js +56 -39
- package/build/components/dataviews-view-config/infinite-scroll-toggle.js.map +7 -1
- package/build/constants.js +215 -108
- package/build/constants.js.map +7 -1
- package/build/dataform-controls/array.js +109 -145
- package/build/dataform-controls/array.js.map +7 -1
- package/build/dataform-controls/checkbox.js +56 -66
- package/build/dataform-controls/checkbox.js.map +7 -1
- package/build/dataform-controls/color.js +112 -119
- package/build/dataform-controls/color.js.map +7 -1
- package/build/dataform-controls/date.js +531 -349
- package/build/dataform-controls/date.js.map +7 -1
- package/build/dataform-controls/datetime.js +189 -148
- package/build/dataform-controls/datetime.js.map +7 -1
- package/build/dataform-controls/email.js +52 -32
- package/build/dataform-controls/email.js.map +7 -1
- package/build/dataform-controls/index.js +83 -63
- package/build/dataform-controls/index.js.map +7 -1
- package/build/dataform-controls/integer.js +36 -129
- package/build/dataform-controls/integer.js.map +7 -1
- package/build/dataform-controls/number.js +39 -0
- package/build/dataform-controls/number.js.map +7 -0
- package/build/dataform-controls/password.js +66 -38
- package/build/dataform-controls/password.js.map +7 -1
- package/build/dataform-controls/radio.js +61 -64
- package/build/dataform-controls/radio.js.map +7 -1
- package/build/dataform-controls/select.js +70 -88
- package/build/dataform-controls/select.js.map +7 -1
- package/build/dataform-controls/telephone.js +52 -32
- package/build/dataform-controls/telephone.js.map +7 -1
- package/build/dataform-controls/text.js +52 -30
- package/build/dataform-controls/text.js.map +7 -1
- package/build/dataform-controls/textarea.js +62 -71
- package/build/dataform-controls/textarea.js.map +7 -1
- package/build/dataform-controls/toggle-group.js +73 -66
- package/build/dataform-controls/toggle-group.js.map +7 -1
- package/build/dataform-controls/toggle.js +57 -67
- package/build/dataform-controls/toggle.js.map +7 -1
- package/build/dataform-controls/url.js +52 -32
- package/build/dataform-controls/url.js.map +7 -1
- package/build/dataform-controls/utils/get-custom-validity.js +35 -0
- package/build/dataform-controls/utils/get-custom-validity.js.map +7 -0
- package/build/dataform-controls/utils/relative-date-control.js +122 -0
- package/build/dataform-controls/utils/relative-date-control.js.map +7 -0
- package/build/dataform-controls/utils/validated-input.js +67 -71
- package/build/dataform-controls/utils/validated-input.js.map +7 -1
- package/build/dataform-controls/utils/validated-number.js +167 -0
- package/build/dataform-controls/utils/validated-number.js.map +7 -0
- package/build/dataform-layouts/card/index.js +217 -0
- package/build/dataform-layouts/card/index.js.map +7 -0
- package/build/dataform-layouts/data-form-layout.js +95 -0
- package/build/dataform-layouts/data-form-layout.js.map +7 -0
- package/build/dataform-layouts/get-summary-fields.js +45 -0
- package/build/dataform-layouts/get-summary-fields.js.map +7 -0
- package/build/dataform-layouts/index.js +99 -0
- package/build/dataform-layouts/index.js.map +7 -0
- package/build/dataform-layouts/is-combined-field.js +31 -0
- package/build/dataform-layouts/is-combined-field.js.map +7 -0
- package/build/dataform-layouts/normalize-form-fields.js +104 -0
- package/build/dataform-layouts/normalize-form-fields.js.map +7 -0
- package/build/dataform-layouts/panel/dropdown.js +159 -0
- package/build/dataform-layouts/panel/dropdown.js.map +7 -0
- package/build/dataform-layouts/panel/index.js +152 -0
- package/build/dataform-layouts/panel/index.js.map +7 -0
- package/build/dataform-layouts/panel/modal.js +176 -0
- package/build/dataform-layouts/panel/modal.js.map +7 -0
- package/build/dataform-layouts/panel/summary-button.js +93 -0
- package/build/dataform-layouts/panel/summary-button.js.map +7 -0
- package/build/dataform-layouts/regular/index.js +139 -0
- package/build/dataform-layouts/regular/index.js.map +7 -0
- package/build/dataform-layouts/row/index.js +120 -0
- package/build/dataform-layouts/row/index.js.map +7 -0
- package/build/dataviews-layouts/grid/index.js +337 -278
- package/build/dataviews-layouts/grid/index.js.map +7 -1
- package/build/dataviews-layouts/grid/preview-size-picker.js +94 -69
- package/build/dataviews-layouts/grid/preview-size-picker.js.map +7 -1
- package/build/dataviews-layouts/index.js +75 -48
- package/build/dataviews-layouts/index.js.map +7 -1
- package/build/dataviews-layouts/list/index.js +441 -354
- package/build/dataviews-layouts/list/index.js.map +7 -1
- package/build/dataviews-layouts/picker-grid/index.js +366 -300
- package/build/dataviews-layouts/picker-grid/index.js.map +7 -1
- package/build/dataviews-layouts/table/column-header-menu.js +144 -133
- package/build/dataviews-layouts/table/column-header-menu.js.map +7 -1
- package/build/dataviews-layouts/table/column-primary.js +86 -66
- package/build/dataviews-layouts/table/column-primary.js.map +7 -1
- package/build/dataviews-layouts/table/density-picker.js +86 -46
- package/build/dataviews-layouts/table/density-picker.js.map +7 -1
- package/build/dataviews-layouts/table/index.js +354 -319
- package/build/dataviews-layouts/table/index.js.map +7 -1
- package/build/dataviews-layouts/table/use-is-horizontal-scroll-end.js +55 -47
- package/build/dataviews-layouts/table/use-is-horizontal-scroll-end.js.map +7 -1
- package/build/dataviews-layouts/utils/get-data-by-group.js +24 -13
- package/build/dataviews-layouts/utils/get-data-by-group.js.map +7 -1
- package/build/dataviews-layouts/utils/grid-items.js +51 -34
- package/build/dataviews-layouts/utils/grid-items.js.map +7 -1
- package/build/dataviews-layouts/utils/item-click-wrapper.js +53 -31
- package/build/dataviews-layouts/utils/item-click-wrapper.js.map +7 -1
- package/build/dataviews-layouts/utils/preview-size-picker.js +94 -69
- package/build/dataviews-layouts/utils/preview-size-picker.js.map +7 -1
- package/build/field-types/array.js +46 -41
- package/build/field-types/array.js.map +7 -1
- package/build/field-types/boolean.js +52 -47
- package/build/field-types/boolean.js.map +7 -1
- package/build/field-types/color.js +79 -81
- package/build/field-types/color.js.map +7 -1
- package/build/field-types/date.js +69 -48
- package/build/field-types/date.js.map +7 -1
- package/build/field-types/datetime.js +62 -43
- package/build/field-types/datetime.js.map +7 -1
- package/build/field-types/email.js +58 -47
- package/build/field-types/email.js.map +7 -1
- package/build/field-types/index.js +84 -89
- package/build/field-types/index.js.map +7 -1
- package/build/field-types/integer.js +68 -45
- package/build/field-types/integer.js.map +7 -1
- package/build/field-types/media.js +25 -27
- package/build/field-types/media.js.map +7 -1
- package/build/field-types/number.js +95 -0
- package/build/field-types/number.js.map +7 -0
- package/build/field-types/password.js +40 -39
- package/build/field-types/password.js.map +7 -1
- package/build/field-types/telephone.js +55 -45
- package/build/field-types/telephone.js.map +7 -1
- package/build/field-types/text.js +55 -46
- package/build/field-types/text.js.map +7 -1
- package/build/field-types/url.js +55 -45
- package/build/field-types/url.js.map +7 -1
- package/build/field-types/utils/render-from-elements.js +52 -0
- package/build/field-types/utils/render-from-elements.js.map +7 -0
- package/build/hooks/index.js +39 -0
- package/build/hooks/index.js.map +7 -0
- package/build/hooks/use-elements.js +63 -0
- package/build/hooks/use-elements.js.map +7 -0
- package/build/hooks/use-form-validity.js +426 -0
- package/build/hooks/use-form-validity.js.map +7 -0
- package/build/index.js +50 -45
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -14
- package/build/lock-unlock.js.map +7 -1
- package/build/types/dataform.js +17 -0
- package/build/types/dataform.js.map +7 -0
- package/build/types/dataviews.js +17 -0
- package/build/types/dataviews.js.map +7 -0
- package/build/types/field-api.js +17 -0
- package/build/types/field-api.js.map +7 -0
- package/build/types/index.js +17 -0
- package/build/types/index.js.map +7 -0
- package/build/types/private.js +17 -0
- package/build/types/private.js.map +7 -0
- package/build/utils/filter-sort-and-paginate.js +285 -0
- package/build/utils/filter-sort-and-paginate.js.map +7 -0
- package/build/utils/has-elements.js +27 -0
- package/build/utils/has-elements.js.map +7 -0
- package/build/utils/normalize-fields.js +160 -0
- package/build/utils/normalize-fields.js.map +7 -0
- package/build-module/components/dataform/index.js +25 -25
- package/build-module/components/dataform/index.js.map +7 -1
- package/build-module/components/dataform-context/index.js +11 -19
- package/build-module/components/dataform-context/index.js.map +7 -1
- package/build-module/components/dataviews/index.js +154 -127
- package/build-module/components/dataviews/index.js.map +7 -1
- package/build-module/components/dataviews-bulk-actions/index.js +227 -140
- package/build-module/components/dataviews-bulk-actions/index.js.map +7 -1
- package/build-module/components/dataviews-context/index.js +20 -30
- package/build-module/components/dataviews-context/index.js.map +7 -1
- package/build-module/components/dataviews-filters/add-filter.js +60 -68
- package/build-module/components/dataviews-filters/add-filter.js.map +7 -1
- package/build-module/components/dataviews-filters/filter.js +454 -232
- package/build-module/components/dataviews-filters/filter.js.map +7 -1
- package/build-module/components/dataviews-filters/filters-toggled.js +11 -19
- package/build-module/components/dataviews-filters/filters-toggled.js.map +7 -1
- package/build-module/components/dataviews-filters/filters.js +65 -59
- package/build-module/components/dataviews-filters/filters.js.map +7 -1
- package/build-module/components/dataviews-filters/index.js +11 -5
- package/build-module/components/dataviews-filters/index.js.map +7 -1
- package/build-module/components/dataviews-filters/input-widget.js +57 -81
- package/build-module/components/dataviews-filters/input-widget.js.map +7 -1
- package/build-module/components/dataviews-filters/reset-filters.js +33 -30
- package/build-module/components/dataviews-filters/reset-filters.js.map +7 -1
- package/build-module/components/dataviews-filters/search-widget.js +276 -195
- package/build-module/components/dataviews-filters/search-widget.js.map +7 -1
- package/build-module/components/dataviews-filters/toggle.js +58 -55
- package/build-module/components/dataviews-filters/toggle.js.map +7 -1
- package/build-module/components/dataviews-filters/use-filters.js +21 -23
- package/build-module/components/dataviews-filters/use-filters.js.map +7 -1
- package/build-module/components/dataviews-filters/utils.js +5 -6
- package/build-module/components/dataviews-filters/utils.js.map +7 -1
- package/build-module/components/dataviews-footer/index.js +28 -26
- package/build-module/components/dataviews-footer/index.js.map +7 -1
- package/build-module/components/dataviews-item-actions/index.js +171 -144
- package/build-module/components/dataviews-item-actions/index.js.map +7 -1
- package/build-module/components/dataviews-layout/index.js +35 -42
- package/build-module/components/dataviews-layout/index.js.map +7 -1
- package/build-module/components/dataviews-pagination/index.js +115 -92
- package/build-module/components/dataviews-pagination/index.js.map +7 -1
- package/build-module/components/dataviews-picker/footer.js +122 -93
- package/build-module/components/dataviews-picker/footer.js.map +7 -1
- package/build-module/components/dataviews-picker/index.js +137 -121
- package/build-module/components/dataviews-picker/index.js.map +7 -1
- package/build-module/components/dataviews-search/index.js +30 -35
- package/build-module/components/dataviews-search/index.js.map +7 -1
- package/build-module/components/dataviews-selection-checkbox/index.js +28 -31
- package/build-module/components/dataviews-selection-checkbox/index.js.map +7 -1
- package/build-module/components/dataviews-view-config/index.js +579 -504
- package/build-module/components/dataviews-view-config/index.js.map +7 -1
- package/build-module/components/dataviews-view-config/infinite-scroll-toggle.js +28 -33
- package/build-module/components/dataviews-view-config/infinite-scroll-toggle.js.map +7 -1
- package/build-module/constants.js +157 -101
- package/build-module/constants.js.map +7 -1
- package/build-module/dataform-controls/array.js +82 -141
- package/build-module/dataform-controls/array.js.map +7 -1
- package/build-module/dataform-controls/checkbox.js +28 -61
- package/build-module/dataform-controls/checkbox.js.map +7 -1
- package/build-module/dataform-controls/color.js +89 -115
- package/build-module/dataform-controls/color.js.map +7 -1
- package/build-module/dataform-controls/date.js +524 -337
- package/build-module/dataform-controls/date.js.map +7 -1
- package/build-module/dataform-controls/datetime.js +162 -139
- package/build-module/dataform-controls/datetime.js.map +7 -1
- package/build-module/dataform-controls/email.js +28 -28
- package/build-module/dataform-controls/email.js.map +7 -1
- package/build-module/dataform-controls/index.js +36 -43
- package/build-module/dataform-controls/index.js.map +7 -1
- package/build-module/dataform-controls/integer.js +8 -123
- package/build-module/dataform-controls/integer.js.map +7 -1
- package/build-module/dataform-controls/number.js +9 -0
- package/build-module/dataform-controls/number.js.map +7 -0
- package/build-module/dataform-controls/password.js +37 -30
- package/build-module/dataform-controls/password.js.map +7 -1
- package/build-module/dataform-controls/radio.js +34 -60
- package/build-module/dataform-controls/radio.js.map +7 -1
- package/build-module/dataform-controls/select.js +43 -84
- package/build-module/dataform-controls/select.js.map +7 -1
- package/build-module/dataform-controls/telephone.js +28 -28
- package/build-module/dataform-controls/telephone.js.map +7 -1
- package/build-module/dataform-controls/text.js +25 -26
- package/build-module/dataform-controls/text.js.map +7 -1
- package/build-module/dataform-controls/textarea.js +35 -67
- package/build-module/dataform-controls/textarea.js.map +7 -1
- package/build-module/dataform-controls/toggle-group.js +50 -62
- package/build-module/dataform-controls/toggle-group.js.map +7 -1
- package/build-module/dataform-controls/toggle.js +29 -62
- package/build-module/dataform-controls/toggle.js.map +7 -1
- package/build-module/dataform-controls/url.js +28 -28
- package/build-module/dataform-controls/url.js.map +7 -1
- package/build-module/dataform-controls/utils/get-custom-validity.js +15 -0
- package/build-module/dataform-controls/utils/get-custom-validity.js.map +7 -0
- package/build-module/dataform-controls/utils/relative-date-control.js +97 -0
- package/build-module/dataform-controls/utils/relative-date-control.js.map +7 -0
- package/build-module/dataform-controls/utils/validated-input.js +40 -67
- package/build-module/dataform-controls/utils/validated-input.js.map +7 -1
- package/build-module/dataform-controls/utils/validated-number.js +142 -0
- package/build-module/dataform-controls/utils/validated-number.js.map +7 -0
- package/build-module/dataform-layouts/card/index.js +183 -0
- package/build-module/dataform-layouts/card/index.js.map +7 -0
- package/build-module/dataform-layouts/data-form-layout.js +61 -0
- package/build-module/dataform-layouts/data-form-layout.js.map +7 -0
- package/build-module/dataform-layouts/get-summary-fields.js +21 -0
- package/build-module/dataform-layouts/get-summary-fields.js.map +7 -0
- package/build-module/dataform-layouts/index.js +68 -0
- package/build-module/dataform-layouts/index.js.map +7 -0
- package/build-module/dataform-layouts/is-combined-field.js +7 -0
- package/build-module/dataform-layouts/is-combined-field.js.map +7 -0
- package/build-module/dataform-layouts/normalize-form-fields.js +79 -0
- package/build-module/dataform-layouts/normalize-form-fields.js.map +7 -0
- package/build-module/dataform-layouts/panel/dropdown.js +136 -0
- package/build-module/dataform-layouts/panel/dropdown.js.map +7 -0
- package/build-module/dataform-layouts/panel/index.js +125 -0
- package/build-module/dataform-layouts/panel/index.js.map +7 -0
- package/build-module/dataform-layouts/panel/modal.js +151 -0
- package/build-module/dataform-layouts/panel/modal.js.map +7 -0
- package/build-module/dataform-layouts/panel/summary-button.js +73 -0
- package/build-module/dataform-layouts/panel/summary-button.js.map +7 -0
- package/build-module/dataform-layouts/regular/index.js +115 -0
- package/build-module/dataform-layouts/regular/index.js.map +7 -0
- package/build-module/dataform-layouts/row/index.js +95 -0
- package/build-module/dataform-layouts/row/index.js.map +7 -0
- package/build-module/dataviews-layouts/grid/index.js +316 -267
- package/build-module/dataviews-layouts/grid/index.js.map +7 -1
- package/build-module/dataviews-layouts/grid/preview-size-picker.js +66 -63
- package/build-module/dataviews-layouts/grid/preview-size-picker.js.map +7 -1
- package/build-module/dataviews-layouts/index.js +53 -42
- package/build-module/dataviews-layouts/index.js.map +7 -1
- package/build-module/dataviews-layouts/list/index.js +422 -339
- package/build-module/dataviews-layouts/list/index.js.map +7 -1
- package/build-module/dataviews-layouts/picker-grid/index.js +344 -291
- package/build-module/dataviews-layouts/picker-grid/index.js.map +7 -1
- package/build-module/dataviews-layouts/table/column-header-menu.js +129 -127
- package/build-module/dataviews-layouts/table/column-header-menu.js.map +7 -1
- package/build-module/dataviews-layouts/table/column-primary.js +71 -62
- package/build-module/dataviews-layouts/table/column-primary.js.map +7 -1
- package/build-module/dataviews-layouts/table/density-picker.js +61 -40
- package/build-module/dataviews-layouts/table/density-picker.js.map +7 -1
- package/build-module/dataviews-layouts/table/index.js +326 -302
- package/build-module/dataviews-layouts/table/index.js.map +7 -1
- package/build-module/dataviews-layouts/table/use-is-horizontal-scroll-end.js +31 -40
- package/build-module/dataviews-layouts/table/use-is-horizontal-scroll-end.js.map +7 -1
- package/build-module/dataviews-layouts/utils/get-data-by-group.js +7 -10
- package/build-module/dataviews-layouts/utils/get-data-by-group.js.map +7 -1
- package/build-module/dataviews-layouts/utils/grid-items.js +19 -28
- package/build-module/dataviews-layouts/utils/grid-items.js.map +7 -1
- package/build-module/dataviews-layouts/utils/item-click-wrapper.js +32 -28
- package/build-module/dataviews-layouts/utils/item-click-wrapper.js.map +7 -1
- package/build-module/dataviews-layouts/utils/preview-size-picker.js +66 -63
- package/build-module/dataviews-layouts/utils/preview-size-picker.js.map +7 -1
- package/build-module/field-types/array.js +32 -37
- package/build-module/field-types/array.js.map +7 -1
- package/build-module/field-types/boolean.js +22 -41
- package/build-module/field-types/boolean.js.map +7 -1
- package/build-module/field-types/color.js +51 -72
- package/build-module/field-types/color.js.map +7 -1
- package/build-module/field-types/date.js +51 -44
- package/build-module/field-types/date.js.map +7 -1
- package/build-module/field-types/datetime.js +43 -39
- package/build-module/field-types/datetime.js.map +7 -1
- package/build-module/field-types/email.js +39 -42
- package/build-module/field-types/email.js.map +7 -1
- package/build-module/field-types/index.js +43 -72
- package/build-module/field-types/index.js.map +7 -1
- package/build-module/field-types/integer.js +52 -41
- package/build-module/field-types/integer.js.map +7 -1
- package/build-module/field-types/media.js +7 -23
- package/build-module/field-types/media.js.map +7 -1
- package/build-module/field-types/number.js +77 -0
- package/build-module/field-types/number.js.map +7 -0
- package/build-module/field-types/password.js +12 -36
- package/build-module/field-types/password.js.map +7 -1
- package/build-module/field-types/telephone.js +36 -40
- package/build-module/field-types/telephone.js.map +7 -1
- package/build-module/field-types/text.js +36 -41
- package/build-module/field-types/text.js.map +7 -1
- package/build-module/field-types/url.js +36 -40
- package/build-module/field-types/url.js.map +7 -1
- package/build-module/field-types/utils/render-from-elements.js +22 -0
- package/build-module/field-types/utils/render-from-elements.js.map +7 -0
- package/build-module/hooks/index.js +5 -0
- package/build-module/hooks/index.js.map +7 -0
- package/build-module/hooks/use-elements.js +43 -0
- package/build-module/hooks/use-elements.js.map +7 -0
- package/build-module/hooks/use-form-validity.js +392 -0
- package/build-module/hooks/use-form-validity.js.map +7 -0
- package/build-module/index.js +15 -7
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/types/dataform.js +1 -0
- package/build-module/types/dataform.js.map +7 -0
- package/build-module/types/dataviews.js +1 -0
- package/build-module/types/dataviews.js.map +7 -0
- package/build-module/types/field-api.js +1 -0
- package/build-module/types/field-api.js.map +7 -0
- package/build-module/types/index.js +1 -0
- package/build-module/types/index.js.map +7 -0
- package/build-module/types/private.js +1 -0
- package/build-module/types/private.js.map +7 -0
- package/build-module/utils/filter-sort-and-paginate.js +278 -0
- package/build-module/utils/filter-sort-and-paginate.js.map +7 -0
- package/build-module/utils/has-elements.js +7 -0
- package/build-module/utils/has-elements.js.map +7 -0
- package/build-module/utils/normalize-fields.js +134 -0
- package/build-module/utils/normalize-fields.js.map +7 -0
- package/build-style/style-rtl.css +81 -217
- package/build-style/style.css +81 -217
- package/build-types/components/dataform/index.d.ts +1 -1
- package/build-types/components/dataform/index.d.ts.map +1 -1
- package/build-types/components/dataform-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-bulk-actions/index.d.ts +1 -1
- package/build-types/components/dataviews-bulk-actions/index.d.ts.map +1 -1
- package/build-types/components/dataviews-context/index.d.ts +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/use-filters.d.ts.map +1 -1
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
- package/build-types/components/dataviews-picker/footer.d.ts.map +1 -1
- package/build-types/components/dataviews-selection-checkbox/index.d.ts +1 -1
- package/build-types/dataform-controls/array.d.ts +1 -1
- package/build-types/dataform-controls/array.d.ts.map +1 -1
- package/build-types/dataform-controls/checkbox.d.ts +1 -1
- package/build-types/dataform-controls/checkbox.d.ts.map +1 -1
- package/build-types/dataform-controls/color.d.ts +1 -1
- package/build-types/dataform-controls/color.d.ts.map +1 -1
- package/build-types/dataform-controls/date.d.ts +1 -1
- package/build-types/dataform-controls/date.d.ts.map +1 -1
- package/build-types/dataform-controls/datetime.d.ts +1 -1
- package/build-types/dataform-controls/datetime.d.ts.map +1 -1
- package/build-types/dataform-controls/email.d.ts +1 -1
- package/build-types/dataform-controls/email.d.ts.map +1 -1
- package/build-types/dataform-controls/index.d.ts.map +1 -1
- package/build-types/dataform-controls/integer.d.ts +4 -1
- package/build-types/dataform-controls/integer.d.ts.map +1 -1
- package/build-types/dataform-controls/number.d.ts +6 -0
- package/build-types/dataform-controls/number.d.ts.map +1 -0
- package/build-types/dataform-controls/password.d.ts +1 -1
- package/build-types/dataform-controls/password.d.ts.map +1 -1
- package/build-types/dataform-controls/radio.d.ts +1 -1
- package/build-types/dataform-controls/radio.d.ts.map +1 -1
- package/build-types/dataform-controls/select.d.ts +1 -1
- package/build-types/dataform-controls/select.d.ts.map +1 -1
- package/build-types/dataform-controls/telephone.d.ts +1 -1
- package/build-types/dataform-controls/telephone.d.ts.map +1 -1
- package/build-types/dataform-controls/text.d.ts +1 -1
- package/build-types/dataform-controls/text.d.ts.map +1 -1
- package/build-types/dataform-controls/textarea.d.ts +1 -1
- package/build-types/dataform-controls/textarea.d.ts.map +1 -1
- package/build-types/dataform-controls/toggle-group.d.ts +1 -1
- package/build-types/dataform-controls/toggle-group.d.ts.map +1 -1
- package/build-types/dataform-controls/toggle.d.ts +1 -1
- package/build-types/dataform-controls/toggle.d.ts.map +1 -1
- package/build-types/dataform-controls/url.d.ts +1 -1
- package/build-types/dataform-controls/url.d.ts.map +1 -1
- package/build-types/dataform-controls/utils/get-custom-validity.d.ts +9 -0
- package/build-types/dataform-controls/utils/get-custom-validity.d.ts.map +1 -0
- package/build-types/dataform-controls/utils/relative-date-control.d.ts +5 -0
- package/build-types/dataform-controls/utils/relative-date-control.d.ts.map +1 -0
- package/build-types/dataform-controls/utils/validated-input.d.ts +1 -1
- package/build-types/dataform-controls/utils/validated-input.d.ts.map +1 -1
- package/build-types/dataform-controls/utils/validated-number.d.ts +9 -0
- package/build-types/dataform-controls/utils/validated-number.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/card/index.d.ts +1 -1
- package/build-types/dataform-layouts/card/index.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/data-form-layout.d.ts +5 -3
- package/build-types/dataform-layouts/data-form-layout.d.ts.map +1 -0
- package/build-types/dataform-layouts/get-summary-fields.d.ts +12 -0
- package/build-types/dataform-layouts/get-summary-fields.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/index.d.ts +0 -5
- package/build-types/dataform-layouts/index.d.ts.map +1 -0
- package/build-types/dataform-layouts/is-combined-field.d.ts.map +1 -0
- package/build-types/{normalize-form-fields.d.ts → dataform-layouts/normalize-form-fields.d.ts} +1 -1
- package/build-types/dataform-layouts/normalize-form-fields.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/panel/dropdown.d.ts +8 -7
- package/build-types/dataform-layouts/panel/dropdown.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/panel/index.d.ts +1 -1
- package/build-types/dataform-layouts/panel/index.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/panel/modal.d.ts +5 -5
- package/build-types/dataform-layouts/panel/modal.d.ts.map +1 -0
- package/build-types/dataform-layouts/panel/summary-button.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/regular/index.d.ts +1 -1
- package/build-types/dataform-layouts/regular/index.d.ts.map +1 -0
- package/build-types/{dataforms-layouts → dataform-layouts}/row/index.d.ts +1 -1
- package/build-types/dataform-layouts/row/index.d.ts.map +1 -0
- package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/utils/item-click-wrapper.d.ts +1 -1
- package/build-types/dataviews-layouts/utils/item-click-wrapper.d.ts.map +1 -1
- package/build-types/field-types/array.d.ts.map +1 -1
- package/build-types/field-types/boolean.d.ts +2 -1
- package/build-types/field-types/boolean.d.ts.map +1 -1
- package/build-types/field-types/color.d.ts +2 -1
- package/build-types/field-types/color.d.ts.map +1 -1
- package/build-types/field-types/date.d.ts +4 -3
- package/build-types/field-types/date.d.ts.map +1 -1
- package/build-types/field-types/datetime.d.ts +3 -2
- package/build-types/field-types/datetime.d.ts.map +1 -1
- package/build-types/field-types/email.d.ts +3 -2
- package/build-types/field-types/email.d.ts.map +1 -1
- package/build-types/field-types/index.d.ts.map +1 -1
- package/build-types/field-types/integer.d.ts +2 -1
- package/build-types/field-types/integer.d.ts.map +1 -1
- package/build-types/field-types/media.d.ts +2 -5
- package/build-types/field-types/media.d.ts.map +1 -1
- package/build-types/field-types/number.d.ts +21 -0
- package/build-types/field-types/number.d.ts.map +1 -0
- package/build-types/field-types/password.d.ts +4 -3
- package/build-types/field-types/password.d.ts.map +1 -1
- package/build-types/field-types/telephone.d.ts +4 -3
- package/build-types/field-types/telephone.d.ts.map +1 -1
- package/build-types/field-types/text.d.ts +4 -3
- package/build-types/field-types/text.d.ts.map +1 -1
- package/build-types/field-types/url.d.ts +4 -3
- package/build-types/field-types/url.d.ts.map +1 -1
- package/build-types/field-types/utils/render-from-elements.d.ts +6 -0
- package/build-types/field-types/utils/render-from-elements.d.ts.map +1 -0
- package/build-types/hooks/index.d.ts +5 -0
- package/build-types/hooks/index.d.ts.map +1 -0
- package/build-types/hooks/use-elements.d.ts +12 -0
- package/build-types/hooks/use-elements.d.ts.map +1 -0
- package/build-types/hooks/use-form-validity.d.ts +16 -0
- package/build-types/hooks/use-form-validity.d.ts.map +1 -0
- package/build-types/index.d.ts +2 -2
- package/build-types/index.d.ts.map +1 -1
- package/build-types/{components/dataform/stories/index.story.d.ts → stories/dataform.story.d.ts} +16 -6
- package/build-types/stories/dataform.story.d.ts.map +1 -0
- package/build-types/{components/dataviews-picker/stories/index.story.d.ts → stories/dataviews-picker.story.d.ts} +2 -2
- package/build-types/stories/dataviews-picker.story.d.ts.map +1 -0
- package/build-types/{components/dataviews/stories/fixtures.d.ts → stories/dataviews.fixtures.d.ts} +2 -2
- package/build-types/stories/dataviews.fixtures.d.ts.map +1 -0
- package/build-types/{components/dataviews/stories/index.story.d.ts → stories/dataviews.story.d.ts} +3 -3
- package/build-types/stories/dataviews.story.d.ts.map +1 -0
- package/build-types/stories/field-types.story.d.ts +157 -0
- package/build-types/stories/field-types.story.d.ts.map +1 -0
- package/build-types/test/use-form-validity.d.ts +2 -0
- package/build-types/test/use-form-validity.d.ts.map +1 -0
- package/build-types/types/dataform.d.ts +112 -0
- package/build-types/types/dataform.d.ts.map +1 -0
- package/build-types/types/dataviews.d.ts +341 -0
- package/build-types/types/dataviews.d.ts.map +1 -0
- package/build-types/types/field-api.d.ts +298 -0
- package/build-types/types/field-api.d.ts.map +1 -0
- package/build-types/types/index.d.ts +4 -0
- package/build-types/types/index.d.ts.map +1 -0
- package/build-types/{private-types.d.ts → types/private.d.ts} +1 -1
- package/build-types/types/private.d.ts.map +1 -0
- package/build-types/{filter-and-sort-data-view.d.ts → utils/filter-sort-and-paginate.d.ts} +3 -3
- package/build-types/utils/filter-sort-and-paginate.d.ts.map +1 -0
- package/build-types/utils/has-elements.d.ts +6 -0
- package/build-types/utils/has-elements.d.ts.map +1 -0
- package/build-types/utils/normalize-fields.d.ts +9 -0
- package/build-types/utils/normalize-fields.d.ts.map +1 -0
- package/build-wp/index.js +3151 -2714
- package/package.json +16 -18
- package/src/components/dataform/index.tsx +9 -3
- package/src/components/dataform-context/index.tsx +3 -1
- package/src/components/dataviews/index.tsx +2 -2
- package/src/components/dataviews/style.scss +4 -0
- package/src/components/dataviews-bulk-actions/index.tsx +1 -2
- package/src/components/dataviews-bulk-actions/style.scss +3 -0
- package/src/components/dataviews-context/index.ts +1 -1
- package/src/components/dataviews-filters/filter.tsx +11 -5
- package/src/components/dataviews-filters/search-widget.tsx +30 -3
- package/src/components/dataviews-filters/style.scss +21 -6
- package/src/components/dataviews-filters/use-filters.ts +4 -2
- package/src/components/dataviews-footer/style.scss +4 -0
- package/src/components/dataviews-item-actions/index.tsx +6 -2
- package/src/components/dataviews-item-actions/style.scss +3 -0
- package/src/components/dataviews-pagination/style.scss +3 -0
- package/src/components/dataviews-picker/footer.tsx +2 -4
- package/src/components/dataviews-picker/index.tsx +2 -2
- package/src/components/dataviews-picker/style.scss +2 -0
- package/src/components/dataviews-selection-checkbox/index.tsx +1 -1
- package/src/components/dataviews-selection-checkbox/style.scss +3 -0
- package/src/components/dataviews-view-config/style.scss +3 -0
- package/src/dataform-controls/array.tsx +16 -82
- package/src/dataform-controls/checkbox.tsx +5 -41
- package/src/dataform-controls/color.tsx +5 -37
- package/src/dataform-controls/date.tsx +375 -238
- package/src/dataform-controls/datetime.tsx +92 -60
- package/src/dataform-controls/email.tsx +2 -0
- package/src/dataform-controls/index.tsx +4 -1
- package/src/dataform-controls/integer.tsx +3 -179
- package/src/dataform-controls/number.tsx +10 -0
- package/src/dataform-controls/password.tsx +2 -0
- package/src/dataform-controls/radio.tsx +24 -55
- package/src/dataform-controls/select.tsx +14 -61
- package/src/dataform-controls/style.scss +2 -0
- package/src/dataform-controls/telephone.tsx +2 -0
- package/src/dataform-controls/text.tsx +2 -0
- package/src/dataform-controls/textarea.tsx +6 -42
- package/src/dataform-controls/toggle-group.tsx +38 -64
- package/src/dataform-controls/toggle.tsx +6 -42
- package/src/dataform-controls/url.tsx +2 -0
- package/src/dataform-controls/utils/get-custom-validity.ts +24 -0
- package/src/dataform-controls/{relative-date-control.tsx → utils/relative-date-control.tsx} +37 -25
- package/src/dataform-controls/utils/validated-input.tsx +4 -40
- package/src/dataform-controls/utils/validated-number.tsx +171 -0
- package/src/{dataforms-layouts → dataform-layouts}/card/index.tsx +106 -8
- package/src/dataform-layouts/card/style.scss +24 -0
- package/src/{dataforms-layouts → dataform-layouts}/data-form-layout.tsx +22 -5
- package/src/dataform-layouts/get-summary-fields.ts +42 -0
- package/src/{dataforms-layouts → dataform-layouts}/index.tsx +32 -2
- package/src/{normalize-form-fields.ts → dataform-layouts/normalize-form-fields.ts} +28 -1
- package/src/{dataforms-layouts → dataform-layouts}/panel/dropdown.tsx +36 -15
- package/src/{dataforms-layouts → dataform-layouts}/panel/index.tsx +88 -55
- package/src/{dataforms-layouts → dataform-layouts}/panel/modal.tsx +42 -31
- package/src/{dataforms-layouts → dataform-layouts}/panel/style.scss +3 -0
- package/src/{dataforms-layouts → dataform-layouts}/regular/index.tsx +5 -1
- package/src/{dataforms-layouts → dataform-layouts}/regular/style.scss +2 -0
- package/src/{dataforms-layouts → dataform-layouts}/row/index.tsx +9 -4
- package/src/dataform-layouts/style.scss +5 -0
- package/src/dataviews-layouts/grid/index.tsx +1 -1
- package/src/dataviews-layouts/grid/style.scss +8 -3
- package/src/dataviews-layouts/list/index.tsx +0 -2
- package/src/dataviews-layouts/list/style.scss +3 -0
- package/src/dataviews-layouts/picker-grid/index.tsx +1 -1
- package/src/dataviews-layouts/picker-grid/style.scss +8 -4
- package/src/dataviews-layouts/table/column-header-menu.tsx +1 -1
- package/src/dataviews-layouts/table/index.tsx +1 -1
- package/src/dataviews-layouts/table/style.scss +9 -0
- package/src/dataviews-layouts/utils/grid-items.scss +2 -0
- package/src/dataviews-layouts/utils/item-click-wrapper.tsx +40 -2
- package/src/field-types/array.tsx +1 -0
- package/src/field-types/boolean.tsx +4 -3
- package/src/field-types/color.tsx +4 -10
- package/src/field-types/{date.ts → date.tsx} +5 -16
- package/src/field-types/datetime.tsx +8 -21
- package/src/field-types/email.tsx +7 -11
- package/src/field-types/index.tsx +13 -23
- package/src/field-types/integer.tsx +7 -11
- package/src/field-types/media.tsx +3 -17
- package/src/field-types/number.tsx +92 -0
- package/src/field-types/password.tsx +8 -21
- package/src/field-types/telephone.tsx +8 -21
- package/src/field-types/text.tsx +8 -21
- package/src/field-types/url.tsx +8 -21
- package/src/field-types/utils/render-from-elements.tsx +29 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use-elements.ts +66 -0
- package/src/hooks/use-form-validity.ts +571 -0
- package/src/index.ts +2 -2
- package/src/{components/dataform/stories/index.story.tsx → stories/dataform.story.tsx} +455 -63
- package/src/{components/dataviews-picker/stories/index.story.tsx → stories/dataviews-picker.story.tsx} +5 -9
- package/src/{components/dataviews/stories/fixtures.tsx → stories/dataviews.fixtures.tsx} +36 -5
- package/src/{components/dataviews/stories/index.story.tsx → stories/dataviews.story.tsx} +7 -8
- package/src/{field-types/stories/index.story.tsx → stories/field-types.story.tsx} +244 -48
- package/src/style.scss +19 -18
- package/src/test/dataform.tsx +36 -0
- package/src/test/dataviews-picker.tsx +1 -1
- package/src/test/dataviews.tsx +1 -2
- package/src/test/{filter-and-sort-data-view.js → filter-sort-and-paginate.js} +63 -16
- package/src/test/normalize-fields.ts +23 -1
- package/src/test/normalize-form-fields.ts +54 -5
- package/src/test/use-form-validity.ts +546 -0
- package/src/types/dataform.ts +144 -0
- package/src/types/dataviews.ts +443 -0
- package/src/types/field-api.ts +381 -0
- package/src/types/index.ts +3 -0
- package/src/{filter-and-sort-data-view.ts → utils/filter-sort-and-paginate.ts} +4 -4
- package/src/utils/has-elements.ts +11 -0
- package/src/{normalize-fields.ts → utils/normalize-fields.ts} +13 -8
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataform-controls/relative-date-control.js +0 -105
- package/build/dataform-controls/relative-date-control.js.map +0 -1
- package/build/dataforms-layouts/card/index.js +0 -136
- package/build/dataforms-layouts/card/index.js.map +0 -1
- package/build/dataforms-layouts/data-form-layout.js +0 -71
- package/build/dataforms-layouts/data-form-layout.js.map +0 -1
- package/build/dataforms-layouts/index.js +0 -58
- package/build/dataforms-layouts/index.js.map +0 -1
- package/build/dataforms-layouts/is-combined-field.js +0 -14
- package/build/dataforms-layouts/is-combined-field.js.map +0 -1
- package/build/dataforms-layouts/panel/dropdown.js +0 -120
- package/build/dataforms-layouts/panel/dropdown.js.map +0 -1
- package/build/dataforms-layouts/panel/index.js +0 -126
- package/build/dataforms-layouts/panel/index.js.map +0 -1
- package/build/dataforms-layouts/panel/modal.js +0 -120
- package/build/dataforms-layouts/panel/modal.js.map +0 -1
- package/build/dataforms-layouts/panel/summary-button.js +0 -67
- package/build/dataforms-layouts/panel/summary-button.js.map +0 -1
- package/build/dataforms-layouts/regular/index.js +0 -116
- package/build/dataforms-layouts/regular/index.js.map +0 -1
- package/build/dataforms-layouts/row/index.js +0 -113
- package/build/dataforms-layouts/row/index.js.map +0 -1
- package/build/filter-and-sort-data-view.js +0 -313
- package/build/filter-and-sort-data-view.js.map +0 -1
- package/build/normalize-fields.js +0 -155
- package/build/normalize-fields.js.map +0 -1
- package/build/normalize-form-fields.js +0 -81
- package/build/normalize-form-fields.js.map +0 -1
- package/build/private-types.js +0 -6
- package/build/private-types.js.map +0 -1
- package/build/types.js +0 -6
- package/build/types.js.map +0 -1
- package/build/utils.js +0 -22
- package/build/utils.js.map +0 -1
- package/build/validation.js +0 -61
- package/build/validation.js.map +0 -1
- package/build-module/dataform-controls/relative-date-control.js +0 -96
- package/build-module/dataform-controls/relative-date-control.js.map +0 -1
- package/build-module/dataforms-layouts/card/index.js +0 -127
- package/build-module/dataforms-layouts/card/index.js.map +0 -1
- package/build-module/dataforms-layouts/data-form-layout.js +0 -62
- package/build-module/dataforms-layouts/data-form-layout.js.map +0 -1
- package/build-module/dataforms-layouts/index.js +0 -51
- package/build-module/dataforms-layouts/index.js.map +0 -1
- package/build-module/dataforms-layouts/is-combined-field.js +0 -8
- package/build-module/dataforms-layouts/is-combined-field.js.map +0 -1
- package/build-module/dataforms-layouts/panel/dropdown.js +0 -113
- package/build-module/dataforms-layouts/panel/dropdown.js.map +0 -1
- package/build-module/dataforms-layouts/panel/index.js +0 -119
- package/build-module/dataforms-layouts/panel/index.js.map +0 -1
- package/build-module/dataforms-layouts/panel/modal.js +0 -113
- package/build-module/dataforms-layouts/panel/modal.js.map +0 -1
- package/build-module/dataforms-layouts/panel/summary-button.js +0 -60
- package/build-module/dataforms-layouts/panel/summary-button.js.map +0 -1
- package/build-module/dataforms-layouts/regular/index.js +0 -109
- package/build-module/dataforms-layouts/regular/index.js.map +0 -1
- package/build-module/dataforms-layouts/row/index.js +0 -106
- package/build-module/dataforms-layouts/row/index.js.map +0 -1
- package/build-module/filter-and-sort-data-view.js +0 -305
- package/build-module/filter-and-sort-data-view.js.map +0 -1
- package/build-module/normalize-fields.js +0 -145
- package/build-module/normalize-fields.js.map +0 -1
- package/build-module/normalize-form-fields.js +0 -73
- package/build-module/normalize-form-fields.js.map +0 -1
- package/build-module/private-types.js +0 -2
- package/build-module/private-types.js.map +0 -1
- package/build-module/types.js +0 -2
- package/build-module/types.js.map +0 -1
- package/build-module/utils.js +0 -16
- package/build-module/utils.js.map +0 -1
- package/build-module/validation.js +0 -54
- package/build-module/validation.js.map +0 -1
- package/build-types/components/dataform/stories/index.story.d.ts.map +0 -1
- package/build-types/components/dataviews/stories/fixtures.d.ts.map +0 -1
- package/build-types/components/dataviews/stories/index.story.d.ts.map +0 -1
- package/build-types/components/dataviews-picker/stories/index.story.d.ts.map +0 -1
- package/build-types/dataform-controls/relative-date-control.d.ts +0 -47
- package/build-types/dataform-controls/relative-date-control.d.ts.map +0 -1
- package/build-types/dataforms-layouts/card/index.d.ts.map +0 -1
- package/build-types/dataforms-layouts/data-form-layout.d.ts.map +0 -1
- package/build-types/dataforms-layouts/index.d.ts.map +0 -1
- package/build-types/dataforms-layouts/is-combined-field.d.ts.map +0 -1
- package/build-types/dataforms-layouts/panel/dropdown.d.ts.map +0 -1
- package/build-types/dataforms-layouts/panel/index.d.ts.map +0 -1
- package/build-types/dataforms-layouts/panel/modal.d.ts.map +0 -1
- package/build-types/dataforms-layouts/panel/summary-button.d.ts.map +0 -1
- package/build-types/dataforms-layouts/regular/index.d.ts.map +0 -1
- package/build-types/dataforms-layouts/row/index.d.ts.map +0 -1
- package/build-types/field-types/stories/index.story.d.ts +0 -85
- package/build-types/field-types/stories/index.story.d.ts.map +0 -1
- package/build-types/filter-and-sort-data-view.d.ts.map +0 -1
- package/build-types/normalize-fields.d.ts +0 -12
- package/build-types/normalize-fields.d.ts.map +0 -1
- package/build-types/normalize-form-fields.d.ts.map +0 -1
- package/build-types/private-types.d.ts.map +0 -1
- package/build-types/test/validation.d.ts +0 -2
- package/build-types/test/validation.d.ts.map +0 -1
- package/build-types/types.d.ts +0 -688
- package/build-types/types.d.ts.map +0 -1
- package/build-types/utils.d.ts +0 -6
- package/build-types/utils.d.ts.map +0 -1
- package/build-types/validation.d.ts +0 -12
- package/build-types/validation.d.ts.map +0 -1
- package/src/dataforms-layouts/card/style.scss +0 -10
- package/src/test/validation.ts +0 -312
- package/src/types.ts +0 -891
- package/src/utils.ts +0 -15
- package/src/validation.ts +0 -91
- /package/build-types/{dataforms-layouts → dataform-layouts}/is-combined-field.d.ts +0 -0
- /package/build-types/{dataforms-layouts → dataform-layouts}/panel/summary-button.d.ts +0 -0
- /package/src/{dataforms-layouts → dataform-layouts}/is-combined-field.ts +0 -0
- /package/src/{dataforms-layouts → dataform-layouts}/panel/summary-button.tsx +0 -0
- /package/src/{dataforms-layouts → dataform-layouts}/row/style.scss +0 -0
- /package/src/{components/dataviews/stories/style.css → stories/dataviews.style.css} +0 -0
- /package/src/{private-types.tsx → types/private.ts} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var use_elements_exports = {};
|
|
20
|
+
__export(use_elements_exports, {
|
|
21
|
+
default: () => useElements
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(use_elements_exports);
|
|
24
|
+
var import_element = require("@wordpress/element");
|
|
25
|
+
const EMPTY_ARRAY = [];
|
|
26
|
+
function useElements({
|
|
27
|
+
elements,
|
|
28
|
+
getElements
|
|
29
|
+
}) {
|
|
30
|
+
const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY;
|
|
31
|
+
const [records, setRecords] = (0, import_element.useState)(staticElements);
|
|
32
|
+
const [isLoading, setIsLoading] = (0, import_element.useState)(false);
|
|
33
|
+
(0, import_element.useEffect)(() => {
|
|
34
|
+
if (!getElements) {
|
|
35
|
+
setRecords(staticElements);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
let cancelled = false;
|
|
39
|
+
setIsLoading(true);
|
|
40
|
+
getElements().then((fetchedElements) => {
|
|
41
|
+
if (!cancelled) {
|
|
42
|
+
const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
|
|
43
|
+
setRecords(dynamicElements);
|
|
44
|
+
}
|
|
45
|
+
}).catch(() => {
|
|
46
|
+
if (!cancelled) {
|
|
47
|
+
setRecords(staticElements);
|
|
48
|
+
}
|
|
49
|
+
}).finally(() => {
|
|
50
|
+
if (!cancelled) {
|
|
51
|
+
setIsLoading(false);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return () => {
|
|
55
|
+
cancelled = true;
|
|
56
|
+
};
|
|
57
|
+
}, [getElements, staticElements]);
|
|
58
|
+
return {
|
|
59
|
+
elements: records,
|
|
60
|
+
isLoading
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=use-elements.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/use-elements.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { Option } from '../types';\n\nconst EMPTY_ARRAY: Option[] = [];\n\nexport default function useElements( {\n\telements,\n\tgetElements,\n}: {\n\telements?: Option[];\n\tgetElements?: () => Promise< Option[] >;\n} ) {\n\tconst staticElements =\n\t\tArray.isArray( elements ) && elements.length > 0\n\t\t\t? elements\n\t\t\t: EMPTY_ARRAY;\n\tconst [ records, setRecords ] = useState< Option[] >( staticElements );\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( ! getElements ) {\n\t\t\tsetRecords( staticElements );\n\t\t\treturn;\n\t\t}\n\n\t\tlet cancelled = false;\n\t\tsetIsLoading( true );\n\t\tgetElements()\n\t\t\t.then( ( fetchedElements ) => {\n\t\t\t\tif ( ! cancelled ) {\n\t\t\t\t\tconst dynamicElements =\n\t\t\t\t\t\tArray.isArray( fetchedElements ) &&\n\t\t\t\t\t\tfetchedElements.length > 0\n\t\t\t\t\t\t\t? fetchedElements\n\t\t\t\t\t\t\t: staticElements;\n\t\t\t\t\tsetRecords( dynamicElements );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tif ( ! cancelled ) {\n\t\t\t\t\tsetRecords( staticElements );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.finally( () => {\n\t\t\t\tif ( ! cancelled ) {\n\t\t\t\t\tsetIsLoading( false );\n\t\t\t\t}\n\t\t\t} );\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t}, [ getElements, staticElements ] );\n\n\treturn {\n\t\telements: records,\n\t\tisLoading,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAoC;AAOpC,MAAM,cAAwB,CAAC;AAEhB,SAAR,YAA8B;AAAA,EACpC;AAAA,EACA;AACD,GAGI;AACH,QAAM,iBACL,MAAM,QAAS,QAAS,KAAK,SAAS,SAAS,IAC5C,WACA;AACJ,QAAM,CAAE,SAAS,UAAW,QAAI,yBAAsB,cAAe;AACrE,QAAM,CAAE,WAAW,YAAa,QAAI,yBAAU,KAAM;AAEpD,gCAAW,MAAM;AAChB,QAAK,CAAE,aAAc;AACpB,iBAAY,cAAe;AAC3B;AAAA,IACD;AAEA,QAAI,YAAY;AAChB,iBAAc,IAAK;AACnB,gBAAY,EACV,KAAM,CAAE,oBAAqB;AAC7B,UAAK,CAAE,WAAY;AAClB,cAAM,kBACL,MAAM,QAAS,eAAgB,KAC/B,gBAAgB,SAAS,IACtB,kBACA;AACJ,mBAAY,eAAgB;AAAA,MAC7B;AAAA,IACD,CAAE,EACD,MAAO,MAAM;AACb,UAAK,CAAE,WAAY;AAClB,mBAAY,cAAe;AAAA,MAC5B;AAAA,IACD,CAAE,EACD,QAAS,MAAM;AACf,UAAK,CAAE,WAAY;AAClB,qBAAc,KAAM;AAAA,MACrB;AAAA,IACD,CAAE;AAEH,WAAO,MAAM;AACZ,kBAAY;AAAA,IACb;AAAA,EACD,GAAG,CAAE,aAAa,cAAe,CAAE;AAEnC,SAAO;AAAA,IACN,UAAU;AAAA,IACV;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var use_form_validity_exports = {};
|
|
30
|
+
__export(use_form_validity_exports, {
|
|
31
|
+
default: () => use_form_validity_default,
|
|
32
|
+
useFormValidity: () => useFormValidity
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(use_form_validity_exports);
|
|
35
|
+
var import_deepmerge = __toESM(require("deepmerge"));
|
|
36
|
+
var import_element = require("@wordpress/element");
|
|
37
|
+
var import_i18n = require("@wordpress/i18n");
|
|
38
|
+
var import_normalize_fields = __toESM(require("../utils/normalize-fields"));
|
|
39
|
+
var import_normalize_form_fields = __toESM(require("../dataform-layouts/normalize-form-fields"));
|
|
40
|
+
const isEmptyNullOrUndefined = (value) => [void 0, "", null].includes(value);
|
|
41
|
+
const isArrayOrElementsEmptyNullOrUndefined = (value) => {
|
|
42
|
+
return !Array.isArray(value) || value.length === 0 || value.every((element) => isEmptyNullOrUndefined(element));
|
|
43
|
+
};
|
|
44
|
+
function isInvalidForRequired(fieldType, value) {
|
|
45
|
+
if (fieldType === void 0 && isEmptyNullOrUndefined(value) || fieldType === "text" && isEmptyNullOrUndefined(value) || fieldType === "email" && isEmptyNullOrUndefined(value) || fieldType === "url" && isEmptyNullOrUndefined(value) || fieldType === "telephone" && isEmptyNullOrUndefined(value) || fieldType === "password" && isEmptyNullOrUndefined(value) || fieldType === "integer" && isEmptyNullOrUndefined(value) || fieldType === "number" && isEmptyNullOrUndefined(value) || fieldType === "array" && isArrayOrElementsEmptyNullOrUndefined(value) || fieldType === "boolean" && value !== true) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
function isFormValid(formValidity) {
|
|
51
|
+
if (!formValidity) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return Object.values(formValidity).every((fieldValidation) => {
|
|
55
|
+
return Object.entries(fieldValidation).every(
|
|
56
|
+
([key, validation]) => {
|
|
57
|
+
if (key === "children" && validation && typeof validation === "object") {
|
|
58
|
+
return isFormValid(validation);
|
|
59
|
+
}
|
|
60
|
+
return validation.type === "valid";
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function updateFieldValidity(setFormValidity, parentFieldId, fieldId, newValidity) {
|
|
66
|
+
if (parentFieldId) {
|
|
67
|
+
setFormValidity((prev) => ({
|
|
68
|
+
...prev,
|
|
69
|
+
[parentFieldId]: {
|
|
70
|
+
...prev?.[parentFieldId],
|
|
71
|
+
children: {
|
|
72
|
+
...prev?.[parentFieldId]?.children,
|
|
73
|
+
[fieldId]: {
|
|
74
|
+
...newValidity
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
} else {
|
|
80
|
+
setFormValidity((prev) => ({
|
|
81
|
+
...prev,
|
|
82
|
+
[fieldId]: {
|
|
83
|
+
...newValidity
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function getFieldsToValidate(fields, form) {
|
|
89
|
+
const formFields = (0, import_normalize_form_fields.default)(form);
|
|
90
|
+
if (formFields.length === 0) {
|
|
91
|
+
return { fields: [], fieldToParent: /* @__PURE__ */ new Map() };
|
|
92
|
+
}
|
|
93
|
+
const fieldToParent = /* @__PURE__ */ new Map();
|
|
94
|
+
const fieldIdsToValidate = [];
|
|
95
|
+
formFields.forEach((formField) => {
|
|
96
|
+
if (!!formField.children) {
|
|
97
|
+
formField.children.forEach((child) => {
|
|
98
|
+
const childId = typeof child === "string" ? child : child.id;
|
|
99
|
+
fieldIdsToValidate.push(childId);
|
|
100
|
+
fieldToParent.set(childId, formField.id);
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
fieldIdsToValidate.push(formField.id);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
fields: (0, import_normalize_fields.default)(
|
|
108
|
+
fields.filter(
|
|
109
|
+
(field) => fieldIdsToValidate.includes(field.id)
|
|
110
|
+
)
|
|
111
|
+
),
|
|
112
|
+
fieldToParent
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function useFormValidity(item, fields, form) {
|
|
116
|
+
const [formValidity, setFormValidity] = (0, import_element.useState)();
|
|
117
|
+
const previousValidatedValuesRef = (0, import_element.useRef)({});
|
|
118
|
+
const customValidationCounterRef = (0, import_element.useRef)({});
|
|
119
|
+
const elementsValidationCounterRef = (0, import_element.useRef)(
|
|
120
|
+
{}
|
|
121
|
+
);
|
|
122
|
+
const validate = (0, import_element.useCallback)(() => {
|
|
123
|
+
const { fields: fieldsToValidate, fieldToParent } = getFieldsToValidate(
|
|
124
|
+
fields,
|
|
125
|
+
form
|
|
126
|
+
);
|
|
127
|
+
if (fieldsToValidate.length === 0) {
|
|
128
|
+
setFormValidity(void 0);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
fieldsToValidate.forEach((field) => {
|
|
132
|
+
const value = field.getValue({ item });
|
|
133
|
+
if (previousValidatedValuesRef.current.hasOwnProperty(field.id) && value === previousValidatedValuesRef.current[field.id]) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
previousValidatedValuesRef.current[field.id] = value;
|
|
137
|
+
const parentFieldId = fieldToParent.get(field.id);
|
|
138
|
+
if (field.isValid.required && isInvalidForRequired(field.type, value)) {
|
|
139
|
+
updateFieldValidity(setFormValidity, parentFieldId, field.id, {
|
|
140
|
+
required: { type: "invalid" }
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (field.isValid.elements && field.hasElements && !field.getElements && Array.isArray(field.elements)) {
|
|
145
|
+
const validValues = field.elements.map((el) => el.value);
|
|
146
|
+
if (field.type !== "array" && !validValues.includes(value)) {
|
|
147
|
+
updateFieldValidity(
|
|
148
|
+
setFormValidity,
|
|
149
|
+
parentFieldId,
|
|
150
|
+
field.id,
|
|
151
|
+
{
|
|
152
|
+
elements: {
|
|
153
|
+
type: "invalid",
|
|
154
|
+
message: "Value must be one of the elements."
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (field.type === "array" && !Array.isArray(value)) {
|
|
161
|
+
updateFieldValidity(
|
|
162
|
+
setFormValidity,
|
|
163
|
+
parentFieldId,
|
|
164
|
+
field.id,
|
|
165
|
+
{
|
|
166
|
+
elements: {
|
|
167
|
+
type: "invalid",
|
|
168
|
+
message: "Value must be an array."
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (field.type === "array" && value.some((v) => !validValues.includes(v))) {
|
|
175
|
+
updateFieldValidity(
|
|
176
|
+
setFormValidity,
|
|
177
|
+
parentFieldId,
|
|
178
|
+
field.id,
|
|
179
|
+
{
|
|
180
|
+
elements: {
|
|
181
|
+
type: "invalid",
|
|
182
|
+
message: "Value must be one of the elements."
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (field.isValid.elements && field.hasElements && typeof field.getElements === "function") {
|
|
190
|
+
const currentToken = (elementsValidationCounterRef.current[field.id] || 0) + 1;
|
|
191
|
+
elementsValidationCounterRef.current[field.id] = currentToken;
|
|
192
|
+
updateFieldValidity(setFormValidity, parentFieldId, field.id, {
|
|
193
|
+
elements: {
|
|
194
|
+
type: "validating",
|
|
195
|
+
message: "Validating..."
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
field.getElements().then((result) => {
|
|
199
|
+
if (elementsValidationCounterRef.current[field.id] !== currentToken) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (!Array.isArray(result)) {
|
|
203
|
+
updateFieldValidity(
|
|
204
|
+
setFormValidity,
|
|
205
|
+
parentFieldId,
|
|
206
|
+
field.id,
|
|
207
|
+
{
|
|
208
|
+
elements: {
|
|
209
|
+
type: "invalid",
|
|
210
|
+
message: "Could not validate elements."
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const validValues = result.map((el) => el.value);
|
|
217
|
+
if (field.type !== "array" && !validValues.includes(value)) {
|
|
218
|
+
updateFieldValidity(
|
|
219
|
+
setFormValidity,
|
|
220
|
+
parentFieldId,
|
|
221
|
+
field.id,
|
|
222
|
+
{
|
|
223
|
+
elements: {
|
|
224
|
+
type: "invalid",
|
|
225
|
+
message: "Value must be one of the elements."
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (field.type === "array" && !Array.isArray(value)) {
|
|
232
|
+
updateFieldValidity(
|
|
233
|
+
setFormValidity,
|
|
234
|
+
parentFieldId,
|
|
235
|
+
field.id,
|
|
236
|
+
{
|
|
237
|
+
elements: {
|
|
238
|
+
type: "invalid",
|
|
239
|
+
message: "Value must be an array."
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (field.type === "array" && value.some(
|
|
246
|
+
(v) => !validValues.includes(v)
|
|
247
|
+
)) {
|
|
248
|
+
updateFieldValidity(
|
|
249
|
+
setFormValidity,
|
|
250
|
+
parentFieldId,
|
|
251
|
+
field.id,
|
|
252
|
+
{
|
|
253
|
+
elements: {
|
|
254
|
+
type: "invalid",
|
|
255
|
+
message: "Value must be one of the elements."
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
}).catch((error) => {
|
|
261
|
+
if (elementsValidationCounterRef.current[field.id] !== currentToken) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
updateFieldValidity(
|
|
265
|
+
setFormValidity,
|
|
266
|
+
parentFieldId,
|
|
267
|
+
field.id,
|
|
268
|
+
{
|
|
269
|
+
elements: {
|
|
270
|
+
type: "invalid",
|
|
271
|
+
message: error.message
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
let customError;
|
|
278
|
+
try {
|
|
279
|
+
customError = field.isValid?.custom?.(
|
|
280
|
+
(0, import_deepmerge.default)(
|
|
281
|
+
item,
|
|
282
|
+
field.setValue({
|
|
283
|
+
item,
|
|
284
|
+
value
|
|
285
|
+
})
|
|
286
|
+
),
|
|
287
|
+
field
|
|
288
|
+
);
|
|
289
|
+
} catch (error) {
|
|
290
|
+
let errorMessage;
|
|
291
|
+
if (error instanceof Error) {
|
|
292
|
+
errorMessage = error.message;
|
|
293
|
+
} else {
|
|
294
|
+
errorMessage = String(error) || (0, import_i18n.__)("Unknown error when running custom validation.");
|
|
295
|
+
}
|
|
296
|
+
updateFieldValidity(setFormValidity, parentFieldId, field.id, {
|
|
297
|
+
custom: {
|
|
298
|
+
type: "invalid",
|
|
299
|
+
message: errorMessage
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
if (typeof customError === "string") {
|
|
304
|
+
updateFieldValidity(setFormValidity, parentFieldId, field.id, {
|
|
305
|
+
custom: {
|
|
306
|
+
type: "invalid",
|
|
307
|
+
message: customError
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (customError instanceof Promise) {
|
|
313
|
+
const currentToken = (customValidationCounterRef.current[field.id] || 0) + 1;
|
|
314
|
+
customValidationCounterRef.current[field.id] = currentToken;
|
|
315
|
+
updateFieldValidity(setFormValidity, parentFieldId, field.id, {
|
|
316
|
+
custom: {
|
|
317
|
+
type: "validating",
|
|
318
|
+
message: "Validating..."
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
customError.then((result) => {
|
|
322
|
+
if (customValidationCounterRef.current[field.id] !== currentToken) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (result === null) {
|
|
326
|
+
updateFieldValidity(
|
|
327
|
+
setFormValidity,
|
|
328
|
+
parentFieldId,
|
|
329
|
+
field.id,
|
|
330
|
+
{
|
|
331
|
+
custom: {
|
|
332
|
+
type: "valid",
|
|
333
|
+
message: "Valid"
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (typeof result === "string") {
|
|
340
|
+
updateFieldValidity(
|
|
341
|
+
setFormValidity,
|
|
342
|
+
parentFieldId,
|
|
343
|
+
field.id,
|
|
344
|
+
{
|
|
345
|
+
custom: {
|
|
346
|
+
type: "invalid",
|
|
347
|
+
message: result
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
}).catch((error) => {
|
|
353
|
+
if (customValidationCounterRef.current[field.id] !== currentToken) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
updateFieldValidity(
|
|
357
|
+
setFormValidity,
|
|
358
|
+
parentFieldId,
|
|
359
|
+
field.id,
|
|
360
|
+
{
|
|
361
|
+
custom: {
|
|
362
|
+
type: "invalid",
|
|
363
|
+
message: error.message
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
});
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
setFormValidity((prev) => {
|
|
371
|
+
if (!prev) {
|
|
372
|
+
return prev;
|
|
373
|
+
}
|
|
374
|
+
if (parentFieldId) {
|
|
375
|
+
const parentField = prev[parentFieldId];
|
|
376
|
+
if (!parentField?.children) {
|
|
377
|
+
return prev;
|
|
378
|
+
}
|
|
379
|
+
const { [field.id]: removed2, ...restChildren } = parentField.children;
|
|
380
|
+
if (Object.keys(restChildren).length === 0) {
|
|
381
|
+
const { children, ...restParent } = parentField;
|
|
382
|
+
if (Object.keys(restParent).length === 0) {
|
|
383
|
+
const {
|
|
384
|
+
[parentFieldId]: removedParent,
|
|
385
|
+
...restFields
|
|
386
|
+
} = prev;
|
|
387
|
+
return Object.keys(restFields).length === 0 ? void 0 : restFields;
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
...prev,
|
|
391
|
+
[parentFieldId]: restParent
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
...prev,
|
|
396
|
+
[parentFieldId]: {
|
|
397
|
+
...parentField,
|
|
398
|
+
children: restChildren
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
if (!prev[field.id]) {
|
|
403
|
+
return prev;
|
|
404
|
+
}
|
|
405
|
+
const { [field.id]: removed, ...rest } = prev;
|
|
406
|
+
if (Object.keys(rest).length === 0) {
|
|
407
|
+
return void 0;
|
|
408
|
+
}
|
|
409
|
+
return rest;
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
}, [item, fields, form]);
|
|
413
|
+
(0, import_element.useEffect)(() => {
|
|
414
|
+
validate();
|
|
415
|
+
}, [validate]);
|
|
416
|
+
return {
|
|
417
|
+
validity: formValidity,
|
|
418
|
+
isValid: isFormValid(formValidity)
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
var use_form_validity_default = useFormValidity;
|
|
422
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
423
|
+
0 && (module.exports = {
|
|
424
|
+
useFormValidity
|
|
425
|
+
});
|
|
426
|
+
//# sourceMappingURL=use-form-validity.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/use-form-validity.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport deepMerge from 'deepmerge';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport normalizeFields from '../utils/normalize-fields';\nimport normalizeFormFields from '../dataform-layouts/normalize-form-fields';\nimport type {\n\tCombinedFormField,\n\tField,\n\tFieldValidity,\n\tForm,\n\tFormValidity,\n\tNormalizedField,\n} from '../types';\nconst isEmptyNullOrUndefined = ( value: any ) =>\n\t[ undefined, '', null ].includes( value );\n\nconst isArrayOrElementsEmptyNullOrUndefined = ( value: any ) => {\n\treturn (\n\t\t! Array.isArray( value ) ||\n\t\tvalue.length === 0 ||\n\t\tvalue.every( ( element: any ) => isEmptyNullOrUndefined( element ) )\n\t);\n};\n\nfunction isInvalidForRequired( fieldType: string | undefined, value: any ) {\n\tif (\n\t\t( fieldType === undefined && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'text' && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'email' && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'url' && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'telephone' && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'password' && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'integer' && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'number' && isEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'array' &&\n\t\t\tisArrayOrElementsEmptyNullOrUndefined( value ) ) ||\n\t\t( fieldType === 'boolean' && value !== true )\n\t) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction isFormValid( formValidity: FormValidity | undefined ): boolean {\n\tif ( ! formValidity ) {\n\t\treturn true;\n\t}\n\n\treturn Object.values( formValidity ).every( ( fieldValidation ) => {\n\t\treturn Object.entries( fieldValidation ).every(\n\t\t\t( [ key, validation ] ) => {\n\t\t\t\tif (\n\t\t\t\t\tkey === 'children' &&\n\t\t\t\t\tvalidation &&\n\t\t\t\t\ttypeof validation === 'object'\n\t\t\t\t) {\n\t\t\t\t\t// Recursively check children validations\n\t\t\t\t\treturn isFormValid( validation as FormValidity );\n\t\t\t\t}\n\t\t\t\treturn validation.type === 'valid';\n\t\t\t}\n\t\t);\n\t} );\n}\n\nfunction updateFieldValidity(\n\tsetFormValidity: React.Dispatch< React.SetStateAction< FormValidity > >,\n\tparentFieldId: string | undefined,\n\tfieldId: string,\n\tnewValidity: FieldValidity\n) {\n\tif ( parentFieldId ) {\n\t\tsetFormValidity( ( prev ) => ( {\n\t\t\t...prev,\n\t\t\t[ parentFieldId ]: {\n\t\t\t\t...prev?.[ parentFieldId ],\n\t\t\t\tchildren: {\n\t\t\t\t\t...prev?.[ parentFieldId ]?.children,\n\t\t\t\t\t[ fieldId ]: {\n\t\t\t\t\t\t...newValidity,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t} ) );\n\t} else {\n\t\tsetFormValidity( ( prev ) => ( {\n\t\t\t...prev,\n\t\t\t[ fieldId ]: {\n\t\t\t\t...newValidity,\n\t\t\t},\n\t\t} ) );\n\t}\n}\n\nfunction getFieldsToValidate< Item >(\n\tfields: Field< Item >[],\n\tform: Form\n): {\n\tfields: NormalizedField< Item >[];\n\tfieldToParent: Map< string, string >;\n} {\n\tconst formFields = normalizeFormFields( form );\n\tif ( formFields.length === 0 ) {\n\t\treturn { fields: [], fieldToParent: new Map() };\n\t}\n\n\tconst fieldToParent = new Map< string, string >();\n\tconst fieldIdsToValidate: string[] = [];\n\tformFields.forEach( ( formField ) => {\n\t\tif ( !! ( formField as CombinedFormField ).children ) {\n\t\t\t( formField as CombinedFormField ).children.forEach( ( child ) => {\n\t\t\t\tconst childId = typeof child === 'string' ? child : child.id;\n\t\t\t\tfieldIdsToValidate.push( childId );\n\t\t\t\tfieldToParent.set( childId, formField.id );\n\t\t\t} );\n\t\t} else {\n\t\t\tfieldIdsToValidate.push( formField.id );\n\t\t}\n\t} );\n\n\treturn {\n\t\tfields: normalizeFields(\n\t\t\tfields.filter( ( field ) =>\n\t\t\t\tfieldIdsToValidate.includes( field.id )\n\t\t\t)\n\t\t),\n\t\tfieldToParent,\n\t};\n}\n\n/**\n * Hook that validates a form item and returns an object with error messages for each field.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return Record of field IDs to error messages (undefined means no error).\n */\nexport function useFormValidity< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form\n): { validity: FormValidity; isValid: boolean } {\n\tconst [ formValidity, setFormValidity ] = useState< FormValidity >();\n\tconst previousValidatedValuesRef = useRef< Record< string, any > >( {} );\n\n\t// The following counters are used to track the validation promises triggered\n\t// by executing isValid.custom and the elements validation. When the promise resolves,\n\t// it will update the form validity state ONLY if its counter matches the current one.\n\tconst customValidationCounterRef = useRef< Record< string, number > >( {} );\n\tconst elementsValidationCounterRef = useRef< Record< string, number > >(\n\t\t{}\n\t);\n\n\tconst validate = useCallback( () => {\n\t\tconst { fields: fieldsToValidate, fieldToParent } = getFieldsToValidate(\n\t\t\tfields,\n\t\t\tform\n\t\t);\n\t\tif ( fieldsToValidate.length === 0 ) {\n\t\t\tsetFormValidity( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\tfieldsToValidate.forEach( ( field ) => {\n\t\t\tconst value = field.getValue( { item } );\n\t\t\tif (\n\t\t\t\tpreviousValidatedValuesRef.current.hasOwnProperty( field.id ) &&\n\t\t\t\tvalue === previousValidatedValuesRef.current[ field.id ]\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpreviousValidatedValuesRef.current[ field.id ] = value;\n\n\t\t\tconst parentFieldId = fieldToParent.get( field.id );\n\n\t\t\t// isValid.required\n\t\t\tif (\n\t\t\t\tfield.isValid.required &&\n\t\t\t\tisInvalidForRequired( field.type, value )\n\t\t\t) {\n\t\t\t\tupdateFieldValidity( setFormValidity, parentFieldId, field.id, {\n\t\t\t\t\trequired: { type: 'invalid' },\n\t\t\t\t} );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// isValid.elements (static elements)\n\t\t\tif (\n\t\t\t\tfield.isValid.elements &&\n\t\t\t\tfield.hasElements &&\n\t\t\t\t! field.getElements &&\n\t\t\t\tArray.isArray( field.elements )\n\t\t\t) {\n\t\t\t\tconst validValues = field.elements.map( ( el ) => el.value );\n\n\t\t\t\tif (\n\t\t\t\t\tfield.type !== 'array' &&\n\t\t\t\t\t! validValues.includes( value )\n\t\t\t\t) {\n\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\tmessage: 'Value must be one of the elements.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( field.type === 'array' && ! Array.isArray( value ) ) {\n\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\tmessage: 'Value must be an array.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\tfield.type === 'array' &&\n\t\t\t\t\tvalue.some( ( v: any ) => ! validValues.includes( v ) )\n\t\t\t\t) {\n\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\tmessage: 'Value must be one of the elements.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// isValid.elements (get them via getElements first)\n\t\t\tif (\n\t\t\t\tfield.isValid.elements &&\n\t\t\t\tfield.hasElements &&\n\t\t\t\ttypeof field.getElements === 'function'\n\t\t\t) {\n\t\t\t\tconst currentToken =\n\t\t\t\t\t( elementsValidationCounterRef.current[ field.id ] || 0 ) +\n\t\t\t\t\t1;\n\t\t\t\telementsValidationCounterRef.current[ field.id ] = currentToken;\n\t\t\t\tupdateFieldValidity( setFormValidity, parentFieldId, field.id, {\n\t\t\t\t\telements: {\n\t\t\t\t\t\ttype: 'validating',\n\t\t\t\t\t\tmessage: 'Validating...',\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tfield\n\t\t\t\t\t.getElements()\n\t\t\t\t\t.then( ( result ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\telementsValidationCounterRef.current[ field.id ] !==\n\t\t\t\t\t\t\tcurrentToken\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( ! Array.isArray( result ) ) {\n\t\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Could not validate elements.',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst validValues = result.map( ( el ) => el.value );\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tfield.type !== 'array' &&\n\t\t\t\t\t\t\t! validValues.includes( value )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t\t'Value must be one of the elements.',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tfield.type === 'array' &&\n\t\t\t\t\t\t\t! Array.isArray( value )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Value must be an array.',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tfield.type === 'array' &&\n\t\t\t\t\t\t\tvalue.some(\n\t\t\t\t\t\t\t\t( v: any ) => ! validValues.includes( v )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t\t'Value must be one of the elements.',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} )\n\t\t\t\t\t.catch( ( error ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\telementsValidationCounterRef.current[ field.id ] !==\n\t\t\t\t\t\t\tcurrentToken\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\telements: {\n\t\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Check isValid.custom\n\t\t\tlet customError;\n\t\t\ttry {\n\t\t\t\tcustomError = field.isValid?.custom?.(\n\t\t\t\t\tdeepMerge(\n\t\t\t\t\t\titem,\n\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\titem,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t} ) as Partial< Item >\n\t\t\t\t\t),\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} catch ( error: any ) {\n\t\t\t\tlet errorMessage;\n\t\t\t\tif ( error instanceof Error ) {\n\t\t\t\t\terrorMessage = error.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage =\n\t\t\t\t\t\tString( error ) ||\n\t\t\t\t\t\t__( 'Unknown error when running custom validation.' );\n\t\t\t\t}\n\n\t\t\t\tupdateFieldValidity( setFormValidity, parentFieldId, field.id, {\n\t\t\t\t\tcustom: {\n\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\tmessage: errorMessage,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// \u2014 isValid.custom (sync version)\n\t\t\tif ( typeof customError === 'string' ) {\n\t\t\t\tupdateFieldValidity( setFormValidity, parentFieldId, field.id, {\n\t\t\t\t\tcustom: {\n\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\tmessage: customError,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// \u2014 isValid.custom (async version)\n\t\t\tif ( customError instanceof Promise ) {\n\t\t\t\t// Increment token for this field to track the latest validation\n\t\t\t\tconst currentToken =\n\t\t\t\t\t( customValidationCounterRef.current[ field.id ] || 0 ) + 1;\n\t\t\t\tcustomValidationCounterRef.current[ field.id ] = currentToken;\n\n\t\t\t\tupdateFieldValidity( setFormValidity, parentFieldId, field.id, {\n\t\t\t\t\tcustom: {\n\t\t\t\t\t\ttype: 'validating',\n\t\t\t\t\t\tmessage: 'Validating...',\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tcustomError\n\t\t\t\t\t.then( ( result ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcustomValidationCounterRef.current[ field.id ] !==\n\t\t\t\t\t\t\tcurrentToken\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( result === null ) {\n\t\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcustom: {\n\t\t\t\t\t\t\t\t\t\ttype: 'valid',\n\t\t\t\t\t\t\t\t\t\tmessage: 'Valid',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( typeof result === 'string' ) {\n\t\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcustom: {\n\t\t\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\t\t\tmessage: result,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} )\n\t\t\t\t\t.catch( ( error ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcustomValidationCounterRef.current[ field.id ] !==\n\t\t\t\t\t\t\tcurrentToken\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tupdateFieldValidity(\n\t\t\t\t\t\t\tsetFormValidity,\n\t\t\t\t\t\t\tparentFieldId,\n\t\t\t\t\t\t\tfield.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcustom: {\n\t\t\t\t\t\t\t\t\ttype: 'invalid',\n\t\t\t\t\t\t\t\t\tmessage: error.message,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// No errors for this field, remove from errors object\n\t\t\tsetFormValidity( ( prev ) => {\n\t\t\t\tif ( ! prev ) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\n\t\t\t\tif ( parentFieldId ) {\n\t\t\t\t\t// This field is a child - remove it from parent's children\n\t\t\t\t\tconst parentField = prev[ parentFieldId ];\n\t\t\t\t\tif ( ! parentField?.children ) {\n\t\t\t\t\t\treturn prev;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { [ field.id ]: removed, ...restChildren } =\n\t\t\t\t\t\tparentField.children as any;\n\n\t\t\t\t\t// If no more children, remove the children property\n\t\t\t\t\tif ( Object.keys( restChildren ).length === 0 ) {\n\t\t\t\t\t\tconst { children, ...restParent } = parentField;\n\t\t\t\t\t\tif ( Object.keys( restParent ).length === 0 ) {\n\t\t\t\t\t\t\t// Remove parent field entirely if no other validations\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t[ parentFieldId ]: removedParent,\n\t\t\t\t\t\t\t\t...restFields\n\t\t\t\t\t\t\t} = prev;\n\t\t\t\t\t\t\treturn Object.keys( restFields ).length === 0\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: restFields;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...prev,\n\t\t\t\t\t\t\t[ parentFieldId ]: restParent,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...prev,\n\t\t\t\t\t\t[ parentFieldId ]: {\n\t\t\t\t\t\t\t...parentField,\n\t\t\t\t\t\t\tchildren: restChildren,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Regular field - remove from top level\n\t\t\t\tif ( ! prev[ field.id ] ) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\n\t\t\t\tconst { [ field.id ]: removed, ...rest } = prev;\n\n\t\t\t\tif ( Object.keys( rest ).length === 0 ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn rest;\n\t\t\t} );\n\t\t} );\n\t}, [ item, fields, form ] );\n\n\tuseEffect( () => {\n\t\tvalidate();\n\t}, [ validate ] );\n\n\treturn {\n\t\tvalidity: formValidity,\n\t\tisValid: isFormValid( formValidity ),\n\t};\n}\n\nexport default useFormValidity;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAsB;AAKtB,qBAAyD;AACzD,kBAAmB;AAKnB,8BAA4B;AAC5B,mCAAgC;AAShC,MAAM,yBAAyB,CAAE,UAChC,CAAE,QAAW,IAAI,IAAK,EAAE,SAAU,KAAM;AAEzC,MAAM,wCAAwC,CAAE,UAAgB;AAC/D,SACC,CAAE,MAAM,QAAS,KAAM,KACvB,MAAM,WAAW,KACjB,MAAM,MAAO,CAAE,YAAkB,uBAAwB,OAAQ,CAAE;AAErE;AAEA,SAAS,qBAAsB,WAA+B,O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,mBAAO;AAAA,cACN,GAAG;AAAA,cACH,CAAE,aAAc,GAAG;AAAA,YACpB;AAAA,UACD;AAEA,iBAAO;AAAA,YACN,GAAG;AAAA,YACH,CAAE,aAAc,GAAG;AAAA,cAClB,GAAG;AAAA,cACH,UAAU;AAAA,YACX;AAAA,UACD;AAAA,QACD;AAGA,YAAK,CAAE,KAAM,MAAM,EAAG,GAAI;AACzB,iBAAO;AAAA,QACR;AAEA,cAAM,EAAE,CAAE,MAAM,EAAG,GAAG,SAAS,GAAG,KAAK,IAAI;AAE3C,YAAK,OAAO,KAAM,IAAK,EAAE,WAAW,GAAI;AACvC,iBAAO;AAAA,QACR;AAEA,eAAO;AAAA,MACR,CAAE;AAAA,IACH,CAAE;AAAA,EACH,GAAG,CAAE,MAAM,QAAQ,IAAK,CAAE;AAE1B,gCAAW,MAAM;AAChB,aAAS;AAAA,EACV,GAAG,CAAE,QAAS,CAAE;AAEhB,SAAO;AAAA,IACN,UAAU;AAAA,IACV,SAAS,YAAa,YAAa;AAAA,EACpC;AACD;AAEA,IAAO,4BAAQ;",
|
|
6
|
+
"names": ["normalizeFormFields", "normalizeFields", "deepMerge", "removed"]
|
|
7
|
+
}
|
package/build/index.js
CHANGED
|
@@ -1,49 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "DataViewsPicker", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _dataviewsPicker.default;
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
DataForm: () => import_dataform.default,
|
|
32
|
+
DataViews: () => import_dataviews.default,
|
|
33
|
+
DataViewsPicker: () => import_dataviews_picker.default,
|
|
34
|
+
VIEW_LAYOUTS: () => import_dataviews_layouts.VIEW_LAYOUTS,
|
|
35
|
+
filterSortAndPaginate: () => import_filter_sort_and_paginate.default,
|
|
36
|
+
useFormValidity: () => import_hooks.useFormValidity
|
|
24
37
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return _validation.isItemValid;
|
|
41
|
-
}
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
|
+
var import_dataviews = __toESM(require("./components/dataviews"));
|
|
40
|
+
var import_dataviews_picker = __toESM(require("./components/dataviews-picker"));
|
|
41
|
+
var import_dataform = __toESM(require("./components/dataform"));
|
|
42
|
+
var import_filter_sort_and_paginate = __toESM(require("./utils/filter-sort-and-paginate"));
|
|
43
|
+
var import_hooks = require("./hooks");
|
|
44
|
+
var import_dataviews_layouts = require("./dataviews-layouts");
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
DataForm,
|
|
48
|
+
DataViews,
|
|
49
|
+
DataViewsPicker,
|
|
50
|
+
VIEW_LAYOUTS,
|
|
51
|
+
filterSortAndPaginate,
|
|
52
|
+
useFormValidity
|
|
42
53
|
});
|
|
43
|
-
|
|
44
|
-
var _dataviewsPicker = _interopRequireDefault(require("./components/dataviews-picker"));
|
|
45
|
-
var _dataform = _interopRequireDefault(require("./components/dataform"));
|
|
46
|
-
var _dataviewsLayouts = require("./dataviews-layouts");
|
|
47
|
-
var _filterAndSortDataView = require("./filter-and-sort-data-view");
|
|
48
|
-
var _validation = require("./validation");
|
|
49
|
-
//# sourceMappingURL=index.js.map
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { default as DataViews } from './components/dataviews';\nexport { default as DataViewsPicker } from './components/dataviews-picker';\nexport { default as DataForm } from './components/dataform';\nexport { default as filterSortAndPaginate } from './utils/filter-sort-and-paginate';\nexport { useFormValidity } from './hooks';\nexport { VIEW_LAYOUTS } from './dataviews-layouts';\nexport type * from './types';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqC;AACrC,8BAA2C;AAC3C,sBAAoC;AACpC,sCAAiD;AACjD,mBAAgC;AAChC,+BAA6B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|