@aloudata/aloudata-design 2.0.0-beta.9 → 2.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/dist/Button/style/index.less +4 -0
- package/dist/Checkbox/style/index.less +8 -10
- package/dist/ColorPicker/index.js +4 -2
- package/dist/ColorPicker/style/index.less +1 -2
- package/dist/ConfigProvider/index.d.ts +1 -1
- package/dist/ConfigProvider/index.js +9 -1
- package/dist/DataPreviewTable/components/Body/index.js +7 -0
- package/dist/DataPreviewTable/interface.d.ts +1 -0
- package/dist/DataPreviewTable/style/index.less +6 -3
- package/dist/Dropdown/index.js +4 -1
- package/dist/Dropdown/style/index.less +12 -2
- package/dist/Empty/index.js +2 -1
- package/dist/Empty/style/index.less +2 -2
- package/dist/Form/style/index.d.ts +1 -0
- package/dist/Form/style/index.js +1 -0
- package/dist/HighlightText/index.d.ts +12 -0
- package/dist/HighlightText/index.js +27 -0
- package/dist/HighlightText/style/index.less +5 -0
- package/dist/Icon/components/ArrowRightLightLine.d.ts +11 -0
- package/dist/Icon/components/ArrowRightLightLine.js +35 -0
- package/dist/Icon/components/TimesLightLine.d.ts +11 -0
- package/dist/Icon/components/TimesLightLine.js +35 -0
- package/dist/Icon/index.d.ts +2 -0
- package/dist/Icon/index.js +2 -0
- package/dist/Icon/svg/Arrow-Right-light-line.svg +5 -0
- package/dist/Icon/svg/Times-light-line.svg +5 -0
- package/dist/IconButton/index.js +4 -1
- package/dist/Input/components/Input/index.d.ts +2 -5
- package/dist/Input/components/Input/index.js +2 -1
- package/dist/Input/components/TextArea/index.js +7 -4
- package/dist/MemberPicker/index.js +35 -9
- package/dist/MemberPicker/interface.d.ts +1 -1
- package/dist/MemberPicker/style/index.less +13 -5
- package/dist/Menu/style/index.less +1 -2
- package/dist/Modal/index.d.ts +3 -4
- package/dist/Modal/index.js +29 -8
- package/dist/Modal/style/modal.less +4 -0
- package/dist/Modal/style/modalConfirm.less +5 -1
- package/dist/Modal/style/polyfill/index.less +0 -3
- package/dist/Popconfirm/index.js +1 -1
- package/dist/Popconfirm/style/index.less +4 -8
- package/dist/Progress/style/index.less +5 -2
- package/dist/Radio/components/Radio/index.js +26 -4
- package/dist/Radio/style/index.less +57 -3
- package/dist/Select/index.d.ts +0 -1
- package/dist/Select/index.js +19 -19
- package/dist/Select/style/emptyShowAll.less +10 -0
- package/dist/Select/style/index.less +17 -7
- package/dist/Select/style/layout.less +1 -0
- package/dist/Select/style/selectDropdown.less +1 -2
- package/dist/Select/style/status.less +45 -2
- package/dist/Table/style/index.less +6 -5
- package/dist/Tabs/style/index.less +2 -7
- package/dist/Tooltip/index.js +5 -3
- package/dist/Tooltip/style/index.less +6 -6
- package/dist/Tree/Tree.d.ts +3 -2
- package/dist/Tree/Tree.js +80 -10
- package/dist/Tree/demo/basic/index.js +4 -0
- package/dist/Tree/demo/filter/index.d.ts +3 -0
- package/dist/Tree/demo/filter/index.js +64 -0
- package/dist/Tree/style/checkbox.less +57 -36
- package/dist/Tree/style/index.less +27 -6
- package/dist/Tree/style/mixin.less +10 -6
- package/dist/Tree/style/var.less +1 -1
- package/dist/ald.min.css +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.less +1 -0
- package/dist/style/index.less +3 -3
- package/dist/style/themes/default/index.less +5 -3
- package/package.json +2 -1
- package/dist/Navigator/components/Header/index.d.ts +0 -9
- package/dist/Navigator/components/Header/index.js +0 -16
- package/dist/Navigator/components/Menu/index.d.ts +0 -13
- package/dist/Navigator/components/Menu/index.js +0 -42
- package/dist/Navigator/components/MenuItem/index.d.ts +0 -21
- package/dist/Navigator/components/MenuItem/index.js +0 -36
- package/dist/Navigator/index.d.ts +0 -51
- package/dist/Navigator/index.js +0 -33
- package/dist/Navigator/style/bg.png +0 -0
- package/dist/Navigator/style/index.less +0 -159
- /package/dist/{Navigator → HighlightText}/style/index.d.ts +0 -0
- /package/dist/{Navigator → HighlightText}/style/index.js +0 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@import './selectDropdown.less';
|
|
8
8
|
@import './option.less';
|
|
9
9
|
@import './layout.less';
|
|
10
|
+
@import './emptyShowAll.less';
|
|
10
11
|
|
|
11
12
|
.ald-select.ald-select {
|
|
12
13
|
display: inline-block;
|
|
@@ -33,6 +34,10 @@
|
|
|
33
34
|
&.ald-select-prefix-multiple {
|
|
34
35
|
cursor: default;
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
.ant-select-selection-overflow {
|
|
39
|
+
margin-left: 6px;
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
.ant-select {
|
|
@@ -63,14 +68,13 @@
|
|
|
63
68
|
.ant-select-selection-overflow {
|
|
64
69
|
align-self: normal;
|
|
65
70
|
flex-wrap: nowrap;
|
|
66
|
-
margin-left: 6px;
|
|
67
71
|
min-width: 52px;
|
|
68
72
|
height: 100%;
|
|
69
73
|
|
|
70
74
|
.ant-select-selection-overflow-item {
|
|
71
75
|
align-items: center;
|
|
72
76
|
line-height: inherit;
|
|
73
|
-
flex: 1;
|
|
77
|
+
// flex: 1;
|
|
74
78
|
min-width: 0;
|
|
75
79
|
// height: 100%;
|
|
76
80
|
|
|
@@ -113,11 +117,6 @@
|
|
|
113
117
|
height: 16px;
|
|
114
118
|
padding: 0 var(--alias-spacing-50, 4px);
|
|
115
119
|
border-radius: var(--alias-radius-100, 8px);
|
|
116
|
-
background: var(
|
|
117
|
-
--alias-colors-bg-accent-blue-subtle-default,
|
|
118
|
-
#d4e7fd
|
|
119
|
-
);
|
|
120
|
-
color: var(--alias-colors-text-information, #0f59b1);
|
|
121
120
|
font-size: 12px;
|
|
122
121
|
}
|
|
123
122
|
}
|
|
@@ -133,6 +132,17 @@
|
|
|
133
132
|
white-space: nowrap;
|
|
134
133
|
text-overflow: ellipsis;
|
|
135
134
|
overflow: hidden;
|
|
135
|
+
// position: relative;;
|
|
136
|
+
|
|
137
|
+
&::before {
|
|
138
|
+
content: ',';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&:first-of-type {
|
|
143
|
+
.ald-select-multiple-tag-default::before {
|
|
144
|
+
content: '';
|
|
145
|
+
}
|
|
136
146
|
}
|
|
137
147
|
|
|
138
148
|
.ant-select-selection-search-input {
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
overflow-y: overlay;
|
|
11
11
|
border: 1px solid var(--alias-colors-border-strong, #d1d5db);
|
|
12
12
|
background: var(--alias-colors-bg-skeleton-subtler, #fff);
|
|
13
|
-
box-shadow: 0
|
|
14
|
-
0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
|
|
13
|
+
box-shadow: 0 10px 18px -2px rgba(0, 0, 0, 0.08);
|
|
15
14
|
padding: 4px 0;
|
|
16
15
|
}
|
|
17
16
|
}
|
|
@@ -11,12 +11,28 @@
|
|
|
11
11
|
.ald-select.ald-select-primary {
|
|
12
12
|
.select-color(var(--alias-colors-border-accent-gray-subtle-default, #D1D5DB),var(--alias-colors-bg-skeleton-subtle, #F9FAFB),var(--alias-colors-text-default, #1f2937));
|
|
13
13
|
|
|
14
|
+
&.ald-select-multiple .ant-select {
|
|
15
|
+
.ant-select-selector {
|
|
16
|
+
color: var(--alias-colors-text-selected, #126fdd);
|
|
17
|
+
|
|
18
|
+
.ant-select-selection-overflow-item-rest {
|
|
19
|
+
.ant-select-selection-item-content {
|
|
20
|
+
background: var(
|
|
21
|
+
--alias-colors-bg-accent-blue-subtle-default,
|
|
22
|
+
#d4e7fd
|
|
23
|
+
);
|
|
24
|
+
color: var(--alias-colors-text-information, #0f59b1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
&.ald-select-fitted {
|
|
15
31
|
.select-color(var(--alias-colors-border-accent-gray-subtle-default, #D1D5DB),var(--alias-colors-bg-skeleton-subtle, #F9FAFB),var(--alias-colors-text-default, #1f2937));
|
|
16
32
|
}
|
|
17
33
|
|
|
18
34
|
&:hover {
|
|
19
|
-
.select-color(var(--alias-colors-border-accent-gray-subtle-hover, #9ca3af),var(--alias-colors-bg-
|
|
35
|
+
.select-color(var(--alias-colors-border-accent-gray-subtle-hover, #9ca3af), var(--alias-colors-bg-accent-gray-subtler-default, #F9FAFB),var(--alias-colors-text-default, #1f2937));
|
|
20
36
|
}
|
|
21
37
|
|
|
22
38
|
&:active {
|
|
@@ -28,12 +44,22 @@
|
|
|
28
44
|
|
|
29
45
|
cursor: default;
|
|
30
46
|
|
|
31
|
-
.ant-select
|
|
47
|
+
.ant-select {
|
|
32
48
|
cursor: default;
|
|
33
49
|
|
|
50
|
+
.ant-select-selector {
|
|
51
|
+
cursor: default;
|
|
52
|
+
}
|
|
53
|
+
|
|
34
54
|
.ant-select-selection-search input {
|
|
35
55
|
cursor: default;
|
|
36
56
|
}
|
|
57
|
+
|
|
58
|
+
.ant-select-arrow {
|
|
59
|
+
.ald-select-suffix-icon {
|
|
60
|
+
color: var(--alias-colors-icon-disabled, rgba(0, 0, 0, 0.25));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
37
63
|
}
|
|
38
64
|
}
|
|
39
65
|
|
|
@@ -46,6 +72,17 @@
|
|
|
46
72
|
&.ald-select-secondary {
|
|
47
73
|
.select-color(var(--alias-colors-border-accent-gray-subtle-default, #D1D5DB),var(--alias-colors-bg-skeleton-subtler, #FFF),var(--alias-colors-text-default, #1f2937));
|
|
48
74
|
|
|
75
|
+
&.ald-select-multiple .ant-select {
|
|
76
|
+
.ant-select-selector {
|
|
77
|
+
.ant-select-selection-overflow-item-rest {
|
|
78
|
+
.ant-select-selection-item-content {
|
|
79
|
+
background: transparent;
|
|
80
|
+
color: var(--alias-colors-text-subtle, #4b5563);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
49
86
|
&.ald-select-fitted {
|
|
50
87
|
.select-color(var(--alias-colors-border-accent-gray-subtle-default, #D1D5DB),var(--alias-colors-bg-skeleton-subtler, #FFF),var(--alias-colors-text-default, #1f2937));
|
|
51
88
|
}
|
|
@@ -73,6 +110,12 @@
|
|
|
73
110
|
.ant-select-selection-search input {
|
|
74
111
|
cursor: default;
|
|
75
112
|
}
|
|
113
|
+
|
|
114
|
+
.ant-select-arrow {
|
|
115
|
+
.ald-select-suffix-icon {
|
|
116
|
+
color: var(--alias-colors-icon-disabled, rgba(0, 0, 0, 0.25));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
76
119
|
}
|
|
77
120
|
}
|
|
78
121
|
}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
.ald-table-main {
|
|
15
15
|
width: 100%;
|
|
16
|
-
color: #171717;
|
|
17
16
|
font-size: 13px;
|
|
18
17
|
line-height: 20px;
|
|
19
18
|
background: #fff;
|
|
19
|
+
color: var(--alias-colors-text-subtle, #4b5563);
|
|
20
20
|
|
|
21
21
|
.ald-table-content {
|
|
22
22
|
display: flex;
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
|
|
70
70
|
.ald-table-th-default {
|
|
71
71
|
font-weight: 500;
|
|
72
|
-
|
|
72
|
+
line-height: 16px;
|
|
73
|
+
padding-left: var(--alias-spacing-200, 16px);
|
|
73
74
|
font-size: 12px;
|
|
74
75
|
overflow: hidden;
|
|
75
76
|
height: 40px;
|
|
@@ -78,13 +79,13 @@
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
.ald-table-td-default {
|
|
81
|
-
|
|
82
|
+
line-height: 20px;
|
|
83
|
+
padding-left: var(--alias-spacing-200, 16px);
|
|
82
84
|
display: flex;
|
|
83
85
|
align-items: center;
|
|
84
86
|
height: 100%;
|
|
85
87
|
font-size: 14px;
|
|
86
88
|
min-height: 47px;
|
|
87
|
-
font-weight: 400;
|
|
88
89
|
overflow: hidden;
|
|
89
90
|
}
|
|
90
91
|
|
|
@@ -102,7 +103,7 @@
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
.ald-table-body {
|
|
105
|
-
min-height:
|
|
106
|
+
min-height: 96px;
|
|
106
107
|
overflow: auto;
|
|
107
108
|
|
|
108
109
|
.ald-table-tr {
|
|
@@ -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 */
|
|
@@ -134,7 +133,7 @@
|
|
|
134
133
|
margin-bottom: 20px;
|
|
135
134
|
|
|
136
135
|
&::before {
|
|
137
|
-
border-color:
|
|
136
|
+
border-color: var(--alias-colors-border-default, #e5e7eb);
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
|
|
@@ -151,10 +150,6 @@
|
|
|
151
150
|
&.ald-tabs-compact {
|
|
152
151
|
.ant-tabs-nav {
|
|
153
152
|
margin-bottom: 0;
|
|
154
|
-
|
|
155
|
-
&::before {
|
|
156
|
-
border: 0;
|
|
157
|
-
}
|
|
158
153
|
}
|
|
159
154
|
}
|
|
160
155
|
}
|
package/dist/Tooltip/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import AntdTooltip from 'antd/lib/tooltip';
|
|
3
2
|
import classNames from 'classnames';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
export default function Tooltip(props) {
|
|
5
5
|
var children = props.children,
|
|
6
6
|
title = props.title,
|
|
@@ -9,8 +9,10 @@ export default function Tooltip(props) {
|
|
|
9
9
|
trigger = props.trigger,
|
|
10
10
|
zIndex = props.zIndex,
|
|
11
11
|
placement = props.placement,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
_props$mouseEnterDela = props.mouseEnterDelay,
|
|
13
|
+
mouseEnterDelay = _props$mouseEnterDela === void 0 ? 0 : _props$mouseEnterDela,
|
|
14
|
+
_props$mouseLeaveDela = props.mouseLeaveDelay,
|
|
15
|
+
mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0 : _props$mouseLeaveDela,
|
|
14
16
|
getPopupContainer = props.getPopupContainer,
|
|
15
17
|
destroyTooltipOnHide = props.destroyTooltipOnHide,
|
|
16
18
|
getTooltipContainer = props.getTooltipContainer,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
|
|
3
|
-
.
|
|
3
|
+
.ant-tooltip.ant-tooltip {
|
|
4
4
|
.ant-tooltip-inner {
|
|
5
5
|
padding: 6px 8px;
|
|
6
6
|
line-height: 16px;
|
|
7
|
-
background:
|
|
8
|
-
border-radius:
|
|
7
|
+
background: var(--alias-colors-bg-skeleton-inverse-subtler, #111827);
|
|
8
|
+
border-radius: var(--alias-radius-50, 4px);
|
|
9
9
|
box-shadow: none;
|
|
10
|
-
color: @ND0;
|
|
11
10
|
font-weight: 400;
|
|
12
11
|
font-size: 12px;
|
|
13
12
|
min-height: 28px;
|
|
13
|
+
color: var(--alias-colors-text-inverse-strong, #fff);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.ant-tooltip-arrow {
|
|
17
17
|
&::before {
|
|
18
|
-
background
|
|
18
|
+
background: var(--alias-colors-bg-skeleton-inverse-subtler, #111827);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.ant-tooltip-arrow-content {
|
|
23
|
-
background:
|
|
23
|
+
background: var(--alias-colors-bg-skeleton-inverse-subtler, #111827);
|
|
24
24
|
}
|
|
25
25
|
}
|
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;
|
|
@@ -131,6 +131,7 @@ export interface TreeProps<T extends BasicDataNode = DataNode> extends Omit<RcTr
|
|
|
131
131
|
titleRender?: (node: T) => React.ReactNode;
|
|
132
132
|
showTabLeader?: boolean;
|
|
133
133
|
handlerRender?: (node: T) => React.ReactNode;
|
|
134
|
+
highlightKeywords?: string;
|
|
134
135
|
}
|
|
135
136
|
declare const Tree: React.ForwardRefExoticComponent<TreeProps<DataNode> & React.RefAttributes<RcTree<DataNode>>>;
|
|
136
137
|
export default Tree;
|
package/dist/Tree/Tree.js
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
|
+
var _excluded = ["className", "showIcon", "showLine", "blockNode", "children", "checkable", "selectable", "draggable", "titleRender", "showTabLeader", "handlerRender", "filterTreeNode", "treeData", "highlightKeywords", "motion"];
|
|
1
2
|
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); }
|
|
3
|
+
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; } } }; }
|
|
4
|
+
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); }
|
|
5
|
+
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
6
|
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
7
|
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
8
|
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; }
|
|
5
9
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
10
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
11
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
8
14
|
import classNames from 'classnames';
|
|
15
|
+
import { produce } from 'immer';
|
|
9
16
|
import { noop } from 'lodash';
|
|
10
17
|
import RcTree from 'rc-tree';
|
|
11
18
|
import * as React from 'react';
|
|
12
19
|
import { ConfigContext } from "../ConfigProvider";
|
|
13
|
-
import
|
|
20
|
+
import HighlightText from "../HighlightText";
|
|
21
|
+
import { ArrowRightLightLine, DragLine } from "../Icon";
|
|
14
22
|
import collapseMotion from "../_utils/motion";
|
|
15
23
|
import dropIndicatorRender from "./utils/dropIndicator";
|
|
16
24
|
import renderSwitcherIcon from "./utils/iconUtil";
|
|
17
|
-
var TREE_SWITCH_LARGE_ICON_SIZE = 20;
|
|
18
25
|
var TREE_SWITCH_CION_SIZE = 16;
|
|
26
|
+
var NODE_DISABLE_CLASS_NAME = 'ald-tree-node-disabled';
|
|
19
27
|
|
|
20
28
|
// [Legacy] Compatible for v3
|
|
21
29
|
|
|
@@ -42,17 +50,21 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
42
50
|
showTabLeader = props.showTabLeader,
|
|
43
51
|
_props$handlerRender = props.handlerRender,
|
|
44
52
|
handlerRender = _props$handlerRender === void 0 ? noop : _props$handlerRender,
|
|
53
|
+
filterTreeNode = props.filterTreeNode,
|
|
54
|
+
treeData = props.treeData,
|
|
55
|
+
highlightKeywords = props.highlightKeywords,
|
|
45
56
|
_props$motion = props.motion,
|
|
46
57
|
motion = _props$motion === void 0 ? _objectSpread(_objectSpread({}, collapseMotion), {}, {
|
|
47
58
|
motionAppear: false
|
|
48
|
-
}) : _props$motion
|
|
59
|
+
}) : _props$motion,
|
|
60
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
49
61
|
var prefixCls = getPrefixCls('tree', 'ald-tree');
|
|
50
62
|
var customTitleRender = React.useCallback(function (node) {
|
|
51
63
|
return /*#__PURE__*/React.createElement(React.Fragment, null, titleRender ? titleRender(node) : node.title, showTabLeader && /*#__PURE__*/React.createElement("div", {
|
|
52
64
|
className: "ald-tree-tab-leader"
|
|
53
65
|
}), handlerRender && handlerRender(node));
|
|
54
66
|
}, [titleRender, showTabLeader, handlerRender]);
|
|
55
|
-
var newProps = _objectSpread(_objectSpread({},
|
|
67
|
+
var newProps = _objectSpread(_objectSpread({}, rest), {}, {
|
|
56
68
|
checkable: checkable,
|
|
57
69
|
selectable: selectable,
|
|
58
70
|
showIcon: showIcon,
|
|
@@ -95,7 +107,7 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
95
107
|
keyEntities = nodeProps.context.keyEntities,
|
|
96
108
|
isLeaf = nodeProps.isLeaf;
|
|
97
109
|
var level = ((_keyEntities = keyEntities[eventKey]) === null || _keyEntities === void 0 ? void 0 : _keyEntities.level) || 0;
|
|
98
|
-
var iconSize =
|
|
110
|
+
var iconSize = TREE_SWITCH_CION_SIZE;
|
|
99
111
|
var indentWidth = isLeaf ? iconSize : 0;
|
|
100
112
|
indentWidth += level * (iconSize / 2);
|
|
101
113
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -105,13 +117,71 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
105
117
|
}
|
|
106
118
|
});
|
|
107
119
|
};
|
|
120
|
+
var newTreeData = React.useMemo(function () {
|
|
121
|
+
if (!filterTreeNode || !treeData) return treeData;
|
|
122
|
+
var shouldNodeDisabled = function shouldNodeDisabled(node) {
|
|
123
|
+
// 初始化一个标志来表示是否需要为当前节点添加className
|
|
124
|
+
var shouldAddDisabled = true;
|
|
125
|
+
if (filterTreeNode(node)) {
|
|
126
|
+
shouldAddDisabled = false;
|
|
127
|
+
}
|
|
128
|
+
if (node.children) {
|
|
129
|
+
// 遍历当前节点的子节点,只要有一个子节点不disable,则该不需要添加className
|
|
130
|
+
var allChildrenShouldAddDisabled = node.children.reduce(function (pre, child) {
|
|
131
|
+
return shouldNodeDisabled(child) && pre;
|
|
132
|
+
}, shouldAddDisabled);
|
|
133
|
+
shouldAddDisabled = allChildrenShouldAddDisabled;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// 如果shouldAddDisabled为true,就为当前节点添加className
|
|
137
|
+
if (shouldAddDisabled) {
|
|
138
|
+
var _node$className;
|
|
139
|
+
node.className = (_node$className = node.className) !== null && _node$className !== void 0 && _node$className.includes(NODE_DISABLE_CLASS_NAME) ? node.className : classNames(node.className, NODE_DISABLE_CLASS_NAME);
|
|
140
|
+
} else {
|
|
141
|
+
var _node$className2;
|
|
142
|
+
var reg = /ald-tree-node-disabled/g;
|
|
143
|
+
(_node$className2 = node.className) === null || _node$className2 === void 0 ? void 0 : _node$className2.replace(reg, ' ');
|
|
144
|
+
}
|
|
145
|
+
if (highlightKeywords && typeof node.title !== 'function') {
|
|
146
|
+
node.title = /*#__PURE__*/React.createElement(HighlightText, {
|
|
147
|
+
keyword: highlightKeywords
|
|
148
|
+
}, node.title);
|
|
149
|
+
}
|
|
150
|
+
return shouldAddDisabled;
|
|
151
|
+
};
|
|
152
|
+
var newTreeData = produce(treeData, function (draft) {
|
|
153
|
+
var _iterator = _createForOfIteratorHelper(draft),
|
|
154
|
+
_step;
|
|
155
|
+
try {
|
|
156
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
157
|
+
var rootNode = _step.value;
|
|
158
|
+
shouldNodeDisabled(rootNode);
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
_iterator.e(err);
|
|
162
|
+
} finally {
|
|
163
|
+
_iterator.f();
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return newTreeData;
|
|
167
|
+
}, [filterTreeNode, treeData, highlightKeywords]);
|
|
168
|
+
var noChildren = React.useMemo(function () {
|
|
169
|
+
if (newTreeData !== null && newTreeData !== void 0 && newTreeData.length) {
|
|
170
|
+
return newTreeData.every(function (node) {
|
|
171
|
+
var _node$children;
|
|
172
|
+
return !((_node$children = node.children) !== null && _node$children !== void 0 && _node$children.length);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return true;
|
|
176
|
+
}, [newTreeData]);
|
|
108
177
|
return /*#__PURE__*/React.createElement(RcTree, _extends({
|
|
109
178
|
itemHeight: 20,
|
|
110
179
|
ref: ref,
|
|
111
180
|
virtual: virtual
|
|
112
181
|
}, newProps, {
|
|
113
182
|
prefixCls: prefixCls,
|
|
114
|
-
|
|
183
|
+
treeData: newTreeData,
|
|
184
|
+
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), _defineProperty(_classNames, "".concat(prefixCls, "-no-children"), noChildren), _classNames), className),
|
|
115
185
|
direction: direction,
|
|
116
186
|
checkable: checkable ? /*#__PURE__*/React.createElement("span", {
|
|
117
187
|
className: "".concat(prefixCls, "-checkbox-inner")
|
|
@@ -120,10 +190,10 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
120
190
|
// @ts-ignore
|
|
121
191
|
,
|
|
122
192
|
switcherIcon: function switcherIcon(nodeProps) {
|
|
123
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderIndent(nodeProps), renderSwitcherIcon(prefixCls, /*#__PURE__*/React.createElement(
|
|
124
|
-
size:
|
|
125
|
-
color: '#
|
|
126
|
-
}, "\u5C55\u5F00"), showLine, nodeProps,
|
|
193
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderIndent(nodeProps), renderSwitcherIcon(prefixCls, /*#__PURE__*/React.createElement(ArrowRightLightLine, {
|
|
194
|
+
size: TREE_SWITCH_CION_SIZE,
|
|
195
|
+
color: '#9CA3AF'
|
|
196
|
+
}, "\u5C55\u5F00"), showLine, nodeProps, TREE_SWITCH_CION_SIZE));
|
|
127
197
|
},
|
|
128
198
|
draggable: draggableConfig
|
|
129
199
|
}), children);
|
|
@@ -4,6 +4,7 @@ export default (function () {
|
|
|
4
4
|
return /*#__PURE__*/React.createElement(App, null, /*#__PURE__*/React.createElement(Tree, {
|
|
5
5
|
size: "large",
|
|
6
6
|
showIcon: true,
|
|
7
|
+
checkable: true,
|
|
7
8
|
icon: 'icon',
|
|
8
9
|
treeData: [{
|
|
9
10
|
title: 'Parent 1',
|
|
@@ -33,6 +34,9 @@ export default (function () {
|
|
|
33
34
|
disabled: true
|
|
34
35
|
}]
|
|
35
36
|
}]
|
|
37
|
+
}, {
|
|
38
|
+
title: 'Parent 2',
|
|
39
|
+
key: '1-1'
|
|
36
40
|
}]
|
|
37
41
|
}));
|
|
38
42
|
});
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
highlightKeywords: filterKey,
|
|
34
|
+
expandedKeys: expandedKeys,
|
|
35
|
+
onExpand: function onExpand(keys) {
|
|
36
|
+
setExpandedKeys(keys);
|
|
37
|
+
},
|
|
38
|
+
treeData: [{
|
|
39
|
+
title: 'Parent 1',
|
|
40
|
+
key: '0-0',
|
|
41
|
+
children: [{
|
|
42
|
+
title: 'parent 1-0',
|
|
43
|
+
key: '0-0-0',
|
|
44
|
+
children: [{
|
|
45
|
+
title: 'leaf',
|
|
46
|
+
key: '0-0-0-0',
|
|
47
|
+
isLeaf: true
|
|
48
|
+
}, {
|
|
49
|
+
title: 'leaf',
|
|
50
|
+
key: '0-0-0-1',
|
|
51
|
+
isLeaf: true
|
|
52
|
+
}]
|
|
53
|
+
}, {
|
|
54
|
+
title: 'parent 1-1',
|
|
55
|
+
key: '0-0-1',
|
|
56
|
+
children: [{
|
|
57
|
+
title: 'ssss',
|
|
58
|
+
key: '0-0-1-0',
|
|
59
|
+
disabled: true
|
|
60
|
+
}]
|
|
61
|
+
}]
|
|
62
|
+
}]
|
|
63
|
+
}));
|
|
64
|
+
});
|