@qsxy/element-plus-react 1.0.1 → 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 (256) 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/Calendar/Calendar.js +12 -3
  8. package/dist/Calendar/Footer.js +4 -2
  9. package/dist/Calendar/QuarterPanel.d.ts +4 -0
  10. package/dist/Calendar/QuarterPanel.js +109 -0
  11. package/dist/Calendar/WeekPanel.js +1 -1
  12. package/dist/Calendar/typings.d.ts +1 -1
  13. package/dist/Card/Card.js +13 -6
  14. package/dist/Card/typings.d.ts +1 -1
  15. package/dist/Cascader/Cascader.js +1 -1
  16. package/dist/Cascader/useCascader.d.ts +0 -14
  17. package/dist/Cascader/useCascader.js +33 -32
  18. package/dist/Checkbox/Checkbox.js +3 -2
  19. package/dist/ConfigProvider/ConfigProvider.js +2 -24
  20. package/dist/ConfigProvider/ConfigProviderContext.js +1 -1
  21. package/dist/ConfigProvider/typings.d.ts +1 -1
  22. package/dist/Container/Main.d.ts +1 -1
  23. package/dist/Container/typings.d.ts +1 -1
  24. package/dist/DatePicker/DatePicker.js +38 -12
  25. package/dist/DatePicker/DateRangePicker.js +27 -9
  26. package/dist/DatePicker/main.js +1 -1
  27. package/dist/DatePicker/typings.d.ts +1 -1
  28. package/dist/DateTimePicker/DateTimePicker.js +2 -2
  29. package/dist/Dialog/Dialog.js +5 -12
  30. package/dist/Input/Input.js +190 -149
  31. package/dist/Input/InputRange.js +1 -1
  32. package/dist/Input/TextArea.js +87 -12
  33. package/dist/Input/typings.d.ts +56 -5
  34. package/dist/Input/useComposition.d.ts +23 -0
  35. package/dist/Input/useComposition.js +63 -0
  36. package/dist/Input/utils.d.ts +7 -0
  37. package/dist/Input/utils.js +95 -0
  38. package/dist/InputNumber/InputNumber.js +351 -141
  39. package/dist/InputNumber/typings.d.ts +16 -2
  40. package/dist/Loading/Loading.js +5 -2
  41. package/dist/Menu/Menu.js +25 -1
  42. package/dist/Menu/MenuItem.js +4 -2
  43. package/dist/Menu/SubMenu.js +2 -2
  44. package/dist/Menu/SubMenuCollapseTransition.js +14 -9
  45. package/dist/Menu/typings.d.ts +2 -1
  46. package/dist/Message/Message.js +51 -23
  47. package/dist/Message/index.js +8 -10
  48. package/dist/Message/typings.d.ts +8 -5
  49. package/dist/MessageBox/MessageBox.js +52 -30
  50. package/dist/MessageBox/index.d.ts +2 -1
  51. package/dist/MessageBox/index.js +4 -2
  52. package/dist/MessageBox/typings.d.ts +3 -0
  53. package/dist/Notification/Notification.js +26 -19
  54. package/dist/Select/Option.js +30 -14
  55. package/dist/Select/SelectContext.d.ts +5 -5
  56. package/dist/Select/SelectContext.js +2 -1
  57. package/dist/Select/SelectCore.d.ts +2 -2
  58. package/dist/Select/SelectCore.js +172 -449
  59. package/dist/Select/SelectDropdown.js +85 -155
  60. package/dist/Select/index.d.ts +1 -1
  61. package/dist/Select/typings.d.ts +52 -22
  62. package/dist/Select/useSelect.d.ts +128 -0
  63. package/dist/Select/useSelect.js +524 -0
  64. package/dist/Space/Space.d.ts +4 -0
  65. package/dist/Space/Space.js +128 -0
  66. package/dist/Space/SpaceItem.d.ts +7 -0
  67. package/dist/Space/SpaceItem.js +14 -0
  68. package/dist/Space/index.d.ts +3 -0
  69. package/dist/Space/index.js +2 -0
  70. package/dist/Space/typings.d.ts +26 -0
  71. package/dist/Space/typings.js +1 -0
  72. package/dist/Space/useSpace.d.ts +7 -0
  73. package/dist/Space/useSpace.js +104 -0
  74. package/dist/Statistic/Statistic.d.ts +4 -0
  75. package/dist/Statistic/Statistic.js +92 -0
  76. package/dist/Statistic/index.d.ts +2 -0
  77. package/dist/Statistic/index.js +1 -0
  78. package/dist/Statistic/typings.d.ts +28 -0
  79. package/dist/Statistic/typings.js +1 -0
  80. package/dist/Switch/Switch.js +2 -2
  81. package/dist/Table/Table.js +3 -0
  82. package/dist/Table/typings.d.ts +2 -0
  83. package/dist/Table/util.js +6 -5
  84. package/dist/Tag/Tag.js +22 -17
  85. package/dist/Tag/typings.d.ts +1 -1
  86. package/dist/Text/Text.d.ts +4 -0
  87. package/dist/Text/Text.js +84 -0
  88. package/dist/Text/index.d.ts +2 -0
  89. package/dist/Text/index.js +1 -0
  90. package/dist/Text/typings.d.ts +15 -0
  91. package/dist/Text/typings.js +1 -0
  92. package/dist/TimePicker/TimePicker.js +2 -2
  93. package/dist/Tree/CollapseTransition.d.ts +7 -0
  94. package/dist/Tree/CollapseTransition.js +60 -0
  95. package/dist/Tree/Tree.d.ts +3 -140
  96. package/dist/Tree/Tree.js +350 -77
  97. package/dist/Tree/TreeContext.d.ts +9 -0
  98. package/dist/Tree/TreeContext.js +14 -0
  99. package/dist/Tree/TreeNode.d.ts +5 -3
  100. package/dist/Tree/TreeNode.js +321 -331
  101. package/dist/Tree/TreeNodeContent.d.ts +9 -0
  102. package/dist/Tree/TreeNodeContent.js +22 -0
  103. package/dist/Tree/index.d.ts +3 -8
  104. package/dist/Tree/index.js +1 -4
  105. package/dist/Tree/model/node.d.ts +62 -0
  106. package/dist/Tree/model/node.js +601 -0
  107. package/dist/Tree/model/tree-store.d.ts +52 -0
  108. package/dist/Tree/model/tree-store.js +510 -0
  109. package/dist/Tree/model/useDragNode.d.ts +30 -0
  110. package/dist/Tree/model/useDragNode.js +293 -0
  111. package/dist/Tree/model/useKeydown.d.ts +0 -0
  112. package/dist/Tree/model/useKeydown.js +104 -0
  113. package/dist/Tree/model/useNodeExpandEventBroadcast.d.ts +15 -0
  114. package/dist/Tree/model/useNodeExpandEventBroadcast.js +54 -0
  115. package/dist/Tree/model/util.d.ts +7 -0
  116. package/dist/Tree/model/util.js +24 -0
  117. package/dist/Tree/typings.d.ts +225 -114
  118. package/dist/TreeSelect/TreeSelect.d.ts +2 -10
  119. package/dist/TreeSelect/TreeSelect.js +90 -566
  120. package/dist/TreeSelect/TreeSelectOption.d.ts +6 -0
  121. package/dist/TreeSelect/TreeSelectOption.js +62 -0
  122. package/dist/TreeSelect/cacheOptions.d.ts +9 -0
  123. package/dist/TreeSelect/cacheOptions.js +22 -0
  124. package/dist/TreeSelect/index.d.ts +0 -1
  125. package/dist/TreeSelect/typings.d.ts +11 -63
  126. package/dist/TreeSelect/useSelect.d.ts +125 -0
  127. package/dist/TreeSelect/useSelect.js +104 -0
  128. package/dist/TreeSelect/useTree.d.ts +130 -0
  129. package/dist/TreeSelect/useTree.js +285 -0
  130. package/dist/TreeSelect/utils.d.ts +10 -0
  131. package/dist/TreeSelect/utils.js +38 -0
  132. package/dist/Upload/UploadContent.js +2 -0
  133. package/dist/Upload/ajax.js +3 -0
  134. package/dist/Upload/typings.d.ts +4 -0
  135. package/dist/Util/aria.d.ts +25 -0
  136. package/dist/Util/aria.js +118 -0
  137. package/dist/Util/base.d.ts +5 -0
  138. package/dist/Util/base.js +140 -1
  139. package/dist/config/Constants.d.ts +3 -0
  140. package/dist/config/Constants.js +8 -0
  141. package/dist/hooks/index.d.ts +1 -0
  142. package/dist/hooks/index.js +1 -0
  143. package/dist/hooks/popperPropsUtils.js +1 -1
  144. package/dist/hooks/treePropsUtils.d.ts +3 -3
  145. package/dist/hooks/treePropsUtils.js +2 -2
  146. package/dist/hooks/useCalcInputWidth.d.ts +8 -0
  147. package/dist/{Tree/useUnmount.js → hooks/useCalcInputWidth.js} +23 -27
  148. package/dist/hooks/useComposition.d.ts +16 -0
  149. package/dist/hooks/useComposition.js +39 -0
  150. package/dist/hooks/useConfigProvider.d.ts +27 -0
  151. package/dist/hooks/useConfigProvider.js +78 -0
  152. package/dist/hooks/useCursor.d.ts +2 -0
  153. package/dist/hooks/useCursor.js +52 -0
  154. package/dist/hooks/useFocusController.d.ts +27 -0
  155. package/dist/hooks/useFocusController.js +72 -0
  156. package/dist/hooks/useResizeObserver.js +6 -6
  157. package/dist/index.css +1 -1
  158. package/dist/index.d.ts +18 -11
  159. package/dist/index.js +11 -5
  160. package/dist/locale/en.d.ts +15 -0
  161. package/dist/locale/en.js +15 -0
  162. package/dist/locale/zhCn.d.ts +15 -0
  163. package/dist/locale/zhCn.js +15 -0
  164. package/package.json +1 -1
  165. package/theme-chalk/alert.scss +115 -0
  166. package/theme-chalk/aside.scss +8 -8
  167. package/theme-chalk/button-group.scss +80 -80
  168. package/theme-chalk/button.scss +304 -304
  169. package/theme-chalk/calendar/date-table.scss +164 -164
  170. package/theme-chalk/calendar/index.scss +1 -0
  171. package/theme-chalk/calendar/quarter-table.scss +78 -0
  172. package/theme-chalk/checkbox.scss +34 -0
  173. package/theme-chalk/color/index.scss +20 -20
  174. package/theme-chalk/common/transition.scss +142 -142
  175. package/theme-chalk/common/var.scss +1 -1
  176. package/theme-chalk/container.scss +14 -14
  177. package/theme-chalk/dark/css-vars.scss +39 -39
  178. package/theme-chalk/dark/var.scss +225 -225
  179. package/theme-chalk/date-picker.scss +12 -12
  180. package/theme-chalk/drawer.scss +1 -0
  181. package/theme-chalk/footer.scss +12 -12
  182. package/theme-chalk/header.scss +12 -12
  183. package/theme-chalk/index.scss +4 -0
  184. package/theme-chalk/input/input-range.scss +2 -1
  185. package/theme-chalk/input/input.scss +298 -437
  186. package/theme-chalk/input/input.scss--bak +578 -0
  187. package/theme-chalk/input-number.bak +172 -0
  188. package/theme-chalk/input-number.scss +192 -172
  189. package/theme-chalk/link.scss +87 -87
  190. package/theme-chalk/main.scss +14 -14
  191. package/theme-chalk/menu.scss +353 -353
  192. package/theme-chalk/message.scss +104 -178
  193. package/theme-chalk/mixins/_button.scss +224 -224
  194. package/theme-chalk/mixins/_col.scss +33 -33
  195. package/theme-chalk/mixins/_var.scss +67 -67
  196. package/theme-chalk/mixins/config.scss +5 -5
  197. package/theme-chalk/mixins/function.scss +99 -99
  198. package/theme-chalk/mixins/mixins.scss +240 -240
  199. package/theme-chalk/mixins/utils.scss +39 -39
  200. package/theme-chalk/notification.bak +156 -0
  201. package/theme-chalk/notification.scss +109 -156
  202. package/theme-chalk/popper.scss +104 -104
  203. package/theme-chalk/radio-button.scss +169 -169
  204. package/theme-chalk/select/index.scss +222 -191
  205. package/theme-chalk/select/index.scss--bak +247 -0
  206. package/theme-chalk/select/option-group.scss +2 -2
  207. package/theme-chalk/select/option.scss +2 -2
  208. package/theme-chalk/select/select-dropdown.scss +2 -2
  209. package/theme-chalk/space.scss +20 -0
  210. package/theme-chalk/statistic.scss +35 -0
  211. package/theme-chalk/switch.scss +300 -300
  212. package/theme-chalk/tag.scss +150 -172
  213. package/theme-chalk/tag.scss--bak +203 -0
  214. package/theme-chalk/text.scss +48 -0
  215. package/theme-chalk/transition.scss +34 -4
  216. package/theme-chalk/tree-select.scss +41 -25
  217. package/theme-chalk/tree.scss +136 -0
  218. package/theme-chalk/var.scss +83 -83
  219. package/dist/Tree/DirectoryTree.d.ts +0 -15
  220. package/dist/Tree/DirectoryTree.js +0 -183
  221. package/dist/Tree/DropIndicator.d.ts +0 -8
  222. package/dist/Tree/DropIndicator.js +0 -34
  223. package/dist/Tree/Indent.d.ts +0 -9
  224. package/dist/Tree/Indent.js +0 -25
  225. package/dist/Tree/MotionTreeNode.d.ts +0 -14
  226. package/dist/Tree/MotionTreeNode.js +0 -125
  227. package/dist/Tree/NodeList.d.ts +0 -50
  228. package/dist/Tree/NodeList.js +0 -301
  229. package/dist/Tree/RCTree.d.ts +0 -248
  230. package/dist/Tree/RCTree.js +0 -1216
  231. package/dist/Tree/contextTypes.d.ts +0 -69
  232. package/dist/Tree/contextTypes.js +0 -9
  233. package/dist/Tree/typings.tsx--bak +0 -245
  234. package/dist/Tree/useUnmount.d.ts +0 -5
  235. package/dist/Tree/util.d.ts +0 -51
  236. package/dist/Tree/util.js +0 -303
  237. package/dist/Tree/utils/conductUtil.d.ts +0 -17
  238. package/dist/Tree/utils/conductUtil.js +0 -209
  239. package/dist/Tree/utils/dictUtil.d.ts +0 -13
  240. package/dist/Tree/utils/dictUtil.js +0 -75
  241. package/dist/Tree/utils/diffUtil.d.ts +0 -7
  242. package/dist/Tree/utils/diffUtil.js +0 -48
  243. package/dist/Tree/utils/dropIndicator.d.ts +0 -11
  244. package/dist/Tree/utils/dropIndicator.js +0 -36
  245. package/dist/Tree/utils/iconUtil.d.ts +0 -5
  246. package/dist/Tree/utils/iconUtil.js +0 -62
  247. package/dist/Tree/utils/keyUtil.d.ts +0 -2
  248. package/dist/Tree/utils/keyUtil.js +0 -3
  249. package/dist/Tree/utils/motion.d.ts +0 -10
  250. package/dist/Tree/utils/motion.js +0 -54
  251. package/dist/Tree/utils/pickAttrs.d.ts +0 -11
  252. package/dist/Tree/utils/pickAttrs.js +0 -51
  253. package/dist/Tree/utils/treeUtil.d.ts +0 -86
  254. package/dist/Tree/utils/treeUtil.js +0 -364
  255. package/dist/TreeSelect/Utils.d.ts +0 -3
  256. package/dist/TreeSelect/Utils.js +0 -20
