@milaboratories/uikit 2.2.92 → 2.2.94
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/.turbo/turbo-build.log +735 -726
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/components/PlElementList/PlElementList.vue.d.ts +70 -0
- package/dist/components/PlElementList/PlElementList.vue.d.ts.map +1 -0
- package/dist/components/PlElementList/PlElementList.vue.js +10 -0
- package/dist/components/PlElementList/PlElementList.vue.js.map +1 -0
- package/dist/components/PlElementList/PlElementList.vue2.js +240 -0
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -0
- package/dist/components/PlElementList/PlElementList.vue3.js +13 -0
- package/dist/components/PlElementList/PlElementList.vue3.js.map +1 -0
- package/dist/components/PlElementList/PlElementListItem.vue.d.ts +57 -0
- package/dist/components/PlElementList/PlElementListItem.vue.d.ts.map +1 -0
- package/dist/components/PlElementList/PlElementListItem.vue.js +10 -0
- package/dist/components/PlElementList/PlElementListItem.vue.js.map +1 -0
- package/dist/components/PlElementList/PlElementListItem.vue2.js +106 -0
- package/dist/components/PlElementList/PlElementListItem.vue2.js.map +1 -0
- package/dist/components/PlElementList/PlElementListItem.vue3.js +39 -0
- package/dist/components/PlElementList/PlElementListItem.vue3.js.map +1 -0
- package/dist/components/PlElementList/index.d.ts +2 -0
- package/dist/components/PlElementList/index.d.ts.map +1 -0
- package/dist/components/PlElementList/utils.d.ts +3 -0
- package/dist/components/PlElementList/utils.d.ts.map +1 -0
- package/dist/components/PlElementList/utils.js +17 -0
- package/dist/components/PlElementList/utils.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +107 -105
- package/dist/index.js.map +1 -1
- package/dist/lib/util/helpers/dist/index.js +134 -105
- package/dist/lib/util/helpers/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@vueuse_core@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/core/index.js +54 -44
- package/dist/node_modules/.pnpm/@vueuse_core@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/core/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@vueuse_integrations@13.3.0_axios@1.8.1_focus-trap@7.6.0_sortablejs@1.15.6_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/integrations/useSortable.js +51 -0
- package/dist/node_modules/.pnpm/@vueuse_integrations@13.3.0_axios@1.8.1_focus-trap@7.6.0_sortablejs@1.15.6_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/integrations/useSortable.js.map +1 -0
- package/dist/node_modules/.pnpm/@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js +57 -49
- package/dist/node_modules/.pnpm/@vueuse_shared@13.3.0_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/shared/index.js.map +1 -1
- package/dist/node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.js +1262 -0
- package/dist/node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.js.map +1 -0
- package/dist/sdk/model/dist/index.js +1 -1
- package/dist/sdk/model/dist/index.js.map +1 -1
- package/package.json +11 -8
- package/src/components/PlElementList/PlElementList.vue +336 -0
- package/src/components/PlElementList/PlElementListItem.vue +239 -0
- package/src/components/PlElementList/README.md +92 -0
- package/src/components/PlElementList/index.ts +1 -0
- package/src/components/PlElementList/utils.ts +17 -0
- package/src/index.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
WARN Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @milaboratories/uikit@2.2.
|
|
3
|
+
> @milaboratories/uikit@2.2.94 type-check /home/runner/_work/platforma/platforma/lib/ui/uikit
|
|
4
4
|
> vue-tsc --project ./tsconfig.lib.json
|
|
5
5
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @milaboratories/uikit
|
|
2
2
|
|
|
3
|
+
## 2.2.94
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [10e5841]
|
|
8
|
+
- @platforma-sdk/model@1.37.11
|
|
9
|
+
|
|
10
|
+
## 2.2.93
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- c6b4dd2: Extend interface for PlElementList
|
|
15
|
+
|
|
3
16
|
## 2.2.92
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const _default: <T extends unknown = unknown, K extends number | string = string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
3
|
+
readonly "onUpdate:items"?: ((value: T[]) => any) | undefined;
|
|
4
|
+
readonly "onUpdate:draggableItems"?: ((value: Set<T>) => any) | undefined;
|
|
5
|
+
readonly "onUpdate:removableItems"?: ((value: Set<T>) => any) | undefined;
|
|
6
|
+
readonly "onUpdate:expandableItems"?: ((value: Set<T>) => any) | undefined;
|
|
7
|
+
readonly "onUpdate:expandedItems"?: ((value: Set<T>) => any) | undefined;
|
|
8
|
+
readonly "onUpdate:pinnableItems"?: ((value: Set<T>) => any) | undefined;
|
|
9
|
+
readonly "onUpdate:pinnedItems"?: ((value: Set<T>) => any) | undefined;
|
|
10
|
+
readonly "onUpdate:toggableItems"?: ((value: Set<T>) => any) | undefined;
|
|
11
|
+
readonly "onUpdate:toggledItems"?: ((value: Set<T>) => any) | undefined;
|
|
12
|
+
readonly onItemClick?: ((item: T) => any) | undefined;
|
|
13
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:items" | "onUpdate:draggableItems" | "onUpdate:removableItems" | "onUpdate:expandableItems" | "onUpdate:expandedItems" | "onUpdate:pinnableItems" | "onUpdate:pinnedItems" | "onUpdate:toggableItems" | "onUpdate:toggledItems" | "onItemClick"> & ({
|
|
14
|
+
items: T[];
|
|
15
|
+
draggableItems?: Set<T>;
|
|
16
|
+
removableItems?: Set<T>;
|
|
17
|
+
expandableItems?: Set<T>;
|
|
18
|
+
expandedItems?: Set<T>;
|
|
19
|
+
pinnableItems?: Set<T>;
|
|
20
|
+
pinnedItems?: Set<T>;
|
|
21
|
+
toggableItems?: Set<T>;
|
|
22
|
+
toggledItems?: Set<T>;
|
|
23
|
+
} & {
|
|
24
|
+
itemClass?: string | string[] | ((item: T, index: number) => string | string[]);
|
|
25
|
+
activeItems?: Set<T>;
|
|
26
|
+
enableDragging?: boolean;
|
|
27
|
+
getItemKey?: (item: T) => K;
|
|
28
|
+
onDragEnd?: (oldIndex: number, newIndex: number) => void | boolean;
|
|
29
|
+
onSort?: (oldIndex: number, newIndex: number) => void | boolean;
|
|
30
|
+
enableExpanding?: boolean;
|
|
31
|
+
onExpand?: (item: T, index: number) => void | boolean;
|
|
32
|
+
enableRemoving?: boolean;
|
|
33
|
+
onRemove?: (item: T, index: number) => void | boolean;
|
|
34
|
+
enableToggling?: boolean;
|
|
35
|
+
onToggle?: (item: T, index: number) => void | boolean;
|
|
36
|
+
enablePinning?: boolean;
|
|
37
|
+
onPin?: (item: T, index: number) => void | boolean;
|
|
38
|
+
}) & Partial<{}>> & import('vue').PublicProps;
|
|
39
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
40
|
+
attrs: any;
|
|
41
|
+
slots: Readonly<{
|
|
42
|
+
"item-title": (props: {
|
|
43
|
+
item: T;
|
|
44
|
+
index: number;
|
|
45
|
+
}) => unknown;
|
|
46
|
+
"item-content"?: (props: {
|
|
47
|
+
item: T;
|
|
48
|
+
index: number;
|
|
49
|
+
}) => unknown;
|
|
50
|
+
}> & {
|
|
51
|
+
"item-title": (props: {
|
|
52
|
+
item: T;
|
|
53
|
+
index: number;
|
|
54
|
+
}) => unknown;
|
|
55
|
+
"item-content"?: (props: {
|
|
56
|
+
item: T;
|
|
57
|
+
index: number;
|
|
58
|
+
}) => unknown;
|
|
59
|
+
};
|
|
60
|
+
emit: ((e: "itemClick", item: T) => void) & (((evt: "update:items", value: T[]) => void) & ((evt: "update:draggableItems", value: Set<T>) => void) & ((evt: "update:removableItems", value: Set<T>) => void) & ((evt: "update:expandableItems", value: Set<T>) => void) & ((evt: "update:expandedItems", value: Set<T>) => void) & ((evt: "update:pinnableItems", value: Set<T>) => void) & ((evt: "update:pinnedItems", value: Set<T>) => void) & ((evt: "update:toggableItems", value: Set<T>) => void) & ((evt: "update:toggledItems", value: Set<T>) => void));
|
|
61
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
}> & {
|
|
64
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
65
|
+
};
|
|
66
|
+
export default _default;
|
|
67
|
+
type __VLS_PrettifyLocal<T> = {
|
|
68
|
+
[K in keyof T]: T[K];
|
|
69
|
+
} & {};
|
|
70
|
+
//# sourceMappingURL=PlElementList.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlElementList.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PlElementList/PlElementList.vue"],"names":[],"mappings":"yBA0ViB,CAAC,SAAS,OAAO,YAAY,CAAC,SAAS,MAAM,GAAG,MAAM,iCACzD,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CA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AAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;sBAleO,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;yBAC3C,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;sBADjD,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;yBAC3C,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;UAme5D,KAzeD,WAAW,QAAQ,CAAC,KAAG,IAAI,0fAyeW;;;;YAGA,OAAO,CAAC,OAAO,WAAW,CAAC;;AAziBvE,wBAyiB4E;AAS5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import s from "./PlElementList.vue2.js";
|
|
2
|
+
import o from "./PlElementList.vue3.js";
|
|
3
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const e = {
|
|
5
|
+
$style: o
|
|
6
|
+
}, c = /* @__PURE__ */ t(s, [["__cssModules", e]]);
|
|
7
|
+
export {
|
|
8
|
+
c as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=PlElementList.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlElementList.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { defineComponent as ce, mergeModels as X, useModel as u, useSlots as ve, computed as g, shallowRef as C, watch as me, createElementBlock as P, openBlock as b, normalizeClass as R, createElementVNode as be, createCommentVNode as ye, Fragment as Y, renderList as Z, createBlock as _, createSlots as ee, withCtx as S, renderSlot as k } from "vue";
|
|
2
|
+
import { isNil as c, shallowHash as te } from "../../lib/util/helpers/dist/index.js";
|
|
3
|
+
import { useSortable as he } from "../../node_modules/.pnpm/@vueuse_integrations@13.3.0_axios@1.8.1_focus-trap@7.6.0_sortablejs@1.15.6_vue@3.5.13_typescript@5.6.3_/node_modules/@vueuse/integrations/useSortable.js";
|
|
4
|
+
import { optionalUpdateRef as v, moveElements as ae } from "./utils.js";
|
|
5
|
+
import ne from "./PlElementListItem.vue.js";
|
|
6
|
+
const ke = /* @__PURE__ */ ce({
|
|
7
|
+
__name: "PlElementList",
|
|
8
|
+
props: /* @__PURE__ */ X({
|
|
9
|
+
itemClass: { type: [String, Array, Function], default: void 0 },
|
|
10
|
+
activeItems: { default: void 0 },
|
|
11
|
+
enableDragging: { type: Boolean, default: void 0 },
|
|
12
|
+
getItemKey: { type: Function, default: void 0 },
|
|
13
|
+
onDragEnd: { type: Function, default: void 0 },
|
|
14
|
+
onSort: { type: Function, default: void 0 },
|
|
15
|
+
enableExpanding: { type: Boolean, default: void 0 },
|
|
16
|
+
onExpand: { type: Function, default: void 0 },
|
|
17
|
+
enableRemoving: { type: Boolean, default: void 0 },
|
|
18
|
+
onRemove: { type: Function, default: void 0 },
|
|
19
|
+
enableToggling: { type: Boolean, default: void 0 },
|
|
20
|
+
onToggle: { type: Function, default: void 0 },
|
|
21
|
+
enablePinning: { type: Boolean, default: void 0 },
|
|
22
|
+
onPin: { type: Function, default: void 0 }
|
|
23
|
+
}, {
|
|
24
|
+
items: { required: !0 },
|
|
25
|
+
itemsModifiers: {},
|
|
26
|
+
draggableItems: {},
|
|
27
|
+
draggableItemsModifiers: {},
|
|
28
|
+
removableItems: {},
|
|
29
|
+
removableItemsModifiers: {},
|
|
30
|
+
expandableItems: {},
|
|
31
|
+
expandableItemsModifiers: {},
|
|
32
|
+
expandedItems: {},
|
|
33
|
+
expandedItemsModifiers: {},
|
|
34
|
+
pinnableItems: {},
|
|
35
|
+
pinnableItemsModifiers: {},
|
|
36
|
+
pinnedItems: {},
|
|
37
|
+
pinnedItemsModifiers: {},
|
|
38
|
+
toggableItems: {},
|
|
39
|
+
toggableItemsModifiers: {},
|
|
40
|
+
toggledItems: {},
|
|
41
|
+
toggledItemsModifiers: {}
|
|
42
|
+
}),
|
|
43
|
+
emits: /* @__PURE__ */ X(["itemClick"], ["update:items", "update:draggableItems", "update:removableItems", "update:expandableItems", "update:expandedItems", "update:pinnableItems", "update:pinnedItems", "update:toggableItems", "update:toggledItems"]),
|
|
44
|
+
setup(o, { emit: le }) {
|
|
45
|
+
const d = u(o, "items"), se = u(o, "draggableItems"), ie = u(o, "removableItems"), oe = u(o, "expandableItems"), y = u(o, "expandedItems"), re = u(o, "pinnableItems"), r = u(o, "pinnedItems"), ue = u(o, "toggableItems"), f = u(o, "toggledItems"), n = o, I = le, T = ve(), D = g(() => n.enableDragging !== !1 && !c(n.getItemKey)), h = g(() => d.value.filter(E)), de = g(() => h.value.length > 0), p = g(() => d.value.filter((e) => !E(e))), $ = g(() => p.value.length > 0), x = C(), w = C(), F = C(), M = g((e) => {
|
|
46
|
+
const t = te(...d.value);
|
|
47
|
+
if (x.value === void 0) return e ?? t;
|
|
48
|
+
const a = te(...x.value);
|
|
49
|
+
return t === a ? e ?? t : e !== t ? t : a;
|
|
50
|
+
});
|
|
51
|
+
B(de, w, h, () => 0), B($, F, p, () => h.value.length);
|
|
52
|
+
function B(e, t, a, l) {
|
|
53
|
+
const s = he(t, a, {
|
|
54
|
+
handle: '[data-draggable="true"]',
|
|
55
|
+
animation: 150,
|
|
56
|
+
forceFallback: !0,
|
|
57
|
+
fallbackOnBody: !0,
|
|
58
|
+
scrollSensitivity: 80,
|
|
59
|
+
forceAutoScrollFallback: !0,
|
|
60
|
+
onUpdate: (i) => {
|
|
61
|
+
var m;
|
|
62
|
+
if (i.oldIndex == null || i.newIndex == null)
|
|
63
|
+
throw new Error("Sortable event has no index");
|
|
64
|
+
((m = n.onDragEnd) == null ? void 0 : m.call(n, i.oldIndex, i.newIndex)) !== !1 && A(l() + i.oldIndex, l() + i.newIndex, !0);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return me(e, (i) => i ? s.start() : s.stop()), s;
|
|
68
|
+
}
|
|
69
|
+
function A(e, t, a) {
|
|
70
|
+
var s;
|
|
71
|
+
if (e === t) return;
|
|
72
|
+
a && (x.value = ae(d.value.slice(), e, t)), ((s = n.onSort) == null ? void 0 : s.call(n, e, t)) === !1 || (ae(d.value, e, t), v(d));
|
|
73
|
+
}
|
|
74
|
+
function K(e) {
|
|
75
|
+
var t;
|
|
76
|
+
return ((t = n.activeItems) == null ? void 0 : t.has(e)) ?? !1;
|
|
77
|
+
}
|
|
78
|
+
function H(e) {
|
|
79
|
+
var t;
|
|
80
|
+
return n.enableDragging === !1 ? !1 : ((t = se.value) == null ? void 0 : t.has(e)) ?? !0;
|
|
81
|
+
}
|
|
82
|
+
function z(e) {
|
|
83
|
+
var t;
|
|
84
|
+
return n.enableToggling === !1 ? !1 : !c(f.value) && (((t = ue.value) == null ? void 0 : t.has(e)) ?? !0);
|
|
85
|
+
}
|
|
86
|
+
function L(e) {
|
|
87
|
+
var t;
|
|
88
|
+
return ((t = f.value) == null ? void 0 : t.has(e)) ?? !1;
|
|
89
|
+
}
|
|
90
|
+
function N(e) {
|
|
91
|
+
var t;
|
|
92
|
+
return n.enablePinning === !1 ? !1 : !c(r.value) && (((t = re.value) == null ? void 0 : t.has(e)) ?? !0);
|
|
93
|
+
}
|
|
94
|
+
function E(e) {
|
|
95
|
+
var t;
|
|
96
|
+
return ((t = r.value) == null ? void 0 : t.has(e)) ?? !1;
|
|
97
|
+
}
|
|
98
|
+
function U(e) {
|
|
99
|
+
var t;
|
|
100
|
+
return n.enableExpanding === !1 ? !1 : !c(y.value) && (((t = oe.value) == null ? void 0 : t.has(e)) ?? !0);
|
|
101
|
+
}
|
|
102
|
+
function V(e) {
|
|
103
|
+
var t;
|
|
104
|
+
return ((t = y.value) == null ? void 0 : t.has(e)) ?? !1;
|
|
105
|
+
}
|
|
106
|
+
function j(e) {
|
|
107
|
+
var t;
|
|
108
|
+
return n.enableRemoving === !1 || ((t = ie.value) == null ? void 0 : t.has(e)) === !1 ? !1 : n.enableRemoving === !0 || typeof n.onRemove == "function";
|
|
109
|
+
}
|
|
110
|
+
function q(e, t) {
|
|
111
|
+
var l;
|
|
112
|
+
if (((l = n.onExpand) == null ? void 0 : l.call(n, e, t)) === !1 || c(y.value)) return;
|
|
113
|
+
const a = y.value;
|
|
114
|
+
a.has(e) ? a.delete(e) : a.add(e), v(y);
|
|
115
|
+
}
|
|
116
|
+
function G(e, t) {
|
|
117
|
+
var l;
|
|
118
|
+
if (((l = n.onToggle) == null ? void 0 : l.call(n, e, t)) === !1 || c(f.value)) return;
|
|
119
|
+
const a = f.value;
|
|
120
|
+
a.has(e) ? a.delete(e) : a.add(e), v(f);
|
|
121
|
+
}
|
|
122
|
+
function J(e, t) {
|
|
123
|
+
var s;
|
|
124
|
+
if (t === -1)
|
|
125
|
+
throw new Error("Pinnable item not found");
|
|
126
|
+
if (((s = n.onPin) == null ? void 0 : s.call(n, e, t)) === !1 || c(r.value)) return;
|
|
127
|
+
const a = r.value, l = a.has(e);
|
|
128
|
+
l ? a.delete(e) : a.add(e), v(r), A(t, a.size + (l ? 0 : -1), !1);
|
|
129
|
+
}
|
|
130
|
+
function O(e, t) {
|
|
131
|
+
var a, l, s;
|
|
132
|
+
((a = n.onRemove) == null ? void 0 : a.call(n, e, t)) !== !1 && (d.value.splice(t, 1), v(d), (l = r.value) != null && l.has(e) && (r.value.delete(e), v(r)), (s = f.value) != null && s.has(e) && (f.value.delete(e), v(f)));
|
|
133
|
+
}
|
|
134
|
+
const Q = (e, t) => c(n.getItemKey) ? `${M.value}-${t}` : `${M.value}-${n.getItemKey(e)}`, fe = g(() => h.value.map(Q)), ge = g(() => p.value.map(Q)), W = (e, t) => typeof n.itemClass == "function" ? n.itemClass(e, t) : n.itemClass ?? null;
|
|
135
|
+
return (e, t) => (b(), P("div", {
|
|
136
|
+
class: R(e.$style.root)
|
|
137
|
+
}, [
|
|
138
|
+
be("div", {
|
|
139
|
+
ref_key: "pinnedContainerRef",
|
|
140
|
+
ref: w,
|
|
141
|
+
class: R(e.$style.list)
|
|
142
|
+
}, [
|
|
143
|
+
(b(!0), P(Y, null, Z(h.value, (a, l) => (b(), _(ne, {
|
|
144
|
+
key: fe.value[l],
|
|
145
|
+
class: R([e.$style.item, W(a, l)]),
|
|
146
|
+
index: l,
|
|
147
|
+
item: a,
|
|
148
|
+
showDragHandle: D.value,
|
|
149
|
+
isActive: K(a),
|
|
150
|
+
isDraggable: H(a),
|
|
151
|
+
isRemovable: j(a),
|
|
152
|
+
isToggable: z(a),
|
|
153
|
+
isToggled: L(a),
|
|
154
|
+
isPinnable: N(a),
|
|
155
|
+
isPinned: E(a),
|
|
156
|
+
isExpandable: U(a),
|
|
157
|
+
isExpanded: V(a),
|
|
158
|
+
onClick: (s) => I("itemClick", a),
|
|
159
|
+
onRemove: O,
|
|
160
|
+
onToggle: G,
|
|
161
|
+
onPin: J,
|
|
162
|
+
onExpand: q
|
|
163
|
+
}, ee({
|
|
164
|
+
title: S(({ item: s, index: i }) => [
|
|
165
|
+
k(e.$slots, "item-title", {
|
|
166
|
+
index: i,
|
|
167
|
+
item: s
|
|
168
|
+
})
|
|
169
|
+
]),
|
|
170
|
+
_: 2
|
|
171
|
+
}, [
|
|
172
|
+
T["item-content"] ? {
|
|
173
|
+
name: "content",
|
|
174
|
+
fn: S(({ item: s, index: i }) => [
|
|
175
|
+
k(e.$slots, "item-content", {
|
|
176
|
+
index: i,
|
|
177
|
+
item: s
|
|
178
|
+
})
|
|
179
|
+
]),
|
|
180
|
+
key: "0"
|
|
181
|
+
} : void 0
|
|
182
|
+
]), 1032, ["class", "index", "item", "showDragHandle", "isActive", "isDraggable", "isRemovable", "isToggable", "isToggled", "isPinnable", "isPinned", "isExpandable", "isExpanded", "onClick"]))), 128))
|
|
183
|
+
], 2),
|
|
184
|
+
$.value ? (b(), P("div", {
|
|
185
|
+
key: 0,
|
|
186
|
+
ref_key: "unpinnedContainerRef",
|
|
187
|
+
ref: F,
|
|
188
|
+
class: R(e.$style.list)
|
|
189
|
+
}, [
|
|
190
|
+
(b(!0), P(Y, null, Z(p.value, (a, l) => {
|
|
191
|
+
var s;
|
|
192
|
+
return b(), _(ne, {
|
|
193
|
+
key: ge.value[l],
|
|
194
|
+
class: R([e.$style.item, W(a, l)]),
|
|
195
|
+
index: l + (((s = r.value) == null ? void 0 : s.size) ?? 0),
|
|
196
|
+
item: a,
|
|
197
|
+
showDragHandle: D.value,
|
|
198
|
+
isActive: K(a),
|
|
199
|
+
isDraggable: H(a),
|
|
200
|
+
isRemovable: j(a),
|
|
201
|
+
isToggable: z(a),
|
|
202
|
+
isToggled: L(a),
|
|
203
|
+
isPinnable: N(a),
|
|
204
|
+
isPinned: E(a),
|
|
205
|
+
isExpandable: U(a),
|
|
206
|
+
isExpanded: V(a),
|
|
207
|
+
onClick: (i) => I("itemClick", a),
|
|
208
|
+
onRemove: O,
|
|
209
|
+
onToggle: G,
|
|
210
|
+
onPin: J,
|
|
211
|
+
onExpand: q
|
|
212
|
+
}, ee({
|
|
213
|
+
title: S(({ item: i, index: m }) => [
|
|
214
|
+
k(e.$slots, "item-title", {
|
|
215
|
+
index: m,
|
|
216
|
+
item: i
|
|
217
|
+
})
|
|
218
|
+
]),
|
|
219
|
+
_: 2
|
|
220
|
+
}, [
|
|
221
|
+
T["item-content"] ? {
|
|
222
|
+
name: "content",
|
|
223
|
+
fn: S(({ item: i, index: m }) => [
|
|
224
|
+
k(e.$slots, "item-content", {
|
|
225
|
+
index: m,
|
|
226
|
+
item: i
|
|
227
|
+
})
|
|
228
|
+
]),
|
|
229
|
+
key: "0"
|
|
230
|
+
} : void 0
|
|
231
|
+
]), 1032, ["class", "index", "item", "showDragHandle", "isActive", "isDraggable", "isRemovable", "isToggable", "isToggled", "isPinnable", "isPinned", "isExpandable", "isExpanded", "onClick"]);
|
|
232
|
+
}), 128))
|
|
233
|
+
], 2)) : ye("", !0)
|
|
234
|
+
], 2));
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
export {
|
|
238
|
+
ke as default
|
|
239
|
+
};
|
|
240
|
+
//# sourceMappingURL=PlElementList.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlElementList.vue2.js","sources":["../../../src/components/PlElementList/PlElementList.vue"],"sourcesContent":["<script generic=\"T extends unknown = unknown, K extends number | string = number | string\" lang=\"ts\" setup>\nimport type { ShallowRef } from 'vue';\nimport { computed, shallowRef, watch } from 'vue';\nimport { isNil, shallowHash } from '@milaboratories/helpers';\nimport { useSortable } from '@vueuse/integrations/useSortable';\nimport { type SortableEvent } from 'sortablejs';\nimport { moveElements, optionalUpdateRef } from './utils.ts';\nimport PlElementListItem from './PlElementListItem.vue';\n\nconst itemsRef = defineModel<T[]>('items', { required: true });\nconst draggableSetRef = defineModel<Set<T>>('draggableItems');\nconst removableSetRef = defineModel<Set<T>>('removableItems');\n\nconst expandableSetRef = defineModel<Set<T>>('expandableItems');\nconst expandedSetRef = defineModel<Set<T>>('expandedItems');\n\nconst pinnableSetRef = defineModel<Set<T>>('pinnableItems');\nconst pinnedSetRef = defineModel<Set<T>>('pinnedItems');\n\nconst toggableSetRef = defineModel<Set<T>>('toggableItems');\nconst toggledSetRef = defineModel<Set<T>>('toggledItems');\n\nconst props = withDefaults(\n defineProps<{\n itemClass?: string | string[] | ((item: T, index: number) => string | string[]);\n activeItems?: Set<T>;\n\n enableDragging?: boolean;\n getItemKey?: (item: T) => K;\n onDragEnd?: (oldIndex: number, newIndex: number) => void | boolean;\n onSort?: (oldIndex: number, newIndex: number) => void | boolean;\n\n enableExpanding?: boolean;\n onExpand?: (item: T, index: number) => void | boolean;\n\n enableRemoving?: boolean;\n onRemove?: (item: T, index: number) => void | boolean;\n\n enableToggling?: boolean;\n onToggle?: (item: T, index: number) => void | boolean;\n\n enablePinning?: boolean;\n onPin?: (item: T, index: number) => void | boolean;\n }>(), {\n itemClass: undefined,\n activeItems: undefined,\n\n enableDragging: undefined,\n enableRemoving: undefined,\n enableExpanding: undefined,\n enableToggling: undefined,\n enablePinning: undefined,\n\n getItemKey: undefined,\n onDragEnd: undefined,\n onSort: undefined,\n onRemove: undefined,\n onExpand: undefined,\n onToggle: undefined,\n onPin: undefined,\n },\n);\n\nconst emits = defineEmits<{\n (e: 'itemClick', item: T): void;\n}>();\n\nconst slots = defineSlots<{\n ['item-title']: (props: { item: T; index: number }) => unknown;\n ['item-content']?: (props: { item: T; index: number }) => unknown;\n}>();\n\nconst dndSortingEnabled = computed((): boolean => {\n return props.enableDragging !== false && !isNil(props.getItemKey);\n});\n\nconst pinnedItemsRef = computed(() => itemsRef.value.filter(isPinned));\nconst hasPinnedItems = computed(() => pinnedItemsRef.value.length > 0);\n\nconst unpinnedItemsRef = computed(() => itemsRef.value.filter((item) => !isPinned(item)));\nconst hasUnpinnedItems = computed(() => unpinnedItemsRef.value.length > 0);\n\nconst domProjectionItemsRef = shallowRef<undefined | T[]>();\nconst pinnedContainerRef = shallowRef<HTMLElement>();\nconst unpinnedContainerRef = shallowRef<HTMLElement>();\n\n// version fix problem with sync between data and rendered values when items have been changed\nconst versionRef = computed<number>((oldVersion) => {\n const currentVersion = shallowHash(...itemsRef.value);\n\n if (domProjectionItemsRef.value === undefined) return oldVersion ?? currentVersion;\n\n const lastSortedVersion = shallowHash(...domProjectionItemsRef.value);\n\n if (currentVersion === lastSortedVersion) return oldVersion ?? currentVersion;\n\n return oldVersion !== currentVersion ? currentVersion : lastSortedVersion;\n});\n\ncreateSortable(hasPinnedItems, pinnedContainerRef, pinnedItemsRef, () => 0);\ncreateSortable(hasUnpinnedItems, unpinnedContainerRef, unpinnedItemsRef, () => pinnedItemsRef.value.length);\n\nfunction createSortable(toggler: ShallowRef<boolean>, elRef: ShallowRef<undefined | HTMLElement>, itemsRef: ShallowRef<T[]>, getOffset: () => number) {\n const sortable = useSortable(elRef, itemsRef, {\n handle: `[data-draggable=\"true\"]`,\n animation: 150,\n forceFallback: true,\n fallbackOnBody: true,\n scrollSensitivity: 80,\n forceAutoScrollFallback: true,\n onUpdate: (evt: SortableEvent) => {\n if (evt.oldIndex == null || evt.newIndex == null) {\n throw new Error('Sortable event has no index');\n }\n if (props.onDragEnd?.(evt.oldIndex, evt.newIndex) !== false) {\n moveItems(getOffset() + evt.oldIndex, getOffset() + evt.newIndex, true);\n }\n },\n });\n watch(toggler, (on) => on ? sortable.start() : sortable.stop());\n\n return sortable;\n}\n\nfunction moveItems(oldIndex: number, newIndex: number, afterUpdateDom: boolean) {\n if (oldIndex === newIndex) return;\n\n if (afterUpdateDom) {\n domProjectionItemsRef.value = moveElements(itemsRef.value.slice(), oldIndex, newIndex);\n }\n\n const preventDefault = props.onSort?.(oldIndex, newIndex) === false;\n\n if (!preventDefault) {\n moveElements(itemsRef.value, oldIndex, newIndex);\n optionalUpdateRef(itemsRef);\n }\n}\n\nfunction isActive(item: T): boolean {\n return props.activeItems?.has(item) ?? false;\n}\n\nfunction isDraggable(item: T): boolean {\n if (props.enableDragging === false) return false;\n return (draggableSetRef.value?.has(item) ?? true);\n}\n\nfunction isToggable(item: T): boolean {\n if (props.enableToggling === false) return false;\n return !isNil(toggledSetRef.value) && (toggableSetRef.value?.has(item) ?? true);\n}\n\nfunction isToggled(item: T): boolean {\n return toggledSetRef.value?.has(item) ?? false;\n}\n\nfunction isPinnable(item: T): boolean {\n if (props.enablePinning === false) return false;\n return !isNil(pinnedSetRef.value) && (pinnableSetRef.value?.has(item) ?? true);\n}\n\nfunction isPinned(item: T): boolean {\n return pinnedSetRef.value?.has(item) ?? false;\n}\n\nfunction isExpandable(item: T): boolean {\n if (props.enableExpanding === false) return false;\n return !isNil(expandedSetRef.value) && (expandableSetRef.value?.has(item) ?? true);\n}\n\nfunction isExpanded(item: T): boolean {\n return expandedSetRef.value?.has(item) ?? false;\n}\n\nfunction isRemovable(item: T): boolean {\n if (props.enableRemoving === false) return false;\n if (removableSetRef.value?.has(item) === false) return false;\n return props.enableRemoving === true || typeof props.onRemove === 'function';\n}\n\nfunction handleExpand(item: T, index: number) {\n if (props.onExpand?.(item, index) === false || isNil(expandedSetRef.value)) return;\n\n const expanded = expandedSetRef.value;\n if (expanded.has(item)) expanded.delete(item);\n else expanded.add(item);\n optionalUpdateRef(expandedSetRef);\n}\n\nfunction handleToggle(item: T, index: number) {\n if (props.onToggle?.(item, index) === false || isNil(toggledSetRef.value)) return;\n\n const toggled = toggledSetRef.value;\n if (toggled.has(item)) toggled.delete(item);\n else toggled.add(item);\n optionalUpdateRef(toggledSetRef);\n}\n\nfunction handlePin(item: T, oldIndex: number) {\n if (oldIndex === -1) {\n throw new Error('Pinnable item not found');\n }\n\n if (props.onPin?.(item, oldIndex) === false || isNil(pinnedSetRef.value)) return;\n\n const pinned = pinnedSetRef.value;\n const alreadyPinned = pinned.has(item);\n if (alreadyPinned) pinned.delete(item);\n else pinned.add(item);\n optionalUpdateRef(pinnedSetRef);\n moveItems(oldIndex, pinned.size + (alreadyPinned ? 0 : -1), false);\n}\n\nfunction handleRemove(item: T, index: number) {\n if (props.onRemove?.(item, index) !== false) {\n itemsRef.value.splice(index, 1);\n optionalUpdateRef(itemsRef);\n\n if (pinnedSetRef.value?.has(item)) {\n pinnedSetRef.value.delete(item);\n optionalUpdateRef(pinnedSetRef);\n }\n\n if (toggledSetRef.value?.has(item)) {\n toggledSetRef.value.delete(item);\n optionalUpdateRef(toggledSetRef);\n }\n }\n}\n\n// version fix problem with sync between data and rendered values\nconst getKey = (item: T, index: number) => {\n if (isNil(props.getItemKey)) return `${versionRef.value}-${index}`;\n return `${versionRef.value}-${props.getItemKey(item)}`;\n};\nconst pinnedKeysRef = computed(() => pinnedItemsRef.value.map(getKey));\nconst unpinnedKeysRef = computed(() => unpinnedItemsRef.value.map(getKey));\n\nconst getItemClass = (item: T, index: number): null | string | string[] => {\n if (typeof props.itemClass === 'function') {\n return props.itemClass(item, index);\n }\n return props.itemClass ?? null;\n};\n\n</script>\n\n<template>\n <div :class=\"$style.root\">\n <div ref=\"pinnedContainerRef\" :class=\"$style.list\">\n <PlElementListItem\n v-for=\"(pinnedItem, pinnedIndex) in pinnedItemsRef\" :key=\"pinnedKeysRef[pinnedIndex]\"\n :class=\"[$style.item, getItemClass(pinnedItem, pinnedIndex)]\"\n\n :index=\"pinnedIndex\"\n :item=\"pinnedItem\"\n :showDragHandle=\"dndSortingEnabled\"\n :isActive=\"isActive(pinnedItem)\"\n :isDraggable=\"isDraggable(pinnedItem)\"\n :isRemovable=\"isRemovable(pinnedItem)\"\n :isToggable=\"isToggable(pinnedItem)\"\n :isToggled=\"isToggled(pinnedItem)\"\n :isPinnable=\"isPinnable(pinnedItem)\"\n :isPinned=\"isPinned(pinnedItem)\"\n :isExpandable=\"isExpandable(pinnedItem)\"\n :isExpanded=\"isExpanded(pinnedItem)\"\n\n @click=\"emits('itemClick', pinnedItem)\"\n @remove=\"handleRemove\"\n @toggle=\"handleToggle\"\n @pin=\"handlePin\"\n @expand=\"handleExpand\"\n >\n <template #title=\"{ item, index }\">\n <slot :index=\"index\" :item=\"item\" name=\"item-title\" />\n </template>\n <template v-if=\"slots['item-content']\" #content=\"{ item, index }\">\n <slot :index=\"index\" :item=\"item\" name=\"item-content\" />\n </template>\n </PlElementListItem>\n </div>\n <div v-if=\"hasUnpinnedItems\" ref=\"unpinnedContainerRef\" :class=\"$style.list\">\n <PlElementListItem\n v-for=\"(unpinnedItem, unpinnedIndex) in unpinnedItemsRef\" :key=\"unpinnedKeysRef[unpinnedIndex]\"\n :class=\"[$style.item, getItemClass(unpinnedItem, unpinnedIndex)]\"\n\n :index=\"unpinnedIndex + (pinnedSetRef?.size ?? 0)\"\n :item=\"unpinnedItem\"\n :showDragHandle=\"dndSortingEnabled\"\n :isActive=\"isActive(unpinnedItem)\"\n :isDraggable=\"isDraggable(unpinnedItem)\"\n :isRemovable=\"isRemovable(unpinnedItem)\"\n :isToggable=\"isToggable(unpinnedItem)\"\n :isToggled=\"isToggled(unpinnedItem)\"\n :isPinnable=\"isPinnable(unpinnedItem)\"\n :isPinned=\"isPinned(unpinnedItem)\"\n :isExpandable=\"isExpandable(unpinnedItem)\"\n :isExpanded=\"isExpanded(unpinnedItem)\"\n\n @click=\"emits('itemClick', unpinnedItem)\"\n @remove=\"handleRemove\"\n @toggle=\"handleToggle\"\n @pin=\"handlePin\"\n @expand=\"handleExpand\"\n >\n <template #title=\"{ item, index }\">\n <slot :index=\"index\" :item=\"item\" name=\"item-title\" />\n </template>\n <template v-if=\"slots['item-content']\" #content=\"{ item, index }\">\n <slot :index=\"index\" :item=\"item\" name=\"item-content\" />\n </template>\n </PlElementListItem>\n </div>\n </div>\n</template>\n\n<style module>\n.root, .list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n min-width: 180px;\n}\n\n.item {\n width: 100%;\n}\n\n:global(.sortable-ghost) {\n visibility: hidden;\n}\n:global(.sortable-drag) {\n opacity: 1;\n}\n</style>\n"],"names":["itemsRef","_useModel","__props","draggableSetRef","removableSetRef","expandableSetRef","expandedSetRef","pinnableSetRef","pinnedSetRef","toggableSetRef","toggledSetRef","props","emits","__emit","slots","_useSlots","dndSortingEnabled","computed","isNil","pinnedItemsRef","isPinned","hasPinnedItems","unpinnedItemsRef","item","hasUnpinnedItems","domProjectionItemsRef","shallowRef","pinnedContainerRef","unpinnedContainerRef","versionRef","oldVersion","currentVersion","shallowHash","lastSortedVersion","createSortable","toggler","elRef","getOffset","sortable","useSortable","evt","_a","moveItems","watch","on","oldIndex","newIndex","afterUpdateDom","moveElements","optionalUpdateRef","isActive","isDraggable","isToggable","isToggled","isPinnable","isExpandable","isExpanded","isRemovable","handleExpand","index","expanded","handleToggle","toggled","handlePin","pinned","alreadyPinned","handleRemove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C,OACbb,EAAA,MAAM,OAAOa,CAAI,GAC/B0B,EAAkBvC,CAAa;AAAA,IAEnC;AAII,UAAA2D,IAAS,CAAC9C,GAASoC,MACnBzC,EAAMP,EAAM,UAAU,IAAU,GAAGkB,EAAW,KAAK,IAAI8B,CAAK,KACzD,GAAG9B,EAAW,KAAK,IAAIlB,EAAM,WAAWY,CAAI,CAAC,IAEhD+C,KAAgBrD,EAAS,MAAME,EAAe,MAAM,IAAIkD,CAAM,CAAC,GAC/DE,KAAkBtD,EAAS,MAAMK,EAAiB,MAAM,IAAI+C,CAAM,CAAC,GAEnEG,IAAe,CAACjD,GAASoC,MACzB,OAAOhD,EAAM,aAAc,aACtBA,EAAM,UAAUY,GAAMoC,CAAK,IAE7BhD,EAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._root_1inp1_2,._list_1inp1_2{display:flex;flex-direction:column;gap:8px;min-width:180px}._item_1inp1_9{width:100%}.sortable-ghost{visibility:hidden}.sortable-drag{opacity:1}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
|
|
2
|
+
const t = "_root_1inp1_2", o = "_list_1inp1_2", i = "_item_1inp1_9", s = {
|
|
3
|
+
root: t,
|
|
4
|
+
list: o,
|
|
5
|
+
item: i
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
s as default,
|
|
9
|
+
i as item,
|
|
10
|
+
o as list,
|
|
11
|
+
t as root
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=PlElementList.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlElementList.vue3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare const _default: <T extends unknown = unknown>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
3
|
+
readonly onToggle?: ((item: T, index: number) => any) | undefined;
|
|
4
|
+
readonly onPin?: ((item: T, index: number) => any) | undefined;
|
|
5
|
+
readonly onExpand?: ((item: T, index: number) => any) | undefined;
|
|
6
|
+
readonly onRemove?: ((item: T, index: number) => any) | undefined;
|
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onToggle" | "onPin" | "onExpand" | "onRemove"> & {
|
|
8
|
+
item: T;
|
|
9
|
+
index: number;
|
|
10
|
+
showDragHandle: boolean;
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
isDraggable: boolean;
|
|
13
|
+
isRemovable: boolean;
|
|
14
|
+
isExpandable: boolean;
|
|
15
|
+
isExpanded: boolean;
|
|
16
|
+
isToggable: boolean;
|
|
17
|
+
isToggled: boolean;
|
|
18
|
+
isPinnable: boolean;
|
|
19
|
+
isPinned: boolean;
|
|
20
|
+
} & Partial<{}>> & import('vue').PublicProps;
|
|
21
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
22
|
+
attrs: any;
|
|
23
|
+
slots: Readonly<{
|
|
24
|
+
title: (props: {
|
|
25
|
+
item: T;
|
|
26
|
+
index: number;
|
|
27
|
+
}) => unknown;
|
|
28
|
+
content?: (props: {
|
|
29
|
+
item: T;
|
|
30
|
+
index: number;
|
|
31
|
+
}) => unknown;
|
|
32
|
+
}> & {
|
|
33
|
+
title: (props: {
|
|
34
|
+
item: T;
|
|
35
|
+
index: number;
|
|
36
|
+
}) => unknown;
|
|
37
|
+
content?: (props: {
|
|
38
|
+
item: T;
|
|
39
|
+
index: number;
|
|
40
|
+
}) => unknown;
|
|
41
|
+
};
|
|
42
|
+
emit: {
|
|
43
|
+
(e: "expand", item: T, index: number): void;
|
|
44
|
+
(e: "toggle", item: T, index: number): void;
|
|
45
|
+
(e: "pin", item: T, index: number): void;
|
|
46
|
+
(e: "remove", item: T, index: number): void;
|
|
47
|
+
};
|
|
48
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}> & {
|
|
51
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
52
|
+
};
|
|
53
|
+
export default _default;
|
|
54
|
+
type __VLS_PrettifyLocal<T> = {
|
|
55
|
+
[K in keyof T]: T[K];
|
|
56
|
+
} & {};
|
|
57
|
+
//# sourceMappingURL=PlElementListItem.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlElementListItem.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PlElementList/PlElementListItem.vue"],"names":[],"mappings":"yBAqPiB,CAAC,SAAS,OAAO,yBACpB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA0M1D,mBAAmB,CAAC;;;;;;cAvMpB,CAAC;eACA,MAAM;wBACG,OAAO;kBACb,OAAO;qBACJ,OAAO;qBACP,OAAO;sBACN,OAAO;oBACT,OAAO;oBACP,OAAO;mBACR,OAAO;oBACN,OAAO;kBACT,OAAO;mBA4L2E,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;eAzLF,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;kBAC3C,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;eADjD,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;kBAC3C,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;;YAKpD,QAAQ,QAAQ,CAAC,SAAS,MAAM,GAAG,IAAI;YACvC,QAAQ,QAAQ,CAAC,SAAS,MAAM,GAAG,IAAI;YACvC,KAAK,QAAQ,CAAC,SAAS,MAAM,GAAG,IAAI;YACpC,QAAQ,QAAQ,CAAC,SAAS,MAAM,GAAG,IAAI;;;;;YAqLD,OAAO,CAAC,OAAO,WAAW,CAAC;;AApNvE,wBAoN4E;AA0B5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import s from "./PlElementListItem.vue2.js";
|
|
2
|
+
import t from "./PlElementListItem.vue3.js";
|
|
3
|
+
import o from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const e = {
|
|
5
|
+
$style: t
|
|
6
|
+
}, c = /* @__PURE__ */ o(s, [["__cssModules", e]]);
|
|
7
|
+
export {
|
|
8
|
+
c as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=PlElementListItem.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlElementListItem.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { defineComponent as B, useSlots as C, computed as E, createElementBlock as o, openBlock as n, normalizeClass as l, createElementVNode as m, createCommentVNode as t, createBlock as P, createVNode as r, unref as a, renderSlot as v, withModifiers as p } from "vue";
|
|
2
|
+
import g from "../PlIcon16/PlIcon16.vue.js";
|
|
3
|
+
import b from "../PlIcon24/PlIcon24.vue.js";
|
|
4
|
+
const f = ["data-draggable"], h = /* @__PURE__ */ B({
|
|
5
|
+
__name: "PlElementListItem",
|
|
6
|
+
props: {
|
|
7
|
+
item: {},
|
|
8
|
+
index: {},
|
|
9
|
+
showDragHandle: { type: Boolean },
|
|
10
|
+
isActive: { type: Boolean },
|
|
11
|
+
isDraggable: { type: Boolean },
|
|
12
|
+
isRemovable: { type: Boolean },
|
|
13
|
+
isExpandable: { type: Boolean },
|
|
14
|
+
isExpanded: { type: Boolean },
|
|
15
|
+
isToggable: { type: Boolean },
|
|
16
|
+
isToggled: { type: Boolean },
|
|
17
|
+
isPinnable: { type: Boolean },
|
|
18
|
+
isPinned: { type: Boolean }
|
|
19
|
+
},
|
|
20
|
+
emits: ["expand", "toggle", "pin", "remove"],
|
|
21
|
+
setup(k, { emit: u }) {
|
|
22
|
+
const s = k, c = C(), $ = E(() => c.content !== void 0), d = u;
|
|
23
|
+
return (e, i) => (n(), o("div", {
|
|
24
|
+
class: l([e.$style.root, {
|
|
25
|
+
[e.$style.active]: s.isActive,
|
|
26
|
+
[e.$style.pinned]: s.isPinned,
|
|
27
|
+
[e.$style.disabled]: s.isToggled
|
|
28
|
+
}])
|
|
29
|
+
}, [
|
|
30
|
+
m("div", {
|
|
31
|
+
class: l([e.$style.head, {
|
|
32
|
+
[e.$style.clickable]: $.value
|
|
33
|
+
}]),
|
|
34
|
+
onClick: i[3] || (i[3] = (y) => e.isExpandable && d("expand", s.item, s.index))
|
|
35
|
+
}, [
|
|
36
|
+
s.showDragHandle ? (n(), o("div", {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: l([e.$style.action, e.$style.draggable, { [e.$style.disable]: !s.isDraggable }]),
|
|
39
|
+
"data-draggable": s.isDraggable
|
|
40
|
+
}, [
|
|
41
|
+
r(a(g), { name: "drag-dots" })
|
|
42
|
+
], 10, f)) : t("", !0),
|
|
43
|
+
e.isExpandable ? (n(), P(a(g), {
|
|
44
|
+
key: 1,
|
|
45
|
+
class: l([e.$style.contentChevron, { [e.$style.opened]: s.isExpanded }]),
|
|
46
|
+
name: "chevron-down"
|
|
47
|
+
}, null, 8, ["class"])) : t("", !0),
|
|
48
|
+
m("div", {
|
|
49
|
+
class: l(e.$style.title)
|
|
50
|
+
}, [
|
|
51
|
+
v(e.$slots, "title", {
|
|
52
|
+
item: s.item,
|
|
53
|
+
index: s.index
|
|
54
|
+
})
|
|
55
|
+
], 2),
|
|
56
|
+
m("div", {
|
|
57
|
+
class: l([e.$style.actions, e.$style.showOnHover])
|
|
58
|
+
}, [
|
|
59
|
+
s.isToggable ? (n(), o("div", {
|
|
60
|
+
key: 0,
|
|
61
|
+
class: l([e.$style.action, e.$style.clickable, { [e.$style.disable]: !s.isToggable }]),
|
|
62
|
+
onClick: i[0] || (i[0] = p((y) => d("toggle", s.item, s.index), ["stop"]))
|
|
63
|
+
}, [
|
|
64
|
+
r(a(b), {
|
|
65
|
+
name: s.isToggled === !0 ? "view-hide" : "view-show",
|
|
66
|
+
size: "16"
|
|
67
|
+
}, null, 8, ["name"])
|
|
68
|
+
], 2)) : t("", !0),
|
|
69
|
+
s.isPinnable ? (n(), o("div", {
|
|
70
|
+
key: 1,
|
|
71
|
+
class: l([e.$style.action, e.$style.clickable, {
|
|
72
|
+
[e.$style.disable]: !s.isPinnable,
|
|
73
|
+
[e.$style.activated]: s.isPinned
|
|
74
|
+
}]),
|
|
75
|
+
onClick: i[1] || (i[1] = p((y) => d("pin", s.item, s.index), ["stop"]))
|
|
76
|
+
}, [
|
|
77
|
+
r(a(b), {
|
|
78
|
+
name: "pin",
|
|
79
|
+
size: "16"
|
|
80
|
+
})
|
|
81
|
+
], 2)) : t("", !0),
|
|
82
|
+
s.isRemovable ? (n(), o("div", {
|
|
83
|
+
key: 2,
|
|
84
|
+
class: l([e.$style.action, e.$style.clickable]),
|
|
85
|
+
onClick: i[2] || (i[2] = p((y) => d("remove", s.item, s.index), ["stop"]))
|
|
86
|
+
}, [
|
|
87
|
+
r(a(g), { name: "close" })
|
|
88
|
+
], 2)) : t("", !0)
|
|
89
|
+
], 2)
|
|
90
|
+
], 2),
|
|
91
|
+
$.value && s.isExpanded ? (n(), o("div", {
|
|
92
|
+
key: 0,
|
|
93
|
+
class: l(e.$style.body)
|
|
94
|
+
}, [
|
|
95
|
+
v(e.$slots, "content", {
|
|
96
|
+
item: s.item,
|
|
97
|
+
index: s.index
|
|
98
|
+
})
|
|
99
|
+
], 2)) : t("", !0)
|
|
100
|
+
], 2));
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
export {
|
|
104
|
+
h as default
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=PlElementListItem.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlElementListItem.vue2.js","sources":["../../../src/components/PlElementList/PlElementListItem.vue"],"sourcesContent":["<script generic=\"T extends unknown = unknown\" lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlIcon24 } from '../PlIcon24';\n\nconst props = defineProps<{\n item: T;\n index: number;\n showDragHandle: boolean;\n isActive: boolean;\n isDraggable: boolean;\n isRemovable: boolean;\n isExpandable: boolean;\n isExpanded: boolean;\n isToggable: boolean;\n isToggled: boolean;\n isPinnable: boolean;\n isPinned: boolean;\n}>();\n\nconst slots = defineSlots<{\n title: (props: { item: T; index: number }) => unknown;\n content?: (props: { item: T; index: number }) => unknown;\n}>();\nconst hasContentSlot = computed(() => slots['content'] !== undefined);\n\nconst emit = defineEmits<{\n (e: 'expand', item: T, index: number): void;\n (e: 'toggle', item: T, index: number): void;\n (e: 'pin', item: T, index: number): void;\n (e: 'remove', item: T, index: number): void;\n}>();\n</script>\n\n<template>\n <div\n :class=\"[$style.root, {\n [$style.active]: props.isActive,\n [$style.pinned]: props.isPinned,\n [$style.disabled]: props.isToggled,\n }]\"\n >\n <div\n :class=\"[$style.head, {\n [$style.clickable]: hasContentSlot,\n }]\"\n @click=\"isExpandable && emit('expand', props.item, props.index)\"\n >\n <div\n v-if=\"props.showDragHandle\"\n :class=\"[$style.action, $style.draggable, { [$style.disable]: !props.isDraggable } ]\"\n :data-draggable=\"props.isDraggable\"\n >\n <PlIcon16 name=\"drag-dots\" />\n </div>\n <PlIcon16 v-if=\"isExpandable\" :class=\"[$style.contentChevron, { [$style.opened]: props.isExpanded }]\" name=\"chevron-down\" />\n\n <div :class=\"$style.title\">\n <slot name=\"title\" :item=\"props.item\" :index=\"props.index\" />\n </div>\n\n <div :class=\"[$style.actions, $style.showOnHover]\">\n <div\n v-if=\"props.isToggable\"\n :class=\"[$style.action, $style.clickable, { [$style.disable]: !props.isToggable }]\"\n @click.stop=\"emit('toggle', props.item, props.index)\"\n >\n <PlIcon24 :name=\"props.isToggled === true ? 'view-hide' : 'view-show'\" size=\"16\" />\n </div>\n <div\n v-if=\"props.isPinnable\"\n :class=\"[$style.action, $style.clickable, {\n [$style.disable]: !props.isPinnable,\n [$style.activated]: props.isPinned,\n }]\"\n @click.stop=\"emit('pin', props.item, props.index)\"\n >\n <PlIcon24 name=\"pin\" size=\"16\" />\n </div>\n <div\n v-if=\"props.isRemovable\"\n :class=\"[$style.action, $style.clickable]\"\n @click.stop=\"emit('remove', props.item, props.index)\"\n >\n <PlIcon16 name=\"close\" />\n </div>\n </div>\n </div>\n <div v-if=\"hasContentSlot && props.isExpanded\" :class=\"$style.body\">\n <slot name=\"content\" :item=\"props.item\" :index=\"props.index\" />\n </div>\n </div>\n</template>\n\n<style module>\n@use '../../assets/variables.scss' as *;\n\n.root {\n --background: rgba(255, 255, 255, 0.8);\n --border-color: var(--color-div-grey);\n --head-background: unset;\n --box-shadow: none;\n --box-shadow-active: 0 0 0 4px color-mix(in srgb, var(--border-color-focus) 50%, transparent);\n\n &:global(.sortable-drag),\n &:global(.sortable-chosen) {\n --head-background: var(--gradient-light-lime);\n --border-color: var(--border-color-focus);\n --box-shadow: var(--box-shadow-active)\n }\n}\n.root {\n display: flex;\n flex-direction: column;\n justify-content: center;\n border-radius: var(--border-radius);\n border: 1px solid var(--border-color);\n background-color: var(--background);\n transition: box-shadow 0.15s;\n box-shadow: var(--box-shadow);;\n overflow: hidden;\n\n &:hover {\n --border-color: var(--border-color-focus);\n }\n\n &.disabled {\n opacity: 0.6;\n filter: grayscale(1);\n }\n\n &.pinned {\n --background: var(--bg-base-light);\n }\n\n &.active {\n --border-color: var(--border-color-focus);\n --head-background: var(--btn-accent-positive-500);\n }\n}\n\n.head {\n position: relative;\n display: flex;\n align-items: center;\n padding: 8px;\n border-radius: var(--border-radius) var(--border-radius) 0 0;\n background: var(--head-background);\n\n &:hover, &.opened {\n --head-background: var(--gradient-light-lime);\n }\n}\n\n.contentChevron {\n display: block;\n width: 16px;\n height: 16px;\n margin-right: 4px;\n transform: rotate(-90deg);\n transition: transform 0.15s;\n\n &.opened {\n transform: rotate(0deg);\n }\n}\n\n.title {\n display: flex;\n flex-direction: row;\n gap: 8px;\n max-width: calc(100% - 50px);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.body {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 24px;\n border-radius: 0 0 var(--border-radius) var(--border-radius);\n}\n\n.actions {\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n background-color: var(--background);\n border-radius: var(--border-radius);\n}\n\n.action {\n width: 24px;\n height: 24px;\n padding: 4px; /* use padding instead of gap on parent, for better accessibility */\n opacity: 0.6;\n border-radius: var(--border-radius);\n transition: all 0.15s;\n\n svg {\n width: 16px;\n height: 16px;\n }\n\n &:hover {\n opacity: 1;\n background-color: var(--bg-elevated-02);\n }\n\n &.activated {\n opacity: 0.8;\n }\n\n &.disable {\n cursor: not-allowed;\n opacity: 0.4;\n }\n}\n\n.clickable {\n cursor: pointer;\n}\n\n.draggable {\n cursor: grab;\n}\n\n.showOnHover {\n opacity: 0;\n transition: opacity 0.15s;\n}\n\n.root:hover .showOnHover {\n opacity: 1;\n}\n</style>\n"],"names":["props","__props","slots","_useSlots","hasContentSlot","computed","emit","__emit"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,UAAMA,IAAQC,GAeRC,IAAQC,EAGV,GACEC,IAAiBC,EAAS,MAAMH,EAAM,YAAe,MAAS,GAE9DI,IAAOC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|