seeder-st2110-components 1.5.7 → 1.5.9

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 CHANGED
@@ -2036,7 +2036,7 @@ const SystemOperations = _ref => {
2036
2036
  onRestart,
2037
2037
  powerOffLabel = "Power Off",
2038
2038
  restartLabel = "Restart",
2039
- iconClassName = "seeder-iconfont seeder-icon-guanji1 text-2xl text-neutral-400",
2039
+ iconClassName = "seeder-iconfont seeder-icon-guanji1 text-xl text-neutral-400",
2040
2040
  confirmTitle = "Confirm",
2041
2041
  cancelText = "No",
2042
2042
  okText = "Yes",
@@ -2844,6 +2844,7 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
2844
2844
  onLoad,
2845
2845
  isLoading,
2846
2846
  isEditing,
2847
+ originalPresetData,
2847
2848
  fields = {
2848
2849
  name: {
2849
2850
  label: "Preset Name",
@@ -2893,8 +2894,9 @@ const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
2893
2894
  const formValues = await form.validateFields();
2894
2895
  const loadData = {
2895
2896
  id: form.getFieldValue('id'),
2896
- // 只加载当前勾选的选项
2897
- category_list: formValues.category_list || []
2897
+ // 优先使用表单中的 category_list,如果没有则使用原始数据
2898
+ name: originalPresetData.name,
2899
+ category_list: hasCategoryList ? formValues.category_list || [] : (originalPresetData === null || originalPresetData === void 0 ? void 0 : originalPresetData.category_list) || []
2898
2900
  };
2899
2901
  await onLoad(loadData);
2900
2902
  } catch (error) {
@@ -2997,6 +2999,7 @@ const Preset = _ref => {
2997
2999
  title: "Preset Management",
2998
3000
  emptyText: "Select a preset from the list to view details",
2999
3001
  deleteConfirm: "Are you sure to delete preset",
3002
+ loadConfirm: "Are you sure you want to load preset",
3000
3003
  loadText: "Loading...",
3001
3004
  successText: "Success",
3002
3005
  newButton: "New Preset",
@@ -3068,7 +3071,8 @@ const Preset = _ref => {
3068
3071
  try {
3069
3072
  AntdModal.confirm({
3070
3073
  icon: /*#__PURE__*/jsx(ExclamationCircleFilled, {}),
3071
- title: "".concat(texts.deleteConfirm, " \"").concat(presetName, "\"?"),
3074
+ title: 'Delete Preset',
3075
+ content: "".concat(texts.deleteConfirm, " \"").concat(presetName, "\"?"),
3072
3076
  cancelText: 'No',
3073
3077
  okText: 'Yes',
3074
3078
  onOk: async () => {
@@ -3095,46 +3099,55 @@ const Preset = _ref => {
3095
3099
  const handleLoadPreset = useCallback(async loadData => {
3096
3100
  if (!loadData) return;
3097
3101
 
3098
- // 显示加载模态框
3099
- const modalInstance = Modal.info({
3100
- title: texts.loadText,
3101
- content: /*#__PURE__*/jsx(Spin, {
3102
- size: "large",
3103
- className: "block mx-auto"
3104
- }),
3105
- maskClosable: false,
3106
- okButtonProps: {
3107
- style: {
3108
- display: 'none'
3102
+ // 显示确认对话框
3103
+ AntdModal.confirm({
3104
+ title: 'Load Preset',
3105
+ content: "".concat(texts.loadConfirm, " \"").concat(loadData.name, "\"?"),
3106
+ cancelText: 'No',
3107
+ okText: 'Yes',
3108
+ onOk: async () => {
3109
+ // 显示加载模态框
3110
+ const modalInstance = Modal.info({
3111
+ title: texts.loadText,
3112
+ content: /*#__PURE__*/jsx(Spin, {
3113
+ size: "large",
3114
+ className: "block mx-auto"
3115
+ }),
3116
+ maskClosable: false,
3117
+ okButtonProps: {
3118
+ style: {
3119
+ display: 'none'
3120
+ }
3121
+ }
3122
+ });
3123
+ try {
3124
+ await loadPreset(_objectSpread2({
3125
+ id: loadData.id
3126
+ }, loadData.category_list && {
3127
+ category_list: loadData.category_list
3128
+ }));
3129
+ // 成功时延迟关闭
3130
+ setTimeout(() => {
3131
+ modalInstance.destroy();
3132
+ AntdMessage.success(texts.successText);
3133
+
3134
+ // 加载成功的外部回调
3135
+ if (onLoadSuccess) {
3136
+ onLoadSuccess(loadData);
3137
+ }
3138
+ }, 1000);
3139
+ } catch (error) {
3140
+ console.error('Failed to load preset:', error);
3141
+ modalInstance.destroy();
3142
+
3143
+ // 加载失败的外部回调
3144
+ if (onLoadError) {
3145
+ onLoadError(error, loadData);
3146
+ }
3109
3147
  }
3110
3148
  }
3111
3149
  });
3112
- try {
3113
- await loadPreset(_objectSpread2({
3114
- id: loadData.id
3115
- }, loadData.category_list && {
3116
- category_list: loadData.category_list
3117
- }));
3118
- // 成功时延迟关闭
3119
- setTimeout(() => {
3120
- modalInstance.destroy();
3121
- AntdMessage.success(texts.successText);
3122
-
3123
- // 加载成功的外部回调
3124
- if (onLoadSuccess) {
3125
- onLoadSuccess(loadData);
3126
- }
3127
- }, 1000);
3128
- } catch (error) {
3129
- console.error('Failed to load preset:', error);
3130
- modalInstance.destroy();
3131
-
3132
- // 加载失败的外部回调
3133
- if (onLoadError) {
3134
- onLoadError(error, loadData);
3135
- }
3136
- }
3137
- }, [loadPreset, texts, AntdMessage]);
3150
+ }, [loadPreset, texts, AntdMessage, AntdModal, onLoadSuccess, onLoadError]);
3138
3151
  const handleSave = useCallback(async () => {
3139
3152
  setLoading(true);
3140
3153
  try {
@@ -3200,6 +3213,8 @@ const Preset = _ref => {
3200
3213
  onLoad: handleLoadPreset,
3201
3214
  isLoading: loading,
3202
3215
  isEditing: !!(selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.id),
3216
+ originalPresetData: selectedPreset // 传递原始数据
3217
+ ,
3203
3218
  fields: fields,
3204
3219
  texts: {
3205
3220
  loadButton: texts.loadButton,