@xwiki/cristal-dsvuetify 0.12.0 → 0.13.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 (42) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{index-DCILSBLH.js → index-UP1o6s9t.js} +3070 -3035
  3. package/dist/index-UP1o6s9t.js.map +1 -0
  4. package/dist/index.es.js +5 -4
  5. package/dist/index.umd.js +9 -8
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/vue/x-dialog.vue.d.ts +1 -0
  8. package/dist/x-alert-Bmt4mXHQ.js +45 -0
  9. package/dist/x-alert-Bmt4mXHQ.js.map +1 -0
  10. package/dist/x-avatar-But_Z7ic.js.map +1 -1
  11. package/dist/x-breadcrumb-C2iUd4Sf.js.map +1 -1
  12. package/dist/x-btn-DNlhiqjD.js.map +1 -1
  13. package/dist/x-card-CRM9KUby.js.map +1 -1
  14. package/dist/x-dialog-C-dMkFJk.js +49 -0
  15. package/dist/x-dialog-C-dMkFJk.js.map +1 -0
  16. package/dist/{x-file-input-BtGTZtfq.js → x-file-input-BsaodA0p.js} +10 -9
  17. package/dist/{x-file-input-BtGTZtfq.js.map → x-file-input-BsaodA0p.js.map} +1 -1
  18. package/dist/{x-form-pSj3365X.js → x-form-iQFXj1PW.js} +2 -2
  19. package/dist/{x-form-pSj3365X.js.map → x-form-iQFXj1PW.js.map} +1 -1
  20. package/dist/x-img-BYgs_O1F.js.map +1 -1
  21. package/dist/x-navigation-tree-DN2Qz7Sm.js +501 -0
  22. package/dist/x-navigation-tree-DN2Qz7Sm.js.map +1 -0
  23. package/dist/x-tab-group-ngNByee3.js.map +1 -1
  24. package/dist/x-text-field-CTsLZhLE.js +31 -0
  25. package/dist/{x-text-field-CAVD3OjY.js.map → x-text-field-CTsLZhLE.js.map} +1 -1
  26. package/langs/translation-de.json +4 -0
  27. package/package.json +17 -10
  28. package/src/components/vuetifyDesignSystemLoader.ts +2 -0
  29. package/src/vue/css/style.css +11 -4
  30. package/src/vue/form/x-text-field.vue +6 -1
  31. package/src/vue/x-alert.vue +2 -0
  32. package/src/vue/x-dialog.vue +14 -1
  33. package/src/vue/x-navigation-tree.vue +66 -58
  34. package/tsconfig.json +14 -8
  35. package/dist/index-DCILSBLH.js.map +0 -1
  36. package/dist/x-alert-C3nY6ghP.js +0 -42
  37. package/dist/x-alert-C3nY6ghP.js.map +0 -1
  38. package/dist/x-dialog-Ce8KWptm.js +0 -38
  39. package/dist/x-dialog-Ce8KWptm.js.map +0 -1
  40. package/dist/x-navigation-tree-W6QDS4uh.js +0 -499
  41. package/dist/x-navigation-tree-W6QDS4uh.js.map +0 -1
  42. package/dist/x-text-field-CAVD3OjY.js +0 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-dsvuetify",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -22,19 +22,26 @@
22
22
  },
23
23
  "main": "./dist/index.es.js",
24
24
  "dependencies": {
25
- "inversify": "6.0.3",
26
- "vue": "3.5.12",
27
- "vue-i18n": "10.0.4",
28
- "vuetify": "3.7.3",
29
- "@xwiki/cristal-api": "0.12.0",
30
- "@xwiki/cristal-dsapi": "0.12.0",
31
- "@xwiki/cristal-navigation-tree-api": "0.12.0",
32
- "@xwiki/cristal-document-api": "0.12.0"
25
+ "inversify": "6.2.0",
26
+ "vue": "3.5.13",
27
+ "vue-i18n": "10.0.5",
28
+ "vuetify": "3.7.5",
29
+ "@xwiki/cristal-document-api": "0.13.0",
30
+ "@xwiki/cristal-navigation-tree-api": "0.13.0",
31
+ "@xwiki/cristal-api": "0.13.0",
32
+ "@xwiki/cristal-dsapi": "0.13.0",
33
+ "@xwiki/cristal-model-api": "0.13.0"
34
+ },
35
+ "peerDependencies": {
36
+ "reflect-metadata": "0.2.2"
33
37
  },
