@wordpress/edit-site 5.23.0 → 5.24.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 +2 -0
- package/build/components/actions/index.js +56 -38
- package/build/components/actions/index.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +7 -2
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/dataviews/add-filter.js +21 -20
- package/build/components/dataviews/add-filter.js.map +1 -1
- package/build/components/dataviews/constants.js +14 -0
- package/build/components/dataviews/constants.js.map +1 -0
- package/build/components/dataviews/dataviews.js +9 -7
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filter-summary.js +62 -0
- package/build/components/dataviews/filter-summary.js.map +1 -0
- package/build/components/dataviews/filters.js +15 -30
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/item-actions.js +84 -30
- package/build/components/dataviews/item-actions.js.map +1 -1
- package/build/components/dataviews/pagination.js +4 -0
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/view-actions.js +24 -24
- package/build/components/dataviews/view-actions.js.map +1 -1
- package/build/components/dataviews/view-grid.js +48 -25
- package/build/components/dataviews/view-grid.js.map +1 -1
- package/build/components/dataviews/view-list.js +28 -33
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/editor/index.js +23 -27
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +15 -2
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/header.js +4 -2
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +22 -16
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +26 -5
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +52 -24
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +9 -3
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/ui.js +28 -36
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +21 -16
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +2 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +1 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/list/added-by.js +43 -54
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +9 -8
- package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +1 -0
- package/build/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/build/components/page-content-focus-notifications/edit-template-notification.js.map +1 -0
- package/build/components/page-content-focus-notifications/index.js +22 -0
- package/build/components/page-content-focus-notifications/index.js.map +1 -0
- package/build/components/page-pages/index.js +9 -15
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -1
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/dataviews-templates.js +166 -51
- package/build/components/page-templates/dataviews-templates.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/save-button/index.js +9 -6
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +14 -0
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +3 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +7 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +6 -5
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +15 -26
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +22 -8
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +8 -5
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +4 -8
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +2 -2
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +10 -6
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +23 -4
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/style-book/index.js +22 -12
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +41 -9
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/welcome-guide/page.js +2 -2
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +6 -3
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +24 -14
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/store/actions.js +4 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +2 -27
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -23
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -40
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +8 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +1 -12
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/actions/index.js +55 -36
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +7 -2
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/dataviews/add-filter.js +21 -20
- package/build-module/components/dataviews/add-filter.js.map +1 -1
- package/build-module/components/dataviews/constants.js +6 -0
- package/build-module/components/dataviews/constants.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +9 -7
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filter-summary.js +55 -0
- package/build-module/components/dataviews/filter-summary.js.map +1 -0
- package/build-module/components/dataviews/filters.js +15 -28
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +84 -30
- package/build-module/components/dataviews/item-actions.js.map +1 -1
- package/build-module/components/dataviews/pagination.js +4 -0
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/view-actions.js +24 -24
- package/build-module/components/dataviews/view-actions.js.map +1 -1
- package/build-module/components/dataviews/view-grid.js +49 -26
- package/build-module/components/dataviews/view-grid.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +28 -33
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/editor/index.js +26 -30
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +14 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/header.js +4 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +23 -17
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +27 -6
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +51 -24
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +9 -3
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/ui.js +28 -36
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +21 -16
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +2 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/list/added-by.js +44 -55
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +9 -8
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +1 -0
- package/build-module/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +1 -0
- package/build-module/components/page-content-focus-notifications/index.js +14 -0
- package/build-module/components/page-content-focus-notifications/index.js.map +1 -0
- package/build-module/components/page-pages/index.js +10 -16
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -1
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/dataviews-templates.js +168 -53
- package/build-module/components/page-templates/dataviews-templates.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/save-button/index.js +11 -8
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +14 -0
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +3 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +7 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +6 -5
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +16 -27
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +21 -7
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +9 -6
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +5 -9
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +3 -3
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +10 -6
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +23 -4
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/style-book/index.js +22 -12
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +41 -9
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +2 -2
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +6 -3
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +24 -14
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/store/actions.js +4 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -25
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -22
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -38
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +8 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +0 -10
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +152 -62
- package/build-style/style.css +152 -62
- package/package.json +41 -41
- package/src/components/actions/index.js +76 -48
- package/src/components/block-editor/site-editor-canvas.js +8 -2
- package/src/components/dataviews/README.md +14 -11
- package/src/components/dataviews/add-filter.js +21 -24
- package/src/components/dataviews/constants.js +5 -0
- package/src/components/dataviews/dataviews.js +10 -10
- package/src/components/dataviews/filter-summary.js +79 -0
- package/src/components/dataviews/filters.js +18 -35
- package/src/components/dataviews/item-actions.js +106 -42
- package/src/components/dataviews/pagination.js +4 -0
- package/src/components/dataviews/style.scss +84 -8
- package/src/components/dataviews/view-actions.js +39 -41
- package/src/components/dataviews/view-grid.js +63 -38
- package/src/components/dataviews/view-list.js +50 -57
- package/src/components/editor/index.js +18 -34
- package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/src/components/global-styles/font-library-modal/utils/index.js +20 -9
- package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +46 -15
- package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +28 -0
- package/src/components/global-styles/header.js +2 -1
- package/src/components/global-styles/screen-block-list.js +37 -26
- package/src/components/global-styles/screen-revisions/index.js +39 -10
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +65 -45
- package/src/components/global-styles/screen-revisions/style.scss +52 -28
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -6
- package/src/components/global-styles/style.scss +0 -11
- package/src/components/global-styles/ui.js +59 -74
- package/src/components/header-edit-mode/document-actions/index.js +20 -18
- package/src/components/header-edit-mode/index.js +1 -0
- package/src/components/header-edit-mode/more-menu/index.js +1 -1
- package/src/components/list/added-by.js +23 -63
- package/src/components/list/style.scss +11 -13
- package/src/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +12 -13
- package/src/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/src/components/page-content-focus-notifications/index.js +14 -0
- package/src/components/page-pages/index.js +15 -20
- package/src/components/page-patterns/use-patterns.js +1 -1
- package/src/components/page-templates/dataviews-templates.js +169 -48
- package/src/components/page-templates/style.scss +13 -0
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/save-button/index.js +37 -24
- package/src/components/save-hub/index.js +15 -0
- package/src/components/save-hub/style.scss +7 -0
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -0
- package/src/components/sidebar-dataviews/default-views.js +7 -2
- package/src/components/sidebar-dataviews/style.scss +7 -0
- package/src/components/sidebar-edit-mode/index.js +13 -9
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +33 -52
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +20 -9
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +6 -6
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +8 -9
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +3 -3
- package/src/components/sidebar-edit-mode/page-panels/style.scss +9 -19
- package/src/components/sidebar-edit-mode/settings-header/index.js +8 -9
- package/src/components/sidebar-navigation-screen/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-page/index.js +24 -3
- package/src/components/sidebar-navigation-screen-template/style.scss +6 -1
- package/src/components/style-book/index.js +48 -35
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +69 -17
- package/src/components/welcome-guide/page.js +2 -2
- package/src/components/welcome-guide/template.js +4 -2
- package/src/hooks/commands/use-edit-mode-commands.js +22 -16
- package/src/store/actions.js +5 -1
- package/src/store/private-actions.js +1 -24
- package/src/store/private-selectors.js +0 -22
- package/src/store/reducer.js +0 -39
- package/src/store/selectors.js +12 -4
- package/src/store/test/actions.js +3 -32
- package/src/store/test/reducer.js +0 -62
- package/src/store/test/selectors.js +0 -35
- package/src/style.scss +1 -0
- package/src/utils/constants.js +0 -10
- package/build/components/dataviews/in-filter.js +0 -51
- package/build/components/dataviews/in-filter.js.map +0 -1
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +0 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -63
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +0 -1
- package/build/components/page-content-focus-manager/edit-template-notification.js.map +0 -1
- package/build/components/page-content-focus-manager/index.js +0 -61
- package/build/components/page-content-focus-manager/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js +0 -87
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js.map +0 -1
- package/build-module/components/dataviews/in-filter.js +0 -42
- package/build-module/components/dataviews/in-filter.js.map +0 -1
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +0 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -56
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +0 -1
- package/build-module/components/page-content-focus-manager/edit-template-notification.js.map +0 -1
- package/build-module/components/page-content-focus-manager/index.js +0 -52
- package/build-module/components/page-content-focus-manager/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js +0 -80
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js.map +0 -1
- package/src/components/dataviews/in-filter.js +0 -63
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -57
- package/src/components/page-content-focus-manager/index.js +0 -51
- package/src/components/sidebar-edit-mode/page-panels/publish-date.js +0 -94
|
@@ -5,6 +5,7 @@ This file documents the DataViews UI component, which provides an API to render
|
|
|
5
5
|
```js
|
|
6
6
|
<DataViews
|
|
7
7
|
data={ pages }
|
|
8
|
+
getItemId={ ( item ) => item.id }
|
|
8
9
|
isLoading={ isLoadingPages }
|
|
9
10
|
view={ view }
|
|
10
11
|
onChangeView={ onChangeView }
|
|
@@ -44,8 +45,8 @@ Example:
|
|
|
44
45
|
},
|
|
45
46
|
search: '',
|
|
46
47
|
filters: [
|
|
47
|
-
{ field: 'author', operator:
|
|
48
|
-
{ field: 'status', operator:
|
|
48
|
+
{ field: 'author', operator: OPERATOR_IN, value: 2 },
|
|
49
|
+
{ field: 'status', operator: OPERATOR_IN, value: 'publish,draft' }
|
|
49
50
|
],
|
|
50
51
|
hiddenFields: [ 'date', 'featured-image' ],
|
|
51
52
|
layout: {},
|
|
@@ -63,7 +64,9 @@ Example:
|
|
|
63
64
|
- `operator`: which type of filter it is. Only `in` available at the moment.
|
|
64
65
|
- `value`: the actual value selected by the user.
|
|
65
66
|
- `hiddenFields`: the `id` of the fields that are hidden in the UI.
|
|
66
|
-
- `layout`:
|
|
67
|
+
- `layout`: config that is specific to a particular layout type.
|
|
68
|
+
- `mediaField`: used by the `grid` layout. The `id` of the field to be used for rendering each card's media.
|
|
69
|
+
- `primaryField`: used by the `grid` layout. The `id` of the field to be used for rendering each card's title.
|
|
67
70
|
|
|
68
71
|
### View <=> data
|
|
69
72
|
|
|
@@ -83,8 +86,8 @@ function MyCustomPageList() {
|
|
|
83
86
|
},
|
|
84
87
|
search: '',
|
|
85
88
|
filters: [
|
|
86
|
-
{ field: 'author', operator:
|
|
87
|
-
{ field: 'status', operator:
|
|
89
|
+
{ field: 'author', operator: OPERATOR_IN, value: 2 },
|
|
90
|
+
{ field: 'status', operator: OPERATOR_IN, value: 'publish,draft' }
|
|
88
91
|
],
|
|
89
92
|
hiddenFields: [ 'date', 'featured-image' ],
|
|
90
93
|
layout: {},
|
|
@@ -93,10 +96,10 @@ function MyCustomPageList() {
|
|
|
93
96
|
const queryArgs = useMemo( () => {
|
|
94
97
|
const filters = {};
|
|
95
98
|
view.filters.forEach( ( filter ) => {
|
|
96
|
-
if ( filter.field === 'status' && filter.operator ===
|
|
99
|
+
if ( filter.field === 'status' && filter.operator === OPERATOR_IN ) {
|
|
97
100
|
filters.status = filter.value;
|
|
98
101
|
}
|
|
99
|
-
if ( filter.field === 'author' && filter.operator ===
|
|
102
|
+
if ( filter.field === 'author' && filter.operator === OPERATOR_IN ) {
|
|
100
103
|
filters.author = filter.value;
|
|
101
104
|
}
|
|
102
105
|
} );
|
|
@@ -154,11 +157,11 @@ Example:
|
|
|
154
157
|
<a href="...">{ item.author }</a>
|
|
155
158
|
);
|
|
156
159
|
},
|
|
160
|
+
type: ENUMERATION_TYPE,
|
|
157
161
|
elements: [
|
|
158
162
|
{ value: 1, label: 'Admin' }
|
|
159
163
|
{ value: 2, label: 'User' }
|
|
160
164
|
]
|
|
161
|
-
filters: [ 'in' ],
|
|
162
165
|
enableSorting: false
|
|
163
166
|
}
|
|
164
167
|
]
|
|
@@ -169,7 +172,7 @@ Example:
|
|
|
169
172
|
- `getValue`: function that returns the value of the field.
|
|
170
173
|
- `render`: function that renders the field.
|
|
171
174
|
- `elements`: the set of valid values for the field's value.
|
|
172
|
-
- `
|
|
175
|
+
- `type`: the type of the field. Used to generate the proper filters. Only `enumeration` available at the moment.
|
|
173
176
|
- `enableSorting`: whether the data can be sorted by the given field. True by default.
|
|
174
177
|
- `enableHiding`: whether the field can be hidden. True by default.
|
|
175
178
|
|
|
@@ -183,6 +186,6 @@ Array of operations that can be performed upon each record. Each action is an ob
|
|
|
183
186
|
- `icon`: icon to show for primary actions. It's required for a primary action, otherwise the action would be considered secondary.
|
|
184
187
|
- `isEligible`: function, optional. Whether the action can be performed for a given record. If not present, the action is considered to be eligible for all items. It takes the given record as input.
|
|
185
188
|
- `isDestructive`: boolean, optional. Whether the action can delete data, in which case the UI would communicate it via red color.
|
|
186
|
-
- `callback`: function, required. Callback function that takes the record as input and performs the required action.
|
|
187
|
-
- `RenderModal`: ReactElement, optional. If an action requires
|
|
189
|
+
- `callback`: function, required unless `RenderModal` is provided. Callback function that takes the record as input and performs the required action.
|
|
190
|
+
- `RenderModal`: ReactElement, optional. If an action requires that some UI be rendered in a modal, it can provide a component which takes as props the record as `item` and a `closeModal` function. When this prop is provided, the `callback` property is ignored.
|
|
188
191
|
- `hideModalHeader`: boolean, optional. This property is used in combination with `RenderModal` and controls the visibility of the modal's header. If the action renders a modal and doesn't hide the header, the action's label is going to be used in the modal's header.
|
|
@@ -13,37 +13,34 @@ import { __ } from '@wordpress/i18n';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import { unlock } from '../../lock-unlock';
|
|
16
|
-
import { OPERATOR_IN } from './
|
|
16
|
+
import { ENUMERATION_TYPE, OPERATOR_IN } from './constants';
|
|
17
17
|
|
|
18
18
|
const {
|
|
19
|
-
DropdownMenuV2,
|
|
20
|
-
DropdownSubMenuV2,
|
|
21
|
-
DropdownSubMenuTriggerV2,
|
|
22
|
-
DropdownMenuItemV2,
|
|
19
|
+
DropdownMenuV2: DropdownMenu,
|
|
20
|
+
DropdownSubMenuV2: DropdownSubMenu,
|
|
21
|
+
DropdownSubMenuTriggerV2: DropdownSubMenuTrigger,
|
|
22
|
+
DropdownMenuItemV2: DropdownMenuItem,
|
|
23
23
|
} = unlock( componentsPrivateApis );
|
|
24
24
|
|
|
25
|
-
const VALID_OPERATORS = [ OPERATOR_IN ];
|
|
26
|
-
|
|
27
25
|
export default function AddFilter( { fields, view, onChangeView } ) {
|
|
28
26
|
const filters = [];
|
|
29
27
|
fields.forEach( ( field ) => {
|
|
30
|
-
if ( ! field.
|
|
28
|
+
if ( ! field.type ) {
|
|
31
29
|
return;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
switch ( field.type ) {
|
|
33
|
+
case ENUMERATION_TYPE:
|
|
36
34
|
filters.push( {
|
|
37
35
|
field: field.id,
|
|
38
36
|
name: field.header,
|
|
39
|
-
operator: filter,
|
|
40
37
|
elements: field.elements || [],
|
|
41
38
|
isVisible: view.filters.some(
|
|
42
|
-
( f ) =>
|
|
39
|
+
( f ) =>
|
|
40
|
+
f.field === field.id && f.operator === OPERATOR_IN
|
|
43
41
|
),
|
|
44
42
|
} );
|
|
45
|
-
|
|
46
|
-
} );
|
|
43
|
+
}
|
|
47
44
|
} );
|
|
48
45
|
|
|
49
46
|
if ( filters.length === 0 ) {
|
|
@@ -51,16 +48,16 @@ export default function AddFilter( { fields, view, onChangeView } ) {
|
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
return (
|
|
54
|
-
<
|
|
51
|
+
<DropdownMenu
|
|
55
52
|
label={ __( 'Add filter' ) }
|
|
56
53
|
trigger={
|
|
57
54
|
<Button
|
|
58
55
|
disabled={ filters.length === view.filters?.length }
|
|
59
56
|
__experimentalIsFocusable
|
|
60
|
-
icon={ plus }
|
|
61
57
|
variant="tertiary"
|
|
62
58
|
size="compact"
|
|
63
59
|
>
|
|
60
|
+
<Icon icon={ plus } style={ { flexShrink: 0 } } />
|
|
64
61
|
{ __( 'Add filter' ) }
|
|
65
62
|
</Button>
|
|
66
63
|
}
|
|
@@ -71,18 +68,18 @@ export default function AddFilter( { fields, view, onChangeView } ) {
|
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
return (
|
|
74
|
-
<
|
|
71
|
+
<DropdownSubMenu
|
|
75
72
|
key={ filter.field }
|
|
76
73
|
trigger={
|
|
77
|
-
<
|
|
74
|
+
<DropdownSubMenuTrigger
|
|
78
75
|
suffix={ <Icon icon={ chevronRightSmall } /> }
|
|
79
76
|
>
|
|
80
77
|
{ filter.name }
|
|
81
|
-
</
|
|
78
|
+
</DropdownSubMenuTrigger>
|
|
82
79
|
}
|
|
83
80
|
>
|
|
84
81
|
{ filter.elements.map( ( element ) => (
|
|
85
|
-
<
|
|
82
|
+
<DropdownMenuItem
|
|
86
83
|
key={ element.value }
|
|
87
84
|
onSelect={ () => {
|
|
88
85
|
onChangeView( ( currentView ) => ( {
|
|
@@ -92,7 +89,7 @@ export default function AddFilter( { fields, view, onChangeView } ) {
|
|
|
92
89
|
...currentView.filters,
|
|
93
90
|
{
|
|
94
91
|
field: filter.field,
|
|
95
|
-
operator:
|
|
92
|
+
operator: OPERATOR_IN,
|
|
96
93
|
value: element.value,
|
|
97
94
|
},
|
|
98
95
|
],
|
|
@@ -101,11 +98,11 @@ export default function AddFilter( { fields, view, onChangeView } ) {
|
|
|
101
98
|
role="menuitemcheckbox"
|
|
102
99
|
>
|
|
103
100
|
{ element.label }
|
|
104
|
-
</
|
|
101
|
+
</DropdownMenuItem>
|
|
105
102
|
) ) }
|
|
106
|
-
</
|
|
103
|
+
</DropdownSubMenu>
|
|
107
104
|
);
|
|
108
105
|
} ) }
|
|
109
|
-
</
|
|
106
|
+
</DropdownMenu>
|
|
110
107
|
);
|
|
111
108
|
}
|
|
@@ -41,6 +41,7 @@ export default function DataViews( {
|
|
|
41
41
|
searchLabel = undefined,
|
|
42
42
|
actions,
|
|
43
43
|
data,
|
|
44
|
+
getItemId,
|
|
44
45
|
isLoading = false,
|
|
45
46
|
paginationInfo,
|
|
46
47
|
supportedLayouts,
|
|
@@ -55,8 +56,8 @@ export default function DataViews( {
|
|
|
55
56
|
return (
|
|
56
57
|
<div className="dataviews-wrapper">
|
|
57
58
|
<VStack spacing={ 4 } justify="flex-start">
|
|
58
|
-
<HStack>
|
|
59
|
-
<HStack justify="start">
|
|
59
|
+
<HStack alignment="flex-start">
|
|
60
|
+
<HStack justify="start" wrap>
|
|
60
61
|
{ search && (
|
|
61
62
|
<Search
|
|
62
63
|
label={ searchLabel }
|
|
@@ -70,14 +71,12 @@ export default function DataViews( {
|
|
|
70
71
|
onChangeView={ onChangeView }
|
|
71
72
|
/>
|
|
72
73
|
</HStack>
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/>
|
|
80
|
-
</HStack>
|
|
74
|
+
<ViewActions
|
|
75
|
+
fields={ fields }
|
|
76
|
+
view={ view }
|
|
77
|
+
onChangeView={ onChangeView }
|
|
78
|
+
supportedLayouts={ supportedLayouts }
|
|
79
|
+
/>
|
|
81
80
|
</HStack>
|
|
82
81
|
<ViewComponent
|
|
83
82
|
fields={ _fields }
|
|
@@ -86,6 +85,7 @@ export default function DataViews( {
|
|
|
86
85
|
paginationInfo={ paginationInfo }
|
|
87
86
|
actions={ actions }
|
|
88
87
|
data={ data }
|
|
88
|
+
getItemId={ getItemId }
|
|
89
89
|
isLoading={ isLoading }
|
|
90
90
|
/>
|
|
91
91
|
<Pagination
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
privateApis as componentsPrivateApis,
|
|
7
|
+
Icon,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
import { chevronDown } from '@wordpress/icons';
|
|
10
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { OPERATOR_IN } from './constants';
|
|
16
|
+
import { unlock } from '../../lock-unlock';
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
DropdownMenuV2: DropdownMenu,
|
|
20
|
+
DropdownMenuCheckboxItemV2: DropdownMenuCheckboxItem,
|
|
21
|
+
} = unlock( componentsPrivateApis );
|
|
22
|
+
|
|
23
|
+
export default function FilterSummary( { filter, view, onChangeView } ) {
|
|
24
|
+
const filterInView = view.filters.find( ( f ) => f.field === filter.field );
|
|
25
|
+
const activeElement = filter.elements.find(
|
|
26
|
+
( element ) => element.value === filterInView?.value
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<DropdownMenu
|
|
31
|
+
key={ filter.field }
|
|
32
|
+
trigger={
|
|
33
|
+
<Button variant="tertiary" size="compact" label={ filter.name }>
|
|
34
|
+
{ activeElement !== undefined
|
|
35
|
+
? sprintf(
|
|
36
|
+
/* translators: 1: Filter name. 2: filter value. e.g.: "Author is Admin". */
|
|
37
|
+
__( '%1$s is %2$s' ),
|
|
38
|
+
filter.name,
|
|
39
|
+
activeElement.label
|
|
40
|
+
)
|
|
41
|
+
: filter.name }
|
|
42
|
+
<Icon icon={ chevronDown } style={ { flexShrink: 0 } } />
|
|
43
|
+
</Button>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
{ filter.elements.map( ( element ) => {
|
|
47
|
+
return (
|
|
48
|
+
<DropdownMenuCheckboxItem
|
|
49
|
+
key={ element.value }
|
|
50
|
+
value={ element.value }
|
|
51
|
+
checked={ activeElement?.value === element.value }
|
|
52
|
+
onSelect={ () =>
|
|
53
|
+
onChangeView( ( currentView ) => ( {
|
|
54
|
+
...currentView,
|
|
55
|
+
page: 1,
|
|
56
|
+
filters: [
|
|
57
|
+
...view.filters.filter(
|
|
58
|
+
( f ) => f.field !== filter.field
|
|
59
|
+
),
|
|
60
|
+
{
|
|
61
|
+
field: filter.field,
|
|
62
|
+
operator: OPERATOR_IN,
|
|
63
|
+
value:
|
|
64
|
+
activeElement?.value ===
|
|
65
|
+
element.value
|
|
66
|
+
? undefined
|
|
67
|
+
: element.value,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
} ) )
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
{ element.label }
|
|
74
|
+
</DropdownMenuCheckboxItem>
|
|
75
|
+
);
|
|
76
|
+
} ) }
|
|
77
|
+
</DropdownMenu>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
@@ -1,62 +1,45 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
9
|
-
import
|
|
4
|
+
import FilterSummary from './filter-summary';
|
|
10
5
|
import AddFilter from './add-filter';
|
|
11
6
|
import ResetFilters from './reset-filters';
|
|
12
|
-
|
|
13
|
-
const VALID_OPERATORS = [ OPERATOR_IN ];
|
|
7
|
+
import { ENUMERATION_TYPE, OPERATOR_IN } from './constants';
|
|
14
8
|
|
|
15
9
|
export default function Filters( { fields, view, onChangeView } ) {
|
|
16
10
|
const filters = [];
|
|
17
11
|
fields.forEach( ( field ) => {
|
|
18
|
-
if ( ! field.
|
|
12
|
+
if ( ! field.type ) {
|
|
19
13
|
return;
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
switch ( field.type ) {
|
|
17
|
+
case ENUMERATION_TYPE:
|
|
24
18
|
filters.push( {
|
|
25
19
|
field: field.id,
|
|
26
20
|
name: field.header,
|
|
27
|
-
|
|
28
|
-
elements: [
|
|
29
|
-
{
|
|
30
|
-
value: '',
|
|
31
|
-
label: __( 'All' ),
|
|
32
|
-
},
|
|
33
|
-
...( field.elements || [] ),
|
|
34
|
-
],
|
|
21
|
+
elements: field.elements || [],
|
|
35
22
|
isVisible: view.filters.some(
|
|
36
|
-
( f ) =>
|
|
23
|
+
( f ) =>
|
|
24
|
+
f.field === field.id && f.operator === OPERATOR_IN
|
|
37
25
|
),
|
|
38
26
|
} );
|
|
39
|
-
|
|
40
|
-
} );
|
|
27
|
+
}
|
|
41
28
|
} );
|
|
42
29
|
|
|
43
|
-
const filterComponents = filters
|
|
30
|
+
const filterComponents = filters.map( ( filter ) => {
|
|
44
31
|
if ( ! filter.isVisible ) {
|
|
45
32
|
return null;
|
|
46
33
|
}
|
|
47
34
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return null;
|
|
35
|
+
return (
|
|
36
|
+
<FilterSummary
|
|
37
|
+
key={ filter.field + '.' + filter.operator }
|
|
38
|
+
filter={ filter }
|
|
39
|
+
view={ view }
|
|
40
|
+
onChangeView={ onChangeView }
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
60
43
|
} );
|
|
61
44
|
|
|
62
45
|
filterComponents.push(
|
|
@@ -2,18 +2,28 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
DropdownMenu,
|
|
6
|
-
MenuGroup,
|
|
7
|
-
MenuItem,
|
|
8
5
|
Button,
|
|
9
6
|
Modal,
|
|
10
7
|
__experimentalHStack as HStack,
|
|
8
|
+
privateApis as componentsPrivateApis,
|
|
11
9
|
} from '@wordpress/components';
|
|
12
10
|
import { __ } from '@wordpress/i18n';
|
|
13
11
|
import { useMemo, useState } from '@wordpress/element';
|
|
14
12
|
import { moreVertical } from '@wordpress/icons';
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { unlock } from '../../lock-unlock';
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
DropdownMenuV2Ariakit: DropdownMenu,
|
|
21
|
+
DropdownMenuGroupV2Ariakit: DropdownMenuGroup,
|
|
22
|
+
DropdownMenuItemV2Ariakit: DropdownMenuItem,
|
|
23
|
+
DropdownMenuItemLabelV2Ariakit: DropdownMenuItemLabel,
|
|
24
|
+
} = unlock( componentsPrivateApis );
|
|
25
|
+
|
|
26
|
+
function ButtonTrigger( { action, onClick } ) {
|
|
17
27
|
return (
|
|
18
28
|
<Button
|
|
19
29
|
label={ action.label }
|
|
@@ -25,11 +35,11 @@ function PrimaryActionTrigger( { action, onClick } ) {
|
|
|
25
35
|
);
|
|
26
36
|
}
|
|
27
37
|
|
|
28
|
-
function
|
|
38
|
+
function DropdownMenuItemTrigger( { action, onClick } ) {
|
|
29
39
|
return (
|
|
30
|
-
<
|
|
31
|
-
{ action.label }
|
|
32
|
-
</
|
|
40
|
+
<DropdownMenuItem onClick={ onClick }>
|
|
41
|
+
<DropdownMenuItemLabel>{ action.label }</DropdownMenuItemLabel>
|
|
42
|
+
</DropdownMenuItem>
|
|
33
43
|
);
|
|
34
44
|
}
|
|
35
45
|
|
|
@@ -62,7 +72,33 @@ function ActionWithModal( { action, item, ActionTrigger } ) {
|
|
|
62
72
|
);
|
|
63
73
|
}
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
function ActionsDropdownMenuGroup( { actions, item } ) {
|
|
76
|
+
return (
|
|
77
|
+
<DropdownMenuGroup>
|
|
78
|
+
{ actions.map( ( action ) => {
|
|
79
|
+
if ( !! action.RenderModal ) {
|
|
80
|
+
return (
|
|
81
|
+
<ActionWithModal
|
|
82
|
+
key={ action.id }
|
|
83
|
+
action={ action }
|
|
84
|
+
item={ item }
|
|
85
|
+
ActionTrigger={ DropdownMenuItemTrigger }
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return (
|
|
90
|
+
<DropdownMenuItemTrigger
|
|
91
|
+
key={ action.id }
|
|
92
|
+
action={ action }
|
|
93
|
+
onClick={ () => action.callback( item ) }
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
} ) }
|
|
97
|
+
</DropdownMenuGroup>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default function ItemActions( { item, actions, isCompact } ) {
|
|
66
102
|
const { primaryActions, secondaryActions } = useMemo( () => {
|
|
67
103
|
return actions.reduce(
|
|
68
104
|
( accumulator, action ) => {
|
|
@@ -84,8 +120,24 @@ export default function ItemActions( { item, actions } ) {
|
|
|
84
120
|
if ( ! primaryActions.length && ! secondaryActions.length ) {
|
|
85
121
|
return null;
|
|
86
122
|
}
|
|
123
|
+
if ( isCompact ) {
|
|
124
|
+
return (
|
|
125
|
+
<CompactItemActions
|
|
126
|
+
item={ item }
|
|
127
|
+
primaryActions={ primaryActions }
|
|
128
|
+
secondaryActions={ secondaryActions }
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
87
132
|
return (
|
|
88
|
-
<HStack
|
|
133
|
+
<HStack
|
|
134
|
+
spacing={ 1 }
|
|
135
|
+
justify="flex-end"
|
|
136
|
+
style={ {
|
|
137
|
+
flexShrink: '0',
|
|
138
|
+
width: 'auto',
|
|
139
|
+
} }
|
|
140
|
+
>
|
|
89
141
|
{ !! primaryActions.length &&
|
|
90
142
|
primaryActions.map( ( action ) => {
|
|
91
143
|
if ( !! action.RenderModal ) {
|
|
@@ -94,51 +146,63 @@ export default function ItemActions( { item, actions } ) {
|
|
|
94
146
|
key={ action.id }
|
|
95
147
|
action={ action }
|
|
96
148
|
item={ item }
|
|
97
|
-
ActionTrigger={
|
|
149
|
+
ActionTrigger={ ButtonTrigger }
|
|
98
150
|
/>
|
|
99
151
|
);
|
|
100
152
|
}
|
|
101
153
|
return (
|
|
102
|
-
<
|
|
154
|
+
<ButtonTrigger
|
|
103
155
|
key={ action.id }
|
|
104
156
|
action={ action }
|
|
105
|
-
item={ item }
|
|
106
157
|
onClick={ () => action.callback( item ) }
|
|
107
158
|
/>
|
|
108
159
|
);
|
|
109
160
|
} ) }
|
|
110
161
|
{ !! secondaryActions.length && (
|
|
111
|
-
<DropdownMenu
|
|
112
|
-
{
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
return (
|
|
128
|
-
<SecondaryActionTrigger
|
|
129
|
-
key={ action.id }
|
|
130
|
-
action={ action }
|
|
131
|
-
item={ item }
|
|
132
|
-
onClick={ () =>
|
|
133
|
-
action.callback( item )
|
|
134
|
-
}
|
|
135
|
-
/>
|
|
136
|
-
);
|
|
137
|
-
} ) }
|
|
138
|
-
</MenuGroup>
|
|
139
|
-
) }
|
|
162
|
+
<DropdownMenu
|
|
163
|
+
trigger={
|
|
164
|
+
<Button
|
|
165
|
+
size="compact"
|
|
166
|
+
icon={ moreVertical }
|
|
167
|
+
label={ __( 'Actions' ) }
|
|
168
|
+
/>
|
|
169
|
+
}
|
|
170
|
+
placement="bottom-end"
|
|
171
|
+
>
|
|
172
|
+
<ActionsDropdownMenuGroup
|
|
173
|
+
actions={ secondaryActions }
|
|
174
|
+
item={ item }
|
|
175
|
+
/>
|
|
140
176
|
</DropdownMenu>
|
|
141
177
|
) }
|
|
142
178
|
</HStack>
|
|
143
179
|
);
|
|
144
180
|
}
|
|
181
|
+
|
|
182
|
+
function CompactItemActions( { item, primaryActions, secondaryActions } ) {
|
|
183
|
+
return (
|
|
184
|
+
<DropdownMenu
|
|
185
|
+
trigger={
|
|
186
|
+
<Button
|
|
187
|
+
size="compact"
|
|
188
|
+
icon={ moreVertical }
|
|
189
|
+
label={ __( 'Actions' ) }
|
|
190
|
+
/>
|
|
191
|
+
}
|
|
192
|
+
placement="bottom-end"
|
|
193
|
+
>
|
|
194
|
+
{ !! primaryActions.length && (
|
|
195
|
+
<ActionsDropdownMenuGroup
|
|
196
|
+
actions={ primaryActions }
|
|
197
|
+
item={ item }
|
|
198
|
+
/>
|
|
199
|
+
) }
|
|
200
|
+
{ !! secondaryActions.length && (
|
|
201
|
+
<ActionsDropdownMenuGroup
|
|
202
|
+
actions={ secondaryActions }
|
|
203
|
+
item={ item }
|
|
204
|
+
/>
|
|
205
|
+
) }
|
|
206
|
+
</DropdownMenu>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
@@ -48,6 +48,7 @@ function Pagination( {
|
|
|
48
48
|
onChangeView( { ...view, page: 1 } )
|
|
49
49
|
}
|
|
50
50
|
disabled={ view.page === 1 }
|
|
51
|
+
__experimentalIsFocusable
|
|
51
52
|
label={ __( 'First page' ) }
|
|
52
53
|
icon={ previous }
|
|
53
54
|
showTooltip
|
|
@@ -58,6 +59,7 @@ function Pagination( {
|
|
|
58
59
|
onChangeView( { ...view, page: view.page - 1 } )
|
|
59
60
|
}
|
|
60
61
|
disabled={ view.page === 1 }
|
|
62
|
+
__experimentalIsFocusable
|
|
61
63
|
label={ __( 'Previous page' ) }
|
|
62
64
|
icon={ chevronLeft }
|
|
63
65
|
showTooltip
|
|
@@ -115,6 +117,7 @@ function Pagination( {
|
|
|
115
117
|
onChangeView( { ...view, page: view.page + 1 } )
|
|
116
118
|
}
|
|
117
119
|
disabled={ view.page >= totalPages }
|
|
120
|
+
__experimentalIsFocusable
|
|
118
121
|
label={ __( 'Next page' ) }
|
|
119
122
|
icon={ chevronRight }
|
|
120
123
|
showTooltip
|
|
@@ -125,6 +128,7 @@ function Pagination( {
|
|
|
125
128
|
onChangeView( { ...view, page: totalPages } )
|
|
126
129
|
}
|
|
127
130
|
disabled={ view.page >= totalPages }
|
|
131
|
+
__experimentalIsFocusable
|
|
128
132
|
label={ __( 'Last page' ) }
|
|
129
133
|
icon={ next }
|
|
130
134
|
showTooltip
|