@thangdevalone/meeting-grid-layout-vue 1.5.7 → 1.5.8
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.cjs +63 -23
- package/dist/index.d.cts +23 -1
- package/dist/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.mjs +63 -23
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -173,6 +173,16 @@ const GridContainer = vue.defineComponent({
|
|
|
173
173
|
type: Boolean,
|
|
174
174
|
default: false
|
|
175
175
|
},
|
|
176
|
+
/**
|
|
177
|
+
* Disable all animations globally.
|
|
178
|
+
* When true, all grid items and float items render without
|
|
179
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
180
|
+
* @default false
|
|
181
|
+
*/
|
|
182
|
+
disableAnimation: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: false
|
|
185
|
+
},
|
|
176
186
|
/** HTML tag to render */
|
|
177
187
|
tag: {
|
|
178
188
|
type: String,
|
|
@@ -206,7 +216,8 @@ const GridContainer = vue.defineComponent({
|
|
|
206
216
|
vue.provide(GridContextKey, {
|
|
207
217
|
grid,
|
|
208
218
|
springPreset: props.springPreset,
|
|
209
|
-
dimensions
|
|
219
|
+
dimensions,
|
|
220
|
+
disableAnimation: props.disableAnimation
|
|
210
221
|
});
|
|
211
222
|
return () => vue.h(
|
|
212
223
|
props.tag,
|
|
@@ -253,7 +264,8 @@ const GridItem = vue.defineComponent({
|
|
|
253
264
|
console.warn("GridItem must be used inside a GridContainer");
|
|
254
265
|
return () => null;
|
|
255
266
|
}
|
|
256
|
-
const { grid, springPreset, dimensions: containerDimensions } = context;
|
|
267
|
+
const { grid, springPreset, dimensions: containerDimensions, disableAnimation: containerDisableAnimation } = context;
|
|
268
|
+
const noAnimation = vue.computed(() => containerDisableAnimation || props.disableAnimation);
|
|
257
269
|
const position = vue.computed(() => grid.value.getPosition(props.index));
|
|
258
270
|
const dimensions = vue.computed(() => grid.value.getItemDimensions(props.index));
|
|
259
271
|
const contentDimensions = vue.computed(
|
|
@@ -331,9 +343,14 @@ const GridItem = vue.defineComponent({
|
|
|
331
343
|
([, w, h2]) => {
|
|
332
344
|
if (isFloat.value && floatInitialized.value && w > 0 && h2 > 0) {
|
|
333
345
|
const pos = getFloatCornerPos(floatAnchor.value);
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
346
|
+
if (noAnimation.value) {
|
|
347
|
+
x.set(pos.x);
|
|
348
|
+
y.set(pos.y);
|
|
349
|
+
} else {
|
|
350
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
351
|
+
motionV.animate(x, pos.x, springCfg);
|
|
352
|
+
motionV.animate(y, pos.y, springCfg);
|
|
353
|
+
}
|
|
337
354
|
}
|
|
338
355
|
}
|
|
339
356
|
);
|
|
@@ -363,6 +380,9 @@ const GridItem = vue.defineComponent({
|
|
|
363
380
|
gridX.set(pos.left);
|
|
364
381
|
gridY.set(pos.top);
|
|
365
382
|
gridAnimReady.value = true;
|
|
383
|
+
} else if (noAnimation.value) {
|
|
384
|
+
gridX.set(pos.left);
|
|
385
|
+
gridY.set(pos.top);
|
|
366
386
|
} else {
|
|
367
387
|
const cfg = {
|
|
368
388
|
type: "spring",
|
|
@@ -401,9 +421,14 @@ const GridItem = vue.defineComponent({
|
|
|
401
421
|
const nearestCorner = findFloatNearestCorner(currentX, currentY);
|
|
402
422
|
floatAnchor.value = nearestCorner;
|
|
403
423
|
const snapPos = getFloatCornerPos(nearestCorner);
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
424
|
+
if (noAnimation.value) {
|
|
425
|
+
x.set(snapPos.x);
|
|
426
|
+
y.set(snapPos.y);
|
|
427
|
+
} else {
|
|
428
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
429
|
+
motionV.animate(x, snapPos.x, springCfg);
|
|
430
|
+
motionV.animate(y, snapPos.y, springCfg);
|
|
431
|
+
}
|
|
407
432
|
};
|
|
408
433
|
return vue.h(
|
|
409
434
|
motionV.motion.div,
|
|
@@ -429,8 +454,8 @@ const GridItem = vue.defineComponent({
|
|
|
429
454
|
x,
|
|
430
455
|
y
|
|
431
456
|
},
|
|
432
|
-
whileDrag: { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
433
|
-
transition: { type: "spring", stiffness: 400, damping: 30 },
|
|
457
|
+
whileDrag: noAnimation.value ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
458
|
+
transition: noAnimation.value ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
434
459
|
"data-grid-index": props.index,
|
|
435
460
|
"data-grid-float": true,
|
|
436
461
|
onDragEnd: handleDragEnd
|
|
@@ -440,7 +465,7 @@ const GridItem = vue.defineComponent({
|
|
|
440
465
|
}
|
|
441
466
|
const itemWidth = dimensions.value.width;
|
|
442
467
|
const itemHeight = dimensions.value.height;
|
|
443
|
-
if (
|
|
468
|
+
if (noAnimation.value) {
|
|
444
469
|
return vue.h(
|
|
445
470
|
props.tag,
|
|
446
471
|
{
|
|
@@ -575,7 +600,7 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
575
600
|
console.warn("FloatingGridItem must be used inside a GridContainer");
|
|
576
601
|
return () => null;
|
|
577
602
|
}
|
|
578
|
-
const { dimensions } = context;
|
|
603
|
+
const { dimensions, disableAnimation: containerDisableAnimation } = context;
|
|
579
604
|
const currentAnchor = vue.ref(props.anchor);
|
|
580
605
|
const effectiveSize = vue.computed(() => {
|
|
581
606
|
if (props.breakpoints && props.breakpoints.length > 0 && dimensions.value.width > 0) {
|
|
@@ -645,9 +670,14 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
645
670
|
if (isInitialized.value && w > 0 && h2 > 0 && newAnchor !== currentAnchor.value) {
|
|
646
671
|
currentAnchor.value = newAnchor;
|
|
647
672
|
const pos = getCornerPosition(newAnchor);
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
673
|
+
if (containerDisableAnimation) {
|
|
674
|
+
x.set(pos.x);
|
|
675
|
+
y.set(pos.y);
|
|
676
|
+
} else {
|
|
677
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
678
|
+
motionV.animate(x, pos.x, springCfg);
|
|
679
|
+
motionV.animate(y, pos.y, springCfg);
|
|
680
|
+
}
|
|
651
681
|
}
|
|
652
682
|
}
|
|
653
683
|
);
|
|
@@ -656,9 +686,14 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
656
686
|
() => {
|
|
657
687
|
if (isInitialized.value && containerDimensions.value.width > 0 && containerDimensions.value.height > 0) {
|
|
658
688
|
const pos = getCornerPosition(currentAnchor.value);
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
689
|
+
if (containerDisableAnimation) {
|
|
690
|
+
x.set(pos.x);
|
|
691
|
+
y.set(pos.y);
|
|
692
|
+
} else {
|
|
693
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
694
|
+
motionV.animate(x, pos.x, springCfg);
|
|
695
|
+
motionV.animate(y, pos.y, springCfg);
|
|
696
|
+
}
|
|
662
697
|
}
|
|
663
698
|
}
|
|
664
699
|
);
|
|
@@ -683,9 +718,14 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
683
718
|
currentAnchor.value = nearestCorner;
|
|
684
719
|
emit("anchorChange", nearestCorner);
|
|
685
720
|
const snapPos = getCornerPosition(nearestCorner);
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
721
|
+
if (containerDisableAnimation) {
|
|
722
|
+
x.set(snapPos.x);
|
|
723
|
+
y.set(snapPos.y);
|
|
724
|
+
} else {
|
|
725
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
726
|
+
motionV.animate(x, snapPos.x, springCfg);
|
|
727
|
+
motionV.animate(y, snapPos.y, springCfg);
|
|
728
|
+
}
|
|
689
729
|
};
|
|
690
730
|
return vue.h(
|
|
691
731
|
motionV.motion.div,
|
|
@@ -709,8 +749,8 @@ const FloatingGridItem = vue.defineComponent({
|
|
|
709
749
|
x,
|
|
710
750
|
y
|
|
711
751
|
},
|
|
712
|
-
whileDrag: { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
713
|
-
transition: { type: "spring", stiffness: 400, damping: 30 },
|
|
752
|
+
whileDrag: containerDisableAnimation ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
753
|
+
transition: containerDisableAnimation ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
714
754
|
onDragEnd: handleDragEnd
|
|
715
755
|
},
|
|
716
756
|
slots.default?.()
|
package/dist/index.d.cts
CHANGED
|
@@ -50,6 +50,7 @@ interface GridContextValue {
|
|
|
50
50
|
grid: ComputedRef<MeetGridResult>;
|
|
51
51
|
springPreset: SpringPreset;
|
|
52
52
|
dimensions: Ref<GridDimensions>;
|
|
53
|
+
disableAnimation: boolean;
|
|
53
54
|
}
|
|
54
55
|
declare const GridContextKey: InjectionKey<GridContextValue>;
|
|
55
56
|
declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -170,6 +171,16 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
170
171
|
type: BooleanConstructor;
|
|
171
172
|
default: boolean;
|
|
172
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Disable all animations globally.
|
|
176
|
+
* When true, all grid items and float items render without
|
|
177
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
disableAnimation: {
|
|
181
|
+
type: BooleanConstructor;
|
|
182
|
+
default: boolean;
|
|
183
|
+
};
|
|
173
184
|
/** HTML tag to render */
|
|
174
185
|
tag: {
|
|
175
186
|
type: StringConstructor;
|
|
@@ -295,6 +306,16 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
295
306
|
type: BooleanConstructor;
|
|
296
307
|
default: boolean;
|
|
297
308
|
};
|
|
309
|
+
/**
|
|
310
|
+
* Disable all animations globally.
|
|
311
|
+
* When true, all grid items and float items render without
|
|
312
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
313
|
+
* @default false
|
|
314
|
+
*/
|
|
315
|
+
disableAnimation: {
|
|
316
|
+
type: BooleanConstructor;
|
|
317
|
+
default: boolean;
|
|
318
|
+
};
|
|
298
319
|
/** HTML tag to render */
|
|
299
320
|
tag: {
|
|
300
321
|
type: StringConstructor;
|
|
@@ -318,6 +339,7 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
318
339
|
pipIndex: number;
|
|
319
340
|
pinOnly: boolean;
|
|
320
341
|
disableFloat: boolean;
|
|
342
|
+
disableAnimation: boolean;
|
|
321
343
|
tag: string;
|
|
322
344
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
323
345
|
declare const GridItem: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -365,8 +387,8 @@ declare const GridItem: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
365
387
|
default: string;
|
|
366
388
|
};
|
|
367
389
|
}>> & Readonly<{}>, {
|
|
368
|
-
tag: string;
|
|
369
390
|
disableAnimation: boolean;
|
|
391
|
+
tag: string;
|
|
370
392
|
itemAspectRatio: string;
|
|
371
393
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
372
394
|
declare const GridOverlay: vue.DefineComponent<vue.ExtractPropTypes<{
|
package/dist/index.d.mts
CHANGED
|
@@ -50,6 +50,7 @@ interface GridContextValue {
|
|
|
50
50
|
grid: ComputedRef<MeetGridResult>;
|
|
51
51
|
springPreset: SpringPreset;
|
|
52
52
|
dimensions: Ref<GridDimensions>;
|
|
53
|
+
disableAnimation: boolean;
|
|
53
54
|
}
|
|
54
55
|
declare const GridContextKey: InjectionKey<GridContextValue>;
|
|
55
56
|
declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -170,6 +171,16 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
170
171
|
type: BooleanConstructor;
|
|
171
172
|
default: boolean;
|
|
172
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Disable all animations globally.
|
|
176
|
+
* When true, all grid items and float items render without
|
|
177
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
disableAnimation: {
|
|
181
|
+
type: BooleanConstructor;
|
|
182
|
+
default: boolean;
|
|
183
|
+
};
|
|
173
184
|
/** HTML tag to render */
|
|
174
185
|
tag: {
|
|
175
186
|
type: StringConstructor;
|
|
@@ -295,6 +306,16 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
295
306
|
type: BooleanConstructor;
|
|
296
307
|
default: boolean;
|
|
297
308
|
};
|
|
309
|
+
/**
|
|
310
|
+
* Disable all animations globally.
|
|
311
|
+
* When true, all grid items and float items render without
|
|
312
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
313
|
+
* @default false
|
|
314
|
+
*/
|
|
315
|
+
disableAnimation: {
|
|
316
|
+
type: BooleanConstructor;
|
|
317
|
+
default: boolean;
|
|
318
|
+
};
|
|
298
319
|
/** HTML tag to render */
|
|
299
320
|
tag: {
|
|
300
321
|
type: StringConstructor;
|
|
@@ -318,6 +339,7 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
318
339
|
pipIndex: number;
|
|
319
340
|
pinOnly: boolean;
|
|
320
341
|
disableFloat: boolean;
|
|
342
|
+
disableAnimation: boolean;
|
|
321
343
|
tag: string;
|
|
322
344
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
323
345
|
declare const GridItem: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -365,8 +387,8 @@ declare const GridItem: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
365
387
|
default: string;
|
|
366
388
|
};
|
|
367
389
|
}>> & Readonly<{}>, {
|
|
368
|
-
tag: string;
|
|
369
390
|
disableAnimation: boolean;
|
|
391
|
+
tag: string;
|
|
370
392
|
itemAspectRatio: string;
|
|
371
393
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
372
394
|
declare const GridOverlay: vue.DefineComponent<vue.ExtractPropTypes<{
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ interface GridContextValue {
|
|
|
50
50
|
grid: ComputedRef<MeetGridResult>;
|
|
51
51
|
springPreset: SpringPreset;
|
|
52
52
|
dimensions: Ref<GridDimensions>;
|
|
53
|
+
disableAnimation: boolean;
|
|
53
54
|
}
|
|
54
55
|
declare const GridContextKey: InjectionKey<GridContextValue>;
|
|
55
56
|
declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -170,6 +171,16 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
170
171
|
type: BooleanConstructor;
|
|
171
172
|
default: boolean;
|
|
172
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Disable all animations globally.
|
|
176
|
+
* When true, all grid items and float items render without
|
|
177
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
disableAnimation: {
|
|
181
|
+
type: BooleanConstructor;
|
|
182
|
+
default: boolean;
|
|
183
|
+
};
|
|
173
184
|
/** HTML tag to render */
|
|
174
185
|
tag: {
|
|
175
186
|
type: StringConstructor;
|
|
@@ -295,6 +306,16 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
295
306
|
type: BooleanConstructor;
|
|
296
307
|
default: boolean;
|
|
297
308
|
};
|
|
309
|
+
/**
|
|
310
|
+
* Disable all animations globally.
|
|
311
|
+
* When true, all grid items and float items render without
|
|
312
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
313
|
+
* @default false
|
|
314
|
+
*/
|
|
315
|
+
disableAnimation: {
|
|
316
|
+
type: BooleanConstructor;
|
|
317
|
+
default: boolean;
|
|
318
|
+
};
|
|
298
319
|
/** HTML tag to render */
|
|
299
320
|
tag: {
|
|
300
321
|
type: StringConstructor;
|
|
@@ -318,6 +339,7 @@ declare const GridContainer: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
318
339
|
pipIndex: number;
|
|
319
340
|
pinOnly: boolean;
|
|
320
341
|
disableFloat: boolean;
|
|
342
|
+
disableAnimation: boolean;
|
|
321
343
|
tag: string;
|
|
322
344
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
323
345
|
declare const GridItem: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
@@ -365,8 +387,8 @@ declare const GridItem: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
365
387
|
default: string;
|
|
366
388
|
};
|
|
367
389
|
}>> & Readonly<{}>, {
|
|
368
|
-
tag: string;
|
|
369
390
|
disableAnimation: boolean;
|
|
391
|
+
tag: string;
|
|
370
392
|
itemAspectRatio: string;
|
|
371
393
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
372
394
|
declare const GridOverlay: vue.DefineComponent<vue.ExtractPropTypes<{
|
package/dist/index.mjs
CHANGED
|
@@ -172,6 +172,16 @@ const GridContainer = defineComponent({
|
|
|
172
172
|
type: Boolean,
|
|
173
173
|
default: false
|
|
174
174
|
},
|
|
175
|
+
/**
|
|
176
|
+
* Disable all animations globally.
|
|
177
|
+
* When true, all grid items and float items render without
|
|
178
|
+
* spring/transition animations. Items snap to positions instantly.
|
|
179
|
+
* @default false
|
|
180
|
+
*/
|
|
181
|
+
disableAnimation: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
default: false
|
|
184
|
+
},
|
|
175
185
|
/** HTML tag to render */
|
|
176
186
|
tag: {
|
|
177
187
|
type: String,
|
|
@@ -205,7 +215,8 @@ const GridContainer = defineComponent({
|
|
|
205
215
|
provide(GridContextKey, {
|
|
206
216
|
grid,
|
|
207
217
|
springPreset: props.springPreset,
|
|
208
|
-
dimensions
|
|
218
|
+
dimensions,
|
|
219
|
+
disableAnimation: props.disableAnimation
|
|
209
220
|
});
|
|
210
221
|
return () => h(
|
|
211
222
|
props.tag,
|
|
@@ -252,7 +263,8 @@ const GridItem = defineComponent({
|
|
|
252
263
|
console.warn("GridItem must be used inside a GridContainer");
|
|
253
264
|
return () => null;
|
|
254
265
|
}
|
|
255
|
-
const { grid, springPreset, dimensions: containerDimensions } = context;
|
|
266
|
+
const { grid, springPreset, dimensions: containerDimensions, disableAnimation: containerDisableAnimation } = context;
|
|
267
|
+
const noAnimation = computed(() => containerDisableAnimation || props.disableAnimation);
|
|
256
268
|
const position = computed(() => grid.value.getPosition(props.index));
|
|
257
269
|
const dimensions = computed(() => grid.value.getItemDimensions(props.index));
|
|
258
270
|
const contentDimensions = computed(
|
|
@@ -330,9 +342,14 @@ const GridItem = defineComponent({
|
|
|
330
342
|
([, w, h2]) => {
|
|
331
343
|
if (isFloat.value && floatInitialized.value && w > 0 && h2 > 0) {
|
|
332
344
|
const pos = getFloatCornerPos(floatAnchor.value);
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
345
|
+
if (noAnimation.value) {
|
|
346
|
+
x.set(pos.x);
|
|
347
|
+
y.set(pos.y);
|
|
348
|
+
} else {
|
|
349
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
350
|
+
animate(x, pos.x, springCfg);
|
|
351
|
+
animate(y, pos.y, springCfg);
|
|
352
|
+
}
|
|
336
353
|
}
|
|
337
354
|
}
|
|
338
355
|
);
|
|
@@ -362,6 +379,9 @@ const GridItem = defineComponent({
|
|
|
362
379
|
gridX.set(pos.left);
|
|
363
380
|
gridY.set(pos.top);
|
|
364
381
|
gridAnimReady.value = true;
|
|
382
|
+
} else if (noAnimation.value) {
|
|
383
|
+
gridX.set(pos.left);
|
|
384
|
+
gridY.set(pos.top);
|
|
365
385
|
} else {
|
|
366
386
|
const cfg = {
|
|
367
387
|
type: "spring",
|
|
@@ -400,9 +420,14 @@ const GridItem = defineComponent({
|
|
|
400
420
|
const nearestCorner = findFloatNearestCorner(currentX, currentY);
|
|
401
421
|
floatAnchor.value = nearestCorner;
|
|
402
422
|
const snapPos = getFloatCornerPos(nearestCorner);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
423
|
+
if (noAnimation.value) {
|
|
424
|
+
x.set(snapPos.x);
|
|
425
|
+
y.set(snapPos.y);
|
|
426
|
+
} else {
|
|
427
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
428
|
+
animate(x, snapPos.x, springCfg);
|
|
429
|
+
animate(y, snapPos.y, springCfg);
|
|
430
|
+
}
|
|
406
431
|
};
|
|
407
432
|
return h(
|
|
408
433
|
motion.div,
|
|
@@ -428,8 +453,8 @@ const GridItem = defineComponent({
|
|
|
428
453
|
x,
|
|
429
454
|
y
|
|
430
455
|
},
|
|
431
|
-
whileDrag: { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
432
|
-
transition: { type: "spring", stiffness: 400, damping: 30 },
|
|
456
|
+
whileDrag: noAnimation.value ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
457
|
+
transition: noAnimation.value ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
433
458
|
"data-grid-index": props.index,
|
|
434
459
|
"data-grid-float": true,
|
|
435
460
|
onDragEnd: handleDragEnd
|
|
@@ -439,7 +464,7 @@ const GridItem = defineComponent({
|
|
|
439
464
|
}
|
|
440
465
|
const itemWidth = dimensions.value.width;
|
|
441
466
|
const itemHeight = dimensions.value.height;
|
|
442
|
-
if (
|
|
467
|
+
if (noAnimation.value) {
|
|
443
468
|
return h(
|
|
444
469
|
props.tag,
|
|
445
470
|
{
|
|
@@ -574,7 +599,7 @@ const FloatingGridItem = defineComponent({
|
|
|
574
599
|
console.warn("FloatingGridItem must be used inside a GridContainer");
|
|
575
600
|
return () => null;
|
|
576
601
|
}
|
|
577
|
-
const { dimensions } = context;
|
|
602
|
+
const { dimensions, disableAnimation: containerDisableAnimation } = context;
|
|
578
603
|
const currentAnchor = ref(props.anchor);
|
|
579
604
|
const effectiveSize = computed(() => {
|
|
580
605
|
if (props.breakpoints && props.breakpoints.length > 0 && dimensions.value.width > 0) {
|
|
@@ -644,9 +669,14 @@ const FloatingGridItem = defineComponent({
|
|
|
644
669
|
if (isInitialized.value && w > 0 && h2 > 0 && newAnchor !== currentAnchor.value) {
|
|
645
670
|
currentAnchor.value = newAnchor;
|
|
646
671
|
const pos = getCornerPosition(newAnchor);
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
672
|
+
if (containerDisableAnimation) {
|
|
673
|
+
x.set(pos.x);
|
|
674
|
+
y.set(pos.y);
|
|
675
|
+
} else {
|
|
676
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
677
|
+
animate(x, pos.x, springCfg);
|
|
678
|
+
animate(y, pos.y, springCfg);
|
|
679
|
+
}
|
|
650
680
|
}
|
|
651
681
|
}
|
|
652
682
|
);
|
|
@@ -655,9 +685,14 @@ const FloatingGridItem = defineComponent({
|
|
|
655
685
|
() => {
|
|
656
686
|
if (isInitialized.value && containerDimensions.value.width > 0 && containerDimensions.value.height > 0) {
|
|
657
687
|
const pos = getCornerPosition(currentAnchor.value);
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
688
|
+
if (containerDisableAnimation) {
|
|
689
|
+
x.set(pos.x);
|
|
690
|
+
y.set(pos.y);
|
|
691
|
+
} else {
|
|
692
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
693
|
+
animate(x, pos.x, springCfg);
|
|
694
|
+
animate(y, pos.y, springCfg);
|
|
695
|
+
}
|
|
661
696
|
}
|
|
662
697
|
}
|
|
663
698
|
);
|
|
@@ -682,9 +717,14 @@ const FloatingGridItem = defineComponent({
|
|
|
682
717
|
currentAnchor.value = nearestCorner;
|
|
683
718
|
emit("anchorChange", nearestCorner);
|
|
684
719
|
const snapPos = getCornerPosition(nearestCorner);
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
720
|
+
if (containerDisableAnimation) {
|
|
721
|
+
x.set(snapPos.x);
|
|
722
|
+
y.set(snapPos.y);
|
|
723
|
+
} else {
|
|
724
|
+
const springCfg = { type: "spring", stiffness: 400, damping: 30 };
|
|
725
|
+
animate(x, snapPos.x, springCfg);
|
|
726
|
+
animate(y, snapPos.y, springCfg);
|
|
727
|
+
}
|
|
688
728
|
};
|
|
689
729
|
return h(
|
|
690
730
|
motion.div,
|
|
@@ -708,8 +748,8 @@ const FloatingGridItem = defineComponent({
|
|
|
708
748
|
x,
|
|
709
749
|
y
|
|
710
750
|
},
|
|
711
|
-
whileDrag: { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
712
|
-
transition: { type: "spring", stiffness: 400, damping: 30 },
|
|
751
|
+
whileDrag: containerDisableAnimation ? { cursor: "grabbing" } : { cursor: "grabbing", scale: 1.05, boxShadow: "0 8px 32px rgba(0,0,0,0.4)" },
|
|
752
|
+
transition: containerDisableAnimation ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 30 },
|
|
713
753
|
onDragEnd: handleDragEnd
|
|
714
754
|
},
|
|
715
755
|
slots.default?.()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thangdevalone/meeting-grid-layout-vue",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"description": "Vue 3 integration for meeting-grid-layout with Motion animations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@vueuse/core": "^10.7.0",
|
|
45
45
|
"motion-v": "^1.0.0",
|
|
46
|
-
"@thangdevalone/meeting-grid-layout-core": "1.5.
|
|
46
|
+
"@thangdevalone/meeting-grid-layout-core": "1.5.8"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"vue": "^3.4.0",
|