@@ -1,17 +0,0 @@
1
- import type { BasicDataNode, DataNode, GetCheckDisabled, Key, KeyEntities } from '../typings';
2
- interface ConductReturnType {
3
- checkedKeys: Key[];
4
- halfCheckedKeys: Key[];
5
- }
6
- export declare function isCheckDisabled<TreeDataType>(node: TreeDataType): boolean;
7
- /**
8
- * Conduct with keys.
9
- * @param keyList current key list
10
- * @param keyEntities key - dataEntity map
11
- * @param mode `fill` to fill missing key, `clean` to remove useless key
12
- */
13
- export declare function conductCheck<TreeDataType extends BasicDataNode = DataNode>(keyList: Key[], checked: true | {
14
- checked: false;
15
- halfCheckedKeys: Key[];
16
- }, keyEntities: KeyEntities<TreeDataType>, getCheckDisabled?: GetCheckDisabled<TreeDataType>): ConductReturnType;
17
- export {};
@@ -1,209 +0,0 @@
1
- import warning from 'rc-util/lib/warning';
2
- import getEntity from "./keyUtil";
3
- function removeFromCheckedKeys(halfCheckedKeys, checkedKeys) {
4
- var filteredKeys = new Set();
5
- halfCheckedKeys.forEach(function (key) {
6
- if (!checkedKeys.has(key)) {
7
- filteredKeys.add(key);
8
- }
9
- });
10
- return filteredKeys;
11
- }
12
- export function isCheckDisabled(node) {
13
- var _ref = node || {},
14
- disabled = _ref.disabled,
15
- disableCheckbox = _ref.disableCheckbox,
16
- checkable = _ref.checkable;
17
- return !!(disabled || disableCheckbox) || checkable === false;
18
- }
19
-
20
- // Fill miss keys
21
- function fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
22
- var checkedKeys = new Set(keys);
23
- var halfCheckedKeys = new Set();
24
-
25
- // Add checked keys top to bottom
26
- for (var level = 0; level <= maxLevel; level += 1) {
27
- var entities = levelEntities.get(level) || new Set();
28
- entities.forEach(function (entity) {
29
- var key = entity.key,
30
- node = entity.node,
31
- _entity$children = entity.children,
32
- children = _entity$children === void 0 ? [] : _entity$children;
33
- if (checkedKeys.has(key) && !syntheticGetCheckDisabled(node)) {
34
- children.filter(function (childEntity) {
35
- return !syntheticGetCheckDisabled(childEntity.node);
36
- }).forEach(function (childEntity) {
37
- checkedKeys.add(childEntity.key);
38
- });
39
- }
40
- });
41
- }
42
-
43
- // Add checked keys from bottom to top
44
- var visitedKeys = new Set();
45
- for (var _level = maxLevel; _level >= 0; _level -= 1) {
46
- var _entities = levelEntities.get(_level) || new Set();
47
- _entities.forEach(function (entity) {
48
- var parent = entity.parent,
49
- node = entity.node;
50
-
51
- // Skip if no need to check
52
- if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
53
- return;
54
- }
55
-
56
- // Skip if parent is disabled
57
- if (syntheticGetCheckDisabled(entity.parent.node)) {
58
- visitedKeys.add(parent.key);
59
- return;
60
- }
61
- var allChecked = true;
62
- var partialChecked = false;
63
- (parent.children || []).filter(function (childEntity) {
64
- return !syntheticGetCheckDisabled(childEntity.node);
65
- }).forEach(function (_ref2) {
66
- var key = _ref2.key;
67
- var checked = checkedKeys.has(key);
68
- if (allChecked && !checked) {
69
- allChecked = false;
70
- }
71
- if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
72
- partialChecked = true;
73
- }
74
- });
75
- if (allChecked) {
76
- checkedKeys.add(parent.key);
77
- }
78
- if (partialChecked) {
79
- halfCheckedKeys.add(parent.key);
80
- }
81
- visitedKeys.add(parent.key);
82
- });
83
- }
84
- return {
85
- checkedKeys: Array.from(checkedKeys),
86
- halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
87
- };
88
- }
89
-
90
- // Remove useless key
91
- function cleanConductCheck(keys, halfKeys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
92
- var checkedKeys = new Set(keys);
93
- var halfCheckedKeys = new Set(halfKeys);
94
-
95
- // Remove checked keys from top to bottom
96
- for (var level = 0; level <= maxLevel; level += 1) {
97
- var entities = levelEntities.get(level) || new Set();
98
- entities.forEach(function (entity) {
99
- var key = entity.key,
100
- node = entity.node,
101
- _entity$children2 = entity.children,
102
- children = _entity$children2 === void 0 ? [] : _entity$children2;
103
- if (!checkedKeys.has(key) && !halfCheckedKeys.has(key) && !syntheticGetCheckDisabled(node)) {
104
- children.filter(function (childEntity) {
105
- return !syntheticGetCheckDisabled(childEntity.node);
106
- }).forEach(function (childEntity) {
107
- checkedKeys.delete(childEntity.key);
108
- });
109
- }
110
- });
111
- }
112
-
113
- // Remove checked keys form bottom to top
114
- halfCheckedKeys = new Set();
115
- var visitedKeys = new Set();
116
- for (var _level2 = maxLevel; _level2 >= 0; _level2 -= 1) {
117
- var _entities2 = levelEntities.get(_level2) || new Set();
118
- _entities2.forEach(function (entity) {
119
- var parent = entity.parent,
120
- node = entity.node;
121
-
122
- // Skip if no need to check
123
- if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
124
- return;
125
- }
126
-
127
- // Skip if parent is disabled
128
- if (syntheticGetCheckDisabled(entity.parent.node)) {
129
- visitedKeys.add(parent.key);
130
- return;
131
- }
132
- var allChecked = true;
133
- var partialChecked = false;
134
- (parent.children || []).filter(function (childEntity) {
135
- return !syntheticGetCheckDisabled(childEntity.node);
136
- }).forEach(function (_ref3) {
137
- var key = _ref3.key;
138
- var checked = checkedKeys.has(key);
139
- if (allChecked && !checked) {
140
- allChecked = false;
141
- }
142
- if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
143
- partialChecked = true;
144
- }
145
- });
146
- if (!allChecked) {
147
- checkedKeys.delete(parent.key);
148
- }
149
- if (partialChecked) {
150
- halfCheckedKeys.add(parent.key);
151
- }
152
- visitedKeys.add(parent.key);
153
- });
154
- }
155
- return {
156
- checkedKeys: Array.from(checkedKeys),
157
- halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
158
- };
159
- }
160
-
161
- /**
162
- * Conduct with keys.
163
- * @param keyList current key list
164
- * @param keyEntities key - dataEntity map
165
- * @param mode `fill` to fill missing key, `clean` to remove useless key
166
- */
167
- export function conductCheck(keyList, checked, keyEntities, getCheckDisabled) {
168
- var warningMissKeys = [];
169
- var syntheticGetCheckDisabled;
170
- if (getCheckDisabled) {
171
- syntheticGetCheckDisabled = getCheckDisabled;
172
- } else {
173
- syntheticGetCheckDisabled = isCheckDisabled;
174
- }
175
-
176
- // We only handle exist keys
177
- var keys = new Set(keyList.filter(function (key) {
178
- var hasEntity = !!getEntity(keyEntities, key);
179
- if (!hasEntity) {
180
- warningMissKeys.push(key);
181
- }
182
- return hasEntity;
183
- }));
184
- var levelEntities = new Map();
185
- var maxLevel = 0;
186
-
187
- // Convert entities by level for calculation
188
- Object.keys(keyEntities).forEach(function (key) {
189
- var entity = keyEntities[key];
190
- var level = entity.level;
191
- var levelSet = levelEntities.get(level);
192
- if (!levelSet) {
193
- levelSet = new Set();
194
- levelEntities.set(level, levelSet);
195
- }
196
- levelSet.add(entity);
197
- maxLevel = Math.max(maxLevel, level);
198
- });
199
- warning(!warningMissKeys.length, "Tree missing follow keys: ".concat(warningMissKeys.slice(0, 100).map(function (key) {
200
- return "'".concat(key, "'");
201
- }).join(', ')));
202
- var result;
203
- if (checked === true) {
204
- result = fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled);
205
- } else {
206
- result = cleanConductCheck(keys, checked.halfCheckedKeys, levelEntities, maxLevel, syntheticGetCheckDisabled);
207
- }
208
- return result;
209
- }
@@ -1,13 +0,0 @@
1
- import { TreeProps } from '../RCTree';
2
- import { DataNode, Key } from '../typings';
3
- type FieldNames = TreeProps['fieldNames'];
4
- /** 计算选中范围,只考虑expanded情况以优化性能 */
5
- export declare function calcRangeKeys({ treeData, expandedKeys, startKey, endKey, fieldNames, }: {
6
- treeData: DataNode[];
7
- expandedKeys: Key[];
8
- startKey?: Key;
9
- endKey?: Key;
10
- fieldNames?: FieldNames;
11
- }): Key[];
12
- export declare function convertDirectoryKeysToNodes(treeData: DataNode[], keys: Key[], fieldNames?: FieldNames): DataNode[];
13
- export {};
@@ -1,75 +0,0 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- 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); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- 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; }
7
- import { fillFieldNames } from "./treeUtil";
8
- var RECORD_NONE = 0;
9
- var RECORD_START = 1;
10
- var RECORD_END = 2;
11
- function traverseNodesKey(treeData, callback, fieldNames) {
12
- var fieldKey = fieldNames.key,
13
- fieldChildren = fieldNames.children;
14
- function processNode(dataNode) {
15
- var key = dataNode[fieldKey];
16
- var children = dataNode[fieldChildren];
17
- if (callback(key, dataNode) !== false) {
18
- traverseNodesKey(children || [], callback, fieldNames);
19
- }
20
- }
21
- treeData.forEach(processNode);
22
- }
23
-
24
- /** 计算选中范围,只考虑expanded情况以优化性能 */
25
- export function calcRangeKeys(_ref) {
26
- var treeData = _ref.treeData,
27
- expandedKeys = _ref.expandedKeys,
28
- startKey = _ref.startKey,
29
- endKey = _ref.endKey,
30
- fieldNames = _ref.fieldNames;
31
- var keys = [];
32
- var record = RECORD_NONE;
33
- if (startKey && startKey === endKey) {
34
- return [startKey];
35
- }
36
- if (!startKey || !endKey) {
37
- return [];
38
- }
39
- function matchKey(key) {
40
- return key === startKey || key === endKey;
41
- }
42
- traverseNodesKey(treeData, function (key) {
43
- if (record === RECORD_END) {
44
- return false;
45
- }
46
- if (matchKey(key)) {
47
- // Match test
48
- keys.push(key);
49
- if (record === RECORD_NONE) {
50
- record = RECORD_START;
51
- } else if (record === RECORD_START) {
52
- record = RECORD_END;
53
- return false;
54
- }
55
- } else if (record === RECORD_START) {
56
- // Append selection
57
- keys.push(key);
58
- }
59
- return expandedKeys.includes(key);
60
- }, fillFieldNames(fieldNames));
61
- return keys;
62
- }
63
- export function convertDirectoryKeysToNodes(treeData, keys, fieldNames) {
64
- var restKeys = _toConsumableArray(keys);
65
- var nodes = [];
66
- traverseNodesKey(treeData, function (key, node) {
67
- var index = restKeys.indexOf(key);
68
- if (index !== -1) {
69
- nodes.push(node);
70
- restKeys.splice(index, 1);
71
- }
72
- return !!restKeys.length;
73
- }, fillFieldNames(fieldNames));
74
- return nodes;
75
- }
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import type { FlattenNode, Key } from '../typings';
3
- export declare function findExpandedKeys(prev?: Key[], next?: Key[]): {
4
- add: boolean;
5
- key: import("react").Key;
6
- };
7
- export declare function getExpandRange(shorter: FlattenNode[], longer: FlattenNode[], key: Key): FlattenNode<import("../typings").DataNode>[];
@@ -1,48 +0,0 @@
1
- export function findExpandedKeys() {
2
- var prev = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3
- var next = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
4
- var prevLen = prev.length;
5
- var nextLen = next.length;
6
- if (Math.abs(prevLen - nextLen) !== 1) {
7
- return {
8
- add: false,
9
- key: null
10
- };
11
- }
12
- function find(shorter, longer) {
13
- var cache = new Map();
14
- shorter.forEach(function (key) {
15
- cache.set(key, true);
16
- });
17
- var keys = longer.filter(function (key) {
18
- return !cache.has(key);
19
- });
20
- return keys.length === 1 ? keys[0] : null;
21
- }
22
- if (prevLen < nextLen) {
23
- return {
24
- add: true,
25
- key: find(prev, next)
26
- };
27
- }
28
- return {
29
- add: false,
30
- key: find(next, prev)
31
- };
32
- }
33
- export function getExpandRange(shorter, longer, key) {
34
- var shorterStartIndex = shorter.findIndex(function (data) {
35
- return data.key === key;
36
- });
37
- var shorterEndNode = shorter[shorterStartIndex + 1];
38
- var longerStartIndex = longer.findIndex(function (data) {
39
- return data.key === key;
40
- });
41
- if (shorterEndNode) {
42
- var longerEndIndex = longer.findIndex(function (data) {
43
- return data.key === shorterEndNode.key;
44
- });
45
- return longer.slice(longerStartIndex + 1, longerEndIndex);
46
- }
47
- return longer.slice(longerStartIndex + 1);
48
- }
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- export declare const offset = 4;
3
- interface Props {
4
- dropPosition: -1 | 0 | 1;
5
- dropLevelOffset: number;
6
- indent: number;
7
- prefixCls: string;
8
- direction: 'ltr' | 'rtl';
9
- }
10
- declare const DropIndicatorRender: (props: Props) => React.JSX.Element;
11
- export default DropIndicatorRender;
@@ -1,36 +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
- 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; }
3
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
- 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); }
5
- import React from 'react';
6
- export var offset = 4;
7
- var DropIndicatorRender = function DropIndicatorRender(props) {
8
- var dropPosition = props.dropPosition,
9
- dropLevelOffset = props.dropLevelOffset,
10
- prefixCls = props.prefixCls,
11
- indent = props.indent,
12
- _props$direction = props.direction,
13
- direction = _props$direction === void 0 ? 'ltr' : _props$direction;
14
- var startPosition = direction === 'ltr' ? 'left' : 'right';
15
- var endPosition = direction === 'ltr' ? 'right' : 'left';
16
- var style = _defineProperty(_defineProperty({}, startPosition, -dropLevelOffset * indent + offset), endPosition, 0);
17
- switch (dropPosition) {
18
- case -1:
19
- style.top = -3;
20
- break;
21
- case 1:
22
- style.bottom = -3;
23
- break;
24
- default:
25
- // dropPosition === 0
26
- style.bottom = -3;
27
- style[startPosition] = indent + offset;
28
- break;
29
- }
30
- // @ts-ignore
31
- return /*#__PURE__*/React.createElement("div", {
32
- style: style,
33
- className: "".concat(prefixCls, "-drop-indicator")
34
- });
35
- };
36
- export default DropIndicatorRender;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { AntTreeNodeProps } from '../Tree';
3
- export default function renderSwitcherIcon(prefixCls: string, switcherIcon: React.ReactElement | null | undefined, showLine: boolean | {
4
- showLeafIcon: boolean;
5
- } | undefined, { isLeaf, expanded, loading }: AntTreeNodeProps): React.JSX.Element;
@@ -1,62 +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
- import classNames from 'classnames';
3
- import React, { cloneElement, isValidElement } from 'react';
4
- import { Icon } from "../../Icon";
5
- export default function renderSwitcherIcon(prefixCls, switcherIcon, showLine, _ref) {
6
- var isLeaf = _ref.isLeaf,
7
- expanded = _ref.expanded,
8
- loading = _ref.loading;
9
- if (loading) {
10
- return /*#__PURE__*/React.createElement(Icon, {
11
- prefix: "fal",
12
- name: "loader",
13
- spin: true,
14
- className: "".concat(prefixCls, "-switcher-loading-icon")
15
- });
16
- }
17
- var showLeafIcon;
18
- if (showLine && _typeof(showLine) === 'object') {
19
- showLeafIcon = showLine.showLeafIcon;
20
- }
21
- if (isLeaf) {
22
- if (showLine) {
23
- if (_typeof(showLine) === 'object' && !showLeafIcon) {
24
- return /*#__PURE__*/React.createElement("span", {
25
- className: "".concat(prefixCls, "-switcher-leaf-line")
26
- });
27
- }
28
- return /*#__PURE__*/React.createElement(Icon, {
29
- name: "file",
30
- prefix: "fal",
31
- className: "".concat(prefixCls, "-switcher-line-icon")
32
- });
33
- }
34
- return null;
35
- }
36
- var switcherCls = "".concat(prefixCls, "-switcher-icon");
37
- if ( /*#__PURE__*/isValidElement(switcherIcon)) {
38
- return /*#__PURE__*/cloneElement(switcherIcon, {
39
- // @ts-ignore
40
- className: classNames(switcherIcon.props.className || '', switcherCls)
41
- });
42
- }
43
- if (switcherIcon) {
44
- return switcherIcon;
45
- }
46
- if (showLine) {
47
- return expanded ? /*#__PURE__*/React.createElement(Icon, {
48
- name: "square-minus",
49
- prefix: "far",
50
- className: "".concat(prefixCls, "-switcher-line-icon")
51
- }) : /*#__PURE__*/React.createElement(Icon, {
52
- name: "square-plus",
53
- prefix: "far",
54
- className: "".concat(prefixCls, "-switcher-line-icon")
55
- });
56
- }
57
- return /*#__PURE__*/React.createElement(Icon, {
58
- name: "angle-right",
59
- prefix: "far",
60
- className: switcherCls
61
- });
62
- }
@@ -1,2 +0,0 @@
1
- import type { Key, KeyEntities } from '../typings';
2
- export default function getEntity<T = any>(keyEntities: KeyEntities<T>, key: Key): import("../typings").DataEntity<T>;
@@ -1,3 +0,0 @@
1
- export default function getEntity(keyEntities, key) {
2
- return keyEntities[key];
3
- }
@@ -1,10 +0,0 @@
1
- import { TransitionProps } from '../../Transition';
2
- export declare const beforeEnter: (el: any) => void;
3
- export declare const onEnter: (el: HTMLElement) => void;
4
- export declare const afterEnter: (el: HTMLElement) => void;
5
- export declare const beforeLeave: (el: any) => void;
6
- export declare const afterLeave: (el: any) => void;
7
- declare const collapseMotion: TransitionProps;
8
- declare const getTransitionName: (rootPrefixCls: string, motion: string, transitionName?: string) => string;
9
- export { getTransitionName };
10
- export default collapseMotion;
@@ -1,54 +0,0 @@
1
- import { addClass, removeClass } from 'dom-lib';
2
- import { namespace } from "../../hooks/prefix";
3
- export var beforeEnter = function beforeEnter(el) {
4
- el.style.height = '0';
5
- el.style.opacity = '0';
6
- };
7
- export var onEnter = function onEnter(el) {
8
- addClass(el, "".concat(namespace, "-motion-collapse"));
9
- el.dataset.oldOverflow = el.style.overflow;
10
- if (el.scrollHeight !== 0) {
11
- el.style.height = "".concat(el.scrollHeight, "px");
12
- el.style.opacity = '1';
13
- } else {
14
- el.style.height = '';
15
- }
16
- el.style.overflow = 'hidden';
17
- };
18
- export var afterEnter = function afterEnter(el) {
19
- removeClass(el, "".concat(namespace, "-motion-collapse"));
20
- el.style.height = '';
21
- el.style.overflow = el.dataset.oldOverflow;
22
- };
23
- export var beforeLeave = function beforeLeave(el) {
24
- addClass(el, "".concat(namespace, "-motion-collapse"));
25
- if (!el.dataset) {
26
- el.dataset = {};
27
- }
28
- el.dataset.oldOverflow = el.style.overflow;
29
- el.style.height = "".concat(el.scrollHeight, "px");
30
- el.style.overflow = 'hidden';
31
- };
32
- export var afterLeave = function afterLeave(el) {
33
- removeClass(el, "".concat(namespace, "-motion-collapse"));
34
- el.style.height = '';
35
- el.style.overflow = el.dataset.oldOverflow;
36
- el.style.display = '';
37
- };
38
- var collapseMotion = {
39
- name: "".concat(namespace, "-treenode-collapse"),
40
- beforeEnter: beforeEnter,
41
- onEnter: onEnter,
42
- afterEnter: afterEnter,
43
- beforeLeave: beforeLeave,
44
- afterLeave: afterLeave,
45
- duration: 300
46
- };
47
- var getTransitionName = function getTransitionName(rootPrefixCls, motion, transitionName) {
48
- if (transitionName !== undefined) {
49
- return transitionName;
50
- }
51
- return "".concat(rootPrefixCls, "-").concat(motion);
52
- };
53
- export { getTransitionName };
54
- export default collapseMotion;
@@ -1,11 +0,0 @@
1
- export interface PickConfig {
2
- aria?: boolean;
3
- data?: boolean;
4
- attr?: boolean;
5
- }
6
- /**
7
- * Picker props from exist props with filter
8
- * @param props Passed props
9
- * @param ariaOnly boolean | { aria?: boolean; data?: boolean; attr?: boolean; } filter config
10
- */
11
- export default function pickAttrs(props: object, ariaOnly?: boolean | PickConfig): {};
@@ -1,51 +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
- 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; }
3
- 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; }
4
- 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; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- 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); }
7
- var attributes = "accept acceptCharset accessKey action allowFullScreen allowTransparency\n alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n charSet checked classID className colSpan cols content contentEditable contextMenu\n controls coords crossOrigin data dateTime default defer dir disabled download draggable\n encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n mediaGroup method min minLength multiple muted name noValidate nonce open\n optimum pattern placeholder poster preload radioGroup readOnly rel required\n reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n summary tabIndex target title type useMap value width wmode wrap";
8
- var eventsName = "onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError";
9
- var propList = "".concat(attributes, " ").concat(eventsName).split(/[\s\n]+/);
10
-
11
- /* eslint-enable max-len */
12
- var ariaPrefix = 'aria-';
13
- var dataPrefix = 'data-';
14
- function match(key, prefix) {
15
- return key.indexOf(prefix) === 0;
16
- }
17
- /**
18
- * Picker props from exist props with filter
19
- * @param props Passed props
20
- * @param ariaOnly boolean | { aria?: boolean; data?: boolean; attr?: boolean; } filter config
21
- */
22
- export default function pickAttrs(props) {
23
- var ariaOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
24
- var mergedConfig;
25
- if (ariaOnly === false) {
26
- mergedConfig = {
27
- aria: true,
28
- data: true,
29
- attr: true
30
- };
31
- } else if (ariaOnly === true) {
32
- mergedConfig = {
33
- aria: true
34
- };
35
- } else {
36
- mergedConfig = _objectSpread({}, ariaOnly);
37
- }
38
- var attrs = {};
39
- Object.keys(props).forEach(function (key) {
40
- if (
41
- // Aria
42
- mergedConfig.aria && (key === 'role' || match(key, ariaPrefix)) ||
43
- // Data
44
- mergedConfig.data && match(key, dataPrefix) ||
45
- // Attr
46
- mergedConfig.attr && propList.includes(key)) {
47
- attrs[key] = props[key];
48
- }
49
- });
50
- return attrs;
51
- }