@kdcloudjs/kdesign 1.3.3 → 1.3.6

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 (46) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/kdesign-complete.less +5 -4
  3. package/dist/kdesign.css +2 -5
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +3493 -1832
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +2 -2
  8. package/dist/kdesign.min.js +8 -8
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/_utils/usePopper.d.ts +1 -0
  11. package/es/_utils/usePopper.js +29 -25
  12. package/es/anchor/anchor.js +20 -1
  13. package/es/base-data/style/index.css +1 -0
  14. package/es/base-data/style/index.less +1 -0
  15. package/es/form/Field.js +7 -6
  16. package/es/form/Form.d.ts +1 -0
  17. package/es/form/Form.js +3 -1
  18. package/es/form/interface.d.ts +1 -0
  19. package/es/menu/menu.js +12 -11
  20. package/es/menu/subMenu.js +58 -57
  21. package/es/select/select.js +24 -18
  22. package/es/style/core/reset.less +4 -4
  23. package/es/style/index.css +0 -4
  24. package/es/table/feature/useRangeSelection.d.ts +3 -0
  25. package/es/table/feature/useRangeSelection.js +10 -0
  26. package/es/table/interface.d.ts +15 -2
  27. package/es/table/table.js +14 -7
  28. package/lib/_utils/usePopper.d.ts +1 -0
  29. package/lib/_utils/usePopper.js +29 -25
  30. package/lib/anchor/anchor.js +20 -1
  31. package/lib/base-data/style/index.css +1 -0
  32. package/lib/base-data/style/index.less +1 -0
  33. package/lib/form/Field.js +7 -6
  34. package/lib/form/Form.d.ts +1 -0
  35. package/lib/form/Form.js +3 -1
  36. package/lib/form/interface.d.ts +1 -0
  37. package/lib/menu/menu.js +12 -11
  38. package/lib/menu/subMenu.js +58 -57
  39. package/lib/select/select.js +24 -18
  40. package/lib/style/core/reset.less +4 -4
  41. package/lib/style/index.css +0 -4
  42. package/lib/table/feature/useRangeSelection.d.ts +3 -0
  43. package/lib/table/feature/useRangeSelection.js +21 -0
  44. package/lib/table/interface.d.ts +15 -2
  45. package/lib/table/table.js +15 -7
  46. package/package.json +2 -2
