@aloudata/aloudata-design 2.0.0-beta.1 → 2.0.0-beta.11
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/Avatar/component/Avatar/index.js +9 -7
- package/dist/Avatar/style/index.less +8 -1
- package/dist/Button/style/variables.less +8 -5
- package/dist/Checkbox/index.js +10 -4
- package/dist/Checkbox/style/index.less +12 -0
- package/dist/Checkbox/type.d.ts +11 -0
- package/dist/ColorPicker/style/index.less +1 -2
- package/dist/ConfigProvider/index.d.ts +1 -1
- package/dist/ConfigProvider/index.js +8 -1
- package/dist/DataPreviewTable/components/Body/index.js +7 -0
- package/dist/DataPreviewTable/constant.d.ts +1 -1
- package/dist/DataPreviewTable/constant.js +1 -1
- package/dist/DataPreviewTable/interface.d.ts +1 -0
- package/dist/DataPreviewTable/style/index.less +11 -11
- package/dist/Dropdown/style/index.less +3 -2
- package/dist/Empty/image/Search.js +2 -2
- package/dist/Empty/image/SearchSmall.js +2 -2
- package/dist/Empty/index.js +2 -1
- package/dist/Empty/style/index.less +2 -1
- package/dist/Form/style/index.less +27 -6
- package/dist/Icon/components/CloseCircleLightLine.d.ts +11 -0
- package/dist/Icon/components/CloseCircleLightLine.js +35 -0
- package/dist/Icon/components/User.d.ts +11 -0
- package/dist/Icon/components/User.js +41 -0
- package/dist/Icon/components/UserGroup.d.ts +11 -0
- package/dist/Icon/components/UserGroup.js +39 -0
- package/dist/Icon/index.d.ts +3 -0
- package/dist/Icon/index.js +4 -1
- package/dist/Icon/svg/Close-Circle-light-line.svg +5 -0
- package/dist/Icon/svg/check-circle-light-line.svg +1 -1
- package/dist/Icon/svg/information-circle-light-line.svg +1 -1
- package/dist/Icon/svg/user.svg +4 -0
- package/dist/Icon/svg/userGroup.svg +7 -0
- package/dist/Input/components/Input/index.js +1 -0
- package/dist/Input/components/TextArea/index.js +1 -0
- package/dist/InputNumber/style/index.less +12 -9
- package/dist/MemberPicker/components/MultipleOption.js +4 -3
- package/dist/MemberPicker/components/NickLabel.d.ts +2 -0
- package/dist/MemberPicker/components/NickLabel.js +8 -2
- package/dist/MemberPicker/components/Panel.js +2 -2
- package/dist/MemberPicker/components/SelectedMemberTags.js +4 -1
- package/dist/MemberPicker/components/SingleOption.js +1 -0
- package/dist/MemberPicker/index.js +13 -1
- package/dist/MemberPicker/interface.d.ts +1 -0
- package/dist/MemberPicker/style/index.less +39 -29
- package/dist/Menu/style/index.less +1 -2
- package/dist/Modal/style/polyfill/index.less +0 -3
- package/dist/Navigator/style/index.less +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +7 -1
- package/dist/Pagination/types.d.ts +1 -0
- package/dist/Popconfirm/index.js +3 -3
- package/dist/Popconfirm/style/index.less +49 -15
- package/dist/Progress/style/index.less +5 -2
- package/dist/ScrollArea/index.d.ts +1 -0
- package/dist/ScrollArea/index.js +5 -2
- package/dist/ScrollArea/style/index.less +5 -0
- package/dist/Select/index.js +3 -1
- package/dist/Select/style/index.less +21 -9
- package/dist/Select/style/layout.less +7 -5
- package/dist/Select/style/selectDropdown.less +1 -2
- package/dist/Select/style/size.less +239 -20
- package/dist/Select/style/variables.less +6 -3
- package/dist/Skeleton/style/index.less +84 -4
- package/dist/Spin/index.js +2 -3
- package/dist/Spin/style/index.less +8 -0
- package/dist/Table/components/Pagination/index.js +3 -1
- package/dist/Table/index.js +18 -3
- package/dist/Table/style/index.less +16 -9
- package/dist/Table/types.d.ts +1 -0
- package/dist/Tabs/index.d.ts +5 -0
- package/dist/Tabs/index.js +5 -2
- package/dist/Tabs/style/index.less +10 -7
- package/dist/TextLink/index.js +3 -2
- package/dist/TextLink/style/index.less +5 -0
- package/dist/TextLink/style/type.less +2 -2
- package/dist/Tree/DirectoryTree.js +0 -12
- package/dist/Tree/Tree.d.ts +2 -2
- package/dist/Tree/Tree.js +56 -2
- package/dist/Tree/demo/directoryTree/index.d.ts +3 -0
- package/dist/Tree/demo/directoryTree/index.js +44 -0
- package/dist/Tree/demo/filter/index.d.ts +3 -0
- package/dist/Tree/demo/filter/index.js +63 -0
- package/dist/Tree/style/index.less +35 -12
- package/dist/Tree/style/mixin.less +10 -8
- package/dist/Tree/style/reset.less +15 -0
- package/dist/ald.min.css +1 -1
- package/dist/notification/demo/footer.d.ts +3 -0
- package/dist/notification/demo/footer.js +44 -0
- package/dist/notification/index.js +77 -48
- package/dist/notification/style/index.less +49 -11
- package/dist/style/index.less +3 -3
- package/dist/style/themes/default/index.less +4 -2
- package/package.json +1 -1
package/dist/Table/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import Pagination from "./components/Pagination";
|
|
|
18
18
|
import { getTableColumns, prefixCls } from "./helper";
|
|
19
19
|
import useScrollX from "./hooks/useScroll";
|
|
20
20
|
// 32 行高 + 1 底线高度
|
|
21
|
-
var HEADER_HEIGHT =
|
|
21
|
+
var HEADER_HEIGHT = 41;
|
|
22
22
|
function Table(props, ref) {
|
|
23
23
|
var _classnames;
|
|
24
24
|
var columns = props.columns,
|
|
@@ -34,7 +34,8 @@ function Table(props, ref) {
|
|
|
34
34
|
_props$rowClassName = props.rowClassName,
|
|
35
35
|
rowClassName = _props$rowClassName === void 0 ? function () {
|
|
36
36
|
return '';
|
|
37
|
-
} : _props$rowClassName
|
|
37
|
+
} : _props$rowClassName,
|
|
38
|
+
onRowClick = props.onRowClick;
|
|
38
39
|
var _useState = useState(null),
|
|
39
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
41
|
totalSize = _useState2[0],
|
|
@@ -117,6 +118,19 @@ function Table(props, ref) {
|
|
|
117
118
|
}));
|
|
118
119
|
}));
|
|
119
120
|
}));
|
|
121
|
+
var onClickRow = useCallback(function (rowData, rowIndex) {
|
|
122
|
+
return function () {
|
|
123
|
+
var _window$getSelection;
|
|
124
|
+
if (typeof onRowClick !== 'function') {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.toString().length) !== 0) {
|
|
128
|
+
// 防止选择文本时触发 onRowClick
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
onRowClick(rowData, rowIndex);
|
|
132
|
+
};
|
|
133
|
+
}, [onRowClick]);
|
|
120
134
|
|
|
121
135
|
// 渲染 body
|
|
122
136
|
var bodyContent = /*#__PURE__*/React.createElement(Spin, {
|
|
@@ -135,7 +149,8 @@ function Table(props, ref) {
|
|
|
135
149
|
})) : _.map(rows, function (row, rowIndex) {
|
|
136
150
|
return /*#__PURE__*/React.createElement("div", {
|
|
137
151
|
key: row.id,
|
|
138
|
-
className: classnames(prefixCls('tr'), rowClassName(row.original, rowIndex))
|
|
152
|
+
className: classnames(prefixCls('tr'), _defineProperty({}, prefixCls('row-hover'), typeof onRowClick === 'function'), rowClassName(row.original, rowIndex)),
|
|
153
|
+
onClick: onClickRow(row.original, rowIndex)
|
|
139
154
|
}, _.map(row.getVisibleCells(), function (cell) {
|
|
140
155
|
return /*#__PURE__*/React.createElement("div", {
|
|
141
156
|
className: prefixCls('td'),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@import '../../Pagination/style/index.less';
|
|
3
3
|
@import '../../Spin/style/index.less';
|
|
4
4
|
@import '../../ScrollArea/style/index.less';
|
|
5
|
+
@import '../../Empty/style/index.less';
|
|
5
6
|
|
|
6
7
|
.ald-table-container {
|
|
7
8
|
position: relative;
|
|
@@ -12,10 +13,10 @@
|
|
|
12
13
|
|
|
13
14
|
.ald-table-main {
|
|
14
15
|
width: 100%;
|
|
15
|
-
color: #171717;
|
|
16
16
|
font-size: 13px;
|
|
17
17
|
line-height: 20px;
|
|
18
18
|
background: #fff;
|
|
19
|
+
color: var(--alias-colors-text-subtle, #4b5563);
|
|
19
20
|
|
|
20
21
|
.ald-table-content {
|
|
21
22
|
display: flex;
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
|
|
69
70
|
.ald-table-th-default {
|
|
70
71
|
font-weight: 500;
|
|
72
|
+
line-height: 16px;
|
|
71
73
|
padding: 0 var(--alias-spacing-200, 16px);
|
|
72
74
|
font-size: 12px;
|
|
73
75
|
overflow: hidden;
|
|
@@ -77,13 +79,13 @@
|
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
.ald-table-td-default {
|
|
82
|
+
line-height: 20px;
|
|
80
83
|
padding: 0 var(--alias-spacing-200, 16px);
|
|
81
84
|
display: flex;
|
|
82
85
|
align-items: center;
|
|
83
86
|
height: 100%;
|
|
84
87
|
font-size: 14px;
|
|
85
88
|
min-height: 47px;
|
|
86
|
-
font-weight: 400;
|
|
87
89
|
overflow: hidden;
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -101,15 +103,19 @@
|
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
.ald-table-body {
|
|
104
|
-
min-height:
|
|
106
|
+
min-height: 96px;
|
|
105
107
|
overflow: auto;
|
|
106
108
|
|
|
107
|
-
.ald-table-tr
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
.ald-table-tr {
|
|
110
|
+
&.ald-table-row-hover:hover {
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
|
|
113
|
+
.ald-table-td {
|
|
114
|
+
background-color: var(
|
|
115
|
+
--alias-colors-bg-interaction-hover,
|
|
116
|
+
rgba(0, 0, 0, 0.05)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
}
|
|
@@ -160,4 +166,5 @@
|
|
|
160
166
|
|
|
161
167
|
.ald-table-empty {
|
|
162
168
|
margin-top: 80px;
|
|
169
|
+
overflow: hidden;
|
|
163
170
|
}
|
package/dist/Table/types.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface ITableProps<TDataItem extends object> {
|
|
|
13
13
|
pagination?: IPaginationProps;
|
|
14
14
|
empty?: React.ReactNode;
|
|
15
15
|
rowClassName?: (record: TDataItem, index: number) => string;
|
|
16
|
+
onRowClick?: (record: TDataItem, index: number) => void;
|
|
16
17
|
}
|
|
17
18
|
export interface ITableRef {
|
|
18
19
|
scrollToFirstRow: () => void;
|
package/dist/Tabs/index.d.ts
CHANGED
|
@@ -59,6 +59,11 @@ export interface ITabsProps extends Omit<TabsProps, 'size'> {
|
|
|
59
59
|
* @default false
|
|
60
60
|
*/
|
|
61
61
|
compact?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @description tabs和content之间是否包含分割线
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
hasDividing?: boolean;
|
|
62
67
|
}
|
|
63
68
|
declare function Tabs(props: ITabsProps): React.JSX.Element;
|
|
64
69
|
declare namespace Tabs {
|
package/dist/Tabs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["size", "className", "popupClassName", "adaptHeight", "style", "monospace", "tabPosition", "padding", "compact"];
|
|
2
|
+
var _excluded = ["size", "className", "popupClassName", "adaptHeight", "style", "monospace", "tabPosition", "padding", "compact", "hasDividing"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
4
4
|
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; }
|
|
5
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; }
|
|
@@ -27,6 +27,8 @@ export default function Tabs(props) {
|
|
|
27
27
|
_props$padding = props.padding,
|
|
28
28
|
padding = _props$padding === void 0 ? false : _props$padding,
|
|
29
29
|
compact = props.compact,
|
|
30
|
+
_props$hasDividing = props.hasDividing,
|
|
31
|
+
hasDividing = _props$hasDividing === void 0 ? true : _props$hasDividing,
|
|
30
32
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
31
33
|
var headerBackgroundColor = props.headerBackgroundColor;
|
|
32
34
|
var tabsProps = _objectSpread({}, otherProps);
|
|
@@ -66,7 +68,8 @@ export default function Tabs(props) {
|
|
|
66
68
|
'ald-tabs-default': size !== 'small',
|
|
67
69
|
'ald-tabs-monospace': _monospace,
|
|
68
70
|
'ald-tabs-padding': !!padding,
|
|
69
|
-
'ald-tabs-compact': !!compact
|
|
71
|
+
'ald-tabs-compact': !!compact,
|
|
72
|
+
'ald-tabs-no-dividing': !hasDividing
|
|
70
73
|
})
|
|
71
74
|
}, tabsProps));
|
|
72
75
|
}
|
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
.ant-tabs-ink-bar {
|
|
54
54
|
height: @tabs-ink-link-bar-height;
|
|
55
55
|
background: @tab-ink-link-bar-background;
|
|
56
|
-
border-
|
|
57
|
-
border-top-right-radius: 2px;
|
|
56
|
+
border-radius: 2px;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
/* small size */
|
|
@@ -62,6 +61,7 @@
|
|
|
62
61
|
.ant-tabs-tab {
|
|
63
62
|
font-size: @tabs-font-size-small;
|
|
64
63
|
line-height: @tabs-line-height-small;
|
|
64
|
+
height: 40px;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.ant-tabs-ink-bar {
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
.ant-tabs-tab {
|
|
80
80
|
font-size: @tabs-font-size;
|
|
81
81
|
line-height: @tabs-line-height;
|
|
82
|
+
height: 44px;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
.ald-tabs-more-icon {
|
|
@@ -132,7 +133,7 @@
|
|
|
132
133
|
margin-bottom: 20px;
|
|
133
134
|
|
|
134
135
|
&::before {
|
|
135
|
-
border-color:
|
|
136
|
+
border-color: var(--alias-colors-border-default, #e5e7eb);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -149,10 +150,6 @@
|
|
|
149
150
|
&.ald-tabs-compact {
|
|
150
151
|
.ant-tabs-nav {
|
|
151
152
|
margin-bottom: 0;
|
|
152
|
-
|
|
153
|
-
&::before {
|
|
154
|
-
border: 0;
|
|
155
|
-
}
|
|
156
153
|
}
|
|
157
154
|
}
|
|
158
155
|
}
|
|
@@ -217,3 +214,9 @@
|
|
|
217
214
|
padding: 0 var(--tabs-padding) var(--tabs-padding);
|
|
218
215
|
}
|
|
219
216
|
}
|
|
217
|
+
|
|
218
|
+
.ald-tabs-no-dividing {
|
|
219
|
+
&.ant-tabs-top > .ant-tabs-nav::before {
|
|
220
|
+
border-bottom: 0;
|
|
221
|
+
}
|
|
222
|
+
}
|
package/dist/TextLink/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import React from 'react';
|
|
|
7
7
|
function TextLink(props) {
|
|
8
8
|
var _classNames;
|
|
9
9
|
var propsSize = props.size,
|
|
10
|
-
type = props.type,
|
|
10
|
+
_props$type = props.type,
|
|
11
|
+
type = _props$type === void 0 ? 'primary' : _props$type,
|
|
11
12
|
underline = props.underline,
|
|
12
13
|
disabled = props.disabled,
|
|
13
14
|
_props$icon = props.icon,
|
|
@@ -18,7 +19,7 @@ function TextLink(props) {
|
|
|
18
19
|
var size = propsSize || 'middle';
|
|
19
20
|
var icon = underline ? null : propsIcon;
|
|
20
21
|
return /*#__PURE__*/React.createElement("span", {
|
|
21
|
-
className: classNames('ald-text-link', className, (_classNames = {}, _defineProperty(_classNames, "ald-text-link-".concat(size), size), _defineProperty(_classNames, "ald-text-link-".concat(type), type), _defineProperty(_classNames, "ald-text-link-
|
|
22
|
+
className: classNames('ald-text-link', className, (_classNames = {}, _defineProperty(_classNames, "ald-text-link-".concat(size), size), _defineProperty(_classNames, "ald-text-link-".concat(type), type), _defineProperty(_classNames, "ald-text-link-disabled", disabled), _defineProperty(_classNames, "ald-text-link-show-underline", underline), _classNames)),
|
|
22
23
|
onClick: onClick
|
|
23
24
|
}, icon, children);
|
|
24
25
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
color: var(--alias-colors-link-hover, #0f59b1);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
&.ald-text-link-disabled {
|
|
13
13
|
color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
color: var(--alias-colors-text-selected, #126fdd);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
&.ald-text-link-disabled {
|
|
29
29
|
color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -19,9 +19,6 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
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
21
|
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; }
|
|
22
|
-
import FileOutlined from '@ant-design/icons/FileOutlined';
|
|
23
|
-
import FolderOpenOutlined from '@ant-design/icons/FolderOpenOutlined';
|
|
24
|
-
import FolderOutlined from '@ant-design/icons/FolderOutlined';
|
|
25
22
|
import classNames from 'classnames';
|
|
26
23
|
import { conductExpandParent } from 'rc-tree/lib/util';
|
|
27
24
|
import { convertDataToEntities, convertTreeToData } from 'rc-tree/lib/utils/treeUtil';
|
|
@@ -29,14 +26,6 @@ import * as React from 'react';
|
|
|
29
26
|
import { ConfigContext } from "../ConfigProvider";
|
|
30
27
|
import Tree from "./Tree";
|
|
31
28
|
import { calcRangeKeys, convertDirectoryKeysToNodes } from "./utils/dictUtil";
|
|
32
|
-
function getIcon(props) {
|
|
33
|
-
var isLeaf = props.isLeaf,
|
|
34
|
-
expanded = props.expanded;
|
|
35
|
-
if (isLeaf) {
|
|
36
|
-
return /*#__PURE__*/React.createElement(FileOutlined, null);
|
|
37
|
-
}
|
|
38
|
-
return expanded ? /*#__PURE__*/React.createElement(FolderOpenOutlined, null) : /*#__PURE__*/React.createElement(FolderOutlined, null);
|
|
39
|
-
}
|
|
40
29
|
function getTreeData(_ref) {
|
|
41
30
|
var treeData = _ref.treeData,
|
|
42
31
|
children = _ref.children;
|
|
@@ -154,7 +143,6 @@ var DirectoryTree = function DirectoryTree(_ref2, ref) {
|
|
|
154
143
|
var prefixCls = getPrefixCls('tree', customizePrefixCls);
|
|
155
144
|
var connectClassName = classNames("".concat(prefixCls, "-directory"), _defineProperty({}, "".concat(prefixCls, "-directory-rtl"), direction === 'rtl'), className);
|
|
156
145
|
return /*#__PURE__*/React.createElement(Tree, _extends({
|
|
157
|
-
icon: getIcon,
|
|
158
146
|
ref: ref,
|
|
159
147
|
blockNode: true
|
|
160
148
|
}, otherProps, {
|
package/dist/Tree/Tree.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ interface DraggableConfig {
|
|
|
80
80
|
icon?: React.ReactNode | false;
|
|
81
81
|
nodeDraggable?: DraggableFn;
|
|
82
82
|
}
|
|
83
|
-
export interface TreeProps<T extends BasicDataNode = DataNode> extends Omit<RcTreeProps<T>, 'prefixCls' | 'showLine' | 'direction' | 'draggable' | 'icon' | 'switcherIcon'> {
|
|
83
|
+
export interface TreeProps<T extends BasicDataNode = DataNode> extends Omit<RcTreeProps<T>, 'prefixCls' | 'showLine' | 'direction' | 'draggable' | 'icon' | 'switcherIcon' | 'filterTreeNode'> {
|
|
84
84
|
showLine?: boolean | {
|
|
85
85
|
showLeafIcon: boolean | TreeLeafIcon;
|
|
86
86
|
};
|
|
@@ -116,7 +116,7 @@ export interface TreeProps<T extends BasicDataNode = DataNode> extends Omit<RcTr
|
|
|
116
116
|
defaultSelectedKeys?: Key[];
|
|
117
117
|
selectable?: boolean;
|
|
118
118
|
/** 点击树节点触发 */
|
|
119
|
-
|
|
119
|
+
filterTreeNode?: (node: DataNode) => boolean;
|
|
120
120
|
loadedKeys?: Key[];
|
|
121
121
|
/** 设置节点可拖拽(IE>8) */
|
|
122
122
|
draggable?: DraggableFn | boolean | DraggableConfig;
|
package/dist/Tree/Tree.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
2
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
2
5
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
6
|
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
7
|
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; }
|
|
@@ -25,7 +28,7 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25
28
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
26
29
|
direction = _React$useContext.direction,
|
|
27
30
|
virtual = _React$useContext.virtual;
|
|
28
|
-
var size = props.size || '
|
|
31
|
+
var size = props.size || 'large';
|
|
29
32
|
var className = props.className,
|
|
30
33
|
_props$showIcon = props.showIcon,
|
|
31
34
|
showIcon = _props$showIcon === void 0 ? false : _props$showIcon,
|
|
@@ -42,6 +45,8 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
42
45
|
showTabLeader = props.showTabLeader,
|
|
43
46
|
_props$handlerRender = props.handlerRender,
|
|
44
47
|
handlerRender = _props$handlerRender === void 0 ? noop : _props$handlerRender,
|
|
48
|
+
filterTreeNode = props.filterTreeNode,
|
|
49
|
+
treeData = props.treeData,
|
|
45
50
|
_props$motion = props.motion,
|
|
46
51
|
motion = _props$motion === void 0 ? _objectSpread(_objectSpread({}, collapseMotion), {}, {
|
|
47
52
|
motionAppear: false
|
|
@@ -105,13 +110,62 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
105
110
|
}
|
|
106
111
|
});
|
|
107
112
|
};
|
|
113
|
+
var newTreeData = React.useMemo(function () {
|
|
114
|
+
if (!filterTreeNode) return treeData;
|
|
115
|
+
var processNode = function processNode(node) {
|
|
116
|
+
// 初始化一个标志来表示是否需要为当前节点及其所有子节点添加className
|
|
117
|
+
var shouldAddDisabled = true;
|
|
118
|
+
// 检查当前节点的title是否包含目标字符串,包含则不需要添加className
|
|
119
|
+
if (filterTreeNode(node)) {
|
|
120
|
+
shouldAddDisabled = false;
|
|
121
|
+
}
|
|
122
|
+
if (node.children) {
|
|
123
|
+
// 遍历当前节点的子节点
|
|
124
|
+
var _iterator = _createForOfIteratorHelper(node.children),
|
|
125
|
+
_step;
|
|
126
|
+
try {
|
|
127
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
128
|
+
var child = _step.value;
|
|
129
|
+
// 递归调用processNode函数来处理子节点,判断子节点是否需要添加className
|
|
130
|
+
var childShouldAddDisabled = processNode(child);
|
|
131
|
+
shouldAddDisabled = shouldAddDisabled && childShouldAddDisabled;
|
|
132
|
+
}
|
|
133
|
+
} catch (err) {
|
|
134
|
+
_iterator.e(err);
|
|
135
|
+
} finally {
|
|
136
|
+
_iterator.f();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 如果shouldAddDisabled为true,就为当前节点添加className
|
|
141
|
+
if (shouldAddDisabled) {
|
|
142
|
+
node.className = classNames(node.className, 'ald-tree-node-disabled');
|
|
143
|
+
}
|
|
144
|
+
return shouldAddDisabled;
|
|
145
|
+
};
|
|
146
|
+
if (!treeData) return treeData;
|
|
147
|
+
var _iterator2 = _createForOfIteratorHelper(treeData),
|
|
148
|
+
_step2;
|
|
149
|
+
try {
|
|
150
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
151
|
+
var rootNode = _step2.value;
|
|
152
|
+
processNode(rootNode);
|
|
153
|
+
}
|
|
154
|
+
} catch (err) {
|
|
155
|
+
_iterator2.e(err);
|
|
156
|
+
} finally {
|
|
157
|
+
_iterator2.f();
|
|
158
|
+
}
|
|
159
|
+
return treeData;
|
|
160
|
+
}, [filterTreeNode, treeData]);
|
|
108
161
|
return /*#__PURE__*/React.createElement(RcTree, _extends({
|
|
109
162
|
itemHeight: 20,
|
|
110
163
|
ref: ref,
|
|
111
164
|
virtual: virtual
|
|
112
165
|
}, newProps, {
|
|
113
166
|
prefixCls: prefixCls,
|
|
114
|
-
|
|
167
|
+
treeData: newTreeData,
|
|
168
|
+
className: classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-icon-hide"), !showIcon), _defineProperty(_classNames, "".concat(prefixCls, "-block-node"), blockNode), _defineProperty(_classNames, "".concat(prefixCls, "-unselectable"), !selectable), _defineProperty(_classNames, "".concat(prefixCls, "-large"), size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _defineProperty(_classNames, 'ald-draggable-tree', draggable), _classNames), className),
|
|
115
169
|
direction: direction,
|
|
116
170
|
checkable: checkable ? /*#__PURE__*/React.createElement("span", {
|
|
117
171
|
className: "".concat(prefixCls, "-checkbox-inner")
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Tree } from "../../..";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var DirectoryTree = Tree.DirectoryTree;
|
|
4
|
+
var treeData = [{
|
|
5
|
+
title: 'parent 0',
|
|
6
|
+
key: '0-0',
|
|
7
|
+
children: [{
|
|
8
|
+
title: 'leaf 0-0',
|
|
9
|
+
key: '0-0-0',
|
|
10
|
+
isLeaf: true
|
|
11
|
+
}, {
|
|
12
|
+
title: 'leaf 0-1',
|
|
13
|
+
key: '0-0-1',
|
|
14
|
+
isLeaf: true
|
|
15
|
+
}]
|
|
16
|
+
}, {
|
|
17
|
+
title: 'parent 1',
|
|
18
|
+
key: '0-1',
|
|
19
|
+
children: [{
|
|
20
|
+
title: 'leaf 1-0',
|
|
21
|
+
key: '0-1-0',
|
|
22
|
+
isLeaf: true
|
|
23
|
+
}, {
|
|
24
|
+
title: 'leaf 1-1',
|
|
25
|
+
key: '0-1-1',
|
|
26
|
+
isLeaf: true
|
|
27
|
+
}]
|
|
28
|
+
}];
|
|
29
|
+
var App = function App() {
|
|
30
|
+
var onSelect = function onSelect(keys, info) {
|
|
31
|
+
console.log('Trigger Select', keys, info);
|
|
32
|
+
};
|
|
33
|
+
var onExpand = function onExpand(keys, info) {
|
|
34
|
+
console.log('Trigger Expand', keys, info);
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(DirectoryTree, {
|
|
37
|
+
multiple: true,
|
|
38
|
+
defaultExpandAll: true,
|
|
39
|
+
onSelect: onSelect,
|
|
40
|
+
onExpand: onExpand,
|
|
41
|
+
treeData: treeData
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
export default App;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { App, Input, Tree } from "../../..";
|
|
8
|
+
import React from 'react';
|
|
9
|
+
export default (function () {
|
|
10
|
+
var _React$useState = React.useState(''),
|
|
11
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
12
|
+
filterKey = _React$useState2[0],
|
|
13
|
+
setFilterKey = _React$useState2[1];
|
|
14
|
+
var _React$useState3 = React.useState([]),
|
|
15
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
16
|
+
expandedKeys = _React$useState4[0],
|
|
17
|
+
setExpandedKeys = _React$useState4[1];
|
|
18
|
+
return /*#__PURE__*/React.createElement(App, null, /*#__PURE__*/React.createElement(Input, {
|
|
19
|
+
onChange: function onChange(v) {
|
|
20
|
+
setFilterKey(v.target.value);
|
|
21
|
+
}
|
|
22
|
+
}), /*#__PURE__*/React.createElement(Tree, {
|
|
23
|
+
size: "large",
|
|
24
|
+
showIcon: true,
|
|
25
|
+
icon: 'icon',
|
|
26
|
+
filterTreeNode: function filterTreeNode(node) {
|
|
27
|
+
var title = node.title;
|
|
28
|
+
if (typeof title === 'string') {
|
|
29
|
+
return title.includes(filterKey);
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
},
|
|
33
|
+
expandedKeys: expandedKeys,
|
|
34
|
+
onExpand: function onExpand(keys) {
|
|
35
|
+
setExpandedKeys(keys);
|
|
36
|
+
},
|
|
37
|
+
treeData: [{
|
|
38
|
+
title: 'Parent 1',
|
|
39
|
+
key: '0-0',
|
|
40
|
+
children: [{
|
|
41
|
+
title: 'parent 1-0',
|
|
42
|
+
key: '0-0-0',
|
|
43
|
+
children: [{
|
|
44
|
+
title: 'leaf',
|
|
45
|
+
key: '0-0-0-0',
|
|
46
|
+
isLeaf: true
|
|
47
|
+
}, {
|
|
48
|
+
title: 'leaf',
|
|
49
|
+
key: '0-0-0-1',
|
|
50
|
+
isLeaf: true
|
|
51
|
+
}]
|
|
52
|
+
}, {
|
|
53
|
+
title: 'parent 1-1',
|
|
54
|
+
key: '0-0-1',
|
|
55
|
+
children: [{
|
|
56
|
+
title: 'ssss',
|
|
57
|
+
key: '0-0-1-0',
|
|
58
|
+
disabled: true
|
|
59
|
+
}]
|
|
60
|
+
}]
|
|
61
|
+
}]
|
|
62
|
+
}));
|
|
63
|
+
});
|
|
@@ -6,21 +6,25 @@
|
|
|
6
6
|
@import './reset.less';
|
|
7
7
|
@import './checkbox.less';
|
|
8
8
|
|
|
9
|
-
@tree-font-size-large:
|
|
10
|
-
@tree-padding-large: 6px
|
|
9
|
+
@tree-font-size-large: 14px;
|
|
10
|
+
@tree-padding-large: 6px;
|
|
11
11
|
@tree-line-height-large: 20px;
|
|
12
12
|
|
|
13
13
|
@tree-font-size-default: 12px;
|
|
14
14
|
@tree-padding-default: 4px;
|
|
15
15
|
@tree-line-height-default: 16px;
|
|
16
16
|
.aldCheckboxFn();
|
|
17
|
-
|
|
17
|
+
@tree-prefix-cls: ~'@{ald-prefix}-tree';
|
|
18
18
|
.@{tree-prefix-cls} {
|
|
19
19
|
.antTreeFn(@tree-prefix-cls);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.ald-tree {
|
|
23
|
-
padding:
|
|
23
|
+
padding: 0;
|
|
24
|
+
|
|
25
|
+
&.ald-draggable-tree {
|
|
26
|
+
padding: 3px 0;
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
.ald-tree-treenode.ald-tree-treenode-draggable {
|
|
26
30
|
.ald-tree-draggable-icon {
|
|
@@ -34,8 +38,11 @@
|
|
|
34
38
|
align-items: center;
|
|
35
39
|
font-size: @tree-font-size-default;
|
|
36
40
|
font-weight: 400;
|
|
37
|
-
color: #
|
|
38
|
-
|
|
41
|
+
color: var(--alias-colors-text-default, #1f2937);
|
|
42
|
+
|
|
43
|
+
&.ald-tree-node-disabled {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
39
46
|
|
|
40
47
|
.ald-tree-draggable-icon {
|
|
41
48
|
display: inline-flex;
|
|
@@ -59,6 +66,7 @@
|
|
|
59
66
|
flex: 1;
|
|
60
67
|
display: flex;
|
|
61
68
|
align-items: center;
|
|
69
|
+
border-radius: 4px;
|
|
62
70
|
// stylelint-disable-next-line
|
|
63
71
|
.ald-tree-iconEle {
|
|
64
72
|
display: inline-flex;
|
|
@@ -71,11 +79,9 @@
|
|
|
71
79
|
|
|
72
80
|
.ald-tree-title {
|
|
73
81
|
line-height: @tree-line-height-default;
|
|
74
|
-
border-radius: 2px;
|
|
75
82
|
display: inline-flex;
|
|
76
83
|
align-items: center;
|
|
77
84
|
justify-content: space-between;
|
|
78
|
-
color: #171717;
|
|
79
85
|
flex: 1;
|
|
80
86
|
|
|
81
87
|
.ald-tree-tab-leader {
|
|
@@ -87,13 +93,23 @@
|
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
&:hover {
|
|
90
|
-
background: var(--colors-
|
|
91
|
-
mix-blend-mode: multiply;
|
|
96
|
+
background: var(--alias-colors-bg-interaction-hover, rgba(0, 0, 0, 0.05));
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
&.ald-tree-node-selected {
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
background: var(--alias-colors-bg-selected-default, #e8f2fe);
|
|
101
|
+
color: var(--alias-colors-text-selected, #126fdd);
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
font-weight: 400;
|
|
104
|
+
line-height: 16px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.ald-tree-treenode-disabled {
|
|
109
|
+
.ald-tree-node-content-wrapper {
|
|
110
|
+
&:hover {
|
|
111
|
+
background: inherit;
|
|
112
|
+
}
|
|
97
113
|
}
|
|
98
114
|
}
|
|
99
115
|
}
|
|
@@ -109,10 +125,17 @@
|
|
|
109
125
|
|
|
110
126
|
.ald-tree-node-content-wrapper {
|
|
111
127
|
padding: @tree-padding-large;
|
|
128
|
+
border-radius: var(--alias-radius-75, 6px);
|
|
112
129
|
|
|
113
130
|
.ald-tree-title {
|
|
114
131
|
line-height: @tree-line-height-large;
|
|
115
132
|
}
|
|
133
|
+
|
|
134
|
+
&.ald-tree-node-selected {
|
|
135
|
+
font-size: 14px;
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
line-height: 20px;
|
|
138
|
+
}
|
|
116
139
|
}
|
|
117
140
|
}
|
|
118
141
|
}
|