zmdms-webui 3.1.0 → 3.1.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.
@@ -55,6 +55,8 @@ interface ILayoutSiderProps {
55
55
  defaultFixed?: boolean;
56
56
  /** 只有当主菜单有对应子菜单数据时,点击时才打开子菜单 */
57
57
  openOnlyHasSubmenus?: boolean;
58
+ /** 点击logo事件 */
59
+ onLogoClick?: () => void;
58
60
  }
59
61
  declare const _default: React__default.NamedExoticComponent<ILayoutSiderProps>;
60
62
 
@@ -16,7 +16,7 @@ var AppLayoutSider = function (props) {
16
16
  // 118 宽度改成 134宽度
17
17
  _b = props.siderWidth,
18
18
  // 118 宽度改成 134宽度
19
- siderWidth = _b === void 0 ? 134 : _b, _c = props.subMenuWidth, subMenuWidth = _c === void 0 ? 162 : _c, addTab = props.addTab, siderBg = props.siderBg, logo = props.logo, logoStyle = props.logoStyle, subMenuLogo = props.subMenuLogo, _d = props.isShowSearchInput, isShowSearchInput = _d === void 0 ? true : _d, apps = props.apps, activeTab = props.activeTab, userMenus = props.userMenus, userSubMenus = props.userSubMenus, mergeSystemIds = props.mergeSystemIds, postMergeSystemIds = props.postMergeSystemIds, drawerTitle = props.drawerTitle, selectMainMenu = props.selectMainMenu, menuJoinRule = props.menuJoinRule, renderItem = props.renderItem, defaultVisible = props.defaultVisible, defaultFixed = props.defaultFixed, openOnlyHasSubmenus = props.openOnlyHasSubmenus, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer;
19
+ siderWidth = _b === void 0 ? 134 : _b, _c = props.subMenuWidth, subMenuWidth = _c === void 0 ? 162 : _c, addTab = props.addTab, siderBg = props.siderBg, logo = props.logo, logoStyle = props.logoStyle, subMenuLogo = props.subMenuLogo, _d = props.isShowSearchInput, isShowSearchInput = _d === void 0 ? true : _d, apps = props.apps, activeTab = props.activeTab, userMenus = props.userMenus, userSubMenus = props.userSubMenus, mergeSystemIds = props.mergeSystemIds, postMergeSystemIds = props.postMergeSystemIds, drawerTitle = props.drawerTitle, selectMainMenu = props.selectMainMenu, menuJoinRule = props.menuJoinRule, renderItem = props.renderItem, defaultVisible = props.defaultVisible, defaultFixed = props.defaultFixed, openOnlyHasSubmenus = props.openOnlyHasSubmenus, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer, onLogoClick = props.onLogoClick;
20
20
  // 当前选中的主菜单item
21
21
  var _e = useState([]), mainMenuSelectedKeys = _e[0], setMainMenuSelectedKeys = _e[1];
22
22
  // 内部二级菜单管理
@@ -74,7 +74,7 @@ var AppLayoutSider = function (props) {
74
74
  menuJoinRule: menuJoinRule,
75
75
  getNewPath: getNewPath,
76
76
  renderItem: renderItem,
77
- } }, { children: jsx(Menu, { width: siderWidth, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, logo: logo, logoStyle: logoStyle, subMenuLogo: subMenuLogo, getPrefixByAppId: getPrefixByAppId, defaultVisible: defaultVisible, openOnlyHasSubmenus: openOnlyHasSubmenus, defaultFixed: defaultFixed, isShowSearchInput: isShowSearchInput, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine, subMenuItemLine: subMenuItemLine, bottomContainer: bottomContainer }) })) })));
77
+ } }, { children: jsx(Menu, { width: siderWidth, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, logo: logo, logoStyle: logoStyle, subMenuLogo: subMenuLogo, getPrefixByAppId: getPrefixByAppId, defaultVisible: defaultVisible, openOnlyHasSubmenus: openOnlyHasSubmenus, defaultFixed: defaultFixed, isShowSearchInput: isShowSearchInput, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine, subMenuItemLine: subMenuItemLine, bottomContainer: bottomContainer, onLogoClick: onLogoClick }) })) })));
78
78
  };
