@xwiki/cristal-dsvuetify 0.25.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-D7wZ4Kvq.js → index-CkeFEgm6.js} +8741 -8708
- package/dist/index-CkeFEgm6.js.map +1 -0
- package/dist/index.es.js +6 -8
- package/dist/index.umd.js +12 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/translations-CXVK8zyA.js +21 -0
- package/dist/{translations-BVK9UR9x.js.map → translations-CXVK8zyA.js.map} +1 -1
- package/dist/vue/form/x-text-field.vue.d.ts +16 -1
- package/dist/vue/x-tree.vue.d.ts +19 -14
- package/dist/{x-checkbox-CN6QxF3B.js → x-checkbox-CxPnLGd0.js} +5 -5
- package/dist/{x-checkbox-CN6QxF3B.js.map → x-checkbox-CxPnLGd0.js.map} +1 -1
- package/dist/{x-file-input-CkjbGsMG.js → x-file-input-CEz4Wmf4.js} +3 -3
- package/dist/{x-file-input-CkjbGsMG.js.map → x-file-input-CEz4Wmf4.js.map} +1 -1
- package/dist/{x-form-dk8EltHS.js → x-form-SvpVocOb.js} +2 -2
- package/dist/{x-form-dk8EltHS.js.map → x-form-SvpVocOb.js.map} +1 -1
- package/dist/x-menu-DUp-JvdG.js +31 -0
- package/dist/{x-menu-CZMwPcag.js.map → x-menu-DUp-JvdG.js.map} +1 -1
- package/dist/{x-select-CpWujZTj.js → x-select-BduzHCet.js} +6 -6
- package/dist/{x-select-CpWujZTj.js.map → x-select-BduzHCet.js.map} +1 -1
- package/dist/x-text-field-CvC6id2f.js +50 -0
- package/dist/{x-text-field-wiH4MWRR.js.map → x-text-field-CvC6id2f.js.map} +1 -1
- package/dist/x-tree-CbliYwVw.js +70 -0
- package/dist/x-tree-CbliYwVw.js.map +1 -0
- package/langs/translation-de.json +1 -3
- package/langs/translation-en.json +1 -3
- package/langs/translation-fr.json +1 -3
- package/package.json +15 -15
- package/src/components/vuetifyDesignSystemLoader.ts +0 -10
- package/src/vue/css/style.css +1 -0
- package/src/vue/form/x-text-field.vue +5 -1
- package/src/vue/x-menu.vue +1 -1
- package/src/vue/x-tree.vue +24 -5
- package/dist/index-D7wZ4Kvq.js.map +0 -1
- package/dist/index.es-BOA77_Kh.js +0 -10
- package/dist/index.es-BOA77_Kh.js.map +0 -1
- package/dist/translations-BVK9UR9x.js +0 -27
- package/dist/vue/form/x-navigation-tree-select.vue.d.ts +0 -14
- package/dist/vue/x-navigation-tree.vue.d.ts +0 -5
- package/dist/x-menu-CZMwPcag.js +0 -31
- package/dist/x-navigation-tree-BkJKd5J2.js +0 -188
- package/dist/x-navigation-tree-BkJKd5J2.js.map +0 -1
- package/dist/x-navigation-tree-select-VRsQSFA3.js +0 -109
- package/dist/x-navigation-tree-select-VRsQSFA3.js.map +0 -1
- package/dist/x-text-field-wiH4MWRR.js +0 -45
- package/dist/x-tree-CkUElkU9.js +0 -51
- package/dist/x-tree-CkUElkU9.js.map +0 -1
- package/src/vue/form/x-navigation-tree-select.vue +0 -146
- package/src/vue/x-navigation-tree.vue +0 -355
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.es-BOA77_Kh.js","sources":["../../../node_modules/.pnpm/@xwiki+platform-dsapi@18.0.0-1766398944_inversify@7.10.6_reflect-metadata@0.2.2__reflec_1f17bdfc3f0a2b100c60245ef706fddd/node_modules/@xwiki/platform-dsapi/dist/index.es.js"],"sourcesContent":["const e = {\n includeTerminals: !0\n}, n = {\n includeTerminals: !1\n};\nexport {\n e as navigationTreePropsDefaults,\n n as navigationTreeSelectPropsDefaults\n};\n//# sourceMappingURL=index.es.js.map\n"],"names":[],"mappings":"AAAK,MAAC,IAAI;AAAA,EACR,kBAAkB;AACpB,GAAG,IAAI;AAAA,EACL,kBAAkB;AACpB;","x_google_ignoreList":[0]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const e = {
|
|
2
|
-
"vuetify.file.input.mandatory": "Pflichtfeld",
|
|
3
|
-
"vuetify.select.input.mandatory": "Pflichtfeld",
|
|
4
|
-
"vuetify.text.input.mandatory": "Pflichtfeld",
|
|
5
|
-
"vuetify.tree.select.location.label": "Speicherort der Seite ändern",
|
|
6
|
-
"vuetify.tree.select.location.select": "Auswählen"
|
|
7
|
-
}, t = {
|
|
8
|
-
"vuetify.file.input.mandatory": "Mandatory field",
|
|
9
|
-
"vuetify.select.input.mandatory": "Mandatory field",
|
|
10
|
-
"vuetify.text.input.mandatory": "Mandatory field",
|
|
11
|
-
"vuetify.tree.select.location.label": "Change Page Location",
|
|
12
|
-
"vuetify.tree.select.location.select": "Select"
|
|
13
|
-
}, i = {
|
|
14
|
-
"vuetify.file.input.mandatory": "Champ obligatoire",
|
|
15
|
-
"vuetify.select.input.mandatory": "Champ obligatoire",
|
|
16
|
-
"vuetify.text.input.mandatory": "Champ obligatoire",
|
|
17
|
-
"vuetify.tree.select.location.label": "Changer l'emplacement de la page",
|
|
18
|
-
"vuetify.tree.select.location.select": "Sélectionner"
|
|
19
|
-
}, a = {
|
|
20
|
-
en: t,
|
|
21
|
-
fr: i,
|
|
22
|
-
de: e
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
a as t
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=translations-BVK9UR9x.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SpaceReference, DocumentReference } from '@xwiki/platform-model-api';
|
|
2
|
-
import { NavigationTreeSelectProps } from '@xwiki/platform-dsapi';
|
|
3
|
-
type __VLS_Props = NavigationTreeSelectProps;
|
|
4
|
-
type __VLS_PublicProps = {
|
|
5
|
-
modelValue?: SpaceReference | DocumentReference;
|
|
6
|
-
} & __VLS_Props;
|
|
7
|
-
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
8
|
-
"update:modelValue": (value: SpaceReference | DocumentReference) => any;
|
|
9
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
10
|
-
"onUpdate:modelValue"?: ((value: SpaceReference | DocumentReference) => any) | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
includeTerminals: boolean;
|
|
13
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
-
export default _default;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { NavigationTreeProps } from '@xwiki/platform-dsapi';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<NavigationTreeProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NavigationTreeProps> & Readonly<{}>, {
|
|
3
|
-
includeTerminals: boolean;
|
|
4
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
|
-
export default _default;
|
package/dist/x-menu-CZMwPcag.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { resolveComponent as o, createBlock as s, openBlock as l, withCtx as e, createVNode as d, renderSlot as n, createElementVNode as i, normalizeProps as _, guardReactiveProps as u } from "vue";
|
|
2
|
-
import { _ as f } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
3
|
-
const p = {};
|
|
4
|
-
function m(t, v) {
|
|
5
|
-
const r = o("v-list"), a = o("v-menu");
|
|
6
|
-
return l(), s(a, {
|
|
7
|
-
"close-on-content-click": !1,
|
|
8
|
-
attach: "#xwCristalApp",
|
|
9
|
-
"z-index": "initial"
|
|
10
|
-
}, {
|
|
11
|
-
activator: e(({ props: c }) => [
|
|
12
|
-
i("span", _(u(c)), [
|
|
13
|
-
n(t.$slots, "activator", {}, void 0, !0)
|
|
14
|
-
], 16)
|
|
15
|
-
]),
|
|
16
|
-
default: e(() => [
|
|
17
|
-
d(r, null, {
|
|
18
|
-
default: e(() => [
|
|
19
|
-
n(t.$slots, "default", {}, void 0, !0)
|
|
20
|
-
]),
|
|
21
|
-
_: 3
|
|
22
|
-
})
|
|
23
|
-
]),
|
|
24
|
-
_: 3
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const k = /* @__PURE__ */ f(p, [["render", m], ["__scopeId", "data-v-dd1f30d6"]]);
|
|
28
|
-
export {
|
|
29
|
-
k as default
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=x-menu-CZMwPcag.js.map
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { defineComponent as b, mergeDefaults as S, inject as A, ref as m, onBeforeMount as B, watch as E, createBlock as F, openBlock as _, unref as L, withCtx as U, createElementBlock as P, withModifiers as M, toDisplayString as I } from "vue";
|
|
2
|
-
import { e as j } from "./index.es-BOA77_Kh.js";
|
|
3
|
-
import { SpaceReference as z } from "@xwiki/platform-model-api";
|
|
4
|
-
import { c as V } from "./index-D7wZ4Kvq.js";
|
|
5
|
-
import { _ as $ } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
-
const q = ["href", "onClick"], G = ["href"], H = /* @__PURE__ */ b({
|
|
7
|
-
__name: "x-navigation-tree",
|
|
8
|
-
props: /* @__PURE__ */ S({
|
|
9
|
-
clickAction: { type: Function },
|
|
10
|
-
currentPageReference: {},
|
|
11
|
-
includeTerminals: { type: Boolean },
|
|
12
|
-
showRootNode: { type: Boolean }
|
|
13
|
-
}, j),
|
|
14
|
-
setup(g) {
|
|
15
|
-
const w = A("cristal"), N = w.getContainer().get("DocumentService"), d = w.getContainer().get("NavigationTreeSourceProvider").get(), l = m([]), c = m(new Array()), f = m([]);
|
|
16
|
-
var h = !1;
|
|
17
|
-
const i = g;
|
|
18
|
-
B(async () => {
|
|
19
|
-
const r = [];
|
|
20
|
-
for (const n of await u(""))
|
|
21
|
-
r.push({
|
|
22
|
-
id: n.id,
|
|
23
|
-
title: n.label,
|
|
24
|
-
href: n.url,
|
|
25
|
-
children: n.has_children ? [] : void 0,
|
|
26
|
-
_location: n.location,
|
|
27
|
-
_is_terminal: n.is_terminal
|
|
28
|
-
});
|
|
29
|
-
i.showRootNode ? l.value.push({
|
|
30
|
-
id: "",
|
|
31
|
-
title: "Root",
|
|
32
|
-
href: ".",
|
|
33
|
-
children: r,
|
|
34
|
-
_location: new z(),
|
|
35
|
-
_is_terminal: !1
|
|
36
|
-
}) : l.value.push(...r), await y(), N.registerDocumentChangeListener("delete", x), N.registerDocumentChangeListener("update", T);
|
|
37
|
-
}), E(() => i.currentPageReference, y);
|
|
38
|
-
async function y() {
|
|
39
|
-
if (i.currentPageReference && !h) {
|
|
40
|
-
h = !0;
|
|
41
|
-
const r = d.getParentNodesId(
|
|
42
|
-
i.currentPageReference,
|
|
43
|
-
i.includeTerminals,
|
|
44
|
-
i.showRootNode
|
|
45
|
-
);
|
|
46
|
-
let n, t = l.value;
|
|
47
|
-
for (n = 0; n < r.length - 1; n++)
|
|
48
|
-
if (t)
|
|
49
|
-
for (const e of t)
|
|
50
|
-
e.id == r[n] && (e.children?.length == 0 && await k(e), f.value.includes(e.id) || f.value.push(e.id), t = e.children);
|
|
51
|
-
if (t)
|
|
52
|
-
for (const e of t)
|
|
53
|
-
e.id == r[n] && (c.value = [e.id], i.clickAction && i.clickAction({
|
|
54
|
-
id: e.id,
|
|
55
|
-
label: e.title,
|
|
56
|
-
location: e._location,
|
|
57
|
-
url: e.href,
|
|
58
|
-
has_children: e.children !== void 0,
|
|
59
|
-
is_terminal: e._is_terminal
|
|
60
|
-
}));
|
|
61
|
-
h = !1;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function k(r) {
|
|
65
|
-
const n = r, t = await u(n.id);
|
|
66
|
-
for (const e of t)
|
|
67
|
-
n.children?.push({
|
|
68
|
-
id: e.id,
|
|
69
|
-
title: e.label,
|
|
70
|
-
href: e.url,
|
|
71
|
-
children: e.has_children ? [] : void 0,
|
|
72
|
-
_location: e.location,
|
|
73
|
-
_is_terminal: e.is_terminal
|
|
74
|
-
});
|
|
75
|
-
t.length == 0 && (n.children = void 0);
|
|
76
|
-
}
|
|
77
|
-
function C() {
|
|
78
|
-
c.value.length > 1 && c.value.pop();
|
|
79
|
-
}
|
|
80
|
-
async function x(r) {
|
|
81
|
-
const n = d.getParentNodesId(
|
|
82
|
-
r,
|
|
83
|
-
i.includeTerminals,
|
|
84
|
-
i.showRootNode
|
|
85
|
-
);
|
|
86
|
-
let t, e = l.value, s = !1;
|
|
87
|
-
e: for (; e && !s; ) {
|
|
88
|
-
for (const a of e.keys())
|
|
89
|
-
if (e[a].id == n[0])
|
|
90
|
-
if (n.length == 1) {
|
|
91
|
-
e.splice(a, 1), t && e.length == 0 && (t.children = void 0);
|
|
92
|
-
return;
|
|
93
|
-
} else {
|
|
94
|
-
t = e[a], e = t.children, n.shift();
|
|
95
|
-
continue e;
|
|
96
|
-
}
|
|
97
|
-
s = !0;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async function T(r) {
|
|
101
|
-
const n = d.getParentNodesId(
|
|
102
|
-
r,
|
|
103
|
-
i.includeTerminals,
|
|
104
|
-
i.showRootNode
|
|
105
|
-
);
|
|
106
|
-
let t, e = l.value, s = !1, a = !0;
|
|
107
|
-
e: for (; e && !s; ) {
|
|
108
|
-
for (const o of e.keys())
|
|
109
|
-
if (e[o].id == n[0])
|
|
110
|
-
if (n.length == 1) {
|
|
111
|
-
const v = await u(
|
|
112
|
-
t || ""
|
|
113
|
-
);
|
|
114
|
-
for (const R of v)
|
|
115
|
-
if (R.id == e[o].id) {
|
|
116
|
-
e[o].title = R.label;
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
} else {
|
|
120
|
-
t = e[o].id, e[o].children || (e[o].children = []), e = e[o].children, n.shift(), a = !1;
|
|
121
|
-
continue e;
|
|
122
|
-
}
|
|
123
|
-
s = !0;
|
|
124
|
-
}
|
|
125
|
-
if (e.length == 0 && !a)
|
|
126
|
-
return;
|
|
127
|
-
const D = await u(t || ""), p = i.currentPageReference ? d.getParentNodesId(
|
|
128
|
-
i.currentPageReference,
|
|
129
|
-
i.includeTerminals
|
|
130
|
-
) : [];
|
|
131
|
-
e: for (const o of D) {
|
|
132
|
-
for (const v of e.keys())
|
|
133
|
-
if (o.id == e[v].id)
|
|
134
|
-
continue e;
|
|
135
|
-
e.push({
|
|
136
|
-
id: o.id,
|
|
137
|
-
title: o.label,
|
|
138
|
-
href: o.url,
|
|
139
|
-
children: o.has_children ? [] : void 0,
|
|
140
|
-
_location: o.location,
|
|
141
|
-
_is_terminal: o.is_terminal
|
|
142
|
-
}), p.length > 0 && p[p.length - 1] === o.id && (c.value = [o.id]);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async function u(r) {
|
|
146
|
-
return (await d.getChildNodes(r)).filter(
|
|
147
|
-
(n) => i.includeTerminals || !n.is_terminal
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
return (r, n) => (_(), F(L(V), {
|
|
151
|
-
opened: f.value,
|
|
152
|
-
"onUpdate:opened": n[0] || (n[0] = (t) => f.value = t),
|
|
153
|
-
density: "compact",
|
|
154
|
-
activated: c.value,
|
|
155
|
-
items: l.value,
|
|
156
|
-
"load-children": k,
|
|
157
|
-
activatable: "",
|
|
158
|
-
"active-strategy": "independent",
|
|
159
|
-
"item-value": "id",
|
|
160
|
-
"onUpdate:activated": C
|
|
161
|
-
}, {
|
|
162
|
-
title: U(({ item: t }) => [
|
|
163
|
-
i.clickAction ? (_(), P("a", {
|
|
164
|
-
key: 0,
|
|
165
|
-
href: t.href,
|
|
166
|
-
onClick: M((e) => {
|
|
167
|
-
c.value = [t.id], g.clickAction({
|
|
168
|
-
id: t.id,
|
|
169
|
-
label: t.title,
|
|
170
|
-
location: t._location,
|
|
171
|
-
url: t.href,
|
|
172
|
-
has_children: t.children !== void 0,
|
|
173
|
-
is_terminal: t._is_terminal
|
|
174
|
-
});
|
|
175
|
-
}, ["prevent"])
|
|
176
|
-
}, I(t.title), 9, q)) : (_(), P("a", {
|
|
177
|
-
key: 1,
|
|
178
|
-
href: t.href
|
|
179
|
-
}, I(t.title), 9, G))
|
|
180
|
-
]),
|
|
181
|
-
_: 1
|
|
182
|
-
}, 8, ["opened", "activated", "items"]));
|
|
183
|
-
}
|
|
184
|
-
}), X = /* @__PURE__ */ $(H, [["__scopeId", "data-v-9e8c5576"]]);
|
|
185
|
-
export {
|
|
186
|
-
X as default
|
|
187
|
-
};
|
|
188
|
-
//# sourceMappingURL=x-navigation-tree-BkJKd5J2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x-navigation-tree-BkJKd5J2.js","sources":["../src/vue/x-navigation-tree.vue"],"sourcesContent":["<!--\n See the LICENSE file distributed with this work for additional\n information regarding copyright ownership.\n\n This is free software; you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as\n published by the Free Software Foundation; either version 2.1 of\n the License, or (at your option) any later version.\n\n This software is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public\n License along with this software; if not, write to the Free\n Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\n/**\n * Navigation Tree implemented using Vuetify's VTreeView component.\n * In order to use the initial component as a proper Navigation Tree for\n * Cristal, a few changes were made:\n * - The only node activated matches the current page, or the clicked link if\n * the component has a custom clickAction. We want to use actual links so\n * that the user can click them normally (to e.g., open them in a new tab).\n * So the default behavior of activating a node by clicking anywhere on the\n * item was disabled. Default hover effects, such as darkening or changing\n * the cursor on items, were also disabled.\n */\nimport { navigationTreePropsDefaults } from \"@xwiki/platform-dsapi\";\nimport { SpaceReference } from \"@xwiki/platform-model-api\";\nimport { inject, onBeforeMount, ref, watch } from \"vue\";\nimport { VTreeview } from \"vuetify/components/VTreeview\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { DocumentService } from \"@xwiki/platform-document-api\";\nimport type { NavigationTreeProps } from \"@xwiki/platform-dsapi\";\nimport type { DocumentReference } from \"@xwiki/platform-model-api\";\nimport type {\n NavigationTreeSource,\n NavigationTreeSourceProvider,\n} from \"@xwiki/platform-navigation-tree-api\";\nimport type { Ref } from \"vue\";\n\ntype TreeItem = {\n id: string;\n title: string;\n href: string;\n children?: Array<TreeItem>;\n _location: SpaceReference | DocumentReference;\n _is_terminal: boolean;\n};\n\nconst cristal: CristalApp = inject<CristalApp>(\"cristal\")!;\nconst documentService: DocumentService = cristal\n .getContainer()\n .get<DocumentService>(\"DocumentService\");\nconst treeSource: NavigationTreeSource = cristal\n .getContainer()\n .get<NavigationTreeSourceProvider>(\"NavigationTreeSourceProvider\")\n .get();\n\nconst rootNodes: Ref<Array<TreeItem>> = ref([]);\n\nconst activatedNodes: Ref<Array<string>> = ref(new Array<string>());\nconst expandedNodes: Ref<unknown> = ref([]);\nvar isExpanding: boolean = false;\n\nconst props = withDefaults(\n defineProps<NavigationTreeProps>(),\n navigationTreePropsDefaults,\n);\n\nonBeforeMount(async () => {\n const newRootNodes: Array<TreeItem> = [];\n for (const node of await getChildNodes(\"\")) {\n newRootNodes.push({\n id: node.id,\n title: node.label,\n href: node.url,\n children: node.has_children ? [] : undefined,\n _location: node.location,\n _is_terminal: node.is_terminal,\n });\n }\n if (props.showRootNode) {\n rootNodes.value.push({\n id: \"\",\n title: \"Root\",\n href: \".\",\n children: newRootNodes,\n _location: new SpaceReference(),\n _is_terminal: false,\n });\n } else {\n rootNodes.value.push(...newRootNodes);\n }\n await expandTree();\n\n documentService.registerDocumentChangeListener(\"delete\", onDocumentDelete);\n documentService.registerDocumentChangeListener(\"update\", onDocumentUpdate);\n});\n\nwatch(() => props.currentPageReference, expandTree);\n\n// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n// eslint-disable-next-line max-statements\nasync function expandTree() {\n if (props.currentPageReference && !isExpanding) {\n isExpanding = true;\n const newExpandedNodes = treeSource.getParentNodesId(\n props.currentPageReference!,\n props.includeTerminals,\n props.showRootNode,\n );\n let i;\n let currentNodes = rootNodes.value;\n for (i = 0; i < newExpandedNodes.length - 1; i++) {\n if (currentNodes) {\n for (const node of currentNodes) {\n if (node.id == newExpandedNodes[i]) {\n if (node.children?.length == 0) {\n await lazyLoadChildren(node);\n }\n if (!(expandedNodes.value as unknown[]).includes(node.id)) {\n (expandedNodes.value as unknown[]).push(node.id);\n }\n currentNodes = node.children!;\n }\n }\n }\n }\n if (currentNodes) {\n for (const node of currentNodes) {\n if (node.id == newExpandedNodes[i]) {\n activatedNodes.value = [node.id];\n // If we have a custom click action, we want to use it on dynamic\n // selection.\n if (props.clickAction) {\n props.clickAction({\n id: node.id,\n label: node.title,\n location: node._location,\n url: node.href,\n has_children: node.children !== undefined,\n is_terminal: node._is_terminal,\n });\n }\n }\n }\n }\n isExpanding = false;\n }\n}\n\nasync function lazyLoadChildren(item: unknown) {\n const treeItem = item as TreeItem;\n const childNodes = await getChildNodes(treeItem.id);\n for (const child of childNodes) {\n treeItem.children?.push({\n id: child.id,\n title: child.label,\n href: child.url,\n children: child.has_children ? [] : undefined,\n _location: child.location,\n _is_terminal: child.is_terminal,\n });\n }\n // If the node doesn't have any children, we update it.\n if (childNodes.length == 0) {\n treeItem.children = undefined;\n }\n}\n\nfunction clearSelection() {\n // Clicking on a node would activate it and this can't be disabled easily.\n // With this listener, we ensure that only the first activated node stays\n // active.\n if (activatedNodes.value.length > 1) {\n activatedNodes.value.pop();\n }\n}\n\n// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n// eslint-disable-next-line max-statements\nasync function onDocumentDelete(page: DocumentReference) {\n const parents = treeSource.getParentNodesId(\n page,\n props.includeTerminals,\n props.showRootNode,\n );\n let currentItem: TreeItem | undefined = undefined;\n let currentItemChildren: TreeItem[] | undefined = rootNodes.value;\n let notFound = false;\n\n currentItemsLoop: while (currentItemChildren && !notFound) {\n for (const i of currentItemChildren.keys()) {\n if (currentItemChildren[i].id == parents[0]) {\n if (parents.length == 1) {\n currentItemChildren.splice(i, 1);\n if (currentItem && currentItemChildren.length == 0) {\n currentItem!.children = undefined;\n }\n return;\n } else {\n currentItem = currentItemChildren[i];\n currentItemChildren = currentItem.children;\n parents.shift();\n continue currentItemsLoop;\n }\n }\n }\n notFound = true;\n }\n}\n\n// TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n// eslint-disable-next-line max-statements\nasync function onDocumentUpdate(page: DocumentReference) {\n const parents = treeSource.getParentNodesId(\n page,\n props.includeTerminals,\n props.showRootNode,\n );\n let currentParent: string | undefined = undefined;\n let currentItems: TreeItem[] | undefined = rootNodes.value;\n let notFound = false;\n let isRoot = true;\n\n currentItemsLoop: while (currentItems && !notFound) {\n for (const i of currentItems.keys()) {\n if (currentItems[i].id == parents[0]) {\n if (parents.length == 1) {\n // Page update\n const newItems = await getChildNodes(\n currentParent ? currentParent : \"\",\n );\n for (const newItem of newItems) {\n if (newItem.id == currentItems[i].id) {\n currentItems[i].title = newItem.label;\n return;\n }\n }\n } else {\n currentParent = currentItems[i].id;\n if (!currentItems[i].children) {\n // This node had no children, we reset this so new ones can be\n // loaded lazily.\n currentItems[i].children = [];\n }\n currentItems = currentItems[i].children;\n parents.shift();\n isRoot = false;\n continue currentItemsLoop;\n }\n }\n }\n notFound = true;\n }\n\n // New page\n if (currentItems.length == 0 && !isRoot) {\n // We don't do anything because this node will be loaded lazily anyway.\n return;\n }\n const newItems = await getChildNodes(currentParent ? currentParent : \"\");\n const currentPageParents = props.currentPageReference\n ? treeSource.getParentNodesId(\n props.currentPageReference!,\n props.includeTerminals,\n )\n : [];\n newItemsLoop: for (const newItem of newItems) {\n for (const i of currentItems!.keys()) {\n if (newItem.id == currentItems![i].id) {\n continue newItemsLoop;\n }\n }\n currentItems!.push({\n id: newItem.id,\n title: newItem.label,\n href: newItem.url,\n children: newItem.has_children ? [] : undefined,\n _location: newItem.location,\n _is_terminal: newItem.is_terminal,\n });\n if (\n currentPageParents.length > 0 &&\n currentPageParents[currentPageParents.length - 1] === newItem.id\n ) {\n // If we add a node, and it's the current page, it should be activated.\n activatedNodes.value = [newItem.id];\n }\n }\n}\n\nasync function getChildNodes(id: string) {\n return (await treeSource.getChildNodes(id)).filter(\n (c) => props.includeTerminals || !c.is_terminal,\n );\n}\n</script>\n\n<template>\n <v-treeview\n v-model:opened=\"expandedNodes\"\n density=\"compact\"\n :activated=\"activatedNodes\"\n :items=\"rootNodes\"\n :load-children=\"lazyLoadChildren\"\n activatable\n active-strategy=\"independent\"\n item-value=\"id\"\n @update:activated=\"clearSelection\"\n >\n <template #title=\"{ item }: { item: any }\">\n <a\n v-if=\"props.clickAction\"\n :href=\"item.href\"\n @click.prevent=\"\n activatedNodes = [item.id];\n clickAction!({\n id: item.id,\n label: item.title,\n location: item._location,\n url: item.href,\n has_children: item.children !== undefined,\n is_terminal: item._is_terminal,\n });\n \"\n >{{ item.title }}</a\n >\n <a v-else :href=\"item.href\">{{ item.title }}</a>\n </template>\n </v-treeview>\n</template>\n\n<style scoped>\n.v-list {\n background: none;\n}\n:deep(a) {\n text-decoration: none;\n color: var(--cr-base-text-color);\n}\n/* Disable hover on items. */\n:deep(.v-list-item__overlay) {\n --v-hover-opacity: 0;\n}\n/* Disable hand cursor on items, since we disable the default click action. */\n:deep(.v-list-item--link) {\n cursor: default;\n}\n</style>\n"],"names":["cristal","inject","documentService","treeSource","rootNodes","ref","activatedNodes","expandedNodes","isExpanding","props","__props","onBeforeMount","newRootNodes","node","getChildNodes","SpaceReference","expandTree","onDocumentDelete","onDocumentUpdate","watch","newExpandedNodes","i","currentNodes","lazyLoadChildren","item","treeItem","childNodes","child","clearSelection","page","parents","currentItem","currentItemChildren","notFound","currentItemsLoop","currentParent","currentItems","isRoot","newItems","newItem","currentPageParents","newItemsLoop","id","c","_createBlock","_unref","VTreeview","$event","_withCtx","_createElementBlock","_withModifiers","_toDisplayString","_hoisted_1","_hoisted_2"],"mappings":";;;;;;;;;;;;;;AA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,MAAA;AAAqB,YAAAzC,EAAA,QAAc,CAAIkB,EAAK,EAAE,GAAad,EAAA,YAAW;AAAA,cAAoB,IAAAc,EAAK;AAAA,cAAuB,OAAAA,EAAK;AAAA,cAA6B,UAAAA,EAAK;AAAA,cAA4B,KAAAA,EAAK;AAAA,4BAAgCA,EAAK,aAAa;AAAA,cAAoC,aAAAA,EAAK;AAAA,YAAA;;WAW3R2B,EAAA3B,EAAK,KAAK,GAAA,GAAA4B,CAAA,WAEhBH,EAAgD,KAAA;AAAA;UAArC,MAAMzB,EAAK;AAAA,QAAA,GAAS2B,EAAA3B,EAAK,KAAK,GAAA,GAAA6B,CAAA;AAAA,MAAA;;;;;"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { defineComponent as w, mergeModels as C, inject as T, useModel as X, ref as v, onMounted as k, resolveComponent as c, createElementBlock as B, openBlock as D, Fragment as H, createVNode as n, unref as r, withCtx as o, createTextVNode as h, toDisplayString as y, mergeDefaults as N } from "vue";
|
|
2
|
-
import { t as M } from "./translations-BVK9UR9x.js";
|
|
3
|
-
import S from "./x-breadcrumb-DaJw0U-E.js";
|
|
4
|
-
import { n as E } from "./index.es-BOA77_Kh.js";
|
|
5
|
-
import { EntityType as I, SpaceReference as A } from "@xwiki/platform-model-api";
|
|
6
|
-
import { useI18n as F } from "vue-i18n";
|
|
7
|
-
import { a as j } from "./index-D7wZ4Kvq.js";
|
|
8
|
-
import { _ as z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
9
|
-
const L = /* @__PURE__ */ w({
|
|
10
|
-
__name: "x-navigation-tree-select",
|
|
11
|
-
props: /* @__PURE__ */ C(/* @__PURE__ */ N({
|
|
12
|
-
label: {},
|
|
13
|
-
help: {},
|
|
14
|
-
currentPageReference: {},
|
|
15
|
-
modelValue: {},
|
|
16
|
-
includeTerminals: { type: Boolean }
|
|
17
|
-
}, E), {
|
|
18
|
-
modelValue: {},
|
|
19
|
-
modelModifiers: {}
|
|
20
|
-
}),
|
|
21
|
-
emits: ["update:modelValue"],
|
|
22
|
-
setup(a) {
|
|
23
|
-
const d = T("cristal"), s = d.getContainer().get("PageHierarchyResolverProvider").get(), b = d.getContainer().get("ModelReferenceHandlerProvider").get(), { t: u } = F({
|
|
24
|
-
messages: M
|
|
25
|
-
}), m = a, g = X(a, "modelValue"), f = v(!1), l = v([]);
|
|
26
|
-
let t;
|
|
27
|
-
k(async () => {
|
|
28
|
-
t = m.currentPageReference, g.value = m.currentPageReference.space, l.value = await s.getPageHierarchy(
|
|
29
|
-
m.currentPageReference.space,
|
|
30
|
-
!1
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
async function P(e) {
|
|
34
|
-
e.location.type == I.SPACE ? e.location.names.length > 0 ? (t = b.createDocumentReference(
|
|
35
|
-
e.location.names[e.location.names.length - 1],
|
|
36
|
-
new A(
|
|
37
|
-
e.location.wiki,
|
|
38
|
-
...e.location.names.slice(0, -1)
|
|
39
|
-
)
|
|
40
|
-
), l.value = await s.getPageHierarchy(
|
|
41
|
-
t,
|
|
42
|
-
!1
|
|
43
|
-
)) : (t = void 0, l.value = [{ label: e.label, pageId: "", url: e.url }]) : (t = e.location, l.value = await s.getPageHierarchy(
|
|
44
|
-
t,
|
|
45
|
-
!1
|
|
46
|
-
)), g.value = e.location;
|
|
47
|
-
}
|
|
48
|
-
return (e, i) => {
|
|
49
|
-
const x = c("x-btn"), V = c("XNavigationTree"), _ = c("XBtn"), R = c("XDialog");
|
|
50
|
-
return D(), B(H, null, [
|
|
51
|
-
n(r(j), {
|
|
52
|
-
label: a.label,
|
|
53
|
-
hint: a.help,
|
|
54
|
-
"persistent-hint": a.help !== void 0,
|
|
55
|
-
active: l.value.length > 0,
|
|
56
|
-
readonly: ""
|
|
57
|
-
}, {
|
|
58
|
-
default: o(() => [
|
|
59
|
-
n(S, { items: l.value }, null, 8, ["items"])
|
|
60
|
-
]),
|
|
61
|
-
_: 1
|
|
62
|
-
}, 8, ["label", "hint", "persistent-hint", "active"]),
|
|
63
|
-
n(R, {
|
|
64
|
-
modelValue: f.value,
|
|
65
|
-
"onUpdate:modelValue": i[1] || (i[1] = (p) => f.value = p),
|
|
66
|
-
width: "auto",
|
|
67
|
-
title: r(u)("vuetify.tree.select.location.label")
|
|
68
|
-
}, {
|
|
69
|
-
activator: o(() => [
|
|
70
|
-
n(x, {
|
|
71
|
-
id: "change-page-location-button",
|
|
72
|
-
size: "small",
|
|
73
|
-
color: "secondary"
|
|
74
|
-
}, {
|
|
75
|
-
default: o(() => [
|
|
76
|
-
h(y(r(u)("vuetify.tree.select.location.label")), 1)
|
|
77
|
-
]),
|
|
78
|
-
_: 1
|
|
79
|
-
})
|
|
80
|
-
]),
|
|
81
|
-
default: o(() => [
|
|
82
|
-
n(V, {
|
|
83
|
-
"current-page-reference": r(t),
|
|
84
|
-
"click-action": P,
|
|
85
|
-
"include-terminals": a.includeTerminals,
|
|
86
|
-
"show-root-node": ""
|
|
87
|
-
}, null, 8, ["current-page-reference", "include-terminals"])
|
|
88
|
-
]),
|
|
89
|
-
footer: o(() => [
|
|
90
|
-
n(_, {
|
|
91
|
-
variant: "primary",
|
|
92
|
-
onClick: i[0] || (i[0] = (p) => f.value = !1)
|
|
93
|
-
}, {
|
|
94
|
-
default: o(() => [
|
|
95
|
-
h(y(r(u)("vuetify.tree.select.location.select")), 1)
|
|
96
|
-
]),
|
|
97
|
-
_: 1
|
|
98
|
-
})
|
|
99
|
-
]),
|
|
100
|
-
_: 1
|
|
101
|
-
}, 8, ["modelValue", "title"])
|
|
102
|
-
], 64);
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}), W = /* @__PURE__ */ z(L, [["__scopeId", "data-v-3fd3a19c"]]);
|
|
106
|
-
export {
|
|
107
|
-
W as default
|
|
108
|
-
};
|
|
109
|
-
//# sourceMappingURL=x-navigation-tree-select-VRsQSFA3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x-navigation-tree-select-VRsQSFA3.js","sources":["../src/vue/form/x-navigation-tree-select.vue"],"sourcesContent":["<!--\n See the LICENSE file distributed with this work for additional\n information regarding copyright ownership.\n\n This is free software; you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as\n published by the Free Software Foundation; either version 2.1 of\n the License, or (at your option) any later version.\n\n This software is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public\n License along with this software; if not, write to the Free\n Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport messages from \"../../translations\";\nimport XBreadcrumb from \"../x-breadcrumb.vue\";\nimport { navigationTreeSelectPropsDefaults } from \"@xwiki/platform-dsapi\";\nimport { EntityType, SpaceReference } from \"@xwiki/platform-model-api\";\nimport { inject, onMounted, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport { VTextField } from \"vuetify/components/VTextField\";\nimport type {\n PageHierarchyItem,\n PageHierarchyResolver,\n PageHierarchyResolverProvider,\n} from \"@xwiki/cristal-hierarchy-api\";\nimport type { CristalApp } from \"@xwiki/platform-api\";\nimport type { NavigationTreeSelectProps } from \"@xwiki/platform-dsapi\";\nimport type { DocumentReference } from \"@xwiki/platform-model-api\";\nimport type {\n ModelReferenceHandler,\n ModelReferenceHandlerProvider,\n} from \"@xwiki/platform-model-reference-api\";\nimport type { NavigationTreeNode } from \"@xwiki/platform-navigation-tree-api\";\nimport type { Ref } from \"vue\";\n\nconst cristal: CristalApp = inject<CristalApp>(\"cristal\")!;\nconst hierarchyResolver: PageHierarchyResolver = cristal\n .getContainer()\n .get<PageHierarchyResolverProvider>(\"PageHierarchyResolverProvider\")\n .get()!;\nconst referenceHandler: ModelReferenceHandler = cristal\n .getContainer()\n .get<ModelReferenceHandlerProvider>(\"ModelReferenceHandlerProvider\")\n .get()!;\n\nconst { t } = useI18n({\n messages,\n});\nconst props = withDefaults(\n defineProps<NavigationTreeSelectProps>(),\n navigationTreeSelectPropsDefaults,\n);\nconst model = defineModel<SpaceReference | DocumentReference>();\n\nconst openedLocationDialog: Ref<boolean> = ref(false);\nconst hierarchy: Ref<Array<PageHierarchyItem>> = ref([]);\nlet selectedPage: DocumentReference | undefined;\n\nonMounted(async () => {\n selectedPage = props.currentPageReference;\n model.value = props.currentPageReference!.space;\n hierarchy.value = await hierarchyResolver.getPageHierarchy(\n props.currentPageReference!.space!,\n false,\n );\n});\n\nasync function treeNodeClickAction(node: NavigationTreeNode) {\n if (node.location.type == EntityType.SPACE) {\n if (node.location.names.length > 0) {\n selectedPage = referenceHandler.createDocumentReference(\n node.location.names[node.location.names.length - 1],\n new SpaceReference(\n node.location.wiki,\n ...node.location.names.slice(0, -1),\n ),\n );\n hierarchy.value = await hierarchyResolver.getPageHierarchy(\n selectedPage,\n false,\n );\n } else {\n selectedPage = undefined;\n hierarchy.value = [{ label: node.label, pageId: \"\", url: node.url }];\n }\n } else {\n selectedPage = node.location;\n hierarchy.value = await hierarchyResolver.getPageHierarchy(\n selectedPage,\n false,\n );\n }\n model.value = node.location;\n}\n</script>\n\n<template>\n <v-text-field\n :label=\"label\"\n :hint=\"help\"\n :persistent-hint=\"help !== undefined\"\n :active=\"hierarchy.length > 0\"\n readonly\n >\n <template #default>\n <XBreadcrumb :items=\"hierarchy\"></XBreadcrumb>\n </template>\n </v-text-field>\n <XDialog\n v-model=\"openedLocationDialog\"\n width=\"auto\"\n :title=\"t('vuetify.tree.select.location.label')\"\n >\n <template #activator>\n <x-btn id=\"change-page-location-button\" size=\"small\" color=\"secondary\">\n {{ t(\"vuetify.tree.select.location.label\") }}\n </x-btn>\n </template>\n <template #default>\n <XNavigationTree\n :current-page-reference=\"selectedPage\"\n :click-action=\"treeNodeClickAction\"\n :include-terminals=\"includeTerminals\"\n show-root-node\n ></XNavigationTree>\n </template>\n <template #footer>\n <XBtn variant=\"primary\" @click=\"openedLocationDialog = false\">\n {{ t(\"vuetify.tree.select.location.select\") }}\n </XBtn>\n </template>\n </XDialog>\n</template>\n\n<style scoped>\n.v-treeview {\n overflow: auto;\n}\n</style>\n"],"names":["cristal","inject","hierarchyResolver","referenceHandler","t","useI18n","messages","props","__props","model","_useModel","openedLocationDialog","ref","hierarchy","selectedPage","onMounted","treeNodeClickAction","node","EntityType","SpaceReference","_createVNode","_unref","VTextField","XBreadcrumb","_component_XDialog","$event","_component_x_btn","_component_XNavigationTree","_component_XBtn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0CA,UAAMA,IAAsBC,EAAmB,SAAS,GAClDC,IAA2CF,EAC9C,aAAA,EACA,IAAmC,+BAA+B,EAClE,IAAA,GACGG,IAA0CH,EAC7C,aAAA,EACA,IAAmC,+BAA+B,EAClE,IAAA,GAEG,EAAE,GAAAI,EAAA,IAAMC,EAAQ;AAAA,MAAA,UACpBC;AAAAA,IAAA,CACD,GACKC,IAAQC,GAIRC,IAAQC,EAA+CF,GAAA,YAAC,GAExDG,IAAqCC,EAAI,EAAK,GAC9CC,IAA2CD,EAAI,EAAE;AACvD,QAAIE;AAEJ,IAAAC,EAAU,YAAY;AACpB,MAAAD,IAAeP,EAAM,sBACrBE,EAAM,QAAQF,EAAM,qBAAsB,OAC1CM,EAAU,QAAQ,MAAMX,EAAkB;AAAA,QACxCK,EAAM,qBAAsB;AAAA,QAC5B;AAAA,MAAA;AAAA,IAEJ,CAAC;AAED,mBAAeS,EAAoBC,GAA0B;AAC3D,MAAIA,EAAK,SAAS,QAAQC,EAAW,QAC/BD,EAAK,SAAS,MAAM,SAAS,KAC/BH,IAAeX,EAAiB;AAAA,QAC9Bc,EAAK,SAAS,MAAMA,EAAK,SAAS,MAAM,SAAS,CAAC;AAAA,QAClD,IAAIE;AAAA,UACFF,EAAK,SAAS;AAAA,UACd,GAAGA,EAAK,SAAS,MAAM,MAAM,GAAG,EAAE;AAAA,Q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gCAAOjB,EAAA,QAAoB;AAAA,YAAA;yBAClD,MAA8C;AAAA,oBAA3CU,EAAAjB,CAAA,EAAC,qCAAA,CAAA,GAAA,CAAA;AAAA,cAAA;;;;;;;;;;"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { defineComponent as s, mergeModels as m, useModel as i, computed as d, createBlock as f, openBlock as c, unref as p } from "vue";
|
|
2
|
-
import { t as y } from "./translations-BVK9UR9x.js";
|
|
3
|
-
import { useI18n as V } from "vue-i18n";
|
|
4
|
-
import { a as h } from "./index-D7wZ4Kvq.js";
|
|
5
|
-
const M = /* @__PURE__ */ s({
|
|
6
|
-
__name: "x-text-field",
|
|
7
|
-
props: /* @__PURE__ */ m({
|
|
8
|
-
name: {},
|
|
9
|
-
label: {},
|
|
10
|
-
required: { type: Boolean },
|
|
11
|
-
autofocus: { type: Boolean },
|
|
12
|
-
modelValue: {},
|
|
13
|
-
help: {},
|
|
14
|
-
readonly: { type: Boolean },
|
|
15
|
-
type: {}
|
|
16
|
-
}, {
|
|
17
|
-
modelValue: {},
|
|
18
|
-
modelModifiers: {}
|
|
19
|
-
}),
|
|
20
|
-
emits: ["update:modelValue"],
|
|
21
|
-
setup(e) {
|
|
22
|
-
const { t: a } = V({
|
|
23
|
-
messages: y
|
|
24
|
-
}), n = e, o = i(e, "modelValue"), u = d(() => {
|
|
25
|
-
const l = [];
|
|
26
|
-
return n.required && l.push((t) => t ? !0 : a("vuetify.text.input.mandatory")), l;
|
|
27
|
-
});
|
|
28
|
-
return (l, t) => (c(), f(p(h), {
|
|
29
|
-
modelValue: o.value,
|
|
30
|
-
"onUpdate:modelValue": t[0] || (t[0] = (r) => o.value = r),
|
|
31
|
-
label: e.label,
|
|
32
|
-
name: e.name,
|
|
33
|
-
autofocus: e.autofocus,
|
|
34
|
-
hint: e.help,
|
|
35
|
-
"persistent-hint": e.help !== void 0,
|
|
36
|
-
rules: u.value,
|
|
37
|
-
readonly: e.readonly,
|
|
38
|
-
type: e.type ?? "text"
|
|
39
|
-
}, null, 8, ["modelValue", "label", "name", "autofocus", "hint", "persistent-hint", "rules", "readonly", "type"]));
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
export {
|
|
43
|
-
M as default
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=x-text-field-wiH4MWRR.js.map
|
package/dist/x-tree-CkUElkU9.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { defineComponent as s, mergeModels as v, useModel as r, ref as p, watch as u, createBlock as f, openBlock as m, unref as h, withCtx as x, createElementVNode as y, toDisplayString as N } from "vue";
|
|
2
|
-
import { c as b } from "./index-D7wZ4Kvq.js";
|
|
3
|
-
import { _ as k } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
-
const w = ["href", "onClick"], C = /* @__PURE__ */ s({
|
|
5
|
-
__name: "x-tree",
|
|
6
|
-
props: /* @__PURE__ */ v({
|
|
7
|
-
rootNode: {},
|
|
8
|
-
showRootNode: { type: Boolean },
|
|
9
|
-
activated: {},
|
|
10
|
-
opened: {}
|
|
11
|
-
}, {
|
|
12
|
-
opened: { default: [], type: Array },
|
|
13
|
-
openedModifiers: {},
|
|
14
|
-
activated: {},
|
|
15
|
-
activatedModifiers: {}
|
|
16
|
-
}),
|
|
17
|
-
emits: ["update:opened", "update:activated"],
|
|
18
|
-
setup(e) {
|
|
19
|
-
const d = r(e, "opened"), a = r(e, "activated"), i = p([]);
|
|
20
|
-
u(a, n, { immediate: !0 });
|
|
21
|
-
function n() {
|
|
22
|
-
i.value = a.value ? [a.value] : [];
|
|
23
|
-
}
|
|
24
|
-
function l(o) {
|
|
25
|
-
o.activatable && (a.value = o.id);
|
|
26
|
-
}
|
|
27
|
-
return (o, c) => (m(), f(h(b), {
|
|
28
|
-
density: "compact",
|
|
29
|
-
activated: i.value,
|
|
30
|
-
items: e.showRootNode ? [e.rootNode] : e.rootNode.children,
|
|
31
|
-
activatable: "",
|
|
32
|
-
"active-strategy": "independent",
|
|
33
|
-
"item-value": "id",
|
|
34
|
-
opened: d.value,
|
|
35
|
-
"onUpdate:opened": c[0] || (c[0] = (t) => d.value = t),
|
|
36
|
-
"onUpdate:activated": n
|
|
37
|
-
}, {
|
|
38
|
-
title: x(({ item: t }) => [
|
|
39
|
-
y("a", {
|
|
40
|
-
href: t.url,
|
|
41
|
-
onClick: (M) => l(t)
|
|
42
|
-
}, N(t.label), 9, w)
|
|
43
|
-
]),
|
|
44
|
-
_: 1
|
|
45
|
-
}, 8, ["activated", "items", "opened"]));
|
|
46
|
-
}
|
|
47
|
-
}), A = /* @__PURE__ */ k(C, [["__scopeId", "data-v-3c0b97c1"]]);
|
|
48
|
-
export {
|
|
49
|
-
A as default
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=x-tree-CkUElkU9.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x-tree-CkUElkU9.js","sources":["../src/vue/x-tree.vue"],"sourcesContent":["<!--\n See the LICENSE file distributed with this work for additional\n information regarding copyright ownership.\n\n This is free software; you can redistribute it and/or modify it\n under the terms of the GNU Lesser General Public License as\n published by the Free Software Foundation; either version 2.1 of\n the License, or (at your option) any later version.\n\n This software is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public\n License along with this software; if not, write to the Free\n Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport { ref, watch } from \"vue\";\nimport { VTreeview } from \"vuetify/components/VTreeview\";\nimport type { DisplayableTreeNode, TreeProps } from \"@xwiki/platform-dsapi\";\nimport type { Ref } from \"vue\";\n\ndefineProps<TreeProps>();\nconst opened = defineModel(\"opened\", { default: [], type: Array<string> });\nconst activated = defineModel<string | undefined>(\"activated\");\n\nconst activatedNodes: Ref<Array<string>> = ref([]);\n\nwatch(activated, resetActivated, { immediate: true });\n\nfunction resetActivated() {\n // Clicking on a node would activate it and this can't be disabled easily.\n // With this listener, we ensure that only the node we want stays active.\n activatedNodes.value = activated.value ? [activated.value] : [];\n}\n\nfunction updateActivated(newActivatedNode: DisplayableTreeNode) {\n if (newActivatedNode.activatable) {\n activated.value = newActivatedNode.id;\n }\n}\n</script>\n\n<template>\n <v-treeview\n density=\"compact\"\n :activated=\"activatedNodes\"\n :items=\"showRootNode ? [rootNode] : rootNode.children\"\n activatable\n active-strategy=\"independent\"\n item-value=\"id\"\n :opened=\"opened\"\n @update:opened=\"($event) => (opened = $event as string[])\"\n @update:activated=\"resetActivated\"\n >\n <template #title=\"{ item }\">\n <a :href=\"item.url\" @click=\"updateActivated(item)\">{{ item.label }}</a>\n </template>\n </v-treeview>\n</template>\n\n<style scoped>\n/* Remove the background color from the root div element. */\n.v-list {\n background: none;\n}\n:deep(a) {\n text-decoration: none;\n color: var(--cr-base-text-color);\n}\n/* Disable hover on items. */\n:deep(.v-list-item__overlay) {\n --v-hover-opacity: 0;\n}\n/* Disable hand cursor on items, since we disable the default click action. */\n:deep(.v-list-item--link) {\n cursor: default;\n}\n</style>\n"],"names":["opened","_useModel","__props","activated","activatedNodes","ref","watch","resetActivated","updateActivated","newActivatedNode","_createBlock","_unref","VTreeview","_cache","$event","_withCtx","item","_createElementVNode","_toDisplayString","_hoisted_1"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,UAAMA,IAASC,EAAWC,GAAC,QAA8C,GACnEC,IAAYF,KAAgC,WAAW,GAEvDG,IAAqCC,EAAI,EAAE;AAEjD,IAAAC,EAAMH,GAAWI,GAAgB,EAAE,WAAW,IAAM;AAEpD,aAASA,IAAiB;AAGxB,MAAAH,EAAe,QAAQD,EAAU,QAAQ,CAACA,EAAU,KAAK,IAAI,CAAA;AAAA,IAC/D;AAEA,aAASK,EAAgBC,GAAuC;AAC9D,MAAIA,EAAiB,gBACnBN,EAAU,QAAQM,EAAiB;AAAA,IAEvC;2BAIEC,EAcaC,EAAAC,CAAA,GAAA;AAAA,MAbX,SAAQ;AAAA,MACP,WAAWR,EAAA;AAAA,MACX,OAAOF,EAAA,eAAY,CAAIA,UAAQ,IAAIA,EAAA,SAAS;AAAA,MAC7C,aAAA;AAAA,MACA,mBAAgB;AAAA,MAChB,cAAW;AAAA,MACV,QAAQF,EAAA;AAAA,MACR,mBAAaa,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAGC,MAAYd,EAAA,QAASc;AAAA,MACrC,sBAAkBP;AAAA,IAAA;MAER,OAAKQ,EACd,CAAuE,EADrD,MAAAC,QAAI;AAAA,QACtBC,EAAuE,KAAA;AAAA,UAAnE,MAAMD,EAAK;AAAA,UAAM,SAAK,CAAAF,MAAEN,EAAgBQ,CAAI;AAAA,QAAA,GAAME,EAAAF,EAAK,KAAK,GAAA,GAAAG,CAAA;AAAA,MAAA;;;;;"}
|