tntd 1.3.66 → 1.4.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/dist/0645cf743e4e44ca9da321d689897f07.png +0 -0
- package/dist/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
- package/dist/1.tntd.js +12 -0
- package/dist/1d0b52448de217857b270af807e9360d.png +0 -0
- package/dist/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
- package/dist/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
- package/dist/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
- package/dist/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
- package/dist/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
- package/dist/4abe481e130d7be0574e45573de8beb7.png +0 -0
- package/dist/95ee2260a509cd630d89c5367ed1973b.png +0 -0
- package/dist/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
- package/dist/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
- package/dist/stats.json +45855 -0
- package/dist/tntd.css +1 -0
- package/dist/tntd.js +15 -0
- package/es/ArrayInput/README.md +129 -0
- package/es/ArrayInput/icon.js +24 -0
- package/es/ArrayInput/index.js +282 -0
- package/es/ArrayInput/index.less +20 -0
- package/es/AuthContext.js +4 -0
- package/es/Columns/README.md +149 -0
- package/es/Columns/index.js +86 -0
- package/es/Columns/index.less +75 -0
- package/es/DevelopmentLogin/LoginModal.js +126 -0
- package/es/DevelopmentLogin/README.md +49 -0
- package/es/DevelopmentLogin/index.js +40 -0
- package/es/Ellipsis/README.md +104 -0
- package/es/Ellipsis/Svg/CopySVG.js +63 -0
- package/es/Ellipsis/Svg/TickSVG.js +41 -0
- package/es/Ellipsis/index.js +143 -0
- package/es/Ellipsis/index.less +56 -0
- package/es/Handle/README.md +104 -0
- package/es/Handle/index.js +92 -0
- package/es/Handle/index.less +9 -0
- package/es/Icon/README.md +119 -0
- package/es/Icon/fonts/demo.css +539 -0
- package/es/Icon/fonts/demo_index.html +3345 -0
- package/es/Icon/fonts/iconfont.css +569 -0
- package/es/Icon/fonts/iconfont.eot +0 -0
- package/es/Icon/fonts/iconfont.js +41 -0
- package/es/Icon/fonts/iconfont.json +975 -0
- package/es/Icon/fonts/iconfont.svg +440 -0
- package/es/Icon/fonts/iconfont.ttf +0 -0
- package/es/Icon/fonts/iconfont.woff +0 -0
- package/es/Icon/fonts/iconfont.woff2 +0 -0
- package/es/Icon/iconList.js +1 -0
- package/es/Icon/index.js +26 -0
- package/es/Icon/index.less +9 -0
- package/es/Img/Contain.js +69 -0
- package/es/Img/Cover.js +126 -0
- package/es/Img/README.md +131 -0
- package/es/Img/index.js +76 -0
- package/es/Layout/ActionsContext.js +3 -0
- package/es/Layout/AppList.js +233 -0
- package/es/Layout/Application.js +115 -0
- package/es/Layout/Avatar.js +116 -0
- package/es/Layout/CompatibleLanguage.js +179 -0
- package/es/Layout/EnterpriseLayout/Avatar.js +144 -0
- package/es/Layout/EnterpriseLayout/Language.js +81 -0
- package/es/Layout/EnterpriseLayout/Theme.js +77 -0
- package/es/Layout/EnterpriseLayout/index.js +31 -0
- package/es/Layout/GlobalNavigation/NavigationPopup.js +396 -0
- package/es/Layout/GlobalNavigation/index.js +137 -0
- package/es/Layout/Header.js +95 -0
- package/es/Layout/HeaderActions.js +107 -0
- package/es/Layout/HeaderNavs.js +93 -0
- package/es/Layout/HeaderTabs.js +264 -0
- package/es/Layout/Iconfont.js +4 -0
- package/es/Layout/Language.js +81 -0
- package/es/Layout/Layout.js +234 -0
- package/es/Layout/Logo.js +86 -0
- package/es/Layout/OrgAppList.js +310 -0
- package/es/Layout/README.md +783 -0
- package/es/Layout/SideMenu.js +340 -0
- package/es/Layout/Theme.js +107 -0
- package/es/Layout/checkAuth.js +29 -0
- package/es/Layout/createActions.js +39 -0
- package/es/Layout/images/avatar/empty.png +0 -0
- package/es/Layout/images/avatar/female1.png +0 -0
- package/es/Layout/images/avatar/female2.png +0 -0
- package/es/Layout/images/avatar/female3.png +0 -0
- package/es/Layout/images/avatar/female4.png +0 -0
- package/es/Layout/images/avatar/female5.png +0 -0
- package/es/Layout/images/avatar/female6.png +0 -0
- package/es/Layout/images/avatar/male1.png +0 -0
- package/es/Layout/images/avatar/male2.png +0 -0
- package/es/Layout/images/avatar/male3.png +0 -0
- package/es/Layout/images/avatar/male4.png +0 -0
- package/es/Layout/images/avatar/male5.png +0 -0
- package/es/Layout/images/avatar/male6.png +0 -0
- package/es/Layout/images/index.js +35 -0
- package/es/Layout/images/logo/baldur.svg +14 -0
- package/es/Layout/images/logo/bi.svg +14 -0
- package/es/Layout/images/logo/bridge.svg +15 -0
- package/es/Layout/images/logo/convert.svg +18 -0
- package/es/Layout/images/logo/dataocean.svg +31 -0
- package/es/Layout/images/logo/default.svg +19 -0
- package/es/Layout/images/logo/dispatch.svg +14 -0
- package/es/Layout/images/logo/graph.svg +26 -0
- package/es/Layout/images/logo/handle.svg +10 -0
- package/es/Layout/images/logo/indicator.svg +41 -0
- package/es/Layout/images/logo/kafka.svg +12 -0
- package/es/Layout/images/logo/logo-custom.svg +13 -0
- package/es/Layout/images/logo/model.svg +17 -0
- package/es/Layout/images/logo/mysql.svg +15 -0
- package/es/Layout/images/logo/orion.svg +24 -0
- package/es/Layout/images/logo/salaxy.svg +11 -0
- package/es/Layout/images/logo/storage.svg +16 -0
- package/es/Layout/images/logo/tnt_cli_identify.svg +19 -0
- package/es/Layout/images/logo/turing.svg +35 -0
- package/es/Layout/images/theme/theme1.svg +35 -0
- package/es/Layout/images/theme/theme2.svg +33 -0
- package/es/Layout/index.js +122 -0
- package/es/Layout/paaslayout/CompactSideMenu.js +167 -0
- package/es/Layout/paaslayout/Header.js +77 -0
- package/es/Layout/paaslayout/Logo.js +22 -0
- package/es/Layout/paaslayout/SideMenu.js +168 -0
- package/es/Layout/paaslayout/index.js +235 -0
- package/es/Layout/storage.js +47 -0
- package/es/Layout/utils.js +136 -0
- package/es/LoadingButton/README.md +75 -0
- package/es/LoadingButton/index.js +45 -0
- package/es/Modal/README.md +59 -0
- package/es/Modal/index.js +96 -0
- package/es/Modal/index.less +86 -0
- package/es/Page/Box.js +74 -0
- package/es/Page/README.md +180 -0
- package/es/Page/index.js +165 -0
- package/es/Page/index.less +144 -0
- package/es/Page/utils.js +23 -0
- package/es/QueryForm/Field/Checkbox.js +21 -0
- package/es/QueryForm/Field/Select.js +80 -0
- package/es/QueryForm/Field/SelectInput.js +92 -0
- package/es/QueryForm/Field/fieldsMap.js +32 -0
- package/es/QueryForm/Field/index.js +157 -0
- package/es/QueryForm/README.md +512 -0
- package/es/QueryForm/createActions.js +53 -0
- package/es/QueryForm/index.js +384 -0
- package/es/QueryForm/index.less +133 -0
- package/es/QueryForm/useForm.js +7 -0
- package/es/QueryListScene/List.js +378 -0
- package/es/QueryListScene/QueryForm.js +166 -0
- package/es/QueryListScene/QueryListScene.js +76 -0
- package/es/QueryListScene/README.md +790 -0
- package/es/QueryListScene/Title.js +12 -0
- package/es/QueryListScene/Toolbar.js +20 -0
- package/es/QueryListScene/createActions.js +72 -0
- package/es/QueryListScene/index.js +19 -0
- package/es/QueryListScene/index.less +97 -0
- package/es/QueryListScene/useActions.js +7 -0
- package/es/Select/DropDownWrap.js +116 -0
- package/es/Select/README.md +68 -0
- package/es/Select/index.js +622 -0
- package/es/Table/README.md +109 -0
- package/es/Table/ResizableTable/index.js +110 -0
- package/es/Table/ResizableTable/index.less +36 -0
- package/es/Table/index.js +35 -0
- package/es/Title/README.md +106 -0
- package/es/Title/index.js +40 -0
- package/es/Title/index.less +170 -0
- package/es/index.js +19 -0
- package/es/locale.js +60 -0
- package/package.json +1 -1
- package/doc-scripts.config.js +0 -37
- package/doc-scripts.renderer.js +0 -11
- package/docs/README.md +0 -1643
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
## ResizableTable
|
|
2
|
+
可伸缩列表格
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### 安装
|
|
6
|
+
```
|
|
7
|
+
npm install tntd --save
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### 代码演示
|
|
11
|
+
```jsx
|
|
12
|
+
import React, { useState, Fragment } from 'react';
|
|
13
|
+
import ReactDOM from 'react-dom';
|
|
14
|
+
import { Switch } from 'antd';
|
|
15
|
+
import { Table } from 'tntd';
|
|
16
|
+
import 'antd/dist/antd.css';
|
|
17
|
+
|
|
18
|
+
const TableDemo = () => {
|
|
19
|
+
const [resizable, setResizable] = useState(true);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<Switch checkedChildren="可伸缩列" unCheckedChildren="可伸缩列" checked={resizable} onChange={checked => setResizable(checked)} />
|
|
24
|
+
<Table
|
|
25
|
+
resizable={resizable}
|
|
26
|
+
rowKey="id"
|
|
27
|
+
bordered
|
|
28
|
+
columns={[
|
|
29
|
+
{ dataIndex: 'id', title: 'ID', width: 200 },
|
|
30
|
+
{ dataIndex: 'name', title: '名称', width: 120 },
|
|
31
|
+
{ dataIndex: 'job', title: '职业' },
|
|
32
|
+
{ dataIndex: 'operation', title: '操作', width: 80 }
|
|
33
|
+
]}
|
|
34
|
+
dataSource={[
|
|
35
|
+
{ id: 1, name: '张三' },
|
|
36
|
+
{ id: 2, name: '李四' }
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
ReactDOM.render(
|
|
44
|
+
<TableDemo />,
|
|
45
|
+
document.getElementById('root')
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Fixed column
|
|
50
|
+
```jsx
|
|
51
|
+
import React, { useState, Fragment, useRef, useEffect } from 'react';
|
|
52
|
+
import ReactDOM from 'react-dom';
|
|
53
|
+
import { Switch } from 'antd';
|
|
54
|
+
import { Table } from 'tntd';
|
|
55
|
+
import 'antd/dist/antd.css';
|
|
56
|
+
|
|
57
|
+
const TableDemo = () => {
|
|
58
|
+
const [resizable, setResizable] = useState(true);
|
|
59
|
+
const handleRef = (component) => {
|
|
60
|
+
console.log('handleRef:', component);
|
|
61
|
+
};
|
|
62
|
+
const tableRef = useRef();
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
console.log('tableRef:', tableRef);
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
console.log(tableRef)
|
|
67
|
+
})
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<Switch checkedChildren="可伸缩列" unCheckedChildren="可伸缩列" checked={resizable} onChange={checked => setResizable(checked)} />
|
|
73
|
+
<Table
|
|
74
|
+
resizable={resizable}
|
|
75
|
+
rowKey="id"
|
|
76
|
+
bordered
|
|
77
|
+
ref={tableRef || handleRef}
|
|
78
|
+
columns={[
|
|
79
|
+
{ dataIndex: 'id', title: 'ID', width: 200, fixed: 'left' },
|
|
80
|
+
{ dataIndex: 'name', title: '名称', width: 120 },
|
|
81
|
+
{ dataIndex: 'name1', title: '名称1', width: 200 },
|
|
82
|
+
{ dataIndex: 'name2', title: '名称2', width: 200 },
|
|
83
|
+
{ dataIndex: 'name3', title: '名称3', width: 200 },
|
|
84
|
+
{ dataIndex: 'name4', title: '名称4', width: 200 },
|
|
85
|
+
{ dataIndex: 'name5', title: '名称5', width: 200 },
|
|
86
|
+
{ dataIndex: 'name6', title: '名称6', width: 200 },
|
|
87
|
+
{ dataIndex: 'job', title: '职业', width: 200 },
|
|
88
|
+
{ dataIndex: 'operation', title: '操作', width: 80, fixed: 'right' }
|
|
89
|
+
]}
|
|
90
|
+
dataSource={[
|
|
91
|
+
{ id: 1, name: '张三' },
|
|
92
|
+
{ id: 2, name: '李四' }
|
|
93
|
+
]}
|
|
94
|
+
scroll={{ x: window.innerWidth - 260 }}
|
|
95
|
+
/>
|
|
96
|
+
</>
|
|
97
|
+
)
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
ReactDOM.render(
|
|
101
|
+
<TableDemo />,
|
|
102
|
+
document.getElementById('root')
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### API
|
|
107
|
+
#### Table
|
|
108
|
+
同antd Table
|
|
109
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import "antd/es/table/style";
|
|
2
|
+
import _Table from "antd/es/table";
|
|
3
|
+
|
|
4
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
|
+
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
7
|
+
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
9
|
+
|
|
10
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
11
|
+
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
|
|
22
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
23
|
+
|
|
24
|
+
import { useState, useEffect, forwardRef, useRef } from 'react';
|
|
25
|
+
import cn from 'classnames';
|
|
26
|
+
import { throttle } from 'lodash';
|
|
27
|
+
import { Resizable } from 'react-resizable';
|
|
28
|
+
import './index.less';
|
|
29
|
+
|
|
30
|
+
var ResizableTitle = function ResizableTitle(props) {
|
|
31
|
+
var onResize = props.onResize,
|
|
32
|
+
width = props.width,
|
|
33
|
+
restProps = _objectWithoutProperties(props, ["onResize", "width"]);
|
|
34
|
+
|
|
35
|
+
if (!width) {
|
|
36
|
+
return React.createElement("th", restProps);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return React.createElement(Resizable, {
|
|
40
|
+
width: width,
|
|
41
|
+
height: 0,
|
|
42
|
+
handle: React.createElement("span", {
|
|
43
|
+
className: "tnt-resizable-table-handle",
|
|
44
|
+
onClick: function onClick(e) {
|
|
45
|
+
return e.stopPropagation();
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
onResize: onResize,
|
|
49
|
+
draggableOpts: {
|
|
50
|
+
enableUserSelectHack: false
|
|
51
|
+
}
|
|
52
|
+
}, React.createElement("th", restProps));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default forwardRef(function (props, ref) {
|
|
56
|
+
var buildColumns = function buildColumns(columns) {
|
|
57
|
+
return columns.map(function (column, index) {
|
|
58
|
+
return _objectSpread({}, column, {
|
|
59
|
+
onHeaderCell: function onHeaderCell(column) {
|
|
60
|
+
return {
|
|
61
|
+
width: column.width,
|
|
62
|
+
onResize: handleResize(index)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var _useState = useState(buildColumns(props.columns)),
|
|
70
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
+
columns = _useState2[0],
|
|
72
|
+
setColumns = _useState2[1];
|
|
73
|
+
|
|
74
|
+
var dataRef = useRef({
|
|
75
|
+
columns: columns
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
var handleResize = function handleResize(index) {
|
|
79
|
+
return throttle(function (e, _ref) {
|
|
80
|
+
var size = _ref.size;
|
|
81
|
+
var columns = dataRef.current.columns;
|
|
82
|
+
setColumns(columns.map(function (column, idx) {
|
|
83
|
+
if (idx === index) {
|
|
84
|
+
return _objectSpread({}, column, {
|
|
85
|
+
width: size.width
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return column;
|
|
90
|
+
}));
|
|
91
|
+
}, 25);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
setColumns(buildColumns(props.columns));
|
|
96
|
+
}, [props.columns]);
|
|
97
|
+
useEffect(function () {
|
|
98
|
+
dataRef.current.columns = columns;
|
|
99
|
+
}, [columns]);
|
|
100
|
+
return React.createElement(_Table, _extends({}, props, {
|
|
101
|
+
className: cn('tnt-resizable-table', _defineProperty({}, props.className, props.className)),
|
|
102
|
+
components: {
|
|
103
|
+
header: {
|
|
104
|
+
cell: ResizableTitle
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
columns: columns,
|
|
108
|
+
ref: ref
|
|
109
|
+
}));
|
|
110
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.tnt-resizable-table {
|
|
2
|
+
.react-resizable {
|
|
3
|
+
position: relative;
|
|
4
|
+
background-clip: padding-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&-handle {
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 10px;
|
|
10
|
+
height: 100%;
|
|
11
|
+
bottom: 0;
|
|
12
|
+
right: -5px;
|
|
13
|
+
cursor: col-resize;
|
|
14
|
+
z-index: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
th:last-of-type{
|
|
18
|
+
.react-resizable-handle {
|
|
19
|
+
right: 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// tbody > tr > td > *,
|
|
23
|
+
.ant-table-column-title{
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
}
|
|
28
|
+
.ant-table-column-sorters {
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
text-overflow: ellipsis;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
align-items: center;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "antd/es/table/style";
|
|
2
|
+
import _Table from "antd/es/table";
|
|
3
|
+
|
|
4
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
|
|
6
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
|
+
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
|
|
12
|
+
import React, { forwardRef } from 'react';
|
|
13
|
+
import cn from 'classnames';
|
|
14
|
+
import ResizableTable from './ResizableTable'; // const ResizableTable = React.lazy(() => import('./ResizableTable'));
|
|
15
|
+
|
|
16
|
+
export default forwardRef(function (_ref, ref) {
|
|
17
|
+
var _ref$resizable = _ref.resizable,
|
|
18
|
+
resizable = _ref$resizable === void 0 ? false : _ref$resizable,
|
|
19
|
+
props = _objectWithoutProperties(_ref, ["resizable"]);
|
|
20
|
+
|
|
21
|
+
if (resizable) {
|
|
22
|
+
return (// <React.Suspense>
|
|
23
|
+
React.createElement(ResizableTable, _extends({}, props, {
|
|
24
|
+
ref: ref
|
|
25
|
+
})) // </React.Suspense>
|
|
26
|
+
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return React.createElement(_Table, _extends({
|
|
31
|
+
className: cn('tnt-table', _defineProperty({}, props.className, props.className))
|
|
32
|
+
}, props, {
|
|
33
|
+
ref: ref
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
## Title组件
|
|
2
|
+
### 代码演示
|
|
3
|
+
```jsx
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import { Button, Table } from 'antd';
|
|
7
|
+
import { Title } from 'tntd';
|
|
8
|
+
import 'antd/dist/antd.css';
|
|
9
|
+
|
|
10
|
+
const Demo = props => {
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
<Title
|
|
15
|
+
title='这是标题'
|
|
16
|
+
subTitle='这是描述,相当于副标题'
|
|
17
|
+
tooltip='test'
|
|
18
|
+
placement="right"
|
|
19
|
+
size='large'
|
|
20
|
+
extra={<Button>这是extra信息</Button>}
|
|
21
|
+
style={{marginBottom:'20px'}}
|
|
22
|
+
/>
|
|
23
|
+
<br/>
|
|
24
|
+
<Title
|
|
25
|
+
title='这是标题'
|
|
26
|
+
subTitle='这是描述,相当于副标题'
|
|
27
|
+
tooltip='test'
|
|
28
|
+
placement="right"
|
|
29
|
+
size='middle'
|
|
30
|
+
extra={<Button>这是extra信息</Button>}
|
|
31
|
+
/>
|
|
32
|
+
<br/>
|
|
33
|
+
<Title
|
|
34
|
+
title='这是标题'
|
|
35
|
+
subTitle='这是描述,相当于副标题'
|
|
36
|
+
tooltip='test'
|
|
37
|
+
placement="right"
|
|
38
|
+
/>
|
|
39
|
+
<br/>
|
|
40
|
+
<Title
|
|
41
|
+
title='这是标题'
|
|
42
|
+
subTitle='这是描述,相当于副标题'
|
|
43
|
+
tooltip='test'
|
|
44
|
+
placement="right"
|
|
45
|
+
size='small'
|
|
46
|
+
/>
|
|
47
|
+
<br/>
|
|
48
|
+
<Title
|
|
49
|
+
title='这是标题'
|
|
50
|
+
subTitle='这是描述,相当于副标题'
|
|
51
|
+
tooltip='test'
|
|
52
|
+
placement="right"
|
|
53
|
+
size='large'
|
|
54
|
+
number={1}
|
|
55
|
+
/>
|
|
56
|
+
<br/>
|
|
57
|
+
<Title
|
|
58
|
+
title='这是标题'
|
|
59
|
+
subTitle='这是描述,相当于副标题'
|
|
60
|
+
tooltip='test'
|
|
61
|
+
placement="right"
|
|
62
|
+
size='middle'
|
|
63
|
+
number={2}
|
|
64
|
+
/>
|
|
65
|
+
<br/>
|
|
66
|
+
<Title
|
|
67
|
+
title='这是标题'
|
|
68
|
+
subTitle='这是描述,相当于副标题'
|
|
69
|
+
tooltip='test'
|
|
70
|
+
placement="right"
|
|
71
|
+
number={3}
|
|
72
|
+
/>
|
|
73
|
+
<br/>
|
|
74
|
+
<Title
|
|
75
|
+
title='这是标题'
|
|
76
|
+
subTitle='这是描述,相当于副标题'
|
|
77
|
+
tooltip='test'
|
|
78
|
+
placement="right"
|
|
79
|
+
size='small'
|
|
80
|
+
number={4}
|
|
81
|
+
simple
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
ReactDOM.render(
|
|
89
|
+
<Demo />,
|
|
90
|
+
document.getElementById('root')
|
|
91
|
+
);
|
|
92
|
+
```
|
|
93
|
+
### API
|
|
94
|
+
#### common
|
|
95
|
+
| 属性名称 | 属性说明 | 类型 | 默认值 | 是否必须 |
|
|
96
|
+
| :---------- | :------------------------- | :------ | :---------- | :------- |
|
|
97
|
+
| title | 标题 | String | - | 否 |
|
|
98
|
+
| subTitle | 副标题 | String | - | 否 |
|
|
99
|
+
| number | 标题前是数字 | Number | - | 否 |
|
|
100
|
+
| size | 大小,large、middle、default、small | String | default | 否 |
|
|
101
|
+
| extra | 右边区域内容 | React node | - | 否 |
|
|
102
|
+
|
|
103
|
+
#### number
|
|
104
|
+
| 属性名称 | 属性说明 | 类型 | 默认值 | 是否必须 |
|
|
105
|
+
| :---------- | :------------------------- | :------ | :---------- | :------- |
|
|
106
|
+
| simple | 当数字时,是否有斜杆 | Bool | true | 否 |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
|
|
11
|
+
import cn from 'classnames';
|
|
12
|
+
import './index.less';
|
|
13
|
+
export default (function (props) {
|
|
14
|
+
var _ref = props || {},
|
|
15
|
+
_ref$title = _ref.title,
|
|
16
|
+
title = _ref$title === void 0 ? '暂无标题' : _ref$title,
|
|
17
|
+
subTitle = _ref.subTitle,
|
|
18
|
+
_ref$size = _ref.size,
|
|
19
|
+
size = _ref$size === void 0 ? 'default' : _ref$size,
|
|
20
|
+
extra = _ref.extra,
|
|
21
|
+
number = _ref.number,
|
|
22
|
+
simple = _ref.simple,
|
|
23
|
+
style = _ref.style,
|
|
24
|
+
rest = _objectWithoutProperties(_ref, ["title", "subTitle", "size", "extra", "number", "simple", "style"]);
|
|
25
|
+
|
|
26
|
+
return React.createElement("div", {
|
|
27
|
+
className: cn('tnt-title', size, {
|
|
28
|
+
'has-number': number
|
|
29
|
+
}, {
|
|
30
|
+
'is-simple': simple
|
|
31
|
+
}),
|
|
32
|
+
style: _objectSpread({}, style)
|
|
33
|
+
}, React.createElement("div", {
|
|
34
|
+
className: "tnt-title-text"
|
|
35
|
+
}, number && React.createElement("i", {
|
|
36
|
+
"class": "count"
|
|
37
|
+
}, number <= 9 ? "0".concat(number) : number), React.createElement("h3", null, title), React.createElement("span", null, subTitle)), extra && React.createElement("div", {
|
|
38
|
+
className: "tnt-title-extra"
|
|
39
|
+
}, extra));
|
|
40
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
.tnt-title {
|
|
2
|
+
& {
|
|
3
|
+
position: relative;
|
|
4
|
+
height: 32px;
|
|
5
|
+
line-height: 32px;
|
|
6
|
+
clear: both;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.has-number{
|
|
11
|
+
.tnt-title-text {
|
|
12
|
+
h3 {
|
|
13
|
+
margin-left: 0;
|
|
14
|
+
}
|
|
15
|
+
&::before {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
&.is-simple {
|
|
20
|
+
.count::before {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
&.small {
|
|
25
|
+
.count {
|
|
26
|
+
font-size: 20px;
|
|
27
|
+
margin-right: 12px;
|
|
28
|
+
&::before {
|
|
29
|
+
width: 20px;
|
|
30
|
+
height: 15px;
|
|
31
|
+
top: 44%;
|
|
32
|
+
left: 60%;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
&.middle {
|
|
37
|
+
.count {
|
|
38
|
+
font-size: 24px;
|
|
39
|
+
margin-right: 12px;
|
|
40
|
+
&::before {
|
|
41
|
+
width: 24px;
|
|
42
|
+
height: 15px;
|
|
43
|
+
left: 56%;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
&.large {
|
|
48
|
+
.count {
|
|
49
|
+
font-size: 28px;
|
|
50
|
+
margin-right: 12px;
|
|
51
|
+
&::before {
|
|
52
|
+
width: 28px;
|
|
53
|
+
height: 18px;
|
|
54
|
+
left: 56%;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
.count {
|
|
59
|
+
position: relative;
|
|
60
|
+
top: -1px;
|
|
61
|
+
color: #0089ff;
|
|
62
|
+
font-size: 22px;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
margin-right: 12px;
|
|
65
|
+
position: relative;
|
|
66
|
+
vertical-align: top;
|
|
67
|
+
font-weight: 400;
|
|
68
|
+
font-family: Roboto,'Helvetica Neue',Helvetica,Tahoma,Arial,'PingFang SC','Microsoft YaHei'!important;
|
|
69
|
+
letter-spacing: 1px;
|
|
70
|
+
}
|
|
71
|
+
.count::before {
|
|
72
|
+
position: absolute;
|
|
73
|
+
display: block;
|
|
74
|
+
content: "";
|
|
75
|
+
width: 22px;
|
|
76
|
+
height: 15px;
|
|
77
|
+
border-top: 1px solid #0089ff;
|
|
78
|
+
background-color: #fff;
|
|
79
|
+
top: 45%;
|
|
80
|
+
left: 58%;
|
|
81
|
+
transform: rotate(-45deg);
|
|
82
|
+
-webkit-transform: rotate(-45deg);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
&.small {
|
|
86
|
+
& {
|
|
87
|
+
height: 28px;
|
|
88
|
+
line-height: 28px;
|
|
89
|
+
}
|
|
90
|
+
.tnt-title-text {
|
|
91
|
+
h3 {
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
}
|
|
94
|
+
&::before {
|
|
95
|
+
height: 14px;
|
|
96
|
+
top: 7px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
&.middle {
|
|
101
|
+
& {
|
|
102
|
+
height: 36px;
|
|
103
|
+
line-height: 36px;
|
|
104
|
+
}
|
|
105
|
+
.tnt-title-text {
|
|
106
|
+
h3 {
|
|
107
|
+
font-size: 18px;
|
|
108
|
+
}
|
|
109
|
+
&::before {
|
|
110
|
+
height: 18px;
|
|
111
|
+
top: 9px;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
&.large {
|
|
116
|
+
& {
|
|
117
|
+
height: 40px;
|
|
118
|
+
line-height: 40px;
|
|
119
|
+
}
|
|
120
|
+
.tnt-title-text {
|
|
121
|
+
h3 {
|
|
122
|
+
font-size: 20px;
|
|
123
|
+
}
|
|
124
|
+
&::before {
|
|
125
|
+
height: 20px;
|
|
126
|
+
top: 9px;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
.tnt-title-text {
|
|
131
|
+
& {
|
|
132
|
+
position: relative;
|
|
133
|
+
float: left;
|
|
134
|
+
}
|
|
135
|
+
h3 {
|
|
136
|
+
font-size: 16px;
|
|
137
|
+
color: #17233D;
|
|
138
|
+
font-weight: normal;
|
|
139
|
+
margin: 0;
|
|
140
|
+
margin-right: 10px;
|
|
141
|
+
margin-left: 10px;
|
|
142
|
+
display: inline-block;
|
|
143
|
+
}
|
|
144
|
+
span {
|
|
145
|
+
position: relative;
|
|
146
|
+
top: 1px;
|
|
147
|
+
font-size: 12px;
|
|
148
|
+
color:#8b919e;
|
|
149
|
+
margin-right: 10px;
|
|
150
|
+
line-height: 1;
|
|
151
|
+
}
|
|
152
|
+
&::before {
|
|
153
|
+
position: absolute;
|
|
154
|
+
left: 0;
|
|
155
|
+
top: 8px;
|
|
156
|
+
background-color: #126BFB;
|
|
157
|
+
content: "";
|
|
158
|
+
width: 3px;
|
|
159
|
+
height: 16px;
|
|
160
|
+
margin-right: 8px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
.tnt-title-extra {
|
|
164
|
+
& {
|
|
165
|
+
position: relative;
|
|
166
|
+
float: right;
|
|
167
|
+
margin-left: 8px;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
package/es/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { default as Layout } from './Layout';
|
|
2
|
+
export { default as AuthContext } from './AuthContext';
|
|
3
|
+
export { default as QueryForm } from './QueryForm';
|
|
4
|
+
export { default as Table } from './Table';
|
|
5
|
+
export { default as ResizableTable } from './Table/ResizableTable';
|
|
6
|
+
export { default as QueryListScene } from './QueryListScene';
|
|
7
|
+
export { default as Icon } from './Icon';
|
|
8
|
+
export { default as iconList } from './Icon/iconList';
|
|
9
|
+
export { default as Modal } from './Modal';
|
|
10
|
+
export { default as Columns } from './Columns';
|
|
11
|
+
export { default as DevelopmentLogin } from './DevelopmentLogin';
|
|
12
|
+
export { default as LoadingButton } from './LoadingButton';
|
|
13
|
+
export { default as Handle } from './Handle';
|
|
14
|
+
export { default as Page } from './Page';
|
|
15
|
+
export { default as Select } from './Select';
|
|
16
|
+
export { default as Img } from './Img';
|
|
17
|
+
export { default as Title } from './Title';
|
|
18
|
+
export { default as Ellipsis } from './Ellipsis';
|
|
19
|
+
export { default as ArrayInput } from './ArrayInput';
|
package/es/locale.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export var zh_CN = {
|
|
2
|
+
globalNavigation: '全局导航',
|
|
3
|
+
menuSearch: '菜单搜索',
|
|
4
|
+
// QueryForm
|
|
5
|
+
search: '搜索',
|
|
6
|
+
reset: '重置',
|
|
7
|
+
moreFiltering: '更多过滤',
|
|
8
|
+
expand: '展开',
|
|
9
|
+
collapse: '收起',
|
|
10
|
+
// QueryListScene
|
|
11
|
+
totalRecords: '共%s条记录',
|
|
12
|
+
// user popover
|
|
13
|
+
personalSettings: '个人设置',
|
|
14
|
+
changePwd: '修改密码',
|
|
15
|
+
signOut: '退出'
|
|
16
|
+
};
|
|
17
|
+
export var en_US = {
|
|
18
|
+
globalNavigation: 'Global Navigation',
|
|
19
|
+
menuSearch: 'Menu Search',
|
|
20
|
+
// QueryForm
|
|
21
|
+
search: 'Search',
|
|
22
|
+
reset: 'Reset',
|
|
23
|
+
moreFiltering: 'More filtering',
|
|
24
|
+
expand: 'Expand',
|
|
25
|
+
collapse: 'Collapse',
|
|
26
|
+
// QueryListScene
|
|
27
|
+
totalRecords: 'Total of %s records',
|
|
28
|
+
// user popover
|
|
29
|
+
personalSettings: 'Personal settings',
|
|
30
|
+
changePwd: 'Change password',
|
|
31
|
+
signOut: 'Sign out'
|
|
32
|
+
};
|
|
33
|
+
export var getText = function getText(key) {
|
|
34
|
+
var _ref;
|
|
35
|
+
|
|
36
|
+
var language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'cn';
|
|
37
|
+
var text = (_ref = {
|
|
38
|
+
cn: zh_CN,
|
|
39
|
+
en: en_US
|
|
40
|
+
}[language] || zh_CN) == null ? void 0 : _ref[key];
|
|
41
|
+
|
|
42
|
+
for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
43
|
+
params[_key - 2] = arguments[_key];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (params == null ? void 0 : params.length) {
|
|
47
|
+
return params.reduce(function (acc, cur) {
|
|
48
|
+
return acc.replace(/%s/, cur);
|
|
49
|
+
}, text);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return text;
|
|
53
|
+
};
|
|
54
|
+
export var getLanguage = function getLanguage() {
|
|
55
|
+
return localStorage.getItem('lang') || 'cn';
|
|
56
|
+
};
|
|
57
|
+
export default {
|
|
58
|
+
en_US: en_US,
|
|
59
|
+
zh_CN: zh_CN
|
|
60
|
+
};
|