@aloudata/aloudata-design 2.0.0-beta.13 → 2.0.0-beta.15

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.
@@ -118,8 +118,8 @@
118
118
  }
119
119
 
120
120
  .ant-checkbox-inner {
121
- width: 16px;
122
- height: 16px;
121
+ width: 14px;
122
+ height: 14px;
123
123
  background-color: @checkbox-inner-bgc-normal;
124
124
  border-color: @checkbox-border-color-normal;
125
125
  border-radius: 2px;
@@ -20,6 +20,7 @@ var AldCustomConfigProvider = function AldCustomConfigProvider(props) {
20
20
  }, children);
21
21
  }
22
22
  return /*#__PURE__*/React.createElement(ConfigProvider, _extends({
23
+ autoInsertSpaceInButton: false,
23
24
  theme: {
24
25
  token: {
25
26
  fontFamily: "Inter,'PingFang SC', system-ui, -apple-system, blinkmacsystemfont,\n 'Helvetica Neue', 'Segoe UI', helvetica, arial, 'Microsoft YaHei',\n 'WenQuanYi Micro Hei', sans-serif;"
@@ -38,12 +38,12 @@
38
38
  padding: 4px 13px 3px 20px;
39
39
  height: 100%;
40
40
  width: 100%;
41
- line-height: 20px;
41
+ line-height: 25px;
42
42
  background: var(--alias-colors-bg-skeleton-subtle, #f9fafb);
43
43
 
44
44
  .ald-data-preview-header-left {
45
45
  width: 20px;
46
- height: 20px;
46
+ height: 100%;
47
47
  display: flex;
48
48
  align-items: center;
49
49
  justify-content: center;
@@ -52,6 +52,8 @@
52
52
  left: 4px;
53
53
  z-index: 1;
54
54
  color: #575757;
55
+ top: 0;
56
+ bottom: 0;
55
57
  // background:rgb(0 0 0 / 0%)
56
58
  }
57
59
 
@@ -1,2 +1,3 @@
1
1
  import '../../style';
2
+ import '../../Tooltip/style/index';
2
3
  import './index.less';
@@ -1,2 +1,3 @@
1
1
  import "../../style";
2
+ import "../../Tooltip/style/index";
2
3
  import "./index.less";
@@ -191,6 +191,11 @@ var Component = function Component(_ref) {
191
191
  setDropdownOpen(open);
192
192
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(open);
193
193
  }, [onOpenChange]);
194
+ var panelKey = useMemo(function () {
195
+ if (dropdownOpen) {
196
+ return _.sampleSize('abcdefghijklmnopqrstuvwxyz0123456789', 8).join('');
197
+ }
198
+ }, [dropdownOpen]);
194
199
  return /*#__PURE__*/React.createElement(Select, _extends({
195
200
  prefix: propPrefix
196
201
  }, restProps, {
@@ -252,6 +257,7 @@ var Component = function Component(_ref) {
252
257
  dataList: totalUserList,
253
258
  lockedIds: lockedIds,
254
259
  multiple: multiple,
260
+ key: panelKey,
255
261
  loading: loading,
256
262
  dropdownWidth: dropdownContentWidth,
257
263
  onSearchValueChange: onSearchValueChange,
@@ -9,7 +9,6 @@ import _ from 'lodash';
9
9
  import React, { useContext, useEffect, useRef } from 'react';
10
10
  import { getUUID } from "../../../_utils/hooks/useId";
11
11
  import { RadioGroupContext } from "../Group";
12
- var FILL_BUTTON_MARGIN = 4;
13
12
  export default function Radio(props) {
14
13
  var groupContext = useContext(RadioGroupContext);
15
14
  var labelRef = useRef(null);
@@ -63,8 +62,8 @@ export default function Radio(props) {
63
62
  useEffect(function () {
64
63
  var _groupContext$sliderR;
65
64
  if (radioProps.checked && groupContext !== null && groupContext !== void 0 && (_groupContext$sliderR = groupContext.sliderRef) !== null && _groupContext$sliderR !== void 0 && _groupContext$sliderR.current && labelRef !== null && labelRef !== void 0 && labelRef.current) {
66
- groupContext.sliderRef.current.style.left = "".concat(labelRef.current.offsetLeft, "px");
67
- groupContext.sliderRef.current.style.width = "".concat(labelRef.current.offsetWidth - FILL_BUTTON_MARGIN, "px");
65
+ groupContext.sliderRef.current.style.left = "".concat(labelRef.current.offsetLeft - 2, "px");
66
+ groupContext.sliderRef.current.style.width = "".concat(labelRef.current.offsetWidth, "px");
68
67
  }
69
68
  }, [groupContext.sliderRef, radioProps.checked]);
70
69
  var onChange = function onChange() {
@@ -90,6 +89,29 @@ export default function Radio(props) {
90
89
  }), /*#__PURE__*/React.createElement("span", {
91
90
  className: "ald-radio-inner"
92
91
  })), /*#__PURE__*/React.createElement("span", {
93
- className: "ald-radio-desc"
92
+ className: "ald-radio-desc",
93
+ onMouseEnter: function onMouseEnter() {
94
+ if (radioProps.checked) {
95
+ var _groupContext$sliderR2, _groupContext$sliderR3;
96
+ (_groupContext$sliderR2 = groupContext.sliderRef) === null || _groupContext$sliderR2 === void 0 ? void 0 : (_groupContext$sliderR3 = _groupContext$sliderR2.current) === null || _groupContext$sliderR3 === void 0 ? void 0 : _groupContext$sliderR3.classList.add('ald-radio-fill-slider-hover');
97
+ }
98
+ },
99
+ onMouseLeave: function onMouseLeave() {
100
+ if (radioProps.checked) {
101
+ var _groupContext$sliderR4, _groupContext$sliderR5, _groupContext$sliderR6, _groupContext$sliderR7;
102
+ (_groupContext$sliderR4 = groupContext.sliderRef) === null || _groupContext$sliderR4 === void 0 ? void 0 : (_groupContext$sliderR5 = _groupContext$sliderR4.current) === null || _groupContext$sliderR5 === void 0 ? void 0 : _groupContext$sliderR5.classList.remove('ald-radio-fill-slider-hover');
103
+ (_groupContext$sliderR6 = groupContext.sliderRef) === null || _groupContext$sliderR6 === void 0 ? void 0 : (_groupContext$sliderR7 = _groupContext$sliderR6.current) === null || _groupContext$sliderR7 === void 0 ? void 0 : _groupContext$sliderR7.classList.remove('ald-radio-fill-slider-active');
104
+ }
105
+ },
106
+ onMouseDown: function onMouseDown() {
107
+ if (radioProps.checked) {
108
+ var _groupContext$sliderR8, _groupContext$sliderR9;
109
+ (_groupContext$sliderR8 = groupContext.sliderRef) === null || _groupContext$sliderR8 === void 0 ? void 0 : (_groupContext$sliderR9 = _groupContext$sliderR8.current) === null || _groupContext$sliderR9 === void 0 ? void 0 : _groupContext$sliderR9.classList.add('ald-radio-fill-slider-active');
110
+ }
111
+ },
112
+ onMouseUp: function onMouseUp() {
113
+ var _groupContext$sliderR10, _groupContext$sliderR11;
114
+ if (radioProps.checked) (_groupContext$sliderR10 = groupContext.sliderRef) === null || _groupContext$sliderR10 === void 0 ? void 0 : (_groupContext$sliderR11 = _groupContext$sliderR10.current) === null || _groupContext$sliderR11 === void 0 ? void 0 : _groupContext$sliderR11.classList.remove('ald-radio-fill-slider-active');
115
+ }
94
116
  }, props.children));
95
117
  }
@@ -183,12 +183,17 @@
183
183
  // transition: width, left, height 0.3s, 0.3s, 0.3s ease;
184
184
  cursor: pointer;
185
185
 
186
- &:hover {
186
+ &:hover,
187
+ &.ald-radio-fill-slider-hover {
188
+ border-radius: var(--alias-radius-75, 6px);
187
189
  border: 1px solid
188
190
  var(--alias-colors-border-accent-gray-subtle-hover, #9ca3af);
191
+ background: var(--alias-colors-bg-skeleton-subtler, #fff);
189
192
  }
190
193
 
191
- &:active {
194
+ &:active,
195
+ &.ald-radio-fill-slider-active {
196
+ border-radius: var(--alias-radius-75, 6px);
192
197
  border: 1px solid
193
198
  var(--alias-colors-border-accent-gray-subtle-default, #d1d5db);
194
199
  background: var(--alias-colors-bg-skeleton-subtle, #f9fafb);
@@ -202,7 +207,6 @@
202
207
  align-items: flex-start;
203
208
  box-sizing: border-box;
204
209
  width: min-content;
205
- width: auto;
206
210
  padding: 0;
207
211
  overflow: hidden;
208
212
 
@@ -368,6 +372,11 @@
368
372
  // 各种大小
369
373
  &.ald-radio-group-middle {
370
374
  height: @radio-group-height-middle;
375
+ border-radius: @border-radius-middle;
376
+
377
+ .ald-radio-filled-slider {
378
+ border-radius: var(--alias-radius-50, 4px);
379
+ }
371
380
 
372
381
  .ald-radio-label {
373
382
  .ald-radio-desc {
@@ -375,6 +384,12 @@
375
384
  }
376
385
  }
377
386
 
387
+ .ald-radio-label.ald-radio-button-wrapper-filled {
388
+ height: 28px;
389
+ border-radius: @border-radius-middle;
390
+ margin-top: 2px;
391
+ }
392
+
378
393
  .ald-radio-icon-button-wrapper-filled,
379
394
  .ald-radio-icon-button-wrapper-filter {
380
395
  padding: 0 @radio-icon-button-padding-middle;
@@ -409,6 +424,11 @@
409
424
 
410
425
  &.ald-radio-group-small {
411
426
  height: @radio-group-height-small;
427
+ border-radius: @border-radius-small;
428
+
429
+ .ald-radio-filled-slider {
430
+ border-radius: var(--alias-radius-25, 2px);
431
+ }
412
432
 
413
433
  .ald-radio-label {
414
434
  .ald-radio-desc {
@@ -416,6 +436,12 @@
416
436
  }
417
437
  }
418
438
 
439
+ .ald-radio-label.ald-radio-button-wrapper-filled {
440
+ height: 24px;
441
+ margin-top: 2px;
442
+ border-radius: @border-radius-small;
443
+ }
444
+
419
445
  .ald-radio-icon-button-wrapper-filled,
420
446
  .ald-radio-icon-button-wrapper-filter {
421
447
  padding: 0 @radio-icon-button-padding-small;
@@ -469,6 +495,17 @@
469
495
 
470
496
  &.ald-radio-group.ald-radio-group-large {
471
497
  height: @radio-group-height-large;
498
+ border-radius: @border-radius-large;
499
+
500
+ .ald-radio-filled-slider {
501
+ border-radius: var(--alias-radius-75, 6px);
502
+ }
503
+
504
+ .ald-radio-label.ald-radio-button-wrapper-filled {
505
+ height: 32px;
506
+ margin-top: 2px;
507
+ border-radius: @border-radius-large!important;
508
+ }
472
509
 
473
510
  .ald-radio-label {
474
511
  .ald-radio-desc {
@@ -527,3 +564,20 @@
527
564
  }
528
565
  }
529
566
  }
567
+
568
+ .ald-radio-group-filled {
569
+ display: flex;
570
+ gap: 2px;
571
+ background: var(--alias-colors-bg-skeleton-strong, #f3f4f6);
572
+ padding: 0 2px;
573
+
574
+ .ald-radio-label:not(.ald-radio-wrapper-disabled) {
575
+ &:hover {
576
+ background: var(--alias-colors-bg-interaction-hover, rgba(0, 0, 0, 0.05));
577
+ }
578
+
579
+ &:active {
580
+ background: var(--alias-colors-bg-interaction-press, rgba(0, 0, 0, 0.1));
581
+ }
582
+ }
583
+ }
@@ -393,7 +393,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
393
393
  bordered: false,
394
394
  open: typeof _open === 'boolean' ? _open : isOpen,
395
395
  disabled: mergedDisabled,
396
- maxTagCount: 1,
396
+ maxTagCount: type === 'secondary' ? 'responsive' : 1,
397
397
  ref: selectRef,
398
398
  tagRender: tagRender || defaultTagRender,
399
399
  onChange: onChange,
@@ -414,7 +414,6 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
414
414
  className: "ald-select-suffix-icon"
415
415
  }),
416
416
  onDropdownVisibleChange: function onDropdownVisibleChange(open) {
417
- console.log(open, 'open');
418
417
  setIsOpen(open);
419
418
  if (!open) {
420
419
  dropDownTimeRef.current = Date.now();
@@ -34,6 +34,10 @@
34
34
  &.ald-select-prefix-multiple {
35
35
  cursor: default;
36
36
  }
37
+
38
+ .ant-select-selection-overflow {
39
+ margin-left: 6px;
40
+ }
37
41
  }
38
42
 
39
43
  .ant-select {
@@ -64,14 +68,13 @@
64
68
  .ant-select-selection-overflow {
65
69
  align-self: normal;
66
70
  flex-wrap: nowrap;
67
- margin-left: 6px;
68
71
  min-width: 52px;
69
72
  height: 100%;
70
73
 
71
74
  .ant-select-selection-overflow-item {
72
75
  align-items: center;
73
76
  line-height: inherit;
74
- flex: 1;
77
+ // flex: 1;
75
78
  min-width: 0;
76
79
  // height: 100%;
77
80
 
@@ -114,11 +117,6 @@
114
117
  height: 16px;
115
118
  padding: 0 var(--alias-spacing-50, 4px);
116
119
  border-radius: var(--alias-radius-100, 8px);
117
- background: var(
118
- --alias-colors-bg-accent-blue-subtle-default,
119
- #d4e7fd
120
- );
121
- color: var(--alias-colors-text-information, #0f59b1);
122
120
  font-size: 12px;
123
121
  }
124
122
  }
@@ -134,6 +132,17 @@
134
132
  white-space: nowrap;
135
133
  text-overflow: ellipsis;
136
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
+ }
137
146
  }
138
147
 
139
148
  .ant-select-selection-search-input {
@@ -14,6 +14,16 @@
14
14
  &.ald-select-multiple .ant-select {
15
15
  .ant-select-selector {
16
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
+ }
17
27
  }
18
28
  }
19
29
 
@@ -62,6 +72,17 @@
62
72
  &.ald-select-secondary {
63
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));
64
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
+
65
86
  &.ald-select-fitted {
66
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));
67
88
  }
@@ -1,25 +1,25 @@
1
1
  @import '../../style/index.less';
2
2
 
3
- .ald-tooltip-overlay.ald-tooltip-overlay {
3
+ .ant-tooltip.ant-tooltip {
4
4
  .ant-tooltip-inner {
5
5
  padding: 6px 8px;
6
6
  line-height: 16px;
7
- background: @BG10;
8
- border-radius: 2px;
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-color: @BG10;
18
+ background: var(--alias-colors-bg-skeleton-inverse-subtler, #111827);
19
19
  }
20
20
  }
21
21
 
22
22
  .ant-tooltip-arrow-content {
23
- background: @BG10;
23
+ background: var(--alias-colors-bg-skeleton-inverse-subtler, #111827);
24
24
  }
25
25
  }
@@ -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
+ highlightFilteredTitle?: boolean;
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,3 +1,4 @@
1
+ var _excluded = ["className", "showIcon", "showLine", "blockNode", "children", "checkable", "selectable", "draggable", "titleRender", "showTabLeader", "handlerRender", "filterTreeNode", "treeData", "highlightFilteredTitle", "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); }
2
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; } } }; }
3
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); }
@@ -8,7 +9,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
8
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; }
9
10
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
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; }
11
14
  import classNames from 'classnames';
15
+ import { produce } from 'immer';
12
16
  import { noop } from 'lodash';
13
17
  import RcTree from 'rc-tree';
14
18
  import * as React from 'react';
@@ -18,6 +22,7 @@ import collapseMotion from "../_utils/motion";
18
22
  import dropIndicatorRender from "./utils/dropIndicator";
19
23
  import renderSwitcherIcon from "./utils/iconUtil";
20
24
  var TREE_SWITCH_CION_SIZE = 16;
25
+ var NODE_DISABLE_CLASS_NAME = 'ald-tree-node-disabled';
21
26
 
22
27
  // [Legacy] Compatible for v3
23
28
 
@@ -46,17 +51,19 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
46
51
  handlerRender = _props$handlerRender === void 0 ? noop : _props$handlerRender,
47
52
  filterTreeNode = props.filterTreeNode,
48
53
  treeData = props.treeData,
54
+ highlightFilteredTitle = props.highlightFilteredTitle,
49
55
  _props$motion = props.motion,
50
56
  motion = _props$motion === void 0 ? _objectSpread(_objectSpread({}, collapseMotion), {}, {
51
57
  motionAppear: false
52
- }) : _props$motion;
58
+ }) : _props$motion,
59
+ rest = _objectWithoutProperties(props, _excluded);
53
60
  var prefixCls = getPrefixCls('tree', 'ald-tree');
54
61
  var customTitleRender = React.useCallback(function (node) {
55
62
  return /*#__PURE__*/React.createElement(React.Fragment, null, titleRender ? titleRender(node) : node.title, showTabLeader && /*#__PURE__*/React.createElement("div", {
56
63
  className: "ald-tree-tab-leader"
57
64
  }), handlerRender && handlerRender(node));
58
65
  }, [titleRender, showTabLeader, handlerRender]);
59
- var newProps = _objectSpread(_objectSpread({}, props), {}, {
66
+ var newProps = _objectSpread(_objectSpread({}, rest), {}, {
60
67
  checkable: checkable,
61
68
  selectable: selectable,
62
69
  showIcon: showIcon,
@@ -110,52 +117,47 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
110
117
  });
111
118
  };
112
119
  var newTreeData = React.useMemo(function () {
113
- if (!filterTreeNode) return treeData;
114
- var processNode = function processNode(node) {
115
- // 初始化一个标志来表示是否需要为当前节点及其所有子节点添加className
120
+ if (!filterTreeNode || !treeData) return treeData;
121
+ var shouldNodeDisabled = function shouldNodeDisabled(node) {
122
+ // 初始化一个标志来表示是否需要为当前节点添加className
116
123
  var shouldAddDisabled = true;
117
- // 检查当前节点的title是否包含目标字符串,包含则不需要添加className
118
124
  if (filterTreeNode(node)) {
119
125
  shouldAddDisabled = false;
120
126
  }
121
127
  if (node.children) {
122
- // 遍历当前节点的子节点
123
- var _iterator = _createForOfIteratorHelper(node.children),
124
- _step;
125
- try {
126
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
127
- var child = _step.value;
128
- // 递归调用processNode函数来处理子节点,判断子节点是否需要添加className
129
- var childShouldAddDisabled = processNode(child);
130
- shouldAddDisabled = shouldAddDisabled && childShouldAddDisabled;
131
- }
132
- } catch (err) {
133
- _iterator.e(err);
134
- } finally {
135
- _iterator.f();
136
- }
128
+ // 遍历当前节点的子节点,只要有一个子节点不disable,则该不需要添加className
129
+ var allChildrenShouldAddDisabled = node.children.reduce(function (pre, child) {
130
+ return shouldNodeDisabled(child) && pre;
131
+ }, shouldAddDisabled);
132
+ shouldAddDisabled = allChildrenShouldAddDisabled;
137
133
  }
138
134
 
139
135
  // 如果shouldAddDisabled为true,就为当前节点添加className
140
136
  if (shouldAddDisabled) {
141
- node.className = classNames(node.className, 'ald-tree-node-disabled');
137
+ var _node$className;
138
+ 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);
139
+ } else {
140
+ var _node$className2;
141
+ var reg = /ald-tree-node-disabled/g;
142
+ (_node$className2 = node.className) === null || _node$className2 === void 0 ? void 0 : _node$className2.replace(reg, ' ');
142
143
  }
143
144
  return shouldAddDisabled;
144
145
  };
145
- if (!treeData) return treeData;
146
- var _iterator2 = _createForOfIteratorHelper(treeData),
147
- _step2;
148
- try {
149
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
150
- var rootNode = _step2.value;
151
- processNode(rootNode);
146
+ var newTreeData = produce(treeData, function (draft) {
147
+ var _iterator = _createForOfIteratorHelper(draft),
148
+ _step;
149
+ try {
150
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
151
+ var rootNode = _step.value;
152
+ shouldNodeDisabled(rootNode);
153
+ }
154
+ } catch (err) {
155
+ _iterator.e(err);
156
+ } finally {
157
+ _iterator.f();
152
158
  }
153
- } catch (err) {
154
- _iterator2.e(err);
155
- } finally {
156
- _iterator2.f();
157
- }
158
- return treeData;
159
+ });
160
+ return newTreeData;
159
161
  }, [filterTreeNode, treeData]);
160
162
  var noChildren = React.useMemo(function () {
161
163
  if (newTreeData !== null && newTreeData !== void 0 && newTreeData.length) {
@@ -173,7 +175,7 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
173
175
  }, newProps, {
174
176
  prefixCls: prefixCls,
175
177
  treeData: newTreeData,
176
- 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),
178
+ 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), _defineProperty(_classNames, 'ald-tree-highlight-filtered-title', highlightFilteredTitle), _classNames), className),
177
179
  direction: direction,
178
180
  checkable: checkable ? /*#__PURE__*/React.createElement("span", {
179
181
  className: "".concat(prefixCls, "-checkbox-inner")
@@ -30,6 +30,48 @@ export default (function () {
30
30
  }
31
31
  return false;
32
32
  },
33
+ highlightFilteredTitle: true,
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
+ }), /*#__PURE__*/React.createElement("p", null), /*#__PURE__*/React.createElement(Tree, {
64
+ size: "large",
65
+ showIcon: true,
66
+ icon: 'icon',
67
+ filterTreeNode: function filterTreeNode(node) {
68
+ var title = node.title;
69
+ if (typeof title === 'string') {
70
+ return title.includes('2');
71
+ }
72
+ return false;
73
+ },
74
+ highlightFilteredTitle: true,
33
75
  expandedKeys: expandedKeys,
34
76
  onExpand: function onExpand(keys) {
35
77
  setExpandedKeys(keys);
@@ -26,13 +26,15 @@
26
26
  padding: 3px 0;
27
27
  }
28
28
 
29
- .ald-tree-treenode.ald-tree-treenode-draggable {
30
- .ald-tree-draggable-icon {
31
- opacity: 1;
32
- cursor: grab;
33
-
34
- &:active {
35
- cursor: grabbing;
29
+ .ald-tree-treenode {
30
+ &.ald-tree-treenode-draggable {
31
+ .ald-tree-draggable-icon {
32
+ opacity: 1;
33
+ cursor: grab;
34
+
35
+ &:active {
36
+ cursor: grabbing;
37
+ }
36
38
  }
37
39
  }
38
40
  }
@@ -42,6 +44,15 @@
42
44
  display: none;
43
45
  }
44
46
  }
47
+
48
+ &.ald-tree-highlight-filtered-title {
49
+ .filter-node {
50
+ .ald-tree-title {
51
+ font-weight: 500;
52
+ color: var(--alias-colors-text-danger);
53
+ }
54
+ }
55
+ }
45
56
  }
46
57
 
47
58
  .ald-tree-treenode {
@@ -102,10 +102,10 @@
102
102
  background: @tree-node-hover-bg;
103
103
  }
104
104
 
105
- &:not(&-disabled).filter-node .@{custom-tree-prefix-cls}-title {
106
- font-weight: 500;
107
- color: var(--alias-colors-text-danger);
108
- }
105
+ // &:not(&-disabled).filter-node .@{custom-tree-prefix-cls}-title {
106
+ // // font-weight: 500;
107
+ // // color: var(--alias-colors-text-danger);
108
+ // }
109
109
 
110
110
  &-draggable {
111
111
  .@{custom-tree-prefix-cls}-draggable-icon {