@sepveneto/free-dom 0.7.0-alpha.2 → 0.7.2
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/index.css +1 -1
- package/dist/index.d.ts +66 -46
- package/dist/index.js +280 -199
- package/dist/index.mjs +190 -109
- package/package.json +11 -4
package/dist/index.js
CHANGED
|
@@ -27,11 +27,42 @@ __export(src_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
28
|
|
|
29
29
|
// src/components/freeDomWrap.ts
|
|
30
|
-
var
|
|
30
|
+
var import_vue_demi14 = require("vue-demi");
|
|
31
31
|
|
|
32
32
|
// src/util/tokens.ts
|
|
33
33
|
var SceneToken = Symbol("Scene");
|
|
34
34
|
|
|
35
|
+
// src/util/render.ts
|
|
36
|
+
var import_lodash = require("lodash");
|
|
37
|
+
var import_vue_demi = require("vue-demi");
|
|
38
|
+
function createRender(comp, attrs = {}, props = {}, listeners = {}) {
|
|
39
|
+
if (!comp)
|
|
40
|
+
return () => null;
|
|
41
|
+
const options = import_vue_demi.isVue2 ? {
|
|
42
|
+
...attrs,
|
|
43
|
+
props,
|
|
44
|
+
on: listeners
|
|
45
|
+
} : {
|
|
46
|
+
...attrs,
|
|
47
|
+
...props
|
|
48
|
+
};
|
|
49
|
+
if (import_vue_demi.isVue2 && typeof comp === "object" && !("render" in comp)) {
|
|
50
|
+
(0, import_lodash.merge)(comp.data, options);
|
|
51
|
+
return comp;
|
|
52
|
+
}
|
|
53
|
+
return (slots) => {
|
|
54
|
+
if (import_vue_demi.isVue2) {
|
|
55
|
+
if (Object.prototype.toString.call(slots) === "[object Object]") {
|
|
56
|
+
return (0, import_vue_demi.h)(comp, { ...options, scopedSlots: slots });
|
|
57
|
+
} else {
|
|
58
|
+
return (0, import_vue_demi.h)(comp, options, Array.isArray(slots) ? slots : [slots]);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
return (0, import_vue_demi.h)(comp, options, slots);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
35
66
|
// src/util/index.ts
|
|
36
67
|
var isProduction = process.env.NODE_ENV === "production";
|
|
37
68
|
function clamp(value, min, max = Infinity) {
|
|
@@ -44,18 +75,18 @@ function log(...args) {
|
|
|
44
75
|
}
|
|
45
76
|
|
|
46
77
|
// src/components/markLine.ts
|
|
47
|
-
var
|
|
78
|
+
var import_vue_demi2 = require("vue-demi");
|
|
48
79
|
var lineType = ["xt", "xc", "xb", "yl", "yc", "yr"];
|
|
49
|
-
var markLine_default = (0,
|
|
80
|
+
var markLine_default = (0, import_vue_demi2.defineComponent)({
|
|
50
81
|
props: {
|
|
51
82
|
showLine: Boolean
|
|
52
83
|
},
|
|
53
84
|
setup() {
|
|
54
|
-
const SceneContext = (0,
|
|
55
|
-
const lines = (0,
|
|
56
|
-
const diff = (0,
|
|
85
|
+
const SceneContext = (0, import_vue_demi2.inject)(SceneToken);
|
|
86
|
+
const lines = (0, import_vue_demi2.shallowRef)(lineType);
|
|
87
|
+
const diff = (0, import_vue_demi2.ref)(SceneContext.diff);
|
|
57
88
|
const nodes = SceneContext.nodes;
|
|
58
|
-
const lineStatus = (0,
|
|
89
|
+
const lineStatus = (0, import_vue_demi2.reactive)({
|
|
59
90
|
xt: {
|
|
60
91
|
show: false,
|
|
61
92
|
pos: 0
|
|
@@ -163,7 +194,7 @@ var markLine_default = (0, import_vue_demi.defineComponent)({
|
|
|
163
194
|
};
|
|
164
195
|
SceneContext?.on("move", runConstraints);
|
|
165
196
|
SceneContext?.on("moveup", clearStatus);
|
|
166
|
-
(0,
|
|
197
|
+
(0, import_vue_demi2.onBeforeUnmount)(() => {
|
|
167
198
|
SceneContext?.off("move");
|
|
168
199
|
SceneContext?.off("moveup");
|
|
169
200
|
});
|
|
@@ -199,28 +230,28 @@ var markLine_default = (0, import_vue_demi.defineComponent)({
|
|
|
199
230
|
};
|
|
200
231
|
},
|
|
201
232
|
render() {
|
|
202
|
-
const _line = (line, info) => (0,
|
|
233
|
+
const _line = (line, info) => (0, import_vue_demi2.h)("div", {
|
|
203
234
|
style: { [line.includes("x") ? "top" : "left"]: info.pos + "px" },
|
|
204
235
|
class: [line.includes("x") ? "vv-free-dom--xline" : "vv-free-dom--yline", "vv-free-dom--line"]
|
|
205
236
|
});
|
|
206
237
|
const _lines = this.showLine ? this.lines.filter((line) => this.lineStatus[line].show).map((line) => _line(line, this.lineStatus[line])) : [];
|
|
207
|
-
return (0,
|
|
238
|
+
return (0, import_vue_demi2.h)("div", {
|
|
208
239
|
class: "vv-free-dom--markline"
|
|
209
240
|
}, _lines);
|
|
210
241
|
}
|
|
211
242
|
});
|
|
212
243
|
|
|
213
244
|
// src/hooks/use-normalize-style.ts
|
|
214
|
-
var
|
|
245
|
+
var import_vue_demi3 = require("vue-demi");
|
|
215
246
|
|
|
216
247
|
// src/hooks/use-default-slot.ts
|
|
217
|
-
var
|
|
248
|
+
var import_vue_demi4 = require("vue-demi");
|
|
218
249
|
function useDefaultSlot() {
|
|
219
|
-
const slots = (0,
|
|
220
|
-
const slotList = (0,
|
|
250
|
+
const slots = (0, import_vue_demi4.useSlots)();
|
|
251
|
+
const slotList = (0, import_vue_demi4.computed)(() => {
|
|
221
252
|
return typeof slots.default === "function" ? slots.default() : slots.default;
|
|
222
253
|
});
|
|
223
|
-
const only = (0,
|
|
254
|
+
const only = (0, import_vue_demi4.computed)(() => slotList.value?.[0]);
|
|
224
255
|
return {
|
|
225
256
|
slots: slotList,
|
|
226
257
|
only
|
|
@@ -228,13 +259,13 @@ function useDefaultSlot() {
|
|
|
228
259
|
}
|
|
229
260
|
|
|
230
261
|
// src/hooks/use-core-date.ts
|
|
231
|
-
var
|
|
262
|
+
var import_vue_demi5 = require("vue-demi");
|
|
232
263
|
function useCoreData(node) {
|
|
233
|
-
const lastX = (0,
|
|
234
|
-
const lastY = (0,
|
|
264
|
+
const lastX = (0, import_vue_demi5.ref)(NaN);
|
|
265
|
+
const lastY = (0, import_vue_demi5.ref)(NaN);
|
|
235
266
|
function create(x, y) {
|
|
236
267
|
const isStart = isNaN(lastX.value);
|
|
237
|
-
const _node = (0,
|
|
268
|
+
const _node = (0, import_vue_demi5.unref)(node);
|
|
238
269
|
if (!_node) {
|
|
239
270
|
throw new Error("drag node does not exist");
|
|
240
271
|
}
|
|
@@ -268,17 +299,17 @@ function useCoreData(node) {
|
|
|
268
299
|
}
|
|
269
300
|
|
|
270
301
|
// src/hooks/use-draggable-data.ts
|
|
271
|
-
var
|
|
302
|
+
var import_vue_demi6 = require("vue-demi");
|
|
272
303
|
function useDraggableData(props) {
|
|
273
|
-
const x = (0,
|
|
274
|
-
const y = (0,
|
|
275
|
-
const deltaX = (0,
|
|
276
|
-
const deltaY = (0,
|
|
277
|
-
const dragData = (0,
|
|
278
|
-
(0,
|
|
304
|
+
const x = (0, import_vue_demi6.ref)(props.x || props.modelValue.x || 0);
|
|
305
|
+
const y = (0, import_vue_demi6.ref)(props.y || props.modelValue.y || 0);
|
|
306
|
+
const deltaX = (0, import_vue_demi6.ref)(0);
|
|
307
|
+
const deltaY = (0, import_vue_demi6.ref)(0);
|
|
308
|
+
const dragData = (0, import_vue_demi6.ref)();
|
|
309
|
+
(0, import_vue_demi6.watchEffect)(() => {
|
|
279
310
|
x.value = props.x || props.modelValue.x || 0;
|
|
280
311
|
});
|
|
281
|
-
(0,
|
|
312
|
+
(0, import_vue_demi6.watchEffect)(() => {
|
|
282
313
|
y.value = props.y || props.modelValue.y || 0;
|
|
283
314
|
});
|
|
284
315
|
const handleDrag = (evt, data) => {
|
|
@@ -315,21 +346,21 @@ function useDraggableData(props) {
|
|
|
315
346
|
}
|
|
316
347
|
|
|
317
348
|
// src/hooks/use-scene-context.ts
|
|
318
|
-
var
|
|
349
|
+
var import_vue_demi7 = require("vue-demi");
|
|
319
350
|
var id = 0;
|
|
320
351
|
function useSceneContext(context, props) {
|
|
321
|
-
const SceneContext = (0,
|
|
352
|
+
const SceneContext = (0, import_vue_demi7.inject)(SceneToken, void 0);
|
|
322
353
|
const uuid = id++;
|
|
323
|
-
const lockAspectRatio = (0,
|
|
324
|
-
const minWidth = (0,
|
|
325
|
-
const minHeight = (0,
|
|
326
|
-
const disabledDrag = (0,
|
|
327
|
-
const disabledResize = (0,
|
|
328
|
-
const scale = (0,
|
|
329
|
-
const fixNonMonospaced = (0,
|
|
354
|
+
const lockAspectRatio = (0, import_vue_demi7.computed)(() => SceneContext?.lockAspectRatio || props.lockAspectRatio);
|
|
355
|
+
const minWidth = (0, import_vue_demi7.computed)(() => SceneContext?.minWidth || props.minWidth);
|
|
356
|
+
const minHeight = (0, import_vue_demi7.computed)(() => SceneContext?.minHeight || props.minHeight);
|
|
357
|
+
const disabledDrag = (0, import_vue_demi7.computed)(() => SceneContext?.disabledDrag || props.disabledDrag);
|
|
358
|
+
const disabledResize = (0, import_vue_demi7.computed)(() => SceneContext?.disabledResize || props.disabledResize);
|
|
359
|
+
const scale = (0, import_vue_demi7.computed)(() => SceneContext?.scale || props.scale);
|
|
360
|
+
const fixNonMonospaced = (0, import_vue_demi7.computed)(() => {
|
|
330
361
|
return SceneContext?.fixNonMonospaced || props.fixNonMonospaced;
|
|
331
362
|
});
|
|
332
|
-
(0,
|
|
363
|
+
(0, import_vue_demi7.onMounted)(() => {
|
|
333
364
|
SceneContext?.register(uuid, context);
|
|
334
365
|
});
|
|
335
366
|
function check(pos) {
|
|
@@ -353,9 +384,9 @@ function useSceneContext(context, props) {
|
|
|
353
384
|
}
|
|
354
385
|
|
|
355
386
|
// src/hooks/use-event-bus.ts
|
|
356
|
-
var
|
|
387
|
+
var import_vue_demi8 = require("vue-demi");
|
|
357
388
|
function useEventBus() {
|
|
358
|
-
const callbacks = (0,
|
|
389
|
+
const callbacks = (0, import_vue_demi8.ref)({});
|
|
359
390
|
const on = (name, cb) => {
|
|
360
391
|
if (!callbacks.value[name]) {
|
|
361
392
|
callbacks.value[name] = [cb];
|
|
@@ -378,14 +409,14 @@ function useEventBus() {
|
|
|
378
409
|
}
|
|
379
410
|
|
|
380
411
|
// src/hooks/use-resizable-data.ts
|
|
381
|
-
var
|
|
412
|
+
var import_vue_demi9 = require("vue-demi");
|
|
382
413
|
function useResizableData(props, domRef) {
|
|
383
|
-
const width = (0,
|
|
384
|
-
const height = (0,
|
|
385
|
-
(0,
|
|
414
|
+
const width = (0, import_vue_demi9.ref)(getWidth());
|
|
415
|
+
const height = (0, import_vue_demi9.ref)(getHeight());
|
|
416
|
+
(0, import_vue_demi9.watchEffect)(() => {
|
|
386
417
|
width.value = getWidth();
|
|
387
418
|
});
|
|
388
|
-
(0,
|
|
419
|
+
(0, import_vue_demi9.watchEffect)(() => {
|
|
389
420
|
height.value = getHeight();
|
|
390
421
|
});
|
|
391
422
|
function getWidth() {
|
|
@@ -402,9 +433,9 @@ function useResizableData(props, domRef) {
|
|
|
402
433
|
if (fixNonMonospaced) {
|
|
403
434
|
await document.fonts.ready;
|
|
404
435
|
}
|
|
405
|
-
const { width: w, height:
|
|
436
|
+
const { width: w, height: h5 } = window.getComputedStyle(domRef.value.$el);
|
|
406
437
|
width.value = Math.max(Math.ceil(parseFloat(w)), minWidth);
|
|
407
|
-
height.value = Math.max(Math.ceil(parseFloat(
|
|
438
|
+
height.value = Math.max(Math.ceil(parseFloat(h5)), minHeight);
|
|
408
439
|
}
|
|
409
440
|
return {
|
|
410
441
|
width,
|
|
@@ -414,22 +445,22 @@ function useResizableData(props, domRef) {
|
|
|
414
445
|
}
|
|
415
446
|
|
|
416
447
|
// src/hooks/use-layout.ts
|
|
417
|
-
var
|
|
448
|
+
var import_vue_demi10 = require("vue-demi");
|
|
418
449
|
function useLayout(props) {
|
|
419
|
-
const layout = (0,
|
|
420
|
-
(0,
|
|
450
|
+
const layout = (0, import_vue_demi10.shallowRef)(props.modelValue);
|
|
451
|
+
(0, import_vue_demi10.watchEffect)(() => {
|
|
421
452
|
layout.value = props.modelValue;
|
|
422
453
|
});
|
|
423
|
-
const cellWidth = (0,
|
|
454
|
+
const cellWidth = (0, import_vue_demi10.computed)(
|
|
424
455
|
() => (props.width - margin.value[0] * (cols.value - 1) - (containerPadding.value?.[0] || margin.value[0]) * 2) / props.cols
|
|
425
456
|
);
|
|
426
|
-
const cols = (0,
|
|
427
|
-
const rowHeight = (0,
|
|
428
|
-
const margin = (0,
|
|
429
|
-
const maxRows = (0,
|
|
430
|
-
const containerPadding = (0,
|
|
431
|
-
const minW = (0,
|
|
432
|
-
const minH = (0,
|
|
457
|
+
const cols = (0, import_vue_demi10.computed)(() => props.cols);
|
|
458
|
+
const rowHeight = (0, import_vue_demi10.computed)(() => props.rowHeight);
|
|
459
|
+
const margin = (0, import_vue_demi10.computed)(() => props.margin);
|
|
460
|
+
const maxRows = (0, import_vue_demi10.computed)(() => props.maxRows);
|
|
461
|
+
const containerPadding = (0, import_vue_demi10.computed)(() => props.containerPadding);
|
|
462
|
+
const minW = (0, import_vue_demi10.computed)(() => props.minW);
|
|
463
|
+
const minH = (0, import_vue_demi10.computed)(() => props.minH);
|
|
433
464
|
function getItem(key) {
|
|
434
465
|
return layout.value.find((item) => item.i === key);
|
|
435
466
|
}
|
|
@@ -526,10 +557,10 @@ function useLayout(props) {
|
|
|
526
557
|
layout.value = _normalize(_layout);
|
|
527
558
|
return layout.value;
|
|
528
559
|
}
|
|
529
|
-
function resizeTo(item, w,
|
|
560
|
+
function resizeTo(item, w, h5) {
|
|
530
561
|
let hasCollisions = false;
|
|
531
562
|
if (!props.collision) {
|
|
532
|
-
const collisions = layout.value.filter((l) => _collides(l, { ...item, w, h:
|
|
563
|
+
const collisions = layout.value.filter((l) => _collides(l, { ...item, w, h: h5 }));
|
|
533
564
|
hasCollisions = collisions.length > 0;
|
|
534
565
|
if (hasCollisions) {
|
|
535
566
|
let leastX = Infinity;
|
|
@@ -548,7 +579,7 @@ function useLayout(props) {
|
|
|
548
579
|
}
|
|
549
580
|
if (!hasCollisions) {
|
|
550
581
|
item.w = w;
|
|
551
|
-
item.h =
|
|
582
|
+
item.h = h5;
|
|
552
583
|
}
|
|
553
584
|
layout.value = _normalize([...layout.value]);
|
|
554
585
|
}
|
|
@@ -664,46 +695,46 @@ function useLayout(props) {
|
|
|
664
695
|
}
|
|
665
696
|
function useLayoutItem(props, layout) {
|
|
666
697
|
const { cellWidth, margin, rowHeight, cols, maxRows, containerPadding: cPadding } = layout;
|
|
667
|
-
const dragging = (0,
|
|
668
|
-
const resizing = (0,
|
|
669
|
-
const containerPadding = (0,
|
|
670
|
-
const x = (0,
|
|
698
|
+
const dragging = (0, import_vue_demi10.ref)();
|
|
699
|
+
const resizing = (0, import_vue_demi10.ref)();
|
|
700
|
+
const containerPadding = (0, import_vue_demi10.computed)(() => cPadding.value || margin.value);
|
|
701
|
+
const x = (0, import_vue_demi10.computed)(() => {
|
|
671
702
|
if (!dragging.value) {
|
|
672
703
|
return Math.round(props.x * (cellWidth.value + margin.value[0]) + containerPadding.value[0]);
|
|
673
704
|
} else {
|
|
674
705
|
return Math.round(dragging.value.x);
|
|
675
706
|
}
|
|
676
707
|
});
|
|
677
|
-
const y = (0,
|
|
708
|
+
const y = (0, import_vue_demi10.computed)(() => {
|
|
678
709
|
if (!dragging.value) {
|
|
679
710
|
return Math.round(props.y * (rowHeight.value + margin.value[1]) + containerPadding.value[1]);
|
|
680
711
|
} else {
|
|
681
712
|
return Math.round(dragging.value.y);
|
|
682
713
|
}
|
|
683
714
|
});
|
|
684
|
-
const width = (0,
|
|
715
|
+
const width = (0, import_vue_demi10.computed)(() => {
|
|
685
716
|
if (!resizing.value) {
|
|
686
717
|
return Math.round(cellWidth.value * props.width + Math.max(0, props.width - 1) * margin.value[0]);
|
|
687
718
|
} else {
|
|
688
719
|
return Math.round(resizing.value.width);
|
|
689
720
|
}
|
|
690
721
|
});
|
|
691
|
-
const height = (0,
|
|
722
|
+
const height = (0, import_vue_demi10.computed)(() => {
|
|
692
723
|
if (!resizing.value) {
|
|
693
724
|
return Math.round(rowHeight.value * props.height + Math.max(0, props.height - 1) * margin.value[1]);
|
|
694
725
|
} else {
|
|
695
726
|
return Math.round(resizing.value.height);
|
|
696
727
|
}
|
|
697
728
|
});
|
|
698
|
-
const minWidth = (0,
|
|
729
|
+
const minWidth = (0, import_vue_demi10.computed)(() => {
|
|
699
730
|
const minW = layout.minW.value;
|
|
700
731
|
return Math.round(cellWidth.value * minW + Math.max(0, minW - 1) * margin.value[0]);
|
|
701
732
|
});
|
|
702
|
-
const minHeight = (0,
|
|
733
|
+
const minHeight = (0, import_vue_demi10.computed)(() => {
|
|
703
734
|
const minH = layout.minH.value;
|
|
704
735
|
return Math.round(rowHeight.value * minH + Math.max(0, minH - 1) * margin.value[1]);
|
|
705
736
|
});
|
|
706
|
-
const style = (0,
|
|
737
|
+
const style = (0, import_vue_demi10.computed)(() => {
|
|
707
738
|
return {
|
|
708
739
|
position: "absolute",
|
|
709
740
|
width: `${width.value}px`,
|
|
@@ -744,15 +775,15 @@ function useLayoutItem(props, layout) {
|
|
|
744
775
|
};
|
|
745
776
|
const onResize = (evt, coreData) => {
|
|
746
777
|
const { width: width2, height: height2 } = coreData;
|
|
747
|
-
const { w, h:
|
|
778
|
+
const { w, h: h5 } = _calcWH(width2, height2);
|
|
748
779
|
resizing.value = { width: width2, height: height2 };
|
|
749
|
-
props.resizeFn(evt, { w, h:
|
|
780
|
+
props.resizeFn(evt, { w, h: h5 });
|
|
750
781
|
};
|
|
751
782
|
const onResizeStop = (evt, coreData) => {
|
|
752
783
|
resizing.value = void 0;
|
|
753
784
|
const { width: width2, height: height2 } = coreData;
|
|
754
|
-
const { w, h:
|
|
755
|
-
props.resizeStopFn(evt, { w, h:
|
|
785
|
+
const { w, h: h5 } = _calcWH(width2, height2);
|
|
786
|
+
props.resizeStopFn(evt, { w, h: h5 });
|
|
756
787
|
};
|
|
757
788
|
function _calcXY(left, top) {
|
|
758
789
|
let x2 = Math.round((left - margin.value[0]) / (cellWidth.value + margin.value[0]));
|
|
@@ -763,10 +794,10 @@ function useLayoutItem(props, layout) {
|
|
|
763
794
|
}
|
|
764
795
|
function _calcWH(width2, height2) {
|
|
765
796
|
let w = Math.round((width2 + margin.value[0]) / (cellWidth.value + margin.value[0]));
|
|
766
|
-
let
|
|
797
|
+
let h5 = Math.round((height2 + margin.value[1]) / (rowHeight.value + margin.value[1]));
|
|
767
798
|
w = clamp(w, 0, cols.value - props.x);
|
|
768
|
-
|
|
769
|
-
return { w, h:
|
|
799
|
+
h5 = clamp(h5, 0, maxRows.value - props.y);
|
|
800
|
+
return { w, h: h5 };
|
|
770
801
|
}
|
|
771
802
|
return {
|
|
772
803
|
x,
|
|
@@ -788,10 +819,10 @@ function useLayoutItem(props, layout) {
|
|
|
788
819
|
}
|
|
789
820
|
|
|
790
821
|
// src/components/freeDom.ts
|
|
791
|
-
var
|
|
822
|
+
var import_vue_demi13 = require("vue-demi");
|
|
792
823
|
|
|
793
824
|
// src/components/freeDomCore.ts
|
|
794
|
-
var
|
|
825
|
+
var import_vue_demi11 = require("vue-demi");
|
|
795
826
|
function noop() {
|
|
796
827
|
}
|
|
797
828
|
var freeDomCoreProps = {
|
|
@@ -813,19 +844,19 @@ var freeDomCoreProps = {
|
|
|
813
844
|
},
|
|
814
845
|
disabled: Boolean
|
|
815
846
|
};
|
|
816
|
-
var freeDomCore = (0,
|
|
847
|
+
var freeDomCore = (0, import_vue_demi11.defineComponent)({
|
|
817
848
|
name: "FreeDomCore",
|
|
818
849
|
props: freeDomCoreProps,
|
|
819
850
|
setup(props) {
|
|
820
851
|
const { only } = useDefaultSlot();
|
|
821
|
-
const dragging = (0,
|
|
822
|
-
const
|
|
823
|
-
const node = (0,
|
|
824
|
-
const ownerDoc = (0,
|
|
852
|
+
const dragging = (0, import_vue_demi11.ref)(false);
|
|
853
|
+
const coreRef = (0, import_vue_demi11.ref)();
|
|
854
|
+
const node = (0, import_vue_demi11.computed)(() => coreRef.value?.$el || coreRef.value);
|
|
855
|
+
const ownerDoc = (0, import_vue_demi11.computed)(() => node.value?.ownerDocument);
|
|
825
856
|
const { lastX, lastY, create } = useCoreData(node);
|
|
826
857
|
let parentNode;
|
|
827
858
|
let parentRect;
|
|
828
|
-
(0,
|
|
859
|
+
(0, import_vue_demi11.onUnmounted)(() => {
|
|
829
860
|
if (!ownerDoc.value)
|
|
830
861
|
return;
|
|
831
862
|
if (props.userSelectHack)
|
|
@@ -910,23 +941,48 @@ var freeDomCore = (0, import_vue_demi10.defineComponent)({
|
|
|
910
941
|
}
|
|
911
942
|
return {
|
|
912
943
|
only,
|
|
913
|
-
|
|
944
|
+
coreRef,
|
|
914
945
|
mousedownFn,
|
|
915
946
|
mouseupFn
|
|
916
947
|
};
|
|
917
948
|
},
|
|
918
949
|
render() {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
950
|
+
const vue2Props = {
|
|
951
|
+
on: {
|
|
952
|
+
mousedown: (evt) => {
|
|
953
|
+
evt.stopPropagation();
|
|
954
|
+
this.mousedownFn(evt);
|
|
955
|
+
},
|
|
956
|
+
mouseup: this.mouseupFn
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
const vue3Props = {
|
|
960
|
+
onMousedown: (evt) => {
|
|
961
|
+
evt.stopPropagation();
|
|
962
|
+
this.mousedownFn(evt);
|
|
963
|
+
},
|
|
922
964
|
onMouseup: this.mouseupFn
|
|
923
|
-
}
|
|
965
|
+
};
|
|
966
|
+
const res = createRender(
|
|
967
|
+
// @ts-expect-error: maybe vue2
|
|
968
|
+
this.only,
|
|
969
|
+
{ ref: (el) => {
|
|
970
|
+
this.coreRef = el;
|
|
971
|
+
} },
|
|
972
|
+
import_vue_demi11.isVue2 ? {} : vue3Props,
|
|
973
|
+
import_vue_demi11.isVue2 ? vue2Props.on : {}
|
|
974
|
+
);
|
|
975
|
+
if (typeof res === "function") {
|
|
976
|
+
return res();
|
|
977
|
+
} else {
|
|
978
|
+
return res;
|
|
979
|
+
}
|
|
924
980
|
}
|
|
925
981
|
});
|
|
926
982
|
var freeDomCore_default = freeDomCore;
|
|
927
983
|
|
|
928
984
|
// src/components/resizeDomCore.ts
|
|
929
|
-
var
|
|
985
|
+
var import_vue_demi12 = require("vue-demi");
|
|
930
986
|
var Dots = ["t", "r", "l", "b", "lt", "lb", "rt", "rb"];
|
|
931
987
|
function noop2() {
|
|
932
988
|
}
|
|
@@ -969,16 +1025,16 @@ var resizeDomCoreProps = {
|
|
|
969
1025
|
},
|
|
970
1026
|
lockAspectRatio: Boolean
|
|
971
1027
|
};
|
|
972
|
-
var resizeDomCore = (0,
|
|
1028
|
+
var resizeDomCore = (0, import_vue_demi12.defineComponent)({
|
|
973
1029
|
name: "ResizeDomCore",
|
|
974
1030
|
props: resizeDomCoreProps,
|
|
975
1031
|
setup(props, { slots }) {
|
|
976
1032
|
const { slots: _slots } = useDefaultSlot();
|
|
977
|
-
const dots = (0,
|
|
1033
|
+
const dots = (0, import_vue_demi12.computed)(() => {
|
|
978
1034
|
const _dots = props.scale;
|
|
979
1035
|
return Array.isArray(_dots) ? _dots : Dots;
|
|
980
1036
|
});
|
|
981
|
-
const lastRect = (0,
|
|
1037
|
+
const lastRect = (0, import_vue_demi12.shallowRef)();
|
|
982
1038
|
function runConstraints(width, height) {
|
|
983
1039
|
const { lockAspectRatio } = props;
|
|
984
1040
|
if (!props.minHeight && !props.minWidth && !lockAspectRatio)
|
|
@@ -1027,7 +1083,7 @@ var resizeDomCore = (0, import_vue_demi11.defineComponent)({
|
|
|
1027
1083
|
}
|
|
1028
1084
|
function renderResizehandler(axis) {
|
|
1029
1085
|
if (!slots.handler) {
|
|
1030
|
-
return () => (0,
|
|
1086
|
+
return () => (0, import_vue_demi12.h)("i", {
|
|
1031
1087
|
class: [
|
|
1032
1088
|
"vv-resize-dom--handler",
|
|
1033
1089
|
`vv-resize-dom--handler__${axis}`
|
|
@@ -1044,20 +1100,25 @@ var resizeDomCore = (0, import_vue_demi11.defineComponent)({
|
|
|
1044
1100
|
};
|
|
1045
1101
|
},
|
|
1046
1102
|
render() {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1103
|
+
const slots = [
|
|
1104
|
+
...this.children || [],
|
|
1105
|
+
this.dots.map((dot) => {
|
|
1106
|
+
return createRender(
|
|
1107
|
+
freeDomCore_default,
|
|
1108
|
+
{ class: [this.dragOpts.disabled && "vv-resize-dom--disabled"] },
|
|
1109
|
+
{
|
|
1110
|
+
...this.dragOpts,
|
|
1111
|
+
stopFn: this.handleResize("stop", dot),
|
|
1112
|
+
startFn: this.handleResize("start", dot),
|
|
1113
|
+
dragFn: this.handleResize("resize", dot)
|
|
1114
|
+
}
|
|
1115
|
+
)(this.renderResizehandler(dot));
|
|
1116
|
+
})
|
|
1117
|
+
];
|
|
1118
|
+
return createRender(
|
|
1119
|
+
"div",
|
|
1120
|
+
{ class: "vv-resize-dom--box" }
|
|
1121
|
+
)(slots);
|
|
1061
1122
|
}
|
|
1062
1123
|
});
|
|
1063
1124
|
var resizeDomCore_default = resizeDomCore;
|
|
@@ -1122,7 +1183,7 @@ var freeDomProps = {
|
|
|
1122
1183
|
scale: resizeDomCoreProps.scale,
|
|
1123
1184
|
fixNonMonospaced: Boolean
|
|
1124
1185
|
};
|
|
1125
|
-
var freeDom = (0,
|
|
1186
|
+
var freeDom = (0, import_vue_demi13.defineComponent)({
|
|
1126
1187
|
name: "FreeDom",
|
|
1127
1188
|
props: freeDomProps,
|
|
1128
1189
|
emits: [
|
|
@@ -1133,8 +1194,7 @@ var freeDom = (0, import_vue_demi12.defineComponent)({
|
|
|
1133
1194
|
"update:modelValue"
|
|
1134
1195
|
],
|
|
1135
1196
|
setup(props, { emit, expose, slots }) {
|
|
1136
|
-
const domRef = (0,
|
|
1137
|
-
const { slots: children } = useDefaultSlot();
|
|
1197
|
+
const domRef = (0, import_vue_demi13.ref)();
|
|
1138
1198
|
const {
|
|
1139
1199
|
x,
|
|
1140
1200
|
y,
|
|
@@ -1146,7 +1206,7 @@ var freeDom = (0, import_vue_demi12.defineComponent)({
|
|
|
1146
1206
|
} = useDraggableData(props);
|
|
1147
1207
|
const { width, height, syncSize: _syncSize } = useResizableData(props, domRef);
|
|
1148
1208
|
const context = {
|
|
1149
|
-
_rect: (0,
|
|
1209
|
+
_rect: (0, import_vue_demi13.reactive)({
|
|
1150
1210
|
x,
|
|
1151
1211
|
y,
|
|
1152
1212
|
width,
|
|
@@ -1165,10 +1225,10 @@ var freeDom = (0, import_vue_demi12.defineComponent)({
|
|
|
1165
1225
|
sceneContext.minHeight.value
|
|
1166
1226
|
);
|
|
1167
1227
|
};
|
|
1168
|
-
(0,
|
|
1228
|
+
(0, import_vue_demi13.onMounted)(() => {
|
|
1169
1229
|
props.autoSize && syncSize();
|
|
1170
1230
|
});
|
|
1171
|
-
const style = (0,
|
|
1231
|
+
const style = (0, import_vue_demi13.computed)(() => ({
|
|
1172
1232
|
position: "absolute",
|
|
1173
1233
|
width: `${width.value}px`,
|
|
1174
1234
|
height: `${height.value}px`,
|
|
@@ -1206,9 +1266,9 @@ var freeDom = (0, import_vue_demi12.defineComponent)({
|
|
|
1206
1266
|
emit("update:y", y.value);
|
|
1207
1267
|
emit("update:modelValue", { x: x.value, y: y.value, w: width.value, h: height.value });
|
|
1208
1268
|
};
|
|
1209
|
-
const onResize = (evt, { node, width: w, height:
|
|
1269
|
+
const onResize = (evt, { node, width: w, height: h5, handle: axis }) => {
|
|
1210
1270
|
const offsetW = -(w - width.value);
|
|
1211
|
-
const offsetH = -(
|
|
1271
|
+
const offsetH = -(h5 - height.value);
|
|
1212
1272
|
const axisH = axis[0];
|
|
1213
1273
|
const axisV = axis[axis.length - 1];
|
|
1214
1274
|
let _x = x.value;
|
|
@@ -1219,14 +1279,14 @@ var freeDom = (0, import_vue_demi12.defineComponent)({
|
|
|
1219
1279
|
if (axisV === "t") {
|
|
1220
1280
|
_y += offsetH;
|
|
1221
1281
|
}
|
|
1222
|
-
const isValid = sceneContext.check?.({ x: _x, y: _y, width: w, height:
|
|
1282
|
+
const isValid = sceneContext.check?.({ x: _x, y: _y, width: w, height: h5 });
|
|
1223
1283
|
if (!isValid)
|
|
1224
1284
|
return;
|
|
1225
1285
|
width.value = w;
|
|
1226
|
-
height.value =
|
|
1286
|
+
height.value = h5;
|
|
1227
1287
|
x.value = _x;
|
|
1228
1288
|
y.value = _y;
|
|
1229
|
-
props.resizeFn(evt, { node, width: w, height:
|
|
1289
|
+
props.resizeFn(evt, { node, width: w, height: h5, handle: axis });
|
|
1230
1290
|
sceneContext?.emit("move");
|
|
1231
1291
|
};
|
|
1232
1292
|
const onResizeStop = () => {
|
|
@@ -1240,21 +1300,21 @@ var freeDom = (0, import_vue_demi12.defineComponent)({
|
|
|
1240
1300
|
emit("update:modelValue", { x: x.value, y: y.value, w: width.value, h: height.value });
|
|
1241
1301
|
sceneContext.emit("moveup");
|
|
1242
1302
|
};
|
|
1243
|
-
const resizeNode = () =>
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
}
|
|
1257
|
-
expose({
|
|
1303
|
+
const resizeNode = () => {
|
|
1304
|
+
const props2 = {
|
|
1305
|
+
width: width.value,
|
|
1306
|
+
height: height.value,
|
|
1307
|
+
lockAspectRatio: sceneContext.lockAspectRatio.value,
|
|
1308
|
+
dragOpts: { disabled: sceneContext.disabledResize.value },
|
|
1309
|
+
resizeFn: onResize,
|
|
1310
|
+
stopFn: onResizeStop,
|
|
1311
|
+
minHeight: sceneContext.minHeight.value,
|
|
1312
|
+
minWidth: sceneContext.minWidth.value,
|
|
1313
|
+
scale: sceneContext.scale.value
|
|
1314
|
+
};
|
|
1315
|
+
return createRender(resizeDomCore_default, {}, props2)(slots);
|
|
1316
|
+
};
|
|
1317
|
+
expose?.({
|
|
1258
1318
|
syncSize
|
|
1259
1319
|
});
|
|
1260
1320
|
return {
|
|
@@ -1267,14 +1327,21 @@ var freeDom = (0, import_vue_demi12.defineComponent)({
|
|
|
1267
1327
|
};
|
|
1268
1328
|
},
|
|
1269
1329
|
render() {
|
|
1270
|
-
|
|
1271
|
-
ref: "domRef",
|
|
1272
|
-
class: "vv-free-dom--draggable",
|
|
1273
|
-
style: this.style,
|
|
1330
|
+
const props = {
|
|
1274
1331
|
stopFn: this.onDragStop,
|
|
1275
1332
|
dragFn: this.onDrag,
|
|
1276
1333
|
disabled: this.disabled
|
|
1277
|
-
}
|
|
1334
|
+
};
|
|
1335
|
+
const slots = () => this.resizeNode();
|
|
1336
|
+
return createRender(
|
|
1337
|
+
freeDomCore_default,
|
|
1338
|
+
{
|
|
1339
|
+
ref: "domRef",
|
|
1340
|
+
class: "vv-free-dom--draggable",
|
|
1341
|
+
style: this.style
|
|
1342
|
+
},
|
|
1343
|
+
props
|
|
1344
|
+
)?.(slots);
|
|
1278
1345
|
}
|
|
1279
1346
|
});
|
|
1280
1347
|
var freeDom_default = freeDom;
|
|
@@ -1305,43 +1372,46 @@ var freeDomWrapProps = {
|
|
|
1305
1372
|
scale: freeDomProps.scale,
|
|
1306
1373
|
fixNonMonospaced: freeDomProps.fixNonMonospaced
|
|
1307
1374
|
};
|
|
1308
|
-
var FreeDomWrap = (0,
|
|
1375
|
+
var FreeDomWrap = (0, import_vue_demi14.defineComponent)({
|
|
1309
1376
|
name: "FreeDomWrap",
|
|
1310
1377
|
props: freeDomWrapProps,
|
|
1311
1378
|
setup(props) {
|
|
1379
|
+
const { slots } = useDefaultSlot();
|
|
1312
1380
|
const eventBus = useEventBus();
|
|
1313
|
-
const rectRef = (0,
|
|
1314
|
-
const nodes = (0,
|
|
1315
|
-
const width = (0,
|
|
1316
|
-
const height = (0,
|
|
1317
|
-
(0,
|
|
1381
|
+
const rectRef = (0, import_vue_demi14.shallowRef)();
|
|
1382
|
+
const nodes = (0, import_vue_demi14.ref)([]);
|
|
1383
|
+
const width = (0, import_vue_demi14.ref)(props.width);
|
|
1384
|
+
const height = (0, import_vue_demi14.ref)(props.height);
|
|
1385
|
+
(0, import_vue_demi14.watchEffect)(() => {
|
|
1318
1386
|
width.value = props.width;
|
|
1319
1387
|
});
|
|
1320
|
-
(0,
|
|
1388
|
+
(0, import_vue_demi14.watchEffect)(() => {
|
|
1321
1389
|
height.value = props.height;
|
|
1322
1390
|
});
|
|
1323
|
-
(0,
|
|
1391
|
+
(0, import_vue_demi14.onMounted)(() => {
|
|
1324
1392
|
if (!props.width || !props.height) {
|
|
1325
1393
|
if (!rectRef.value)
|
|
1326
1394
|
console.warn("[free-dom] cannot find element, width or height may be set to 0");
|
|
1327
|
-
const { width: w, height:
|
|
1395
|
+
const { width: w, height: h5 } = rectRef.value?.getBoundingClientRect() || {};
|
|
1328
1396
|
if (!props.width)
|
|
1329
1397
|
width.value = w || 0;
|
|
1330
1398
|
if (!props.height)
|
|
1331
|
-
height.value =
|
|
1399
|
+
height.value = h5 || 0;
|
|
1332
1400
|
}
|
|
1333
1401
|
});
|
|
1334
1402
|
function register(uuid, node) {
|
|
1335
1403
|
nodes.value.push({ uuid, node });
|
|
1336
1404
|
}
|
|
1337
1405
|
function checkValid(pos) {
|
|
1338
|
-
const { x, y, width: w, height:
|
|
1339
|
-
return x >= 0 &&
|
|
1406
|
+
const { x, y, width: w, height: h5 } = pos;
|
|
1407
|
+
return x >= 0 && // @ts-expect-error: trigger after mounted
|
|
1408
|
+
x + w <= width.value && y >= 0 && // @ts-expect-error: trigger after mounted
|
|
1409
|
+
y + h5 <= height.value;
|
|
1340
1410
|
}
|
|
1341
|
-
(0,
|
|
1411
|
+
(0, import_vue_demi14.provide)(
|
|
1342
1412
|
SceneToken,
|
|
1343
|
-
(0,
|
|
1344
|
-
...(0,
|
|
1413
|
+
(0, import_vue_demi14.reactive)({
|
|
1414
|
+
...(0, import_vue_demi14.toRefs)(props),
|
|
1345
1415
|
nodes,
|
|
1346
1416
|
width,
|
|
1347
1417
|
height,
|
|
@@ -1352,30 +1422,35 @@ var FreeDomWrap = (0, import_vue_demi13.defineComponent)({
|
|
|
1352
1422
|
emit: eventBus.emit
|
|
1353
1423
|
})
|
|
1354
1424
|
);
|
|
1355
|
-
const style = (0,
|
|
1425
|
+
const style = (0, import_vue_demi14.computed)(() => ({
|
|
1356
1426
|
width: `${props.width}px`,
|
|
1357
1427
|
height: `${props.height}px`
|
|
1358
1428
|
}));
|
|
1359
1429
|
return {
|
|
1360
1430
|
rectRef,
|
|
1361
|
-
style
|
|
1431
|
+
style,
|
|
1432
|
+
slots
|
|
1362
1433
|
};
|
|
1363
1434
|
},
|
|
1364
1435
|
render() {
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1436
|
+
const marklineComp = createRender(markLine_default, {}, { showLine: this.showLine })();
|
|
1437
|
+
const slots = [this.slots, marklineComp];
|
|
1438
|
+
return createRender(
|
|
1439
|
+
"section",
|
|
1440
|
+
{
|
|
1441
|
+
ref: "rectRef",
|
|
1442
|
+
class: "vv-free-dom--scene",
|
|
1443
|
+
style: this.style
|
|
1444
|
+
}
|
|
1445
|
+
)(slots);
|
|
1371
1446
|
}
|
|
1372
1447
|
});
|
|
1373
1448
|
|
|
1374
1449
|
// src/components/gridLayout.ts
|
|
1375
|
-
var
|
|
1450
|
+
var import_vue_demi16 = require("vue-demi");
|
|
1376
1451
|
|
|
1377
1452
|
// src/components/gridItem.ts
|
|
1378
|
-
var
|
|
1453
|
+
var import_vue_demi15 = require("vue-demi");
|
|
1379
1454
|
|
|
1380
1455
|
// src/components/tokens.ts
|
|
1381
1456
|
var gridLayoutContextKey = Symbol("gridLayoutContext");
|
|
@@ -1432,12 +1507,12 @@ var gridItemProps = {
|
|
|
1432
1507
|
}
|
|
1433
1508
|
};
|
|
1434
1509
|
var gridItemEmits = ["dragMove"];
|
|
1435
|
-
var GridItem = (0,
|
|
1510
|
+
var GridItem = (0, import_vue_demi15.defineComponent)({
|
|
1436
1511
|
name: "GridItem",
|
|
1437
1512
|
props: gridItemProps,
|
|
1438
1513
|
emits: gridItemEmits,
|
|
1439
1514
|
setup(props) {
|
|
1440
|
-
const layout = (0,
|
|
1515
|
+
const layout = (0, import_vue_demi15.inject)(gridLayoutContextKey);
|
|
1441
1516
|
if (!layout) {
|
|
1442
1517
|
throw new Error("TODO");
|
|
1443
1518
|
}
|
|
@@ -1459,7 +1534,7 @@ var GridItem = (0, import_vue_demi14.defineComponent)({
|
|
|
1459
1534
|
} = useLayoutItem(props, layout);
|
|
1460
1535
|
const { only, slots } = useDefaultSlot();
|
|
1461
1536
|
const resizeNode = (child) => {
|
|
1462
|
-
|
|
1537
|
+
const _props = {
|
|
1463
1538
|
width: width.value,
|
|
1464
1539
|
height: height.value,
|
|
1465
1540
|
scale: props.scale,
|
|
@@ -1471,20 +1546,26 @@ var GridItem = (0, import_vue_demi14.defineComponent)({
|
|
|
1471
1546
|
startFn: onResizeStart,
|
|
1472
1547
|
resizeFn: onResize,
|
|
1473
1548
|
stopFn: onResizeStop
|
|
1474
|
-
}
|
|
1549
|
+
};
|
|
1550
|
+
return createRender(resizeDomCore_default, {}, _props)(() => child);
|
|
1551
|
+
};
|
|
1552
|
+
const dragNode = (child) => {
|
|
1553
|
+
const _attrs = {
|
|
1554
|
+
class: [
|
|
1555
|
+
dragging.value && "vv-grid-layout--item__draggable",
|
|
1556
|
+
"vv-grid-layout--item",
|
|
1557
|
+
!props.isDraggable && "vv-grid-layout--item__disabled"
|
|
1558
|
+
],
|
|
1559
|
+
style: style.value
|
|
1560
|
+
};
|
|
1561
|
+
const _props = {
|
|
1562
|
+
disabled: !props.isDraggable,
|
|
1563
|
+
startFn: onDragStart,
|
|
1564
|
+
stopFn: onDragStop,
|
|
1565
|
+
dragFn: onDrag
|
|
1566
|
+
};
|
|
1567
|
+
return createRender(freeDomCore_default, _attrs, _props)(() => resizeNode(child));
|
|
1475
1568
|
};
|
|
1476
|
-
const dragNode = (child) => (0, import_vue_demi14.h)(freeDomCore_default, {
|
|
1477
|
-
class: [
|
|
1478
|
-
dragging.value && "vv-grid-layout--item__draggable",
|
|
1479
|
-
"vv-grid-layout--item",
|
|
1480
|
-
!props.isDraggable && "vv-grid-layout--item__disabled"
|
|
1481
|
-
],
|
|
1482
|
-
style: style.value,
|
|
1483
|
-
disabled: !props.isDraggable,
|
|
1484
|
-
startFn: onDragStart,
|
|
1485
|
-
stopFn: onDragStop,
|
|
1486
|
-
dragFn: onDrag
|
|
1487
|
-
}, () => resizeNode(child));
|
|
1488
1569
|
return {
|
|
1489
1570
|
x,
|
|
1490
1571
|
y,
|
|
@@ -1511,10 +1592,6 @@ var GridItem = (0, import_vue_demi14.defineComponent)({
|
|
|
1511
1592
|
|
|
1512
1593
|
// src/components/gridLayout.ts
|
|
1513
1594
|
var gridLayoutProps = {
|
|
1514
|
-
style: {
|
|
1515
|
-
type: Object,
|
|
1516
|
-
default: () => ({})
|
|
1517
|
-
},
|
|
1518
1595
|
modelValue: {
|
|
1519
1596
|
type: Array,
|
|
1520
1597
|
required: true,
|
|
@@ -1560,14 +1637,15 @@ var gridLayoutProps = {
|
|
|
1560
1637
|
disabledResize: Boolean,
|
|
1561
1638
|
collision: Boolean
|
|
1562
1639
|
};
|
|
1563
|
-
var GridLayout = (0,
|
|
1640
|
+
var GridLayout = (0, import_vue_demi16.defineComponent)({
|
|
1564
1641
|
name: "GridLayout",
|
|
1642
|
+
inheritAttrs: false,
|
|
1565
1643
|
props: gridLayoutProps,
|
|
1566
1644
|
emits: ["update:modelValue"],
|
|
1567
1645
|
setup(props, { emit }) {
|
|
1568
1646
|
const layout = useLayout(props);
|
|
1569
|
-
(0,
|
|
1570
|
-
const activeDrag = (0,
|
|
1647
|
+
(0, import_vue_demi16.provide)(gridLayoutContextKey, layout);
|
|
1648
|
+
const activeDrag = (0, import_vue_demi16.ref)(null);
|
|
1571
1649
|
function processItem(node) {
|
|
1572
1650
|
const key = node.key;
|
|
1573
1651
|
if (!key)
|
|
@@ -1577,7 +1655,7 @@ var GridLayout = (0, import_vue_demi15.defineComponent)({
|
|
|
1577
1655
|
return;
|
|
1578
1656
|
const isDraggable = !config.static && !props.disabledDrag;
|
|
1579
1657
|
const isResizable = !config.static && !props.disabledResize;
|
|
1580
|
-
|
|
1658
|
+
const _props = {
|
|
1581
1659
|
x: config.x,
|
|
1582
1660
|
y: config.y,
|
|
1583
1661
|
width: config.w,
|
|
@@ -1614,28 +1692,31 @@ var GridLayout = (0, import_vue_demi15.defineComponent)({
|
|
|
1614
1692
|
height: config.h
|
|
1615
1693
|
};
|
|
1616
1694
|
activeDrag.value = placeholder2;
|
|
1617
|
-
const { w, h:
|
|
1618
|
-
layout.resizeTo(config, w,
|
|
1695
|
+
const { w, h: h5 } = data;
|
|
1696
|
+
layout.resizeTo(config, w, h5);
|
|
1619
1697
|
},
|
|
1620
1698
|
resizeStopFn: (evt, data) => {
|
|
1621
|
-
const { w, h:
|
|
1622
|
-
layout.resizeTo(config, w,
|
|
1699
|
+
const { w, h: h5 } = data;
|
|
1700
|
+
layout.resizeTo(config, w, h5);
|
|
1623
1701
|
activeDrag.value = null;
|
|
1624
1702
|
}
|
|
1625
|
-
}
|
|
1703
|
+
};
|
|
1704
|
+
return createRender(GridItem, {}, _props)({ default: () => node });
|
|
1626
1705
|
}
|
|
1627
1706
|
function placeholder() {
|
|
1628
1707
|
if (!activeDrag.value)
|
|
1629
1708
|
return null;
|
|
1630
1709
|
const { x, y, width, height } = activeDrag.value;
|
|
1631
|
-
|
|
1632
|
-
class: "vv-grid-layout--placeholder",
|
|
1710
|
+
const _props = {
|
|
1633
1711
|
x,
|
|
1634
1712
|
y,
|
|
1635
1713
|
width,
|
|
1636
1714
|
height,
|
|
1637
1715
|
move: false
|
|
1638
|
-
}
|
|
1716
|
+
};
|
|
1717
|
+
return createRender(GridItem, {
|
|
1718
|
+
class: "vv-grid-layout--placeholder"
|
|
1719
|
+
}, _props)();
|
|
1639
1720
|
}
|
|
1640
1721
|
return {
|
|
1641
1722
|
processItem,
|
|
@@ -1645,11 +1726,11 @@ var GridLayout = (0, import_vue_demi15.defineComponent)({
|
|
|
1645
1726
|
},
|
|
1646
1727
|
render() {
|
|
1647
1728
|
const mergedStyle = {
|
|
1648
|
-
...this.style || {},
|
|
1729
|
+
...this.$attrs.style || {},
|
|
1649
1730
|
height: this.layout.calContainerHeight()
|
|
1650
1731
|
};
|
|
1651
1732
|
const defaultSlot = typeof this.$slots.default === "function" ? this.$slots.default() : this.$slots.default || [];
|
|
1652
|
-
return (0,
|
|
1733
|
+
return (0, import_vue_demi16.h)("div", {
|
|
1653
1734
|
class: "vv-grid-layout",
|
|
1654
1735
|
style: mergedStyle
|
|
1655
1736
|
}, [
|