@@ -15,6 +15,7 @@ export interface PopperProps {
15
15
  mouseEnterDelay?: number;
16
16
  mouseLeaveDelay?: number;
17
17
  defaultVisible?: boolean;
18
+ autoPlacement?: boolean;
18
19
  popperClassName?: string;
19
20
  placement?: PlacementType;
20
21
  popperStyle?: React.CSSProperties;
@@ -150,6 +150,8 @@ function usePopper(locatorElement, popperElement, props) {
150
150
  mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela,
151
151
  _props$defaultVisible = props.defaultVisible,
152
152
  defaultVisible = _props$defaultVisible === void 0 ? false : _props$defaultVisible,
153
+ _props$autoPlacement = props.autoPlacement,
154
+ autoPlacement = _props$autoPlacement === void 0 ? true : _props$autoPlacement,
153
155
  _props$getTriggerElem = props.getTriggerElement,
154
156
  getTriggerElement = _props$getTriggerElem === void 0 ? function (locatorNode) {
155
157
  return locatorNode;
@@ -287,36 +289,38 @@ function usePopper(locatorElement, popperElement, props) {
287
289
  var currentPos = trigger === 'contextMenu' ? mousePos : locatorPos;
288
290
  var _currentPlacement = placement;
289
291
 
290
- if (top - gap - popperHeight <= 5 && bottom + gap + popperHeight < document.body.clientHeight - 5) {
291
- _currentPlacement = _currentPlacement.replace('top', 'bottom');
292
- }
292
+ if (autoPlacement) {
293
+ if (top - gap - popperHeight <= 5 && bottom + gap + popperHeight < document.body.clientHeight - 5) {
294
+ _currentPlacement = _currentPlacement.replace('top', 'bottom');
295
+ }
293
296
 
294
- if (bottom + gap + popperHeight >= document.body.clientHeight - 5 && top - gap - popperHeight > 5) {
295
- _currentPlacement = _currentPlacement.replace('bottom', 'top');
296
- }
297
+ if (bottom + gap + popperHeight >= document.body.clientHeight - 5 && top - gap - popperHeight > 5) {
298
+ _currentPlacement = _currentPlacement.replace('bottom', 'top');
299
+ }
297
300
 
298
- if (left + popperWidth >= document.body.clientWidth - 5 && right - popperWidth > 5) {
299
- _currentPlacement = _currentPlacement.replace('Left', 'Right');
300
- }
301
+ if (left + popperWidth >= document.body.clientWidth - 5 && right - popperWidth > 5) {
302
+ _currentPlacement = _currentPlacement.replace('Left', 'Right');
303
+ }
301
304
 
302
- if (right - popperWidth <= 5 && left + popperWidth < document.body.clientWidth - 5) {
303
- _currentPlacement = _currentPlacement.replace('Right', 'Left');
304
- }
305
+ if (right - popperWidth <= 5 && left + popperWidth < document.body.clientWidth - 5) {
306
+ _currentPlacement = _currentPlacement.replace('Right', 'Left');
307
+ }
305
308
 
306
- if (top + popperHeight >= document.body.clientHeight - 5 && bottom - popperHeight > 5) {
307
- _currentPlacement = _currentPlacement.replace('Top', 'Bottom');
308
- }
309
+ if (top + popperHeight >= document.body.clientHeight - 5 && bottom - popperHeight > 5) {
310
+ _currentPlacement = _currentPlacement.replace('Top', 'Bottom');
311
+ }
309
312
 
310
- if (bottom - popperHeight <= 5 && top + popperHeight < document.body.clientHeight - 5) {
311
- _currentPlacement = _currentPlacement.replace('Bottom', 'Top');
312
- }
313
+ if (bottom - popperHeight <= 5 && top + popperHeight < document.body.clientHeight - 5) {
314
+ _currentPlacement = _currentPlacement.replace('Bottom', 'Top');
315
+ }
313
316
 
314
- if (left - gap - popperWidth <= 5 && right + gap + popperWidth < document.body.clientWidth - 5) {
315
- _currentPlacement = _currentPlacement.replace('left', 'right');
316
- }
317
+ if (left - gap - popperWidth <= 5 && right + gap + popperWidth < document.body.clientWidth - 5) {
318
+ _currentPlacement = _currentPlacement.replace('left', 'right');
319
+ }
317
320
 
318
- if (right + gap + popperWidth >= document.body.clientWidth - 5 && left - gap - popperWidth > 5) {
319
- _currentPlacement = _currentPlacement.replace('right', 'left');
321
+ if (right + gap + popperWidth >= document.body.clientWidth - 5 && left - gap - popperWidth > 5) {
322
+ _currentPlacement = _currentPlacement.replace('right', 'left');
323
+ }
320
324
  }
321
325
 
322
326
  var leftLeft = currentPos.left - popperWidth - gap;
@@ -429,7 +433,7 @@ function usePopper(locatorElement, popperElement, props) {
429
433
  setArrowPos(_arrowPos);
430
434
  setCurrentPlacement(_currentPlacement);
431
435
  }
432
- }, [locatorRef, popperRef, container, trigger, mousePos, placement, gap, arrowOffset, arrowSize, arrowWidth]);
436
+ }, [locatorRef, popperRef, container, trigger, mousePos, placement, gap, arrowOffset, arrowSize, arrowWidth, autoPlacement]);
433
437
  useEffect(function () {
434
438
  if (canAlign) {
435
439
  alignPopper();
@@ -444,7 +448,7 @@ function usePopper(locatorElement, popperElement, props) {
444
448
 
445
449
  var popperContainerStyle = _extends(_extends(_extends({
446
450
  position: 'absolute'
447
- }, popperStyle), align), arrow ? arrowStyle : {});
451
+ }, align), arrow ? arrowStyle : {}), popperStyle);
448
452
 
449
453
  var popperProps = {
450
454
  ref: popperRef,
@@ -320,7 +320,9 @@ var InternalAnchor = function InternalAnchor(props, ref) {
320
320
  !isLocked && setOptionShow(visible);
321
321
  };
322
322
 
323
- var popperProps = _extends(_extends({}, anchorProps), {
323
+ var popperProps = _extends(_extends({
324
+ autoPlacement: false
325
+ }, anchorProps), {
324
326
  prefixCls: anchorPrefixCls,
325
327
  defaultVisible: optionShow,
326
328
  visible: optionShow,
@@ -328,6 +330,22 @@ var InternalAnchor = function InternalAnchor(props, ref) {
328
330
  onVisibleChange: handleVisibleChange
329
331
  });
330
332
 
333
+ var fixedRef = React.useRef(null);
334
+
335
+ if (type === 'advanced' && isLocked) {
336
+ if (fixedRef.current) {
337
+ var _fixedRef$current$get = fixedRef.current.getBoundingClientRect(),
338
+ left = _fixedRef$current$get.left,
339
+ top = _fixedRef$current$get.top;
340
+
341
+ popperProps.popperStyle = {
342
+ position: 'fixed',
343
+ left: left,
344
+ top: top
345
+ };
346
+ }
347
+ }
348
+
331
349
  var addChildrenProps = function addChildrenProps(linksChildren) {
332
350
  var _context4;
333
351
 
@@ -456,6 +474,7 @@ var InternalAnchor = function InternalAnchor(props, ref) {
456
474
  type: "lock-solid"
457
475
  });
458
476
  return /*#__PURE__*/React.createElement("div", {
477
+ ref: fixedRef,
459
478
  className: anchorAdvancedClass,
460
479
  style: dropdownStyle
461
480
  }, lockedIcon !== false && /*#__PURE__*/React.createElement("span", {
@@ -222,6 +222,7 @@
222
222
  }
223
223
  .kd-baseData-dropdown-options {
224
224
  height: var(--kd-c-base-data-dropdown-options-sizing-height, 32px);
225
+ cursor: pointer;
225
226
  }
226
227
  .kd-baseData-dropdown-options:hover {
227
228
  background: var(--kd-c-base-data-color-background-hover, var(--kd-g-color-hover, #f5f5f5));
@@ -115,6 +115,7 @@
115
115
 
116
116
  &-options {
117
117
  height: @base-data-dropdown-options-height;
118
+ cursor: pointer;
118
119
 
119
120
  &:hover {
120
121
  background: @base-data-hover-bg;
package/es/form/Field.js CHANGED
@@ -98,7 +98,8 @@ var Field = function Field(props) {
98
98
  getInternalHooks = fieldContext.getInternalHooks,
99
99
  vertical = fieldContext.vertical,
100
100
  getDefaultValue = fieldContext.getDefaultValue,
101
- local = fieldContext.local;
101
+ local = fieldContext.local,
102
+ formDisabled = fieldContext.disabled;
102
103
 
103
104
  var _getInternalHooks = getInternalHooks(INTERNAL_HOOK_KEY),
104
105
  registerField = _getInternalHooks.registerField,
@@ -264,17 +265,17 @@ var Field = function Field(props) {
264
265
  chDisabled = _ch$props.disabled,
265
266
  chDefaultValue = _ch$props.defaultValue;
266
267
 
267
- var onChange = function onChange(evt) {
268
+ var onChange = function onChange() {
268
269
  if (chValue === undefined) {
269
- setFieldValue(getInputValueFormProp(evt));
270
+ setFieldValue(getInputValueFormProp(arguments.length <= 0 ? undefined : arguments[0]));
270
271
  }
271
272
 
272
273
  if (typeof faChange === 'function') {
273
- faChange(evt);
274
+ faChange.apply(void 0, arguments);
274
275
  }
275
276
 
276
277
  if (typeof chChange === 'function') {
277
- chChange(evt);
278
+ chChange.apply(void 0, arguments);
278
279
  }
279
280
  };
280
281
 
@@ -292,7 +293,7 @@ var Field = function Field(props) {
292
293
  return _extends(_extends({}, rest), (_extends3 = {
293
294
  onChange: onChange,
294
295
  defaultValue: defaultValue
295
- }, _defineProperty(_extends3, innerValuePropName, fieldValue), _defineProperty(_extends3, "disabled", chDisabled || faDisabled), _extends3));
296
+ }, _defineProperty(_extends3, innerValuePropName, fieldValue), _defineProperty(_extends3, "disabled", chDisabled !== undefined ? chDisabled : faDisabled !== undefined ? faDisabled : formDisabled), _extends3));
296
297
  };
297
298
 
298
299
  return /*#__PURE__*/React.createElement("div", {
package/es/form/Form.d.ts CHANGED
@@ -4,6 +4,7 @@ declare type BaseFormProps = Omit<React.FormHTMLAttributes<HTMLFormElement>, 'on
4
4
  export interface FormProps<Values = any> extends BaseFormProps {
5
5
  children?: React.ReactNode;
6
6
  defaultValues?: Store;
7
+ disabled?: boolean;
7
8
  className?: string;
8
9
  form?: FormInstance<Values>;
9
10
  labelAlign?: LabelAlign;
package/es/form/Form.js CHANGED
@@ -52,7 +52,8 @@ var Form = function Form(props, ref) {
52
52
  onFinish = formProps.onFinish,
53
53
  onFinishFailed = formProps.onFinishFailed,
54
54
  onValuesChange = formProps.onValuesChange,
55
- restProps = __rest(formProps, ["children", "defaultValues", "className", "form", "labelAlign", "labelWidth", "layout", "name", "prefixCls", "wrapperWidth", "onFinish", "onFinishFailed", "onValuesChange"]);
55
+ disabled = formProps.disabled,
56
+ restProps = __rest(formProps, ["children", "defaultValues", "className", "form", "labelAlign", "labelWidth", "layout", "name", "prefixCls", "wrapperWidth", "onFinish", "onFinishFailed", "onValuesChange", "disabled"]);
56
57
 
57
58
  var formPrefixCls = getPrefixCls(prefixCls, 'form', customizePrefixCls);
58
59
  var formClassName = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(formPrefixCls), true), _defineProperty(_classnames, _concatInstanceProperty(_context = "".concat(formPrefixCls, "-")).call(_context, layout), true), _classnames), className);
@@ -90,6 +91,7 @@ var Form = function Form(props, ref) {
90
91
  labelWidth: labelWidth,
91
92
  wrapperWidth: wrapperWidth,
92
93
  local: formLang,
94
+ disabled: disabled,
93
95
  vertical: layout === 'vertical'
94
96
  });
95
97
  }, [formInstance, labelAlign, labelWidth, wrapperWidth, layout, formLang]);
@@ -34,6 +34,7 @@ export interface InternalFormInstance extends FormInstance {
34
34
  labelAlign?: LabelAlign;
35
35
  wrapperWidth?: string | number;
36
36
  vertical?: boolean;
37
+ disabled?: boolean;
37
38
  local?: InnerLocale;
38
39
  getInternalHooks: (key: string) => InternalHooks | null;
39
40
  }
package/es/menu/menu.js CHANGED
@@ -75,31 +75,32 @@ var Menu = function Menu(props) {
75
75
  openKeys = _React$useState4[0],
76
76
  setOpenKeys = _React$useState4[1];
77
77
 
78
+ if (mode === 'inline') {
79
+ restProps.triggerSubMenuAction = 'click';
80
+ }
81
+
82
+ useEffect(function () {
83
+ setOpenKeys([]);
84
+ setSelectedKey('');
85
+ openSubMenuSet.clear();
86
+ }, [mode]);
78
87
  useEffect(function () {
79
88
  if (userSelectedKey !== undefined) {
80
89
  setSelectedKey(userSelectedKey);
81
90
  }
82
91
  }, [userSelectedKey]);
83
92
  useEffect(function () {
84
- if (userOpenKeys !== undefined) {
93
+ if (userOpenKeys !== undefined && Array.isArray(userOpenKeys)) {
85
94
  setOpenKeys(userOpenKeys);
86
- }
87
- }, [userOpenKeys]);
88
- useEffect(function () {
89
- if (Array.isArray(userOpenKeys)) {
95
+ openSubMenuSet.clear();
90
96
  userOpenKeys.forEach(function (d) {
91
97
  openSubMenuSet.add(d);
92
98
  });
93
99
  }
94
- }, []); // triggerSubMenuAction内嵌模式固定为click,即该值设置只对垂直模式有效
95
-
96
- if (mode === 'inline') {
97
- restProps.triggerSubMenuAction = 'click';
98
- } // React.useEffect(() => {
100
+ }, [userOpenKeys]); // React.useEffect(() => {
99
101
  // setCollapsed(restProps.collapsed)
100
102
  // }, [restProps.collapsed])
101
103
 
102
-
103
104
  var handleOnClick = function handleOnClick(info) {
104
105
  if (userSelectedKey === undefined) {
105
106
  setSelectedKey(info.key);
@@ -31,7 +31,7 @@ import devWarning from '../_utils/devwarning';
31
31
  import { MENU_ITEM_CONTAINER_NAME } from './menuItem';
32
32
 
33
33
  var SubMenu = function SubMenu(props) {
34
- var _classNames3, _classNames4, _context5;
34
+ var _classNames2, _classNames3, _context4;
35
35
 
36
36
  var _React$useContext = React.useContext(ConfigContext),
37
37
  getPrefixCls = _React$useContext.getPrefixCls,
@@ -59,8 +59,9 @@ var SubMenu = function SubMenu(props) {
59
59
  handleOnOpenChange = _a.handleOnOpenChange,
60
60
  _a$paddingLeft = _a.paddingLeft,
61
61
  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"]); // 初始化level
62
+ restProps = __rest(_a, ["prefixCls", "theme", "mode", "title", "icon", "disabled", "children", "collapsed", "keyValue", "selectedKey", "openKeys", "triggerSubMenuAction", "forceSubMenuRender", "inlineIndent", "className", "style", "handleOnOpenChange", "paddingLeft"]);
63
63
 
64
+ var isVertical = mode === 'vertical'; // 初始化level
64
65
 
65
66
  if (!restProps.level) {
66
67
  restProps.level = 1;
@@ -82,7 +83,7 @@ var SubMenu = function SubMenu(props) {
82
83
  var visible = Array.isArray(openKeys) && _includesInstanceProperty(openKeys).call(openKeys, keyValue);
83
84
 
84
85
  React.useEffect(function () {
85
- if (!visible) return;
86
+ if (!visible || isVertical) return;
86
87
  var subMenuWrapperEle = subMenuWrapperRef.current;
87
88
  var subMenuEle = subMenuRef.current;
88
89
 
@@ -187,11 +188,10 @@ var SubMenu = function SubMenu(props) {
187
188
  if (!_includesInstanceProperty(className).call(className, MENU_ITEM_CONTAINER_NAME)) {
188
189
  closeSubMenu();
189
190
  }
190
- }); // 缩略模式自动关闭子菜单
191
-
192
- if (triggerSubMenuAction === 'click' && mode === 'vertical' && collapsed) {
193
- closeSubMenu();
194
- }
191
+ }); // // 缩略模式自动关闭子菜单
192
+ // if (triggerSubMenuAction === 'click' && mode === 'vertical' && collapsed) {
193
+ // closeSubMenu()
194
+ // }
195
195
 
196
196
  var handleMouseEvent = function handleMouseEvent(status) {
197
197
  if (disabled || triggerSubMenuAction === 'click') return;
@@ -212,7 +212,7 @@ var SubMenu = function SubMenu(props) {
212
212
  // 保存路径
213
213
  info.keyPath = _concatInstanceProperty(_context = info.keyPath).call(_context, [keyValue]);
214
214
 
215
- if (triggerSubMenuAction === 'click' && mode === 'vertical') {
215
+ if (triggerSubMenuAction === 'click' && isVertical) {
216
216
  closeSubMenu();
217
217
  }
218
218
 
@@ -285,53 +285,12 @@ var SubMenu = function SubMenu(props) {
285
285
  var titleStyle = {
286
286
  paddingRight: "".concat(curPaddingRight, "px"),
287
287
  paddingLeft: "".concat(curPaddingLeft, "px")
288
- };
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
288
+ }; // eslint-disable-next-line react-hooks/rules-of-hooks
328
289
 
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)),
290
+ 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)),
332
292
  ref: subMenuVerticalRef,
333
- key: keyValue,
334
- style: style
293
+ key: keyValue
335
294
  }, {
336
295
  onMouseLeave: handleOnMouseLeave,
337
296
  onMouseEnter: handleOnMouseEnter,
@@ -350,8 +309,8 @@ var SubMenu = function SubMenu(props) {
350
309
  handleOnMouseEnter();
351
310
  }
352
311
  }, /*#__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) {
312
+ className: classNames("".concat(prefixCls, "-sub"), restProps.popupClassName, (_classNames3 = {}, _defineProperty(_classNames3, "".concat(prefixCls, "-sub-second"), restProps.level === 1), _defineProperty(_classNames3, "".concat(prefixCls, "-sub-third"), restProps.level === 2), _classNames3))
313
+ }, _mapInstanceProperty(_context4 = toArray(children)).call(_context4, function (item, index) {
355
314
  var key = item.key || index;
356
315
  return /*#__PURE__*/React.cloneElement(item, {
357
316
  key: key,
@@ -373,10 +332,52 @@ var SubMenu = function SubMenu(props) {
373
332
  arrow: false,
374
333
  placement: 'rightTop',
375
334
  gap: 0,
376
- visible: visible,
335
+ visible: isVertical ? visible : false,
336
+ disabled: isVertical ? undefined : true,
377
337
  prefixCls: 'kd-menu-popper',
378
338
  popperClassName: theme === 'light' ? 'light' : ''
379
339
  });
340
+
341
+ if (isVertical) {
342
+ return verticalView;
343
+ } else {
344
+ var _classNames4, _context5;
345
+
346
+ return /*#__PURE__*/React.createElement("li", _extends({
347
+ ref: subMenuRef,
348
+ className: classNames(prefixCls, className, (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefixCls, "-collapsed"), collapsed), _defineProperty(_classNames4, "".concat(prefixCls, "-disabled"), disabled), _classNames4)),
349
+ key: keyValue
350
+ }, mouseEvent, {
351
+ style: style
352
+ }), /*#__PURE__*/React.createElement("div", {
353
+ className: classNames("".concat(prefixCls, "-title")),
354
+ style: titleStyle
355
+ }, icon && /*#__PURE__*/React.cloneElement(renderReactNodeFunction(icon), {
356
+ className: classNames("".concat(prefixCls, "-icon"))
357
+ }), renderItemTitle(), renderItemArrow()), /*#__PURE__*/React.createElement("div", {
358
+ style: getCurrentStyle(),
359
+ ref: subMenuWrapperRef
360
+ }, /*#__PURE__*/React.createElement("ul", {
361
+ className: classNames("".concat(prefixCls, "-sub"), restProps.popupClassName)
362
+ }, _mapInstanceProperty(_context5 = toArray(children)).call(_context5, function (item, index) {
363
+ var key = item.key || index;
364
+ return /*#__PURE__*/React.cloneElement(item, {
365
+ key: key,
366
+ level: restProps.level + 1,
367
+ keyValue: key,
368
+ collapsed: collapsed,
369
+ mode: mode,
370
+ selectedKey: selectedKey,
371
+ openKeys: openKeys,
372
+ forceSubMenuRender: forceSubMenuRender,
373
+ triggerSubMenuAction: triggerSubMenuAction,
374
+ handleOnOpenChange: handleOnOpenChange,
375
+ handleOnClick: handleOnClick,
376
+ inlineIndent: inlineIndent,
377
+ paddingLeft: curPaddingLeft
378
+ });
379
+ }))));
380
+ }
380
381
  };
381
382
 
382
383
  SubMenu.displayName = 'SubMenu';
@@ -67,7 +67,6 @@ var InternalSelect = function InternalSelect(props, ref) {
67
67
  setInitValue = _useMergedState2[1];
68
68
 
69
69
  var realChildren = Array.isArray(options) ? options : toArray(children); // options配置项和默认children
70
- // console.log('real', realChildren)
71
70
 
72
71
  var innerRef = React.useRef();
73
72
  var selectRef = ref || innerRef;
@@ -251,6 +250,7 @@ var InternalSelect = function InternalSelect(props, ref) {
251
250
  return (child === null || child === void 0 ? void 0 : child.value) === key;
252
251
  }
253
252
  })) || {};
253
+ var optionsObj = obj.props ? obj.props : obj || {};
254
254
 
255
255
  if (value !== undefined) {
256
256
  // onChange && onChange(labelInValue ? { value: key, label } : key)
@@ -271,13 +271,13 @@ var InternalSelect = function InternalSelect(props, ref) {
271
271
  _spliceInstanceProperty(optsArr).call(optsArr, idx, 1);
272
272
  } else {
273
273
  valArr.push(key);
274
- optsArr.push({
274
+ optsArr.push(_extends(_extends({}, optionsObj), {
275
275
  value: key,
276
276
  label: obj.props ? (_a = obj.props) === null || _a === void 0 ? void 0 : _a.children : obj.label || key
277
- });
277
+ }));
278
278
  }
279
279
 
280
- onChange && onChange(labelInValue ? optsArr : valArr);
280
+ onChange && onChange(labelInValue ? optsArr : valArr, optsArr);
281
281
 
282
282
  if (!isSelected) {
283
283
  onDeselect && onDeselect(key); // 下拉项取消选中时调用,参数为选中项的value,多选模式下生效
@@ -287,7 +287,10 @@ var InternalSelect = function InternalSelect(props, ref) {
287
287
  onChange && onChange(labelInValue ? {
288
288
  value: key,
289
289
  label: label
290
- } : key);
290
+ } : key, _extends(_extends({}, optionsObj), {
291
+ value: key,
292
+ label: label
293
+ }));
291
294
  }
292
295
 
293
296
  onSelect && onSelect(key);
@@ -303,7 +306,10 @@ var InternalSelect = function InternalSelect(props, ref) {
303
306
  onChange && onChange(labelInValue ? {
304
307
  value: key,
305
308
  label: label
306
- } : key);
309
+ } : key, _extends(_extends({}, optionsObj), {
310
+ value: key,
311
+ label: label
312
+ }));
307
313
  } else {
308
314
  var _multipleRef$current2 = multipleRef.current,
309
315
  _selectedVal = _multipleRef$current2.selectedVal,
@@ -318,15 +324,15 @@ var InternalSelect = function InternalSelect(props, ref) {
318
324
  } else {
319
325
  _selectedVal.push(key);
320
326
 
321
- _selectMulOpts.push({
327
+ _selectMulOpts.push(_extends(_extends({}, optionsObj), {
322
328
  value: key,
323
329
  label: obj.props ? (_c = obj.props) === null || _c === void 0 ? void 0 : _c.children : obj.label || key
324
- });
330
+ }));
325
331
  } // setInitValue([...selectedVal])
326
332
 
327
333
 
328
334
  setMulOptions(_toConsumableArray(_selectMulOpts));
329
- onChange && onChange(labelInValue ? _selectMulOpts : _selectedVal);
335
+ onChange && onChange(labelInValue ? _selectMulOpts : _selectedVal, _selectMulOpts);
330
336
 
331
337
  if (!isSelected) {
332
338
  onDeselect && onDeselect(key); // 下拉项取消选中时调用,参数为选中项的value,多选模式下生效
@@ -347,9 +353,9 @@ var InternalSelect = function InternalSelect(props, ref) {
347
353
 
348
354
  if ((realChildren === null || realChildren === void 0 ? void 0 : realChildren.length) !== selectedVal.length) {
349
355
  _mapInstanceProperty(realChildren).call(realChildren, function (child) {
350
- var _child$props = child.props,
351
- value = _child$props.value,
352
- children = _child$props.children;
356
+ var _ref = child.props || child,
357
+ value = _ref.value,
358
+ children = _ref.children;
353
359
 
354
360
  if (!_includesInstanceProperty(selectedVal).call(selectedVal, value)) {
355
361
  selectedVal.push(value);
@@ -362,12 +368,12 @@ var InternalSelect = function InternalSelect(props, ref) {
362
368
 
363
369
  setMulOptions(_toConsumableArray(selectMulOpts));
364
370
  } else {
365
- multipleRef.current.selectedVal = [];
366
- multipleRef.current.selectMulOpts = [];
371
+ multipleRef.current.selectedVal = selectedVal = [];
372
+ multipleRef.current.selectMulOpts = selectMulOpts = [];
367
373
  setMulOptions([]);
368
374
  }
369
375
 
370
- onChange && onChange(labelInValue ? selectMulOpts : selectedVal);
376
+ onChange && onChange(labelInValue ? selectMulOpts : selectedVal, selectMulOpts);
371
377
  }; // 筛选内容 ---可以优化,抽成hook
372
378
 
373
379
 
@@ -428,7 +434,7 @@ var InternalSelect = function InternalSelect(props, ref) {
428
434
  _spliceInstanceProperty(selectMulOpts).call(selectMulOpts, idx, 1);
429
435
 
430
436
  setMulOptions(_toConsumableArray(selectMulOpts));
431
- onChange && onChange(labelInValue ? selectMulOpts : selectedVal);
437
+ onChange && onChange(labelInValue ? selectMulOpts : selectedVal, selectMulOpts);
432
438
  e.stopPropagation();
433
439
  }; // 渲染后缀图标
434
440
 
@@ -659,8 +665,8 @@ var InternalSelect = function InternalSelect(props, ref) {
659
665
  var _a;
660
666
 
661
667
  if (selectRef === null || selectRef === void 0 ? void 0 : selectRef.current) {
662
- var _ref = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(),
663
- width = _ref.width;
668
+ var _ref2 = (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(),
669
+ width = _ref2.width;
664
670
 
665
671
  return {
666
672
  width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || (width > 75 ? width : 75),
@@ -194,10 +194,10 @@ template {
194
194
  /**
195
195
  * Reset scrollbar style
196
196
  */
197
- ::-webkit-scrollbar {
198
- width: 10px !important;
199
- height: 10px !important;
200
- }
197
+ // ::-webkit-scrollbar {
198
+ // width: 10px !important;
199
+ // height: 10px !important;
200
+ // }
201
201
 
202
202
  ::-webkit-scrollbar-button {
203
203
  width: 0;
@@ -1779,10 +1779,6 @@ template {
1779
1779
  /**
1780
1780
  * Reset scrollbar style
1781
1781
  */
1782
- ::-webkit-scrollbar {
1783
- width: 10px !important;
1784
- height: 10px !important;
1785
- }
1786
1782
  ::-webkit-scrollbar-button {
1787
1783
  width: 0;
1788
1784
  height: 0;
@@ -0,0 +1,3 @@
1
+ import { TableRangeSelection, TablePipeline } from '../interface';
2
+ declare function useRangeSelection(pipeline: TablePipeline, rangeSelection?: TableRangeSelection): void;
3
+ export default useRangeSelection;
@@ -0,0 +1,10 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
+ import { features } from '@kdcloudjs/table';
3
+
4
+ function useRangeSelection(pipeline, rangeSelection) {
5
+ if (rangeSelection) {
6
+ pipeline.use(features.rangeSelection(_extends({}, rangeSelection)));
7
+ }
8
+ }
9
+
10
+ export default useRangeSelection;
@@ -1,6 +1,16 @@
1
+ /// <reference types="react" />
1
2
  import { TableProps as BaseTableProps, TablePipeline as TP, ArtColumnStaticPart } from '@kdcloudjs/table';
2
- import { SortFeatureOptions, RowDetailFeatureOptions, FilterFeatureOptions, TreeModeFeatureOptions, ColumnDragOptions, ColumnResizeOptions, ContextMenuFeatureOptions } from '@kdcloudjs/table/es/table/pipeline/features';
3
- export interface TableProps extends BaseTableProps {
3
+ import { SortFeatureOptions, RowDetailFeatureOptions, FilterFeatureOptions, TreeModeFeatureOptions, ColumnDragOptions, ColumnResizeOptions, ContextMenuFeatureOptions, RangeSelectionFeatureOptions } from '@kdcloudjs/table/es/table/pipeline/features';
4
+ declare type TablePropsOfComponents = Pick<BaseTableProps, 'components'> & {
5
+ components?: {
6
+ /** 复选框 */
7
+ Checkbox?: React.ComponentType;
8
+ /** 单选框 */
9
+ Radio?: React.ComponentType;
10
+ };
11
+ };
12
+ declare type TablePropsOfExtend = Omit<BaseTableProps, 'components'>;
13
+ export interface TableProps extends TablePropsOfExtend, TablePropsOfComponents {
4
14
  rowSelection?: TableRowSelection;
5
15
  prefixCls?: string;
6
16
  rowDetail?: TableRowDetail;
@@ -11,6 +21,7 @@ export interface TableProps extends BaseTableProps {
11
21
  columnDrag?: boolean | ColumnDragOptions;
12
22
  columnResize?: boolean | ColumnResizeOptions;
13
23
  contextMenu?: IContextMenu;
24
+ rangeSelection?: TableRangeSelection;
14
25
  }
15
26
  export declare type RowSelectionType = 'checkbox' | 'radio';
16
27
  export declare type RowSelectionFixed = 'start' | 'end';
@@ -32,3 +43,5 @@ export declare type TableSort = SortFeatureOptions;
32
43
  export declare type TableTreeMode = TreeModeFeatureOptions;
33
44
  export declare type TablePipeline = TP;
34
45
  export declare type IContextMenu = boolean | ContextMenuFeatureOptions;
46
+ export declare type TableRangeSelection = RangeSelectionFeatureOptions;
47
+ export {};