@kdcloudjs/kdesign 1.6.15 → 1.6.17

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 (56) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/kdesign-complete.less +5 -0
  3. package/dist/kdesign.css +7 -1
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +563 -316
  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.js +2 -0
  11. package/es/checkbox/checkbox.d.ts +1 -4
  12. package/es/checkbox/checkbox.js +26 -19
  13. package/es/checkbox/group.d.ts +11 -1
  14. package/es/checkbox/group.js +43 -71
  15. package/es/checkbox/index.d.ts +2 -1
  16. package/es/checkbox/index.js +1 -1
  17. package/es/date-picker/range/input-range.js +1 -1
  18. package/es/date-picker/single/input-date.js +1 -1
  19. package/es/modal/style/index.css +4 -0
  20. package/es/modal/style/index.less +2 -0
  21. package/es/select/select.js +4 -3
  22. package/es/stepper/style/index.css +2 -0
  23. package/es/stepper/style/index.less +3 -0
  24. package/es/table/feature/useFooterDataSource.d.ts +3 -0
  25. package/es/table/feature/useFooterDataSource.js +11 -0
  26. package/es/table/interface.d.ts +1 -0
  27. package/es/table/table.js +10 -9
  28. package/es/tree/tree.js +15 -1
  29. package/es/tree/treeHooks.d.ts +1 -1
  30. package/es/tree/treeHooks.js +5 -5
  31. package/es/tree/utils/treeUtils.d.ts +3 -2
  32. package/es/tree/utils/treeUtils.js +49 -17
  33. package/lib/_utils/usePopper.js +2 -0
  34. package/lib/checkbox/checkbox.d.ts +1 -4
  35. package/lib/checkbox/checkbox.js +32 -25
  36. package/lib/checkbox/group.d.ts +11 -1
  37. package/lib/checkbox/group.js +49 -75
  38. package/lib/checkbox/index.d.ts +2 -1
  39. package/lib/checkbox/index.js +4 -4
  40. package/lib/date-picker/range/input-range.js +1 -1
  41. package/lib/date-picker/single/input-date.js +1 -1
  42. package/lib/modal/style/index.css +4 -0
  43. package/lib/modal/style/index.less +2 -0
  44. package/lib/select/select.js +4 -3
  45. package/lib/stepper/style/index.css +2 -0
  46. package/lib/stepper/style/index.less +3 -0
  47. package/lib/table/feature/useFooterDataSource.d.ts +3 -0
  48. package/lib/table/feature/useFooterDataSource.js +19 -0
  49. package/lib/table/interface.d.ts +1 -0
  50. package/lib/table/table.js +11 -9
  51. package/lib/tree/tree.js +16 -1
  52. package/lib/tree/treeHooks.d.ts +1 -1
  53. package/lib/tree/treeHooks.js +5 -5
  54. package/lib/tree/utils/treeUtils.d.ts +3 -2
  55. package/lib/tree/utils/treeUtils.js +54 -19
  56. package/package.json +1 -1
@@ -556,10 +556,12 @@ function usePopper(locatorElement, popperElement, props) {
556
556
  focus: 'mousedown',
557
557
  contextMenu: 'mousedown'
558
558
  };
559
+ popperNode === null || popperNode === void 0 ? void 0 : popperNode.addEventListener('mouseleave', debounceHidePopper);
559
560
  Array.isArray(trigger) ? trigger.forEach(function (action) {
560
561
  return document.addEventListener(mapEvent[action], debounceHidePopper);
561
562
  }) : document.addEventListener(mapEvent[trigger], debounceHidePopper);
562
563
  return function () {
564
+ popperNode === null || popperNode === void 0 ? void 0 : popperNode.removeEventListener('mouseleave', debounceHidePopper);
563
565
  Array.isArray(trigger) ? trigger.forEach(function (action) {
564
566
  return document.removeEventListener(mapEvent[action], debounceHidePopper);
565
567
  }) : document.removeEventListener(mapEvent[trigger], debounceHidePopper);
@@ -1,8 +1,5 @@
1
1
  import React from 'react';
2
- export declare const CheckboxTypes: ["default", "square"];
3
- export declare type CheckboxType = typeof CheckboxTypes[number];
4
- export declare const CheckboxSizes: ["large", "middle", "small"];
5
- export declare type CheckboxSize = typeof CheckboxSizes[number];
2
+ import type { CheckboxType, CheckboxSize } from './group';
6
3
  export interface CheckboxProps {
7
4
  checked?: boolean;
8
5
  defaultChecked?: boolean;
@@ -19,14 +19,12 @@ var __rest = this && this.__rest || function (s, e) {
19
19
 
20
20
  import React, { useCallback, useContext, useEffect, useState, useRef } from 'react';
21
21
  import classNames from 'classnames';
22
+ import { GroupContext, CheckboxTypes, CheckboxSizes } from './group';
22
23
  import ConfigContext from '../config-provider/ConfigContext';
23
24
  import { getCompProps } from '../_utils';
24
- import { tuple } from '../_utils/type';
25
25
  import isBoolean from 'lodash/isBoolean';
26
26
  import Icon from '../icon';
27
27
  import devWarning from '../_utils/devwarning';
28
- export var CheckboxTypes = tuple('default', 'square');
29
- export var CheckboxSizes = tuple('large', 'middle', 'small');
30
28
 
31
29
  var InternalCheckbox = function InternalCheckbox(props, ref) {
32
30
  var _context, _context2, _context3, _classNames, _context4, _context5, _context6, _classNames2, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _classNames4, _context15, _context16, _context17, _classNames5, _context18;
@@ -53,38 +51,47 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
53
51
  name = CheckboxProps.name,
54
52
  rest = __rest(CheckboxProps, ["checkboxType", "className", "prefixCls", "defaultChecked", "checked", "size", "onChange", "disabled", "children", "style", "value", "indeterminate", "name"]);
55
53
 
56
- var getChecked = function getChecked() {
57
- return isBoolean(checked) ? checked : defaultChecked;
58
- };
54
+ var checkboxGroup = React.useContext(GroupContext);
55
+ var mergedDisabled = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.disabled) || disabled;
56
+ var mergedCheckboxType = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.checkboxType) || checkboxType;
57
+ var mergedName = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.name) || name;
58
+ var initChecked = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.groupValue) ? (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.groupValue.indexOf(value)) > -1 : isBoolean(checked) ? checked : defaultChecked;
59
59
 
