eco-vue-js 0.26.1 → 0.26.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/dist/components/DragContainer/WDragContainer.vue.d.ts.map +1 -1
- package/dist/components/DragContainer/WDragContainer.vue_vue_type_script_setup_true_lang.js +22 -20
- package/dist/components/Tabs/WTabs.vue_vue_type_script_setup_true_lang.js +2 -2
- package/docs/components/drag-container.md +1 -1
- package/docs/llms.txt +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WDragContainer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/DragContainer/WDragContainer.vue"],"names":[],"mappings":"AAyBA;AAAA,
|
|
1
|
+
{"version":3,"file":"WDragContainer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/DragContainer/WDragContainer.vue"],"names":[],"mappings":"AAyBA;AAAA,OAqGO,EAAC,KAAK,cAAc,EAAuB,MAAM,KAAK,CAAA;AAK7D,QAAA,MAAM,YAAY,GAAK,IAAI,EAC1B,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,gBAAgB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE;WAqKO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;QAnKtD,kCAAkC;cAC5B,IAAI,EAAE;QACZ,yCAAyC;mBAC9B,OAAO;;;KAgKuE,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC5J,CAAC,OAAO,EAAE,EAAE,KAAK,IAAI;WACtB,GAAG;;QAvJT,0QAA0Q;kBAChQ,CAAC,KAAK,EAAE;YAChB,IAAI,EAAE,IAAI,CAAA;YACV,KAAK,EAAE,MAAM,CAAA;YACb,IAAI,EAAE,OAAO,CAAA;YACb,WAAW,EAAE,IAAI,EAAE,CAAA;YACnB,QAAQ,EAAE,OAAO,CAAA;YACjB,QAAQ,EAAE,MAAM,IAAI,CAAA;YACpB,SAAS,EAAE,cAAc,CAAA;SAC1B,KAAK,IAAI;;cAdN,aAAa,SAAS,IAAI,EAAE,KAAG,IAAI;EAgKrC,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;CAAI,CAAC;wBACpE,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DragItem_default from "./components/DragItem.vue.js";
|
|
2
2
|
import { useDragContainer } from "./use/useDragContainer.js";
|
|
3
|
-
import { Fragment, createBlock, createElementBlock, defineComponent, mergeProps, openBlock, ref, renderList, renderSlot, unref, watch, withCtx } from "vue";
|
|
3
|
+
import { Fragment, computed, createBlock, createElementBlock, defineComponent, mergeProps, openBlock, ref, renderList, renderSlot, unref, watch, withCtx } from "vue";
|
|
4
4
|
//#region src/components/DragContainer/WDragContainer.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = { class: "relative grid grid-cols-1" };
|
|
6
6
|
var WDragContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
@@ -14,45 +14,47 @@ var WDragContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
|
|
|
14
14
|
const props = __props;
|
|
15
15
|
const emit = __emit;
|
|
16
16
|
const { draggable, dragging, startDrag, stopDrag } = useDragContainer();
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
17
|
+
const getInitialOrder = (list) => list.map((_, index) => index);
|
|
18
|
+
const order = ref(getInitialOrder(props.list));
|
|
19
|
+
const orderedList = computed(() => order.value.map((index) => props.list[index]));
|
|
20
|
+
let dragIndex = null;
|
|
21
|
+
const dragStart = (index) => {
|
|
20
22
|
startDrag();
|
|
21
|
-
|
|
23
|
+
dragIndex = index;
|
|
22
24
|
};
|
|
23
|
-
const dragEnter = (
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const dragEnter = (position) => {
|
|
26
|
+
if (dragIndex === null) return;
|
|
27
|
+
const from = order.value.indexOf(dragIndex);
|
|
28
|
+
if (from === -1) return;
|
|
29
|
+
order.value.splice(from, 1);
|
|
30
|
+
order.value.splice(position, 0, dragIndex);
|
|
29
31
|
};
|
|
30
32
|
const dragEnd = () => {
|
|
31
33
|
stopDrag();
|
|
32
|
-
|
|
34
|
+
dragIndex = null;
|
|
33
35
|
};
|
|
34
36
|
const drop = () => {
|
|
35
|
-
emit("update:list",
|
|
37
|
+
emit("update:list", orderedList.value);
|
|
36
38
|
dragEnd();
|
|
37
39
|
};
|
|
38
|
-
watch(() => props.list, (newList) => {
|
|
39
|
-
|
|
40
|
+
watch([() => props.list, () => props.list.length], ([newList]) => {
|
|
41
|
+
order.value = getInitialOrder(newList);
|
|
40
42
|
});
|
|
41
43
|
return (_ctx, _cache) => {
|
|
42
44
|
return openBlock(), createElementBlock("div", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.list, (item, index) => {
|
|
43
45
|
return openBlock(), createBlock(DragItem_default, {
|
|
44
46
|
key: index,
|
|
45
47
|
disabled: __props.disabled || !unref(draggable),
|
|
46
|
-
order:
|
|
47
|
-
"onDrag:start": ($event) => dragStart(
|
|
48
|
+
order: order.value.indexOf(index),
|
|
49
|
+
"onDrag:start": ($event) => dragStart(index),
|
|
48
50
|
"onDrag:enter": dragEnter,
|
|
49
51
|
"onDrag:end": drop
|
|
50
52
|
}, {
|
|
51
53
|
default: withCtx((defaultScope) => [renderSlot(_ctx.$slots, "default", mergeProps({ ref_for: true }, defaultScope, {
|
|
52
54
|
item,
|
|
53
|
-
index:
|
|
54
|
-
last:
|
|
55
|
-
orderedList:
|
|
55
|
+
index: order.value.indexOf(index),
|
|
56
|
+
last: order.value.indexOf(index) === order.value.length - 1,
|
|
57
|
+
orderedList: orderedList.value,
|
|
56
58
|
dragging: unref(dragging)
|
|
57
59
|
}))]),
|
|
58
60
|
_: 2
|
|
@@ -434,8 +434,8 @@ var WTabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
434
434
|
"--direction-factor": isDirect.value ? "1" : "-1"
|
|
435
435
|
})
|
|
436
436
|
}, [createVNode(TransitionGroup, {
|
|
437
|
-
"enter-active-class": "transition-[translate,opacity] duration-250 w-full",
|
|
438
|
-
"leave-active-class": "transition-[translate,opacity] duration-250 w-full absolute top-0",
|
|
437
|
+
"enter-active-class": "transition-[translate,opacity] duration-250 w-full [overflow-anchor:none]",
|
|
438
|
+
"leave-active-class": "transition-[translate,opacity] duration-250 w-full absolute top-0 [overflow-anchor:none]",
|
|
439
439
|
"enter-from-class": __props.lessTransitions || __props.side || unref(hasScrollbar) ? "opacity-0" : "opacity-0 translate-x-[calc((100%+var(--inner-margin))*var(--direction-factor))]",
|
|
440
440
|
"leave-to-class": __props.lessTransitions || __props.side || unref(hasScrollbar) ? "opacity-0 absolute" : "opacity-0 translate-x-[calc((100%+var(--inner-margin))*var(--direction-factor)*-1)]",
|
|
441
441
|
css: !__props.flat
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Drag container
|
|
2
2
|
|
|
3
|
-
`WDragContainer` lets the user reorder `list` by dragging its items. It doesn't render the items itself: the default slot renders each one, and binds `container` — the drag attributes and its place in the order — to the item's root. An item becomes draggable when `initDrag` is called, usually on mousedown of a drag handle, so that text in the item can still be selected. The items move as the dragged one passes over them; `update:list` emits the new order once it is dropped.
|
|
3
|
+
`WDragContainer` lets the user reorder `list` by dragging its items. It doesn't render the items itself: the default slot renders each one, and binds `container` — the drag attributes and its place in the order — to the item's root. An item becomes draggable when `initDrag` is called, usually on mousedown of a drag handle, so that text in the item can still be selected. The items move as the dragged one passes over them; `update:list` emits the new order once it is dropped. Items are tracked by their position, so `list` may hold equal values — the same string twice, or the same object.
|
|
4
4
|
|
|
5
5
|
The `w-drag-item-overlay-*` utility sets the color laid over the item being dragged.
|
|
6
6
|
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# eco-vue-js
|
|
2
2
|
|
|
3
|
-
> Vue 3 UI kit with Tailwind v4 — components, utilities, icons and recipes. These are the docs of version 0.26.
|
|
3
|
+
> Vue 3 UI kit with Tailwind v4 — components, utilities, icons and recipes. These are the docs of version 0.26.3, the one installed next to them. Start with Getting started and Conventions; each component page lists its props, events and slots with examples.
|
|
4
4
|
|
|
5
5
|
Release notes, for what changed between versions: https://github.com/rsmple/eco-vue-js/releases. The docs site, with live demos: https://rsmple.github.io/eco-vue-js/
|
|
6
6
|
|