@svadmin/ui 0.96.1 → 0.99.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 +563 -190
- package/dist/app.theme.css +563 -190
- package/dist/components/AboutSettings.svelte +2 -1
- package/dist/components/ApprovalCenter.svelte +3 -3
- package/dist/components/AutoForm.svelte +2 -2
- package/dist/components/BackTop.svelte +20 -0
- package/dist/components/BackTop.svelte.d.ts +7 -0
- package/dist/components/FieldRenderer.svelte +1 -1
- package/dist/components/GanttChart.svelte +4 -4
- package/dist/components/ItemList.svelte +30 -0
- package/dist/components/ItemList.svelte.d.ts +13 -0
- package/dist/components/KanbanBoard.svelte +6 -6
- package/dist/components/Link.svelte +28 -0
- package/dist/components/Link.svelte.d.ts +11 -0
- package/dist/components/MoneyInput.svelte +51 -2
- package/dist/components/MoneyInput.svelte.d.ts +3 -0
- package/dist/components/Popconfirm.svelte +36 -0
- package/dist/components/Popconfirm.svelte.d.ts +11 -0
- package/dist/components/ResourceOperationsPage.svelte +1 -1
- package/dist/components/ResourceOverviewCard.svelte +1 -1
- package/dist/components/Result.svelte +22 -0
- package/dist/components/Result.svelte.d.ts +10 -0
- package/dist/components/Sidebar.svelte +1 -1
- package/dist/components/Spin.svelte +17 -0
- package/dist/components/Spin.svelte.d.ts +8 -0
- package/dist/components/Text.svelte +13 -0
- package/dist/components/Text.svelte.d.ts +8 -0
- package/dist/components/Tree.svelte +37 -0
- package/dist/components/Tree.svelte.d.ts +11 -0
- package/dist/components/Typography.svelte +17 -0
- package/dist/components/Typography.svelte.d.ts +9 -0
- package/dist/components/content/WorkspaceLayout.svelte +1 -1
- package/dist/components/list-state.svelte.d.ts +1 -1
- package/dist/components/list-state.svelte.js +4 -1
- package/dist/components/saved-list-views.d.ts +6 -0
- package/dist/components/saved-list-views.js +58 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.js +10 -1
- package/dist/recipes.d.ts +6 -0
- package/dist/recipes.js +5 -3
- package/package.json +5 -5
|
@@ -20,7 +20,7 @@ export function cloneListStateSnapshot(state) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
/** 将可恢复的查询快照收敛为持久化视图契约;分页可选字段在写入前补齐。 */
|
|
23
|
-
export function captureSavedListViewState(snapshot, columns, fallbackPageSize, density) {
|
|
23
|
+
export function captureSavedListViewState(snapshot, columns, fallbackPageSize, density, columnPinning) {
|
|
24
24
|
return {
|
|
25
25
|
search: snapshot.search,
|
|
26
26
|
filters: snapshot.filters.map(cloneListFilter),
|
|
@@ -32,6 +32,9 @@ export function captureSavedListViewState(snapshot, columns, fallbackPageSize, d
|
|
|
32
32
|
columnVisibility: { ...columns.columnVisibility },
|
|
33
33
|
columnOrder: [...columns.columnOrder],
|
|
34
34
|
...(density === undefined ? {} : { density }),
|
|
35
|
+
...(columnPinning === undefined ? {} : {
|
|
36
|
+
columnPinning: { left: [...columnPinning.left], right: [...columnPinning.right] },
|
|
37
|
+
}),
|
|
35
38
|
};
|
|
36
39
|
}
|
|
37
40
|
function editableValues(filters, fields) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Filter, Sort } from '@svadmin/core';
|
|
2
|
+
export interface SavedListViewColumnPinning {
|
|
3
|
+
left: string[];
|
|
4
|
+
right: string[];
|
|
5
|
+
}
|
|
2
6
|
export interface SavedListViewState {
|
|
3
7
|
search: string;
|
|
4
8
|
filters: Filter[];
|
|
@@ -11,6 +15,8 @@ export interface SavedListViewState {
|
|
|
11
15
|
columnOrder: string[];
|
|
12
16
|
/** 表格密度;旧视图缺失时沿用宿主当前密度。 */
|
|
13
17
|
density?: 'compact' | 'comfortable';
|
|
18
|
+
/** 冻结列;旧视图缺失时沿用宿主当前冻结列。 */
|
|
19
|
+
columnPinning?: SavedListViewColumnPinning;
|
|
14
20
|
}
|
|
15
21
|
export interface SavedListView {
|
|
16
22
|
id: string;
|
|
@@ -78,6 +78,41 @@ function parseColumnOrder(value, allowedColumnIds, pruned) {
|
|
|
78
78
|
}
|
|
79
79
|
return order;
|
|
80
80
|
}
|
|
81
|
+
function parseColumnPinning(value, allowedColumnIds, pruned) {
|
|
82
|
+
if (value === undefined)
|
|
83
|
+
return undefined;
|
|
84
|
+
if (!isRecord(value) || Object.keys(value).some(key => key !== 'left' && key !== 'right'))
|
|
85
|
+
return null;
|
|
86
|
+
const parseSide = (side) => {
|
|
87
|
+
if (side === undefined)
|
|
88
|
+
return [];
|
|
89
|
+
if (!Array.isArray(side))
|
|
90
|
+
return null;
|
|
91
|
+
const ids = [];
|
|
92
|
+
const seen = new Set();
|
|
93
|
+
for (const columnId of side) {
|
|
94
|
+
if (typeof columnId !== 'string')
|
|
95
|
+
return null;
|
|
96
|
+
if (!allowedColumnIds.has(columnId)) {
|
|
97
|
+
pruned.add(columnId);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (seen.has(columnId))
|
|
101
|
+
continue;
|
|
102
|
+
seen.add(columnId);
|
|
103
|
+
ids.push(columnId);
|
|
104
|
+
}
|
|
105
|
+
return ids;
|
|
106
|
+
};
|
|
107
|
+
const left = parseSide(value['left']);
|
|
108
|
+
const right = parseSide(value['right']);
|
|
109
|
+
if (!left || !right)
|
|
110
|
+
return null;
|
|
111
|
+
const rightIds = new Set(right);
|
|
112
|
+
if (left.some(columnId => rightIds.has(columnId)))
|
|
113
|
+
return null;
|
|
114
|
+
return { left, right };
|
|
115
|
+
}
|
|
81
116
|
function parseState(value, allowedColumnIds, pruned) {
|
|
82
117
|
if (!isRecord(value))
|
|
83
118
|
return undefined;
|
|
@@ -101,6 +136,9 @@ function parseState(value, allowedColumnIds, pruned) {
|
|
|
101
136
|
const density = value['density'] === undefined ? undefined : value['density'];
|
|
102
137
|
if (density !== undefined && density !== 'compact' && density !== 'comfortable')
|
|
103
138
|
return undefined;
|
|
139
|
+
const columnPinning = parseColumnPinning(value['columnPinning'], allowedColumnIds, pruned);
|
|
140
|
+
if (columnPinning === null)
|
|
141
|
+
return undefined;
|
|
104
142
|
return {
|
|
105
143
|
search: value['search'],
|
|
106
144
|
filters: filters,
|
|
@@ -112,6 +150,7 @@ function parseState(value, allowedColumnIds, pruned) {
|
|
|
112
150
|
columnVisibility,
|
|
113
151
|
columnOrder,
|
|
114
152
|
...(density === undefined ? {} : { density }),
|
|
153
|
+
...(columnPinning === undefined ? {} : { columnPinning }),
|
|
115
154
|
};
|
|
116
155
|
}
|
|
117
156
|
function parseAccess(value) {
|
|
@@ -250,10 +289,28 @@ export function decodeSavedListViewMutationResult(value, allowedColumnIds, expec
|
|
|
250
289
|
if (candidate['access'] !== undefined && !access)
|
|
251
290
|
return;
|
|
252
291
|
const state = candidate['state'];
|
|
253
|
-
if (!isRecord(state) || Object.keys(state).some(key => !['search', 'filters', 'sorters', 'pagination', 'columnVisibility', 'columnOrder', 'density'].includes(key)))
|
|
292
|
+
if (!isRecord(state) || Object.keys(state).some(key => !['search', 'filters', 'sorters', 'pagination', 'columnVisibility', 'columnOrder', 'density', 'columnPinning'].includes(key)))
|
|
254
293
|
return;
|
|
255
294
|
if (state['density'] !== undefined && state['density'] !== 'compact' && state['density'] !== 'comfortable')
|
|
256
295
|
return;
|
|
296
|
+
if (state['columnPinning'] !== undefined) {
|
|
297
|
+
const pinning = state['columnPinning'];
|
|
298
|
+
if (!isRecord(pinning) || Object.keys(pinning).some(key => key !== 'left' && key !== 'right'))
|
|
299
|
+
return;
|
|
300
|
+
const exactSide = (side) => {
|
|
301
|
+
if (!Array.isArray(side) || side.some(id => typeof id !== 'string' || !allowedColumnIds.has(id))
|
|
302
|
+
|| new Set(side).size !== side.length)
|
|
303
|
+
return;
|
|
304
|
+
return side;
|
|
305
|
+
};
|
|
306
|
+
const left = exactSide(pinning['left']);
|
|
307
|
+
const right = exactSide(pinning['right']);
|
|
308
|
+
if (!left || !right)
|
|
309
|
+
return;
|
|
310
|
+
const rightIds = new Set(right);
|
|
311
|
+
if (left.some(id => rightIds.has(id)))
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
257
314
|
if (!isRecord(state['pagination']) || Object.keys(state['pagination']).some(key => !['current', 'pageSize'].includes(key)))
|
|
258
315
|
return;
|
|
259
316
|
if (!isRecord(state['columnVisibility']) || Object.entries(state['columnVisibility'])
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export { default as Rate } from './components/Rate.svelte';
|
|
|
19
19
|
export { default as PivotExportButton } from './components/PivotExportButton.svelte';
|
|
20
20
|
export type { PivotCache } from '@svadmin/core/pivot';
|
|
21
21
|
export { decodeSavedListViewMutationResult, decodeSavedListViewRemoveResult, decodeSavedListViewAccess, } from './components/saved-list-views.js';
|
|
22
|
-
export type { SavedListView, SavedListViewState, SavedListViewProvider, SavedListViewMutation, SavedListViewMutationSuccess, SavedListViewMutationConflict, SavedListViewRemoveSuccess, ListPreferenceScope, SavedListViewAccess, SavedListViewAccessMode, SavedListViewSubject, } from './components/saved-list-views.js';
|
|
22
|
+
export type { SavedListView, SavedListViewState, SavedListViewColumnPinning, SavedListViewProvider, SavedListViewMutation, SavedListViewMutationSuccess, SavedListViewMutationConflict, SavedListViewRemoveSuccess, ListPreferenceScope, SavedListViewAccess, SavedListViewAccessMode, SavedListViewSubject, } from './components/saved-list-views.js';
|
|
23
23
|
export type { BatchSelection } from './components/table-contract.js';
|
|
24
24
|
export { cloneListFilter, cloneListStateSnapshot } from './components/list-state.svelte.js';
|
|
25
25
|
export type { ListStateSnapshot } from './components/list-state.svelte.js';
|
|
@@ -247,7 +247,18 @@ export { Select } from './components/ui/select/index.js';
|
|
|
247
247
|
export { Switch } from './components/ui/switch/index.js';
|
|
248
248
|
export { Checkbox } from './components/ui/checkbox/index.js';
|
|
249
249
|
export { Badge } from './components/ui/badge/index.js';
|
|
250
|
-
export { Separator } from './components/ui/separator/index.js';
|
|
250
|
+
export { Separator, Separator as Divider } from './components/ui/separator/index.js';
|
|
251
|
+
export { default as Link } from './components/Link.svelte';
|
|
252
|
+
export { default as Title } from './components/Typography.svelte';
|
|
253
|
+
export { default as Text } from './components/Text.svelte';
|
|
254
|
+
export { default as Spin } from './components/Spin.svelte';
|
|
255
|
+
export { default as Result } from './components/Result.svelte';
|
|
256
|
+
export { default as Popconfirm } from './components/Popconfirm.svelte';
|
|
257
|
+
export { default as BackTop } from './components/BackTop.svelte';
|
|
258
|
+
export { default as ItemList } from './components/ItemList.svelte';
|
|
259
|
+
export type { ListItem } from './components/ItemList.svelte';
|
|
260
|
+
export { default as Tree } from './components/Tree.svelte';
|
|
261
|
+
export type { TreeNode } from './components/Tree.svelte';
|
|
251
262
|
export { Avatar } from './components/ui/avatar/index.js';
|
|
252
263
|
export { Skeleton } from './components/ui/skeleton/index.js';
|
|
253
264
|
export * as Sheet from './components/ui/sheet/index.js';
|
package/dist/index.js
CHANGED
|
@@ -197,7 +197,16 @@ export { Select } from './components/ui/select/index.js';
|
|
|
197
197
|
export { Switch } from './components/ui/switch/index.js';
|
|
198
198
|
export { Checkbox } from './components/ui/checkbox/index.js';
|
|
199
199
|
export { Badge } from './components/ui/badge/index.js';
|
|
200
|
-
export { Separator } from './components/ui/separator/index.js';
|
|
200
|
+
export { Separator, Separator as Divider } from './components/ui/separator/index.js';
|
|
201
|
+
export { default as Link } from './components/Link.svelte';
|
|
202
|
+
export { default as Title } from './components/Typography.svelte';
|
|
203
|
+
export { default as Text } from './components/Text.svelte';
|
|
204
|
+
export { default as Spin } from './components/Spin.svelte';
|
|
205
|
+
export { default as Result } from './components/Result.svelte';
|
|
206
|
+
export { default as Popconfirm } from './components/Popconfirm.svelte';
|
|
207
|
+
export { default as BackTop } from './components/BackTop.svelte';
|
|
208
|
+
export { default as ItemList } from './components/ItemList.svelte';
|
|
209
|
+
export { default as Tree } from './components/Tree.svelte';
|
|
201
210
|
export { Avatar } from './components/ui/avatar/index.js';
|
|
202
211
|
export { Skeleton } from './components/ui/skeleton/index.js';
|
|
203
212
|
export * as Sheet from './components/ui/sheet/index.js';
|
package/dist/recipes.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ declare const buttonRecipeStyles: import("tailwind-variants").TVReturnType<{
|
|
|
6
6
|
ghost: "svadmin-button--ghost";
|
|
7
7
|
destructive: "svadmin-button--destructive";
|
|
8
8
|
link: "svadmin-button--link";
|
|
9
|
+
dashed: "svadmin-button--dashed";
|
|
10
|
+
text: "svadmin-button--text";
|
|
9
11
|
};
|
|
10
12
|
size: {
|
|
11
13
|
default: "svadmin-button-size--default";
|
|
@@ -25,6 +27,8 @@ declare const buttonRecipeStyles: import("tailwind-variants").TVReturnType<{
|
|
|
25
27
|
ghost: "svadmin-button--ghost";
|
|
26
28
|
destructive: "svadmin-button--destructive";
|
|
27
29
|
link: "svadmin-button--link";
|
|
30
|
+
dashed: "svadmin-button--dashed";
|
|
31
|
+
text: "svadmin-button--text";
|
|
28
32
|
};
|
|
29
33
|
size: {
|
|
30
34
|
default: "svadmin-button-size--default";
|
|
@@ -44,6 +48,8 @@ declare const buttonRecipeStyles: import("tailwind-variants").TVReturnType<{
|
|
|
44
48
|
ghost: "svadmin-button--ghost";
|
|
45
49
|
destructive: "svadmin-button--destructive";
|
|
46
50
|
link: "svadmin-button--link";
|
|
51
|
+
dashed: "svadmin-button--dashed";
|
|
52
|
+
text: "svadmin-button--text";
|
|
47
53
|
};
|
|
48
54
|
size: {
|
|
49
55
|
default: "svadmin-button-size--default";
|
package/dist/recipes.js
CHANGED
|
@@ -20,6 +20,8 @@ const buttonRecipeStyles = tv({
|
|
|
20
20
|
ghost: "svadmin-button--ghost",
|
|
21
21
|
destructive: "svadmin-button--destructive",
|
|
22
22
|
link: "svadmin-button--link",
|
|
23
|
+
dashed: "svadmin-button--dashed",
|
|
24
|
+
text: "svadmin-button--text",
|
|
23
25
|
},
|
|
24
26
|
size: {
|
|
25
27
|
default: "svadmin-button-size--default",
|
|
@@ -136,11 +138,11 @@ const productToolbarRecipeStyles = tv({
|
|
|
136
138
|
});
|
|
137
139
|
const productWorkspaceRecipeStyles = tv({
|
|
138
140
|
slots: {
|
|
139
|
-
root: "flex min-w-0 flex-col gap-
|
|
141
|
+
root: "flex min-w-0 flex-col gap-4",
|
|
140
142
|
summary: "min-w-0",
|
|
141
|
-
columns: "grid min-w-0 grid-cols-1 items-start gap-
|
|
143
|
+
columns: "grid min-w-0 grid-cols-1 items-start gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,var(--workspace-secondary-width,22rem))]",
|
|
142
144
|
primary: "min-w-0 lg:order-1",
|
|
143
|
-
secondary: "flex min-w-0 flex-col gap-
|
|
145
|
+
secondary: "flex min-w-0 flex-col gap-4 lg:order-2",
|
|
144
146
|
},
|
|
145
147
|
variants: { hasSecondary: { true: {}, false: { columns: "lg:grid-cols-1" } } },
|
|
146
148
|
defaultVariants: { hasSecondary: false },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.99.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.
|
|
91
|
+
"@svadmin/core": "^0.67.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.
|
|
142
|
+
"@svadmin/devtools": "^0.3.11",
|
|
143
143
|
"@svadmin/devtools-contract": "^0.3.1",
|
|
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.
|
|
180
|
+
"@svadmin/ai-elements": "^0.13.0",
|
|
181
181
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
182
182
|
"@tailwindcss/cli": "4.3.3",
|
|
183
183
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"vitest": "^4.1.11"
|
|
197
197
|
},
|
|
198
198
|
"scripts": {
|
|
199
|
-
"build": "bun run build:styles && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && node scripts/build-static-css.mjs && node scripts/postbuild-css.mjs",
|
|
199
|
+
"build": "bun run build:styles && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && node scripts/stamp-build-version.mjs && node scripts/build-static-css.mjs && node scripts/postbuild-css.mjs",
|
|
200
200
|
"shadcn": "shadcn-svelte --help",
|
|
201
201
|
"shadcn:add": "shadcn-svelte add --cwd shadcn --no-deps-install",
|
|
202
202
|
"test": "vitest run --config ./vitest.config.ts",
|