60
- var _useState = useState(getChecked()),
60
+ var _useState = useState(initChecked),
61
61
  _useState2 = _slicedToArray(_useState, 2),
62
62
  selected = _useState2[0],
63
63
  setSelected = _useState2[1];
64
64
 
65
65
  var labelRef = useRef(null);
66
- devWarning(CheckboxTypes.indexOf(checkboxType) === -1, 'checkbox', "cannot found checkbox type '".concat(checkboxType, "'"));
66
+ React.useEffect(function () {
67
+ setSelected((checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.groupValue) ? (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.groupValue.indexOf(value)) > -1 : isBoolean(checked) ? checked : defaultChecked);
68
+ }, [checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.groupValue, checked, defaultChecked]);
69
+ devWarning(CheckboxTypes.indexOf(mergedCheckboxType) === -1, 'checkbox', "cannot found checkbox type '".concat(mergedCheckboxType, "'"));
67
70
  devWarning(CheckboxSizes.indexOf(size) === -1, 'checkbox', "cannot found size type '".concat(size, "'"));
68
71
  var checkboxPrefixCls = getPrefixCls(prefixCls, 'checkbox', customPrefixcls);
69
72
 
70
73
  var isDefaultType = function isDefaultType() {
71
- return checkboxType === 'default';
74
+ return mergedCheckboxType === 'default';
72
75
  };
73
76
 
74
77
  var getIndeterminate = function getIndeterminate() {
75
78
  return selected ? false : indeterminate;
76
79
  };
77
80
 
78
- var getDefaultClassName = classNames(className, (_classNames = {}, _defineProperty(_classNames, "".concat(checkboxPrefixCls), true), _defineProperty(_classNames, "".concat(checkboxPrefixCls, "-no-child"), !children), _defineProperty(_classNames, _concatInstanceProperty(_context = "".concat(checkboxPrefixCls, "-")).call(_context, size), true && !!children), _defineProperty(_classNames, _concatInstanceProperty(_context2 = "".concat(checkboxPrefixCls, "-")).call(_context2, checkboxType), true), _defineProperty(_classNames, _concatInstanceProperty(_context3 = "".concat(checkboxPrefixCls, "-")).call(_context3, checkboxType, "-disabled"), disabled), _defineProperty(_classNames, "checked", selected), _classNames));
79
- var getSquareClassName = classNames(className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(checkboxPrefixCls), true), _defineProperty(_classNames2, _concatInstanceProperty(_context4 = "".concat(checkboxPrefixCls, "-")).call(_context4, checkboxType), true), _defineProperty(_classNames2, _concatInstanceProperty(_context5 = "".concat(checkboxPrefixCls, "-")).call(_context5, checkboxType, "-disabled"), disabled), _defineProperty(_classNames2, _concatInstanceProperty(_context6 = "".concat(checkboxPrefixCls, "-")).call(_context6, checkboxType, "-checked"), selected && !disabled), _defineProperty(_classNames2, "checked", selected), _classNames2));
81
+ var getDefaultClassName = classNames(className, (_classNames = {}, _defineProperty(_classNames, "".concat(checkboxPrefixCls), true), _defineProperty(_classNames, "".concat(checkboxPrefixCls, "-no-child"), !children), _defineProperty(_classNames, _concatInstanceProperty(_context = "".concat(checkboxPrefixCls, "-")).call(_context, size), true && !!children), _defineProperty(_classNames, _concatInstanceProperty(_context2 = "".concat(checkboxPrefixCls, "-")).call(_context2, mergedCheckboxType), true), _defineProperty(_classNames, _concatInstanceProperty(_context3 = "".concat(checkboxPrefixCls, "-")).call(_context3, mergedCheckboxType, "-disabled"), mergedDisabled), _defineProperty(_classNames, "checked", selected), _classNames));
82
+ var getSquareClassName = classNames(className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(checkboxPrefixCls), true), _defineProperty(_classNames2, _concatInstanceProperty(_context4 = "".concat(checkboxPrefixCls, "-")).call(_context4, mergedCheckboxType), true), _defineProperty(_classNames2, _concatInstanceProperty(_context5 = "".concat(checkboxPrefixCls, "-")).call(_context5, mergedCheckboxType, "-disabled"), mergedDisabled), _defineProperty(_classNames2, _concatInstanceProperty(_context6 = "".concat(checkboxPrefixCls, "-")).call(_context6, mergedCheckboxType, "-checked"), selected && !mergedDisabled), _defineProperty(_classNames2, "checked", selected), _classNames2));
80
83
  var getRootClassName = isDefaultType() ? getDefaultClassName : getSquareClassName;
81
84
  var inputClassName = classNames(_defineProperty({}, "".concat(checkboxPrefixCls, "-input"), true));
