@svadmin/ui 0.91.0 → 0.92.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.
@@ -183,6 +183,8 @@
183
183
  get dataProviderName() { return binding.dataProviderName; },
184
184
  get redirect() { return redirect; },
185
185
  warnWhenUnsavedChanges: true,
186
+ // 失败已经显示在表单内,不再额外弹一条相同的 toast。
187
+ errorNotification: false,
186
188
  get validate() { return validator; },
187
189
  get onMutationSuccess() {
188
190
  const callback = onSuccess;
@@ -1148,7 +1148,12 @@
1148
1148
 
1149
1149
  {#snippet defaultEmptyState()}
1150
1150
  {@const hasCriteria = !!(searchText.trim() || appliedSearchText.trim() || activeFilterCount > 0)}
1151
- <DataState state={hasCriteria ? 'filtered-empty' : 'empty'} description={i18n.t(hasCriteria ? 'empty.description' : 'common.noDataHint')}>
1151
+ <DataState
1152
+ state={hasCriteria ? 'filtered-empty' : 'empty'}
1153
+ description={i18n.t(hasCriteria
1154
+ ? 'empty.description'
1155
+ : canCreate ? 'common.noDataHint' : 'common.noData')}
1156
+ >
1152
1157
  {#snippet action()}
1153
1158
  {#if hasCriteria}
1154
1159
  <Button variant="outline" size="sm" onclick={clearFilters}>
@@ -82,6 +82,8 @@
82
82
  get dataProviderName() { return binding.dataProviderName; },
83
83
  redirect: 'list',
84
84
  warnWhenUnsavedChanges: true,
85
+ // 失败已经显示在当前步骤内,不再额外弹一条相同的 toast。
86
+ errorNotification: false,
85
87
  get validate() { return validator; },
86
88
  get onMutationSuccess() {
87
89
  const callback = onSuccess;
@@ -16,14 +16,25 @@
16
16
  import UndoableNotification from './UndoableNotification.svelte';
17
17
 
18
18
  let host = $state<ToastHostRegistration | null>(null);
19
+ let sheetOpen = $state(false);
19
20
  const isActiveHost = $derived(host?.isActive() ?? false);
20
21
  const theme = $derived(getResolvedTheme() === 'dark' ? 'dark' : 'light');
22
+ const toastPosition = $derived<'top-right' | 'bottom-left'>(sheetOpen ? 'bottom-left' : 'top-right');
21
23
 
22
24
  onMount(() => {
25
+ const syncSheetState = (): void => {
26
+ sheetOpen = document.querySelector('.svadmin-sheet-panel') !== null;
27
+ };
28
+ syncSheetState();
29
+ const sheetObserver = new MutationObserver(syncSheetState);
30
+ sheetObserver.observe(document.body, { childList: true, subtree: true });
23
31
  const registration = registerToastHost();
24
32
  host = registration;
25
33
 
26
- return () => registration.unregister();
34
+ return () => {
35
+ sheetObserver.disconnect();
36
+ registration.unregister();
37
+ };
27
38
  });
28
39
 
29
40
  $effect(() => {
@@ -55,7 +66,7 @@
55
66
  });
56
67
 
57
68
  const toasterProps = $derived({
58
- position: "top-right",
69
+ position: toastPosition,
59
70
  richColors: true,
60
71
  closeButton: true,
61
72
  expand: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ui",
3
- "version": "0.91.0",
3
+ "version": "0.92.0",
4
4
  "description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -88,7 +88,7 @@
88
88
  "@codemirror/lang-json": "^6.0.0",
89
89
  "@codemirror/lang-markdown": "^6.0.0",
90
90
  "@codemirror/lang-sql": "^6.0.0",
91
- "@svadmin/core": "^0.65.0",
91
+ "@svadmin/core": "^0.66.0",
92
92
  "@tanstack/svelte-query": "^6.1.48",
93
93
  "codemirror": "^6.0.0",
94
94
  "isomorphic-dompurify": "^3.23.0",
@@ -139,7 +139,7 @@
139
139
  }
140
140
  },
141
141
  "dependencies": {
142
- "@svadmin/devtools": "^0.3.6",
142
+ "@svadmin/devtools": "^0.3.7",
143
143
  "@svadmin/devtools-contract": "^0.3.0",
144
144
  "@vibeunion/devtools-devframe": "^0.1.0",
145
145
  "typebox": "^1.3.34",
@@ -177,7 +177,7 @@
177
177
  "@codemirror/lang-markdown": "^6.5.2",
178
178
  "@codemirror/lang-sql": "^6.10.0",
179
179
  "@happy-dom/global-registrator": "^20.11.12",
180
- "@svadmin/ai-elements": "^0.12.3",
180
+ "@svadmin/ai-elements": "^0.12.4",
181
181
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
182
182
  "@tailwindcss/cli": "4.3.3",
183
183
  "@testing-library/dom": "^10.4.1",