zmdms-webui 0.0.51 → 0.0.52

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.
@@ -3,7 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { memo, useRef } from 'react';
4
4
  import classNames from '../node_modules/classnames/index.js';
5
5
  import { useTimer } from '../config/commonHooks.js';
6
- import LeftContent from './LeftContent.js';
6
+ import LeftContent from '../leftcontent/leftContent.js';
7
7
  import Footer from '../footer/footer.js';
8
8
  import { Spin } from 'antd';
9
9
 
@@ -0,0 +1,5 @@
1
+ import _default from './leftContent.js';
2
+
3
+
4
+
5
+ export { _default as default };
@@ -0,0 +1,5 @@
1
+ import LeftContent from './leftContent.js';
2
+
3
+
4
+
5
+ export { LeftContent as default };
@@ -0,0 +1,13 @@
1
+ import React__default from 'react';
2
+
3
+ interface IProps {
4
+ children?: React__default.ReactNode;
5
+ containerRef?: any;
6
+ defaultLeftOpen?: boolean;
7
+ width?: number;
8
+ style?: React__default.CSSProperties;
9
+ showIcon?: boolean;
10
+ }
11
+ declare const _default: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<IProps & React__default.RefAttributes<unknown>>>;
12
+
13
+ export { _default as default };
@@ -0,0 +1,37 @@
1
+ import { __assign } from '../_virtual/_tslib.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { memo, forwardRef, useState, useRef, useEffect } from 'react';
4
+ import DoubleRightOutlined from '../node_modules/@ant-design/icons/es/icons/DoubleRightOutlined.js';
5
+ import { Drawer } from 'antd';
6
+
7
+ var LeftContent = function (_a, ref) {
8
+ var children = _a.children, containerRef = _a.containerRef, _b = _a.defaultLeftOpen, defaultLeftOpen = _b === void 0 ? true : _b, _c = _a.width, width = _c === void 0 ? 200 : _c, style = _a.style, showIcon = _a.showIcon;
9
+ var _d = useState(defaultLeftOpen), open = _d[0], setOpen = _d[1];
10
+ var currentRef = useRef();
11
+ useEffect(function () {
12
+ var _a;
13
+ var containerDom = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
14
+ // 如果没有传入需要改变宽度的容器 那么默认取下一个兄弟节点
15
+ if (!containerDom) {
16
+ containerDom = (_a = currentRef.current) === null || _a === void 0 ? void 0 : _a.nextElementSibling;
17
+ }
18
+ if (open) {
19
+ containerDom.style.paddingLeft = "".concat(width, "px");
20
+ }
21
+ else {
22
+ containerDom.style.paddingLeft = "0";
23
+ }
24
+ }, [open, containerRef, width]);
25
+ var onClose = function () {
26
+ setOpen(false);
27
+ };
28
+ return (jsxs("div", __assign({ style: style, ref: currentRef }, { children: [showIcon && (jsx(DoubleRightOutlined, { className: "ztxk-container--left-content", style: {
29
+ left: open ? "".concat(width + 10, "px") : "10px",
30
+ transform: open ? "rotate(180deg)" : "none",
31
+ }, onClick: function () {
32
+ setOpen(!open);
33
+ } })), jsx(Drawer, __assign({ mask: false, closable: false, open: open, zIndex: 88, onClose: onClose, placement: "left", getContainer: false, width: width, className: "ztxk-container--left-drawer" }, { children: children }))] })));
34
+ };
35
+ var LeftContent$1 = memo(forwardRef(LeftContent));
36
+
37
+ export { LeftContent$1 as default };
@@ -5,9 +5,16 @@ import React__default from 'react';
5
5
  */
6
6
 
7
7
  interface IProps {
8
+ /** 是否拥有权限 如果这个配置了 那么直接返回组件 */
8
9
  hasAuth?: boolean;
9
10
  element: any;
10
11
  backLogin: () => React__default.ReactNode;
12
+ /** 获取当前用户的权限列表 */
13
+ useAuth?: any;
14
+ /** 当前页面的路由 */
15
+ path?: string;
16
+ /** 路由白名单 */
17
+ whitePaths?: string[];
11
18
  }
12
19
  declare function ProtectedRoute(props: IProps): any;
13
20
 
@@ -2,8 +2,10 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { getToken } from 'zmdms-utils';
3
3
 
