@liujitcn/kratos-admin-core 0.0.45 → 0.0.47

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.
@@ -1,5 +1,5 @@
1
1
  import type { FormRules } from "element-plus";
2
- import type { ProFormField } from "../../components/ProForm/interface";
2
+ import type { ProFormField, ProFormLabelPosition } from "../../components/ProForm/interface";
3
3
  /** 表单弹窗组件属性。 */
4
4
  interface FormDialogProps {
5
5
  modelValue: boolean;
@@ -10,6 +10,7 @@ interface FormDialogProps {
10
10
  fields: ProFormField[];
11
11
  rules?: FormRules;
12
12
  labelWidth?: string;
13
+ labelPosition?: ProFormLabelPosition;
13
14
  gutter?: number;
14
15
  colSpan?: number;
15
16
  confirmText?: string;
@@ -60,6 +61,7 @@ declare const __VLS_base: import("vue").DefineComponent<FormDialogProps, {
60
61
  confirmLoading: boolean;
61
62
  rules: FormRules;
62
63
  labelWidth: string;
64
+ labelPosition: ProFormLabelPosition;
63
65
  gutter: number;
64
66
  colSpan: number;
65
67
  formProps: Record<string, any>;
@@ -1,3 +1,4 @@
1
+ import type { ProFormLabelPosition } from "../../components/ProForm/interface";
1
2
  import type { PasswordCryptoScene } from "../../utils/passwordCrypto";
2
3
  import type { PasswordCrypto } from "../../rpc/common/v1/types";
3
4
  /** 通用密码验证弹窗属性。 */
@@ -32,6 +33,8 @@ interface PasswordVerifyDialogProps {
32
33
  closeOnPressEscape?: boolean;
33
34
  /** 表单标签宽度。 */
34
35
  labelWidth?: string;
36
+ /** 表单标签布局方向。 */
37
+ labelPosition?: ProFormLabelPosition;
35
38
  }
36
39
  declare const __VLS_export: import("vue").DefineComponent<PasswordVerifyDialogProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
40
  confirm: (password: PasswordCrypto) => any;
@@ -57,6 +60,7 @@ declare const __VLS_export: import("vue").DefineComponent<PasswordVerifyDialogPr
57
60
  cancelText: string;
58
61
  confirmLoading: boolean;
59
62
  labelWidth: string;
63
+ labelPosition: ProFormLabelPosition;
60
64
  passwordLabel: string;
61
65
  passwordPlaceholder: string;
62
66
  scene: PasswordCryptoScene;
@@ -12,6 +12,33 @@ export declare const LOCALE_MESSAGES: {
12
12
  "common.action.delete": string;
13
13
  "common.action.download": string;
14
14
  "common.action.edit": string;
15
+ "common.action.next": string;
16
+ "common.action.previous": string;
17
+ "common.action.refresh": string;
18
+ "common.action.enable": string;
19
+ "common.action.disable": string;
20
+ "common.action.export": string;
21
+ "common.action.import": string;
22
+ "common.action.copy": string;
23
+ "common.action.detail": string;
24
+ "common.action.submit": string;
25
+ "common.action.clear": string;
26
+ "common.action.filter": string;
27
+ "common.action.more": string;
28
+ "common.action.publish": string;
29
+ "common.action.revoke": string;
30
+ "common.action.retry": string;
31
+ "common.action.start": string;
32
+ "common.action.stop": string;
33
+ "common.action.pause": string;
34
+ "common.action.resume": string;
35
+ "common.action.upload": string;
36
+ "common.action.preview": string;
37
+ "common.action.configure": string;
38
+ "common.action.continue": string;
39
+ "common.action.skip": string;
40
+ "common.action.select_all": string;
41
+ "common.action.deselect_all": string;
15
42
  "common.action.expand": string;
16
43
  "common.action.collapse": string;
17
44
  "common.action.login": string;
@@ -350,6 +377,33 @@ export declare const LOCALE_MESSAGES: {
350
377
  "common.action.delete": string;
351
378
  "common.action.download": string;
352
379
  "common.action.edit": string;
380
+ "common.action.next": string;
381
+ "common.action.previous": string;
382
+ "common.action.refresh": string;
383
+ "common.action.enable": string;
384
+ "common.action.disable": string;
385
+ "common.action.export": string;
386
+ "common.action.import": string;
387
+ "common.action.copy": string;
388
+ "common.action.detail": string;
389
+ "common.action.submit": string;
390
+ "common.action.clear": string;
391
+ "common.action.filter": string;
392
+ "common.action.more": string;
393
+ "common.action.publish": string;
394
+ "common.action.revoke": string;
395
+ "common.action.retry": string;
396
+ "common.action.start": string;
397
+ "common.action.stop": string;
398
+ "common.action.pause": string;
399
+ "common.action.resume": string;
400
+ "common.action.upload": string;
401
+ "common.action.preview": string;
402
+ "common.action.configure": string;
403
+ "common.action.continue": string;
404
+ "common.action.skip": string;
405
+ "common.action.select_all": string;
406
+ "common.action.deselect_all": string;
353
407
  "common.action.expand": string;
354
408
  "common.action.collapse": string;
355
409
  "common.action.login": string;
@@ -688,6 +742,33 @@ export declare const LOCALE_MESSAGES: {
688
742
  "common.action.delete": string;
689
743
  "common.action.download": string;
690
744
  "common.action.edit": string;
745
+ "common.action.next": string;
746
+ "common.action.previous": string;
747
+ "common.action.refresh": string;
748
+ "common.action.enable": string;
749
+ "common.action.disable": string;
750
+ "common.action.export": string;
751
+ "common.action.import": string;
752
+ "common.action.copy": string;
753
+ "common.action.detail": string;
754
+ "common.action.submit": string;
755
+ "common.action.clear": string;
756
+ "common.action.filter": string;
757
+ "common.action.more": string;
758
+ "common.action.publish": string;
759
+ "common.action.revoke": string;
760
+ "common.action.retry": string;
761
+ "common.action.start": string;
762
+ "common.action.stop": string;
763
+ "common.action.pause": string;
764
+ "common.action.resume": string;
765
+ "common.action.upload": string;
766
+ "common.action.preview": string;
767
+ "common.action.configure": string;
768
+ "common.action.continue": string;
769
+ "common.action.skip": string;
770
+ "common.action.select_all": string;
771
+ "common.action.deselect_all": string;
691
772
  "common.action.expand": string;
692
773
  "common.action.collapse": string;
693
774
  "common.action.login": string;
@@ -1026,6 +1107,33 @@ export declare const LOCALE_MESSAGES: {
1026
1107
  "common.action.delete": string;
1027
1108
  "common.action.download": string;
1028
1109
  "common.action.edit": string;
1110
+ "common.action.next": string;
1111
+ "common.action.previous": string;
1112
+ "common.action.refresh": string;
1113
+ "common.action.enable": string;
1114
+ "common.action.disable": string;
1115
+ "common.action.export": string;
1116
+ "common.action.import": string;
1117
+ "common.action.copy": string;
1118
+ "common.action.detail": string;
1119
+ "common.action.submit": string;
1120
+ "common.action.clear": string;
1121
+ "common.action.filter": string;
1122
+ "common.action.more": string;
1123
+ "common.action.publish": string;
1124
+ "common.action.revoke": string;
1125
+ "common.action.retry": string;
1126
+ "common.action.start": string;
1127
+ "common.action.stop": string;
1128
+ "common.action.pause": string;
1129
+ "common.action.resume": string;
1130
+ "common.action.upload": string;
1131
+ "common.action.preview": string;
1132
+ "common.action.configure": string;
1133
+ "common.action.continue": string;
1134
+ "common.action.skip": string;
1135
+ "common.action.select_all": string;
1136
+ "common.action.deselect_all": string;
1029
1137
  "common.action.expand": string;
1030
1138
  "common.action.collapse": string;
1031
1139
  "common.action.login": string;
@@ -23,6 +23,7 @@
23
23
  :fields="fields"
24
24
  :rules="rules"
25
25
  :label-width="labelWidth"
26
+ :label-position="labelPosition"
26
27
  :gutter="gutter"
27
28
  :col-span="colSpan"
28
29
  v-bind="formProps"
@@ -50,7 +51,7 @@ import { computed, nextTick, ref, useSlots, watch } from "vue";
50
51
  import type { FormRules } from "element-plus";
51
52
  import ProDialog from "../../components/Dialog/ProDialog.vue";
52
53
  import ProForm from "../../components/ProForm/index.vue";
53
- import type { ProFormField, ProFormInstance } from "../../components/ProForm/interface";
54
+ import type { ProFormField, ProFormInstance, ProFormLabelPosition } from "../../components/ProForm/interface";
54
55
  import { useLocaleStore } from "../../locales";
55
56
 
56
57
  const { t } = useLocaleStore();
@@ -65,6 +66,7 @@ interface FormDialogProps {
65
66
  fields: ProFormField[];
66
67
  rules?: FormRules;
67
68
  labelWidth?: string;
69
+ labelPosition?: ProFormLabelPosition;
68
70
  gutter?: number;
69
71
  colSpan?: number;
70
72
  confirmText?: string;
@@ -81,7 +83,8 @@ const props = withDefaults(defineProps<FormDialogProps>(), {
81
83
  width: "500px",
82
84
  top: "8vh",
83
85
  rules: () => ({}),
84
- labelWidth: "180px",
86
+ labelWidth: "6em",
87
+ labelPosition: "right",
85
88
  gutter: 20,
86
89
  colSpan: 24,
87
90
  confirmText: "",
@@ -23,6 +23,7 @@
23
23
  :fields="fields"
24
24
  :rules="rules"
25
25
  :label-width="labelWidth"
26
+ :label-position="labelPosition"
26
27
  @keyup.enter.prevent="handleConfirm"
27
28
  />
28
29
  </ProDialog>
@@ -33,7 +34,7 @@ import { computed, reactive, ref } from "vue";
33
34
  import type { FormRules } from "element-plus";
34
35
  import ProDialog from "../../components/Dialog/ProDialog.vue";
35
36
  import ProForm from "../../components/ProForm/index.vue";
36
- import type { ProFormField, ProFormInstance } from "../../components/ProForm/interface";
37
+ import type { ProFormField, ProFormInstance, ProFormLabelPosition } from "../../components/ProForm/interface";
37
38
  import { useLocaleStore } from "../../locales";
38
39
  import { PASSWORD_CRYPTO_SCENE, encryptPassword } from "../../utils/passwordCrypto";
39
40
  import type { PasswordCryptoScene } from "../../utils/passwordCrypto";
@@ -73,6 +74,8 @@ interface PasswordVerifyDialogProps {
73
74
  closeOnPressEscape?: boolean;
74
75
  /** 表单标签宽度。 */
75
76
  labelWidth?: string;
77
+ /** 表单标签布局方向。 */
78
+ labelPosition?: ProFormLabelPosition;
76
79
  }
77
80
 
78
81
  const props = withDefaults(defineProps<PasswordVerifyDialogProps>(), {
@@ -89,7 +92,8 @@ const props = withDefaults(defineProps<PasswordVerifyDialogProps>(), {
89
92
  destroyOnClose: false,
90
93
  closeOnClickModal: false,
91
94
  closeOnPressEscape: true,
92
- labelWidth: "auto"
95
+ labelWidth: "6em",
96
+ labelPosition: "right"
93
97
  });
94
98
 
95
99
  const emit = defineEmits<{
@@ -66,8 +66,8 @@ interface ProFormProps {
66
66
 
67
67
  const props = withDefaults(defineProps<ProFormProps>(), {
68
68
  rules: () => ({}),
69
- labelWidth: "180px",
70
- labelPosition: "top",
69
+ labelWidth: "6em",
70
+ labelPosition: "right",
71
71
  gutter: 20,
72
72
  colSpan: 24
73
73
  });
@@ -7,6 +7,33 @@
7
7
  "common.action.delete": "Delete",
8
8
  "common.action.download": "Download",
9
9
  "common.action.edit": "Edit",
10
+ "common.action.next": "Next",
11
+ "common.action.previous": "Previous",
12
+ "common.action.refresh": "Refresh",
13
+ "common.action.enable": "Enable",
14
+ "common.action.disable": "Disable",
15
+ "common.action.export": "Export",
16
+ "common.action.import": "Import",
17
+ "common.action.copy": "Copy",
18
+ "common.action.detail": "Details",
19
+ "common.action.submit": "Submit",
20
+ "common.action.clear": "Clear",
21
+ "common.action.filter": "Filter",
22
+ "common.action.more": "More",
23
+ "common.action.publish": "Publish",
24
+ "common.action.revoke": "Revoke",
25
+ "common.action.retry": "Retry",
26
+ "common.action.start": "Start",
27
+ "common.action.stop": "Stop",
28
+ "common.action.pause": "Pause",
29
+ "common.action.resume": "Resume",
30
+ "common.action.upload": "Upload",
31
+ "common.action.preview": "Preview",
32
+ "common.action.configure": "Configure",
33
+ "common.action.continue": "Continue",
34
+ "common.action.skip": "Skip",
35
+ "common.action.select_all": "Select all",
36
+ "common.action.deselect_all": "Deselect all",
10
37
  "common.action.expand": "Expand",
11
38
  "common.action.collapse": "Collapse",
12
39
  "common.action.login": "Log in",
@@ -72,23 +72,30 @@ export function registerLocaleMessages(modules: AdminModule[]): void {
72
72
 
73
73
  modules.forEach(module => {
74
74
  if (!module.messages) return;
75
- const expectedKeys = requiredLocaleKeys(module.messages[DEFAULT_LOCALE] ?? {});
75
+ const defaultMessages = module.messages[DEFAULT_LOCALE] ?? {};
76
+ const expectedKeys = requiredLocaleKeys(defaultMessages);
76
77
  SUPPORTED_LOCALES.forEach(locale => {
77
78
  const messages = module.messages?.[locale];
78
- if (!messages) throw new Error(`${module.name} 缺少 ${locale} 语言包`);
79
- const keys = requiredLocaleKeys(messages);
79
+ if (!messages) {
80
+ warnLocaleIssue(`${module.name} 缺少 ${locale} 语言包,已回退到 ${DEFAULT_LOCALE}`);
81
+ }
82
+ const targetMessages = messages ?? {};
83
+ const keys = requiredLocaleKeys(targetMessages);
80
84
  if (keys.join("\u0000") !== expectedKeys.join("\u0000")) {
81
- throw new Error(`${module.name} 的 ${locale} 语言包键集合不一致`);
85
+ warnLocaleIssue(`${module.name} 的 ${locale} 语言包键集合不一致,缺失文案已回退到 ${DEFAULT_LOCALE}`);
82
86
  }
83
87
 
84
88
  const target = merged.get(locale) as LocaleMessages;
85
- Object.keys(messages).forEach(key => {
89
+ expectedKeys.forEach(key => {
90
+ let message = targetMessages[key] ?? defaultMessages[key];
86
91
  assertLocaleKeyNamespace(module.name, key);
87
92
  if (Object.prototype.hasOwnProperty.call(target, key)) {
88
93
  throw new Error(`${locale} 语言键重复: ${key}`);
89
94
  }
90
- assertLocalePlaceholders(module.name, key, messages[key], module.messages?.[DEFAULT_LOCALE]?.[key] ?? "");
91
- target[key] = messages[key];
95
+ if (!hasMatchingLocalePlaceholders(module.name, key, message, defaultMessages[key] ?? "")) {
96
+ message = defaultMessages[key] ?? "";
97
+ }
98
+ target[key] = message;
92
99
  });
93
100
  });
94
101
  });
@@ -215,9 +222,16 @@ function requiredLocaleKeys(messages: LocaleMessages): string[] {
215
222
  .sort();
216
223
  }
217
224
 
218
- function assertLocalePlaceholders(moduleName: string, key: string, message: string, sourceMessage: string): void {
225
+ function hasMatchingLocalePlaceholders(moduleName: string, key: string, message: string, sourceMessage: string): boolean {
219
226
  const placeholders = (value: string) => [...value.matchAll(/\{([A-Za-z0-9_]+)\}/g)].map(match => match[1]).sort();
220
227
  if (placeholders(message).join("\u0000") !== placeholders(sourceMessage).join("\u0000")) {
221
- throw new Error(`${moduleName} 的 ${key} 占位符集合不一致`);
228
+ warnLocaleIssue(`${moduleName} 的 ${key} 占位符集合不一致,已回退到 ${DEFAULT_LOCALE}`);
229
+ return false;
222
230
  }
231
+ return true;
232
+ }
233
+
234
+ /** 记录语言包问题但不阻断应用启动。 */
235
+ function warnLocaleIssue(message: string): void {
236
+ console.warn(`[i18n] ${message}`);
223
237
  }
@@ -7,6 +7,33 @@
7
7
  "common.action.delete": "削除",
8
8
  "common.action.download": "ダウンロード",
9
9
  "common.action.edit": "編集者",
10
+ "common.action.next": "次へ",
11
+ "common.action.previous": "前へ",
12
+ "common.action.refresh": "更新",
13
+ "common.action.enable": "有効化",
14
+ "common.action.disable": "無効化",
15
+ "common.action.export": "エクスポート",
16
+ "common.action.import": "インポート",
17
+ "common.action.copy": "コピー",
18
+ "common.action.detail": "詳細",
19
+ "common.action.submit": "送信",
20
+ "common.action.clear": "クリア",
21
+ "common.action.filter": "フィルター",
22
+ "common.action.more": "その他",
23
+ "common.action.publish": "公開",
24
+ "common.action.revoke": "取り消し",
25
+ "common.action.retry": "再試行",
26
+ "common.action.start": "開始",
27
+ "common.action.stop": "停止",
28
+ "common.action.pause": "一時停止",
29
+ "common.action.resume": "再開",
30
+ "common.action.upload": "アップロード",
31
+ "common.action.preview": "プレビュー",
32
+ "common.action.configure": "設定",
33
+ "common.action.continue": "続行",
34
+ "common.action.skip": "スキップ",
35
+ "common.action.select_all": "すべて選択",
36
+ "common.action.deselect_all": "すべて選択解除",
10
37
  "common.action.expand": "展開する",
11
38
  "common.action.collapse": "閉じる",
12
39
  "common.action.login": "ログイン",
@@ -7,6 +7,33 @@
7
7
  "common.action.delete": "删除",
8
8
  "common.action.download": "下载",
9
9
  "common.action.edit": "编辑",
10
+ "common.action.next": "下一步",
11
+ "common.action.previous": "上一步",
12
+ "common.action.refresh": "刷新",
13
+ "common.action.enable": "启用",
14
+ "common.action.disable": "禁用",
15
+ "common.action.export": "导出",
16
+ "common.action.import": "导入",
17
+ "common.action.copy": "复制",
18
+ "common.action.detail": "详情",
19
+ "common.action.submit": "提交",
20
+ "common.action.clear": "清空",
21
+ "common.action.filter": "筛选",
22
+ "common.action.more": "更多",
23
+ "common.action.publish": "发布",
24
+ "common.action.revoke": "撤销",
25
+ "common.action.retry": "重试",
26
+ "common.action.start": "开始",
27
+ "common.action.stop": "停止",
28
+ "common.action.pause": "暂停",
29
+ "common.action.resume": "恢复",
30
+ "common.action.upload": "上传",
31
+ "common.action.preview": "预览",
32
+ "common.action.configure": "配置",
33
+ "common.action.continue": "继续",
34
+ "common.action.skip": "跳过",
35
+ "common.action.select_all": "全选",
36
+ "common.action.deselect_all": "取消全选",
10
37
  "common.action.expand": "展开",
11
38
  "common.action.collapse": "收起",
12
39
  "common.action.login": "登录",
@@ -7,6 +7,33 @@
7
7
  "common.action.delete": "刪除",
8
8
  "common.action.download": "下載",
9
9
  "common.action.edit": "編輯",
10
+ "common.action.next": "下一步",
11
+ "common.action.previous": "上一步",
12
+ "common.action.refresh": "重新整理",
13
+ "common.action.enable": "啟用",
14
+ "common.action.disable": "停用",
15
+ "common.action.export": "匯出",
16
+ "common.action.import": "匯入",
17
+ "common.action.copy": "複製",
18
+ "common.action.detail": "詳情",
19
+ "common.action.submit": "提交",
20
+ "common.action.clear": "清空",
21
+ "common.action.filter": "篩選",
22
+ "common.action.more": "更多",
23
+ "common.action.publish": "發布",
24
+ "common.action.revoke": "撤銷",
25
+ "common.action.retry": "重試",
26
+ "common.action.start": "開始",
27
+ "common.action.stop": "停止",
28
+ "common.action.pause": "暫停",
29
+ "common.action.resume": "恢復",
30
+ "common.action.upload": "上傳",
31
+ "common.action.preview": "預覽",
32
+ "common.action.configure": "設定",
33
+ "common.action.continue": "繼續",
34
+ "common.action.skip": "跳過",
35
+ "common.action.select_all": "全選",
36
+ "common.action.deselect_all": "取消全選",
10
37
  "common.action.expand": "展開",
11
38
  "common.action.collapse": "收起",
12
39
  "common.action.login": "登入",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@liujitcn/kratos-admin-core",
3
3
  "private": false,
4
- "version": "0.0.45",
4
+ "version": "0.0.47",
5
5
  "type": "module",
6
6
  "description": "kratos-admin frontend runtime and base modules",
7
7
  "author": {