zmdms-webui 0.0.4 → 0.0.6
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/README.md +22 -12
- package/dist/es/_virtual/_tslib.js +39 -1
- package/dist/es/button/button.d.ts +5 -3
- package/dist/es/button/button.js +7 -18
- package/dist/es/detaillist/index.d.ts +5 -0
- package/dist/es/detaillist/index.js +5 -0
- package/dist/es/detaillist/item.d.ts +21 -0
- package/dist/es/detaillist/item.js +26 -0
- package/dist/es/detaillist/list.d.ts +15 -0
- package/dist/es/detaillist/list.js +19 -0
- package/dist/es/dynamicsetting/dynamicSetting.d.ts +2 -2
- package/dist/es/dynamicsetting/interface.d.ts +6 -1
- package/dist/es/dynamicsetting/useDynamic.js +2 -0
- package/dist/es/footer/footer.js +1 -1
- package/dist/es/forgetpassword/forgetPassword.js +2 -2
- package/dist/es/form/detaultDom.js +11 -0
- package/dist/es/form/form.d.ts +1 -0
- package/dist/es/form/form.js +8 -5
- package/dist/es/form/formItems.js +4 -2
- package/dist/es/form/hooks.js +8 -8
- package/dist/es/form/interface.d.ts +5 -4
- package/dist/es/formitem/formItem.js +26 -9
- package/dist/es/login/index.d.ts +1 -0
- package/dist/es/login/index.js +2 -2
- package/dist/es/modal/index.d.ts +5 -0
- package/dist/es/modal/index.js +5 -0
- package/dist/es/modal/interface.d.ts +16 -0
- package/dist/es/modal/modal.d.ts +5 -0
- package/dist/es/modal/modal.js +34 -0
- package/dist/es/node_modules/@ant-design/icons/es/icons/MinusOutlined.js +15 -0
- package/dist/es/node_modules/@ant-design/icons/es/icons/MinusSquareOutlined.js +15 -0
- package/dist/es/node_modules/@ant-design/icons/es/icons/PicRightOutlined.js +15 -0
- package/dist/es/node_modules/@ant-design/icons/es/icons/PlusOutlined.js +15 -0
- package/dist/es/node_modules/@ant-design/icons-svg/es/asn/MinusOutlined.js +5 -0
- package/dist/es/node_modules/@ant-design/icons-svg/es/asn/MinusSquareOutlined.js +5 -0
- package/dist/es/node_modules/@ant-design/icons-svg/es/asn/PicRightOutlined.js +5 -0
- package/dist/es/node_modules/@ant-design/icons-svg/es/asn/PlusOutlined.js +5 -0
- package/dist/es/table/components/ColumnAddDel.js +21 -0
- package/dist/es/table/components/ColumnDynamic.js +14 -0
- package/dist/es/table/components/CopyIcon.js +4 -2
- package/dist/es/table/components/EnhanceCell.js +17 -6
- package/dist/es/table/components/EnhanceRow.js +12 -2
- package/dist/es/table/components/hooks.js +18 -2
- package/dist/es/table/components/useDragRef.js +56 -0
- package/dist/es/table/constant.js +6 -2
- package/dist/es/table/hooks.js +154 -5
- package/dist/es/table/interface.d.ts +51 -4
- package/dist/es/table/table.js +122 -16
- package/dist/es/table/useColumns.js +47 -4
- package/dist/es/table/useDynamicListByColumns.js +1 -1
- package/dist/es/table/useInnerPagination.js +60 -0
- package/dist/es/table/useSummary.js +286 -0
- package/dist/es/table/useTableValidate.js +208 -0
- package/dist/es/table/utils.js +4 -3
- 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/dist/index.umd.js +2 -2
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# zmdms-webui
|
|
2
2
|
|
|
3
|
-
基于antd4.24.8版本二开组件库,通过rollup打包。
|
|
3
|
+
基于 antd4.24.8 版本二开组件库,通过 rollup 打包。
|
|
4
4
|
|
|
5
5
|
# 使用国际化
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
```
|
|
10
10
|
// 引入获取语言配置的hook
|
|
11
11
|
import useLocale from '../config/useLocale';
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
const localeConfig = useLocale(); // 能获取到配置在config/i18n下的语言配置相关信息
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
```
|
|
19
19
|
因为我们组件是基于antd的做的二次开发,由于antd的国际化配置是通过ConfigProvider这个context.provider。但是并没有暴露给用户获取。所以需要额外定义一个切换的context供组件获取
|
|
20
20
|
import { ConfigProvider, ZtxkContext } from 'ztxk-webui'
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
<ConfigProvider locale={locale}>
|
|
23
23
|
<ZtxkContext.Provider value={ztxkConfig}>
|
|
24
24
|
<App />
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
# 注意事项
|
|
32
32
|
|
|
33
|
-
1. 需要覆盖下webpack5下的限制
|
|
33
|
+
1. 需要覆盖下 webpack5 下的限制
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
启用后,你若在 .mjs 文件或其他 .js 文件中导入模块,并且它们最近的 package.json 中包含 "type" 字段,其值为 "module"时,你应为此文件提供扩展名,否则 webpack 会提示 Module not found 的错误且编译失败。并且 webpack 不会解析 resolve.mainFiles 中定义的文件目录,你必须自己指定文件名。
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
};
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
2. 开发时 添加less支持 (less-loader 需要用10.2.0以下的版本)
|
|
52
|
+
2. 开发时 添加 less 支持 (less-loader 需要用 10.2.0 以下的版本)
|
|
53
53
|
|
|
54
54
|
```
|
|
55
|
-
|
|
55
|
+
// 进入 react-scripts/config/webpack.config.js
|
|
56
56
|
{
|
|
57
57
|
test: /\.(less)$/,
|
|
58
58
|
exclude: /\.module\.(less)$/,
|
|
@@ -84,21 +84,31 @@
|
|
|
84
84
|
sideEffects: true,
|
|
85
85
|
},
|
|
86
86
|
```
|
|
87
|
-
|
|
88
|
-
3. 本地link需要注意事项
|
|
87
|
+
|
|
88
|
+
3. 本地 link 需要注意事项
|
|
89
89
|
|
|
90
90
|
```
|
|
91
91
|
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
92
92
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
93
93
|
2. You might be breaking the Rules of Hooks
|
|
94
94
|
3. You might have more than one copy of React in the same app
|
|
95
|
-
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
|
|
96
|
-
|
|
95
|
+
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
|
|
96
|
+
|
|
97
97
|
需要切换到ui库下面,将react link到开发项目的node modules下
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
cd zmdms-webui
|
|
100
100
|
npm link ..\zmdms-webmain\node_modules\react
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
- 使用 link 后报如下错误,可能是 lock 文件中 有 file:引用本地文件导致的错误
|
|
104
|
+
删除对应的引用即可
|
|
105
|
+
|
|
106
|
+
````
|
|
107
|
+
ode:events:491
|
|
108
|
+
throw er; // Unhandled 'error' event
|
|
109
|
+
^
|
|
104
110
|
|
|
111
|
+
Error: EISDIR: illegal operation on a directory, read
|
|
112
|
+
Emitted 'error' event on ReadStream instance at:
|
|
113
|
+
```
|
|
114
|
+
````
|
|
@@ -38,6 +38,44 @@ function __rest(s, e) {
|
|
|
38
38
|
return t;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
42
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
45
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
46
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
47
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function __generator(thisArg, body) {
|
|
52
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
53
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
54
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
58
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
59
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
60
|
+
switch (op[0]) {
|
|
61
|
+
case 0: case 1: t = op; break;
|
|
62
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
63
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
64
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
65
|
+
default:
|
|
66
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
67
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
68
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
69
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
70
|
+
if (t[2]) _.ops.pop();
|
|
71
|
+
_.trys.pop(); continue;
|
|
72
|
+
}
|
|
73
|
+
op = body.call(thisArg, _);
|
|
74
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
75
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
41
79
|
function __spreadArray(to, from, pack) {
|
|
42
80
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
43
81
|
if (ar || !(i in from)) {
|
|
@@ -48,4 +86,4 @@ function __spreadArray(to, from, pack) {
|
|
|
48
86
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
49
87
|
}
|
|
50
88
|
|
|
51
|
-
export { __assign, __rest, __spreadArray };
|
|
89
|
+
export { __assign, __awaiter, __generator, __rest, __spreadArray };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { ButtonProps } from 'antd/es/button';
|
|
3
3
|
|
|
4
|
-
interface IProps extends ButtonProps {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
interface IProps extends Omit<ButtonProps, "onClick"> {
|
|
5
|
+
onClick?: (event: React__default.MouseEvent<HTMLElement, MouseEvent>, currentBtn: ICurrentBtn) => void;
|
|
6
|
+
}
|
|
7
|
+
interface ICurrentBtn {
|
|
8
|
+
canClick: boolean;
|
|
7
9
|
}
|
|
8
10
|
declare const Button: React__default.FC<IProps>;
|
|
9
11
|
|
package/dist/es/button/button.js
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
import { __rest, __assign } from '../_virtual/_tslib.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useRef } from 'react';
|
|
4
3
|
import { Button as Button$1 } from 'antd';
|
|
5
4
|
import classNames from '../node_modules/classnames/index.js';
|
|
6
5
|
|
|
7
|
-
var maxClickTime = 300;
|
|
8
6
|
var Button = function (props) {
|
|
9
7
|
var _a;
|
|
10
|
-
var
|
|
11
|
-
var startTimeRef = useRef(0);
|
|
8
|
+
var type = props.type, className = props.className, disabled = props.disabled, size = props.size, danger = props.danger, onClick = props.onClick, resetProps = __rest(props, ["type", "className", "disabled", "size", "danger", "onClick"]);
|
|
12
9
|
var classes = classNames("zt-btn", className, (_a = {},
|
|
13
10
|
_a["zt-btn-".concat(type)] = type,
|
|
14
11
|
_a["zt-btn-disabled"] = disabled,
|
|
15
12
|
_a["zt-btn-".concat(size)] = size,
|
|
16
13
|
_a["zt-btn-dangerous"] = danger,
|
|
17
14
|
_a));
|
|
15
|
+
var currentBtn = {
|
|
16
|
+
canClick: true,
|
|
17
|
+
};
|
|
18
18
|
var myOnClick = function (event) {
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
if (startTimeRef.current === 0 ||
|
|
22
|
-
nowDateTime - startTimeRef.current > maxClickTime) {
|
|
23
|
-
startTimeRef.current = nowDateTime;
|
|
24
|
-
onClick && onClick(event);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
startTimeRef.current = nowDateTime;
|
|
28
|
-
console.log("点击按钮过于频繁");
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
onClick && onClick(event);
|
|
19
|
+
if (!currentBtn.canClick) {
|
|
20
|
+
return;
|
|
33
21
|
}
|
|
22
|
+
onClick && onClick(event, currentBtn);
|
|
34
23
|
};
|
|
35
24
|
return (jsx(Button$1, __assign({ className: classes, type: type, disabled: disabled, size: size, danger: danger, onClick: myOnClick }, resetProps)));
|
|
36
25
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { ColProps } from 'antd/lib/col';
|
|
3
|
+
|
|
4
|
+
interface IProps extends ColProps {
|
|
5
|
+
title: string;
|
|
6
|
+
colon?: boolean;
|
|
7
|
+
span: number;
|
|
8
|
+
titleSpan?: number;
|
|
9
|
+
titleProps?: any;
|
|
10
|
+
/** 多余得属性 */
|
|
11
|
+
textProps?: any;
|
|
12
|
+
/**是否显示差别 */
|
|
13
|
+
showDiff?: boolean;
|
|
14
|
+
/** 是否添加超出隐藏 */
|
|
15
|
+
isEllipsis?: boolean;
|
|
16
|
+
/** 是否加粗 */
|
|
17
|
+
isBlod?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const Item: React__default.FC<IProps>;
|
|
20
|
+
|
|
21
|
+
export { IProps, Item as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __assign } from '../_virtual/_tslib.js';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import classNames from '../node_modules/classnames/index.js';
|
|
4
|
+
import { Col } from 'antd';
|
|
5
|
+
|
|
6
|
+
var Item = function (_a) {
|
|
7
|
+
var children = _a.children, className = _a.className, title = _a.title, _b = _a.colon, colon = _b === void 0 ? true : _b, span = _a.span, titleSpan = _a.titleSpan, titleProps = _a.titleProps, textProps = _a.textProps, showDiff = _a.showDiff, _c = _a.isEllipsis, isEllipsis = _c === void 0 ? true : _c, isBlod = _a.isBlod;
|
|
8
|
+
var classes = classNames("ztxk-grid-item", className);
|
|
9
|
+
return (jsxs(Fragment, { children: [jsxs(Col, __assign({ className: classes + " ztxk-grid-item--title",
|
|
10
|
+
// span={titleSpan ? titleSpan : Math.ceil(span * 0.3)}
|
|
11
|
+
span: titleSpan ? titleSpan : 3, title: title }, titleProps, { children: [jsx("span", __assign({ className: "ztxk-grid-item--title-text" }, { children: title })), jsx("span", __assign({ className: "ztxk-grid-item--title-colon" }, { children: colon && ":" }))] })), jsx(Col, __assign({ className: showDiff
|
|
12
|
+
? classes +
|
|
13
|
+
" ztxk-grid-item--text ztxk-grid-item--diff" +
|
|
14
|
+
"".concat(isEllipsis
|
|
15
|
+
? " ztxk-grid-item--text-ellipsis"
|
|
16
|
+
: " ztxk-grid-item--text-noellipsis")
|
|
17
|
+
: classes +
|
|
18
|
+
" ztxk-grid-item--text" +
|
|
19
|
+
"".concat(isEllipsis
|
|
20
|
+
? " ztxk-grid-item--text-ellipsis"
|
|
21
|
+
: " ztxk-grid-item--text-noellipsis"),
|
|
22
|
+
// span={titleSpan ? span - titleSpan : span - Math.ceil(span * 0.3)}
|
|
23
|
+
span: titleSpan ? span - titleSpan : span - 3, title: typeof children === "string" ? children : undefined, style: { fontWeight: isBlod ? "bold" : "normal" } }, textProps, { children: children }))] }));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { Item as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { RowProps } from 'antd/lib/row';
|
|
3
|
+
import Item from './item.js';
|
|
4
|
+
|
|
5
|
+
interface IListProps extends RowProps {
|
|
6
|
+
border?: boolean;
|
|
7
|
+
isBg?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ListComponent extends React__default.FC<IListProps> {
|
|
10
|
+
Item: typeof Item;
|
|
11
|
+
displayName: string;
|
|
12
|
+
}
|
|
13
|
+
declare const DetailList: ListComponent;
|
|
14
|
+
|
|
15
|
+
export { IListProps, DetailList as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { __rest, __assign } from '../_virtual/_tslib.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import classNames from '../node_modules/classnames/index.js';
|
|
4
|
+
import Item from './item.js';
|
|
5
|
+
import { Row } from 'antd';
|
|
6
|
+
|
|
7
|
+
var List = function (_a) {
|
|
8
|
+
var children = _a.children, className = _a.className, border = _a.border, isBg = _a.isBg, restProps = __rest(_a, ["children", "className", "border", "isBg"]);
|
|
9
|
+
var classes = classNames("ztxk-grid", className, {
|
|
10
|
+
"ztxk-grid--border": border,
|
|
11
|
+
"ztxk-grid--background": isBg,
|
|
12
|
+
});
|
|
13
|
+
return (jsx(Row, __assign({ className: classes }, restProps, { gutter: 0 }, { children: children })));
|
|
14
|
+
};
|
|
15
|
+
var DetailList = List;
|
|
16
|
+
DetailList.displayName = "ZTXK_WEBUI_DetailList";
|
|
17
|
+
DetailList.Item = Item;
|
|
18
|
+
|
|
19
|
+
export { DetailList as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { IDynamicSettingProps } from './interface.js';
|
|
2
|
+
import { IDynamicSettingProps, IRef } from './interface.js';
|
|
3
3
|
|
|
4
|
-
declare const _default: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<IDynamicSettingProps & React__default.RefAttributes<
|
|
4
|
+
declare const _default: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<IDynamicSettingProps & React__default.RefAttributes<IRef>>>;
|
|
5
5
|
|
|
6
6
|
export { _default as default };
|
|
@@ -13,6 +13,11 @@ interface IDynamicSettingProps {
|
|
|
13
13
|
children?: JSX.Element;
|
|
14
14
|
title?: string;
|
|
15
15
|
hiddenOperationIcon?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface IRef {
|
|
18
|
+
getCurrentDynamicList: (list: IDynamicItem[]) => IDynamicItem[];
|
|
19
|
+
setList: React.Dispatch<React.SetStateAction<IDynamicItem[]>>;
|
|
20
|
+
setVisible: (v: boolean) => void;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
export { IDynamicItem, IDynamicSettingProps };
|
|
23
|
+
export { IDynamicItem, IDynamicSettingProps, IRef };
|
|
@@ -25,12 +25,14 @@ function getCurrentDynamicItems(dynamicKey, parentDynamicKey, list) {
|
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
// 如果缓存中有值,那么以缓存中的值为准
|
|
28
|
+
// key保留 其他内容替换
|
|
28
29
|
list.forEach(function (item, index) {
|
|
29
30
|
var result = __assign({ checked: true }, item);
|
|
30
31
|
// 将最新的名字等同步
|
|
31
32
|
// 如果之前有数据,那么需要验证数据的准确性,比如修改了名字但是key没替换
|
|
32
33
|
var currentData = currentDynamicList_1.find(function (currentDynamic) { return currentDynamic.key === result.key; });
|
|
33
34
|
if (currentData) {
|
|
35
|
+
currentData.label = result.label;
|
|
34
36
|
currentData.isFind = true; // 代表当前这个字段被找到
|
|
35
37
|
}
|
|
36
38
|
else {
|
package/dist/es/footer/footer.js
CHANGED
|
@@ -18,7 +18,7 @@ var Footer = function (props) {
|
|
|
18
18
|
} }, { children: footerDom ? (jsxs("div", __assign({ className: "ztxk-footer--group" }, { children: [footerDom.map(function (item, index) {
|
|
19
19
|
var DOMType = item.DOMType, render = item.render;
|
|
20
20
|
if (DOMType === "button") {
|
|
21
|
-
var
|
|
21
|
+
var _a = item.type, type = _a === void 0 ? "primary" : _a, loading = item.loading, disabled = item.disabled, onClick = item.onClick;
|
|
22
22
|
return (jsx(Button, __assign({ type: type, loading: loading, disabled: disabled, onClick: onClick }, { children: item.text }), index));
|
|
23
23
|
}
|
|
24
24
|
if (DOMType === "pagination") {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import ModalComponent from '../modal/modal.js';
|
|
3
3
|
|
|
4
4
|
var ForgetPassword = function () {
|
|
5
|
-
return jsx(
|
|
5
|
+
return jsx(ModalComponent, {});
|
|
6
6
|
};
|
|
7
7
|
ForgetPassword.displayName = "ZTXK_WEBUI_ForgetPassword";
|
|
8
8
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __assign } from '../_virtual/_tslib.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
var DefaultDom = function (_a) {
|
|
6
|
+
var children = _a.children, value = _a.value;
|
|
7
|
+
return (jsx("div", __assign({ className: "ztxk-form--detault-dom" }, { children: children ? children : value })));
|
|
8
|
+
};
|
|
9
|
+
var DefaultDom$1 = memo(DefaultDom);
|
|
10
|
+
|
|
11
|
+
export { DefaultDom$1 as default };
|
package/dist/es/form/form.d.ts
CHANGED
package/dist/es/form/form.js
CHANGED
|
@@ -3,8 +3,9 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { memo, useMemo, useCallback } from 'react';
|
|
4
4
|
import { Form as Form$1 } from 'antd';
|
|
5
5
|
import classNames from '../node_modules/classnames/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { useFormPreferencesCreateNewItems, useDynamicListByItems, useBtnHandle } from './hooks.js';
|
|
7
7
|
import FormItems from './formItems.js';
|
|
8
|
+
import DefaultDom from './detaultDom.js';
|
|
8
9
|
import DynamicSetting from '../dynamicsetting/dynamicSetting.js';
|
|
9
10
|
import Button from '../button/button.js';
|
|
10
11
|
|
|
@@ -17,14 +18,15 @@ var FORM_DYNAMIC_KEY = "ztxk-webui-dynamic-form";
|
|
|
17
18
|
// 用户配置优先,先从远端获取到 表单配置信息。
|
|
18
19
|
// 给子元素设置好了表单配置信息后 接下来的内容 交给动态列配置接管
|
|
19
20
|
var Form = function (props) {
|
|
20
|
-
var form = props.form, bottomBorder = props.bottomBorder, _a = props.isFlex, isFlex = _a === void 0 ? true : _a, wrapClassName = props.wrapClassName, leftClassName = props.leftClassName; props.itemClassName; var rightWrapVisible = props.rightWrapVisible, rightClassName = props.rightClassName, children = props.children, dynamicKey = props.dynamicKey,
|
|
21
|
+
var form = props.form, bottomBorder = props.bottomBorder, _a = props.isFlex, isFlex = _a === void 0 ? true : _a, wrapClassName = props.wrapClassName, leftClassName = props.leftClassName; props.itemClassName; var rightWrapVisible = props.rightWrapVisible, rightClassName = props.rightClassName, children = props.children, dynamicKey = props.dynamicKey, formPreferences = props.formPreferences, items = props.items, outsideState = props.outsideState, onValuesChange = props.onValuesChange, onResetHandle = props.onResetHandle, onSearchHandle = props.onSearchHandle, type = props.type, restProps = __rest(props, ["form", "bottomBorder", "isFlex", "wrapClassName", "leftClassName", "itemClassName", "rightWrapVisible", "rightClassName", "children", "dynamicKey", "formPreferences", "items", "outsideState", "onValuesChange", "onResetHandle", "onSearchHandle", "type"]);
|
|
21
22
|
// 获取新的items
|
|
22
|
-
var configInfoItems =
|
|
23
|
+
var configInfoItems = useFormPreferencesCreateNewItems(formPreferences, items).configInfoItems;
|
|
23
24
|
// 根据items 和 dynamicKey 获取到动态列配置信息
|
|
24
|
-
var _b = useDynamicListByItems(configInfoItems, dynamicKey,
|
|
25
|
+
var _b = useDynamicListByItems(configInfoItems, dynamicKey, formPreferences), dynamicList = _b.dynamicList, onCurrentListChange = _b.onCurrentListChange, newItems = _b.newItems, dynamicSettingRef = _b.dynamicSettingRef;
|
|
25
26
|
// 主容器类名
|
|
26
27
|
var wrapClasses = classNames("ztxk-form", wrapClassName, {
|
|
27
28
|
"ztxk-form--bottom-border": bottomBorder,
|
|
29
|
+
"ztxk-form--list": type === "list",
|
|
28
30
|
});
|
|
29
31
|
// 左容器类名
|
|
30
32
|
var leftClasses = classNames("ztxk-form__left", leftClassName, {
|
|
@@ -84,6 +86,7 @@ MemoForm.List = Form$1.List;
|
|
|
84
86
|
MemoForm.ErrorList = Form$1.ErrorList;
|
|
85
87
|
MemoForm.Provider = Form$1.Provider;
|
|
86
88
|
MemoForm.useFormInstance = Form$1.useFormInstance;
|
|
87
|
-
MemoForm.useWatch = Form$1.useWatch;
|
|
89
|
+
MemoForm.useWatch = Form$1.useWatch;
|
|
90
|
+
MemoForm.DefaultDom = DefaultDom;
|
|
88
91
|
|
|
89
92
|
export { FORM_DYNAMIC_KEY, MemoForm as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __assign } from '../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { memo } from 'react';
|
|
3
4
|
import FormItem from '../formitem/formItem.js';
|
|
4
5
|
|
|
5
6
|
var FormItems = function (props) {
|
|
@@ -9,6 +10,7 @@ var FormItems = function (props) {
|
|
|
9
10
|
return (jsx(FormItem, __assign({ index: index }, item, { outsideState: outsideState }), "".concat(item.name)));
|
|
10
11
|
})
|
|
11
12
|
: null }));
|
|
12
|
-
};
|
|
13
|
+
};
|
|
14
|
+
var FormItems$1 = memo(FormItems);
|
|
13
15
|
|
|
14
|
-
export { FormItems as default };
|
|
16
|
+
export { FormItems$1 as default };
|
package/dist/es/form/hooks.js
CHANGED
|
@@ -4,22 +4,22 @@ import { getCurrentDynamicItems } from '../dynamicsetting/useDynamic.js';
|
|
|
4
4
|
import { FORM_DYNAMIC_KEY } from './form.js';
|
|
5
5
|
|
|
6
6
|
// 根据表单配置信息 及 表单项items 生成新的表单项items
|
|
7
|
-
function
|
|
7
|
+
function useFormPreferencesCreateNewItems(formPreferences, items) {
|
|
8
8
|
var configInfoItems = useMemo(function () {
|
|
9
|
-
if (
|
|
9
|
+
if (formPreferences) {
|
|
10
10
|
return items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
11
11
|
var _a, _b, _c;
|
|
12
12
|
var name = item.name, configName = item.configName;
|
|
13
13
|
var key = configName || name;
|
|
14
|
-
return __assign(__assign({}, item), { isDisplay: (_a =
|
|
14
|
+
return __assign(__assign({}, item), { isDisplay: (_a = formPreferences[key]) === null || _a === void 0 ? void 0 : _a.isDisplay, isRequired: (_b = formPreferences[key]) === null || _b === void 0 ? void 0 : _b.isRequired, isChangeable: (_c = formPreferences[key]) === null || _c === void 0 ? void 0 : _c.isChangeable });
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
return items;
|
|
18
|
-
}, [
|
|
18
|
+
}, [formPreferences, items]);
|
|
19
19
|
return { configInfoItems: configInfoItems };
|
|
20
20
|
}
|
|
21
21
|
// 根据新的表单项items 经过 dynamic处理后 得到最新的配置信息
|
|
22
|
-
function useDynamicListByItems(items, dynamicKey,
|
|
22
|
+
function useDynamicListByItems(items, dynamicKey, formPreferences) {
|
|
23
23
|
// 动态列配置手动刷新基础配置
|
|
24
24
|
var dynamicSettingRef = useRef({});
|
|
25
25
|
// 根据子元素生成动态列配置信息
|
|
@@ -44,11 +44,11 @@ function useDynamicListByItems(items, dynamicKey, formConfigInfo) {
|
|
|
44
44
|
// 如果表单配置信息发生改变,那么重置下初始化值
|
|
45
45
|
useEffect(function () {
|
|
46
46
|
var _a, _b;
|
|
47
|
-
if (
|
|
47
|
+
if (formPreferences && dynamicKey) {
|
|
48
48
|
(_b = (_a = dynamicSettingRef.current) === null || _a === void 0 ? void 0 : _a.setList) === null || _b === void 0 ? void 0 : _b.call(_a, dynamicList);
|
|
49
49
|
}
|
|
50
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
-
}, [
|
|
51
|
+
}, [formPreferences, dynamicKey]);
|
|
52
52
|
// 变化的动态列配置信息
|
|
53
53
|
var _a = useState(function () {
|
|
54
54
|
return getCurrentDynamicItems(dynamicKey, FORM_DYNAMIC_KEY, dynamicList);
|
|
@@ -102,4 +102,4 @@ function useBtnHandle(form, handleObj) {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export { useBtnHandle, useDynamicListByItems,
|
|
105
|
+
export { useBtnHandle, useDynamicListByItems, useFormPreferencesCreateNewItems };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd/lib/form';
|
|
2
2
|
import { IFormItem } from '../formitem/formItem.js';
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
interface IFormPreferences {
|
|
5
5
|
isRequired?: boolean | number;
|
|
6
6
|
isChangeable?: boolean | number;
|
|
7
7
|
isDisplay?: boolean | number;
|
|
@@ -10,6 +10,7 @@ interface IFormItemProps extends IFormItem {
|
|
|
10
10
|
}
|
|
11
11
|
interface IProFormProps extends FormProps {
|
|
12
12
|
bottomBorder?: boolean;
|
|
13
|
+
type?: "default" | "list";
|
|
13
14
|
isFlex?: boolean;
|
|
14
15
|
wrapClassName?: string;
|
|
15
16
|
leftClassName?: string;
|
|
@@ -25,8 +26,8 @@ interface IProFormProps extends FormProps {
|
|
|
25
26
|
*/
|
|
26
27
|
onSearchHandle?: any;
|
|
27
28
|
dynamicKey?: string;
|
|
28
|
-
|
|
29
|
-
[prop: string]:
|
|
29
|
+
formPreferences?: {
|
|
30
|
+
[prop: string]: IFormPreferences;
|
|
30
31
|
};
|
|
31
32
|
items?: IFormItemProps[];
|
|
32
33
|
children?: any;
|
|
@@ -36,4 +37,4 @@ interface IProFormProps extends FormProps {
|
|
|
36
37
|
outsideState?: any;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export {
|
|
40
|
+
export { IFormItemProps, IFormPreferences, IProFormProps };
|
|
@@ -5,6 +5,7 @@ import classNames from '../node_modules/classnames/index.js';
|
|
|
5
5
|
import '../config/ZtxkContext.js';
|
|
6
6
|
import isEqual from '../config/isEqual.js';
|
|
7
7
|
import MemoForm from '../form/form.js';
|
|
8
|
+
import { Col } from 'antd';
|
|
8
9
|
|
|
9
10
|
var FormItem = function (props) {
|
|
10
11
|
var _a;
|
|
@@ -84,26 +85,42 @@ var FormItem = function (props) {
|
|
|
84
85
|
}
|
|
85
86
|
return (jsxs(ItemWrap, __assign({ width: width, className: className }, { children: [preNode ? preNode : null, jsx(MemoForm.Item, __assign({}, resetProps, { className: itemClasses }, { children: render ? render(itemProps, form) : children })), nextNode ? nextNode : null] })));
|
|
86
87
|
};
|
|
87
|
-
function getWidthStr(width) {
|
|
88
|
+
// function getWidthStr(width: IWidth | undefined) {
|
|
89
|
+
// switch (width) {
|
|
90
|
+
// case "half":
|
|
91
|
+
// return "16.66%";
|
|
92
|
+
// case "all":
|
|
93
|
+
// return "100%";
|
|
94
|
+
// case "double":
|
|
95
|
+
// return "66.66%";
|
|
96
|
+
// case "halfAll":
|
|
97
|
+
// return "50%";
|
|
98
|
+
// default:
|
|
99
|
+
// return "33.33%";
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
102
|
+
function getWidthNum(width) {
|
|
88
103
|
switch (width) {
|
|
89
104
|
case "half":
|
|
90
|
-
return
|
|
105
|
+
return 12;
|
|
91
106
|
case "all":
|
|
92
|
-
return
|
|
107
|
+
return 24;
|
|
93
108
|
case "double":
|
|
94
|
-
return
|
|
109
|
+
return 16;
|
|
95
110
|
case "halfAll":
|
|
96
|
-
return
|
|
111
|
+
return 12;
|
|
97
112
|
default:
|
|
98
|
-
return
|
|
113
|
+
return 8;
|
|
99
114
|
}
|
|
100
115
|
}
|
|
101
116
|
function ItemWrap(props) {
|
|
102
117
|
var className = props.className, children = props.children, width = props.width;
|
|
103
118
|
var itemClasses = classNames("ztxk-form__item--wrap", className);
|
|
104
|
-
return (jsx(
|
|
105
|
-
|
|
106
|
-
|
|
119
|
+
return (jsx(Col, __assign({ className: itemClasses,
|
|
120
|
+
// style={{
|
|
121
|
+
// width: getWidthStr(width),
|
|
122
|
+
// }}
|
|
123
|
+
span: getWidthNum(width) }, { children: children })));
|
|
107
124
|
}
|
|
108
125
|
FormItem.displayName = "ZTXK_WEBUI_FormItem";
|
|
109
126
|
// export default FormItem;
|
package/dist/es/login/index.d.ts
CHANGED
package/dist/es/login/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import Button from '../button/button.js';
|
|
|
7
7
|
|
|
8
8
|
var Item = Form.Item;
|
|
9
9
|
var Login = function (props) {
|
|
10
|
-
var loginLogo = props.loginLogo, loginBg = props.loginBg, onFinishHandle = props.onFinishHandle;
|
|
10
|
+
var loginLogo = props.loginLogo, loginBg = props.loginBg, onFinishHandle = props.onFinishHandle, loading = props.loading;
|
|
11
11
|
var form = Form.useForm()[0];
|
|
12
12
|
var onFinish = function (values) {
|
|
13
13
|
// 内部处理
|
|
@@ -23,7 +23,7 @@ var Login = function (props) {
|
|
|
23
23
|
required: true,
|
|
24
24
|
message: "请输入您的密码",
|
|
25
25
|
},
|
|
26
|
-
] }, { children: jsx(MemoInput.Password, { size: "large", prefix: jsx(IconFont, { type: "icon-mima", style: { fontSize: "14px", color: "rgba(0,0,0,.65)" } }) }) })), jsx(Item, { children: jsx(Button, __assign({ htmlType: "submit", block: true, className: "form__item--button" }, { children: "\u767B\u5F55" })) }), jsxs("div", __assign({ className: "form__item--remember" }, { children: [jsx(Item, __assign({ name: "remember", valuePropName: "checked" }, { children: jsx(Checkbox, { children: "\u8BB0\u4F4F\u5BC6\u7801" }) })), jsx("div", __assign({ className: "form__item--remember-forget" }, { children: "\u5FD8\u8BB0\u5BC6\u7801" }))] }))] })) })));
|
|
26
|
+
] }, { children: jsx(MemoInput.Password, { size: "large", prefix: jsx(IconFont, { type: "icon-mima", style: { fontSize: "14px", color: "rgba(0,0,0,.65)" } }) }) })), jsx(Item, { children: jsx(Button, __assign({ htmlType: "submit", block: true, className: "form__item--button", loading: loading }, { children: "\u767B\u5F55" })) }), jsxs("div", __assign({ className: "form__item--remember" }, { children: [jsx(Item, __assign({ name: "remember", valuePropName: "checked" }, { children: jsx(Checkbox, { children: "\u8BB0\u4F4F\u5BC6\u7801" }) })), jsx("div", __assign({ className: "form__item--remember-forget" }, { children: "\u5FD8\u8BB0\u5BC6\u7801" }))] }))] })) })));
|
|
27
27
|
};
|
|
28
28
|
Login.displayName = "ZTXK_WEBUI_Login";
|
|
29
29
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ModalProps } from 'antd/lib/modal';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { Modal } from 'antd';
|
|
4
|
+
|
|
5
|
+
interface IModalProps extends ModalProps {
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface IModalComponent extends React__default.ForwardRefExoticComponent<IModalProps & React__default.RefAttributes<unknown>> {
|
|
9
|
+
info: typeof Modal.info;
|
|
10
|
+
success: typeof Modal.success;
|
|
11
|
+
error: typeof Modal.error;
|
|
12
|
+
warning: typeof Modal.warning;
|
|
13
|
+
confirm: typeof Modal.confirm;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { IModalComponent, IModalProps };
|