zmdms-webui 0.0.122 → 0.0.124
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/applayout/index.css +1 -1
- package/dist/es/applayoutsider/menu/MainMenu.js +11 -4
- package/dist/es/applayoutsider/menu/SubMenu.js +2 -1
- package/dist/es/dynamicsetting/useDynamic.js +26 -0
- package/dist/es/table/components/PopoverIcon.js +26 -0
- package/dist/es/table/components/TitleDirectionColumn.js +1 -0
- package/dist/es/table/interface.d.ts +5 -1
- package/dist/es/table/table.js +4 -1
- package/dist/es/table/useColumns.js +13 -6
- package/dist/es/table/useSummary.js +88 -52
- package/dist/es/table/useTableValidate.js +35 -14
- package/dist/index.dark.css +1 -1
- package/dist/index.default.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.zmdms-container{background-color:#e9ecf3}.zmdms-container .zmdms-sider{background-color:#5b76f6;background-repeat:no-repeat;background-size:100% auto;background-size:cover;z-index:100}.zmdms-container .zmdms-content{background-color:#e9ecf3}.zmdms-container .zmdms-content--header{align-items:center;background:#fff;display:flex;height:48px;justify-content:space-between;line-height:48px;padding:0 0 0 10px}.zmdms-container .zmdms-content--header .ant-tabs{flex:1;margin-top:8px;width:calc(100% - 350px)}.zmdms-container .zmdms-content--header .ant-tabs .ant-tabs-tab a{color:#768696;display:inline-block;padding:0 5px 0 10px}.zmdms-container .zmdms-content--header .ant-tabs .ant-tabs-nav{margin-bottom:0}.zmdms-container .zmdms-content--content{height:calc(100vh - 48px);position:relative}.zmdms-container .zmdms-content--header-info{color:#000000a6;display:flex;height:48px;max-width:350px}.zmdms-container .zmdms-content--header-info .full-screen{cursor:pointer;text-align:center;width:36px}.zmdms-container .zmdms-content--header-info .user-operation{align-items:center;cursor:pointer;display:flex;padding:0 12px}.zmdms-container .zmdms-content--header-info .user-operation:hover{background-color:#f7f7f7}.zmdms-container .zmdms-content--header-info .user-operation>span:last-child{color:#000000a6;display:inline-block;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:70px}.zmdms-menu{display:flex;flex-direction:column;height:100vh}.zmdms-menu .zmdms-logo{align-items:center;display:block;display:flex;height:48px;padding:9px 0 5px}.zmdms-menu .zmdms-logo>img{display:block;margin:0 auto;width:102px}.zmdms-menu .zmdms-menu--main{background:#0000;border-right:none;flex:1;overflow-x:hidden;overflow-y:auto}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu,.zmdms-menu .zmdms-menu--main>.ant-menu-submenu.ant-menu-submenu-open>.ant-menu-submenu-title{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title{align-items:center;background-color:#5b76f5;color:#ffffffa6;display:flex;font-size:13px;height:36px;line-height:36px;margin:0;padding:0}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title .ant-menu-submenu-arrow{color:#ffffffa6;right:6px}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title .ant-menu-title-content{flex:none;width:88%}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title:hover,.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub.ant-menu-inline{background:#0000}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item{align-items:center;color:#ffffffa6;display:flex;font-size:13px;height:36px;line-height:36px;margin:0}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item a{color:inherit}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item:active{background:#0000}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item:hover{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item:not(:last-child){margin-bottom:0}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item.ant-menu-item-selected{background:#5b76f5;color:#fff;width:100%}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item.ant-menu-item-selected:after{border-right:none}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar{height:4px;width:6px}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar-track{background:#fff0;border-radius:4px}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar-thumb{background:#5b76f6;border-radius:4px}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar-thumb:hover{background:#5b76f6}.zmdms-menu .zmdms-menu--main>.ant-menu-item{align-items:center;color:#ffffffa6;display:flex;font-size:13px;height:36px;line-height:36px;margin:0}.zmdms-menu .zmdms-menu--main>.ant-menu-item a{color:inherit}.zmdms-menu .zmdms-menu--main>.ant-menu-item:active{background:#0000}.zmdms-menu .zmdms-menu--main>.ant-menu-item:hover{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-item:not(:last-child){margin-bottom:0}.zmdms-menu .zmdms-menu--main>.ant-menu-item.ant-menu-item-selected{background:#5b76f6;color:#fff;width:100%}.zmdms-menu .zmdms-menu--main>.ant-menu-item.ant-menu-item-selected:after{border-right:none}.zmdms-menu--sub{padding:0}.zmdms-menu--sub .ant-drawer-content{background:#0000;background-position:100%;background-repeat:no-repeat;background-size:cover;overflow:hidden}.zmdms-menu--sub .ant-drawer-content .ant-menu{background:#0000;color:#fff}.zmdms-menu--sub.ant-drawer-left>.ant-drawer-content-wrapper{left:-1px}.zmdms-menu--sub .ant-drawer-header{border-bottom:none;padding:0}.zmdms-menu--sub .ant-drawer-header .ant-drawer-header-title{color:#fff;height:48px;padding:0 10px}.zmdms-menu--sub .ant-drawer-header .ant-drawer-header-title .ant-drawer-title{color:#fff;font-size:14px}.zmdms-menu--sub.zmdms-menu--sub-margin .ant-drawer-body{margin-top:48px}.zmdms-menu--sub .ant-drawer-body{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:#5b76f566;font-size:13px;overflow-x:hidden;padding:0}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar{height:4px;width:6px}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar-track{background:#fff0;border-radius:4px}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar-thumb{background:#5b76f6;border-radius:4px}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar-thumb:hover{background:#5b76f6}.zmdms-menu--sub .ant-drawer-body .ant-menu-submenu.ant-menu-submenu-inline{border-bottom:1px solid #8d9eff47;padding-bottom:
|
|
1
|
+
.zmdms-container{background-color:#e9ecf3}.zmdms-container .zmdms-sider{background-color:#5b76f6;background-repeat:no-repeat;background-size:100% auto;background-size:cover;z-index:100}.zmdms-container .zmdms-content{background-color:#e9ecf3}.zmdms-container .zmdms-content--header{align-items:center;background:#fff;display:flex;height:48px;justify-content:space-between;line-height:48px;padding:0 0 0 10px}.zmdms-container .zmdms-content--header .ant-tabs{flex:1;margin-top:8px;width:calc(100% - 350px)}.zmdms-container .zmdms-content--header .ant-tabs .ant-tabs-tab a{color:#768696;display:inline-block;padding:0 5px 0 10px}.zmdms-container .zmdms-content--header .ant-tabs .ant-tabs-nav{margin-bottom:0}.zmdms-container .zmdms-content--content{height:calc(100vh - 48px);position:relative}.zmdms-container .zmdms-content--header-info{color:#000000a6;display:flex;height:48px;max-width:350px}.zmdms-container .zmdms-content--header-info .full-screen{cursor:pointer;text-align:center;width:36px}.zmdms-container .zmdms-content--header-info .user-operation{align-items:center;cursor:pointer;display:flex;padding:0 12px}.zmdms-container .zmdms-content--header-info .user-operation:hover{background-color:#f7f7f7}.zmdms-container .zmdms-content--header-info .user-operation>span:last-child{color:#000000a6;display:inline-block;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:70px}.zmdms-menu{display:flex;flex-direction:column;height:100vh}.zmdms-menu .zmdms-logo{align-items:center;display:block;display:flex;height:48px;padding:9px 0 5px}.zmdms-menu .zmdms-logo>img{display:block;margin:0 auto;width:102px}.zmdms-menu .zmdms-menu--main{background:#0000;border-right:none;flex:1;overflow-x:hidden;overflow-y:auto}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu,.zmdms-menu .zmdms-menu--main>.ant-menu-submenu.ant-menu-submenu-open>.ant-menu-submenu-title{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title{align-items:center;background-color:#5b76f5;color:#ffffffa6;display:flex;font-size:13px;height:36px;line-height:36px;margin:0;padding:0}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title .ant-menu-submenu-arrow{color:#ffffffa6;right:6px}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title .ant-menu-title-content{flex:none;width:88%}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title:hover,.zmdms-menu .zmdms-menu--main>.ant-menu-submenu>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub.ant-menu-inline{background:#0000}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item{align-items:center;color:#ffffffa6;display:flex;font-size:13px;height:36px;line-height:36px;margin:0}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item a{color:inherit}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item:active{background:#0000}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item:hover{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item:not(:last-child){margin-bottom:0}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item.ant-menu-item-selected{background:#5b76f5;color:#fff;width:100%}.zmdms-menu .zmdms-menu--main>.ant-menu-submenu .ant-menu-sub>.ant-menu-item.ant-menu-item-selected:after{border-right:none}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar{height:4px;width:6px}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar-track{background:#fff0;border-radius:4px}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar-thumb{background:#5b76f6;border-radius:4px}.zmdms-menu .zmdms-menu--main::-webkit-scrollbar-thumb:hover{background:#5b76f6}.zmdms-menu .zmdms-menu--main>.ant-menu-item{align-items:center;color:#ffffffa6;display:flex;font-size:13px;height:36px;line-height:36px;margin:0}.zmdms-menu .zmdms-menu--main>.ant-menu-item a{color:inherit}.zmdms-menu .zmdms-menu--main>.ant-menu-item:active{background:#0000}.zmdms-menu .zmdms-menu--main>.ant-menu-item:hover{color:#fff}.zmdms-menu .zmdms-menu--main>.ant-menu-item:not(:last-child){margin-bottom:0}.zmdms-menu .zmdms-menu--main>.ant-menu-item.ant-menu-item-selected{background:#5b76f6;color:#fff;width:100%}.zmdms-menu .zmdms-menu--main>.ant-menu-item.ant-menu-item-selected:after{border-right:none}.zmdms-menu--sub{padding:0}.zmdms-menu--sub .ant-drawer-content{background:#0000;background-position:100%;background-repeat:no-repeat;background-size:cover;overflow:hidden}.zmdms-menu--sub .ant-drawer-content .ant-menu{background:#0000;color:#fff}.zmdms-menu--sub.ant-drawer-left>.ant-drawer-content-wrapper{left:-1px}.zmdms-menu--sub .ant-drawer-header{border-bottom:none;padding:0}.zmdms-menu--sub .ant-drawer-header .ant-drawer-header-title{color:#fff;height:48px;padding:0 10px}.zmdms-menu--sub .ant-drawer-header .ant-drawer-header-title .ant-drawer-title{color:#fff;font-size:14px}.zmdms-menu--sub.zmdms-menu--sub-margin .ant-drawer-body{margin-top:48px}.zmdms-menu--sub .ant-drawer-body{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:#5b76f566;font-size:13px;overflow-x:hidden;padding:0}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar{height:4px;width:6px}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar-track{background:#fff0;border-radius:4px}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar-thumb{background:#5b76f6;border-radius:4px}.zmdms-menu--sub .ant-drawer-body::-webkit-scrollbar-thumb:hover{background:#5b76f6}.zmdms-menu--sub .ant-drawer-body .ant-menu-submenu.ant-menu-submenu-inline{border-bottom:1px solid #8d9eff47;padding-bottom:0}.zmdms-menu--sub .ant-drawer-body .ant-menu-sub.ant-menu-inline{background:#0000;padding:0 10px}.zmdms-menu--sub .ant-drawer-body .ant-menu-item,.zmdms-menu--sub .ant-drawer-body .ant-menu-sub.ant-menu-inline>.ant-menu-item{align-items:center;border-radius:4px;color:#fff;display:flex;font-size:13px;height:30px;line-height:30px;margin:0}.zmdms-menu--sub .ant-drawer-body .ant-menu-item:not(:last-child),.zmdms-menu--sub .ant-drawer-body .ant-menu-sub.ant-menu-inline>.ant-menu-item:not(:last-child){margin-bottom:0}.zmdms-menu--sub .ant-drawer-body .ant-menu-item a,.zmdms-menu--sub .ant-drawer-body .ant-menu-sub.ant-menu-inline>.ant-menu-item a{color:#fff}.zmdms-menu--sub .ant-drawer-body .ant-menu-item:active,.zmdms-menu--sub .ant-drawer-body .ant-menu-sub.ant-menu-inline>.ant-menu-item:active{background:#0000}.zmdms-menu--sub .ant-drawer-body .ant-menu-item:last-child,.zmdms-menu--sub .ant-drawer-body .ant-menu-sub.ant-menu-inline>.ant-menu-item:last-child{margin-bottom:10px}.zmdms-menu--sub .ant-drawer-body .ant-menu-inline>.ant-menu-submenu>.ant-menu-submenu-title,.zmdms-menu--sub .ant-drawer-body .ant-menu-submenu-title{color:#fff;font-size:13px;font-weight:700;height:30px;line-height:30px}.zmdms-menu--sub .ant-drawer-body .ant-menu-inline>.ant-menu-submenu>.ant-menu-submenu-title .ant-menu-submenu-arrow,.zmdms-menu--sub .ant-drawer-body .ant-menu-inline>.ant-menu-submenu>.ant-menu-submenu-title:hover,.zmdms-menu--sub .ant-drawer-body .ant-menu-inline>.ant-menu-submenu>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow,.zmdms-menu--sub .ant-drawer-body .ant-menu-submenu-title .ant-menu-submenu-arrow,.zmdms-menu--sub .ant-drawer-body .ant-menu-submenu-title:hover,.zmdms-menu--sub .ant-drawer-body .ant-menu-submenu-title:hover .ant-menu-submenu-arrow{color:#fff}.zmdms-menu--sub .ant-drawer-body .ant-menu-inline>.ant-menu-submenu>.ant-menu-submenu-title:active,.zmdms-menu--sub .ant-drawer-body .ant-menu-submenu-title:active{background:#0000}.zmdms-menu--sub .ant-drawer-body .ant-menu-item-selected{background-color:#5b76f5!important;color:#fff}.zmdms-menu--sub .ant-drawer-body .ant-menu-item-selected:after{border-right:none}.zmdms-menu--sub .ant-drawer-footer{align-items:center;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:#5b76f566;border-top:1px solid #5670ea;display:flex;height:40px;justify-content:center;line-height:40px;padding:3px 10px}.zmdms-menu--sub .ant-drawer-footer .zt-btn-link{color:#fff}
|
|
@@ -7,6 +7,7 @@ import { LayoutMenuContext } from '../LayoutSiderContext.js';
|
|
|
7
7
|
import IconFont from '../../icon/index.js';
|
|
8
8
|
import { Menu } from 'antd';
|
|
9
9
|
|
|
10
|
+
// 是否隐藏菜单 isHiddenMenu 1 是 2 否
|
|
10
11
|
var MainMenu = function (props) {
|
|
11
12
|
var onMouseEnter = props.onMouseEnter, addTab = props.addTab, getPrefixByAppId = props.getPrefixByAppId, subMenu = props.subMenu;
|
|
12
13
|
var _a = useContext(LayoutMenuContext), mainMenuSelectedKeys = _a.mainMenuSelectedKeys, setMainMenuSelectedKeys = _a.setMainMenuSelectedKeys, userMenus = _a.userMenus, apps = _a.apps, mergeSystemIds = _a.mergeSystemIds, postMergeSystemIds = _a.postMergeSystemIds, menuJoinRule = _a.menuJoinRule, renderItem = _a.renderItem;
|
|
@@ -73,7 +74,7 @@ var MainMenu = function (props) {
|
|
|
73
74
|
// 如果菜单列表只有一项的话 那么认为当前只有一个系统
|
|
74
75
|
// 不需要展示多个系统
|
|
75
76
|
if (userMenus.length === 1) {
|
|
76
|
-
return (((_a = userMenus[0]) === null || _a === void 0 ? void 0 : _a.children) || []).map(function (userMenu) {
|
|
77
|
+
return filterMenu(((_a = userMenus[0]) === null || _a === void 0 ? void 0 : _a.children) || []).map(function (userMenu) {
|
|
77
78
|
return {
|
|
78
79
|
label: getLabel(userMenu),
|
|
79
80
|
title: userMenu.name,
|
|
@@ -90,7 +91,7 @@ var MainMenu = function (props) {
|
|
|
90
91
|
key: userMenu.id,
|
|
91
92
|
icon: userMenu.source ? (jsx(IconFont, { type: userMenu.source, style: { fontSize: "18px" } })) : null,
|
|
92
93
|
children: children
|
|
93
|
-
? children.map(function (item) {
|
|
94
|
+
? filterMenu(children || []).map(function (item) {
|
|
94
95
|
return {
|
|
95
96
|
label: getLabel(item),
|
|
96
97
|
title: item.name,
|
|
@@ -110,6 +111,12 @@ var MainMenu = function (props) {
|
|
|
110
111
|
subMenu && ((_b = (_a = subMenu.current) === null || _a === void 0 ? void 0 : _a.onSubMenuOpenChange) === null || _b === void 0 ? void 0 : _b.call(_a, info.selectedKeys));
|
|
111
112
|
}, [setMainMenuSelectedKeys, subMenu]);
|
|
112
113
|
return (jsx(Menu, { className: "zmdms-menu--main", items: items, inlineIndent: 10, mode: "inline", onMouseEnter: onMouseEnter, selectedKeys: mainMenuSelectedKeys, onSelect: onSelectHandle, openKeys: mainMenuOpenKeys, onOpenChange: onMainMenuOpenChange }));
|
|
113
|
-
};
|
|
114
|
+
};
|
|
115
|
+
function filterMenu(menus) {
|
|
116
|
+
if (Array.isArray(menus)) {
|
|
117
|
+
return menus.filter(function (item) { return item.isHiddenMenu !== 1; });
|
|
118
|
+
}
|
|
119
|
+
return menus;
|
|
120
|
+
}
|
|
114
121
|
|
|
115
|
-
export { MainMenu as default };
|
|
122
|
+
export { MainMenu as default, filterMenu };
|
|
@@ -5,6 +5,7 @@ import { Link } from 'react-router-dom';
|
|
|
5
5
|
import { useSubMenuOpenKeys } from './hook.js';
|
|
6
6
|
import { LayoutMenuContext } from '../LayoutSiderContext.js';
|
|
7
7
|
import classNames from '../../node_modules/classnames/index.js';
|
|
8
|
+
import { filterMenu } from './MainMenu.js';
|
|
8
9
|
import ButtonCom from '../../button/button.js';
|
|
9
10
|
import SwapOutlined from '../../node_modules/@ant-design/icons/es/icons/SwapOutlined.js';
|
|
10
11
|
import { Drawer, Menu } from 'antd';
|
|
@@ -73,7 +74,7 @@ var SubMenu = function (props, ref) {
|
|
|
73
74
|
}
|
|
74
75
|
deep++;
|
|
75
76
|
if (Array.isArray(arr)) {
|
|
76
|
-
arr.forEach(function (menuItem) {
|
|
77
|
+
filterMenu(arr).forEach(function (menuItem) {
|
|
77
78
|
// 获取当前菜单的系统id
|
|
78
79
|
var system = menuItem.system, path = menuItem.path;
|
|
79
80
|
var prefix = getPrefixByAppId(system);
|
|
@@ -28,11 +28,37 @@ function recursionDynamicItems(list, currentDynamicList) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
+
// 这里如果有子元素,可以理解成,整个列都是业务新增的,需要默认标识找到
|
|
32
|
+
var resultChildren = null;
|
|
33
|
+
if (Array.isArray(result.children) && result.children.length > 0) {
|
|
34
|
+
resultChildren = recursionAddFind(result.children);
|
|
35
|
+
}
|
|
36
|
+
if (resultChildren) {
|
|
37
|
+
result.children = resultChildren;
|
|
38
|
+
}
|
|
31
39
|
// 没有从之前的字段中被找到的话,说明是业务新增的 需要添加上
|
|
32
40
|
// 这里存在一个问题:可能缓存中有的值已经被业务方删除了,那么需要删除掉从找到的值
|
|
33
41
|
// 这里不是从末尾添加。应该是按顺序添加
|
|
34
42
|
if (index <= currentDynamicList.length - 1) {
|
|
35
43
|
currentDynamicList.splice(index, 0, __assign(__assign({}, result), { isFind: true }));
|
|
44
|
+
// 这个行为改变了 list原本的排序结构。
|
|
45
|
+
// 需要往后的数据都重新处理下才行。将索引指向正确的位置
|
|
46
|
+
// 这个只对表格处理,因为表格需要indexs来标识子集的位置
|
|
47
|
+
if (result.indexs) {
|
|
48
|
+
var recursionIndexs_1 = function (dynamicList, indexs, parentIndex) {
|
|
49
|
+
if (Array.isArray(dynamicList)) {
|
|
50
|
+
dynamicList.forEach(function (item, index) {
|
|
51
|
+
var newIndexs = indexs ? indexs.slice() : [];
|
|
52
|
+
newIndexs.push(parentIndex ? parentIndex + index : index);
|
|
53
|
+
item.indexs = newIndexs;
|
|
54
|
+
if (Array.isArray(item.children)) {
|
|
55
|
+
recursionIndexs_1(item.children, indexs);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
recursionIndexs_1(currentDynamicList.slice(index + 1), [], index + 1);
|
|
61
|
+
}
|
|
36
62
|
}
|
|
37
63
|
else {
|
|
38
64
|
currentDynamicList.push(__assign(__assign({}, result), { isFind: true }));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { Popover } from 'antd';
|
|
5
|
+
import QuestionCircleOutlined from '../../node_modules/@ant-design/icons/es/icons/QuestionCircleOutlined.js';
|
|
6
|
+
|
|
7
|
+
var PopoverIcon = function (_a) {
|
|
8
|
+
var text = _a.text;
|
|
9
|
+
return (jsx(Popover, __assign({ content: jsx(PopoverIconWrap, { text: text }), trigger: "hover" }, { children: jsx(QuestionCircleOutlined, { style: { marginLeft: 4, color: "#9f9f9f" } }) })));
|
|
10
|
+
};
|
|
11
|
+
var PopoverIcon$1 = memo(PopoverIcon);
|
|
12
|
+
var defaultStyle = {
|
|
13
|
+
width: 200,
|
|
14
|
+
color: "#333333",
|
|
15
|
+
wordWrap: "break-word",
|
|
16
|
+
textAlign: "center",
|
|
17
|
+
};
|
|
18
|
+
function PopoverIconWrap(props) {
|
|
19
|
+
var text = props.text, _a = props.color, color = _a === void 0 ? defaultStyle.color : _a, _b = props.width, width = _b === void 0 ? defaultStyle.width : _b;
|
|
20
|
+
if ((text || "").length < 10) {
|
|
21
|
+
width = 100;
|
|
22
|
+
}
|
|
23
|
+
return jsx("div", __assign({ style: __assign(__assign({}, defaultStyle), { color: color, width: width }) }, { children: text || "" }));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { PopoverIcon$1 as default };
|
|
@@ -2,6 +2,7 @@ import { __assign } from '../../_virtual/_tslib.js';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
5
|
+
// 上下结构的表头数据
|
|
5
6
|
var TitleDirectionColumn = function (_a) {
|
|
6
7
|
var title = _a.title, children = _a.children, className = _a.className, style = _a.style;
|
|
7
8
|
return (jsxs("div", __assign({ className: className, style: __assign({ display: "flex", flexDirection: "column", flexGrow: 1 }, style) }, { children: [title, jsx("div", { children: children })] })));
|
|
@@ -114,6 +114,10 @@ interface IColumnType<RecordType> extends ColumnType<RecordType> {
|
|
|
114
114
|
* 当你传入的title是一个 组件时。组件再做动态列配置的时候,需要一个字符串的值,来充当动态列配置的title。这里可以传入一个字符串的值进来
|
|
115
115
|
*/
|
|
116
116
|
dynamicTitle?: string;
|
|
117
|
+
/**
|
|
118
|
+
* 气泡提示框
|
|
119
|
+
*/
|
|
120
|
+
popoverText?: string;
|
|
117
121
|
}
|
|
118
122
|
interface IColumnGroupType<RecordType> extends Omit<IColumnType<RecordType>, "dataIndex"> {
|
|
119
123
|
children: IColumnsType<RecordType>;
|
|
@@ -134,7 +138,7 @@ interface ITableRefHandel {
|
|
|
134
138
|
/**
|
|
135
139
|
* 触发表格验证
|
|
136
140
|
*/
|
|
137
|
-
tableValidate?: () => Promise<any>;
|
|
141
|
+
tableValidate?: (validateKeys?: string[]) => Promise<any>;
|
|
138
142
|
/**
|
|
139
143
|
* 移除错误样式
|
|
140
144
|
*/
|
package/dist/es/table/table.js
CHANGED
|
@@ -10,6 +10,7 @@ import './components/ColumnDynamic.js';
|
|
|
10
10
|
import './components/ColumnAddDel.js';
|
|
11
11
|
import './components/TitleOperation.js';
|
|
12
12
|
import { TABLE_DYNAMIC_KEY, INNER_TABLE_PAGINATION_POSITION, INNER_TABLE_PAGINATION_PAGESIZEOPTIONS } from './constant.js';
|
|
13
|
+
import './components/PopoverIcon.js';
|
|
13
14
|
import { useColumns } from './useColumns.js';
|
|
14
15
|
import { useDynamicListByColumns } from './useDynamicListByColumns.js';
|
|
15
16
|
import useSummary from './useSummary.js';
|
|
@@ -31,6 +32,7 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
|
|
|
31
32
|
// completed: 实现可编辑功能
|
|
32
33
|
// completed: 实现虚拟滚动配置
|
|
33
34
|
// completed: 实现表头自定义伸缩
|
|
35
|
+
// TODO: 排序功能优化
|
|
34
36
|
var Table = function (props) {
|
|
35
37
|
// console.log("表格渲染");
|
|
36
38
|
var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, hiddenDynamicIcon = props.hiddenDynamicIcon, columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, _c = props.isDelAll, isDelAll = _c === void 0 ? true : _c, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _d = props.summaryFixed, summaryFixed = _d === void 0 ? true : _d, isInnerPagination = props.isInnerPagination, _e = props.innerPaginationPageSize, innerPaginationPageSize = _e === void 0 ? 30 : _e, _f = props.innerPaginationPosition, innerPaginationPosition = _f === void 0 ? INNER_TABLE_PAGINATION_POSITION : _f, _g = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _g === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _g, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _h = props.isResizableColumn, isResizableColumn = _h === void 0 ? true : _h, _j = props.isRealTimeValidate, isRealTimeValidate = _j === void 0 ? true : _j, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "addMode", "addCallback", "isDel", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isRealTimeValidate"]);
|
|
@@ -193,7 +195,7 @@ var Table = function (props) {
|
|
|
193
195
|
return currentDynamicList;
|
|
194
196
|
},
|
|
195
197
|
/** 表格的验证方法 */
|
|
196
|
-
tableValidate: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
198
|
+
tableValidate: function (validateKeys) { return __awaiter(void 0, void 0, void 0, function () {
|
|
197
199
|
return __generator(this, function (_a) {
|
|
198
200
|
switch (_a.label) {
|
|
199
201
|
case 0:
|
|
@@ -206,6 +208,7 @@ var Table = function (props) {
|
|
|
206
208
|
isInnerPagination: isInnerPagination,
|
|
207
209
|
setCurrent: setCurrent,
|
|
208
210
|
pageSize: pageSize,
|
|
211
|
+
validateKeys: validateKeys,
|
|
209
212
|
})];
|
|
210
213
|
case 1: return [2 /*return*/, _a.sent()];
|
|
211
214
|
}
|
|
@@ -9,6 +9,7 @@ import ColumnDynamic from './components/ColumnDynamic.js';
|
|
|
9
9
|
import ColumnAddDel, { ColumnDelAll } from './components/ColumnAddDel.js';
|
|
10
10
|
import TitleOperation from './components/TitleOperation.js';
|
|
11
11
|
import SortTitle from './components/SortTitle.js';
|
|
12
|
+
import PopoverIcon from './components/PopoverIcon.js';
|
|
12
13
|
import { PLACEHOLDER_NULL } from '../config/constant.js';
|
|
13
14
|
|
|
14
15
|
// 处理columns
|
|
@@ -20,13 +21,19 @@ function useColumns(columns, options) {
|
|
|
20
21
|
// 循环遍历 neColumns 根据一些内容进行处理
|
|
21
22
|
var myNewColumns = [];
|
|
22
23
|
var enhanceColumnHandle = function (_column, options) {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
var isCopy = _column.isCopy, editable = _column.editable, editableConfig = _column.editableConfig, title = _column.title, key = _column.key, validate = _column.validate, isRequire = _column.isRequire, isFillDown = _column.isFillDown, isOrder = _column.isOrder, isStress = _column.isStress;
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
var isCopy = _column.isCopy, editable = _column.editable, editableConfig = _column.editableConfig, title = _column.title, key = _column.key, validate = _column.validate, isRequire = _column.isRequire, isFillDown = _column.isFillDown, isOrder = _column.isOrder, isStress = _column.isStress, popoverText = _column.popoverText;
|
|
25
26
|
var _key = key ? key : _column === null || _column === void 0 ? void 0 : _column.dataIndex;
|
|
26
|
-
var
|
|
27
|
+
var _d = (options || {}).keyIndex, keyIndex = _d === void 0 ? [] : _d;
|
|
28
|
+
// 添加气泡提示
|
|
29
|
+
if (popoverText) {
|
|
30
|
+
_column.title = (jsxs(Fragment, { children: [typeof _column.title === "function"
|
|
31
|
+
? (_a = _column.title) === null || _a === void 0 ? void 0 : _a.call(_column, {})
|
|
32
|
+
: _column.title, jsx(PopoverIcon, { text: popoverText })] }));
|
|
33
|
+
}
|
|
27
34
|
// 添加自定义排序
|
|
28
35
|
if (isOrder) {
|
|
29
|
-
_column.title = (jsx(SortTitle, { title: title, field: _key, onChange: customSortHandle, customOrder: order, setCustomOrder: setOrder, align: _column.align, isStress: isStress }));
|
|
36
|
+
_column.title = (jsx(SortTitle, { title: _column.title, field: _key, onChange: customSortHandle, customOrder: order, setCustomOrder: setOrder, align: _column.align, isStress: isStress }));
|
|
30
37
|
}
|
|
31
38
|
// 列头增加复制按钮
|
|
32
39
|
// 列头增加往下填充
|
|
@@ -37,13 +44,13 @@ function useColumns(columns, options) {
|
|
|
37
44
|
justifyContent: "space-between",
|
|
38
45
|
flex: "1",
|
|
39
46
|
} }, { children: [jsx("div", __assign({ style: { flexGrow: 1, textAlign: _column.align }, className: isStress ? "ztxk-table--title-stress" : undefined }, { children: typeof _column.title === "function"
|
|
40
|
-
? (
|
|
47
|
+
? (_b = _column.title) === null || _b === void 0 ? void 0 : _b.call(_column, {})
|
|
41
48
|
: _column.title })), jsx(TitleOperation, { copyKey: isCopy === true ? _key : isCopy, dataSourceRef: dataSourceRef, isFillDown: isFillDown, dataKey: _key, onTableChange: onTableChange })] })));
|
|
42
49
|
}
|
|
43
50
|
// 列头增加必填标识
|
|
44
51
|
if (isRequire || isStress) {
|
|
45
52
|
_column.title = (jsxs("div", __assign({ style: { display: "flex", alignItems: "center" } }, { children: [isRequire ? jsx("i", __assign({ className: "ztxk-column--required" }, { children: "*" })) : null, jsx("div", __assign({ style: { flexGrow: 1 }, className: isStress ? "ztxk-table--title-stress" : undefined }, { children: typeof _column.title === "function"
|
|
46
|
-
? (
|
|
53
|
+
? (_c = _column.title) === null || _c === void 0 ? void 0 : _c.call(_column, {})
|
|
47
54
|
: _column.title }))] })));
|
|
48
55
|
}
|
|
49
56
|
// 如果列添加可编辑配置
|
|
@@ -17,6 +17,7 @@ function useSummary(summaryConfig, columns, options) {
|
|
|
17
17
|
fillNumber: fillNumber,
|
|
18
18
|
columns: columns,
|
|
19
19
|
});
|
|
20
|
+
console.log(columns, summaryData);
|
|
20
21
|
return (jsx(Table.Summary, __assign({ fixed: summaryFixed }, { children: summaryData.map(function (summary) {
|
|
21
22
|
var title = summary.title, key = summary.key, titleIndex = summary.titleIndex, list = summary.list;
|
|
22
23
|
return (jsx(Table.Summary.Row, { children: Array.isArray(list) &&
|
|
@@ -33,6 +34,25 @@ function useSummary(summaryConfig, columns, options) {
|
|
|
33
34
|
}, [summaryConfig, fillNumber, columns, summaryFixed, isAddOrDel]);
|
|
34
35
|
return summaryConfig ? summaryHandle : undefined;
|
|
35
36
|
}
|
|
37
|
+
function recursionColumns(columns, options) {
|
|
38
|
+
var dataResult = options.dataResult, columnResult = options.columnResult, dataObj = options.dataObj;
|
|
39
|
+
columns === null || columns === void 0 ? void 0 : columns.forEach(function (col) {
|
|
40
|
+
if (Array.isArray(col.children)) {
|
|
41
|
+
recursionColumns(col.children, {
|
|
42
|
+
dataResult: dataResult,
|
|
43
|
+
columnResult: columnResult,
|
|
44
|
+
dataObj: dataObj,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
dataResult.push(col.key || col.dataIndex ? dataObj[col.key || col.dataIndex] : undefined);
|
|
49
|
+
columnResult.push({
|
|
50
|
+
key: col === null || col === void 0 ? void 0 : col.key,
|
|
51
|
+
dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
36
56
|
function getSummaryData(summaryConfig, dataSource, options) {
|
|
37
57
|
var _summaryData = [];
|
|
38
58
|
var fillNumber = options.fillNumber, columns = options.columns;
|
|
@@ -49,37 +69,45 @@ function getSummaryData(summaryConfig, dataSource, options) {
|
|
|
49
69
|
return;
|
|
50
70
|
}
|
|
51
71
|
// 拿到统计数据
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
columns
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
? subtotalObj_1[col.key || col.dataIndex]
|
|
60
|
-
: undefined);
|
|
61
|
-
columnResult_1.push({
|
|
62
|
-
key: col === null || col === void 0 ? void 0 : col.key,
|
|
63
|
-
dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
subtotalResult_1.push(col.key || col.dataIndex
|
|
69
|
-
? subtotalObj_1[col.key || col.dataIndex]
|
|
70
|
-
: undefined);
|
|
71
|
-
columnResult_1.push({
|
|
72
|
-
key: col === null || col === void 0 ? void 0 : col.key,
|
|
73
|
-
dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
72
|
+
var subtotalObj = getSubtotalObj(fields, dataSource);
|
|
73
|
+
var subtotalResult = [];
|
|
74
|
+
var columnResult = [];
|
|
75
|
+
recursionColumns(columns, {
|
|
76
|
+
dataResult: subtotalResult,
|
|
77
|
+
columnResult: columnResult,
|
|
78
|
+
dataObj: subtotalObj,
|
|
76
79
|
});
|
|
80
|
+
// columns?.forEach((col: any) => {
|
|
81
|
+
// if (col.children) {
|
|
82
|
+
// col.children.forEach((col: any) => {
|
|
83
|
+
// subtotalResult.push(
|
|
84
|
+
// col.key || col.dataIndex
|
|
85
|
+
// ? subtotalObj[col.key || col.dataIndex]
|
|
86
|
+
// : undefined
|
|
87
|
+
// );
|
|
88
|
+
// columnResult.push({
|
|
89
|
+
// key: col?.key,
|
|
90
|
+
// dataIndex: col?.dataIndex,
|
|
91
|
+
// });
|
|
92
|
+
// });
|
|
93
|
+
// } else {
|
|
94
|
+
// subtotalResult.push(
|
|
95
|
+
// col.key || col.dataIndex
|
|
96
|
+
// ? subtotalObj[col.key || col.dataIndex]
|
|
97
|
+
// : undefined
|
|
98
|
+
// );
|
|
99
|
+
// columnResult.push({
|
|
100
|
+
// key: col?.key,
|
|
101
|
+
// dataIndex: col?.dataIndex,
|
|
102
|
+
// });
|
|
103
|
+
// }
|
|
104
|
+
// });
|
|
77
105
|
_summaryData.push({
|
|
78
106
|
title: title || "小计",
|
|
79
107
|
titleIndex: 0 + fillNumber,
|
|
80
108
|
key: "subtotal",
|
|
81
|
-
list: Array(fillNumber).fill(undefined).concat(
|
|
82
|
-
columnList: Array(fillNumber).fill(undefined).concat(
|
|
109
|
+
list: Array(fillNumber).fill(undefined).concat(subtotalResult),
|
|
110
|
+
columnList: Array(fillNumber).fill(undefined).concat(columnResult),
|
|
83
111
|
});
|
|
84
112
|
break;
|
|
85
113
|
case "total": // 总计
|
|
@@ -89,39 +117,47 @@ function getSummaryData(summaryConfig, dataSource, options) {
|
|
|
89
117
|
if (fields.length === 0) {
|
|
90
118
|
return;
|
|
91
119
|
}
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
columns
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
? totalObj_1[col.key || col.dataIndex]
|
|
100
|
-
: undefined);
|
|
101
|
-
totalColumnResult_1.push({
|
|
102
|
-
key: col === null || col === void 0 ? void 0 : col.key,
|
|
103
|
-
dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
totalResult_1.push(col.key || col.dataIndex
|
|
109
|
-
? totalObj_1[col.key || col.dataIndex]
|
|
110
|
-
: undefined);
|
|
111
|
-
totalColumnResult_1.push({
|
|
112
|
-
key: col === null || col === void 0 ? void 0 : col.key,
|
|
113
|
-
dataIndex: col === null || col === void 0 ? void 0 : col.dataIndex,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
120
|
+
var totalObj = getTotalObj(fields);
|
|
121
|
+
var totalResult = [];
|
|
122
|
+
var totalColumnResult = [];
|
|
123
|
+
recursionColumns(columns, {
|
|
124
|
+
dataResult: totalResult,
|
|
125
|
+
columnResult: totalColumnResult,
|
|
126
|
+
dataObj: totalObj,
|
|
116
127
|
});
|
|
128
|
+
// columns?.forEach((col: any) => {
|
|
129
|
+
// if (col.children) {
|
|
130
|
+
// col.children.forEach((col: any) => {
|
|
131
|
+
// totalResult.push(
|
|
132
|
+
// col.key || col.dataIndex
|
|
133
|
+
// ? totalObj[col.key || col.dataIndex]
|
|
134
|
+
// : undefined
|
|
135
|
+
// );
|
|
136
|
+
// totalColumnResult.push({
|
|
137
|
+
// key: col?.key,
|
|
138
|
+
// dataIndex: col?.dataIndex,
|
|
139
|
+
// });
|
|
140
|
+
// });
|
|
141
|
+
// } else {
|
|
142
|
+
// totalResult.push(
|
|
143
|
+
// col.key || col.dataIndex
|
|
144
|
+
// ? totalObj[col.key || col.dataIndex]
|
|
145
|
+
// : undefined
|
|
146
|
+
// );
|
|
147
|
+
// totalColumnResult.push({
|
|
148
|
+
// key: col?.key,
|
|
149
|
+
// dataIndex: col?.dataIndex,
|
|
150
|
+
// });
|
|
151
|
+
// }
|
|
152
|
+
// });
|
|
117
153
|
_summaryData.push({
|
|
118
154
|
title: title || "总计",
|
|
119
155
|
titleIndex: 0 + fillNumber,
|
|
120
156
|
key: "total",
|
|
121
|
-
list: Array(fillNumber).fill(undefined).concat(
|
|
157
|
+
list: Array(fillNumber).fill(undefined).concat(totalResult),
|
|
122
158
|
columnList: Array(fillNumber)
|
|
123
159
|
.fill(undefined)
|
|
124
|
-
.concat(
|
|
160
|
+
.concat(totalColumnResult),
|
|
125
161
|
});
|
|
126
162
|
break;
|
|
127
163
|
}
|
|
@@ -50,11 +50,13 @@ function domFind(el, selector) {
|
|
|
50
50
|
}
|
|
51
51
|
function tableValidate(dataSource, columns, restParams) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var getCurrentTable, rowSelection, expandable, tableName, isInnerPagination, setCurrent, pageSize,
|
|
53
|
+
var getCurrentTable, rowSelection, expandable, tableName, isInnerPagination, setCurrent, pageSize,
|
|
54
|
+
// 需要验证的字段,如果没传 那就所有字段都校验
|
|
55
|
+
validateKeys, requiredFileds, childrenLen, parseValidateFiledsHandle, i, item, _loop_1, j, state_1;
|
|
54
56
|
return __generator(this, function (_a) {
|
|
55
57
|
switch (_a.label) {
|
|
56
58
|
case 0:
|
|
57
|
-
getCurrentTable = restParams.getCurrentTable, rowSelection = restParams.rowSelection, expandable = restParams.expandable, tableName = restParams.tableName, isInnerPagination = restParams.isInnerPagination, setCurrent = restParams.setCurrent, pageSize = restParams.pageSize;
|
|
59
|
+
getCurrentTable = restParams.getCurrentTable, rowSelection = restParams.rowSelection, expandable = restParams.expandable, tableName = restParams.tableName, isInnerPagination = restParams.isInnerPagination, setCurrent = restParams.setCurrent, pageSize = restParams.pageSize, validateKeys = restParams.validateKeys;
|
|
58
60
|
if (!Array.isArray(dataSource) || dataSource.length === 0) {
|
|
59
61
|
console.info("没有数据,无需验证!");
|
|
60
62
|
return [2 /*return*/];
|
|
@@ -64,18 +66,37 @@ function tableValidate(dataSource, columns, restParams) {
|
|
|
64
66
|
return [2 /*return*/];
|
|
65
67
|
}
|
|
66
68
|
requiredFileds = [];
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
childrenLen = 0;
|
|
70
|
+
parseValidateFiledsHandle = function (columns) {
|
|
71
|
+
if (Array.isArray(columns)) {
|
|
72
|
+
columns.forEach(function (column, index) {
|
|
73
|
+
var _a;
|
|
74
|
+
// 如果有子元素,需要递归往下遍历
|
|
75
|
+
if (Array.isArray(column.children)) {
|
|
76
|
+
parseValidateFiledsHandle(column.children);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
var _key = ((_a = column === null || column === void 0 ? void 0 : column.validate) === null || _a === void 0 ? void 0 : _a.dataIndex)
|
|
80
|
+
? column.validate.dataIndex
|
|
81
|
+
: (column === null || column === void 0 ? void 0 : column.key)
|
|
82
|
+
? column === null || column === void 0 ? void 0 : column.key
|
|
83
|
+
: column === null || column === void 0 ? void 0 : column.dataIndex;
|
|
84
|
+
if (column.validate &&
|
|
85
|
+
((validateKeys && validateKeys.includes(_key)) || !validateKeys)) {
|
|
86
|
+
requiredFileds.push({
|
|
87
|
+
dataIndex: _key,
|
|
88
|
+
title: column.validate.title ||
|
|
89
|
+
column.__title ||
|
|
90
|
+
column.title,
|
|
91
|
+
validate: column.validate,
|
|
92
|
+
index: childrenLen + (rowSelection ? 1 : 0) + (expandable ? 1 : 0),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
childrenLen++;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
parseValidateFiledsHandle(columns);
|
|
79
100
|
i = 0;
|
|
80
101
|
_a.label = 1;
|
|
81
102
|
case 1:
|