zmdms-webui 2.7.6 → 2.7.7

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.
@@ -37,7 +37,7 @@ var CommonSearchList = function (props) {
37
37
  deleteData === null || deleteData === void 0 ? void 0 : deleteData(index);
38
38
  };
39
39
  return (jsxs("div", __assign({ className: "common-search-list--container" }, { children: [jsx("div", __assign({ className: "common-search-list--title" }, { children: "\u5E38\u7528\u641C\u7D22" })), jsx("div", __assign({ className: "common-search-list--content" }, { children: jsx(Sortable, { children: commonSearchList.map(function (item, index) {
40
- return (jsx(Sortable.Item, __assign({ onMoveItem: onMoveItem, onMoveEnd: onMoveEnd, index: index, type: sortableType }, { children: jsxs(ButtonCom, __assign({ type: currentCommonSearchKey === item.key ? "primary" : undefined, onClick: function () {
40
+ return (jsx(Sortable.Item, __assign({ onMoveItem: onMoveItem, onMoveEnd: onMoveEnd, index: index, type: sortableType }, { children: jsxs(ButtonCom, __assign({ type: currentCommonSearchKey === item.key ? "primary" : undefined, isWhite: true, onClick: function () {
41
41
  handleClick(item);
42
42
  if (currentCommonSearchKey === item.key) {
43
43
  return;
@@ -44,6 +44,7 @@ var Form = function (props, ref) {
44
44
  form: form,
45
45
  setData: setData,
46
46
  isCommonSearchEnabled: isCommonSearchEnabled,
47
+ setCurrentCommonSearchKey: setCurrentCommonSearchKey,
47
48
  }).onCommonSearchHandle;
48
49
  // 获取新的items 如果传入了配置项的话,配置项优先
49
50
  var configInfoItems = useFormPreferencesCreateNewItems(formPreferences, items).configInfoItems;
@@ -127,6 +128,7 @@ var Form = function (props, ref) {
127
128
  var _d = useBtnHandle(form, {
128
129
  onSearchHandle: onSearchHandle,
129
130
  onResetHandle: onResetHandle,
131
+ setCurrentCommonSearchKey: setCurrentCommonSearchKey,
130
132
  }), onSearchHandleInner = _d.onSearchHandleInner, onResetHandleInner = _d.onResetHandleInner, onDropdownResetHandleInner = _d.onDropdownResetHandleInner;
131
133
  var leftWrapRef = useRef(null);
132
134
  var _e = useToggle(leftWrapRef, {
@@ -139,7 +141,7 @@ var Form = function (props, ref) {
139
141
  setToggleHandle: setToggleHandle,
140
142
  };
141
143
  });
142
- return (jsxs(FormContext.Provider, __assign({ value: { onSearch: onSearchHandleInner } }, { children: [jsxs(Form$1, __assign({ form: form, onValuesChange: onValuesChangeHandle }, restProps, { className: wrapClasses }, { children: [jsx("div", __assign({ className: leftClasses, ref: leftWrapRef }, { children: items ? (jsx(FormItems, { items: dynamicKey ? newItems : configInfoItems, outsideState: outsideState })) : (children) })), jsxs("div", __assign({ className: "ztxk-form--operation" }, { children: [dynamicKey ? (jsx(DynamicSetting, { dynamicKey: dynamicKey, parentDynamicKey: FORM_DYNAMIC_KEY, defaultList: dynamicList, onCurrentListChange: onCurrentListChange, ref: dynamicSettingRef })) : null, isToggle ? (jsx(Toggle, { toggle: toggle, onClick: onToggleChange })) : null] })), rightWrapVisible ? (jsxs("div", __assign({ className: rightClasses }, { children: [jsxs("div", __assign({ className: "ztxk-form__right--common-left" }, { children: [isResetAndClear ? (jsx(ResetButton, { onClick: onDropdownResetHandleInner })) : (jsx(ButtonCom, __assign({ type: "default", onClick: onResetHandleInner }, { children: "\u91CD\u7F6E" }))), jsx(ButtonCom, __assign({ type: "primary", onClick: onSearchHandleInner }, { children: "\u67E5\u8BE2" }))] })), isCommonSearchEnabled ? (jsx("div", __assign({ className: "ztxk-form__right--common-right" }, { children: jsx(ButtonCom, __assign({ style: { width: "100%" }, onClick: onCommonSearchHandle }, { children: currentCommonSearchKey ? "更新常用搜索" : "保存为常用搜索" })) }))) : null] }))) : null] })), isCommonSearchEnabled ? (jsx(CommonSearchList, { commonSearchList: commonSearchList, setCommonSearchList: setCommonSearchList, currentCommonSearchKey: currentCommonSearchKey, setCurrentCommonSearchKey: setCurrentCommonSearchKey, form: form, reTransformData: reTransformData, deleteData: deleteData, setReplaceData: setReplaceData, updateServerData: updateServerData, onSearchHandle: onSearchHandleInner })) : null] })));
144
+ return (jsxs(FormContext.Provider, __assign({ value: { onSearch: onSearchHandleInner } }, { children: [jsxs(Form$1, __assign({ form: form, onValuesChange: onValuesChangeHandle }, restProps, { className: wrapClasses }, { children: [jsx("div", __assign({ className: leftClasses, ref: leftWrapRef }, { children: items ? (jsx(FormItems, { items: dynamicKey ? newItems : configInfoItems, outsideState: outsideState })) : (children) })), jsxs("div", __assign({ className: "ztxk-form--operation" }, { children: [dynamicKey ? (jsx(DynamicSetting, { dynamicKey: dynamicKey, parentDynamicKey: FORM_DYNAMIC_KEY, defaultList: dynamicList, onCurrentListChange: onCurrentListChange, ref: dynamicSettingRef })) : null, isToggle ? (jsx(Toggle, { toggle: toggle, onClick: onToggleChange })) : null] })), rightWrapVisible ? (jsxs("div", __assign({ className: rightClasses }, { children: [jsxs("div", __assign({ className: "ztxk-form__right--common-left" }, { children: [isResetAndClear ? (jsx(ResetButton, { onClick: onDropdownResetHandleInner })) : (jsx(ButtonCom, __assign({ type: "default", onClick: onResetHandleInner }, { children: "\u91CD\u7F6E" }))), jsx(ButtonCom, __assign({ type: "primary", onClick: onSearchHandleInner }, { children: "\u67E5\u8BE2" }))] })), isCommonSearchEnabled ? (jsx("div", __assign({ className: "ztxk-form__right--common-right" }, { children: jsx(ButtonCom, __assign({ style: { width: "100%" }, onClick: onCommonSearchHandle }, { children: "\u4FDD\u5B58\u4E3A\u5E38\u7528\u641C\u7D22" })) }))) : null] }))) : null] })), isCommonSearchEnabled ? (jsx(CommonSearchList, { commonSearchList: commonSearchList, setCommonSearchList: setCommonSearchList, currentCommonSearchKey: currentCommonSearchKey, setCurrentCommonSearchKey: setCurrentCommonSearchKey, form: form, reTransformData: reTransformData, deleteData: deleteData, setReplaceData: setReplaceData, updateServerData: updateServerData, onSearchHandle: onSearchHandleInner })) : null] })));
143
145
  };
144
146
  var MemoForm = memo(forwardRef(Form));
145
147
  MemoForm.displayName = "ZTXK_WEBUI_Form";
@@ -116,20 +116,22 @@ function useDynamicListByItems(items, options) {
116
116
  }
117
117
  // 右侧按钮组
118
118
  function useBtnHandle(form, handleObj) {
119
- var onResetHandle = handleObj.onResetHandle, onSearchHandle = handleObj.onSearchHandle;
119
+ var onResetHandle = handleObj.onResetHandle, onSearchHandle = handleObj.onSearchHandle, setCurrentCommonSearchKey = handleObj.setCurrentCommonSearchKey;
120
120
  var onResetHandleInner = useCallback(function () {
121
121
  form === null || form === void 0 ? void 0 : form.resetFields();
122
+ setCurrentCommonSearchKey === null || setCurrentCommonSearchKey === void 0 ? void 0 : setCurrentCommonSearchKey("");
122
123
  onResetHandle && onResetHandle();
123
- }, [form, onResetHandle]);
124
+ }, [form, onResetHandle, setCurrentCommonSearchKey]);
124
125
  var onDropdownResetHandleInner = useCallback(function (key) {
125
126
  form === null || form === void 0 ? void 0 : form.resetFields();
127
+ setCurrentCommonSearchKey === null || setCurrentCommonSearchKey === void 0 ? void 0 : setCurrentCommonSearchKey("");
126
128
  if (key === "clear") {
127
129
  onResetHandle && onResetHandle({});
128
130
  }
129
131
  else {
130
132
  onResetHandle && onResetHandle();
131
133
  }
132
- }, [form, onResetHandle]);
134
+ }, [form, onResetHandle, setCurrentCommonSearchKey]);
133
135
  var onSearchHandleInner = useCallback(function () {
134
136
  // 当前表单数据
135
137
  var currentFormParams = form === null || form === void 0 ? void 0 : form.getFieldsValue(true);
@@ -125,7 +125,7 @@ function useCommonSearch(options) {
125
125
  result[index] = saveData;
126
126
  }
127
127
  else {
128
- result.push(saveData);
128
+ result.unshift(saveData);
129
129
  }
130
130
  }
131
131
  setCommonSearchList(result);
@@ -213,7 +213,7 @@ function useCommonSearch(options) {
213
213
  };
214
214
  }
215
215
  function useCommonSearchModal(options) {
216
- var commonSearchList = options.commonSearchList, currentCommonSearchKey = options.currentCommonSearchKey, form = options.form, setData = options.setData, isCommonSearchEnabled = options.isCommonSearchEnabled;
216
+ var commonSearchList = options.commonSearchList, currentCommonSearchKey = options.currentCommonSearchKey, form = options.form, setData = options.setData, isCommonSearchEnabled = options.isCommonSearchEnabled, setCurrentCommonSearchKey = options.setCurrentCommonSearchKey;
217
217
  var iptRef = useRef(null);
218
218
  useEffect(function () {
219
219
  var _a;
@@ -238,7 +238,8 @@ function useCommonSearchModal(options) {
238
238
  }
239
239
  ModalComponent.confirm({
240
240
  icon: null,
241
- title: currentCommonSearchKey ? "更新常用搜索" : "保存为常用搜索",
241
+ // title: currentCommonSearchKey ? "更新常用搜索" : "保存为常用搜索",
242
+ title: "保存为常用搜索",
242
243
  content: jsx(MyInput, { ref: iptRef }),
243
244
  onOk: function () {
244
245
  var _a, _b;
@@ -257,7 +258,8 @@ function useCommonSearchModal(options) {
257
258
  data = {
258
259
  title: currentCommonName,
259
260
  value: currentData,
260
- key: currentCommonSearchKey || Date.now(),
261
+ // key: currentCommonSearchKey || Date.now(),
262
+ key: Date.now(),
261
263
  };
262
264
  _c.label = 1;
263
265
  case 1:
@@ -265,6 +267,7 @@ function useCommonSearchModal(options) {
265
267
  return [4 /*yield*/, (setData === null || setData === void 0 ? void 0 : setData(data))];
266
268
  case 2:
267
269
  _c.sent();
270
+ setCurrentCommonSearchKey === null || setCurrentCommonSearchKey === void 0 ? void 0 : setCurrentCommonSearchKey(data.key);
268
271
  myMessage.info("保存成功!");
269
272
  (_b = iptRef.current) === null || _b === void 0 ? void 0 : _b.setValue("");
270
273
  return [3 /*break*/, 4];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.7.6",
3
+ "version": "2.7.7",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",