@kdcloudjs/kdesign 1.3.1 → 1.3.4
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/CHANGELOG.md +52 -0
- package/dist/kdesign-complete.less +171 -103
- package/dist/kdesign.css +163 -74
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +420 -299
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +4 -4
- package/dist/kdesign.min.js +8 -8
- package/dist/kdesign.min.js.map +1 -1
- package/es/button/group.js +2 -1
- package/es/button/style/index.css +20 -19
- package/es/button/style/index.less +29 -27
- package/es/button/style/token.less +4 -4
- package/es/cascader/cascader.d.ts +7 -3
- package/es/cascader/cascader.js +8 -6
- package/es/checkbox/checkbox.js +20 -12
- package/es/config-provider/compDefaultProps.d.ts +0 -1
- package/es/config-provider/compDefaultProps.js +1 -2
- package/es/form/Field.js +53 -9
- package/es/grid/row.d.ts +1 -1
- package/es/icon/interface.js +1 -1
- package/es/menu/menu.d.ts +1 -1
- package/es/menu/menu.js +51 -19
- package/es/menu/menuItem.d.ts +1 -0
- package/es/menu/menuItem.js +14 -10
- package/es/menu/style/index.css +139 -53
- package/es/menu/style/index.less +101 -69
- package/es/menu/style/mixin.less +33 -1
- package/es/menu/style/token.less +4 -2
- package/es/menu/subMenu.d.ts +1 -1
- package/es/menu/subMenu.js +118 -112
- package/es/radio/radio.d.ts +1 -1
- package/es/radio/radio.js +18 -11
- package/es/select/select.js +9 -2
- package/es/style/icon/kdicon.css +3 -1
- package/es/style/icon/kdicon.woff +0 -0
- package/lib/button/group.js +2 -1
- package/lib/button/style/index.css +20 -19
- package/lib/button/style/index.less +29 -27
- package/lib/button/style/token.less +4 -4
- package/lib/cascader/cascader.d.ts +7 -3
- package/lib/cascader/cascader.js +10 -8
- package/lib/checkbox/checkbox.js +19 -11
- package/lib/config-provider/compDefaultProps.d.ts +0 -1
- package/lib/config-provider/compDefaultProps.js +1 -2
- package/lib/form/Field.js +54 -9
- package/lib/grid/row.d.ts +1 -1
- package/lib/icon/interface.js +1 -1
- package/lib/menu/menu.d.ts +1 -1
- package/lib/menu/menu.js +57 -23
- package/lib/menu/menuItem.d.ts +1 -0
- package/lib/menu/menuItem.js +16 -10
- package/lib/menu/style/index.css +139 -53
- package/lib/menu/style/index.less +101 -69
- package/lib/menu/style/mixin.less +33 -1
- package/lib/menu/style/token.less +4 -2
- package/lib/menu/subMenu.d.ts +1 -1
- package/lib/menu/subMenu.js +137 -135
- package/lib/radio/radio.d.ts +1 -1
- package/lib/radio/radio.js +30 -20
- package/lib/select/select.js +9 -2
- package/lib/style/icon/kdicon.css +3 -1
- package/lib/style/icon/kdicon.woff +0 -0
- package/package.json +2 -2
package/es/menu/subMenu.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
4
3
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
5
4
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
6
5
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
@@ -19,18 +18,20 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
19
18
|
return t;
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
import
|
|
21
|
+
import React from 'react';
|
|
23
22
|
import { ConfigContext } from '../config-provider';
|
|
24
23
|
import { getCompProps } from '../_utils';
|
|
25
24
|
import { toArray } from '../_utils/react-children';
|
|
26
25
|
import classNames from 'classnames';
|
|
27
|
-
import { isString,
|
|
26
|
+
import { isString, getItemWidth, renderReactNodeFunction, isElementInViewport, DEFAUTL_PADDING } from './util';
|
|
28
27
|
import { useOnClickOutside } from '../_utils/hooks';
|
|
29
28
|
import { Icon } from '../index';
|
|
29
|
+
import usePopper from '../_utils/usePopper';
|
|
30
30
|
import devWarning from '../_utils/devwarning';
|
|
31
|
+
import { MENU_ITEM_CONTAINER_NAME } from './menuItem';
|
|
31
32
|
|
|
32
33
|
var SubMenu = function SubMenu(props) {
|
|
33
|
-
var
|
|
34
|
+
var _classNames3, _classNames4, _context5;
|
|
34
35
|
|
|
35
36
|
var _React$useContext = React.useContext(ConfigContext),
|
|
36
37
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
@@ -40,6 +41,7 @@ var SubMenu = function SubMenu(props) {
|
|
|
40
41
|
|
|
41
42
|
var _a = getCompProps('MenuSubMenu', userDefaultProps, props),
|
|
42
43
|
customPrefixcls = _a.prefixCls,
|
|
44
|
+
theme = _a.theme,
|
|
43
45
|
mode = _a.mode,
|
|
44
46
|
title = _a.title,
|
|
45
47
|
icon = _a.icon,
|
|
@@ -57,7 +59,7 @@ var SubMenu = function SubMenu(props) {
|
|
|
57
59
|
handleOnOpenChange = _a.handleOnOpenChange,
|
|
58
60
|
_a$paddingLeft = _a.paddingLeft,
|
|
59
61
|
paddingLeft = _a$paddingLeft === void 0 ? 0 : _a$paddingLeft,
|
|
60
|
-
restProps = __rest(_a, ["prefixCls", "mode", "title", "icon", "disabled", "children", "collapsed", "keyValue", "selectedKey", "openKeys", "triggerSubMenuAction", "forceSubMenuRender", "inlineIndent", "className", "style", "handleOnOpenChange", "paddingLeft"]); // 初始化level
|
|
62
|
+
restProps = __rest(_a, ["prefixCls", "theme", "mode", "title", "icon", "disabled", "children", "collapsed", "keyValue", "selectedKey", "openKeys", "triggerSubMenuAction", "forceSubMenuRender", "inlineIndent", "className", "style", "handleOnOpenChange", "paddingLeft"]); // 初始化level
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
if (!restProps.level) {
|
|
@@ -74,19 +76,13 @@ var SubMenu = function SubMenu(props) {
|
|
|
74
76
|
var prefixCls = getPrefixCls(pkgPrefixCls, 'menu-submenu', customPrefixcls);
|
|
75
77
|
var subMenuRef = React.useRef(null);
|
|
76
78
|
var subMenuWrapperRef = React.useRef(null);
|
|
79
|
+
var subMenuVerticalRef = React.useRef(null);
|
|
80
|
+
var subMenuWrapperVerticalRef = React.useRef(null);
|
|
77
81
|
|
|
78
|
-
var
|
|
79
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
80
|
-
isVisible = _React$useState2[0],
|
|
81
|
-
setIsVisible = _React$useState2[1];
|
|
82
|
+
var visible = Array.isArray(openKeys) && _includesInstanceProperty(openKeys).call(openKeys, keyValue);
|
|
82
83
|
|
|
83
84
|
React.useEffect(function () {
|
|
84
|
-
if (
|
|
85
|
-
setIsVisible(_includesInstanceProperty(openKeys).call(openKeys, keyValue));
|
|
86
|
-
}
|
|
87
|
-
}, [keyValue]);
|
|
88
|
-
React.useEffect(function () {
|
|
89
|
-
if (!isVisible) return;
|
|
85
|
+
if (!visible) return;
|
|
90
86
|
var subMenuWrapperEle = subMenuWrapperRef.current;
|
|
91
87
|
var subMenuEle = subMenuRef.current;
|
|
92
88
|
|
|
@@ -134,15 +130,15 @@ var SubMenu = function SubMenu(props) {
|
|
|
134
130
|
if (mode === 'inline') {
|
|
135
131
|
var height = ((_a = subMenuWrapperRef.current) === null || _a === void 0 ? void 0 : _a.scrollHeight) || 0;
|
|
136
132
|
return {
|
|
137
|
-
height:
|
|
133
|
+
height: visible && !collapsed ? "".concat(height, "px") : '0px',
|
|
138
134
|
overflow: 'hidden',
|
|
139
|
-
opacity:
|
|
135
|
+
opacity: visible && !collapsed ? 1 : 0,
|
|
140
136
|
transition: 'all 0.2s cubic-bezier(0,.4,.4,1)'
|
|
141
137
|
};
|
|
142
138
|
}
|
|
143
139
|
|
|
144
140
|
var style = {
|
|
145
|
-
visibility: forceSubMenuRender && !
|
|
141
|
+
visibility: forceSubMenuRender && !visible ? 'visible' : 'hidden'
|
|
146
142
|
};
|
|
147
143
|
|
|
148
144
|
if (restProps.subMenuMode === 'horizontal') {
|
|
@@ -171,16 +167,24 @@ var SubMenu = function SubMenu(props) {
|
|
|
171
167
|
paddingLeft: "".concat(popupOffsetPosition[0], "px"),
|
|
172
168
|
paddingTop: "".concat(popupOffsetPosition[1], "px")
|
|
173
169
|
});
|
|
174
|
-
}, [subMenuRef, restProps.popupOffset, forceSubMenuRender,
|
|
170
|
+
}, [subMenuRef, restProps.popupOffset, forceSubMenuRender, visible, mode, restProps.subMenuMode]);
|
|
171
|
+
|
|
172
|
+
var handleVisibleChange = function handleVisibleChange(status) {
|
|
173
|
+
var clean = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
174
|
+
handleOnOpenChange(keyValue, status, clean);
|
|
175
|
+
};
|
|
175
176
|
|
|
176
177
|
var closeSubMenu = function closeSubMenu() {
|
|
177
|
-
|
|
178
|
-
handleOnOpenChange(keyValue);
|
|
178
|
+
handleVisibleChange(false, true);
|
|
179
179
|
}; // 点击区域外的地方关闭
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
useOnClickOutside([
|
|
183
|
-
|
|
182
|
+
useOnClickOutside([subMenuVerticalRef, subMenuWrapperVerticalRef], function (e) {
|
|
183
|
+
var _a;
|
|
184
|
+
|
|
185
|
+
var className = ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.className) || '';
|
|
186
|
+
|
|
187
|
+
if (!_includesInstanceProperty(className).call(className, MENU_ITEM_CONTAINER_NAME)) {
|
|
184
188
|
closeSubMenu();
|
|
185
189
|
}
|
|
186
190
|
}); // 缩略模式自动关闭子菜单
|
|
@@ -191,8 +195,7 @@ var SubMenu = function SubMenu(props) {
|
|
|
191
195
|
|
|
192
196
|
var handleMouseEvent = function handleMouseEvent(status) {
|
|
193
197
|
if (disabled || triggerSubMenuAction === 'click') return;
|
|
194
|
-
|
|
195
|
-
setIsVisible(status);
|
|
198
|
+
handleVisibleChange(status);
|
|
196
199
|
};
|
|
197
200
|
|
|
198
201
|
var handleOnMouseEnter = function handleOnMouseEnter() {
|
|
@@ -217,11 +220,9 @@ var SubMenu = function SubMenu(props) {
|
|
|
217
220
|
}; // 子菜单展开收缩
|
|
218
221
|
|
|
219
222
|
|
|
220
|
-
var handleOnClickSubMenu = function handleOnClickSubMenu(
|
|
223
|
+
var handleOnClickSubMenu = function handleOnClickSubMenu() {
|
|
221
224
|
if (disabled || triggerSubMenuAction === 'hover') return;
|
|
222
|
-
|
|
223
|
-
handleOnOpenChange(keyValue);
|
|
224
|
-
setIsVisible(!isVisible);
|
|
225
|
+
handleVisibleChange(!visible);
|
|
225
226
|
};
|
|
226
227
|
|
|
227
228
|
var renderItemTitle = function renderItemTitle() {
|
|
@@ -242,86 +243,12 @@ var SubMenu = function SubMenu(props) {
|
|
|
242
243
|
if (mode !== 'inline' || collapsed) return null;
|
|
243
244
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
244
245
|
type: "arrow-down",
|
|
245
|
-
className: classNames("".concat(prefixCls, "-arrow"), _defineProperty({}, _concatInstanceProperty(_context2 = "".concat(prefixCls, "-arrow-")).call(_context2,
|
|
246
|
+
className: classNames("".concat(prefixCls, "-arrow"), _defineProperty({}, _concatInstanceProperty(_context2 = "".concat(prefixCls, "-arrow-")).call(_context2, visible ? 'up' : 'down'), true))
|
|
246
247
|
});
|
|
247
248
|
};
|
|
248
249
|
|
|
249
|
-
var renderSubMenu = function renderSubMenu() {
|
|
250
|
-
var _context3;
|
|
251
|
-
|
|
252
|
-
var style = getCurrentStyle(); // 展开收缩动画。针对二级三级菜单目前使用单一的样式去区分了
|
|
253
|
-
|
|
254
|
-
var motionClassName = {};
|
|
255
|
-
|
|
256
|
-
if (mode !== 'inline') {
|
|
257
|
-
var prefixClsMotion = "".concat(prefixCls, "-sub");
|
|
258
|
-
|
|
259
|
-
if (isVisible) {
|
|
260
|
-
motionClassName["".concat(prefixClsMotion, "-second")] = restProps.level === 1;
|
|
261
|
-
motionClassName["".concat(prefixClsMotion, "-third")] = restProps.level === 2;
|
|
262
|
-
} else {
|
|
263
|
-
motionClassName["".concat(prefixClsMotion, "-hide")] = true;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
268
|
-
style: style,
|
|
269
|
-
ref: subMenuWrapperRef
|
|
270
|
-
}, /*#__PURE__*/React.createElement("ul", {
|
|
271
|
-
className: classNames("".concat(prefixCls, "-sub"), restProps.popupClassName, motionClassName)
|
|
272
|
-
}, _mapInstanceProperty(_context3 = toArray(children)).call(_context3, function (item, index) {
|
|
273
|
-
var key = item.key || index;
|
|
274
|
-
return /*#__PURE__*/React.cloneElement(item, {
|
|
275
|
-
key: key,
|
|
276
|
-
level: restProps.level + 1,
|
|
277
|
-
keyValue: key,
|
|
278
|
-
collapsed: collapsed,
|
|
279
|
-
mode: mode,
|
|
280
|
-
selectedKey: selectedKey,
|
|
281
|
-
openKeys: openKeys,
|
|
282
|
-
forceSubMenuRender: forceSubMenuRender,
|
|
283
|
-
triggerSubMenuAction: triggerSubMenuAction,
|
|
284
|
-
handleOnOpenChange: handleOnOpenChange,
|
|
285
|
-
handleOnClick: handleOnClick,
|
|
286
|
-
inlineIndent: inlineIndent,
|
|
287
|
-
paddingLeft: curPaddingLeft
|
|
288
|
-
});
|
|
289
|
-
})));
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
var renderThridMenu = function renderThridMenu() {
|
|
293
|
-
var _context4;
|
|
294
|
-
|
|
295
|
-
var style = getCurrentStyle();
|
|
296
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
297
|
-
style: style
|
|
298
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
299
|
-
className: classNames("".concat(prefixCls, "-thrid")),
|
|
300
|
-
onClick: function onClick(e) {
|
|
301
|
-
e.stopPropagation();
|
|
302
|
-
},
|
|
303
|
-
style: {
|
|
304
|
-
width: getWrapWidth(children)
|
|
305
|
-
}
|
|
306
|
-
}, _mapInstanceProperty(_context4 = toArray(children)).call(_context4, function (item, i) {
|
|
307
|
-
return /*#__PURE__*/React.cloneElement(item, {
|
|
308
|
-
level: restProps.level + 1,
|
|
309
|
-
subMenuMode: restProps.subMenuMode,
|
|
310
|
-
keyValue: item.key || i,
|
|
311
|
-
collapsed: collapsed,
|
|
312
|
-
mode: mode,
|
|
313
|
-
selectedKey: selectedKey,
|
|
314
|
-
openKeys: openKeys,
|
|
315
|
-
forceSubMenuRender: forceSubMenuRender,
|
|
316
|
-
triggerSubMenuAction: triggerSubMenuAction,
|
|
317
|
-
handleOnOpenChange: handleOnOpenChange,
|
|
318
|
-
handleOnClick: handleOnClick
|
|
319
|
-
});
|
|
320
|
-
})));
|
|
321
|
-
};
|
|
322
|
-
|
|
323
250
|
if (restProps.subMenuMode === 'horizontal' && restProps.level > 1 && children) {
|
|
324
|
-
var
|
|
251
|
+
var _context3;
|
|
325
252
|
|
|
326
253
|
var width = getItemWidth(children);
|
|
327
254
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -333,7 +260,7 @@ var SubMenu = function SubMenu(props) {
|
|
|
333
260
|
className: classNames("".concat(prefixCls, "-thrid-title"))
|
|
334
261
|
}, /*#__PURE__*/React.createElement("span", null, title)), /*#__PURE__*/React.createElement("ul", {
|
|
335
262
|
className: classNames("".concat(prefixCls, "-thrid-list"), restProps.popupClassName)
|
|
336
|
-
}, _mapInstanceProperty(
|
|
263
|
+
}, _mapInstanceProperty(_context3 = toArray(children)).call(_context3, function (item, i) {
|
|
337
264
|
return /*#__PURE__*/React.cloneElement(item, {
|
|
338
265
|
level: restProps.level + 1,
|
|
339
266
|
subMenuMode: restProps.subMenuMode,
|
|
@@ -359,18 +286,97 @@ var SubMenu = function SubMenu(props) {
|
|
|
359
286
|
paddingRight: "".concat(curPaddingRight, "px"),
|
|
360
287
|
paddingLeft: "".concat(curPaddingLeft, "px")
|
|
361
288
|
};
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
289
|
+
|
|
290
|
+
if (mode !== 'vertical') {
|
|
291
|
+
var _classNames2, _context4;
|
|
292
|
+
|
|
293
|
+
return /*#__PURE__*/React.createElement("li", _extends({
|
|
294
|
+
ref: subMenuRef,
|
|
295
|
+
className: classNames(prefixCls, className, (_classNames2 = {}, _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)),
|
|
296
|
+
key: keyValue
|
|
297
|
+
}, mouseEvent, {
|
|
298
|
+
style: style
|
|
299
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
300
|
+
className: classNames("".concat(prefixCls, "-title")),
|
|
301
|
+
style: titleStyle
|
|
302
|
+
}, icon && /*#__PURE__*/React.cloneElement(renderReactNodeFunction(icon), {
|
|
303
|
+
className: classNames("".concat(prefixCls, "-icon"))
|
|
304
|
+
}), renderItemTitle(), renderItemArrow()), /*#__PURE__*/React.createElement("div", {
|
|
305
|
+
style: getCurrentStyle(),
|
|
306
|
+
ref: subMenuWrapperRef
|
|
307
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
308
|
+
className: classNames("".concat(prefixCls, "-sub"), restProps.popupClassName)
|
|
309
|
+
}, _mapInstanceProperty(_context4 = toArray(children)).call(_context4, function (item, index) {
|
|
310
|
+
var key = item.key || index;
|
|
311
|
+
return /*#__PURE__*/React.cloneElement(item, {
|
|
312
|
+
key: key,
|
|
313
|
+
level: restProps.level + 1,
|
|
314
|
+
keyValue: key,
|
|
315
|
+
collapsed: collapsed,
|
|
316
|
+
mode: mode,
|
|
317
|
+
selectedKey: selectedKey,
|
|
318
|
+
openKeys: openKeys,
|
|
319
|
+
forceSubMenuRender: forceSubMenuRender,
|
|
320
|
+
triggerSubMenuAction: triggerSubMenuAction,
|
|
321
|
+
handleOnOpenChange: handleOnOpenChange,
|
|
322
|
+
handleOnClick: handleOnClick,
|
|
323
|
+
inlineIndent: inlineIndent,
|
|
324
|
+
paddingLeft: curPaddingLeft
|
|
325
|
+
});
|
|
326
|
+
}))));
|
|
327
|
+
} // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
return usePopper( /*#__PURE__*/React.createElement("li", _extends({
|
|
331
|
+
className: classNames(prefixCls, className, (_classNames3 = {}, _defineProperty(_classNames3, "light", theme === 'light'), _defineProperty(_classNames3, "".concat(prefixCls, "-collapsed"), collapsed), _defineProperty(_classNames3, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames3, "".concat(prefixCls, "-hover"), !disabled && visible), _defineProperty(_classNames3, "".concat(prefixCls, "-active"), Array.isArray(openKeys) && _includesInstanceProperty(openKeys).call(openKeys, keyValue)), _classNames3)),
|
|
332
|
+
ref: subMenuVerticalRef,
|
|
333
|
+
key: keyValue,
|
|
367
334
|
style: style
|
|
335
|
+
}, {
|
|
336
|
+
onMouseLeave: handleOnMouseLeave,
|
|
337
|
+
onMouseEnter: handleOnMouseEnter,
|
|
338
|
+
onClick: handleOnClickSubMenu
|
|
368
339
|
}), /*#__PURE__*/React.createElement("div", {
|
|
369
340
|
className: classNames("".concat(prefixCls, "-title")),
|
|
370
341
|
style: titleStyle
|
|
371
342
|
}, icon && /*#__PURE__*/React.cloneElement(renderReactNodeFunction(icon), {
|
|
372
343
|
className: classNames("".concat(prefixCls, "-icon"))
|
|
373
|
-
}), renderItemTitle(), renderItemArrow()),
|
|
344
|
+
}), renderItemTitle(), renderItemArrow())), /*#__PURE__*/React.createElement("div", {
|
|
345
|
+
ref: subMenuWrapperVerticalRef,
|
|
346
|
+
onMouseLeave: function onMouseLeave() {
|
|
347
|
+
handleOnMouseLeave();
|
|
348
|
+
},
|
|
349
|
+
onMouseEnter: function onMouseEnter() {
|
|
350
|
+
handleOnMouseEnter();
|
|
351
|
+
}
|
|
352
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
353
|
+
className: classNames("".concat(prefixCls, "-sub"), restProps.popupClassName, (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefixCls, "-sub-second"), restProps.level === 1), _defineProperty(_classNames4, "".concat(prefixCls, "-sub-third"), restProps.level === 2), _classNames4))
|
|
354
|
+
}, _mapInstanceProperty(_context5 = toArray(children)).call(_context5, function (item, index) {
|
|
355
|
+
var key = item.key || index;
|
|
356
|
+
return /*#__PURE__*/React.cloneElement(item, {
|
|
357
|
+
key: key,
|
|
358
|
+
level: restProps.level + 1,
|
|
359
|
+
keyValue: key,
|
|
360
|
+
collapsed: collapsed,
|
|
361
|
+
mode: mode,
|
|
362
|
+
theme: theme,
|
|
363
|
+
selectedKey: selectedKey,
|
|
364
|
+
openKeys: openKeys,
|
|
365
|
+
forceSubMenuRender: forceSubMenuRender,
|
|
366
|
+
triggerSubMenuAction: triggerSubMenuAction,
|
|
367
|
+
handleOnOpenChange: handleOnOpenChange,
|
|
368
|
+
handleOnClick: handleOnClick,
|
|
369
|
+
inlineIndent: inlineIndent,
|
|
370
|
+
paddingLeft: curPaddingLeft
|
|
371
|
+
});
|
|
372
|
+
}))), {
|
|
373
|
+
arrow: false,
|
|
374
|
+
placement: 'rightTop',
|
|
375
|
+
gap: 0,
|
|
376
|
+
visible: visible,
|
|
377
|
+
prefixCls: 'kd-menu-popper',
|
|
378
|
+
popperClassName: theme === 'light' ? 'light' : ''
|
|
379
|
+
});
|
|
374
380
|
};
|
|
375
381
|
|
|
376
382
|
SubMenu.displayName = 'SubMenu';
|
package/es/radio/radio.d.ts
CHANGED
package/es/radio/radio.js
CHANGED
|
@@ -16,7 +16,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
16
16
|
return t;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
import
|
|
19
|
+
import React, { useEffect } from 'react';
|
|
20
20
|
import classNames from 'classnames';
|
|
21
21
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
22
22
|
import { getCompProps } from '../_utils';
|
|
@@ -85,22 +85,29 @@ var InternalRadio = function InternalRadio(props, ref) {
|
|
|
85
85
|
|
|
86
86
|
var classString = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(radioPrefixCls), true), _defineProperty(_classNames, "".concat(radioPrefixCls, "-disabled"), radioProps.disabled), _defineProperty(_classNames, "".concat(radioPrefixCls, "-checked"), context ? radioProps.checked : isChecked), _classNames), className); // 单选包裹元素class名称
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
useEffect(function () {
|
|
89
|
+
var handleRepeatClick = function handleRepeatClick(e) {
|
|
90
|
+
var element = e.target;
|
|
91
|
+
|
|
92
|
+
if (element.tagName !== 'INPUT') {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var radioRef = mergedRef;
|
|
98
|
+
radioRef.current.addEventListener('click', handleRepeatClick);
|
|
99
|
+
return function () {
|
|
100
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
|
+
radioRef.current.removeEventListener('click', handleRepeatClick);
|
|
102
|
+
};
|
|
103
|
+
}, []);
|
|
96
104
|
return (
|
|
97
105
|
/*#__PURE__*/
|
|
98
106
|
// eslint-disable-next-line
|
|
99
107
|
React.createElement("label", {
|
|
100
108
|
className: classString,
|
|
101
109
|
style: style,
|
|
102
|
-
ref: mergedRef
|
|
103
|
-
onClick: handleRepeatClick
|
|
110
|
+
ref: mergedRef
|
|
104
111
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
105
112
|
type: "radio",
|
|
106
113
|
className: "".concat(radioPrefixCls, "-input")
|
package/es/select/select.js
CHANGED
|
@@ -492,8 +492,15 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
492
492
|
return (realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) === 0 && /*#__PURE__*/React.createElement("div", {
|
|
493
493
|
className: emptyListCls
|
|
494
494
|
}, emptyContent);
|
|
495
|
-
};
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
var isShowSearch = useCallback(function () {
|
|
498
|
+
if (isMultiple) {
|
|
499
|
+
return showSearch !== null && showSearch !== void 0 ? showSearch : true;
|
|
500
|
+
}
|
|
496
501
|
|
|
502
|
+
return showSearch !== null && showSearch !== void 0 ? showSearch : false;
|
|
503
|
+
}, [showSearch, isMultiple]); // 渲染下拉列表框
|
|
497
504
|
|
|
498
505
|
var renderContent = function renderContent() {
|
|
499
506
|
var _a;
|
|
@@ -530,7 +537,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
530
537
|
className: dropDownCls,
|
|
531
538
|
style: dropDownStyle,
|
|
532
539
|
ref: dropDownRef
|
|
533
|
-
}, (
|
|
540
|
+
}, isShowSearch() && /*#__PURE__*/React.createElement("div", {
|
|
534
541
|
className: searchCls
|
|
535
542
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
536
543
|
ref: searchRef,
|
package/es/style/icon/kdicon.css
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "kdicon";
|
|
3
|
-
src: url("kdicon.woff?t=
|
|
3
|
+
src: url("kdicon.woff?t=1654677347390") format("woff");
|
|
4
4
|
}
|
|
5
5
|
.kdicon {
|
|
6
6
|
font-family: 'kdicon' !important;
|
|
7
|
+
font-size:16px;
|
|
7
8
|
font-style:normal;
|
|
8
9
|
-webkit-font-smoothing: antialiased;
|
|
9
10
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
.kdicon-copy:before { content: "\e678"; }
|
|
63
64
|
.kdicon-counterclockwise:before { content: "\e6e5"; }
|
|
64
65
|
.kdicon-customize:before { content: "\e707"; }
|
|
66
|
+
.kdicon-dashboard:before { content: "\e71c"; }
|
|
65
67
|
.kdicon-date-selection:before { content: "\e70f"; }
|
|
66
68
|
.kdicon-date:before { content: "\e6eb"; }
|
|
67
69
|
.kdicon-delete-indentation:before { content: "\e697"; }
|
|
Binary file
|
package/lib/button/group.js
CHANGED
|
@@ -146,7 +146,8 @@ var InternalButtonGroup = function InternalButtonGroup(props, ref) {
|
|
|
146
146
|
|
|
147
147
|
var popperProps = (0, _extends2.default)((0, _extends2.default)({
|
|
148
148
|
placement: 'bottomLeft',
|
|
149
|
-
trigger: 'click'
|
|
149
|
+
trigger: 'click',
|
|
150
|
+
gap: 0
|
|
150
151
|
}, buttonGoupProps), {
|
|
151
152
|
prefixCls: btnGroupPrefixCls,
|
|
152
153
|
defaultVisible: optionShow,
|
|
@@ -354,35 +354,36 @@
|
|
|
354
354
|
.kd-btn-group-basic-icon {
|
|
355
355
|
margin-left: 4px;
|
|
356
356
|
}
|
|
357
|
-
.kd-btn-group-
|
|
358
|
-
|
|
357
|
+
.kd-btn-group-similar .kd-btn-group-trigger .kd-btn {
|
|
358
|
+
border-top-left-radius: 0;
|
|
359
|
+
border-bottom-left-radius: 0;
|
|
360
|
+
margin-left: -1px;
|
|
359
361
|
}
|
|
360
|
-
.kd-btn-group-trigger .kd-btn-primary
|
|
361
|
-
background: var(--kd-c-button-group-trigger-color-background-
|
|
362
|
-
border-color: var(--kd-c-button-group-trigger-color-background-hover, #4c74da);
|
|
362
|
+
.kd-btn-group-similar .kd-btn-group-trigger .kd-btn-primary {
|
|
363
|
+
background: var(--kd-c-button-group-trigger-color-background, var(--kd-g-color-theme-7, #375cca));
|
|
363
364
|
}
|
|
364
|
-
.kd-btn-group-trigger .kd-btn-primary:
|
|
365
|
-
background: var(--kd-c-button-group-trigger-color-background-
|
|
365
|
+
.kd-btn-group-similar .kd-btn-group-trigger .kd-btn-primary:hover {
|
|
366
|
+
background: var(--kd-c-button-group-trigger-color-background-hover, var(--kd-g-color-theme-6, #5582f3));
|
|
367
|
+
border-color: var(--kd-c-button-group-trigger-color-background-hover, var(--kd-g-color-theme-6, #5582f3));
|
|
366
368
|
}
|
|
367
|
-
.kd-btn-group-trigger .kd-btn-primary:
|
|
368
|
-
background: var(--kd-c-button-group-trigger-color-background-
|
|
369
|
+
.kd-btn-group-similar .kd-btn-group-trigger .kd-btn-primary:active {
|
|
370
|
+
background: var(--kd-c-button-group-trigger-color-background-active, var(--kd-g-color-theme-8, #1f3ba1));
|
|
369
371
|
}
|
|
370
|
-
.kd-btn-group-trigger .kd-btn {
|
|
371
|
-
|
|
372
|
+
.kd-btn-group-similar .kd-btn-group-trigger .kd-btn-primary:disabled {
|
|
373
|
+
background: var(--kd-c-button-group-trigger-color-background-disabled, var(--kd-g-color-theme-5, #87adff)) !important;
|
|
374
|
+
}
|
|
375
|
+
.kd-btn-group-similar > .kd-btn:first-child {
|
|
376
|
+
border-top-right-radius: 0;
|
|
377
|
+
border-bottom-right-radius: 0;
|
|
378
|
+
}
|
|
379
|
+
.kd-btn-group-similar > .kd-btn:first-child:hover {
|
|
380
|
+
z-index: 1;
|
|
372
381
|
}
|
|
373
382
|
.kd-btn-group .kd-btn-size-small,
|
|
374
383
|
.kd-btn-group .kd-btn-size-middle,
|
|
375
384
|
.kd-btn-group .kd-btn-size-large {
|
|
376
385
|
min-width: unset;
|
|
377
386
|
}
|
|
378
|
-
.kd-btn-group .kd-btn:first-child {
|
|
379
|
-
border-top-right-radius: 0;
|
|
380
|
-
border-bottom-right-radius: 0;
|
|
381
|
-
}
|
|
382
|
-
.kd-btn-group .kd-btn:last-child {
|
|
383
|
-
border-top-left-radius: 0;
|
|
384
|
-
border-bottom-left-radius: 0;
|
|
385
|
-
}
|
|
386
387
|
.kd-btn-group .kd-dropdown-menu {
|
|
387
388
|
padding: 0;
|
|
388
389
|
}
|
|
@@ -259,25 +259,37 @@
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
&-
|
|
263
|
-
.@{btn-prefix-cls}-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
262
|
+
&-similar {
|
|
263
|
+
.@{btn-prefix-cls}-group-trigger {
|
|
264
|
+
.@{btn-prefix-cls} {
|
|
265
|
+
border-top-left-radius: 0;
|
|
266
|
+
border-bottom-left-radius: 0;
|
|
267
|
+
margin-left: -1px;
|
|
268
|
+
&-primary {
|
|
269
|
+
background: @btn-group-trigger-color-background;
|
|
270
|
+
&:hover {
|
|
271
|
+
background: @btn-group-trigger-color-background-hover;
|
|
272
|
+
border-color: @btn-group-trigger-color-background-hover;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&:active {
|
|
276
|
+
background: @btn-group-trigger-color-background-active;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&:disabled {
|
|
280
|
+
background: @btn-group-trigger-color-background-disabled !important;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
276
283
|
}
|
|
277
284
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
285
|
+
&>.@{btn-prefix-cls} {
|
|
286
|
+
&:first-child {
|
|
287
|
+
border-top-right-radius: 0;
|
|
288
|
+
border-bottom-right-radius: 0;
|
|
289
|
+
&:hover {
|
|
290
|
+
z-index: 1;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
281
293
|
}
|
|
282
294
|
}
|
|
283
295
|
|
|
@@ -287,16 +299,6 @@
|
|
|
287
299
|
&-size-large {
|
|
288
300
|
min-width: unset;
|
|
289
301
|
}
|
|
290
|
-
|
|
291
|
-
&:first-child {
|
|
292
|
-
border-top-right-radius: 0;
|
|
293
|
-
border-bottom-right-radius: 0;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
&:last-child {
|
|
297
|
-
border-top-left-radius: 0;
|
|
298
|
-
border-bottom-left-radius: 0;
|
|
299
|
-
}
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
.@{kd-prefix}-dropdown {
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
@btn-group-dropdown-item-border-color: var(~'@{button-custom-prefix}-group-dropdown-item-border-color', #E5E5E5); // 集合按钮 下拉边框颜色
|
|
62
62
|
@btn-group-dropdown-item-color-background-hover: var(~'@{button-custom-prefix}-group-dropdown-item-color-background-hover', #F5F5F5); // 集合按钮 下拉hover背景颜色
|
|
63
63
|
@btn-group-dropdown-color-background: var(~'@{button-custom-prefix}-group-dropdown-color-background', #fff); // 集合按钮 下拉菜单背景颜色
|
|
64
|
-
@btn-group-trigger-color-background: var(~'@{button-custom-prefix}-group-trigger-color-background',
|
|
65
|
-
@btn-group-trigger-color-background-hover: var(~'@{button-custom-prefix}-group-trigger-color-background-hover',
|
|
66
|
-
@btn-group-trigger-color-background-active: var(~'@{button-custom-prefix}-group-trigger-color-background-active',
|
|
67
|
-
@btn-group-trigger-color-background-disabled: var(~'@{button-custom-prefix}-group-trigger-color-background-disabled',
|
|
64
|
+
@btn-group-trigger-color-background: var(~'@{button-custom-prefix}-group-trigger-color-background', @color-theme-7);
|
|
65
|
+
@btn-group-trigger-color-background-hover: var(~'@{button-custom-prefix}-group-trigger-color-background-hover', @color-theme-6);
|
|
66
|
+
@btn-group-trigger-color-background-active: var(~'@{button-custom-prefix}-group-trigger-color-background-active', @color-theme-8);
|
|
67
|
+
@btn-group-trigger-color-background-disabled: var(~'@{button-custom-prefix}-group-trigger-color-background-disabled', @color-theme-5);
|
|
68
68
|
|
|
69
69
|
// font
|
|
70
70
|
@btn-g-font-weight: var(~'@{button-custom-prefix}-font-weight', @font-weight-light);
|
|
@@ -14,8 +14,8 @@ declare type FieldNames = {
|
|
|
14
14
|
value: string;
|
|
15
15
|
children: string;
|
|
16
16
|
};
|
|
17
|
-
export declare const
|
|
18
|
-
export declare type
|
|
17
|
+
export declare const CascaderPlacement: ["topLeft", "topRight", "bottomLeft", "bottomRight"];
|
|
18
|
+
export declare type CascaderPlacementType = typeof CascaderPlacement[number];
|
|
19
19
|
export declare type CascaderValueType = Array<string | number>;
|
|
20
20
|
export declare type CascaderExpandTrigger = 'click' | 'hover';
|
|
21
21
|
export interface CascaderProps extends PopperProps {
|
|
@@ -29,8 +29,10 @@ export interface CascaderProps extends PopperProps {
|
|
|
29
29
|
allowClear?: boolean;
|
|
30
30
|
placeholder?: string;
|
|
31
31
|
popupVisible?: boolean;
|
|
32
|
+
popperVisible?: boolean;
|
|
32
33
|
fieldNames?: FieldNames;
|
|
33
34
|
popupClassName?: string;
|
|
35
|
+
popperClassName?: string;
|
|
34
36
|
changeOnSelect?: boolean;
|
|
35
37
|
notFoundContent?: string;
|
|
36
38
|
value?: CascaderValueType;
|
|
@@ -40,10 +42,12 @@ export interface CascaderProps extends PopperProps {
|
|
|
40
42
|
expandIcon?: React.ReactNode;
|
|
41
43
|
defaultPopupVisible?: boolean;
|
|
42
44
|
defaultValue?: CascaderValueType;
|
|
43
|
-
popupPlacement?:
|
|
45
|
+
popupPlacement?: CascaderPlacementType;
|
|
46
|
+
popperPlacement?: CascaderPlacementType;
|
|
44
47
|
options?: Array<CascaderOptionType>;
|
|
45
48
|
expandTrigger?: CascaderExpandTrigger;
|
|
46
49
|
onPopupVisibleChange?: (visible: boolean) => void;
|
|
50
|
+
onPopperVisibleChange?: (visible: boolean) => void;
|
|
47
51
|
loadData?: (selectedOptions: CascaderOptionType[]) => void;
|
|
48
52
|
dropdownRender?: (menus: React.ReactNode) => React.ReactNode;
|
|
49
53
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|