@antdv-vue/pro-provider 0.0.0-stage → 2.0.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +136 -2
  3. package/dist/ConfigProviderContainer.d.ts +10 -0
  4. package/dist/ConfigProviderContainer.js +207 -0
  5. package/dist/ProConfigProvider.d.ts +12 -0
  6. package/dist/ProConfigProvider.js +115 -0
  7. package/dist/context.d.ts +2810 -0
  8. package/dist/context.js +37 -0
  9. package/dist/index.d.ts +8 -0
  10. package/dist/index.js +7 -0
  11. package/dist/intl.d.ts +220 -0
  12. package/dist/intl.js +188 -0
  13. package/dist/locale/ar_EG.d.ts +6 -0
  14. package/dist/locale/ar_EG.js +99 -0
  15. package/dist/locale/ca_ES.d.ts +6 -0
  16. package/dist/locale/ca_ES.js +99 -0
  17. package/dist/locale/cs_CZ.d.ts +6 -0
  18. package/dist/locale/cs_CZ.js +99 -0
  19. package/dist/locale/de_DE.d.ts +6 -0
  20. package/dist/locale/de_DE.js +99 -0
  21. package/dist/locale/en_GB.d.ts +6 -0
  22. package/dist/locale/en_GB.js +99 -0
  23. package/dist/locale/en_US.d.ts +6 -0
  24. package/dist/locale/en_US.js +99 -0
  25. package/dist/locale/es_ES.d.ts +6 -0
  26. package/dist/locale/es_ES.js +99 -0
  27. package/dist/locale/fa_IR.d.ts +6 -0
  28. package/dist/locale/fa_IR.js +99 -0
  29. package/dist/locale/fr_FR.d.ts +6 -0
  30. package/dist/locale/fr_FR.js +99 -0
  31. package/dist/locale/he_IL.d.ts +6 -0
  32. package/dist/locale/he_IL.js +99 -0
  33. package/dist/locale/hr_HR.d.ts +6 -0
  34. package/dist/locale/hr_HR.js +99 -0
  35. package/dist/locale/id_ID.d.ts +6 -0
  36. package/dist/locale/id_ID.js +99 -0
  37. package/dist/locale/it_IT.d.ts +6 -0
  38. package/dist/locale/it_IT.js +99 -0
  39. package/dist/locale/ja_JP.d.ts +6 -0
  40. package/dist/locale/ja_JP.js +99 -0
  41. package/dist/locale/ko_KR.d.ts +6 -0
  42. package/dist/locale/ko_KR.js +99 -0
  43. package/dist/locale/mn_MN.d.ts +6 -0
  44. package/dist/locale/mn_MN.js +99 -0
  45. package/dist/locale/ms_MY.d.ts +6 -0
  46. package/dist/locale/ms_MY.js +99 -0
  47. package/dist/locale/nl_NL.d.ts +6 -0
  48. package/dist/locale/nl_NL.js +99 -0
  49. package/dist/locale/pl_PL.d.ts +6 -0
  50. package/dist/locale/pl_PL.js +99 -0
  51. package/dist/locale/pt_BR.d.ts +6 -0
  52. package/dist/locale/pt_BR.js +99 -0
  53. package/dist/locale/ro_RO.d.ts +6 -0
  54. package/dist/locale/ro_RO.js +99 -0
  55. package/dist/locale/ru_RU.d.ts +6 -0
  56. package/dist/locale/ru_RU.js +99 -0
  57. package/dist/locale/sk_SK.d.ts +6 -0
  58. package/dist/locale/sk_SK.js +99 -0
  59. package/dist/locale/sr_RS.d.ts +6 -0
  60. package/dist/locale/sr_RS.js +99 -0
  61. package/dist/locale/sv_SE.d.ts +6 -0
  62. package/dist/locale/sv_SE.js +99 -0
  63. package/dist/locale/th_TH.d.ts +6 -0
  64. package/dist/locale/th_TH.js +99 -0
  65. package/dist/locale/tr_TR.d.ts +6 -0
  66. package/dist/locale/tr_TR.js +99 -0
  67. package/dist/locale/uk_UA.d.ts +6 -0
  68. package/dist/locale/uk_UA.js +99 -0
  69. package/dist/locale/uz_UZ.d.ts +6 -0
  70. package/dist/locale/uz_UZ.js +99 -0
  71. package/dist/locale/vi_VN.d.ts +6 -0
  72. package/dist/locale/vi_VN.js +99 -0
  73. package/dist/locale/zh_CN.d.ts +112 -0
  74. package/dist/locale/zh_CN.js +106 -0
  75. package/dist/locale/zh_HK.d.ts +6 -0
  76. package/dist/locale/zh_HK.js +99 -0
  77. package/dist/locale/zh_TW.d.ts +6 -0
  78. package/dist/locale/zh_TW.js +99 -0
  79. package/dist/pro-provider.esm.js +4147 -0
  80. package/dist/typing/layoutToken.d.ts +625 -0
  81. package/dist/typing/layoutToken.js +72 -0
  82. package/dist/typing.d.ts +99 -0
  83. package/dist/typing.js +1 -0
  84. package/dist/useStyle/index.d.ts +162 -0
  85. package/dist/useStyle/index.js +254 -0
  86. package/dist/useStyle/token.d.ts +35 -0
  87. package/dist/useStyle/token.js +421 -0
  88. package/dist/utils/index.d.ts +13 -0
  89. package/dist/utils/index.js +21 -0
  90. package/dist/utils/merge.d.ts +20 -0
  91. package/dist/utils/merge.js +36 -0
  92. package/package.json +65 -3
