@wordpress/edit-site 6.42.0 → 6.43.1-next.v.202604091042.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/more-menu/site-export.cjs +1 -1
  3. package/build/components/more-menu/site-export.cjs.map +2 -2
  4. package/build/components/page-patterns/index.cjs +7 -27
  5. package/build/components/page-patterns/index.cjs.map +2 -2
  6. package/build/components/page-templates/index-legacy.cjs +13 -6
  7. package/build/components/page-templates/index-legacy.cjs.map +2 -2
  8. package/build/components/post-list/index.cjs +15 -6
  9. package/build/components/post-list/index.cjs.map +2 -2
  10. package/build/components/post-list/quick-edit-modal.cjs +16 -48
  11. package/build/components/post-list/quick-edit-modal.cjs.map +2 -2
  12. package/build/components/sidebar-dataviews/index.cjs +37 -25
  13. package/build/components/sidebar-dataviews/index.cjs.map +3 -3
  14. package/build/components/sidebar-identity/index.cjs +17 -1
  15. package/build/components/sidebar-identity/index.cjs.map +2 -2
  16. package/build/components/sidebar-navigation-screen-patterns/index.cjs +55 -47
  17. package/build/components/sidebar-navigation-screen-patterns/index.cjs.map +2 -2
  18. package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs +33 -56
  19. package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs.map +3 -3
  20. package/build/components/site-editor-routes/home.cjs +8 -4
  21. package/build/components/site-editor-routes/home.cjs.map +2 -2
  22. package/build/components/site-editor-routes/navigation-item.cjs +13 -6
  23. package/build/components/site-editor-routes/navigation-item.cjs.map +2 -2
  24. package/build/components/site-editor-routes/navigation.cjs +9 -4
  25. package/build/components/site-editor-routes/navigation.cjs.map +2 -2
  26. package/build/components/site-editor-routes/page-item.cjs +13 -6
  27. package/build/components/site-editor-routes/page-item.cjs.map +2 -2
  28. package/build/components/site-editor-routes/pages.cjs +21 -7
  29. package/build/components/site-editor-routes/pages.cjs.map +3 -3
  30. package/build/components/site-editor-routes/stylebook.cjs +17 -2
  31. package/build/components/site-editor-routes/stylebook.cjs.map +2 -2
  32. package/build/components/site-editor-routes/template-item.cjs +13 -6
  33. package/build/components/site-editor-routes/template-item.cjs.map +2 -2
  34. package/build/components/site-editor-routes/templates.cjs +20 -7
  35. package/build/components/site-editor-routes/templates.cjs.map +3 -3
  36. package/build/components/site-editor-routes/utils.cjs +7 -2
  37. package/build/components/site-editor-routes/utils.cjs.map +2 -2
  38. package/build-module/components/more-menu/site-export.mjs +1 -1
  39. package/build-module/components/more-menu/site-export.mjs.map +2 -2
  40. package/build-module/components/page-patterns/index.mjs +8 -30
  41. package/build-module/components/page-patterns/index.mjs.map +2 -2
  42. package/build-module/components/page-templates/index-legacy.mjs +14 -11
  43. package/build-module/components/page-templates/index-legacy.mjs.map +2 -2
  44. package/build-module/components/post-list/index.mjs +16 -11
  45. package/build-module/components/post-list/index.mjs.map +2 -2
  46. package/build-module/components/post-list/quick-edit-modal.mjs +16 -48
  47. package/build-module/components/post-list/quick-edit-modal.mjs.map +2 -2
  48. package/build-module/components/sidebar-dataviews/index.mjs +45 -25
  49. package/build-module/components/sidebar-dataviews/index.mjs.map +2 -2
  50. package/build-module/components/sidebar-identity/index.mjs +17 -1
  51. package/build-module/components/sidebar-identity/index.mjs.map +2 -2
  52. package/build-module/components/sidebar-navigation-screen-patterns/index.mjs +55 -47
  53. package/build-module/components/sidebar-navigation-screen-patterns/index.mjs.map +2 -2
  54. package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs +41 -59
  55. package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs.map +2 -2
  56. package/build-module/components/site-editor-routes/home.mjs +10 -6
  57. package/build-module/components/site-editor-routes/home.mjs.map +2 -2
  58. package/build-module/components/site-editor-routes/navigation-item.mjs +14 -7
  59. package/build-module/components/site-editor-routes/navigation-item.mjs.map +2 -2
  60. package/build-module/components/site-editor-routes/navigation.mjs +10 -5
  61. package/build-module/components/site-editor-routes/navigation.mjs.map +2 -2
  62. package/build-module/components/site-editor-routes/page-item.mjs +14 -7
  63. package/build-module/components/site-editor-routes/page-item.mjs.map +2 -2
  64. package/build-module/components/site-editor-routes/pages.mjs +22 -11
  65. package/build-module/components/site-editor-routes/pages.mjs.map +2 -2
  66. package/build-module/components/site-editor-routes/stylebook.mjs +18 -3
  67. package/build-module/components/site-editor-routes/stylebook.mjs.map +2 -2
  68. package/build-module/components/site-editor-routes/template-item.mjs +14 -7
  69. package/build-module/components/site-editor-routes/template-item.mjs.map +2 -2
  70. package/build-module/components/site-editor-routes/templates.mjs +21 -11
  71. package/build-module/components/site-editor-routes/templates.mjs.map +2 -2
  72. package/build-module/components/site-editor-routes/utils.mjs +5 -1
  73. package/build-module/components/site-editor-routes/utils.mjs.map +2 -2
  74. package/build-style/style-rtl.css +68 -51
  75. package/build-style/style.css +68 -51
  76. package/package.json +46 -46
  77. package/src/components/more-menu/site-export.js +1 -1
  78. package/src/components/page-patterns/index.js +9 -30
  79. package/src/components/page-templates/index-legacy.js +14 -11
  80. package/src/components/post-list/index.js +16 -10
  81. package/src/components/post-list/quick-edit-modal.js +19 -54
  82. package/src/components/post-list/style.scss +2 -0
  83. package/src/components/sidebar-dataviews/index.js +48 -26
  84. package/src/components/sidebar-dataviews/style.scss +0 -16
  85. package/src/components/sidebar-identity/index.js +17 -1
  86. package/src/components/sidebar-navigation-screen-patterns/index.js +62 -55
  87. package/src/components/sidebar-navigation-screen-templates-browse/content-legacy.js +44 -64
  88. package/src/components/site-editor-routes/home.js +9 -5
  89. package/src/components/site-editor-routes/navigation-item.js +13 -6
  90. package/src/components/site-editor-routes/navigation.js +9 -4
  91. package/src/components/site-editor-routes/page-item.js +13 -6
  92. package/src/components/site-editor-routes/pages.js +21 -10
  93. package/src/components/site-editor-routes/stylebook.js +12 -3
  94. package/src/components/site-editor-routes/template-item.js +13 -6
  95. package/src/components/site-editor-routes/templates.js +21 -10
  96. package/src/components/site-editor-routes/utils.js +12 -0
  97. package/build/components/post-list/view-utils.cjs +0 -202
  98. package/build/components/post-list/view-utils.cjs.map +0 -7
  99. package/build/components/sidebar-dataviews/dataview-item.cjs +0 -82
  100. package/build/components/sidebar-dataviews/dataview-item.cjs.map +0 -7
  101. package/build-module/components/post-list/view-utils.mjs +0 -182
  102. package/build-module/components/post-list/view-utils.mjs.map +0 -7
  103. package/build-module/components/sidebar-dataviews/dataview-item.mjs +0 -51
  104. package/build-module/components/sidebar-dataviews/dataview-item.mjs.map +0 -7
  105. package/src/components/post-list/view-utils.js +0 -187
  106. package/src/components/sidebar-dataviews/dataview-item.js +0 -56
