@svadmin/core 0.14.0 → 0.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/core",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Core SDK — hooks, types, context, i18n, permissions, router",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -181,7 +181,9 @@ export function useGetIdentity() {
181
181
  let isLoading = $state(true);
182
182
  let error = $state<Error | null>(null);
183
183
 
184
- if (provider) {
184
+ function fetch() {
185
+ if (!provider) { isLoading = false; return; }
186
+ isLoading = true;
185
187
  provider.getIdentity().then(identity => {
186
188
  data = identity;
187
189
  isLoading = false;
@@ -190,14 +192,15 @@ export function useGetIdentity() {
190
192
  isLoading = false;
191
193
  console.warn('[svadmin] useGetIdentity failed:', err);
192
194
  });
193
- } else {
194
- isLoading = false;
195
195
  }
196
196
 
197
+ fetch();
198
+
197
199
  return {
198
200
  get data() { return data; },
199
201
  get isLoading() { return isLoading; },
200
202
  get error() { return error; },
203
+ refetch: fetch,
201
204
  };
202
205
  }
203
206
 
@@ -140,6 +140,37 @@ const locales: Record<string, Locale> = {
140
140
  'validation.maxLength': '最多 {max} 个字符',
141
141
  'validation.invalidEmail': '请输入有效的邮箱地址',
142
142
  'validation.invalidFormat': '格式不正确',
143
+ // Settings
144
+ 'settings.title': '设置',
145
+ 'settings.profile': '个人资料',
146
+ 'settings.appearance': '外观设置',
147
+ 'settings.about': '关于',
148
+ 'settings.general': '通用',
149
+ 'settings.system': '系统',
150
+ 'settings.themeMode': '主题模式',
151
+ 'settings.light': '浅色',
152
+ 'settings.dark': '深色',
153
+ 'settings.systemTheme': '跟随系统',
154
+ 'settings.colorAccent': '强调色',
155
+ 'settings.language': '语言',
156
+ 'settings.interface': '界面',
157
+ 'settings.sidebarDensity': '侧边栏密度',
158
+ 'settings.compact': '紧凑',
159
+ 'settings.standard': '标准',
160
+ 'settings.defaultPageSize': '默认每页条数',
161
+ 'settings.version': '版本',
162
+ 'settings.registeredResources': '已注册资源',
163
+ 'settings.dataProvider': '数据源',
164
+ 'settings.currentEnvironment': '当前环境',
165
+ 'settings.settingsDescription': '管理您的账户和界面偏好。',
166
+ // Profile
167
+ 'profile.title': '个人资料',
168
+ 'profile.name': '姓名',
169
+ 'profile.notAvailable': '无法获取资料',
170
+ 'profile.changePassword': '修改密码',
171
+ 'profile.currentPassword': '当前密码',
172
+ 'profile.passwordChanged': '密码已修改',
173
+ 'profile.updatePassword': '更新密码',
143
174
  },
144
175
  'en': {
145
176
  // Common
@@ -278,6 +309,37 @@ const locales: Record<string, Locale> = {
278
309
  'validation.maxLength': 'Maximum {max} characters',
279
310
  'validation.invalidEmail': 'Please enter a valid email address',
280
311
  'validation.invalidFormat': 'Invalid format',
312
+ // Settings
313
+ 'settings.title': 'Settings',
314
+ 'settings.profile': 'Profile',
315
+ 'settings.appearance': 'Appearance',
316
+ 'settings.about': 'About',
317
+ 'settings.general': 'General',
318
+ 'settings.system': 'System',
319
+ 'settings.themeMode': 'Theme Mode',
320
+ 'settings.light': 'Light',
321
+ 'settings.dark': 'Dark',
322
+ 'settings.systemTheme': 'System',
323
+ 'settings.colorAccent': 'Color Accent',
324
+ 'settings.language': 'Language',
325
+ 'settings.interface': 'Interface',
326
+ 'settings.sidebarDensity': 'Sidebar Density',
327
+ 'settings.compact': 'Compact',
328
+ 'settings.standard': 'Standard',
329
+ 'settings.defaultPageSize': 'Default Page Size',
330
+ 'settings.version': 'Version',
331
+ 'settings.registeredResources': 'Registered Resources',
332
+ 'settings.dataProvider': 'Data Provider',
333
+ 'settings.currentEnvironment': 'Current Environment',
334
+ 'settings.settingsDescription': 'Manage your account and interface preferences.',
335
+ // Profile
336
+ 'profile.title': 'Profile',
337
+ 'profile.name': 'Name',
338
+ 'profile.notAvailable': 'Profile not available',
339
+ 'profile.changePassword': 'Change Password',
340
+ 'profile.currentPassword': 'Current Password',
341
+ 'profile.passwordChanged': 'Password updated successfully',
342
+ 'profile.updatePassword': 'Update Password',
281
343
  },
282
344
  };
283
345
 
@@ -44,6 +44,8 @@ export interface AdminOptions {
44
44
  disableRouteChangeHandler?: boolean;
45
45
  onLiveEvent?: (event: unknown) => void;
46
46
  menuItems?: (items: { name: string; route: string; label: string; icon?: string; parentName?: string; order?: number }[]) => { name: string; route: string; label: string; icon?: string; parentName?: string; order?: number }[];
47
+ /** Default page size for tables. Falls back to localStorage 'svadmin-default-page-size' or 10. */
48
+ defaultPageSize?: number;
47
49
  }
48
50
 
49
51
  const defaultTextTransformers: TextTransformers = {
package/src/types.ts CHANGED
@@ -222,6 +222,8 @@ export interface AuthProvider {
222
222
  register?: (params: Record<string, unknown>) => Promise<AuthActionResult>;
223
223
  forgotPassword?: (params: Record<string, unknown>) => Promise<AuthActionResult>;
224
224
  updatePassword?: (params: Record<string, unknown>) => Promise<AuthActionResult>;
225
+ /** Update user profile (name, avatar, etc.) */
226
+ updateProfile?: (params: { name?: string; avatar?: string | File; [key: string]: unknown }) => Promise<AuthActionResult>;
225
227
  onError?: (error: unknown) => Promise<{ redirectTo?: string; logout?: boolean }>;
226
228
  }
227
229