@kdcloudjs/kdesign 1.3.8 → 1.3.9

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.
@@ -20,12 +20,15 @@
20
20
  cursor: pointer;
21
21
 
22
22
  &-title {
23
- .menuItemTitle();
24
- }
25
-
26
- &-title > span {
27
- opacity: 1;
28
- transition: opacity calc(@menu-motion-duration - 0.1s) cubic-bezier(0,.4,.4,1);
23
+ display: flex;
24
+ align-items: center;
25
+ height: 50px;
26
+ .ellipsis();
27
+ & > span {
28
+ .ellipsis();
29
+ opacity: 1;
30
+ transition: opacity calc(@menu-motion-duration - 0.1s) cubic-bezier(0, .4, .4, 1);
31
+ }
29
32
  }
30
33
 
31
34
  &-collapsed {
@@ -42,7 +45,7 @@
42
45
 
43
46
  & > span {
44
47
  opacity: 0;
45
- transition: opacity calc(@menu-motion-duration - 0.1s) cubic-bezier(0,.4,.4,1);
48
+ transition: opacity calc(@menu-motion-duration - 0.1s) cubic-bezier(0, .4, .4, 1);
46
49
  }
47
50
  }
48
51
  }
@@ -54,76 +57,90 @@
54
57
 
55
58
  &-disabled {
56
59
  cursor: not-allowed;
57
- color: @menu-color-disabled;
58
- }
59
-
60
- &-active {
61
- .hover();
60
+ color: @menu-color-disabled !important;
61
+ background-color: @menu-color-background !important;
62
62
  }
63
63
 
64
64
  &-arrow {
65
65
  margin-left: auto;
66
66
  font-size: 16px;
67
+
67
68
  &-up {
68
69
  transform: rotate(180deg);
69
- transition: transform calc(@menu-motion-duration - 0.1s) cubic-bezier(0,.4,.4,1);
70
+ transition: transform calc(@menu-motion-duration - 0.1s) cubic-bezier(0, .4, .4, 1);
70
71
  }
71
72
 
72
73
  &-down {
73
74
  transform: rotate(0deg);
74
- transition: transform calc(@menu-motion-duration - 0.1s) cubic-bezier(0.4,0,0.6,1);
75
+ transition: transform calc(@menu-motion-duration - 0.1s) cubic-bezier(0.4, 0, 0.6, 1);
75
76
  }
76
77
  }
77
78
  }
78
79
 
80
+
79
81
  .hover {
80
82
  background-color: @menu-sub-color-background;
81
83
  color: @menu-sub-color-hover;
82
84
  }
83
85
 