79
79
  AppLayoutSider.displayName = "ZTXK_WEBUI_AppLayoutSider";
80
80
  var AppLayoutSider$1 = memo(AppLayoutSider);
@@ -4,11 +4,11 @@ import { memo } from 'react';
4
4
  import classNames from '../../node_modules/classnames/index.js';
5
5
 
6
6
  var Logo = function (_a) {
7
- var logo = _a.logo, showLine = _a.showLine, style = _a.style;
7
+ var logo = _a.logo, showLine = _a.showLine, style = _a.style, onClick = _a.onClick;
8
8
  var classes = classNames("zmdms-logo", {
9
9
  "zmdms-logo--line": showLine,
10
10
  });
11
- return (jsx("div", __assign({ className: classes }, { children: jsx("img", { src: logo, title: "\u6D59\u6C5F\u4EA4\u901A\u96C6\u56E2", alt: "cico_logo", style: style }) })));
11
+ return (jsx("div", __assign({ className: classes }, { children: jsx("img", { src: logo, title: "\u6D59\u6C5F\u4EA4\u901A\u96C6\u56E2", alt: "cico_logo", style: style, onClick: onClick }) })));
12
12
  };
13
13
  var Logo$1 = memo(Logo);
14
14
 
@@ -7,7 +7,7 @@ import MainMenu from './MainMenu.js';
7
7
  import SubMenu from './SubMenu.js';
8
8
 
9
9
  var MenuCom = function (props) {
10
- var width = props.width, subMenuWidth = props.subMenuWidth, layoutSiderRef = props.layoutSiderRef, addTab = props.addTab, logo = props.logo, logoStyle = props.logoStyle, getPrefixByAppId = props.getPrefixByAppId, subMenuLogo = props.subMenuLogo, _a = props.defaultVisible, defaultVisible = _a === void 0 ? false : _a, openOnlyHasSubmenus = props.openOnlyHasSubmenus, defaultFixed = props.defaultFixed, isShowSearchInput = props.isShowSearchInput, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer;
10
+ var width = props.width, subMenuWidth = props.subMenuWidth, layoutSiderRef = props.layoutSiderRef, addTab = props.addTab, logo = props.logo, logoStyle = props.logoStyle, getPrefixByAppId = props.getPrefixByAppId, subMenuLogo = props.subMenuLogo, _a = props.defaultVisible, defaultVisible = _a === void 0 ? false : _a, openOnlyHasSubmenus = props.openOnlyHasSubmenus, defaultFixed = props.defaultFixed, isShowSearchInput = props.isShowSearchInput, hideSubMenuBg = props.hideSubMenuBg, menuItemLine = props.menuItemLine, subMenuItemLine = props.subMenuItemLine, bottomContainer = props.bottomContainer, onLogoClick = props.onLogoClick;
11
11
  // 二级菜单是否显示
12
12
  var _b = useState(defaultVisible), visible = _b[0], setVisible = _b[1];
13
13
  // 二级菜单Ref对象
@@ -27,7 +27,7 @@ var MenuCom = function (props) {
27
27
  var _a;
28
28
  (_a = subMenu.current) === null || _a === void 0 ? void 0 : _a.setVisible(false);
29
29
  }, []);
