wargerm 0.1.0
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/LICENSE +21 -0
- package/README.md +30 -0
- package/README.zh-CN.md +30 -0
- package/dist/components/Button/index.d.ts +12 -0
- package/dist/components/IconFont/index.d.ts +3 -0
- package/dist/components/Input/index.d.ts +6 -0
- package/dist/components/Table/index.d.ts +66 -0
- package/dist/hooks/useClickOutside.d.ts +3 -0
- package/dist/hooks/useDebounce.d.ts +2 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.js +479 -0
- package/dist/index.js +492 -0
- package/package.json +70 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 UmiJS
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
## 📒 目录介绍
|
2
|
+
|
3
|
+
```
|
4
|
+
├── docs 文档存放路径
|
5
|
+
│ ├── index.md 首页展示
|
6
|
+
│ └── **.** 网站目录文档
|
7
|
+
├── src 组件主目录
|
8
|
+
│ ├── index.ts 组件注册
|
9
|
+
│ └── Foo 组件开发
|
10
|
+
├── .eslintrc.js eslint 配置
|
11
|
+
├── .fatherrc.ts father 配置
|
12
|
+
├── .umirc.ts dumi 配置
|
13
|
+
└── tsconfig.json typescript 配置
|
14
|
+
```
|
15
|
+
|
16
|
+
其余文件可自行查阅了解。
|
17
|
+
|
18
|
+
## 🤖 命令介绍
|
19
|
+
|
20
|
+
| 名称 | 描述 | 备注 |
|
21
|
+
| ----------------------- | -------------- | -------------------------------------------------------------------- |
|
22
|
+
| `npm run start` | 项目启动 | 使用 [dumi](https://github.com/umijs/dumi),组件开发和文档开发在一起 |
|
23
|
+
| `npm run test` | 组件测试 | - |
|
24
|
+
| `npm run test:coverage` | 代码覆盖率查看 | - |
|
25
|
+
| `npm run prettier` | 代码美化 | - |
|
26
|
+
| `npm run build` | 组件打包 | 使用 [father](https://github.com/umijs/father) 工具 |
|
27
|
+
| `npm run release` | 组件打包发布 | - |
|
28
|
+
| `npm run docs:build` | 文档打包 | - |
|
29
|
+
| `npm run docs:deploy` | 文档发布 | 这里默认是使用了 GitHub Pages |
|
30
|
+
| `npm run deploy` | 文档打包发布 | - |
|
package/README.zh-CN.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
## 📒 目录介绍
|
2
|
+
|
3
|
+
```
|
4
|
+
├── docs 文档存放路径
|
5
|
+
│ ├── index.md 首页展示
|
6
|
+
│ └── **.** 网站目录文档
|
7
|
+
├── src 组件主目录
|
8
|
+
│ ├── index.ts 组件注册
|
9
|
+
│ └── Foo 组件开发
|
10
|
+
├── .eslintrc.js eslint 配置
|
11
|
+
├── .fatherrc.ts father 配置
|
12
|
+
├── .umirc.ts dumi 配置
|
13
|
+
└── tsconfig.json typescript 配置
|
14
|
+
```
|
15
|
+
|
16
|
+
其余文件可自行查阅了解。
|
17
|
+
|
18
|
+
## 🤖 命令介绍
|
19
|
+
|
20
|
+
| 名称 | 描述 | 备注 |
|
21
|
+
| ----------------------- | -------------- | -------------------------------------------------------------------- |
|
22
|
+
| `npm run start` | 项目启动 | 使用 [dumi](https://github.com/umijs/dumi),组件开发和文档开发在一起 |
|
23
|
+
| `npm run test` | 组件测试 | - |
|
24
|
+
| `npm run test:coverage` | 代码覆盖率查看 | - |
|
25
|
+
| `npm run prettier` | 代码美化 | - |
|
26
|
+
| `npm run build` | 组件打包 | 使用 [father](https://github.com/umijs/father) 工具 |
|
27
|
+
| `npm run release` | 组件打包发布 | - |
|
28
|
+
| `npm run docs:build` | 文档打包 | - |
|
29
|
+
| `npm run docs:deploy` | 文档发布 | 这里默认是使用了 GitHub Pages |
|
30
|
+
| `npm run deploy` | 文档打包发布 | - |
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
import { ButtonProps } from 'antd/lib/button';
|
3
|
+
interface IMultiple {
|
4
|
+
handleMenuClick?: (e: any) => void;
|
5
|
+
handleClick?: (e: any) => void;
|
6
|
+
children?: String[];
|
7
|
+
}
|
8
|
+
export interface IButtonProps extends ButtonProps {
|
9
|
+
multiple?: IMultiple;
|
10
|
+
}
|
11
|
+
declare const WButton: FC<IButtonProps>;
|
12
|
+
export default WButton;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ReactNode } from 'react';
|
3
|
+
interface ColumnProps {
|
4
|
+
title: string;
|
5
|
+
dataIndex: string;
|
6
|
+
key?: string | number;
|
7
|
+
width?: number;
|
8
|
+
ellipsis?: Boolean;
|
9
|
+
showTitle?: Boolean;
|
10
|
+
fixed?: 'left' | 'right';
|
11
|
+
render?: (text: string, record: Record<string, any>, index: number) => ReactNode;
|
12
|
+
}
|
13
|
+
interface IRowSelection {
|
14
|
+
type: 'checkbox' | 'radio';
|
15
|
+
selectedRowKeys?: Array<string | number>;
|
16
|
+
defaultSelectedRowKeys?: Array<string | number>;
|
17
|
+
/**
|
18
|
+
* 选中项发生变化时的回调
|
19
|
+
*/
|
20
|
+
onChange?: (selectedRowKeys: Array<string | number>, selectedRows: Array<Record<string, any>>) => void;
|
21
|
+
/**
|
22
|
+
* 用户手动选择/取消选择某行的回调
|
23
|
+
*/
|
24
|
+
onSelect?: (record: Record<string, any>, selected: boolean, selectedRows: Record<string, any>[], nativeEvent: MouseEvent) => void;
|
25
|
+
/**
|
26
|
+
* 用户手动选择/取消选择所有行的回调
|
27
|
+
*/
|
28
|
+
onSelectAll?: (selected: boolean, selectedRows: Record<string, any>[], changeRows: Record<string, any>[]) => void;
|
29
|
+
}
|
30
|
+
interface Iscroll {
|
31
|
+
/**
|
32
|
+
* 当分页、排序、筛选变化后是否滚动到表格顶部
|
33
|
+
*/
|
34
|
+
scrollToFirstRowOnChange?: boolean;
|
35
|
+
/**
|
36
|
+
* 设置横向滚动,也可用于指定滚动区域的宽,可以设置为像素值,百分比,true 和 'max-content'
|
37
|
+
*/
|
38
|
+
x?: string | number | true;
|
39
|
+
/**
|
40
|
+
* 设置纵向滚动,也可用于指定滚动区域的高,可以设置为像素值
|
41
|
+
*/
|
42
|
+
y?: string | number;
|
43
|
+
}
|
44
|
+
declare type Props = {
|
45
|
+
className?: string;
|
46
|
+
rowClassName?: (record: Record<string, any>, index: number) => string;
|
47
|
+
style?: React.CSSProperties;
|
48
|
+
tbodyStyle?: React.CSSProperties;
|
49
|
+
thStyle?: React.CSSProperties;
|
50
|
+
columns: ColumnProps[];
|
51
|
+
border?: Boolean;
|
52
|
+
dataSource: Record<string, any>[];
|
53
|
+
rowKey: ((record: Record<string, any>) => number | string) | string;
|
54
|
+
onRow?: (record: Record<string, any>, index: any) => Record<string, any>;
|
55
|
+
rowSelection?: IRowSelection;
|
56
|
+
scroll?: Iscroll;
|
57
|
+
pagination?: boolean | Record<string, any>;
|
58
|
+
children?: ReactNode;
|
59
|
+
};
|
60
|
+
declare function Table({ columns, dataSource, rowKey, onRow, className, rowClassName, rowSelection, style, tbodyStyle, thStyle, border, scroll, pagination, ...props }: Props): JSX.Element;
|
61
|
+
declare namespace Table {
|
62
|
+
var defaultProps: {
|
63
|
+
rowKey: string;
|
64
|
+
};
|
65
|
+
}
|
66
|
+
export default Table;
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,479 @@
|
|
1
|
+
import React, { useState } from 'react';
|
2
|
+
import { Menu, Dropdown, Button, Input, Checkbox, Radio, Tooltip, Pagination } from 'antd';
|
3
|
+
import { createFromIconfontCN } from '@ant-design/icons';
|
4
|
+
import classnames from 'classnames';
|
5
|
+
import uniqBy from 'lodash/uniqBy';
|
6
|
+
|
7
|
+
function styleInject(css, ref) {
|
8
|
+
if ( ref === void 0 ) ref = {};
|
9
|
+
var insertAt = ref.insertAt;
|
10
|
+
|
11
|
+
if (!css || typeof document === 'undefined') { return; }
|
12
|
+
|
13
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
14
|
+
var style = document.createElement('style');
|
15
|
+
style.type = 'text/css';
|
16
|
+
|
17
|
+
if (insertAt === 'top') {
|
18
|
+
if (head.firstChild) {
|
19
|
+
head.insertBefore(style, head.firstChild);
|
20
|
+
} else {
|
21
|
+
head.appendChild(style);
|
22
|
+
}
|
23
|
+
} else {
|
24
|
+
head.appendChild(style);
|
25
|
+
}
|
26
|
+
|
27
|
+
if (style.styleSheet) {
|
28
|
+
style.styleSheet.cssText = css;
|
29
|
+
} else {
|
30
|
+
style.appendChild(document.createTextNode(css));
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
var css_248z = "/* Color\n----------------------- */\n/* Border\n----------------------- */\n::-webkit-scrollbar {\n width: 6px;\n}\n::-webkit-scrollbar-track {\n background: hsla(0, 0%, 100%, 0.1);\n -webkit-box-shadow: inset006pxrgba(255, 0, 0, 0.3);\n}\n::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.5);\n}\n::-webkit-scrollbar-thumb:window-inactive {\n background: rgba(0, 0, 0, 0.2);\n}\n[data-prefers-color='dark'] .__dumi-default-previewer {\n background: linear-gradient(#1c274f 0%, #2f4262 100%);\n}\n[data-prefers-color='light'] .__dumi-default-previewer {\n background: linear-gradient(#9fb5c6 0%, #ccdfee 100%);\n}\n[data-prefers-color='dark'] .ant-btn {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n border: 1px solid #41a9d4;\n width: 95px;\n height: 30px;\n font-size: 14px;\n font-family: Adobe Heiti Std R, Adobe Heiti Std R-R;\n font-weight: R;\n text-align: left;\n color: #3665ea;\n letter-spacing: 1px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='dark'] .ant-btn-primary {\n color: #fff;\n background: rgba(6, 15, 41, 0.7);\n border: 1px solid #41a9d4;\n}\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary {\n background: rgba(229, 145, 145, 0.7);\n color: #fff;\n border: none;\n}\n[data-prefers-color='dark'] .ant-btn-link {\n background: none;\n border: none;\n}\n[data-prefers-color='dark'] .ant-btn[disabled],\n[data-prefers-color='dark'] .ant-btn[disabled]:hover,\n[data-prefers-color='dark'] .ant-btn[disabled]:focus,\n[data-prefers-color='dark'] .ant-btn[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled],\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled]:hover,\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled]:focus,\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='dark'] .ant-btn-link[disabled],\n[data-prefers-color='dark'] .ant-btn-link[disabled]:hover,\n[data-prefers-color='dark'] .ant-btn-link[disabled]:focus,\n[data-prefers-color='dark'] .ant-btn-link[disabled]:active {\n background: none;\n border: none;\n}\n[data-prefers-color='dark'] .ant-dropdown-trigger {\n width: 30px;\n height: 30px;\n}\n[data-prefers-color='dark'] .ant-dropdown-menu {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n}\n[data-prefers-color='dark'] .ant-dropdown-menu .ant-dropdown-menu-item {\n color: #3665ea;\n}\n[data-prefers-color='dark'] .ant-dropdown-menu-item:hover,\n[data-prefers-color='dark'] .ant-dropdown-menu-submenu-title:hover {\n background: rgba(40, 130, 254, 0.7);\n color: #fff;\n}\n[data-prefers-color='light'] .ant-btn {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n border: 1px solid #41a9d4;\n width: 95px;\n height: 30px;\n font-size: 14px;\n font-family: Adobe Heiti Std R, Adobe Heiti Std R-R;\n font-weight: R;\n text-align: left;\n color: #3665ea;\n letter-spacing: 1px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='light'] .ant-btn-primary {\n background: rgba(40, 130, 254, 0.7);\n border: 1px solid #41a9d4;\n color: #fff;\n}\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary {\n background: rgba(229, 145, 145, 0.7);\n color: #fff;\n border: none;\n}\n[data-prefers-color='light'] .ant-btn-link {\n background: none;\n border: none;\n}\n[data-prefers-color='light'] .ant-btn[disabled],\n[data-prefers-color='light'] .ant-btn[disabled]:hover,\n[data-prefers-color='light'] .ant-btn[disabled]:focus,\n[data-prefers-color='light'] .ant-btn[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled],\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled]:hover,\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled]:focus,\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='light'] .ant-btn-link[disabled],\n[data-prefers-color='light'] .ant-btn-link[disabled]:hover,\n[data-prefers-color='light'] .ant-btn-link[disabled]:focus,\n[data-prefers-color='light'] .ant-btn-link[disabled]:active {\n background: none;\n border: none;\n}\n[data-prefers-color='light'] .ant-dropdown-trigger {\n width: 30px;\n height: 30px;\n}\n[data-prefers-color='light'] .ant-dropdown-menu {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n}\n[data-prefers-color='light'] .ant-dropdown-menu .ant-dropdown-menu-item {\n color: #3665ea;\n}\n[data-prefers-color='light'] .ant-dropdown-menu-item:hover,\n[data-prefers-color='light'] .ant-dropdown-menu-submenu-title:hover {\n background: rgba(40, 130, 254, 0.7);\n color: #fff;\n}\n[data-prefers-color='dark'] input {\n padding: 0;\n outline: none;\n border: none;\n}\n[data-prefers-color='dark'] input.ant-input {\n background-color: transparent;\n height: 28px;\n border: 1px solid #4383a4;\n color: #fff;\n padding-left: 10px;\n}\n[data-prefers-color='dark'] input.ant-input:focus,\n[data-prefers-color='dark'] input.ant-input-focused {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='dark'] input.ant-input:hover {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='light'] input {\n padding: 0;\n outline: none;\n border: none;\n}\n[data-prefers-color='light'] input.ant-input {\n background-color: transparent;\n height: 28px;\n border: 1px solid #4383a4;\n color: #fff;\n padding-left: 10px;\n}\n[data-prefers-color='light'] input.ant-input:focus,\n[data-prefers-color='light'] input.ant-input-focused {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='light'] input.ant-input:hover {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='dark'] .container {\n position: relative;\n}\n[data-prefers-color='dark'] .container .theader .th {\n height: 32px;\n padding-left: 6px;\n display: flex;\n background-color: #212f51;\n}\n[data-prefers-color='dark'] .container .theader .th .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='dark'] .container .tbody {\n overflow: auto;\n padding-top: 5px;\n margin-top: 19px;\n}\n[data-prefers-color='dark'] .container .tbody .tr {\n padding-left: 6px;\n width: 100%;\n height: 32px;\n display: flex;\n background-color: #263759;\n margin-bottom: 17px;\n}\n[data-prefers-color='dark'] .container .tbody .tr .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='dark'] .ant-pagination-jump-prev .ant-pagination-item-container .ant-pagination-item-ellipsis,\n[data-prefers-color='dark'] .ant-pagination-jump-next .ant-pagination-item-container .ant-pagination-item-ellipsis {\n color: #9cd0ef;\n}\n[data-prefers-color='dark'] .ant-pagination-item-active {\n background: transparent;\n}\n[data-prefers-color='light'] .container {\n position: relative;\n}\n[data-prefers-color='light'] .container .theader .th {\n height: 32px;\n padding-left: 6px;\n display: flex;\n background-color: #212f51;\n}\n[data-prefers-color='light'] .container .theader .th .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='light'] .container .tbody {\n overflow: auto;\n padding-top: 5px;\n margin-top: 19px;\n}\n[data-prefers-color='light'] .container .tbody .tr {\n padding-left: 6px;\n width: 100%;\n height: 32px;\n display: flex;\n background-color: #263759;\n margin-bottom: 17px;\n}\n[data-prefers-color='light'] .container .tbody .tr .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='light'] .ant-pagination-jump-prev .ant-pagination-item-container .ant-pagination-item-ellipsis,\n[data-prefers-color='light'] .ant-pagination-jump-next .ant-pagination-item-container .ant-pagination-item-ellipsis {\n color: #9cd0ef;\n}\n[data-prefers-color='light'] .ant-pagination-item-active {\n background: transparent;\n}\n";
|
35
|
+
styleInject(css_248z);
|
36
|
+
|
37
|
+
function ownKeys(object, enumerableOnly) {
|
38
|
+
var keys = Object.keys(object);
|
39
|
+
|
40
|
+
if (Object.getOwnPropertySymbols) {
|
41
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
42
|
+
|
43
|
+
if (enumerableOnly) {
|
44
|
+
symbols = symbols.filter(function (sym) {
|
45
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
keys.push.apply(keys, symbols);
|
50
|
+
}
|
51
|
+
|
52
|
+
return keys;
|
53
|
+
}
|
54
|
+
|
55
|
+
function _objectSpread2(target) {
|
56
|
+
for (var i = 1; i < arguments.length; i++) {
|
57
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
58
|
+
|
59
|
+
if (i % 2) {
|
60
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
61
|
+
_defineProperty(target, key, source[key]);
|
62
|
+
});
|
63
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
64
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
65
|
+
} else {
|
66
|
+
ownKeys(Object(source)).forEach(function (key) {
|
67
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
return target;
|
73
|
+
}
|
74
|
+
|
75
|
+
function _typeof(obj) {
|
76
|
+
"@babel/helpers - typeof";
|
77
|
+
|
78
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
79
|
+
_typeof = function (obj) {
|
80
|
+
return typeof obj;
|
81
|
+
};
|
82
|
+
} else {
|
83
|
+
_typeof = function (obj) {
|
84
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
85
|
+
};
|
86
|
+
}
|
87
|
+
|
88
|
+
return _typeof(obj);
|
89
|
+
}
|
90
|
+
|
91
|
+
function _defineProperty(obj, key, value) {
|
92
|
+
if (key in obj) {
|
93
|
+
Object.defineProperty(obj, key, {
|
94
|
+
value: value,
|
95
|
+
enumerable: true,
|
96
|
+
configurable: true,
|
97
|
+
writable: true
|
98
|
+
});
|
99
|
+
} else {
|
100
|
+
obj[key] = value;
|
101
|
+
}
|
102
|
+
|
103
|
+
return obj;
|
104
|
+
}
|
105
|
+
|
106
|
+
function _extends() {
|
107
|
+
_extends = Object.assign || function (target) {
|
108
|
+
for (var i = 1; i < arguments.length; i++) {
|
109
|
+
var source = arguments[i];
|
110
|
+
|
111
|
+
for (var key in source) {
|
112
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
113
|
+
target[key] = source[key];
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
return target;
|
119
|
+
};
|
120
|
+
|
121
|
+
return _extends.apply(this, arguments);
|
122
|
+
}
|
123
|
+
|
124
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
125
|
+
if (source == null) return {};
|
126
|
+
var target = {};
|
127
|
+
var sourceKeys = Object.keys(source);
|
128
|
+
var key, i;
|
129
|
+
|
130
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
131
|
+
key = sourceKeys[i];
|
132
|
+
if (excluded.indexOf(key) >= 0) continue;
|
133
|
+
target[key] = source[key];
|
134
|
+
}
|
135
|
+
|
136
|
+
return target;
|
137
|
+
}
|
138
|
+
|
139
|
+
function _objectWithoutProperties(source, excluded) {
|
140
|
+
if (source == null) return {};
|
141
|
+
|
142
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
143
|
+
|
144
|
+
var key, i;
|
145
|
+
|
146
|
+
if (Object.getOwnPropertySymbols) {
|
147
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
148
|
+
|
149
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
150
|
+
key = sourceSymbolKeys[i];
|
151
|
+
if (excluded.indexOf(key) >= 0) continue;
|
152
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
153
|
+
target[key] = source[key];
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
return target;
|
158
|
+
}
|
159
|
+
|
160
|
+
function _slicedToArray(arr, i) {
|
161
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
162
|
+
}
|
163
|
+
|
164
|
+
function _toConsumableArray(arr) {
|
165
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
166
|
+
}
|
167
|
+
|
168
|
+
function _arrayWithoutHoles(arr) {
|
169
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
170
|
+
}
|
171
|
+
|
172
|
+
function _arrayWithHoles(arr) {
|
173
|
+
if (Array.isArray(arr)) return arr;
|
174
|
+
}
|
175
|
+
|
176
|
+
function _iterableToArray(iter) {
|
177
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
178
|
+
}
|
179
|
+
|
180
|
+
function _iterableToArrayLimit(arr, i) {
|
181
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
182
|
+
|
183
|
+
if (_i == null) return;
|
184
|
+
var _arr = [];
|
185
|
+
var _n = true;
|
186
|
+
var _d = false;
|
187
|
+
|
188
|
+
var _s, _e;
|
189
|
+
|
190
|
+
try {
|
191
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
192
|
+
_arr.push(_s.value);
|
193
|
+
|
194
|
+
if (i && _arr.length === i) break;
|
195
|
+
}
|
196
|
+
} catch (err) {
|
197
|
+
_d = true;
|
198
|
+
_e = err;
|
199
|
+
} finally {
|
200
|
+
try {
|
201
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
202
|
+
} finally {
|
203
|
+
if (_d) throw _e;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
return _arr;
|
208
|
+
}
|
209
|
+
|
210
|
+
function _unsupportedIterableToArray(o, minLen) {
|
211
|
+
if (!o) return;
|
212
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
213
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
214
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
215
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
216
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
217
|
+
}
|
218
|
+
|
219
|
+
function _arrayLikeToArray(arr, len) {
|
220
|
+
if (len == null || len > arr.length) len = arr.length;
|
221
|
+
|
222
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
223
|
+
|
224
|
+
return arr2;
|
225
|
+
}
|
226
|
+
|
227
|
+
function _nonIterableSpread() {
|
228
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
229
|
+
}
|
230
|
+
|
231
|
+
function _nonIterableRest() {
|
232
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
233
|
+
}
|
234
|
+
|
235
|
+
var _excluded = ["multiple", "children", "disabled"];
|
236
|
+
|
237
|
+
var WButton = function WButton(props) {
|
238
|
+
var multiple = props.multiple,
|
239
|
+
children = props.children,
|
240
|
+
disabled = props.disabled,
|
241
|
+
extraProps = _objectWithoutProperties(props, _excluded);
|
242
|
+
|
243
|
+
var menu = /*#__PURE__*/React.createElement(Menu, {
|
244
|
+
onClick: multiple && multiple.handleMenuClick
|
245
|
+
}, multiple && multiple.children && multiple.children.map(function (child, index) {
|
246
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
247
|
+
key: index
|
248
|
+
}, child);
|
249
|
+
}));
|
250
|
+
return multiple ? /*#__PURE__*/React.createElement(Dropdown.Button, {
|
251
|
+
disabled: disabled,
|
252
|
+
onClick: multiple && multiple.handleClick,
|
253
|
+
overlay: menu
|
254
|
+
}, children) : /*#__PURE__*/React.createElement(Button, _objectSpread2({
|
255
|
+
disabled: disabled
|
256
|
+
}, extraProps), children);
|
257
|
+
};
|
258
|
+
|
259
|
+
WButton.defaultProps = {};
|
260
|
+
|
261
|
+
/*
|
262
|
+
* @Author: lijin
|
263
|
+
* @Date: 2021-08-04 16:24:47
|
264
|
+
* @LastEditTime: 2021-09-09 15:57:23
|
265
|
+
* @LastEditors: lijin
|
266
|
+
* @Description:
|
267
|
+
* @FilePath: \wargerm\src\IconFont\index.tsx
|
268
|
+
* 可以输入预定的版权声明、个性签名、空行等
|
269
|
+
*/
|
270
|
+
// iconFontScriptUrl 修改成自己的iconfont图标项目地址
|
271
|
+
// 注意:如果需要图标多色,Iconfont图标项目里要进行批量去色处理
|
272
|
+
// 使用:
|
273
|
+
// import IconFont from '@/components/IconFont';
|
274
|
+
// <IconFont type='icon-demo' className='xxx-xxx' />
|
275
|
+
|
276
|
+
var index = createFromIconfontCN({
|
277
|
+
scriptUrl: '//at.alicdn.com/t/font_2720974_ec0fzxnc7ul.js'
|
278
|
+
});
|
279
|
+
|
280
|
+
var WInput = function WInput(props) {
|
281
|
+
var extraProps = _extends({}, props);
|
282
|
+
|
283
|
+
return /*#__PURE__*/React.createElement(Input, _objectSpread2({}, extraProps));
|
284
|
+
};
|
285
|
+
|
286
|
+
WInput.defaultProps = {};
|
287
|
+
|
288
|
+
var _excluded$1 = ["columns", "dataSource", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination"];
|
289
|
+
function Table(_ref) {
|
290
|
+
var columns = _ref.columns,
|
291
|
+
dataSource = _ref.dataSource,
|
292
|
+
_ref$rowKey = _ref.rowKey,
|
293
|
+
rowKey = _ref$rowKey === void 0 ? 'key' : _ref$rowKey,
|
294
|
+
onRow = _ref.onRow,
|
295
|
+
className = _ref.className,
|
296
|
+
rowClassName = _ref.rowClassName,
|
297
|
+
rowSelection = _ref.rowSelection,
|
298
|
+
style = _ref.style,
|
299
|
+
tbodyStyle = _ref.tbodyStyle,
|
300
|
+
thStyle = _ref.thStyle,
|
301
|
+
_ref$border = _ref.border,
|
302
|
+
scroll = _ref.scroll,
|
303
|
+
_ref$pagination = _ref.pagination,
|
304
|
+
pagination = _ref$pagination === void 0 ? false : _ref$pagination,
|
305
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
306
|
+
|
307
|
+
var _useState = useState(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [])),
|
308
|
+
_useState2 = _slicedToArray(_useState, 2),
|
309
|
+
selectedRowKeys = _useState2[0],
|
310
|
+
setSelectedKeys = _useState2[1];
|
311
|
+
|
312
|
+
var _useState3 = useState([]),
|
313
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
314
|
+
selectedRows = _useState4[0],
|
315
|
+
setSelectedRows = _useState4[1];
|
316
|
+
|
317
|
+
var onSelectAllChange = function onSelectAllChange(e) {
|
318
|
+
if (e.target.checked) {
|
319
|
+
setSelectedKeys(dataSource.map(function (record) {
|
320
|
+
return typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
|
321
|
+
}));
|
322
|
+
setSelectedRows(function () {
|
323
|
+
var _rowSelection$onSelec;
|
324
|
+
|
325
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec = rowSelection.onSelectAll) === null || _rowSelection$onSelec === void 0 ? void 0 : _rowSelection$onSelec.call(rowSelection, e.target.checked, dataSource, dataSource);
|
326
|
+
return dataSource;
|
327
|
+
});
|
328
|
+
} else {
|
329
|
+
setSelectedKeys([]);
|
330
|
+
setSelectedRows(function () {
|
331
|
+
var _rowSelection$onSelec2;
|
332
|
+
|
333
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec2 = rowSelection.onSelectAll) === null || _rowSelection$onSelec2 === void 0 ? void 0 : _rowSelection$onSelec2.call(rowSelection, e.target.checked, [], dataSource);
|
334
|
+
return [];
|
335
|
+
});
|
336
|
+
}
|
337
|
+
};
|
338
|
+
|
339
|
+
return /*#__PURE__*/React.createElement("div", {
|
340
|
+
className: classnames(_defineProperty({
|
341
|
+
container: true
|
342
|
+
}, className || 'defalut-table', true)),
|
343
|
+
style: style
|
344
|
+
}, /*#__PURE__*/React.createElement("div", {
|
345
|
+
className: "theader"
|
346
|
+
}, /*#__PURE__*/React.createElement("div", {
|
347
|
+
className: "th",
|
348
|
+
style: thStyle
|
349
|
+
}, (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'checkbox' && /*#__PURE__*/React.createElement("div", {
|
350
|
+
style: {
|
351
|
+
width: '50px',
|
352
|
+
flex: '0 1 auto'
|
353
|
+
},
|
354
|
+
className: "td"
|
355
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
356
|
+
checked: dataSource.every(function (record) {
|
357
|
+
return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
|
358
|
+
}),
|
359
|
+
indeterminate: !dataSource.every(function (record) {
|
360
|
+
return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
|
361
|
+
}) && dataSource.some(function (record) {
|
362
|
+
return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
|
363
|
+
}),
|
364
|
+
onChange: onSelectAllChange
|
365
|
+
}, ' ')), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'radio' && /*#__PURE__*/React.createElement("div", {
|
366
|
+
style: {
|
367
|
+
width: '50px',
|
368
|
+
flex: '0 1 auto'
|
369
|
+
},
|
370
|
+
className: "td"
|
371
|
+
}), columns.map(function (column) {
|
372
|
+
return /*#__PURE__*/React.createElement("div", {
|
373
|
+
key: column.dataIndex,
|
374
|
+
style: {
|
375
|
+
width: column.width + 'px',
|
376
|
+
flex: column.width ? '0 1 auto' : '1'
|
377
|
+
},
|
378
|
+
className: "td"
|
379
|
+
}, column.title);
|
380
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
381
|
+
className: "tbody",
|
382
|
+
style: _objectSpread2({
|
383
|
+
height: (style === null || style === void 0 ? void 0 : style.height) ? "calc(".concat(style.height, " - ").concat(52 + (pagination === false ? 0 : 42), "px)") : '200px'
|
384
|
+
}, tbodyStyle)
|
385
|
+
}, dataSource.map(function (record, index) {
|
386
|
+
var _ref2, _ref3;
|
387
|
+
|
388
|
+
var key = typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
|
389
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread2({
|
390
|
+
key: key,
|
391
|
+
className: classnames(_defineProperty({
|
392
|
+
tr: true
|
393
|
+
}, typeof rowClassName === 'function' ? rowClassName(record, index) : '', true))
|
394
|
+
}, typeof onRow === 'function' ? onRow(record, index) : {}), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'checkbox' && /*#__PURE__*/React.createElement("div", {
|
395
|
+
style: {
|
396
|
+
width: '50px',
|
397
|
+
flex: '0 1 auto'
|
398
|
+
},
|
399
|
+
className: "td"
|
400
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
401
|
+
checked: (_ref2 = [].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys))) === null || _ref2 === void 0 ? void 0 : _ref2.includes(key),
|
402
|
+
onClick: function onClick(e) {
|
403
|
+
return e.stopPropagation();
|
404
|
+
},
|
405
|
+
onChange: function onChange(event) {
|
406
|
+
setSelectedKeys(function (keys) {
|
407
|
+
var rows = uniqBy([].concat(_toConsumableArray(selectedRows), [record]), typeof rowKey === 'function' ? rowKey(record) : rowKey);
|
408
|
+
|
409
|
+
if (event.target.checked) {
|
410
|
+
var _rowSelection$onChang, _rowSelection$onSelec3;
|
411
|
+
|
412
|
+
setSelectedRows(rows);
|
413
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang = rowSelection.onChange) === null || _rowSelection$onChang === void 0 ? void 0 : _rowSelection$onChang.call(rowSelection, _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys), [key]))), rows);
|
414
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec3 = rowSelection.onSelect) === null || _rowSelection$onSelec3 === void 0 ? void 0 : _rowSelection$onSelec3.call(rowSelection, record, event.target.checked, rows, event.nativeEvent);
|
415
|
+
return _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(keys), [key])));
|
416
|
+
} else {
|
417
|
+
var _rowSelection$onSelec4, _rowSelection$onChang2;
|
418
|
+
|
419
|
+
var selectedKeys = _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(keys))));
|
420
|
+
|
421
|
+
var _index = selectedKeys.indexOf(key);
|
422
|
+
|
423
|
+
selectedKeys.splice(_index, 1);
|
424
|
+
rows.splice(_index, 1);
|
425
|
+
setSelectedRows(rows);
|
426
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec4 = rowSelection.onSelect) === null || _rowSelection$onSelec4 === void 0 ? void 0 : _rowSelection$onSelec4.call(rowSelection, record, event.target.checked, rows, event.nativeEvent);
|
427
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang2 = rowSelection.onChange) === null || _rowSelection$onChang2 === void 0 ? void 0 : _rowSelection$onChang2.call(rowSelection, selectedKeys, rows);
|
428
|
+
return selectedKeys;
|
429
|
+
}
|
430
|
+
});
|
431
|
+
}
|
432
|
+
}, ' ')), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'radio' && /*#__PURE__*/React.createElement("div", {
|
433
|
+
style: {
|
434
|
+
width: '50px',
|
435
|
+
flex: '0 1 auto'
|
436
|
+
},
|
437
|
+
className: "td"
|
438
|
+
}, /*#__PURE__*/React.createElement(Radio, {
|
439
|
+
checked: (_ref3 = [].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys))) === null || _ref3 === void 0 ? void 0 : _ref3.includes(key),
|
440
|
+
onClick: function onClick(e) {
|
441
|
+
return e.stopPropagation();
|
442
|
+
},
|
443
|
+
onChange: function onChange(event) {
|
444
|
+
var _rowSelection$onSelec5, _rowSelection$onChang3;
|
445
|
+
|
446
|
+
setSelectedKeys([key]);
|
447
|
+
setSelectedRows([record]);
|
448
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec5 = rowSelection.onSelect) === null || _rowSelection$onSelec5 === void 0 ? void 0 : _rowSelection$onSelec5.call(rowSelection, record, event.target.checked, [record], event.nativeEvent);
|
449
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang3 = rowSelection.onChange) === null || _rowSelection$onChang3 === void 0 ? void 0 : _rowSelection$onChang3.call(rowSelection, _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), [key]))), [record]);
|
450
|
+
}
|
451
|
+
})), columns.map(function (column) {
|
452
|
+
return column.render ? column.render(record[column.dataIndex], record, index) : column.showTitle ? /*#__PURE__*/React.createElement(Tooltip, {
|
453
|
+
key: column.dataIndex,
|
454
|
+
placement: "top",
|
455
|
+
title: record[column.dataIndex]
|
456
|
+
}, /*#__PURE__*/React.createElement("div", {
|
457
|
+
className: 'td' + (column.ellipsis ? ' ellipsis' : ''),
|
458
|
+
style: {
|
459
|
+
width: column.width + 'px',
|
460
|
+
flex: column.width ? '0 1 auto' : '1'
|
461
|
+
}
|
462
|
+
}, record[column.dataIndex])) : /*#__PURE__*/React.createElement("div", {
|
463
|
+
key: column.dataIndex,
|
464
|
+
className: 'td' + (column.ellipsis ? ' ellipsis' : ''),
|
465
|
+
style: {
|
466
|
+
width: column.width + 'px',
|
467
|
+
flex: column.width ? '0 1 auto' : '1'
|
468
|
+
}
|
469
|
+
}, record[column.dataIndex]);
|
470
|
+
}));
|
471
|
+
})), _typeof(pagination) === 'object' && /*#__PURE__*/React.createElement(Pagination, _objectSpread2({
|
472
|
+
className: "mt10"
|
473
|
+
}, pagination)));
|
474
|
+
}
|
475
|
+
Table.defaultProps = {
|
476
|
+
rowKey: 'key'
|
477
|
+
};
|
478
|
+
|
479
|
+
export { WButton as Button, index as IconFont, WInput as Input, Table };
|
package/dist/index.js
ADDED
@@ -0,0 +1,492 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var React = require('react');
|
6
|
+
var antd = require('antd');
|
7
|
+
var icons = require('@ant-design/icons');
|
8
|
+
var classnames = require('classnames');
|
9
|
+
var uniqBy = require('lodash/uniqBy');
|
10
|
+
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
12
|
+
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
14
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
15
|
+
var uniqBy__default = /*#__PURE__*/_interopDefaultLegacy(uniqBy);
|
16
|
+
|
17
|
+
function styleInject(css, ref) {
|
18
|
+
if ( ref === void 0 ) ref = {};
|
19
|
+
var insertAt = ref.insertAt;
|
20
|
+
|
21
|
+
if (!css || typeof document === 'undefined') { return; }
|
22
|
+
|
23
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
24
|
+
var style = document.createElement('style');
|
25
|
+
style.type = 'text/css';
|
26
|
+
|
27
|
+
if (insertAt === 'top') {
|
28
|
+
if (head.firstChild) {
|
29
|
+
head.insertBefore(style, head.firstChild);
|
30
|
+
} else {
|
31
|
+
head.appendChild(style);
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
head.appendChild(style);
|
35
|
+
}
|
36
|
+
|
37
|
+
if (style.styleSheet) {
|
38
|
+
style.styleSheet.cssText = css;
|
39
|
+
} else {
|
40
|
+
style.appendChild(document.createTextNode(css));
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
var css_248z = "/* Color\n----------------------- */\n/* Border\n----------------------- */\n::-webkit-scrollbar {\n width: 6px;\n}\n::-webkit-scrollbar-track {\n background: hsla(0, 0%, 100%, 0.1);\n -webkit-box-shadow: inset006pxrgba(255, 0, 0, 0.3);\n}\n::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.5);\n}\n::-webkit-scrollbar-thumb:window-inactive {\n background: rgba(0, 0, 0, 0.2);\n}\n[data-prefers-color='dark'] .__dumi-default-previewer {\n background: linear-gradient(#1c274f 0%, #2f4262 100%);\n}\n[data-prefers-color='light'] .__dumi-default-previewer {\n background: linear-gradient(#9fb5c6 0%, #ccdfee 100%);\n}\n[data-prefers-color='dark'] .ant-btn {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n border: 1px solid #41a9d4;\n width: 95px;\n height: 30px;\n font-size: 14px;\n font-family: Adobe Heiti Std R, Adobe Heiti Std R-R;\n font-weight: R;\n text-align: left;\n color: #3665ea;\n letter-spacing: 1px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='dark'] .ant-btn-primary {\n color: #fff;\n background: rgba(6, 15, 41, 0.7);\n border: 1px solid #41a9d4;\n}\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary {\n background: rgba(229, 145, 145, 0.7);\n color: #fff;\n border: none;\n}\n[data-prefers-color='dark'] .ant-btn-link {\n background: none;\n border: none;\n}\n[data-prefers-color='dark'] .ant-btn[disabled],\n[data-prefers-color='dark'] .ant-btn[disabled]:hover,\n[data-prefers-color='dark'] .ant-btn[disabled]:focus,\n[data-prefers-color='dark'] .ant-btn[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled],\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled]:hover,\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled]:focus,\n[data-prefers-color='dark'] .ant-btn-dangerous.ant-btn-primary[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='dark'] .ant-btn-link[disabled],\n[data-prefers-color='dark'] .ant-btn-link[disabled]:hover,\n[data-prefers-color='dark'] .ant-btn-link[disabled]:focus,\n[data-prefers-color='dark'] .ant-btn-link[disabled]:active {\n background: none;\n border: none;\n}\n[data-prefers-color='dark'] .ant-dropdown-trigger {\n width: 30px;\n height: 30px;\n}\n[data-prefers-color='dark'] .ant-dropdown-menu {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n}\n[data-prefers-color='dark'] .ant-dropdown-menu .ant-dropdown-menu-item {\n color: #3665ea;\n}\n[data-prefers-color='dark'] .ant-dropdown-menu-item:hover,\n[data-prefers-color='dark'] .ant-dropdown-menu-submenu-title:hover {\n background: rgba(40, 130, 254, 0.7);\n color: #fff;\n}\n[data-prefers-color='light'] .ant-btn {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n border: 1px solid #41a9d4;\n width: 95px;\n height: 30px;\n font-size: 14px;\n font-family: Adobe Heiti Std R, Adobe Heiti Std R-R;\n font-weight: R;\n text-align: left;\n color: #3665ea;\n letter-spacing: 1px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='light'] .ant-btn-primary {\n background: rgba(40, 130, 254, 0.7);\n border: 1px solid #41a9d4;\n color: #fff;\n}\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary {\n background: rgba(229, 145, 145, 0.7);\n color: #fff;\n border: none;\n}\n[data-prefers-color='light'] .ant-btn-link {\n background: none;\n border: none;\n}\n[data-prefers-color='light'] .ant-btn[disabled],\n[data-prefers-color='light'] .ant-btn[disabled]:hover,\n[data-prefers-color='light'] .ant-btn[disabled]:focus,\n[data-prefers-color='light'] .ant-btn[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled],\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled]:hover,\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled]:focus,\n[data-prefers-color='light'] .ant-btn-dangerous.ant-btn-primary[disabled]:active {\n background: rgba(79, 87, 96, 0.2);\n border: none;\n color: rgba(111, 125, 134);\n}\n[data-prefers-color='light'] .ant-btn-link[disabled],\n[data-prefers-color='light'] .ant-btn-link[disabled]:hover,\n[data-prefers-color='light'] .ant-btn-link[disabled]:focus,\n[data-prefers-color='light'] .ant-btn-link[disabled]:active {\n background: none;\n border: none;\n}\n[data-prefers-color='light'] .ant-dropdown-trigger {\n width: 30px;\n height: 30px;\n}\n[data-prefers-color='light'] .ant-dropdown-menu {\n background: linear-gradient(rgba(219, 230, 255, 0.7) 0%, rgba(239, 244, 249, 0.7) 100%);\n}\n[data-prefers-color='light'] .ant-dropdown-menu .ant-dropdown-menu-item {\n color: #3665ea;\n}\n[data-prefers-color='light'] .ant-dropdown-menu-item:hover,\n[data-prefers-color='light'] .ant-dropdown-menu-submenu-title:hover {\n background: rgba(40, 130, 254, 0.7);\n color: #fff;\n}\n[data-prefers-color='dark'] input {\n padding: 0;\n outline: none;\n border: none;\n}\n[data-prefers-color='dark'] input.ant-input {\n background-color: transparent;\n height: 28px;\n border: 1px solid #4383a4;\n color: #fff;\n padding-left: 10px;\n}\n[data-prefers-color='dark'] input.ant-input:focus,\n[data-prefers-color='dark'] input.ant-input-focused {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='dark'] input.ant-input:hover {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='light'] input {\n padding: 0;\n outline: none;\n border: none;\n}\n[data-prefers-color='light'] input.ant-input {\n background-color: transparent;\n height: 28px;\n border: 1px solid #4383a4;\n color: #fff;\n padding-left: 10px;\n}\n[data-prefers-color='light'] input.ant-input:focus,\n[data-prefers-color='light'] input.ant-input-focused {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='light'] input.ant-input:hover {\n border: 1px solid #4383a4;\n}\n[data-prefers-color='dark'] .container {\n position: relative;\n}\n[data-prefers-color='dark'] .container .theader .th {\n height: 32px;\n padding-left: 6px;\n display: flex;\n background-color: #212f51;\n}\n[data-prefers-color='dark'] .container .theader .th .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='dark'] .container .tbody {\n overflow: auto;\n padding-top: 5px;\n margin-top: 19px;\n}\n[data-prefers-color='dark'] .container .tbody .tr {\n padding-left: 6px;\n width: 100%;\n height: 32px;\n display: flex;\n background-color: #263759;\n margin-bottom: 17px;\n}\n[data-prefers-color='dark'] .container .tbody .tr .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='dark'] .ant-pagination-jump-prev .ant-pagination-item-container .ant-pagination-item-ellipsis,\n[data-prefers-color='dark'] .ant-pagination-jump-next .ant-pagination-item-container .ant-pagination-item-ellipsis {\n color: #9cd0ef;\n}\n[data-prefers-color='dark'] .ant-pagination-item-active {\n background: transparent;\n}\n[data-prefers-color='light'] .container {\n position: relative;\n}\n[data-prefers-color='light'] .container .theader .th {\n height: 32px;\n padding-left: 6px;\n display: flex;\n background-color: #212f51;\n}\n[data-prefers-color='light'] .container .theader .th .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='light'] .container .tbody {\n overflow: auto;\n padding-top: 5px;\n margin-top: 19px;\n}\n[data-prefers-color='light'] .container .tbody .tr {\n padding-left: 6px;\n width: 100%;\n height: 32px;\n display: flex;\n background-color: #263759;\n margin-bottom: 17px;\n}\n[data-prefers-color='light'] .container .tbody .tr .td {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n[data-prefers-color='light'] .ant-pagination-jump-prev .ant-pagination-item-container .ant-pagination-item-ellipsis,\n[data-prefers-color='light'] .ant-pagination-jump-next .ant-pagination-item-container .ant-pagination-item-ellipsis {\n color: #9cd0ef;\n}\n[data-prefers-color='light'] .ant-pagination-item-active {\n background: transparent;\n}\n";
|
45
|
+
styleInject(css_248z);
|
46
|
+
|
47
|
+
function ownKeys(object, enumerableOnly) {
|
48
|
+
var keys = Object.keys(object);
|
49
|
+
|
50
|
+
if (Object.getOwnPropertySymbols) {
|
51
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
52
|
+
|
53
|
+
if (enumerableOnly) {
|
54
|
+
symbols = symbols.filter(function (sym) {
|
55
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
keys.push.apply(keys, symbols);
|
60
|
+
}
|
61
|
+
|
62
|
+
return keys;
|
63
|
+
}
|
64
|
+
|
65
|
+
function _objectSpread2(target) {
|
66
|
+
for (var i = 1; i < arguments.length; i++) {
|
67
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
68
|
+
|
69
|
+
if (i % 2) {
|
70
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
71
|
+
_defineProperty(target, key, source[key]);
|
72
|
+
});
|
73
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
74
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
75
|
+
} else {
|
76
|
+
ownKeys(Object(source)).forEach(function (key) {
|
77
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
78
|
+
});
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
return target;
|
83
|
+
}
|
84
|
+
|
85
|
+
function _typeof(obj) {
|
86
|
+
"@babel/helpers - typeof";
|
87
|
+
|
88
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
89
|
+
_typeof = function (obj) {
|
90
|
+
return typeof obj;
|
91
|
+
};
|
92
|
+
} else {
|
93
|
+
_typeof = function (obj) {
|
94
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
95
|
+
};
|
96
|
+
}
|
97
|
+
|
98
|
+
return _typeof(obj);
|
99
|
+
}
|
100
|
+
|
101
|
+
function _defineProperty(obj, key, value) {
|
102
|
+
if (key in obj) {
|
103
|
+
Object.defineProperty(obj, key, {
|
104
|
+
value: value,
|
105
|
+
enumerable: true,
|
106
|
+
configurable: true,
|
107
|
+
writable: true
|
108
|
+
});
|
109
|
+
} else {
|
110
|
+
obj[key] = value;
|
111
|
+
}
|
112
|
+
|
113
|
+
return obj;
|
114
|
+
}
|
115
|
+
|
116
|
+
function _extends() {
|
117
|
+
_extends = Object.assign || function (target) {
|
118
|
+
for (var i = 1; i < arguments.length; i++) {
|
119
|
+
var source = arguments[i];
|
120
|
+
|
121
|
+
for (var key in source) {
|
122
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
123
|
+
target[key] = source[key];
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
return target;
|
129
|
+
};
|
130
|
+
|
131
|
+
return _extends.apply(this, arguments);
|
132
|
+
}
|
133
|
+
|
134
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
135
|
+
if (source == null) return {};
|
136
|
+
var target = {};
|
137
|
+
var sourceKeys = Object.keys(source);
|
138
|
+
var key, i;
|
139
|
+
|
140
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
141
|
+
key = sourceKeys[i];
|
142
|
+
if (excluded.indexOf(key) >= 0) continue;
|
143
|
+
target[key] = source[key];
|
144
|
+
}
|
145
|
+
|
146
|
+
return target;
|
147
|
+
}
|
148
|
+
|
149
|
+
function _objectWithoutProperties(source, excluded) {
|
150
|
+
if (source == null) return {};
|
151
|
+
|
152
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
153
|
+
|
154
|
+
var key, i;
|
155
|
+
|
156
|
+
if (Object.getOwnPropertySymbols) {
|
157
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
158
|
+
|
159
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
160
|
+
key = sourceSymbolKeys[i];
|
161
|
+
if (excluded.indexOf(key) >= 0) continue;
|
162
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
163
|
+
target[key] = source[key];
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
return target;
|
168
|
+
}
|
169
|
+
|
170
|
+
function _slicedToArray(arr, i) {
|
171
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
172
|
+
}
|
173
|
+
|
174
|
+
function _toConsumableArray(arr) {
|
175
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
176
|
+
}
|
177
|
+
|
178
|
+
function _arrayWithoutHoles(arr) {
|
179
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
180
|
+
}
|
181
|
+
|
182
|
+
function _arrayWithHoles(arr) {
|
183
|
+
if (Array.isArray(arr)) return arr;
|
184
|
+
}
|
185
|
+
|
186
|
+
function _iterableToArray(iter) {
|
187
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
188
|
+
}
|
189
|
+
|
190
|
+
function _iterableToArrayLimit(arr, i) {
|
191
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
192
|
+
|
193
|
+
if (_i == null) return;
|
194
|
+
var _arr = [];
|
195
|
+
var _n = true;
|
196
|
+
var _d = false;
|
197
|
+
|
198
|
+
var _s, _e;
|
199
|
+
|
200
|
+
try {
|
201
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
202
|
+
_arr.push(_s.value);
|
203
|
+
|
204
|
+
if (i && _arr.length === i) break;
|
205
|
+
}
|
206
|
+
} catch (err) {
|
207
|
+
_d = true;
|
208
|
+
_e = err;
|
209
|
+
} finally {
|
210
|
+
try {
|
211
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
212
|
+
} finally {
|
213
|
+
if (_d) throw _e;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
return _arr;
|
218
|
+
}
|
219
|
+
|
220
|
+
function _unsupportedIterableToArray(o, minLen) {
|
221
|
+
if (!o) return;
|
222
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
223
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
224
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
225
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
226
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
227
|
+
}
|
228
|
+
|
229
|
+
function _arrayLikeToArray(arr, len) {
|
230
|
+
if (len == null || len > arr.length) len = arr.length;
|
231
|
+
|
232
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
233
|
+
|
234
|
+
return arr2;
|
235
|
+
}
|
236
|
+
|
237
|
+
function _nonIterableSpread() {
|
238
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
239
|
+
}
|
240
|
+
|
241
|
+
function _nonIterableRest() {
|
242
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
243
|
+
}
|
244
|
+
|
245
|
+
var _excluded = ["multiple", "children", "disabled"];
|
246
|
+
|
247
|
+
var WButton = function WButton(props) {
|
248
|
+
var multiple = props.multiple,
|
249
|
+
children = props.children,
|
250
|
+
disabled = props.disabled,
|
251
|
+
extraProps = _objectWithoutProperties(props, _excluded);
|
252
|
+
|
253
|
+
var menu = /*#__PURE__*/React__default['default'].createElement(antd.Menu, {
|
254
|
+
onClick: multiple && multiple.handleMenuClick
|
255
|
+
}, multiple && multiple.children && multiple.children.map(function (child, index) {
|
256
|
+
return /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
257
|
+
key: index
|
258
|
+
}, child);
|
259
|
+
}));
|
260
|
+
return multiple ? /*#__PURE__*/React__default['default'].createElement(antd.Dropdown.Button, {
|
261
|
+
disabled: disabled,
|
262
|
+
onClick: multiple && multiple.handleClick,
|
263
|
+
overlay: menu
|
264
|
+
}, children) : /*#__PURE__*/React__default['default'].createElement(antd.Button, _objectSpread2({
|
265
|
+
disabled: disabled
|
266
|
+
}, extraProps), children);
|
267
|
+
};
|
268
|
+
|
269
|
+
WButton.defaultProps = {};
|
270
|
+
|
271
|
+
/*
|
272
|
+
* @Author: lijin
|
273
|
+
* @Date: 2021-08-04 16:24:47
|
274
|
+
* @LastEditTime: 2021-09-09 15:57:23
|
275
|
+
* @LastEditors: lijin
|
276
|
+
* @Description:
|
277
|
+
* @FilePath: \wargerm\src\IconFont\index.tsx
|
278
|
+
* 可以输入预定的版权声明、个性签名、空行等
|
279
|
+
*/
|
280
|
+
// iconFontScriptUrl 修改成自己的iconfont图标项目地址
|
281
|
+
// 注意:如果需要图标多色,Iconfont图标项目里要进行批量去色处理
|
282
|
+
// 使用:
|
283
|
+
// import IconFont from '@/components/IconFont';
|
284
|
+
// <IconFont type='icon-demo' className='xxx-xxx' />
|
285
|
+
|
286
|
+
var index = icons.createFromIconfontCN({
|
287
|
+
scriptUrl: '//at.alicdn.com/t/font_2720974_ec0fzxnc7ul.js'
|
288
|
+
});
|
289
|
+
|
290
|
+
var WInput = function WInput(props) {
|
291
|
+
var extraProps = _extends({}, props);
|
292
|
+
|
293
|
+
return /*#__PURE__*/React__default['default'].createElement(antd.Input, _objectSpread2({}, extraProps));
|
294
|
+
};
|
295
|
+
|
296
|
+
WInput.defaultProps = {};
|
297
|
+
|
298
|
+
var _excluded$1 = ["columns", "dataSource", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination"];
|
299
|
+
function Table(_ref) {
|
300
|
+
var columns = _ref.columns,
|
301
|
+
dataSource = _ref.dataSource,
|
302
|
+
_ref$rowKey = _ref.rowKey,
|
303
|
+
rowKey = _ref$rowKey === void 0 ? 'key' : _ref$rowKey,
|
304
|
+
onRow = _ref.onRow,
|
305
|
+
className = _ref.className,
|
306
|
+
rowClassName = _ref.rowClassName,
|
307
|
+
rowSelection = _ref.rowSelection,
|
308
|
+
style = _ref.style,
|
309
|
+
tbodyStyle = _ref.tbodyStyle,
|
310
|
+
thStyle = _ref.thStyle,
|
311
|
+
_ref$border = _ref.border,
|
312
|
+
scroll = _ref.scroll,
|
313
|
+
_ref$pagination = _ref.pagination,
|
314
|
+
pagination = _ref$pagination === void 0 ? false : _ref$pagination,
|
315
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
316
|
+
|
317
|
+
var _useState = React.useState(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [])),
|
318
|
+
_useState2 = _slicedToArray(_useState, 2),
|
319
|
+
selectedRowKeys = _useState2[0],
|
320
|
+
setSelectedKeys = _useState2[1];
|
321
|
+
|
322
|
+
var _useState3 = React.useState([]),
|
323
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
324
|
+
selectedRows = _useState4[0],
|
325
|
+
setSelectedRows = _useState4[1];
|
326
|
+
|
327
|
+
var onSelectAllChange = function onSelectAllChange(e) {
|
328
|
+
if (e.target.checked) {
|
329
|
+
setSelectedKeys(dataSource.map(function (record) {
|
330
|
+
return typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
|
331
|
+
}));
|
332
|
+
setSelectedRows(function () {
|
333
|
+
var _rowSelection$onSelec;
|
334
|
+
|
335
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec = rowSelection.onSelectAll) === null || _rowSelection$onSelec === void 0 ? void 0 : _rowSelection$onSelec.call(rowSelection, e.target.checked, dataSource, dataSource);
|
336
|
+
return dataSource;
|
337
|
+
});
|
338
|
+
} else {
|
339
|
+
setSelectedKeys([]);
|
340
|
+
setSelectedRows(function () {
|
341
|
+
var _rowSelection$onSelec2;
|
342
|
+
|
343
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec2 = rowSelection.onSelectAll) === null || _rowSelection$onSelec2 === void 0 ? void 0 : _rowSelection$onSelec2.call(rowSelection, e.target.checked, [], dataSource);
|
344
|
+
return [];
|
345
|
+
});
|
346
|
+
}
|
347
|
+
};
|
348
|
+
|
349
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
350
|
+
className: classnames__default['default'](_defineProperty({
|
351
|
+
container: true
|
352
|
+
}, className || 'defalut-table', true)),
|
353
|
+
style: style
|
354
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
355
|
+
className: "theader"
|
356
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
357
|
+
className: "th",
|
358
|
+
style: thStyle
|
359
|
+
}, (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'checkbox' && /*#__PURE__*/React__default['default'].createElement("div", {
|
360
|
+
style: {
|
361
|
+
width: '50px',
|
362
|
+
flex: '0 1 auto'
|
363
|
+
},
|
364
|
+
className: "td"
|
365
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Checkbox, {
|
366
|
+
checked: dataSource.every(function (record) {
|
367
|
+
return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
|
368
|
+
}),
|
369
|
+
indeterminate: !dataSource.every(function (record) {
|
370
|
+
return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
|
371
|
+
}) && dataSource.some(function (record) {
|
372
|
+
return selectedRowKeys.includes(typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey]);
|
373
|
+
}),
|
374
|
+
onChange: onSelectAllChange
|
375
|
+
}, ' ')), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'radio' && /*#__PURE__*/React__default['default'].createElement("div", {
|
376
|
+
style: {
|
377
|
+
width: '50px',
|
378
|
+
flex: '0 1 auto'
|
379
|
+
},
|
380
|
+
className: "td"
|
381
|
+
}), columns.map(function (column) {
|
382
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
383
|
+
key: column.dataIndex,
|
384
|
+
style: {
|
385
|
+
width: column.width + 'px',
|
386
|
+
flex: column.width ? '0 1 auto' : '1'
|
387
|
+
},
|
388
|
+
className: "td"
|
389
|
+
}, column.title);
|
390
|
+
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
391
|
+
className: "tbody",
|
392
|
+
style: _objectSpread2({
|
393
|
+
height: (style === null || style === void 0 ? void 0 : style.height) ? "calc(".concat(style.height, " - ").concat(52 + (pagination === false ? 0 : 42), "px)") : '200px'
|
394
|
+
}, tbodyStyle)
|
395
|
+
}, dataSource.map(function (record, index) {
|
396
|
+
var _ref2, _ref3;
|
397
|
+
|
398
|
+
var key = typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
|
399
|
+
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2({
|
400
|
+
key: key,
|
401
|
+
className: classnames__default['default'](_defineProperty({
|
402
|
+
tr: true
|
403
|
+
}, typeof rowClassName === 'function' ? rowClassName(record, index) : '', true))
|
404
|
+
}, typeof onRow === 'function' ? onRow(record, index) : {}), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'checkbox' && /*#__PURE__*/React__default['default'].createElement("div", {
|
405
|
+
style: {
|
406
|
+
width: '50px',
|
407
|
+
flex: '0 1 auto'
|
408
|
+
},
|
409
|
+
className: "td"
|
410
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Checkbox, {
|
411
|
+
checked: (_ref2 = [].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys))) === null || _ref2 === void 0 ? void 0 : _ref2.includes(key),
|
412
|
+
onClick: function onClick(e) {
|
413
|
+
return e.stopPropagation();
|
414
|
+
},
|
415
|
+
onChange: function onChange(event) {
|
416
|
+
setSelectedKeys(function (keys) {
|
417
|
+
var rows = uniqBy__default['default']([].concat(_toConsumableArray(selectedRows), [record]), typeof rowKey === 'function' ? rowKey(record) : rowKey);
|
418
|
+
|
419
|
+
if (event.target.checked) {
|
420
|
+
var _rowSelection$onChang, _rowSelection$onSelec3;
|
421
|
+
|
422
|
+
setSelectedRows(rows);
|
423
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang = rowSelection.onChange) === null || _rowSelection$onChang === void 0 ? void 0 : _rowSelection$onChang.call(rowSelection, _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys), [key]))), rows);
|
424
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec3 = rowSelection.onSelect) === null || _rowSelection$onSelec3 === void 0 ? void 0 : _rowSelection$onSelec3.call(rowSelection, record, event.target.checked, rows, event.nativeEvent);
|
425
|
+
return _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(keys), [key])));
|
426
|
+
} else {
|
427
|
+
var _rowSelection$onSelec4, _rowSelection$onChang2;
|
428
|
+
|
429
|
+
var selectedKeys = _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(keys))));
|
430
|
+
|
431
|
+
var _index = selectedKeys.indexOf(key);
|
432
|
+
|
433
|
+
selectedKeys.splice(_index, 1);
|
434
|
+
rows.splice(_index, 1);
|
435
|
+
setSelectedRows(rows);
|
436
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec4 = rowSelection.onSelect) === null || _rowSelection$onSelec4 === void 0 ? void 0 : _rowSelection$onSelec4.call(rowSelection, record, event.target.checked, rows, event.nativeEvent);
|
437
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang2 = rowSelection.onChange) === null || _rowSelection$onChang2 === void 0 ? void 0 : _rowSelection$onChang2.call(rowSelection, selectedKeys, rows);
|
438
|
+
return selectedKeys;
|
439
|
+
}
|
440
|
+
});
|
441
|
+
}
|
442
|
+
}, ' ')), (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) === 'radio' && /*#__PURE__*/React__default['default'].createElement("div", {
|
443
|
+
style: {
|
444
|
+
width: '50px',
|
445
|
+
flex: '0 1 auto'
|
446
|
+
},
|
447
|
+
className: "td"
|
448
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Radio, {
|
449
|
+
checked: (_ref3 = [].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), _toConsumableArray(selectedRowKeys))) === null || _ref3 === void 0 ? void 0 : _ref3.includes(key),
|
450
|
+
onClick: function onClick(e) {
|
451
|
+
return e.stopPropagation();
|
452
|
+
},
|
453
|
+
onChange: function onChange(event) {
|
454
|
+
var _rowSelection$onSelec5, _rowSelection$onChang3;
|
455
|
+
|
456
|
+
setSelectedKeys([key]);
|
457
|
+
setSelectedRows([record]);
|
458
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onSelec5 = rowSelection.onSelect) === null || _rowSelection$onSelec5 === void 0 ? void 0 : _rowSelection$onSelec5.call(rowSelection, record, event.target.checked, [record], event.nativeEvent);
|
459
|
+
rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$onChang3 = rowSelection.onChange) === null || _rowSelection$onChang3 === void 0 ? void 0 : _rowSelection$onChang3.call(rowSelection, _toConsumableArray(new Set([].concat(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || []), [key]))), [record]);
|
460
|
+
}
|
461
|
+
})), columns.map(function (column) {
|
462
|
+
return column.render ? column.render(record[column.dataIndex], record, index) : column.showTitle ? /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
|
463
|
+
key: column.dataIndex,
|
464
|
+
placement: "top",
|
465
|
+
title: record[column.dataIndex]
|
466
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
467
|
+
className: 'td' + (column.ellipsis ? ' ellipsis' : ''),
|
468
|
+
style: {
|
469
|
+
width: column.width + 'px',
|
470
|
+
flex: column.width ? '0 1 auto' : '1'
|
471
|
+
}
|
472
|
+
}, record[column.dataIndex])) : /*#__PURE__*/React__default['default'].createElement("div", {
|
473
|
+
key: column.dataIndex,
|
474
|
+
className: 'td' + (column.ellipsis ? ' ellipsis' : ''),
|
475
|
+
style: {
|
476
|
+
width: column.width + 'px',
|
477
|
+
flex: column.width ? '0 1 auto' : '1'
|
478
|
+
}
|
479
|
+
}, record[column.dataIndex]);
|
480
|
+
}));
|
481
|
+
})), _typeof(pagination) === 'object' && /*#__PURE__*/React__default['default'].createElement(antd.Pagination, _objectSpread2({
|
482
|
+
className: "mt10"
|
483
|
+
}, pagination)));
|
484
|
+
}
|
485
|
+
Table.defaultProps = {
|
486
|
+
rowKey: 'key'
|
487
|
+
};
|
488
|
+
|
489
|
+
exports.Button = WButton;
|
490
|
+
exports.IconFont = index;
|
491
|
+
exports.Input = WInput;
|
492
|
+
exports.Table = Table;
|
package/package.json
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
{
|
2
|
+
"private": false,
|
3
|
+
"name": "wargerm",
|
4
|
+
"version": "0.1.0",
|
5
|
+
"scripts": {
|
6
|
+
"start": "dumi dev",
|
7
|
+
"docs:build": "dumi build",
|
8
|
+
"docs:deploy": "gh-pages -d docs-dist",
|
9
|
+
"build": "father-build",
|
10
|
+
"deploy": "npm run docs:build && npm run docs:deploy",
|
11
|
+
"release": "npm run build && npm publish",
|
12
|
+
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
13
|
+
"test": "umi-test",
|
14
|
+
"test:coverage": "umi-test --coverage"
|
15
|
+
},
|
16
|
+
"main": "dist/index.js",
|
17
|
+
"module": "dist/index.esm.js",
|
18
|
+
"unpkg": "dist/index.umd.min.js",
|
19
|
+
"typings": "dist/index.d.ts",
|
20
|
+
"author": "jinly2",
|
21
|
+
"license": "MIT",
|
22
|
+
"keywords": [
|
23
|
+
"React",
|
24
|
+
"Component"
|
25
|
+
],
|
26
|
+
"gitHooks": {
|
27
|
+
"pre-commit": "lint-staged"
|
28
|
+
},
|
29
|
+
"repository": {
|
30
|
+
"type": "git",
|
31
|
+
"url": "https://gitee.com/jin2/wargerm.git",
|
32
|
+
"branch": "main"
|
33
|
+
},
|
34
|
+
"files": [
|
35
|
+
"dist",
|
36
|
+
"es",
|
37
|
+
"lib"
|
38
|
+
],
|
39
|
+
"lint-staged": {
|
40
|
+
"*.{js,jsx,less,md,json}": [
|
41
|
+
"prettier --write"
|
42
|
+
],
|
43
|
+
"*.ts?(x)": [
|
44
|
+
"prettier --parser=typescript --write"
|
45
|
+
]
|
46
|
+
},
|
47
|
+
"dependencies": {},
|
48
|
+
"peerDependencies": {
|
49
|
+
"@ant-design/icons": ">=4.2.0",
|
50
|
+
"antd": ">=4.7.0",
|
51
|
+
"classnames": ">=2.2.0",
|
52
|
+
"lodash": ">=4.0.0",
|
53
|
+
"react": ">=17.0.0"
|
54
|
+
},
|
55
|
+
"devDependencies": {
|
56
|
+
"@ant-design/icons": "^4.6.4",
|
57
|
+
"@types/lodash": "^4.14.173",
|
58
|
+
"@umijs/test": "^3.0.5",
|
59
|
+
"antd": "^4.16.13",
|
60
|
+
"babel-plugin-import": "^1.13.3",
|
61
|
+
"classnames": "^2.3.1",
|
62
|
+
"dumi": "^1.1.0",
|
63
|
+
"father-build": "^1.19.1",
|
64
|
+
"gh-pages": "^3.0.0",
|
65
|
+
"lint-staged": "^10.0.7",
|
66
|
+
"prettier": "^1.19.1",
|
67
|
+
"react": "^16.12.0",
|
68
|
+
"yorkie": "^2.0.0"
|
69
|
+
}
|
70
|
+
}
|