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

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.
@@ -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();
@@ -71,7 +71,7 @@
71
71
  .ant-select-selection-overflow-item {
72
72
  align-items: center;
73
73
  line-height: inherit;
74
- flex: 1;
74
+ // flex: 1;
75
75
  min-width: 0;
76
76
  // height: 100%;
77
77
 
@@ -114,11 +114,6 @@
114
114
  height: 16px;
115
115
  padding: 0 var(--alias-spacing-50, 4px);
116
116
  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
117
  font-size: 12px;
123
118
  }
124
119
  }
@@ -134,6 +129,17 @@
134
129
  white-space: nowrap;
135
130
  text-overflow: ellipsis;
136
131
  overflow: hidden;
132
+ // position: relative;;
133
+
134
+ &::before {
135
+ content: ',';
136
+ }
137
+ }
138
+
139
+ &:first-of-type {
140
+ .ald-select-multiple-tag-default::before {
141
+ content: '';
142
+ }
137
143
  }
138
144
 
139
145
  .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
  }
@@ -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
@@ -9,7 +9,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
9
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
10
  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); }
11
11
  import classNames from 'classnames';
12
- import { noop } from 'lodash';
12
+ import { cloneDeep, noop } from 'lodash';
13
13
  import RcTree from 'rc-tree';
14
14
  import * as React from 'react';
15
15
  import { ConfigContext } from "../ConfigProvider";
@@ -18,6 +18,7 @@ import collapseMotion from "../_utils/motion";
18
18
  import dropIndicatorRender from "./utils/dropIndicator";
19
19
  import renderSwitcherIcon from "./utils/iconUtil";
20
20
  var TREE_SWITCH_CION_SIZE = 16;
21
+ var NODE_DISABLE_CLASS_NAME = 'ald-tree-node-disabled';
21
22
 
22
23
  // [Legacy] Compatible for v3
23
24
 
@@ -46,6 +47,7 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
46
47
  handlerRender = _props$handlerRender === void 0 ? noop : _props$handlerRender,
47
48
  filterTreeNode = props.filterTreeNode,
48
49
  treeData = props.treeData,
50
+ highlightFilteredTitle = props.highlightFilteredTitle,
49
51
  _props$motion = props.motion,
50
52
  motion = _props$motion === void 0 ? _objectSpread(_objectSpread({}, collapseMotion), {}, {
51
53
  motionAppear: false
@@ -111,51 +113,46 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
111
113
  };
112
114
  var newTreeData = React.useMemo(function () {
113
115
  if (!filterTreeNode) return treeData;
114
- var processNode = function processNode(node) {
115
- // 初始化一个标志来表示是否需要为当前节点及其所有子节点添加className
116
+ var treeDataClone = cloneDeep(treeData);
117
+ var shouldNodeDisabled = function shouldNodeDisabled(node) {
118
+ // 初始化一个标志来表示是否需要为当前节点添加className
116
119
  var shouldAddDisabled = true;
117
- // 检查当前节点的title是否包含目标字符串,包含则不需要添加className
118
120
  if (filterTreeNode(node)) {
119
121
  shouldAddDisabled = false;
120
122
  }
121
123
  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
- }
124
+ // 遍历当前节点的子节点,只要有一个子节点不disable,则该不需要添加className
125
+ var allChildrenShouldAddDisabled = node.children.reduce(function (pre, child) {
126
+ return shouldNodeDisabled(child) && pre;
127
+ }, shouldAddDisabled);
128
+ shouldAddDisabled = allChildrenShouldAddDisabled;
137
129
  }
138
130
 
139
131
  // 如果shouldAddDisabled为true,就为当前节点添加className
140
132
  if (shouldAddDisabled) {
141
- node.className = classNames(node.className, 'ald-tree-node-disabled');
133
+ var _node$className;
134
+ 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);
135
+ } else {
136
+ var _node$className2;
137
+ var reg = /ald-tree-node-disabled/g;
138
+ (_node$className2 = node.className) === null || _node$className2 === void 0 ? void 0 : _node$className2.replace(reg, ' ');
142
139
  }
143
140
  return shouldAddDisabled;
144
141
  };
145
- if (!treeData) return treeData;
146
- var _iterator2 = _createForOfIteratorHelper(treeData),
147
- _step2;
142
+ if (!treeDataClone) return treeDataClone;
143
+ var _iterator = _createForOfIteratorHelper(treeDataClone),
144
+ _step;
148
145
  try {
149
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
150
- var rootNode = _step2.value;
151
- processNode(rootNode);
146
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
147
+ var rootNode = _step.value;
148
+ shouldNodeDisabled(rootNode);
152
149
  }
153
150
  } catch (err) {
154
- _iterator2.e(err);
151
+ _iterator.e(err);
155
152
  } finally {
156
- _iterator2.f();
153
+ _iterator.f();
157
154
  }
158
- return treeData;
155
+ return treeDataClone;
159
156
  }, [filterTreeNode, treeData]);
160
157
  var noChildren = React.useMemo(function () {
161
158
  if (newTreeData !== null && newTreeData !== void 0 && newTreeData.length) {
@@ -173,7 +170,7 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
173
170
  }, newProps, {
174
171
  prefixCls: prefixCls,
175
172
  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),
173
+ 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
174
  direction: direction,
178
175
  checkable: checkable ? /*#__PURE__*/React.createElement("span", {
179
176
  className: "".concat(prefixCls, "-checkbox-inner")
@@ -30,6 +30,7 @@ export default (function () {
30
30
  }
31
31
  return false;
32
32
  },
33
+ highlightFilteredTitle: true,
33
34
  expandedKeys: expandedKeys,
34
35
  onExpand: function onExpand(keys) {
35
36
  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 {