@wordpress/edit-site 6.33.5 → 6.33.7
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/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +2 -2
- package/build/components/add-new-template/index.js +6 -4
- package/build/components/add-new-template/index.js.map +2 -2
- package/build/components/add-new-template/utils.js +84 -9
- package/build/components/add-new-template/utils.js.map +2 -2
- package/build/components/dataviews-actions/index.js +2 -55
- package/build/components/dataviews-actions/index.js.map +3 -3
- package/build/components/editor/index.js +0 -1
- package/build/components/editor/index.js.map +2 -2
- package/build/components/editor/use-resolve-edited-entity.js +5 -11
- package/build/components/editor/use-resolve-edited-entity.js.map +2 -2
- package/build/components/page-patterns/index.js +1 -1
- package/build/components/page-patterns/index.js.map +2 -2
- package/build/components/page-templates/fields.js +5 -80
- package/build/components/page-templates/fields.js.map +3 -3
- package/build/components/page-templates/hooks.js +1 -1
- package/build/components/page-templates/hooks.js.map +2 -2
- package/build/components/page-templates/index.js +46 -217
- package/build/components/page-templates/index.js.map +3 -3
- package/build/components/page-templates/view-utils.js +1 -5
- package/build/components/page-templates/view-utils.js.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +6 -21
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
- package/build/components/site-editor-routes/template-item.js +14 -15
- package/build/components/site-editor-routes/template-item.js.map +2 -2
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +2 -2
- package/build-module/components/add-new-template/index.js +7 -4
- package/build-module/components/add-new-template/index.js.map +2 -2
- package/build-module/components/add-new-template/utils.js +84 -9
- package/build-module/components/add-new-template/utils.js.map +2 -2
- package/build-module/components/dataviews-actions/index.js +1 -53
- package/build-module/components/dataviews-actions/index.js.map +2 -2
- package/build-module/components/editor/index.js +0 -1
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/editor/use-resolve-edited-entity.js +5 -11
- package/build-module/components/editor/use-resolve-edited-entity.js.map +2 -2
- package/build-module/components/page-patterns/index.js +1 -1
- package/build-module/components/page-patterns/index.js.map +2 -2
- package/build-module/components/page-templates/fields.js +6 -85
- package/build-module/components/page-templates/fields.js.map +3 -3
- package/build-module/components/page-templates/hooks.js +1 -1
- package/build-module/components/page-templates/hooks.js.map +2 -2
- package/build-module/components/page-templates/index.js +51 -235
- package/build-module/components/page-templates/index.js.map +2 -2
- package/build-module/components/page-templates/view-utils.js +1 -5
- package/build-module/components/page-templates/view-utils.js.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +7 -22
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
- package/build-module/components/site-editor-routes/template-item.js +14 -15
- package/build-module/components/site-editor-routes/template-item.js.map +2 -2
- package/build-style/posts-rtl.css +6 -1
- package/build-style/posts.css +6 -1
- package/build-style/style-rtl.css +6 -1
- package/build-style/style.css +6 -1
- package/package.json +17 -17
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/src/components/add-new-template/index.js +9 -4
- package/src/components/add-new-template/utils.js +118 -9
- package/src/components/dataviews-actions/index.js +0 -61
- package/src/components/editor/index.js +0 -1
- package/src/components/editor/use-resolve-edited-entity.js +5 -20
- package/src/components/page-patterns/index.js +1 -1
- package/src/components/page-templates/fields.js +5 -95
- package/src/components/page-templates/hooks.js +1 -1
- package/src/components/page-templates/index.js +35 -244
- package/src/components/page-templates/view-utils.js +1 -8
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +7 -22
- package/src/components/site-editor-routes/template-item.js +26 -28
|
@@ -1,45 +1,28 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Page } from "@wordpress/admin-ui";
|
|
3
|
-
import { __
|
|
4
|
-
import { decodeEntities } from "@wordpress/html-entities";
|
|
3
|
+
import { __ } from "@wordpress/i18n";
|
|
5
4
|
import { useState, useMemo, useCallback } from "@wordpress/element";
|
|
6
|
-
import {
|
|
7
|
-
privateApis as corePrivateApis,
|
|
8
|
-
store as coreStore
|
|
9
|
-
} from "@wordpress/core-data";
|
|
5
|
+
import { privateApis as corePrivateApis } from "@wordpress/core-data";
|
|
10
6
|
import { DataViews, filterSortAndPaginate } from "@wordpress/dataviews";
|
|
11
7
|
import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
12
8
|
import { privateApis as editorPrivateApis } from "@wordpress/editor";
|
|
13
9
|
import { addQueryArgs } from "@wordpress/url";
|
|
14
|
-
import { useSelect, useDispatch } from "@wordpress/data";
|
|
15
10
|
import { useEvent } from "@wordpress/compose";
|
|
16
11
|
import { useView } from "@wordpress/views";
|
|
17
|
-
import { Button
|
|
18
|
-
import { store as noticesStore } from "@wordpress/notices";
|
|
12
|
+
import { Button } from "@wordpress/components";
|
|
19
13
|
import AddNewTemplate from "../add-new-template";
|
|
20
14
|
import { TEMPLATE_POST_TYPE } from "../../utils/constants";
|
|
21
15
|
import { unlock } from "../../lock-unlock";
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
useSetActiveTemplateAction
|
|
25
|
-
} from "../dataviews-actions";
|
|
26
|
-
import {
|
|
27
|
-
authorField,
|
|
28
|
-
descriptionField,
|
|
29
|
-
previewField,
|
|
30
|
-
activeField,
|
|
31
|
-
slugField,
|
|
32
|
-
useThemeField
|
|
33
|
-
} from "./fields";
|
|
16
|
+
import { useEditPostAction } from "../dataviews-actions";
|
|
17
|
+
import { authorField, descriptionField, previewField } from "./fields";
|
|
34
18
|
import { defaultLayouts, getDefaultView } from "./view-utils";
|
|
35
|
-
const { usePostActions,
|
|
19
|
+
const { usePostActions, templateTitleField } = unlock(editorPrivateApis);
|
|
36
20
|
const { useHistory, useLocation } = unlock(routerPrivateApis);
|
|
37
21
|
const { useEntityRecordsWithPermissions } = unlock(corePrivateApis);
|
|
38
22
|
function PageTemplates() {
|
|
39
23
|
const { path, query } = useLocation();
|
|
40
24
|
const { activeView = "active", postId } = query;
|
|
41
25
|
const [selection, setSelection] = useState([postId]);
|
|
42
|
-
const [selectedRegisteredTemplate, setSelectedRegisteredTemplate] = useState(false);
|
|
43
26
|
const defaultView = useMemo(() => {
|
|
44
27
|
return getDefaultView(activeView);
|
|
45
28
|
}, [activeView]);
|
|
@@ -62,105 +45,9 @@ function PageTemplates() {
|
|
|
62
45
|
);
|
|
63
46
|
}
|
|
64
47
|
});
|
|
65
|
-
const {
|
|
66
|
-
const { getEntityRecord, getCurrentTheme } = select(coreStore);
|
|
67
|
-
return {
|
|
68
|
-
activeTemplatesOption: getEntityRecord("root", "site")?.active_templates,
|
|
69
|
-
activeTheme: getCurrentTheme(),
|
|
70
|
-
defaultTemplateTypes: select(coreStore).getCurrentTheme()?.default_template_types
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
const { records: userRecords, isResolving: isLoadingUserRecords } = useEntityRecordsWithPermissions("postType", TEMPLATE_POST_TYPE, {
|
|
74
|
-
per_page: -1,
|
|
75
|
-
combinedTemplates: false
|
|
76
|
-
});
|
|
77
|
-
const { records: staticRecords, isResolving: isLoadingStaticData } = useEntityRecordsWithPermissions("root", "registeredTemplate", {
|
|
78
|
-
// This should not be needed, the endpoint returns all registered
|
|
79
|
-
// templates, but it's not possible right now to turn off pagination
|
|
80
|
-
// for entity configs.
|
|
48
|
+
const { records, isResolving: isLoadingData } = useEntityRecordsWithPermissions("postType", TEMPLATE_POST_TYPE, {
|
|
81
49
|
per_page: -1
|
|
82
50
|
});
|
|
83
|
-
const activeTemplates = useMemo(() => {
|
|
84
|
-
const _active = [...staticRecords];
|
|
85
|
-
if (activeTemplatesOption) {
|
|
86
|
-
for (const activeSlug in activeTemplatesOption) {
|
|
87
|
-
const activeId = activeTemplatesOption[activeSlug];
|
|
88
|
-
const template = userRecords.find(
|
|
89
|
-
(userRecord) => userRecord.id === activeId && userRecord.theme === activeTheme.stylesheet
|
|
90
|
-
);
|
|
91
|
-
if (template) {
|
|
92
|
-
const index = _active.findIndex(
|
|
93
|
-
({ slug }) => slug === template.slug
|
|
94
|
-
);
|
|
95
|
-
if (index !== -1) {
|
|
96
|
-
_active[index] = template;
|
|
97
|
-
} else {
|
|
98
|
-
_active.push(template);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return _active;
|
|
104
|
-
}, [userRecords, staticRecords, activeTemplatesOption, activeTheme]);
|
|
105
|
-
let isLoadingData;
|
|
106
|
-
if (activeView === "active") {
|
|
107
|
-
isLoadingData = isLoadingUserRecords || isLoadingStaticData;
|
|
108
|
-
} else if (activeView === "user") {
|
|
109
|
-
isLoadingData = isLoadingUserRecords;
|
|
110
|
-
} else {
|
|
111
|
-
isLoadingData = isLoadingStaticData;
|
|
112
|
-
}
|
|
113
|
-
const records = useMemo(() => {
|
|
114
|
-
function isCustom(record) {
|
|
115
|
-
return record.is_custom ?? // For user templates it's custom if the is_wp_suggestion meta
|
|
116
|
-
// field is not set and the slug is not found in the default
|
|
117
|
-
// template types.
|
|
118
|
-
(!record.meta?.is_wp_suggestion && !defaultTemplateTypes.some(
|
|
119
|
-
(type) => type.slug === record.slug
|
|
120
|
-
));
|
|
121
|
-
}
|
|
122
|
-
let _records;
|
|
123
|
-
if (activeView === "active") {
|
|
124
|
-
_records = activeTemplates.filter(
|
|
125
|
-
(record) => !isCustom(record)
|
|
126
|
-
);
|
|
127
|
-
} else if (activeView === "user") {
|
|
128
|
-
_records = userRecords;
|
|
129
|
-
} else {
|
|
130
|
-
_records = staticRecords;
|
|
131
|
-
}
|
|
132
|
-
return _records.map((record) => ({
|
|
133
|
-
...record,
|
|
134
|
-
_isActive: activeTemplates.some(
|
|
135
|
-
(template) => template.id === record.id
|
|
136
|
-
),
|
|
137
|
-
_isCustom: isCustom(record)
|
|
138
|
-
}));
|
|
139
|
-
}, [
|
|
140
|
-
activeTemplates,
|
|
141
|
-
defaultTemplateTypes,
|
|
142
|
-
userRecords,
|
|
143
|
-
staticRecords,
|
|
144
|
-
activeView
|
|
145
|
-
]);
|
|
146
|
-
const users = useSelect(
|
|
147
|
-
(select) => {
|
|
148
|
-
const { getUser } = select(coreStore);
|
|
149
|
-
return records.reduce((acc, record) => {
|
|
150
|
-
if (record.author_text) {
|
|
151
|
-
if (!acc[record.author_text]) {
|
|
152
|
-
acc[record.author_text] = record.author_text;
|
|
153
|
-
}
|
|
154
|
-
} else if (record.author) {
|
|
155
|
-
if (!acc[record.author]) {
|
|
156
|
-
acc[record.author] = getUser(record.author);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return acc;
|
|
160
|
-
}, {});
|
|
161
|
-
},
|
|
162
|
-
[records]
|
|
163
|
-
);
|
|
164
51
|
const history = useHistory();
|
|
165
52
|
const onChangeSelection = useCallback(
|
|
166
53
|
(items) => {
|
|
@@ -175,87 +62,42 @@ function PageTemplates() {
|
|
|
175
62
|
},
|
|
176
63
|
[history, path, view?.type]
|
|
177
64
|
);
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
65
|
+
const authors = useMemo(() => {
|
|
66
|
+
if (!records) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const authorsSet = /* @__PURE__ */ new Set();
|
|
70
|
+
records.forEach((template) => {
|
|
71
|
+
authorsSet.add(template.author_text);
|
|
72
|
+
});
|
|
73
|
+
return Array.from(authorsSet).map((author) => ({
|
|
74
|
+
value: author,
|
|
75
|
+
label: author
|
|
76
|
+
}));
|
|
77
|
+
}, [records]);
|
|
78
|
+
const fields = useMemo(
|
|
79
|
+
() => [
|
|
185
80
|
previewField,
|
|
186
81
|
templateTitleField,
|
|
187
82
|
descriptionField,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (activeView === "user") {
|
|
192
|
-
_fields.push(themeField);
|
|
193
|
-
if (dateField) {
|
|
194
|
-
_fields.push(dateField);
|
|
83
|
+
{
|
|
84
|
+
...authorField,
|
|
85
|
+
elements: authors
|
|
195
86
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
elements.push({
|
|
200
|
-
value: users[author]?.id ?? author,
|
|
201
|
-
label: users[author]?.name ?? author
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
_fields.push({
|
|
205
|
-
...authorField,
|
|
206
|
-
elements
|
|
207
|
-
});
|
|
208
|
-
return _fields;
|
|
209
|
-
}, [users, activeView, themeField, dateField]);
|
|
87
|
+
],
|
|
88
|
+
[authors]
|
|
89
|
+
);
|
|
210
90
|
const { data, paginationInfo } = useMemo(() => {
|
|
211
91
|
return filterSortAndPaginate(records, view, fields);
|
|
212
92
|
}, [records, view, fields]);
|
|
213
|
-
const { createSuccessNotice } = useDispatch(noticesStore);
|
|
214
|
-
const onActionPerformed = useCallback(
|
|
215
|
-
(actionId, items) => {
|
|
216
|
-
switch (actionId) {
|
|
217
|
-
case "duplicate-post":
|
|
218
|
-
{
|
|
219
|
-
const newItem = items[0];
|
|
220
|
-
const _title = typeof newItem.title === "string" ? newItem.title : newItem.title?.rendered;
|
|
221
|
-
history.navigate(`/template?activeView=user`);
|
|
222
|
-
createSuccessNotice(
|
|
223
|
-
sprintf(
|
|
224
|
-
// translators: %s: Title of the created post or template, e.g: "Hello world".
|
|
225
|
-
__('"%s" successfully created.'),
|
|
226
|
-
decodeEntities(_title) || __("(no title)")
|
|
227
|
-
),
|
|
228
|
-
{
|
|
229
|
-
type: "snackbar",
|
|
230
|
-
id: "duplicate-post-action",
|
|
231
|
-
actions: [
|
|
232
|
-
{
|
|
233
|
-
label: __("Edit"),
|
|
234
|
-
onClick: () => {
|
|
235
|
-
history.navigate(
|
|
236
|
-
`/${newItem.type}/${newItem.id}?canvas=edit`
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
[history, createSuccessNotice]
|
|
248
|
-
);
|
|
249
93
|
const postTypeActions = usePostActions({
|
|
250
94
|
postType: TEMPLATE_POST_TYPE,
|
|
251
|
-
context: "list"
|
|
252
|
-
onActionPerformed
|
|
95
|
+
context: "list"
|
|
253
96
|
});
|
|
254
97
|
const editAction = useEditPostAction();
|
|
255
|
-
const setActiveTemplateAction = useSetActiveTemplateAction();
|
|
256
98
|
const actions = useMemo(
|
|
257
|
-
() =>
|
|
258
|
-
[postTypeActions,
|
|
99
|
+
() => [editAction, ...postTypeActions],
|
|
100
|
+
[postTypeActions, editAction]
|
|
259
101
|
);
|
|
260
102
|
const onChangeView = useEvent((newView) => {
|
|
261
103
|
if (newView.type !== view.type) {
|
|
@@ -263,10 +105,7 @@ function PageTemplates() {
|
|
|
263
105
|
}
|
|
264
106
|
updateView(newView);
|
|
265
107
|
});
|
|
266
|
-
|
|
267
|
-
(action) => action.id === "duplicate-post"
|
|
268
|
-
);
|
|
269
|
-
return /* @__PURE__ */ jsxs(
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
270
109
|
Page,
|
|
271
110
|
{
|
|
272
111
|
className: "edit-site-page-templates",
|
|
@@ -285,49 +124,26 @@ function PageTemplates() {
|
|
|
285
124
|
),
|
|
286
125
|
/* @__PURE__ */ jsx(AddNewTemplate, {})
|
|
287
126
|
] }),
|
|
288
|
-
children:
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if (typeof item.id === "string") {
|
|
303
|
-
setSelectedRegisteredTemplate(item);
|
|
304
|
-
} else {
|
|
305
|
-
history.navigate(
|
|
306
|
-
`/${item.type}/${item.id}?canvas=edit`
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
selection,
|
|
311
|
-
defaultLayouts
|
|
127
|
+
children: /* @__PURE__ */ jsx(
|
|
128
|
+
DataViews,
|
|
129
|
+
{
|
|
130
|
+
paginationInfo,
|
|
131
|
+
fields,
|
|
132
|
+
actions,
|
|
133
|
+
data,
|
|
134
|
+
isLoading: isLoadingData,
|
|
135
|
+
view,
|
|
136
|
+
onChangeView,
|
|
137
|
+
onChangeSelection,
|
|
138
|
+
isItemClickable: () => true,
|
|
139
|
+
onClickItem: ({ id }) => {
|
|
140
|
+
history.navigate(`/wp_template/${id}?canvas=edit`);
|
|
312
141
|
},
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
title: __("Duplicate"),
|
|
319
|
-
onRequestClose: () => setSelectedRegisteredTemplate(),
|
|
320
|
-
size: "small",
|
|
321
|
-
children: /* @__PURE__ */ jsx(
|
|
322
|
-
duplicateAction.RenderModal,
|
|
323
|
-
{
|
|
324
|
-
items: [selectedRegisteredTemplate],
|
|
325
|
-
closeModal: () => setSelectedRegisteredTemplate()
|
|
326
|
-
}
|
|
327
|
-
)
|
|
328
|
-
}
|
|
329
|
-
)
|
|
330
|
-
]
|
|
142
|
+
selection,
|
|
143
|
+
defaultLayouts
|
|
144
|
+
},
|
|
145
|
+
activeView
|
|
146
|
+
)
|
|
331
147
|
}
|
|
332
148
|
);
|
|
333
149
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-templates/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport {\n\tprivateApis as corePrivateApis,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEvent } from '@wordpress/compose';\nimport { useView } from '@wordpress/views';\nimport { Button, Modal } from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tuseEditPostAction,\n\tuseSetActiveTemplateAction,\n} from '../dataviews-actions';\nimport {\n\tauthorField,\n\tdescriptionField,\n\tpreviewField,\n\tactiveField,\n\tslugField,\n\tuseThemeField,\n} from './fields';\nimport { defaultLayouts, getDefaultView } from './view-utils';\n\nconst { usePostActions, usePostFields, templateTitleField } =\n\tunlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'active', postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\tconst [ selectedRegisteredTemplate, setSelectedRegisteredTemplate ] =\n\t\tuseState( false );\n\tconst defaultView = useMemo( () => {\n\t\treturn getDefaultView( activeView );\n\t}, [ activeView ] );\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t\tslug: activeView,\n\t\tdefaultView,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( newQueryParams ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: newQueryParams.page,\n\t\t\t\t\tsearch: newQueryParams.search || undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\n\tconst { activeTemplatesOption, activeTheme, defaultTemplateTypes } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEntityRecord, getCurrentTheme } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tactiveTemplatesOption: getEntityRecord( 'root', 'site' )\n\t\t\t\t\t?.active_templates,\n\t\t\t\tactiveTheme: getCurrentTheme(),\n\t\t\t\tdefaultTemplateTypes:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t\t\t?.default_template_types,\n\t\t\t};\n\t\t} );\n\t// Todo: this will have to be better so that we're not fetching all the\n\t// records all the time. Active templates query will need to move server\n\t// side.\n\tconst { records: userRecords, isResolving: isLoadingUserRecords } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t\tcombinedTemplates: false,\n\t\t} );\n\tconst { records: staticRecords, isResolving: isLoadingStaticData } =\n\t\tuseEntityRecordsWithPermissions( 'root', 'registeredTemplate', {\n\t\t\t// This should not be needed, the endpoint returns all registered\n\t\t\t// templates, but it's not possible right now to turn off pagination\n\t\t\t// for entity configs.\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst activeTemplates = useMemo( () => {\n\t\tconst _active = [ ...staticRecords ];\n\t\tif ( activeTemplatesOption ) {\n\t\t\tfor ( const activeSlug in activeTemplatesOption ) {\n\t\t\t\tconst activeId = activeTemplatesOption[ activeSlug ];\n\t\t\t\t// Replace the template in the array.\n\t\t\t\tconst template = userRecords.find(\n\t\t\t\t\t( userRecord ) =>\n\t\t\t\t\t\tuserRecord.id === activeId &&\n\t\t\t\t\t\tuserRecord.theme === activeTheme.stylesheet\n\t\t\t\t);\n\t\t\t\tif ( template ) {\n\t\t\t\t\tconst index = _active.findIndex(\n\t\t\t\t\t\t( { slug } ) => slug === template.slug\n\t\t\t\t\t);\n\t\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\t\t_active[ index ] = template;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_active.push( template );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn _active;\n\t}, [ userRecords, staticRecords, activeTemplatesOption, activeTheme ] );\n\n\tlet isLoadingData;\n\tif ( activeView === 'active' ) {\n\t\tisLoadingData = isLoadingUserRecords || isLoadingStaticData;\n\t} else if ( activeView === 'user' ) {\n\t\tisLoadingData = isLoadingUserRecords;\n\t} else {\n\t\tisLoadingData = isLoadingStaticData;\n\t}\n\n\tconst records = useMemo( () => {\n\t\tfunction isCustom( record ) {\n\t\t\t// For registered templates, the is_custom field is defined.\n\t\t\treturn (\n\t\t\t\trecord.is_custom ??\n\t\t\t\t// For user templates it's custom if the is_wp_suggestion meta\n\t\t\t\t// field is not set and the slug is not found in the default\n\t\t\t\t// template types.\n\t\t\t\t( ! record.meta?.is_wp_suggestion &&\n\t\t\t\t\t! defaultTemplateTypes.some(\n\t\t\t\t\t\t( type ) => type.slug === record.slug\n\t\t\t\t\t) )\n\t\t\t);\n\t\t}\n\n\t\tlet _records;\n\t\tif ( activeView === 'active' ) {\n\t\t\t// Don't show active custom templates in the active view.\n\t\t\t_records = activeTemplates.filter(\n\t\t\t\t( record ) => ! isCustom( record )\n\t\t\t);\n\t\t} else if ( activeView === 'user' ) {\n\t\t\t_records = userRecords;\n\t\t} else {\n\t\t\t_records = staticRecords;\n\t\t}\n\t\treturn _records.map( ( record ) => ( {\n\t\t\t...record,\n\t\t\t_isActive: activeTemplates.some(\n\t\t\t\t( template ) => template.id === record.id\n\t\t\t),\n\t\t\t_isCustom: isCustom( record ),\n\t\t} ) );\n\t}, [\n\t\tactiveTemplates,\n\t\tdefaultTemplateTypes,\n\t\tuserRecords,\n\t\tstaticRecords,\n\t\tactiveView,\n\t] );\n\n\tconst users = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\treturn records.reduce( ( acc, record ) => {\n\t\t\t\tif ( record.author_text ) {\n\t\t\t\t\tif ( ! acc[ record.author_text ] ) {\n\t\t\t\t\t\tacc[ record.author_text ] = record.author_text;\n\t\t\t\t\t}\n\t\t\t\t} else if ( record.author ) {\n\t\t\t\t\tif ( ! acc[ record.author ] ) {\n\t\t\t\t\t\tacc[ record.author ] = getUser( record.author );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t}, {} );\n\t\t},\n\t\t[ records ]\n\t);\n\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === 'list' ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, path, view?.type ]\n\t);\n\n\tconst postTypeFields = usePostFields( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t} );\n\tconst dateField = postTypeFields.find( ( field ) => field.id === 'date' );\n\tconst themeField = useThemeField();\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [\n\t\t\tpreviewField,\n\t\t\ttemplateTitleField,\n\t\t\tdescriptionField,\n\t\t\tactiveField,\n\t\t\tslugField,\n\t\t];\n\t\tif ( activeView === 'user' ) {\n\t\t\t_fields.push( themeField );\n\t\t\tif ( dateField ) {\n\t\t\t\t_fields.push( dateField );\n\t\t\t}\n\t\t}\n\t\tconst elements = [];\n\t\tfor ( const author in users ) {\n\t\t\telements.push( {\n\t\t\t\tvalue: users[ author ]?.id ?? author,\n\t\t\t\tlabel: users[ author ]?.name ?? author,\n\t\t\t} );\n\t\t}\n\t\t_fields.push( {\n\t\t\t...authorField,\n\t\t\telements,\n\t\t} );\n\t\treturn _fields;\n\t}, [ users, activeView, themeField, dateField ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\thistory.navigate( `/template?activeView=user` );\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no title)' )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t\tonActionPerformed,\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst setActiveTemplateAction = useSetActiveTemplateAction();\n\tconst actions = useMemo(\n\t\t() =>\n\t\t\tactiveView === 'user'\n\t\t\t\t? [ setActiveTemplateAction, editAction, ...postTypeActions ]\n\t\t\t\t: [ setActiveTemplateAction, ...postTypeActions ],\n\t\t[ postTypeActions, setActiveTemplateAction, editAction, activeView ]\n\t);\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tif ( newView.type !== view.type ) {\n\t\t\t// Retrigger the routing areas resolution.\n\t\t\thistory.invalidate();\n\t\t}\n\t\tupdateView( newView );\n\t} );\n\n\tconst duplicateAction = actions.find(\n\t\t( action ) => action.id === 'duplicate-post'\n\t);\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t{ isModified && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tresetToDefault();\n\t\t\t\t\t\t\t\thistory.invalidate();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset view' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<AddNewTemplate />\n\t\t\t\t</>\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ () => true }\n\t\t\t\tonClickItem={ ( item ) => {\n\t\t\t\t\tif ( typeof item.id === 'string' ) {\n\t\t\t\t\t\tsetSelectedRegisteredTemplate( item );\n\t\t\t\t\t} else {\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t`/${ item.type }/${ item.id }?canvas=edit`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t\t{ selectedRegisteredTemplate && duplicateAction && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Duplicate' ) }\n\t\t\t\t\tonRequestClose={ () => setSelectedRegisteredTemplate() }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<duplicateAction.RenderModal\n\t\t\t\t\t\titems={ [ selectedRegisteredTemplate ] }\n\t\t\t\t\t\tcloseModal={ () => setSelectedRegisteredTemplate() }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEvent } from '@wordpress/compose';\nimport { useView } from '@wordpress/views';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { authorField, descriptionField, previewField } from './fields';\nimport { defaultLayouts, getDefaultView } from './view-utils';\n\nconst { usePostActions, templateTitleField } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'active', postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\n\tconst defaultView = useMemo( () => {\n\t\treturn getDefaultView( activeView );\n\t}, [ activeView ] );\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t\tslug: activeView,\n\t\tdefaultView,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( newQueryParams ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: newQueryParams.page,\n\t\t\t\t\tsearch: newQueryParams.search || undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\n\tconst { records, isResolving: isLoadingData } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === 'list' ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, path, view?.type ]\n\t);\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\tpreviewField,\n\t\t\ttemplateTitleField,\n\t\t\tdescriptionField,\n\t\t\t{\n\t\t\t\t...authorField,\n\t\t\t\telements: authors,\n\t\t\t},\n\t\t],\n\t\t[ authors ]\n\t);\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tif ( newView.type !== view.type ) {\n\t\t\t// Retrigger the routing areas resolution.\n\t\t\thistory.invalidate();\n\t\t}\n\t\tupdateView( newView );\n\t} );\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t{ isModified && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tresetToDefault();\n\t\t\t\t\t\t\t\thistory.invalidate();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset view' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<AddNewTemplate />\n\t\t\t\t</>\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ () => true }\n\t\t\t\tonClickItem={ ( { id } ) => {\n\t\t\t\t\thistory.navigate( `/wp_template/${ id }?canvas=edit` );\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAkII,mBAEE,KAFF;AA/HJ,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,UAAU,SAAS,mBAAmB;AAC/C,SAAS,eAAe,uBAAuB;AAC/C,SAAS,WAAW,6BAA6B;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,cAAc;AAKvB,OAAO,oBAAoB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAClC,SAAS,aAAa,kBAAkB,oBAAoB;AAC5D,SAAS,gBAAgB,sBAAsB;AAE/C,MAAM,EAAE,gBAAgB,mBAAmB,IAAI,OAAQ,iBAAkB;AACzE,MAAM,EAAE,YAAY,YAAY,IAAI,OAAQ,iBAAkB;AAC9D,MAAM,EAAE,gCAAgC,IAAI,OAAQ,eAAgB;AAErD,SAAR,gBAAiC;AACvC,QAAM,EAAE,MAAM,MAAM,IAAI,YAAY;AACpC,QAAM,EAAE,aAAa,UAAU,OAAO,IAAI;AAC1C,QAAM,CAAE,WAAW,YAAa,IAAI,SAAU,CAAE,MAAO,CAAE;AAEzD,QAAM,cAAc,QAAS,MAAM;AAClC,WAAO,eAAgB,UAAW;AAAA,EACnC,GAAG,CAAE,UAAW,CAAE;AAClB,QAAM,EAAE,MAAM,YAAY,YAAY,eAAe,IAAI,QAAS;AAAA,IACjE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA,aAAa;AAAA,MACZ,MAAM,MAAM;AAAA,MACZ,QAAQ,MAAM;AAAA,IACf;AAAA,IACA,qBAAqB,CAAE,mBAAoB;AAC1C,cAAQ;AAAA,QACP,aAAc,MAAM;AAAA,UACnB,GAAG;AAAA,UACH,YAAY,eAAe;AAAA,UAC3B,QAAQ,eAAe,UAAU;AAAA,QAClC,CAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD,CAAE;AAEF,QAAM,EAAE,SAAS,aAAa,cAAc,IAC3C,gCAAiC,YAAY,oBAAoB;AAAA,IAChE,UAAU;AAAA,EACX,CAAE;AACH,QAAM,UAAU,WAAW;AAC3B,QAAM,oBAAoB;AAAA,IACzB,CAAE,UAAW;AACZ,mBAAc,KAAM;AACpB,UAAK,MAAM,SAAS,QAAS;AAC5B,gBAAQ;AAAA,UACP,aAAc,MAAM;AAAA,YACnB,QAAQ,MAAM,WAAW,IAAI,MAAO,CAAE,IAAI;AAAA,UAC3C,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,SAAS,MAAM,MAAM,IAAK;AAAA,EAC7B;AAEA,QAAM,UAAU,QAAS,MAAM;AAC9B,QAAK,CAAE,SAAU;AAChB,aAAO,CAAC;AAAA,IACT;AACA,UAAM,aAAa,oBAAI,IAAI;AAC3B,YAAQ,QAAS,CAAE,aAAc;AAChC,iBAAW,IAAK,SAAS,WAAY;AAAA,IACtC,CAAE;AACF,WAAO,MAAM,KAAM,UAAW,EAAE,IAAK,CAAE,YAAc;AAAA,MACpD,OAAO;AAAA,MACP,OAAO;AAAA,IACR,EAAI;AAAA,EACL,GAAG,CAAE,OAAQ,CAAE;AAEf,QAAM,SAAS;AAAA,IACd,MAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,GAAG;AAAA,QACH,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAE,OAAQ;AAAA,EACX;AAEA,QAAM,EAAE,MAAM,eAAe,IAAI,QAAS,MAAM;AAC/C,WAAO,sBAAuB,SAAS,MAAM,MAAO;AAAA,EACrD,GAAG,CAAE,SAAS,MAAM,MAAO,CAAE;AAE7B,QAAM,kBAAkB,eAAgB;AAAA,IACvC,UAAU;AAAA,IACV,SAAS;AAAA,EACV,CAAE;AACF,QAAM,aAAa,kBAAkB;AACrC,QAAM,UAAU;AAAA,IACf,MAAM,CAAE,YAAY,GAAG,eAAgB;AAAA,IACvC,CAAE,iBAAiB,UAAW;AAAA,EAC/B;AAEA,QAAM,eAAe,SAAU,CAAE,YAAa;AAC7C,QAAK,QAAQ,SAAS,KAAK,MAAO;AAEjC,cAAQ,WAAW;AAAA,IACpB;AACA,eAAY,OAAQ;AAAA,EACrB,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,OAAQ,GAAI,WAAY;AAAA,MACxB,SACC,iCACG;AAAA,sBACD;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,SAAU,MAAM;AACf,6BAAe;AACf,sBAAQ,WAAW;AAAA,YACpB;AAAA,YAEE,aAAI,YAAa;AAAA;AAAA,QACpB;AAAA,QAED,oBAAC,kBAAe;AAAA,SACjB;AAAA,MAGD;AAAA,QAAC;AAAA;AAAA,UAEA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAY;AAAA,UACZ;AAAA,UACA;AAAA,UACA;AAAA,UACA,iBAAkB,MAAM;AAAA,UACxB,aAAc,CAAE,EAAE,GAAG,MAAO;AAC3B,oBAAQ,SAAU,gBAAiB,EAAG,cAAe;AAAA,UACtD;AAAA,UACA;AAAA,UACA;AAAA;AAAA,QAdM;AAAA,MAeP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -19,17 +19,13 @@ const DEFAULT_VIEW = {
|
|
|
19
19
|
titleField: "title",
|
|
20
20
|
descriptionField: "description",
|
|
21
21
|
mediaField: "preview",
|
|
22
|
-
fields: ["author", "active", "slug"
|
|
22
|
+
fields: ["author", "active", "slug"],
|
|
23
23
|
filters: [],
|
|
24
24
|
...defaultLayouts.grid
|
|
25
25
|
};
|
|
26
26
|
function getDefaultView(activeView) {
|
|
27
27
|
return {
|
|
28
28
|
...DEFAULT_VIEW,
|
|
29
|
-
sort: activeView === "user" ? {
|
|
30
|
-
field: "date",
|
|
31
|
-
direction: "desc"
|
|
32
|
-
} : DEFAULT_VIEW.sort,
|
|
33
29
|
filters: !["active", "user"].includes(activeView) ? [
|
|
34
30
|
{
|
|
35
31
|
field: "author",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-templates/view-utils.js"],
|
|
4
|
-
"sourcesContent": ["export const defaultLayouts = {\n\ttable: {\n\t\tshowMedia: false,\n\t},\n\tgrid: {\n\t\tshowMedia: true,\n\t},\n\tlist: {\n\t\tshowMedia: false,\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: 'grid',\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\ttitleField: 'title',\n\tdescriptionField: 'description',\n\tmediaField: 'preview',\n\tfields: [ 'author', 'active', 'slug'
|
|
5
|
-
"mappings": "AAAO,MAAM,iBAAiB;AAAA,EAC7B,OAAO;AAAA,IACN,WAAW;AAAA,EACZ;AAAA,EACA,MAAM;AAAA,IACL,WAAW;AAAA,EACZ;AAAA,EACA,MAAM;AAAA,IACL,WAAW;AAAA,EACZ;AACD;AAEA,MAAM,eAAe;AAAA,EACpB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,QAAQ,CAAE,UAAU,UAAU,
|
|
4
|
+
"sourcesContent": ["export const defaultLayouts = {\n\ttable: {\n\t\tshowMedia: false,\n\t},\n\tgrid: {\n\t\tshowMedia: true,\n\t},\n\tlist: {\n\t\tshowMedia: false,\n\t},\n};\n\nconst DEFAULT_VIEW = {\n\ttype: 'grid',\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\ttitleField: 'title',\n\tdescriptionField: 'description',\n\tmediaField: 'preview',\n\tfields: [ 'author', 'active', 'slug' ],\n\tfilters: [],\n\t...defaultLayouts.grid,\n};\n\nexport function getDefaultView( activeView ) {\n\treturn {\n\t\t...DEFAULT_VIEW,\n\t\tfilters: ! [ 'active', 'user' ].includes( activeView )\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'author',\n\t\t\t\t\t\toperator: 'isAny',\n\t\t\t\t\t\tvalue: [ activeView ],\n\t\t\t\t\t},\n\t\t\t ]\n\t\t\t: [],\n\t};\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,iBAAiB;AAAA,EAC7B,OAAO;AAAA,IACN,WAAW;AAAA,EACZ;AAAA,EACA,MAAM;AAAA,IACL,WAAW;AAAA,EACZ;AAAA,EACA,MAAM;AAAA,IACL,WAAW;AAAA,EACZ;AACD;AAEA,MAAM,eAAe;AAAA,EACpB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,QAAQ,CAAE,UAAU,UAAU,MAAO;AAAA,EACrC,SAAS,CAAC;AAAA,EACV,GAAG,eAAe;AACnB;AAEO,SAAS,eAAgB,YAAa;AAC5C,SAAO;AAAA,IACN,GAAG;AAAA,IACH,SAAS,CAAE,CAAE,UAAU,MAAO,EAAE,SAAU,UAAW,IAClD;AAAA,MACA;AAAA,QACC,OAAO;AAAA,QACP,UAAU;AAAA,QACV,OAAO,CAAE,UAAW;AAAA,MACrB;AAAA,IACA,IACA,CAAC;AAAA,EACL;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,7 +7,8 @@ import { privateApis as routerPrivateApis } from "@wordpress/router";
|
|
|
7
7
|
import { addQueryArgs } from "@wordpress/url";
|
|
8
8
|
import SidebarNavigationItem from "../sidebar-navigation-item";
|
|
9
9
|
import { useAddedBy } from "../page-templates/hooks";
|
|
10
|
-
import {
|
|
10
|
+
import { layout } from "@wordpress/icons";
|
|
11
|
+
import { TEMPLATE_POST_TYPE } from "../../utils/constants";
|
|
11
12
|
import { unlock } from "../../lock-unlock";
|
|
12
13
|
const { useLocation } = unlock(routerPrivateApis);
|
|
13
14
|
const EMPTY_ARRAY = [];
|
|
@@ -25,12 +26,9 @@ function TemplateDataviewItem({ template, isActive }) {
|
|
|
25
26
|
}
|
|
26
27
|
function DataviewsTemplatesSidebarContent() {
|
|
27
28
|
const {
|
|
28
|
-
query: { activeView = "
|
|
29
|
+
query: { activeView = "all" }
|
|
29
30
|
} = useLocation();
|
|
30
|
-
const { records } = useEntityRecords("
|
|
31
|
-
// This should not be needed, the endpoint returns all registered
|
|
32
|
-
// templates, but it's not possible right now to turn off pagination for
|
|
33
|
-
// entity configs.
|
|
31
|
+
const { records } = useEntityRecords("postType", TEMPLATE_POST_TYPE, {
|
|
34
32
|
per_page: -1
|
|
35
33
|
});
|
|
36
34
|
const firstItemPerAuthorText = useMemo(() => {
|
|
@@ -48,22 +46,9 @@ function DataviewsTemplatesSidebarContent() {
|
|
|
48
46
|
SidebarNavigationItem,
|
|
49
47
|
{
|
|
50
48
|
to: "/template",
|
|
51
|
-
icon:
|
|
52
|
-
"aria-current": activeView === "
|
|
53
|
-
children: __("
|
|
54
|
-
}
|
|
55
|
-
),
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
SidebarNavigationItem,
|
|
58
|
-
{
|
|
59
|
-
to: addQueryArgs("/template", { activeView: "user" }),
|
|
60
|
-
icon: commentAuthorAvatar,
|
|
61
|
-
"aria-current": activeView === "user",
|
|
62
|
-
// Let's avoid calling them "custom templates" to avoid
|
|
63
|
-
// confusion. "Created" is closest to meaning database
|
|
64
|
-
// templates, created by users.
|
|
65
|
-
// https://developer.wordpress.org/themes/classic-themes/templates/page-template-files/#creating-custom-page-templates-for-global-use
|
|
66
|
-
children: __("Created templates")
|
|
49
|
+
icon: layout,
|
|
50
|
+
"aria-current": activeView === "all",
|
|
51
|
+
children: __("All templates")
|
|
67
52
|
}
|
|
68
53
|
),
|
|
69
54
|
firstItemPerAuthorText.map((template) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-navigation-screen-templates-browse/content.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useAddedBy } from '../page-templates/hooks';\nimport {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useAddedBy } from '../page-templates/hooks';\nimport { layout } from '@wordpress/icons';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\tto={ addQueryArgs( '/template', { activeView: text } ) }\n\t\t\ticon={ icon }\n\t\t\taria-current={ isActive }\n\t\t>\n\t\t\t{ text }\n\t\t</SidebarNavigationItem>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent() {\n\tconst {\n\t\tquery: { activeView = 'all' },\n\t} = useLocation();\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-templates-browse\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tto=\"/template\"\n\t\t\t\ticon={ layout }\n\t\t\t\taria-current={ activeView === 'all' }\n\t\t\t>\n\t\t\t\t{ __( 'All templates' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AA2BE,cAgCA,YAhCA;AAxBF,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,2BAA2B,iBAAiB;AACrD,SAAS,UAAU;AACnB,SAAS,eAAe,yBAAyB;AACjD,SAAS,oBAAoB;AAK7B,OAAO,2BAA2B;AAClC,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,0BAA0B;AACnC,SAAS,cAAc;AAEvB,MAAM,EAAE,YAAY,IAAI,OAAQ,iBAAkB;AAElD,MAAM,cAAc,CAAC;AAErB,SAAS,qBAAsB,EAAE,UAAU,SAAS,GAAI;AACvD,QAAM,EAAE,MAAM,KAAK,IAAI,WAAY,SAAS,MAAM,SAAS,EAAG;AAE9D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,IAAK,aAAc,aAAa,EAAE,YAAY,KAAK,CAAE;AAAA,MACrD;AAAA,MACA,gBAAe;AAAA,MAEb;AAAA;AAAA,EACH;AAEF;AAEe,SAAR,mCAAoD;AAC1D,QAAM;AAAA,IACL,OAAO,EAAE,aAAa,MAAM;AAAA,EAC7B,IAAI,YAAY;AAChB,QAAM,EAAE,QAAQ,IAAI,iBAAkB,YAAY,oBAAoB;AAAA,IACrE,UAAU;AAAA,EACX,CAAE;AACF,QAAM,yBAAyB,QAAS,MAAM;AAC7C,UAAM,qBAAqB,SAAS,OAAQ,CAAE,KAAK,aAAc;AAChE,YAAM,SAAS,SAAS;AACxB,UAAK,UAAU,CAAE,IAAK,MAAO,GAAI;AAChC,YAAK,MAAO,IAAI;AAAA,MACjB;AACA,aAAO;AAAA,IACR,GAAG,CAAC,CAAE;AACN,YACG,sBAAsB,OAAO,OAAQ,kBAAmB,MAC1D;AAAA,EAEF,GAAG,CAAE,OAAQ,CAAE;AAEf,SACC,qBAAC,aAAU,WAAU,wDACpB;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,IAAG;AAAA,QACH,MAAO;AAAA,QACP,gBAAe,eAAe;AAAA,QAE5B,aAAI,eAAgB;AAAA;AAAA,IACvB;AAAA,IACE,uBAAuB,IAAK,CAAE,aAAc;AAC7C,aACC;AAAA,QAAC;AAAA;AAAA,UAEA;AAAA,UACA,UAAW,eAAe,SAAS;AAAA;AAAA,QAF7B,SAAS;AAAA,MAGhB;AAAA,IAEF,CAAE;AAAA,KACH;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,24 +2,23 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import Editor from "../editor";
|
|
3
3
|
import SidebarNavigationScreenTemplatesBrowse from "../sidebar-navigation-screen-templates-browse";
|
|
4
4
|
import SidebarNavigationScreenUnsupported from "../sidebar-navigation-screen-unsupported";
|
|
5
|
-
const areas = {
|
|
6
|
-
sidebar({ siteData }) {
|
|
7
|
-
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
8
|
-
return isBlockTheme ? /* @__PURE__ */ jsx(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ jsx(SidebarNavigationScreenUnsupported, {});
|
|
9
|
-
},
|
|
10
|
-
mobile({ siteData }) {
|
|
11
|
-
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
12
|
-
return isBlockTheme ? /* @__PURE__ */ jsx(Editor, {}) : /* @__PURE__ */ jsx(SidebarNavigationScreenUnsupported, {});
|
|
13
|
-
},
|
|
14
|
-
preview({ siteData }) {
|
|
15
|
-
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
16
|
-
return isBlockTheme ? /* @__PURE__ */ jsx(Editor, {}) : /* @__PURE__ */ jsx(SidebarNavigationScreenUnsupported, {});
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
5
|
const templateItemRoute = {
|
|
20
6
|
name: "template-item",
|
|
21
7
|
path: "/wp_template/*postId",
|
|
22
|
-
areas
|
|
8
|
+
areas: {
|
|
9
|
+
sidebar({ siteData }) {
|
|
10
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
11
|
+
return isBlockTheme ? /* @__PURE__ */ jsx(SidebarNavigationScreenTemplatesBrowse, { backPath: "/" }) : /* @__PURE__ */ jsx(SidebarNavigationScreenUnsupported, {});
|
|
12
|
+
},
|
|
13
|
+
mobile({ siteData }) {
|
|
14
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
15
|
+
return isBlockTheme ? /* @__PURE__ */ jsx(Editor, {}) : /* @__PURE__ */ jsx(SidebarNavigationScreenUnsupported, {});
|
|
16
|
+
},
|
|
17
|
+
preview({ siteData }) {
|
|
18
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
19
|
+
return isBlockTheme ? /* @__PURE__ */ jsx(Editor, {}) : /* @__PURE__ */ jsx(SidebarNavigationScreenUnsupported, {});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
23
22
|
};
|
|
24
23
|
export {
|
|
25
24
|
templateItemRoute
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/site-editor-routes/template-item.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';\n\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';\n\nexport const templateItemRoute = {\n\tname: 'template-item',\n\tpath: '/wp_template/*postId',\n\tareas: {\n\t\tsidebar( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\treturn isBlockTheme ? (\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse backPath=\"/\" />\n\t\t\t) : (\n\t\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t\t);\n\t\t},\n\t\tmobile( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\treturn isBlockTheme ? (\n\t\t\t\t<Editor />\n\t\t\t) : (\n\t\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t\t);\n\t\t},\n\t\tpreview( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\treturn isBlockTheme ? (\n\t\t\t\t<Editor />\n\t\t\t) : (\n\t\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t\t);\n\t\t},\n\t},\n};\n"],
|
|
5
|
+
"mappings": "AAcI;AAXJ,OAAO,YAAY;AACnB,OAAO,4CAA4C;AACnD,OAAO,wCAAwC;AAExC,MAAM,oBAAoB;AAAA,EAChC,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,IACN,QAAS,EAAE,SAAS,GAAI;AACvB,YAAM,eAAe,SAAS,cAAc;AAC5C,aAAO,eACN,oBAAC,0CAAuC,UAAS,KAAI,IAErD,oBAAC,sCAAmC;AAAA,IAEtC;AAAA,IACA,OAAQ,EAAE,SAAS,GAAI;AACtB,YAAM,eAAe,SAAS,cAAc;AAC5C,aAAO,eACN,oBAAC,UAAO,IAER,oBAAC,sCAAmC;AAAA,IAEtC;AAAA,IACA,QAAS,EAAE,SAAS,GAAI;AACvB,YAAM,eAAe,SAAS,cAAc;AAC5C,aAAO,eACN,oBAAC,UAAO,IAER,oBAAC,sCAAmC;AAAA,IAEtC;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1758,7 +1758,6 @@ div.dataviews-view-list {
|
|
|
1758
1758
|
.dataviews-view-table td.dataviews-view-table__checkbox-column,
|
|
1759
1759
|
.dataviews-view-table th.dataviews-view-table__checkbox-column {
|
|
1760
1760
|
padding-left: 0;
|
|
1761
|
-
width: 1%;
|
|
1762
1761
|
}
|
|
1763
1762
|
|
|
1764
1763
|
.dataviews-view-table td.dataviews-view-table__checkbox-column .dataviews-view-table__cell-content-wrapper,
|
|
@@ -1880,6 +1879,7 @@ div.dataviews-view-list {
|
|
|
1880
1879
|
min-height: 32px;
|
|
1881
1880
|
display: flex;
|
|
1882
1881
|
align-items: center;
|
|
1882
|
+
white-space: nowrap;
|
|
1883
1883
|
}
|
|
1884
1884
|
|
|
1885
1885
|
.dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper.dataviews-view-table__cell-align-end {
|
|
@@ -2003,6 +2003,11 @@ div.dataviews-view-list {
|
|
|
2003
2003
|
color: #1e1e1e;
|
|
2004
2004
|
}
|
|
2005
2005
|
|
|
2006
|
+
/* Column width intents via colgroup: make non-primary columns shrink-to-fit */
|
|
2007
|
+
.dataviews-view-table col[class^=dataviews-view-table__col-]:not(.dataviews-view-table__col-primary) {
|
|
2008
|
+
width: 1%;
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2006
2011
|
.dataviews-view-picker-grid .dataviews-view-picker-grid__card {
|
|
2007
2012
|
height: 100%;
|
|
2008
2013
|
justify-content: flex-start;
|