@xwiki/cristal-dsvuetify 0.15.0 → 0.17.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 (39) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/{index-BAakw3UY.js → index-ptn5-s1m.js} +8120 -7532
  3. package/dist/index-ptn5-s1m.js.map +1 -0
  4. package/dist/index.es.js +5 -5
  5. package/dist/index.umd.js +10 -10
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/vue/form/x-checkbox.vue.d.ts +3 -3
  8. package/dist/vue/form/x-navigation-tree-select.vue.d.ts +3 -1
  9. package/dist/vue/x-navigation-tree.vue.d.ts +3 -1
  10. package/dist/{x-checkbox-Fro597Ax.js → x-checkbox-DkOHWnw9.js} +7 -7
  11. package/dist/{x-checkbox-Fro597Ax.js.map → x-checkbox-DkOHWnw9.js.map} +1 -1
  12. package/dist/{x-file-input-CvH0AC3G.js → x-file-input-BI6tqzny.js} +7 -6
  13. package/dist/{x-file-input-CvH0AC3G.js.map → x-file-input-BI6tqzny.js.map} +1 -1
  14. package/dist/{x-form-DCHdDC6W.js → x-form-BVMvR_NO.js} +2 -2
  15. package/dist/{x-form-DCHdDC6W.js.map → x-form-BVMvR_NO.js.map} +1 -1
  16. package/dist/x-navigation-tree-BsHJIZki.js +543 -0
  17. package/dist/x-navigation-tree-BsHJIZki.js.map +1 -0
  18. package/dist/x-navigation-tree-select-B8G-rNmk.js +99 -0
  19. package/dist/x-navigation-tree-select-B8G-rNmk.js.map +1 -0
  20. package/dist/{x-tab-group-Bp7V46k9.js → x-tab-group-D1jmHXyJ.js} +2 -2
  21. package/dist/x-tab-group-D1jmHXyJ.js.map +1 -0
  22. package/dist/x-text-field-DutyqCkJ.js +45 -0
  23. package/dist/{x-text-field-2Sv6HUGW.js.map → x-text-field-DutyqCkJ.js.map} +1 -1
  24. package/package.json +15 -15
  25. package/src/components/componentsInit.ts +1 -1
  26. package/src/components/vuetifyDesignSystemLoader.ts +0 -1
  27. package/src/vue/__tests__/utils/vuetify.ts +0 -1
  28. package/src/vue/form/x-checkbox.vue +1 -1
  29. package/src/vue/form/x-navigation-tree-select.vue +6 -1
  30. package/src/vue/form/x-text-field.vue +1 -0
  31. package/src/vue/x-navigation-tree.vue +30 -14
  32. package/src/vue/x-tab-group.vue +2 -2
  33. package/dist/index-BAakw3UY.js.map +0 -1
  34. package/dist/x-navigation-tree-D_fUW-gW.js +0 -520
  35. package/dist/x-navigation-tree-D_fUW-gW.js.map +0 -1
  36. package/dist/x-navigation-tree-select-DaiYF3ux.js +0 -95
  37. package/dist/x-navigation-tree-select-DaiYF3ux.js.map +0 -1
  38. package/dist/x-tab-group-Bp7V46k9.js.map +0 -1
  39. package/dist/x-text-field-2Sv6HUGW.js +0 -43
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-navigation-tree-BsHJIZki.js","sources":["../../api/src/XNavigationTree.ts","../../../node_modules/.pnpm/vuetify@3.8.0_typescript@5.8.2_vite-plugin-vuetify@2.1.0_vue@3.5.13_typescript@5.8.2_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewGroup.js","../../../node_modules/.pnpm/vuetify@3.8.0_typescript@5.8.2_vite-plugin-vuetify@2.1.0_vue@3.5.13_typescript@5.8.2_/node_modules/vuetify/lib/labs/VTreeview/shared.js","../../../node_modules/.pnpm/vuetify@3.8.0_typescript@5.8.2_vite-plugin-vuetify@2.1.0_vue@3.5.13_typescript@5.8.2_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewItem.js","../../../node_modules/.pnpm/vuetify@3.8.0_typescript@5.8.2_vite-plugin-vuetify@2.1.0_vue@3.5.13_typescript@5.8.2_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewChildren.js","../../../node_modules/.pnpm/vuetify@3.8.0_typescript@5.8.2_vite-plugin-vuetify@2.1.0_vue@3.5.13_typescript@5.8.2_/node_modules/vuetify/lib/labs/VTreeview/VTreeview.js","../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\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type { NavigationTreeNode } from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * @since 0.15\n */\ntype NavigationTreeProps = {\n clickAction?: (node: NavigationTreeNode) => void;\n currentPageReference?: DocumentReference;\n /**\n * Whether to include terminal pages in the tree (default: true).\n * @since 0.16\n */\n includeTerminals?: boolean;\n};\n\n/**\n * Default props values for NavigationTree implementations.\n * @since 0.16\n */\nconst navigationTreePropsDefaults = {\n includeTerminals: true,\n};\n\nexport type { NavigationTreeProps };\nexport { navigationTreePropsDefaults };\n","import { Fragment as _Fragment, createVNode as _createVNode, mergeProps as _mergeProps } from \"vue\";\n// Components\nimport { VDefaultsProvider } from \"../../components/VDefaultsProvider/index.js\";\nimport { makeVListGroupProps, VListGroup } from \"../../components/VList/VListGroup.js\"; // Utilities\nimport { computed, ref } from 'vue';\nimport { genericComponent, omit, propsFactory, useRender } from \"../../util/index.js\"; // Types\nexport const makeVTreeviewGroupProps = propsFactory({\n ...omit(makeVListGroupProps({\n collapseIcon: '$treeviewCollapse',\n expandIcon: '$treeviewExpand'\n }), ['subgroup'])\n}, 'VTreeviewGroup');\nexport const VTreeviewGroup = genericComponent()({\n name: 'VTreeviewGroup',\n props: makeVTreeviewGroupProps(),\n setup(props, _ref) {\n let {\n slots\n } = _ref;\n const vListGroupRef = ref();\n const toggleIcon = computed(() => vListGroupRef.value?.isOpen ? props.collapseIcon : props.expandIcon);\n const activatorDefaults = computed(() => ({\n VTreeviewItem: {\n prependIcon: undefined,\n appendIcon: undefined,\n active: vListGroupRef.value?.isOpen,\n toggleIcon: toggleIcon.value\n }\n }));\n useRender(() => {\n const listGroupProps = VListGroup.filterProps(props);\n return _createVNode(VListGroup, _mergeProps(listGroupProps, {\n \"ref\": vListGroupRef,\n \"class\": ['v-treeview-group', props.class],\n \"subgroup\": true\n }), {\n ...slots,\n activator: slots.activator ? slotProps => _createVNode(_Fragment, null, [_createVNode(VDefaultsProvider, {\n \"defaults\": activatorDefaults.value\n }, {\n default: () => [slots.activator?.(slotProps)]\n })]) : undefined\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeviewGroup.js.map","// Types\n\nexport const VTreeviewSymbol = Symbol.for('vuetify:v-treeview');\n//# sourceMappingURL=shared.js.map","import { Fragment as _Fragment, createVNode as _createVNode, mergeProps as _mergeProps } from \"vue\";\n// Styles\nimport \"./VTreeviewItem.css\";\n\n// Components\nimport { VBtn } from \"../../components/VBtn/index.js\";\nimport { VListItemAction } from \"../../components/VList/index.js\";\nimport { makeVListItemProps, VListItem } from \"../../components/VList/VListItem.js\";\nimport { VProgressCircular } from \"../../components/VProgressCircular/index.js\"; // Composables\nimport { IconValue } from \"../../composables/icons.js\"; // Utilities\nimport { computed, inject, ref, toRaw } from 'vue';\nimport { genericComponent, omit, propsFactory, useRender } from \"../../util/index.js\"; // Types\nimport { VTreeviewSymbol } from \"./shared.js\";\nexport const makeVTreeviewItemProps = propsFactory({\n loading: Boolean,\n toggleIcon: IconValue,\n ...makeVListItemProps({\n slim: true\n })\n}, 'VTreeviewItem');\nexport const VTreeviewItem = genericComponent()({\n name: 'VTreeviewItem',\n props: makeVTreeviewItemProps(),\n emits: {\n toggleExpand: value => true\n },\n setup(props, _ref) {\n let {\n slots,\n emit\n } = _ref;\n const visibleIds = inject(VTreeviewSymbol, {\n visibleIds: ref()\n }).visibleIds;\n const vListItemRef = ref();\n const isActivatableGroupActivator = computed(() => vListItemRef.value?.root.activatable.value && vListItemRef.value?.isGroupActivator);\n const vListItemRefIsClickable = computed(() => vListItemRef.value?.link.isClickable.value || props.value != null && !!vListItemRef.value?.list);\n const isClickable = computed(() => !props.disabled && props.link !== false && (props.link || vListItemRefIsClickable.value || isActivatableGroupActivator.value));\n const isFiltered = computed(() => visibleIds.value && !visibleIds.value.has(toRaw(vListItemRef.value?.id)));\n function activateGroupActivator(e) {\n if (isClickable.value && isActivatableGroupActivator.value) {\n vListItemRef.value?.activate(!vListItemRef.value?.isActivated, e);\n }\n }\n function onClickAction(e) {\n e.preventDefault();\n emit('toggleExpand', e);\n }\n useRender(() => {\n const listItemProps = omit(VListItem.filterProps(props), ['onClick']);\n const hasPrepend = slots.prepend || props.toggleIcon;\n return _createVNode(VListItem, _mergeProps({\n \"ref\": vListItemRef\n }, listItemProps, {\n \"active\": vListItemRef.value?.isActivated,\n \"class\": ['v-treeview-item', {\n 'v-treeview-item--activatable-group-activator': isActivatableGroupActivator.value,\n 'v-treeview-item--filtered': isFiltered.value\n }, props.class],\n \"ripple\": false,\n \"onClick\": props.onClick ?? activateGroupActivator\n }), {\n ...slots,\n prepend: hasPrepend ? slotProps => {\n return _createVNode(_Fragment, null, [_createVNode(VListItemAction, {\n \"start\": false\n }, {\n default: () => [props.toggleIcon ? _createVNode(VBtn, {\n \"density\": \"compact\",\n \"icon\": props.toggleIcon,\n \"loading\": props.loading,\n \"variant\": \"text\",\n \"onClick\": onClickAction\n }, {\n loader() {\n return _createVNode(VProgressCircular, {\n \"indeterminate\": \"disable-shrink\",\n \"size\": \"20\",\n \"width\": \"2\"\n }, null);\n }\n }) : _createVNode(\"div\", {\n \"class\": \"v-treeview-item__level\"\n }, null)]\n }), slots.prepend?.(slotProps)]);\n } : undefined\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeviewItem.js.map","import { Fragment as _Fragment, createVNode as _createVNode, mergeProps as _mergeProps } from \"vue\";\n// Components\nimport { VTreeviewGroup } from \"./VTreeviewGroup.js\";\nimport { VTreeviewItem } from \"./VTreeviewItem.js\";\nimport { VCheckboxBtn } from \"../../components/VCheckbox/index.js\"; // Composables\nimport { makeDensityProps } from \"../../composables/density.js\";\nimport { IconValue } from \"../../composables/icons.js\"; // Utilities\nimport { computed, reactive, toRaw, withModifiers } from 'vue';\nimport { genericComponent, propsFactory } from \"../../util/index.js\"; // Types\nexport const makeVTreeviewChildrenProps = propsFactory({\n disabled: Boolean,\n loadChildren: Function,\n loadingIcon: {\n type: String,\n default: '$loading'\n },\n items: Array,\n openOnClick: {\n type: Boolean,\n default: undefined\n },\n indeterminateIcon: {\n type: IconValue,\n default: '$checkboxIndeterminate'\n },\n falseIcon: IconValue,\n trueIcon: IconValue,\n returnObject: Boolean,\n selectable: Boolean,\n selectedColor: String,\n selectStrategy: [String, Function, Object],\n ...makeDensityProps()\n}, 'VTreeviewChildren');\nexport const VTreeviewChildren = genericComponent()({\n name: 'VTreeviewChildren',\n props: makeVTreeviewChildrenProps(),\n setup(props, _ref) {\n let {\n slots\n } = _ref;\n const isLoading = reactive(new Set());\n const isClickOnOpen = computed(() => !props.disabled && (props.openOnClick != null ? props.openOnClick : props.selectable));\n async function checkChildren(item) {\n try {\n if (!props.items?.length || !props.loadChildren) return;\n if (item?.children?.length === 0) {\n isLoading.add(item.value);\n await props.loadChildren(item.raw);\n }\n } finally {\n isLoading.delete(item.value);\n }\n }\n function selectItem(select, isSelected) {\n if (props.selectable) {\n select(!isSelected);\n }\n }\n return () => slots.default?.() ?? props.items?.map(item => {\n const {\n children,\n props: itemProps\n } = item;\n const loading = isLoading.has(item.value);\n const slotsWithItem = {\n prepend: slotProps => _createVNode(_Fragment, null, [props.selectable && (!children || children && !['leaf', 'single-leaf'].includes(props.selectStrategy)) && _createVNode(\"div\", null, [_createVNode(VCheckboxBtn, {\n \"key\": item.value,\n \"modelValue\": slotProps.isSelected,\n \"disabled\": props.disabled,\n \"loading\": loading,\n \"color\": props.selectedColor,\n \"density\": props.density,\n \"indeterminate\": slotProps.isIndeterminate,\n \"indeterminateIcon\": props.indeterminateIcon,\n \"falseIcon\": props.falseIcon,\n \"trueIcon\": props.trueIcon,\n \"onClick\": withModifiers(() => selectItem(slotProps.select, slotProps.isSelected), ['stop']),\n \"onKeydown\": e => {\n if (!['Enter', 'Space'].includes(e.key)) return;\n e.stopPropagation();\n selectItem(slotProps.select, slotProps.isSelected);\n }\n }, null)]), slots.prepend?.({\n ...slotProps,\n item: item.raw,\n internalItem: item\n })]),\n append: slots.append ? slotProps => slots.append?.({\n ...slotProps,\n item: item.raw,\n internalItem: item\n }) : undefined,\n title: slots.title ? slotProps => slots.title?.({\n ...slotProps,\n item: item.raw,\n internalItem: item\n }) : undefined,\n subtitle: slots.subtitle ? slotProps => slots.subtitle?.({\n ...slotProps,\n item: item.raw,\n internalItem: item\n }) : undefined\n };\n const treeviewGroupProps = VTreeviewGroup.filterProps(itemProps);\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props);\n return children ? _createVNode(VTreeviewGroup, _mergeProps(treeviewGroupProps, {\n \"value\": props.returnObject ? item.raw : treeviewGroupProps?.value\n }), {\n activator: _ref2 => {\n let {\n props: activatorProps\n } = _ref2;\n const listItemProps = {\n ...itemProps,\n ...activatorProps,\n value: itemProps?.value,\n onToggleExpand: [() => checkChildren(item), activatorProps.onClick],\n onClick: isClickOnOpen.value ? [() => checkChildren(item), activatorProps.onClick] : undefined\n };\n return _createVNode(VTreeviewItem, _mergeProps(listItemProps, {\n \"value\": props.returnObject ? item.raw : itemProps.value,\n \"loading\": loading\n }), slotsWithItem);\n },\n default: () => _createVNode(VTreeviewChildren, _mergeProps(treeviewChildrenProps, {\n \"items\": children,\n \"returnObject\": props.returnObject\n }), slots)\n }) : slots.item?.({\n props: itemProps,\n item: item.raw,\n internalItem: item\n }) ?? _createVNode(VTreeviewItem, _mergeProps(itemProps, {\n \"value\": props.returnObject ? toRaw(item.raw) : itemProps.value\n }), slotsWithItem);\n });\n }\n});\n//# sourceMappingURL=VTreeviewChildren.js.map","import { mergeProps as _mergeProps, createVNode as _createVNode } from \"vue\";\n// Components\nimport { makeVTreeviewChildrenProps, VTreeviewChildren } from \"./VTreeviewChildren.js\";\nimport { makeVListProps, useListItems, VList } from \"../../components/VList/VList.js\"; // Composables\nimport { provideDefaults } from \"../../composables/defaults.js\";\nimport { makeFilterProps, useFilter } from \"../../composables/filter.js\";\nimport { useProxiedModel } from \"../../composables/proxiedModel.js\"; // Utilities\nimport { computed, provide, ref, toRaw, toRef } from 'vue';\nimport { genericComponent, omit, propsFactory, useRender } from \"../../util/index.js\"; // Types\nimport { VTreeviewSymbol } from \"./shared.js\";\nfunction flatten(items) {\n let flat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n for (const item of items) {\n flat.push(item);\n if (item.children) flatten(item.children, flat);\n }\n return flat;\n}\nexport const makeVTreeviewProps = propsFactory({\n fluid: Boolean,\n openAll: Boolean,\n search: String,\n ...makeFilterProps({\n filterKeys: ['title']\n }),\n ...makeVTreeviewChildrenProps(),\n ...omit(makeVListProps({\n collapseIcon: '$treeviewCollapse',\n expandIcon: '$treeviewExpand',\n slim: true\n }), ['itemType', 'nav', 'openStrategy']),\n modelValue: {\n type: Array,\n default: () => []\n }\n}, 'VTreeview');\nexport const VTreeview = genericComponent()({\n name: 'VTreeview',\n props: makeVTreeviewProps(),\n emits: {\n 'update:opened': val => true,\n 'update:activated': val => true,\n 'update:selected': val => true,\n 'update:modelValue': val => true,\n 'click:open': value => true,\n 'click:select': value => true\n },\n setup(props, _ref) {\n let {\n slots\n } = _ref;\n const {\n items\n } = useListItems(props);\n const activeColor = toRef(props, 'activeColor');\n const baseColor = toRef(props, 'baseColor');\n const color = toRef(props, 'color');\n const activated = useProxiedModel(props, 'activated');\n const model = useProxiedModel(props, 'modelValue');\n const _selected = useProxiedModel(props, 'selected', props.modelValue);\n const selected = computed({\n get: () => _selected.value,\n set(val) {\n _selected.value = val;\n model.value = val;\n }\n });\n const vListRef = ref();\n const opened = computed(() => props.openAll ? openAll(items.value) : props.opened);\n const flatItems = computed(() => flatten(items.value));\n const search = toRef(props, 'search');\n const {\n filteredItems\n } = useFilter(props, flatItems, search);\n const visibleIds = computed(() => {\n if (!search.value) return null;\n const getPath = vListRef.value?.getPath;\n if (!getPath) return null;\n return new Set(filteredItems.value.flatMap(item => {\n const itemVal = props.returnObject ? item.raw : item.props.value;\n return [...getPath(itemVal), ...getChildren(itemVal)].map(toRaw);\n }));\n });\n function getChildren(id) {\n const arr = [];\n const queue = (vListRef.value?.children.get(id) ?? []).slice();\n while (queue.length) {\n const child = queue.shift();\n if (!child) continue;\n arr.push(child);\n queue.push(...(vListRef.value?.children.get(child) ?? []).slice());\n }\n return arr;\n }\n function openAll(items) {\n let ids = [];\n for (const i of items) {\n if (!i.children) continue;\n ids.push(props.returnObject ? toRaw(i.raw) : i.value);\n if (i.children) {\n ids = ids.concat(openAll(i.children));\n }\n }\n return ids;\n }\n provide(VTreeviewSymbol, {\n visibleIds\n });\n provideDefaults({\n VTreeviewGroup: {\n activeColor,\n baseColor,\n color,\n collapseIcon: toRef(props, 'collapseIcon'),\n expandIcon: toRef(props, 'expandIcon')\n },\n VTreeviewItem: {\n activeClass: toRef(props, 'activeClass'),\n activeColor,\n baseColor,\n color,\n density: toRef(props, 'density'),\n disabled: toRef(props, 'disabled'),\n lines: toRef(props, 'lines'),\n variant: toRef(props, 'variant')\n }\n });\n useRender(() => {\n const listProps = VList.filterProps(props);\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props);\n return _createVNode(VList, _mergeProps({\n \"ref\": vListRef\n }, listProps, {\n \"class\": ['v-treeview', {\n 'v-treeview--fluid': props.fluid\n }, props.class],\n \"open-strategy\": \"multiple\",\n \"style\": props.style,\n \"opened\": opened.value,\n \"activated\": activated.value,\n \"onUpdate:activated\": $event => activated.value = $event,\n \"selected\": selected.value,\n \"onUpdate:selected\": $event => selected.value = $event\n }), {\n default: () => [_createVNode(VTreeviewChildren, _mergeProps(treeviewChildrenProps, {\n \"density\": props.density,\n \"returnObject\": props.returnObject,\n \"items\": items.value\n }), slots)]\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeview.js.map","<!--\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 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/cristal-dsapi\";\nimport { inject, onBeforeMount, ref, watch } from \"vue\";\nimport { VTreeview } from \"vuetify/labs/VTreeview\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type { NavigationTreeProps } from \"@xwiki/cristal-dsapi\";\nimport type {\n DocumentReference,\n SpaceReference,\n} from \"@xwiki/cristal-model-api\";\nimport type {\n NavigationTreeSource,\n NavigationTreeSourceProvider,\n} from \"@xwiki/cristal-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;\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 for (const node of await getChildNodes(\"\")) {\n rootNodes.value.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 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 );\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(page, props.includeTerminals);\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(page, props.includeTerminals);\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 = treeSource.getParentNodesId(\n props.currentPageReference!,\n props.includeTerminals,\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":["navigationTreePropsDefaults","makeVTreeviewGroupProps","propsFactory","omit","makeVListGroupProps","VTreeviewGroup","genericComponent","props","_ref","slots","vListGroupRef","ref","toggleIcon","computed","_a","activatorDefaults","useRender","listGroupProps","VListGroup","_createVNode","_mergeProps","slotProps","_Fragment","VDefaultsProvider","VTreeviewSymbol","makeVTreeviewItemProps","IconValue","makeVListItemProps","VTreeviewItem","value","emit","visibleIds","inject","vListItemRef","isActivatableGroupActivator","_b","vListItemRefIsClickable","isClickable","isFiltered","toRaw","activateGroupActivator","e","onClickAction","listItemProps","VListItem","hasPrepend","VListItemAction","VBtn","VProgressCircular","makeVTreeviewChildrenProps","makeDensityProps","VTreeviewChildren","isLoading","reactive","isClickOnOpen","checkChildren","item","selectItem","select","isSelected","children","itemProps","loading","slotsWithItem","VCheckboxBtn","withModifiers","treeviewGroupProps","treeviewChildrenProps","_ref2","activatorProps","flatten","items","flat","makeVTreeviewProps","makeFilterProps","makeVListProps","VTreeview","val","useListItems","activeColor","toRef","baseColor","color","activated","useProxiedModel","model","_selected","selected","vListRef","opened","openAll","flatItems","search","filteredItems","useFilter","getPath","itemVal","getChildren","id","arr","queue","child","ids","i","provide","provideDefaults","listProps","VList","$event","cristal","documentService","treeSource","rootNodes","activatedNodes","expandedNodes","isExpanding","__props","onBeforeMount","node","getChildNodes","expandTree","onDocumentDelete","onDocumentUpdate","watch","newExpandedNodes","currentNodes","lazyLoadChildren","treeItem","childNodes","clearSelection","page","parents","currentItem","currentItemChildren","notFound","currentItemsLoop","currentParent","currentItems","isRoot","newItems","newItem","currentPageParents","newItemsLoop","c"],"mappings":";;;AAwCA,MAAMA,KAA8B;AAAA,EAClC,kBAAkB;AACpB,GCpCaC,KAA0BC,EAAa;AAAA,EAClD,GAAGC,EAAKC,GAAoB;AAAA,IAC1B,cAAc;AAAA,IACd,YAAY;AAAA,EAChB,CAAG,GAAG,CAAC,UAAU,CAAC;AAClB,GAAG,gBAAgB,GACNC,IAAiBC,EAAgB,EAAG;AAAA,EAC/C,MAAM;AAAA,EACN,OAAOL,GAAyB;AAAA,EAChC,MAAMM,GAAOC,GAAM;AACjB,QAAI;AAAA,MACF,OAAAC;AAAA,IACN,IAAQD;AACJ,UAAME,IAAgBC,EAAK,GACrBC,IAAaC,EAAS,MAAA;;AAAM,cAAAC,IAAAJ,EAAc,UAAd,QAAAI,EAAqB,SAASP,EAAM,eAAeA,EAAM;AAAA,KAAU,GAC/FQ,IAAoBF,EAAS,MAAO;;AAAA;AAAA,QACxC,eAAe;AAAA,UACb,aAAa;AAAA,UACb,YAAY;AAAA,UACZ,SAAQC,IAAAJ,EAAc,UAAd,gBAAAI,EAAqB;AAAA,UAC7B,YAAYF,EAAW;AAAA,QAC/B;AAAA,MACA;AAAA,KAAM;AACF,WAAAI,EAAU,MAAM;AACd,YAAMC,IAAiBC,EAAW,YAAYX,CAAK;AACnD,aAAOY,EAAaD,GAAYE,EAAYH,GAAgB;AAAA,QAC1D,KAAOP;AAAA,QACP,OAAS,CAAC,oBAAoBH,EAAM,KAAK;AAAA,QACzC,UAAY;AAAA,MACpB,CAAO,GAAG;AAAA,QACF,GAAGE;AAAA,QACH,WAAWA,EAAM,YAAY,CAAAY,MAAaF,EAAaG,GAAW,MAAM,CAACH,EAAaI,IAAmB;AAAA,UACvG,UAAYR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,MAAMH,EAAclC,CAAC,EAAE;AACxB,qBAAAuC;AAGb,QAAAL,EAAc,KAAK;AAAA,UACjB,IAAIG,EAAQ;AAAA,UACZ,OAAOA,EAAQ;AAAA,UACf,MAAMA,EAAQ;AAAA,UACd,UAAUA,EAAQ,eAAe,CAAA,IAAK;AAAA,UACtC,WAAWA,EAAQ;AAAA,UACnB,cAAcA,EAAQ;AAAA,QAAA,CACvB,GAECC,EAAmB,SAAS,KAC5BA,EAAmBA,EAAmB,SAAS,CAAC,MAAMD,EAAQ,OAG/C3B,EAAA,QAAQ,CAAC2B,EAAQ,EAAE;AAAA,MACpC;AAAA,IACF;AAGF,mBAAerB,EAAcrB,GAAY;AACvC,cAAQ,MAAMa,EAAW,cAAcb,CAAE,GAAG;AAAA,QAC1C,CAAC6C,MAAMxI,EAAM,oBAAoB,CAACwI,EAAE;AAAA,MACtC;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[1,2,3,4,5]}
@@ -0,0 +1,99 @@
1
+ import { defineComponent as C, mergeModels as D, mergeDefaults as X, inject as k, useModel as w, ref as v, onMounted as x, resolveComponent as i, openBlock as B, createElementBlock as N, Fragment as H, createVNode as t, unref as n, withCtx as a, createTextVNode as h, toDisplayString as y } from "vue";
2
+ import { t as M } from "./translations-k4crOAds.js";
3
+ import S from "./x-breadcrumb-C2iUd4Sf.js";
4
+ import { SpaceReference as F } from "@xwiki/cristal-model-api";
5
+ import { useI18n as I } from "vue-i18n";
6
+ import { a as j } from "./index-ptn5-s1m.js";
7
+ import { _ as z } from "./_plugin-vue_export-helper-CHgC5LLL.js";
8
+ const A = {
9
+ includeTerminals: !1
10
+ }, E = /* @__PURE__ */ C({
11
+ __name: "x-navigation-tree-select",
12
+ props: /* @__PURE__ */ D(/* @__PURE__ */ X({
13
+ label: {},
14
+ help: {},
15
+ currentPageReference: {},
16
+ modelValue: {},
17
+ includeTerminals: { type: Boolean }
18
+ }, A), {
19
+ modelValue: {},
20
+ modelModifiers: {}
21
+ }),
22
+ emits: ["update:modelValue"],
23
+ setup(m) {
24
+ const d = k("cristal"), f = d.getContainer().get("PageHierarchyResolverProvider").get(), _ = d.getContainer().get("ModelReferenceHandlerProvider").get(), { t: c } = I({
25
+ messages: M
26
+ }), s = m, p = w(m, "modelValue"), u = v(!1), o = v([]);
27
+ let l;
28
+ x(async () => {
29
+ l = s.currentPageReference, p.value = s.currentPageReference.space, o.value = await f.getPageHierarchy(
30
+ s.currentPageReference.space
31
+ );
32
+ });
33
+ async function b(e) {
34
+ l = _.createDocumentReference(
35
+ e.location.names[e.location.names.length - 1],
36
+ new F(e.location.wiki, ...e.location.names.slice(0, -1))
37
+ ), p.value = e.location, o.value = await f.getPageHierarchy(l);
38
+ }
39
+ return (e, r) => {
40
+ const P = i("x-btn"), V = i("XNavigationTree"), R = i("XBtn"), T = i("XDialog");
41
+ return B(), N(H, null, [
42
+ t(n(j), {
43
+ label: e.label,
44
+ hint: e.help,
45
+ "persistent-hint": e.help !== void 0,
46
+ active: o.value.length > 0,
47
+ readonly: ""
48
+ }, {
49
+ default: a(() => [
50
+ t(S, { items: o.value }, null, 8, ["items"])
51
+ ]),
52
+ _: 1
53
+ }, 8, ["label", "hint", "persistent-hint", "active"]),
54
+ t(T, {
55
+ modelValue: u.value,
56
+ "onUpdate:modelValue": r[1] || (r[1] = (g) => u.value = g),
57
+ width: "auto",
58
+ title: n(c)("vuetify.tree.select.location.label")
59
+ }, {
60
+ activator: a(() => [
61
+ t(P, {
62
+ id: "change-page-location-button",
63
+ size: "small",
64
+ color: "secondary"
65
+ }, {
66
+ default: a(() => [
67
+ h(y(n(c)("vuetify.tree.select.location.label")), 1)
68
+ ]),
69
+ _: 1
70
+ })
71
+ ]),
72
+ default: a(() => [
73
+ t(V, {
74
+ "current-page-reference": n(l),
75
+ "click-action": b,
76
+ "include-terminals": e.includeTerminals
77
+ }, null, 8, ["current-page-reference", "include-terminals"])
78
+ ]),
79
+ footer: a(() => [
80
+ t(R, {
81
+ variant: "primary",
82
+ onClick: r[0] || (r[0] = (g) => u.value = !1)
83
+ }, {
84
+ default: a(() => [
85
+ h(y(n(c)("vuetify.tree.select.location.select")), 1)
86
+ ]),
87
+ _: 1
88
+ })
89
+ ]),
90
+ _: 1
91
+ }, 8, ["modelValue", "title"])
92
+ ], 64);
93
+ };
94
+ }
95
+ }), O = /* @__PURE__ */ z(E, [["__scopeId", "data-v-bc4a5612"]]);
96
+ export {
97
+ O as default
98
+ };
99
+ //# sourceMappingURL=x-navigation-tree-select-B8G-rNmk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-navigation-tree-select-B8G-rNmk.js","sources":["../../api/src/XNavigationTreeSelect.ts","../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\nimport type {\n DocumentReference,\n SpaceReference,\n} from \"@xwiki/cristal-model-api\";\n\n/**\n * @since 0.15\n */\ntype NavigationTreeSelectProps = {\n label: string;\n help?: string;\n currentPageReference?: DocumentReference;\n modelValue?: SpaceReference;\n /**\n * Whether to include terminal pages as select options (default: false).\n * @since 0.16\n */\n includeTerminals?: boolean;\n};\n\n/**\n * Default props values for NavigationTreeSelect implementations.\n * @since 0.16\n */\nconst navigationTreeSelectPropsDefaults = {\n includeTerminals: false,\n};\n\nexport type { NavigationTreeSelectProps };\nexport { navigationTreeSelectPropsDefaults };\n","<!--\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 setup lang=\"ts\">\nimport messages from \"../../translations\";\nimport XBreadcrumb from \"../x-breadcrumb.vue\";\nimport { navigationTreeSelectPropsDefaults } from \"@xwiki/cristal-dsapi\";\nimport { SpaceReference } from \"@xwiki/cristal-model-api\";\nimport { inject, onMounted, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport { VTextField } from \"vuetify/components/VTextField\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { NavigationTreeSelectProps } from \"@xwiki/cristal-dsapi\";\nimport type {\n PageHierarchyItem,\n PageHierarchyResolver,\n PageHierarchyResolverProvider,\n} from \"@xwiki/cristal-hierarchy-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type {\n ModelReferenceHandler,\n ModelReferenceHandlerProvider,\n} from \"@xwiki/cristal-model-reference-api\";\nimport type { NavigationTreeNode } from \"@xwiki/cristal-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>();\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 );\n});\n\nasync function treeNodeClickAction(node: NavigationTreeNode) {\n selectedPage = referenceHandler.createDocumentReference(\n node.location.names[node.location.names.length - 1],\n new SpaceReference(node.location.wiki, ...node.location.names.slice(0, -1)),\n );\n model.value = node.location;\n hierarchy.value = await hierarchyResolver.getPageHierarchy(selectedPage);\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 ></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":["navigationTreeSelectPropsDefaults","cristal","inject","hierarchyResolver","referenceHandler","t","useI18n","messages","props","__props","model","_useModel","openedLocationDialog","ref","hierarchy","selectedPage","onMounted","treeNodeClickAction","node","SpaceReference"],"mappings":";;;;;;;AA4CA,MAAMA,IAAoC;AAAA,EACxC,kBAAkB;AACpB;;;;;;;;;;;;;;ACJM,UAAAC,IAAsBC,EAAmB,SAAS,GAClDC,IAA2CF,EAC9C,aAAA,EACA,IAAmC,+BAA+B,EAClE,IAAI,GACDG,IAA0CH,EAC7C,aAAA,EACA,IAAmC,+BAA+B,EAClE,IAAI,GAED,EAAE,GAAAI,EAAE,IAAIC,EAAQ;AAAA,MACpBC,UAAAA;AAAAA,IAAA,CACD,GACKC,IAAQC,GAIRC,IAAQC,iBAA4B,GAEpCC,IAAqCC,EAAI,EAAK,GAC9CC,IAA2CD,EAAI,EAAE;AACnD,QAAAE;AAEJ,IAAAC,EAAU,YAAY;AACpB,MAAAD,IAAeP,EAAM,sBACfE,EAAA,QAAQF,EAAM,qBAAsB,OAChCM,EAAA,QAAQ,MAAMX,EAAkB;AAAA,QACxCK,EAAM,qBAAsB;AAAA,MAC9B;AAAA,IAAA,CACD;AAED,mBAAeS,EAAoBC,GAA0B;AAC3D,MAAAH,IAAeX,EAAiB;AAAA,QAC9Bc,EAAK,SAAS,MAAMA,EAAK,SAAS,MAAM,SAAS,CAAC;AAAA,QAClD,IAAIC,EAAeD,EAAK,SAAS,MAAM,GAAGA,EAAK,SAAS,MAAM,MAAM,GAAG,EAAE,CAAC;AAAA,MAC5E,GACAR,EAAM,QAAQQ,EAAK,UACnBJ,EAAU,QAAQ,MAAMX,EAAkB,iBAAiBY,CAAY;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,7 +3,7 @@ const x = /* @__PURE__ */ f({
3
3
  __name: "x-tab-group",
