zmdms-webui 0.0.51 → 0.0.53
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/es/container/container.js +2 -2
- package/dist/es/leftcontent/index.d.ts +5 -0
- package/dist/es/leftcontent/index.js +5 -0
- package/dist/es/leftcontent/leftContent.d.ts +24 -0
- package/dist/es/leftcontent/leftContent.js +55 -0
- package/dist/es/protectedroute/index.d.ts +7 -0
- package/dist/es/protectedroute/index.js +19 -1
- package/dist/es/select/select.js +1 -1
- package/dist/es/tag/index.d.ts +5 -0
- package/dist/es/tag/index.js +5 -0
- package/dist/es/tag/interface.d.ts +9 -0
- package/dist/es/tag/tag.d.ts +5 -0
- package/dist/es/tag/tag.js +15 -0
- package/dist/es/uploadlist/hooks.js +1 -0
- package/dist/index.build.d.ts +3 -1
- package/dist/index.dark.css +1 -1
- package/dist/index.default.css +1 -1
- package/dist/index.es.js +3 -1
- package/package.json +1 -1
- package/dist/es/container/LeftContent.js +0 -30
|
@@ -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
|
|
6
|
+
import LeftContentMemo from '../leftcontent/leftContent.js';
|
|
7
7
|
import Footer from '../footer/footer.js';
|
|
8
8
|
import { Spin } from 'antd';
|
|
9
9
|
|
|
@@ -19,7 +19,7 @@ var Container = function (props) {
|
|
|
19
19
|
var classes = classNames("ztxk-container__content", className, {
|
|
20
20
|
"ztxk-container__content--flex": isFlex,
|
|
21
21
|
});
|
|
22
|
-
return (jsxs("div", __assign({ className: "ztxk-container", ref: containerRef }, { children: [leftContent && (jsx(
|
|
22
|
+
return (jsxs("div", __assign({ className: "ztxk-container", ref: containerRef }, { children: [leftContent && (jsx(LeftContentMemo, __assign({ containerRef: containerRef, defaultLeftOpen: defaultLeftOpen, width: defaultLeftWidth }, { children: leftContent }))), jsx(ContainerLoading, { loading: loading }), jsx("div", __assign({ className: classes }, { children: children })), jsx(Footer, { footerDom: footerDom })] })));
|
|
23
23
|
};
|
|
24
24
|
var ContainerButtonWrap = memo(function (_a) {
|
|
25
25
|
var children = _a.children, isMarginTop = _a.isMarginTop, className = _a.className, style = _a.style;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
/** 通过flex布局 来控制抽屉侧的容器宽度 */
|
|
11
|
+
isFlex?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface IWrapProps {
|
|
14
|
+
className?: string;
|
|
15
|
+
children?: React__default.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare const LeftContentWrap: React__default.FC<IWrapProps>;
|
|
18
|
+
interface LeftContentComponent extends React__default.FC<IProps> {
|
|
19
|
+
displayName: string;
|
|
20
|
+
Wrap: typeof LeftContentWrap;
|
|
21
|
+
}
|
|
22
|
+
declare const LeftContentMemo: LeftContentComponent;
|
|
23
|
+
|
|
24
|
+
export { LeftContentMemo as default };
|
|
@@ -0,0 +1,55 @@
|
|
|
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 classNames from '../node_modules/classnames/index.js';
|
|
5
|
+
import DoubleRightOutlined from '../node_modules/@ant-design/icons/es/icons/DoubleRightOutlined.js';
|
|
6
|
+
import { Drawer } from 'antd';
|
|
7
|
+
|
|
8
|
+
var LeftContent = function (_a, ref) {
|
|
9
|
+
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, isFlex = _a.isFlex;
|
|
10
|
+
var _d = useState(defaultLeftOpen), open = _d[0], setOpen = _d[1];
|
|
11
|
+
var currentRef = useRef();
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
var _a;
|
|
14
|
+
if (isFlex) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var containerDom = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
18
|
+
// 如果没有传入需要改变宽度的容器 那么默认取下一个兄弟节点
|
|
19
|
+
if (!containerDom) {
|
|
20
|
+
containerDom = (_a = currentRef.current) === null || _a === void 0 ? void 0 : _a.nextElementSibling;
|
|
21
|
+
}
|
|
22
|
+
if (!containerDom) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// 如果找到指定元素
|
|
26
|
+
if (!containerDom.classList.contains("ztxk-container")) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (open) {
|
|
30
|
+
containerDom.style.paddingLeft = "".concat(width, "px");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
containerDom.style.paddingLeft = "0";
|
|
34
|
+
}
|
|
35
|
+
}, [open, containerRef, width, isFlex]);
|
|
36
|
+
var onClose = function () {
|
|
37
|
+
setOpen(false);
|
|
38
|
+
};
|
|
39
|
+
return (jsxs("div", __assign({ style: style, ref: currentRef }, { children: [showIcon && (jsx(DoubleRightOutlined, { className: "ztxk-container--left-icon", style: {
|
|
40
|
+
left: open ? "".concat(width + 10, "px") : "10px",
|
|
41
|
+
transform: open ? "rotate(180deg)" : "none",
|
|
42
|
+
}, onClick: function () {
|
|
43
|
+
setOpen(!open);
|
|
44
|
+
} })), 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 }))] })));
|
|
45
|
+
};
|
|
46
|
+
var LeftContentWrap = function (_a) {
|
|
47
|
+
var className = _a.className, children = _a.children;
|
|
48
|
+
var classes = classNames("ztxk-container--left-wrap", className, {});
|
|
49
|
+
return jsx("div", __assign({ className: classes }, { children: children }));
|
|
50
|
+
};
|
|
51
|
+
var LeftContentMemo = memo(forwardRef(LeftContent));
|
|
52
|
+
LeftContentMemo.displayName = "ZTXK_WEBUI_LeftContentMemo";
|
|
53
|
+
LeftContentMemo.Wrap = LeftContentWrap;
|
|
54
|
+
|
|
55
|
+
export { LeftContentMemo 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
|
|
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
|
|
package/dist/es/select/select.js
CHANGED
|
@@ -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,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"));
|
package/dist/index.build.d.ts
CHANGED
|
@@ -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 {
|
|
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';
|