@byline/host-tanstack-start 6.1.0 → 6.2.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useParams, useRouter, useRouterState } from "@tanstack/react-router";
|
|
3
|
-
import { AdminTabs, StatusBadge, renderFormatted } from "@byline/admin/react";
|
|
3
|
+
import { AdminTabs, StatusBadge, renderFormatted, tabPanelId, tabTriggerId } from "@byline/admin/react";
|
|
4
4
|
import { useBylineAdminServices } from "@byline/admin/services";
|
|
5
5
|
import { useTranslation } from "@byline/i18n/react";
|
|
6
6
|
import { Button, Container, Section, Table } from "@byline/ui/react";
|
|
@@ -13,6 +13,7 @@ import { DocumentHistoryView } from "./document-history.js";
|
|
|
13
13
|
import history_module from "./history.module.js";
|
|
14
14
|
import { HistoryStats, VersionHistoryCore } from "./version-history.js";
|
|
15
15
|
import { ViewMenu } from "./view-menu.js";
|
|
16
|
+
const HISTORY_TABS_ID = 'collection-history';
|
|
16
17
|
function getColumnValue(document, fieldName) {
|
|
17
18
|
if (document.fields && 'object' == typeof document.fields && fieldName in document.fields) return document.fields[fieldName];
|
|
18
19
|
return document[fieldName];
|
|
@@ -171,6 +172,7 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, auditLog, workfl
|
|
|
171
172
|
]
|
|
172
173
|
}),
|
|
173
174
|
/*#__PURE__*/ jsx(AdminTabs, {
|
|
175
|
+
idBase: HISTORY_TABS_ID,
|
|
174
176
|
tabs: [
|
|
175
177
|
{
|
|
176
178
|
name: 'versions',
|
|
@@ -188,17 +190,26 @@ const HistoryView = ({ collectionDefinition, adminConfig, data, auditLog, workfl
|
|
|
188
190
|
]
|
|
189
191
|
})
|
|
190
192
|
}),
|
|
191
|
-
'document' === activeTab ? /*#__PURE__*/ jsx(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
'document' === activeTab ? /*#__PURE__*/ jsx("div", {
|
|
194
|
+
role: "tabpanel",
|
|
195
|
+
id: tabPanelId(HISTORY_TABS_ID, 'document'),
|
|
196
|
+
"aria-labelledby": tabTriggerId(HISTORY_TABS_ID, 'document'),
|
|
197
|
+
children: /*#__PURE__*/ jsx(DocumentHistoryView, {
|
|
198
|
+
data: auditLog ?? {
|
|
199
|
+
entries: [],
|
|
200
|
+
meta: {
|
|
201
|
+
total: 0,
|
|
202
|
+
page: 1,
|
|
203
|
+
pageSize: 0,
|
|
204
|
+
totalPages: 0
|
|
205
|
+
}
|
|
199
206
|
}
|
|
200
|
-
}
|
|
207
|
+
})
|
|
201
208
|
}) : /*#__PURE__*/ jsx(Section, {
|
|
209
|
+
role: "tabpanel",
|
|
210
|
+
id: tabPanelId(HISTORY_TABS_ID, 'versions'),
|
|
211
|
+
"aria-labelledby": tabTriggerId(HISTORY_TABS_ID, 'versions'),
|
|
212
|
+
tabIndex: 0,
|
|
202
213
|
children: /*#__PURE__*/ jsx(Container, {
|
|
203
214
|
children: /*#__PURE__*/ jsx(VersionHistoryCore, {
|
|
204
215
|
data: data,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "6.1
|
|
6
|
+
"version": "6.2.1",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -125,15 +125,15 @@
|
|
|
125
125
|
"react-json-view-lite": "^2.5.0",
|
|
126
126
|
"react-swipeable": "^7.0.2",
|
|
127
127
|
"zod": "^4.6.2",
|
|
128
|
-
"@byline/admin": "6.1
|
|
129
|
-
"@byline/
|
|
130
|
-
"@byline/
|
|
131
|
-
"@byline/
|
|
132
|
-
"@byline/client": "6.1
|
|
133
|
-
"@byline/
|
|
134
|
-
"@byline/
|
|
135
|
-
"@byline/
|
|
136
|
-
"@byline/
|
|
128
|
+
"@byline/admin": "6.2.1",
|
|
129
|
+
"@byline/analytics-agent": "6.2.1",
|
|
130
|
+
"@byline/analytics": "6.2.1",
|
|
131
|
+
"@byline/ai": "6.2.1",
|
|
132
|
+
"@byline/client": "6.2.1",
|
|
133
|
+
"@byline/core": "6.2.1",
|
|
134
|
+
"@byline/i18n": "6.2.1",
|
|
135
|
+
"@byline/ui": "6.2.1",
|
|
136
|
+
"@byline/auth": "6.2.1"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
139
|
"@tanstack/react-router": "^1.167.0",
|
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
import { useParams, useRouter, useRouterState } from '@tanstack/react-router'
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
AdminTabs,
|
|
13
|
+
renderFormatted,
|
|
14
|
+
StatusBadge,
|
|
15
|
+
tabPanelId,
|
|
16
|
+
tabTriggerId,
|
|
17
|
+
} from '@byline/admin/react'
|
|
12
18
|
import { useBylineAdminServices } from '@byline/admin/services'
|
|
13
19
|
import type { CollectionAdminConfig, MultiCollectionDefinition, WorkflowStatus } from '@byline/core'
|
|
14
20
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas'
|
|
@@ -31,6 +37,9 @@ import {
|
|
|
31
37
|
import { ViewMenu } from './view-menu.js'
|
|
32
38
|
import type { ContentLocaleOption } from './view-menu.js'
|
|
33
39
|
|
|
40
|
+
/** Id prefix shared by the history tablist and the panels it controls. */
|
|
41
|
+
const HISTORY_TABS_ID = 'collection-history'
|
|
42
|
+
|
|
34
43
|
/** Resolve user fields before root document metadata such as status. */
|
|
35
44
|
function getColumnValue(document: Record<string, unknown>, fieldName: string): unknown {
|
|
36
45
|
if (document.fields && typeof document.fields === 'object' && fieldName in document.fields) {
|
|
@@ -251,6 +260,7 @@ export const HistoryView = ({
|
|
|
251
260
|
/>
|
|
252
261
|
</div>
|
|
253
262
|
<AdminTabs
|
|
263
|
+
idBase={HISTORY_TABS_ID}
|
|
254
264
|
tabs={[
|
|
255
265
|
{ name: 'versions', label: t('collections.history.tabs.versions') },
|
|
256
266
|
{ name: 'document', label: t('collections.history.tabs.document') },
|
|
@@ -263,13 +273,24 @@ export const HistoryView = ({
|
|
|
263
273
|
</Section>
|
|
264
274
|
|
|
265
275
|
{activeTab === 'document' ? (
|
|
266
|
-
<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
276
|
+
<div
|
|
277
|
+
role="tabpanel"
|
|
278
|
+
id={tabPanelId(HISTORY_TABS_ID, 'document')}
|
|
279
|
+
aria-labelledby={tabTriggerId(HISTORY_TABS_ID, 'document')}
|
|
280
|
+
>
|
|
281
|
+
<DocumentHistoryView
|
|
282
|
+
data={
|
|
283
|
+
auditLog ?? { entries: [], meta: { total: 0, page: 1, pageSize: 0, totalPages: 0 } }
|
|
284
|
+
}
|
|
285
|
+
/>
|
|
286
|
+
</div>
|
|
271
287
|
) : (
|
|
272
|
-
<Section
|
|
288
|
+
<Section
|
|
289
|
+
role="tabpanel"
|
|
290
|
+
id={tabPanelId(HISTORY_TABS_ID, 'versions')}
|
|
291
|
+
aria-labelledby={tabTriggerId(HISTORY_TABS_ID, 'versions')}
|
|
292
|
+
tabIndex={0}
|
|
293
|
+
>
|
|
273
294
|
<Container>
|
|
274
295
|
<VersionHistoryCore
|
|
275
296
|
data={data as unknown as VersionHistoryData}
|
|
@@ -43,6 +43,8 @@ vi.mock('@byline/admin/react', () => ({
|
|
|
43
43
|
))}
|
|
44
44
|
</div>
|
|
45
45
|
),
|
|
46
|
+
tabPanelId: (idBase: string, name: string) => `${idBase}-panel-${name}`,
|
|
47
|
+
tabTriggerId: (idBase: string, name: string) => `${idBase}-tab-${name}`,
|
|
46
48
|
renderFormatted: (value: unknown) => String(value ?? ''),
|
|
47
49
|
StatusBadge: ({ status }: { status: string }) => <span>{status}</span>,
|
|
48
50
|
DiffModal: (props: Record<string, unknown>) => {
|