82
- var checkedWrapperClassName = classNames((_classNames4 = {}, _defineProperty(_classNames4, _concatInstanceProperty(_context7 = "".concat(checkboxPrefixCls, "-")).call(_context7, checkboxType, "-no-child"), !children), _defineProperty(_classNames4, _concatInstanceProperty(_context8 = "".concat(checkboxPrefixCls, "-")).call(_context8, checkboxType, "-wrapper"), true), _defineProperty(_classNames4, _concatInstanceProperty(_context9 = "".concat(checkboxPrefixCls, "-")).call(_context9, checkboxType, "-wrapper-size"), !!children), _defineProperty(_classNames4, _concatInstanceProperty(_context10 = "".concat(checkboxPrefixCls, "-")).call(_context10, checkboxType, "-margin"), !!children), _defineProperty(_classNames4, _concatInstanceProperty(_context11 = "".concat(checkboxPrefixCls, "-")).call(_context11, checkboxType, "-checked"), selected), _defineProperty(_classNames4, _concatInstanceProperty(_context12 = "".concat(checkboxPrefixCls, "-")).call(_context12, checkboxType, "-indeterminate"), getIndeterminate()), _defineProperty(_classNames4, _concatInstanceProperty(_context13 = "".concat(checkboxPrefixCls, "-")).call(_context13, checkboxType, "-disabled"), disabled && !selected), _defineProperty(_classNames4, _concatInstanceProperty(_context14 = "".concat(checkboxPrefixCls, "-")).call(_context14, checkboxType, "-checked-disabled"), disabled && selected), _classNames4));
83
- var triangleClassName = classNames((_classNames5 = {}, _defineProperty(_classNames5, _concatInstanceProperty(_context15 = "".concat(checkboxPrefixCls, "-")).call(_context15, checkboxType, "-triangle"), !selected), _defineProperty(_classNames5, _concatInstanceProperty(_context16 = "".concat(checkboxPrefixCls, "-")).call(_context16, checkboxType, "-triangle-checked"), selected), _defineProperty(_classNames5, _concatInstanceProperty(_context17 = "".concat(checkboxPrefixCls, "-")).call(_context17, checkboxType, "-triangle-disabled"), disabled), _classNames5));
84
- var innerIconClassName = classNames(_defineProperty({}, _concatInstanceProperty(_context18 = "".concat(checkboxPrefixCls, "-")).call(_context18, checkboxType, "-inner"), true));
85
+ var checkedWrapperClassName = classNames((_classNames4 = {}, _defineProperty(_classNames4, _concatInstanceProperty(_context7 = "".concat(checkboxPrefixCls, "-")).call(_context7, mergedCheckboxType, "-no-child"), !children), _defineProperty(_classNames4, _concatInstanceProperty(_context8 = "".concat(checkboxPrefixCls, "-")).call(_context8, mergedCheckboxType, "-wrapper"), true), _defineProperty(_classNames4, _concatInstanceProperty(_context9 = "".concat(checkboxPrefixCls, "-")).call(_context9, mergedCheckboxType, "-wrapper-size"), !!children), _defineProperty(_classNames4, _concatInstanceProperty(_context10 = "".concat(checkboxPrefixCls, "-")).call(_context10, mergedCheckboxType, "-margin"), !!children), _defineProperty(_classNames4, _concatInstanceProperty(_context11 = "".concat(checkboxPrefixCls, "-")).call(_context11, mergedCheckboxType, "-checked"), selected), _defineProperty(_classNames4, _concatInstanceProperty(_context12 = "".concat(checkboxPrefixCls, "-")).call(_context12, mergedCheckboxType, "-indeterminate"), getIndeterminate()), _defineProperty(_classNames4, _concatInstanceProperty(_context13 = "".concat(checkboxPrefixCls, "-")).call(_context13, mergedCheckboxType, "-disabled"), mergedDisabled && !selected), _defineProperty(_classNames4, _concatInstanceProperty(_context14 = "".concat(checkboxPrefixCls, "-")).call(_context14, mergedCheckboxType, "-checked-disabled"), mergedDisabled && selected), _classNames4));
86
+ var triangleClassName = classNames((_classNames5 = {}, _defineProperty(_classNames5, _concatInstanceProperty(_context15 = "".concat(checkboxPrefixCls, "-")).call(_context15, mergedCheckboxType, "-triangle"), !selected), _defineProperty(_classNames5, _concatInstanceProperty(_context16 = "".concat(checkboxPrefixCls, "-")).call(_context16, mergedCheckboxType, "-triangle-checked"), selected), _defineProperty(_classNames5, _concatInstanceProperty(_context17 = "".concat(checkboxPrefixCls, "-")).call(_context17, mergedCheckboxType, "-triangle-disabled"), mergedDisabled), _classNames5));
87
+ var innerIconClassName = classNames(_defineProperty({}, _concatInstanceProperty(_context18 = "".concat(checkboxPrefixCls, "-")).call(_context18, mergedCheckboxType, "-inner"), true));
85
88
  var handleChange = useCallback(function (e) {
86
89
  onChange && onChange(e);
87
- setSelected(e.target.checked);
90
+ (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.onCheckboxGroupChange) && (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.onCheckboxGroupChange(value, e.target.checked));
91
+
92
+ if (!(checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.isControlled)) {
93
+ setSelected(e.target.checked);
94
+ }
88
95
  }, [onChange]);
