react-virtual-sortable 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.
- package/LICENSE +21 -21
- package/README.md +147 -147
- package/dist/virtual-list.js +25 -26
- package/dist/virtual-list.min.js +2 -2
- package/package.json +67 -66
- package/types/index.d.ts +77 -77
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 mfuu
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 mfuu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
# react-virtual-sortable
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/react-virtual-sortable) [](https://www.npmjs.com/package/react-virtual-sortable) [](LICENSE)
|
|
4
|
-
|
|
5
|
-
A virtual scrolling list component that can be sorted by dragging
|
|
6
|
-
|
|
7
|
-
### [Live Demo](https://mfuu.github.io/react-virtual-sortable/)
|
|
8
|
-
|
|
9
|
-
## Simple Usage
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm i react-virtual-sortable
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Root component:
|
|
16
|
-
```jsx
|
|
17
|
-
import VirtualList from 'react-virtual-sortable';
|
|
18
|
-
|
|
19
|
-
function Virtual() {
|
|
20
|
-
|
|
21
|
-
const [list, setList] = useState([{id: '1', text: 'a'}, {id: '2', text: 'b'}, ...]);
|
|
22
|
-
|
|
23
|
-
const onDrop = (event) => {
|
|
24
|
-
// dnd complete
|
|
25
|
-
setList(() => event.list);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// use style and className as jsx used
|
|
29
|
-
return (
|
|
30
|
-
<VirtualList
|
|
31
|
-
className="virtual-list"
|
|
32
|
-
style={{ height: '500px' }}
|
|
33
|
-
dataKey="id"
|
|
34
|
-
dataSource={ list }
|
|
35
|
-
handle=".handle"
|
|
36
|
-
header={ <div className="loading">top loading...</div> }
|
|
37
|
-
footer={ <div className="loading">bottom loading...</div> }
|
|
38
|
-
onDrop={ onDrop }
|
|
39
|
-
>
|
|
40
|
-
{
|
|
41
|
-
(record, index, dataKey) => {
|
|
42
|
-
return (
|
|
43
|
-
<div>
|
|
44
|
-
<span className=".handle">{ index }</span>
|
|
45
|
-
{ record.text }
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
</VirtualList>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Props
|
|
56
|
-
|
|
57
|
-
**Callback**
|
|
58
|
-
|
|
59
|
-
| **Emit** | **Type** | **Default** | **Description** |
|
|
60
|
-
| ---------- | ---------- | ----------- | --------------------------------------- |
|
|
61
|
-
| `onTop` | `Function` | - | Scrolling to the top of the scroller |
|
|
62
|
-
| `onBottom` | `Function` | - | Scrolling to the bottom of the scroller |
|
|
63
|
-
| `onDrag` | `Function` | - | Drag is started |
|
|
64
|
-
| `onDrop` | `Function` | - | Drag is complete |
|
|
65
|
-
|
|
66
|
-
**Required props**
|
|
67
|
-
| **Prop** | **Type** | **Default** | **Description** |
|
|
68
|
-
| ------------ | -------- | ----------- | --------------------------------------------------------------------- |
|
|
69
|
-
| `dataKey` | `String` | - | The unique identifier of each piece of data, in the form of `'a.b.c'` |
|
|
70
|
-
| `dataSource` | `Array` | `[]` | The data that needs to be rendered |
|
|
71
|
-
|
|
72
|
-
**Common used**
|
|
73
|
-
|
|
74
|
-
| **Prop** | **Type** | **Default** | **Description** |
|
|
75
|
-
| -------------- | ------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
76
|
-
| `header` | `JSX.Element` | - | Top of list |
|
|
77
|
-
| `footer` | `JSX.Element` | - | Bottom of list |
|
|
78
|
-
| `size` | `Number` | - | Estimated height of each row. You can choose to pass it or not, it will be automatically calculated |
|
|
79
|
-
| `keeps` | `Number` | `30` | The number of lines rendered by the virtual scroll |
|
|
80
|
-
| `handle` | `String` | - | Drag handle selector within list items |
|
|
81
|
-
| `group` | `Object/String` | - | string: 'name' or object: `{ name: 'group', put: true/false, pull: true/false/'clone', revertDrag: true/false }` |
|
|
82
|
-
| `scroller` | `Document \| HTMLElement` | - | Virtual list scrolling element |
|
|
83
|
-
| `direction` | `vertical \| horizontal` | `vertical` | Scroll direction |
|
|
84
|
-
| `debounceTime` | `Number` | `0` | debounce time on scroll |
|
|
85
|
-
| `throttleTime` | `Number` | `0` | debounce time on scroll |
|
|
86
|
-
| `tableMode` | `Boolean` | `false` | display with table and tbody |
|
|
87
|
-
|
|
88
|
-
**Uncommonly used**
|
|
89
|
-
|
|
90
|
-
| **Prop** | **Type** | **Default** | **Description** |
|
|
91
|
-
| ------------------ | --------- | ------------------------- | --------------------------------------------------------------------------- |
|
|
92
|
-
| `draggable` | `String` | `[role="item"]` | Specifies which items inside the element should be draggable |
|
|
93
|
-
| `sortable` | `Boolean` | `true` | Whether the current list can be sorted by dragging |
|
|
94
|
-
| `lockAxis` | `x \| y` | `-` | Axis on which dragging will be locked |
|
|
95
|
-
| `keepOffset` | `Boolean` | `false` | When scrolling up to load data, keep the same offset as the previous scroll |
|
|
96
|
-
| `disabled` | `Boolean` | `false` | Disables the sortable if set to true |
|
|
97
|
-
| `animation` | `Number` | `150` | Drag-and-drop's animation delay |
|
|
98
|
-
| `autoScroll` | `Boolean` | `true` | Automatic scrolling when moving to the edge of the container |
|
|
99
|
-
| `scrollSpeed` | `Object` | `{ x: 10, y: 10 }` | Vertical&Horizontal scrolling speed (px) |
|
|
100
|
-
| `scrollThreshold` | `Number` | `55` | Threshold to trigger autoscroll |
|
|
101
|
-
| `delay` | `Number` | `0` | Time in milliseconds to define when the sorting should start |
|
|
102
|
-
| `delayOnTouchOnly` | `Boolean` | `false` | Only delay on press if user is using touch |
|
|
103
|
-
| `fallbackOnBody` | `Boolean` | `false` | Appends the ghost element into the document's body |
|
|
104
|
-
| `rootTag` | `String` | `div` | Label type for root element |
|
|
105
|
-
| `wrapTag` | `String` | `div` | Label type for list wrap element |
|
|
106
|
-
| `wrapStyle` | `Object` | `{}` | List wrapper element style |
|
|
107
|
-
| `wrapClass` | `String` | `''` | List wrapper element class |
|
|
108
|
-
| `ghostStyle` | `Object` | `{}` | The style of the mask element when dragging |
|
|
109
|
-
| `ghostClass` | `String` | `''` | The class of the mask element when dragging |
|
|
110
|
-
| `chosenClass` | `String` | `''` | Class name for the chosen item |
|
|
111
|
-
| `placeholderClass` | `String` | `''` | Class name for the drop placeholder |
|
|
112
|
-
|
|
113
|
-
## Methods
|
|
114
|
-
Use the methods exposed in the component by setting `ref`
|
|
115
|
-
```jsx
|
|
116
|
-
...
|
|
117
|
-
|
|
118
|
-
const virtualRef = useRef();
|
|
119
|
-
|
|
120
|
-
const scrollToBottom = () => {
|
|
121
|
-
virtualRef.current.scrollToBottom();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<button onClick={ scrollToBottom }></button>
|
|
126
|
-
<virtualList
|
|
127
|
-
ref={ virtualRef }
|
|
128
|
-
...
|
|
129
|
-
>
|
|
130
|
-
{
|
|
131
|
-
(record) => <div>{ record.text }</div>
|
|
132
|
-
}
|
|
133
|
-
</virtualList>
|
|
134
|
-
)
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
| **Prop** | **Description** |
|
|
138
|
-
| ------------------------ | ---------------------------------------------------------- |
|
|
139
|
-
| `getSize(key)` | get the height of the specified item by key value |
|
|
140
|
-
| `getOffset()` | get the current scroll top/left |
|
|
141
|
-
| `getClientSize()` | Get wrapper element client viewport size (width or height) |
|
|
142
|
-
| `getScrollSize()` | Get all scroll size (scrollHeight or scrollWidth) |
|
|
143
|
-
| `scrollToTop()` | scroll to the top of the list |
|
|
144
|
-
| `scrollToBottom()` | scroll to the bottom of the list |
|
|
145
|
-
| `scrollToKey(key)` | scroll to the specified data-key |
|
|
146
|
-
| `scrollToIndex(index)` | scroll to the specified index value |
|
|
147
|
-
| `scrollToOffset(offset)` | scroll to the specified height |
|
|
1
|
+
# react-virtual-sortable
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/react-virtual-sortable) [](https://www.npmjs.com/package/react-virtual-sortable) [](LICENSE)
|
|
4
|
+
|
|
5
|
+
A virtual scrolling list component that can be sorted by dragging
|
|
6
|
+
|
|
7
|
+
### [Live Demo](https://mfuu.github.io/react-virtual-sortable/)
|
|
8
|
+
|
|
9
|
+
## Simple Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i react-virtual-sortable
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Root component:
|
|
16
|
+
```jsx
|
|
17
|
+
import VirtualList from 'react-virtual-sortable';
|
|
18
|
+
|
|
19
|
+
function Virtual() {
|
|
20
|
+
|
|
21
|
+
const [list, setList] = useState([{id: '1', text: 'a'}, {id: '2', text: 'b'}, ...]);
|
|
22
|
+
|
|
23
|
+
const onDrop = (event) => {
|
|
24
|
+
// dnd complete
|
|
25
|
+
setList(() => event.list);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// use style and className as jsx used
|
|
29
|
+
return (
|
|
30
|
+
<VirtualList
|
|
31
|
+
className="virtual-list"
|
|
32
|
+
style={{ height: '500px' }}
|
|
33
|
+
dataKey="id"
|
|
34
|
+
dataSource={ list }
|
|
35
|
+
handle=".handle"
|
|
36
|
+
header={ <div className="loading">top loading...</div> }
|
|
37
|
+
footer={ <div className="loading">bottom loading...</div> }
|
|
38
|
+
onDrop={ onDrop }
|
|
39
|
+
>
|
|
40
|
+
{
|
|
41
|
+
(record, index, dataKey) => {
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
<span className=".handle">{ index }</span>
|
|
45
|
+
{ record.text }
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</VirtualList>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Props
|
|
56
|
+
|
|
57
|
+
**Callback**
|
|
58
|
+
|
|
59
|
+
| **Emit** | **Type** | **Default** | **Description** |
|
|
60
|
+
| ---------- | ---------- | ----------- | --------------------------------------- |
|
|
61
|
+
| `onTop` | `Function` | - | Scrolling to the top of the scroller |
|
|
62
|
+
| `onBottom` | `Function` | - | Scrolling to the bottom of the scroller |
|
|
63
|
+
| `onDrag` | `Function` | - | Drag is started |
|
|
64
|
+
| `onDrop` | `Function` | - | Drag is complete |
|
|
65
|
+
|
|
66
|
+
**Required props**
|
|
67
|
+
| **Prop** | **Type** | **Default** | **Description** |
|
|
68
|
+
| ------------ | -------- | ----------- | --------------------------------------------------------------------- |
|
|
69
|
+
| `dataKey` | `String` | - | The unique identifier of each piece of data, in the form of `'a.b.c'` |
|
|
70
|
+
| `dataSource` | `Array` | `[]` | The data that needs to be rendered |
|
|
71
|
+
|
|
72
|
+
**Common used**
|
|
73
|
+
|
|
74
|
+
| **Prop** | **Type** | **Default** | **Description** |
|
|
75
|
+
| -------------- | ------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
76
|
+
| `header` | `JSX.Element` | - | Top of list |
|
|
77
|
+
| `footer` | `JSX.Element` | - | Bottom of list |
|
|
78
|
+
| `size` | `Number` | - | Estimated height of each row. You can choose to pass it or not, it will be automatically calculated |
|
|
79
|
+
| `keeps` | `Number` | `30` | The number of lines rendered by the virtual scroll |
|
|
80
|
+
| `handle` | `String` | - | Drag handle selector within list items |
|
|
81
|
+
| `group` | `Object/String` | - | string: 'name' or object: `{ name: 'group', put: true/false, pull: true/false/'clone', revertDrag: true/false }` |
|
|
82
|
+
| `scroller` | `Document \| HTMLElement` | - | Virtual list scrolling element |
|
|
83
|
+
| `direction` | `vertical \| horizontal` | `vertical` | Scroll direction |
|
|
84
|
+
| `debounceTime` | `Number` | `0` | debounce time on scroll |
|
|
85
|
+
| `throttleTime` | `Number` | `0` | debounce time on scroll |
|
|
86
|
+
| `tableMode` | `Boolean` | `false` | display with table and tbody |
|
|
87
|
+
|
|
88
|
+
**Uncommonly used**
|
|
89
|
+
|
|
90
|
+
| **Prop** | **Type** | **Default** | **Description** |
|
|
91
|
+
| ------------------ | --------- | ------------------------- | --------------------------------------------------------------------------- |
|
|
92
|
+
| `draggable` | `String` | `[role="item"]` | Specifies which items inside the element should be draggable |
|
|
93
|
+
| `sortable` | `Boolean` | `true` | Whether the current list can be sorted by dragging |
|
|
94
|
+
| `lockAxis` | `x \| y` | `-` | Axis on which dragging will be locked |
|
|
95
|
+
| `keepOffset` | `Boolean` | `false` | When scrolling up to load data, keep the same offset as the previous scroll |
|
|
96
|
+
| `disabled` | `Boolean` | `false` | Disables the sortable if set to true |
|
|
97
|
+
| `animation` | `Number` | `150` | Drag-and-drop's animation delay |
|
|
98
|
+
| `autoScroll` | `Boolean` | `true` | Automatic scrolling when moving to the edge of the container |
|
|
99
|
+
| `scrollSpeed` | `Object` | `{ x: 10, y: 10 }` | Vertical&Horizontal scrolling speed (px) |
|
|
100
|
+
| `scrollThreshold` | `Number` | `55` | Threshold to trigger autoscroll |
|
|
101
|
+
| `delay` | `Number` | `0` | Time in milliseconds to define when the sorting should start |
|
|
102
|
+
| `delayOnTouchOnly` | `Boolean` | `false` | Only delay on press if user is using touch |
|
|
103
|
+
| `fallbackOnBody` | `Boolean` | `false` | Appends the ghost element into the document's body |
|
|
104
|
+
| `rootTag` | `String` | `div` | Label type for root element |
|
|
105
|
+
| `wrapTag` | `String` | `div` | Label type for list wrap element |
|
|
106
|
+
| `wrapStyle` | `Object` | `{}` | List wrapper element style |
|
|
107
|
+
| `wrapClass` | `String` | `''` | List wrapper element class |
|
|
108
|
+
| `ghostStyle` | `Object` | `{}` | The style of the mask element when dragging |
|
|
109
|
+
| `ghostClass` | `String` | `''` | The class of the mask element when dragging |
|
|
110
|
+
| `chosenClass` | `String` | `''` | Class name for the chosen item |
|
|
111
|
+
| `placeholderClass` | `String` | `''` | Class name for the drop placeholder |
|
|
112
|
+
|
|
113
|
+
## Methods
|
|
114
|
+
Use the methods exposed in the component by setting `ref`
|
|
115
|
+
```jsx
|
|
116
|
+
...
|
|
117
|
+
|
|
118
|
+
const virtualRef = useRef();
|
|
119
|
+
|
|
120
|
+
const scrollToBottom = () => {
|
|
121
|
+
virtualRef.current.scrollToBottom();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<button onClick={ scrollToBottom }></button>
|
|
126
|
+
<virtualList
|
|
127
|
+
ref={ virtualRef }
|
|
128
|
+
...
|
|
129
|
+
>
|
|
130
|
+
{
|
|
131
|
+
(record) => <div>{ record.text }</div>
|
|
132
|
+
}
|
|
133
|
+
</virtualList>
|
|
134
|
+
)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| **Prop** | **Description** |
|
|
138
|
+
| ------------------------ | ---------------------------------------------------------- |
|
|
139
|
+
| `getSize(key)` | get the height of the specified item by key value |
|
|
140
|
+
| `getOffset()` | get the current scroll top/left |
|
|
141
|
+
| `getClientSize()` | Get wrapper element client viewport size (width or height) |
|
|
142
|
+
| `getScrollSize()` | Get all scroll size (scrollHeight or scrollWidth) |
|
|
143
|
+
| `scrollToTop()` | scroll to the top of the list |
|
|
144
|
+
| `scrollToBottom()` | scroll to the bottom of the list |
|
|
145
|
+
| `scrollToKey(key)` | scroll to the specified data-key |
|
|
146
|
+
| `scrollToIndex(index)` | scroll to the specified index value |
|
|
147
|
+
| `scrollToOffset(offset)` | scroll to the specified height |
|
package/dist/virtual-list.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-virtual-sortable v1.0.
|
|
2
|
+
* react-virtual-sortable v1.0.3
|
|
3
3
|
* open source under the MIT license
|
|
4
4
|
* https://github.com/mfuu/react-virtual-sortable#readme
|
|
5
5
|
*/
|
|
@@ -144,10 +144,10 @@
|
|
|
144
144
|
|
|
145
145
|
var sortableDnd_min = {exports: {}};
|
|
146
146
|
|
|
147
|
-
/*!
|
|
148
|
-
* sortable-dnd v0.6.23
|
|
149
|
-
* open source under the MIT license
|
|
150
|
-
* https://github.com/mfuu/sortable-dnd#readme
|
|
147
|
+
/*!
|
|
148
|
+
* sortable-dnd v0.6.23
|
|
149
|
+
* open source under the MIT license
|
|
150
|
+
* https://github.com/mfuu/sortable-dnd#readme
|
|
151
151
|
*/
|
|
152
152
|
sortableDnd_min.exports;
|
|
153
153
|
(function (module, exports) {
|
|
@@ -934,7 +934,7 @@
|
|
|
934
934
|
return result;
|
|
935
935
|
}
|
|
936
936
|
function isSameValue(a, b) {
|
|
937
|
-
return a == b;
|
|
937
|
+
return a === 0 ? a === b : a == b;
|
|
938
938
|
}
|
|
939
939
|
function getDataKey(item, dataKey) {
|
|
940
940
|
return (!Array.isArray(dataKey) ? dataKey.replace(/\[/g, '.').replace(/\]/g, '.').split('.') : dataKey).reduce(function (o, k) {
|
|
@@ -1695,46 +1695,46 @@
|
|
|
1695
1695
|
var uniqueKeys = React__namespace.useRef([]);
|
|
1696
1696
|
var rootRef = React__namespace.useRef();
|
|
1697
1697
|
var wrapRef = React__namespace.useRef();
|
|
1698
|
-
/**
|
|
1699
|
-
* git item size by data-key
|
|
1698
|
+
/**
|
|
1699
|
+
* git item size by data-key
|
|
1700
1700
|
*/
|
|
1701
1701
|
var getSize = function getSize(key) {
|
|
1702
1702
|
return virtualRef.current.getSize(key);
|
|
1703
1703
|
};
|
|
1704
|
-
/**
|
|
1705
|
-
* Get the current scroll height
|
|
1704
|
+
/**
|
|
1705
|
+
* Get the current scroll height
|
|
1706
1706
|
*/
|
|
1707
1707
|
var getOffset = function getOffset() {
|
|
1708
1708
|
return virtualRef.current.getOffset();
|
|
1709
1709
|
};
|
|
1710
|
-
/**
|
|
1711
|
-
* Get client viewport size
|
|
1710
|
+
/**
|
|
1711
|
+
* Get client viewport size
|
|
1712
1712
|
*/
|
|
1713
1713
|
var getClientSize = function getClientSize() {
|
|
1714
1714
|
return virtualRef.current.getClientSize();
|
|
1715
1715
|
};
|
|
1716
|
-
/**
|
|
1717
|
-
* Get all scroll size
|
|
1716
|
+
/**
|
|
1717
|
+
* Get all scroll size
|
|
1718
1718
|
*/
|
|
1719
1719
|
var getScrollSize = function getScrollSize() {
|
|
1720
1720
|
return virtualRef.current.getScrollSize();
|
|
1721
1721
|
};
|
|
1722
|
-
/**
|
|
1723
|
-
* Scroll to the specified offset
|
|
1722
|
+
/**
|
|
1723
|
+
* Scroll to the specified offset
|
|
1724
1724
|
*/
|
|
1725
1725
|
var scrollToOffset = function scrollToOffset(offset) {
|
|
1726
1726
|
var _a;
|
|
1727
1727
|
(_a = virtualRef.current) === null || _a === void 0 ? void 0 : _a.scrollToOffset(offset);
|
|
1728
1728
|
};
|
|
1729
|
-
/**
|
|
1730
|
-
* Scroll to the specified index position
|
|
1729
|
+
/**
|
|
1730
|
+
* Scroll to the specified index position
|
|
1731
1731
|
*/
|
|
1732
1732
|
var scrollToIndex = function scrollToIndex(index) {
|
|
1733
1733
|
var _a;
|
|
1734
1734
|
(_a = virtualRef.current) === null || _a === void 0 ? void 0 : _a.scrollToIndex(index);
|
|
1735
1735
|
};
|
|
1736
|
-
/**
|
|
1737
|
-
* Scroll to the specified data-key position
|
|
1736
|
+
/**
|
|
1737
|
+
* Scroll to the specified data-key position
|
|
1738
1738
|
*/
|
|
1739
1739
|
var scrollToKey = function scrollToKey(key) {
|
|
1740
1740
|
var _a;
|
|
@@ -1743,14 +1743,14 @@
|
|
|
1743
1743
|
(_a = virtualRef.current) === null || _a === void 0 ? void 0 : _a.scrollToIndex(index);
|
|
1744
1744
|
}
|
|
1745
1745
|
};
|
|
1746
|
-
/**
|
|
1747
|
-
* Scroll to top of list
|
|
1746
|
+
/**
|
|
1747
|
+
* Scroll to top of list
|
|
1748
1748
|
*/
|
|
1749
1749
|
var scrollToTop = function scrollToTop() {
|
|
1750
1750
|
scrollToOffset(0);
|
|
1751
1751
|
};
|
|
1752
|
-
/**
|
|
1753
|
-
* Scroll to bottom of list
|
|
1752
|
+
/**
|
|
1753
|
+
* Scroll to bottom of list
|
|
1754
1754
|
*/
|
|
1755
1755
|
var scrollToBottom = function scrollToBottom() {
|
|
1756
1756
|
var _a;
|
|
@@ -1953,9 +1953,8 @@
|
|
|
1953
1953
|
return;
|
|
1954
1954
|
}
|
|
1955
1955
|
var sizes = (_a = virtualRef.current) === null || _a === void 0 ? void 0 : _a.sizes.size;
|
|
1956
|
-
var renders = Math.min(keeps, dataSource.length);
|
|
1957
1956
|
(_b = virtualRef.current) === null || _b === void 0 ? void 0 : _b.onItemResized(key, size);
|
|
1958
|
-
if (sizes ===
|
|
1957
|
+
if (sizes === keeps - 1 && dataSource.length > keeps) {
|
|
1959
1958
|
virtualRef.current.updateRange(Object.assign({}, range));
|
|
1960
1959
|
}
|
|
1961
1960
|
};
|
package/dist/virtual-list.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-virtual-sortable v1.0.
|
|
2
|
+
* react-virtual-sortable v1.0.3
|
|
3
3
|
* open source under the MIT license
|
|
4
4
|
* https://github.com/mfuu/react-virtual-sortable#readme
|
|
5
5
|
*/
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* sortable-dnd v0.6.23
|
|
9
9
|
* open source under the MIT license
|
|
10
10
|
* https://github.com/mfuu/sortable-dnd#readme
|
|
11
|
-
*/!function(t,e){t.exports=function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},t.apply(null,arguments)}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var n={capture:!1,passive:!1},o=/\s+/g;function i(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var r=i(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),s=i(/Edge/i),l=i(/safari/i)&&!i(/chrome/i)&&!i(/android/i),a=function(){var t=!1;return document.addEventListener("checkIfSupportPassive",null,{get passive(){return t=!0,!0}}),t}();function c(t,e,o){window.addEventListener?t.addEventListener(e,o,!(!a&&r)&&n):window.attachEvent?t.attachEvent("on"+e,o):t["on"+e]=o}function u(t,e,o){window.removeEventListener?t.removeEventListener(e,o,!(!a&&r)&&n):window.detachEvent?t.detachEvent("on"+e,o):t["on"+e]=null}function h(){return document.scrollingElement||document.documentElement}function d(t,e,n){if(t.getBoundingClientRect||t===window){var o,i,r,s,l,a,c;if(t!==window&&t.parentNode&&t!==h()?(i=(o=t.getBoundingClientRect()).top,r=o.left,s=o.bottom,l=o.right,a=o.height,c=o.width):(i=0,r=0,s=window.innerHeight,l=window.innerWidth,a=window.innerHeight,c=window.innerWidth),e&&t!==window){n=n||t.parentNode;do{if(n&&n.getBoundingClientRect){var u=n.getBoundingClientRect();i-=u.top+parseInt(w(n,"border-top-width")),r-=u.left+parseInt(w(n,"border-left-width")),s=i+o.height,l=r+o.width;break}}while(n=n.parentNode)}return{top:i,left:r,bottom:s,right:l,width:c,height:a}}}function f(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&S(t,e):S(t,e))||o&&t===n)return t;if(t===n)break}while(t=t.parentNode);return null}}function p(t,e){if(!t||!e)return!1;if(e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return!0;return!1}function v(t,e){for(var n=t.lastElementChild;n&&(n===ot.ghost||"none"===w(n,"display")||e&&!S(n,e));)n=n.previousElementSibling;return n||null}function g(t,e){if(!t||!t.parentNode)return-1;for(var n=0;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!S(t,e)||"none"===w(t,"display")||n++;return n}function m(t,e,n,o){for(var i=0,r=0,s=t.children;i<s.length;){if(s[i]!==ot.ghost&&"none"!==w(s[i],"display")&&f(s[i],n,t,!1)&&(o||s[i]!==ot.dragged)){if(r===e)return s[i];r++}i++}return null}function y(t,e){var n=w(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=m(t,0,e),l=m(t,1,e),a=i&&w(i),c=l&&w(l),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+d(i).width,h=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+d(l).width,f=s||r?"cssFloat":"float";if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&"none"!==a.float){var p="left"===a.float?"left":"right";return!l||"both"!==c.clear&&c.clear!==p?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||u>=o&&"none"===n[f]||l&&"none"===n[f]&&u+h>o)?"vertical":"horizontal"}function b(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(o," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(o," ")}}function S(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function w(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function x(t,e){var n,o,i=(o=e,(n=t).compareDocumentPosition?n.compareDocumentPosition(o):n.contains?(n!=o&&n.contains(o)&&16)+(n!=o&&o.contains(n)&&8)+(n.sourceIndex>=0&&o.sourceIndex>=0?(n.sourceIndex<o.sourceIndex&&4)+(n.sourceIndex>o.sourceIndex&&2):1):0);return 2===i?1:4===i?-1:0}function k(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function E(e){var n=e.sortable,o=e.name,i=e.evt,r=n.options[o];"function"==typeof r&&r(t({},i))}!function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"];(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1]}();var O,I,T,z="Sortable"+Date.now();function C(t){this.options=t,this.scrollEl=null,this.autoScrollInterval=null}function D(t){this.options=t,this.stack=[]}function _(t){this.options=t||{},this.selects=[]}C.prototype={nulling:function(){this.autoScrollInterval&&(clearInterval(this.autoScrollInterval),this.autoScrollInterval=null)},onStarted:function(){var t=this;this.nulling(),this.autoScrollInterval=setInterval((function(){t.autoScroll()}))},onMove:function(t,e,n){this.options=n,this.scrollEl=t,this.moveEvent=e},autoScroll:function(){var t=this.moveEvent,e=this.scrollEl;if(e&&void 0!==t.clientX&&void 0!==t.clientY){var n=d(e);if(n){var o=t.clientX,i=t.clientY,r=n.top,s=n.right,l=n.bottom,a=n.left,c=n.height,u=n.width;if(!(i<r||o>s||i>l||o<a)){var h=this.options,f=h.scrollThreshold,p=h.scrollSpeed,v=e.scrollTop,g=e.scrollLeft,m=e.scrollHeight,y=v>0&&i>=r&&i<=r+f,b=g+u<e.scrollWidth&&o<=s&&o>=s-f,S=v+c<m&&i<=l&&i>=l-f;g>0&&o>=a&&o<=a+f&&(e.scrollLeft+=Math.floor(Math.max(-1,(o-a)/f-1)*p.x)),b&&(e.scrollLeft+=Math.ceil(Math.min(1,(o-s)/f+1)*p.x)),y&&(e.scrollTop+=Math.floor(Math.max(-1,(i-r)/f-1)*p.y)),S&&(e.scrollTop+=Math.ceil(Math.min(1,(i-l)/f+1)*p.y))}}}}},D.prototype={collect:function(t){if(t){for(var e=d(t),n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,o=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,i=Math.min(e.right,n),r=Math.min(e.bottom,o),s=Array.prototype.slice.call(t.children),l=[],a=0,c=s.length;a<=c;a++){var u=s[a];if(u&&u!==ot.ghost&&"none"!==w(u,"display")){var h=d(u);if(!(h.bottom<0||h.right<0)){if(h.top-h.height>r||h.left-h.width>i)break;l.push({el:u,rect:h})}}}this.stack.push(l)}},animate:function(){var t=this.stack.pop();if(t&&this.options.animation)for(var e=0,n=t.length;e<n;e++){var o=t[e],i=o.el,r=o.rect;this.execute(i,r)}},execute:function(t,e){var n=d(t);if(n.top!==e.top||n.left!==e.left){var o=e.left-n.left,i=e.top-n.top;w(t,"transition",""),w(t,"transform","translate3d(".concat(o,"px, ").concat(i,"px, 0)")),this.repaintDummy=function(t){return t.offsetWidth}(t);var r=this.options,s=r.animation,l=r.easing;w(t,"transition","transform ".concat(s,"ms ").concat(l?" "+l:"")),w(t,"transform","translate3d(0px, 0px, 0px)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){w(t,"transition",""),w(t,"transform",""),t.animated=null}),s)}}},_.prototype={eventProperties:function(){return{nodes:O||[],clones:I||[]}},isActive:function(){return!!O},nulling:function(){O=I=T=null},select:function(t){b(t,this.options.selectedClass,!0),this.selects.push(t),this.selects.sort((function(t,e){return x(t,e)}))},deselect:function(t){var e=this.selects.indexOf(t);e>-1&&(b(t,this.options.selectedClass,!1),this.selects.splice(e,1))},useSelectHandle:function(t,e){var n=this.options.selectHandle;return!!(T="function"==typeof n&&n(t)||"string"==typeof n&&S(e,n))},onChoose:function(){!this.options.multiple||0===this.selects.length||this.selects.indexOf(ot.dragged)<0||(this.selects.sort((function(t,e){return x(t,e)})),O=this.selects,this.toggleChosenClass(!0))},onDrop:function(t,e,n){if(O){var o=ot.dragged,i=ot.clone,r=O.indexOf(o);t!==e&&n?(w(i,"display","none"),this.toggleVisible(!0),I=O.map((function(t){return t.cloneNode(!0)})),this.sortElements(I,r,i)):this.sortElements(O,r,i),t!==e&&(e[z].multiplayer.toggleSelected(I||O,"add"),!n&&t[z].multiplayer.toggleSelected(O,"remove"))}},onSelect:function(t,e,n,o){var i=this.options,r=i.multiple,s=i.selectHandle;if(r&&(s&&T||!s&&!n)){var l=this.selects.indexOf(e);b(e,this.options.selectedClass,l<0);var a={from:o.el,event:t,node:e,index:g(e)};l<0?(this.selects.push(e),E({sortable:o,name:"onSelect",evt:a})):(this.selects.splice(l,1),E({sortable:o,name:"onDeselect",evt:a})),this.selects.sort((function(t,e){return x(t,e)}))}},toggleChosenClass:function(t){if(O)for(var e=0,n=O.length;e<n;e++)b(O[e],this.options.chosenClass,t)},toggleVisible:function(t){if(O)for(var e=0,n=O.length;e<n;e++)O[e]!=ot.dragged&&w(O[e],"display",t?"":"none")},toggleSelected:function(t,e){var n=this;"add"===e?t.forEach((function(t){return n.selects.push(t)})):this.selects=this.selects.filter((function(e){return t.indexOf(e)<0}))},sortElements:function(t,e,n){for(var o=0,i=t.length;o<i;o++)if(w(t[o],"display",""),o<e)n.parentNode.insertBefore(t[o],n);else{var r=o>0?t[o-1]:n;n.parentNode.insertBefore(t[o],r.nextSibling)}}};var M,R,N,B,j,A,H,P,K,L,F,Y,U,W,X,q,V,G,$,J,Q,Z,tt=[];function et(t){var n,o,i,r={},s=t.group;s&&"object"===e(s)||(s={name:s,pull:!0,put:!0,revertDrag:!0}),r.name=s.name,r.pull=null===(n=s.pull)||void 0===n||n,r.put=null===(o=s.put)||void 0===o||o,r.revertDrag=null===(i=s.revertDrag)||void 0===i||i,t.group=r}function nt(t){var e=q||X;return!(void 0!==t.clientX&&void 0!==t.clientY&&Math.abs(t.clientX-e.clientX)<=0&&Math.abs(t.clientY-e.clientY)<=0)}function ot(e,n){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(e));e[z]=this,this.el=e,this.options=n=t({},n);var o={store:null,group:"",handle:null,sortable:!0,disabled:!1,multiple:!1,lockAxis:"",direction:"",animation:150,easing:"",draggable:">*",selectHandle:null,customGhost:null,autoScroll:!0,scrollThreshold:55,scrollSpeed:{x:10,y:10},delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",placeholderClass:"",swapOnDrop:!0,removeCloneOnDrop:!0,fallbackOnBody:!1,supportTouch:"ontouchstart"in window,emptyInsertThreshold:-1};for(var i in o)!(i in this.options)&&(this.options[i]=o[i]);for(var r in et(n),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));c(e,this.options.supportTouch?"touchstart":"mousedown",this._onDrag),this.autoScroller=new C(this.options),this.multiplayer=new _(this.options),this.animator=new D(this.options),tt.push(e)}return ot.prototype={constructor:ot,_onDrag:function(t){var e=this;if(!N&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var n=t.touches&&t.touches[0],o=(n||t).target;if(!l||!o||"SELECT"!==o.tagName.toUpperCase()){var i=f(o,this.options.draggable,this.el);if(i&&!i.animated&&(X={event:t,clientX:(n||t).clientX,clientY:(n||t).clientY},N=i,c(J=n?N:document,"mouseup",this._onDrop),c(J,"touchend",this._onDrop),c(J,"touchcancel",this._onDrop),!this.multiplayer.useSelectHandle(t,o))){var a=this.options.handle;if(("function"!=typeof a||a(t))&&("string"!=typeof a||f(o,a,N))){var u=this.options,h=u.delay,d=u.delayOnTouchOnly;!h||d&&!n||s||r?this._onStart(n,t):(c(this.el.ownerDocument,"touchmove",this._delayMoveHandler),c(this.el.ownerDocument,"mousemove",this._delayMoveHandler),c(this.el.ownerDocument,"mouseup",this._cancelStart),c(this.el.ownerDocument,"touchend",this._cancelStart),c(this.el.ownerDocument,"touchcancel",this._cancelStart),Z=setTimeout((function(){return e._onStart(n,t)}),h)),c(document,"selectstart",k),l&&w(document.body,"user-select","none")}}}}},_delayMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-X.clientX),Math.abs(e.clientY-X.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(Z),u(this.el.ownerDocument,"touchmove",this._delayMoveHandler),u(this.el.ownerDocument,"mousemove",this._delayMoveHandler),u(this.el.ownerDocument,"mouseup",this._cancelStart),u(this.el.ownerDocument,"touchend",this._cancelStart),u(this.el.ownerDocument,"touchcancel",this._cancelStart),u(document,"selectstart",k),l&&w(document.body,"user-select","")},_onStart:function(t,e){k(e);var n=g(N);M=this.el,R=this.el,K=N,Y=n,U=n,W=n,G={to:this.el,target:N,newIndex:n,relative:0},$=N,P=this.el,A=N.cloneNode(!0),L=N.parentNode,F=this.options.group.pull,ot.clone=A,ot.active=this,ot.dragged=N,this.multiplayer.onChoose(),b(N,this.options.chosenClass,!0),E({sortable:this,name:"onChoose",evt:this._getEventProperties(e)}),c(J,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout((function(){return document.selection.empty()}),0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){this.animator.collect(L),b(A,this.options.chosenClass,!0),b(A,this.options.placeholderClass,!0),this._appendGhost(),this.multiplayer.toggleVisible(!1),w(N,"display","none"),N.parentNode.insertBefore(A,N),E({sortable:this,name:"onDrag",evt:this._getEventProperties(X.event)}),this.animator.animate(),this.autoScroller.onStarted()},_getGhostElement:function(){var t=this.options.customGhost;if("function"==typeof t){var e=this.multiplayer.selects;return t(this.multiplayer.isActive()?e:[N])}return N},_appendGhost:function(){if(!H){var e=this.options.fallbackOnBody?document.body:this.el,n=this._getGhostElement();b(H=n.cloneNode(!0),this.options.ghostClass,!0);var o=d(N),i=t({position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,margin:0,zIndex:1e5,opacity:"0.8",overflow:"hidden",boxSizing:"border-box",transform:"",transition:"",pointerEvents:"none"},this.options.ghostStyle);for(var r in i)w(H,r,i[r]);ot.ghost=H,e.appendChild(H);var s=(X.clientX-o.left)/parseInt(H.style.width)*100,l=(X.clientY-o.top)/parseInt(H.style.height)*100;w(H,"transform-origin","".concat(s,"% ").concat(l,"%")),w(H,"will-change","transform")}},_nearestSortable:function(t){k(t);var e=t.touches&&t.touches[0]||t;if(N&&nt(e)){!q&&this._onStarted();var n=this.options.lockAxis,o="x"===n?X.clientX:e.clientX,i="y"===n?X.clientY:e.clientY,r=document.elementFromPoint(o,i),s=o-X.clientX,l=i-X.clientY;q={event:t,clientX:o,clientY:i},w(H,"transform","translate3d(".concat(s,"px, ").concat(l,"px, 0)"));var a,c,u,f=(a=o,c=i,tt.reduce((function(t,e){var n=e[z].options.emptyInsertThreshold;if(null!=n){var o=d(e),i=a>=o.left-n&&a<=o.right+n,r=c>=o.top-n&&c<=o.bottom+n;return i&&r&&(!u||u&&o.left>=u.left&&o.right<=u.right&&o.top>=u.top&&o.bottom<=u.bottom)&&(t=e,u=o),t}}),null));f&&f[z]._onMove(t,r);var p=f?f[z].options:null,v=null;(!f||p.autoScroll)&&X&&q&&(v=function(t,e){if(!t||!t.getBoundingClientRect)return h();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=w(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return h();if(o||e)return n;o=!0}}}while(n=n.parentNode);return h()}(r,!0)),this.autoScroller.onMove(v,q,p||this.options)}},_allowPut:function(){if(P===this.el)return!0;if(!this.options.group.put)return!1;var t=this.options.group,e=t.name,n=t.put,o=P[z].options.group;return n.join&&n.indexOf(o.name)>-1||o.name&&e&&o.name===e},_getDirection:function(){var t=this.options,e=t.draggable,n=t.direction;return n?"function"==typeof n?n.call(q.event,A,this):n:y(L,e)},_allowSwap:function(){var t=d(B),e="vertical"===this._getDirection(),n=e?"top":"left",o=e?"bottom":"right",i=B[e?"offsetHeight":"offsetWidth"],r=e?q.clientY:q.clientX,s=r>=t[n]&&r<t[o]-i/2?-1:1,l=m(L,0,this.options.draggable),a=v(L),c=d(l),u=d(a);if(B===L||p(L,B))return A===l&&r<c[n]?(j=B,!0):A===a&&r>u[o]&&(j=B.nextSibling,!0);var h=x(A,B);return j=h<0?B.nextSibling:B,V!==B?(Q=s,!0):Q!==s&&(Q=s,s<0?h>0:h<0)},_onMove:function(t,e){if(!this.options.disabled&&this._allowPut()){if(B=f(e,this.options.draggable,this.el),E({sortable:this,name:"onMove",evt:this._getEventProperties(t,{target:B})}),this.options.sortable||this.el!==P)return this.el===R||e!==this.el&&v(this.el)?void(B&&!B.animated&&!p(B,A)&&this._allowSwap()&&(B!==A&&j!==A?(this.el!==R?this._onInsert(t):B!==N&&this._onChange(t),V=B):V=B)):(B=V=null,void this._onInsert(t));R!==P&&(B=V=N,Q=0,this._onInsert(t))}},_onInsert:function(t){var e=B||A,n="clone"===F&&this.el!==P&&R===P,o="clone"===F&&this.el===P&&R!==P,i=p(B,document),r=B===N&&!i,s=R[z],l=P[z];M=this.el,Y=g(A),K=e,L=i?B.parentNode:this.el,s.animator.collect(A.parentNode),this.animator.collect(L),n&&(G.target=$,G.newIndex=Y,G.relative=$===N?0:x(A,$),w(N,"display",""),l.multiplayer.toggleVisible(!0),l.options.group.revertDrag||A.parentNode.insertBefore(N,A)),o&&(Y=g(N),w(N,"display","none"),this.multiplayer.toggleVisible(!1)),w(A,"display",r?"none":""),B&&i?L.insertBefore(A,Q<0?B:B.nextSibling):L.appendChild(A),U=r?W:g(A),n&&l.options.group.revertDrag&&(G.target=N,G.newIndex=W,G.relative=0,E({sortable:l,name:"onChange",evt:this._getEventProperties(t,{to:P,target:N,newIndex:W,revertDrag:!0})})),n||E({sortable:s,name:"onRemove",evt:this._getEventProperties(t,{newIndex:-1})}),o&&e!==N&&($=e,E({sortable:this,name:"onChange",evt:this._getEventProperties(t,{from:P,backToOrigin:!0})})),o||E({sortable:this,name:"onAdd",evt:this._getEventProperties(t,{oldIndex:-1})}),s.animator.animate(),this.animator.animate(),R=this.el},_onChange:function(t){this.animator.collect(L),Y=g(A),L=B.parentNode,K=B,this.el===P&&($=B),L.insertBefore(A,j),U=g(A),E({sortable:this,name:"onChange",evt:this._getEventProperties(t)}),this.animator.animate(),R=this.el},_onDrop:function(t){this._cancelStart(),u(J,"touchmove",this._nearestSortable),u(J,"mousemove",this._nearestSortable),u(J,"mouseup",this._onDrop),u(J,"touchend",this._onDrop),u(J,"touchcancel",this._onDrop),P&&(R=P,Y=W,K===A&&(K=N),this.animator.collect(L),this.multiplayer.toggleChosenClass(!1),b(N,this.options.chosenClass,!1),E({sortable:this,name:"onUnchoose",evt:this._getEventProperties(t)}),q&&this._onEnd(t),!q&&this.animator.animate()),!nt(t.changedTouches?t.changedTouches[0]:t)&&this.multiplayer.onSelect(t,N,P,this),H&&H.parentNode&&H.parentNode.removeChild(H),this._nulling()},_onEnd:function(e){b(A,this.options.chosenClass,!1),b(A,this.options.placeholderClass,!1);var n="clone"===F;this.multiplayer.onDrop(R,M,n);var o=this._getEventProperties(e),i=this.options,r=i.swapOnDrop,s=i.removeCloneOnDrop;n&&R!==M||!("function"==typeof r?r(o):r)||L.insertBefore(N,A),n&&R!==M&&!this.multiplayer.isActive()||!("function"==typeof s?s(o):s)||A&&A.parentNode&&A.parentNode.removeChild(A),w(N,"display",""),this.animator.animate(),R!==M&&E({sortable:R[z],name:"onDrop",evt:t({},o,n?G:{newIndex:-1})}),E({sortable:M[z],name:"onDrop",evt:t({},o,R===M?{}:{oldIndex:-1})})},_getEventProperties:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o={};return o.event=e,o.to=M,o.from=R,o.node=N,o.clone=A,o.target=K,o.oldIndex=Y,o.newIndex=U,o.pullMode=F,t(o,this.multiplayer.eventProperties(),n),o.relative=K===N?0:x(A,K),o},_nulling:function(){M=R=N=B=j=A=H=P=K=L=F=Y=U=W=X=q=V=G=$=J=Q=Z=ot.clone=ot.ghost=ot.active=ot.dragged=null,this.multiplayer.nulling(),this.autoScroller.nulling()},destroy:function(){this._cancelStart(),this._nulling(),u(this.el,"touchstart",this._onDrag),u(this.el,"mousedown",this._onDrag);var t=tt.indexOf(this.el);t>-1&&tt.splice(t,1),this.el[z]=this.animator=this.multiplayer=this.autoScroller=null},option:function(t,e){if(void 0===e)return this.options[t];this.options[t]=e,this.animator.options[t]=e,this.multiplayer.options[t]=e,this.autoScroller.options[t]=e,"group"===t&&et(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selects}},ot.utils={on:c,off:u,css:w,index:g,closest:f,getRect:d,toggleClass:b,detectDirection:y},ot.get=function(t){return t[z]},ot.create=function(t,e){return new ot(t,e)},ot}()}(f);var p=d(f.exports);function v(t,e){var n,o=function(){for(var o=this,i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];n||(e<=0?t.apply(this,r):n=setTimeout((function(){n=null,t.apply(o,r)}),e))};return o.cancel=function(){n&&(clearTimeout(n),n=null)},o}function g(t,e){var n=v(t,e),o=function(){n.cancel(),n.apply(this,arguments)};return o.cancel=function(){n.cancel()},o}function m(t,e){return t==e}function y(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce((function(t,e){return(t||{})[e]}),t)}function b(t){return t instanceof Document&&9===t.nodeType||t instanceof Window}var S=["delay","group","handle","lockAxis","disabled","sortable","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","scrollSpeed","fallbackOnBody","scrollThreshold","delayOnTouchOnly","placeholderClass"],w=function(){function t(e,n){i(this,t),this.el=e,this.options=n,this.rangeChanged=!1,this.installSortable()}return s(t,[{key:"destroy",value:function(){this.sortable.destroy(),this.rangeChanged=!1}},{key:"option",value:function(t,e){this.options[t]=e,S.includes(t)&&this.sortable.option(t,e)}},{key:"installSortable",value:function(){var t=this,e=S.reduce((function(e,n){return e[n]=t.options[n],e}),{});this.sortable=new p(this.el,Object.assign(Object.assign({},e),{emptyInsertThreshold:0,swapOnDrop:function(t){return t.from===t.to},removeCloneOnDrop:function(t){return t.from===t.to},onDrag:function(e){return t.onDrag(e)},onDrop:function(e){return t.onDrop(e)},onChoose:function(e){return t.onChoose(e)},onUnchoose:function(e){return t.onUnchoose(e)}}))}},{key:"onChoose",value:function(t){this.dispatchEvent("onChoose",t)}},{key:"onUnchoose",value:function(t){this.dispatchEvent("onUnchoose",t)}},{key:"onDrag",value:function(t){var e=t.node.getAttribute("data-key"),n=this.getIndex(e),o=this.options.list[n],i=this.options.uniqueKeys[n];this.sortable.option("store",{item:o,key:i,index:n}),this.dispatchEvent("onDrag",{item:o,key:i,index:n,event:t})}},{key:"onDrop",value:function(t){var e,n,o,i=null===(e=p.get(t.from))||void 0===e?void 0:e.option("store"),r=i.item,s=i.key,l=i.index,c=this.options.list,u={key:s,item:r,list:c,event:t,changed:!1,oldList:a(c),oldIndex:l,newIndex:l};t.from===t.to&&t.node===t.target||this.handleDropEvent(t,u,l),this.dispatchEvent("onDrop",u),t.from===this.el&&this.rangeChanged&&(null===(n=p.dragged)||void 0===n||n.remove()),t.from!==t.to&&(null===(o=p.clone)||void 0===o||o.remove()),this.rangeChanged=!1}},{key:"handleDropEvent",value:function(t,e,n){var o=t.target.getAttribute("data-key"),i=-1,r=n;t.from===t.to?(((r=this.getIndex(e.key))<(i=this.getIndex(o))&&-1===t.relative||r>i&&1===t.relative)&&(i+=t.relative),i!==r&&(e.list.splice(r,1),e.list.splice(i,0,e.item))):(t.from===this.el&&(r=this.getIndex(e.key),e.list.splice(r,1)),t.to===this.el&&(r=-1,i=this.getIndex(o),0===t.relative?i=e.list.length:1===t.relative&&(i+=t.relative),e.list.splice(i,0,e.item))),e.changed=t.from!==t.to||i!==r,e.oldIndex=r,e.newIndex=i}},{key:"getIndex",value:function(t){if(null==t)return-1;for(var e=this.options.uniqueKeys,n=0,o=e.length;n<o;n++)if(m(e[n],t))return n;return-1}},{key:"dispatchEvent",value:function(t,e){var n=this.options[t];n&&n(e)}}]),t}(),x=["size","keeps","scroller","direction","debounceTime","throttleTime"],k=function(){function t(e){i(this,t),this.options=e;var n={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(var o in n)!(o in this.options)&&(this.options[o]=n[o]);this.sizes=new Map,this.sizeType="INIT",this.fixedSize=0,this.averageSize=0,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.direction="STATIONARY",this.updateScrollElement(),this.updateOnScrollFunction(),this.addScrollEventListener(),this.checkIfUpdate(0,e.keeps-1)}return s(t,[{key:"isFixed",value:function(){return"FIXED"===this.sizeType}},{key:"isFront",value:function(){return"FRONT"===this.direction}},{key:"isBehind",value:function(){return"BEHIND"===this.direction}},{key:"isHorizontal",value:function(){return"horizontal"===this.options.direction}},{key:"getSize",value:function(t){return this.sizes.get(t)||this.getItemSize()}},{key:"getOffset",value:function(){var t=this.isHorizontal()?"scrollLeft":"scrollTop";return this.scrollEl[t]}},{key:"getScrollSize",value:function(){var t=this.isHorizontal()?"scrollWidth":"scrollHeight";return this.scrollEl[t]}},{key:"getClientSize",value:function(){var t=this.isHorizontal()?"offsetWidth":"offsetHeight";return this.scrollEl[t]}},{key:"scrollToOffset",value:function(t){var e=this.isHorizontal()?"scrollLeft":"scrollTop";this.scrollEl[e]=t}},{key:"scrollToIndex",value:function(t){if(t>=this.options.uniqueKeys.length-1)this.scrollToBottom();else{var e=this.getOffsetByRange(0,t),n=this.getScrollStartOffset();this.scrollToOffset(e+n)}}},{key:"scrollToBottom",value:function(){var t=this,e=this.getScrollSize();this.scrollToOffset(e),setTimeout((function(){var e=t.getClientSize(),n=t.getScrollSize();t.getOffset()+e+1<n&&t.scrollToBottom()}),5)}},{key:"option",value:function(t,e){var n=this,o=this.options[t];this.options[t]=e,"uniqueKeys"===t&&this.sizes.forEach((function(t,o){e.includes(o)||n.sizes.delete(o)})),"scroller"===t&&(o&&p.utils.off(o,"scroll",this.onScroll),this.updateScrollElement(),this.addScrollEventListener())}},{key:"updateRange",value:function(t){if(t)this.handleUpdate(t.start);else{var e=this.range.start;e=Math.max(e,0),this.handleUpdate(e)}}},{key:"onItemResized",value:function(t,e){e&&this.sizes.get(t)!==e&&(this.sizes.set(t,e),"INIT"===this.sizeType?(this.sizeType="FIXED",this.fixedSize=e):this.isFixed()&&this.fixedSize!==e&&(this.sizeType="DYNAMIC",this.fixedSize=0),this.averageSize||"DYNAMIC"!==this.sizeType||this.sizes.size!==this.options.keeps||this.updateAverageSize())}},{key:"updateAverageSize",value:function(){var t=a(this.sizes.values()).reduce((function(t,e){return t+e}),0);this.averageSize=Math.round(t/this.sizes.size)}},{key:"addScrollEventListener",value:function(){this.options.scroller&&p.utils.on(this.options.scroller,"scroll",this.onScroll)}},{key:"removeScrollEventListener",value:function(){this.options.scroller&&p.utils.off(this.options.scroller,"scroll",this.onScroll)}},{key:"enableScroll",value:function(t){var e=this.options.scroller,n=t?p.utils.off:p.utils.on,o="onwheel"in document.createElement("div")?"wheel":"mousewheel";n(e,"DOMMouseScroll",this.preventDefault),n(e,o,this.preventDefault),n(e,"touchmove",this.preventDefault),n(e,"keydown",this.preventDefaultForKeyDown)}},{key:"preventDefault",value:function(t){t.preventDefault()}},{key:"preventDefaultForKeyDown",value:function(t){if({37:1,38:1,39:1,40:1}[t.keyCode])return this.preventDefault(t),!1}},{key:"updateScrollElement",value:function(){var t=this.options.scroller;if(b(t)){var e=document.scrollingElement||document.documentElement||document.body;this.scrollEl=e}else this.scrollEl=t}},{key:"updateOnScrollFunction",value:function(){var t=this,e=this.options,n=e.debounceTime,o=e.throttleTime;this.onScroll=n?g((function(){return t.handleScroll()}),n):o?v((function(){return t.handleScroll()}),o):function(){return t.handleScroll()}}},{key:"handleScroll",value:function(){var t=this.getOffset(),e=this.getClientSize(),n=this.getScrollSize();t===this.offset?this.direction="STATIONARY":this.direction=t<this.offset?"FRONT":"BEHIND",this.offset=t;var o=this.isFront()&&t<=0,i=this.isBehind()&&e+t+1>=n;this.options.onScroll({top:o,bottom:i,offset:t,direction:this.direction}),this.isFront()?this.handleScrollFront():this.isBehind()&&this.handleScrollBehind()}},{key:"handleScrollFront",value:function(){var t=this.getScrollItems();if(!(t>=this.range.start)){var e=Math.max(t-this.options.buffer,0);this.checkIfUpdate(e,this.getEndByStart(e))}}},{key:"handleScrollBehind",value:function(){var t=this.getScrollItems();t<this.range.start+this.options.buffer||this.checkIfUpdate(t,this.getEndByStart(t))}},{key:"getScrollItems",value:function(){var t=this.offset-this.getScrollStartOffset();if(t<=0)return 0;if(this.isFixed())return Math.floor(t/this.fixedSize);for(var e=0,n=this.options.uniqueKeys.length,o=0,i=0;e<=n;){if(o=e+Math.floor((n-e)/2),(i=this.getOffsetByRange(0,o))===t)return o;i<t?e=o+1:i>t&&(n=o-1)}return e>0?--e:0}},{key:"checkIfUpdate",value:function(t,e){var n=this.options.keeps;this.options.uniqueKeys.length<=n?t=0:e-t<n-1&&(t=e-n+1),this.range.start!==t&&this.handleUpdate(t)}},{key:"handleUpdate",value:function(t){this.range.start=t,this.range.end=this.getEndByStart(t),this.range.front=this.getFrontOffset(),this.range.behind=this.getBehindOffset(),this.options.onUpdate(Object.assign({},this.range))}},{key:"getFrontOffset",value:function(){return this.isFixed()?this.fixedSize*this.range.start:this.getOffsetByRange(0,this.range.start)}},{key:"getBehindOffset",value:function(){var t=this.range.end,e=this.getLastIndex();return this.isFixed()?(e-t)*this.fixedSize:(e-t)*this.getItemSize()}},{key:"getOffsetByRange",value:function(t,e){if(t>=e)return 0;for(var n=0,o=t;o<e;o++){var i=this.sizes.get(this.options.uniqueKeys[o]);n+="number"==typeof i?i:this.getItemSize()}return n}},{key:"getEndByStart",value:function(t){return Math.min(t+this.options.keeps-1,this.getLastIndex())}},{key:"getLastIndex",value:function(){var t=this.options,e=t.uniqueKeys,n=t.keeps;return e.length>0?e.length-1:n-1}},{key:"getItemSize",value:function(){return this.isFixed()?this.fixedSize:this.options.size||this.averageSize}},{key:"getScrollStartOffset",value:function(){var t=this.options,e=t.wrapper,n=t.scroller;if(n===e)return 0;var o=0;if(n&&e){var i=this.isHorizontal()?"left":"top",r=b(n)?p.utils.getRect(e):p.utils.getRect(e,!0,n);o=this.offset+r[i]}return o}}]),t}();function E(t){var e=t.dataKey,o=t.sizeKey,i=t.dragging,r=t.chosenKey,s=t.children,l=t.onSizeChange,a=n.useRef(null);n.useLayoutEffect((function(){var t;return void 0!==("undefined"==typeof ResizeObserver?"undefined":u(ResizeObserver))&&(t=new ResizeObserver((function(){var t=a.current[o];l(e,t)})),a.current&&(null==t||t.observe(a.current))),function(){t&&(t.disconnect(),t=null)}}),[a]);var c=n.useMemo((function(){var t=s.props.style||{},n=m(e,r);return i&&n?Object.assign(t,{display:"none"}):t}),[r,i]);return n.cloneElement(s,{"data-key":e,role:"item",ref:a,style:c,className:s.props.className})}var O=n.memo(E);function I(t,e){n.useEffect(e,Object.values(t))}var T="onDrag",z="onDrop",C="onTop",D="onBottom";function _(t,e){var o=t.dataKey,i=void 0===o?"":o,r=t.dataSource,s=void 0===r?[]:r,u=t.tableMode,h=void 0!==u&&u,d=t.wrapTag,f=void 0===d?"div":d,p=t.rootTag,v=void 0===p?"div":p,b=t.style,E=void 0===b?{}:b,_=t.className,M=void 0===_?"":_,R=t.wrapStyle,N=void 0===R?{}:R,B=t.wrapClass,j=void 0===B?"":B,A=t.size,H=void 0===A?void 0:A,P=t.keeps,K=void 0===P?30:P,L=t.scroller,F=void 0===L?void 0:L,Y=t.direction,U=void 0===Y?"vertical":Y,W=t.debounceTime,X=void 0===W?0:W,q=t.throttleTime,V=void 0===q?0:q,G=t.delay,$=void 0===G?0:G,J=t.group,Q=void 0===J?"":J,Z=t.handle,tt=void 0===Z?"":Z,et=t.lockAxis,nt=void 0===et?void 0:et,ot=t.disabled,it=void 0!==ot&&ot,rt=t.sortable,st=void 0===rt||rt,lt=t.draggable,at=void 0===lt?'[role="item"]':lt,ct=t.animation,ut=void 0===ct?150:ct,ht=t.autoScroll,dt=void 0===ht||ht,ft=t.scrollSpeed,pt=void 0===ft?{x:10,y:10}:ft,vt=t.ghostClass,gt=void 0===vt?"":vt,mt=t.ghostStyle,yt=void 0===mt?void 0:mt,bt=t.chosenClass,St=void 0===bt?"":bt,wt=t.placeholderClass,xt=void 0===wt?"":wt,kt=t.fallbackOnBody,Et=void 0!==kt&&kt,Ot=t.scrollThreshold,It=void 0===Ot?55:Ot,Tt=t.delayOnTouchOnly,zt=void 0!==Tt&&Tt,Ct=l(n.useState({start:0,end:K-1,front:0,behind:0}),2),Dt=Ct[0],_t=Ct[1],Mt=n.useRef(!1),Rt=n.useRef(""),Nt=n.useRef([]),Bt=n.useRef(),jt=n.useRef(),At=function(t){return qt.current.getSize(t)},Ht=function(){return qt.current.getOffset()},Pt=function(){return qt.current.getClientSize()},Kt=function(){return qt.current.getScrollSize()},Lt=function(t){var e;null===(e=qt.current)||void 0===e||e.scrollToOffset(t)},Ft=function(t){var e;null===(e=qt.current)||void 0===e||e.scrollToIndex(t)},Yt=function(t){var e,n=Nt.current.indexOf(t);n>-1&&(null===(e=qt.current)||void 0===e||e.scrollToIndex(n))},Ut=function(){Lt(0)},Wt=function(){var t;null===(t=qt.current)||void 0===t||t.scrollToBottom()};n.useImperativeHandle(e,(function(){return{getSize:At,getOffset:Ht,getClientSize:Pt,getScrollSize:Kt,scrollToTop:Ut,scrollToKey:Yt,scrollToIndex:Ft,scrollToOffset:Lt,scrollToBottom:Wt}})),n.useEffect((function(){return Zt(),le(),function(){var t,e;null===(t=qt.current)||void 0===t||t.removeScrollEventListener(),null===(e=ee.current)||void 0===e||e.destroy()}}),[]);var Xt=n.useRef(!1),qt=n.useRef(),Vt={size:H,keeps:K,scroller:F,direction:U,debounceTime:X,throttleTime:V},Gt=g((function(){var e;Xt.current=!0,null===(e=t[C])||void 0===e||e.call(t)}),50),$t=g((function(){var e;null===(e=t[D])||void 0===e||e.call(t)}),50),Jt=function(t){Xt.current=!1,t.top?Gt():t.bottom&&$t()},Qt=function(t){_t((function(e){return ee.current&&Mt.current&&t.start!==e.start&&(ee.current.rangeChanged=!0),t}))},Zt=function(){qt.current=new k(Object.assign(Object.assign({},Vt),{buffer:Math.round(K/3),wrapper:jt.current,scroller:F||Bt.current,uniqueKeys:Nt.current,onScroll:Jt,onUpdate:Qt}))};I(Vt,(function(){x.forEach((function(e){var n;void 0!==t[e]&&(null===(n=qt.current)||void 0===n||n.option(e,t[e]))}))}));var te=n.useRef(0);n.useEffect((function(){var e;if(te.current&&Xt.current&&t.keepOffset){var n=Math.abs(s.length-te.current);n>0&&(null===(e=qt.current)||void 0===e||e.scrollToIndex(n)),Xt.current=!1}te.current=s.length}),[s]);var ee=n.useRef(),ne={delay:$,group:Q,handle:tt,lockAxis:nt,disabled:it,sortable:st,draggable:at,animation:ut,autoScroll:dt,ghostClass:gt,ghostStyle:yt,chosenClass:St,scrollSpeed:pt,fallbackOnBody:Et,scrollThreshold:It,delayOnTouchOnly:zt,placeholderClass:xt},oe=function(t){Rt.current=t.node.getAttribute("data-key")},ie=function(){Rt.current=""},re=function(e){var n,o,i;Mt.current=!0,st||(null===(n=qt.current)||void 0===n||n.enableScroll(!1),null===(o=ee.current)||void 0===o||o.option("autoScroll",!1)),null===(i=t[T])||void 0===i||i.call(t,e)},se=function(e){var n,o,i;Mt.current=!1,null===(n=qt.current)||void 0===n||n.enableScroll(!0),null===(o=ee.current)||void 0===o||o.option("autoScroll",t.autoScroll);var r=Object.assign(Object.assign({},e),{list:a(e.list)});null===(i=t[z])||void 0===i||i.call(t,r)},le=function(){ee.current=new w(Bt.current,Object.assign(Object.assign({},ne),{list:s,uniqueKeys:Nt.current,onDrag:re,onDrop:se,onChoose:oe,onUnchoose:ie}))};I(ne,(function(){S.forEach((function(e){var n;void 0!==t[e]&&(null===(n=ee.current)||void 0===n||n.option(e,t[e]))}))}));var ae=n.useRef([]);n.useEffect((function(){var t;ce(),ue(ae.current,s),ae.current=s,null===(t=ee.current)||void 0===t||t.option("list",s)}),[s]);var ce=function(){var t,e;Nt.current=s.map((function(t){return y(t,i)})),null===(t=qt.current)||void 0===t||t.option("uniqueKeys",Nt.current),null===(e=ee.current)||void 0===e||e.option("uniqueKeys",Nt.current)},ue=function(t,e){var n;if((t.length||e.length)&&t.length!==e.length){var o=Object.assign({},Dt);t.length>K&&e.length>t.length&&o.end===t.length-1&&he()&&o.start++,null===(n=qt.current)||void 0===n||n.updateRange(o)}},he=function(){return Ht()+Pt()+1>=Kt()},de=n.useMemo((function(){var t=Dt.front,e=Dt.behind,n="vertical"!==U,o=n?"auto hidden":"hidden auto",i=n?"0px ".concat(e,"px 0px ").concat(t,"px"):"".concat(t,"px 0px ").concat(e,"px");return{containerStyle:Object.assign(Object.assign({},E),{overflow:h||F?"":o}),wrapperStyle:Object.assign(Object.assign({},N),{padding:h?"":i}),itemSizeKey:n?"offsetWidth":"offsetHeight"}}),[Dt,E,N,F,h,U]),fe=de.containerStyle,pe=de.wrapperStyle,ve=de.itemSizeKey,ge=l(n.useMemo((function(){return[h?"table":f,h?"tbody":f]}),[v,f,h]),2),me=ge[0],ye=ge[1],be=function(t){var e=t.list,o=t.start,i=t.end,r=t.dataKey,s=t.sizeKey,l=t.dragging,a=t.chosenKey,c=t.children,u=t.onSizeChange;return e.slice(o,i+1).map((function(t,e){var i=o+e,h=y(t,r);return n.createElement(O,{key:h,dataKey:h,sizeKey:s,dragging:l,chosenKey:a,onSizeChange:u},"function"==typeof c?c(t,i,h):c)}))}({list:s,start:Dt.start,end:Dt.end,dataKey:i,sizeKey:ve,children:t.children,dragging:Mt.current,chosenKey:Rt.current,onSizeChange:function(t,e){var n,o;if(!m(t,Rt.current)){var i=null===(n=qt.current)||void 0===n?void 0:n.sizes.size,r=Math.min(K,s.length);null===(o=qt.current)||void 0===o||o.onItemResized(t,e),i===r-1&&qt.current.updateRange(Object.assign({},Dt))}}}),Se=function(t,e){var o,i,r,s=(o={padding:0,border:0},i="vertical"===U?"height":"width",r="".concat(t,"px"),(i=c(i))in o?Object.defineProperty(o,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[i]=r,o);return n.createElement("tr",{key:e},n.createElement("td",{style:s}))};return n.createElement(me,{ref:Bt,style:fe,className:M},[t.header,n.createElement(ye,{ref:jt,key:"virtual-table-wrap",style:pe,className:j},[h&&Se(Dt.front,"virtual-table-front")].concat(a(be),[h&&Se(Dt.behind,"virtual-table-behind")])),t.footer])}return n.forwardRef(_)}));
|
|
11
|
+
*/!function(t,e){t.exports=function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},t.apply(null,arguments)}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}var n={capture:!1,passive:!1},o=/\s+/g;function i(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var r=i(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),s=i(/Edge/i),l=i(/safari/i)&&!i(/chrome/i)&&!i(/android/i),a=function(){var t=!1;return document.addEventListener("checkIfSupportPassive",null,{get passive(){return t=!0,!0}}),t}();function c(t,e,o){window.addEventListener?t.addEventListener(e,o,!(!a&&r)&&n):window.attachEvent?t.attachEvent("on"+e,o):t["on"+e]=o}function u(t,e,o){window.removeEventListener?t.removeEventListener(e,o,!(!a&&r)&&n):window.detachEvent?t.detachEvent("on"+e,o):t["on"+e]=null}function h(){return document.scrollingElement||document.documentElement}function d(t,e,n){if(t.getBoundingClientRect||t===window){var o,i,r,s,l,a,c;if(t!==window&&t.parentNode&&t!==h()?(i=(o=t.getBoundingClientRect()).top,r=o.left,s=o.bottom,l=o.right,a=o.height,c=o.width):(i=0,r=0,s=window.innerHeight,l=window.innerWidth,a=window.innerHeight,c=window.innerWidth),e&&t!==window){n=n||t.parentNode;do{if(n&&n.getBoundingClientRect){var u=n.getBoundingClientRect();i-=u.top+parseInt(w(n,"border-top-width")),r-=u.left+parseInt(w(n,"border-left-width")),s=i+o.height,l=r+o.width;break}}while(n=n.parentNode)}return{top:i,left:r,bottom:s,right:l,width:c,height:a}}}function f(t,e,n,o){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&S(t,e):S(t,e))||o&&t===n)return t;if(t===n)break}while(t=t.parentNode);return null}}function p(t,e){if(!t||!e)return!1;if(e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));if(e.contains&&1===t.nodeType)return e.contains(t)&&e!==t;for(;t=t.parentNode;)if(t===e)return!0;return!1}function v(t,e){for(var n=t.lastElementChild;n&&(n===ot.ghost||"none"===w(n,"display")||e&&!S(n,e));)n=n.previousElementSibling;return n||null}function g(t,e){if(!t||!t.parentNode)return-1;for(var n=0;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||e&&!S(t,e)||"none"===w(t,"display")||n++;return n}function m(t,e,n,o){for(var i=0,r=0,s=t.children;i<s.length;){if(s[i]!==ot.ghost&&"none"!==w(s[i],"display")&&f(s[i],n,t,!1)&&(o||s[i]!==ot.dragged)){if(r===e)return s[i];r++}i++}return null}function y(t,e){var n=w(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=m(t,0,e),l=m(t,1,e),a=i&&w(i),c=l&&w(l),u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+d(i).width,h=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+d(l).width,f=s||r?"cssFloat":"float";if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&"none"!==a.float){var p="left"===a.float?"left":"right";return!l||"both"!==c.clear&&c.clear!==p?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||u>=o&&"none"===n[f]||l&&"none"===n[f]&&u+h>o)?"vertical":"horizontal"}function b(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(o," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(o," ")}}function S(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function w(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"==typeof n?"":"px")}}function x(t,e){var n,o,i=(o=e,(n=t).compareDocumentPosition?n.compareDocumentPosition(o):n.contains?(n!=o&&n.contains(o)&&16)+(n!=o&&o.contains(n)&&8)+(n.sourceIndex>=0&&o.sourceIndex>=0?(n.sourceIndex<o.sourceIndex&&4)+(n.sourceIndex>o.sourceIndex&&2):1):0);return 2===i?1:4===i?-1:0}function k(t){void 0!==t.preventDefault&&t.cancelable&&t.preventDefault()}function E(e){var n=e.sortable,o=e.name,i=e.evt,r=n.options[o];"function"==typeof r&&r(t({},i))}!function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var t=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"];(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1]}();var O,I,T,z="Sortable"+Date.now();function C(t){this.options=t,this.scrollEl=null,this.autoScrollInterval=null}function D(t){this.options=t,this.stack=[]}function _(t){this.options=t||{},this.selects=[]}C.prototype={nulling:function(){this.autoScrollInterval&&(clearInterval(this.autoScrollInterval),this.autoScrollInterval=null)},onStarted:function(){var t=this;this.nulling(),this.autoScrollInterval=setInterval((function(){t.autoScroll()}))},onMove:function(t,e,n){this.options=n,this.scrollEl=t,this.moveEvent=e},autoScroll:function(){var t=this.moveEvent,e=this.scrollEl;if(e&&void 0!==t.clientX&&void 0!==t.clientY){var n=d(e);if(n){var o=t.clientX,i=t.clientY,r=n.top,s=n.right,l=n.bottom,a=n.left,c=n.height,u=n.width;if(!(i<r||o>s||i>l||o<a)){var h=this.options,f=h.scrollThreshold,p=h.scrollSpeed,v=e.scrollTop,g=e.scrollLeft,m=e.scrollHeight,y=v>0&&i>=r&&i<=r+f,b=g+u<e.scrollWidth&&o<=s&&o>=s-f,S=v+c<m&&i<=l&&i>=l-f;g>0&&o>=a&&o<=a+f&&(e.scrollLeft+=Math.floor(Math.max(-1,(o-a)/f-1)*p.x)),b&&(e.scrollLeft+=Math.ceil(Math.min(1,(o-s)/f+1)*p.x)),y&&(e.scrollTop+=Math.floor(Math.max(-1,(i-r)/f-1)*p.y)),S&&(e.scrollTop+=Math.ceil(Math.min(1,(i-l)/f+1)*p.y))}}}}},D.prototype={collect:function(t){if(t){for(var e=d(t),n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,o=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,i=Math.min(e.right,n),r=Math.min(e.bottom,o),s=Array.prototype.slice.call(t.children),l=[],a=0,c=s.length;a<=c;a++){var u=s[a];if(u&&u!==ot.ghost&&"none"!==w(u,"display")){var h=d(u);if(!(h.bottom<0||h.right<0)){if(h.top-h.height>r||h.left-h.width>i)break;l.push({el:u,rect:h})}}}this.stack.push(l)}},animate:function(){var t=this.stack.pop();if(t&&this.options.animation)for(var e=0,n=t.length;e<n;e++){var o=t[e],i=o.el,r=o.rect;this.execute(i,r)}},execute:function(t,e){var n=d(t);if(n.top!==e.top||n.left!==e.left){var o=e.left-n.left,i=e.top-n.top;w(t,"transition",""),w(t,"transform","translate3d(".concat(o,"px, ").concat(i,"px, 0)")),this.repaintDummy=function(t){return t.offsetWidth}(t);var r=this.options,s=r.animation,l=r.easing;w(t,"transition","transform ".concat(s,"ms ").concat(l?" "+l:"")),w(t,"transform","translate3d(0px, 0px, 0px)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){w(t,"transition",""),w(t,"transform",""),t.animated=null}),s)}}},_.prototype={eventProperties:function(){return{nodes:O||[],clones:I||[]}},isActive:function(){return!!O},nulling:function(){O=I=T=null},select:function(t){b(t,this.options.selectedClass,!0),this.selects.push(t),this.selects.sort((function(t,e){return x(t,e)}))},deselect:function(t){var e=this.selects.indexOf(t);e>-1&&(b(t,this.options.selectedClass,!1),this.selects.splice(e,1))},useSelectHandle:function(t,e){var n=this.options.selectHandle;return!!(T="function"==typeof n&&n(t)||"string"==typeof n&&S(e,n))},onChoose:function(){!this.options.multiple||0===this.selects.length||this.selects.indexOf(ot.dragged)<0||(this.selects.sort((function(t,e){return x(t,e)})),O=this.selects,this.toggleChosenClass(!0))},onDrop:function(t,e,n){if(O){var o=ot.dragged,i=ot.clone,r=O.indexOf(o);t!==e&&n?(w(i,"display","none"),this.toggleVisible(!0),I=O.map((function(t){return t.cloneNode(!0)})),this.sortElements(I,r,i)):this.sortElements(O,r,i),t!==e&&(e[z].multiplayer.toggleSelected(I||O,"add"),!n&&t[z].multiplayer.toggleSelected(O,"remove"))}},onSelect:function(t,e,n,o){var i=this.options,r=i.multiple,s=i.selectHandle;if(r&&(s&&T||!s&&!n)){var l=this.selects.indexOf(e);b(e,this.options.selectedClass,l<0);var a={from:o.el,event:t,node:e,index:g(e)};l<0?(this.selects.push(e),E({sortable:o,name:"onSelect",evt:a})):(this.selects.splice(l,1),E({sortable:o,name:"onDeselect",evt:a})),this.selects.sort((function(t,e){return x(t,e)}))}},toggleChosenClass:function(t){if(O)for(var e=0,n=O.length;e<n;e++)b(O[e],this.options.chosenClass,t)},toggleVisible:function(t){if(O)for(var e=0,n=O.length;e<n;e++)O[e]!=ot.dragged&&w(O[e],"display",t?"":"none")},toggleSelected:function(t,e){var n=this;"add"===e?t.forEach((function(t){return n.selects.push(t)})):this.selects=this.selects.filter((function(e){return t.indexOf(e)<0}))},sortElements:function(t,e,n){for(var o=0,i=t.length;o<i;o++)if(w(t[o],"display",""),o<e)n.parentNode.insertBefore(t[o],n);else{var r=o>0?t[o-1]:n;n.parentNode.insertBefore(t[o],r.nextSibling)}}};var M,R,N,B,j,A,H,P,K,L,F,Y,U,W,X,q,V,G,$,J,Q,Z,tt=[];function et(t){var n,o,i,r={},s=t.group;s&&"object"===e(s)||(s={name:s,pull:!0,put:!0,revertDrag:!0}),r.name=s.name,r.pull=null===(n=s.pull)||void 0===n||n,r.put=null===(o=s.put)||void 0===o||o,r.revertDrag=null===(i=s.revertDrag)||void 0===i||i,t.group=r}function nt(t){var e=q||X;return!(void 0!==t.clientX&&void 0!==t.clientY&&Math.abs(t.clientX-e.clientX)<=0&&Math.abs(t.clientY-e.clientY)<=0)}function ot(e,n){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable-dnd: `el` must be an HTMLElement, not ".concat({}.toString.call(e));e[z]=this,this.el=e,this.options=n=t({},n);var o={store:null,group:"",handle:null,sortable:!0,disabled:!1,multiple:!1,lockAxis:"",direction:"",animation:150,easing:"",draggable:">*",selectHandle:null,customGhost:null,autoScroll:!0,scrollThreshold:55,scrollSpeed:{x:10,y:10},delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,ghostClass:"",ghostStyle:{},chosenClass:"",selectedClass:"",placeholderClass:"",swapOnDrop:!0,removeCloneOnDrop:!0,fallbackOnBody:!1,supportTouch:"ontouchstart"in window,emptyInsertThreshold:-1};for(var i in o)!(i in this.options)&&(this.options[i]=o[i]);for(var r in et(n),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));c(e,this.options.supportTouch?"touchstart":"mousedown",this._onDrag),this.autoScroller=new C(this.options),this.multiplayer=new _(this.options),this.animator=new D(this.options),tt.push(e)}return ot.prototype={constructor:ot,_onDrag:function(t){var e=this;if(!N&&!this.options.disabled&&this.options.group.pull&&(!/mousedown|pointerdown/.test(t.type)||0===t.button)){var n=t.touches&&t.touches[0],o=(n||t).target;if(!l||!o||"SELECT"!==o.tagName.toUpperCase()){var i=f(o,this.options.draggable,this.el);if(i&&!i.animated&&(X={event:t,clientX:(n||t).clientX,clientY:(n||t).clientY},N=i,c(J=n?N:document,"mouseup",this._onDrop),c(J,"touchend",this._onDrop),c(J,"touchcancel",this._onDrop),!this.multiplayer.useSelectHandle(t,o))){var a=this.options.handle;if(("function"!=typeof a||a(t))&&("string"!=typeof a||f(o,a,N))){var u=this.options,h=u.delay,d=u.delayOnTouchOnly;!h||d&&!n||s||r?this._onStart(n,t):(c(this.el.ownerDocument,"touchmove",this._delayMoveHandler),c(this.el.ownerDocument,"mousemove",this._delayMoveHandler),c(this.el.ownerDocument,"mouseup",this._cancelStart),c(this.el.ownerDocument,"touchend",this._cancelStart),c(this.el.ownerDocument,"touchcancel",this._cancelStart),Z=setTimeout((function(){return e._onStart(n,t)}),h)),c(document,"selectstart",k),l&&w(document.body,"user-select","none")}}}}},_delayMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-X.clientX),Math.abs(e.clientY-X.clientY))>=Math.floor(this.options.touchStartThreshold/(window.devicePixelRatio||1))&&this._cancelStart()},_cancelStart:function(){clearTimeout(Z),u(this.el.ownerDocument,"touchmove",this._delayMoveHandler),u(this.el.ownerDocument,"mousemove",this._delayMoveHandler),u(this.el.ownerDocument,"mouseup",this._cancelStart),u(this.el.ownerDocument,"touchend",this._cancelStart),u(this.el.ownerDocument,"touchcancel",this._cancelStart),u(document,"selectstart",k),l&&w(document.body,"user-select","")},_onStart:function(t,e){k(e);var n=g(N);M=this.el,R=this.el,K=N,Y=n,U=n,W=n,G={to:this.el,target:N,newIndex:n,relative:0},$=N,P=this.el,A=N.cloneNode(!0),L=N.parentNode,F=this.options.group.pull,ot.clone=A,ot.active=this,ot.dragged=N,this.multiplayer.onChoose(),b(N,this.options.chosenClass,!0),E({sortable:this,name:"onChoose",evt:this._getEventProperties(e)}),c(J,t?"touchmove":"mousemove",this._nearestSortable);try{document.selection?setTimeout((function(){return document.selection.empty()}),0):window.getSelection().removeAllRanges()}catch(t){}},_onStarted:function(){this.animator.collect(L),b(A,this.options.chosenClass,!0),b(A,this.options.placeholderClass,!0),this._appendGhost(),this.multiplayer.toggleVisible(!1),w(N,"display","none"),N.parentNode.insertBefore(A,N),E({sortable:this,name:"onDrag",evt:this._getEventProperties(X.event)}),this.animator.animate(),this.autoScroller.onStarted()},_getGhostElement:function(){var t=this.options.customGhost;if("function"==typeof t){var e=this.multiplayer.selects;return t(this.multiplayer.isActive()?e:[N])}return N},_appendGhost:function(){if(!H){var e=this.options.fallbackOnBody?document.body:this.el,n=this._getGhostElement();b(H=n.cloneNode(!0),this.options.ghostClass,!0);var o=d(N),i=t({position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,margin:0,zIndex:1e5,opacity:"0.8",overflow:"hidden",boxSizing:"border-box",transform:"",transition:"",pointerEvents:"none"},this.options.ghostStyle);for(var r in i)w(H,r,i[r]);ot.ghost=H,e.appendChild(H);var s=(X.clientX-o.left)/parseInt(H.style.width)*100,l=(X.clientY-o.top)/parseInt(H.style.height)*100;w(H,"transform-origin","".concat(s,"% ").concat(l,"%")),w(H,"will-change","transform")}},_nearestSortable:function(t){k(t);var e=t.touches&&t.touches[0]||t;if(N&&nt(e)){!q&&this._onStarted();var n=this.options.lockAxis,o="x"===n?X.clientX:e.clientX,i="y"===n?X.clientY:e.clientY,r=document.elementFromPoint(o,i),s=o-X.clientX,l=i-X.clientY;q={event:t,clientX:o,clientY:i},w(H,"transform","translate3d(".concat(s,"px, ").concat(l,"px, 0)"));var a,c,u,f=(a=o,c=i,tt.reduce((function(t,e){var n=e[z].options.emptyInsertThreshold;if(null!=n){var o=d(e),i=a>=o.left-n&&a<=o.right+n,r=c>=o.top-n&&c<=o.bottom+n;return i&&r&&(!u||u&&o.left>=u.left&&o.right<=u.right&&o.top>=u.top&&o.bottom<=u.bottom)&&(t=e,u=o),t}}),null));f&&f[z]._onMove(t,r);var p=f?f[z].options:null,v=null;(!f||p.autoScroll)&&X&&q&&(v=function(t,e){if(!t||!t.getBoundingClientRect)return h();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=w(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return h();if(o||e)return n;o=!0}}}while(n=n.parentNode);return h()}(r,!0)),this.autoScroller.onMove(v,q,p||this.options)}},_allowPut:function(){if(P===this.el)return!0;if(!this.options.group.put)return!1;var t=this.options.group,e=t.name,n=t.put,o=P[z].options.group;return n.join&&n.indexOf(o.name)>-1||o.name&&e&&o.name===e},_getDirection:function(){var t=this.options,e=t.draggable,n=t.direction;return n?"function"==typeof n?n.call(q.event,A,this):n:y(L,e)},_allowSwap:function(){var t=d(B),e="vertical"===this._getDirection(),n=e?"top":"left",o=e?"bottom":"right",i=B[e?"offsetHeight":"offsetWidth"],r=e?q.clientY:q.clientX,s=r>=t[n]&&r<t[o]-i/2?-1:1,l=m(L,0,this.options.draggable),a=v(L),c=d(l),u=d(a);if(B===L||p(L,B))return A===l&&r<c[n]?(j=B,!0):A===a&&r>u[o]&&(j=B.nextSibling,!0);var h=x(A,B);return j=h<0?B.nextSibling:B,V!==B?(Q=s,!0):Q!==s&&(Q=s,s<0?h>0:h<0)},_onMove:function(t,e){if(!this.options.disabled&&this._allowPut()){if(B=f(e,this.options.draggable,this.el),E({sortable:this,name:"onMove",evt:this._getEventProperties(t,{target:B})}),this.options.sortable||this.el!==P)return this.el===R||e!==this.el&&v(this.el)?void(B&&!B.animated&&!p(B,A)&&this._allowSwap()&&(B!==A&&j!==A?(this.el!==R?this._onInsert(t):B!==N&&this._onChange(t),V=B):V=B)):(B=V=null,void this._onInsert(t));R!==P&&(B=V=N,Q=0,this._onInsert(t))}},_onInsert:function(t){var e=B||A,n="clone"===F&&this.el!==P&&R===P,o="clone"===F&&this.el===P&&R!==P,i=p(B,document),r=B===N&&!i,s=R[z],l=P[z];M=this.el,Y=g(A),K=e,L=i?B.parentNode:this.el,s.animator.collect(A.parentNode),this.animator.collect(L),n&&(G.target=$,G.newIndex=Y,G.relative=$===N?0:x(A,$),w(N,"display",""),l.multiplayer.toggleVisible(!0),l.options.group.revertDrag||A.parentNode.insertBefore(N,A)),o&&(Y=g(N),w(N,"display","none"),this.multiplayer.toggleVisible(!1)),w(A,"display",r?"none":""),B&&i?L.insertBefore(A,Q<0?B:B.nextSibling):L.appendChild(A),U=r?W:g(A),n&&l.options.group.revertDrag&&(G.target=N,G.newIndex=W,G.relative=0,E({sortable:l,name:"onChange",evt:this._getEventProperties(t,{to:P,target:N,newIndex:W,revertDrag:!0})})),n||E({sortable:s,name:"onRemove",evt:this._getEventProperties(t,{newIndex:-1})}),o&&e!==N&&($=e,E({sortable:this,name:"onChange",evt:this._getEventProperties(t,{from:P,backToOrigin:!0})})),o||E({sortable:this,name:"onAdd",evt:this._getEventProperties(t,{oldIndex:-1})}),s.animator.animate(),this.animator.animate(),R=this.el},_onChange:function(t){this.animator.collect(L),Y=g(A),L=B.parentNode,K=B,this.el===P&&($=B),L.insertBefore(A,j),U=g(A),E({sortable:this,name:"onChange",evt:this._getEventProperties(t)}),this.animator.animate(),R=this.el},_onDrop:function(t){this._cancelStart(),u(J,"touchmove",this._nearestSortable),u(J,"mousemove",this._nearestSortable),u(J,"mouseup",this._onDrop),u(J,"touchend",this._onDrop),u(J,"touchcancel",this._onDrop),P&&(R=P,Y=W,K===A&&(K=N),this.animator.collect(L),this.multiplayer.toggleChosenClass(!1),b(N,this.options.chosenClass,!1),E({sortable:this,name:"onUnchoose",evt:this._getEventProperties(t)}),q&&this._onEnd(t),!q&&this.animator.animate()),!nt(t.changedTouches?t.changedTouches[0]:t)&&this.multiplayer.onSelect(t,N,P,this),H&&H.parentNode&&H.parentNode.removeChild(H),this._nulling()},_onEnd:function(e){b(A,this.options.chosenClass,!1),b(A,this.options.placeholderClass,!1);var n="clone"===F;this.multiplayer.onDrop(R,M,n);var o=this._getEventProperties(e),i=this.options,r=i.swapOnDrop,s=i.removeCloneOnDrop;n&&R!==M||!("function"==typeof r?r(o):r)||L.insertBefore(N,A),n&&R!==M&&!this.multiplayer.isActive()||!("function"==typeof s?s(o):s)||A&&A.parentNode&&A.parentNode.removeChild(A),w(N,"display",""),this.animator.animate(),R!==M&&E({sortable:R[z],name:"onDrop",evt:t({},o,n?G:{newIndex:-1})}),E({sortable:M[z],name:"onDrop",evt:t({},o,R===M?{}:{oldIndex:-1})})},_getEventProperties:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o={};return o.event=e,o.to=M,o.from=R,o.node=N,o.clone=A,o.target=K,o.oldIndex=Y,o.newIndex=U,o.pullMode=F,t(o,this.multiplayer.eventProperties(),n),o.relative=K===N?0:x(A,K),o},_nulling:function(){M=R=N=B=j=A=H=P=K=L=F=Y=U=W=X=q=V=G=$=J=Q=Z=ot.clone=ot.ghost=ot.active=ot.dragged=null,this.multiplayer.nulling(),this.autoScroller.nulling()},destroy:function(){this._cancelStart(),this._nulling(),u(this.el,"touchstart",this._onDrag),u(this.el,"mousedown",this._onDrag);var t=tt.indexOf(this.el);t>-1&&tt.splice(t,1),this.el[z]=this.animator=this.multiplayer=this.autoScroller=null},option:function(t,e){if(void 0===e)return this.options[t];this.options[t]=e,this.animator.options[t]=e,this.multiplayer.options[t]=e,this.autoScroller.options[t]=e,"group"===t&&et(this.options)},select:function(t){this.multiplayer.select(t)},deselect:function(t){this.multiplayer.deselect(t)},getSelectedElements:function(){return this.multiplayer.selects}},ot.utils={on:c,off:u,css:w,index:g,closest:f,getRect:d,toggleClass:b,detectDirection:y},ot.get=function(t){return t[z]},ot.create=function(t,e){return new ot(t,e)},ot}()}(f);var p=d(f.exports);function v(t,e){var n,o=function(){for(var o=this,i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];n||(e<=0?t.apply(this,r):n=setTimeout((function(){n=null,t.apply(o,r)}),e))};return o.cancel=function(){n&&(clearTimeout(n),n=null)},o}function g(t,e){var n=v(t,e),o=function(){n.cancel(),n.apply(this,arguments)};return o.cancel=function(){n.cancel()},o}function m(t,e){return 0===t?t===e:t==e}function y(t,e){return(Array.isArray(e)?e:e.replace(/\[/g,".").replace(/\]/g,".").split(".")).reduce((function(t,e){return(t||{})[e]}),t)}function b(t){return t instanceof Document&&9===t.nodeType||t instanceof Window}var S=["delay","group","handle","lockAxis","disabled","sortable","draggable","animation","autoScroll","ghostClass","ghostStyle","chosenClass","scrollSpeed","fallbackOnBody","scrollThreshold","delayOnTouchOnly","placeholderClass"],w=function(){function t(e,n){i(this,t),this.el=e,this.options=n,this.rangeChanged=!1,this.installSortable()}return s(t,[{key:"destroy",value:function(){this.sortable.destroy(),this.rangeChanged=!1}},{key:"option",value:function(t,e){this.options[t]=e,S.includes(t)&&this.sortable.option(t,e)}},{key:"installSortable",value:function(){var t=this,e=S.reduce((function(e,n){return e[n]=t.options[n],e}),{});this.sortable=new p(this.el,Object.assign(Object.assign({},e),{emptyInsertThreshold:0,swapOnDrop:function(t){return t.from===t.to},removeCloneOnDrop:function(t){return t.from===t.to},onDrag:function(e){return t.onDrag(e)},onDrop:function(e){return t.onDrop(e)},onChoose:function(e){return t.onChoose(e)},onUnchoose:function(e){return t.onUnchoose(e)}}))}},{key:"onChoose",value:function(t){this.dispatchEvent("onChoose",t)}},{key:"onUnchoose",value:function(t){this.dispatchEvent("onUnchoose",t)}},{key:"onDrag",value:function(t){var e=t.node.getAttribute("data-key"),n=this.getIndex(e),o=this.options.list[n],i=this.options.uniqueKeys[n];this.sortable.option("store",{item:o,key:i,index:n}),this.dispatchEvent("onDrag",{item:o,key:i,index:n,event:t})}},{key:"onDrop",value:function(t){var e,n,o,i=null===(e=p.get(t.from))||void 0===e?void 0:e.option("store"),r=i.item,s=i.key,l=i.index,c=this.options.list,u={key:s,item:r,list:c,event:t,changed:!1,oldList:a(c),oldIndex:l,newIndex:l};t.from===t.to&&t.node===t.target||this.handleDropEvent(t,u,l),this.dispatchEvent("onDrop",u),t.from===this.el&&this.rangeChanged&&(null===(n=p.dragged)||void 0===n||n.remove()),t.from!==t.to&&(null===(o=p.clone)||void 0===o||o.remove()),this.rangeChanged=!1}},{key:"handleDropEvent",value:function(t,e,n){var o=t.target.getAttribute("data-key"),i=-1,r=n;t.from===t.to?(((r=this.getIndex(e.key))<(i=this.getIndex(o))&&-1===t.relative||r>i&&1===t.relative)&&(i+=t.relative),i!==r&&(e.list.splice(r,1),e.list.splice(i,0,e.item))):(t.from===this.el&&(r=this.getIndex(e.key),e.list.splice(r,1)),t.to===this.el&&(r=-1,i=this.getIndex(o),0===t.relative?i=e.list.length:1===t.relative&&(i+=t.relative),e.list.splice(i,0,e.item))),e.changed=t.from!==t.to||i!==r,e.oldIndex=r,e.newIndex=i}},{key:"getIndex",value:function(t){if(null==t)return-1;for(var e=this.options.uniqueKeys,n=0,o=e.length;n<o;n++)if(m(e[n],t))return n;return-1}},{key:"dispatchEvent",value:function(t,e){var n=this.options[t];n&&n(e)}}]),t}(),x=["size","keeps","scroller","direction","debounceTime","throttleTime"],k=function(){function t(e){i(this,t),this.options=e;var n={size:0,keeps:0,buffer:0,wrapper:null,scroller:null,direction:"vertical",uniqueKeys:[],debounceTime:null,throttleTime:null};for(var o in n)!(o in this.options)&&(this.options[o]=n[o]);this.sizes=new Map,this.sizeType="INIT",this.fixedSize=0,this.averageSize=0,this.range={start:0,end:0,front:0,behind:0},this.offset=0,this.direction="STATIONARY",this.updateScrollElement(),this.updateOnScrollFunction(),this.addScrollEventListener(),this.checkIfUpdate(0,e.keeps-1)}return s(t,[{key:"isFixed",value:function(){return"FIXED"===this.sizeType}},{key:"isFront",value:function(){return"FRONT"===this.direction}},{key:"isBehind",value:function(){return"BEHIND"===this.direction}},{key:"isHorizontal",value:function(){return"horizontal"===this.options.direction}},{key:"getSize",value:function(t){return this.sizes.get(t)||this.getItemSize()}},{key:"getOffset",value:function(){var t=this.isHorizontal()?"scrollLeft":"scrollTop";return this.scrollEl[t]}},{key:"getScrollSize",value:function(){var t=this.isHorizontal()?"scrollWidth":"scrollHeight";return this.scrollEl[t]}},{key:"getClientSize",value:function(){var t=this.isHorizontal()?"offsetWidth":"offsetHeight";return this.scrollEl[t]}},{key:"scrollToOffset",value:function(t){var e=this.isHorizontal()?"scrollLeft":"scrollTop";this.scrollEl[e]=t}},{key:"scrollToIndex",value:function(t){if(t>=this.options.uniqueKeys.length-1)this.scrollToBottom();else{var e=this.getOffsetByRange(0,t),n=this.getScrollStartOffset();this.scrollToOffset(e+n)}}},{key:"scrollToBottom",value:function(){var t=this,e=this.getScrollSize();this.scrollToOffset(e),setTimeout((function(){var e=t.getClientSize(),n=t.getScrollSize();t.getOffset()+e+1<n&&t.scrollToBottom()}),5)}},{key:"option",value:function(t,e){var n=this,o=this.options[t];this.options[t]=e,"uniqueKeys"===t&&this.sizes.forEach((function(t,o){e.includes(o)||n.sizes.delete(o)})),"scroller"===t&&(o&&p.utils.off(o,"scroll",this.onScroll),this.updateScrollElement(),this.addScrollEventListener())}},{key:"updateRange",value:function(t){if(t)this.handleUpdate(t.start);else{var e=this.range.start;e=Math.max(e,0),this.handleUpdate(e)}}},{key:"onItemResized",value:function(t,e){e&&this.sizes.get(t)!==e&&(this.sizes.set(t,e),"INIT"===this.sizeType?(this.sizeType="FIXED",this.fixedSize=e):this.isFixed()&&this.fixedSize!==e&&(this.sizeType="DYNAMIC",this.fixedSize=0),this.averageSize||"DYNAMIC"!==this.sizeType||this.sizes.size!==this.options.keeps||this.updateAverageSize())}},{key:"updateAverageSize",value:function(){var t=a(this.sizes.values()).reduce((function(t,e){return t+e}),0);this.averageSize=Math.round(t/this.sizes.size)}},{key:"addScrollEventListener",value:function(){this.options.scroller&&p.utils.on(this.options.scroller,"scroll",this.onScroll)}},{key:"removeScrollEventListener",value:function(){this.options.scroller&&p.utils.off(this.options.scroller,"scroll",this.onScroll)}},{key:"enableScroll",value:function(t){var e=this.options.scroller,n=t?p.utils.off:p.utils.on,o="onwheel"in document.createElement("div")?"wheel":"mousewheel";n(e,"DOMMouseScroll",this.preventDefault),n(e,o,this.preventDefault),n(e,"touchmove",this.preventDefault),n(e,"keydown",this.preventDefaultForKeyDown)}},{key:"preventDefault",value:function(t){t.preventDefault()}},{key:"preventDefaultForKeyDown",value:function(t){if({37:1,38:1,39:1,40:1}[t.keyCode])return this.preventDefault(t),!1}},{key:"updateScrollElement",value:function(){var t=this.options.scroller;if(b(t)){var e=document.scrollingElement||document.documentElement||document.body;this.scrollEl=e}else this.scrollEl=t}},{key:"updateOnScrollFunction",value:function(){var t=this,e=this.options,n=e.debounceTime,o=e.throttleTime;this.onScroll=n?g((function(){return t.handleScroll()}),n):o?v((function(){return t.handleScroll()}),o):function(){return t.handleScroll()}}},{key:"handleScroll",value:function(){var t=this.getOffset(),e=this.getClientSize(),n=this.getScrollSize();t===this.offset?this.direction="STATIONARY":this.direction=t<this.offset?"FRONT":"BEHIND",this.offset=t;var o=this.isFront()&&t<=0,i=this.isBehind()&&e+t+1>=n;this.options.onScroll({top:o,bottom:i,offset:t,direction:this.direction}),this.isFront()?this.handleScrollFront():this.isBehind()&&this.handleScrollBehind()}},{key:"handleScrollFront",value:function(){var t=this.getScrollItems();if(!(t>=this.range.start)){var e=Math.max(t-this.options.buffer,0);this.checkIfUpdate(e,this.getEndByStart(e))}}},{key:"handleScrollBehind",value:function(){var t=this.getScrollItems();t<this.range.start+this.options.buffer||this.checkIfUpdate(t,this.getEndByStart(t))}},{key:"getScrollItems",value:function(){var t=this.offset-this.getScrollStartOffset();if(t<=0)return 0;if(this.isFixed())return Math.floor(t/this.fixedSize);for(var e=0,n=this.options.uniqueKeys.length,o=0,i=0;e<=n;){if(o=e+Math.floor((n-e)/2),(i=this.getOffsetByRange(0,o))===t)return o;i<t?e=o+1:i>t&&(n=o-1)}return e>0?--e:0}},{key:"checkIfUpdate",value:function(t,e){var n=this.options.keeps;this.options.uniqueKeys.length<=n?t=0:e-t<n-1&&(t=e-n+1),this.range.start!==t&&this.handleUpdate(t)}},{key:"handleUpdate",value:function(t){this.range.start=t,this.range.end=this.getEndByStart(t),this.range.front=this.getFrontOffset(),this.range.behind=this.getBehindOffset(),this.options.onUpdate(Object.assign({},this.range))}},{key:"getFrontOffset",value:function(){return this.isFixed()?this.fixedSize*this.range.start:this.getOffsetByRange(0,this.range.start)}},{key:"getBehindOffset",value:function(){var t=this.range.end,e=this.getLastIndex();return this.isFixed()?(e-t)*this.fixedSize:(e-t)*this.getItemSize()}},{key:"getOffsetByRange",value:function(t,e){if(t>=e)return 0;for(var n=0,o=t;o<e;o++){var i=this.sizes.get(this.options.uniqueKeys[o]);n+="number"==typeof i?i:this.getItemSize()}return n}},{key:"getEndByStart",value:function(t){return Math.min(t+this.options.keeps-1,this.getLastIndex())}},{key:"getLastIndex",value:function(){var t=this.options,e=t.uniqueKeys,n=t.keeps;return e.length>0?e.length-1:n-1}},{key:"getItemSize",value:function(){return this.isFixed()?this.fixedSize:this.options.size||this.averageSize}},{key:"getScrollStartOffset",value:function(){var t=this.options,e=t.wrapper,n=t.scroller;if(n===e)return 0;var o=0;if(n&&e){var i=this.isHorizontal()?"left":"top",r=b(n)?p.utils.getRect(e):p.utils.getRect(e,!0,n);o=this.offset+r[i]}return o}}]),t}();function E(t){var e=t.dataKey,o=t.sizeKey,i=t.dragging,r=t.chosenKey,s=t.children,l=t.onSizeChange,a=n.useRef(null);n.useLayoutEffect((function(){var t;return void 0!==("undefined"==typeof ResizeObserver?"undefined":u(ResizeObserver))&&(t=new ResizeObserver((function(){var t=a.current[o];l(e,t)})),a.current&&(null==t||t.observe(a.current))),function(){t&&(t.disconnect(),t=null)}}),[a]);var c=n.useMemo((function(){var t=s.props.style||{},n=m(e,r);return i&&n?Object.assign(t,{display:"none"}):t}),[r,i]);return n.cloneElement(s,{"data-key":e,role:"item",ref:a,style:c,className:s.props.className})}var O=n.memo(E);function I(t,e){n.useEffect(e,Object.values(t))}var T="onDrag",z="onDrop",C="onTop",D="onBottom";function _(t,e){var o=t.dataKey,i=void 0===o?"":o,r=t.dataSource,s=void 0===r?[]:r,u=t.tableMode,h=void 0!==u&&u,d=t.wrapTag,f=void 0===d?"div":d,p=t.rootTag,v=void 0===p?"div":p,b=t.style,E=void 0===b?{}:b,_=t.className,M=void 0===_?"":_,R=t.wrapStyle,N=void 0===R?{}:R,B=t.wrapClass,j=void 0===B?"":B,A=t.size,H=void 0===A?void 0:A,P=t.keeps,K=void 0===P?30:P,L=t.scroller,F=void 0===L?void 0:L,Y=t.direction,U=void 0===Y?"vertical":Y,W=t.debounceTime,X=void 0===W?0:W,q=t.throttleTime,V=void 0===q?0:q,G=t.delay,$=void 0===G?0:G,J=t.group,Q=void 0===J?"":J,Z=t.handle,tt=void 0===Z?"":Z,et=t.lockAxis,nt=void 0===et?void 0:et,ot=t.disabled,it=void 0!==ot&&ot,rt=t.sortable,st=void 0===rt||rt,lt=t.draggable,at=void 0===lt?'[role="item"]':lt,ct=t.animation,ut=void 0===ct?150:ct,ht=t.autoScroll,dt=void 0===ht||ht,ft=t.scrollSpeed,pt=void 0===ft?{x:10,y:10}:ft,vt=t.ghostClass,gt=void 0===vt?"":vt,mt=t.ghostStyle,yt=void 0===mt?void 0:mt,bt=t.chosenClass,St=void 0===bt?"":bt,wt=t.placeholderClass,xt=void 0===wt?"":wt,kt=t.fallbackOnBody,Et=void 0!==kt&&kt,Ot=t.scrollThreshold,It=void 0===Ot?55:Ot,Tt=t.delayOnTouchOnly,zt=void 0!==Tt&&Tt,Ct=l(n.useState({start:0,end:K-1,front:0,behind:0}),2),Dt=Ct[0],_t=Ct[1],Mt=n.useRef(!1),Rt=n.useRef(""),Nt=n.useRef([]),Bt=n.useRef(),jt=n.useRef(),At=function(t){return qt.current.getSize(t)},Ht=function(){return qt.current.getOffset()},Pt=function(){return qt.current.getClientSize()},Kt=function(){return qt.current.getScrollSize()},Lt=function(t){var e;null===(e=qt.current)||void 0===e||e.scrollToOffset(t)},Ft=function(t){var e;null===(e=qt.current)||void 0===e||e.scrollToIndex(t)},Yt=function(t){var e,n=Nt.current.indexOf(t);n>-1&&(null===(e=qt.current)||void 0===e||e.scrollToIndex(n))},Ut=function(){Lt(0)},Wt=function(){var t;null===(t=qt.current)||void 0===t||t.scrollToBottom()};n.useImperativeHandle(e,(function(){return{getSize:At,getOffset:Ht,getClientSize:Pt,getScrollSize:Kt,scrollToTop:Ut,scrollToKey:Yt,scrollToIndex:Ft,scrollToOffset:Lt,scrollToBottom:Wt}})),n.useEffect((function(){return Zt(),le(),function(){var t,e;null===(t=qt.current)||void 0===t||t.removeScrollEventListener(),null===(e=ee.current)||void 0===e||e.destroy()}}),[]);var Xt=n.useRef(!1),qt=n.useRef(),Vt={size:H,keeps:K,scroller:F,direction:U,debounceTime:X,throttleTime:V},Gt=g((function(){var e;Xt.current=!0,null===(e=t[C])||void 0===e||e.call(t)}),50),$t=g((function(){var e;null===(e=t[D])||void 0===e||e.call(t)}),50),Jt=function(t){Xt.current=!1,t.top?Gt():t.bottom&&$t()},Qt=function(t){_t((function(e){return ee.current&&Mt.current&&t.start!==e.start&&(ee.current.rangeChanged=!0),t}))},Zt=function(){qt.current=new k(Object.assign(Object.assign({},Vt),{buffer:Math.round(K/3),wrapper:jt.current,scroller:F||Bt.current,uniqueKeys:Nt.current,onScroll:Jt,onUpdate:Qt}))};I(Vt,(function(){x.forEach((function(e){var n;void 0!==t[e]&&(null===(n=qt.current)||void 0===n||n.option(e,t[e]))}))}));var te=n.useRef(0);n.useEffect((function(){var e;if(te.current&&Xt.current&&t.keepOffset){var n=Math.abs(s.length-te.current);n>0&&(null===(e=qt.current)||void 0===e||e.scrollToIndex(n)),Xt.current=!1}te.current=s.length}),[s]);var ee=n.useRef(),ne={delay:$,group:Q,handle:tt,lockAxis:nt,disabled:it,sortable:st,draggable:at,animation:ut,autoScroll:dt,ghostClass:gt,ghostStyle:yt,chosenClass:St,scrollSpeed:pt,fallbackOnBody:Et,scrollThreshold:It,delayOnTouchOnly:zt,placeholderClass:xt},oe=function(t){Rt.current=t.node.getAttribute("data-key")},ie=function(){Rt.current=""},re=function(e){var n,o,i;Mt.current=!0,st||(null===(n=qt.current)||void 0===n||n.enableScroll(!1),null===(o=ee.current)||void 0===o||o.option("autoScroll",!1)),null===(i=t[T])||void 0===i||i.call(t,e)},se=function(e){var n,o,i;Mt.current=!1,null===(n=qt.current)||void 0===n||n.enableScroll(!0),null===(o=ee.current)||void 0===o||o.option("autoScroll",t.autoScroll);var r=Object.assign(Object.assign({},e),{list:a(e.list)});null===(i=t[z])||void 0===i||i.call(t,r)},le=function(){ee.current=new w(Bt.current,Object.assign(Object.assign({},ne),{list:s,uniqueKeys:Nt.current,onDrag:re,onDrop:se,onChoose:oe,onUnchoose:ie}))};I(ne,(function(){S.forEach((function(e){var n;void 0!==t[e]&&(null===(n=ee.current)||void 0===n||n.option(e,t[e]))}))}));var ae=n.useRef([]);n.useEffect((function(){var t;ce(),ue(ae.current,s),ae.current=s,null===(t=ee.current)||void 0===t||t.option("list",s)}),[s]);var ce=function(){var t,e;Nt.current=s.map((function(t){return y(t,i)})),null===(t=qt.current)||void 0===t||t.option("uniqueKeys",Nt.current),null===(e=ee.current)||void 0===e||e.option("uniqueKeys",Nt.current)},ue=function(t,e){var n;if((t.length||e.length)&&t.length!==e.length){var o=Object.assign({},Dt);t.length>K&&e.length>t.length&&o.end===t.length-1&&he()&&o.start++,null===(n=qt.current)||void 0===n||n.updateRange(o)}},he=function(){return Ht()+Pt()+1>=Kt()},de=n.useMemo((function(){var t=Dt.front,e=Dt.behind,n="vertical"!==U,o=n?"auto hidden":"hidden auto",i=n?"0px ".concat(e,"px 0px ").concat(t,"px"):"".concat(t,"px 0px ").concat(e,"px");return{containerStyle:Object.assign(Object.assign({},E),{overflow:h||F?"":o}),wrapperStyle:Object.assign(Object.assign({},N),{padding:h?"":i}),itemSizeKey:n?"offsetWidth":"offsetHeight"}}),[Dt,E,N,F,h,U]),fe=de.containerStyle,pe=de.wrapperStyle,ve=de.itemSizeKey,ge=l(n.useMemo((function(){return[h?"table":f,h?"tbody":f]}),[v,f,h]),2),me=ge[0],ye=ge[1],be=function(t){var e=t.list,o=t.start,i=t.end,r=t.dataKey,s=t.sizeKey,l=t.dragging,a=t.chosenKey,c=t.children,u=t.onSizeChange;return e.slice(o,i+1).map((function(t,e){var i=o+e,h=y(t,r);return n.createElement(O,{key:h,dataKey:h,sizeKey:s,dragging:l,chosenKey:a,onSizeChange:u},"function"==typeof c?c(t,i,h):c)}))}({list:s,start:Dt.start,end:Dt.end,dataKey:i,sizeKey:ve,children:t.children,dragging:Mt.current,chosenKey:Rt.current,onSizeChange:function(t,e){var n,o;if(!m(t,Rt.current)){var i=null===(n=qt.current)||void 0===n?void 0:n.sizes.size;null===(o=qt.current)||void 0===o||o.onItemResized(t,e),i===K-1&&s.length>K&&qt.current.updateRange(Object.assign({},Dt))}}}),Se=function(t,e){var o,i,r,s=(o={padding:0,border:0},i="vertical"===U?"height":"width",r="".concat(t,"px"),(i=c(i))in o?Object.defineProperty(o,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[i]=r,o);return n.createElement("tr",{key:e},n.createElement("td",{style:s}))};return n.createElement(me,{ref:Bt,style:fe,className:M},[t.header,n.createElement(ye,{ref:jt,key:"virtual-table-wrap",style:pe,className:j},[h&&Se(Dt.front,"virtual-table-front")].concat(a(be),[h&&Se(Dt.behind,"virtual-table-behind")])),t.footer])}return n.forwardRef(_)}));
|
package/package.json
CHANGED
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-virtual-sortable",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A virtual scrolling list component that can be sorted by dragging",
|
|
5
|
-
"main": "dist/virtual-list.js",
|
|
6
|
-
"types": "types/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"types"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "rollup --config",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"docs:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"virtual
|
|
29
|
-
"
|
|
30
|
-
"big-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"@babel/
|
|
45
|
-
"@babel/
|
|
46
|
-
"@babel/preset-
|
|
47
|
-
"@babel/preset-
|
|
48
|
-
"@
|
|
49
|
-
"@rollup/plugin-
|
|
50
|
-
"@rollup/plugin-
|
|
51
|
-
"@rollup/plugin-
|
|
52
|
-
"@rollup/plugin-
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"react
|
|
60
|
-
"
|
|
61
|
-
"rollup
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-virtual-sortable",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "A virtual scrolling list component that can be sorted by dragging",
|
|
5
|
+
"main": "dist/virtual-list.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"types"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rollup --config",
|
|
13
|
+
"publish": "npm publish",
|
|
14
|
+
"core:update": "git submodule update --remote",
|
|
15
|
+
"docs:dev": "cross-env APP_ROOT=dumi dumi dev",
|
|
16
|
+
"docs:build": "cross-env APP_ROOT=dumi dumi build"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/mfuu/react-virtual-sortable.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"sort",
|
|
24
|
+
"drag",
|
|
25
|
+
"drop",
|
|
26
|
+
"sortable",
|
|
27
|
+
"draggable",
|
|
28
|
+
"virtual",
|
|
29
|
+
"virtual-list",
|
|
30
|
+
"big-data",
|
|
31
|
+
"big-list",
|
|
32
|
+
"infinite"
|
|
33
|
+
],
|
|
34
|
+
"author": "mfuu",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/mfuu/react-virtual-sortable/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/mfuu/react-virtual-sortable#readme",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"sortable-dnd": "^0.6.23"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@babel/core": "^7.16.7",
|
|
45
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
46
|
+
"@babel/preset-env": "^7.16.11",
|
|
47
|
+
"@babel/preset-react": "^7.16.7",
|
|
48
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
49
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
50
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
51
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
52
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
53
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
54
|
+
"@types/react": "^18.3.12",
|
|
55
|
+
"cross-env": "^7.0.3",
|
|
56
|
+
"dumi": "^2.4.14",
|
|
57
|
+
"mockjs": "^1.1.0",
|
|
58
|
+
"prettier": "^2.8.8",
|
|
59
|
+
"react": "^18.0.0",
|
|
60
|
+
"react-dom": "^18.0.0",
|
|
61
|
+
"rollup": "^2.69.2",
|
|
62
|
+
"rollup-plugin-dts": "^4.2.0",
|
|
63
|
+
"ts-loader": "^9.2.6",
|
|
64
|
+
"tslib": "^2.3.1",
|
|
65
|
+
"typescript": "^4.5.4"
|
|
66
|
+
}
|
|
67
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SortableEvent, Group, ScrollSpeed } from 'sortable-dnd';
|
|
3
3
|
|
|
4
|
-
interface DragEvent<T> {
|
|
5
|
-
item: T;
|
|
6
|
-
key: string | number;
|
|
7
|
-
index?: number;
|
|
8
|
-
event: SortableEvent;
|
|
9
|
-
}
|
|
10
|
-
interface DropEvent<T> {
|
|
11
|
-
key: string | number;
|
|
12
|
-
item: T;
|
|
13
|
-
list: T[];
|
|
14
|
-
event: SortableEvent;
|
|
15
|
-
changed: boolean;
|
|
16
|
-
oldList: T[];
|
|
17
|
-
oldIndex: number;
|
|
18
|
-
newIndex: number;
|
|
4
|
+
interface DragEvent<T> {
|
|
5
|
+
item: T;
|
|
6
|
+
key: string | number;
|
|
7
|
+
index?: number;
|
|
8
|
+
event: SortableEvent;
|
|
9
|
+
}
|
|
10
|
+
interface DropEvent<T> {
|
|
11
|
+
key: string | number;
|
|
12
|
+
item: T;
|
|
13
|
+
list: T[];
|
|
14
|
+
event: SortableEvent;
|
|
15
|
+
changed: boolean;
|
|
16
|
+
oldList: T[];
|
|
17
|
+
oldIndex: number;
|
|
18
|
+
newIndex: number;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
declare type RenderFunc<T> = (item: T, index: number, key: string | number) => React.ReactElement;
|
|
22
|
-
interface VirtualProps<T> {
|
|
23
|
-
dataKey: string;
|
|
24
|
-
dataSource: T[];
|
|
25
|
-
children: React.ReactElement | RenderFunc<T>;
|
|
26
|
-
tableMode?: boolean;
|
|
27
|
-
keeps?: number;
|
|
28
|
-
size?: number;
|
|
29
|
-
group?: Group | string;
|
|
30
|
-
handle?: string;
|
|
31
|
-
lockAxis?: 'x' | 'y';
|
|
32
|
-
scroller?: HTMLElement | Document;
|
|
33
|
-
direction?: 'vertical' | 'horizontal';
|
|
34
|
-
debounceTime?: number;
|
|
35
|
-
throttleTime?: number;
|
|
36
|
-
delay?: number;
|
|
37
|
-
disabled?: boolean;
|
|
38
|
-
sortable?: boolean;
|
|
39
|
-
draggable?: string;
|
|
40
|
-
animation?: number;
|
|
41
|
-
keepOffset?: boolean;
|
|
42
|
-
autoScroll?: boolean;
|
|
43
|
-
scrollSpeed?: ScrollSpeed;
|
|
44
|
-
fallbackOnBody?: boolean;
|
|
45
|
-
scrollThreshold?: number;
|
|
46
|
-
delayOnTouchOnly?: boolean;
|
|
47
|
-
rootTag?: string;
|
|
48
|
-
wrapTag?: string;
|
|
49
|
-
style?: CSSStyleDeclaration;
|
|
50
|
-
className?: string;
|
|
51
|
-
wrapStyle?: CSSStyleDeclaration;
|
|
52
|
-
wrapClass?: string;
|
|
53
|
-
ghostStyle?: CSSStyleDeclaration;
|
|
54
|
-
ghostClass?: string;
|
|
55
|
-
chosenClass?: string;
|
|
56
|
-
placeholderClass?: string;
|
|
57
|
-
header?: React.ReactNode;
|
|
58
|
-
footer?: React.ReactNode;
|
|
59
|
-
onTop?: () => void;
|
|
60
|
-
onBottom?: () => void;
|
|
61
|
-
onDrag?: (event: DragEvent<T>) => void;
|
|
62
|
-
onDrop?: (event: DropEvent<T>) => void;
|
|
63
|
-
}
|
|
64
|
-
interface VirtualComponentRef {
|
|
65
|
-
getSize: (key: string | number) => number;
|
|
66
|
-
getOffset: () => number;
|
|
67
|
-
getClientSize: () => number;
|
|
68
|
-
getScrollSize: () => number;
|
|
69
|
-
scrollToTop: () => void;
|
|
70
|
-
scrollToKey: (key: string | number) => void;
|
|
71
|
-
scrollToIndex: (index: number) => void;
|
|
72
|
-
scrollToOffset: (offset: number) => void;
|
|
73
|
-
scrollToBottom: () => void;
|
|
21
|
+
declare type RenderFunc<T> = (item: T, index: number, key: string | number) => React.ReactElement;
|
|
22
|
+
interface VirtualProps<T> {
|
|
23
|
+
dataKey: string;
|
|
24
|
+
dataSource: T[];
|
|
25
|
+
children: React.ReactElement | RenderFunc<T>;
|
|
26
|
+
tableMode?: boolean;
|
|
27
|
+
keeps?: number;
|
|
28
|
+
size?: number;
|
|
29
|
+
group?: Group | string;
|
|
30
|
+
handle?: string;
|
|
31
|
+
lockAxis?: 'x' | 'y';
|
|
32
|
+
scroller?: HTMLElement | Document;
|
|
33
|
+
direction?: 'vertical' | 'horizontal';
|
|
34
|
+
debounceTime?: number;
|
|
35
|
+
throttleTime?: number;
|
|
36
|
+
delay?: number;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
sortable?: boolean;
|
|
39
|
+
draggable?: string;
|
|
40
|
+
animation?: number;
|
|
41
|
+
keepOffset?: boolean;
|
|
42
|
+
autoScroll?: boolean;
|
|
43
|
+
scrollSpeed?: ScrollSpeed;
|
|
44
|
+
fallbackOnBody?: boolean;
|
|
45
|
+
scrollThreshold?: number;
|
|
46
|
+
delayOnTouchOnly?: boolean;
|
|
47
|
+
rootTag?: string;
|
|
48
|
+
wrapTag?: string;
|
|
49
|
+
style?: CSSStyleDeclaration;
|
|
50
|
+
className?: string;
|
|
51
|
+
wrapStyle?: CSSStyleDeclaration;
|
|
52
|
+
wrapClass?: string;
|
|
53
|
+
ghostStyle?: CSSStyleDeclaration;
|
|
54
|
+
ghostClass?: string;
|
|
55
|
+
chosenClass?: string;
|
|
56
|
+
placeholderClass?: string;
|
|
57
|
+
header?: React.ReactNode;
|
|
58
|
+
footer?: React.ReactNode;
|
|
59
|
+
onTop?: () => void;
|
|
60
|
+
onBottom?: () => void;
|
|
61
|
+
onDrag?: (event: DragEvent<T>) => void;
|
|
62
|
+
onDrop?: (event: DropEvent<T>) => void;
|
|
63
|
+
}
|
|
64
|
+
interface VirtualComponentRef {
|
|
65
|
+
getSize: (key: string | number) => number;
|
|
66
|
+
getOffset: () => number;
|
|
67
|
+
getClientSize: () => number;
|
|
68
|
+
getScrollSize: () => number;
|
|
69
|
+
scrollToTop: () => void;
|
|
70
|
+
scrollToKey: (key: string | number) => void;
|
|
71
|
+
scrollToIndex: (index: number) => void;
|
|
72
|
+
scrollToOffset: (offset: number) => void;
|
|
73
|
+
scrollToBottom: () => void;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
declare function VirtualList<T>(props: VirtualProps<T>, ref: React.ForwardedRef<VirtualComponentRef>): React.ReactElement<{
|
|
77
|
-
ref: React.MutableRefObject<HTMLElement | undefined>;
|
|
78
|
-
style: {
|
|
79
|
-
overflow: string;
|
|
80
|
-
};
|
|
81
|
-
className: string;
|
|
82
|
-
}, string | React.JSXElementConstructor<any>>;
|
|
83
|
-
declare const _default: <T>(props: VirtualProps<T> & {
|
|
84
|
-
ref?: React.ForwardedRef<VirtualComponentRef> | undefined;
|
|
76
|
+
declare function VirtualList<T>(props: VirtualProps<T>, ref: React.ForwardedRef<VirtualComponentRef>): React.ReactElement<{
|
|
77
|
+
ref: React.MutableRefObject<HTMLElement | undefined>;
|
|
78
|
+
style: {
|
|
79
|
+
overflow: string;
|
|
80
|
+
};
|
|
81
|
+
className: string;
|
|
82
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
83
|
+
declare const _default: <T>(props: VirtualProps<T> & {
|
|
84
|
+
ref?: React.ForwardedRef<VirtualComponentRef> | undefined;
|
|
85
85
|
}) => ReturnType<typeof VirtualList>;
|
|
86
86
|
|
|
87
87
|
export { _default as default };
|