@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.5

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 (179) hide show
  1. package/AutoBox/index.js +72 -85
  2. package/AutoTips/index.js +72 -95
  3. package/Badge/index.js +17 -16
  4. package/Breadcrumbs/index.js +57 -73
  5. package/Button/index.js +89 -117
  6. package/ButtonGroup/index.js +30 -33
  7. package/Carousel/index.js +29 -33
  8. package/Cascader/index.js +7 -9
  9. package/Checkbox/index.js +28 -35
  10. package/CheckboxGroup/index.js +43 -58
  11. package/Collapse/index.js +52 -49
  12. package/CollapseBox/index.js +65 -70
  13. package/CollapseLayout/index.js +106 -101
  14. package/ColorPicker/index.js +3 -3
  15. package/ComboSelect/index.js +242 -330
  16. package/Container/index.js +17 -21
  17. package/CopyText/index.js +50 -83
  18. package/DatePicker/index.js +22 -27
  19. package/Descriptions/index.js +50 -59
  20. package/Desktop/index.js +161 -180
  21. package/DragVerify/index.js +77 -113
  22. package/Drawer/index.js +80 -95
  23. package/Dropdown/index.js +3 -3
  24. package/DynamicMultiBox/index.js +219 -224
  25. package/DynamicMultiBox/interface.d.ts +7 -0
  26. package/Empty/index.js +26 -28
  27. package/Form/index.js +66 -74
  28. package/FormItem/index.js +14 -15
  29. package/FunctionModal/index.js +7 -14
  30. package/GlobalContext/index.js +17 -20
  31. package/Help/index.js +9 -12
  32. package/HelperText/index.js +11 -11
  33. package/InputLang/index.js +104 -124
  34. package/InputNumber/index.js +62 -81
  35. package/Label/index.js +19 -21
  36. package/Loading/index.js +11 -10
  37. package/Menu/index.js +302 -371
  38. package/Message/index.js +104 -113
  39. package/Modal/index.js +122 -148
  40. package/MultiBox/index.d.ts +5 -0
  41. package/MultiBox/index.js +111 -115
  42. package/Notification/index.js +105 -103
  43. package/OperateBtn/index.d.ts +3 -0
  44. package/OperateBtn/index.js +77 -107
  45. package/PageHeader/index.js +327 -406
  46. package/Pagination/index.js +107 -137
  47. package/ParauiProvider/index.js +20 -22
  48. package/PasswordRules/index.js +36 -40
  49. package/PopConfirm/index.js +60 -77
  50. package/Popover/index.js +12 -12
  51. package/Progress/index.js +72 -74
  52. package/Querying/index.js +22 -23
  53. package/README.md +2 -0
  54. package/Radio/index.js +27 -34
  55. package/RadioGroup/index.js +38 -52
  56. package/Search/index.js +34 -43
  57. package/Select/index.js +281 -345
  58. package/SelectInput/index.js +8 -13
  59. package/Selector/index.js +905 -796
  60. package/SelectorPicker/index.js +111 -133
  61. package/SingleBox/index.d.ts +5 -0
  62. package/SingleBox/index.js +92 -88
  63. package/Slider/index.js +46 -57
  64. package/Status/index.js +14 -13
  65. package/Stepper/index.js +25 -26
  66. package/Styles/theme.scss +9 -9
  67. package/Switch/index.js +32 -35
  68. package/Table/index.js +767 -963
  69. package/Tabs/index.js +102 -102
  70. package/Tag/index.js +115 -162
  71. package/TextEditor/index.js +81 -103
  72. package/TextField/index.js +142 -183
  73. package/TimePicker/index.js +27 -28
  74. package/Timeline/index.js +67 -58
  75. package/Title/index.js +32 -34
  76. package/ToggleButton/index.js +53 -52
  77. package/Tooltip/index.js +79 -82
  78. package/Transfer/index.js +159 -201
  79. package/Tree/index.js +7 -12
  80. package/Upload/index.js +523 -758
  81. package/Upload/interface.d.ts +2 -0
  82. package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
  83. package/_verture/{index-5a7e2438.js → index-0ced30f7.js} +1127 -1079
  84. package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
  85. package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
  86. package/_verture/index-da9097d3.js +239 -0
  87. package/_verture/{index-9331b116.js → index-ef1235fb.js} +125 -134
  88. package/_verture/{index-b1f80962.js → index-f186b5e8.js} +314 -398
  89. package/_verture/intl-f2f27722.js +69 -0
  90. package/_verture/{modalContext-736ff215.js → modalContext-5df08980.js} +36 -64
  91. package/_verture/{slicedToArray-a8206399.js → slicedToArray-8223a2ef.js} +15 -2
  92. package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
  93. package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
  94. package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
  95. package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
  96. package/_verture/{utils-418da0a4.js → utils-46e99c9a.js} +34 -25
  97. package/index.js +21 -22
  98. package/locale/index.js +6 -6
  99. package/package.json +1 -1
  100. package/umd/AutoBox.js +9 -8
  101. package/umd/AutoTips.js +9 -8
  102. package/umd/Badge.js +1 -1
  103. package/umd/Breadcrumbs.js +9 -8
  104. package/umd/Button.js +9 -8
  105. package/umd/ButtonGroup.js +9 -8
  106. package/umd/Carousel.js +5 -5
  107. package/umd/Cascader.js +9 -8
  108. package/umd/Checkbox.js +9 -8
  109. package/umd/CheckboxGroup.js +9 -8
  110. package/umd/Collapse.js +8 -7
  111. package/umd/CollapseBox.js +1 -1
  112. package/umd/CollapseLayout.js +4 -4
  113. package/umd/ColorPicker.js +1 -1
  114. package/umd/ComboSelect.js +9 -8
  115. package/umd/Container.js +1 -1
  116. package/umd/CopyText.js +9 -8
  117. package/umd/DatePicker.js +9 -8
  118. package/umd/Descriptions.js +9 -8
  119. package/umd/Desktop.js +9 -8
  120. package/umd/DragVerify.js +4 -4
  121. package/umd/Drawer.js +9 -8
  122. package/umd/Dropdown.js +6 -5
  123. package/umd/DynamicMultiBox.js +11 -10
  124. package/umd/Empty.js +1 -1
  125. package/umd/Form.js +9 -8
  126. package/umd/FormItem.js +9 -8
  127. package/umd/FunctionModal.js +9 -8
  128. package/umd/GlobalContext.js +1 -1
  129. package/umd/Help.js +9 -8
  130. package/umd/HelperText.js +1 -1
  131. package/umd/InputLang.js +9 -8
  132. package/umd/InputNumber.js +9 -8
  133. package/umd/Label.js +9 -8
  134. package/umd/Loading.js +4 -4
  135. package/umd/Menu.js +4 -4
  136. package/umd/Message.js +4 -4
  137. package/umd/Modal.js +9 -8
  138. package/umd/MultiBox.js +9 -8
  139. package/umd/Notification.js +8 -7
  140. package/umd/OperateBtn.js +9 -8
  141. package/umd/PageHeader.js +9 -8
  142. package/umd/Pagination.js +9 -8
  143. package/umd/ParauiProvider.js +1 -1
  144. package/umd/PasswordRules.js +4 -4
  145. package/umd/PopConfirm.js +9 -8
  146. package/umd/Popover.js +9 -8
  147. package/umd/Progress.js +5 -5
  148. package/umd/Querying.js +1 -1
  149. package/umd/Radio.js +9 -8
  150. package/umd/RadioGroup.js +9 -8
  151. package/umd/Search.js +9 -8
  152. package/umd/Select.js +9 -8
  153. package/umd/SelectInput.js +9 -8
  154. package/umd/Selector.js +9 -8
  155. package/umd/SelectorPicker.js +9 -8
  156. package/umd/SingleBox.js +9 -8
  157. package/umd/Slider.js +6 -5
  158. package/umd/Status.js +4 -4
  159. package/umd/Stepper.js +9 -8
  160. package/umd/Switch.js +9 -8
  161. package/umd/Table.js +9 -8
  162. package/umd/Tabs.js +9 -8
  163. package/umd/Tag.js +9 -8
  164. package/umd/TextEditor.js +22 -21
  165. package/umd/TextField.js +9 -8
  166. package/umd/TimePicker.js +9 -8
  167. package/umd/Timeline.js +1 -1
  168. package/umd/Title.js +9 -8
  169. package/umd/ToggleButton.js +9 -8
  170. package/umd/Tooltip.js +9 -8
  171. package/umd/Transfer.js +10 -9
  172. package/umd/Tree.js +9 -8
  173. package/umd/Upload.js +10 -9
  174. package/umd/locale.js +1 -1
  175. package/_verture/index-232d890b.js +0 -327
  176. package/_verture/index-e9007d6a.js +0 -236
  177. package/_verture/intl-5c1ec055.js +0 -81
  178. package/_verture/toConsumableArray-8f4c9589.js +0 -19
  179. package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