89
96
  useEffect(function () {
90
97
  isBoolean(checked) && checked !== selected && setSelected(checked);
@@ -125,7 +132,7 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
125
132
  className: innerIconClassName
126
133
  }, /*#__PURE__*/React.createElement(Icon, {
127
134
  type: "right-bold",
128
- className: _concatInstanceProperty(_context19 = "".concat(checkboxPrefixCls, "-")).call(_context19, checkboxType, "-inner-icon")
135
+ className: _concatInstanceProperty(_context19 = "".concat(checkboxPrefixCls, "-")).call(_context19, mergedCheckboxType, "-inner-icon")
129
136
  })), /*#__PURE__*/React.createElement("input", {
130
137
  type: "checkbox",
131
138
  className: inputClassName,
@@ -133,8 +140,8 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
133
140
  ref: ref,
134
141
  value: value,
135
142
  checked: selected,
136
- disabled: disabled,
137
- name: name
143
+ disabled: mergedDisabled,
144
+ name: mergedName
138
145
  })), children && /*#__PURE__*/React.createElement("span", {
139
146
  className: "".concat(checkboxPrefixCls, "-children")
140
147
  }, children), !isDefaultType() && /*#__PURE__*/React.createElement("span", {
@@ -143,7 +150,7 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
143
150
  className: innerIconClassName
144
151
  }, /*#__PURE__*/React.createElement(Icon, {
145
152
  type: "right-bold",
146
- className: _concatInstanceProperty(_context20 = "".concat(checkboxPrefixCls, "-")).call(_context20, checkboxType, "-inner-icon")
153
+ className: _concatInstanceProperty(_context20 = "".concat(checkboxPrefixCls, "-")).call(_context20, mergedCheckboxType, "-inner-icon")
147
154
  }))))
148
155
  );
149
156
  };
@@ -3,10 +3,20 @@ export declare const CheckboxTypes: ["default", "square"];
3
3
  export declare type CheckboxType = typeof CheckboxTypes[number];
4
4
  export declare const CheckboxSizes: ["large", "middle", "small"];
5
5
  export declare type CheckboxSize = typeof CheckboxSizes[number];
6
+ export declare type CheckboxValueType = string | number;
7
+ export interface CheckboxGroupContext {
8
+ name?: string;
9
+ isControlled?: boolean;
10
+ groupValue?: Array<CheckboxValueType>;
11
+ checkboxType?: CheckboxType;
12
+ disabled?: boolean;
13
+ onCheckboxGroupChange?: (checkedValue: CheckboxValueType, isChecked: boolean) => void;
14
+ }
15
+ export declare const GroupContext: React.Context<CheckboxGroupContext | null>;
6
16
  export interface CheckboxGroupProps {
7
17
  name?: string;
8
18
  size?: CheckboxSize;
9
- value?: string[];
19
+ value?: Array<CheckboxValueType>;
10
20
  checkboxType?: CheckboxType;
11
21
  disabled?: boolean;
12
22
  defaultValue?: string[] | string;
@@ -1,7 +1,5 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/extends";
2
1
  import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
3
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
4
- import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
2
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
5
3
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
6
4
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
7
5
  import React, { useContext } from 'react'; // import { Icon } from '../index'
@@ -11,12 +9,11 @@ import ConfigContext from '../config-provider/ConfigContext';
11
9
  import { getCompProps } from '../_utils';
12
10
  import { tuple } from '../_utils/type';
13
11
  import { isArrayValueRepeat } from '../_utils/arrayUtil';
14
- import isArray from 'lodash/isArray';
15
12
  import Checkbox from './checkbox';
16
- import isBoolean from 'lodash/isBoolean';
17
13
  import devWarning from '../_utils/devwarning';
18
14
  export var CheckboxTypes = tuple('default', 'square');
19
15
  export var CheckboxSizes = tuple('large', 'middle', 'small');
16
+ export var GroupContext = /*#__PURE__*/React.createContext(null);
20
17
  var CheckboxGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
18
  // const CheckboxGroup = (props: CheckboxGroupProps): FunctionComponentElement<CheckboxGroupProps> => {
22
19
  var _useContext = useContext(ConfigContext),
@@ -38,111 +35,86 @@ var CheckboxGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
38
35
  defaultValue = CheckboxProps.defaultValue,
39
36
  value = CheckboxProps.value,
40
37
  name = CheckboxProps.name;
38
+ var initData = value || (Array.isArray(defaultValue) ? defaultValue : typeof defaultValue !== 'undefined' ? [defaultValue] : []);
41
39
 
42
- var _React$useState = React.useState(defaultValue),
40
+ var _React$useState = React.useState([]),
43
41
  _React$useState2 = _slicedToArray(_React$useState, 2),
44
42
  groupValue = _React$useState2[0],
45
43
  setGroupValue = _React$useState2[1];
46
44
 
45
+ var innerValue = React.useRef(initData);
47
46
  React.useEffect(function () {
48
- if (value) {
49
- setGroupValue(value);
50
- }
51
- }, [value]);
47
+ innerValue.current = value || (Array.isArray(defaultValue) ? defaultValue : typeof defaultValue !== 'undefined' ? [defaultValue] : []);
48
+ setGroupValue(innerValue.current);
49
+ }, [value, defaultValue]);
50
+ var isControlled = typeof value !== 'undefined';
52
51
  var checkboxGroupPrefixCls = getPrefixCls(prefixCls, 'checkbox-group', customPrefixcls); // 按钮样式前缀
53
52
 
54
- devWarning(isArrayValueRepeat(value), 'checkboxGroup', "variable value's value should be unique ");
55
-
56
- var getDisabled = function getDisabled(optionDisabled) {
57
- return isBoolean(optionDisabled) ? optionDisabled : disabled;
58
- };
59
-
60
- var getChecked = function getChecked(props, value) {
61
- return isArray(value) ? _includesInstanceProperty(value).call(value, (props === null || props === void 0 ? void 0 : props.value) || props) || _includesInstanceProperty(value).call(value, String((props === null || props === void 0 ? void 0 : props.value) || props)) : String(value) === String((props === null || props === void 0 ? void 0 : props.value) || props);
62
- };
53
+ devWarning(isArrayValueRepeat(groupValue), 'checkboxGroup', "variable value's value should be unique ");
63
54
 
