zmdms-webui 1.5.2 → 1.5.3
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/button/button.js +10 -3
- package/dist/es/button/interface.d.ts +6 -1
- package/dist/es/config/ZtxkContext.d.ts +6 -0
- package/dist/es/config/ZtxkContext.js +1 -0
- package/dist/es/container/index.css +1 -1
- package/dist/es/enhanceselect/enhance-select.d.ts +6 -0
- package/dist/es/enhanceselect/index.d.ts +5 -0
- package/dist/es/enhanceselect/interface.d.ts +71 -0
- package/dist/index.build.d.ts +2 -0
- package/dist/index.dark.css +1 -1
- package/dist/index.default.css +1 -1
- package/dist/index.es.js +1 -0
- package/package.json +1 -1
package/dist/es/button/button.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { __rest, __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useRef } from 'react';
|
|
4
|
-
import { Button as Button$1, Tooltip } from 'antd';
|
|
4
|
+
import { Button as Button$1, Tooltip, Popconfirm } from 'antd';
|
|
5
5
|
import classNames from '../node_modules/classnames/index.js';
|
|
6
6
|
import ButtonDownload from './buttonDownload.js';
|
|
7
7
|
import ButtonExport from './buttonExport.js';
|
|
8
8
|
import ButtonPreview from './buttonPreview.js';
|
|
9
|
+
import '../config/ZtxkContext.js';
|
|
10
|
+
import useBaseContext from '../config/useBaseContext.js';
|
|
9
11
|
|
|
10
12
|
var Button = function (props) {
|
|
11
13
|
var _a;
|
|
12
|
-
var type = props.type, className = props.className, disabled = props.disabled, size = props.size, danger = props.danger, onClick = props.onClick, _b = props.isAuth, isAuth = _b === void 0 ? true : _b, loading = props.loading, tooltipTitle = props.tooltipTitle, tooltipConfig = props.tooltipConfig, resetProps = __rest(props, ["type", "className", "disabled", "size", "danger", "onClick", "isAuth", "loading", "tooltipTitle", "tooltipConfig"]);
|
|
14
|
+
var type = props.type, className = props.className, disabled = props.disabled, size = props.size, danger = props.danger, onClick = props.onClick, _b = props.isAuth, isAuth = _b === void 0 ? true : _b, loading = props.loading, tooltipTitle = props.tooltipTitle, tooltipConfig = props.tooltipConfig, confirmTitle = props.confirmTitle, confirmMsg = props.confirmMsg, confirmConfig = props.confirmConfig, resetProps = __rest(props, ["type", "className", "disabled", "size", "danger", "onClick", "isAuth", "loading", "tooltipTitle", "tooltipConfig", "confirmTitle", "confirmMsg", "confirmConfig"]);
|
|
13
15
|
var _c = useState(), innerLoading = _c[0], setLoading = _c[1];
|
|
16
|
+
var noPermission = useBaseContext().noPermission;
|
|
14
17
|
var classes = classNames("zt-btn", className, (_a = {},
|
|
15
18
|
_a["zt-btn-".concat(type)] = type,
|
|
16
19
|
_a["zt-btn-disabled"] = disabled || !isAuth,
|
|
@@ -61,7 +64,11 @@ var Button = function (props) {
|
|
|
61
64
|
});
|
|
62
65
|
}); };
|
|
63
66
|
var Btn = (jsx(Button$1, __assign({ className: classes, type: type, disabled: disabled || !isAuth, size: size, danger: danger, onClick: myOnClick, loading: loading || innerLoading }, resetProps)));
|
|
64
|
-
|
|
67
|
+
// 无权限时 不显示按钮模式
|
|
68
|
+
if (noPermission === "display" && !isAuth) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return tooltipTitle || tooltipConfig ? (jsx(Tooltip, __assign({}, tooltipConfig, { title: tooltipTitle || (tooltipConfig === null || tooltipConfig === void 0 ? void 0 : tooltipConfig.title) }, { children: jsx(Fragment, { children: Btn }) }))) : confirmTitle || confirmMsg || confirmConfig ? (jsx(Popconfirm, __assign({}, confirmConfig, { title: confirmTitle || confirmMsg || (confirmConfig === null || confirmConfig === void 0 ? void 0 : confirmConfig.title), onConfirm: function (e) { return myOnClick(e); } }, { children: jsx(Button$1, __assign({ className: classes, type: type, disabled: disabled || !isAuth, size: size, danger: danger, loading: loading || innerLoading }, resetProps)) }))) : (jsx(Fragment, { children: Btn }));
|
|
65
72
|
};
|
|
66
73
|
var ButtonCom = Button;
|
|
67
74
|
ButtonCom.displayName = "ZTXK_WEBUI_Button";
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { Button } from 'antd';
|
|
2
2
|
import { ButtonProps } from 'antd/es/button';
|
|
3
3
|
import { TooltipProps } from 'antd/es/tooltip';
|
|
4
|
+
import { PopconfirmProps } from 'antd/es/popconfirm';
|
|
4
5
|
import ButtonDownload from './buttonDownload.js';
|
|
5
6
|
import ButtonExport from './buttonExport.js';
|
|
6
7
|
import ButtonPreview from './buttonPreview.js';
|
|
7
8
|
|
|
8
9
|
interface IButtonProps extends ButtonProps {
|
|
9
|
-
/** 是否有权限 */
|
|
10
|
+
/** 是否有权限 false无权限 true有权限 */
|
|
10
11
|
isAuth?: boolean;
|
|
11
12
|
/** tooltip相关 */
|
|
12
13
|
tooltipTitle?: string;
|
|
13
14
|
tooltipConfig?: TooltipProps;
|
|
15
|
+
/** 二次确认相关 */
|
|
16
|
+
confirmTitle?: string;
|
|
17
|
+
confirmMsg?: string;
|
|
18
|
+
confirmConfig?: PopconfirmProps;
|
|
14
19
|
}
|
|
15
20
|
interface ButtonComponent extends React.FC<IButtonProps> {
|
|
16
21
|
displayName: string;
|
|
@@ -11,6 +11,12 @@ interface IZtxkConfig {
|
|
|
11
11
|
* 接口请求方法
|
|
12
12
|
*/
|
|
13
13
|
request?: any;
|
|
14
|
+
/**
|
|
15
|
+
* 按钮无权限时的处理方法。默认无权限的按钮会隐藏。
|
|
16
|
+
* 如果传入: display 则按钮会隐藏
|
|
17
|
+
* 如果传入: disabled 则按钮会禁用
|
|
18
|
+
*/
|
|
19
|
+
noPermission?: "display" | "disabled";
|
|
14
20
|
}
|
|
15
21
|
declare const ZtxkContext: React__default.Context<IZtxkConfig>;
|
|
16
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.ztxk-container{min-height:100px;overflow:auto;position:relative}.ztxk-container .ztxk-container__loading{align-items:center;background-color:#bbc7d366;bottom:0;display:flex;flex-direction:column;justify-content:center;left:0;min-height:100px;position:absolute;right:0;text-align:center;top:0;z-index:10000}.ztxk-container .ztxk-container__content{background-color:#fff;margin:10px;overflow-y:auto;padding:10px}.ztxk-container .ztxk-container__content.ztxk-container__content--flex{display:flex;flex-direction:column}.ztxk-container .ztxk-container__content.ztxk-container__content--title{display:flex;flex-direction:column;padding:0!important}.ztxk-container .ztxk-container__content.ztxk-container__content--title .ztxk-container__content--main{flex-grow:1;overflow-y:auto;padding:10px}.ztxk-container--btn-wrap.btn-wrap--margin-top{margin-top:10px}.ztxk-container--btn-wrap>button{margin-bottom:10px;margin-right:10px}.ztxk-container--scroll-wrap{overflow-y:auto}.ztxk-container--scroll-wrap.scroll-wrap--margin-top{margin-top:10px}
|
|
1
|
+
.ztxk-container{min-height:100px;overflow:auto;position:relative}.ztxk-container .ztxk-container__loading{align-items:center;background-color:#bbc7d366;bottom:0;display:flex;flex-direction:column;justify-content:center;left:0;min-height:100px;position:absolute;right:0;text-align:center;top:0;z-index:10000}.ztxk-container .ztxk-container__content{background-color:#fff;margin:10px;overflow-y:auto;padding:10px}.ztxk-container .ztxk-container__content.ztxk-container__content--flex{display:flex;flex-direction:column}.ztxk-container .ztxk-container__content.ztxk-container__content--title{display:flex;flex-direction:column;padding:0!important}.ztxk-container .ztxk-container__content.ztxk-container__content--title .ztxk-container__content--main{flex-grow:1;overflow-y:auto;padding:10px}.ztxk-container .ztxk-container__content.ztxk-container__content--title .ztxk-container__content--main--flex{display:flex;flex-direction:column}.ztxk-container--btn-wrap.btn-wrap--margin-top{margin-top:10px}.ztxk-container--btn-wrap>button{margin-bottom:10px;margin-right:10px}.ztxk-container--scroll-wrap{overflow-y:auto}.ztxk-container--scroll-wrap.scroll-wrap--margin-top{margin-top:10px}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { IEnhanceSelectProps } from './interface.js';
|
|
3
|
+
|
|
4
|
+
declare const MemoEnhanceSelect: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<IEnhanceSelectProps & React__default.RefAttributes<unknown>>>;
|
|
5
|
+
|
|
6
|
+
export { MemoEnhanceSelect as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ISelectProps } from '../select/interface.js';
|
|
2
|
+
|
|
3
|
+
interface IEnhanceSelectProps extends ISelectProps {
|
|
4
|
+
/**
|
|
5
|
+
* 发送请求的方法(同axios),通常业务那边会封装一个代理的request方法,可以通过context获取,不是必传
|
|
6
|
+
*/
|
|
7
|
+
request?: any;
|
|
8
|
+
/**
|
|
9
|
+
* 接口请求地址。接口返回的数据,组件支持接口数据返回两种模式
|
|
10
|
+
* 一种是 { ..., data: [] }
|
|
11
|
+
* 另一种是分页的模式 { ..., records: [], total: xx, size: xx, current: xx }
|
|
12
|
+
*/
|
|
13
|
+
url?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 接口请求参数。
|
|
16
|
+
*/
|
|
17
|
+
params?: any;
|
|
18
|
+
/**
|
|
19
|
+
* 请求类型
|
|
20
|
+
*/
|
|
21
|
+
method?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 超时时间 单位毫秒 默认2分钟
|
|
24
|
+
* @default 120000
|
|
25
|
+
*/
|
|
26
|
+
timeout?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 数据是否缓存。对于那些不分页的接口,默认是缓存数据的。
|
|
29
|
+
* 分页的接口,默认是不缓存数据的。
|
|
30
|
+
*/
|
|
31
|
+
isCache?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 转换数据的方法。
|
|
34
|
+
* 接受接口返回的数据,返回一个数组。可以直接给下拉框使用的数组。
|
|
35
|
+
* 组件有默认实现:分页接口、不分页接口的转换。
|
|
36
|
+
* 如果接口返回的数据,跟默认有冲突,需要自定义转换方法。
|
|
37
|
+
* 如果是不分页接口:返回的数据是一个数组即可
|
|
38
|
+
* 如果是分页接口:返回的格式按照 { current: number, size: number, total: number, records: any[] }; 这种格式
|
|
39
|
+
* 大多数情况下,是按中拓这边的分页接口处理数据的,所以不需要做其他处理。除非特殊情况
|
|
40
|
+
*/
|
|
41
|
+
transformData?: (data: any) => any;
|
|
42
|
+
/**
|
|
43
|
+
* 对于那些分页接口,数据回显的时候会有一个问题。因为组件默认只会加载第一页数据,但是用户选择的时候,可能数据并不是第一页的。
|
|
44
|
+
* 这就会导致回显的时候,数据比对不上,显示一个id。
|
|
45
|
+
* 这里的做法是,通过当前选中的值,再首次加载的时候去根据id去请求数据。
|
|
46
|
+
* 查询的key是什么?默认会去 dataKey,如果你的逐渐查询不是dataKey,可以自定义。
|
|
47
|
+
* 有一个更好的方法,就是分页接口额外加一个参数,这个参数来传入主键的值。
|
|
48
|
+
* 后端查询的时候,把这个参数和状态值一起查询,不额外添加参数。查询到后,直接追加到分页的数据中。
|
|
49
|
+
* 这样做的一个好处就是,即使是第一次,也能查到应有的数据。
|
|
50
|
+
* 但是,这个方法需要后端配合。
|
|
51
|
+
*/
|
|
52
|
+
firstLoadDataKey?: string;
|
|
53
|
+
/**
|
|
54
|
+
* 接口是否分页
|
|
55
|
+
*/
|
|
56
|
+
isPage?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* 每页多少条 默认每页50条
|
|
59
|
+
*/
|
|
60
|
+
pageSize?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 远程搜索的key值。默认会采用titleKey作为搜索的key值。也可以是指定的值
|
|
63
|
+
*/
|
|
64
|
+
remoteSearchKey?: string;
|
|
65
|
+
/**
|
|
66
|
+
* 哪些查询参数有值,才进行查询
|
|
67
|
+
*/
|
|
68
|
+
mustQueryKeys?: string | string[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { IEnhanceSelectProps };
|
package/dist/index.build.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { default as AppLayoutSider } from './es/applayoutsider/appLayoutSider.js
|
|
|
26
26
|
export { default as OperationBtn } from './es/operationbtn/operationBtn.js';
|
|
27
27
|
export { default as Select } from './es/select/select.js';
|
|
28
28
|
export { default as SelectRender } from './es/select/select-render.js';
|
|
29
|
+
export { default as EnhanceSelect } from './es/enhanceselect/enhance-select.js';
|
|
29
30
|
export { default as UploadList } from './es/uploadlist/uploadList.js';
|
|
30
31
|
export { default as TreeSelect } from './es/treeselect/treeSelect.js';
|
|
31
32
|
export { default as Tree } from './es/tree/tree.js';
|
|
@@ -60,4 +61,5 @@ export { IItems, ITabsProps } from './es/tabs/interface.js';
|
|
|
60
61
|
export { IUploadListProps } from './es/uploadlist/interface.js';
|
|
61
62
|
export { ITreeSelectProps } from './es/treeselect/interface.js';
|
|
62
63
|
export { ITreeProps } from './es/tree/interface.js';
|
|
64
|
+
export { IEnhanceSelectProps } from './es/enhanceselect/interface.js';
|
|
63
65
|
export { TableRowSelection } from 'antd/es/table/interface';
|