seeder-st2110-components 1.7.14 → 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 +69 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +69 -20
- 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,12 +183,13 @@ 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
|
-
//
|
|
192
|
+
// 默认语言:中文
|
|
176
193
|
return 'zh-CN';
|
|
177
194
|
};
|
|
178
195
|
|
|
@@ -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
|
* 在组件库初始化时调用,注册默认语言包
|
|
@@ -1687,6 +1728,8 @@ var zhCN = {
|
|
|
1687
1728
|
// 通用按钮
|
|
1688
1729
|
'button.close': '关闭',
|
|
1689
1730
|
'button.apply': '应用',
|
|
1731
|
+
'button.cancel': '取消',
|
|
1732
|
+
'button.delete': '删除',
|
|
1690
1733
|
// 输入框占位符
|
|
1691
1734
|
'input.placeholder.enterInteger': '请输入整数',
|
|
1692
1735
|
'input.placeholder.enterPort': '请输入端口 (0-65535)',
|
|
@@ -1720,7 +1763,7 @@ var zhCN = {
|
|
|
1720
1763
|
'networkSettings.restartLater': '稍后重启',
|
|
1721
1764
|
'networkSettings.saveSuccess': '保存成功',
|
|
1722
1765
|
// PTP Modal
|
|
1723
|
-
'ptp.title': 'PTP
|
|
1766
|
+
'ptp.title': 'PTP',
|
|
1724
1767
|
'ptp.domainNumber': '域编号',
|
|
1725
1768
|
'ptp.priority1': '优先级 1',
|
|
1726
1769
|
'ptp.priority2': '优先级 2',
|
|
@@ -1732,16 +1775,18 @@ var zhCN = {
|
|
|
1732
1775
|
'ptp.offsetScaledLogVariance': '时钟偏移方差',
|
|
1733
1776
|
'ptp.portIdentity': '端口标识',
|
|
1734
1777
|
'ptp.grandmasterIdentity': '主时钟 ID',
|
|
1735
|
-
'ptp.utcOffset': 'UTC
|
|
1778
|
+
'ptp.utcOffset': 'UTC 偏移',
|
|
1779
|
+
'ptp.connectedStatus': '连接状态',
|
|
1780
|
+
'ptp.lockedStatus': '锁定状态',
|
|
1736
1781
|
'ptp.connected': '已连接',
|
|
1737
1782
|
'ptp.disconnected': '未连接',
|
|
1738
1783
|
'ptp.locked': '已锁定',
|
|
1739
1784
|
'ptp.unlocked': '未锁定',
|
|
1740
1785
|
'ptp.saveSuccess': '保存成功',
|
|
1741
1786
|
// NMOS Modal
|
|
1742
|
-
'nmos.title': 'NMOS
|
|
1787
|
+
'nmos.title': 'NMOS',
|
|
1743
1788
|
'nmos.hostAddress': '主机地址',
|
|
1744
|
-
'nmos.domain': '
|
|
1789
|
+
'nmos.domain': '域名',
|
|
1745
1790
|
'nmos.registrationPort': '注册端口',
|
|
1746
1791
|
'nmos.registryAddress': '注册服务器地址',
|
|
1747
1792
|
'nmos.registryVersion': '注册版本',
|
|
@@ -1807,7 +1852,7 @@ var zhCN = {
|
|
|
1807
1852
|
// 系统操作
|
|
1808
1853
|
'system.poweroff': '关机',
|
|
1809
1854
|
'system.restart': '重启',
|
|
1810
|
-
'system.action.powerOff': '
|
|
1855
|
+
'system.action.powerOff': '关闭',
|
|
1811
1856
|
'system.action.restart': '重启',
|
|
1812
1857
|
'system.confirm.title': '确认操作',
|
|
1813
1858
|
'system.confirm.message': '确定要{action}系统吗?此操作无法撤销。',
|
|
@@ -1831,6 +1876,8 @@ var enUS = {
|
|
|
1831
1876
|
// General buttons
|
|
1832
1877
|
'button.close': 'Close',
|
|
1833
1878
|
'button.apply': 'Apply',
|
|
1879
|
+
'button.cancel': 'Cancel',
|
|
1880
|
+
'button.delete': 'Delete',
|
|
1834
1881
|
// Input placeholders
|
|
1835
1882
|
'input.placeholder.enterInteger': 'Enter an integer',
|
|
1836
1883
|
'input.placeholder.enterPort': ' Enter port (0-65535)',
|
|
@@ -1864,8 +1911,8 @@ var enUS = {
|
|
|
1864
1911
|
'networkSettings.restartLater': 'Restart Later',
|
|
1865
1912
|
'networkSettings.saveSuccess': 'Success',
|
|
1866
1913
|
// PTP Modal
|
|
1867
|
-
'ptp.title': 'PTP
|
|
1868
|
-
'ptp.domainNumber': 'Domain
|
|
1914
|
+
'ptp.title': 'PTP',
|
|
1915
|
+
'ptp.domainNumber': 'Domain',
|
|
1869
1916
|
'ptp.priority1': 'Priority 1',
|
|
1870
1917
|
'ptp.priority2': 'Priority 2',
|
|
1871
1918
|
'ptp.clockClass': 'Clock Class',
|
|
@@ -1877,14 +1924,16 @@ var enUS = {
|
|
|
1877
1924
|
'ptp.portIdentity': 'Port Identity',
|
|
1878
1925
|
'ptp.grandmasterIdentity': 'Grandmaster Identity',
|
|
1879
1926
|
'ptp.utcOffset': 'UTC Offset',
|
|
1927
|
+
'ptp.connectedStatus': 'Connected Status',
|
|
1928
|
+
'ptp.lockedStatus': 'Locked Status',
|
|
1880
1929
|
'ptp.connected': 'Connected',
|
|
1881
1930
|
'ptp.disconnected': 'Disconnected',
|
|
1882
1931
|
'ptp.locked': 'Locked',
|
|
1883
1932
|
'ptp.unlocked': 'Unlocked',
|
|
1884
1933
|
'ptp.saveSuccess': 'Success',
|
|
1885
1934
|
// NMOS Modal
|
|
1886
|
-
'nmos.title': 'NMOS
|
|
1887
|
-
'nmos.hostAddress': 'Host
|
|
1935
|
+
'nmos.title': 'NMOS',
|
|
1936
|
+
'nmos.hostAddress': 'Host Addresses',
|
|
1888
1937
|
'nmos.domain': 'Domain',
|
|
1889
1938
|
'nmos.registryAddress': 'Registry Address',
|
|
1890
1939
|
'nmos.registrationPort': 'Registry Port',
|
|
@@ -1933,7 +1982,7 @@ var enUS = {
|
|
|
1933
1982
|
'license.status.activated': 'Already activated',
|
|
1934
1983
|
'license.status.expired': 'Expired',
|
|
1935
1984
|
'license.status.invalid': 'Invalid',
|
|
1936
|
-
'license.status.expiresOn': '
|
|
1985
|
+
'license.status.expiresOn': 'will expire on',
|
|
1937
1986
|
'license.validation.keyRequired': 'License key cannot be empty',
|
|
1938
1987
|
'license.error.authorizationFailed': 'Authorization failed',
|
|
1939
1988
|
// Upgrade related
|
|
@@ -2462,7 +2511,7 @@ const defaultFieldConfigs = {
|
|
|
2462
2511
|
readOnly: true
|
|
2463
2512
|
},
|
|
2464
2513
|
is_connected: {
|
|
2465
|
-
label: 'ptp.
|
|
2514
|
+
label: 'ptp.connectedStatus',
|
|
2466
2515
|
formType: 'badge',
|
|
2467
2516
|
statusMap: {
|
|
2468
2517
|
0: {
|
|
@@ -2476,7 +2525,7 @@ const defaultFieldConfigs = {
|
|
|
2476
2525
|
}
|
|
2477
2526
|
},
|
|
2478
2527
|
is_locked: {
|
|
2479
|
-
label: 'ptp.
|
|
2528
|
+
label: 'ptp.lockedStatus',
|
|
2480
2529
|
formType: 'badge',
|
|
2481
2530
|
statusMap: {
|
|
2482
2531
|
0: {
|