64
55
  var getReduceItem = function getReduceItem(targetValue) {
65
- var index = value.indexOf(targetValue);
66
-
67
- _spliceInstanceProperty(value).call(value, index, 1);
56
+ var _context;
68
57
 
69
- return value;
58
+ return _filterInstanceProperty(_context = innerValue.current).call(_context, function (d) {
59
+ return d !== targetValue;
60
+ });
70
61
  };
71
62
 
72
63
  var getAddItem = function getAddItem(targetValue) {
73
- return _concatInstanceProperty(value).call(value, targetValue);
74
- };
64
+ var _context2;
75
65
 
76
- var onCheckboxChange = function onCheckboxChange(ev, item) {
77
- var _a;
66
+ return innerValue.current.indexOf(targetValue) > -1 ? innerValue.current : _concatInstanceProperty(_context2 = innerValue.current).call(_context2, targetValue);
67
+ };
78
68
 
79
- var val = ev.target.value;
80
- var checked = ev.target.checked;
69
+ var onCheckboxChange = function onCheckboxChange(checkedValue, isChecked) {
81
70
  var newVal = [];
82
71
 
83
- if (checked) {
84
- newVal = getAddItem(val);
72
+ if (isChecked) {
73
+ newVal = getAddItem(checkedValue);
85
74
  } else {
86
- newVal = getReduceItem(val);
75
+ newVal = getReduceItem(checkedValue);
76
+ }
77
+
78
+ if (!isControlled) {
79
+ innerValue.current = newVal;
87
80
  }
88
81
 
89
- setGroupValue(newVal);
90
82
  onChange && onChange(newVal);
91
- ((_a = item.props) === null || _a === void 0 ? void 0 : _a.onChange) && item.props.onChange(ev);
83
+ };
84
+
85
+ var context = {
86
+ groupValue: groupValue,
87
+ disabled: disabled,
88
+ name: name,
89
+ isControlled: isControlled,
90
+ checkboxType: checkboxType,
91
+ onCheckboxGroupChange: function onCheckboxGroupChange(checkedValue, isChecked) {
92
+ onCheckboxChange(checkedValue, isChecked);
93
+ }
92
94
  };
93
95
 
94
96
  var renderByOptions = function renderByOptions() {
95
97
  return _mapInstanceProperty(options).call(options, function (option, index) {
96
98
  return /*#__PURE__*/React.createElement(Checkbox, {
97
99
  size: size,
98
- disabled: getDisabled(option.disabled),
100
+ disabled: option.disabled,
99
101
  key: index,
100
102
  name: name,
101
- defaultChecked: getChecked(option, defaultValue),
102
- checked: getChecked(option, groupValue),
103
+ defaultChecked: option.defaultValue,
104
+ checked: option.checked,
103
105
  checkboxType: checkboxType,
104
106
  value: (option === null || option === void 0 ? void 0 : option.value) || option,
105
- onChange: function onChange(e) {
106
- return onCheckboxChange(e, option);
107
- }
107
+ onChange: option.onChange
108
108
  }, option.label || option);
109
109
  });
110
110
  };
111
111
 
112
- var renderChildren = function renderChildren() {
113
- var _context;
114
-
115
- return _mapInstanceProperty(_context = React.Children).call(_context, children, function (item) {
116
- var _a, _b;
117
-
118
- var groupProps = {};
119
- groupProps = {
120
- name: name,
121
- size: size,
122
- onChange: function onChange(e) {
123
- return onCheckboxChange(e, item);
124
- },
125
- checkboxType: checkboxType || ((_a = item.props) === null || _a === void 0 ? void 0 : _a.checkboxType),
126
- disabled: isBoolean(disabled) ? disabled : (_b = item.props) === null || _b === void 0 ? void 0 : _b.disabled,
127
- checked: getChecked(item.props, groupValue),
128
- defaultChecked: getChecked(item.props, defaultValue)
129
- };
130
- return /*#__PURE__*/React.cloneElement(item, _extends(_extends({}, item.props), groupProps));
131
- });
132
- };
133
-
134
- var renderCheckbox = function renderCheckbox() {
135
- if (isArray(options)) {
136
- return renderByOptions();
137
- } else if (children) {
138
- return renderChildren();
139
- }
140
- };
141
-
142
112
  return /*#__PURE__*/React.createElement("ul", {
143
113
  className: classnames(checkboxGroupPrefixCls, className),
144
114
  style: style,
145
115
  ref: ref
146
- }, renderCheckbox());
116
+ }, /*#__PURE__*/React.createElement(GroupContext.Provider, {
117
+ value: context
118
+ }, options && options.length > 0 ? renderByOptions() : children));
147
119
  });
148
120
  export default /*#__PURE__*/React.memo(CheckboxGroup);
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckboxProps } from './checkbox';
3
3
  import Group from './group';
4
- export { CheckboxProps, CheckboxSizes, CheckboxTypes } from './checkbox';
4
+ export { CheckboxSizes, CheckboxTypes, CheckboxSize, CheckboxType, CheckboxValueType } from './group';
5
5
  export { CheckboxGroupProps } from './group';
6
+ export { CheckboxProps } from './checkbox';
6
7
  interface CompoundedComponent extends React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLElement>> {
7
8
  Group: typeof Group;
8
9
  }
@@ -1,6 +1,6 @@
1
1
  import InternalCheckbox from './checkbox';
2
2
  import Group from './group';
3
- export { CheckboxSizes, CheckboxTypes } from './checkbox';
3
+ export { CheckboxSizes, CheckboxTypes } from './group';
4
4
  var Checkbox = InternalCheckbox;
5
5
  Checkbox.Group = Group;
6
6
  export { Group };
@@ -140,7 +140,7 @@ function InputDate(props, ref) {
140
140
  }
