seeder-st2110-components 2.0.0 → 2.0.2
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 +116 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +116 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1690,7 +1690,7 @@ var zhCN = {
|
|
|
1690
1690
|
'networkSettings.name': '名称',
|
|
1691
1691
|
'networkSettings.ipAddress': 'IP 地址',
|
|
1692
1692
|
'networkSettings.subnetMask': '子网掩码',
|
|
1693
|
-
'networkSettings.restartRequired': '
|
|
1693
|
+
'networkSettings.restartRequired': '需要重启才能应用更改。是否立即重启?',
|
|
1694
1694
|
'networkSettings.restartNow': '立即重启',
|
|
1695
1695
|
'networkSettings.restartLater': '稍后重启',
|
|
1696
1696
|
'networkSettings.saveSuccess': '保存成功',
|
|
@@ -1699,14 +1699,14 @@ var zhCN = {
|
|
|
1699
1699
|
'ptp.domainNumber': '域编号',
|
|
1700
1700
|
'ptp.priority1': '优先级 1',
|
|
1701
1701
|
'ptp.priority2': '优先级 2',
|
|
1702
|
+
'ptp.grandmasterIdentity': '主时钟 ID',
|
|
1703
|
+
'ptp.portIdentity': '端口标识',
|
|
1702
1704
|
'ptp.clockClass': '时钟等级',
|
|
1703
1705
|
'ptp.clockClass.atomic': '原子钟 ({value})',
|
|
1704
1706
|
'ptp.clockClass.gps': 'GPS ({value})',
|
|
1705
1707
|
'ptp.clockClass.slaveOnly': '仅从时钟 ({value})',
|
|
1706
1708
|
'ptp.clockAccuracy': '时钟精度',
|
|
1707
1709
|
'ptp.offsetScaledLogVariance': '时钟偏移方差',
|
|
1708
|
-
'ptp.portIdentity': '端口标识',
|
|
1709
|
-
'ptp.grandmasterIdentity': '主时钟 ID',
|
|
1710
1710
|
'ptp.utcOffset': 'UTC 偏移',
|
|
1711
1711
|
'ptp.connectedStatus': '连接状态',
|
|
1712
1712
|
'ptp.lockedStatus': '锁定状态',
|
|
@@ -1715,16 +1715,17 @@ var zhCN = {
|
|
|
1715
1715
|
'ptp.locked': '已锁定',
|
|
1716
1716
|
'ptp.unlocked': '未锁定',
|
|
1717
1717
|
'ptp.saveSuccess': '保存成功',
|
|
1718
|
+
'ptp.unknown': '未知',
|
|
1718
1719
|
// NMOS Modal
|
|
1719
1720
|
'nmos.title': 'NMOS',
|
|
1720
1721
|
'nmos.hostAddress': '主机地址',
|
|
1721
1722
|
'nmos.domain': '域名',
|
|
1722
|
-
'nmos.
|
|
1723
|
-
'nmos.
|
|
1724
|
-
'nmos.registryVersion': '
|
|
1723
|
+
'nmos.registryAddress': '注册中心地址',
|
|
1724
|
+
'nmos.registrationPort': '注册中心端口',
|
|
1725
|
+
'nmos.registryVersion': '注册中心版本',
|
|
1725
1726
|
'nmos.loggingLevel': '日志级别',
|
|
1726
1727
|
'nmos.placeholder.selectHostAddress': '选择主机地址',
|
|
1727
|
-
'nmos.placeholder.selectVersion': '
|
|
1728
|
+
'nmos.placeholder.selectVersion': '选择版本',
|
|
1728
1729
|
'nmos.saveSuccess': '保存成功',
|
|
1729
1730
|
// Preset Modal
|
|
1730
1731
|
'preset.title': '预设管理',
|
|
@@ -1742,6 +1743,8 @@ var zhCN = {
|
|
|
1742
1743
|
'preset.button.save': '保存',
|
|
1743
1744
|
'preset.button.edit': '编辑',
|
|
1744
1745
|
'preset.button.cancel': '取消',
|
|
1746
|
+
'preset.button.import': '导入',
|
|
1747
|
+
'preset.button.export': '导出',
|
|
1745
1748
|
'preset.empty.noData': '从列表中选择一个预设查看详情',
|
|
1746
1749
|
'preset.unsaved.detected': '检测到未保存的预设',
|
|
1747
1750
|
'preset.empty.create': '创建新预设',
|
|
@@ -1755,6 +1758,7 @@ var zhCN = {
|
|
|
1755
1758
|
'preset.validation.nameRequired': '名称是必填项',
|
|
1756
1759
|
'preset.validation.categoryRequired': '请选择分类',
|
|
1757
1760
|
'preset.error.noSelectionOrIdMissing': '未选择预设或预设 ID 缺失',
|
|
1761
|
+
'preset.import.invalidFile': '请选择 .preset 格式的文件',
|
|
1758
1762
|
// License/Auth Modal
|
|
1759
1763
|
'license.title': '注册许可证',
|
|
1760
1764
|
'license.machineCode': '机器码',
|
|
@@ -1839,7 +1843,7 @@ var enUS = {
|
|
|
1839
1843
|
'networkSettings.name': 'Name',
|
|
1840
1844
|
'networkSettings.ipAddress': 'IP Address',
|
|
1841
1845
|
'networkSettings.subnetMask': 'Netmask',
|
|
1842
|
-
'networkSettings.restartRequired': '
|
|
1846
|
+
'networkSettings.restartRequired': 'Restart is required to apply the changes. Do you want to restart now?',
|
|
1843
1847
|
'networkSettings.restartNow': 'Restart Now',
|
|
1844
1848
|
'networkSettings.restartLater': 'Restart Later',
|
|
1845
1849
|
'networkSettings.saveSuccess': 'Success',
|
|
@@ -1848,14 +1852,14 @@ var enUS = {
|
|
|
1848
1852
|
'ptp.domainNumber': 'Domain',
|
|
1849
1853
|
'ptp.priority1': 'Priority 1',
|
|
1850
1854
|
'ptp.priority2': 'Priority 2',
|
|
1855
|
+
'ptp.grandmasterIdentity': 'Grandmaster Identity',
|
|
1856
|
+
'ptp.portIdentity': 'Port Identity',
|
|
1851
1857
|
'ptp.clockClass': 'Clock Class',
|
|
1852
1858
|
'ptp.clockClass.atomic': 'Atomic Clock ({value})',
|
|
1853
1859
|
'ptp.clockClass.gps': 'GPS ({value})',
|
|
1854
1860
|
'ptp.clockClass.slaveOnly': 'Slave-Only ({value})',
|
|
1855
1861
|
'ptp.clockAccuracy': 'Clock Accuracy',
|
|
1856
1862
|
'ptp.offsetScaledLogVariance': 'Offset Scaled Log Variance',
|
|
1857
|
-
'ptp.portIdentity': 'Port Identity',
|
|
1858
|
-
'ptp.grandmasterIdentity': 'Grandmaster Identity',
|
|
1859
1863
|
'ptp.utcOffset': 'UTC Offset',
|
|
1860
1864
|
'ptp.connectedStatus': 'Connected Status',
|
|
1861
1865
|
'ptp.lockedStatus': 'Locked Status',
|
|
@@ -1864,6 +1868,7 @@ var enUS = {
|
|
|
1864
1868
|
'ptp.locked': 'Locked',
|
|
1865
1869
|
'ptp.unlocked': 'Unlocked',
|
|
1866
1870
|
'ptp.saveSuccess': 'Success',
|
|
1871
|
+
'ptp.unknown': 'Unknown',
|
|
1867
1872
|
// NMOS Modal
|
|
1868
1873
|
'nmos.title': 'NMOS',
|
|
1869
1874
|
'nmos.hostAddress': 'Host Addresses',
|
|
@@ -1891,6 +1896,8 @@ var enUS = {
|
|
|
1891
1896
|
'preset.button.save': 'Save',
|
|
1892
1897
|
'preset.button.edit': 'Edit',
|
|
1893
1898
|
'preset.button.cancel': 'Cancel',
|
|
1899
|
+
'preset.button.import': 'Import',
|
|
1900
|
+
'preset.button.export': 'Export',
|
|
1894
1901
|
'preset.empty.noData': 'Select a preset from the list to view details',
|
|
1895
1902
|
'preset.unsaved.detected': 'Existing unsaved preset detected',
|
|
1896
1903
|
'preset.empty.create': 'Create New Preset',
|
|
@@ -1904,6 +1911,7 @@ var enUS = {
|
|
|
1904
1911
|
'preset.validation.nameRequired': 'Name is required',
|
|
1905
1912
|
'preset.validation.categoryRequired': 'No category selected',
|
|
1906
1913
|
'preset.error.noSelectionOrIdMissing': 'No preset selected or preset ID is missing',
|
|
1914
|
+
'preset.import.invalidFile': 'Please select a file with the .preset extension.',
|
|
1907
1915
|
// License/Auth Modal
|
|
1908
1916
|
'license.title': 'Register License',
|
|
1909
1917
|
'license.machineCode': 'Machine Code',
|
|
@@ -2591,7 +2599,9 @@ const PtpModal = _ref => {
|
|
|
2591
2599
|
case 'badge':
|
|
2592
2600
|
const normalizedValue = typeof item.value === 'boolean' ? item.value ? 1 : 0 : item.value;
|
|
2593
2601
|
const status = ((_item$statusMap = item.statusMap) === null || _item$statusMap === void 0 ? void 0 : _item$statusMap[normalizedValue]) || {
|
|
2594
|
-
text:
|
|
2602
|
+
text: intl.formatMessage({
|
|
2603
|
+
id: ptp.unknown
|
|
2604
|
+
}),
|
|
2595
2605
|
color: 'gray'
|
|
2596
2606
|
};
|
|
2597
2607
|
return /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
|
|
@@ -2675,10 +2685,15 @@ const LeftList = /*#__PURE__*/React.memo(_ref => {
|
|
|
2675
2685
|
onSelectPreset,
|
|
2676
2686
|
onAddNew,
|
|
2677
2687
|
onRemove,
|
|
2688
|
+
onImport,
|
|
2689
|
+
onExport,
|
|
2678
2690
|
hasPresets = dataSource.length > 0,
|
|
2691
|
+
enableImportAndExport,
|
|
2679
2692
|
texts = {
|
|
2680
2693
|
newButton: "preset.button.new",
|
|
2681
|
-
removeButton: "preset.button.delete"
|
|
2694
|
+
removeButton: "preset.button.delete",
|
|
2695
|
+
importButton: "preset.button.import",
|
|
2696
|
+
exportButton: "preset.button.export"
|
|
2682
2697
|
}
|
|
2683
2698
|
} = _ref;
|
|
2684
2699
|
const intl = useIntl();
|
|
@@ -2780,6 +2795,19 @@ const LeftList = /*#__PURE__*/React.memo(_ref => {
|
|
|
2780
2795
|
className: "btn-gray",
|
|
2781
2796
|
onClick: onRemove,
|
|
2782
2797
|
children: texts.removeButton
|
|
2798
|
+
}), enableImportAndExport && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2799
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
2800
|
+
type: "default",
|
|
2801
|
+
className: "btn-gray",
|
|
2802
|
+
onClick: onImport,
|
|
2803
|
+
children: texts.importButton
|
|
2804
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
2805
|
+
type: "default",
|
|
2806
|
+
className: "btn-gray",
|
|
2807
|
+
onClick: onExport,
|
|
2808
|
+
disabled: !selectedPresetId,
|
|
2809
|
+
children: texts.exportButton
|
|
2810
|
+
})]
|
|
2783
2811
|
})]
|
|
2784
2812
|
})
|
|
2785
2813
|
})]
|
|
@@ -3036,6 +3064,8 @@ const Preset = _ref => {
|
|
|
3036
3064
|
removePreset,
|
|
3037
3065
|
loadPreset,
|
|
3038
3066
|
updatePreset,
|
|
3067
|
+
uploadPreset,
|
|
3068
|
+
downloadPreset,
|
|
3039
3069
|
onLoadSuccess,
|
|
3040
3070
|
// 加载成功后的回调
|
|
3041
3071
|
onLoadError,
|
|
@@ -3061,14 +3091,17 @@ const Preset = _ref => {
|
|
|
3061
3091
|
loadButton: "preset.button.load",
|
|
3062
3092
|
saveButton: "preset.button.save",
|
|
3063
3093
|
editButton: "preset.button.edit",
|
|
3064
|
-
cancelButton: "preset.button.cancel"
|
|
3094
|
+
cancelButton: "preset.button.cancel",
|
|
3095
|
+
importButton: "preset.button.import",
|
|
3096
|
+
exportButton: "preset.button.export"
|
|
3065
3097
|
},
|
|
3066
3098
|
// 样式定制
|
|
3067
3099
|
width = 1000,
|
|
3068
3100
|
height = 680,
|
|
3069
3101
|
className = "",
|
|
3070
3102
|
// 功能配置
|
|
3071
|
-
enableEdit = true
|
|
3103
|
+
enableEdit = true,
|
|
3104
|
+
enableImportAndExport = false
|
|
3072
3105
|
} = _ref;
|
|
3073
3106
|
const intl = useIntl();
|
|
3074
3107
|
const {
|
|
@@ -3078,6 +3111,7 @@ const Preset = _ref => {
|
|
|
3078
3111
|
const [presetList, setPresetList] = React.useState([]);
|
|
3079
3112
|
const [selectedPreset, setSelectedPreset] = React.useState(null);
|
|
3080
3113
|
const [loading, setLoading] = React.useState(false);
|
|
3114
|
+
const [uploading, setUploading] = React.useState(false);
|
|
3081
3115
|
const [presetChanged, setPresetChanged] = React.useState(0);
|
|
3082
3116
|
const [form] = antd.Form.useForm();
|
|
3083
3117
|
|
|
@@ -3196,6 +3230,68 @@ const Preset = _ref => {
|
|
|
3196
3230
|
console.error('Failed to delete preset:', error);
|
|
3197
3231
|
}
|
|
3198
3232
|
}, [selectedPreset, form, modal, message, removePreset, getPresetList, fmt]);
|
|
3233
|
+
const handleImport = React.useCallback(async () => {
|
|
3234
|
+
// 创建一个临时的 input 元素
|
|
3235
|
+
const input = document.createElement('input');
|
|
3236
|
+
input.type = 'file';
|
|
3237
|
+
input.accept = '.preset'; // 限制只能选择 .preset 文件
|
|
3238
|
+
|
|
3239
|
+
input.onchange = async e => {
|
|
3240
|
+
var _e$target$files;
|
|
3241
|
+
const file = (_e$target$files = e.target.files) === null || _e$target$files === void 0 ? void 0 : _e$target$files[0];
|
|
3242
|
+
if (!file) {
|
|
3243
|
+
return; // 用户取消选择
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
// 确保文件扩展名是 .preset(防止 accept 被绕过)
|
|
3247
|
+
if (!file.name.toLowerCase().endsWith('.preset')) {
|
|
3248
|
+
message.error(intl.formatMessage({
|
|
3249
|
+
id: 'preset.import.invalidFile'
|
|
3250
|
+
}));
|
|
3251
|
+
return;
|
|
3252
|
+
}
|
|
3253
|
+
try {
|
|
3254
|
+
setUploading(true);
|
|
3255
|
+
await uploadPreset(file);
|
|
3256
|
+
message.success(intl.formatMessage({
|
|
3257
|
+
id: 'preset.success'
|
|
3258
|
+
}));
|
|
3259
|
+
|
|
3260
|
+
// 上传成功后刷新列表
|
|
3261
|
+
fetchPresetList();
|
|
3262
|
+
} catch (error) {
|
|
3263
|
+
console.error('Failed to import preset file:', error);
|
|
3264
|
+
} finally {
|
|
3265
|
+
setUploading(false);
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
// 清理:移除 input
|
|
3269
|
+
input.remove();
|
|
3270
|
+
};
|
|
3271
|
+
|
|
3272
|
+
// 触发文件选择框
|
|
3273
|
+
input.click();
|
|
3274
|
+
}, [uploadPreset, message, intl, fetchPresetList]);
|
|
3275
|
+
const handleExport = React.useCallback(() => {
|
|
3276
|
+
if (!(selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.id)) {
|
|
3277
|
+
message.warning(intl.formatMessage({
|
|
3278
|
+
id: 'preset.error.noSelectionOrIdMissing'
|
|
3279
|
+
}));
|
|
3280
|
+
return;
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
// 构造下载 URL
|
|
3284
|
+
const downloadUrl = "".concat(downloadPreset, "/").concat(selectedPreset.id);
|
|
3285
|
+
|
|
3286
|
+
// 创建临时 a 标签
|
|
3287
|
+
const link = document.createElement('a');
|
|
3288
|
+
link.href = downloadUrl;
|
|
3289
|
+
link.download = "".concat(selectedPreset.name || 'preset', ".preset"); // 指定文件名
|
|
3290
|
+
|
|
3291
|
+
document.body.appendChild(link);
|
|
3292
|
+
link.click();
|
|
3293
|
+
document.body.removeChild(link);
|
|
3294
|
+
}, [selectedPreset, message, intl]);
|
|
3199
3295
|
const handleLoadPreset = React.useCallback(async loadData => {
|
|
3200
3296
|
if (!loadData) return;
|
|
3201
3297
|
let modalInstance = null;
|
|
@@ -3383,9 +3479,14 @@ const Preset = _ref => {
|
|
|
3383
3479
|
onSelectPreset: handleSelectPreset,
|
|
3384
3480
|
onAddNew: handleAddNew,
|
|
3385
3481
|
onRemove: handleRemove,
|
|
3482
|
+
onImport: handleImport,
|
|
3483
|
+
onExport: handleExport,
|
|
3484
|
+
enableImportAndExport: enableImportAndExport,
|
|
3386
3485
|
texts: {
|
|
3387
3486
|
newButton: fmt(texts.newButton),
|
|
3388
|
-
removeButton: fmt(texts.removeButton)
|
|
3487
|
+
removeButton: fmt(texts.removeButton),
|
|
3488
|
+
importButton: fmt(texts.importButton),
|
|
3489
|
+
exportButton: fmt(texts.exportButton)
|
|
3389
3490
|
}
|
|
3390
3491
|
})
|
|
3391
3492
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
|