package/Transfer/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
2
- import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
3
1
  import { jsxs, jsx } from 'react/jsx-runtime';
4
2
  import { useRef, useState, useEffect, useCallback } from 'react';
5
3
  import clsx from 'clsx';
@@ -8,26 +6,24 @@ import NavigateBefore from '@para-ui/icons/Left';
8
6
  import Right from '@para-ui/icons/Right';
9
7
  import ExpandLess from '@para-ui/icons/Up';
10
8
  import Down from '@para-ui/icons/Down';
11
- import { u as useFormatMessage } from '../_verture/useFormatMessage-703f8b20.js';
12
- import { $ as $prefixCls } from '../_verture/constant-0d9802f7.js';
9
+ import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
10
+ import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
13
11
  import { Search } from '../Search/index.js';
14
12
  import SearchIcon from '@para-ui/icons/Search';
15
13
  import AutoTips from '../AutoTips/index.js';
16
14
  import Drag from '@para-ui/icons/Drag';
17
15
  import { S as Sortable } from '../_verture/sortable.esm-49896035.js';
18
- import { d as debounce } from '../_verture/utils-418da0a4.js';
16
+ import { d as debounce } from '../_verture/utils-46e99c9a.js';
19
17
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
20
- import '../_verture/unsupportedIterableToArray-cb478f24.js';
21
- import '../_verture/typeof-adeedc13.js';
22
18
  import '../_verture/tslib.es6-55ed4bd2.js';
