zmdms-webui 3.1.3 → 3.1.5

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,7 @@ var AppLayoutSider = function (props) {
55
55
  ? "/".concat(prefix).concat(path)
56
56
  : path;
57
57
  }, [menuJoinRule]);
58
+ console.log(mainMenuSelectedKeys);
58
59
  return (jsx(Layout.Sider, __assign({ className: "zmdms-sider", collapsedWidth: "0", collapsible: true, trigger: null, width: siderWidth, ref: layoutSiderRef, style: {
59
60
  backgroundImage: "url(".concat(siderBg, ")"),
60
61
  } }, { children: jsx(LayoutMenuContext.Provider, __assign({ value: {
@@ -98,7 +98,7 @@ function useSubMenuOpenKeys(userSubMenus, activeTab, options) {
98
98
  return;
99
99
  }
100
100
  // 如果没有选中页签
101
- if (!activeTab) {
101
+ if (!activeTab || activeTab === "/") {
102
102
  return;
103
103
  }
104
104
  // 专门为那种主菜单带路由跳转的逻辑处理
@@ -186,7 +186,9 @@ function useSubMenuOpenKeys(userSubMenus, activeTab, options) {
186
186
  if (Array.isArray(value)) {
187
187
  // 要先过滤掉没有子级的菜单,因为没有子级的菜单不需要展开
188
188
  setOpenKeys(value
189
- .filter(function (i) { return Array.isArray(i.children) && i.children.length > 0; })
189
+ .filter(function (i) {
190
+ return Array.isArray(i.children) && i.children.length > 0;
191
+ })
190
192
  .map(function (i) { return i.id; }));
191
193
  }
192
194
  return true;
@@ -70,6 +70,18 @@ interface IZtxkConfig {
70
70
  * 操作按钮是否默认展示更多按钮
71
71
  */
72
72
  enableOperationBtnGroupShowMore?: boolean;
73
+ /**
74
+ * 表格的展开收起图标是否使用组件自定义图标,或者自己自定义
75
+ */
76
+ enableTableExpandIcon?: boolean | ((option: any) => React__default.ReactNode);
77
+ /**
78
+ * 字典接口配置
79
+ */
80
+ dictApiUrl?: string;
81
+ /**
82
+ * 附件组件公用请求头配置
83
+ */
84
+ fileListRequestHeaders?: Record<string, string>;
73
85
  }
74
86
  declare const ZtxkContext: React__default.Context<IZtxkConfig>;
75
87
 
@@ -17,6 +17,9 @@ var ztxkConfig = {
17
17
  enableTableSummaryCollapse: false,
18
18
  enableTableSummaryDefaultExpand: false,
19
19
  enableOperationBtnGroupShowMore: false,
20
+ enableTableExpandIcon: false,
21
+ dictApiUrl: "/api/zmdms-mdm-data/dict-biz/dictionary",
22
+ fileListRequestHeaders: undefined,
20
23
  };
21
24
  var ZtxkContext = React__default.createContext(ztxkConfig);
22
25
 
@@ -1,9 +1,13 @@
1
1
  import { useState, useEffect } from 'react';
2
+ import '../../config/ZtxkContext.js';
3
+ import useBaseContext from '../../config/useBaseContext.js';
4
+ import '../../config/MyStorage.js';
2
5
 
3
6
  var defaultFileType = [];
4
7
  // 获取附件类型
5
8
  function useFetchFileTypeData(options) {
6
9
  var request = options.request, fileTypeKey = options.fileTypeKey, fileTypeFilterList = options.fileTypeFilterList, fileTypeList = options.fileTypeList, useOutsideFileTypeList = options.useOutsideFileTypeList, isAllowedPatchFileType = options.isAllowedPatchFileType;
10
+ var dictApiUrl = useBaseContext().dictApiUrl;
7
11
  var _a = useState(), fileTypeFetchList = _a[0], setFileType = _a[1];
8
12
  useEffect(function () {
9
13
  if (!isAllowedPatchFileType) {
@@ -25,7 +29,7 @@ function useFetchFileTypeData(options) {
25
29
  status: 50,
26
30
  };
27
31
  request === null || request === void 0 ? void 0 : request({
28
- url: "/api/zmdms-mdm-data/dict-biz/dictionary",
32
+ url: dictApiUrl || "/api/zmdms-mdm-data/dict-biz/dictionary",
29
33
  params: params,
30
34
  method: "GET",
31
35
  }).then(function (res) {
@@ -0,0 +1,18 @@
1
+ import _objectSpread2 from '../../../../@babel/runtime/helpers/esm/objectSpread2.js';
2
+ import * as React from 'react';
3
+ import UpOutlinedSvg from '../../../icons-svg/es/asn/UpOutlined.js';
4
+ import AntdIcon from '../components/AntdIcon.js';
5
+
6
+ var UpOutlined = function UpOutlined(props, ref) {
7
+ return /*#__PURE__*/React.createElement(AntdIcon, _objectSpread2(_objectSpread2({}, props), {}, {
8
+ ref: ref,
9
+ icon: UpOutlinedSvg
10
+ }));
11
+ };
12
+ var RefIcon = /*#__PURE__*/React.forwardRef(UpOutlined);
13
+ if (process.env.NODE_ENV !== 'production') {
14
+ RefIcon.displayName = 'UpOutlined';
15
+ }
16
+ var UpOutlined$1 = RefIcon;
17
+
18
+ export { UpOutlined$1 as default };
@@ -0,0 +1,5 @@
1
+ // This icon file is generated automatically.
2
+ var UpOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, "name": "up", "theme": "outlined" };
3
+ var UpOutlinedSvg = UpOutlined;
4
+
5
+ export { UpOutlinedSvg as default };
@@ -34,6 +34,8 @@ import useTableSummaryCollapse from './useTableSummaryCollapse.js';
34
34
  import MehOutlined from '../node_modules/@ant-design/icons/es/icons/MehOutlined.js';
35
35
  import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js';
36
36
  import DynamicSetting from '../dynamicsetting/dynamicSetting.js';
37
+ import UpOutlined from '../node_modules/@ant-design/icons/es/icons/UpOutlined.js';
38
+ import DownOutlined from '../node_modules/@ant-design/icons/es/icons/DownOutlined.js';
37
39
 
38
40
  // completed: 实现列拖拽切换位置、显隐功能
39
41
  // completed: 实现新增行、删除行功能 新增时 可以选择新增多少行 删除时 可以选择删除全部
@@ -50,7 +52,12 @@ var Table = function (props) {
50
52
  var _a;
51
53
  // console.log("表格渲染");
52
54
  var className = props.className, _b = props.bordered, bordered = _b === void 0 ? true : _b, _c = props.pagination, pagination = _c === void 0 ? false : _c, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, customDynamicListHandle = props.customDynamicListHandle, isRemeberFilter = props.isRemeberFilter, _d = props.isOrderUpdateData, isOrderUpdateData = _d === void 0 ? true : _d, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _e = props.isTheadTitleAdd, isTheadTitleAdd = _e === void 0 ? true : _e, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _f = props.isDelAll, isDelAll = _f === void 0 ? true : _f, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _g = props.summaryFixed, summaryFixed = _g === void 0 ? true : _g, isInnerPagination = props.isInnerPagination, _h = props.innerPaginationPageSize, innerPaginationPageSize = _h === void 0 ? 30 : _h, _j = props.innerPaginationPosition, innerPaginationPosition = _j === void 0 ? INNER_TABLE_PAGINATION_POSITION : _j, _k = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _k === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _k, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _l = props.isResizableColumn, isResizableColumn = _l === void 0 ? true : _l, _m = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _m === void 0 ? true : _m, _o = props.isRealTimeValidate, isRealTimeValidate = _o === void 0 ? true : _o, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _p = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _p === void 0 ? 65 : _p, _q = props.isAutoScrollY, isAutoScrollY = _q === void 0 ? false : _q, tableId = props.tableId, extraOnRow = props.onRow, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, headerAlign = props.headerAlign, isDimensionDynamic = props.isDimensionDynamic, _r = props.isDimensionMergeChildren, isDimensionMergeChildren = _r === void 0 ? true : _r, dimensionCustomSumKeys = props.dimensionCustomSumKeys, isAutoMerge = props.isAutoMerge, mode = props.mode, rowSelection = props.rowSelection, isContextMenu = props.isContextMenu, isFullscreenHandle = props.isFullscreenHandle, _s = props.isExportSummary, isExportSummary = _s === void 0 ? true : _s, isAutoMergeAddAndDel = props.isAutoMergeAddAndDel, isDynamicColumnText = props.isDynamicColumnText, isTableSummaryCollapse = props.isTableSummaryCollapse, isTableSummaryDefaultExpand = props.isTableSummaryDefaultExpand, emptyCompact = props.emptyCompact, rowKey = props.rowKey, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "customDynamicListHandle", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId", "onRow", "fixedRowsCount", "fixedRowsConfig", "headerAlign", "isDimensionDynamic", "isDimensionMergeChildren", "dimensionCustomSumKeys", "isAutoMerge", "mode", "rowSelection", "isContextMenu", "isFullscreenHandle", "isExportSummary", "isAutoMergeAddAndDel", "isDynamicColumnText", "isTableSummaryCollapse", "isTableSummaryDefaultExpand", "emptyCompact", "rowKey"]);
53
- var _t = useBaseContext(), enableDynamicColumnText = _t.enableDynamicColumnText, enableTableSummaryCollapse = _t.enableTableSummaryCollapse, enableTableSummaryDefaultExpand = _t.enableTableSummaryDefaultExpand;
55
+ var _t = useBaseContext(), enableDynamicColumnText = _t.enableDynamicColumnText, enableTableSummaryCollapse = _t.enableTableSummaryCollapse, enableTableSummaryDefaultExpand = _t.enableTableSummaryDefaultExpand, enableTableExpandIcon = _t.enableTableExpandIcon;
56
+ // 处理expandable
57
+ var expandIcon = getExpandIcon({
58
+ expandable: props.expandable,
59
+ enableTableExpandIcon: enableTableExpandIcon,
60
+ });
54
61
  // 表格动态列配置是否显示文字
55
62
  var isDynamicColumnTextEnable = getFinalValue(enableDynamicColumnText, isDynamicColumnText);
56
63
  // 表格合计是否可以展开收起
@@ -454,7 +461,8 @@ var Table = function (props) {
454
461
  ? function () {
455
462
  return document.querySelector(".ztxk-table--fullscreen") || document.body;
456
463
  }
457
- : undefined }, resetProps, { rowKey: newRowKey, locale: locale })));
464
+ : undefined }, resetProps, { expandable: expandIcon
465
+ ? __assign(__assign({}, props.expandable), { expandIcon: expandIcon }) : props.expandable, rowKey: newRowKey, locale: locale })));
458
466
  return (jsxs("div", __assign({ style: isFlex
459
467
  ? {
460
468
  position: "relative",
@@ -485,6 +493,20 @@ MemoTable.Summary = Table$1.Summary;
485
493
  MemoTable.TitleDirectionColumn = TitleDirectionColumn;
486
494
  MemoTable.TableDynamicHeader = TableDynamicHeader;
487
495
  MemoTable.DifferencesClassName = "ztxk-table--differences";
488
- MemoTable.IS_SUMMARY = IS_SUMMARY;
496
+ MemoTable.IS_SUMMARY = IS_SUMMARY;
497
+ function getExpandIcon(option) {
498
+ var expandable = option.expandable, enableTableExpandIcon = option.enableTableExpandIcon;
499
+ var expandIcon = null;
500
+ if (expandable && !expandable.expandIcon && enableTableExpandIcon) {
501
+ expandIcon =
502
+ enableTableExpandIcon === true
503
+ ? function (_a) {
504
+ var expanded = _a.expanded, onExpand = _a.onExpand, record = _a.record;
505
+ return expanded ? (jsx(UpOutlined, { onClick: function (e) { return onExpand(record, e); } })) : (jsx(DownOutlined, { onClick: function (e) { return onExpand(record, e); } }));
506
+ }
507
+ : enableTableExpandIcon;
508
+ }
509
+ return expandIcon;
510
+ }
489
511
 
490
512
  export { MemoTable as default };
@@ -16,7 +16,7 @@ var translationTypeList = [
16
16
  { dictKey: "1", dictValue: "中文转英文" },
17
17
  ];
18
18
  var TranslationButton = function (props) {
19
- var _a = useBaseContext(), request = _a.request, translationPreviewRoute = _a.translationPreviewRoute;
19
+ var _a = useBaseContext(), request = _a.request, translationPreviewRoute = _a.translationPreviewRoute, dictApiUrl = _a.dictApiUrl;
20
20
  var attachId = props.attachId, tid = props.tid, translationParams = props.translationParams, tidChange = props.tidChange, previewUrl = props.previewUrl;
21
21
  var previewRoute = useMemo(function () {
22
22
  return previewUrl || translationPreviewRoute || "";
@@ -25,14 +25,14 @@ var TranslationButton = function (props) {
25
25
  var _c = useState(false), loading = _c[0], setLoading = _c[1];
26
26
  var res = useQuery({
27
27
  queryKey: [
28
- "/api/zmdms-mdm-data/dict-biz/dictionary",
28
+ dictApiUrl || "/api/zmdms-mdm-data/dict-biz/dictionary",
29
29
  "zsk_term_library_id",
30
30
  ],
31
31
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
32
32
  return __generator(this, function (_a) {
33
33
  // 查询函数,用于获取数据的逻辑
34
34
  return [2 /*return*/, request({
35
- url: "/api/zmdms-mdm-data/dict-biz/dictionary",
35
+ url: dictApiUrl || "/api/zmdms-mdm-data/dict-biz/dictionary",
36
36
  method: "GET",
37
37
  params: { code: "zsk_term_library_id" },
38
38
  })];
@@ -228,14 +228,14 @@ function useOnChange(props) {
228
228
  * 生成基础参数
229
229
  */
230
230
  function useBasicInfo(props) {
231
- var action = props.action, _a = props.API_BASEURL, API_BASEURL = _a === void 0 ? "" : _a, headers = props.headers, data = props.data, isPublic = props.isPublic;
231
+ var action = props.action, _a = props.API_BASEURL, API_BASEURL = _a === void 0 ? "" : _a, headers = props.headers, data = props.data, isPublic = props.isPublic, fileListRequestHeaders = props.fileListRequestHeaders;
232
232
  // 文件上传路径
233
233
  var fileAction = action ? action : createUploadFileLink({ API_BASEURL: API_BASEURL });
234
234
  // 文件上传头部参数
235
235
  var fileHeaders = useMemo(function () {
236
236
  var _a;
237
- return __assign((_a = {}, _a[TOKEN_KEY] = getToken() || "", _a), headers);
238
- }, [headers]);
237
+ return __assign(__assign((_a = {}, _a[TOKEN_KEY] = getToken() || "", _a), fileListRequestHeaders), headers);
238
+ }, [headers, fileListRequestHeaders]);
239
239
  // 其余参数
240
240
  var fileData = useMemo(function () {
241
241
  var newData = __assign({}, data);
@@ -34,7 +34,7 @@ var MAXSIZE = 104857600; // 100 * 1024 * 1024
34
34
  var UploadList = function (props, ref) {
35
35
  var _a;
36
36
  var children = props.children, btnText = props.btnText, className = props.className, _b = props.showTip, showTip = _b === void 0 ? true : _b, _c = props.maxSize, maxSize = _c === void 0 ? MAXSIZE : _c, showTable = props.showTable, acceptList = props.acceptList, beforeUpload = props.beforeUpload, onChange = props.onChange, PROPS_API_BASEURL = props.API_BASEURL, PROPS_FILE_API_BASEURL = props.FILE_API_BASEURL, action = props.action, headers = props.headers, data = props.data, userName = props.userName, fileList = props.fileList, isPublic = props.isPublic, _d = props.maxPreviewSize, maxPreviewSize = _d === void 0 ? MAX_PREVIEW_SIZE : _d, isPreview = props.isPreview, isDownload = props.isDownload, isDelete = props.isDelete, _e = props.filePreview, filePreview = _e === void 0 ? true : _e, _f = props.zipName, zipName = _f === void 0 ? "\u6279\u91CF\u4E0B\u8F7D-".concat(Date.now(), ".zip") : _f, isImage = props.isImage, _g = props.isImageCrop, isImageCrop = _g === void 0 ? true : _g, imgCropProps = props.imgCropProps, _h = props.imgWidth, imgWidth = _h === void 0 ? 110 : _h, _j = props.imgHeight, imgHeight = _j === void 0 ? 110 : _j, customRenderBtn = props.customRenderBtn, disAllowDuplicateFile = props.disAllowDuplicateFile, fieldNames = props.fieldNames, tableColumns = props.tableColumns, onBeforeDownloadValidate = props.onBeforeDownloadValidate, onBeforePreviewValidate = props.onBeforePreviewValidate, onBeforeDeleteValidate = props.onBeforeDeleteValidate, isImgPreview = props.isImgPreview, isTranslation = props.isTranslation, renderTableOperationColumn = props.renderTableOperationColumn, resetProps = __rest(props, ["children", "btnText", "className", "showTip", "maxSize", "showTable", "acceptList", "beforeUpload", "onChange", "API_BASEURL", "FILE_API_BASEURL", "action", "headers", "data", "userName", "fileList", "isPublic", "maxPreviewSize", "isPreview", "isDownload", "isDelete", "filePreview", "zipName", "isImage", "isImageCrop", "imgCropProps", "imgWidth", "imgHeight", "customRenderBtn", "disAllowDuplicateFile", "fieldNames", "tableColumns", "onBeforeDownloadValidate", "onBeforePreviewValidate", "onBeforeDeleteValidate", "isImgPreview", "isTranslation", "renderTableOperationColumn"]);
37
- var _k = useBaseContext(), apiBaseUrl = _k.apiBaseUrl, fileBaseUrl = _k.fileBaseUrl, enableTranslationButton = _k.enableTranslationButton;
37
+ var _k = useBaseContext(), apiBaseUrl = _k.apiBaseUrl, fileBaseUrl = _k.fileBaseUrl, enableTranslationButton = _k.enableTranslationButton, fileListRequestHeaders = _k.fileListRequestHeaders;
38
38
  // 翻译按钮是否显示
39
39
  var isTranslationButton = getFinalValue(enableTranslationButton, isTranslation);
40
40
  var maxCount = resetProps.maxCount, listType = resetProps.listType, method = resetProps.method;
@@ -96,6 +96,7 @@ var UploadList = function (props, ref) {
96
96
  headers: headers,
97
97
  data: data,
98
98
  isPublic: isPublic,
99
+ fileListRequestHeaders: fileListRequestHeaders,
99
100
  }), fileAction = _o.fileAction, fileHeaders = _o.fileHeaders, fileData = _o.fileData;
100
101
  // 表格需要的附件列表数据
101
102
  var uploadTableData = useUploadTableData({
@@ -301,7 +302,7 @@ var UploadList = function (props, ref) {
301
302
  };
302
303
  }, [showTable, isDownload, isDelete]);
303
304
  // 上传子元素
304
- var renderChildren = (jsx(Upload, __assign({ showUploadList: showUploadListMemo, multiple: true, beforeUpload: beforeUploadHandle, onChange: onChangeHandle, action: fileAction, headers: fileHeaders, data: fileData, fileList: innerFileList, onPreview: onPreview, onDownload: onDownload }, resetProps, { children: children ? (children) : !listType || listType === "text" ? (jsxs(ButtonCom, __assign({ type: "primary", icon: jsx(UploadOutlined, {}) }, { children: [btnText || "添加附件", maxCount ? "(\u6700\u591A\u4E0A\u4F20".concat(maxCount, "\u4E2A\u6587\u4EF6)") : ""] }))) : isImage &&
305
+ var renderChildren = (jsx(Upload, __assign({ showUploadList: showUploadListMemo, multiple: maxCount === 1 ? false : true, beforeUpload: beforeUploadHandle, onChange: onChangeHandle, action: fileAction, headers: fileHeaders, data: fileData, fileList: innerFileList, onPreview: onPreview, onDownload: onDownload }, resetProps, { children: children ? (children) : !listType || listType === "text" ? (jsxs(ButtonCom, __assign({ type: "primary", icon: jsx(UploadOutlined, {}) }, { children: [btnText || "添加附件", maxCount ? "(\u6700\u591A\u4E0A\u4F20".concat(maxCount, "\u4E2A\u6587\u4EF6)") : ""] }))) : isImage &&
305
306
  maxCount &&
306
307
  innerFileList &&
307
308
  innerFileList.length >= maxCount &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",