4
4
  function ProtectedRoute(props) {
5
- var _a = props.hasAuth, hasAuth = _a === void 0 ? true : _a, element = props.element, backLogin = props.backLogin;
5
+ var _a;
6
+ var hasAuth = props.hasAuth, element = props.element, backLogin = props.backLogin, useAuth = props.useAuth, _b = props.path, path = _b === void 0 ? "" : _b, whitePaths = props.whitePaths;
6
7
  var token = getToken();
8
+ var userRoutes = ((useAuth === null || useAuth === void 0 ? void 0 : useAuth()) || {}).userRoutes;
7
9
  if (!token) {
8
10
  console.log("当前页面需要登录! 请登录成功后再进行访问!");
9
11
  return backLogin();
@@ -11,6 +13,22 @@ function ProtectedRoute(props) {
11
13
  if (hasAuth) {
12
14
  return element;
13
15
  }
16
+ // 是否拥有路由权限
17
+ if (userRoutes) {
18
+ try {
19
+ var arr_1 = [];
20
+ Object.keys(userRoutes).forEach(function (key) {
21
+ var routes = userRoutes[key];
22
+ arr_1.push.apply(arr_1, routes);
23
+ });
24
+ if (arr_1.includes(path) || ((_a = whitePaths === null || whitePaths === void 0 ? void 0 : whitePaths.includes) === null || _a === void 0 ? void 0 : _a.call(whitePaths, path))) {
25
+ return element;
26
+ }
27
+ }
28
+ catch (err) {
29
+ return jsx("div", { children: "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u5F53\u524D\u9875\u9762\uFF01" });
30
+ }
31
+ }
14
32
  return jsx("div", { children: "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u5F53\u524D\u9875\u9762\uFF01" });
15
33
  }
16
34
 
@@ -101,7 +101,7 @@ var Select = function (props, ref) {
101
101
  var text = textContent(option === null || option === void 0 ? void 0 : option.children);
102
102
  return (text === null || text === void 0 ? void 0 : text.toLowerCase().indexOf(input.toLowerCase().trim())) >= 0;
103
103
  };
104
- return (jsx(Select$1, __assign({ showArrow: true, dropdownMatchSelectWidth: dropdownMatchSelectWidth, onChange: onChangeHandle, showSearch: true, onSearch: onDebounceSearchHandle, filterOption: isRemoteSearch ? false : filterOptionHandle, dropdownRender: dropdownRender
104
+ return (jsx(Select$1, __assign({ defaultValue: showAll ? "" : undefined, showArrow: true, dropdownMatchSelectWidth: dropdownMatchSelectWidth, onChange: onChangeHandle, showSearch: true, onSearch: onDebounceSearchHandle, filterOption: isRemoteSearch ? false : filterOptionHandle, dropdownRender: dropdownRender
105
105
  ? dropdownRender
106
106
  : dropdownButton
107
107
  ? dropdownButtonHandle
@@ -0,0 +1,5 @@
1
+ import MemoTag from './tag.js';
2
+
3
+
4
+
5
+ export { MemoTag as default };
@@ -0,0 +1,5 @@
1
+ import MemoTag from './tag.js';
2
+
3
+
4
+
5
+ export { MemoTag as default };
@@ -0,0 +1,9 @@
1
+ import React__default from 'react';
2
+ import { TagProps } from 'antd/lib/tag';
3
+
4
+ interface ITagProps extends TagProps {
5
+ }
6
+ interface TagComponent extends React__default.FC<ITagProps> {
7
+ }
8
+
9
+ export { ITagProps, TagComponent };
@@ -0,0 +1,5 @@
1
+ import { TagComponent } from './interface.js';
2
+
3
+ declare const MemoTag: TagComponent;
4
+
5
+ export { MemoTag as default };
@@ -0,0 +1,15 @@
1
+ import { __rest, __assign } from '../_virtual/_tslib.js';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { memo } from 'react';
4
+ import { Tag as Tag$1 } from 'antd';
5
+ import classNames from '../node_modules/classnames/index.js';
6
+
7
+ var Tag = function (props) {
8
+ var className = props.className, resetProps = __rest(props, ["className"]);
9
+ var classes = classNames("ztxk-tag", className, {});
10
+ return jsx(Tag$1, __assign({ className: classes }, resetProps));
11
+ };
12
+ var MemoTag = memo(Tag);
13
+ MemoTag.displayName = "ZTXK_WEBUI_Tag";
14
+
15
+ export { MemoTag as default };
@@ -33,6 +33,7 @@ function useBeforeUpload(props) {
33
33
  }
34
34
  // 获取支持的附件类型
35
35
  var ACCEPT = acceptList ? acceptList : [];
36
+ ACCEPT = ACCEPT.map(function (a) { return a.toLowerCase(); });
36
37
  // 默认支持任何格式的文件,但是不支持exe
37
38
  if (ACCEPT.length > 0 && !ACCEPT.includes(fileExtension)) {
38
39
  message.warning("\u4E0D\u652F\u6301 ".concat(fileExtension, " \u6587\u4EF6\u683C\u5F0F"));
@@ -30,7 +30,9 @@ export { default as Tree } from './es/tree/tree.js';
30
30
  export { default as Descriptions } from './es/descriptions/descriptions.js';
31
31
  export { default as Title } from './es/title/title.js';
32
32
  export { default as Print } from './es/print/print.js';
33
- export { Affix, Alert, Anchor, AutoComplete, Avatar, BackTop, Badge, Breadcrumb, Card, Carousel, Cascader, Checkbox, Col, Collapse, Comment, ConfigProvider, Divider, Drawer, Dropdown, Empty, Grid, Image, Layout, List, Mentions, Menu, PageHeader, Popconfirm, Popover, Progress, Radio, Rate, Result, Row, Segmented, Skeleton, Slider, Space, Spin, Statistic, Steps, Switch, Tag, Timeline, Tooltip, Transfer, Typography, Upload, message, notification } from 'antd';
33
+ export { default as Tag } from './es/tag/tag.js';
34
+ export { default as LeftContent } from './es/leftcontent/leftContent.js';
35
+ export { Affix, Alert, Anchor, AutoComplete, Avatar, BackTop, Badge, Breadcrumb, Card, Carousel, Cascader, Checkbox, Col, Collapse, Comment, ConfigProvider, Divider, Drawer, Dropdown, Empty, Grid, Image, Layout, List, Mentions, Menu, PageHeader, Popconfirm, Popover, Progress, Radio, Rate, Result, Row, Segmented, Skeleton, Slider, Space, Spin, Statistic, Steps, Switch, Timeline, Tooltip, Transfer, Typography, Upload, message, notification } from 'antd';
34
36
  export { IModalOpenOptions, IModalProps, IModalRef } from './es/modal/interface.js';
35
37
  export { IFooterDom, IFooterProps } from './es/footer/interface.js';
36
38
  export { IColumnsType, ITableProps } from './es/table/interface.js';