@lemon-fe/components 0.0.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/README.md +11 -0
- package/es/Actions/index.d.ts +25 -0
- package/es/Actions/index.js +164 -0
- package/es/Actions/index.less +82 -0
- package/es/BaseTable/BaseTableContext.d.ts +6 -0
- package/es/BaseTable/BaseTableContext.js +6 -0
- package/es/BaseTable/ResizeHeaderCell.d.ts +8 -0
- package/es/BaseTable/ResizeHeaderCell.js +115 -0
- package/es/BaseTable/Sort.d.ts +10 -0
- package/es/BaseTable/Sort.js +122 -0
- package/es/BaseTable/VirtualBody.d.ts +8 -0
- package/es/BaseTable/VirtualBody.js +165 -0
- package/es/BaseTable/index.d.ts +7 -0
- package/es/BaseTable/index.js +371 -0
- package/es/BaseTable/index.less +103 -0
- package/es/BaseTable/typings.d.ts +32 -0
- package/es/BaseTable/utils.d.ts +4 -0
- package/es/BaseTable/utils.js +26 -0
- package/es/DurationPicker/index.d.ts +26 -0
- package/es/DurationPicker/index.js +234 -0
- package/es/DurationPicker/index.less +63 -0
- package/es/EditableTable/EditableCell.d.ts +11 -0
- package/es/EditableTable/EditableCell.js +37 -0
- package/es/EditableTable/EditableTableFormItem.d.ts +6 -0
- package/es/EditableTable/EditableTableFormItem.js +49 -0
- package/es/EditableTable/Table.d.ts +7 -0
- package/es/EditableTable/Table.js +363 -0
- package/es/EditableTable/index.d.ts +9 -0
- package/es/EditableTable/index.js +8 -0
- package/es/EditableTable/index.less +19 -0
- package/es/EditableTable/typings.d.ts +86 -0
- package/es/EditableTable/util.d.ts +25 -0
- package/es/EditableTable/util.js +387 -0
- package/es/Filter/index.d.ts +7 -0
- package/es/Filter/index.js +469 -0
- package/es/Filter/index.less +77 -0
- package/es/Filter/typings.d.ts +27 -0
- package/es/FormLayout/index.d.ts +32 -0
- package/es/FormLayout/index.js +41 -0
- package/es/FormLayout/index.less +89 -0
- package/es/Icons/DarkSearch.d.ts +5 -0
- package/es/Icons/DarkSearch.js +38 -0
- package/es/Icons/Down.d.ts +5 -0
- package/es/Icons/Down.js +30 -0
- package/es/Icons/Empty.d.ts +2 -0
- package/es/Icons/Empty.js +267 -0
- package/es/Icons/Search.d.ts +5 -0
- package/es/Icons/Search.js +39 -0
- package/es/Icons/Tip.d.ts +6 -0
- package/es/Icons/Tip.js +169 -0
- package/es/Icons/index.d.ts +12 -0
- package/es/Icons/index.js +13 -0
- package/es/InputMaxLength/index.d.ts +14 -0
- package/es/InputMaxLength/index.js +92 -0
- package/es/InputMaxLength/index.less +8 -0
- package/es/Layout/index.d.ts +21 -0
- package/es/Layout/index.js +35 -0
- package/es/Layout/index.less +92 -0
- package/es/PageLoading/index.d.ts +5 -0
- package/es/PageLoading/index.js +15 -0
- package/es/PageLoading/index.less +10 -0
- package/es/Popup/index.d.ts +27 -0
- package/es/Popup/index.js +191 -0
- package/es/Popup/index.less +14 -0
- package/es/Section/index.d.ts +54 -0
- package/es/Section/index.js +111 -0
- package/es/Section/index.less +177 -0
- package/es/SiderTree/TreeNodeTitle.d.ts +9 -0
- package/es/SiderTree/TreeNodeTitle.js +124 -0
- package/es/SiderTree/index.d.ts +35 -0
- package/es/SiderTree/index.js +237 -0
- package/es/SiderTree/index.less +170 -0
- package/es/SiderTree/typings.d.ts +19 -0
- package/es/Table/index.d.ts +3 -0
- package/es/Table/index.js +224 -0
- package/es/Table/index.less +1 -0
- package/es/Table/typings.d.ts +26 -0
- package/es/Table/utils.d.ts +2 -0
- package/es/Table/utils.js +3 -0
- package/es/TipMark/index.d.ts +10 -0
- package/es/TipMark/index.js +45 -0
- package/es/TipMark/index.less +8 -0
- package/es/constants.d.ts +1 -0
- package/es/constants.js +1 -0
- package/es/index.d.ts +21 -0
- package/es/index.js +17 -0
- package/es/index.less +50 -0
- package/es/init.d.ts +3 -0
- package/es/init.js +100 -0
- package/es/theme.less +13 -0
- package/package.json +43 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var _excluded = ["value", "onChange", "component", "children", "formatLabel", "disabled", "allowClear", "autoFocus", "showLabel", "beforeOk", "placeholder", "onClick", "disabledTip"];
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
+
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
|
|
13
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
+
|
|
15
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
|
|
19
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
|
+
|
|
21
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
22
|
+
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
import React, { useState, createElement, cloneElement, useRef } from 'react';
|
|
30
|
+
import { Modal, Input, message } from 'antd';
|
|
31
|
+
import { CloseCircleFilled } from '@ant-design/icons';
|
|
32
|
+
import { PREFIX_CLS } from '../constants';
|
|
33
|
+
import SearchIcon from '../Icons/Search';
|
|
34
|
+
|
|
35
|
+
function Popup(props) {
|
|
36
|
+
var valueProp = props.value,
|
|
37
|
+
onChange = props.onChange,
|
|
38
|
+
component = props.component,
|
|
39
|
+
children = props.children,
|
|
40
|
+
formatLabel = props.formatLabel,
|
|
41
|
+
_props$disabled = props.disabled,
|
|
42
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
43
|
+
_props$allowClear = props.allowClear,
|
|
44
|
+
allowClear = _props$allowClear === void 0 ? false : _props$allowClear,
|
|
45
|
+
autoFocus = props.autoFocus,
|
|
46
|
+
_props$showLabel = props.showLabel,
|
|
47
|
+
showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
|
|
48
|
+
beforeOk = props.beforeOk,
|
|
49
|
+
placeholder = props.placeholder,
|
|
50
|
+
onClick = props.onClick,
|
|
51
|
+
disabledTip = props.disabledTip,
|
|
52
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
53
|
+
|
|
54
|
+
var prefixCls = "".concat(PREFIX_CLS, "-popup");
|
|
55
|
+
|
|
56
|
+
var _useState = useState(valueProp),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
value = _useState2[0],
|
|
59
|
+
setValue = _useState2[1];
|
|
60
|
+
|
|
61
|
+
var _useState3 = useState(false),
|
|
62
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
+
visible = _useState4[0],
|
|
64
|
+
setVisible = _useState4[1];
|
|
65
|
+
|
|
66
|
+
var inputRef = useRef(null);
|
|
67
|
+
|
|
68
|
+
var handleCancel = function handleCancel() {
|
|
69
|
+
setVisible(false);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var handleOpen = function handleOpen() {
|
|
73
|
+
if (onClick) {
|
|
74
|
+
onClick();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (disabled) {
|
|
78
|
+
if (disabledTip) {
|
|
79
|
+
message.warning(disabledTip);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (valueProp) {
|
|
86
|
+
setValue(valueProp);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
setVisible(true);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var handleOk = /*#__PURE__*/function () {
|
|
93
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
94
|
+
var res;
|
|
95
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
96
|
+
while (1) {
|
|
97
|
+
switch (_context.prev = _context.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
setVisible(false);
|
|
100
|
+
|
|
101
|
+
if (!onChange) {
|
|
102
|
+
_context.next = 10;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (!(beforeOk && value)) {
|
|
107
|
+
_context.next = 9;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_context.next = 5;
|
|
112
|
+
return beforeOk(value);
|
|
113
|
+
|
|
114
|
+
case 5:
|
|
115
|
+
res = _context.sent;
|
|
116
|
+
onChange(res);
|
|
117
|
+
_context.next = 10;
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
case 9:
|
|
121
|
+
onChange(value);
|
|
122
|
+
|
|
123
|
+
case 10:
|
|
124
|
+
if (inputRef.current) {
|
|
125
|
+
inputRef.current.focus();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
case 11:
|
|
129
|
+
case "end":
|
|
130
|
+
return _context.stop();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, _callee);
|
|
134
|
+
}));
|
|
135
|
+
|
|
136
|
+
return function handleOk() {
|
|
137
|
+
return _ref.apply(this, arguments);
|
|
138
|
+
};
|
|
139
|
+
}();
|
|
140
|
+
|
|
141
|
+
var handleClear = function handleClear(e) {
|
|
142
|
+
e.stopPropagation();
|
|
143
|
+
|
|
144
|
+
if (onChange) {
|
|
145
|
+
onChange(undefined);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
var label = valueProp ? formatLabel ? formatLabel(valueProp) : valueProp : undefined;
|
|
150
|
+
var trigger;
|
|
151
|
+
|
|
152
|
+
if (children) {
|
|
153
|
+
trigger = showLabel ? /*#__PURE__*/cloneElement(children, undefined, label) : children;
|
|
154
|
+
} else {
|
|
155
|
+
trigger = /*#__PURE__*/React.createElement(Input, {
|
|
156
|
+
className: "".concat(prefixCls, "-input"),
|
|
157
|
+
value: label,
|
|
158
|
+
readOnly: true,
|
|
159
|
+
ref: inputRef,
|
|
160
|
+
disabled: disabled,
|
|
161
|
+
autoFocus: autoFocus,
|
|
162
|
+
placeholder: placeholder,
|
|
163
|
+
suffix: /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && allowClear && label && /*#__PURE__*/React.createElement(CloseCircleFilled, {
|
|
164
|
+
className: "ant-input-clear-icon",
|
|
165
|
+
onClick: handleClear
|
|
166
|
+
}), /*#__PURE__*/React.createElement(SearchIcon, null))
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: "".concat(prefixCls, "-wrapper"),
|
|
172
|
+
onClick: handleOpen
|
|
173
|
+
}, trigger), /*#__PURE__*/React.createElement(Modal, _objectSpread({
|
|
174
|
+
destroyOnClose: true,
|
|
175
|
+
visible: visible,
|
|
176
|
+
width: 896,
|
|
177
|
+
centered: true,
|
|
178
|
+
onCancel: handleCancel,
|
|
179
|
+
onOk: handleOk,
|
|
180
|
+
bodyStyle: {
|
|
181
|
+
height: '549px',
|
|
182
|
+
padding: 0,
|
|
183
|
+
backgroundColor: '#f9f9f9'
|
|
184
|
+
}
|
|
185
|
+
}, restProps), /*#__PURE__*/createElement(component, {
|
|
186
|
+
value: value,
|
|
187
|
+
onChange: setValue
|
|
188
|
+
})));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export default Popup;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Key } from 'react';
|
|
2
|
+
import type { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { TabsProps } from 'antd';
|
|
4
|
+
interface Props extends Pick<TabsProps, 'activeKey' | 'onTabClick'> {
|
|
5
|
+
/**
|
|
6
|
+
* @description 标题
|
|
7
|
+
*/
|
|
8
|
+
title?: string | ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* @description 内容
|
|
11
|
+
*/
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* @description 容器样式
|
|
15
|
+
*/
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
/**
|
|
18
|
+
* @description 容器样式
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @description 暂未实现
|
|
23
|
+
*/
|
|
24
|
+
footer?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* @description 当内部有表头固定的表格时,可以考虑这个
|
|
27
|
+
*/
|
|
28
|
+
type?: 'table';
|
|
29
|
+
/**
|
|
30
|
+
* @description tabs
|
|
31
|
+
*/
|
|
32
|
+
tabs?: {
|
|
33
|
+
title?: string;
|
|
34
|
+
key: string;
|
|
35
|
+
}[];
|
|
36
|
+
/**
|
|
37
|
+
* @description body元素的样式
|
|
38
|
+
*/
|
|
39
|
+
bodyStyle?: CSSProperties;
|
|
40
|
+
/**
|
|
41
|
+
* @description 标签切换事件
|
|
42
|
+
*/
|
|
43
|
+
onTabChange?: (activeKey: Key, activeIndex: number) => void;
|
|
44
|
+
/**
|
|
45
|
+
* @description 操作栏,请与Actions组件结合使用并且带有标题,请不要在Tabs模式时使用
|
|
46
|
+
*/
|
|
47
|
+
actions?: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* @description 同 style flex属性, 为true时 flex = 1
|
|
50
|
+
*/
|
|
51
|
+
flex?: boolean | number;
|
|
52
|
+
}
|
|
53
|
+
export default function Section(props: Props): JSX.Element;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : 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
|
+
import React from 'react';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import { Tabs } from 'antd';
|
|
10
|
+
import { PREFIX_CLS } from '../constants';
|
|
11
|
+
export default function Section(props) {
|
|
12
|
+
var _classNames;
|
|
13
|
+
|
|
14
|
+
var title = props.title,
|
|
15
|
+
children = props.children,
|
|
16
|
+
style = props.style,
|
|
17
|
+
className = props.className,
|
|
18
|
+
tabs = props.tabs,
|
|
19
|
+
type = props.type,
|
|
20
|
+
bodyStyle = props.bodyStyle,
|
|
21
|
+
onTabChange = props.onTabChange,
|
|
22
|
+
actions = props.actions,
|
|
23
|
+
flex = props.flex,
|
|
24
|
+
activeKey = props.activeKey,
|
|
25
|
+
onTabClick = props.onTabClick;
|
|
26
|
+
var prefixCls = PREFIX_CLS + '-section';
|
|
27
|
+
var containerStyle = style;
|
|
28
|
+
|
|
29
|
+
if (flex) {
|
|
30
|
+
containerStyle = _objectSpread({
|
|
31
|
+
flex: typeof flex === 'number' ? flex : 1
|
|
32
|
+
}, containerStyle);
|
|
33
|
+
} // 不使用Children.map的原因是由于它会给子节点生成一个key与tabs的activeTabKey无法对应
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var mapChildren = function mapChildren(children, cb) {
|
|
37
|
+
var nodes = [];
|
|
38
|
+
|
|
39
|
+
if (Array.isArray(children)) {
|
|
40
|
+
nodes = children;
|
|
41
|
+
} else {
|
|
42
|
+
nodes = [children];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return nodes.filter(function (item) {
|
|
46
|
+
return item !== null;
|
|
47
|
+
}).map(cb);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var hasActions = !!actions;
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(type), !!type), _defineProperty(_classNames, "".concat(prefixCls, "-flex"), !!flex), _defineProperty(_classNames, "".concat(prefixCls, "-with-actions"), hasActions), _classNames), className),
|
|
53
|
+
style: containerStyle
|
|
54
|
+
}, !!title || hasActions ? /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "".concat(prefixCls, "-header")
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: "".concat(prefixCls, "-title")
|
|
58
|
+
}, title), actions) : null, tabs !== undefined && tabs.length > 0 ? /*#__PURE__*/React.createElement(Tabs, {
|
|
59
|
+
activeKey: activeKey,
|
|
60
|
+
onTabClick: onTabClick,
|
|
61
|
+
renderTabBar: function renderTabBar(tabProps) {
|
|
62
|
+
var activeKey = tabProps.activeKey,
|
|
63
|
+
onTabClick = tabProps.onTabClick;
|
|
64
|
+
var active = tabs.findIndex(function (item) {
|
|
65
|
+
return item.key === activeKey;
|
|
66
|
+
});
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "".concat(prefixCls, "-tab")
|
|
69
|
+
}, tabs.map(function (_, index) {
|
|
70
|
+
var _classNames2;
|
|
71
|
+
|
|
72
|
+
var tab = tabs[index];
|
|
73
|
+
var key = tab.key;
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
key: key,
|
|
76
|
+
className: classNames("".concat(prefixCls, "-tab-item"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-tab-item-active"), active === index), _defineProperty(_classNames2, "".concat(prefixCls, "-tab-item-active-left"), index === active - 1), _defineProperty(_classNames2, "".concat(prefixCls, "-tab-item-active-right"), index === active + 1), _classNames2)),
|
|
77
|
+
onClick: function onClick(e) {
|
|
78
|
+
if (key !== null) {
|
|
79
|
+
onTabClick(key, e);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (key !== activeKey) {
|
|
83
|
+
if (onTabChange) {
|
|
84
|
+
onTabChange(tab.key, index);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: "".concat(prefixCls, "-tab-item-arc-left")
|
|
90
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: "".concat(prefixCls, "-tab-item-content")
|
|
92
|
+
}, tab.title), /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: "".concat(prefixCls, "-tab-item-arc-right")
|
|
94
|
+
}));
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
}, mapChildren(children, function (child, index) {
|
|
98
|
+
var _tabs$index = tabs[index],
|
|
99
|
+
tab = _tabs$index.title,
|
|
100
|
+
key = _tabs$index.key;
|
|
101
|
+
return /*#__PURE__*/React.createElement(Tabs.TabPane, {
|
|
102
|
+
tab: tab,
|
|
103
|
+
key: key,
|
|
104
|
+
className: "".concat(prefixCls, "-body"),
|
|
105
|
+
style: bodyStyle
|
|
106
|
+
}, child);
|
|
107
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "".concat(prefixCls, "-body"),
|
|
109
|
+
style: bodyStyle
|
|
110
|
+
}, children));
|
|
111
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
@import '../theme.less';
|
|
2
|
+
|
|
3
|
+
.@{prefixCls}-section {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
color: #333;
|
|
7
|
+
|
|
8
|
+
&-flex {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
min-height: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&-flex &-body {
|
|
15
|
+
flex: 1 1 100%;
|
|
16
|
+
overflow: auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-header {
|
|
20
|
+
display: flex;
|
|
21
|
+
margin-bottom: 8px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-title {
|
|
25
|
+
flex: 1;
|
|
26
|
+
font-weight: bold;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-with-actions &-header {
|
|
31
|
+
align-items: flex-end;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-body {
|
|
35
|
+
padding: @space;
|
|
36
|
+
background-color: #fff;
|
|
37
|
+
border-radius: 4px;
|
|
38
|
+
|
|
39
|
+
& > .@{prefixCls}-actions {
|
|
40
|
+
padding: 16px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
& > .@{prefixCls}-table {
|
|
44
|
+
overflow: auto;
|
|
45
|
+
border-radius: 6px 6px 0 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.ant-tabs-tabpane {
|
|
49
|
+
border-top-left-radius: 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&-footer {
|
|
54
|
+
padding: 10px 0;
|
|
55
|
+
background-color: #fff;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& > .ant-tabs {
|
|
59
|
+
flex: 1;
|
|
60
|
+
|
|
61
|
+
& > .ant-tabs-content-holder {
|
|
62
|
+
flex: 1;
|
|
63
|
+
|
|
64
|
+
.ant-tabs-content {
|
|
65
|
+
height: 100%;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&-tab {
|
|
71
|
+
position: relative;
|
|
72
|
+
left: 4px;
|
|
73
|
+
display: flex;
|
|
74
|
+
|
|
75
|
+
&-item {
|
|
76
|
+
position: relative;
|
|
77
|
+
z-index: 1;
|
|
78
|
+
padding: 0 8px;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
|
|
81
|
+
&-content {
|
|
82
|
+
position: relative;
|
|
83
|
+
z-index: 2;
|
|
84
|
+
height: 40px;
|
|
85
|
+
padding: 0 8px;
|
|
86
|
+
line-height: 40px;
|
|
87
|
+
background: #ededed;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&-arc-left {
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: 0;
|
|
93
|
+
left: 0;
|
|
94
|
+
z-index: 1;
|
|
95
|
+
width: 16px;
|
|
96
|
+
height: 40px;
|
|
97
|
+
background: #ededed;
|
|
98
|
+
transform-origin: 50% 50%;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&-arc-right {
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: 0;
|
|
104
|
+
right: 0;
|
|
105
|
+
z-index: 1;
|
|
106
|
+
width: 16px;
|
|
107
|
+
height: 40px;
|
|
108
|
+
background: #ededed;
|
|
109
|
+
transform-origin: 50% 50%;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&-active {
|
|
113
|
+
z-index: 2;
|
|
114
|
+
color: .primary(1) [];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&-active &-content {
|
|
118
|
+
background: #fff;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&-active &-arc-left {
|
|
122
|
+
background: #fff;
|
|
123
|
+
border-top-left-radius: 4px;
|
|
124
|
+
transform: skew(-10deg);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&-active &-arc-right {
|
|
128
|
+
background: #fff;
|
|
129
|
+
border-top-right-radius: 4px;
|
|
130
|
+
transform: skew(10deg);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&-active-left &-arc-right,
|
|
134
|
+
&:last-child &-arc-right {
|
|
135
|
+
border-top-right-radius: 4px;
|
|
136
|
+
transform: skew(10deg);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&-active-right &-arc-left,
|
|
140
|
+
&:first-child &-arc-left {
|
|
141
|
+
border-top-left-radius: 4px;
|
|
142
|
+
transform: skew(-10deg);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&-item + &-item::before {
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 14px;
|
|
149
|
+
left: 0;
|
|
150
|
+
z-index: 2;
|
|
151
|
+
display: block;
|
|
152
|
+
width: 1px;
|
|
153
|
+
height: 12px;
|
|
154
|
+
background: #dbdbdb;
|
|
155
|
+
content: '';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&-item-active::before,
|
|
159
|
+
&-item-active-right::before {
|
|
160
|
+
display: none !important;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.@{prefixCls}-section-table {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex: 1;
|
|
168
|
+
flex-direction: column;
|
|
169
|
+
min-height: 0;
|
|
170
|
+
|
|
171
|
+
.@{prefixCls}-section-body {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex: 1;
|
|
174
|
+
flex-direction: column;
|
|
175
|
+
min-height: 0;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OperationType, TreeData } from './typings';
|
|
3
|
+
interface Props<T> {
|
|
4
|
+
node: TreeData<T>;
|
|
5
|
+
prefixCls: string;
|
|
6
|
+
operation?: OperationType<T>;
|
|
7
|
+
}
|
|
8
|
+
export default function TreeNodeTitle<T>(props: Props<T>): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import { Popover } from 'antd';
|
|
14
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
15
|
+
export default function TreeNodeTitle(props) {
|
|
16
|
+
var _operation$others;
|
|
17
|
+
|
|
18
|
+
var item = props.node,
|
|
19
|
+
operation = props.operation,
|
|
20
|
+
prefixCls = props.prefixCls;
|
|
21
|
+
|
|
22
|
+
var _useState = useState(false),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
show = _useState2[0],
|
|
25
|
+
setShow = _useState2[1];
|
|
26
|
+
|
|
27
|
+
var _useState3 = useState(false),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
visible = _useState4[0],
|
|
30
|
+
setVisible = _useState4[1];
|
|
31
|
+
|
|
32
|
+
var trigger = useRef(null);
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
var _trigger$current, _title, _title2;
|
|
35
|
+
|
|
36
|
+
var handler = function handler() {
|
|
37
|
+
setShow(function (prev) {
|
|
38
|
+
return !prev;
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var title = (_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : _trigger$current.parentNode;
|
|
43
|
+
(_title = title) === null || _title === void 0 ? void 0 : _title.addEventListener('mouseenter', handler);
|
|
44
|
+
(_title2 = title) === null || _title2 === void 0 ? void 0 : _title2.addEventListener('mouseleave', handler);
|
|
45
|
+
return function () {
|
|
46
|
+
var _title3, _title4;
|
|
47
|
+
|
|
48
|
+
(_title3 = title) === null || _title3 === void 0 ? void 0 : _title3.removeEventListener('mouseenter', handler);
|
|
49
|
+
(_title4 = title) === null || _title4 === void 0 ? void 0 : _title4.removeEventListener('mouseleave', handler);
|
|
50
|
+
title = null;
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
if (!operation) {
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "".concat(prefixCls, "-title-content")
|
|
57
|
+
}, item.title);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var others = (_operation$others = operation.others) === null || _operation$others === void 0 ? void 0 : _operation$others.call(operation, item);
|
|
61
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "".concat(prefixCls, "-title-content"),
|
|
63
|
+
ref: trigger
|
|
64
|
+
}, item.title), /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: "".concat(prefixCls, "-title-operators"),
|
|
66
|
+
style: {
|
|
67
|
+
display: visible || show ? 'flex' : 'none'
|
|
68
|
+
},
|
|
69
|
+
onClick: function onClick(e) {
|
|
70
|
+
return e.stopPropagation();
|
|
71
|
+
}
|
|
72
|
+
}, others ? /*#__PURE__*/React.createElement(Popover, {
|
|
73
|
+
overlayClassName: "".concat(prefixCls, "-menu-popover"),
|
|
74
|
+
placement: "bottomLeft",
|
|
75
|
+
visible: visible,
|
|
76
|
+
trigger: "click",
|
|
77
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
onClick: function onClick() {
|
|
79
|
+
return setVisible(false);
|
|
80
|
+
}
|
|
81
|
+
}, others),
|
|
82
|
+
onVisibleChange: setVisible
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "".concat(prefixCls, "-title-operators-item"),
|
|
85
|
+
onClick: function onClick() {
|
|
86
|
+
return setVisible(true);
|
|
87
|
+
}
|
|
88
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
89
|
+
width: "7",
|
|
90
|
+
height: "7",
|
|
91
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
92
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
93
|
+
fill: "currentColor",
|
|
94
|
+
fillRule: "evenodd"
|
|
95
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
96
|
+
cx: "3.5",
|
|
97
|
+
cy: "3.5",
|
|
98
|
+
r: "1"
|
|
99
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
100
|
+
cx: ".5",
|
|
101
|
+
cy: "3.5",
|
|
102
|
+
r: "1"
|
|
103
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
104
|
+
cx: "6.5",
|
|
105
|
+
cy: "3.5",
|
|
106
|
+
r: "1"
|
|
107
|
+
}))))) : null, operation.onAdd ? /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "".concat(prefixCls, "-title-operators-item"),
|
|
109
|
+
onClick: function onClick() {
|
|
110
|
+
return operation.onAdd(item);
|
|
111
|
+
}
|
|
112
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
113
|
+
width: "7",
|
|
114
|
+
height: "7",
|
|
115
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
116
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
117
|
+
fill: "currentColor",
|
|
118
|
+
fillRule: "evenodd"
|
|
119
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
120
|
+
d: "M0 3h7v1H0z"
|
|
121
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
122
|
+
d: "M4 0v7H3V0z"
|
|
123
|
+
})))) : null));
|
|
124
|
+
}
|