30
- return (jsxs("div", __assign({ className: "zmdms-menu", onMouseLeave: onMouseLeave }, { children: [jsx(Logo, { logo: logo, showLine: visible && !hideSubMenuBg, style: logoStyle }), isShowSearchInput && jsx(SearchInput, { setVisible: setVisible }), jsx(MainMenu, { onMouseEnter: onMouseEnter, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenu: subMenu, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine }), jsx(SubMenu, { ref: subMenu, marginLeft: width, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenuLogo: subMenuLogo, visible: visible, setVisible: setVisible, defaultFixed: defaultFixed, hideSubMenuBg: hideSubMenuBg, subMenuItemLine: subMenuItemLine, openOnlyHasSubmenus: openOnlyHasSubmenus }), bottomContainer] })));
30
+ return (jsxs("div", __assign({ className: "zmdms-menu", onMouseLeave: onMouseLeave }, { children: [jsx(Logo, { logo: logo, showLine: visible && !hideSubMenuBg, style: logoStyle, onClick: onLogoClick }), isShowSearchInput && jsx(SearchInput, { setVisible: setVisible }), jsx(MainMenu, { onMouseEnter: onMouseEnter, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenu: subMenu, hideSubMenuBg: hideSubMenuBg, menuItemLine: menuItemLine }), jsx(SubMenu, { ref: subMenu, marginLeft: width, subMenuWidth: subMenuWidth, layoutSiderRef: layoutSiderRef, addTab: addTab, getPrefixByAppId: getPrefixByAppId, subMenuLogo: subMenuLogo, visible: visible, setVisible: setVisible, defaultFixed: defaultFixed, hideSubMenuBg: hideSubMenuBg, subMenuItemLine: subMenuItemLine, openOnlyHasSubmenus: openOnlyHasSubmenus }), bottomContainer] })));
31
31
  };
32
32
  var Menu = memo(MenuCom);
33
33
 
