@xwiki/cristal-dsvuetify 0.11.0 → 0.12.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/vuetifyDesignSystemLoader.d.ts +1 -1
  3. package/dist/{index-BMliq0dk.js → index-DCILSBLH.js} +1368 -1366
  4. package/dist/index-DCILSBLH.js.map +1 -0
  5. package/dist/index.es.js +2 -2
  6. package/dist/index.umd.js +6 -6
  7. package/dist/index.umd.js.map +1 -1
  8. package/dist/vue/x-alert.vue.d.ts +15 -1
  9. package/dist/vue/x-navigation-tree.vue.d.ts +1 -3
  10. package/dist/x-alert-C3nY6ghP.js +42 -0
  11. package/dist/x-alert-C3nY6ghP.js.map +1 -0
  12. package/dist/x-btn-DNlhiqjD.js.map +1 -1
  13. package/dist/{x-file-input-8euR7G64.js → x-file-input-BtGTZtfq.js} +2 -2
  14. package/dist/x-file-input-BtGTZtfq.js.map +1 -0
  15. package/dist/{x-form-UiBYkCKP.js → x-form-pSj3365X.js} +2 -2
  16. package/dist/{x-form-UiBYkCKP.js.map → x-form-pSj3365X.js.map} +1 -1
  17. package/dist/x-navigation-tree-W6QDS4uh.js +499 -0
  18. package/dist/x-navigation-tree-W6QDS4uh.js.map +1 -0
  19. package/dist/{x-text-field-uL1ePP_x.js → x-text-field-CAVD3OjY.js} +2 -2
  20. package/dist/{x-text-field-uL1ePP_x.js.map → x-text-field-CAVD3OjY.js.map} +1 -1
  21. package/package.json +9 -8
  22. package/src/components/componentsInit.ts +1 -1
  23. package/src/components/vuetifyDesignSystemLoader.ts +10 -9
  24. package/src/vue/__tests__/utils/vuetify.ts +1 -0
  25. package/src/vue/__tests__/x-btn.test.ts +4 -3
  26. package/src/vue/css/style.css +1 -0
  27. package/src/vue/form/x-file-input.vue +3 -4
  28. package/src/vue/form/x-text-field.vue +3 -3
  29. package/src/vue/x-alert.vue +2 -1
  30. package/src/vue/x-btn.vue +1 -1
  31. package/src/vue/x-navigation-tree.vue +89 -7
  32. package/vitest.config.ts +1 -1
  33. package/dist/index-BMliq0dk.js.map +0 -1
  34. package/dist/x-alert-D8oy1BPL.js +0 -40
  35. package/dist/x-alert-D8oy1BPL.js.map +0 -1
  36. package/dist/x-file-input-8euR7G64.js.map +0 -1
  37. package/dist/x-navigation-tree-DkVWsvlI.js +0 -449
  38. package/dist/x-navigation-tree-DkVWsvlI.js.map +0 -1
@@ -1,3 +1,17 @@
1
1
  import { AlertProps } from '@xwiki/cristal-dsapi';