@@ -0,0 +1,37 @@
1
+ import { zhCNIntl } from "./intl.js";
2
+ import { inject, provide, ref } from "vue";
3
+ import { theme } from "antdv-next";
4
+ //#region src/context.ts
5
+ const proCacheTokenKey = Symbol("proCacheTokenContext");
6
+ const useProCacheTokenProvider = (props) => provide(proCacheTokenKey, props);
7
+ const useProCacheToken = () => inject(proCacheTokenKey, {});
8
+ const proConfigConsumerKey = Symbol("proConfigConsumerContext");
9
+ /**
10
+ * The default value for ProConfigContext, used as a fallback when no provider is found.
11
+ */
12
+ const defaultProConfigConsumer = {
13
+ intl: {
14
+ ...zhCNIntl,
15
+ locale: "default"
16
+ },
17
+ valueTypeMap: {},
18
+ hashed: true,
19
+ dark: false,
20
+ compact: false,
21
+ token: {
22
+ ...theme.getDesignToken(),
23
+ proComponentsCls: ".ant-pro",
24
+ antCls: ".ant",
25
+ themeId: 0
26
+ },
27
+ prefixCls: ".ant-pro"
28
+ };
29
+ const defaultProConfigConsumerRef = ref(defaultProConfigConsumer);
30
+ const useProConfigProvider = (props) => provide(proConfigConsumerKey, props);
31
+ /**
32
+ * Inject the ProConfig context. If not found, use the default value.
33
+ * @returns The context value (as a Ref)
34
+ */
35
+ const useProConfig = () => inject(proConfigConsumerKey, defaultProConfigConsumerRef);
36
+ //#endregion
37
+ export { defaultProConfigConsumer, proCacheTokenKey, proConfigConsumerKey, useProCacheToken, useProCacheTokenProvider, useProConfig, useProConfigProvider };
@@ -0,0 +1,8 @@
1
+ import { IntlType, arEGIntl, caESIntl, createIntl, csCZIntl, deDEIntl, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, heILIntl, hrHRIntl, idIDIntl, intlMap, intlMapKeys, itITIntl, jaJPIntl, koKRIntl, mnMNIntl, msMYIntl, nlNLIntl, plPLIntl, ptBRIntl, roROIntl, ruRUIntl, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useIntl, uzUZIntl, viVNIntl, zhCNIntl, zhHKIntl, zhTWIntl } from "./intl.js";
2
+ import { BaseLayoutDesignToken, DeepPartial, LayoutDesignToken, ProFlattenTokenType, ProTokenType, getLayoutDesignToken, proLayoutUnitless } from "./typing/layoutToken.js";
3
+ import { GenerateStyle, ProAliasCssVarToken, ProAliasToken, genComponentStyleHook, lighten, operationUnit, proTheme, resetComponent, setAlpha, useStyle, useToken } from "./useStyle/index.js";
4
+ import { BaseProFieldFC, ParamsType, ProConfigProviderProps, ProFieldFCMode, ProFieldFCRenderProps, ProRenderFieldPropsType, ProSchemaValueEnumType } from "./typing.js";
5
+ import ProConfigProvider from "./ProConfigProvider.js";
6
+ import { ProCacheTokenProps, ProConfigConsumerProps, defaultProConfigConsumer, proCacheTokenKey, proConfigConsumerKey, useProCacheToken, useProCacheTokenProvider, useProConfig, useProConfigProvider } from "./context.js";
7
+ import { isNeedOpenHash } from "./utils/index.js";
8
+ export { BaseLayoutDesignToken, BaseProFieldFC, DeepPartial, GenerateStyle, IntlType, LayoutDesignToken, ParamsType, ProAliasCssVarToken, ProAliasToken, ProCacheTokenProps, ProConfigConsumerProps, ProConfigProvider, ProConfigProviderProps, ProFieldFCMode, ProFieldFCRenderProps, ProFlattenTokenType, ProRenderFieldPropsType, ProSchemaValueEnumType, ProTokenType, arEGIntl, caESIntl, createIntl, csCZIntl, deDEIntl, ProConfigProvider as default, defaultProConfigConsumer, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, genComponentStyleHook, getLayoutDesignToken, heILIntl, hrHRIntl, idIDIntl, intlMap, intlMapKeys, isNeedOpenHash, itITIntl, jaJPIntl, koKRIntl, lighten, mnMNIntl, msMYIntl, nlNLIntl, operationUnit, plPLIntl, proCacheTokenKey, proConfigConsumerKey, proLayoutUnitless, proTheme, ptBRIntl, resetComponent, roROIntl, ruRUIntl, setAlpha, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useIntl, useProCacheToken, useProCacheTokenProvider, useProConfig, useProConfigProvider, useStyle, useToken, uzUZIntl, viVNIntl, zhCNIntl, zhHKIntl, zhTWIntl };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { arEGIntl, caESIntl, createIntl, csCZIntl, deDEIntl, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, heILIntl, hrHRIntl, idIDIntl, intlMap, intlMapKeys, itITIntl, jaJPIntl, koKRIntl, mnMNIntl, msMYIntl, nlNLIntl, plPLIntl, ptBRIntl, roROIntl, ruRUIntl, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useIntl, uzUZIntl, viVNIntl, zhCNIntl, zhHKIntl, zhTWIntl } from "./intl.js";
2
+ import { defaultProConfigConsumer, proCacheTokenKey, proConfigConsumerKey, useProCacheToken, useProCacheTokenProvider, useProConfig, useProConfigProvider } from "./context.js";
3
+ import { genComponentStyleHook, lighten, operationUnit, proTheme, resetComponent, setAlpha, useStyle, useToken } from "./useStyle/index.js";
4
+ import { getLayoutDesignToken, proLayoutUnitless } from "./typing/layoutToken.js";
5
+ import { isNeedOpenHash } from "./utils/index.js";
6
+ import ProConfigProvider from "./ProConfigProvider.js";
7
+ export { ProConfigProvider, arEGIntl, caESIntl, createIntl, csCZIntl, deDEIntl, ProConfigProvider as default, defaultProConfigConsumer, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, genComponentStyleHook, getLayoutDesignToken, heILIntl, hrHRIntl, idIDIntl, intlMap, intlMapKeys, isNeedOpenHash, itITIntl, jaJPIntl, koKRIntl, lighten, mnMNIntl, msMYIntl, nlNLIntl, operationUnit, plPLIntl, proCacheTokenKey, proConfigConsumerKey, proLayoutUnitless, proTheme, ptBRIntl, resetComponent, roROIntl, ruRUIntl, setAlpha, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useIntl, useProCacheToken, useProCacheTokenProvider, useProConfig, useProConfigProvider, useStyle, useToken, uzUZIntl, viVNIntl, zhCNIntl, zhHKIntl, zhTWIntl };
package/dist/intl.d.ts ADDED
@@ -0,0 +1,220 @@
1
+ import { ProLocale } from "./locale/zh_CN.js";
2
+ import { ComputedRef } from "vue";
3
+
4
+ //#region src/intl.d.ts
5
+ interface IntlType {
6
+ locale: string;
7
+ getMessage: (message: {
8
+ id: string;
9
+ defaultMessage?: string;
10
+ }) => string | undefined;
11
+ }
12
+ /**
13
+ * 创建一个国际化的操作函数。
14
+ *
15
+ * 当某 locale 找不到 id 对应的文案时,按以下顺序回退:
16
+ * 1. zh-CN locale 自身找不到 → 返回 `defaultMessage`
17
+ * 2. 其他 locale 找不到 → 去 zh-CN messages 里找;还找不到才返回 `defaultMessage`
18
+ *
19
+ * @param locale 语言标识,如 `'zh_CN'` / `'en_US'`(注意是下划线形式)
20
+ * @param localeMap 该语言对应的 messages 对象
21
+ */
22
+ declare function createIntl(locale: string, localeMap: Record<string, any>): IntlType;
23
+ /**
24
+ * 所有内置语言的原始 messages 表。新增语言只需在此处追加一项。
25
+ * Key 使用 antd locale 的 `xx_YY` 形态(带下划线)。
26
+ */
27
+ declare const localeMessages: {
28
+ readonly mn_MN: ProLocale;
29
+ readonly ar_EG: ProLocale;
30
+ readonly zh_CN: {
31
+ readonly moneySymbol: "¥";
32
+ readonly deleteThisLine: "删除此行";
33
+ readonly copyThisLine: "复制此行";
34
+ readonly sortUpThisLine: "向上排序";
35
+ readonly sortDownThisLine: "向下排序";
36
+ readonly emptyListValidateMessage: "列表不能为空";
37
+ readonly form: {
38
+ readonly lightFilter: {
39
+ readonly more: "更多筛选";
40
+ readonly clear: "清除";
41
+ readonly confirm: "确认";
42
+ readonly itemUnit: "项";
43
+ };
44
+ readonly captcha: {
45
+ readonly getCaptcha: "获取验证码";
46
+ readonly resendAfter: "秒后重新获取";
47
+ };
48
+ readonly upload: {
49
+ readonly buttonText: "单击上传";
50
+ readonly draggerTitle: "单击或拖动文件到此区域进行上传";
51
+ readonly draggerDescription: "支持单次或批量上传";
52
+ };
53
+ readonly modal: {
54
+ readonly okText: "确认";
55
+ readonly cancelText: "取消";
56
+ };
57
+ };
58
+ readonly tableForm: {
59
+ readonly search: "查询";
60
+ readonly reset: "重置";
61
+ readonly submit: "提交";
62
+ readonly collapsed: "展开";
63
+ readonly expand: "收起";
64
+ readonly inputPlaceholder: "请输入";
65
+ readonly selectPlaceholder: "请选择";
66
+ };
67
+ readonly alert: {
68
+ readonly clear: "取消选择";
69
+ readonly selected: "已选择";
70
+ readonly item: "项";
71
+ };
72
+ readonly pagination: {
73
+ readonly total: {
74
+ readonly range: "第";
75
+ readonly total: "条/总共";
76
+ readonly item: "条";
77
+ };
78
+ };
79
+ readonly tableToolBar: {
80
+ readonly startPin: "固定在列首";
81
+ readonly endPin: "固定在列尾";
82
+ readonly noPin: "不固定";
83
+ readonly startFixedTitle: "固定在左侧";
84
+ readonly endFixedTitle: "固定在右侧";
85
+ readonly noFixedTitle: "不固定";
86
+ readonly reset: "重置";
87
+ readonly columnDisplay: "列展示";
88
+ readonly columnSetting: "列设置";
89
+ readonly fullScreen: "全屏";
90
+ readonly exitFullScreen: "退出全屏";
91
+ readonly reload: "刷新";
92
+ readonly density: "密度";
93
+ readonly densityDefault: "正常";
94
+ readonly densityLarger: "宽松";
95
+ readonly densityMedium: "中等";
96
+ readonly densitySmall: "紧凑";
97
+ };
98
+ readonly stepsForm: {
99
+ readonly next: "下一步";
100
+ readonly prev: "上一步";
101
+ readonly submit: "提交";
102
+ };
103
+ readonly loginForm: {
104
+ readonly submitText: "登录";
105
+ };
106
+ readonly editableTable: {
107
+ readonly defaultFieldLabel: "此项";
108
+ readonly defaultFieldType: "文本";
109
+ readonly onlyOneLineEditor: "只能同时编辑一行";
110
+ readonly onlyAddOneLine: "只能同时新增一行";
111
+ readonly action: {
112
+ readonly save: "保存";
113
+ readonly cancel: "取消";
114
+ readonly delete: "删除";
115
+ readonly add: "添加一行数据";
116
+ };
117
+ };
118
+ readonly switch: {
119
+ readonly open: "打开";
120
+ readonly close: "关闭";
121
+ };
122
+ readonly time: {
123
+ readonly seconds: "秒";
124
+ readonly minutes: "分钟";
125
+ readonly hours: "小时";
126
+ readonly days: "天";
127
+ readonly ago: "前";
128
+ };
129
+ };
130
+ readonly en_US: ProLocale;
131
+ readonly en_GB: ProLocale;
132
+ readonly vi_VN: ProLocale;
133
+ readonly it_IT: ProLocale;
134
+ readonly ja_JP: ProLocale;
135
+ readonly es_ES: ProLocale;
136
+ readonly ca_ES: ProLocale;
137
+ readonly ru_RU: ProLocale;
138
+ readonly sr_RS: ProLocale;
139
+ readonly ms_MY: ProLocale;
140
+ readonly zh_TW: ProLocale;
141
+ readonly zh_HK: ProLocale;
142
+ readonly fr_FR: ProLocale;
143
+ readonly pt_BR: ProLocale;
144
+ readonly ko_KR: ProLocale;
145
+ readonly id_ID: ProLocale;
146
+ readonly de_DE: ProLocale;
147
+ readonly fa_IR: ProLocale;
148
+ readonly tr_TR: ProLocale;
149
+ readonly pl_PL: ProLocale;
150
+ readonly hr_HR: ProLocale;
151
+ readonly th_TH: ProLocale;
152
+ readonly cs_CZ: ProLocale;
153
+ readonly sk_SK: ProLocale;
154
+ readonly he_IL: ProLocale;
155
+ readonly uk_UA: ProLocale;
156
+ readonly uz_UZ: ProLocale;
157
+ readonly nl_NL: ProLocale;
158
+ readonly ro_RO: ProLocale;
159
+ readonly sv_SE: ProLocale;
160
+ };
161
+ type LocaleUnderscoreKey = keyof typeof localeMessages;
162
+ /** `zh-CN` 这种短横线形态的 key 类型。 */
163
+ type LocaleDashKey = LocaleUnderscoreKey extends `${infer A}_${infer B}` ? `${A}-${B}` : never;
164
+ /**
165
+ * `antd locale key (xx-YY)` → IntlType 的映射表。
166
+ * 所有条目都从 `localeMessages` 统一派生,避免手写导致漏项。
167
+ */
168
+ declare const intlMap: Record<LocaleDashKey, IntlType>;
169
+ declare const intlMapKeys: LocaleDashKey[];
170
+ /**
171
+ * 根据 antd 的 locale key 找到对应 intl 的 key。
172
+ *
173
+ * 匹配顺序:
174
+ * 1. 完全一致(大小写不敏感)
175
+ * 2. 同语族前缀匹配,例如 `'zh'` → `'zh-CN'`(取 intlMapKeys 中第一个前缀命中的)
176
+ * 3. 兜底 `'zh-CN'`
177
+ */
178
+ declare function findIntlKeyByAntdLocaleKey<T extends string>(localeKey?: T): T;
179
+ declare const arEGIntl: IntlType;
180
+ declare const caESIntl: IntlType;
181
+ declare const csCZIntl: IntlType;
182
+ declare const deDEIntl: IntlType;
183
+ declare const enGBIntl: IntlType;
184
+ declare const enUSIntl: IntlType;
185
+ declare const esESIntl: IntlType;
186
+ declare const faIRIntl: IntlType;
187
+ declare const frFRIntl: IntlType;
188
+ declare const heILIntl: IntlType;
189
+ declare const hrHRIntl: IntlType;
190
+ declare const idIDIntl: IntlType;
191
+ declare const itITIntl: IntlType;
192
+ declare const jaJPIntl: IntlType;
193
+ declare const koKRIntl: IntlType;
194
+ declare const mnMNIntl: IntlType;
195
+ declare const msMYIntl: IntlType;
196
+ declare const nlNLIntl: IntlType;
197
+ declare const plPLIntl: IntlType;
198
+ declare const ptBRIntl: IntlType;
199
+ declare const roROIntl: IntlType;
200
+ declare const ruRUIntl: IntlType;
201
+ declare const skSKIntl: IntlType;
202
+ declare const srRSIntl: IntlType;
203
+ declare const svSEIntl: IntlType;
204
+ declare const thTHIntl: IntlType;
205
+ declare const trTRIntl: IntlType;
206
+ declare const ukUAIntl: IntlType;
207
+ declare const uzUZIntl: IntlType;
208
+ declare const viVNIntl: IntlType;
209
+ declare const zhCNIntl: IntlType;
210
+ declare const zhHKIntl: IntlType;
211
+ declare const zhTWIntl: IntlType;
212
+ /**
213
+ * It returns the intl object from the context if it exists, otherwise it returns the intl object for
214
+ * 获取国际化的方法
215
+ * the current locale
216
+ * @returns The return value of the function is the intl object.
217
+ */
218
+ declare function useIntl(): ComputedRef<IntlType>;
219
+ //#endregion
220
+ export { IntlType, arEGIntl, caESIntl, createIntl, csCZIntl, deDEIntl, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, heILIntl, hrHRIntl, idIDIntl, intlMap, intlMapKeys, itITIntl, jaJPIntl, koKRIntl, mnMNIntl, msMYIntl, nlNLIntl, plPLIntl, ptBRIntl, roROIntl, ruRUIntl, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useIntl, uzUZIntl, viVNIntl, zhCNIntl, zhHKIntl, zhTWIntl };
package/dist/intl.js ADDED
@@ -0,0 +1,188 @@
1
+ import arEG from "./locale/ar_EG.js";
2
+ import caES from "./locale/ca_ES.js";
3
+ import csCZ from "./locale/cs_CZ.js";
4
+ import deDE from "./locale/de_DE.js";
5
+ import enGB from "./locale/en_GB.js";
6
+ import enUS from "./locale/en_US.js";
7
+ import esES from "./locale/es_ES.js";
8
+ import faIR from "./locale/fa_IR.js";
9
+ import frFR from "./locale/fr_FR.js";
10
+ import heIL from "./locale/he_IL.js";
11
+ import hrHR from "./locale/hr_HR.js";
12
+ import idID from "./locale/id_ID.js";
13
+ import itIT from "./locale/it_IT.js";
14
+ import jaJP from "./locale/ja_JP.js";
15
+ import koKR from "./locale/ko_KR.js";
16
+ import mnMN from "./locale/mn_MN.js";
17
+ import msMY from "./locale/ms_MY.js";
18
+ import nlNL from "./locale/nl_NL.js";
19
+ import plPL from "./locale/pl_PL.js";
20
+ import ptBR from "./locale/pt_BR.js";
21
+ import roRO from "./locale/ro_RO.js";
22
+ import ruRU from "./locale/ru_RU.js";
23
+ import skSK from "./locale/sk_SK.js";
24
+ import srRS from "./locale/sr_RS.js";
25
+ import svSE from "./locale/sv_SE.js";
26
+ import thTH from "./locale/th_TH.js";
27
+ import trTR from "./locale/tr_TR.js";
28
+ import ukUA from "./locale/uk_UA.js";
29
+ import uzUZ from "./locale/uz_UZ.js";
30
+ import viVN from "./locale/vi_VN.js";
31
+ import zhCN from "./locale/zh_CN.js";
32
+ import zhHK from "./locale/zh_HK.js";
33
+ import zhTW from "./locale/zh_TW.js";
34
+ import { useProConfig } from "./context.js";
35
+ import { computed } from "vue";
36
+ import { useConfig } from "antdv-next/config-provider/context";
37
+ import { get } from "@v-c/util";
38
+ //#region src/intl.ts
39
+ /**
40
+ * 从 locale messages 中按 id 取值的工具。id 支持点号路径和方括号下标:
41
+ * - `a.b.c`
42
+ * - `a.b[0].c`
43
+ */
44
+ function getMessageByPath(messages, id) {
45
+ return get(messages, id.replace(/\[(\d+)\]/g, ".$1").split(".")) || "";
46
+ }
47
+ /**
48
+ * `zh-CN` 的 messages 快照,供 `createIntl` 的跨语言 fallback 使用。
49
+ *
50
+ * 这里要显式保存一份 messages 引用,而不是在运行时从 `intlMap['zh-CN'].getMessage` 取值,
51
+ * 避免"createIntl 自身被改动为其他 fallback 策略时出现递归"的风险。
52
+ */
53
+ const zhCNMessages = zhCN;
54
+ /**
55
+ * 创建一个国际化的操作函数。
56
+ *
57
+ * 当某 locale 找不到 id 对应的文案时,按以下顺序回退:
58
+ * 1. zh-CN locale 自身找不到 → 返回 `defaultMessage`
59
+ * 2. 其他 locale 找不到 → 去 zh-CN messages 里找;还找不到才返回 `defaultMessage`
60
+ *
61
+ * @param locale 语言标识,如 `'zh_CN'` / `'en_US'`(注意是下划线形式)
62
+ * @param localeMap 该语言对应的 messages 对象
63
+ */
64
+ function createIntl(locale, localeMap) {
65
+ return {
66
+ getMessage: ({ id, defaultMessage }) => {
67
+ const msg = getMessageByPath(localeMap, id);
68
+ if (msg) return msg;
69
+ if (locale.replace("_", "-") === "zh-CN") return defaultMessage;
70
+ return getMessageByPath(zhCNMessages, id) || defaultMessage;
71
+ },
72
+ locale
73
+ };
74
+ }
75
+ /**
76
+ * 所有内置语言的原始 messages 表。新增语言只需在此处追加一项。
77
+ * Key 使用 antd locale 的 `xx_YY` 形态(带下划线)。
78
+ */
79
+ const localeMessages = {
80
+ mn_MN: mnMN,
81
+ ar_EG: arEG,
82
+ zh_CN: zhCN,
83
+ en_US: enUS,
84
+ en_GB: enGB,
85
+ vi_VN: viVN,
86
+ it_IT: itIT,
87
+ ja_JP: jaJP,
88
+ es_ES: esES,
89
+ ca_ES: caES,
90
+ ru_RU: ruRU,
91
+ sr_RS: srRS,
92
+ ms_MY: msMY,
93
+ zh_TW: zhTW,
94
+ zh_HK: zhHK,
95
+ fr_FR: frFR,
96
+ pt_BR: ptBR,
97
+ ko_KR: koKR,
98
+ id_ID: idID,
99
+ de_DE: deDE,
100
+ fa_IR: faIR,
101
+ tr_TR: trTR,
102
+ pl_PL: plPL,
103
+ hr_HR: hrHR,
104
+ th_TH: thTH,
105
+ cs_CZ: csCZ,
106
+ sk_SK: skSK,
107
+ he_IL: heIL,
108
+ uk_UA: ukUA,
109
+ uz_UZ: uzUZ,
110
+ nl_NL: nlNL,
111
+ ro_RO: roRO,
112
+ sv_SE: svSE
113
+ };
114
+ /** 将 `zh_CN` 转为 `zh-CN`。 */
115
+ function toDashKey(k) {
116
+ return k.replace("_", "-");
117
+ }
118
+ /**
119
+ * `antd locale key (xx-YY)` → IntlType 的映射表。
120
+ * 所有条目都从 `localeMessages` 统一派生,避免手写导致漏项。
121
+ */
122
+ const intlMap = Object.fromEntries(Object.keys(localeMessages).map((k) => [toDashKey(k), createIntl(k, localeMessages[k])]));
123
+ const intlMapKeys = Object.keys(intlMap);
124
+ /**
125
+ * 根据 antd 的 locale key 找到对应 intl 的 key。
126
+ *
127
+ * 匹配顺序:
128
+ * 1. 完全一致(大小写不敏感)
129
+ * 2. 同语族前缀匹配,例如 `'zh'` → `'zh-CN'`(取 intlMapKeys 中第一个前缀命中的)
130
+ * 3. 兜底 `'zh-CN'`
131
+ */
132
+ function findIntlKeyByAntdLocaleKey(localeKey) {
133
+ const input = (localeKey || "zh-CN").toLowerCase();
134
+ const exact = intlMapKeys.find((k) => k.toLowerCase() === input);
135
+ if (exact) return exact;
136
+ const prefix = `${input.split("-")[0]}-`;
137
+ return intlMapKeys.find((k) => k.toLowerCase().startsWith(prefix)) ?? "zh-CN";
138
+ }
139
+ const arEGIntl = intlMap["ar-EG"];
140
+ const caESIntl = intlMap["ca-ES"];
141
+ const csCZIntl = intlMap["cs-CZ"];
142
+ const deDEIntl = intlMap["de-DE"];
143
+ const enGBIntl = intlMap["en-GB"];
144
+ const enUSIntl = intlMap["en-US"];
145
+ const esESIntl = intlMap["es-ES"];
146
+ const faIRIntl = intlMap["fa-IR"];
147
+ const frFRIntl = intlMap["fr-FR"];
148
+ const heILIntl = intlMap["he-IL"];
149
+ const hrHRIntl = intlMap["hr-HR"];
150
+ const idIDIntl = intlMap["id-ID"];
151
+ const itITIntl = intlMap["it-IT"];
152
+ const jaJPIntl = intlMap["ja-JP"];
153
+ const koKRIntl = intlMap["ko-KR"];
154
+ const mnMNIntl = intlMap["mn-MN"];
155
+ const msMYIntl = intlMap["ms-MY"];
156
+ const nlNLIntl = intlMap["nl-NL"];
157
+ const plPLIntl = intlMap["pl-PL"];
158
+ const ptBRIntl = intlMap["pt-BR"];
159
+ const roROIntl = intlMap["ro-RO"];
160
+ const ruRUIntl = intlMap["ru-RU"];
161
+ const skSKIntl = intlMap["sk-SK"];
162
+ const srRSIntl = intlMap["sr-RS"];
163
+ const svSEIntl = intlMap["sv-SE"];
164
+ const thTHIntl = intlMap["th-TH"];
165
+ const trTRIntl = intlMap["tr-TR"];
166
+ const ukUAIntl = intlMap["uk-UA"];
167
+ const uzUZIntl = intlMap["uz-UZ"];
168
+ const viVNIntl = intlMap["vi-VN"];
169
+ const zhCNIntl = intlMap["zh-CN"];
170
+ const zhHKIntl = intlMap["zh-HK"];
171
+ const zhTWIntl = intlMap["zh-TW"];
172
+ /**
173
+ * It returns the intl object from the context if it exists, otherwise it returns the intl object for
174
+ * 获取国际化的方法
175
+ * the current locale
176
+ * @returns The return value of the function is the intl object.
177
+ */
178
+ function useIntl() {
179
+ const config = useConfig();
180
+ const proProvide = useProConfig();
181
+ return computed(() => {
182
+ if (proProvide.value.intl && proProvide.value.intl?.locale !== "default") return proProvide.value.intl;
183
+ if (config.value.locale?.locale) return intlMap[findIntlKeyByAntdLocaleKey(config.value.locale?.locale)] || zhCNIntl;
184
+ return zhCNIntl;
185
+ });
186
+ }
187
+ //#endregion
188
+ export { arEGIntl, caESIntl, createIntl, csCZIntl, deDEIntl, enGBIntl, enUSIntl, esESIntl, faIRIntl, findIntlKeyByAntdLocaleKey, frFRIntl, heILIntl, hrHRIntl, idIDIntl, intlMap, intlMapKeys, itITIntl, jaJPIntl, koKRIntl, mnMNIntl, msMYIntl, nlNLIntl, plPLIntl, ptBRIntl, roROIntl, ruRUIntl, skSKIntl, srRSIntl, svSEIntl, thTHIntl, trTRIntl, ukUAIntl, useIntl, uzUZIntl, viVNIntl, zhCNIntl, zhHKIntl, zhTWIntl };
@@ -0,0 +1,6 @@
1
+ import { ProLocale } from "./zh_CN.js";
2
+
3
+ //#region src/locale/ar_EG.d.ts
4
+ declare const arEG: ProLocale;
5
+ //#endregion
6
+ export { arEG as default };
@@ -0,0 +1,99 @@
1
+ //#region src/locale/ar_EG.ts
2
+ const arEG = {
3
+ moneySymbol: "$",
4
+ deleteThisLine: "احذف هذا السطر",
5
+ copyThisLine: "انسخ هذا السطر",
6
+ sortUpThisLine: "نقل للأعلى",
7
+ sortDownThisLine: "نقل للأسفل",
8
+ emptyListValidateMessage: "لا يمكن أن تكون القائمة فارغة",
9
+ form: {
10
+ lightFilter: {
11
+ more: "المزيد",
12
+ clear: "نظف",
13
+ confirm: "تأكيد",
14
+ itemUnit: "عناصر"
15
+ },
16
+ captcha: {
17
+ getCaptcha: "احصل على رمز التحقق",
18
+ resendAfter: "ثانية لإعادة الإرسال"
19
+ },
20
+ upload: {
21
+ buttonText: "انقر للرفع",
22
+ draggerTitle: "انقر أو اسحب الملف إلى هذه المنطقة للرفع",
23
+ draggerDescription: "يدعم الرفع الفردي أو المتعدد"
24
+ },
25
+ modal: {
26
+ okText: "تأكيد",
27
+ cancelText: "إلغاء"
28
+ }
29
+ },
30
+ time: {
31
+ seconds: "ثانية",
32
+ minutes: "دقيقة",
33
+ hours: "ساعة",
34
+ days: "يوم",
35
+ ago: "مضت"
36
+ },
37
+ tableForm: {
38
+ search: "ابحث",
39
+ reset: "إعادة تعيين",
40
+ submit: "ارسال",
41
+ collapsed: "مُقلص",
42
+ expand: "مُوسع",
43
+ inputPlaceholder: "الرجاء الإدخال",
44
+ selectPlaceholder: "الرجاء الإختيار"
45
+ },
46
+ alert: {
47
+ clear: "نظف",
48
+ selected: "محدد",
49
+ item: "عنصر"
50
+ },
51
+ pagination: { total: {
52
+ range: " ",
53
+ total: "من",
54
+ item: "عناصر"
55
+ } },
56
+ tableToolBar: {
57
+ startPin: "ثبت على اليسار",
58
+ endPin: "ثبت على اليمين",
59
+ noPin: "الغاء التثبيت",
60
+ startFixedTitle: "لصق على اليسار",
61
+ endFixedTitle: "لصق على اليمين",
62
+ noFixedTitle: "إلغاء الإلصاق",
63
+ reset: "إعادة تعيين",
64
+ columnDisplay: "الأعمدة المعروضة",
65
+ columnSetting: "الإعدادات",
66
+ fullScreen: "وضع كامل الشاشة",
67
+ exitFullScreen: "الخروج من وضع كامل الشاشة",
68
+ reload: "تحديث",
69
+ density: "الكثافة",
70
+ densityDefault: "افتراضي",
71
+ densityLarger: "أكبر",
72
+ densityMedium: "وسط",
73
+ densitySmall: "مدمج"
74
+ },
75
+ stepsForm: {
76
+ next: "التالي",
77
+ prev: "السابق",
78
+ submit: "أنهى"
79
+ },
80
+ loginForm: { submitText: "تسجيل الدخول" },
81
+ editableTable: {
82
+ defaultFieldLabel: "هذا الحقل",
83
+ defaultFieldType: "نص",
84
+ onlyOneLineEditor: "يمكن تحرير سطر واحد فقط في كل مرة",
85
+ onlyAddOneLine: "يمكن إضافة سطر واحد فقط في كل مرة",
86
+ action: {
87
+ save: "أنقذ",
88
+ cancel: "إلغاء الأمر",
89
+ delete: "حذف",
90
+ add: "إضافة صف من البيانات"
91
+ }
92
+ },
93
+ switch: {
94
+ open: "مفتوح",
95
+ close: "غلق"
96
+ }
97
+ };
98
+ //#endregion
99
+ export { arEG as default };
@@ -0,0 +1,6 @@
1
+ import { ProLocale } from "./zh_CN.js";
2
+
3
+ //#region src/locale/ca_ES.d.ts
4
+ declare const caES: ProLocale;
5
+ //#endregion
6
+ export { caES as default };
@@ -0,0 +1,99 @@
1
+ //#region src/locale/ca_ES.ts
2
+ const caES = {
3
+ moneySymbol: "€",
4
+ deleteThisLine: "Suprimeix aquesta línia",
5
+ copyThisLine: "Copia aquesta línia",
6
+ sortUpThisLine: "Mou amunt",
7
+ sortDownThisLine: "Mou avall",
8
+ emptyListValidateMessage: "La llista no pot estar buida",
9
+ form: {
10
+ lightFilter: {
11
+ more: "Més",
12
+ clear: "Netejar",
13
+ confirm: "Confirmar",
14
+ itemUnit: "Elements"
15
+ },
16
+ captcha: {
17
+ getCaptcha: "Obtén el codi de verificació",
18
+ resendAfter: "s per tornar a enviar"
19
+ },
20
+ upload: {
21
+ buttonText: "Fes clic per pujar",
22
+ draggerTitle: "Fes clic o arrossega el fitxer a aquesta zona per pujar-lo",
23
+ draggerDescription: "Admet càrrega única o múltiple"
24
+ },
25
+ modal: {
26
+ okText: "Confirmar",
27
+ cancelText: "Cancel·lar"
28
+ }
29
+ },
30
+ time: {
31
+ seconds: "segons",
32
+ minutes: "minuts",
33
+ hours: "hores",
34
+ days: "dies",
35
+ ago: "enrere"
36
+ },
37
+ tableForm: {
38
+ search: "Cercar",
39
+ reset: "Netejar",
40
+ submit: "Enviar",
41
+ collapsed: "Expandir",
42
+ expand: "Col·lapsar",
43
+ inputPlaceholder: "Introduïu valor",
44
+ selectPlaceholder: "Seleccioneu valor"
45
+ },
46
+ alert: {
47
+ clear: "Netejar",
48
+ selected: "Seleccionat",
49
+ item: "Article"
50
+ },
51
+ pagination: { total: {
52
+ range: " ",
53
+ total: "de",
54
+ item: "articles"
55
+ } },
56
+ tableToolBar: {
57
+ startPin: "Pin a l'esquerra",
58
+ endPin: "Pin a la dreta",
59
+ noPin: "Sense Pin",
60
+ startFixedTitle: "Fixat a l'esquerra",
61
+ endFixedTitle: "Fixat a la dreta",
62
+ noFixedTitle: "Sense fixar",
63
+ reset: "Reiniciar",
64
+ columnDisplay: "Mostrar Columna",
65
+ columnSetting: "Configuració",
66
+ fullScreen: "Pantalla Completa",
67
+ exitFullScreen: "Sortir Pantalla Completa",
68
+ reload: "Refrescar",
69
+ density: "Densitat",
70
+ densityDefault: "Per Defecte",
71
+ densityLarger: "Llarg",
72
+ densityMedium: "Mitjà",
73
+ densitySmall: "Compacte"
74
+ },
75
+ stepsForm: {
76
+ next: "Següent",
77
+ prev: "Anterior",
78
+ submit: "Finalizar"
79
+ },
80
+ loginForm: { submitText: "Entrar" },
81
+ editableTable: {
82
+ defaultFieldLabel: "Aquest camp",
83
+ defaultFieldType: "Text",
84
+ onlyOneLineEditor: "Només es pot editar una línia alhora",
85
+ onlyAddOneLine: "Només es pot afegir una línia alhora",
86
+ action: {
87
+ save: "Guardar",
88
+ cancel: "Cancel·lar",
89
+ delete: "Eliminar",
90
+ add: "afegir una fila de dades"
91
+ }
92
+ },
93
+ switch: {
94
+ open: "obert",
95
+ close: "tancat"
96
+ }
97
+ };
98
+ //#endregion
99
+ export { caES as default };
@@ -0,0 +1,6 @@
1
+ import { ProLocale } from "./zh_CN.js";
2
+
3
+ //#region src/locale/cs_CZ.d.ts
4
+ declare const csCZ: ProLocale;
5
+ //#endregion
6
+ export { csCZ as default };