@@ -26,6 +26,10 @@ interface IZtxkConfig {
26
26
  * 这里加一个属性来控制展示模式。默认还是展示div,点击时才会渲染input inputNumber等。
27
27
  */
28
28
  editTableInputMode?: "div" | "input";
29
+ /**
30
+ * 编辑表格组件是否默认显示allowClear
31
+ */
32
+ editTableInputAllowClear?: boolean;
29
33
  /**
30
34
  * 用户自定义配置的存储接口
31
35
  */
@@ -6,6 +6,7 @@ var ztxkConfig = {
6
6
  fileBaseUrl: "",
7
7
  noPermission: "display",
8
8
  editTableInputMode: "div",
9
+ editTableInputAllowClear: false,
9
10
  customConfigFetch: undefined,
10
11
  enableCommonSearch: false,
11
12
  enableDynamicColumnSearch: false,
@@ -16,7 +16,7 @@ import { Popover } from 'antd';
16
16
  var EnhanceCell = function (props) {
17
17
  var _a, _b;
18
18
  var record = props.record, propsIndex = props.index, editable = props.editable, editableConfig = props.editableConfig, dataIndex = props.dataIndex, title = props.title, onEditableSave = props.onEditableSave, dataSourceRef = props.dataSourceRef; props.onMouseEnter; props.onMouseLeave; var children = props.children, currentPage = props.currentPage, isValidate = props.isValidate, validate = props.validate, isRealTimeValidate = props.isRealTimeValidate, insertTableFromClipboard = props.insertTableFromClipboard, filterConfigRef = props.filterConfigRef, __rowKey = props.__rowKey, resetProps = __rest(props, ["record", "index", "editable", "editableConfig", "dataIndex", "title", "onEditableSave", "dataSourceRef", "onMouseEnter", "onMouseLeave", "children", "currentPage", "isValidate", "validate", "isRealTimeValidate", "insertTableFromClipboard", "filterConfigRef", "__rowKey"]);
19
- var editTableInputMode = useBaseContext().editTableInputMode;
19
+ var _c = useBaseContext(), editTableInputMode = _c.editTableInputMode, editTableInputAllowClear = _c.editTableInputAllowClear;
20
20
  // 当前单元格的类型
21
21
  var tdType = editableConfig === null || editableConfig === void 0 ? void 0 : editableConfig.type;
22
22
  // 设置最新的index
@@ -33,22 +33,22 @@ var EnhanceCell = function (props) {
33
33
  // 20250114:用下面这种方式取值,如果是配置了scu的话,值就会有问题。
34
34
  // const newRecord = record || dataSourceRef?.current?.[index];
35
35
  // 当前数据
36
- var _c = useState(newRecord ? newRecord[dataIndex] : undefined), val = _c[0], setVal = _c[1];
36
+ var _d = useState(newRecord ? newRecord[dataIndex] : undefined), val = _d[0], setVal = _d[1];
37
37
  var iptNumberRef = useRef();
38
38
  var isIptNumberBooleanRef = useRef(false);
39
39
  // 当前是否是编辑状态 性能优化,显示纯字段比显示一个完整的组件 性能要高出许多
40
40
  // 文本域 不需要切换状态
41
- var _d = useEditing(
41
+ var _e = useEditing(
42
42
  // tdType === "textarea" ? true : false,
43
- false, tdType === "textarea" ? false : true), editing = _d.editing, toggleEdit = _d.toggleEdit;
43
+ false, tdType === "textarea" ? false : true), editing = _e.editing, toggleEdit = _e.toggleEdit;
44
44
  // 输入框ref对象
45
45
  var iptRef = useIptRef(editing);
46
46
  // 单元格Ref
47
- var _e = useTdRef(), tdRef = _e.tdRef, removeErrorClass = _e.removeErrorClass, addErrorClass = _e.addErrorClass;
48
- var _f = useState({
47
+ var _f = useTdRef(), tdRef = _f.tdRef, removeErrorClass = _f.removeErrorClass, addErrorClass = _f.addErrorClass;
48
+ var _g = useState({
49
49
  open: false,
50
50
  message: "",
51
- }), showPopover = _f[0], setShowPopover = _f[1];
51
+ }), showPopover = _g[0], setShowPopover = _g[1];
52
52
  // 点击时触发验证
53
53
  // const [isCurrent, setIsCurrent] = useState<boolean>(false);
54
54
  // 20231124 修改逻辑: 点击时不触发 点击只做一个必要条件
@@ -183,9 +183,9 @@ var EnhanceCell = function (props) {
183
183
  }); };
184
184
  // 如果开启编辑 那么内部直接代理
185
185
  if (typeof editable === "function" ? editable(newRecord, index) : editable) {
186
- var _g = editableConfig || {
186
+ var _h = editableConfig || {
187
187
  type: "input",
188
- }, _h = _g.type, type = _h === void 0 ? "input" : _h, max = _g.max, min = _g.min, maxHandle = _g.maxHandle, minHandle = _g.minHandle, disabled = _g.disabled, disabledHandle = _g.disabledHandle; _g.trimType; var resetEditableConfigProps = __rest(_g, ["type", "max", "min", "maxHandle", "minHandle", "disabled", "disabledHandle", "trimType"]);
188
+ }, _j = _h.type, type = _j === void 0 ? "input" : _j, max = _h.max, min = _h.min, maxHandle = _h.maxHandle, minHandle = _h.minHandle, disabled = _h.disabled, disabledHandle = _h.disabledHandle; _h.trimType; var resetEditableConfigProps = __rest(_h, ["type", "max", "min", "maxHandle", "minHandle", "disabled", "disabledHandle", "trimType"]);
189
189
  var CurrentReactNode = null;
190
190
  // 这里将children 替换成val 要显示的值
191
191
  // let newChildren: any = children;
@@ -202,7 +202,7 @@ var EnhanceCell = function (props) {
202
202
  if (isValidate) {
203
203
  removeErrorClass();
204
204
  }
205
- }, onPressEnter: onSave, onBlur: onSave, ref: iptRef, disabled: resultDisabled, onPaste: onPasteHand }, resetEditableConfigProps)));
205
+ }, onPressEnter: onSave, onBlur: onSave, ref: iptRef, disabled: resultDisabled, onPaste: onPasteHand, allowClear: editTableInputAllowClear }, resetEditableConfigProps)));
206
206
  }
207
207
  // 文本域输入框处理
208
208
  if (type === "textarea") {
@@ -213,7 +213,7 @@ var EnhanceCell = function (props) {
213
213
  if (isValidate) {
214
214
  removeErrorClass();
215
215
  }
216
- }, onPressEnter: onSave, onBlur: onSave, ref: iptRef, disabled: resultDisabled, onPaste: onPasteHand }, resetEditableConfigProps)));
216
+ }, onPressEnter: onSave, onBlur: onSave, ref: iptRef, disabled: resultDisabled, onPaste: onPasteHand, allowClear: editTableInputAllowClear }, resetEditableConfigProps)));
217
217
  }
