@wordpress/dataviews 9.1.1-next.f56bd8138.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 +44 -1
- package/README.md +140 -38
- 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 -156
- 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 +46 -0
- package/build/components/dataviews-filters/filters-toggled.js.map +7 -0
- package/build/components/dataviews-filters/filters.js +101 -0
- package/build/components/dataviews-filters/filters.js.map +7 -0
- package/build/components/dataviews-filters/index.js +46 -197
- 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 +124 -0
- package/build/components/dataviews-filters/toggle.js.map +7 -0
- package/build/components/dataviews-filters/use-filters.js +74 -0
- package/build/components/dataviews-filters/use-filters.js.map +7 -0
- 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 -147
- 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 -297
- 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 +156 -131
- 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 +16 -0
- package/build-module/components/dataviews-filters/filters-toggled.js.map +7 -0
- package/build-module/components/dataviews-filters/filters.js +71 -0
- package/build-module/components/dataviews-filters/filters.js.map +7 -0
- package/build-module/components/dataviews-filters/index.js +11 -187
- 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 +94 -0
- package/build-module/components/dataviews-filters/toggle.js.map +7 -0
- package/build-module/components/dataviews-filters/use-filters.js +54 -0
- package/build-module/components/dataviews-filters/use-filters.js.map +7 -0
- 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 +139 -125
- 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 -288
- 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/index.d.ts +3 -2
- package/build-types/components/dataviews/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/filters-toggled.d.ts +5 -0
- package/build-types/components/dataviews-filters/filters-toggled.d.ts.map +1 -0
- package/build-types/components/dataviews-filters/filters.d.ts +6 -0
- package/build-types/components/dataviews-filters/filters.d.ts.map +1 -0
- package/build-types/components/dataviews-filters/index.d.ts +4 -8
- package/build-types/components/dataviews-filters/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/toggle.d.ts +3 -0
- package/build-types/components/dataviews-filters/toggle.d.ts.map +1 -0
- package/build-types/components/dataviews-filters/use-filters.d.ts +4 -0
- package/build-types/components/dataviews-filters/use-filters.d.ts.map +1 -0
- 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-picker/index.d.ts +3 -2
- package/build-types/components/dataviews-picker/index.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/picker-grid/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 +3241 -2787
- 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 +10 -16
- 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/filters-toggled.tsx +20 -0
- package/src/components/dataviews-filters/filters.tsx +73 -0
- package/src/components/dataviews-filters/index.tsx +4 -246
- package/src/components/dataviews-filters/search-widget.tsx +30 -3
- package/src/components/dataviews-filters/style.scss +21 -6
- package/src/components/dataviews-filters/toggle.tsx +118 -0
- package/src/components/dataviews-filters/use-filters.ts +75 -0
- 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 +10 -16
- 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 +16 -9
- 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} +8 -9
- 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
|
@@ -1,142 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import { unlock } from '../../lock-unlock';
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
-
const {
|
|
20
|
-
Menu,
|
|
21
|
-
kebabCase
|
|
22
|
-
} = unlock(componentsPrivateApis);
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Modal,
|
|
5
|
+
__experimentalHStack as HStack,
|
|
6
|
+
privateApis as componentsPrivateApis
|
|
7
|
+
} from "@wordpress/components";
|
|
8
|
+
import { __ } from "@wordpress/i18n";
|
|
9
|
+
import { useMemo, useState } from "@wordpress/element";
|
|
10
|
+
import { moreVertical } from "@wordpress/icons";
|
|
11
|
+
import { useRegistry } from "@wordpress/data";
|
|
12
|
+
import { unlock } from "../../lock-unlock";
|
|
13
|
+
const { Menu, kebabCase } = unlock(componentsPrivateApis);
|
|
23
14
|
function ButtonTrigger({
|
|
24
15
|
action,
|
|
25
16
|
onClick,
|
|
26
17
|
items
|
|
27
18
|
}) {
|
|
28
|
-
const label = typeof action.label ===
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
const label = typeof action.label === "string" ? action.label : action.label(items);
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
Button,
|
|
22
|
+
{
|
|
23
|
+
label,
|
|
24
|
+
icon: action.icon,
|
|
25
|
+
disabled: !!action.disabled,
|
|
26
|
+
accessibleWhenDisabled: true,
|
|
27
|
+
size: "compact",
|
|
28
|
+
onClick
|
|
29
|
+
}
|
|
30
|
+
);
|
|
38
31
|
}
|
|
39
32
|
function MenuItemTrigger({
|
|
40
33
|
action,
|
|
41
34
|
onClick,
|
|
42
35
|
items
|
|
43
36
|
}) {
|
|
44
|
-
const label = typeof action.label ===
|
|
45
|
-
return
|
|
46
|
-
disabled: action.disabled,
|
|
47
|
-
onClick: onClick,
|
|
48
|
-
children: /*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
49
|
-
children: label
|
|
50
|
-
})
|
|
51
|
-
});
|
|
37
|
+
const label = typeof action.label === "string" ? action.label : action.label(items);
|
|
38
|
+
return /* @__PURE__ */ jsx(Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ jsx(Menu.ItemLabel, { children: label }) });
|
|
52
39
|
}
|
|
53
|
-
|
|
40
|
+
function ActionModal({
|
|
54
41
|
action,
|
|
55
42
|
items,
|
|
56
43
|
closeModal
|
|
57
44
|
}) {
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
45
|
+
const label = typeof action.label === "string" ? action.label : action.label(items);
|
|
46
|
+
const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader;
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
Modal,
|
|
49
|
+
{
|
|
50
|
+
title: modalHeader || label,
|
|
51
|
+
__experimentalHideHeader: !!action.hideModalHeader,
|
|
52
|
+
onRequestClose: closeModal,
|
|
53
|
+
focusOnMount: action.modalFocusOnMount ?? true,
|
|
54
|
+
size: action.modalSize || "medium",
|
|
55
|
+
overlayClassName: `dataviews-action-modal dataviews-action-modal__${kebabCase(
|
|
56
|
+
action.id
|
|
57
|
+
)}`,
|
|
58
|
+
children: /* @__PURE__ */ jsx(action.RenderModal, { items, closeModal })
|
|
59
|
+
}
|
|
60
|
+
);
|
|
72
61
|
}
|
|
73
|
-
|
|
62
|
+
function ActionsMenuGroup({
|
|
74
63
|
actions,
|
|
75
64
|
item,
|
|
76
65
|
registry,
|
|
77
66
|
setActiveModalAction
|
|
78
67
|
}) {
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
return /* @__PURE__ */ jsx(Menu.Group, { children: actions.map((action) => /* @__PURE__ */ jsx(
|
|
69
|
+
MenuItemTrigger,
|
|
70
|
+
{
|
|
71
|
+
action,
|
|
82
72
|
onClick: () => {
|
|
83
|
-
if (
|
|
73
|
+
if ("RenderModal" in action) {
|
|
84
74
|
setActiveModalAction(action);
|
|
85
75
|
return;
|
|
86
76
|
}
|
|
87
|
-
action.callback([item], {
|
|
88
|
-
registry
|
|
89
|
-
});
|
|
77
|
+
action.callback([item], { registry });
|
|
90
78
|
},
|
|
91
79
|
items: [item]
|
|
92
|
-
},
|
|
93
|
-
|
|
80
|
+
},
|
|
81
|
+
action.id
|
|
82
|
+
)) });
|
|
94
83
|
}
|
|
95
|
-
|
|
84
|
+
function ItemActions({
|
|
96
85
|
item,
|
|
97
86
|
actions,
|
|
98
87
|
isCompact
|
|
99
88
|
}) {
|
|
100
89
|
const registry = useRegistry();
|
|
101
|
-
const {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const _primaryActions = _eligibleActions.filter(action => action.isPrimary && !!action.icon);
|
|
90
|
+
const { primaryActions, eligibleActions } = useMemo(() => {
|
|
91
|
+
const _eligibleActions = actions.filter(
|
|
92
|
+
(action) => !action.isEligible || action.isEligible(item)
|
|
93
|
+
);
|
|
94
|
+
const _primaryActions = _eligibleActions.filter(
|
|
95
|
+
(action) => action.isPrimary && !!action.icon
|
|
96
|
+
);
|
|
109
97
|
return {
|
|
110
98
|
primaryActions: _primaryActions,
|
|
111
99
|
eligibleActions: _eligibleActions
|
|
112
100
|
};
|
|
113
101
|
}, [actions, item]);
|
|
114
102
|
if (isCompact) {
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
CompactItemActions,
|
|
105
|
+
{
|
|
106
|
+
item,
|
|
107
|
+
actions: eligibleActions,
|
|
108
|
+
isSmall: true,
|
|
109
|
+
registry
|
|
110
|
+
}
|
|
111
|
+
);
|
|
121
112
|
}
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
113
|
+
return /* @__PURE__ */ jsxs(
|
|
114
|
+
HStack,
|
|
115
|
+
{
|
|
116
|
+
spacing: 1,
|
|
117
|
+
justify: "flex-end",
|
|
118
|
+
className: "dataviews-item-actions",
|
|
119
|
+
style: {
|
|
120
|
+
flexShrink: 0,
|
|
121
|
+
width: "auto"
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
PrimaryActions,
|
|
126
|
+
{
|
|
127
|
+
item,
|
|
128
|
+
actions: primaryActions,
|
|
129
|
+
registry
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
primaryActions.length < eligibleActions.length && /* @__PURE__ */ jsx(
|
|
133
|
+
CompactItemActions,
|
|
134
|
+
{
|
|
135
|
+
item,
|
|
136
|
+
actions: eligibleActions,
|
|
137
|
+
registry
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
);
|
|
140
143
|
}
|
|
141
144
|
function CompactItemActions({
|
|
142
145
|
item,
|
|
@@ -144,33 +147,46 @@ function CompactItemActions({
|
|
|
144
147
|
isSmall,
|
|
145
148
|
registry
|
|
146
149
|
}) {
|
|
147
|
-
const [activeModalAction, setActiveModalAction] = useState(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
150
|
+
const [activeModalAction, setActiveModalAction] = useState(
|
|
151
|
+
null
|
|
152
|
+
);
|
|
153
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
154
|
+
/* @__PURE__ */ jsxs(Menu, { placement: "bottom-end", children: [
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
Menu.TriggerButton,
|
|
157
|
+
{
|
|
158
|
+
render: /* @__PURE__ */ jsx(
|
|
159
|
+
Button,
|
|
160
|
+
{
|
|
161
|
+
size: isSmall ? "small" : "compact",
|
|
162
|
+
icon: moreVertical,
|
|
163
|
+
label: __("Actions"),
|
|
164
|
+
accessibleWhenDisabled: true,
|
|
165
|
+
disabled: !actions.length,
|
|
166
|
+
className: "dataviews-all-actions-button"
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ jsx(Menu.Popover, { children: /* @__PURE__ */ jsx(
|
|
172
|
+
ActionsMenuGroup,
|
|
173
|
+
{
|
|
174
|
+
actions,
|
|
175
|
+
item,
|
|
176
|
+
registry,
|
|
177
|
+
setActiveModalAction
|
|
178
|
+
}
|
|
179
|
+
) })
|
|
180
|
+
] }),
|
|
181
|
+
!!activeModalAction && /* @__PURE__ */ jsx(
|
|
182
|
+
ActionModal,
|
|
183
|
+
{
|
|
184
|
+
action: activeModalAction,
|
|
185
|
+
items: [item],
|
|
186
|
+
closeModal: () => setActiveModalAction(null)
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] });
|
|
174
190
|
}
|
|
175
191
|
function PrimaryActions({
|
|
176
192
|
item,
|
|
@@ -181,24 +197,35 @@ function PrimaryActions({
|
|
|
181
197
|
if (!Array.isArray(actions) || actions.length === 0) {
|
|
182
198
|
return null;
|
|
183
199
|
}
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
200
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
201
|
+
actions.map((action) => /* @__PURE__ */ jsx(
|
|
202
|
+
ButtonTrigger,
|
|
203
|
+
{
|
|
204
|
+
action,
|
|
205
|
+
onClick: () => {
|
|
206
|
+
if ("RenderModal" in action) {
|
|
207
|
+
setActiveModalAction(action);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
action.callback([item], { registry });
|
|
211
|
+
},
|
|
212
|
+
items: [item]
|
|
195
213
|
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
214
|
+
action.id
|
|
215
|
+
)),
|
|
216
|
+
!!activeModalAction && /* @__PURE__ */ jsx(
|
|
217
|
+
ActionModal,
|
|
218
|
+
{
|
|
219
|
+
action: activeModalAction,
|
|
220
|
+
items: [item],
|
|
221
|
+
closeModal: () => setActiveModalAction(null)
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
] });
|
|
203
225
|
}
|
|
204
|
-
|
|
226
|
+
export {
|
|
227
|
+
ActionModal,
|
|
228
|
+
ActionsMenuGroup,
|
|
229
|
+
ItemActions as default
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Modal","__experimentalHStack","HStack","privateApis","componentsPrivateApis","__","useMemo","useState","moreVertical","useRegistry","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Menu","kebabCase","ButtonTrigger","action","onClick","items","label","icon","disabled","accessibleWhenDisabled","isDestructive","size","MenuItemTrigger","Item","children","ItemLabel","ActionModal","closeModal","_action$modalFocusOnM","title","modalHeader","__experimentalHideHeader","hideModalHeader","onRequestClose","focusOnMount","modalFocusOnMount","modalSize","overlayClassName","id","RenderModal","ActionsMenuGroup","actions","item","registry","setActiveModalAction","Group","map","callback","ItemActions","isCompact","primaryActions","eligibleActions","_eligibleActions","filter","isEligible","_primaryActions","isPrimary","CompactItemActions","isSmall","spacing","justify","className","style","flexShrink","width","PrimaryActions","length","activeModalAction","placement","TriggerButton","render","Popover","Array","isArray"],"sources":["@wordpress/dataviews/src/components/dataviews-item-actions/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { MouseEventHandler } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { moreVertical } from '@wordpress/icons';\nimport { useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport type { Action, ActionModal as ActionModalType } from '../../types';\n\nconst { Menu, kebabCase } = unlock( componentsPrivateApis );\n\nexport interface ActionTriggerProps< Item > {\n\taction: Action< Item >;\n\tonClick: MouseEventHandler;\n\tisBusy?: boolean;\n\titems: Item[];\n}\n\nexport interface ActionModalProps< Item > {\n\taction: ActionModalType< Item >;\n\titems: Item[];\n\tcloseModal: () => void;\n}\n\ninterface ActionsMenuGroupProps< Item > {\n\tactions: Action< Item >[];\n\titem: Item;\n\tregistry: ReturnType< typeof useRegistry >;\n\tsetActiveModalAction: ( action: ActionModalType< Item > | null ) => void;\n}\n\ninterface ItemActionsProps< Item > {\n\titem: Item;\n\tactions: Action< Item >[];\n\tisCompact?: boolean;\n}\n\ninterface CompactItemActionsProps< Item > {\n\titem: Item;\n\tactions: Action< Item >[];\n\tisSmall?: boolean;\n\tregistry: ReturnType< typeof useRegistry >;\n}\n\ninterface PrimaryActionsProps< Item > {\n\titem: Item;\n\tactions: Action< Item >[];\n\tregistry: ReturnType< typeof useRegistry >;\n}\n\nfunction ButtonTrigger< Item >( {\n\taction,\n\tonClick,\n\titems,\n}: ActionTriggerProps< Item > ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Button\n\t\t\tlabel={ label }\n\t\t\ticon={ action.icon }\n\t\t\tdisabled={ !! action.disabled }\n\t\t\taccessibleWhenDisabled\n\t\t\tisDestructive={ action.isDestructive }\n\t\t\tsize=\"compact\"\n\t\t\tonClick={ onClick }\n\t\t/>\n\t);\n}\n\nfunction MenuItemTrigger< Item >( {\n\taction,\n\tonClick,\n\titems,\n}: ActionTriggerProps< Item > ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Menu.Item disabled={ action.disabled } onClick={ onClick }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\nexport function ActionModal< Item >( {\n\taction,\n\titems,\n\tcloseModal,\n}: ActionModalProps< Item > ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ action.modalHeader || label }\n\t\t\t__experimentalHideHeader={ !! action.hideModalHeader }\n\t\t\tonRequestClose={ closeModal }\n\t\t\tfocusOnMount={ action.modalFocusOnMount ?? true }\n\t\t\tsize={ action.modalSize || 'medium' }\n\t\t\toverlayClassName={ `dataviews-action-modal dataviews-action-modal__${ kebabCase(\n\t\t\t\taction.id\n\t\t\t) }` }\n\t\t>\n\t\t\t<action.RenderModal items={ items } closeModal={ closeModal } />\n\t\t</Modal>\n\t);\n}\n\nexport function ActionsMenuGroup< Item >( {\n\tactions,\n\titem,\n\tregistry,\n\tsetActiveModalAction,\n}: ActionsMenuGroupProps< Item > ) {\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => (\n\t\t\t\t<MenuItemTrigger\n\t\t\t\t\tkey={ action.id }\n\t\t\t\t\taction={ action }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\taction.callback( [ item ], { registry } );\n\t\t\t\t\t} }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Menu.Group>\n\t);\n}\n\nexport default function ItemActions< Item >( {\n\titem,\n\tactions,\n\tisCompact,\n}: ItemActionsProps< Item > ) {\n\tconst registry = useRegistry();\n\tconst { primaryActions, eligibleActions } = useMemo( () => {\n\t\t// If an action is eligible for all items, doesn't need\n\t\t// to provide the `isEligible` function.\n\t\tconst _eligibleActions = actions.filter(\n\t\t\t( action ) => ! action.isEligible || action.isEligible( item )\n\t\t);\n\t\tconst _primaryActions = _eligibleActions.filter(\n\t\t\t( action ) => action.isPrimary && !! action.icon\n\t\t);\n\t\treturn {\n\t\t\tprimaryActions: _primaryActions,\n\t\t\teligibleActions: _eligibleActions,\n\t\t};\n\t}, [ actions, item ] );\n\n\tif ( isCompact ) {\n\t\treturn (\n\t\t\t<CompactItemActions\n\t\t\t\titem={ item }\n\t\t\t\tactions={ eligibleActions }\n\t\t\t\tisSmall\n\t\t\t\tregistry={ registry }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<HStack\n\t\t\tspacing={ 1 }\n\t\t\tjustify=\"flex-end\"\n\t\t\tclassName=\"dataviews-item-actions\"\n\t\t\tstyle={ {\n\t\t\t\tflexShrink: 0,\n\t\t\t\twidth: 'auto',\n\t\t\t} }\n\t\t>\n\t\t\t<PrimaryActions\n\t\t\t\titem={ item }\n\t\t\t\tactions={ primaryActions }\n\t\t\t\tregistry={ registry }\n\t\t\t/>\n\t\t\t{ primaryActions.length < eligibleActions.length && (\n\t\t\t\t<CompactItemActions\n\t\t\t\t\titem={ item }\n\t\t\t\t\tactions={ eligibleActions }\n\t\t\t\t\tregistry={ registry }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n\nfunction CompactItemActions< Item >( {\n\titem,\n\tactions,\n\tisSmall,\n\tregistry,\n}: CompactItemActionsProps< Item > ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState(\n\t\tnull as ActionModalType< Item > | null\n\t);\n\treturn (\n\t\t<>\n\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize={ isSmall ? 'small' : 'compact' }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\t\t\tclassName=\"dataviews-all-actions-button\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<ActionsMenuGroup\n\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\tregistry={ registry }\n\t\t\t\t\t\tsetActiveModalAction={ setActiveModalAction }\n\t\t\t\t\t/>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction PrimaryActions< Item >( {\n\titem,\n\tactions,\n\tregistry,\n}: PrimaryActionsProps< Item > ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState( null as any );\n\tif ( ! Array.isArray( actions ) || actions.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ actions.map( ( action ) => (\n\t\t\t\t<ButtonTrigger\n\t\t\t\t\tkey={ action.id }\n\t\t\t\t\taction={ action }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\taction.callback( [ item ], { registry } );\n\t\t\t\t\t} }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,MAAM,EACNC,KAAK,EACLC,oBAAoB,IAA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,KAAK,EAAG,CAAE2B,IAAI,CAAI;MAClBf,UAAU,EAAGA,CAAA,KAAMiB,oBAAoB,CAAE,IAAK;IAAG,CACjD,CACD;EAAA,CACA,CAAC;AAEL;AAEA,SAASqB,cAAcA,CAAU;EAChCvB,IAAI;EACJD,OAAO;EACPE;AAC4B,CAAC,EAAG;EAChC,MAAM,CAAEwB,iBAAiB,EAAEvB,oBAAoB,CAAE,GAAG5C,QAAQ,CAAE,IAAY,CAAC;EAC3E,IAAK,CAAEwE,KAAK,CAACC,OAAO,CAAEhC,OAAQ,CAAC,IAAIA,OAAO,CAACyB,MAAM,KAAK,CAAC,EAAG;IACzD,OAAO,IAAI;EACZ;EACA,oBACC3D,KAAA,CAAAE,SAAA;IAAAe,QAAA,GACGiB,OAAO,CAACK,GAAG,CAAIjC,MAAM,iBACtBR,IAAA,CAACO,aAAa;MAEbC,MAAM,EAAGA,MAAQ;MACjBC,OAAO,EAAGA,CAAA,KAAM;QACf,IAAK,aAAa,IAAID,MAAM,EAAG;UAC9B+B,oBAAoB,CAAE/B,MAAO,CAAC;UAC9B;QACD;QACAA,MAAM,CAACkC,QAAQ,CAAE,CAAEL,IAAI,CAAE,EAAE;UAAEC;QAAS,CAAE,CAAC;MAC1C,CAAG;MACH5B,KAAK,EAAG,CAAE2B,IAAI;IAAI,GATZ7B,MAAM,CAACyB,EAUb,CACA,CAAC,EACD,CAAC,CAAE6B,iBAAiB,iBACrB9D,IAAA,CAACqB,WAAW;MACXb,MAAM,EAAGsD,iBAAmB;MAC5BpD,KAAK,EAAG,CAAE2B,IAAI,CAAI;MAClBf,UAAU,EAAGA,CAAA,KAAMiB,oBAAoB,CAAE,IAAK;IAAG,CACjD,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/dataviews-item-actions/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { MouseEventHandler } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { moreVertical } from '@wordpress/icons';\nimport { useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport type { Action, ActionModal as ActionModalType } from '../../types';\n\nconst { Menu, kebabCase } = unlock( componentsPrivateApis );\n\nexport interface ActionTriggerProps< Item > {\n\taction: Action< Item >;\n\tonClick: MouseEventHandler;\n\tisBusy?: boolean;\n\titems: Item[];\n}\n\nexport interface ActionModalProps< Item > {\n\taction: ActionModalType< Item >;\n\titems: Item[];\n\tcloseModal: () => void;\n}\n\ninterface ActionsMenuGroupProps< Item > {\n\tactions: Action< Item >[];\n\titem: Item;\n\tregistry: ReturnType< typeof useRegistry >;\n\tsetActiveModalAction: ( action: ActionModalType< Item > | null ) => void;\n}\n\ninterface ItemActionsProps< Item > {\n\titem: Item;\n\tactions: Action< Item >[];\n\tisCompact?: boolean;\n}\n\ninterface CompactItemActionsProps< Item > {\n\titem: Item;\n\tactions: Action< Item >[];\n\tisSmall?: boolean;\n\tregistry: ReturnType< typeof useRegistry >;\n}\n\ninterface PrimaryActionsProps< Item > {\n\titem: Item;\n\tactions: Action< Item >[];\n\tregistry: ReturnType< typeof useRegistry >;\n}\n\nfunction ButtonTrigger< Item >( {\n\taction,\n\tonClick,\n\titems,\n}: ActionTriggerProps< Item > ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Button\n\t\t\tlabel={ label }\n\t\t\ticon={ action.icon }\n\t\t\tdisabled={ !! action.disabled }\n\t\t\taccessibleWhenDisabled\n\t\t\tsize=\"compact\"\n\t\t\tonClick={ onClick }\n\t\t/>\n\t);\n}\n\nfunction MenuItemTrigger< Item >( {\n\taction,\n\tonClick,\n\titems,\n}: ActionTriggerProps< Item > ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Menu.Item disabled={ action.disabled } onClick={ onClick }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\nexport function ActionModal< Item >( {\n\taction,\n\titems,\n\tcloseModal,\n}: ActionModalProps< Item > ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\n\tconst modalHeader =\n\t\ttypeof action.modalHeader === 'function'\n\t\t\t? action.modalHeader( items )\n\t\t\t: action.modalHeader;\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalHeader || label }\n\t\t\t__experimentalHideHeader={ !! action.hideModalHeader }\n\t\t\tonRequestClose={ closeModal }\n\t\t\tfocusOnMount={ action.modalFocusOnMount ?? true }\n\t\t\tsize={ action.modalSize || 'medium' }\n\t\t\toverlayClassName={ `dataviews-action-modal dataviews-action-modal__${ kebabCase(\n\t\t\t\taction.id\n\t\t\t) }` }\n\t\t>\n\t\t\t<action.RenderModal items={ items } closeModal={ closeModal } />\n\t\t</Modal>\n\t);\n}\n\nexport function ActionsMenuGroup< Item >( {\n\tactions,\n\titem,\n\tregistry,\n\tsetActiveModalAction,\n}: ActionsMenuGroupProps< Item > ) {\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => (\n\t\t\t\t<MenuItemTrigger\n\t\t\t\t\tkey={ action.id }\n\t\t\t\t\taction={ action }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\taction.callback( [ item ], { registry } );\n\t\t\t\t\t} }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Menu.Group>\n\t);\n}\n\nexport default function ItemActions< Item >( {\n\titem,\n\tactions,\n\tisCompact,\n}: ItemActionsProps< Item > ) {\n\tconst registry = useRegistry();\n\tconst { primaryActions, eligibleActions } = useMemo( () => {\n\t\t// If an action is eligible for all items, doesn't need\n\t\t// to provide the `isEligible` function.\n\t\tconst _eligibleActions = actions.filter(\n\t\t\t( action ) => ! action.isEligible || action.isEligible( item )\n\t\t);\n\t\tconst _primaryActions = _eligibleActions.filter(\n\t\t\t( action ) => action.isPrimary && !! action.icon\n\t\t);\n\t\treturn {\n\t\t\tprimaryActions: _primaryActions,\n\t\t\teligibleActions: _eligibleActions,\n\t\t};\n\t}, [ actions, item ] );\n\n\tif ( isCompact ) {\n\t\treturn (\n\t\t\t<CompactItemActions\n\t\t\t\titem={ item }\n\t\t\t\tactions={ eligibleActions }\n\t\t\t\tisSmall\n\t\t\t\tregistry={ registry }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<HStack\n\t\t\tspacing={ 1 }\n\t\t\tjustify=\"flex-end\"\n\t\t\tclassName=\"dataviews-item-actions\"\n\t\t\tstyle={ {\n\t\t\t\tflexShrink: 0,\n\t\t\t\twidth: 'auto',\n\t\t\t} }\n\t\t>\n\t\t\t<PrimaryActions\n\t\t\t\titem={ item }\n\t\t\t\tactions={ primaryActions }\n\t\t\t\tregistry={ registry }\n\t\t\t/>\n\t\t\t{ primaryActions.length < eligibleActions.length && (\n\t\t\t\t<CompactItemActions\n\t\t\t\t\titem={ item }\n\t\t\t\t\tactions={ eligibleActions }\n\t\t\t\t\tregistry={ registry }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n\nfunction CompactItemActions< Item >( {\n\titem,\n\tactions,\n\tisSmall,\n\tregistry,\n}: CompactItemActionsProps< Item > ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState(\n\t\tnull as ActionModalType< Item > | null\n\t);\n\treturn (\n\t\t<>\n\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize={ isSmall ? 'small' : 'compact' }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\t\t\tclassName=\"dataviews-all-actions-button\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<ActionsMenuGroup\n\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\tregistry={ registry }\n\t\t\t\t\t\tsetActiveModalAction={ setActiveModalAction }\n\t\t\t\t\t/>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction PrimaryActions< Item >( {\n\titem,\n\tactions,\n\tregistry,\n}: PrimaryActionsProps< Item > ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState( null as any );\n\tif ( ! Array.isArray( actions ) || actions.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ actions.map( ( action ) => (\n\t\t\t\t<ButtonTrigger\n\t\t\t\t\tkey={ action.id }\n\t\t\t\t\taction={ action }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\taction.callback( [ item ], { registry } );\n\t\t\t\t\t} }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AA0EE,SAmJA,UAnJA,KAgHA,YAhHA;AAlEF;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,eAAe;AAAA,OACT;AACP,SAAS,UAAU;AACnB,SAAS,SAAS,gBAAgB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAK5B,SAAS,cAAc;AAGvB,MAAM,EAAE,MAAM,UAAU,IAAI,OAAQ,qBAAsB;AAyC1D,SAAS,cAAuB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACD,GAAgC;AAC/B,QAAM,QACL,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,OAAO,MAAO,KAAM;AACvE,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,MAAO,OAAO;AAAA,MACd,UAAW,CAAC,CAAE,OAAO;AAAA,MACrB,wBAAsB;AAAA,MACtB,MAAK;AAAA,MACL;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,gBAAyB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AACD,GAAgC;AAC/B,QAAM,QACL,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,OAAO,MAAO,KAAM;AACvE,SACC,oBAAC,KAAK,MAAL,EAAU,UAAW,OAAO,UAAW,SACvC,8BAAC,KAAK,WAAL,EAAiB,iBAAO,GAC1B;AAEF;AAEO,SAAS,YAAqB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACD,GAA8B;AAC7B,QAAM,QACL,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,OAAO,MAAO,KAAM;AAEvE,QAAM,cACL,OAAO,OAAO,gBAAgB,aAC3B,OAAO,YAA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AAAA,EACA;AAAA,EACA;AACD,GAAiC;AAChC,QAAM,CAAE,mBAAmB,oBAAqB,IAAI,SAAU,IAAY;AAC1E,MAAK,CAAE,MAAM,QAAS,OAAQ,KAAK,QAAQ,WAAW,GAAI;AACzD,WAAO;AAAA,EACR;AACA,SACC,iCACG;AAAA,YAAQ,IAAK,CAAE,WAChB;AAAA,MAAC;AAAA;AAAA,QAEA;AAAA,QACA,SAAU,MAAM;AACf,cAAK,iBAAiB,QAAS;AAC9B,iCAAsB,MAAO;AAC7B;AAAA,UACD;AACA,iBAAO,SAAU,CAAE,IAAK,GAAG,EAAE,SAAS,CAAE;AAAA,QACzC;AAAA,QACA,OAAQ,CAAE,IAAK;AAAA;AAAA,MATT,OAAO;AAAA,IAUd,CACC;AAAA,IACA,CAAC,CAAE,qBACJ;AAAA,MAAC;AAAA;AAAA,QACA,QAAS;AAAA,QACT,OAAQ,CAAE,IAAK;AAAA,QACf,YAAa,MAAM,qBAAsB,IAAK;AAAA;AAAA,IAC/C;AAAA,KAEF;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
import { useContext } from '@wordpress/element';
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import DataViewsContext from '../dataviews-context';
|
|
15
|
-
import { VIEW_LAYOUTS } from '../../dataviews-layouts';
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
export default function DataViewsLayout({
|
|
18
|
-
className
|
|
19
|
-
}) {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "@wordpress/element";
|
|
3
|
+
import { __ } from "@wordpress/i18n";
|
|
4
|
+
import DataViewsContext from "../dataviews-context";
|
|
5
|
+
import { VIEW_LAYOUTS } from "../../dataviews-layouts";
|
|
6
|
+
function DataViewsLayout({ className }) {
|
|
20
7
|
const {
|
|
21
8
|
actions = [],
|
|
22
9
|
data,
|
|
@@ -33,28 +20,34 @@ export default function DataViewsLayout({
|
|
|
33
20
|
isItemClickable,
|
|
34
21
|
renderItemLink,
|
|
35
22
|
defaultLayouts,
|
|
36
|
-
empty =
|
|
37
|
-
children: __('No results')
|
|
38
|
-
})
|
|
23
|
+
empty = /* @__PURE__ */ jsx("p", { children: __("No results") })
|
|
39
24
|
} = useContext(DataViewsContext);
|
|
40
|
-
const ViewComponent = VIEW_LAYOUTS.find(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
25
|
+
const ViewComponent = VIEW_LAYOUTS.find(
|
|
26
|
+
(v) => v.type === view.type && defaultLayouts[v.type]
|
|
27
|
+
)?.component;
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
ViewComponent,
|
|
30
|
+
{
|
|
31
|
+
className,
|
|
32
|
+
actions,
|
|
33
|
+
data,
|
|
34
|
+
fields,
|
|
35
|
+
getItemId,
|
|
36
|
+
getItemLevel,
|
|
37
|
+
isLoading,
|
|
38
|
+
onChangeView,
|
|
39
|
+
onChangeSelection,
|
|
40
|
+
selection,
|
|
41
|
+
setOpenedFilter,
|
|
42
|
+
onClickItem,
|
|
43
|
+
renderItemLink,
|
|
44
|
+
isItemClickable,
|
|
45
|
+
view,
|
|
46
|
+
empty
|
|
47
|
+
}
|
|
48
|
+
);
|
|
59
49
|
}
|
|
60
|
-
|
|
50
|
+
export {
|
|
51
|
+
DataViewsLayout as default
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/dataviews-layout/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ComponentType } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DataViewsContext from '../dataviews-context';\nimport { VIEW_LAYOUTS } from '../../dataviews-layouts';\nimport type { ViewBaseProps } from '../../types';\n\ntype DataViewsLayoutProps = {\n\tclassName?: string;\n};\n\nexport default function DataViewsLayout( { className }: DataViewsLayoutProps ) {\n\tconst {\n\t\tactions = [],\n\t\tdata,\n\t\tfields,\n\t\tgetItemId,\n\t\tgetItemLevel,\n\t\tisLoading,\n\t\tview,\n\t\tonChangeView,\n\t\tselection,\n\t\tonChangeSelection,\n\t\tsetOpenedFilter,\n\t\tonClickItem,\n\t\tisItemClickable,\n\t\trenderItemLink,\n\t\tdefaultLayouts,\n\t\tempty = <p>{ __( 'No results' ) }</p>,\n\t} = useContext( DataViewsContext );\n\n\tconst ViewComponent = VIEW_LAYOUTS.find(\n\t\t( v ) => v.type === view.type && defaultLayouts[ v.type ]\n\t)?.component as ComponentType< ViewBaseProps< any > >;\n\n\treturn (\n\t\t<ViewComponent\n\t\t\tclassName={ className }\n\t\t\tactions={ actions }\n\t\t\tdata={ data }\n\t\t\tfields={ fields }\n\t\t\tgetItemId={ getItemId }\n\t\t\tgetItemLevel={ getItemLevel }\n\t\t\tisLoading={ isLoading }\n\t\t\tonChangeView={ onChangeView }\n\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\tselection={ selection }\n\t\t\tsetOpenedFilter={ setOpenedFilter }\n\t\t\tonClickItem={ onClickItem }\n\t\t\trenderItemLink={ renderItemLink }\n\t\t\tisItemClickable={ isItemClickable }\n\t\t\tview={ view }\n\t\t\tempty={ empty }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAuCU;AA/BV,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AAKnB,OAAO,sBAAsB;AAC7B,SAAS,oBAAoB;AAOd,SAAR,gBAAkC,EAAE,UAAU,GAA0B;AAC9E,QAAM;AAAA,IACL,UAAU,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,oBAAC,OAAI,aAAI,YAAa,GAAG;AAAA,EAClC,IAAI,WAAY,gBAAiB;AAEjC,QAAM,gBAAgB,aAAa;AAAA,IAClC,CAAE,MAAO,EAAE,SAAS,KAAK,QAAQ,eAAgB,EAAE,IAAK;AAAA,EACzD,GAAG;AAEH,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|