@@ -1,182 +0,0 @@
1
- // packages/edit-site/src/components/post-list/view-utils.js
2
- import { __ } from "@wordpress/i18n";
3
- import {
4
- trash,
5
- pages,
6
- drafts,
7
- published,
8
- scheduled,
9
- pending,
10
- notAllowed
11
- } from "@wordpress/icons";
12
- import { OPERATOR_IS_ANY } from "../../utils/constants.mjs";
13
- var defaultLayouts = {
14
- table: {
15
- layout: {
16
- styles: {
17
- author: {
18
- align: "start"
19
- }
20
- }
21
- }
22
- },
23
- grid: {},
24
- list: {}
25
- };
26
- var DEFAULT_VIEW = {
27
- type: "list",
28
- filters: [],
29
- perPage: 20,
30
- sort: {
31
- field: "title",
32
- direction: "asc"
33
- },
34
- showLevels: true,
35
- titleField: "title",
36
- mediaField: "featured_media",
37
- fields: ["author", "status"],
38
- ...defaultLayouts.list
39
- };
40
- function getDefaultViews(postType) {
41
- return [
42
- {
43
- title: postType?.labels?.all_items || __("All items"),
44
- slug: "all",
45
- icon: pages,
46
- view: DEFAULT_VIEW
47
- },
48
- {
49
- title: __("Published"),
50
- slug: "published",
51
- icon: published,
52
- view: {
53
- ...DEFAULT_VIEW,
54
- filters: [
55
- {
56
- field: "status",
57
- operator: OPERATOR_IS_ANY,
58
- value: "publish",
59
- isLocked: true
60
- }
61
- ]
62
- }
63
- },
64
- {
65
- title: __("Scheduled"),
66
- slug: "future",
67
- icon: scheduled,
68
- view: {
69
- ...DEFAULT_VIEW,
70
- filters: [
71
- {
72
- field: "status",
73
- operator: OPERATOR_IS_ANY,
74
- value: "future",
75
- isLocked: true
76
- }
77
- ]
78
- }
79
- },
80
- {
81
- title: __("Drafts"),
82
- slug: "drafts",
83
- icon: drafts,
84
- view: {
85
- ...DEFAULT_VIEW,
86
- filters: [
87
- {
88
- field: "status",
89
- operator: OPERATOR_IS_ANY,
90
- value: "draft",
91
- isLocked: true
92
- }
93
- ]
94
- }
95
- },
96
- {
97
- title: __("Pending"),
98
- slug: "pending",
99
- icon: pending,
100
- view: {
101
- ...DEFAULT_VIEW,
102
- filters: [
103
- {
104
- field: "status",
105
- operator: OPERATOR_IS_ANY,
106
- value: "pending",
107
- isLocked: true
108
- }
109
- ]
110
- }
111
- },
112
- {
113
- title: __("Private"),
114
- slug: "private",
115
- icon: notAllowed,
116
- view: {
117
- ...DEFAULT_VIEW,
118
- filters: [
119
- {
120
- field: "status",
121
- operator: OPERATOR_IS_ANY,
122
- value: "private",
123
- isLocked: true
124
- }
125
- ]
126
- }
127
- },
128
- {
129
- title: __("Trash"),
130
- slug: "trash",
131
- icon: trash,
132
- view: {
133
- ...DEFAULT_VIEW,
134
- type: "table",
135
- layout: defaultLayouts.table.layout,
136
- filters: [
137
- {
138
- field: "status",
139
- operator: OPERATOR_IS_ANY,
140
- value: "trash",
141
- isLocked: true
142
- }
143
- ]
144
- }
145
- }
146
- ];
147
- }
148
- var SLUG_TO_STATUS = {
149
- published: "publish",
150
- future: "future",
151
- drafts: "draft",
152
- pending: "pending",
153
- private: "private",
154
- trash: "trash"
155
- };
156
- function getActiveViewOverridesForTab(activeView) {
157
- const base = {
158
- ...defaultLayouts.table
159
- };
160
- const status = SLUG_TO_STATUS[activeView];
161
- if (!status) {
162
- return base;
163
- }
164
- return {
165
- ...base,
166
- filters: [
167
- {
168
- field: "status",
169
- operator: OPERATOR_IS_ANY,
170
- value: status,
171
- isLocked: true
172
- }
173
- ]
174
- };
175
- }
176
- export {
177
- DEFAULT_VIEW,
178
- defaultLayouts,
179
- getActiveViewOverridesForTab,
180
- getDefaultViews
181
- };
182
- //# sourceMappingURL=view-utils.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/post-list/view-utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IS_ANY } from '../../utils/constants';\n\nexport const defaultLayouts = {\n\ttable: {\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\talign: 'start',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tgrid: {},\n\tlist: {},\n};\n\nexport const DEFAULT_VIEW = {\n\ttype: 'list',\n\tfilters: [],\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\tshowLevels: true,\n\ttitleField: 'title',\n\tmediaField: 'featured_media',\n\tfields: [ 'author', 'status' ],\n\t...defaultLayouts.list,\n};\n\nexport function getDefaultViews( postType ) {\n\treturn [\n\t\t{\n\t\t\ttitle: postType?.labels?.all_items || __( 'All items' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_VIEW,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Published' ),\n\t\t\tslug: 'published',\n\t\t\ticon: published,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'publish',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Scheduled' ),\n\t\t\tslug: 'future',\n\t\t\ticon: scheduled,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'future',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Pending' ),\n\t\t\tslug: 'pending',\n\t\t\ticon: pending,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'pending',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Private' ),\n\t\t\tslug: 'private',\n\t\t\ticon: notAllowed,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'private',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\ttype: 'table',\n\t\t\t\tlayout: defaultLayouts.table.layout,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t];\n}\n\nconst SLUG_TO_STATUS = {\n\tpublished: 'publish',\n\tfuture: 'future',\n\tdrafts: 'draft',\n\tpending: 'pending',\n\tprivate: 'private',\n\ttrash: 'trash',\n};\n\nexport function getActiveViewOverridesForTab( activeView ) {\n\tconst base = {\n\t\t...defaultLayouts.table,\n\t};\n\tconst status = SLUG_TO_STATUS[ activeView ];\n\tif ( ! status ) {\n\t\treturn base;\n\t}\n\treturn {\n\t\t...base,\n\t\tfilters: [\n\t\t\t{\n\t\t\t\tfield: 'status',\n\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\tvalue: status,\n\t\t\t\tisLocked: true,\n\t\t\t},\n\t\t],\n\t};\n}\n"],
5
- "mappings": "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",
6
- "names": []
7
- }
@@ -1,51 +0,0 @@
1
- // packages/edit-site/src/components/sidebar-dataviews/dataview-item.js
2
- import clsx from "clsx";
3
- import { privateApis as routerPrivateApis } from "@wordpress/router";
4
- import { __experimentalHStack as HStack } from "@wordpress/components";
5
- import { VIEW_LAYOUTS } from "@wordpress/dataviews";
6
- import { addQueryArgs } from "@wordpress/url";
7
- import SidebarNavigationItem from "../sidebar-navigation-item/index.mjs";
8
- import { unlock } from "../../lock-unlock.mjs";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var { useLocation } = unlock(routerPrivateApis);
11
- function DataViewItem({
12
- title,
13
- slug,
14
- type,
15
- icon,
16
- isActive,
17
- suffix
18
- }) {
19
- const { path } = useLocation();
20
- const iconToUse = icon || VIEW_LAYOUTS.find((v) => v.type === type).icon;
21
- if (slug === "all") {
22
- slug = void 0;
23
- }
24
- return /* @__PURE__ */ jsxs(
25
- HStack,
26
- {
27
- justify: "flex-start",
28
- className: clsx("edit-site-sidebar-dataviews-dataview-item", {
29
- "is-selected": isActive
30
- }),
31
- children: [
32
- /* @__PURE__ */ jsx(
33
- SidebarNavigationItem,
34
- {
35
- icon: iconToUse,
36
- to: addQueryArgs(path, {
37
- activeView: slug
38
- }),
39
- "aria-current": isActive ? "true" : void 0,
40
- children: title
41
- }
42
- ),
43
- suffix
44
- ]
45
- }
46
- );
47
- }
48
- export {
49
- DataViewItem as default
50
- };
51
- //# sourceMappingURL=dataview-item.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar-dataviews/dataview-item.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { VIEW_LAYOUTS } from '@wordpress/dataviews';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function DataViewItem( {\n\ttitle,\n\tslug,\n\ttype,\n\ticon,\n\tisActive,\n\tsuffix,\n} ) {\n\tconst { path } = useLocation();\n\n\tconst iconToUse =\n\t\ticon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;\n\n\tif ( slug === 'all' ) {\n\t\tslug = undefined;\n\t}\n\treturn (\n\t\t<HStack\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ clsx( 'edit-site-sidebar-dataviews-dataview-item', {\n\t\t\t\t'is-selected': isActive,\n\t\t\t} ) }\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ iconToUse }\n\t\t\t\tto={ addQueryArgs( path, {\n\t\t\t\t\tactiveView: slug,\n\t\t\t\t} ) }\n\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ suffix }\n\t\t</HStack>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,eAAe,yBAAyB;AACjD,SAAS,wBAAwB,cAAc;AAC/C,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAK7B,OAAO,2BAA2B;AAClC,SAAS,cAAc;AAoBrB,SAMC,KAND;AAnBF,IAAM,EAAE,YAAY,IAAI,OAAQ,iBAAkB;AAEnC,SAAR,aAA+B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,KAAK,IAAI,YAAY;AAE7B,QAAM,YACL,QAAQ,aAAa,KAAM,CAAE,MAAO,EAAE,SAAS,IAAK,EAAE;AAEvD,MAAK,SAAS,OAAQ;AACrB,WAAO;AAAA,EACR;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,WAAY,KAAM,6CAA6C;AAAA,QAC9D,eAAe;AAAA,MAChB,CAAE;AAAA,MAEF;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,MAAO;AAAA,YACP,IAAK,aAAc,MAAM;AAAA,cACxB,YAAY;AAAA,YACb,CAAE;AAAA,YACF,gBAAe,WAAW,SAAS;AAAA,YAEjC;AAAA;AAAA,QACH;AAAA,QACE;AAAA;AAAA;AAAA,EACH;AAEF;",
6
- "names": []
7
- }
@@ -1,187 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
-
6
- import {
7
- trash,
8
- pages,
9
- drafts,
10
- published,
11
- scheduled,
12
- pending,
13
- notAllowed,
14
- } from '@wordpress/icons';
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
- import { OPERATOR_IS_ANY } from '../../utils/constants';
20
-
21
- export const defaultLayouts = {
22
- table: {
23
- layout: {
24
- styles: {
25
- author: {
26
- align: 'start',
27
- },
28
- },
29
- },
30
- },
31
- grid: {},
32
- list: {},
33
- };
34
-
35
- export const DEFAULT_VIEW = {
36
- type: 'list',
37
- filters: [],
38
- perPage: 20,
39
- sort: {
40
- field: 'title',
41
- direction: 'asc',
42
- },
43
- showLevels: true,
44
- titleField: 'title',
45
- mediaField: 'featured_media',
46
- fields: [ 'author', 'status' ],
47
- ...defaultLayouts.list,
48
- };
49
-
50
- export function getDefaultViews( postType ) {
51
- return [
52
- {
53
- title: postType?.labels?.all_items || __( 'All items' ),
54
- slug: 'all',
55
- icon: pages,
56
- view: DEFAULT_VIEW,
57
- },
58
- {
59
- title: __( 'Published' ),
60
- slug: 'published',
61
- icon: published,
62
- view: {
63
- ...DEFAULT_VIEW,
64
- filters: [
65
- {
66
- field: 'status',
67
- operator: OPERATOR_IS_ANY,
68
- value: 'publish',
69
- isLocked: true,
70
- },
71
- ],
72
- },
73
- },
74
- {
75
- title: __( 'Scheduled' ),
76
- slug: 'future',
77
- icon: scheduled,
78
- view: {
79
- ...DEFAULT_VIEW,
80
- filters: [
81
- {
82
- field: 'status',
83
- operator: OPERATOR_IS_ANY,
84
- value: 'future',
85
- isLocked: true,
86
- },
87
- ],
88
- },
89
- },
90
- {
91
- title: __( 'Drafts' ),
92
- slug: 'drafts',
93
- icon: drafts,
94
- view: {
95
- ...DEFAULT_VIEW,
96
- filters: [
97
- {
98
- field: 'status',
99
- operator: OPERATOR_IS_ANY,
100
- value: 'draft',
101
- isLocked: true,
102
- },
103
- ],
104
- },
105
- },
106
- {
107
- title: __( 'Pending' ),
108
- slug: 'pending',
109
- icon: pending,
110
- view: {
111
- ...DEFAULT_VIEW,
112
- filters: [
113
- {
114
- field: 'status',
115
- operator: OPERATOR_IS_ANY,
116
- value: 'pending',
117
- isLocked: true,
118
- },
119
- ],
120
- },
121
- },
122
- {
123
- title: __( 'Private' ),
124
- slug: 'private',
125
- icon: notAllowed,
126
- view: {
127
- ...DEFAULT_VIEW,
128
- filters: [
129
- {
130
- field: 'status',
131
- operator: OPERATOR_IS_ANY,
132
- value: 'private',
133
- isLocked: true,
134
- },
135
- ],
136
- },
137
- },
138
- {
139
- title: __( 'Trash' ),
140
- slug: 'trash',
141
- icon: trash,
142
- view: {
143
- ...DEFAULT_VIEW,
144
- type: 'table',
145
- layout: defaultLayouts.table.layout,
146
- filters: [
147
- {
148
- field: 'status',
149
- operator: OPERATOR_IS_ANY,
150
- value: 'trash',
151
- isLocked: true,
152
- },
153
- ],
154
- },
155
- },
156
- ];
157
- }
158
-
159
- const SLUG_TO_STATUS = {
160
- published: 'publish',
161
- future: 'future',
162
- drafts: 'draft',
163
- pending: 'pending',
164
- private: 'private',
165
- trash: 'trash',
166
- };
167
-
168
- export function getActiveViewOverridesForTab( activeView ) {
169
- const base = {
170
- ...defaultLayouts.table,
171
- };
172
- const status = SLUG_TO_STATUS[ activeView ];
173
- if ( ! status ) {
174
- return base;
175
- }
176
- return {
177
- ...base,
178
- filters: [
179
- {
180
- field: 'status',
181
- operator: OPERATOR_IS_ANY,
182
- value: status,
183
- isLocked: true,
184
- },
185
- ],
186
- };
187
- }
@@ -1,56 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import clsx from 'clsx';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { privateApis as routerPrivateApis } from '@wordpress/router';
10
- import { __experimentalHStack as HStack } from '@wordpress/components';
11
- import { VIEW_LAYOUTS } from '@wordpress/dataviews';
12
- import { addQueryArgs } from '@wordpress/url';
13
-
14
- /**
15
- * Internal dependencies
16
- */
17
- import SidebarNavigationItem from '../sidebar-navigation-item';
18
- import { unlock } from '../../lock-unlock';
19
- const { useLocation } = unlock( routerPrivateApis );
20
-
21
- export default function DataViewItem( {
22
- title,
23
- slug,
24
- type,
25
- icon,
26
- isActive,
27
- suffix,
28
- } ) {
29
- const { path } = useLocation();
30
-
31
- const iconToUse =
32
- icon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;
33
-
34
- if ( slug === 'all' ) {
35
- slug = undefined;
36
- }
37
- return (
38
- <HStack
39
- justify="flex-start"
40
- className={ clsx( 'edit-site-sidebar-dataviews-dataview-item', {
41
- 'is-selected': isActive,
42
- } ) }
43
- >
44
- <SidebarNavigationItem
45
- icon={ iconToUse }
46
- to={ addQueryArgs( path, {
47
- activeView: slug,
48
- } ) }
49
- aria-current={ isActive ? 'true' : undefined }
50
- >
51
- { title }
52
- </SidebarNavigationItem>
53
- { suffix }
54
- </HStack>
55
- );
56
- }