seeder-st2110-components 1.7.15 → 1.7.16
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/dist/index.esm.js +63 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +63 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -149,16 +149,32 @@ if (process.env.NODE_ENV === 'development' && typeof window !== 'undefined') {
|
|
|
149
149
|
const getLocale = () => {
|
|
150
150
|
// 尝试从 Umi 获取语言设置
|
|
151
151
|
if (typeof window !== 'undefined') {
|
|
152
|
-
var _window$g_initialProp, _window$g_initialProp2;
|
|
153
|
-
// 方式 1:Umi 的
|
|
152
|
+
var _window$g_initialProp, _window$g_initialProp2, _window$g_initialProp3;
|
|
153
|
+
// 方式 1:Umi 的运行时语言(通过 umi 的 locale 服务)
|
|
154
|
+
// Umi 会在 window.g_lang 或 window.LOCALE 中存储当前语言
|
|
155
|
+
if (window.g_lang) {
|
|
156
|
+
return window.g_lang;
|
|
157
|
+
}
|
|
158
|
+
if (window.LOCALE) {
|
|
159
|
+
return window.LOCALE;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 方式 2:Umi 的 g_initialProps
|
|
154
163
|
if ((_window$g_initialProp = window.g_initialProps) !== null && _window$g_initialProp !== void 0 && _window$g_initialProp.locale) {
|
|
155
164
|
return window.g_initialProps.locale;
|
|
156
165
|
}
|
|
157
|
-
|
|
166
|
+
|
|
167
|
+
// 方式 3:Umi 的全局语言标记
|
|
158
168
|
if ((_window$g_initialProp2 = window.g_initialProps) !== null && _window$g_initialProp2 !== void 0 && (_window$g_initialProp2 = _window$g_initialProp2.___g_initialPropsFromServer) !== null && _window$g_initialProp2 !== void 0 && _window$g_initialProp2.locale) {
|
|
159
169
|
return window.g_initialProps.___g_initialPropsFromServer.locale;
|
|
160
170
|
}
|
|
161
|
-
|
|
171
|
+
|
|
172
|
+
// 方式 4:Umi 的 globalInitialProps
|
|
173
|
+
if ((_window$g_initialProp3 = window.g_initialPropsFromServer) !== null && _window$g_initialProp3 !== void 0 && _window$g_initialProp3.locale) {
|
|
174
|
+
return window.g_initialPropsFromServer.locale;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 方式 5:从 localStorage 读取(Umi 默认行为)
|
|
162
178
|
try {
|
|
163
179
|
const storedLocale = localStorage.getItem('umi-locale');
|
|
164
180
|
if (storedLocale) {
|
|
@@ -167,13 +183,14 @@ const getLocale = () => {
|
|
|
167
183
|
} catch (e) {
|
|
168
184
|
// localStorage 不可用时忽略
|
|
169
185
|
}
|
|
170
|
-
|
|
186
|
+
|
|
187
|
+
// 方式 6:组件库自定义语言标记
|
|
171
188
|
if (window.__COMPONENT_LOCALE__) {
|
|
172
189
|
return window.__COMPONENT_LOCALE__;
|
|
173
190
|
}
|
|
174
191
|
}
|
|
175
|
-
//
|
|
176
|
-
return '
|
|
192
|
+
// 默认语言:中文
|
|
193
|
+
return 'zh-CN';
|
|
177
194
|
};
|
|
178
195
|
|
|
179
196
|
/**
|
|
@@ -182,7 +199,7 @@ const getLocale = () => {
|
|
|
182
199
|
*/
|
|
183
200
|
const getMessages = () => {
|
|
184
201
|
if (typeof window !== 'undefined') {
|
|
185
|
-
var _window$
|
|
202
|
+
var _window$g_initialProp4;
|
|
186
203
|
// 尝试从多个来源读取语言包
|
|
187
204
|
const messages = {};
|
|
188
205
|
|
|
@@ -193,7 +210,7 @@ const getMessages = () => {
|
|
|
193
210
|
const projectMessages = window.__PROJECT_I18N_MESSAGES__ || {};
|
|
194
211
|
|
|
195
212
|
// 3. Umi 的语言包
|
|
196
|
-
const umiMessages = ((_window$
|
|
213
|
+
const umiMessages = ((_window$g_initialProp4 = window.g_initialProps) === null || _window$g_initialProp4 === void 0 ? void 0 : _window$g_initialProp4.messages) || {};
|
|
197
214
|
|
|
198
215
|
// 合并语言包(组件库的优先级最高,其次是主项目,最后是 Umi)
|
|
199
216
|
const allLocales = new Set([...Object.keys(componentMessages), ...Object.keys(projectMessages), ...Object.keys(umiMessages)]);
|
|
@@ -289,6 +306,30 @@ const addMessages = (locale, messages) => {
|
|
|
289
306
|
}
|
|
290
307
|
};
|
|
291
308
|
|
|
309
|
+
// 自动同步 Umi 语言配置(在组件库加载时执行)
|
|
310
|
+
if (typeof window !== 'undefined') {
|
|
311
|
+
// 尝试从 Umi 读取语言并同步到组件库
|
|
312
|
+
const syncLocaleFromUmi = () => {
|
|
313
|
+
var _window$g_initialProp5, _window$g_initialProp6;
|
|
314
|
+
const umiLocale = window.g_lang || window.LOCALE || ((_window$g_initialProp5 = window.g_initialProps) === null || _window$g_initialProp5 === void 0 ? void 0 : _window$g_initialProp5.locale) || ((_window$g_initialProp6 = window.g_initialPropsFromServer) === null || _window$g_initialProp6 === void 0 ? void 0 : _window$g_initialProp6.locale) || localStorage.getItem('umi-locale');
|
|
315
|
+
if (umiLocale && !window.__COMPONENT_LOCALE__) {
|
|
316
|
+
window.__COMPONENT_LOCALE__ = umiLocale;
|
|
317
|
+
console.log('[i18n] Synced locale from Umi:', umiLocale);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// 立即同步
|
|
322
|
+
syncLocaleFromUmi();
|
|
323
|
+
|
|
324
|
+
// 监听 localStorage 变化(处理语言切换)
|
|
325
|
+
window.addEventListener('storage', e => {
|
|
326
|
+
if (e.key === 'umi-locale' && e.newValue) {
|
|
327
|
+
window.__COMPONENT_LOCALE__ = e.newValue;
|
|
328
|
+
console.log('[i18n] Locale changed via storage:', e.newValue);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
292
333
|
/**
|
|
293
334
|
* 初始化国际化
|
|
294
335
|
* 在组件库初始化时调用,注册默认语言包
|
|
@@ -1722,7 +1763,7 @@ var zhCN = {
|
|
|
1722
1763
|
'networkSettings.restartLater': '稍后重启',
|
|
1723
1764
|
'networkSettings.saveSuccess': '保存成功',
|
|
1724
1765
|
// PTP Modal
|
|
1725
|
-
'ptp.title': 'PTP
|
|
1766
|
+
'ptp.title': 'PTP',
|
|
1726
1767
|
'ptp.domainNumber': '域编号',
|
|
1727
1768
|
'ptp.priority1': '优先级 1',
|
|
1728
1769
|
'ptp.priority2': '优先级 2',
|
|
@@ -1735,13 +1776,15 @@ var zhCN = {
|
|
|
1735
1776
|
'ptp.portIdentity': '端口标识',
|
|
1736
1777
|
'ptp.grandmasterIdentity': '主时钟 ID',
|
|
1737
1778
|
'ptp.utcOffset': 'UTC 偏移',
|
|
1779
|
+
'ptp.connectedStatus': '连接状态',
|
|
1780
|
+
'ptp.lockedStatus': '锁定状态',
|
|
1738
1781
|
'ptp.connected': '已连接',
|
|
1739
1782
|
'ptp.disconnected': '未连接',
|
|
1740
1783
|
'ptp.locked': '已锁定',
|
|
1741
1784
|
'ptp.unlocked': '未锁定',
|
|
1742
1785
|
'ptp.saveSuccess': '保存成功',
|
|
1743
1786
|
// NMOS Modal
|
|
1744
|
-
'nmos.title': 'NMOS
|
|
1787
|
+
'nmos.title': 'NMOS',
|
|
1745
1788
|
'nmos.hostAddress': '主机地址',
|
|
1746
1789
|
'nmos.domain': '域名',
|
|
1747
1790
|
'nmos.registrationPort': '注册端口',
|
|
@@ -1868,8 +1911,8 @@ var enUS = {
|
|
|
1868
1911
|
'networkSettings.restartLater': 'Restart Later',
|
|
1869
1912
|
'networkSettings.saveSuccess': 'Success',
|
|
1870
1913
|
// PTP Modal
|
|
1871
|
-
'ptp.title': 'PTP
|
|
1872
|
-
'ptp.domainNumber': 'Domain
|
|
1914
|
+
'ptp.title': 'PTP',
|
|
1915
|
+
'ptp.domainNumber': 'Domain',
|
|
1873
1916
|
'ptp.priority1': 'Priority 1',
|
|
1874
1917
|
'ptp.priority2': 'Priority 2',
|
|
1875
1918
|
'ptp.clockClass': 'Clock Class',
|
|
@@ -1881,14 +1924,16 @@ var enUS = {
|
|
|
1881
1924
|
'ptp.portIdentity': 'Port Identity',
|
|
1882
1925
|
'ptp.grandmasterIdentity': 'Grandmaster Identity',
|
|
1883
1926
|
'ptp.utcOffset': 'UTC Offset',
|
|
1927
|
+
'ptp.connectedStatus': 'Connected Status',
|
|
1928
|
+
'ptp.lockedStatus': 'Locked Status',
|
|
1884
1929
|
'ptp.connected': 'Connected',
|
|
1885
1930
|
'ptp.disconnected': 'Disconnected',
|
|
1886
1931
|
'ptp.locked': 'Locked',
|
|
1887
1932
|
'ptp.unlocked': 'Unlocked',
|
|
1888
1933
|
'ptp.saveSuccess': 'Success',
|
|
1889
1934
|
// NMOS Modal
|
|
1890
|
-
'nmos.title': 'NMOS
|
|
1891
|
-
'nmos.hostAddress': 'Host
|
|
1935
|
+
'nmos.title': 'NMOS',
|
|
1936
|
+
'nmos.hostAddress': 'Host Addresses',
|
|
1892
1937
|
'nmos.domain': 'Domain',
|
|
1893
1938
|
'nmos.registryAddress': 'Registry Address',
|
|
1894
1939
|
'nmos.registrationPort': 'Registry Port',
|
|
@@ -1937,7 +1982,7 @@ var enUS = {
|
|
|
1937
1982
|
'license.status.activated': 'Already activated',
|
|
1938
1983
|
'license.status.expired': 'Expired',
|
|
1939
1984
|
'license.status.invalid': 'Invalid',
|
|
1940
|
-
'license.status.expiresOn': '
|
|
1985
|
+
'license.status.expiresOn': 'will expire on',
|
|
1941
1986
|
'license.validation.keyRequired': 'License key cannot be empty',
|
|
1942
1987
|
'license.error.authorizationFailed': 'Authorization failed',
|
|
1943
1988
|
// Upgrade related
|
|
@@ -2466,7 +2511,7 @@ const defaultFieldConfigs = {
|
|
|
2466
2511
|
readOnly: true
|
|
2467
2512
|
},
|
|
2468
2513
|
is_connected: {
|
|
2469
|
-
label: 'ptp.
|
|
2514
|
+
label: 'ptp.connectedStatus',
|
|
2470
2515
|
formType: 'badge',
|
|
2471
2516
|
statusMap: {
|
|
2472
2517
|
0: {
|
|
@@ -2480,7 +2525,7 @@ const defaultFieldConfigs = {
|
|
|
2480
2525
|
}
|
|
2481
2526
|
},
|
|
2482
2527
|
is_locked: {
|
|
2483
|
-
label: 'ptp.
|
|
2528
|
+
label: 'ptp.lockedStatus',
|
|
2484
2529
|
formType: 'badge',
|
|
2485
2530
|
statusMap: {
|
|
2486
2531
|
0: {
|