4
4
  emits: ["tab-change"],
5
5
  setup(g, { emit: d }) {
6
- const t = i(null), m = d;
6
+ const t = i(), m = d;
7
7
  function r(e) {
8
8
  typeof e == "string" && m("tab-change", e);
9
9
  }
@@ -46,4 +46,4 @@ const x = /* @__PURE__ */ f({
46
46
  export {
47
47
  x as default
48
48
  };
49
- //# sourceMappingURL=x-tab-group-Bp7V46k9.js.map
49
+ //# sourceMappingURL=x-tab-group-D1jmHXyJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-tab-group-D1jmHXyJ.js","sources":["../src/vue/x-tab-group.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 setup lang=\"ts\">\nimport { Ref, ref } from \"vue\";\nconst tab: Ref<unknown> = ref();\n\nconst emits = defineEmits([\"tab-change\"]);\n\nfunction change(tabId: unknown) {\n if (typeof tabId == \"string\") {\n emits(\"tab-change\", tabId);\n }\n}\n</script>\n\n<template>\n <v-card class=\"mx-auto\">\n <v-tabs v-model=\"tab\" @update:model-value=\"change\">\n <slot name=\"tabs\"></slot>\n </v-tabs>\n <v-card-text>\n <v-tabs-window v-model=\"tab\">\n <slot name=\"panels\"></slot>\n </v-tabs-window>\n </v-card-text>\n </v-card>\n</template>\n\n<style scoped></style>\n"],"names":["tab","ref","emits","__emit","change","tabId"],"mappings":";;;;;AAqBA,UAAMA,IAAoBC,EAAI,GAExBC,IAAQC;AAEd,aAASC,EAAOC,GAAgB;AAC1B,MAAA,OAAOA,KAAS,YAClBH,EAAM,cAAcG,CAAK;AAAA,IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,45 @@
1
+ import { defineComponent as s, mergeModels as m, useModel as p, computed as d, openBlock as i, createBlock as f, unref as y } from "vue";
2
+ import { t as V } from "./translations-k4crOAds.js";
3
+ import { useI18n as c } from "vue-i18n";
4
+ import { a as h } from "./index-ptn5-s1m.js";
5
+ const g = /* @__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(t) {
22
+ const { t: n } = c({
23
+ messages: V
24
+ }), a = t, l = p(t, "modelValue"), u = d(() => {
25
+ const e = [];
26
+ return a.required && e.push((o) => o ? !0 : n("vuetify.text.input.mandatory")), e;
27
+ });
28
+ return (e, o) => (i(), f(y(h), {
29
+ modelValue: l.value,
30
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => l.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
+ g as default
44
+ };
45
+ //# sourceMappingURL=x-text-field-DutyqCkJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-text-field-2Sv6HUGW.js","sources":["../src/vue/form/x-text-field.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport messages from \"../../translations\";\nimport { computed } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport { VTextField } from \"vuetify/components/VTextField\";\nimport type { TextFieldProps } from \"@xwiki/cristal-dsapi\";\n\nconst { t } = useI18n({\n messages,\n});\nconst props = defineProps<TextFieldProps>();\nconst input = defineModel<string>();\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.text.input.mandatory\");\n }\n });\n }\n return rulesList;\n});\n</script>\n\n<template>\n <v-text-field\n v-model=\"input\"\n :label=\"label\"\n :name=\"name\"\n :autofocus=\"autofocus\"\n :hint=\"help\"\n :persistent-hint=\"help !== undefined\"\n :rules=\"rules\"\n :readonly=\"readonly\"\n ></v-text-field>\n</template>\n\n<style scoped></style>\n"],"names":["t","useI18n","messages","props","__props","input","_useModel","rules","computed","rulesList","value"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOM,UAAA,EAAE,GAAAA,EAAE,IAAIC,EAAQ;AAAA,MACpBC,UAAAA;AAAAA,IAAA,CACD,GACKC,IAAQC,GACRC,IAAQC,EAAmBF,GAAA,YAAC,GAE5BG,IAAQC,EAAS,MAAM;AAC3B,YAAMC,IAAY,CAAC;AACnB,aAAIN,EAAM,YACEM,EAAA,KAAK,CAACC,MACVA,IACK,KAEAV,EAAE,8BAA8B,CAE1C,GAEIS;AAAA,IAAA,CACR;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"x-text-field-DutyqCkJ.js","sources":["../src/vue/form/x-text-field.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport messages from \"../../translations\";\nimport { computed } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport { VTextField } from \"vuetify/components/VTextField\";\nimport type { TextFieldProps } from \"@xwiki/cristal-dsapi\";\n\nconst { t } = useI18n({\n messages,\n});\nconst props = defineProps<TextFieldProps>();\nconst input = defineModel<string>();\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.text.input.mandatory\");\n }\n });\n }\n return rulesList;\n});\n</script>\n\n<template>\n <v-text-field\n v-model=\"input\"\n :label=\"label\"\n :name=\"name\"\n :autofocus=\"autofocus\"\n :hint=\"help\"\n :persistent-hint=\"help !== undefined\"\n :rules=\"rules\"\n :readonly=\"readonly\"\n :type=\"type ?? 'text'\"\n ></v-text-field>\n</template>\n\n<style scoped></style>\n"],"names":["t","useI18n","messages","props","__props","input","_useModel","rules","computed","rulesList","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOM,UAAA,EAAE,GAAAA,EAAE,IAAIC,EAAQ;AAAA,MACpBC,UAAAA;AAAAA,IAAA,CACD,GACKC,IAAQC,GACRC,IAAQC,EAAmBF,GAAA,YAAC,GAE5BG,IAAQC,EAAS,MAAM;AAC3B,YAAMC,IAAY,CAAC;AACnB,aAAIN,EAAM,YACEM,EAAA,KAAK,CAACC,MACVA,IACK,KAEAV,EAAE,8BAA8B,CAE1C,GAEIS;AAAA,IAAA,CACR;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-dsvuetify",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -22,16 +22,16 @@
22
22
  },
23
23
  "main": "./dist/index.es.js",
24
24
  "dependencies": {
25
- "inversify": "6.2.2",
25
+ "inversify": "7.5.0",
26
26
  "vue": "3.5.13",
27
- "vue-i18n": "11.1.0",
28
- "vuetify": "3.7.11",
29
- "@xwiki/cristal-model-api": "0.15.0",
30
- "@xwiki/cristal-api": "0.15.0",
31
- "@xwiki/cristal-document-api": "0.15.0",
32
- "@xwiki/cristal-model-reference-api": "0.15.0",
33
- "@xwiki/cristal-navigation-tree-api": "0.15.0",
34
- "@xwiki/cristal-hierarchy-api": "0.15.0"
27
+ "vue-i18n": "11.1.2",
28
+ "vuetify": "3.8.0",
29
+ "@xwiki/cristal-document-api": "0.17.0",
30
+ "@xwiki/cristal-hierarchy-api": "0.17.0",
31
+ "@xwiki/cristal-model-reference-api": "0.17.0",
32
+ "@xwiki/cristal-api": "0.17.0",
33
+ "@xwiki/cristal-navigation-tree-api": "0.17.0",
34
+ "@xwiki/cristal-model-api": "0.17.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "reflect-metadata": "0.2.2"
@@ -39,11 +39,11 @@
39
39
  "devDependencies": {
40
40
  "@vue/test-utils": "2.4.6",
41
41
  "reflect-metadata": "0.2.2",
42
- "typescript": "5.7.3",
43
- "vite": "6.1.0",
44
- "vue-tsc": "2.2.0",
45
- "@xwiki/cristal-dsapi": "0.15.0",
46
- "@xwiki/cristal-dev-config": "0.15.0"
42
+ "typescript": "5.8.2",
43
+ "vite": "6.2.6",
44
+ "vue-tsc": "2.2.8",
45
+ "@xwiki/cristal-dev-config": "0.17.0",
46
+ "@xwiki/cristal-dsapi": "0.17.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "pnpm compile",
@@ -27,6 +27,6 @@ export default class ComponentInit {
27
27
  container
28
28
  .bind<DesignSystemLoader>("DesignSystemLoader")
29
29
  .to(VuetifyDesignSystemLoader)
30
- .whenTargetNamed("vuetify");
30
+ .whenNamed("vuetify");
31
31
  }
32
32
  }
@@ -21,7 +21,6 @@
21
21
  import { registerAsyncComponent } from "@xwiki/cristal-api";
22
22
  import { injectable } from "inversify";
23
23
  import { createVuetify } from "vuetify";
24
- // eslint-disable-next-line import/namespace
25
24
  import * as components from "vuetify/components";
26
25
  import { VCol, VContainer, VRow, VTextField } from "vuetify/components";
27
26
 
@@ -19,7 +19,6 @@
19
19
  */
20
20
 
21
21
  import { createVuetify } from "vuetify";
22
- // eslint-disable-next-line import/namespace
23
22
  import * as components from "vuetify/components";
24
23
  import * as directives from "vuetify/directives";
25
24
 
@@ -23,7 +23,7 @@ import type { CheckboxProps } from "@xwiki/cristal-dsapi";
23
23
 
24
24
  defineProps<CheckboxProps>();
25
25
 
26
- const checked = defineModel<boolean>();
26
+ const checked = defineModel<boolean | null>();
27
27
  </script>
28
28
  <template>
29
29
  <v-checkbox
@@ -20,6 +20,7 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
20
  <script setup lang="ts">
21
21
  import messages from "../../translations";
22
22
  import XBreadcrumb from "../x-breadcrumb.vue";
23
+ import { navigationTreeSelectPropsDefaults } from "@xwiki/cristal-dsapi";
23
24
  import { SpaceReference } from "@xwiki/cristal-model-api";
24
25
  import { inject, onMounted, ref } from "vue";
25
26
  import { useI18n } from "vue-i18n";
@@ -52,7 +53,10 @@ const referenceHandler: ModelReferenceHandler = cristal
52
53
  const { t } = useI18n({
53
54
  messages,
54
55
  });
55
- const props = defineProps<NavigationTreeSelectProps>();
56
+ const props = withDefaults(
57
+ defineProps<NavigationTreeSelectProps>(),
58
+ navigationTreeSelectPropsDefaults,
59
+ );
56
60
  const model = defineModel<SpaceReference>();
57
61
 
58
62
  const openedLocationDialog: Ref<boolean> = ref(false);
@@ -103,6 +107,7 @@ async function treeNodeClickAction(node: NavigationTreeNode) {
103
107
  <XNavigationTree
104
108
  :current-page-reference="selectedPage"
105
109
  :click-action="treeNodeClickAction"
110
+ :include-terminals="includeTerminals"
106
111
  ></XNavigationTree>
107
112
  </template>
108
113
  <template #footer>
@@ -36,6 +36,7 @@ const rules = computed(() => {
36
36
  :persistent-hint="help !== undefined"
37
37
  :rules="rules"
38
38
  :readonly="readonly"
39
+ :type="type ?? 'text'"
39
40
  ></v-text-field>
40
41
  </template>
41
42
 
@@ -29,6 +29,7 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
29
29
  * item was disabled. Default hover effects, such as darkening or changing
30
30
  * the cursor on items, were also disabled.
31
31
  */
32
+ import { navigationTreePropsDefaults } from "@xwiki/cristal-dsapi";
32
33
  import { inject, onBeforeMount, ref, watch } from "vue";
33
34
  import { VTreeview } from "vuetify/labs/VTreeview";
34
35
  import type { CristalApp } from "@xwiki/cristal-api";
@@ -50,6 +51,7 @@ type TreeItem = {
50
51
  href: string;
51
52
  children?: Array<TreeItem>;
52
53
  _location: SpaceReference;
54
+ _is_terminal: boolean;
53
55
  };
54
56
 
55
57
  const cristal: CristalApp = inject<CristalApp>("cristal")!;
@@ -64,19 +66,23 @@ const treeSource: NavigationTreeSource = cristal
64
66
  const rootNodes: Ref<Array<TreeItem>> = ref([]);
65
67
 
66
68
  const activatedNodes: Ref<Array<string>> = ref(new Array<string>());
67
- const expandedNodes: Ref<Array<string>> = ref(new Array<string>());
69
+ const expandedNodes: Ref<unknown> = ref([]);
68
70
  var isExpanding: boolean = false;
69
71
 
70
- const props = defineProps<NavigationTreeProps>();
72
+ const props = withDefaults(
73
+ defineProps<NavigationTreeProps>(),
74
+ navigationTreePropsDefaults,
75
+ );
71
76
 
72
77
  onBeforeMount(async () => {
73
- for (const node of await treeSource.getChildNodes("")) {
78
+ for (const node of await getChildNodes("")) {
74
79
  rootNodes.value.push({
75
80
  id: node.id,
76
81
  title: node.label,
77
82
  href: node.url,
78
83
  children: node.has_children ? [] : undefined,
79
84
  _location: node.location,
85
+ _is_terminal: node.is_terminal,
80
86
  });
81
87
  }
82
88
  await expandTree();
@@ -93,7 +99,8 @@ async function expandTree() {
93
99
  if (props.currentPageReference && !isExpanding) {
94
100
  isExpanding = true;
95
101
  const newExpandedNodes = treeSource.getParentNodesId(
96
- props.currentPageReference,
102
+ props.currentPageReference!,
103
+ props.includeTerminals,
97
104
  );
98
105
  let i;
99
106
  let currentNodes = rootNodes.value;
@@ -104,8 +111,8 @@ async function expandTree() {
104
111
  if (node.children?.length == 0) {
105
112
  await lazyLoadChildren(node);
106
113
  }
107
- if (!expandedNodes.value.includes(node.id)) {
108
- expandedNodes.value.push(node.id);
114
+ if (!(expandedNodes.value as unknown[]).includes(node.id)) {
115
+ (expandedNodes.value as unknown[]).push(node.id);
109
116
  }
110
117
  currentNodes = node.children!;
111
118
  }
@@ -125,6 +132,7 @@ async function expandTree() {
125
132
  location: node._location,
126
133
  url: node.href,
127
134
  has_children: node.children !== undefined,
135
+ is_terminal: node._is_terminal,
128
136
  });
129
137
  }
130
138
  }
@@ -136,7 +144,7 @@ async function expandTree() {
136
144
 
137
145
  async function lazyLoadChildren(item: unknown) {
138
146
  const treeItem = item as TreeItem;
139
- const childNodes = await treeSource.getChildNodes(treeItem.id);
147
+ const childNodes = await getChildNodes(treeItem.id);
140
148
  for (const child of childNodes) {
141
149
  treeItem.children?.push({
142
150
  id: child.id,
@@ -144,6 +152,7 @@ async function lazyLoadChildren(item: unknown) {
144
152
  href: child.url,
145
153
  children: child.has_children ? [] : undefined,
146
154
  _location: child.location,
155
+ _is_terminal: child.is_terminal,
147
156
  });
148
157
  }
149
158
  // If the node doesn't have any children, we update it.
@@ -164,7 +173,7 @@ function clearSelection() {
164
173
  // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
165
174
  // eslint-disable-next-line max-statements
166
175
  async function onDocumentDelete(page: DocumentReference) {
167
- const parents = treeSource.getParentNodesId(page);
176
+ const parents = treeSource.getParentNodesId(page, props.includeTerminals);
168
177
  let currentItem: TreeItem | undefined = undefined;
169
178
  let currentItemChildren: TreeItem[] | undefined = rootNodes.value;
170
179
  let notFound = false;
@@ -193,7 +202,7 @@ async function onDocumentDelete(page: DocumentReference) {
193
202
  // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
194
203
  // eslint-disable-next-line max-statements
195
204
  async function onDocumentUpdate(page: DocumentReference) {
196
- const parents = treeSource.getParentNodesId(page);
205
+ const parents = treeSource.getParentNodesId(page, props.includeTerminals);
197
206
  let currentParent: string | undefined = undefined;
198
207
  let currentItems: TreeItem[] | undefined = rootNodes.value;
199
208
  let notFound = false;
@@ -204,7 +213,7 @@ async function onDocumentUpdate(page: DocumentReference) {
204
213
  if (currentItems[i].id == parents[0]) {
205
214
  if (parents.length == 1) {
206
215
  // Page update
207
- const newItems = await treeSource.getChildNodes(
216
+ const newItems = await getChildNodes(
208
217
  currentParent ? currentParent : "",
209
218
  );
210
219
  for (const newItem of newItems) {
@@ -235,11 +244,10 @@ async function onDocumentUpdate(page: DocumentReference) {
235
244
  // We don't do anything because this node will be loaded lazily anyway.
236
245
  return;
237
246
  }
238
- const newItems = await treeSource.getChildNodes(
239
- currentParent ? currentParent : "",
240
- );
247
+ const newItems = await getChildNodes(currentParent ? currentParent : "");
241
248
  const currentPageParents = treeSource.getParentNodesId(
242
- props.currentPageReference,
249
+ props.currentPageReference!,
250
+ props.includeTerminals,
243
251
  );
244
252
  newItemsLoop: for (const newItem of newItems) {
245
253
  for (const i of currentItems!.keys()) {
@@ -253,6 +261,7 @@ async function onDocumentUpdate(page: DocumentReference) {
253
261
  href: newItem.url,
254
262
  children: newItem.has_children ? [] : undefined,
255
263
  _location: newItem.location,
264
+ _is_terminal: newItem.is_terminal,
256
265
  });
257
266
  if (
258
267
  currentPageParents.length > 0 &&
@@ -263,6 +272,12 @@ async function onDocumentUpdate(page: DocumentReference) {
263
272
  }
264
273
  }
265
274
  }
275
+
276
+ async function getChildNodes(id: string) {
277
+ return (await treeSource.getChildNodes(id)).filter(
278
+ (c) => props.includeTerminals || !c.is_terminal,
279
+ );
280
+ }
266
281
  </script>
267
282
 
268
283
  <template>
@@ -289,6 +304,7 @@ async function onDocumentUpdate(page: DocumentReference) {
289
304
  location: item._location,
290
305
  url: item.href,
291
306
  has_children: item.children !== undefined,
307
+ is_terminal: item._is_terminal,
292
308
  });
293
309
  "
294
310
  >{{ item.title }}</a
@@ -18,8 +18,8 @@ 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 setup lang="ts">
21
- import { ref } from "vue";
22
- const tab = ref(null);
21
+ import { Ref, ref } from "vue";
22
+ const tab: Ref<unknown> = ref();
23
23
 
24
24
  const emits = defineEmits(["tab-change"]);
25
25