23
19
  import '@para-ui/icons/LoadingF';
24
20
  import '../Tooltip/index.js';
25
21
  import 'rc-tooltip';
26
22
  import 'rc-tooltip/lib/placements';
27
23
  import '@para-ui/icons/Forbid';
28
- import '../_verture/index-e9007d6a.js';
24
+ import '../_verture/index-da9097d3.js';
29
25
  import 'rc-dropdown';
30
- import '../_verture/usePopupContainer-87febeb9.js';
26
+ import '../_verture/usePopupContainer-635f66f4.js';
31
27
  import 'dayjs';
32
28
  import '@paraview/lib';
33
29
  import '@para-ui/core/GlobalContext';
@@ -40,8 +36,7 @@ import '@para-ui/icons/PreviewOpen';
40
36
  import '@para-ui/icons/CloseCircleF';
41
37
  import '../Loading/index.js';
42
38
  import '../HelperText/index.js';
43
- import '../_verture/useGlobalProps-1b846a65.js';
44
- import '../_verture/defineProperty-1d116156.js';
39
+ import '../_verture/useGlobalProps-1e416658.js';
45
40
 
46
41
  var en = {
47
42
  left: 'Left',
@@ -64,8 +59,8 @@ var zh = {
64
59
  };
65
60
 
66
61
  var localeJson = {
67
- zh: zh,
68
- en: en
62
+ zh,
63
+ en
69
64
  };
70
65
 
71
66
  var useClick = function useClick(callback, doubleCallback) {
@@ -93,36 +88,32 @@ var useClick = function useClick(callback, doubleCallback) {
93
88
  };
94
89
  };
95
90
 
96
- var Box = function Box(props) {
97
- var title = props.title,
98
- data = props.data,
99
- onSearch = props.onSearch,
100
- onchange = props.onchange,
101
- onMove = props.onMove,
102
- queryAll = props.queryAll,
103
- inverse = props.inverse,
104
- direction = props.direction,
105
- fluctuationPosition = props.fluctuationPosition,
106
- fluctuationOrther = props.fluctuationOrther,
107
- onEndSort = props.onEndSort,
108
- multiple = props.multiple,
109
- rightIcon = props.rightIcon,
110
- style = props.style,
111
- customKey = props.customKey;
112
- var intl = useFormatMessage('Transfer', localeJson);
113
- var _useState = useState([]),
114
- _useState2 = _slicedToArray(_useState, 2),
115
- checkCount = _useState2[0],
116
- setCheckCount = _useState2[1];
117
- var _useState3 = useState(0),
118
- _useState4 = _slicedToArray(_useState3, 2),
119
- disabledCount = _useState4[0],
120
- setDisabledCount = _useState4[1];
121
- var ref = useRef();
122
- useEffect(function () {
123
- var arr = [];
124
- var count = 0;
125
- data.forEach(function (item, index) {
91
+ const Box = props => {
92
+ const {
93
+ title,
94
+ data,
95
+ onSearch,
96
+ onchange,
97
+ onMove,
98
+ queryAll,
99
+ inverse,
100
+ direction,
101
+ fluctuationPosition,
102
+ fluctuationOrther,
103
+ onEndSort,
104
+ multiple,
105
+ rightIcon,
106
+ style,
107
+ customKey
108
+ } = props;
109
+ const intl = useFormatMessage('Transfer', localeJson);
110
+ const [checkCount, setCheckCount] = useState([]);
111
+ const [disabledCount, setDisabledCount] = useState(0);
112
+ const ref = useRef();
113
+ useEffect(() => {
114
+ const arr = [];
115
+ let count = 0;
116
+ data.forEach((item, index) => {
126
117
  if (item.checked && !item.hide) {
127
118
  arr.push(index);
128
119
  }
@@ -133,29 +124,29 @@ var Box = function Box(props) {
133
124
  setDisabledCount(count);
134
125
  setCheckCount(arr);
135
126
  }, [data]);
136
- useEffect(function () {
127
+ useEffect(() => {
137
128
  if (direction == 'right') {
138
129
  new Sortable(ref.current, {
139
130
  animation: 180,
140
131
  ghostClass: 'blue-background-class',
141
132
  dragClass: 'drag-item',
142
133
  easing: 'step-start',
143
- onEnd: function onEnd(evt) {
134
+ onEnd: evt => {
144
135
  onEndSort === null || onEndSort === void 0 ? void 0 : onEndSort(evt.oldIndex, evt.newIndex);
145
136
  }
146
137
  });
147
138
  }
148
139
  }, []);
149
- var handler = useClick(function (e, index, item) {
140
+ const handler = useClick((e, index, item) => {
150
141
  if (item.disabled) return;
151
142
  onchange(e, !item.checked, index, direction, multiple);
152
- }, function (e, index, item) {
143
+ }, (e, index, item) => {
153
144
  if (item === null || item === void 0 ? void 0 : item.disabled) return;
154
145
  onchange(e, true, index, direction, false);
155
146
  onMove(direction === 'right' ? 'left' : 'right');
156
147
  });
157
- var itemStyle = function itemStyle(data) {
158
- var stlye = {};
148
+ const itemStyle = data => {
149
+ const stlye = {};
159
150
  if (data === null || data === void 0 ? void 0 : data.tagColor) {
160
151
  stlye.borderLeft = "4px solid ".concat(data.tagColor);
161
152
  }
@@ -180,15 +171,15 @@ var Box = function Box(props) {
180
171
  showBtn: false,
181
172
  rightIcon: jsx(SearchIcon, {}),
182
173
  rightIconExist: true,
183
- onChange: function onChange(val) {
174
+ onChange: val => {
184
175
  onSearch(val, direction);
185
176
  },
186
- onClickRightIcon: function onClickRightIcon(val) {
177
+ onClickRightIcon: val => {
187
178
  onSearch(val, direction);
188
179
  },
189
- onEnter: function onEnter(event) {
180
+ onEnter: event => {
190
181
  var _a;
191
- var val = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.value) || '';
182
+ const val = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.value) || '';
192
183
  onSearch(val, direction);
193
184
  },
194
185
  allowClear: false
@@ -196,11 +187,11 @@ var Box = function Box(props) {
196
187
  className: "context",
197
188
  ref: ref
198
189
  }, {
199
- children: data.map(function (item, index) {
190
+ children: data.map((item, index) => {
200
191
  return jsxs("div", Object.assign({
201
192
  className: clsx('item', (item === null || item === void 0 ? void 0 : item.tagColor) && 'item-border', (item === null || item === void 0 ? void 0 : item.disabled) && 'item-disabled', (item === null || item === void 0 ? void 0 : item.checked) && 'item-checked', fluctuationPosition === index && 'item-fluctuation', fluctuationOrther === index && 'item-fluctuationOrther'),
202
193
  style: itemStyle(item),
203
- onClick: function onClick(e) {
194
+ onClick: e => {
204
195
  handler(e, index, item);
205
196
  }
206
197
  }, {
@@ -232,7 +223,7 @@ var Box = function Box(props) {
232
223
  children: [jsx(Button, Object.assign({
233
224
  variant: "text",
234
225
  className: "".concat(checkCount.length === data.length - disabledCount && data.length > 0 ? 'btn-on' : ''),
235
- onClick: function onClick() {
226
+ onClick: () => {
236
227
  queryAll(checkCount.length !== data.length - disabledCount, direction);
237
228
  }
238
229
  }, {
@@ -243,7 +234,7 @@ var Box = function Box(props) {
243
234
  variant: "text",
244
235
  className: "".concat(checkCount.length === 0 || checkCount.length === data.length - disabledCount ? 'btn-off' : ''),
245
236
  disabled: checkCount.length === 0 || checkCount.length === data.length - disabledCount,
246
- onClick: function onClick() {
237
+ onClick: () => {
247
238
  inverse(direction);
248
239
  }
249
240
  }, {
@@ -259,117 +250,85 @@ var Box = function Box(props) {
259
250
  }))]
260
251
  }));
261
252
  };
262
- var Sortablejs = Sortable;
253
+ const Sortablejs = Sortable;
263
254
 
264
255
  var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-transfer {\n display: flex;\n font-size: 14px;\n user-select: none;\n}\n.paraui-v4-transfer .blue-background-class {\n background-color: rgb(240, 245, 255);\n}\n.paraui-v4-transfer .drag-item {\n background: rgb(255, 255, 255) !important;\n box-shadow: rgba(212, 218, 227, 0.4);\n}\n.paraui-v4-transfer .box {\n border-radius: 4px;\n border: 1px solid rgb(212, 218, 227);\n overflow: hidden;\n}\n.paraui-v4-transfer .box .box-header {\n background: rgb(247, 248, 250);\n color: rgb(29, 33, 38);\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 10px;\n height: 36px;\n border-bottom: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-transfer .box .count {\n color: rgb(29, 33, 38);\n letter-spacing: 1px;\n}\n.paraui-v4-transfer .box .context {\n height: 400px;\n overflow: auto;\n scrollbar-base-color: red;\n margin-top: 4px;\n}\n.paraui-v4-transfer .box .context .item-fluctuation {\n animation: flucturation 0.4s forwards;\n}\n.paraui-v4-transfer .box .context .item-fluctuationOrther {\n animation: flucturationOrther 0.5s forwards;\n}\n.paraui-v4-transfer .box .context .item {\n padding: 0px 10px;\n height: 30px;\n display: flex;\n align-items: center;\n cursor: pointer;\n}\n.paraui-v4-transfer .box .context .item.item-checked:hover {\n background-color: rgb(247, 248, 250) !important;\n}\n.paraui-v4-transfer .box .context .item.item-checked > .item-label {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .context .item > .item-label {\n flex: 1;\n overflow: hidden;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-transfer .box .context .item:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-transfer .box .context .item.item-disabled:hover {\n background: inherit;\n cursor: no-drop;\n}\n.paraui-v4-transfer .box .context .item.item-disabled > .item-label {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .context .item .handle {\n margin-left: 8px;\n display: flex;\n align-content: center;\n}\n.paraui-v4-transfer .box .context .item .handle .handle-line {\n height: 12px;\n border-left: 1px solid rgb(212, 218, 227);\n margin: auto 10px auto 0;\n}\n.paraui-v4-transfer .box .context .item .handle svg {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-transfer .box .context .item .handle:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .context .item-border {\n padding-left: 6px;\n}\n.paraui-v4-transfer .box .text-field-content {\n border: none;\n border-radius: 0;\n border-bottom: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-transfer .box .footer {\n display: flex;\n align-items: center;\n border-top: 1px solid rgb(212, 218, 227);\n height: 36px;\n justify-content: space-between;\n padding: 0 10px;\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) button {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) button:hover {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) .btn-off {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) .btn-off:hover {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) > button {\n padding: 0;\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) > button:nth-child(2) {\n margin-left: 16px;\n}\n.paraui-v4-transfer ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: rgba(255, 255, 255, 0.5);\n}\n.paraui-v4-transfer .moveBtn {\n display: flex;\n height: 500px;\n flex-direction: column;\n justify-content: center;\n margin: 0 20px;\n}\n.paraui-v4-transfer .moveBtn > button {\n background-color: rgb(46, 101, 230);\n color: rgb(255, 255, 255);\n}\n.paraui-v4-transfer .moveBtn .btn-left {\n margin-top: 16px;\n}\n\n@keyframes flucturation {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(36px);\n }\n}\n@keyframes flucturationOrther {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(-36px);\n }\n}";
265
256
  styleInject(css_248z);
266
257
 
267
- var Transfer = function Transfer(props) {
258
+ const Transfer = props => {
268
259
  var _a, _b, _c, _d;
269
- var intl = useFormatMessage('Transfer', localeJson);
270
- var _props$data = props.data,
271
- data = _props$data === void 0 ? [] : _props$data,
272
- value = props.value,
273
- _props$customKey = props.customKey,
274
- customKey = _props$customKey === void 0 ? 'key' : _props$customKey,
275
- onChange = props.onChange,
276
- _props$titles = props.titles,
277
- titles = _props$titles === void 0 ? [intl({
260
+ const intl = useFormatMessage('Transfer', localeJson);
261
+ const {
262
+ data = [],
263
+ value,
264
+ customKey = 'key',
265
+ onChange,
266
+ titles = [intl({
278
267
  id: 'left'
279
268
  }), intl({
280
269
  id: 'right'
281
- })] : _props$titles,
282
- className = props.className,
283
- _props$style = props.style,
284
- style = _props$style === void 0 ? {
270
+ })],
271
+ // ['左侧', '右侧']
272
+ className,
273
+ style = {
285
274
  width: '298px'
286
- } : _props$style,
287
- onSort = props.onSort,
288
- _props$trim = props.trim,
289
- trim = _props$trim === void 0 ? false : _props$trim,
290
- _props$multiple = props.multiple,
291
- multiple = _props$multiple === void 0 ? true : _props$multiple,
292
- rightIcon = props.rightIcon,
293
- _props$render = props.render,
294
- render = _props$render === void 0 ? function (item) {} : _props$render;
295
- var _useState = useState({}),
296
- _useState2 = _slicedToArray(_useState, 2),
297
- transData = _useState2[0],
298
- setTransData = _useState2[1];
299
- var _useState3 = useState([]),
300
- _useState4 = _slicedToArray(_useState3, 2),
301
- leftData = _useState4[0],
302
- setLeftData = _useState4[1];
303
- var _useState5 = useState([]),
304
- _useState6 = _slicedToArray(_useState5, 2),
305
- rightData = _useState6[0],
306
- setRightData = _useState6[1];
307
- var _useState7 = useState([]),
308
- _useState8 = _slicedToArray(_useState7, 2),
309
- leftCount = _useState8[0],
310
- setLeftCount = _useState8[1];
311
- var _useState9 = useState([]),
312
- _useState10 = _slicedToArray(_useState9, 2),
313
- rightCount = _useState10[0],
314
- setRightCount = _useState10[1];
315
- var _useState11 = useState(),
316
- _useState12 = _slicedToArray(_useState11, 2),
317
- fluctuationPosition = _useState12[0];
318
- _useState12[1];
319
- var _useState13 = useState(),
320
- _useState14 = _slicedToArray(_useState13, 2),
321
- fluctuationOrther = _useState14[0];
322
- _useState14[1];
323
- var _useState15 = useState(false),
324
- _useState16 = _slicedToArray(_useState15, 2),
325
- animationsLock = _useState16[0],
326
- setAnimationLock = _useState16[1];
327
- var onchange = useCallback(function (e, bol, index, direction, multiple) {
275
+ },
276
+ onSort,
277
+ trim = false,
278
+ multiple = true,
279
+ rightIcon,
280
+ render = item => {}
281
+ } = props;
282
+ const [transData, setTransData] = useState({});
283
+ const [leftData, setLeftData] = useState([]);
284
+ const [rightData, setRightData] = useState([]);
285
+ const [leftCount, setLeftCount] = useState([]);
286
+ const [rightCount, setRightCount] = useState([]);
287
+ const [fluctuationPosition, setFluctuationPosition] = useState();
288
+ const [fluctuationOrther, setFluctuationOrther] = useState();
289
+ const [animationsLock, setAnimationLock] = useState(false);
290
+ const onchange = useCallback((e, bol, index, direction, multiple) => {
328
291
  if (direction === 'left') {
329
- !multiple && leftData.forEach(function (item) {
330
- return item.checked = false;
331
- });
292
+ !multiple && leftData.forEach(item => item.checked = false);
332
293
  leftData[index].checked = bol;
333
- setLeftData(_toConsumableArray(leftData));
294
+ setLeftData([...leftData]);
334
295
  } else {
335
- !multiple && rightData.forEach(function (item) {
336
- return item.checked = false;
337
- });
296
+ !multiple && rightData.forEach(item => item.checked = false);
338
297
  rightData[index].checked = bol;
339
- setRightData(_toConsumableArray(rightData));
298
+ setRightData([...rightData]);
340
299
  }
341
300
  }, [leftData, rightData]);
342
- var queryAll = useCallback(function (checked, direction) {
301
+ const queryAll = useCallback((checked, direction) => {
343
302
  if (direction === 'left') {
344
- leftData.forEach(function (item) {
303
+ leftData.forEach(item => {
345
304
  if (!item.disabled && !item.hide) item.checked = checked;
346
305
  });
347
- setLeftData(_toConsumableArray(leftData));
306
+ setLeftData([...leftData]);
348
307
  } else {
349
- rightData.forEach(function (item) {
308
+ rightData.forEach(item => {
350
309
  if (!item.disabled && !item.hide) item.checked = checked;
351
310
  });
352
- setRightData(_toConsumableArray(rightData));
311
+ setRightData([...rightData]);
353
312
  }
354
313
  }, [leftData, rightData]);
355
- var inverse = useCallback(function (direction) {
314
+ const inverse = useCallback(direction => {
356
315
  if (direction === 'left') {
357
- leftData.forEach(function (item) {
316
+ leftData.forEach(item => {
358
317
  if (!item.disabled && !item.hide) item.checked = !item.checked;
359
318
  });
360
- setLeftData(_toConsumableArray(leftData));
319
+ setLeftData([...leftData]);
361
320
  } else {
362
- rightData.forEach(function (item) {
321
+ rightData.forEach(item => {
363
322
  if (!item.disabled && !item.hide) item.checked = !item.checked;
364
323
  });
365
- setRightData(_toConsumableArray(rightData));
324
+ setRightData([...rightData]);
366
325
  }
367
326
  }, [leftData, rightData]);
368
- var onMove = function onMove(direction) {
369
- var newData = [];
327
+ const onMove = direction => {
328
+ let newData = [];
370
329
  if (direction === 'left') {
371
- newData = _toConsumableArray(rightData);
372
- newData.forEach(function (item) {
330
+ newData = [...rightData];
331
+ newData.forEach(item => {
373
332
  if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
374
333
  item.checked = false;
375
334
  leftData.push(item);
@@ -377,8 +336,8 @@ var Transfer = function Transfer(props) {
377
336
  }
378
337
  });
379
338
  } else {
380
- newData = _toConsumableArray(leftData);
381
- newData.forEach(function (item) {
339
+ newData = [...leftData];
340
+ newData.forEach(item => {
382
341
  if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
383
342
  item.checked = false;
384
343
  rightData.push(item);
@@ -386,132 +345,131 @@ var Transfer = function Transfer(props) {
386
345
  }
387
346
  });
388
347
  }
389
- setLeftData(_toConsumableArray(leftData));
390
- setRightData(_toConsumableArray(rightData));
391
- var rArr = [];
392
- rightData.forEach(function (item) {
348
+ setLeftData([...leftData]);
349
+ setRightData([...rightData]);
350
+ const rArr = [];
351
+ rightData.forEach(item => {
393
352
  rArr.push(item[customKey]);
394
353
  });
395
354
  onChange === null || onChange === void 0 ? void 0 : onChange(rArr);
396
355
  };
397
356
  // 上下移动
398
- var fluctuation = function fluctuation(direction) {
357
+ const fluctuation = direction => {
399
358
  setAnimationLock(true);
400
359
  if (direction == 'up') {
401
360
  // setFluctuationPosition(rightCount[0] - 1)
402
361
  // setFluctuationOrther(rightCount[0])
403
362
  // setTimeout(() => {
404
- setRightData(function (pre) {
363
+ setRightData(pre => {
405
364
  // setFluctuationPosition(undefined)
406
365
  // setFluctuationOrther(undefined)
407
- rightCount.forEach(function (item) {
408
- pre.splice.apply(pre, [item - 1, 0].concat(_toConsumableArray(pre.splice(item, 1))));
366
+ rightCount.forEach(item => {
367
+ pre.splice(item - 1, 0, ...pre.splice(item, 1));
409
368
  });
410
369
  setAnimationLock(false);
411
- var rArr = [];
412
- pre.forEach(function (item) {
370
+ const rArr = [];
371
+ pre.forEach(item => {
413
372
  rArr.push(item[customKey]);
414
373
  });
415
- onSort === null || onSort === void 0 ? void 0 : onSort([].concat(rArr));
416
- onChange === null || onChange === void 0 ? void 0 : onChange([].concat(rArr));
417
- return _toConsumableArray(pre);
374
+ onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
375
+ onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
376
+ return [...pre];
418
377
  });
419
378
  // }, 400)
420
379
  } else {
421
380
  // setFluctuationPosition(rightCount[0])
422
381
  // setFluctuationOrther(rightCount[0] + 1)
423
382
  // setTimeout(() => {
424
- setRightData(function (pre) {
383
+ setRightData(pre => {
425
384
  // setFluctuationPosition(undefined)
426
385
  // setFluctuationOrther(undefined)
427
- rightCount.reverse().forEach(function (item) {
428
- pre.splice.apply(pre, [item + 1, 0].concat(_toConsumableArray(pre.splice(item, 1))));
386
+ rightCount.reverse().forEach(item => {
387
+ pre.splice(item + 1, 0, ...pre.splice(item, 1));
429
388
  });
430
389
  setAnimationLock(false);
431
- var rArr = [];
432
- pre.forEach(function (item) {
390
+ const rArr = [];
391
+ pre.forEach(item => {
433
392
  rArr.push(item[customKey]);
434
393
  });
435
- onSort === null || onSort === void 0 ? void 0 : onSort([].concat(rArr));
436
- onChange === null || onChange === void 0 ? void 0 : onChange([].concat(rArr));
437
- return _toConsumableArray(pre);
394
+ onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
395
+ onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
396
+ return [...pre];
438
397
  });
439
398
  // }, 400)
440
399
  }
441
400
  };
442
-
443
- var onSearch = debounce(function (e, direction) {
444
- var str = trim ? e.toUpperCase().trim() : e.toUpperCase();
401
+ const onSearch = debounce((e, direction) => {
402
+ const str = trim ? e.toUpperCase().trim() : e.toUpperCase();
445
403
  if (direction === 'left') {
446
- leftData.forEach(function (item) {
404
+ leftData.forEach(item => {
447
405
  item.hide = false;
448
- var name = (item.name || '').toUpperCase();
449
- var description = (item.description || '').toUpperCase();
406
+ const name = (item.name || '').toUpperCase();
407
+ const description = (item.description || '').toUpperCase();
450
408
  if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
451
409
  item.hide = true;
452
410
  }
453
411
  });
454
- setLeftData(_toConsumableArray(leftData));
412
+ setLeftData([...leftData]);
455
413
  } else {
456
- rightData.filter(function (item) {
414
+ rightData.filter(item => {
457
415
  item.hide = false;
458
- var name = (item.name || '').toUpperCase();
459
- var description = (item.description || '').toUpperCase();
416
+ const name = (item.name || '').toUpperCase();
417
+ const description = (item.description || '').toUpperCase();
460
418
  if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
461
419
  item.hide = true;
462
420
  }
463
421
  });
464
- setRightData(_toConsumableArray(rightData));
422
+ setRightData([...rightData]);
465
423
  }
466
424
  }, 500);
467
- var onEndSort = useCallback(function (oldIndex, newIndex) {
468
- setRightData(function (pre) {
469
- pre.splice.apply(pre, [newIndex, 0].concat(_toConsumableArray(pre.splice(oldIndex, 1))));
470
- var rArr = [];
471
- pre.forEach(function (item) {
425
+ const onEndSort = useCallback((oldIndex, newIndex) => {
426
+ setRightData(pre => {
427
+ pre.splice(newIndex, 0, ...pre.splice(oldIndex, 1));
428
+ const rArr = [];
429
+ pre.forEach(item => {
472
430
  rArr.push(item[customKey]);
473
431
  });
474
- onSort === null || onSort === void 0 ? void 0 : onSort([].concat(rArr));
475
- onChange === null || onChange === void 0 ? void 0 : onChange([].concat(rArr));
476
- return _toConsumableArray(pre);
432
+ onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
433
+ onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
434
+ return [...pre];
477
435
  });
478
436
  }, []);
479
- useEffect(function () {
437
+ useEffect(() => {
480
438
  if (data.length) {
481
- var _leftData = {};
482
- data.forEach(function (item) {
483
- var key = item[customKey];
439
+ const leftData = {};
440
+ data.forEach(item => {
441
+ const key = item[customKey];
484
442
  render(item);
485
- _leftData[key] = item;
443
+ leftData[key] = item;
486
444
  });
487
- setTransData(Object.assign({}, _leftData));
445
+ setTransData(Object.assign({}, leftData));
488
446
  }
489
447
  }, [data]);
490
- useEffect(function () {
491
- var rData = [];
492
- var lData = [];
493
- value === null || value === void 0 ? void 0 : value.forEach(function (item) {
448
+ useEffect(() => {
449
+ const rData = [];
450
+ const lData = [];
451
+ value === null || value === void 0 ? void 0 : value.forEach(item => {
494
452
  if (transData[item]) {
495
453
  rData.push(transData[item]);
496
454
  delete transData[item];
497
455
  }
498
456
  });
499
- for (var key in transData) {
457
+ for (const key in transData) {
500
458
  lData.push(transData[key]);
501
459
  }
502
- setRightData([].concat(rData));
503
- setLeftData([].concat(lData));
460
+ setRightData([...rData]);
461
+ setLeftData([...lData]);
504
462
  }, [value, transData]);
505
- useEffect(function () {
506
- var arr = [];
507
- leftData.forEach(function (item, index) {
463
+ useEffect(() => {
464
+ const arr = [];
465
+ leftData.forEach((item, index) => {
508
466
  if (item.checked && !item.hide) {
509
467
  arr.push(index);
510
468
  }
511
469
  });
512
470
  setLeftCount(arr);
513
- var rArr = [];
514
- rightData.forEach(function (item, index) {
471
+ const rArr = [];
472
+ rightData.forEach((item, index) => {
515
473
  if (item.checked && !item.hide) {
516
474
  rArr.push(index);
517
475
  }
@@ -547,7 +505,7 @@ var Transfer = function Transfer(props) {
547
505
  arrow: false,
548
506
  placement: 'bottomLeft'
549
507
  },
550
- onClick: function onClick() {
508
+ onClick: () => {
551
509
  onMove('right');
552
510
  }
553
511
  }, {
@@ -562,7 +520,7 @@ var Transfer = function Transfer(props) {
562
520
  arrow: false,
563
521
  placement: 'bottomLeft'
564
522
  },
565
- onClick: function onClick() {
523
+ onClick: () => {
566
524
  fluctuation('up');
567
525
  }
568
526
  }, {
@@ -577,7 +535,7 @@ var Transfer = function Transfer(props) {
577
535
  arrow: false,
578
536
  placement: 'bottomLeft'
579
537
  },
580
- onClick: function onClick() {
538
+ onClick: () => {
581
539
  fluctuation('down');
582
540
  }
583
541
  }, {
@@ -592,7 +550,7 @@ var Transfer = function Transfer(props) {
592
550
  arrow: false,
593
551
  placement: 'bottomLeft'
594
552
  },
595
- onClick: function onClick() {
553
+ onClick: () => {
596
554
  onMove('left');
597
555
  }
598
556
  }, {
@@ -617,6 +575,6 @@ var Transfer = function Transfer(props) {
617
575
  })]
618
576
  }));
619
577
  };
620
- var SSortablejs = Sortablejs;
578
+ const SSortablejs = Sortablejs;
621
579
 
622
580
  export { SSortablejs, Transfer, Transfer as default };