@svadmin/lite 0.5.0 → 0.7.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/README.md +190 -9
- package/dist/compatibility.d.ts +23 -0
- package/dist/compatibility.js +95 -0
- package/dist/components/LiteDynamicFormList.svelte +169 -0
- package/dist/components/LiteDynamicFormList.svelte.d.ts +45 -0
- package/dist/components/LiteFilterBuilder.svelte +205 -0
- package/dist/components/LiteFilterBuilder.svelte.d.ts +19 -0
- package/dist/components/LiteShowField.svelte +52 -22
- package/dist/components/LiteShowField.svelte.d.ts +3 -2
- package/dist/components/LiteTable.svelte +89 -36
- package/dist/components/LiteTable.svelte.d.ts +3 -2
- package/dist/components/LiteTransfer.svelte +185 -0
- package/dist/components/LiteTransfer.svelte.d.ts +18 -0
- package/dist/components/compatibility/LiteCapabilityBoundary.svelte +51 -0
- package/dist/components/compatibility/LiteCapabilityBoundary.svelte.d.ts +13 -0
- package/dist/components/compatibility/LiteClipboardFallback.svelte +16 -0
- package/dist/components/compatibility/LiteClipboardFallback.svelte.d.ts +8 -0
- package/dist/components/compatibility/LiteComputeFallback.svelte +50 -0
- package/dist/components/compatibility/LiteComputeFallback.svelte.d.ts +14 -0
- package/dist/components/compatibility/LiteDirectoryUpload.svelte +44 -0
- package/dist/components/compatibility/LiteDirectoryUpload.svelte.d.ts +11 -0
- package/dist/components/compatibility/LiteOrderedList.svelte +47 -0
- package/dist/components/compatibility/LiteOrderedList.svelte.d.ts +14 -0
- package/dist/components/compatibility/LiteRealtimeStatus.svelte +43 -0
- package/dist/components/compatibility/LiteRealtimeStatus.svelte.d.ts +11 -0
- package/dist/components/compatibility/LiteVisualFallback.svelte +80 -0
- package/dist/components/compatibility/LiteVisualFallback.svelte.d.ts +18 -0
- package/dist/components/compatibility/index.d.ts +7 -0
- package/dist/components/compatibility/index.js +7 -0
- package/dist/components/fields/LiteAvatarField.svelte +127 -0
- package/dist/components/fields/LiteAvatarField.svelte.d.ts +21 -0
- package/dist/components/fields/LiteCascader.svelte +119 -0
- package/dist/components/fields/LiteCascader.svelte.d.ts +24 -0
- package/dist/components/fields/LiteCodeField.svelte +71 -0
- package/dist/components/fields/LiteCodeField.svelte.d.ts +16 -0
- package/dist/components/fields/LiteCopyField.svelte +74 -0
- package/dist/components/fields/LiteCopyField.svelte.d.ts +18 -0
- package/dist/components/fields/LiteCurrencyField.svelte +126 -0
- package/dist/components/fields/LiteCurrencyField.svelte.d.ts +21 -0
- package/dist/components/fields/LiteDateRangeField.svelte +147 -0
- package/dist/components/fields/LiteDateRangeField.svelte.d.ts +26 -0
- package/dist/components/fields/LitePercentField.svelte +124 -0
- package/dist/components/fields/LitePercentField.svelte.d.ts +17 -0
- package/dist/components/fields/LitePhoneField.svelte +81 -0
- package/dist/components/fields/LitePhoneField.svelte.d.ts +17 -0
- package/dist/components/fields/LiteRatingField.svelte +105 -0
- package/dist/components/fields/LiteRatingField.svelte.d.ts +16 -0
- package/dist/components/fields/LiteTreeSelect.svelte +143 -0
- package/dist/components/fields/LiteTreeSelect.svelte.d.ts +23 -0
- package/dist/components/fields/index.d.ts +12 -0
- package/dist/components/fields/index.js +10 -0
- package/dist/components/pages/LiteCreatePage.svelte +15 -6
- package/dist/components/pages/LiteCreatePage.svelte.d.ts +1 -1
- package/dist/components/pages/LiteEditPage.svelte +18 -9
- package/dist/components/pages/LiteEditPage.svelte.d.ts +1 -1
- package/dist/components/pages/LiteListPage.svelte +99 -27
- package/dist/components/pages/LiteListPage.svelte.d.ts +4 -2
- package/dist/components/pages/LiteShowPage.svelte +19 -10
- package/dist/components/pages/LiteShowPage.svelte.d.ts +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +8 -1
- package/dist/lite.css +444 -0
- package/dist/schema-generator.js +15 -4
- package/dist/server-adapter.d.ts +18 -1
- package/dist/server-adapter.js +73 -16
- package/package.json +5 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FieldDefinition } from '@svadmin/core';
|
|
2
|
+
export interface TreeSelectOption {
|
|
3
|
+
value: string | number;
|
|
4
|
+
label: string;
|
|
5
|
+
children?: TreeSelectOption[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface Props {
|
|
9
|
+
field?: FieldDefinition;
|
|
10
|
+
name?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
value?: string | number | (string | number)[];
|
|
13
|
+
options?: TreeSelectOption[];
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
error?: string[];
|
|
19
|
+
mode?: 'show' | 'edit' | 'create';
|
|
20
|
+
}
|
|
21
|
+
declare const LiteTreeSelect: import("svelte").Component<Props, {}, "">;
|
|
22
|
+
type LiteTreeSelect = ReturnType<typeof LiteTreeSelect>;
|
|
23
|
+
export default LiteTreeSelect;
|
|
@@ -13,3 +13,15 @@ export { default as LiteFileField } from './LiteFileField.svelte';
|
|
|
13
13
|
export { default as LiteRichTextField } from './LiteRichTextField.svelte';
|
|
14
14
|
export { default as LiteMarkdownField } from './LiteMarkdownField.svelte';
|
|
15
15
|
export { default as LiteJsonField } from './LiteJsonField.svelte';
|
|
16
|
+
export { default as LiteAvatarField } from './LiteAvatarField.svelte';
|
|
17
|
+
export { default as LiteCodeField } from './LiteCodeField.svelte';
|
|
18
|
+
export { default as LiteCopyField } from './LiteCopyField.svelte';
|
|
19
|
+
export { default as LiteCurrencyField } from './LiteCurrencyField.svelte';
|
|
20
|
+
export { default as LiteDateRangeField } from './LiteDateRangeField.svelte';
|
|
21
|
+
export { default as LitePercentField } from './LitePercentField.svelte';
|
|
22
|
+
export { default as LitePhoneField } from './LitePhoneField.svelte';
|
|
23
|
+
export { default as LiteRatingField } from './LiteRatingField.svelte';
|
|
24
|
+
export { default as LiteTreeSelect } from './LiteTreeSelect.svelte';
|
|
25
|
+
export type { TreeSelectOption } from './LiteTreeSelect.svelte';
|
|
26
|
+
export { default as LiteCascader } from './LiteCascader.svelte';
|
|
27
|
+
export type { CascaderOption } from './LiteCascader.svelte';
|
|
@@ -13,3 +13,13 @@ export { default as LiteFileField } from './LiteFileField.svelte';
|
|
|
13
13
|
export { default as LiteRichTextField } from './LiteRichTextField.svelte';
|
|
14
14
|
export { default as LiteMarkdownField } from './LiteMarkdownField.svelte';
|
|
15
15
|
export { default as LiteJsonField } from './LiteJsonField.svelte';
|
|
16
|
+
export { default as LiteAvatarField } from './LiteAvatarField.svelte';
|
|
17
|
+
export { default as LiteCodeField } from './LiteCodeField.svelte';
|
|
18
|
+
export { default as LiteCopyField } from './LiteCopyField.svelte';
|
|
19
|
+
export { default as LiteCurrencyField } from './LiteCurrencyField.svelte';
|
|
20
|
+
export { default as LiteDateRangeField } from './LiteDateRangeField.svelte';
|
|
21
|
+
export { default as LitePercentField } from './LitePercentField.svelte';
|
|
22
|
+
export { default as LitePhoneField } from './LitePhoneField.svelte';
|
|
23
|
+
export { default as LiteRatingField } from './LiteRatingField.svelte';
|
|
24
|
+
export { default as LiteTreeSelect } from './LiteTreeSelect.svelte';
|
|
25
|
+
export { default as LiteCascader } from './LiteCascader.svelte';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ResourceDefinition } from
|
|
3
|
-
import { t } from
|
|
4
|
-
import LiteForm from
|
|
5
|
-
import
|
|
2
|
+
import type { ResourceDefinition } from "@svadmin/core";
|
|
3
|
+
import { t } from "@svadmin/core/i18n";
|
|
4
|
+
import LiteForm from "../LiteForm.svelte";
|
|
5
|
+
import LiteBreadcrumbs from "../LiteBreadcrumbs.svelte";
|
|
6
|
+
import LiteListButton from "../buttons/LiteListButton.svelte";
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
resource: ResourceDefinition;
|
|
@@ -15,13 +16,21 @@
|
|
|
15
16
|
resource,
|
|
16
17
|
errors = {},
|
|
17
18
|
values = {},
|
|
18
|
-
basePath =
|
|
19
|
+
basePath = "/lite",
|
|
19
20
|
}: Props = $props();
|
|
20
21
|
</script>
|
|
21
22
|
|
|
22
23
|
<div class="lite-page">
|
|
24
|
+
<LiteBreadcrumbs
|
|
25
|
+
items={[
|
|
26
|
+
{ label: t("common.dashboard") || "Dashboard", href: basePath },
|
|
27
|
+
{ label: resource.label || resource.name, href: `${basePath}/${resource.name}` },
|
|
28
|
+
{ label: t("common.create") || "Create" },
|
|
29
|
+
]}
|
|
30
|
+
/>
|
|
31
|
+
|
|
23
32
|
<div class="lite-page-header">
|
|
24
|
-
<h1 class="lite-page-title">{t(
|
|
33
|
+
<h1 class="lite-page-title">{t("common.create") || "Create"} {resource.label || resource.name}</h1>
|
|
25
34
|
<div class="lite-page-actions">
|
|
26
35
|
<LiteListButton resource={resource.name} {basePath} />
|
|
27
36
|
</div>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ResourceDefinition } from
|
|
3
|
-
import { t } from
|
|
4
|
-
import LiteForm from
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import type { ResourceDefinition } from "@svadmin/core";
|
|
3
|
+
import { t } from "@svadmin/core/i18n";
|
|
4
|
+
import LiteForm from "../LiteForm.svelte";
|
|
5
|
+
import LiteBreadcrumbs from "../LiteBreadcrumbs.svelte";
|
|
6
|
+
import LiteListButton from "../buttons/LiteListButton.svelte";
|
|
7
|
+
import LiteShowButton from "../buttons/LiteShowButton.svelte";
|
|
8
|
+
import LiteDeleteButton from "../buttons/LiteDeleteButton.svelte";
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
resource: ResourceDefinition;
|
|
@@ -19,20 +20,28 @@
|
|
|
19
20
|
resource,
|
|
20
21
|
record,
|
|
21
22
|
errors = {},
|
|
22
|
-
basePath =
|
|
23
|
+
basePath = "/lite",
|
|
23
24
|
canDelete,
|
|
24
25
|
canShow,
|
|
25
26
|
}: Props = $props();
|
|
26
27
|
|
|
27
|
-
let pk = $derived(resource.primaryKey ??
|
|
28
|
+
let pk = $derived(resource.primaryKey ?? "id");
|
|
28
29
|
let idStr = $derived(String(record[pk]));
|
|
29
30
|
const showDelete = $derived(canDelete ?? resource.canDelete !== false);
|
|
30
31
|
const showView = $derived(canShow ?? resource.canShow !== false);
|
|
31
32
|
</script>
|
|
32
33
|
|
|
33
34
|
<div class="lite-page">
|
|
35
|
+
<LiteBreadcrumbs
|
|
36
|
+
items={[
|
|
37
|
+
{ label: t("common.dashboard") || "Dashboard", href: basePath },
|
|
38
|
+
{ label: resource.label || resource.name, href: `${basePath}/${resource.name}` },
|
|
39
|
+
{ label: `${t("common.edit") || "Edit"} #${idStr}` },
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
|
|
34
43
|
<div class="lite-page-header">
|
|
35
|
-
<h1 class="lite-page-title">{t(
|
|
44
|
+
<h1 class="lite-page-title">{t("common.edit") || "Edit"} {resource.label || resource.name} #{idStr}</h1>
|
|
36
45
|
<div class="lite-page-actions">
|
|
37
46
|
{#if showView}
|
|
38
47
|
<LiteShowButton resource={resource.name} recordItemId={idStr} {basePath} />
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ResourceDefinition } from
|
|
3
|
-
import { t } from
|
|
4
|
-
import LiteTable from
|
|
5
|
-
import LitePagination from
|
|
6
|
-
import
|
|
7
|
-
import LiteCreateButton from
|
|
8
|
-
import LiteRefreshButton from
|
|
2
|
+
import type { ResourceDefinition } from "@svadmin/core";
|
|
3
|
+
import { t } from "@svadmin/core/i18n";
|
|
4
|
+
import LiteTable from "../LiteTable.svelte";
|
|
5
|
+
import LitePagination from "../LitePagination.svelte";
|
|
6
|
+
import LiteBreadcrumbs from "../LiteBreadcrumbs.svelte";
|
|
7
|
+
import LiteCreateButton from "../buttons/LiteCreateButton.svelte";
|
|
8
|
+
import LiteRefreshButton from "../buttons/LiteRefreshButton.svelte";
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
resource: ResourceDefinition;
|
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
total: number;
|
|
14
14
|
pagination: { page: number; perPage: number };
|
|
15
15
|
currentSort?: string;
|
|
16
|
-
currentOrder?:
|
|
16
|
+
currentOrder?: "asc" | "desc";
|
|
17
17
|
currentSearch?: string;
|
|
18
|
+
currentFilters?: Record<string, string>;
|
|
18
19
|
basePath?: string;
|
|
19
20
|
canCreate?: boolean;
|
|
20
21
|
canShow?: boolean;
|
|
21
22
|
canEdit?: boolean;
|
|
22
23
|
canDelete?: boolean;
|
|
24
|
+
enableBatch?: boolean;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
let {
|
|
@@ -28,24 +30,43 @@
|
|
|
28
30
|
total,
|
|
29
31
|
pagination,
|
|
30
32
|
currentSort,
|
|
31
|
-
currentOrder =
|
|
33
|
+
currentOrder = "asc",
|
|
32
34
|
currentSearch,
|
|
33
|
-
|
|
35
|
+
currentFilters = {},
|
|
36
|
+
basePath = "/lite",
|
|
34
37
|
canCreate,
|
|
35
38
|
canShow,
|
|
36
39
|
canEdit,
|
|
37
40
|
canDelete,
|
|
41
|
+
enableBatch = true,
|
|
38
42
|
}: Props = $props();
|
|
39
43
|
|
|
40
44
|
const showCreate = $derived(canCreate ?? resource.canCreate !== false);
|
|
41
45
|
const showView = $derived(canShow ?? resource.canShow !== false);
|
|
42
46
|
const showEdit = $derived(canEdit ?? resource.canEdit !== false);
|
|
43
47
|
const showDelete = $derived(canDelete ?? resource.canDelete !== false);
|
|
48
|
+
|
|
49
|
+
const filterableFields = $derived(
|
|
50
|
+
resource.fields
|
|
51
|
+
.filter((f) => f.type === "select" && f.options && f.options.length > 0 && f.filterable !== false)
|
|
52
|
+
.slice(0, 3)
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const hasActiveFilters = $derived(
|
|
56
|
+
Boolean(currentSearch) || Object.values(currentFilters).some((v) => Boolean(v))
|
|
57
|
+
);
|
|
44
58
|
</script>
|
|
45
59
|
|
|
46
60
|
<div class="lite-page">
|
|
61
|
+
<LiteBreadcrumbs
|
|
62
|
+
items={[
|
|
63
|
+
{ label: t("common.dashboard") || "Dashboard", href: basePath },
|
|
64
|
+
{ label: resource.label || resource.name },
|
|
65
|
+
]}
|
|
66
|
+
/>
|
|
67
|
+
|
|
47
68
|
<div class="lite-page-header">
|
|
48
|
-
<h1 class="lite-page-title">{resource.label || resource.name} {t(
|
|
69
|
+
<h1 class="lite-page-title">{resource.label || resource.name} {t("common.list") || "List"}</h1>
|
|
49
70
|
<div class="lite-page-actions">
|
|
50
71
|
{#if showCreate}
|
|
51
72
|
<LiteCreateButton resource={resource.name} {basePath} />
|
|
@@ -55,25 +76,75 @@
|
|
|
55
76
|
</div>
|
|
56
77
|
|
|
57
78
|
<div class="lite-card" style="margin-bottom: 20px;">
|
|
58
|
-
<div style="padding: 16px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center;">
|
|
59
|
-
<
|
|
79
|
+
<div style="padding: 16px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;">
|
|
80
|
+
<form method="GET" class="lite-filter-bar" style="margin: 0;">
|
|
81
|
+
<input
|
|
82
|
+
type="text"
|
|
83
|
+
name="q"
|
|
84
|
+
value={currentSearch ?? ""}
|
|
85
|
+
placeholder={t("common.search") || "Search..."}
|
|
86
|
+
class="lite-input"
|
|
87
|
+
style="width: 200px; display: inline-block;"
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
{#each filterableFields as field (field.key)}
|
|
91
|
+
<select
|
|
92
|
+
name={field.key}
|
|
93
|
+
class="lite-select"
|
|
94
|
+
style="width: 150px; display: inline-block;"
|
|
95
|
+
>
|
|
96
|
+
<option value="">All {field.label}</option>
|
|
97
|
+
{#if field.options}
|
|
98
|
+
{#each field.options as opt (opt.value)}
|
|
99
|
+
<option
|
|
100
|
+
value={String(opt.value)}
|
|
101
|
+
selected={String(currentFilters[field.key] ?? "") === String(opt.value)}
|
|
102
|
+
>
|
|
103
|
+
{opt.label}
|
|
104
|
+
</option>
|
|
105
|
+
{/each}
|
|
106
|
+
{/if}
|
|
107
|
+
</select>
|
|
108
|
+
{/each}
|
|
109
|
+
|
|
110
|
+
{#if currentSort}
|
|
111
|
+
<input type="hidden" name="sort" value={currentSort} />
|
|
112
|
+
{/if}
|
|
113
|
+
{#if currentOrder}
|
|
114
|
+
<input type="hidden" name="order" value={currentOrder} />
|
|
115
|
+
{/if}
|
|
116
|
+
|
|
117
|
+
<button type="submit" class="lite-btn lite-btn-sm lite-btn-primary">
|
|
118
|
+
{t("common.filter") || "Filter"}
|
|
119
|
+
</button>
|
|
120
|
+
|
|
121
|
+
{#if hasActiveFilters}
|
|
122
|
+
<a href={basePath + "/" + resource.name} class="lite-btn lite-btn-sm">
|
|
123
|
+
{t("common.reset") || "Reset"}
|
|
124
|
+
</a>
|
|
125
|
+
{/if}
|
|
126
|
+
</form>
|
|
127
|
+
|
|
60
128
|
<span style="font-size: 13px; color: #64748b;">
|
|
61
|
-
{t(
|
|
129
|
+
{t("common.total") || "Total"}: <strong>{total}</strong>
|
|
62
130
|
</span>
|
|
63
131
|
</div>
|
|
64
132
|
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
133
|
+
<div class="lite-table-scroll">
|
|
134
|
+
<LiteTable
|
|
135
|
+
{records}
|
|
136
|
+
{resource}
|
|
137
|
+
{currentSort}
|
|
138
|
+
{currentOrder}
|
|
139
|
+
{currentSearch}
|
|
140
|
+
{basePath}
|
|
141
|
+
canShow={showView}
|
|
142
|
+
canEdit={showEdit}
|
|
143
|
+
canDelete={showDelete}
|
|
144
|
+
{enableBatch}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
|
|
77
148
|
{#if total > pagination.perPage}
|
|
78
149
|
<LitePagination
|
|
79
150
|
page={pagination.page}
|
|
@@ -81,7 +152,8 @@
|
|
|
81
152
|
preserveParams={{
|
|
82
153
|
...(currentSort ? { sort: currentSort } : {}),
|
|
83
154
|
...(currentOrder ? { order: currentOrder } : {}),
|
|
84
|
-
...(currentSearch ? { q: currentSearch } : {})
|
|
155
|
+
...(currentSearch ? { q: currentSearch } : {}),
|
|
156
|
+
...currentFilters,
|
|
85
157
|
}}
|
|
86
158
|
/>
|
|
87
159
|
{/if}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResourceDefinition } from
|
|
1
|
+
import type { ResourceDefinition } from "@svadmin/core";
|
|
2
2
|
interface Props {
|
|
3
3
|
resource: ResourceDefinition;
|
|
4
4
|
records: Record<string, unknown>[];
|
|
@@ -8,13 +8,15 @@ interface Props {
|
|
|
8
8
|
perPage: number;
|
|
9
9
|
};
|
|
10
10
|
currentSort?: string;
|
|
11
|
-
currentOrder?:
|
|
11
|
+
currentOrder?: "asc" | "desc";
|
|
12
12
|
currentSearch?: string;
|
|
13
|
+
currentFilters?: Record<string, string>;
|
|
13
14
|
basePath?: string;
|
|
14
15
|
canCreate?: boolean;
|
|
15
16
|
canShow?: boolean;
|
|
16
17
|
canEdit?: boolean;
|
|
17
18
|
canDelete?: boolean;
|
|
19
|
+
enableBatch?: boolean;
|
|
18
20
|
}
|
|
19
21
|
declare const LiteListPage: import("svelte").Component<Props, {}, "">;
|
|
20
22
|
type LiteListPage = ReturnType<typeof LiteListPage>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ResourceDefinition } from
|
|
3
|
-
import { t } from
|
|
4
|
-
import LiteShowField from
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import type { ResourceDefinition } from "@svadmin/core";
|
|
3
|
+
import { t } from "@svadmin/core/i18n";
|
|
4
|
+
import LiteShowField from "../LiteShowField.svelte";
|
|
5
|
+
import LiteBreadcrumbs from "../LiteBreadcrumbs.svelte";
|
|
6
|
+
import LiteListButton from "../buttons/LiteListButton.svelte";
|
|
7
|
+
import LiteEditButton from "../buttons/LiteEditButton.svelte";
|
|
8
|
+
import LiteDeleteButton from "../buttons/LiteDeleteButton.svelte";
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
resource: ResourceDefinition;
|
|
@@ -17,12 +18,12 @@
|
|
|
17
18
|
let {
|
|
18
19
|
resource,
|
|
19
20
|
record,
|
|
20
|
-
basePath =
|
|
21
|
+
basePath = "/lite",
|
|
21
22
|
canEdit,
|
|
22
23
|
canDelete,
|
|
23
24
|
}: Props = $props();
|
|
24
25
|
|
|
25
|
-
let pk = $derived(resource.primaryKey ??
|
|
26
|
+
let pk = $derived(resource.primaryKey ?? "id");
|
|
26
27
|
let idStr = $derived(String(record[pk]));
|
|
27
28
|
const showEdit = $derived(canEdit ?? resource.canEdit !== false);
|
|
28
29
|
const showDelete = $derived(canDelete ?? resource.canDelete !== false);
|
|
@@ -33,8 +34,16 @@
|
|
|
33
34
|
</script>
|
|
34
35
|
|
|
35
36
|
<div class="lite-page">
|
|
37
|
+
<LiteBreadcrumbs
|
|
38
|
+
items={[
|
|
39
|
+
{ label: t("common.dashboard") || "Dashboard", href: basePath },
|
|
40
|
+
{ label: resource.label || resource.name, href: `${basePath}/${resource.name}` },
|
|
41
|
+
{ label: `#${idStr}` },
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
44
|
+
|
|
36
45
|
<div class="lite-page-header">
|
|
37
|
-
<h1 class="lite-page-title">{t(
|
|
46
|
+
<h1 class="lite-page-title">{t("common.show") || "Show"} {resource.label || resource.name} #{idStr}</h1>
|
|
38
47
|
<div class="lite-page-actions">
|
|
39
48
|
{#if showEdit}
|
|
40
49
|
<LiteEditButton resource={resource.name} recordItemId={idStr} {basePath} />
|
|
@@ -54,7 +63,7 @@
|
|
|
54
63
|
{field.label}
|
|
55
64
|
</div>
|
|
56
65
|
<div style="color: #0f172a; font-size: 14px;">
|
|
57
|
-
<LiteShowField {field} value={record[field.key]} />
|
|
66
|
+
<LiteShowField {field} value={record[field.key]} {basePath} />
|
|
58
67
|
</div>
|
|
59
68
|
</div>
|
|
60
69
|
{/each}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { createListLoader, createDetailLoader, createCrudActions, createAuthGuard, createAuthActions, createLegacyRedirectHook, isLegacyBrowser, } from './server-adapter';
|
|
2
|
-
export type { ListLoaderResult } from './server-adapter';
|
|
1
|
+
export { createListLoader, createDetailLoader, createCrudActions, createAuthGuard, createAuthActions, createLegacyRedirectHook, getLegacyRedirectLocation, isLegacyBrowser, } from './server-adapter';
|
|
2
|
+
export type { LegacyRedirectOptions, ListLoaderResult } from './server-adapter';
|
|
3
|
+
export { LITE_COMPATIBILITY_CATALOG, detectLiteCapabilities, resolveLiteCompatibility, } from './compatibility';
|
|
4
|
+
export type { LiteCapability, LiteCapabilitySupport, LiteCompatibilityDescriptor, LiteCompatibilityResolution, LiteFallbackKind, } from './compatibility';
|
|
3
5
|
export { fieldsToTypeBoxSchema, resourceToTypeBoxSchema, fieldsToZodSchema, resourceToZodSchema, fieldToInputType, fieldToPlaceholder, } from './schema-generator';
|
|
4
6
|
export { getStatusBadgeClass, parseExplicitBoolean, isExplicitBooleanTrue } from './value-normalization';
|
|
5
7
|
export { default as LiteLayout } from './components/LiteLayout.svelte';
|
|
@@ -13,6 +15,11 @@ export { default as LiteAlert } from './components/LiteAlert.svelte';
|
|
|
13
15
|
export { default as LitePermissionMatrix } from './components/LitePermissionMatrix.svelte';
|
|
14
16
|
export { default as LiteAuditLog } from './components/LiteAuditLog.svelte';
|
|
15
17
|
export { default as LiteArrayField } from './components/LiteArrayField.svelte';
|
|
18
|
+
export { default as LiteDynamicFormList } from './components/LiteDynamicFormList.svelte';
|
|
19
|
+
export { default as LiteTransfer } from './components/LiteTransfer.svelte';
|
|
20
|
+
export type { TransferItem } from './components/LiteTransfer.svelte';
|
|
21
|
+
export { default as LiteFilterBuilder } from './components/LiteFilterBuilder.svelte';
|
|
22
|
+
export type { FilterRuleItem } from './components/LiteFilterBuilder.svelte';
|
|
16
23
|
export { default as LiteBreadcrumbs } from './components/LiteBreadcrumbs.svelte';
|
|
17
24
|
export { default as LiteStatsCard } from './components/LiteStatsCard.svelte';
|
|
18
25
|
export { default as LiteConfirmDialog } from './components/LiteConfirmDialog.svelte';
|
|
@@ -21,6 +28,7 @@ export { default as LiteTabs } from './components/LiteTabs.svelte';
|
|
|
21
28
|
export { default as LiteShowField } from './components/LiteShowField.svelte';
|
|
22
29
|
export { default as LiteMediaThumbnail } from './components/LiteMediaThumbnail.svelte';
|
|
23
30
|
export { default as LiteChatDialog } from './components/LiteChatDialog.svelte';
|
|
31
|
+
export * from './components/compatibility/index';
|
|
24
32
|
export * from './components/buttons/index';
|
|
25
33
|
export * from './components/fields/index';
|
|
26
34
|
export * from './components/pages/index';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// @svadmin/lite — Lightweight SSR Admin UI
|
|
2
2
|
// Server-rendered by default, with optional progressive enhancement.
|
|
3
3
|
// Server utilities (use in +page.server.ts / hooks.server.ts)
|
|
4
|
-
export { createListLoader, createDetailLoader, createCrudActions, createAuthGuard, createAuthActions, createLegacyRedirectHook, isLegacyBrowser, } from './server-adapter';
|
|
4
|
+
export { createListLoader, createDetailLoader, createCrudActions, createAuthGuard, createAuthActions, createLegacyRedirectHook, getLegacyRedirectLocation, isLegacyBrowser, } from './server-adapter';
|
|
5
|
+
// Optional browser capabilities. The SSR baseline does not import browser globals.
|
|
6
|
+
export { LITE_COMPATIBILITY_CATALOG, detectLiteCapabilities, resolveLiteCompatibility, } from './compatibility';
|
|
5
7
|
// Schema generator (TypeBox schemas used by Lite actions and client forms)
|
|
6
8
|
export { fieldsToTypeBoxSchema, resourceToTypeBoxSchema, fieldsToZodSchema, resourceToZodSchema, fieldToInputType, fieldToPlaceholder, } from './schema-generator';
|
|
7
9
|
// UI Components (use in +page.svelte with csr = false)
|
|
@@ -17,6 +19,9 @@ export { default as LiteAlert } from './components/LiteAlert.svelte';
|
|
|
17
19
|
export { default as LitePermissionMatrix } from './components/LitePermissionMatrix.svelte';
|
|
18
20
|
export { default as LiteAuditLog } from './components/LiteAuditLog.svelte';
|
|
19
21
|
export { default as LiteArrayField } from './components/LiteArrayField.svelte';
|
|
22
|
+
export { default as LiteDynamicFormList } from './components/LiteDynamicFormList.svelte';
|
|
23
|
+
export { default as LiteTransfer } from './components/LiteTransfer.svelte';
|
|
24
|
+
export { default as LiteFilterBuilder } from './components/LiteFilterBuilder.svelte';
|
|
20
25
|
export { default as LiteBreadcrumbs } from './components/LiteBreadcrumbs.svelte';
|
|
21
26
|
export { default as LiteStatsCard } from './components/LiteStatsCard.svelte';
|
|
22
27
|
export { default as LiteConfirmDialog } from './components/LiteConfirmDialog.svelte';
|
|
@@ -25,6 +30,8 @@ export { default as LiteTabs } from './components/LiteTabs.svelte';
|
|
|
25
30
|
export { default as LiteShowField } from './components/LiteShowField.svelte';
|
|
26
31
|
export { default as LiteMediaThumbnail } from './components/LiteMediaThumbnail.svelte';
|
|
27
32
|
export { default as LiteChatDialog } from './components/LiteChatDialog.svelte';
|
|
33
|
+
// Compatibility fallbacks for browser-only and third-party UI capabilities.
|
|
34
|
+
export * from './components/compatibility/index';
|
|
28
35
|
// Action Buttons
|
|
29
36
|
export * from './components/buttons/index';
|
|
30
37
|
// Fields
|