@qsxy/element-plus-react 1.0.2 → 1.0.3

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 (216) hide show
  1. package/dist/Alert/Alert.d.ts +7 -0
  2. package/dist/Alert/Alert.js +98 -0
  3. package/dist/Alert/index.d.ts +2 -0
  4. package/dist/Alert/index.js +1 -0
  5. package/dist/Alert/typings.d.ts +45 -0
  6. package/dist/Alert/typings.js +1 -0
  7. package/dist/Card/Card.js +5 -3
  8. package/dist/Cascader/useCascader.d.ts +0 -14
  9. package/dist/Cascader/useCascader.js +33 -32
  10. package/dist/Checkbox/Checkbox.js +3 -2
  11. package/dist/ConfigProvider/ConfigProvider.js +2 -24
  12. package/dist/ConfigProvider/ConfigProviderContext.js +1 -1
  13. package/dist/ConfigProvider/typings.d.ts +1 -1
  14. package/dist/Container/Main.d.ts +1 -1
  15. package/dist/Container/typings.d.ts +1 -1
  16. package/dist/Dialog/Dialog.js +5 -12
  17. package/dist/Input/Input.js +68 -43
  18. package/dist/Input/TextArea.js +1 -1
  19. package/dist/Input/typings.d.ts +42 -1
  20. package/dist/Input/utils.d.ts +1 -0
  21. package/dist/Input/utils.js +5 -1
  22. package/dist/InputNumber/InputNumber.js +351 -141
  23. package/dist/InputNumber/typings.d.ts +15 -1
  24. package/dist/Loading/Loading.js +5 -2
  25. package/dist/Menu/Menu.js +25 -1
  26. package/dist/Menu/MenuItem.js +4 -2
  27. package/dist/Menu/SubMenu.js +2 -2
  28. package/dist/Menu/SubMenuCollapseTransition.js +14 -9
  29. package/dist/Menu/typings.d.ts +2 -1
  30. package/dist/Message/Message.js +51 -23
  31. package/dist/Message/index.js +8 -10
  32. package/dist/Message/typings.d.ts +8 -5
  33. package/dist/MessageBox/MessageBox.js +52 -30
  34. package/dist/MessageBox/index.d.ts +2 -1
  35. package/dist/MessageBox/index.js +4 -2
  36. package/dist/MessageBox/typings.d.ts +3 -0
  37. package/dist/Notification/Notification.js +26 -19
  38. package/dist/Select/SelectContext.d.ts +2 -1
  39. package/dist/Select/SelectContext.js +2 -1
  40. package/dist/Select/SelectCore.js +13 -7
  41. package/dist/Select/SelectDropdown.js +23 -15
  42. package/dist/Select/index.d.ts +1 -1
  43. package/dist/Select/typings.d.ts +13 -9
  44. package/dist/Select/useSelect.d.ts +13 -10
  45. package/dist/Select/useSelect.js +34 -26
  46. package/dist/Space/Space.d.ts +4 -0
  47. package/dist/Space/Space.js +128 -0
  48. package/dist/Space/SpaceItem.d.ts +7 -0
  49. package/dist/Space/SpaceItem.js +14 -0
  50. package/dist/Space/index.d.ts +3 -0
  51. package/dist/Space/index.js +2 -0
  52. package/dist/Space/typings.d.ts +26 -0
  53. package/dist/Space/typings.js +1 -0
  54. package/dist/Space/useSpace.d.ts +7 -0
  55. package/dist/Space/useSpace.js +104 -0
  56. package/dist/Statistic/Statistic.d.ts +4 -0
  57. package/dist/Statistic/Statistic.js +92 -0
  58. package/dist/Statistic/index.d.ts +2 -0
  59. package/dist/Statistic/index.js +1 -0
  60. package/dist/Statistic/typings.d.ts +28 -0
  61. package/dist/Statistic/typings.js +1 -0
  62. package/dist/Switch/Switch.js +2 -2
  63. package/dist/Table/Table.js +3 -0
  64. package/dist/Table/typings.d.ts +2 -0
  65. package/dist/Tag/typings.d.ts +1 -1
  66. package/dist/Text/Text.d.ts +4 -0
  67. package/dist/Text/Text.js +84 -0
  68. package/dist/Text/index.d.ts +2 -0
  69. package/dist/Text/index.js +1 -0
  70. package/dist/Text/typings.d.ts +15 -0
  71. package/dist/Text/typings.js +1 -0
  72. package/dist/Tree/CollapseTransition.d.ts +7 -0
  73. package/dist/Tree/CollapseTransition.js +60 -0
  74. package/dist/Tree/Tree.d.ts +3 -140
  75. package/dist/Tree/Tree.js +350 -77
  76. package/dist/Tree/TreeContext.d.ts +9 -0
  77. package/dist/Tree/TreeContext.js +14 -0
  78. package/dist/Tree/TreeNode.d.ts +5 -3
  79. package/dist/Tree/TreeNode.js +321 -331
  80. package/dist/Tree/TreeNodeContent.d.ts +9 -0
  81. package/dist/Tree/TreeNodeContent.js +22 -0
  82. package/dist/Tree/index.d.ts +3 -8
  83. package/dist/Tree/index.js +1 -4
  84. package/dist/Tree/model/node.d.ts +62 -0
  85. package/dist/Tree/model/node.js +601 -0
  86. package/dist/Tree/model/tree-store.d.ts +52 -0
  87. package/dist/Tree/model/tree-store.js +510 -0
  88. package/dist/Tree/model/useDragNode.d.ts +30 -0
  89. package/dist/Tree/model/useDragNode.js +293 -0
  90. package/dist/Tree/model/useKeydown.d.ts +0 -0
  91. package/dist/Tree/model/useKeydown.js +104 -0
  92. package/dist/Tree/model/useNodeExpandEventBroadcast.d.ts +15 -0
  93. package/dist/Tree/model/useNodeExpandEventBroadcast.js +54 -0
  94. package/dist/Tree/model/util.d.ts +7 -0
  95. package/dist/Tree/model/util.js +24 -0
  96. package/dist/Tree/typings.d.ts +225 -114
  97. package/dist/TreeSelect/TreeSelect.d.ts +2 -10
  98. package/dist/TreeSelect/TreeSelect.js +90 -566
  99. package/dist/TreeSelect/TreeSelectOption.d.ts +6 -0
  100. package/dist/TreeSelect/TreeSelectOption.js +62 -0
  101. package/dist/TreeSelect/cacheOptions.d.ts +9 -0
  102. package/dist/TreeSelect/cacheOptions.js +22 -0
  103. package/dist/TreeSelect/index.d.ts +0 -1
  104. package/dist/TreeSelect/typings.d.ts +11 -63
  105. package/dist/TreeSelect/useSelect.d.ts +125 -0
  106. package/dist/TreeSelect/useSelect.js +104 -0
  107. package/dist/TreeSelect/useTree.d.ts +130 -0
  108. package/dist/TreeSelect/useTree.js +285 -0
  109. package/dist/TreeSelect/utils.d.ts +10 -0
  110. package/dist/TreeSelect/utils.js +38 -0
  111. package/dist/Upload/UploadContent.js +2 -0
  112. package/dist/Upload/ajax.js +3 -0
  113. package/dist/Upload/typings.d.ts +4 -0
  114. package/dist/Util/aria.js +12 -12
  115. package/dist/Util/base.d.ts +5 -0
  116. package/dist/Util/base.js +140 -1
  117. package/dist/config/Constants.d.ts +3 -0
  118. package/dist/config/Constants.js +8 -0
  119. package/dist/hooks/index.d.ts +1 -0
  120. package/dist/hooks/index.js +1 -0
  121. package/dist/hooks/popperPropsUtils.js +1 -1
  122. package/dist/hooks/treePropsUtils.d.ts +3 -3
  123. package/dist/hooks/treePropsUtils.js +2 -2
  124. package/dist/hooks/useConfigProvider.d.ts +27 -0
  125. package/dist/hooks/useConfigProvider.js +78 -0
  126. package/dist/hooks/useResizeObserver.js +6 -6
  127. package/dist/index.css +1 -1
  128. package/dist/index.d.ts +18 -11
  129. package/dist/index.js +11 -5
  130. package/package.json +1 -1
  131. package/theme-chalk/alert.scss +115 -0
  132. package/theme-chalk/aside.scss +8 -8
  133. package/theme-chalk/button-group.scss +80 -80
  134. package/theme-chalk/button.scss +304 -304
  135. package/theme-chalk/calendar/date-table.scss +164 -164
  136. package/theme-chalk/checkbox.scss +34 -0
  137. package/theme-chalk/color/index.scss +20 -20
  138. package/theme-chalk/common/transition.scss +142 -142
  139. package/theme-chalk/container.scss +14 -14
  140. package/theme-chalk/dark/css-vars.scss +39 -39
  141. package/theme-chalk/dark/var.scss +225 -225
  142. package/theme-chalk/date-picker.scss +12 -12
  143. package/theme-chalk/drawer.scss +1 -0
  144. package/theme-chalk/footer.scss +12 -12
  145. package/theme-chalk/header.scss +12 -12
  146. package/theme-chalk/index.scss +4 -0
  147. package/theme-chalk/input/input-range.scss +2 -1
  148. package/theme-chalk/input/input.scss +439 -424
  149. package/theme-chalk/input-number.bak +172 -0
  150. package/theme-chalk/input-number.scss +192 -172
  151. package/theme-chalk/link.scss +87 -87
  152. package/theme-chalk/main.scss +14 -14
  153. package/theme-chalk/menu.scss +353 -353
  154. package/theme-chalk/message.scss +104 -178
  155. package/theme-chalk/mixins/_button.scss +224 -224
  156. package/theme-chalk/mixins/_col.scss +33 -33
  157. package/theme-chalk/mixins/_var.scss +67 -67
  158. package/theme-chalk/mixins/config.scss +5 -5
  159. package/theme-chalk/mixins/function.scss +99 -99
  160. package/theme-chalk/mixins/mixins.scss +240 -240
  161. package/theme-chalk/mixins/utils.scss +39 -39
  162. package/theme-chalk/notification.bak +156 -0
  163. package/theme-chalk/notification.scss +109 -156
  164. package/theme-chalk/popper.scss +104 -104
  165. package/theme-chalk/radio-button.scss +169 -169
  166. package/theme-chalk/select/index.scss +278 -272
  167. package/theme-chalk/space.scss +20 -0
  168. package/theme-chalk/statistic.scss +35 -0
  169. package/theme-chalk/switch.scss +300 -300
  170. package/theme-chalk/tag.scss +181 -181
  171. package/theme-chalk/text.scss +48 -0
  172. package/theme-chalk/transition.scss +34 -4
  173. package/theme-chalk/tree-select.scss +41 -25
  174. package/theme-chalk/tree.scss +136 -0
  175. package/theme-chalk/var.scss +83 -83
  176. package/dist/Input/Input.1.d.ts +0 -16
  177. package/dist/Input/Input.1.js +0 -376
  178. package/dist/Tree/DirectoryTree.d.ts +0 -15
  179. package/dist/Tree/DirectoryTree.js +0 -183
  180. package/dist/Tree/DropIndicator.d.ts +0 -8
  181. package/dist/Tree/DropIndicator.js +0 -34
  182. package/dist/Tree/Indent.d.ts +0 -9
  183. package/dist/Tree/Indent.js +0 -25
  184. package/dist/Tree/MotionTreeNode.d.ts +0 -14
  185. package/dist/Tree/MotionTreeNode.js +0 -125
  186. package/dist/Tree/NodeList.d.ts +0 -50
  187. package/dist/Tree/NodeList.js +0 -301
  188. package/dist/Tree/RCTree.d.ts +0 -248
  189. package/dist/Tree/RCTree.js +0 -1216
  190. package/dist/Tree/contextTypes.d.ts +0 -69
  191. package/dist/Tree/contextTypes.js +0 -9
  192. package/dist/Tree/typings.tsx--bak +0 -245
  193. package/dist/Tree/useUnmount.d.ts +0 -5
  194. package/dist/Tree/useUnmount.js +0 -34
  195. package/dist/Tree/util.d.ts +0 -51
  196. package/dist/Tree/util.js +0 -303
  197. package/dist/Tree/utils/conductUtil.d.ts +0 -17
  198. package/dist/Tree/utils/conductUtil.js +0 -209
  199. package/dist/Tree/utils/dictUtil.d.ts +0 -13
  200. package/dist/Tree/utils/dictUtil.js +0 -75
  201. package/dist/Tree/utils/diffUtil.d.ts +0 -7
  202. package/dist/Tree/utils/diffUtil.js +0 -48
  203. package/dist/Tree/utils/dropIndicator.d.ts +0 -11
  204. package/dist/Tree/utils/dropIndicator.js +0 -36
  205. package/dist/Tree/utils/iconUtil.d.ts +0 -5
  206. package/dist/Tree/utils/iconUtil.js +0 -62
  207. package/dist/Tree/utils/keyUtil.d.ts +0 -2
  208. package/dist/Tree/utils/keyUtil.js +0 -3
  209. package/dist/Tree/utils/motion.d.ts +0 -10
  210. package/dist/Tree/utils/motion.js +0 -54
  211. package/dist/Tree/utils/pickAttrs.d.ts +0 -11
  212. package/dist/Tree/utils/pickAttrs.js +0 -51
  213. package/dist/Tree/utils/treeUtil.d.ts +0 -86
  214. package/dist/Tree/utils/treeUtil.js +0 -364
  215. package/dist/TreeSelect/Utils.d.ts +0 -3
  216. package/dist/TreeSelect/Utils.js +0 -20
