deepsea-components 5.16.15 → 5.17.0
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/dist/components/AutoFit.cjs +9 -9
- package/dist/components/AutoFit.js +9 -9
- package/dist/components/AutoScroll.cjs +4 -4
- package/dist/components/AutoScroll.js +4 -4
- package/dist/components/AutoSizeTextarea.cjs +23 -81
- package/dist/components/AutoSizeTextarea.js +23 -81
- package/dist/components/CircleText.cjs +24 -120
- package/dist/components/CircleText.js +24 -120
- package/dist/components/CopyButton.cjs +2 -2
- package/dist/components/CopyButton.js +2 -2
- package/dist/components/DraggableGrid.cjs +98 -149
- package/dist/components/DraggableGrid.js +98 -149
- package/dist/components/Echart.cjs +24 -94
- package/dist/components/Echart.js +24 -94
- package/dist/components/Flow.cjs +8 -8
- package/dist/components/Flow.js +8 -8
- package/dist/components/FormLabel.cjs +27 -92
- package/dist/components/FormLabel.js +27 -92
- package/dist/components/HlsPlayer.cjs +24 -65
- package/dist/components/HlsPlayer.js +24 -65
- package/dist/components/IconFileType.cjs +4 -14
- package/dist/components/IconFileType.js +4 -14
- package/dist/components/InfiniteScroll.cjs +4 -4
- package/dist/components/InfiniteScroll.js +4 -4
- package/dist/components/InputFile.cjs +11 -2
- package/dist/components/InputFile.d.ts +8 -0
- package/dist/components/InputFile.js +11 -2
- package/dist/components/InputFileButton.cjs +18 -9
- package/dist/components/InputFileButton.js +18 -9
- package/dist/components/ReadSheet.cjs +7 -32
- package/dist/components/ReadSheet.js +7 -32
- package/dist/components/Ring.cjs +10 -48
- package/dist/components/Ring.js +10 -48
- package/dist/components/ScrollMask.cjs +11 -97
- package/dist/components/ScrollMask.js +11 -97
- package/dist/components/SectionRing.cjs +15 -60
- package/dist/components/SectionRing.js +15 -60
- package/dist/components/TransitionBox.cjs +28 -118
- package/dist/components/TransitionBox.js +28 -118
- package/dist/components/TransitionNum.cjs +8 -8
- package/dist/components/TransitionNum.js +8 -8
- package/dist/components/Trapezium.cjs +9 -68
- package/dist/components/Trapezium.js +9 -68
- package/dist/components/Unify.cjs +19 -79
- package/dist/components/Unify.js +19 -79
- package/package.json +3 -3
- package/src/components/InputFile.tsx +23 -2
- package/src/components/InputFileButton.tsx +16 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { clsx, getArray, isNullable } from "deepsea-tools";
|
|
5
4
|
import { useDragMove } from "soda-hooks";
|
|
@@ -65,68 +64,18 @@ function getOrderToKey(keyToOrder) {
|
|
|
65
64
|
key
|
|
66
65
|
]));
|
|
67
66
|
}
|
|
68
|
-
function DraggableGridItem(
|
|
69
|
-
const $ = c(19);
|
|
70
|
-
let handle;
|
|
71
|
-
let item;
|
|
72
|
-
let itemKey;
|
|
73
|
-
let onDragMove;
|
|
74
|
-
let onDragMoveEnd;
|
|
75
|
-
let onDragMoveStart;
|
|
76
|
-
let rest;
|
|
77
|
-
if ($[0] !== t0) {
|
|
78
|
-
({ item, itemKey, handle, onDragMoveStart, onDragMove, onDragMoveEnd, ...rest } = t0);
|
|
79
|
-
$[0] = t0;
|
|
80
|
-
$[1] = handle;
|
|
81
|
-
$[2] = item;
|
|
82
|
-
$[3] = itemKey;
|
|
83
|
-
$[4] = onDragMove;
|
|
84
|
-
$[5] = onDragMoveEnd;
|
|
85
|
-
$[6] = onDragMoveStart;
|
|
86
|
-
$[7] = rest;
|
|
87
|
-
} else {
|
|
88
|
-
handle = $[1];
|
|
89
|
-
item = $[2];
|
|
90
|
-
itemKey = $[3];
|
|
91
|
-
onDragMove = $[4];
|
|
92
|
-
onDragMoveEnd = $[5];
|
|
93
|
-
onDragMoveStart = $[6];
|
|
94
|
-
rest = $[7];
|
|
95
|
-
}
|
|
67
|
+
function DraggableGridItem({ item, itemKey, handle, onDragMoveStart, onDragMove, onDragMoveEnd, ...rest }) {
|
|
96
68
|
const element = useRef(null);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
t2 = {
|
|
108
|
-
element: t1,
|
|
109
|
-
onDragMoveStart,
|
|
110
|
-
onDragMove,
|
|
111
|
-
onDragMoveEnd
|
|
112
|
-
};
|
|
113
|
-
$[12] = onDragMove;
|
|
114
|
-
$[13] = onDragMoveEnd;
|
|
115
|
-
$[14] = onDragMoveStart;
|
|
116
|
-
$[15] = t1;
|
|
117
|
-
$[16] = t2;
|
|
118
|
-
} else t2 = $[16];
|
|
119
|
-
useDragMove(t2);
|
|
120
|
-
let t3;
|
|
121
|
-
if ($[17] !== rest) {
|
|
122
|
-
t3 = /*#__PURE__*/ jsx("div", {
|
|
123
|
-
ref: element,
|
|
124
|
-
...rest
|
|
125
|
-
});
|
|
126
|
-
$[17] = rest;
|
|
127
|
-
$[18] = t3;
|
|
128
|
-
} else t3 = $[18];
|
|
129
|
-
return t3;
|
|
69
|
+
useDragMove({
|
|
70
|
+
element: isNullable(handle) ? element : ()=>element.current && ("string" == typeof handle ? element.current.querySelector(handle) : "function" == typeof handle ? handle(item, itemKey, element.current) : handle),
|
|
71
|
+
onDragMoveStart,
|
|
72
|
+
onDragMove,
|
|
73
|
+
onDragMoveEnd
|
|
74
|
+
});
|
|
75
|
+
return /*#__PURE__*/ jsx("div", {
|
|
76
|
+
ref: element,
|
|
77
|
+
...rest
|
|
78
|
+
});
|
|
130
79
|
}
|
|
131
80
|
function isLegalOrderMap({ orders, keys, orderMap }) {
|
|
132
81
|
if (!isTheSameIterable(orderMap.keys(), keys)) return false;
|
|
@@ -135,7 +84,7 @@ function isLegalOrderMap({ orders, keys, orderMap }) {
|
|
|
135
84
|
return values.length === new Set(values).size;
|
|
136
85
|
}
|
|
137
86
|
function DraggableGrid({ className, classNames, style, items = [], disabled, columns, rows, gap = 0, gapX = gap, gapY = gap, itemWidth, itemHeight, orderMap, onOrderMapChange, render, keyExtractor, isItemDisabled: _isItemDisabled, isOrderDisabled, orderPriority, handle, onDragMoveStart: _onDragMoveStart, onDragMove: _onDragMove, onDragMoveEnd: _onDragMoveEnd, ...rest }) {
|
|
138
|
-
const
|
|
87
|
+
const keyToItem = useMemo(()=>{
|
|
139
88
|
const keyToItem = new Map();
|
|
140
89
|
items.forEach((item)=>{
|
|
141
90
|
const key = keyExtractor ? keyExtractor(item) : item;
|
|
@@ -146,8 +95,8 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
146
95
|
items,
|
|
147
96
|
keyExtractor
|
|
148
97
|
]);
|
|
149
|
-
if (
|
|
150
|
-
const
|
|
98
|
+
if (keyToItem.size !== items.length) throw new Error("there are duplicate keys in the items");
|
|
99
|
+
const orders = useMemo(()=>{
|
|
151
100
|
let orders = getArray(columns * rows);
|
|
152
101
|
if (isOrderDisabled) orders = orders.filter((order)=>Array.isArray(isOrderDisabled) ? !isOrderDisabled.includes(order) : !isOrderDisabled(order));
|
|
153
102
|
if (orderPriority) orders = orders.toSorted(orderPriority);
|
|
@@ -160,14 +109,14 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
160
109
|
]);
|
|
161
110
|
const [keyToOrder, setKeyToOrder] = useState(()=>{
|
|
162
111
|
if (orderMap && isLegalOrderMap({
|
|
163
|
-
orders
|
|
164
|
-
keys:
|
|
112
|
+
orders,
|
|
113
|
+
keys: keyToItem.keys(),
|
|
165
114
|
orderMap
|
|
166
115
|
})) return orderMap;
|
|
167
116
|
const newOrderMap = getOrderMap({
|
|
168
117
|
prev: orderMap,
|
|
169
|
-
orders
|
|
170
|
-
keys: Array.from(
|
|
118
|
+
orders,
|
|
119
|
+
keys: Array.from(keyToItem.keys()),
|
|
171
120
|
orderPriority
|
|
172
121
|
});
|
|
173
122
|
null == onOrderMapChange || onOrderMapChange(newOrderMap);
|
|
@@ -175,29 +124,29 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
175
124
|
});
|
|
176
125
|
const [dragging, setDragging] = useState(void 0);
|
|
177
126
|
const { current: cache } = useRef({
|
|
178
|
-
orders
|
|
179
|
-
keys: Array.from(
|
|
127
|
+
orders,
|
|
128
|
+
keys: Array.from(keyToItem.keys())
|
|
180
129
|
});
|
|
181
130
|
useEffect(()=>{
|
|
182
|
-
if (!isTheSameArray((null == dragging ? void 0 : dragging.orders) ?? cache.orders,
|
|
183
|
-
cache.orders =
|
|
184
|
-
cache.keys = Array.from(((null == dragging ? void 0 : dragging.keyToOrder) ??
|
|
185
|
-
const
|
|
131
|
+
if (!isTheSameArray((null == dragging ? void 0 : dragging.orders) ?? cache.orders, orders) || !isTheSameIterable((null == dragging ? void 0 : dragging.keyToOrder.keys()) ?? cache.keys, keyToItem.keys())) {
|
|
132
|
+
cache.orders = orders;
|
|
133
|
+
cache.keys = Array.from(((null == dragging ? void 0 : dragging.keyToOrder) ?? keyToItem).keys());
|
|
134
|
+
const newOrderMap = getOrderMap({
|
|
186
135
|
prev: (null == dragging ? void 0 : dragging.keyToOrder) ?? keyToOrder,
|
|
187
|
-
orders
|
|
136
|
+
orders,
|
|
188
137
|
keys: cache.keys,
|
|
189
138
|
orderPriority
|
|
190
139
|
});
|
|
191
|
-
setKeyToOrder(
|
|
192
|
-
null == onOrderMapChange || onOrderMapChange(
|
|
193
|
-
const newRenderKeys = new Set(
|
|
140
|
+
setKeyToOrder(newOrderMap);
|
|
141
|
+
null == onOrderMapChange || onOrderMapChange(newOrderMap);
|
|
142
|
+
const newRenderKeys = new Set(newOrderMap.keys());
|
|
194
143
|
setRenderKeys((prev)=>prev.intersection(newRenderKeys).union(newRenderKeys.difference(prev)));
|
|
195
144
|
}
|
|
196
145
|
}, [
|
|
197
146
|
dragging,
|
|
198
147
|
cache,
|
|
199
|
-
|
|
200
|
-
|
|
148
|
+
orders,
|
|
149
|
+
keyToItem,
|
|
201
150
|
keyToOrder,
|
|
202
151
|
orderPriority,
|
|
203
152
|
onOrderMapChange
|
|
@@ -205,31 +154,31 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
205
154
|
const [renderKeys, setRenderKeys] = useState(()=>new Set(keyToOrder.keys()));
|
|
206
155
|
const recent = useRef(void 0);
|
|
207
156
|
useEffect(()=>{
|
|
208
|
-
if (!!dragging && (!isTheSameArray(dragging.orders,
|
|
157
|
+
if (!!dragging && (!isTheSameArray(dragging.orders, orders) || dragging.columns !== columns || dragging.rows !== rows || dragging.gapX !== gapX || dragging.gapY !== gapY || dragging.itemWidth !== itemWidth || dragging.itemHeight !== itemHeight || !isTheSameIterable(dragging.keyToOrder.keys(), keyToItem.keys()))) {
|
|
209
158
|
setDragging(void 0);
|
|
210
|
-
if (isTheSameArray(dragging.orders,
|
|
159
|
+
if (isTheSameArray(dragging.orders, orders) && isTheSameIterable(dragging.keyToOrder.keys(), keyToItem.keys())) {
|
|
211
160
|
setKeyToOrder(dragging.keyToOrder);
|
|
212
161
|
null == onOrderMapChange || onOrderMapChange(dragging.keyToOrder);
|
|
213
162
|
}
|
|
214
163
|
}
|
|
215
164
|
}, [
|
|
216
165
|
dragging,
|
|
217
|
-
|
|
166
|
+
orders,
|
|
218
167
|
columns,
|
|
219
168
|
rows,
|
|
220
169
|
gapX,
|
|
221
170
|
gapY,
|
|
222
171
|
itemWidth,
|
|
223
172
|
itemHeight,
|
|
224
|
-
|
|
173
|
+
keyToItem,
|
|
225
174
|
keyToOrder,
|
|
226
175
|
onOrderMapChange
|
|
227
176
|
]);
|
|
228
177
|
useEffect(()=>{
|
|
229
178
|
if (orderMap === keyToOrder) return;
|
|
230
179
|
if (!!orderMap && isLegalOrderMap({
|
|
231
|
-
orders
|
|
232
|
-
keys:
|
|
180
|
+
orders,
|
|
181
|
+
keys: keyToItem.keys(),
|
|
233
182
|
orderMap
|
|
234
183
|
})) setKeyToOrder(orderMap);
|
|
235
184
|
else null == onOrderMapChange || onOrderMapChange(keyToOrder);
|
|
@@ -238,24 +187,24 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
238
187
|
keyToOrder,
|
|
239
188
|
onOrderMapChange
|
|
240
189
|
]);
|
|
241
|
-
function onDragMoveStart(
|
|
190
|
+
function onDragMoveStart(key, event) {
|
|
242
191
|
null == _onDragMoveStart || _onDragMoveStart(event);
|
|
243
192
|
const position = getPosition({
|
|
244
|
-
order: keyToOrder.get(
|
|
193
|
+
order: keyToOrder.get(key),
|
|
245
194
|
columns,
|
|
246
195
|
gapX,
|
|
247
196
|
gapY,
|
|
248
197
|
itemWidth,
|
|
249
198
|
itemHeight
|
|
250
199
|
});
|
|
251
|
-
recent.current =
|
|
200
|
+
recent.current = key;
|
|
252
201
|
setDragging({
|
|
253
|
-
key
|
|
202
|
+
key,
|
|
254
203
|
startX: position.x,
|
|
255
204
|
startY: position.y,
|
|
256
205
|
deltaX: event.deltaX,
|
|
257
206
|
deltaY: event.deltaY,
|
|
258
|
-
orders
|
|
207
|
+
orders,
|
|
259
208
|
columns,
|
|
260
209
|
rows,
|
|
261
210
|
gapX,
|
|
@@ -265,65 +214,65 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
265
214
|
keyToOrder: keyToOrder
|
|
266
215
|
});
|
|
267
216
|
}
|
|
268
|
-
function onDragMove(
|
|
269
|
-
null == _onDragMove || _onDragMove(
|
|
217
|
+
function onDragMove(event) {
|
|
218
|
+
null == _onDragMove || _onDragMove(event);
|
|
270
219
|
if (!dragging) return;
|
|
271
|
-
const { deltaX, deltaY } =
|
|
272
|
-
const { key
|
|
273
|
-
setDragging((
|
|
274
|
-
...
|
|
220
|
+
const { deltaX, deltaY } = event;
|
|
221
|
+
const { key, orders, keyToOrder, startX, startY, columns, gapX, gapY, itemWidth, itemHeight } = dragging;
|
|
222
|
+
setDragging((prev)=>({
|
|
223
|
+
...prev,
|
|
275
224
|
deltaX,
|
|
276
225
|
deltaY
|
|
277
226
|
}));
|
|
278
227
|
const x = startX + deltaX;
|
|
279
228
|
const y = startY + deltaY;
|
|
280
|
-
const currentOrder =
|
|
281
|
-
const currentOrderIndex =
|
|
282
|
-
const nearestOrder =
|
|
229
|
+
const currentOrder = keyToOrder.get(key);
|
|
230
|
+
const currentOrderIndex = orders.indexOf(currentOrder);
|
|
231
|
+
const nearestOrder = orders.toSorted((a, b)=>{
|
|
283
232
|
const aPosition = getPosition({
|
|
284
233
|
order: a,
|
|
285
|
-
columns
|
|
286
|
-
gapX
|
|
287
|
-
gapY
|
|
288
|
-
itemWidth
|
|
289
|
-
itemHeight
|
|
234
|
+
columns,
|
|
235
|
+
gapX,
|
|
236
|
+
gapY,
|
|
237
|
+
itemWidth,
|
|
238
|
+
itemHeight
|
|
290
239
|
});
|
|
291
240
|
const bPosition = getPosition({
|
|
292
241
|
order: b,
|
|
293
|
-
columns
|
|
294
|
-
gapX
|
|
295
|
-
gapY
|
|
296
|
-
itemWidth
|
|
297
|
-
itemHeight
|
|
242
|
+
columns,
|
|
243
|
+
gapX,
|
|
244
|
+
gapY,
|
|
245
|
+
itemWidth,
|
|
246
|
+
itemHeight
|
|
298
247
|
});
|
|
299
248
|
const aDistance = (x - aPosition.x) ** 2 + (y - aPosition.y) ** 2;
|
|
300
249
|
const bDistance = (x - bPosition.x) ** 2 + (y - bPosition.y) ** 2;
|
|
301
250
|
if (aDistance - bDistance !== 0) return aDistance - bDistance;
|
|
302
|
-
const aIndex =
|
|
303
|
-
const bIndex =
|
|
251
|
+
const aIndex = orders.indexOf(a);
|
|
252
|
+
const bIndex = orders.indexOf(b);
|
|
304
253
|
return Math.abs(aIndex - currentOrderIndex) - Math.abs(bIndex - currentOrderIndex);
|
|
305
254
|
})[0];
|
|
306
255
|
if (nearestOrder === currentOrder) {
|
|
307
|
-
setKeyToOrder(
|
|
308
|
-
null == onOrderMapChange || onOrderMapChange(
|
|
256
|
+
setKeyToOrder(keyToOrder);
|
|
257
|
+
null == onOrderMapChange || onOrderMapChange(keyToOrder);
|
|
309
258
|
return;
|
|
310
259
|
}
|
|
311
|
-
const newKeyToOrder = new Map(
|
|
312
|
-
newKeyToOrder.set(
|
|
313
|
-
const orderToKey = getOrderToKey(
|
|
260
|
+
const newKeyToOrder = new Map(keyToOrder);
|
|
261
|
+
newKeyToOrder.set(key, nearestOrder);
|
|
262
|
+
const orderToKey = getOrderToKey(keyToOrder);
|
|
314
263
|
if (!orderToKey.has(nearestOrder)) {
|
|
315
264
|
setKeyToOrder(newKeyToOrder);
|
|
316
265
|
null == onOrderMapChange || onOrderMapChange(newKeyToOrder);
|
|
317
266
|
return;
|
|
318
267
|
}
|
|
319
|
-
const nearestOrderIndex =
|
|
268
|
+
const nearestOrderIndex = orders.indexOf(nearestOrder);
|
|
320
269
|
const itemDirection = currentOrderIndex > nearestOrderIndex ? "decrease" : "increase";
|
|
321
|
-
const targetDirection = "decrease" === itemDirection &&
|
|
270
|
+
const targetDirection = "decrease" === itemDirection && orders.slice(0, nearestOrderIndex).some((order)=>!orderToKey.has(order)) || "increase" === itemDirection && orders.slice(nearestOrderIndex + 1).every((order)=>orderToKey.has(order)) ? "decrease" : "increase";
|
|
322
271
|
function moveTargetOrder(targetOrder) {
|
|
323
272
|
const targetKey = orderToKey.get(targetOrder);
|
|
324
|
-
const targetOrderIndex =
|
|
273
|
+
const targetOrderIndex = orders.indexOf(targetOrder);
|
|
325
274
|
const nextOrderIndex = targetOrderIndex + ("decrease" === targetDirection ? -1 : 1);
|
|
326
|
-
const nextOrder =
|
|
275
|
+
const nextOrder = orders[nextOrderIndex];
|
|
327
276
|
newKeyToOrder.set(targetKey, nextOrder);
|
|
328
277
|
if (nextOrder === currentOrder || !orderToKey.has(nextOrder)) return;
|
|
329
278
|
moveTargetOrder(nextOrder);
|
|
@@ -332,15 +281,15 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
332
281
|
setKeyToOrder(newKeyToOrder);
|
|
333
282
|
null == onOrderMapChange || onOrderMapChange(newKeyToOrder);
|
|
334
283
|
}
|
|
335
|
-
function onDragMoveEnd(
|
|
336
|
-
null == _onDragMoveEnd || _onDragMoveEnd(
|
|
284
|
+
function onDragMoveEnd(event) {
|
|
285
|
+
null == _onDragMoveEnd || _onDragMoveEnd(event);
|
|
337
286
|
if (!dragging) return;
|
|
338
287
|
setDragging(void 0);
|
|
339
288
|
}
|
|
340
|
-
function isItemDisabled(
|
|
289
|
+
function isItemDisabled(key) {
|
|
341
290
|
if (!_isItemDisabled) return false;
|
|
342
|
-
if (Array.isArray(_isItemDisabled)) return _isItemDisabled.includes(
|
|
343
|
-
return _isItemDisabled(
|
|
291
|
+
if (Array.isArray(_isItemDisabled)) return _isItemDisabled.includes(key);
|
|
292
|
+
return _isItemDisabled(keyToItem.get(key), key);
|
|
344
293
|
}
|
|
345
294
|
return /*#__PURE__*/ jsx("div", {
|
|
346
295
|
className: clsx(DraggableGrid_module.draggableGrid, "function" == typeof className ? className({
|
|
@@ -356,20 +305,20 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
356
305
|
}) : style
|
|
357
306
|
},
|
|
358
307
|
...rest,
|
|
359
|
-
children: Array.from(renderKeys).map((
|
|
360
|
-
if (!
|
|
361
|
-
const
|
|
362
|
-
const
|
|
363
|
-
const isDragging = (null == dragging ? void 0 : dragging.key) ===
|
|
364
|
-
const
|
|
365
|
-
order
|
|
308
|
+
children: Array.from(renderKeys).map((key)=>{
|
|
309
|
+
if (!keyToItem.has(key)) return;
|
|
310
|
+
const item = keyToItem.get(key);
|
|
311
|
+
const order = keyToOrder.get(key);
|
|
312
|
+
const isDragging = (null == dragging ? void 0 : dragging.key) === key;
|
|
313
|
+
const position = getPosition({
|
|
314
|
+
order,
|
|
366
315
|
columns,
|
|
367
316
|
gapX,
|
|
368
317
|
gapY,
|
|
369
318
|
itemWidth,
|
|
370
319
|
itemHeight
|
|
371
320
|
});
|
|
372
|
-
const
|
|
321
|
+
const style = isDragging ? {
|
|
373
322
|
"--width": `${itemWidth}px`,
|
|
374
323
|
"--height": `${itemHeight}px`,
|
|
375
324
|
"--translate-x": `${dragging.startX + dragging.deltaX}px`,
|
|
@@ -379,29 +328,29 @@ function DraggableGrid({ className, classNames, style, items = [], disabled, col
|
|
|
379
328
|
} : {
|
|
380
329
|
"--width": `${itemWidth}px`,
|
|
381
330
|
"--height": `${itemHeight}px`,
|
|
382
|
-
"--translate-x": `${
|
|
383
|
-
"--translate-y": `${
|
|
331
|
+
"--translate-x": `${position.x}px`,
|
|
332
|
+
"--translate-y": `${position.y}px`,
|
|
384
333
|
"--transition-property": "transform",
|
|
385
|
-
"--z-index": recent.current ===
|
|
334
|
+
"--z-index": recent.current === key ? 999999 : keyToOrder.get(key)
|
|
386
335
|
};
|
|
387
|
-
const children = render ? render(
|
|
388
|
-
order
|
|
336
|
+
const children = render ? render(item, {
|
|
337
|
+
order,
|
|
389
338
|
isDragging: isDragging
|
|
390
|
-
}) :
|
|
339
|
+
}) : item;
|
|
391
340
|
return /*#__PURE__*/ jsx(DraggableGridItem, {
|
|
392
|
-
item:
|
|
393
|
-
itemKey:
|
|
341
|
+
item: item,
|
|
342
|
+
itemKey: key,
|
|
394
343
|
handle: handle,
|
|
395
344
|
className: clsx(DraggableGrid_module.draggableGridItem, "function" == typeof (null == classNames ? void 0 : classNames.item) ? classNames.item({
|
|
396
|
-
order
|
|
345
|
+
order,
|
|
397
346
|
isDragging: isDragging
|
|
398
347
|
}) : null == classNames ? void 0 : classNames.item),
|
|
399
|
-
style:
|
|
400
|
-
onDragMoveStart: disabled || isItemDisabled(
|
|
401
|
-
onDragMove: disabled || isItemDisabled(
|
|
402
|
-
onDragMoveEnd: disabled || isItemDisabled(
|
|
348
|
+
style: style,
|
|
349
|
+
onDragMoveStart: disabled || isItemDisabled(key) ? void 0 : (event)=>onDragMoveStart(key, event),
|
|
350
|
+
onDragMove: disabled || isItemDisabled(key) ? void 0 : onDragMove,
|
|
351
|
+
onDragMoveEnd: disabled || isItemDisabled(key) ? void 0 : onDragMoveEnd,
|
|
403
352
|
children: children
|
|
404
|
-
},
|
|
353
|
+
}, key);
|
|
405
354
|
})
|
|
406
355
|
});
|
|
407
356
|
}
|
|
@@ -30,107 +30,37 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
Bar: ()=>Bar
|
|
31
31
|
});
|
|
32
32
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
33
|
-
const compiler_runtime_namespaceObject = require("react/compiler-runtime");
|
|
34
33
|
const external_echarts_namespaceObject = require("echarts");
|
|
35
34
|
const external_react_namespaceObject = require("react");
|
|
36
35
|
const Echart = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((props, ref)=>{
|
|
37
|
-
const
|
|
38
|
-
let chart;
|
|
39
|
-
let height;
|
|
40
|
-
let option;
|
|
41
|
-
let rest;
|
|
42
|
-
let width;
|
|
43
|
-
if ($[0] !== props) {
|
|
44
|
-
({ width, height, option, chart, ...rest } = props);
|
|
45
|
-
$[0] = props;
|
|
46
|
-
$[1] = chart;
|
|
47
|
-
$[2] = height;
|
|
48
|
-
$[3] = option;
|
|
49
|
-
$[4] = rest;
|
|
50
|
-
$[5] = width;
|
|
51
|
-
} else {
|
|
52
|
-
chart = $[1];
|
|
53
|
-
height = $[2];
|
|
54
|
-
option = $[3];
|
|
55
|
-
rest = $[4];
|
|
56
|
-
width = $[5];
|
|
57
|
-
}
|
|
36
|
+
const { width, height, option, chart, ...rest } = props;
|
|
58
37
|
const container = (0, external_react_namespaceObject.useRef)(null);
|
|
59
38
|
const chartRef = (0, external_react_namespaceObject.useRef)(null);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return ()
|
|
69
|
-
var _chartRef_current;
|
|
70
|
-
return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.dispose();
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
$[6] = height;
|
|
74
|
-
$[7] = option;
|
|
75
|
-
$[8] = width;
|
|
76
|
-
$[9] = t0;
|
|
77
|
-
} else t0 = $[9];
|
|
78
|
-
let t1;
|
|
79
|
-
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
|
-
t1 = [];
|
|
81
|
-
$[10] = t1;
|
|
82
|
-
} else t1 = $[10];
|
|
83
|
-
(0, external_react_namespaceObject.useLayoutEffect)(t0, t1);
|
|
84
|
-
let t2;
|
|
85
|
-
let t3;
|
|
86
|
-
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
87
|
-
t2 = ()=>container.current;
|
|
88
|
-
t3 = [];
|
|
89
|
-
$[11] = t2;
|
|
90
|
-
$[12] = t3;
|
|
91
|
-
} else {
|
|
92
|
-
t2 = $[11];
|
|
93
|
-
t3 = $[12];
|
|
94
|
-
}
|
|
95
|
-
(0, external_react_namespaceObject.useImperativeHandle)(ref, t2, t3);
|
|
96
|
-
let t4;
|
|
97
|
-
let t5;
|
|
98
|
-
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
99
|
-
t4 = ()=>chartRef.current;
|
|
100
|
-
t5 = [];
|
|
101
|
-
$[13] = t4;
|
|
102
|
-
$[14] = t5;
|
|
103
|
-
} else {
|
|
104
|
-
t4 = $[13];
|
|
105
|
-
t5 = $[14];
|
|
106
|
-
}
|
|
107
|
-
(0, external_react_namespaceObject.useImperativeHandle)(chart, t4, t5);
|
|
108
|
-
let t6;
|
|
109
|
-
if ($[15] !== height || $[16] !== option || $[17] !== width) {
|
|
110
|
-
t6 = ()=>{
|
|
111
|
-
var _chartRef_current, _chartRef_current1;
|
|
112
|
-
null == (_chartRef_current = chartRef.current) || _chartRef_current.setOption(option);
|
|
113
|
-
null == (_chartRef_current1 = chartRef.current) || _chartRef_current1.resize({
|
|
114
|
-
width,
|
|
115
|
-
height
|
|
116
|
-
});
|
|
39
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
40
|
+
const ele = container.current;
|
|
41
|
+
chartRef.current = (0, external_echarts_namespaceObject.init)(ele, option, {
|
|
42
|
+
width,
|
|
43
|
+
height
|
|
44
|
+
});
|
|
45
|
+
return ()=>{
|
|
46
|
+
var _chartRef_current;
|
|
47
|
+
return null == (_chartRef_current = chartRef.current) ? void 0 : _chartRef_current.dispose();
|
|
117
48
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
ref: container,
|
|
128
|
-
...rest
|
|
49
|
+
}, []);
|
|
50
|
+
(0, external_react_namespaceObject.useImperativeHandle)(ref, ()=>container.current, []);
|
|
51
|
+
(0, external_react_namespaceObject.useImperativeHandle)(chart, ()=>chartRef.current, []);
|
|
52
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
53
|
+
var _chartRef_current, _chartRef_current1;
|
|
54
|
+
null == (_chartRef_current = chartRef.current) || _chartRef_current.setOption(option);
|
|
55
|
+
null == (_chartRef_current1 = chartRef.current) || _chartRef_current1.resize({
|
|
56
|
+
width,
|
|
57
|
+
height
|
|
129
58
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
59
|
+
});
|
|
60
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
61
|
+
ref: container,
|
|
62
|
+
...rest
|
|
63
|
+
});
|
|
134
64
|
});
|
|
135
65
|
const Pie = Echart;
|
|
136
66
|
const Bar = Echart;
|