84
- .light-hover {
85
- background-color: @menu-light-color-background-hover;
86
- color: @menu-light-color-hover;
87
- }
88
-
89
- .light-active {
90
- background-color: @menu-light-color-background-active;
91
- color: @menu-light-color-active;
92
- }
93
-
94
- .light-default {
95
- color: @menu-light-color;
96
- background: #ffffff;
86
+ .active {
87
+ background-color: @menu-sub-color-background;
88
+ color: @menu-sub-color-hover;
97
89
  }
98
90
 
99
- .menuItemTitle() {
100
- display: flex;
101
- align-items: center;
102
- height: 50px;
103
- .ellipsis();
104
- & > span {
105
- .ellipsis();
106
- }
91
+ .active-inline-title {
92
+ color: @menu-sub-color-hover !important;
93
+ background: @menu-color-background !important;
94
+ border: none;
107
95
  }
108
96
 
109
97
 
110
98
  .light {
111
99
  .light-default();
112
100
 
113
- .@{submenu-prefix-cls}-hover,
114
- .@{submenu-prefix-cls}-sub {
115
- .light-default();
101
+ .@{menuitem-prefix-cls}-disabled, .@{submenu-prefix-cls}-disabled {
102
+ background-color: #fff !important;
116
103
  }
117
104
 
118
- .@{submenu-prefix-cls}-title:hover {
119
- color: @menu-light-color-hover;
105
+ .@{submenu-prefix-cls}-sub {
106
+ color: @menu-light-color;
107
+ background: #FAFAFA;
120
108
  }
121
109
 
122
- .@{submenu-prefix-cls}:not(.@{submenu-prefix-cls}-disabled):hover {
110
+ .@{menuitem-prefix-cls}:hover {
123
111
  .light-hover();
124
112
  }
125
113
 
126
- .@{menuitem-prefix-cls}:not(.@{menuitem-prefix-cls}-disabled):hover {
114
+ .@{menuitem-prefix-cls}-hover, .@{submenu-prefix-cls}-hover {
127
115
  .light-hover();
128
116
  }
117
+
118
+ .@{menuitem-prefix-cls}-active, .@{submenu-prefix-cls}-active {
119
+ .light-active();
120
+ }
121
+ }
122
+
123
+ .light-default {
124
+ color: @menu-light-color;
125
+ background: #ffffff;
126
+ }
127
+
128
+ .light-hover {
129
+ background-color: @menu-light-color-background-hover;
130
+ color: @menu-light-color-hover;
131
+ border: none;
129
132
  }
133
+
134
+ .light-active {
135
+ background-color: @menu-light-color-background-active !important;
136
+ color: @menu-light-color-active !important;
137
+ border: none;
138
+ }
139
+
140
+ .light-active-inline-title {
141
+ color: @menu-light-color-active !important;
142
+ background: #ffffff !important;
143
+ border: none;
144
+ }
145
+
146
+
@@ -50,6 +50,7 @@ var SubMenu = function SubMenu(props) {
50
50
  collapsed = _a.collapsed,
51
51
  keyValue = _a.keyValue,
52
52
  selectedKey = _a.selectedKey,
53
+ selectedKeyPath = _a.selectedKeyPath,
53
54
  openKeys = _a.openKeys,
54
55
  triggerSubMenuAction = _a.triggerSubMenuAction,
55
56
  forceSubMenuRender = _a.forceSubMenuRender,
@@ -59,7 +60,7 @@ var SubMenu = function SubMenu(props) {
59
60
  handleOnOpenChange = _a.handleOnOpenChange,
60
61
  _a$paddingLeft = _a.paddingLeft,
61
62
  paddingLeft = _a$paddingLeft === void 0 ? 0 : _a$paddingLeft,
62
- restProps = __rest(_a, ["prefixCls", "theme", "mode", "title", "icon", "disabled", "children", "collapsed", "keyValue", "selectedKey", "openKeys", "triggerSubMenuAction", "forceSubMenuRender", "inlineIndent", "className", "style", "handleOnOpenChange", "paddingLeft"]);
63
+ restProps = __rest(_a, ["prefixCls", "theme", "mode", "title", "icon", "disabled", "children", "collapsed", "keyValue", "selectedKey", "selectedKeyPath", "openKeys", "triggerSubMenuAction", "forceSubMenuRender", "inlineIndent", "className", "style", "handleOnOpenChange", "paddingLeft"]);
63
64
 
64
65
  var isVertical = mode === 'vertical'; // 初始化level
65
66
 
@@ -288,7 +289,7 @@ var SubMenu = function SubMenu(props) {
288
289
  }; // eslint-disable-next-line react-hooks/rules-of-hooks
289
290
 
290
291
  var verticalView = usePopper( /*#__PURE__*/React.createElement("li", _extends({
291
- className: classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, "light", theme === 'light'), _defineProperty(_classNames2, "".concat(prefixCls, "-collapsed"), collapsed), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-hover"), !disabled && visible), _defineProperty(_classNames2, "".concat(prefixCls, "-active"), Array.isArray(openKeys) && _includesInstanceProperty(openKeys).call(openKeys, keyValue)), _classNames2)),
292
+ className: classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, "light", theme === 'light'), _defineProperty(_classNames2, "".concat(prefixCls, "-collapsed"), collapsed), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-hover"), !disabled && Array.isArray(openKeys) && _includesInstanceProperty(openKeys).call(openKeys, keyValue)), _defineProperty(_classNames2, "".concat(prefixCls, "-active"), Array.isArray(selectedKeyPath) && _includesInstanceProperty(selectedKeyPath).call(selectedKeyPath, keyValue)), _classNames2)),
292
293
  ref: subMenuVerticalRef,
293
294
  key: keyValue
294
295
  }, {
@@ -332,7 +333,7 @@ var SubMenu = function SubMenu(props) {
332
333
  arrow: false,
333
334
  placement: 'rightTop',
334
335
  gap: 0,
335
- visible: isVertical ? visible : false,
336
+ visible: isVertical && !disabled ? visible : false,
336
337
  disabled: isVertical ? undefined : true,
337
338
  prefixCls: 'kd-menu-popper',
338
339
  popperClassName: theme === 'light' ? 'light' : ''
@@ -345,7 +346,7 @@ var SubMenu = function SubMenu(props) {
345
346
 
346
347
  return /*#__PURE__*/React.createElement("li", _extends({
347
348
  ref: subMenuRef,
348
- className: classNames(prefixCls, className, (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefixCls, "-collapsed"), collapsed), _defineProperty(_classNames4, "".concat(prefixCls, "-disabled"), disabled), _classNames4)),
349
+ className: classNames(prefixCls, className, (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefixCls, "-collapsed"), collapsed), _defineProperty(_classNames4, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames4, "".concat(prefixCls, "-active"), Array.isArray(selectedKeyPath) && _includesInstanceProperty(selectedKeyPath).call(selectedKeyPath, keyValue)), _classNames4)),
349
350
  key: keyValue
350
351
  }, mouseEvent, {
351
352
  style: style
@@ -55,7 +55,9 @@ var InternalSelect = function InternalSelect(props, ref) {
55
55
  placeholder = selectProps.placeholder,
56
56
  dropdownStyle = selectProps.dropdownStyle,
57
57
  style = selectProps.style,
58
- clearIcon = selectProps.clearIcon;
58
+ clearIcon = selectProps.clearIcon,
59
+ _selectProps$popperSt = selectProps.popperStyle,
60
+ popperStyle = _selectProps$popperSt === void 0 ? {} : _selectProps$popperSt;
59
61
  var isMultiple = mode === 'multiple'; // 是否多选
60
62
 
61
63
  var _useMergedState = useMergedState(undefined, {
@@ -116,7 +118,7 @@ var InternalSelect = function InternalSelect(props, ref) {
116
118
 
117
119
  var searchCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-dropdown-search"), true)); // 下拉子项列表样式
118
120
 
119
- var dropContentCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-dropdown-scroll"), isMultiple ? (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) > 8 : (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) > 10)); // 多选底部样式
121
+ var dropContentCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-dropdown-scroll"), (isMultiple ? (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) > 8 : (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) > 10) || selectProps.dropdownRender)); // 多选底部样式
120
122
 
121
123
  var multipleFooterCls = classNames(_defineProperty({}, "".concat(selectPrefixCls, "-multiple-footer"), true)); // 多选,单选公共样式
122
124
 
@@ -668,10 +670,10 @@ var InternalSelect = function InternalSelect(props, ref) {
668
670
  var _ref2 = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(),
669
671
  width = _ref2.width;
670
672
 
671
- return {
673
+ return _extends({
672
674
  width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || (width > 75 ? width : 75),
673
675
  zIndex: 1050
674
- };
676
+ }, popperStyle);
675
677
  }
676
678
  };
677
679
 
package/es/table/table.js CHANGED
@@ -67,6 +67,8 @@ function Table(props) {
67
67
  });
68
68
 
69
69
  if (footerDataSource) {
70
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
71
+ // @ts-ignore
70
72
  pipeline.footerDataSource(footerDataSource);
71
73
  }
72
74
  /* -------------------------------------------------------------------------- */
@@ -140,7 +140,6 @@
140
140
  pointer-events: none;
141
141
  }
142
142
  .kd-tree-node-item {
143
- height: var(--kd-c-tree-node-sizing-height, 32px);
144
143
  display: -webkit-box;
145
144
  display: -ms-flexbox;
146
145
  display: flex;
@@ -167,7 +166,7 @@
167
166
  border-right: 10px;
168
167
  border-color: white;
169
168
  border-style: solid;
170
- height: var(--kd-c-tree-node-sizing-height, 32px);
169
+ height: 100%;
171
170
  cursor: default;
172
171
  opacity: 0;
173
172
  }
@@ -33,7 +33,6 @@
33
33
  pointer-events: none;
34
34
  }
35
35
  &-item {
36
- height: @tree-node-height;
37
36
  display: flex;
38
37
  align-items: center;
39
38
  }
@@ -54,7 +53,7 @@
54
53
  border-right: 10px;
55
54
  border-color: white;
56
55
  border-style: solid;
57
- height: @tree-node-height;
56
+ height: 100%;
58
57
  cursor: default;
59
58
  opacity: 0;
60
59
  }
@@ -13,7 +13,6 @@
13
13
  @tree-node-icon-color-text: var(~'@{tree-prefix}-node-icon-color-text', #666666);
14
14
 
15
15
  // sizing
16
- @tree-node-height: var(~'@{tree-prefix}-node-sizing-height', 32px);
17
16
  @tree-expand-icon-height: var(~'@{tree-prefix}-expand-icon-sizing-height', 22px);
18
17
  @tree-expand-icon-width: var(~'@{tree-prefix}-expand-icon-sizing-width', 22px);
19
18
  @tree-node-icon-height: var(~'@{tree-prefix}-node-icon-sizing-height', 20px);
package/es/tree/tree.js CHANGED
@@ -57,8 +57,7 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
57
57
  setTreeNodeClassName = _TreeProps$setTreeNod2 === void 0 ? function () {
58
58
  return '';
59
59
  } : _TreeProps$setTreeNod2,
60
- _TreeProps$estimatedI = TreeProps.estimatedItemSize,
61
- innerEstimatedItemSize = _TreeProps$estimatedI === void 0 ? 28 : _TreeProps$estimatedI,
60
+ innerEstimatedItemSize = TreeProps.estimatedItemSize,
62
61
  style = TreeProps.style;
63
62
  var treePrefixCls = getPrefixCls(prefixCls, 'tree', customPrefixcls); // 树样式前缀
64
63
 
@@ -324,7 +324,7 @@ var TreeNode = /*#__PURE__*/React.forwardRef(function (props, ref) {
324
324
  return /*#__PURE__*/React.createElement("div", {
325
325
  className: classNames("".concat(treeNodePrefixCls, "-item"), _defineProperty({}, "".concat(treeNodePrefixCls, "-item-hover"), !disabled && selectable), _defineProperty({}, "".concat(treeNodePrefixCls, "-selected"), selected && selectable && !disabled), _defineProperty({}, "".concat(treeNodePrefixCls, "-disabled"), disabled), _defineProperty({}, "".concat(treeNodePrefixCls, "-opened"), expandState), _concatInstanceProperty(_context = "".concat(treeNodePrefixCls, "-item-")).call(_context, nodeKey), className),
326
326
  style: _extends({
327
- height: "".concat(estimatedItemSize)
327
+ height: "".concat(estimatedItemSize, "px")
328
328
  }, style),
329
329
  onClick: handleClick
330
330
  }, renderNode());
@@ -305,6 +305,7 @@ declare const compDefaultProps: {
305
305
  draggable: boolean;
306
306
  virtual: boolean;
307
307
  switcherIcon: () => JSX.Element;
308
+ estimatedItemSize: number;
308
309
  };
309
310
  TreeNode: {};
310
311
  ToolTip: {
@@ -337,7 +337,8 @@ var compDefaultProps = {
337
337
  return /*#__PURE__*/React.createElement(_index.Icon, {
338
338
  type: "arrow-right-solid"
339
339
  });
340
- }
340
+ },
341
+ estimatedItemSize: 32
341
342
  },
342
343
  TreeNode: {},
343
344
  ToolTip: {
package/lib/menu/menu.js CHANGED
@@ -105,8 +105,13 @@ var Menu = function Menu(props) {
105
105
 
106
106
  var _React$useState3 = _react.default.useState([]),
107
107
  _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
108
- openKeys = _React$useState4[0],
109
- setOpenKeys = _React$useState4[1];
108
+ selectedKeyPath = _React$useState4[0],
109
+ setSelectedKeyPath = _React$useState4[1];
110
+
111
+ var _React$useState5 = _react.default.useState([]),
112
+ _React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2),
113
+ openKeys = _React$useState6[0],
114
+ setOpenKeys = _React$useState6[1];
110
115
 
111
116
  if (mode === 'inline') {
112
117
  restProps.triggerSubMenuAction = 'click';
@@ -115,6 +120,7 @@ var Menu = function Menu(props) {
115
120
  (0, _react.useEffect)(function () {
116
121
  setOpenKeys([]);
117
122
  setSelectedKey('');
123
+ setSelectedKeyPath([]);
118
124
  openSubMenuSet.clear();
119
125
  }, [mode]);
120
126
  (0, _react.useEffect)(function () {
@@ -125,22 +131,29 @@ var Menu = function Menu(props) {
125
131
  (0, _react.useEffect)(function () {
126
132
  if (userOpenKeys !== undefined && Array.isArray(userOpenKeys)) {
127
133
  setOpenKeys(userOpenKeys);
128
- openSubMenuSet.clear();
129
- userOpenKeys.forEach(function (d) {
130
- openSubMenuSet.add(d);
134
+ }
135
+ }, [userOpenKeys]);
136
+ (0, _react.useEffect)(function () {
137
+ if (userSelectedKey !== undefined && userOpenKeys !== undefined && Array.isArray(userOpenKeys)) {
138
+ setSelectedKeyPath(userOpenKeys);
139
+ setTimeout(function () {
140
+ userOpenKeys.forEach(function (d) {
141
+ openSubMenuSet.add(d);
142
+ });
131
143
  });
132
144
  }
133
- }, [userOpenKeys]); // React.useEffect(() => {
134
- // setCollapsed(restProps.collapsed)
135
- // }, [restProps.collapsed])
145
+ }, []);
136
146
 
137
147
  var handleOnClick = function handleOnClick(info) {
138
148
  if (userSelectedKey === undefined) {
139
149
  setSelectedKey(info.key);
140
150
  }
141
151
 
152
+ setSelectedKeyPath(info.keyPath);
153
+
142
154
  if (mode !== 'inline' && openKeys.length > 0) {
143
155
  setOpenKeys([]);
156
+ openSubMenuSet.clear();
144
157
  }
145
158
 
146
159
  onClick && onClick(info);
@@ -192,6 +205,7 @@ var Menu = function Menu(props) {
192
205
  mode: mode,
193
206
  openKeys: openKeys,
194
207
  selectedKey: selectedKey,
208
+ selectedKeyPath: selectedKeyPath,
195
209
  theme: theme,
196
210
  triggerSubMenuAction: restProps.triggerSubMenuAction,
197
211
  forceSubMenuRender: forceSubMenuRender,