feat(editor): Schema preview UI updates (#13578)

This commit is contained in:
Elias Meire
2025-03-05 10:29:13 +01:00
committed by GitHub
parent c821f1c532
commit 8790a0df3d
7 changed files with 148 additions and 163 deletions

View File

@@ -261,7 +261,14 @@ export type RenderHeader = {
preview?: boolean;
};
type Renders = RenderHeader | RenderItem;
export type RenderIcon = {
id: string;
type: 'icon';
icon: string;
tooltip: string;
};
type Renders = RenderHeader | RenderItem | RenderIcon;
const icons = {
object: 'cube',
@@ -285,13 +292,11 @@ const emptyItem = (): RenderItem => ({
type: 'item',
});
const dummyItem = (): RenderItem => ({
id: `dummy-${window.crypto.randomUUID()}`,
icon: '',
level: 1,
title: '...',
type: 'item',
preview: true,
const moreFieldsItem = (): RenderIcon => ({
id: `moreFields-${window.crypto.randomUUID()}`,
type: 'icon',
icon: 'ellipsis-h',
tooltip: useI18n().baseText('dataMapping.schemaView.previewExtraFields'),
});
const isDataEmpty = (schema: Schema) => {
@@ -445,7 +450,7 @@ export const useFlattenSchema = () => {
acc.push(...flattenSchema(item));
if (item.preview) {
acc.push(dummyItem());
acc.push(moreFieldsItem());
}
return acc;