@@ -1,83 +1,83 @@
1
- // CSS3 var
2
- @use 'common/var' as *;
3
- @use 'mixins/var' as *;
4
- @use 'mixins/mixins' as *;
5
-
6
- // for better performance do not dynamically change the root variable if you really
7
- // do not need that, since this could introduce recalculation overhead for rendering.
8
- // https://lisilinhart.info/posts/css-variables-performance/
9
-
10
- // common
11
- :root {
12
- @include set-css-var-value('color-white', $color-white);
13
- @include set-css-var-value('color-black', $color-black);
14
-
15
- // get rgb
16
- @each $type in (primary, success, warning, danger, error, info) {
17
- @include set-css-color-rgb($type);
18
- }
19
-
20
- // Typography
21
- @include set-component-css-var('font-size', $font-size);
22
- @include set-component-css-var('font-family', $font-family);
23
-
24
- @include set-css-var-value('font-weight-primary', 500);
25
- @include set-css-var-value('font-line-height-primary', 24px);
26
-
27
- // z-index --el-index-#{$type}
28
- @include set-component-css-var('index', $z-index);
29
-
30
- // --el-border-radius-#{$type}
31
- @include set-component-css-var('border-radius', $border-radius);
32
-
33
- // Transition
34
- // refer to this website to get the bezier motion function detail
35
- // https://cubic-bezier.com/#p1,p2,p3,p4 (change px as your function parameter)
36
- @include set-component-css-var('transition-duration', $transition-duration);
37
-
38
- @include set-component-css-var('transition-function', $transition-function);
39
- @include set-component-css-var('transition', $transition);
40
-
41
- // common component size
42
- @include set-component-css-var('component-size', $common-component-size);
43
- }
44
-
45
- // for light
46
- :root {
47
- color-scheme: light;
48
-
49
- // --el-color-#{$type}
50
- // --el-color-#{$type}-light-{$i}
51
- @each $type in (primary, success, warning, danger, error, info) {
52
- @include set-css-color-type($colors, $type);
53
- }
54
-
55
- // color-scheme
56
- // Background --el-bg-color-#{$type}
57
- @include set-component-css-var('bg-color', $bg-color);
58
- // --el-text-color-#{$type}
59
- @include set-component-css-var('text-color', $text-color);
60
- // --el-border-color-#{$type}
61
- @include set-component-css-var('border-color', $border-color);
62
- // Fill --el-fill-color-#{$type}
63
- @include set-component-css-var('fill-color', $fill-color);
64
-
65
- // Box-shadow
66
- // --el-box-shadow-#{$type}
67
- @include set-component-css-var('box-shadow', $box-shadow);
68
- // Disable base
69
- @include set-component-css-var('disabled', $disabled);
70
-
71
- // overlay & mask
72
- @include set-component-css-var('overlay-color', $overlay-color);
73
- @include set-component-css-var('mask-color', $mask-color);
74
-
75
- // Border
76
- @include set-css-var-value('border-width', $border-width);
77
- @include set-css-var-value('border-style', $border-style);
78
- @include set-css-var-value('border-color-hover', $border-color-hover);
79
- @include set-css-var-value('border', getCssVar('border-width') getCssVar('border-style') getCssVar('border-color'));
80
-
81
- // Svg
82
- @include css-var-from-global('svg-monochrome-grey', 'border-color');
83
- }
1
+ // CSS3 var
2
+ @use 'common/var' as *;
3
+ @use 'mixins/var' as *;
4
+ @use 'mixins/mixins' as *;
5
+
6
+ // for better performance do not dynamically change the root variable if you really
7
+ // do not need that, since this could introduce recalculation overhead for rendering.
8
+ // https://lisilinhart.info/posts/css-variables-performance/
9
+
10
+ // common
11
+ :root {
12
+ @include set-css-var-value('color-white', $color-white);
13
+ @include set-css-var-value('color-black', $color-black);
14
+
15
+ // get rgb
16
+ @each $type in (primary, success, warning, danger, error, info) {
17
+ @include set-css-color-rgb($type);
18
+ }
19
+
20
+ // Typography
21
+ @include set-component-css-var('font-size', $font-size);
22
+ @include set-component-css-var('font-family', $font-family);
23
+
24
+ @include set-css-var-value('font-weight-primary', 500);
25
+ @include set-css-var-value('font-line-height-primary', 24px);
26
+
27
+ // z-index --el-index-#{$type}
28
+ @include set-component-css-var('index', $z-index);
29
+
30
+ // --el-border-radius-#{$type}
31
+ @include set-component-css-var('border-radius', $border-radius);
32
+
33
+ // Transition
34
+ // refer to this website to get the bezier motion function detail
35
+ // https://cubic-bezier.com/#p1,p2,p3,p4 (change px as your function parameter)
36
+ @include set-component-css-var('transition-duration', $transition-duration);
37
+
38
+ @include set-component-css-var('transition-function', $transition-function);
39
+ @include set-component-css-var('transition', $transition);
40
+
41
+ // common component size
42
+ @include set-component-css-var('component-size', $common-component-size);
43
+ }
44
+
45
+ // for light
46
+ :root {
47
+ color-scheme: light;
48
+
49
+ // --el-color-#{$type}
50
+ // --el-color-#{$type}-light-{$i}
51
+ @each $type in (primary, success, warning, danger, error, info) {
52
+ @include set-css-color-type($colors, $type);
53
+ }
54
+
55
+ // color-scheme
56
+ // Background --el-bg-color-#{$type}
57
+ @include set-component-css-var('bg-color', $bg-color);
58
+ // --el-text-color-#{$type}
59
+ @include set-component-css-var('text-color', $text-color);
60
+ // --el-border-color-#{$type}
61
+ @include set-component-css-var('border-color', $border-color);
62
+ // Fill --el-fill-color-#{$type}
63
+ @include set-component-css-var('fill-color', $fill-color);
64
+
65
+ // Box-shadow
66
+ // --el-box-shadow-#{$type}
67
+ @include set-component-css-var('box-shadow', $box-shadow);
68
+ // Disable base
69
+ @include set-component-css-var('disabled', $disabled);
70
+
71
+ // overlay & mask
72
+ @include set-component-css-var('overlay-color', $overlay-color);
73
+ @include set-component-css-var('mask-color', $mask-color);
74
+
75
+ // Border
76
+ @include set-css-var-value('border-width', $border-width);
77
+ @include set-css-var-value('border-style', $border-style);
78
+ @include set-css-var-value('border-color-hover', $border-color-hover);
79
+ @include set-css-var-value('border', getCssVar('border-width') getCssVar('border-style') getCssVar('border-color'));
80
+
81
+ // Svg
82
+ @include css-var-from-global('svg-monochrome-grey', 'border-color');
83
+ }
@@ -1,16 +0,0 @@
1
- import React, { RefObject } from 'react';
2
- import InputRange from './InputRange';
3
- import TextArea from './TextArea';
4
- import { InputProps, InputRef } from './typings';
5
- declare const ForwardInput: (props: InputProps & {
6
- ref?: RefObject<InputRef> | React.ForwardedRef<InputRef>;
7
- }) => React.ReactElement;
8
- type InternalInputType = typeof ForwardInput;
9
- interface InputInterface extends InternalInputType {
10
- displayName?: string;
11
- defaultProps?: Partial<InputProps>;
12
- TextArea: typeof TextArea;
13
- Range: typeof InputRange;
14
- }
15
- declare const Input: InputInterface;
16
- export default Input;
@@ -1,376 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18;
3
- var _excluded = ["name", "title", "prefix", "suffix", "prepend", "append", "error", "warning", "debounceInput", "debounceTime", "placeholder", "readOnly", "plain", "classPrefix", "onChange", "onClear", "showPassword", "onFocus", "onBlur", "maxLength", "showWordLimit", "hiddenValue", "defaultValue"];
4
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
19
- import { useDebounceFn } from 'ahooks';
20
- import classNames from 'classnames';
21
- import { addClass, addStyle, hasClass, removeClass } from 'dom-lib';
22
- import isObject from 'lodash/isObject';
23
- import React, { cloneElement, forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
24
- import Icon from "../Icon/Icon";
25
- import { isNotEmpty, mergeDefaultProps } from "../Util";
26
- import { partitionHTMLProps, useClassNames, useControlled, useDisabled, useSize } from "../hooks";
27
- import InputGroup from "./InputGroup";
28
- import InputRange from "./InputRange";
29
- import TextArea from "./TextArea";
30
- function InternalInput(props, ref) {
31
- var _this = this;
32
- props = mergeDefaultProps({
33
- type: 'text',
34
- placeholder: '请输入',
35
- clearable: true,
36
- debounceTime: 200,
37
- defaultValue: ''
38
- }, props);
39
- var _props = props,
40
- name = _props.name,
41
- title = _props.title,
42
- prefix = _props.prefix,
43
- suffix = _props.suffix,
44
- prepend = _props.prepend,
45
- append = _props.append,
46
- error = _props.error,
47
- warning = _props.warning,
48
- debounceInput = _props.debounceInput,
49
- debounceTime = _props.debounceTime,
50
- placeholder = _props.placeholder,
51
- readOnly = _props.readOnly,
52
- plain = _props.plain,
53
- _props$classPrefix = _props.classPrefix,
54
- classPrefix = _props$classPrefix === void 0 ? 'input' : _props$classPrefix,
55
- onChange = _props.onChange,
56
- onClear = _props.onClear,
57
- showPassword = _props.showPassword,
58
- _onFocus = _props.onFocus,
59
- _onBlur = _props.onBlur,
60
- maxLength = _props.maxLength,
61
- showWordLimit = _props.showWordLimit,
62
- hiddenValue = _props.hiddenValue,
63
- defaultValue = _props.defaultValue,
64
- rest = _objectWithoutProperties(_props, _excluded);
65
- var _useClassNames = useClassNames(classPrefix),
66
- b = _useClassNames.b,
67
- e = _useClassNames.e,
68
- m = _useClassNames.m,
69
- is = _useClassNames.is;
70
- var _partitionHTMLProps = partitionHTMLProps(rest),
71
- _partitionHTMLProps2 = _slicedToArray(_partitionHTMLProps, 1),
72
- htmlInputProps = _partitionHTMLProps2[0];
73
- var _useControlled = useControlled(props.value, defaultValue),
74
- _useControlled2 = _slicedToArray(_useControlled, 2),
75
- value = _useControlled2[0],
76
- setValue = _useControlled2[1];
77
- var _useState = useState(props.type || 'text'),
78
- _useState2 = _slicedToArray(_useState, 2),
79
- type = _useState2[0],
80
- setType = _useState2[1];
81
- var disabled = useDisabled(props.disabled);
82
- var size = useSize(props.size);
83
- var containerRef = useRef(null);
84
- var inputRef = useRef(null);
85
- var contentRef = useRef(null);
86
- var clearRef = useRef(null);
87
- var suffixRef = useRef(null);
88
- // 搜索框是否输入完毕
89
- var inputOver = useRef(true);
90
-
91
- // const containerRef = useMemo(() => props.containerRef ?? rootRef, [props.containerRef]);
92
-
93
- /** 是否可清空 */
94
- var clearable = useMemo(function () {
95
- // 只读不显示清除按钮只有input组件适用,加上了那些引用input组件就无法显示清空按钮了,这里添加说明,下次别再添加了
96
- return Boolean(showPassword ? false : props.clearable /* && !readOnly */);
97
- }, [props.clearable, showPassword]);
98
-
99
- /** 输入框尾部内容 */
100
- var suffixSlot = useMemo(function () {
101
- if (type === 'text' && maxLength && showWordLimit) {
102
- return /*#__PURE__*/React.createElement("span", {
103
- className: e(_templateObject || (_templateObject = _taggedTemplateLiteral(["count"])))
104
- }, /*#__PURE__*/React.createElement("span", {
105
- className: e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["count-inner"])))
106
- }, typeof value === 'string' ? value.length : 0, " / ", maxLength));
107
- } else if (['text', 'password'].includes(type) && suffix) {
108
- if (isObject(suffix)) {
109
- var _nodeType;
110
- var nodeType = suffix === null || suffix === void 0 ? void 0 : suffix.type;
111
- nodeType = ((_nodeType = nodeType) === null || _nodeType === void 0 ? void 0 : _nodeType.displayName) || nodeType;
112
- if (nodeType.toString().startsWith('Icon')) {
113
- var _suffix$props;
114
- return /*#__PURE__*/cloneElement(suffix, _objectSpread(_objectSpread({}, suffix.props), {}, {
115
- className: classNames((_suffix$props = suffix.props) === null || _suffix$props === void 0 ? void 0 : _suffix$props.className, e(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["icon"]))))
116
- }));
117
- }
118
- }
119
- return suffix;
120
- } else if (showPassword && isNotEmpty(value)) {
121
- return /*#__PURE__*/React.createElement(Icon, {
122
- name: type === 'text' ? 'eye' : 'eye-slash',
123
- className: classNames(e(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["icon"]))), e(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["clear"]))))
124
- });
125
- }
126
- return null;
127
- }, [type, maxLength, showWordLimit, suffix, showPassword, value, e]);
128
-
129
- /** 后缀是否可点击 */
130
- var suffixCanClick = useMemo(function () {
131
- if (showPassword) {
132
- return true;
133
- }
134
- }, [showPassword]);
135
- var showClear = useCallback(function (_value) {
136
- if (clearable && isNotEmpty(_value) && !disabled && clearRef.current) {
137
- addStyle(clearRef.current, 'display', '');
138
- if (suffixRef.current) {
139
- if (type === 'text' && maxLength && showWordLimit) {
140
- return;
141
- }
142
- addStyle(suffixRef.current, 'display', 'none');
143
- }
144
- } else {
145
- if (suffixRef.current) {
146
- addStyle(suffixRef.current, 'display', '');
147
- }
148
- }
149
- // addClass((ref ?? contentRef).current, m`suffix`);
150
- }, [clearable, disabled, maxLength, showWordLimit, type]);
151
- var hideClear = useCallback(function () {
152
- if (clearRef.current) {
153
- addStyle(clearRef.current, 'display', 'none');
154
- }
155
- if (suffixRef.current) {
156
- addStyle(suffixRef.current, 'display', '');
157
- }
158
- // if (!suffixSlot) {
159
- // removeClass((ref ?? contentRef).current, m`suffix`);
160
- // }
161
- }, []);
162
-
163
- /** 在点击由 clearable 属性生成的清空按钮时触发 */
164
- var handelClear = useCallback(function (event) {
165
- event.stopPropagation();
166
- setValue('');
167
- if (clearRef.current) {
168
- addStyle(clearRef.current, 'display', 'none');
169
- }
170
- hideClear();
171
- if (!readOnly && !disabled) {
172
- var _inputRef$current;
173
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
174
- }
175
- onClear === null || onClear === void 0 || onClear(event);
176
- onChange === null || onChange === void 0 || onChange('', event);
177
- }, [disabled, hideClear, onChange, onClear, readOnly, setValue]);
178
-
179
- /** 后缀点击事件 */
180
- var onClickSuffix = useCallback(function () {
181
- if (showPassword) {
182
- setType(type === 'text' ? 'password' : 'text');
183
- }
184
- }, [type, showPassword]);
185
-
186
- /** 输入事件 */
187
- var handleInput = useCallback(function (event) {
188
- if (inputOver.current) {
189
- // 让搜索变成异步的
190
- setValue(event.target.value);
191
- if (clearRef.current && clearable && isNotEmpty(event.target.value)) {
192
- showClear(event.target.value);
193
- } else {
194
- hideClear();
195
- }
196
- onChange === null || onChange === void 0 || onChange(event.target.value, event);
197
- }
198
- }, [setValue, clearable, onChange, showClear, hideClear]);
199
- var _useDebounceFn = useDebounceFn(handleInput, {
200
- wait: debounceTime
201
- }),
202
- handleDebounceInput = _useDebounceFn.run;
203
- var handleComposition = useCallback(function (event) {
204
- var _type = event.type;
205
- if (_type === 'compositionstart') {
206
- inputOver.current = false;
207
- } else if (_type === 'compositionend') {
208
- inputOver.current = true;
209
- handleInput(event);
210
- }
211
- }, [handleInput]);
212
- useEffect(function () {
213
- var input = inputRef.current;
214
- if (input && debounceInput) {
215
- input.addEventListener('compositionstart', handleComposition);
216
- input.addEventListener('compositionupdate', handleComposition);
217
- input.addEventListener('compositionend', handleComposition);
218
- }
219
- }, [debounceInput, handleComposition]);
220
- useImperativeHandle(ref, function () {
221
- return {
222
- ref: containerRef,
223
- input: inputRef,
224
- getValue: function getValue() {
225
- return value;
226
- },
227
- setValue: setValue,
228
- onClear: handelClear,
229
- clear: handelClear,
230
- focus: function focus() {
231
- var _inputRef$current2;
232
- return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
233
- },
234
- blur: function blur() {
235
- var _inputRef$current3;
236
- return (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.blur();
237
- },
238
- showClear: showClear,
239
- hideClear: hideClear
240
- };
241
- });
242
-
243
- /** 输入框头部内容 */
244
- var preffixSlot = useMemo(function () {
245
- if (['text', 'password'].includes(type) && prefix) {
246
- if (isObject(prefix)) {
247
- var _nodeType2;
248
- var nodeType = prefix === null || prefix === void 0 ? void 0 : prefix.type;
249
- nodeType = ((_nodeType2 = nodeType) === null || _nodeType2 === void 0 ? void 0 : _nodeType2.displayName) || nodeType;
250
- if (nodeType.toString().startsWith('Icon')) {
251
- var _prefix$props;
252
- return /*#__PURE__*/cloneElement(prefix, _objectSpread(_objectSpread({}, prefix.props), {}, {
253
- className: classNames((_prefix$props = prefix.props) === null || _prefix$props === void 0 ? void 0 : _prefix$props.className, e(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["icon"]))))
254
- }));
255
- }
256
- }
257
- return prefix;
258
- }
259
- return null;
260
- }, [type, prefix, e]);
261
- var content = useMemo(function () {
262
- return type === 'hidden' ? /*#__PURE__*/React.createElement("input", _extends({
263
- ref: inputRef,
264
- type: "hidden",
265
- name: name,
266
- value: value,
267
- disabled: disabled,
268
- onChange: debounceInput ? handleDebounceInput : handleInput,
269
- onClick: props.onClick,
270
- className: props.className,
271
- style: props.innerStyle
272
- }, htmlInputProps)) : /*#__PURE__*/React.createElement("div", {
273
- className: classNames(e(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["wrapper"]))), is({
274
- error: error,
275
- warning: warning
276
- })),
277
- ref: contentRef,
278
- onMouseEnter: function onMouseEnter() {
279
- return showClear(value);
280
- },
281
- onMouseLeave: function onMouseLeave() {
282
- if (!hasClass(contentRef.current, is('focus'))) {
283
- hideClear();
284
- }
285
- }
286
- }, ['text', 'password'].includes(type) && preffixSlot && /*#__PURE__*/React.createElement("span", {
287
- className: e(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["prefix"])))
288
- }, /*#__PURE__*/React.createElement("span", {
289
- className: e(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["prefix-inner"])))
290
- }, preffixSlot, " ")), /*#__PURE__*/React.createElement("input", _extends({
291
- ref: inputRef,
292
- type: type,
293
- name: name,
294
- title: title,
295
- value: hiddenValue ? '' : value,
296
- className: e(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["inner"]))),
297
- style: props.innerStyle,
298
- placeholder: placeholder,
299
- autoComplete: "off",
300
- readOnly: readOnly,
301
- disabled: disabled,
302
- maxLength: maxLength,
303
- onInput: handleInput,
304
- onClick: props.onClick,
305
- onFocus: function onFocus(event) {
306
- if (contentRef.current) {
307
- addClass(contentRef.current, is('focus'));
308
- }
309
- showClear(value);
310
- _onFocus === null || _onFocus === void 0 || _onFocus.call(_this, event);
311
- },
312
- onBlur: function onBlur(event) {
313
- if (contentRef.current) {
314
- removeClass(contentRef.current, is('focus'));
315
- }
316
- hideClear();
317
- _onBlur === null || _onBlur === void 0 || _onBlur.call(_this, event);
318
- }
319
- }, htmlInputProps)), /*#__PURE__*/React.createElement("span", {
320
- ref: clearRef,
321
- key: "clearIcon",
322
- className: e(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["suffix"]))),
323
- style: {
324
- display: 'none'
325
- },
326
- onClick: handelClear
327
- }, /*#__PURE__*/React.createElement("span", {
328
- className: e(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["suffix-inner"])))
329
- }, /*#__PURE__*/React.createElement(Icon, {
330
- prefix: "fal",
331
- name: "circle-xmark",
332
- className: classNames(e(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["icon"]))), e(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["clear"])))),
333
- onMouseDown: function onMouseDown(event) {
334
- event.preventDefault();
335
- event.stopPropagation();
336
- }
337
- }))), suffixSlot && /*#__PURE__*/React.createElement("span", {
338
- ref: suffixRef,
339
- key: "suffixSlot",
340
- className: classNames(e(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["suffix"]))), _defineProperty({}, b('click', false), suffixCanClick)),
341
- onClick: onClickSuffix
342
- }, /*#__PURE__*/React.createElement("span", {
343
- className: e(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["suffix-inner"])))
344
- }, suffixSlot)));
345
- }, [type, name, value, disabled, debounceInput, handleDebounceInput, handleInput, props.onClick, props.className, props.innerStyle, htmlInputProps, e, is, error, warning, preffixSlot, title, hiddenValue, placeholder, readOnly, maxLength, handelClear, suffixSlot, b, suffixCanClick, onClickSuffix, showClear, hideClear, _onFocus, _onBlur]);
346
- if (append || prepend) {
347
- return /*#__PURE__*/React.createElement(InputGroup, {
348
- prepend: prepend,
349
- append: append,
350
- ref: containerRef,
351
- className: classNames(_defineProperty({}, m(size), size), is({
352
- disabled: disabled,
353
- plain: plain
354
- }), b(), props.className),
355
- style: props.style
356
- }, content);
357
- } else {
358
- return /*#__PURE__*/React.createElement("div", {
359
- ref: containerRef,
360
- className: classNames(b(), _defineProperty(_defineProperty(_defineProperty({}, m(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["prefix"]))), preffixSlot), m(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["suffix"]))), suffixSlot || clearable), m(size), size), is({
361
- disabled: disabled,
362
- plain: plain
363
- }), props.className),
364
- style: append || prepend ? {} : props.style,
365
- onClick: function onClick(event) {
366
- return event.stopPropagation();
367
- }
368
- }, content);
369
- }
370
- }
371
- var ForwardInput = /*#__PURE__*/forwardRef(InternalInput);
372
- var Input = ForwardInput;
373
- Input.TextArea = TextArea;
374
- Input.Range = InputRange;
375
- Input.displayName = 'ElInput';
376
- export default Input;
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import RcTree from './RCTree';
3
- import { TreeProps } from './Tree';
4
- import { BasicDataNode, DataNode, Key } from './typings';
5
- export type ExpandAction = false | 'click' | 'doubleClick';
6
- export interface DirectoryTreeProps<T extends BasicDataNode = DataNode> extends TreeProps<T> {
7
- expandAction?: ExpandAction;
8
- }
9
- type DirectoryTreeCompoundedComponent = (<T extends BasicDataNode | DataNode = DataNode>(props: React.PropsWithChildren<DirectoryTreeProps<T>> & React.RefAttributes<RcTree>) => React.ReactElement) & Pick<React.FC, 'displayName'>;
10
- export interface DirectoryTreeState {
11
- expandedKeys?: Key[];
12
- selectedKeys?: Key[];
13
- }
14
- declare const ForwardDirectoryTree: DirectoryTreeCompoundedComponent;
15
- export default ForwardDirectoryTree;