2
- declare const _default: import('vue').DefineComponent<AlertProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AlertProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
2
+ declare function __VLS_template(): {
3
+ slots: {
4
+ default?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ attrs: Partial<{}>;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import('vue').DefineComponent<AlertProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AlertProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
3
12
  export default _default;
13
+ type __VLS_WithTemplateSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -1,12 +1,10 @@
1
1
  import { PageData } from '@xwiki/cristal-api';
2
- import { NavigationTreeSource, NavigationTreeNode } from '@xwiki/cristal-navigation-tree-api';
2
+ import { NavigationTreeNode } from '@xwiki/cristal-navigation-tree-api';
3
3
  type OnClickAction = (node: NavigationTreeNode) => void;
4
4
  declare const _default: import('vue').DefineComponent<{
5
- treeSource: NavigationTreeSource;
6
5
  clickAction?: OnClickAction;
7
6
  currentPage?: PageData;
8
7
  }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
9
- treeSource: NavigationTreeSource;
10
8
  clickAction?: OnClickAction;
11
9
  currentPage?: PageData;
12
10
  }> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,42 @@
1
+ import { defineComponent as p, resolveComponent as o, openBlock as l, createBlock as n, withCtx as a, createElementBlock as c, Fragment as i, renderList as m, createTextVNode as d, toDisplayString as u, renderSlot as _ } from "vue";
2
+ const y = /* @__PURE__ */ p({
3
+ __name: "x-alert",
4
+ props: {
5
+ title: {},
6
+ type: {},
7
+ description: {},
8
+ actions: {},
9
+ closable: { type: Boolean }
10
+ },
11
+ setup(b) {
12
+ return (e, f) => {
13
+ const r = o("x-btn"), s = o("v-alert");
14
+ return l(), n(s, {
15
+ closable: e.closable,
16
+ title: e.title,
17
+ type: e.type,
18
+ text: e.description
19
+ }, {
20
+ default: a(() => [
21
+ (l(!0), c(i, null, m(e.actions, (t) => (l(), n(r, {
22
+ key: t.name,
23
+ size: "small",
24
+ variant: "text",
25
+ onClick: t.callback
26
+ }, {
27
+ default: a(() => [
28
+ d(u(t.name), 1)
29
+ ]),
30
+ _: 2
31
+ }, 1032, ["onClick"]))), 128)),
32
+ _(e.$slots, "default")
33
+ ]),
34
+ _: 3
35
+ }, 8, ["closable", "title", "type", "text"]);
36
+ };
37
+ }
38
+ });
39
+ export {
40
+ y as default
41
+ };
42
+ //# sourceMappingURL=x-alert-C3nY6ghP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-alert-C3nY6ghP.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"x-btn-DNlhiqjD.js","sources":["../src/vue/x-btn.vue"],"sourcesContent":["<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script lang=\"ts\" setup>\nimport { computed } from \"vue\";\nimport { type BtnProps } from \"@xwiki/cristal-dsapi\";\n\nconst { variant } = defineProps<BtnProps>();\n\n// Map the variants to corresponding vuetify colors.\nconst color = computed(() => {\n let color = undefined;\n switch (variant) {\n case \"default\":\n break;\n case \"primary\":\n color = \"primary\";\n break;\n case \"success\":\n color = \"success\";\n break;\n case \"neutral\":\n color = \"secondary\";\n break;\n case \"warning\":\n color = \"warning\";\n break;\n case \"danger\":\n color = \"error\";\n break;\n }\n return color;\n});\n\nconst vVariant = computed(() => (variant == \"text\" ? \"text\" : \"tonal\"));\n</script>\n<template>\n <v-btn :color=\"color\" :variant=\"vVariant\">\n <slot />\n </v-btn>\n</template>\n"],"names":["color","computed","__props","vVariant"],"mappings":";;;;;;;AA0BM,UAAAA,IAAQC,EAAS,MAAM;AAC3B,UAAID;AACJ,cAAQE,EAAA,SAAS;AAAA,QACf,KAAK;AACH;AAAA,QACF,KAAK;AACHF,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,MACJ;AACOA,aAAAA;AAAAA,IAAA,CACR,GAEKG,IAAWF,EAAS,MAAOC,EAAO,WAAI,SAAS,SAAS,OAAQ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"x-btn-DNlhiqjD.js","sources":["../src/vue/x-btn.vue"],"sourcesContent":["<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script lang=\"ts\" setup>\nimport { computed } from \"vue\";\nimport type { BtnProps } from \"@xwiki/cristal-dsapi\";\n\nconst { variant } = defineProps<BtnProps>();\n\n// Map the variants to corresponding vuetify colors.\nconst color = computed(() => {\n let color = undefined;\n switch (variant) {\n case \"default\":\n break;\n case \"primary\":\n color = \"primary\";\n break;\n case \"success\":\n color = \"success\";\n break;\n case \"neutral\":\n color = \"secondary\";\n break;\n case \"warning\":\n color = \"warning\";\n break;\n case \"danger\":\n color = \"error\";\n break;\n }\n return color;\n});\n\nconst vVariant = computed(() => (variant == \"text\" ? \"text\" : \"tonal\"));\n</script>\n<template>\n <v-btn :color=\"color\" :variant=\"vVariant\">\n <slot />\n </v-btn>\n</template>\n"],"names":["color","computed","__props","vVariant"],"mappings":";;;;;;;AA0BM,UAAAA,IAAQC,EAAS,MAAM;AAC3B,UAAID;AACJ,cAAQE,EAAO,SAAE;AAAA,QACf,KAAK;AACH;AAAA,QACF,KAAK;AACHF,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,QACF,KAAK;AACHA,UAAAA,IAAQ;AACR;AAAA,MACJ;AACOA,aAAAA;AAAAA,IAAA,CACR,GAEKG,IAAWF,EAAS,MAAOC,EAAA,WAAW,SAAS,SAAS,OAAQ;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as s, mergeModels as m, useModel as i, computed as d, openBlock as p, createBlock as f, unref as c } from "vue";
2
2
  import { t as V } from "./translations-BNEIsfPR.js";
3
3
  import { useI18n as b } from "vue-i18n";
4
- import { b as v } from "./index-BMliq0dk.js";
4
+ import { b as v } from "./index-DCILSBLH.js";
5
5
  const k = /* @__PURE__ */ s({
6
6
  __name: "x-file-input",
7
7
  props: /* @__PURE__ */ m({
@@ -32,4 +32,4 @@ const k = /* @__PURE__ */ s({
32
32
  export {
33
33
  k as default
34
34
  };
35
- //# sourceMappingURL=x-file-input-8euR7G64.js.map
35
+ //# sourceMappingURL=x-file-input-BtGTZtfq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-file-input-BtGTZtfq.js","sources":["../src/vue/form/x-file-input.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport messages from \"../../translations\";\nimport { computed, defineModel } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport { VFileInput } from \"vuetify/components/VFileInput\";\nimport type { TextFieldModel, TextFieldProps } from \"@xwiki/cristal-dsapi\";\n\nconst { t } = useI18n({\n messages,\n});\n\nconst model = defineModel<TextFieldModel>();\nconst props = defineProps<TextFieldProps>();\n\nconst rules = computed(() => {\n const rulesList = [];\n if (props.required) {\n rulesList.push((value: unknown) => {\n if (value) {\n return true;\n } else {\n return t(\"vuetify.file.input.mandatory\");\n }\n });\n }\n return rulesList;\n});\n</script>\n\n<template>\n <v-file-input\n v-model=\"model\"\n :label=\"label\"\n :name=\"name\"\n :rules=\"rules\"\n ></v-file-input>\n</template>\n\n<style scoped></style>\n"],"names":["useI18n","messages","model","_useModel","props","__props","rules","computed","rulesList","value"],"mappings":";;;;;;;;;;;;;;;;AAOM,UAAA,EAAE,EAAE,IAAIA,EAAQ;AAAA,MAAA,UACpBC;AAAAA,IAAA,CACD,GAEKC,IAAQC,iBAA4B,GACpCC,IAAQC,GAERC,IAAQC,EAAS,MAAM;AAC3B,YAAMC,IAAY,CAAA;AAClB,aAAIJ,EAAM,YACEI,EAAA,KAAK,CAACC,MACVA,IACK,KAEA,EAAE,8BAA8B,CAE1C,GAEID;AAAA,IAAA,CACR;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as i, resolveComponent as s, openBlock as c, createBlock as f, unref as u, withModifiers as a, withCtx as e, createVNode as _, renderSlot as l } from "vue";
2
- import { V as p } from "./index-BMliq0dk.js";
2
+ import { V as p } from "./index-DCILSBLH.js";
3
3
  const h = /* @__PURE__ */ i({
4
4
  __name: "x-form",
5
5
  emits: ["formSubmit"],
@@ -29,4 +29,4 @@ const h = /* @__PURE__ */ i({
29
29
  export {
30
30
  h as default
31
31
  };
32
- //# sourceMappingURL=x-form-UiBYkCKP.js.map
32
+ //# sourceMappingURL=x-form-pSj3365X.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-form-UiBYkCKP.js","sources":["../src/vue/form/x-form.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { VForm } from \"vuetify/components/VForm\";\nconst emits = defineEmits([\"formSubmit\"]);\nfunction submit() {\n emits(\"formSubmit\");\n}\n</script>\n\n<template>\n <v-form @submit.prevent=\"submit\">\n <v-container>\n <slot></slot>\n </v-container>\n </v-form>\n</template>\n\n<style scoped></style>\n"],"names":["emits","__emit","submit"],"mappings":";;;;;;AAEA,UAAMA,IAAQC;AACd,aAASC,IAAS;AAChB,MAAAF,EAAM,YAAY;AAAA,IACpB;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"x-form-pSj3365X.js","sources":["../src/vue/form/x-form.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { VForm } from \"vuetify/components/VForm\";\nconst emits = defineEmits([\"formSubmit\"]);\nfunction submit() {\n emits(\"formSubmit\");\n}\n</script>\n\n<template>\n <v-form @submit.prevent=\"submit\">\n <v-container>\n <slot></slot>\n </v-container>\n </v-form>\n</template>\n\n<style scoped></style>\n"],"names":["emits","__emit","submit"],"mappings":";;;;;;AAEA,UAAMA,IAAQC;AACd,aAASC,IAAS;AAChB,MAAAF,EAAM,YAAY;AAAA,IACpB;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,499 @@
1
+ import { ref as P, computed as V, createVNode as g, mergeProps as T, Fragment as G, inject as W, reactive as Y, withModifiers as H, toRaw as S, toRef as y, provide as Z, defineComponent as ee, onBeforeMount as te, watch as ne, openBlock as j, createBlock as ae, unref as ie, withCtx as le, createElementBlock as $, toDisplayString as R } from "vue";
2
+ import { p as O, o as D, m as oe, g as L, u as E, c as U, d as re, E as ce, I as x, e as de, f as se, h as M, i as ue, j as ve, k as fe, l as he, n as ge, q as me, r as Ie, s as B, t as we, v as pe, w as q } from "./index-DCILSBLH.js";
3
+ import { _ as ke } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
+ const Ce = O({
5
+ ...D(oe({
6
+ collapseIcon: "$treeviewCollapse",
7
+ expandIcon: "$treeviewExpand"
8
+ }), ["subgroup"])
9
+ }, "VTreeviewGroup"), z = L()({
10
+ name: "VTreeviewGroup",
11
+ props: Ce(),
12
+ setup(e, I) {
13
+ let {
14
+ slots: i
15
+ } = I;
16
+ const u = P(), p = V(() => {
17
+ var o;
18
+ return (o = u.value) != null && o.isOpen ? e.collapseIcon : e.expandIcon;
19
+ }), b = V(() => {
20
+ var o;
21
+ return {
22
+ VTreeviewItem: {
23
+ prependIcon: void 0,
24
+ appendIcon: void 0,
25
+ active: (o = u.value) == null ? void 0 : o.isOpen,
26
+ toggleIcon: p.value
27
+ }
28
+ };
29
+ });
30
+ return E(() => {
31
+ const o = U.filterProps(e);
32
+ return g(U, T(o, {
33
+ ref: u,
34
+ class: ["v-treeview-group", e.class],
35
+ subgroup: !0
36
+ }), {
37
+ ...i,
38
+ activator: i.activator ? (v) => g(G, null, [g(re, {
39
+ defaults: b.value
40
+ }, {
41
+ default: () => {
42
+ var f;
43
+ return [(f = i.activator) == null ? void 0 : f.call(i, v)];
44
+ }
45
+ })]) : void 0
46
+ });
47
+ }), {};
48
+ }
49
+ }), J = Symbol.for("vuetify:v-treeview"), be = O({
50
+ loading: Boolean,
51
+ onToggleExpand: ce(),
52
+ toggleIcon: x,
53
+ ...de({
54
+ slim: !0
55
+ })
56
+ }, "VTreeviewItem"), K = L()({
57
+ name: "VTreeviewItem",
58
+ props: be(),
59
+ setup(e, I) {
60
+ let {
61
+ attrs: i,
62
+ slots: u,
63
+ emit: p
64
+ } = I;
65
+ const b = se(e, i), o = P(), v = V(() => {
66
+ var s, w;
67
+ return ((s = o.value) == null ? void 0 : s.root.activatable.value) && ((w = o.value) == null ? void 0 : w.isGroupActivator);
68
+ }), f = V(() => {
69
+ var s;
70
+ return !e.disabled && e.link !== !1 && (e.link || b.isClickable.value || e.value != null && !!((s = o.value) != null && s.list) || v.value);
71
+ });
72
+ function d(s) {
73
+ var w, C, l, r;
74
+ !f.value || !v.value && ((w = o.value) != null && w.isGroupActivator) || (C = o.value) != null && C.root.activatable.value && ((r = o.value) == null || r.activate(!((l = o.value) != null && l.isActivated), s));
75
+ }
76
+ const k = W(J, {
77
+ visibleIds: P()
78
+ }).visibleIds;
79
+ return E(() => {
80
+ var C, l;
81
+ const s = D(M.filterProps(e), ["onClick"]), w = u.prepend || e.toggleIcon;
82
+ return g(M, T({
83
+ ref: o
84
+ }, s, {
85
+ active: (C = o.value) == null ? void 0 : C.isActivated,
86
+ class: ["v-treeview-item", {
87
+ "v-treeview-item--activatable-group-activator": v.value,
88
+ "v-treeview-item--filtered": k.value && !k.value.has((l = o.value) == null ? void 0 : l.id)
89
+ }, e.class],
90
+ ripple: !1,
91
+ onClick: e.onClick ?? d
92
+ }), {
93
+ ...u,
94
+ prepend: w ? (r) => {
95
+ var t;
96
+ return g(G, null, [e.toggleIcon && g(ue, {
97
+ start: !1
98
+ }, {
99
+ default: () => [g(ve, {
100
+ density: "compact",
101
+ icon: e.toggleIcon,
102
+ loading: e.loading,
103
+ variant: "text",
104
+ onClick: e.onToggleExpand
105
+ }, {
106
+ loader() {
107
+ return g(fe, {
108
+ indeterminate: "disable-shrink",
109
+ size: "20",
110
+ width: "2"
111
+ }, null);
112
+ }
113
+ })]
114
+ }), (t = u.prepend) == null ? void 0 : t.call(u, r)]);
115
+ } : void 0
116
+ });
117
+ }), {};
118
+ }
119
+ }), Q = O({
120
+ loadChildren: Function,
121
+ loadingIcon: {
122
+ type: String,
123
+ default: "$loading"
124
+ },
125
+ items: Array,
126
+ openOnClick: {
127
+ type: Boolean,
128
+ default: void 0
129
+ },
130
+ indeterminateIcon: {
131
+ type: x,
132
+ default: "$checkboxIndeterminate"
133
+ },
134
+ falseIcon: x,
135
+ trueIcon: x,
136
+ returnObject: Boolean,
137
+ selectable: Boolean,
138
+ selectedColor: String,
139
+ selectStrategy: [String, Function, Object]
140
+ }, "VTreeviewChildren"), A = L()({
141
+ name: "VTreeviewChildren",
142
+ props: Q(),
143
+ setup(e, I) {
144
+ let {
145
+ slots: i
146
+ } = I;
147
+ const u = Y(/* @__PURE__ */ new Set()), p = V(() => e.openOnClick != null ? e.openOnClick : e.selectable);
148
+ async function b(v) {
149
+ var f, d;
150
+ try {
151
+ if (!((f = e.items) != null && f.length) || !e.loadChildren) return;
152
+ ((d = v == null ? void 0 : v.children) == null ? void 0 : d.length) === 0 && (u.add(v.value), await e.loadChildren(v.raw));
153
+ } finally {
154
+ u.delete(v.value);
155
+ }
156
+ }
157
+ function o(v, f) {
158
+ e.selectable && v(!f);
159
+ }
160
+ return () => {
161
+ var v, f;
162
+ return ((v = i.default) == null ? void 0 : v.call(i)) ?? ((f = e.items) == null ? void 0 : f.map((d) => {
163
+ var t;
164
+ const {
165
+ children: k,
166
+ props: s
167
+ } = d, w = u.has(d.value), C = {
168
+ prepend: (n) => {
169
+ var a;
170
+ return g(G, null, [e.selectable && (!k || k && !["leaf", "single-leaf"].includes(e.selectStrategy)) && g("div", null, [g(he, {
171
+ key: d.value,
172
+ modelValue: n.isSelected,
173
+ loading: w,
174
+ color: e.selectedColor,
175
+ indeterminate: n.isIndeterminate,
176
+ indeterminateIcon: e.indeterminateIcon,
177
+ falseIcon: e.falseIcon,
178
+ trueIcon: e.trueIcon,
179
+ onClick: H(() => o(n.select, n.isSelected), ["stop"]),
180
+ onKeydown: (c) => {
181
+ ["Enter", "Space"].includes(c.key) && (c.stopPropagation(), o(n.select, n.isSelected));
182
+ }
183
+ }, null)]), (a = i.prepend) == null ? void 0 : a.call(i, {
184
+ ...n,
185
+ item: d.raw,
186
+ internalItem: d
187
+ })]);
188
+ },
189
+ append: i.append ? (n) => {
190
+ var a;
191
+ return (a = i.append) == null ? void 0 : a.call(i, {
192
+ ...n,
193
+ item: d.raw,
194
+ internalItem: d
195
+ });
196
+ } : void 0,
197
+ title: i.title ? (n) => {
198
+ var a;
199
+ return (a = i.title) == null ? void 0 : a.call(i, {
200
+ ...n,
201
+ item: d.raw,
202
+ internalItem: d
203
+ });
204
+ } : void 0
205
+ }, l = z.filterProps(s), r = A.filterProps(e);
206
+ return k ? g(z, T(l, {
207
+ value: e.returnObject ? d.raw : l == null ? void 0 : l.value
208
+ }), {
209
+ activator: (n) => {
210
+ let {
211
+ props: a
212
+ } = n;
213
+ const c = {
214
+ ...s,
215
+ ...a,
216
+ value: s == null ? void 0 : s.value,
217
+ onToggleExpand: [() => b(d), a.onClick],
218
+ onClick: p.value ? [() => b(d), a.onClick] : void 0
219
+ };
220
+ return g(K, T(c, {
221
+ value: e.returnObject ? S(d.raw) : s.value,
222
+ loading: w
223
+ }), C);
224
+ },
225
+ default: () => g(A, T(r, {
226
+ items: k,
227
+ returnObject: e.returnObject
228
+ }), i)
229
+ }) : ((t = i.item) == null ? void 0 : t.call(i, {
230
+ props: s,
231
+ item: d.raw,
232
+ internalItem: d
233
+ })) ?? g(K, T(s, {
234
+ value: e.returnObject ? S(d.raw) : s.value
235
+ }), C);
236
+ }));
237
+ };
238
+ }
239
+ });
240
+ function X(e) {
241
+ let I = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
242
+ for (const i of e)
243
+ I.push(i), i.children && X(i.children, I);
244
+ return I;
245
+ }
246
+ const ye = O({
247
+ openAll: Boolean,
248
+ search: String,
249
+ ...ge({
250
+ filterKeys: ["title"]
251
+ }),
252
+ ...Q(),
253
+ ...D(me({
254
+ collapseIcon: "$treeviewCollapse",
255
+ expandIcon: "$treeviewExpand",
256
+ slim: !0
257
+ }), ["itemType", "nav", "openStrategy"]),
258
+ modelValue: {
259
+ type: Array,
260
+ default: () => []
261
+ }
262
+ }, "VTreeview"), Ve = L()({
263
+ name: "VTreeview",
264
+ props: ye(),
265
+ emits: {
266
+ "update:opened": (e) => !0,
267
+ "update:activated": (e) => !0,
268
+ "update:selected": (e) => !0,
269
+ "update:modelValue": (e) => !0,
270
+ "click:open": (e) => !0,
271
+ "click:select": (e) => !0
272
+ },
273
+ setup(e, I) {
274
+ let {
275
+ slots: i
276
+ } = I;
277
+ const {
278
+ items: u
279
+ } = Ie(e), p = y(e, "activeColor"), b = y(e, "baseColor"), o = y(e, "color"), v = B(e, "activated"), f = B(e, "modelValue"), d = B(e, "selected", e.modelValue), k = V({
280
+ get: () => d.value,
281
+ set(c) {
282
+ d.value = c, f.value = c;
283
+ }
284
+ }), s = P(), w = V(() => e.openAll ? a(u.value) : e.opened), C = V(() => X(u.value)), l = y(e, "search"), {
285
+ filteredItems: r
286
+ } = we(e, C, l), t = V(() => {
287
+ var m;
288
+ if (!l.value) return null;
289
+ const c = (m = s.value) == null ? void 0 : m.getPath;
290
+ return c ? new Set(r.value.flatMap((h) => {
291
+ const _ = e.returnObject ? h.raw : h.props.value;
292
+ return [...c(_), ...n(_)].map(S);
293
+ })) : null;
294
+ });
295
+ function n(c) {
296
+ var _, F;
297
+ const m = [], h = (((_ = s.value) == null ? void 0 : _.children.get(c)) ?? []).slice();
298
+ for (; h.length; ) {
299
+ const N = h.shift();
300
+ N && (m.push(N), h.push(...(((F = s.value) == null ? void 0 : F.children.get(N)) ?? []).slice()));
301
+ }
302
+ return m;
303
+ }
304
+ function a(c) {
305
+ let m = [];
306
+ for (const h of c)
307
+ h.children && (m.push(e.returnObject ? S(h.raw) : h.value), h.children && (m = m.concat(a(h.children))));
308
+ return m;
309
+ }
310
+ return Z(J, {
311
+ visibleIds: t
312
+ }), pe({
313
+ VTreeviewGroup: {
314
+ activeColor: p,
315
+ baseColor: b,
316
+ color: o,
317
+ collapseIcon: y(e, "collapseIcon"),
318
+ expandIcon: y(e, "expandIcon")
319
+ },
320
+ VTreeviewItem: {
321
+ activeClass: y(e, "activeClass"),
322
+ activeColor: p,
323
+ baseColor: b,
324
+ color: o,
325
+ density: y(e, "density"),
326
+ disabled: y(e, "disabled"),
327
+ lines: y(e, "lines"),
328
+ variant: y(e, "variant")
329
+ }
330
+ }), E(() => {
331
+ const c = q.filterProps(e), m = A.filterProps(e);
332
+ return g(q, T({
333
+ ref: s
334
+ }, c, {
335
+ class: ["v-treeview", e.class],
336
+ "open-strategy": "multiple",
337
+ style: e.style,
338
+ opened: w.value,
339
+ activated: v.value,
340
+ "onUpdate:activated": (h) => v.value = h,
341
+ selected: k.value,
342
+ "onUpdate:selected": (h) => k.value = h
343
+ }), {
344
+ default: () => [g(A, T(m, {
345
+ returnObject: e.returnObject,
346
+ items: u.value
347
+ }), i)]
348
+ });
349
+ }), {};
350
+ }
351
+ }), Pe = ["href", "onClick"], Te = ["href"], _e = /* @__PURE__ */ ee({
352
+ __name: "x-navigation-tree",
353
+ props: {
354
+ clickAction: { type: Function },
355
+ currentPage: {}
356
+ },
357
+ setup(e) {
358
+ const I = W("cristal"), i = I.getContainer().get("DocumentService"), u = I.getContainer().get("NavigationTreeSourceProvider").get(), p = P([]), b = P(void 0), o = P(new Array()), v = P(new Array()), f = e;
359
+ te(async () => {
360
+ for (const l of await u.getChildNodes(""))
361
+ p.value.push({
362
+ id: l.id,
363
+ title: l.label,
364
+ href: l.url,
365
+ children: l.has_children ? [] : void 0,
366
+ _location: l.location
367
+ });
368
+ f.currentPage !== void 0 && await d(), i.registerDocumentChangeListener("delete", w), i.registerDocumentChangeListener("update", C);
369
+ }), ne(
370
+ () => f.currentPage,
371
+ async () => {
372
+ f.currentPage && await d();
373
+ }
374
+ );
375
+ async function d() {
376
+ var n;
377
+ const l = u.getParentNodesId(f.currentPage);
378
+ let r, t = p.value;
379
+ for (r = 0; r < l.length - 1; r++)
380
+ if (t)
381
+ for (const a of t)
382
+ a.id == l[r] && (((n = a.children) == null ? void 0 : n.length) == 0 && await k(a), v.value.includes(a.id) || v.value.push(a.id), t = a.children);
383
+ if (t)
384
+ for (const a of t)
385
+ a.id == l[r] && (o.value = [a.id], f.clickAction && f.clickAction({
386
+ id: a.id,
387
+ label: a.title,
388
+ location: a._location,
389
+ url: a.href,
390
+ has_children: a.children !== void 0
391
+ }));
392
+ }
393
+ async function k(l) {
394
+ var n;
395
+ const r = l, t = await u.getChildNodes(r.id);
396
+ for (const a of t)
397
+ (n = r.children) == null || n.push({
398
+ id: a.id,
399
+ title: a.label,
400
+ href: a.url,
401
+ children: a.has_children ? [] : void 0,
402
+ _location: a.location
403
+ });
404
+ t.length == 0 && (r.children = void 0);
405
+ }
406
+ function s() {
407
+ o.value.length > 1 && o.value.pop();
408
+ }
409
+ async function w(l) {
410
+ const r = u.getParentNodesId(l);
411
+ let t = p.value;
412
+ for (; t; )
413
+ for (const n of t.keys())
414
+ if (t[n].id == r[0])
415
+ if (r.length == 1) {
416
+ t.splice(n, 1);
417
+ return;
418
+ } else {
419
+ t = t[n].children, r.shift();
420
+ break;
421
+ }
422
+ }
423
+ async function C(l) {
424
+ const r = u.getParentNodesId(l);
425
+ let t, n = p.value;
426
+ for (; n; ) {
427
+ for (const c of n.keys())
428
+ if (n[c].id == r[0])
429
+ if (r.length == 1) {
430
+ const m = await u.getChildNodes(
431
+ t || ""
432
+ );
433
+ for (const h of m)
434
+ if (h.id == n[c].id) {
435
+ n[c].title = h.label;
436
+ return;
437
+ }
438
+ } else {
439
+ t = n[c].id, n = n[c].children, r.shift();
440
+ break;
441
+ }
442
+ const a = await u.getChildNodes(
443
+ t || ""
444
+ );
445
+ e: for (const c of a) {
446
+ for (const m of n.keys())
447
+ if (c.id == n[m].id)
448
+ continue e;
449
+ n.push({
450
+ id: c.id,
451
+ title: c.label,
452
+ href: c.url,
453
+ children: c.has_children ? [] : void 0,
454
+ _location: c.location
455
+ });
456
+ }
457
+ }
458
+ }
459
+ return (l, r) => (j(), ae(ie(Ve), {
460
+ ref_key: "tree",
461
+ ref: b,
462
+ opened: v.value,
463
+ "onUpdate:opened": r[0] || (r[0] = (t) => v.value = t),
464
+ density: "compact",
465
+ activated: o.value,
466
+ items: p.value,
467
+ "load-children": k,
468
+ activatable: "",
469
+ "active-strategy": "independent",
470
+ "item-value": "id",
471
+ "open-strategy": "multiple",
472
+ "onUpdate:activated": s
473
+ }, {
474
+ title: le(({ item: t }) => [
475
+ f.clickAction ? (j(), $("a", {
476
+ key: 0,
477
+ href: t.href,
478
+ onClick: H((n) => {
479
+ o.value = [t.id], l.clickAction({
480
+ id: t.id,
481
+ label: t.title,
482
+ location: t._location,
483
+ url: t.href,
484
+ has_children: t.children !== void 0
485
+ });
486
+ }, ["prevent"])
487
+ }, R(t.title), 9, Pe)) : (j(), $("a", {
488
+ key: 1,
489
+ href: t.href
490
+ }, R(t.title), 9, Te))
491
+ ]),
492
+ _: 1
493
+ }, 8, ["opened", "activated", "items"]));
494
+ }
495
+ }), Oe = /* @__PURE__ */ ke(_e, [["__scopeId", "data-v-cf1d31bb"]]);
496
+ export {
497
+ Oe as default
498
+ };
499
+ //# sourceMappingURL=x-navigation-tree-W6QDS4uh.js.map