inicontent 1.0.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/.github/pull_request.yml +18 -0
- package/CONTRIBUTING.md +67 -0
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/app/app.vue +106 -0
- package/app/assets/main.css +974 -0
- package/app/components/Api/EndpointCard.vue +169 -0
- package/app/components/Api/SchemaDocsTable.vue +208 -0
- package/app/components/Asset/Card.vue +1363 -0
- package/app/components/Asset/Grid.vue +295 -0
- package/app/components/Asset/Icon.vue +38 -0
- package/app/components/Asset/Preview.vue +486 -0
- package/app/components/Asset/Scanner.vue +700 -0
- package/app/components/Asset/Thumb.vue +708 -0
- package/app/components/Auth/Reset.vue +99 -0
- package/app/components/Auth/index.vue +346 -0
- package/app/components/ChatInterface.vue +2326 -0
- package/app/components/ChatPagePreview.vue +34 -0
- package/app/components/Column/Array.vue +29 -0
- package/app/components/Column/Asset.vue +21 -0
- package/app/components/Column/Boolean.vue +12 -0
- package/app/components/Column/Color.vue +9 -0
- package/app/components/Column/Date.vue +57 -0
- package/app/components/Column/Edit.vue +215 -0
- package/app/components/Column/Email.vue +9 -0
- package/app/components/Column/Html.vue +27 -0
- package/app/components/Column/Id.vue +20 -0
- package/app/components/Column/Locale.vue +32 -0
- package/app/components/Column/Object.vue +18 -0
- package/app/components/Column/Password.vue +7 -0
- package/app/components/Column/Role.vue +15 -0
- package/app/components/Column/S.vue +14 -0
- package/app/components/Column/Table/Single.vue +49 -0
- package/app/components/Column/Table/index.vue +42 -0
- package/app/components/Column/Tags.vue +31 -0
- package/app/components/Column/Text.vue +9 -0
- package/app/components/Column/Url.vue +9 -0
- package/app/components/Column/index.vue +41 -0
- package/app/components/Dashboard/Editor.vue +221 -0
- package/app/components/Dashboard/Grid.vue +270 -0
- package/app/components/Dashboard/View.vue +131 -0
- package/app/components/Dashboard/Widget/BarChart.vue +73 -0
- package/app/components/Dashboard/Widget/Counter.vue +51 -0
- package/app/components/Dashboard/Widget/LineChart.vue +76 -0
- package/app/components/Dashboard/Widget/PieChart.vue +75 -0
- package/app/components/Dashboard/Widget/Table.vue +94 -0
- package/app/components/Dashboard/WidgetEditor.vue +274 -0
- package/app/components/Data/Array.vue +102 -0
- package/app/components/Data/Html.vue +9 -0
- package/app/components/Data/Icon.vue +9 -0
- package/app/components/Data/Object.vue +10 -0
- package/app/components/Data/S.vue +16 -0
- package/app/components/Data/Table.vue +53 -0
- package/app/components/Data/Value.vue +34 -0
- package/app/components/Data/index.vue +14 -0
- package/app/components/Field/Array.vue +324 -0
- package/app/components/Field/Asset/Actions.vue +97 -0
- package/app/components/Field/Asset/index.vue +639 -0
- package/app/components/Field/Boolean.vue +26 -0
- package/app/components/Field/Checkbox.vue +48 -0
- package/app/components/Field/Color.vue +27 -0
- package/app/components/Field/Date.vue +30 -0
- package/app/components/Field/Email.vue +51 -0
- package/app/components/Field/EmailTemplate.vue +420 -0
- package/app/components/Field/Html/ColorPicker.vue +127 -0
- package/app/components/Field/Html/Editor.vue +544 -0
- package/app/components/Field/Html/index.vue +25 -0
- package/app/components/Field/Icon.vue +114 -0
- package/app/components/Field/JSON.vue +113 -0
- package/app/components/Field/Mention.vue +36 -0
- package/app/components/Field/Number.vue +27 -0
- package/app/components/Field/Object.vue +92 -0
- package/app/components/Field/Password.vue +55 -0
- package/app/components/Field/Radio.vue +47 -0
- package/app/components/Field/S.vue +44 -0
- package/app/components/Field/Select.vue +49 -0
- package/app/components/Field/Table.vue +348 -0
- package/app/components/Field/Tags.vue +113 -0
- package/app/components/Field/Text.vue +31 -0
- package/app/components/Field/Textarea.vue +33 -0
- package/app/components/Field/Url.vue +40 -0
- package/app/components/Field/Wrapper.vue +128 -0
- package/app/components/Field/index.vue +68 -0
- package/app/components/FloatingChatbot.vue +73 -0
- package/app/components/Form/Card.vue +151 -0
- package/app/components/Form/Drawer.vue +195 -0
- package/app/components/Form/index.vue +621 -0
- package/app/components/Header.vue +328 -0
- package/app/components/Offline/ConflictModal.vue +200 -0
- package/app/components/Offline/SyncStatus.vue +249 -0
- package/app/components/PlatformFeatureLanding.vue +65 -0
- package/app/components/Table/Backups.vue +638 -0
- package/app/components/Table/Flows.vue +814 -0
- package/app/components/Table/Grid.vue +296 -0
- package/app/components/Table/Icon.vue +36 -0
- package/app/components/Table/Logs.vue +181 -0
- package/app/components/Table/Schedules.vue +722 -0
- package/app/components/Table/Search/Button.vue +256 -0
- package/app/components/Table/Search/Items.vue +286 -0
- package/app/components/Table/Search/index.vue +87 -0
- package/app/components/Table/Settings/Schema.vue +801 -0
- package/app/components/Table/Settings/index.vue +631 -0
- package/app/components/Table/TranslateDrawer.vue +526 -0
- package/app/components/Table/Views/Kanban.vue +289 -0
- package/app/components/Table/Views/Table.vue +1273 -0
- package/app/components/Table/index.vue +890 -0
- package/app/composables/Translation/define.ts +41 -0
- package/app/composables/Translation/fetch.ts +107 -0
- package/app/composables/Translation/languages.ts +1 -0
- package/app/composables/Translation/loadCoreTranslations.ts +38 -0
- package/app/composables/Translation/translate.ts +250 -0
- package/app/composables/databaseCookies.ts +79 -0
- package/app/composables/fieldValidator.ts +72 -0
- package/app/composables/fieldsList.ts +301 -0
- package/app/composables/formatDatabase.ts +101 -0
- package/app/composables/index.ts +444 -0
- package/app/composables/openDrawer.ts +118 -0
- package/app/composables/optimizeFile.ts +287 -0
- package/app/composables/renderLabel.ts +88 -0
- package/app/composables/schemaClipboard.ts +95 -0
- package/app/composables/search.ts +353 -0
- package/app/composables/setThemeConfig.ts +48 -0
- package/app/composables/translationValue.ts +169 -0
- package/app/composables/useAssetPreview.ts +84 -0
- package/app/composables/useAssetUploader.ts +56 -0
- package/app/composables/useDashboardData.ts +310 -0
- package/app/composables/useDocumentThumbnail.ts +351 -0
- package/app/composables/useEcharts.ts +33 -0
- package/app/composables/useLocalDatabaseConfig.ts +51 -0
- package/app/composables/useOcr.ts +300 -0
- package/app/composables/useOfflineFetch.ts +194 -0
- package/app/composables/useOfflineItem.ts +107 -0
- package/app/composables/useOfflineQueue.ts +302 -0
- package/app/composables/useOfflineSync.ts +235 -0
- package/app/composables/usePasskeyAuth.ts +156 -0
- package/app/composables/usePdfCompressor.ts +180 -0
- package/app/composables/usePlatformRedirect.ts +72 -0
- package/app/composables/useRealtimeSync.ts +233 -0
- package/app/composables/useReferencedItems.ts +180 -0
- package/app/composables/useScanner.ts +664 -0
- package/app/composables/useSubscription.ts +650 -0
- package/app/composables/useThumbnailCache.ts +136 -0
- package/app/composables/useVideoCompressor.ts +194 -0
- package/app/error.vue +112 -0
- package/app/layouts/api.vue +188 -0
- package/app/layouts/dashboard.vue +91 -0
- package/app/layouts/default.vue +228 -0
- package/app/layouts/table.vue +471 -0
- package/app/locales/ar.ts +996 -0
- package/app/locales/en.ts +655 -0
- package/app/locales/es.ts +996 -0
- package/app/locales/fr.ts +997 -0
- package/app/middleware/dashboard.ts +33 -0
- package/app/middleware/database.ts +83 -0
- package/app/middleware/global.ts +1 -0
- package/app/middleware/sid-ingest.global.ts +29 -0
- package/app/middleware/table.ts +54 -0
- package/app/middleware/user.ts +26 -0
- package/app/pages/[[database]]/admin/api/auth/index.vue +306 -0
- package/app/pages/[[database]]/admin/api/index.vue +18 -0
- package/app/pages/[[database]]/admin/api/tables/[table]/index.vue +497 -0
- package/app/pages/[[database]]/admin/api/tables/index.vue +87 -0
- package/app/pages/[[database]]/admin/billing/index.vue +16 -0
- package/app/pages/[[database]]/admin/dashboards/[id]/edit.vue +66 -0
- package/app/pages/[[database]]/admin/dashboards/[id]/index.vue +117 -0
- package/app/pages/[[database]]/admin/dashboards/index.vue +20 -0
- package/app/pages/[[database]]/admin/index.vue +28 -0
- package/app/pages/[[database]]/admin/settings.vue +526 -0
- package/app/pages/[[database]]/admin/tables/[table]/[id]/edit.vue +143 -0
- package/app/pages/[[database]]/admin/tables/[table]/[id]/index.vue +146 -0
- package/app/pages/[[database]]/admin/tables/[table]/flows.vue +10 -0
- package/app/pages/[[database]]/admin/tables/[table]/index.vue +10 -0
- package/app/pages/[[database]]/admin/tables/[table]/new.vue +12 -0
- package/app/pages/[[database]]/admin/tables/[table]/schedules.vue +10 -0
- package/app/pages/[[database]]/admin/tables/[table]/settings.vue +30 -0
- package/app/pages/[[database]]/admin/tables/assets/[...path].vue +24 -0
- package/app/pages/[[database]]/admin/tables/assets/flows.vue +10 -0
- package/app/pages/[[database]]/admin/tables/backups/index.vue +10 -0
- package/app/pages/[[database]]/admin/tables/blocks/index.vue +16 -0
- package/app/pages/[[database]]/admin/tables/index.vue +20 -0
- package/app/pages/[[database]]/admin/tables/pages/index.vue +16 -0
- package/app/pages/[[database]]/admin/tables/templates/index.vue +16 -0
- package/app/pages/[[database]]/api/index.vue +120 -0
- package/app/pages/[[database]]/auth/index.vue +12 -0
- package/app/pages/[[database]]/auth/reset.vue +10 -0
- package/app/pages/[[database]]/index.vue +10 -0
- package/app/plugins/offline-warmup.client.ts +53 -0
- package/app/plugins/template-globals.ts +9 -0
- package/app/spa-loading-template.html +93 -0
- package/biome.json +53 -0
- package/index.d.ts +380 -0
- package/modules/naiveui.ts +41 -0
- package/nuxt.config.ts +269 -0
- package/package.json +56 -0
- package/pnpm-workspace.yaml +5 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/pwa-192x192.png +0 -0
- package/public/pwa-512x512.png +0 -0
- package/public/pwa-maskable-192x192.png +0 -0
- package/public/pwa-maskable-512x512.png +0 -0
- package/public/vendor/opencv.js +48 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<article
|
|
3
|
+
class="endpoint-card"
|
|
4
|
+
:data-endpoint="endpoint"
|
|
5
|
+
:data-method="method"
|
|
6
|
+
:data-description="description"
|
|
7
|
+
>
|
|
8
|
+
<header class="endpoint-card__header">
|
|
9
|
+
<NFlex align="center" wrap :size="8">
|
|
10
|
+
<NTag :type="methodType" size="small" round>
|
|
11
|
+
{{ method }}
|
|
12
|
+
</NTag>
|
|
13
|
+
<NCode :code="endpoint" language="bash" />
|
|
14
|
+
</NFlex>
|
|
15
|
+
<NText v-if="description" depth="3" class="endpoint-card__desc">
|
|
16
|
+
{{ description }}
|
|
17
|
+
</NText>
|
|
18
|
+
</header>
|
|
19
|
+
|
|
20
|
+
<section
|
|
21
|
+
v-if="$slots.params || params?.length"
|
|
22
|
+
class="endpoint-card__section"
|
|
23
|
+
data-section="params"
|
|
24
|
+
>
|
|
25
|
+
<NH5>{{ t('apiDocs.queryParams') }}</NH5>
|
|
26
|
+
<slot name="params">
|
|
27
|
+
<NDataTable
|
|
28
|
+
v-if="params?.length"
|
|
29
|
+
:columns="paramColumns"
|
|
30
|
+
:data="params"
|
|
31
|
+
:bordered="false"
|
|
32
|
+
:single-line="false"
|
|
33
|
+
size="small"
|
|
34
|
+
:pagination="false"
|
|
35
|
+
/>
|
|
36
|
+
</slot>
|
|
37
|
+
</section>
|
|
38
|
+
|
|
39
|
+
<section
|
|
40
|
+
v-if="$slots.request || requestExample"
|
|
41
|
+
class="endpoint-card__section"
|
|
42
|
+
data-section="request"
|
|
43
|
+
>
|
|
44
|
+
<NH5>{{ t('apiDocs.requestExample') }}</NH5>
|
|
45
|
+
<slot name="request">
|
|
46
|
+
<NCode
|
|
47
|
+
v-if="requestExample"
|
|
48
|
+
:code="requestExample"
|
|
49
|
+
language="json"
|
|
50
|
+
word-wrap
|
|
51
|
+
/>
|
|
52
|
+
</slot>
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
<section
|
|
56
|
+
v-if="$slots.response || responseExample"
|
|
57
|
+
class="endpoint-card__section"
|
|
58
|
+
data-section="response"
|
|
59
|
+
>
|
|
60
|
+
<NH5>{{ t('apiDocs.responseExample') }}</NH5>
|
|
61
|
+
<slot name="response">
|
|
62
|
+
<NCode
|
|
63
|
+
v-if="responseExample"
|
|
64
|
+
:code="responseExample"
|
|
65
|
+
language="json"
|
|
66
|
+
word-wrap
|
|
67
|
+
/>
|
|
68
|
+
</slot>
|
|
69
|
+
</section>
|
|
70
|
+
|
|
71
|
+
<section v-if="$slots.extra" class="endpoint-card__section" data-section="extra">
|
|
72
|
+
<slot name="extra" />
|
|
73
|
+
</section>
|
|
74
|
+
</article>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script setup lang="ts">
|
|
78
|
+
import type { DataTableColumns } from "naive-ui";
|
|
79
|
+
|
|
80
|
+
interface ParamRow {
|
|
81
|
+
name: string;
|
|
82
|
+
type: string;
|
|
83
|
+
required: boolean;
|
|
84
|
+
description: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const props = withDefaults(
|
|
88
|
+
defineProps<{
|
|
89
|
+
endpoint: string;
|
|
90
|
+
method: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
requestExample?: string;
|
|
93
|
+
responseExample?: string;
|
|
94
|
+
params?: ParamRow[];
|
|
95
|
+
}>(),
|
|
96
|
+
{
|
|
97
|
+
description: "",
|
|
98
|
+
requestExample: "",
|
|
99
|
+
responseExample: "",
|
|
100
|
+
params: () => [],
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const methodType = computed(() => {
|
|
105
|
+
const map: Record<string, "success" | "info" | "warning" | "error"> = {
|
|
106
|
+
POST: "success",
|
|
107
|
+
GET: "info",
|
|
108
|
+
PUT: "warning",
|
|
109
|
+
DELETE: "error",
|
|
110
|
+
};
|
|
111
|
+
return map[props.method.toUpperCase()] ?? "default";
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const paramColumns: DataTableColumns<ParamRow> = [
|
|
115
|
+
{
|
|
116
|
+
title: t("key"),
|
|
117
|
+
key: "name",
|
|
118
|
+
width: 160,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
title: t("type"),
|
|
122
|
+
key: "type",
|
|
123
|
+
width: 100,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: t("required"),
|
|
127
|
+
key: "required",
|
|
128
|
+
width: 90,
|
|
129
|
+
render: (row) => (row.required ? t("required") : t("optional")),
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
title: t("description"),
|
|
133
|
+
key: "description",
|
|
134
|
+
minWidth: 200,
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<style scoped>
|
|
140
|
+
.endpoint-card {
|
|
141
|
+
border: 1px solid var(--n-border-color);
|
|
142
|
+
border-radius: 8px;
|
|
143
|
+
padding: 20px;
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
gap: 20px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.endpoint-card__header {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
gap: 8px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.endpoint-card__desc {
|
|
156
|
+
margin-top: 4px;
|
|
157
|
+
display: block;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.endpoint-card__section {
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
gap: 8px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.endpoint-card__section h5 {
|
|
167
|
+
margin: 0;
|
|
168
|
+
}
|
|
169
|
+
</style>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="schema-docs-table" role="table" :aria-label="t('apiDocs.schemaTitle')">
|
|
3
|
+
<NDataTable v-if="rows.length" :columns="columns" :data="rows" :row-key="rowKey" :bordered="false"
|
|
4
|
+
:single-line="false" :size="size" striped :pagination="false" />
|
|
5
|
+
<NEmpty v-else :description="emptyDescription || t('apiDocs.noSchemaFields')" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import type { DataTableColumns } from "naive-ui";
|
|
11
|
+
import { NTable, NText } from "#components";
|
|
12
|
+
|
|
13
|
+
interface SchemaDocRow {
|
|
14
|
+
id: string;
|
|
15
|
+
keyText: string;
|
|
16
|
+
labelText: string;
|
|
17
|
+
typeText: string;
|
|
18
|
+
required: boolean;
|
|
19
|
+
requiredText: string;
|
|
20
|
+
descriptionText: string;
|
|
21
|
+
children?: SchemaDocRow[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(
|
|
25
|
+
defineProps<{
|
|
26
|
+
schema?: Schema;
|
|
27
|
+
size?: "small" | "medium" | "large";
|
|
28
|
+
emptyDescription?: string;
|
|
29
|
+
}>(),
|
|
30
|
+
{
|
|
31
|
+
size: "medium",
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const rows = computed(() => (props.schema ? mapSchema(props.schema) : []));
|
|
36
|
+
const size = computed(() => props.size);
|
|
37
|
+
const rowKey = (row: SchemaDocRow) => row.id;
|
|
38
|
+
|
|
39
|
+
const columns = computed<DataTableColumns<SchemaDocRow>>(() => [
|
|
40
|
+
{
|
|
41
|
+
type: "expand",
|
|
42
|
+
expandable: (rowData) => Boolean(rowData.children?.length),
|
|
43
|
+
renderExpand: (rowData) =>
|
|
44
|
+
rowData.children?.length ? renderNestedTable(rowData.children) : null,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: t("label"),
|
|
48
|
+
key: "labelText",
|
|
49
|
+
className: "schema-docs-table__column--label",
|
|
50
|
+
render: (rowData) => rowData.labelText,
|
|
51
|
+
minWidth: 180,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: t("key"),
|
|
55
|
+
key: "keyText",
|
|
56
|
+
width: 160,
|
|
57
|
+
ellipsis: true,
|
|
58
|
+
render: (rowData) => rowData.keyText,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: t("type"),
|
|
62
|
+
key: "typeText",
|
|
63
|
+
width: 180,
|
|
64
|
+
render: (rowData) => rowData.typeText,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: t("required"),
|
|
68
|
+
key: "requiredText",
|
|
69
|
+
width: 120,
|
|
70
|
+
render: (rowData) =>
|
|
71
|
+
rowData.required
|
|
72
|
+
? h(NText, { type: "success" }, { default: () => rowData.requiredText })
|
|
73
|
+
: h(
|
|
74
|
+
NText,
|
|
75
|
+
{ type: "default" },
|
|
76
|
+
{ default: () => rowData.requiredText },
|
|
77
|
+
),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: t("description"),
|
|
81
|
+
key: "descriptionText",
|
|
82
|
+
minWidth: 220,
|
|
83
|
+
render: (rowData) => rowData.descriptionText,
|
|
84
|
+
},
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
function renderNestedTable(children: SchemaDocRow[]) {
|
|
88
|
+
return h(
|
|
89
|
+
"div",
|
|
90
|
+
{ class: "schema-docs-table__nested" },
|
|
91
|
+
h(
|
|
92
|
+
NTable,
|
|
93
|
+
{
|
|
94
|
+
singleLine: false,
|
|
95
|
+
size: "small",
|
|
96
|
+
bordered: false,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
default: () => [
|
|
100
|
+
h("thead", null, [
|
|
101
|
+
h("tr", null, [
|
|
102
|
+
h("th", null, t("label")),
|
|
103
|
+
h("th", null, t("key")),
|
|
104
|
+
h("th", null, t("type")),
|
|
105
|
+
h("th", null, t("required")),
|
|
106
|
+
h("th", null, t("description")),
|
|
107
|
+
]),
|
|
108
|
+
]),
|
|
109
|
+
h(
|
|
110
|
+
"tbody",
|
|
111
|
+
null,
|
|
112
|
+
children.map((child) =>
|
|
113
|
+
h("tr", { key: child.id }, [
|
|
114
|
+
h(
|
|
115
|
+
"td",
|
|
116
|
+
{ class: "schema-docs-table__column--label" },
|
|
117
|
+
child.labelText,
|
|
118
|
+
),
|
|
119
|
+
h("td", null, child.keyText),
|
|
120
|
+
h("td", null, child.typeText),
|
|
121
|
+
h("td", null, child.requiredText),
|
|
122
|
+
h("td", null, child.descriptionText),
|
|
123
|
+
]),
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
),
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function mapSchema(schema: Schema, parentPath: string[] = []): SchemaDocRow[] {
|
|
133
|
+
return schema.map((field, index) => {
|
|
134
|
+
const fallbackKey = `field-${index}`;
|
|
135
|
+
const key = field.key ?? fallbackKey;
|
|
136
|
+
const path = [...parentPath, key].join(".");
|
|
137
|
+
const labelText = field.labelKey
|
|
138
|
+
? t(field.labelKey)
|
|
139
|
+
: (field.label ?? t(key));
|
|
140
|
+
|
|
141
|
+
const nestedChildren = hasSchemaChildren(field)
|
|
142
|
+
? mapSchema(field.children as Schema, [...parentPath, key])
|
|
143
|
+
: undefined;
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
id: path,
|
|
147
|
+
keyText: key,
|
|
148
|
+
labelText,
|
|
149
|
+
typeText: formatFieldType(field),
|
|
150
|
+
required: Boolean(field.required),
|
|
151
|
+
requiredText: field.required ? t("required") : t("optional"),
|
|
152
|
+
descriptionText: field.description || "—",
|
|
153
|
+
children: nestedChildren,
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function hasSchemaChildren(
|
|
159
|
+
field: Field,
|
|
160
|
+
): field is Field & { children: Schema } {
|
|
161
|
+
if (!field.children) return false;
|
|
162
|
+
if (Array.isArray(field.children)) {
|
|
163
|
+
return field.children.some(
|
|
164
|
+
(child) => typeof child === "object" && child !== null && "key" in child,
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return typeof field.children === "object";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function formatFieldType(field: Field): string {
|
|
172
|
+
if (Array.isArray(field.type)) {
|
|
173
|
+
return field.type.join(" | ");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const baseType = field.type ?? "string";
|
|
177
|
+
|
|
178
|
+
if (baseType === "array") {
|
|
179
|
+
if (hasSchemaChildren(field)) return "Array<Object>";
|
|
180
|
+
if (Array.isArray(field.children))
|
|
181
|
+
return `Array<${field.children.map(String).join(" | ")}>`;
|
|
182
|
+
if (typeof field.children === "string") return `Array<${field.children}>`;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (baseType === "table") {
|
|
186
|
+
if ("table" in field && field.table) return `Table<${field.table}>`;
|
|
187
|
+
if (hasSchemaChildren(field)) return "Table<Object>";
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (field.subType) return `${baseType} (${field.subType})`;
|
|
191
|
+
|
|
192
|
+
return String(baseType);
|
|
193
|
+
}
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<style scoped>
|
|
197
|
+
.schema-docs-table {
|
|
198
|
+
width: 100%;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.schema-docs-table__nested {
|
|
202
|
+
padding: 8px 8px 0 8px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.schema-docs-table__column--label {
|
|
206
|
+
font-weight: 600;
|
|
207
|
+
}
|
|
208
|
+
</style>
|