34
38
  "devDependencies": {
35
39
  "@vue/test-utils": "2.4.6",
40
+ "reflect-metadata": "0.2.2",
41
+ "typescript": "5.6.3",
42
+ "vite": "6.0.3",
36
43
  "vue-tsc": "2.1.10",
37
- "@xwiki/cristal-dev-config": "0.12.0"
44
+ "@xwiki/cristal-dev-config": "0.13.0"
38
45
  },
39
46
  "scripts": {
40
47
  "build": "pnpm compile",
@@ -33,6 +33,8 @@ import type { App } from "vue";
33
33
 
34
34
  @injectable()
35
35
  export class VuetifyDesignSystemLoader implements DesignSystemLoader {
36
+ // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
37
+ // eslint-disable-next-line max-statements
36
38
  loadDesignSystem(app: App): void {
37
39
  /*
38
40
  // Manuel importing to reduce build size
@@ -32,7 +32,8 @@
32
32
  --cr-sizes-collapsed-main-sidebar-width: 32px; /*The width of the bar that gets shown containing the menu button to reopen the standard main main sidebar*/
33
33
  --cr-base-font-size: 16px;
34
34
  --cr-base-text-color: var(--cr-color-gray-950);
35
-
35
+ --cr-base-link-color: var(--cr-color-sky-700);
36
+ --cr-base-visited-link-color: var(--cr-color-blue-700);
36
37
 
37
38
  /*
38
39
  * Typography
@@ -82,9 +83,9 @@
82
83
  --cr-focus-ring: var(--cr-focus-ring-style) var(--cr-focus-ring-width) var(--cr-focus-ring-color);
83
84
  --cr-focus-ring-offset: 1px;
84
85
 
85
- /*
86
- * Color Primitives
87
- */
86
+ /*
87
+ * Color Primitives
88
+ */
88
89
 
89
90
  /* Gray */
90
91
  --cr-color-gray-50: hsl(0 0% 97.5%);
@@ -535,6 +536,12 @@
535
536
  --cr-panel-border-color: var(--cr-color-neutral-200);
536
537
  --cr-panel-border-width: 1px;
537
538
 
539
+ /*
540
+ * Header
541
+ */
542
+
543
+ --cr-panel-background-color: var(--cr-color-neutral-0);
544
+
538
545
  /*
539
546
  * Tooltips
540
547
  */
@@ -26,7 +26,12 @@ const rules = computed(() => {
26
26
  </script>
27
27
 
28
28
  <template>
29
- <v-text-field :label="label" :name="name" :rules="rules"></v-text-field>
29
+ <v-text-field
30
+ :label="label"
31
+ :name="name"
32
+ :autofocus="autofocus"
33
+ :rules="rules"
34
+ ></v-text-field>
30
35
  </template>
31
36
 
32
37
  <style scoped></style>
@@ -32,6 +32,8 @@ defineProps<AlertProps>();
32
32
  @click="action.callback"
33
33
  >{{ action.name }}</x-btn
34
34
  >
35
+ <br v-if="details" />
36
+ <small v-if="details">{{ details }}</small>
35
37
  <slot />
36
38
  </v-alert>
37
39
  </template>
@@ -18,16 +18,20 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
18
  02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
19
  -->
20
20
  <script lang="ts" setup>
21
+ import { useSlots } from "vue";
22
+
21
23
  defineProps<{
22
24
  title: string;
23
25
  width: string | number | undefined;
24
26
  }>();
25
27
 
28
+ const slots = useSlots();
29
+
26
30
  // const innerIsActive = ref(props.isActive);
27
31
  </script>
28
32
 
29
33
  <template>
30
- <v-dialog :width="width">
34
+ <v-dialog :width="width" scrollable>
31
35
  <template #activator="{ props }">
32
36
  <span v-bind="props">
33
37
  <slot name="activator" />
@@ -38,7 +42,16 @@ defineProps<{
38
42
  <v-card-text>
39
43
  <slot name="default" />
40
44
  </v-card-text>
45
+ <v-card-actions v-if="slots.footer">
46
+ <slot name="footer" />
47
+ </v-card-actions>
41
48
  </v-card>
42
49
  </template>
43
50
  </v-dialog>
44
51
  </template>
52
+
53
+ <style scoped>
54
+ :deep(.v-card-actions) {
55
+ padding: var(--cr-spacing-large);
56
+ }
57
+ </style>
@@ -33,6 +33,7 @@ import { inject, onBeforeMount, ref, watch } from "vue";
33
33
  import { VTreeview } from "vuetify/labs/VTreeview";
34
34
  import type { CristalApp, PageData } from "@xwiki/cristal-api";
35
35
  import type { DocumentService } from "@xwiki/cristal-document-api";
36
+ import type { SpaceReference } from "@xwiki/cristal-model-api";
36
37
  import type {
37
38
  NavigationTreeNode,
38
39
  NavigationTreeSource,
@@ -45,7 +46,7 @@ type TreeItem = {
45
46
  title: string;
46
47
  href: string;
47
48
  children?: Array<TreeItem>;
48
- _location: string;
49
+ _location: SpaceReference;
49
50
  };
50
51
 
51
52
  type OnClickAction = (node: NavigationTreeNode) => void;
@@ -64,6 +65,7 @@ const tree: Ref<VTreeview | undefined> = ref(undefined);
64
65
 
65
66
  const activatedNodes: Ref<Array<string>> = ref(new Array<string>());
66
67
  const expandedNodes: Ref<Array<string>> = ref(new Array<string>());
68
+ var isExpanding: boolean = false;
67
69
 
68
70
  const props = defineProps<{
69
71
  clickAction?: OnClickAction;
@@ -80,59 +82,56 @@ onBeforeMount(async () => {
80
82
  _location: node.location,
81
83
  });
82
84
  }
83
- if (props.currentPage !== undefined) {
84
- await expandTree();
85
- }
85
+ await expandTree();
86
86
 
87
87
  documentService.registerDocumentChangeListener("delete", onDocumentDelete);
88
88
  documentService.registerDocumentChangeListener("update", onDocumentUpdate);
89
89
  });
90
90
 
91
- watch(
92
- () => props.currentPage,
93
- async () => {
94
- if (props.currentPage) {
95
- await expandTree();
96
- }
97
- },
98
- );
91
+ watch(() => props.currentPage, expandTree);
99
92
 
93
+ // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
94
+ // eslint-disable-next-line max-statements
100
95
  async function expandTree() {
101
- const newExpandedNodes = treeSource.getParentNodesId(props.currentPage);
102
- let i;
103
- let currentNodes = rootNodes.value;
104
- for (i = 0; i < newExpandedNodes.length - 1; i++) {
105
- if (currentNodes) {
106
- for (const node of currentNodes) {
107
- if (node.id == newExpandedNodes[i]) {
108
- if (node.children?.length == 0) {
109
- await lazyLoadChildren(node);
110
- }
111
- if (!expandedNodes.value.includes(node.id)) {
112
- expandedNodes.value.push(node.id);
96
+ if (props.currentPage && !isExpanding) {
97
+ isExpanding = true;
98
+ const newExpandedNodes = treeSource.getParentNodesId(props.currentPage);
99
+ let i;
100
+ let currentNodes = rootNodes.value;
101
+ for (i = 0; i < newExpandedNodes.length - 1; i++) {
102
+ if (currentNodes) {
103
+ for (const node of currentNodes) {
104
+ if (node.id == newExpandedNodes[i]) {
105
+ if (node.children?.length == 0) {
106
+ await lazyLoadChildren(node);
107
+ }
108
+ if (!expandedNodes.value.includes(node.id)) {
109
+ expandedNodes.value.push(node.id);
110
+ }
111
+ currentNodes = node.children!;
113
112
  }
114
- currentNodes = node.children!;
115
113
  }
116
114
  }
117
115
  }
118
- }
119
- if (currentNodes) {
120
- for (const node of currentNodes) {
121
- if (node.id == newExpandedNodes[i]) {
122
- activatedNodes.value = [node.id];
123
- // If we have a custom click action, we want to use it on dynamic
124
- // selection.
125
- if (props.clickAction) {
126
- props.clickAction({
127
- id: node.id,
128
- label: node.title,
129
- location: node._location,
130
- url: node.href,
131
- has_children: node.children !== undefined,
132
- });
116
+ if (currentNodes) {
117
+ for (const node of currentNodes) {
118
+ if (node.id == newExpandedNodes[i]) {
119
+ activatedNodes.value = [node.id];
120
+ // If we have a custom click action, we want to use it on dynamic
121
+ // selection.
122
+ if (props.clickAction) {
123
+ props.clickAction({
124
+ id: node.id,
125
+ label: node.title,
126
+ location: node._location,
127
+ url: node.href,
128
+ has_children: node.children !== undefined,
129
+ });
130
+ }
133
131
  }
134
132
  }
135
133
  }
134
+ isExpanding = false;
136
135
  }
137
136
  }
138
137
 
@@ -163,6 +162,8 @@ function clearSelection() {
163
162
  }
164
163
  }
165
164
 
165
+ // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
166
+ // eslint-disable-next-line max-statements
166
167
  async function onDocumentDelete(page: PageData) {
167
168
  const parents = treeSource.getParentNodesId(page);
168
169
  let currentItems: TreeItem[] | undefined = rootNodes.value;
@@ -182,12 +183,15 @@ async function onDocumentDelete(page: PageData) {
182
183
  }
183
184
  }
184
185
 
186
+ // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
187
+ // eslint-disable-next-line max-statements
185
188
  async function onDocumentUpdate(page: PageData) {
186
189
  const parents = treeSource.getParentNodesId(page);
187
190
  let currentParent: string | undefined = undefined;
188
191
  let currentItems: TreeItem[] | undefined = rootNodes.value;
192
+ let notFound = false;
189
193
 
190
- while (currentItems) {
194
+ currentItemsLoop: while (currentItems && !notFound) {
191
195
  for (const i of currentItems.keys()) {
192
196
  if (currentItems[i].id == parents[0]) {
193
197
  if (parents.length == 1) {
@@ -203,31 +207,35 @@ async function onDocumentUpdate(page: PageData) {
203
207
  }
204
208
  } else {
205
209
  currentParent = currentItems[i].id;
210
+ if (!currentItems[i].children) {
211
+ currentItems[i].children = [];
212
+ }
206
213
  currentItems = currentItems[i].children;
207
214
  parents.shift();
208
- break;
215
+ continue currentItemsLoop;
209
216
  }
210
217
  }
211
218
  }
219
+ notFound = true;
220
+ }
212
221
 
213
- // New page
214
- const newItems = await treeSource.getChildNodes(
215
- currentParent ? currentParent : "",
216
- );
217
- newItemsLoop: for (const newItem of newItems) {
218
- for (const i of currentItems!.keys()) {
219
- if (newItem.id == currentItems![i].id) {
220
- continue newItemsLoop;
221
- }
222
+ // New page
223
+ const newItems = await treeSource.getChildNodes(
224
+ currentParent ? currentParent : "",
225
+ );
226
+ newItemsLoop: for (const newItem of newItems) {
227
+ for (const i of currentItems!.keys()) {
228
+ if (newItem.id == currentItems![i].id) {
229
+ continue newItemsLoop;
222
230
  }
223
- currentItems!.push({
224
- id: newItem.id,
225
- title: newItem.label,
226
- href: newItem.url,
227
- children: newItem.has_children ? [] : undefined,
228
- _location: newItem.location,
229
- });
230
231
  }
232
+ currentItems!.push({
233
+ id: newItem.id,
234
+ title: newItem.label,
235
+ href: newItem.url,
236
+ children: newItem.has_children ? [] : undefined,
237
+ _location: newItem.location,
238
+ });
231
239
  }
232
240
  }
233
241
  </script>
package/tsconfig.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
- "compilerOptions": {
3
- "rootDir" : "src",
4
- "outDir" : "dist",
5
- "isolatedDeclarations": false
6
- },
7
- "extends": "./../../tsconfig.json",
8
- "include": ["./src/index.ts", "./src/**/*"],
9
- "exclude": ["**/*.spec.ts", "**/*.test.ts"]
2
+ "compilerOptions": {
3
+ "rootDir": "src",
4
+ "outDir": "dist",
5
+ "isolatedDeclarations": false
6
+ },
7
+ "extends": "./../../tsconfig.json",
8
+ "include": [
9
+ "./src/index.ts",
10
+ "./src/**/*"
11
+ ],
12
+ "exclude": [
13
+ "**/*.spec.ts",
14
+ "**/*.test.ts"
15
+ ]
10
16
  }