218
218
  // 数字输入框处理
219
219
  if (type === "inputNumber") {
@@ -239,7 +239,7 @@ var EnhanceCell = function (props) {
239
239
  setTimeout(function () {
240
240
  onSave();
241
241
  });
242
- }, ref: iptRef, disabled: resultDisabled, onPaste: onPasteHand }, resetEditableConfigProps)));
242
+ }, ref: iptRef, disabled: resultDisabled, onPaste: onPasteHand, allowClear: editTableInputAllowClear }, resetEditableConfigProps)));
243
243
  // 显示的时候 展示转换的值
244
244
  try {
245
245
  if (Array.isArray(newChildren)) {
@@ -1,4 +1,4 @@
1
- import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
1
+ import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useMemo, useState } from 'react';
4
4
  import { unstable_batchedUpdates } from 'react-dom';
@@ -6,7 +6,7 @@ import { usePercent } from './hooks.js';
6
6
  import '../config/ZtxkContext.js';
7
7
  import useBaseContext from '../config/useBaseContext.js';
8
8
  import '../config/MyStorage.js';
9
- import { useMount } from 'ahooks';
9
+ import { useQuery } from '@tanstack/react-query';
10
10
  import ButtonCom from '../button/button.js';
11
11
  import myMessage from '../message/index.js';
12
12
  import { Progress, Dropdown } from 'antd';
@@ -23,24 +23,30 @@ var TranslationButton = function (props) {
23
23
  }, [previewUrl, translationPreviewRoute]);
24
24
  var _b = useState(), translationTid = _b[0], setTranslationTid = _b[1];
25
25
  var _c = useState(false), loading = _c[0], setLoading = _c[1];
26
- var _d = useState([]), libraryList = _d[0], setLibraryList = _d[1];
27
- useMount(function () {
28
- request({
29
- url: "/api/zmdms-mdm-data/dict-biz/dictionary",
30
- method: "GET",
31
- params: { code: "zsk_term_library_id" },
32
- }).then(function (res) {
33
- if (res.status === 200 && res.data.code === 200) {
34
- setLibraryList(res.data.data);
35
- }
36
- });
37
- });
26
+ var res = useQuery({
27
+ queryKey: [
28
+ "/api/zmdms-mdm-data/dict-biz/dictionary",
29
+ "zsk_term_library_id",
30
+ ],
31
+ queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
32
+ return __generator(this, function (_a) {
33
+ // 查询函数,用于获取数据的逻辑
34
+ return [2 /*return*/, request({
35
+ url: "/api/zmdms-mdm-data/dict-biz/dictionary",
36
+ method: "GET",
37
+ params: { code: "zsk_term_library_id" },
38
+ })];
39
+ });
40
+ }); },
41
+ staleTime: Infinity, // 数据过期时间
42
+ }).data;
38
43
  var libraryMap = useMemo(function () {
39
- return (libraryList || []).reduce(function (acc, item) {
44
+ var _a;
45
+ return (((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) || []).reduce(function (acc, item) {
40
46
  acc[item.dictKey] = item.dictValue;
41
47
  return acc;
42
48
  }, {});
43
- }, [libraryList]);
49
+ }, [res]);
44
50
  // 翻译状态 当没有tid的时候 是 开始状态 start
45
51
  // 有tid的时候 调用接口判断是否 是翻译中 然后下载
46
52
  var currentTid = useMemo(function () {
@@ -49,11 +55,11 @@ var TranslationButton = function (props) {
49
55
  var translationStatus = useMemo(function () {
50
56
  return currentTid ? "pending" : "start";
51
57
  }, [currentTid]);
52
- var _e = usePercent({
58
+ var _d = usePercent({
53
59
  currentTid: currentTid,
54
60
  tid: tid,
55
61
  request: request,
56
- }), percent = _e.percent, isTranslating = _e.isTranslating, startTranslate = _e.startTranslate;
62
+ }), percent = _d.percent, isTranslating = _d.isTranslating, startTranslate = _d.startTranslate;
57
63
  /**
58
64
  * @param translationType 翻译转换规则
59
65
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",