@svadmin/ui 0.100.0 → 0.102.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 +1 -1
- package/dist/app.css +99 -0
- package/dist/app.theme.css +99 -0
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AdminApp.svelte +13 -1
- package/dist/components/AdminApp.svelte.d.ts +7 -0
- package/dist/components/Affix.svelte +43 -0
- package/dist/components/Affix.svelte.d.ts +11 -0
- package/dist/components/Anchor.svelte +60 -0
- package/dist/components/Anchor.svelte.d.ts +14 -0
- package/dist/components/AutoTable.svelte +35 -16
- package/dist/components/AutoTable.svelte.d.ts +6 -0
- package/dist/components/Calendar.svelte +152 -0
- package/dist/components/Calendar.svelte.d.ts +20 -0
- package/dist/components/Carousel.svelte +107 -0
- package/dist/components/Carousel.svelte.d.ts +15 -0
- package/dist/components/Collapse.svelte +177 -0
- package/dist/components/Collapse.svelte.d.ts +32 -0
- package/dist/components/CommentThread.svelte +109 -0
- package/dist/components/CommentThread.svelte.d.ts +22 -0
- package/dist/components/CopyButton.svelte +148 -0
- package/dist/components/CopyButton.svelte.d.ts +19 -0
- package/dist/components/DataTableShell.svelte +140 -0
- package/dist/components/DataTableShell.svelte.d.ts +18 -0
- package/dist/components/Header.svelte +28 -0
- package/dist/components/Header.svelte.d.ts +8 -0
- package/dist/components/ImagePreview.svelte +83 -0
- package/dist/components/ImagePreview.svelte.d.ts +14 -0
- package/dist/components/Layout.svelte +86 -6
- package/dist/components/Layout.svelte.d.ts +6 -0
- package/dist/components/ListFooter.svelte +9 -3
- package/dist/components/ListFooter.svelte.d.ts +1 -0
- package/dist/components/ListPagination.svelte +25 -19
- package/dist/components/ListPagination.svelte.d.ts +4 -3
- package/dist/components/NotificationCenter.svelte +215 -0
- package/dist/components/NotificationCenter.svelte.d.ts +28 -0
- package/dist/components/ScrollableTable.svelte +211 -0
- package/dist/components/ScrollableTable.svelte.d.ts +14 -0
- package/dist/components/ThemeSettingsDrawer.svelte +212 -0
- package/dist/components/ThemeSettingsDrawer.svelte.d.ts +10 -0
- package/dist/components/TypographyEllipsis.svelte +123 -0
- package/dist/components/TypographyEllipsis.svelte.d.ts +18 -0
- package/dist/components/ViewModeToggle.svelte +47 -0
- package/dist/components/ViewModeToggle.svelte.d.ts +11 -0
- package/dist/components/list-i18n.d.ts +27 -0
- package/dist/components/list-i18n.js +53 -0
- package/dist/components/templates/AdvancedDetailTemplate.svelte +36 -0
- package/dist/components/templates/AdvancedDetailTemplate.svelte.d.ts +17 -0
- package/dist/components/templates/AdvancedFormTemplate.svelte +32 -0
- package/dist/components/templates/AdvancedFormTemplate.svelte.d.ts +15 -0
- package/dist/components/templates/AnalysisTemplate.svelte +34 -0
- package/dist/components/templates/AnalysisTemplate.svelte.d.ts +16 -0
- package/dist/components/templates/BasicDetailTemplate.svelte +32 -0
- package/dist/components/templates/BasicDetailTemplate.svelte.d.ts +15 -0
- package/dist/components/templates/CardListTemplate.svelte +29 -0
- package/dist/components/templates/CardListTemplate.svelte.d.ts +14 -0
- package/dist/components/templates/ExceptionTemplate.svelte +28 -0
- package/dist/components/templates/ExceptionTemplate.svelte.d.ts +11 -0
- package/dist/components/templates/GroupFormTemplate.svelte +30 -0
- package/dist/components/templates/GroupFormTemplate.svelte.d.ts +14 -0
- package/dist/components/templates/MonitorTemplate.svelte +39 -0
- package/dist/components/templates/MonitorTemplate.svelte.d.ts +15 -0
- package/dist/components/templates/ProfileTemplate.svelte +30 -0
- package/dist/components/templates/ProfileTemplate.svelte.d.ts +14 -0
- package/dist/components/templates/ResultTemplate.svelte +39 -0
- package/dist/components/templates/ResultTemplate.svelte.d.ts +14 -0
- package/dist/components/templates/SearchTableTemplate.svelte +31 -0
- package/dist/components/templates/SearchTableTemplate.svelte.d.ts +15 -0
- package/dist/components/templates/StepFormTemplate.svelte +62 -0
- package/dist/components/templates/StepFormTemplate.svelte.d.ts +23 -0
- package/dist/components/templates/TemplatePageShell.svelte +109 -0
- package/dist/components/templates/TemplatePageShell.svelte.d.ts +20 -0
- package/dist/components/templates/WorkplaceTemplate.svelte +34 -0
- package/dist/components/templates/WorkplaceTemplate.svelte.d.ts +16 -0
- package/dist/components/templates/index.d.ts +16 -0
- package/dist/components/templates/index.js +16 -0
- package/dist/design-system-components.d.ts +64 -0
- package/dist/design-system-components.js +72 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +17 -0
- package/dist/ui-preferences.svelte.d.ts +19 -0
- package/dist/ui-preferences.svelte.js +69 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ Use the business page layer as the default customer API:
|
|
|
53
53
|
- `PagePattern` for custom list, form, detail, workspace, and dashboard pages.
|
|
54
54
|
- `AppShellPage` for hosts that bring their own router: sidebar, topbar, primary
|
|
55
55
|
region, optional secondary column and footer, with no data or router coupling.
|
|
56
|
-
- `FilterToolbar`, `AutoTable`, `SavedViewsMenu`, `ListPagination`, `ListFooter`, `AutoForm`, `DetailDrawer`,
|
|
56
|
+
- `FilterToolbar`, `AutoTable`, `SavedViewsMenu`, `ListPagination`, `ListFooter`, `DataTableShell`, `ScrollableTable`, `CopyButton`, `AutoForm`, `DetailDrawer`,
|
|
57
57
|
`RowActions`, and `DataState` for the recurring work patterns inside those
|
|
58
58
|
pages.
|
|
59
59
|
|
package/dist/app.css
CHANGED
|
@@ -5531,7 +5531,9 @@
|
|
|
5531
5531
|
--text-2xl--line-height: calc(2 / 1.5);
|
|
5532
5532
|
--font-weight-medium: 500;
|
|
5533
5533
|
--font-weight-semibold: 600;
|
|
5534
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
5534
5535
|
--radius-md: calc(var(--radius) - 2px);
|
|
5536
|
+
--radius-lg: var(--radius);
|
|
5535
5537
|
--drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);
|
|
5536
5538
|
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
5537
5539
|
--default-transition-duration: 150ms;
|
|
@@ -11475,6 +11477,103 @@ details[data-svadmin-filter][open] > :not(summary),
|
|
|
11475
11477
|
}
|
|
11476
11478
|
}
|
|
11477
11479
|
|
|
11480
|
+
/* --- Runtime shell preferences --- */
|
|
11481
|
+
:root[data-svadmin-radius='compact'] {
|
|
11482
|
+
--radius: 0.125rem;
|
|
11483
|
+
}
|
|
11484
|
+
|
|
11485
|
+
:root[data-svadmin-radius='rounded'] {
|
|
11486
|
+
--radius: 0.75rem;
|
|
11487
|
+
}
|
|
11488
|
+
|
|
11489
|
+
:root[data-svadmin-radius='compact'] .svadmin-button,
|
|
11490
|
+
:root[data-svadmin-radius='compact'] [data-slot='button'] {
|
|
11491
|
+
border-radius: var(--radius-sm);
|
|
11492
|
+
}
|
|
11493
|
+
|
|
11494
|
+
.svadmin-compact-density :is([data-svadmin-main], [data-svadmin-sidebar]) {
|
|
11495
|
+
font-size: var(--svadmin-text-label);
|
|
11496
|
+
}
|
|
11497
|
+
|
|
11498
|
+
.svadmin-compact-density :is([data-slot='button'], .svadmin-button, .svadmin-input, [data-slot='input'], [data-slot='select-trigger']) {
|
|
11499
|
+
min-height: calc(var(--svadmin-control-h) - 0.25rem);
|
|
11500
|
+
height: auto;
|
|
11501
|
+
}
|
|
11502
|
+
|
|
11503
|
+
.svadmin-compact-density :is(.svadmin-table-head, .svadmin-table-cell, .svadmin-table-row) {
|
|
11504
|
+
height: calc(var(--svadmin-row-h) - 0.25rem);
|
|
11505
|
+
}
|
|
11506
|
+
|
|
11507
|
+
.svadmin-compact-density .svadmin-table-head {
|
|
11508
|
+
height: calc(var(--svadmin-table-head-h) - 0.25rem);
|
|
11509
|
+
}
|
|
11510
|
+
|
|
11511
|
+
.svadmin-color-weak [data-slot='badge'],
|
|
11512
|
+
.svadmin-color-weak [data-svadmin-status] {
|
|
11513
|
+
border: 1px solid currentColor;
|
|
11514
|
+
font-weight: 600;
|
|
11515
|
+
}
|
|
11516
|
+
|
|
11517
|
+
.svadmin-color-weak :is([data-positive='true'], [data-tone='success'], [data-status='success']) {
|
|
11518
|
+
text-decoration: underline;
|
|
11519
|
+
text-decoration-thickness: 0.125rem;
|
|
11520
|
+
text-underline-offset: 0.15em;
|
|
11521
|
+
}
|
|
11522
|
+
|
|
11523
|
+
.svadmin-page-transition [data-svadmin-main] > div > div {
|
|
11524
|
+
animation: svadmin-page-enter 160ms ease-out;
|
|
11525
|
+
}
|
|
11526
|
+
|
|
11527
|
+
@keyframes svadmin-page-enter {
|
|
11528
|
+
from {
|
|
11529
|
+
opacity: 0;
|
|
11530
|
+
transform: translateY(0.25rem);
|
|
11531
|
+
}
|
|
11532
|
+
to {
|
|
11533
|
+
opacity: 1;
|
|
11534
|
+
transform: translateY(0);
|
|
11535
|
+
}
|
|
11536
|
+
}
|
|
11537
|
+
|
|
11538
|
+
[data-svadmin-navigation-theme='dark'] :is([data-svadmin-sidebar], [data-svadmin-topbar]) {
|
|
11539
|
+
--background: #17171a;
|
|
11540
|
+
--foreground: #e6e6e6;
|
|
11541
|
+
--card: #232324;
|
|
11542
|
+
--muted: #2a2a2b;
|
|
11543
|
+
--muted-foreground: #b3b3b3;
|
|
11544
|
+
--border: #484849;
|
|
11545
|
+
--sidebar: #17171a;
|
|
11546
|
+
--sidebar-foreground: #e6e6e6;
|
|
11547
|
+
--sidebar-border: #484849;
|
|
11548
|
+
color: var(--foreground);
|
|
11549
|
+
background: var(--sidebar);
|
|
11550
|
+
border-color: var(--border);
|
|
11551
|
+
}
|
|
11552
|
+
|
|
11553
|
+
[data-svadmin-navigation='top'] [data-svadmin-main] {
|
|
11554
|
+
padding-block-start: var(--svadmin-space-4);
|
|
11555
|
+
}
|
|
11556
|
+
|
|
11557
|
+
[data-svadmin-navigation='mix'] .svadmin-top-navigation,
|
|
11558
|
+
[data-svadmin-navigation='top'] .svadmin-top-navigation {
|
|
11559
|
+
background: color-mix(in srgb, var(--background) 94%, var(--card));
|
|
11560
|
+
}
|
|
11561
|
+
|
|
11562
|
+
.svadmin-reduced-motion *,
|
|
11563
|
+
.svadmin-reduced-motion *::before,
|
|
11564
|
+
.svadmin-reduced-motion *::after {
|
|
11565
|
+
scroll-behavior: auto !important;
|
|
11566
|
+
animation-duration: 0.001ms !important;
|
|
11567
|
+
animation-iteration-count: 1 !important;
|
|
11568
|
+
transition-duration: 0.001ms !important;
|
|
11569
|
+
}
|
|
11570
|
+
|
|
11571
|
+
@media (prefers-reduced-motion: reduce) {
|
|
11572
|
+
.svadmin-page-transition [data-svadmin-main] > div > div {
|
|
11573
|
+
animation: none;
|
|
11574
|
+
}
|
|
11575
|
+
}
|
|
11576
|
+
|
|
11478
11577
|
:root,
|
|
11479
11578
|
.svadmin-theme{
|
|
11480
11579
|
--color-background: var(--background);
|
package/dist/app.theme.css
CHANGED
|
@@ -5531,7 +5531,9 @@
|
|
|
5531
5531
|
--text-2xl--line-height: calc(2 / 1.5);
|
|
5532
5532
|
--font-weight-medium: 500;
|
|
5533
5533
|
--font-weight-semibold: 600;
|
|
5534
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
5534
5535
|
--radius-md: calc(var(--radius) - 2px);
|
|
5536
|
+
--radius-lg: var(--radius);
|
|
5535
5537
|
--drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);
|
|
5536
5538
|
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
5537
5539
|
--default-transition-duration: 150ms;
|
|
@@ -11475,6 +11477,103 @@ details[data-svadmin-filter][open] > :not(summary),
|
|
|
11475
11477
|
}
|
|
11476
11478
|
}
|
|
11477
11479
|
|
|
11480
|
+
/* --- Runtime shell preferences --- */
|
|
11481
|
+
:root[data-svadmin-radius='compact'] {
|
|
11482
|
+
--radius: 0.125rem;
|
|
11483
|
+
}
|
|
11484
|
+
|
|
11485
|
+
:root[data-svadmin-radius='rounded'] {
|
|
11486
|
+
--radius: 0.75rem;
|
|
11487
|
+
}
|
|
11488
|
+
|
|
11489
|
+
:root[data-svadmin-radius='compact'] .svadmin-button,
|
|
11490
|
+
:root[data-svadmin-radius='compact'] [data-slot='button'] {
|
|
11491
|
+
border-radius: var(--radius-sm);
|
|
11492
|
+
}
|
|
11493
|
+
|
|
11494
|
+
.svadmin-compact-density :is([data-svadmin-main], [data-svadmin-sidebar]) {
|
|
11495
|
+
font-size: var(--svadmin-text-label);
|
|
11496
|
+
}
|
|
11497
|
+
|
|
11498
|
+
.svadmin-compact-density :is([data-slot='button'], .svadmin-button, .svadmin-input, [data-slot='input'], [data-slot='select-trigger']) {
|
|
11499
|
+
min-height: calc(var(--svadmin-control-h) - 0.25rem);
|
|
11500
|
+
height: auto;
|
|
11501
|
+
}
|
|
11502
|
+
|
|
11503
|
+
.svadmin-compact-density :is(.svadmin-table-head, .svadmin-table-cell, .svadmin-table-row) {
|
|
11504
|
+
height: calc(var(--svadmin-row-h) - 0.25rem);
|
|
11505
|
+
}
|
|
11506
|
+
|
|
11507
|
+
.svadmin-compact-density .svadmin-table-head {
|
|
11508
|
+
height: calc(var(--svadmin-table-head-h) - 0.25rem);
|
|
11509
|
+
}
|
|
11510
|
+
|
|
11511
|
+
.svadmin-color-weak [data-slot='badge'],
|
|
11512
|
+
.svadmin-color-weak [data-svadmin-status] {
|
|
11513
|
+
border: 1px solid currentColor;
|
|
11514
|
+
font-weight: 600;
|
|
11515
|
+
}
|
|
11516
|
+
|
|
11517
|
+
.svadmin-color-weak :is([data-positive='true'], [data-tone='success'], [data-status='success']) {
|
|
11518
|
+
text-decoration: underline;
|
|
11519
|
+
text-decoration-thickness: 0.125rem;
|
|
11520
|
+
text-underline-offset: 0.15em;
|
|
11521
|
+
}
|
|
11522
|
+
|
|
11523
|
+
.svadmin-page-transition [data-svadmin-main] > div > div {
|
|
11524
|
+
animation: svadmin-page-enter 160ms ease-out;
|
|
11525
|
+
}
|
|
11526
|
+
|
|
11527
|
+
@keyframes svadmin-page-enter {
|
|
11528
|
+
from {
|
|
11529
|
+
opacity: 0;
|
|
11530
|
+
transform: translateY(0.25rem);
|
|
11531
|
+
}
|
|
11532
|
+
to {
|
|
11533
|
+
opacity: 1;
|
|
11534
|
+
transform: translateY(0);
|
|
11535
|
+
}
|
|
11536
|
+
}
|
|
11537
|
+
|
|
11538
|
+
[data-svadmin-navigation-theme='dark'] :is([data-svadmin-sidebar], [data-svadmin-topbar]) {
|
|
11539
|
+
--background: #17171a;
|
|
11540
|
+
--foreground: #e6e6e6;
|
|
11541
|
+
--card: #232324;
|
|
11542
|
+
--muted: #2a2a2b;
|
|
11543
|
+
--muted-foreground: #b3b3b3;
|
|
11544
|
+
--border: #484849;
|
|
11545
|
+
--sidebar: #17171a;
|
|
11546
|
+
--sidebar-foreground: #e6e6e6;
|
|
11547
|
+
--sidebar-border: #484849;
|
|
11548
|
+
color: var(--foreground);
|
|
11549
|
+
background: var(--sidebar);
|
|
11550
|
+
border-color: var(--border);
|
|
11551
|
+
}
|
|
11552
|
+
|
|
11553
|
+
[data-svadmin-navigation='top'] [data-svadmin-main] {
|
|
11554
|
+
padding-block-start: var(--svadmin-space-4);
|
|
11555
|
+
}
|
|
11556
|
+
|
|
11557
|
+
[data-svadmin-navigation='mix'] .svadmin-top-navigation,
|
|
11558
|
+
[data-svadmin-navigation='top'] .svadmin-top-navigation {
|
|
11559
|
+
background: color-mix(in srgb, var(--background) 94%, var(--card));
|
|
11560
|
+
}
|
|
11561
|
+
|
|
11562
|
+
.svadmin-reduced-motion *,
|
|
11563
|
+
.svadmin-reduced-motion *::before,
|
|
11564
|
+
.svadmin-reduced-motion *::after {
|
|
11565
|
+
scroll-behavior: auto !important;
|
|
11566
|
+
animation-duration: 0.001ms !important;
|
|
11567
|
+
animation-iteration-count: 1 !important;
|
|
11568
|
+
transition-duration: 0.001ms !important;
|
|
11569
|
+
}
|
|
11570
|
+
|
|
11571
|
+
@media (prefers-reduced-motion: reduce) {
|
|
11572
|
+
.svadmin-page-transition [data-svadmin-main] > div > div {
|
|
11573
|
+
animation: none;
|
|
11574
|
+
}
|
|
11575
|
+
}
|
|
11576
|
+
|
|
11478
11577
|
:root,
|
|
11479
11578
|
.svadmin-theme{
|
|
11480
11579
|
--color-background: var(--background);
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
const resources = $derived(adminContext.resources.filter((resource) => resource.meta?.['aboutVisible'] !== false));
|
|
12
12
|
const providerNames = $derived(adminContext.getDataProviderNames());
|
|
13
13
|
let { version: suppliedVersion, headingLevel = 'h1' }: { version?: string; headingLevel?: 'h1' | 'h2' } = $props();
|
|
14
|
-
const buildVersion = "0.
|
|
14
|
+
const buildVersion = "0.102.0";
|
|
15
15
|
const version = $derived(suppliedVersion ?? (
|
|
16
16
|
buildVersion.startsWith('__')
|
|
17
17
|
? (i18n.locale === 'zh-CN' ? '开发构建(未提供版本)' : 'Development build (version unavailable)')
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
import type { MfaEnrollmentProvider } from './TwoFactorAuthPage.svelte';
|
|
101
101
|
import type { NotificationPreferencesProvider } from './NotificationsSettings.svelte';
|
|
102
102
|
import type { MemberDirectoryProvider } from './account/MemberDirectory.svelte';
|
|
103
|
+
import type { NotificationItem } from './NotificationCenter.svelte';
|
|
103
104
|
|
|
104
105
|
interface Props {
|
|
105
106
|
mfaEnrollmentProvider?: MfaEnrollmentProvider;
|
|
@@ -139,6 +140,12 @@
|
|
|
139
140
|
dashboard?: Snippet;
|
|
140
141
|
/** Optional AI assistant rendered by Layout. Keep AI UI in @svadmin/ai-elements. */
|
|
141
142
|
aiAssistant?: Snippet<[LayoutAIAssistantProps]>;
|
|
143
|
+
/** Header notification items. Omit to render an empty built-in center. */
|
|
144
|
+
notifications?: NotificationItem[];
|
|
145
|
+
notificationUnreadCount?: number;
|
|
146
|
+
onnotificationread?: (item: NotificationItem) => void | Promise<void>;
|
|
147
|
+
onnotificationreadall?: () => void | Promise<void>;
|
|
148
|
+
onnotificationopen?: (item: NotificationItem) => void | Promise<void>;
|
|
142
149
|
loginPage?: Snippet;
|
|
143
150
|
/** Prefill and display credentials on the default login page, useful for demos/examples. */
|
|
144
151
|
loginDefaults?: {
|
|
@@ -200,6 +207,11 @@
|
|
|
200
207
|
themeConfig: userThemeConfig,
|
|
201
208
|
dashboard,
|
|
202
209
|
aiAssistant,
|
|
210
|
+
notifications,
|
|
211
|
+
notificationUnreadCount,
|
|
212
|
+
onnotificationread,
|
|
213
|
+
onnotificationreadall,
|
|
214
|
+
onnotificationopen,
|
|
203
215
|
loginPage,
|
|
204
216
|
loginDefaults,
|
|
205
217
|
components: userComponents,
|
|
@@ -600,7 +612,7 @@
|
|
|
600
612
|
<ErrorComp status={standaloneErrorStatus} />
|
|
601
613
|
</SystemPageShell>
|
|
602
614
|
{:else if isAuthenticated || !resolvedAuthProvider}
|
|
603
|
-
<Layout {title} {...definedOptions({ "menu": menu })} {...definedOptions({ "siteUrl": siteUrl })} routeMode={resolvedRouteMode} {...definedOptions({ "aiAssistant": aiAssistant })}>
|
|
615
|
+
<Layout {title} {...definedOptions({ "menu": menu })} {...definedOptions({ "siteUrl": siteUrl })} {...definedOptions({ "notifications": notifications, "notificationUnreadCount": notificationUnreadCount, "onnotificationread": onnotificationread, "onnotificationreadall": onnotificationreadall, "onnotificationopen": onnotificationopen })} routeMode={resolvedRouteMode} {...definedOptions({ "aiAssistant": aiAssistant })}>
|
|
604
616
|
<div class="svadmin-u-d89972fe17d6 svadmin-u-8a7a926578c8" aria-busy={authRechecking}>
|
|
605
617
|
{#if authRechecking}
|
|
606
618
|
<div class="svadmin-u-da4dbfbc4fdc svadmin-u-7b7df0449b80 svadmin-u-236812d64c82 svadmin-u-60fbb7713999 svadmin-u-8a7a926578c8 svadmin-u-3960ffc248d9 svadmin-u-86843cf1e227 svadmin-u-d542b60b5312" role="status" aria-live="polite">
|
|
@@ -17,6 +17,7 @@ import type { AdminProviderBundle } from '../types.js';
|
|
|
17
17
|
import type { MfaEnrollmentProvider } from './TwoFactorAuthPage.svelte';
|
|
18
18
|
import type { NotificationPreferencesProvider } from './NotificationsSettings.svelte';
|
|
19
19
|
import type { MemberDirectoryProvider } from './account/MemberDirectory.svelte';
|
|
20
|
+
import type { NotificationItem } from './NotificationCenter.svelte';
|
|
20
21
|
interface Props {
|
|
21
22
|
mfaEnrollmentProvider?: MfaEnrollmentProvider;
|
|
22
23
|
notificationPreferencesProvider?: NotificationPreferencesProvider;
|
|
@@ -55,6 +56,12 @@ interface Props {
|
|
|
55
56
|
dashboard?: Snippet;
|
|
56
57
|
/** Optional AI assistant rendered by Layout. Keep AI UI in @svadmin/ai-elements. */
|
|
57
58
|
aiAssistant?: Snippet<[LayoutAIAssistantProps]>;
|
|
59
|
+
/** Header notification items. Omit to render an empty built-in center. */
|
|
60
|
+
notifications?: NotificationItem[];
|
|
61
|
+
notificationUnreadCount?: number;
|
|
62
|
+
onnotificationread?: (item: NotificationItem) => void | Promise<void>;
|
|
63
|
+
onnotificationreadall?: () => void | Promise<void>;
|
|
64
|
+
onnotificationopen?: (item: NotificationItem) => void | Promise<void>;
|
|
58
65
|
loginPage?: Snippet;
|
|
59
66
|
/** Prefill and display credentials on the default login page, useful for demos/examples. */
|
|
60
67
|
loginDefaults?: {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
import { cn } from '../utils.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
top?: number;
|
|
8
|
+
bottom?: number;
|
|
9
|
+
target?: string;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let { top = 16, bottom, target = 'window', children, class: className = '' }: Props = $props();
|
|
15
|
+
let stuck = $state(false);
|
|
16
|
+
let sentinel: HTMLDivElement | undefined;
|
|
17
|
+
let observer: IntersectionObserver | undefined;
|
|
18
|
+
|
|
19
|
+
onMount(() => {
|
|
20
|
+
if (!sentinel) return;
|
|
21
|
+
observer = new IntersectionObserver(([entry]) => {
|
|
22
|
+
if (entry) stuck = !entry.isIntersecting;
|
|
23
|
+
}, { root: target === 'window' ? null : document.querySelector(target), rootMargin: `-${top}px 0px 0px 0px`, threshold: [0] });
|
|
24
|
+
observer.observe(sentinel);
|
|
25
|
+
return () => observer?.disconnect();
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div bind:this={sentinel} aria-hidden="true" class="svadmin-affix__sentinel"></div>
|
|
30
|
+
<div
|
|
31
|
+
class={cn('svadmin-affix', className)}
|
|
32
|
+
class:is-stuck={stuck}
|
|
33
|
+
style:top={`${top}px`}
|
|
34
|
+
style:bottom={bottom === undefined ? undefined : `${bottom}px`}
|
|
35
|
+
>
|
|
36
|
+
{@render children()}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.svadmin-affix__sentinel { height: 1px; }
|
|
41
|
+
.svadmin-affix { position: sticky; z-index: 10; }
|
|
42
|
+
.svadmin-affix.is-stuck { box-shadow: var(--svadmin-shadow-surface); }
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
top?: number;
|
|
4
|
+
bottom?: number;
|
|
5
|
+
target?: string;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Affix: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Affix = ReturnType<typeof Affix>;
|
|
11
|
+
export default Affix;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, untrack } from 'svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
export interface AnchorItem {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
level?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
items: AnchorItem[];
|
|
13
|
+
offset?: number;
|
|
14
|
+
label?: string;
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let { items, offset = 96, label = 'On this page', class: className = '' }: Props = $props();
|
|
19
|
+
let active = $state(untrack(() => items[0]?.id ?? ''));
|
|
20
|
+
let observer: IntersectionObserver | undefined;
|
|
21
|
+
|
|
22
|
+
onMount(() => {
|
|
23
|
+
const elements = items.map((item) => document.getElementById(item.id)).filter((value): value is HTMLElement => Boolean(value));
|
|
24
|
+
if (elements.length === 0) return;
|
|
25
|
+
observer = new IntersectionObserver((entries) => {
|
|
26
|
+
const visible = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
|
|
27
|
+
if (visible[0]?.target.id) active = visible[0].target.id;
|
|
28
|
+
}, { rootMargin: `-${offset}px 0px -65% 0px`, threshold: [0, 1] });
|
|
29
|
+
for (const element of elements) observer.observe(element);
|
|
30
|
+
return () => observer?.disconnect();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function jump(id: string): void {
|
|
34
|
+
const target = document.getElementById(id);
|
|
35
|
+
if (!target) return;
|
|
36
|
+
const top = target.getBoundingClientRect().top + window.scrollY - offset;
|
|
37
|
+
window.scrollTo({ top, behavior: 'smooth' });
|
|
38
|
+
active = id;
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<nav class={cn('svadmin-anchor', className)} aria-label={label}>
|
|
43
|
+
<p class="svadmin-anchor__title">{label}</p>
|
|
44
|
+
<ul>
|
|
45
|
+
{#each items as item (item.id)}
|
|
46
|
+
<li style:padding-inline-start={`${Math.max(0, (item.level ?? 1) - 1) * 0.75}rem`}>
|
|
47
|
+
<button type="button" class:is-active={active === item.id} aria-current={active === item.id ? 'location' : undefined} onclick={() => jump(item.id)}>{item.label}</button>
|
|
48
|
+
</li>
|
|
49
|
+
{/each}
|
|
50
|
+
</ul>
|
|
51
|
+
</nav>
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
.svadmin-anchor { display: grid; gap: var(--svadmin-space-2); min-width: 0; }
|
|
55
|
+
.svadmin-anchor__title { margin: 0; color: var(--muted-foreground); font-size: var(--svadmin-text-caption); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
56
|
+
.svadmin-anchor ul { display: grid; gap: var(--svadmin-space-1); margin: 0; padding: 0; list-style: none; }
|
|
57
|
+
.svadmin-anchor button { width: 100%; padding: var(--svadmin-space-1) var(--svadmin-space-2); border: 0; border-inline-start: 2px solid transparent; background: transparent; color: var(--muted-foreground); font-size: var(--svadmin-text-label); text-align: start; cursor: pointer; }
|
|
58
|
+
.svadmin-anchor button:hover, .svadmin-anchor button:focus-visible { color: var(--foreground); background: var(--accent); outline: none; }
|
|
59
|
+
.svadmin-anchor button.is-active { border-inline-start-color: var(--primary); color: var(--primary); font-weight: 600; }
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface AnchorItem {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
level?: number;
|
|
5
|
+
}
|
|
6
|
+
interface Props {
|
|
7
|
+
items: AnchorItem[];
|
|
8
|
+
offset?: number;
|
|
9
|
+
label?: string;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const Anchor: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type Anchor = ReturnType<typeof Anchor>;
|
|
14
|
+
export default Anchor;
|
|
@@ -138,6 +138,12 @@
|
|
|
138
138
|
emptyState?: Snippet;
|
|
139
139
|
/** Expandable row content */
|
|
140
140
|
expandedRowRender?: Snippet<[{ record: Record<string, unknown> }]>;
|
|
141
|
+
/** 受控展开行 ID;提供后内部展开状态只读。 */
|
|
142
|
+
expandedRowKeys?: (string | number)[];
|
|
143
|
+
/** 非受控模式下的初始展开行 ID。 */
|
|
144
|
+
defaultExpandedRowKeys?: (string | number)[];
|
|
145
|
+
/** 展开状态变化回调,参数为记录 ID。 */
|
|
146
|
+
onExpandedRowsChange?: (keys: (string | number)[]) => void;
|
|
141
147
|
/** Externally controlled pagination */
|
|
142
148
|
pagination?: { current: number; pageSize: number };
|
|
143
149
|
/** Externally controlled sorters */
|
|
@@ -184,6 +190,9 @@
|
|
|
184
190
|
rowActions,
|
|
185
191
|
emptyState,
|
|
186
192
|
expandedRowRender,
|
|
193
|
+
expandedRowKeys,
|
|
194
|
+
defaultExpandedRowKeys,
|
|
195
|
+
onExpandedRowsChange,
|
|
187
196
|
batchActions,
|
|
188
197
|
summary,
|
|
189
198
|
pagination: externalPagination,
|
|
@@ -492,7 +501,9 @@
|
|
|
492
501
|
const selectedIds = $derived(selectionModel.selectedIds);
|
|
493
502
|
const selectedCount = $derived(selectionModel.selectedCount);
|
|
494
503
|
const { rowIsSelected } = selectionModel;
|
|
495
|
-
const expandedAtom = createAtom<ExpandedState>(
|
|
504
|
+
const expandedAtom = createAtom<ExpandedState>(
|
|
505
|
+
Object.fromEntries((untrack(() => defaultExpandedRowKeys) ?? []).map((id) => [tableRowKey(id), true])),
|
|
506
|
+
);
|
|
496
507
|
const features = tableFeatures({
|
|
497
508
|
columnOrderingFeature,
|
|
498
509
|
columnSizingFeature,
|
|
@@ -509,11 +520,25 @@
|
|
|
509
520
|
return preferenceIdentityReady && loadedPreferenceScopeId === listPreferenceScopeId(listPreferenceScope);
|
|
510
521
|
}
|
|
511
522
|
|
|
523
|
+
/** 受控时以外部 ID 为准;空数组同样表示受控且全部收起。 */
|
|
524
|
+
const controlledExpandedKeys = $derived(
|
|
525
|
+
expandedRowKeys ? new Set(expandedRowKeys.map((id) => tableRowKey(id))) : undefined,
|
|
526
|
+
);
|
|
527
|
+
|
|
512
528
|
function rowIsExpanded(rowId: string): boolean {
|
|
529
|
+
if (controlledExpandedKeys) return controlledExpandedKeys.has(rowId);
|
|
513
530
|
const expanded = tableExpanded.current;
|
|
514
531
|
return expanded === true || expanded[rowId] === true;
|
|
515
532
|
}
|
|
516
533
|
|
|
534
|
+
function expandedRecordIds(): (string | number)[] {
|
|
535
|
+
if (expandedRowKeys !== undefined) return [...expandedRowKeys];
|
|
536
|
+
const current = tableExpanded.current;
|
|
537
|
+
const rows = table_getRowModel(tbl).flatRows;
|
|
538
|
+
if (current === true) return rows.map((row) => row.original.id);
|
|
539
|
+
return rows.filter((row) => current[row.id]).map((row) => row.original.id);
|
|
540
|
+
}
|
|
541
|
+
|
|
517
542
|
function rowIdValue(row: Row<TableFeatures, TableRecord>): string | number {
|
|
518
543
|
return row.original.id;
|
|
519
544
|
}
|
|
@@ -769,22 +794,16 @@
|
|
|
769
794
|
});
|
|
770
795
|
|
|
771
796
|
function toggleRowExpanded(rowId: string): void {
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
}
|
|
781
|
-
if (current[rowId]) {
|
|
782
|
-
expandedAtom.set(Object.fromEntries(
|
|
783
|
-
Object.entries(current).filter(([id, isExpanded]) => id !== rowId && isExpanded)
|
|
784
|
-
));
|
|
785
|
-
return;
|
|
797
|
+
const row = table_getRowModel(tbl).flatRows.find((candidate) => candidate.id === rowId);
|
|
798
|
+
const recordId = row?.original.id;
|
|
799
|
+
if (recordId === undefined) return;
|
|
800
|
+
const nextIds = rowIsExpanded(rowId)
|
|
801
|
+
? expandedRecordIds().filter((id) => tableRowKey(id) !== rowId)
|
|
802
|
+
: [...expandedRecordIds(), recordId];
|
|
803
|
+
if (expandedRowKeys === undefined) {
|
|
804
|
+
expandedAtom.set(Object.fromEntries(nextIds.map((id) => [tableRowKey(id), true])));
|
|
786
805
|
}
|
|
787
|
-
|
|
806
|
+
onExpandedRowsChange?.(nextIds);
|
|
788
807
|
}
|
|
789
808
|
|
|
790
809
|
const totalPages = $derived(canRead && pageRecords.ok && !query.isError
|
|
@@ -49,6 +49,12 @@ interface Props {
|
|
|
49
49
|
expandedRowRender?: Snippet<[{
|
|
50
50
|
record: Record<string, unknown>;
|
|
51
51
|
}]>;
|
|
52
|
+
/** 受控展开行 ID;提供后内部展开状态只读。 */
|
|
53
|
+
expandedRowKeys?: (string | number)[];
|
|
54
|
+
/** 非受控模式下的初始展开行 ID。 */
|
|
55
|
+
defaultExpandedRowKeys?: (string | number)[];
|
|
56
|
+
/** 展开状态变化回调,参数为记录 ID。 */
|
|
57
|
+
onExpandedRowsChange?: (keys: (string | number)[]) => void;
|
|
52
58
|
/** Externally controlled pagination */
|
|
53
59
|
pagination?: {
|
|
54
60
|
current: number;
|