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