141
141
 
142
142
  var getSuffixNode = function getSuffixNode() {
143
- if (isMouseEnter && (startHoverValue || endHoverValue || startText || endText)) {
143
+ if (isMouseEnter && (startHoverValue || endHoverValue || startText || endText) && allowClear) {
144
144
  return clearNode;
145
145
  }
146
146
 
@@ -60,7 +60,7 @@ function InputDate(props, ref) {
60
60
  var placeholder = getPlaceholder(picker, locale, propsPlaceholder);
61
61
 
62
62
  var getSuffixNode = function getSuffixNode() {
63
- if (isMouseEnter && (hoverValue || text)) {
63
+ if (isMouseEnter && (hoverValue || text) && allowClear) {
64
64
  return null;
65
65
  }
66
66
 
@@ -160,6 +160,8 @@
160
160
  -ms-flex-align: center;
161
161
  align-items: center;
162
162
  height: var(--kd-c-modal-header-sizing-height, 50px);
163
+ -ms-flex-negative: 0;
164
+ flex-shrink: 0;
163
165
  }
164
166
  .kd-modal-container-box .kd-modal-header .kd-modal-title-container {
165
167
  display: -webkit-box;
@@ -242,6 +244,8 @@
242
244
  align-items: center;
243
245
  font-size: var(--kd-c-modal-footer-font-size, 14px);
244
246
  color: var(--kd-c-modal-footer-text-color, var(--kd-g-color-text-secondary, #666));
247
+ -ms-flex-negative: 0;
248
+ flex-shrink: 0;
245
249
  }
246
250
  .kd-modal-margin-btn {
247
251
  margin-right: var(--kd-c-modal-footer-button-spacing, 12px);
@@ -58,6 +58,7 @@
58
58
  padding: @modal-header-sizing-padding-vertical @modal-header-sizing-padding-horizontal;
59
59
  align-items: center;
60
60
  height: @modal-header-sizing-height;
61
+ flex-shrink: 0;
61
62
  .@{modal-prefix-cls}-title-container {
62
63
  display: flex;
63
64
  justify-content: center;
@@ -113,6 +114,7 @@
113
114
  align-items: center;
114
115
  font-size: @modal-footer-font-size;
115
116
  color: @modal-footer-font-color;
117
+ flex-shrink: 0;
116
118
  }
117
119
  // each(@modal-footer-type-set, {
118
120
  // .@{modal-prefix-cls}-@{key}-footer {
@@ -464,9 +464,8 @@ var InternalSelect = function InternalSelect(props, ref) {
464
464
  }; // 多选模式下清除某一项
465
465
 
466
466
 
467
- var handleRemove = function handleRemove(e) {
467
+ var handleRemove = function handleRemove(e, tag) {
468
468
  if (disabled) return;
469
- var tag = e.currentTarget.parentNode.getAttribute('data-tag');
470
469
  var _multipleRef$current4 = multipleRef.current,
471
470
  selectedVal = _multipleRef$current4.selectedVal,
472
471
  selectMulOpts = _multipleRef$current4.selectMulOpts;
@@ -670,7 +669,9 @@ var InternalSelect = function InternalSelect(props, ref) {
670
669
  size: size,
671
670
  closable: true,
672
671
  disabled: disabled,
673
- onClose: handleRemove,
672
+ onClose: function onClose(e) {
673
+ return handleRemove(e, value);
674
+ },
674
675
  "data-tag": value
675
676
  }, label));
676
677
  }), maxTagCount && mulOptions.length > maxTagCount ? maxTagPlaceholder ? handleMaxTagHolder() : /*#__PURE__*/React.createElement("span", {
@@ -104,6 +104,8 @@
104
104
  .kd-inputNumber {
105
105
  width: 100px;
106
106
  height: var(--kd-c-stepper-input-middle-sizing-height, 28px);
107
+ --kd-c-input-wrapper-padding-left: 9px;
108
+ --kd-c-input-padding-left: 0;
107
109
  }
108
110
  .kd-inputNumber input {
109
111
  text-align: center;
@@ -2,10 +2,13 @@
2
2
  @import './mixin.less';
3
3
 
4
4
  @inputNumber-prefix-cls: ~'@{kd-prefix}-inputNumber';
5
+ @inputWrapper-prefix-cls: ~'@{kd-prefix}-wrapper';
5
6
  .@{inputNumber-prefix-cls} {
6
7
  width: 100px;
7
8
  height: @stepper-input-middle-sizing-height;
8
9
 
10
+ --kd-c-input-wrapper-padding-left: 9px;
11
+ --kd-c-input-padding-left: 0;
9
12
  input {
10
13
  text-align: center;
11
14
  color: @stepper-input-color;
@@ -0,0 +1,3 @@
1
+ import { TablePipeline } from '../interface';
2
+ declare function useFooterDataSource(pipeline: TablePipeline, footerDataSource: any[] | undefined): void;
3
+ export default useFooterDataSource;
@@ -0,0 +1,11 @@
1
+ import { features } from '@kdcloudjs/table';
2
+
3
+ function useFooterDataSource(pipeline, footerDataSource) {
4
+ if (footerDataSource) {
5
+ pipeline.use(features.footerDataSource({
6
+ dataSource: footerDataSource
7
+ }));
8
+ }
9
+ }
10
+
11
+ export default useFooterDataSource;
@@ -14,6 +14,7 @@ export declare type TableApi = {
14
14
  getColumns: () => any[];
15
15
  getDataSource: () => any[];
16
16
  getFooterDataSource: () => any[];
17
+ clearRangeSelection: () => void;
17
18
  };
18
19
  export declare type TableInstance = {
19
20
  api: TableApi;
package/es/table/table.js CHANGED
@@ -20,6 +20,7 @@ import useContextMenu from './feature/contextMenu';
20
20
  import useRangeSelection from './feature/useRangeSelection';
21
21
  import useMergeCellHover from './feature/mergeCellHover';
22
22
  import devWarning from '../_utils/devwarning';
23
+ import useFooterDataSource from './feature/useFooterDataSource';
23
24
  var Table = /*#__PURE__*/forwardRef(function (props, ref) {
24
25
  var columns = props.columns,
25
26
  dataSource = props.dataSource,
@@ -69,22 +70,21 @@ var Table = /*#__PURE__*/forwardRef(function (props, ref) {
69
70
  dataSource: dataSource
70
71
  });
71
72
  var pipelineRef = useRef(pipeline);
72
- pipelineRef.current = pipeline;
73
-
74
- if (footerDataSource) {
75
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
76
- // @ts-ignore
77
- pipeline.footerDataSource(footerDataSource);
78
- }
73
+ pipelineRef.current = pipeline; // if (footerDataSource) {
74
+ // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
75
+ // // @ts-ignore
76
+ // pipeline.footerDataSource(footerDataSource)
77
+ // }
79
78
 
80
79
  useImperativeHandle(ref, function () {
81
- var _a, _b, _c;
80
+ var _a, _b, _c, _d;
82
81
 
83
82
  return {
84
83
  api: {
85
84
  getColumns: (_a = pipelineRef.current.getColumns) === null || _a === void 0 ? void 0 : _a.bind(pipelineRef.current),
86
85
  getDataSource: (_b = pipelineRef.current.getDataSource) === null || _b === void 0 ? void 0 : _b.bind(pipelineRef.current),
87
- getFooterDataSource: (_c = pipelineRef.current.getFooterDataSource) === null || _c === void 0 ? void 0 : _c.bind(pipelineRef.current)
86
+ getFooterDataSource: (_c = pipelineRef.current.getFooterDataSource) === null || _c === void 0 ? void 0 : _c.bind(pipelineRef.current),
87
+ clearRangeSelection: (_d = pipelineRef.current.clearRangeSelection) === null || _d === void 0 ? void 0 : _d.bind(pipelineRef.current)
88
88
  }
89
89
  };
90
90
  });
@@ -105,6 +105,7 @@ var Table = /*#__PURE__*/forwardRef(function (props, ref) {
105
105
  useContextMenu(pipeline, contextMenu);
106
106
  useRangeSelection(pipeline, rangeSelection);
107
107
  useMergeCellHover(pipeline);
108
+ useFooterDataSource(pipeline, footerDataSource);
108
109
  /* -------------------------------------------------------------------------- */
109
110
 
110
111
  /* after useTablePipeline, merge pipeline.getProps result */
package/es/tree/tree.js CHANGED
@@ -130,11 +130,19 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
130
130
  loadingKeys = _React$useState14[0],
131
131
  setLoadingKeys = _React$useState14[1];
132
132
 
133
+ var _React$useState15 = React.useState([]),
134
+ _React$useState16 = _slicedToArray(_React$useState15, 2),
135
+ searchExpandedKeys = _React$useState16[0],
136
+ setSearchExpandedKeys = _React$useState16[1];
137
+
133
138
  var isSearching = React.useMemo(function () {
134
139
  return typeof filterTreeNode === 'function' && filterValue;
135
140
  }, [filterValue]);
141
+ useEffect(function () {
142
+ setSearchExpandedKeys([]);
143
+ }, [filterValue]);
136
144
 
137
- var _useExpand = useExpand(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, isInit, filterTreeNode, isSearching, keysData),
145
+ var _useExpand = useExpand(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, isInit, filterTreeNode, isSearching, keysData, searchExpandedKeys),
138
146
  _useExpand2 = _slicedToArray(_useExpand, 2),
139
147
  expandedKeys = _useExpand2[0],
140
148
  setExpandedKeys = _useExpand2[1];
@@ -229,6 +237,12 @@ var InternalTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
229
237
  node: node,
230
238
  expanded: expanded
231
239
  });
240
+
241
+ if (isSearching) {
242
+ var newSearchExpandedKeys = expanded ? addKeys(searchExpandedKeys, [key]) : delKey(searchExpandedKeys, [key]);
243
+ setSearchExpandedKeys(newSearchExpandedKeys);
244
+ }
245
+
232
246
  setScrollKey('');
233
247
  setIsInit(false);
234
248
 
@@ -4,6 +4,6 @@ export declare const useViewportHeight: (height: number, listRef: React.RefObjec
4
4
  export declare const useVisibleDataMemo: (virtual: boolean, filterData: TreeNodeData[], viewportHeight: number, estimatedItemSize: number, start: number) => TreeNodeData[][];
5
5
  export declare const usePlantomHeightEffect: (plantomRef: React.RefObject<HTMLElement>, filterData: TreeNodeData[], estimatedItemSize: number) => void;
6
6
  export declare const useChecked: (checkStrictly: boolean, checkedKeysProps: string[], defaultCheckedKeys: string[], _flattenAllData: any[], _maxLevel: number, checkable: boolean, keysData: KeysDataType) => readonly [string[], string[], React.Dispatch<React.SetStateAction<string[]>>, React.Dispatch<React.SetStateAction<string[]>>];
7
- export declare const useExpand: (flattenAllData: any[], expandedKeysProps: string[], defaultExpandedKeys: string[], defaultExpandAll: boolean, defaultExpandRoot: boolean, defaultExpandParent: boolean, scrollKey: string, isInit: boolean, filterTreeNode: FunctionConstructor, isSearching: boolean, keysData: KeysDataType) => readonly [string[], React.Dispatch<React.SetStateAction<string[]>>];
7
+ export declare const useExpand: (flattenAllData: any[], expandedKeysProps: string[], defaultExpandedKeys: string[], defaultExpandAll: boolean, defaultExpandRoot: boolean, defaultExpandParent: boolean, scrollKey: string, isInit: boolean, filterTreeNode: FunctionConstructor, isSearching: boolean, keysData: KeysDataType, searchExpandedKeys: string[]) => readonly [string[], React.Dispatch<React.SetStateAction<string[]>>];
8
8
  export declare const useScrollToKey: (scrollKey: string, index: number, estimatedItemSize: number, scrollRef: any, viewportHeight: number, treeNodePrefixCls: string) => void;
9
9
  export declare const useSelect: (selectedKeysProps: string[], defaultSelectedKeys: string[]) => readonly [string[], React.Dispatch<React.SetStateAction<string[]>>];
@@ -64,7 +64,7 @@ export var useChecked = function useChecked(checkStrictly, checkedKeysProps, def
64
64
  }, [nextHalfCheckedKeys]);
65
65
  return [checkedKeys, halfCheckedKeys, setCheckedKeys, setHalfCheckedKeys];
66
66
  };
67
- export var useExpand = function useExpand(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, isInit, filterTreeNode, isSearching, keysData) {
67
+ export var useExpand = function useExpand(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, isInit, filterTreeNode, isSearching, keysData, searchExpandedKeys) {
68
68
  var expandScrollkeys = [];
69
69
 
70
70
  if (scrollKey) {
@@ -73,8 +73,8 @@ export var useExpand = function useExpand(flattenAllData, expandedKeysProps, def
73
73
  }
74
74
 
75
75
  var initialExpandedKeys = React.useMemo(function () {
76
- return getInitExpandedKeys(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, expandScrollkeys, filterTreeNode, isSearching, keysData);
77
- }, [flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, filterTreeNode, isSearching, keysData]);
76
+ return getInitExpandedKeys(flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, expandScrollkeys, filterTreeNode, isSearching, keysData, searchExpandedKeys);
77
+ }, [flattenAllData, expandedKeysProps, defaultExpandedKeys, defaultExpandAll, defaultExpandRoot, defaultExpandParent, scrollKey, filterTreeNode, isSearching, keysData, searchExpandedKeys]);
78
78
  var newExpandedKeys = React.useMemo(function () {
79
79
  return getExpandedKeys(expandedKeysProps, expandScrollkeys);
80
80
  }, [expandedKeysProps]);
@@ -85,9 +85,9 @@ export var useExpand = function useExpand(flattenAllData, expandedKeysProps, def
85
85
  setExpandedKeys = _React$useState8[1];
86
86
 
87
87
  React.useEffect(function () {
88
- var keys = isInit ? initialExpandedKeys : newExpandedKeys;
88
+ var keys = isInit || isSearching ? initialExpandedKeys : newExpandedKeys;
89
89
  setExpandedKeys(keys);
90
- }, [newExpandedKeys, initialExpandedKeys]);
90
+ }, [newExpandedKeys, initialExpandedKeys, isSearching, isInit]);
91
91
  return [expandedKeys, setExpandedKeys];
92
92
  };
93
93
  export var useScrollToKey = function useScrollToKey(scrollKey, index, estimatedItemSize, scrollRef, viewportHeight, treeNodePrefixCls) {
@@ -16,7 +16,8 @@ export declare const getExpand: (expandedKeys: string[], key: string) => boolean
16
16
  export declare const getChecked: (checkedKeys: string[], key: string) => boolean;
17
17
  export declare const getSelected: (selectedKeys: string[], key: string) => boolean;
18
18
  export declare const getHalfChecked: (halfCheckedKeys: string[], key: string) => boolean;
19
- export declare const getAllFilterKeys: (data: any[], filterTreeNode: FunctionConstructor, keysData: KeysDataType) => any[];
19
+ export declare function findfilterChildrenKeys(node: any, allFilterKeys: Set<any>): Set<string>;
20
+ export declare const getAllFilterKeys: (data: any[], filterTreeNode: FunctionConstructor, keysData: KeysDataType) => any;
20
21
  export declare const getFilterData: (data: any[], filterTreeNode: FunctionConstructor, isSearching: boolean, posData?: {}, keysData?: {}) => any[];
21
22
  export declare const getMaxLevel: (data: any[]) => number;
22
23
  /**
@@ -59,6 +60,6 @@ export declare const getDataCheckededStateStrictly: (checkedKeys: string[]) => {
59
60
  };
60
61
  export declare const delKey: (prevKeys: string[], delKeys: string[]) => never[] & string[];
61
62
  export declare const getAllNodeKeys: (data: any[]) => string[];
62
- export declare const getInitExpandedKeys: (data: any[], expandedKeys: string[], defaultExpandedKeys: string[], defaultExpandAll: boolean, defaultExpandRoot: boolean, defaultExpandParent: boolean, expandScrollkeys: string[] | undefined, filterTreeNode: FunctionConstructor, isSearching: boolean, keysData: KeysDataType) => string[];
63
+ export declare const getInitExpandedKeys: (data: any[], expandedKeys: string[], defaultExpandedKeys: string[], defaultExpandAll: boolean, defaultExpandRoot: boolean, defaultExpandParent: boolean, expandScrollkeys: string[] | undefined, filterTreeNode: FunctionConstructor, isSearching: boolean, keysData: KeysDataType, searchExpandedKeys: string[]) => string[];
63
64
  export declare const getExpandedKeys: (expandedKeys: string[], expandScrollkeys?: string[]) => string[];
64
65
  export declare const calcDropPosition: (event: React.MouseEvent, dropNode: HTMLElement) => 0 | 1 | -1;