@aloudata/aloudata-design 2.0.0-beta.10 → 2.0.0-beta.12

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.
Files changed (42) hide show
  1. package/dist/Button/style/index.less +4 -0
  2. package/dist/Checkbox/style/index.less +0 -3
  3. package/dist/ConfigProvider/index.d.ts +1 -1
  4. package/dist/ConfigProvider/index.js +8 -1
  5. package/dist/DataPreviewTable/components/Body/index.js +7 -0
  6. package/dist/DataPreviewTable/interface.d.ts +1 -0
  7. package/dist/DataPreviewTable/style/index.less +2 -1
  8. package/dist/Dropdown/index.js +4 -1
  9. package/dist/Dropdown/style/index.less +11 -0
  10. package/dist/Empty/style/index.less +2 -2
  11. package/dist/Icon/components/TimesLightLine.d.ts +11 -0
  12. package/dist/Icon/components/TimesLightLine.js +35 -0
  13. package/dist/Icon/index.d.ts +1 -0
  14. package/dist/Icon/index.js +1 -0
  15. package/dist/Icon/svg/Times-light-line.svg +5 -0
  16. package/dist/IconButton/index.js +4 -1
  17. package/dist/Input/components/Input/index.js +2 -1
  18. package/dist/Input/components/TextArea/index.js +7 -4
  19. package/dist/MemberPicker/index.js +19 -2
  20. package/dist/MemberPicker/style/index.less +6 -3
  21. package/dist/Modal/style/polyfill/index.less +0 -3
  22. package/dist/Popconfirm/index.js +1 -1
  23. package/dist/Popconfirm/style/index.less +2 -4
  24. package/dist/Progress/style/index.less +5 -2
  25. package/dist/Select/index.js +4 -3
  26. package/dist/Select/style/index.less +1 -0
  27. package/dist/Select/style/layout.less +1 -0
  28. package/dist/Select/style/status.less +17 -1
  29. package/dist/Table/style/index.less +6 -5
  30. package/dist/Tabs/style/index.less +1 -5
  31. package/dist/Tooltip/index.js +5 -3
  32. package/dist/Tree/Tree.d.ts +2 -2
  33. package/dist/Tree/Tree.js +65 -2
  34. package/dist/Tree/demo/basic/index.js +3 -0
  35. package/dist/Tree/demo/filter/index.d.ts +3 -0
  36. package/dist/Tree/demo/filter/index.js +63 -0
  37. package/dist/Tree/style/index.less +10 -0
  38. package/dist/Tree/style/mixin.less +7 -3
  39. package/dist/ald.min.css +1 -1
  40. package/dist/style/index.less +3 -3
  41. package/dist/style/themes/default/index.less +3 -1
  42. package/package.json +1 -1
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; }
@@ -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,71 @@ 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]);
161
+ var noChildren = React.useMemo(function () {
162
+ if (newTreeData !== null && newTreeData !== void 0 && newTreeData.length) {
163
+ return newTreeData.every(function (node) {
164
+ var _node$children;
165
+ return !((_node$children = node.children) !== null && _node$children !== void 0 && _node$children.length);
166
+ });
167
+ }
168
+ return true;
169
+ }, [newTreeData]);
108
170
  return /*#__PURE__*/React.createElement(RcTree, _extends({
109
171
  itemHeight: 20,
110
172
  ref: ref,
111
173
  virtual: virtual
112
174
  }, newProps, {
113
175
  prefixCls: prefixCls,
114
- 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),
176
+ treeData: newTreeData,
177
+ 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
178
  direction: direction,
116
179
  checkable: checkable ? /*#__PURE__*/React.createElement("span", {
117
180
  className: "".concat(prefixCls, "-checkbox-inner")
@@ -122,7 +185,7 @@ var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
122
185
  switcherIcon: function switcherIcon(nodeProps) {
123
186
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderIndent(nodeProps), renderSwitcherIcon(prefixCls, /*#__PURE__*/React.createElement(ChevronDownLine, {
124
187
  size: size === 'small' ? TREE_SWITCH_CION_SIZE : TREE_SWITCH_LARGE_ICON_SIZE,
125
- color: '#a2a2a2'
188
+ color: '#9CA3AF'
126
189
  }, "\u5C55\u5F00"), showLine, nodeProps, size === 'small' ? TREE_SWITCH_CION_SIZE : TREE_SWITCH_LARGE_ICON_SIZE));
127
190
  },
128
191
  draggable: draggableConfig
@@ -33,6 +33,9 @@ export default (function () {
33
33
  disabled: true
34
34
  }]
35
35
  }]
36
+ }, {
37
+ title: 'Parent 2',
38
+ key: '1-1'
36
39
  }]
37
40
  }));
38
41
  });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: () => React.JSX.Element;
3
+ export default _default;
@@ -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
+ });
@@ -31,6 +31,12 @@
31
31
  opacity: 1;
32
32
  }
33
33
  }
34
+
35
+ &.ald-tree-no-children {
36
+ .ald-tree-switcher {
37
+ display: none;
38
+ }
39
+ }
34
40
  }
35
41
 
36
42
  .ald-tree-treenode {
@@ -40,6 +46,10 @@
40
46
  font-weight: 400;
41
47
  color: var(--alias-colors-text-default, #1f2937);
42
48
 
49
+ &.ald-tree-node-disabled {
50
+ display: none;
51
+ }
52
+
43
53
  .ald-tree-draggable-icon {
44
54
  display: inline-flex;
45
55
  align-items: center;
@@ -85,8 +85,12 @@
85
85
  &-disabled {
86
86
  // >>> Title
87
87
  .@{custom-tree-prefix-cls}-node-content-wrapper {
88
- color: @disabled-color;
89
- cursor: not-allowed;
88
+ color: var(--alias-colors-text-default, #1f2937);
89
+ cursor: default;
90
+ font-size: 14px;
91
+ font-style: normal;
92
+ font-weight: 400;
93
+ line-height: 20px;
90
94
 
91
95
  &:hover {
92
96
  background: transparent;
@@ -99,8 +103,8 @@
99
103
  }
100
104
 
101
105
  &:not(&-disabled).filter-node .@{custom-tree-prefix-cls}-title {
102
- color: @tree-node-highlight-color;
103
106
  font-weight: 500;
107
+ color: var(--alias-colors-text-danger);
104
108
  }
105
109
 
106
110
  &-draggable {