@xwiki/cristal-dsvuetify 0.10.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.
- package/CHANGELOG.md +27 -0
- package/dist/components/componentsInit.d.ts +0 -1
- package/dist/components/vuetifyDesignSystemLoader.d.ts +1 -2
- package/dist/{index-BjjXwAdJ.js → index-DCILSBLH.js} +7359 -7287
- package/dist/index-DCILSBLH.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +6 -4
- package/dist/index.umd.js +11 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/{translations-CFfpgNrx.js → translations-BNEIsfPR.js} +3 -3
- package/dist/{translations-CFfpgNrx.js.map → translations-BNEIsfPR.js.map} +1 -1
- package/dist/vue/__tests__/utils/vuetify.d.ts +5 -0
- package/dist/vue/form/x-file-input.vue.d.ts +10 -31
- package/dist/vue/form/x-form.vue.d.ts +9 -4
- package/dist/vue/form/x-text-field.vue.d.ts +1 -11
- package/dist/vue/x-alert.vue.d.ts +15 -21
- package/dist/vue/x-avatar.vue.d.ts +3 -3
- package/dist/vue/x-breadcrumb.vue.d.ts +1 -11
- package/dist/vue/x-btn.vue.d.ts +9 -3
- package/dist/vue/x-card.vue.d.ts +3 -3
- package/dist/vue/x-dialog.vue.d.ts +11 -15
- package/dist/vue/x-divider.vue.d.ts +1 -1
- package/dist/vue/x-img.vue.d.ts +3 -3
- package/dist/vue/x-load.vue.d.ts +1 -2
- package/dist/vue/x-menu-item.vue.d.ts +12 -16
- package/dist/vue/x-menu-label.vue.d.ts +16 -0
- package/dist/vue/x-menu.vue.d.ts +9 -17
- package/dist/vue/x-navigation-tree.vue.d.ts +4 -16
- package/dist/vue/x-search.vue.d.ts +1 -1
- package/dist/vue/x-tab-group.vue.d.ts +10 -5
- package/dist/vue/x-tab-panel.vue.d.ts +8 -13
- package/dist/vue/x-tab.vue.d.ts +8 -13
- package/dist/x-alert-C3nY6ghP.js +42 -0
- package/dist/x-alert-C3nY6ghP.js.map +1 -0
- package/dist/x-breadcrumb-C2iUd4Sf.js +22 -0
- package/dist/{x-breadcrumb-DBZVExfF.js.map → x-breadcrumb-C2iUd4Sf.js.map} +1 -1
- package/dist/x-btn-DNlhiqjD.js +48 -0
- package/dist/x-btn-DNlhiqjD.js.map +1 -0
- package/dist/x-divider-Buudf0KI.js +12 -0
- package/dist/x-divider-Buudf0KI.js.map +1 -0
- package/dist/{x-file-input-B6XyfogW.js → x-file-input-BtGTZtfq.js} +9 -9
- package/dist/x-file-input-BtGTZtfq.js.map +1 -0
- package/dist/{x-form-leyAZnAr.js → x-form-pSj3365X.js} +2 -2
- package/dist/{x-form-leyAZnAr.js.map → x-form-pSj3365X.js.map} +1 -1
- package/dist/x-menu-DDC7z1Wb.js +31 -0
- package/dist/x-menu-DDC7z1Wb.js.map +1 -0
- package/dist/x-menu-item-ByE5R9Bf.js +22 -0
- package/dist/x-menu-item-ByE5R9Bf.js.map +1 -0
- package/dist/x-menu-label-DniImc0U.js +17 -0
- package/dist/x-menu-label-DniImc0U.js.map +1 -0
- package/dist/x-navigation-tree-W6QDS4uh.js +499 -0
- package/dist/x-navigation-tree-W6QDS4uh.js.map +1 -0
- package/dist/{x-text-field-B88odaud.js → x-text-field-CAVD3OjY.js} +6 -6
- package/dist/{x-text-field-B88odaud.js.map → x-text-field-CAVD3OjY.js.map} +1 -1
- package/package.json +13 -10
- package/src/components/componentsInit.ts +1 -1
- package/src/components/vuetifyDesignSystemLoader.ts +25 -6
- package/src/vue/__tests__/utils/vuetify.ts +43 -0
- package/src/vue/__tests__/x-btn.test.ts +54 -0
- package/src/vue/css/style.css +2 -0
- package/src/vue/form/x-file-input.vue +3 -4
- package/src/vue/form/x-text-field.vue +3 -3
- package/src/vue/x-alert.vue +14 -16
- package/src/vue/x-breadcrumb.vue +5 -1
- package/src/vue/x-btn.vue +34 -1
- package/src/vue/x-divider.vue +1 -1
- package/src/vue/x-menu-item.vue +2 -2
- package/src/vue/x-menu-label.vue +25 -0
- package/src/vue/x-menu.vue +13 -6
- package/src/vue/x-navigation-tree.vue +132 -11
- package/tsconfig.json +2 -1
- package/{src/vue.d.ts → vitest.config.ts} +17 -7
- package/dist/index-BjjXwAdJ.js.map +0 -1
- package/dist/x-alert-Cm6mzRpR.js +0 -29
- package/dist/x-alert-Cm6mzRpR.js.map +0 -1
- package/dist/x-breadcrumb-DBZVExfF.js +0 -21
- package/dist/x-btn-DsACLwMY.js +0 -17
- package/dist/x-btn-DsACLwMY.js.map +0 -1
- package/dist/x-divider-7cmRuxTV.js +0 -16
- package/dist/x-divider-7cmRuxTV.js.map +0 -1
- package/dist/x-file-input-B6XyfogW.js.map +0 -1
- package/dist/x-menu-VerLAd9F.js +0 -32
- package/dist/x-menu-VerLAd9F.js.map +0 -1
- package/dist/x-menu-item-DGurfOCF.js +0 -22
- package/dist/x-menu-item-DGurfOCF.js.map +0 -1
- package/dist/x-navigation-tree-B8JZ_wJm.js +0 -470
- package/dist/x-navigation-tree-B8JZ_wJm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-navigation-tree-W6QDS4uh.js","sources":["../../../node_modules/.pnpm/vuetify@3.7.3_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewGroup.mjs","../../../node_modules/.pnpm/vuetify@3.7.3_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/shared.mjs","../../../node_modules/.pnpm/vuetify@3.7.3_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewItem.mjs","../../../node_modules/.pnpm/vuetify@3.7.3_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewChildren.mjs","../../../node_modules/.pnpm/vuetify@3.7.3_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeview.mjs","../src/vue/x-navigation-tree.vue"],"sourcesContent":["import { mergeProps as _mergeProps, createVNode as _createVNode, Fragment as _Fragment } from \"vue\";\n// Components\nimport { VDefaultsProvider } from \"../../components/VDefaultsProvider/index.mjs\";\nimport { makeVListGroupProps, VListGroup } from \"../../components/VList/VListGroup.mjs\"; // Utilities\nimport { computed, ref } from 'vue';\nimport { genericComponent, omit, propsFactory, useRender } from \"../../util/index.mjs\"; // 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.mjs.map","// Types\n\nexport const VTreeviewSymbol = Symbol.for('vuetify:v-treeview');\n//# sourceMappingURL=shared.mjs.map","import { mergeProps as _mergeProps, createVNode as _createVNode, Fragment as _Fragment } from \"vue\";\n// Styles\nimport \"./VTreeviewItem.css\";\n\n// Components\nimport { VBtn } from \"../../components/VBtn/index.mjs\";\nimport { VListItemAction } from \"../../components/VList/index.mjs\";\nimport { makeVListItemProps, VListItem } from \"../../components/VList/VListItem.mjs\";\nimport { VProgressCircular } from \"../../components/VProgressCircular/index.mjs\"; // Composables\nimport { IconValue } from \"../../composables/icons.mjs\";\nimport { useLink } from \"../../composables/router.mjs\"; // Utilities\nimport { computed, inject, ref } from 'vue';\nimport { EventProp, genericComponent, omit, propsFactory, useRender } from \"../../util/index.mjs\"; // Types\nimport { VTreeviewSymbol } from \"./shared.mjs\";\nexport const makeVTreeviewItemProps = propsFactory({\n loading: Boolean,\n onToggleExpand: EventProp(),\n toggleIcon: IconValue,\n ...makeVListItemProps({\n slim: true\n })\n}, 'VTreeviewItem');\nexport const VTreeviewItem = genericComponent()({\n name: 'VTreeviewItem',\n props: makeVTreeviewItemProps(),\n setup(props, _ref) {\n let {\n attrs,\n slots,\n emit\n } = _ref;\n const link = useLink(props, attrs);\n const vListItemRef = ref();\n const isActivatableGroupActivator = computed(() => vListItemRef.value?.root.activatable.value && vListItemRef.value?.isGroupActivator);\n const isClickable = computed(() => !props.disabled && props.link !== false && (props.link || link.isClickable.value || props.value != null && !!vListItemRef.value?.list || isActivatableGroupActivator.value));\n function activateItem(e) {\n if (!isClickable.value || !isActivatableGroupActivator.value && vListItemRef.value?.isGroupActivator) return;\n if (vListItemRef.value?.root.activatable.value) {\n vListItemRef.value?.activate(!vListItemRef.value?.isActivated, e);\n }\n }\n const visibleIds = inject(VTreeviewSymbol, {\n visibleIds: ref()\n }).visibleIds;\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': visibleIds.value && !visibleIds.value.has(vListItemRef.value?.id)\n }, props.class],\n \"ripple\": false,\n \"onClick\": props.onClick ?? activateItem\n }), {\n ...slots,\n prepend: hasPrepend ? slotProps => {\n return _createVNode(_Fragment, null, [props.toggleIcon && _createVNode(VListItemAction, {\n \"start\": false\n }, {\n default: () => [_createVNode(VBtn, {\n \"density\": \"compact\",\n \"icon\": props.toggleIcon,\n \"loading\": props.loading,\n \"variant\": \"text\",\n \"onClick\": props.onToggleExpand\n }, {\n loader() {\n return _createVNode(VProgressCircular, {\n \"indeterminate\": \"disable-shrink\",\n \"size\": \"20\",\n \"width\": \"2\"\n }, null);\n }\n })]\n }), slots.prepend?.(slotProps)]);\n } : undefined\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeviewItem.mjs.map","import { mergeProps as _mergeProps, resolveDirective as _resolveDirective, createVNode as _createVNode, Fragment as _Fragment } from \"vue\";\n// Components\nimport { VTreeviewGroup } from \"./VTreeviewGroup.mjs\";\nimport { VTreeviewItem } from \"./VTreeviewItem.mjs\";\nimport { VCheckboxBtn } from \"../../components/VCheckbox/index.mjs\"; // Composables\nimport { IconValue } from \"../../composables/icons.mjs\"; // Utilities\nimport { computed, reactive, toRaw, withModifiers } from 'vue';\nimport { genericComponent, propsFactory } from \"../../util/index.mjs\"; // Types\nexport const makeVTreeviewChildrenProps = propsFactory({\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}, '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.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 \"loading\": loading,\n \"color\": props.selectedColor,\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 };\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 ? toRaw(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.mjs.map","import { createVNode as _createVNode, mergeProps as _mergeProps, resolveDirective as _resolveDirective } from \"vue\";\n// Components\nimport { makeVTreeviewChildrenProps, VTreeviewChildren } from \"./VTreeviewChildren.mjs\";\nimport { makeVListProps, useListItems, VList } from \"../../components/VList/VList.mjs\"; // Composables\nimport { provideDefaults } from \"../../composables/defaults.mjs\";\nimport { makeFilterProps, useFilter } from \"../../composables/filter.mjs\";\nimport { useProxiedModel } from \"../../composables/proxiedModel.mjs\"; // Utilities\nimport { computed, provide, ref, toRaw, toRef } from 'vue';\nimport { genericComponent, omit, propsFactory, useRender } from \"../../util/index.mjs\"; // Types\nimport { VTreeviewSymbol } from \"./shared.mjs\";\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 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', 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 \"returnObject\": props.returnObject,\n \"items\": items.value\n }), slots)]\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeview.mjs.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 { inject, onBeforeMount, ref, watch } from \"vue\";\nimport { VTreeview } from \"vuetify/labs/VTreeview\";\nimport type { CristalApp, PageData } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type {\n NavigationTreeNode,\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: string;\n};\n\ntype OnClickAction = (node: NavigationTreeNode) => void;\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([]);\nconst tree: Ref<VTreeview | undefined> = ref(undefined);\n\nconst activatedNodes: Ref<Array<string>> = ref(new Array<string>());\nconst expandedNodes: Ref<Array<string>> = ref(new Array<string>());\n\nconst props = defineProps<{\n clickAction?: OnClickAction;\n currentPage?: PageData;\n}>();\n\nonBeforeMount(async () => {\n for (const node of await treeSource.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 });\n }\n if (props.currentPage !== undefined) {\n await expandTree();\n }\n\n documentService.registerDocumentChangeListener(\"delete\", onDocumentDelete);\n documentService.registerDocumentChangeListener(\"update\", onDocumentUpdate);\n});\n\nwatch(\n () => props.currentPage,\n async () => {\n if (props.currentPage) {\n await expandTree();\n }\n },\n);\n\nasync function expandTree() {\n const newExpandedNodes = treeSource.getParentNodesId(props.currentPage);\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.includes(node.id)) {\n expandedNodes.value.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 });\n }\n }\n }\n }\n}\n\nasync function lazyLoadChildren(item: unknown) {\n const treeItem = item as TreeItem;\n const childNodes = await treeSource.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 });\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\nasync function onDocumentDelete(page: PageData) {\n const parents = treeSource.getParentNodesId(page);\n let currentItems: TreeItem[] | undefined = rootNodes.value;\n while (currentItems) {\n for (const i of currentItems.keys()) {\n if (currentItems[i].id == parents[0]) {\n if (parents.length == 1) {\n currentItems.splice(i, 1);\n return;\n } else {\n currentItems = currentItems[i].children;\n parents.shift();\n break;\n }\n }\n }\n }\n}\n\nasync function onDocumentUpdate(page: PageData) {\n const parents = treeSource.getParentNodesId(page);\n let currentParent: string | undefined = undefined;\n let currentItems: TreeItem[] | undefined = rootNodes.value;\n\n while (currentItems) {\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 treeSource.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 currentItems = currentItems[i].children;\n parents.shift();\n break;\n }\n }\n }\n\n // New page\n const newItems = await treeSource.getChildNodes(\n currentParent ? currentParent : \"\",\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 });\n }\n }\n}\n</script>\n\n<template>\n <v-treeview\n ref=\"tree\"\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 open-strategy=\"multiple\"\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 });\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":["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","EventProp","IconValue","makeVListItemProps","VTreeviewItem","attrs","emit","link","useLink","vListItemRef","isActivatableGroupActivator","_b","isClickable","activateItem","e","_d","_c","visibleIds","inject","listItemProps","VListItem","hasPrepend","VListItemAction","VBtn","VProgressCircular","makeVTreeviewChildrenProps","VTreeviewChildren","isLoading","reactive","isClickOnOpen","checkChildren","item","selectItem","select","isSelected","children","itemProps","loading","slotsWithItem","VCheckboxBtn","withModifiers","treeviewGroupProps","treeviewChildrenProps","_ref2","activatorProps","toRaw","flatten","items","flat","makeVTreeviewProps","makeFilterProps","makeVListProps","VTreeview","val","value","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","tree","activatedNodes","expandedNodes","__props","onBeforeMount","node","expandTree","onDocumentDelete","onDocumentUpdate","watch","newExpandedNodes","currentNodes","lazyLoadChildren","treeItem","childNodes","clearSelection","page","parents","currentItems","currentParent","newItems","newItem","newItemsLoop"],"mappings":";;;AAMO,MAAMA,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,IACD,IAAGD;AACJ,UAAME,IAAgBC,KAChBC,IAAaC,EAAS,MAAM;;AAAA,cAAAC,IAAAJ,EAAc,UAAd,QAAAI,EAAqB,SAASP,EAAM,eAAeA,EAAM;AAAA,KAAU,GAC/FQ,IAAoBF,EAAS,MAAO;;AAAA;AAAA,QACxC,eAAe;AAAA,UACb,aA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EAAQ,UAAU,GAAG;AAEjBG,oBAAAA,IAAW,MAAMtB,EAAW;AAAA,gBAChCqB,KAAgC;AAAA,cAAA;AAElC,yBAAWE,KAAWD;AACpB,oBAAIC,EAAQ,MAAMH,EAAa5B,CAAC,EAAE,IAAI;AACvB,kBAAA4B,EAAA5B,CAAC,EAAE,QAAQ+B,EAAQ;AAChC;AAAA,gBACF;AAAA,YACF,OACK;AACW,cAAAF,IAAAD,EAAa5B,CAAC,EAAE,IACjB4B,IAAAA,EAAa5B,CAAC,EAAE,UAC/B2B,EAAQ,MAAM;AACd;AAAA,YACF;AAKE,cAAAG,IAAW,MAAMtB,EAAW;AAAA,UAChCqB,KAAgC;AAAA,QAAA;AAEpB,QAAAG,EAAA,YAAWD,KAAWD,GAAU;AACjC,qBAAA9B,KAAK4B,EAAc;AAC5B,gBAAIG,EAAQ,MAAMH,EAAc5B,CAAC,EAAE;AACxB,uBAAAgC;AAGb,UAAAJ,EAAc,KAAK;AAAA,YACjB,IAAIG,EAAQ;AAAA,YACZ,OAAOA,EAAQ;AAAA,YACf,MAAMA,EAAQ;AAAA,YACd,UAAUA,EAAQ,eAAe,CAAA,IAAK;AAAA,YACtC,WAAWA,EAAQ;AAAA,UAAA,CACpB;AAAA,QACH;AAAA,MACF;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as a, computed as l, openBlock as u, createBlock as m, unref as
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent as a, computed as l, openBlock as u, createBlock as m, unref as i } from "vue";
|
|
2
|
+
import { t as p } from "./translations-BNEIsfPR.js";
|
|
3
3
|
import { useI18n as f } from "vue-i18n";
|
|
4
|
-
import { a as c } from "./index-
|
|
4
|
+
import { a as c } from "./index-DCILSBLH.js";
|
|
5
5
|
const y = /* @__PURE__ */ a({
|
|
6
6
|
__name: "x-text-field",
|
|
7
7
|
props: {
|
|
@@ -11,12 +11,12 @@ const y = /* @__PURE__ */ a({
|
|
|
11
11
|
},
|
|
12
12
|
setup(t) {
|
|
13
13
|
const { t: n } = f({
|
|
14
|
-
messages:
|
|
14
|
+
messages: p
|
|
15
15
|
}), o = t, s = l(() => {
|
|
16
16
|
const e = [];
|
|
17
17
|
return o.required && e.push((r) => r ? !0 : n("vuetify.text.input.mandatory")), e;
|
|
18
18
|
});
|
|
19
|
-
return (e, r) => (u(), m(
|
|
19
|
+
return (e, r) => (u(), m(i(c), {
|
|
20
20
|
label: e.label,
|
|
21
21
|
name: e.name,
|
|
22
22
|
rules: s.value
|
|
@@ -26,4 +26,4 @@ const y = /* @__PURE__ */ a({
|
|
|
26
26
|
export {
|
|
27
27
|
y as default
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=x-text-field-
|
|
29
|
+
//# sourceMappingURL=x-text-field-CAVD3OjY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-text-field-
|
|
1
|
+
{"version":3,"file":"x-text-field-CAVD3OjY.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>();\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 :label=\"label\" :name=\"name\" :rules=\"rules\"></v-text-field>\n</template>\n\n<style scoped></style>\n"],"names":["t","useI18n","messages","props","__props","rules","computed","rulesList","value"],"mappings":";;;;;;;;;;;;AAOM,UAAA,EAAE,GAAAA,EAAE,IAAIC,EAAQ;AAAA,MAAA,UACpBC;AAAAA,IAAA,CACD,GACKC,IAAQC,GAERC,IAAQC,EAAS,MAAM;AAC3B,YAAMC,IAAY,CAAA;AAClB,aAAIJ,EAAM,YACEI,EAAA,KAAK,CAACC,MACVA,IACK,KAEAR,EAAE,8BAA8B,CAE1C,GAEIO;AAAA,IAAA,CACR;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-dsvuetify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -22,23 +22,26 @@
|
|
|
22
22
|
},
|
|
23
23
|
"main": "./dist/index.es.js",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"inversify": "6.0.
|
|
26
|
-
"vue": "3.
|
|
27
|
-
"vue-i18n": "
|
|
28
|
-
"vuetify": "3.
|
|
29
|
-
"@xwiki/cristal-api": "0.
|
|
30
|
-
"@xwiki/cristal-dsapi": "0.
|
|
31
|
-
"@xwiki/cristal-navigation-tree-api": "0.
|
|
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"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"vue-
|
|
35
|
+
"@vue/test-utils": "2.4.6",
|
|
36
|
+
"vue-tsc": "2.1.10",
|
|
37
|
+
"@xwiki/cristal-dev-config": "0.12.0"
|
|
35
38
|
},
|
|
36
39
|
"scripts": {
|
|
37
40
|
"build": "pnpm compile",
|
|
38
41
|
"clean": "rimraf dist",
|
|
39
42
|
"compile": "vue-tsc --project tsconfig.json && vite build",
|
|
40
43
|
"lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0",
|
|
41
|
-
"test": "
|
|
44
|
+
"test": "vitest --run"
|
|
42
45
|
},
|
|
43
46
|
"types": "./dist/index.d.ts"
|
|
44
47
|
}
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
import { VuetifyDesignSystemLoader } from "./vuetifyDesignSystemLoader";
|
|
21
22
|
import type { DesignSystemLoader } from "@xwiki/cristal-api";
|
|
22
23
|
import type { Container } from "inversify";
|
|
23
|
-
import { VuetifyDesignSystemLoader } from "./vuetifyDesignSystemLoader";
|
|
24
24
|
|
|
25
25
|
export default class ComponentInit {
|
|
26
26
|
constructor(container: Container) {
|
|
@@ -18,16 +18,18 @@
|
|
|
18
18
|
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import
|
|
21
|
+
import { registerAsyncComponent } from "@xwiki/cristal-api";
|
|
22
|
+
import { injectable } from "inversify";
|
|
23
|
+
import { createVuetify } from "vuetify";
|
|
24
|
+
// eslint-disable-next-line import/namespace
|
|
22
25
|
import * as components from "vuetify/components";
|
|
23
26
|
import { VCol, VContainer, VRow, VTextField } from "vuetify/components";
|
|
24
|
-
import type { DesignSystemLoader } from "@xwiki/cristal-api";
|
|
25
27
|
|
|
26
|
-
import { createVuetify } from "vuetify";
|
|
27
|
-
import { mdi } from "vuetify/iconsets/mdi";
|
|
28
28
|
import * as directives from "vuetify/directives";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
29
|
+
import { mdi } from "vuetify/iconsets/mdi";
|
|
30
|
+
import { blue, blueGrey } from "vuetify/util/colors";
|
|
31
|
+
import type { DesignSystemLoader } from "@xwiki/cristal-api";
|
|
32
|
+
import type { App } from "vue";
|
|
31
33
|
|
|
32
34
|
@injectable()
|
|
33
35
|
export class VuetifyDesignSystemLoader implements DesignSystemLoader {
|
|
@@ -56,6 +58,18 @@ export class VuetifyDesignSystemLoader implements DesignSystemLoader {
|
|
|
56
58
|
mdi,
|
|
57
59
|
},
|
|
58
60
|
},
|
|
61
|
+
theme: {
|
|
62
|
+
themes: {
|
|
63
|
+
light: {
|
|
64
|
+
dark: false,
|
|
65
|
+
colors: {
|
|
66
|
+
background: "#FFFFFF",
|
|
67
|
+
primary: blue.darken4,
|
|
68
|
+
secondary: blueGrey.darken4,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
59
73
|
});
|
|
60
74
|
app.use(vuetify);
|
|
61
75
|
// Native Vuetify components
|
|
@@ -83,6 +97,11 @@ export class VuetifyDesignSystemLoader implements DesignSystemLoader {
|
|
|
83
97
|
"XMenuItem",
|
|
84
98
|
() => import("../vue/x-menu-item.vue"),
|
|
85
99
|
);
|
|
100
|
+
registerAsyncComponent(
|
|
101
|
+
app,
|
|
102
|
+
"XMenuLabel",
|
|
103
|
+
() => import("../vue/x-menu-label.vue"),
|
|
104
|
+
);
|
|
86
105
|
registerAsyncComponent(
|
|
87
106
|
app,
|
|
88
107
|
"XBreadcrumb",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* See the LICENSE file distributed with this work for additional
|
|
3
|
+
* information regarding copyright ownership.
|
|
4
|
+
*
|
|
5
|
+
* This is free software; you can redistribute it and/or modify it
|
|
6
|
+
* under the terms of the GNU Lesser General Public License as
|
|
7
|
+
* published by the Free Software Foundation; either version 2.1 of
|
|
8
|
+
* the License, or (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* This software is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
* Lesser General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
* License along with this software; if not, write to the Free
|
|
17
|
+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
18
|
+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { createVuetify } from "vuetify";
|
|
22
|
+
// eslint-disable-next-line import/namespace
|
|
23
|
+
import * as components from "vuetify/components";
|
|
24
|
+
import * as directives from "vuetify/directives";
|
|
25
|
+
|
|
26
|
+
const vuetify = createVuetify({
|
|
27
|
+
components,
|
|
28
|
+
directives,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Provide the required options for testing vuetify, and merge them with existing
|
|
33
|
+
* @param options - the existing options to merge
|
|
34
|
+
*/
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
export function addVuetifyOptions(options: any) {
|
|
37
|
+
return {
|
|
38
|
+
...options,
|
|
39
|
+
global: {
|
|
40
|
+
plugins: [vuetify],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* See the LICENSE file distributed with this work for additional
|
|
3
|
+
* information regarding copyright ownership.
|
|
4
|
+
*
|
|
5
|
+
* This is free software; you can redistribute it and/or modify it
|
|
6
|
+
* under the terms of the GNU Lesser General Public License as
|
|
7
|
+
* published by the Free Software Foundation; either version 2.1 of
|
|
8
|
+
* the License, or (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* This software is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
* Lesser General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
* License along with this software; if not, write to the Free
|
|
17
|
+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
18
|
+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { addVuetifyOptions } from "./utils/vuetify";
|
|
22
|
+
import XBtn from "../x-btn.vue";
|
|
23
|
+
import { VueWrapper, mount } from "@vue/test-utils";
|
|
24
|
+
import { describe, expect, it } from "vitest";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Mount a XBtn component with the default configuration.
|
|
28
|
+
* @param options - additional wrapper options, overriding the default ones
|
|
29
|
+
*/
|
|
30
|
+
function mountXBtn(options: unknown): VueWrapper {
|
|
31
|
+
return mount(XBtn, addVuetifyOptions(options));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe("x-btn", () => {
|
|
35
|
+
it("display the slot", () => {
|
|
36
|
+
const xBtn = mountXBtn({
|
|
37
|
+
slots: {
|
|
38
|
+
default: "Content",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
expect(xBtn.text()).eq("Content");
|
|
42
|
+
});
|
|
43
|
+
it("uses the variant", () => {
|
|
44
|
+
const xBtn = mountXBtn({
|
|
45
|
+
props: {
|
|
46
|
+
variant: "danger",
|
|
47
|
+
},
|
|
48
|
+
slots: {
|
|
49
|
+
default: "Content",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
expect(xBtn.classes()).toContain("text-error");
|
|
53
|
+
});
|
|
54
|
+
});
|
package/src/vue/css/style.css
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* 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
21
|
.load-spinner {
|
|
21
22
|
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><circle fill="%23B9B9B9" stroke="%23B9B9B9" stroke-width="6" r="15" cx="40" cy="100"><animate attributeName="opacity" calcMode="spline" dur="2" values="1;0;1;" keySplines=".5 0 .5 1;.5 0 .5 1" repeatCount="indefinite" begin="-.4"></animate></circle><circle fill="%23B9B9B9" stroke="%23B9B9B9" stroke-width="6" r="15" cx="100" cy="100"><animate attributeName="opacity" calcMode="spline" dur="2" values="1;0;1;" keySplines=".5 0 .5 1;.5 0 .5 1" repeatCount="indefinite" begin="-.2"></animate></circle><circle fill="%23B9B9B9" stroke="%23B9B9B9" stroke-width="6" r="15" cx="160" cy="100"><animate attributeName="opacity" calcMode="spline" dur="2" values="1;0;1;" keySplines=".5 0 .5 1;.5 0 .5 1" repeatCount="indefinite" begin="0"></animate></circle></svg>');
|
|
22
23
|
background-size: cover;
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
--cr-sizes-main-sidebar-min-width: 250px; /*The minimum width of the main sidebar*/
|
|
31
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*/
|
|
32
33
|
--cr-base-font-size: 16px;
|
|
34
|
+
--cr-base-text-color: var(--cr-color-gray-950);
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
/*
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type { TextFieldModel, TextFieldProps } from "@xwiki/cristal-dsapi";
|
|
3
|
-
import { computed } from "vue";
|
|
4
|
-
import { VFileInput } from "vuetify/components/VFileInput";
|
|
5
2
|
import messages from "../../translations";
|
|
3
|
+
import { computed, defineModel } from "vue";
|
|
6
4
|
import { useI18n } from "vue-i18n";
|
|
7
|
-
import {
|
|
5
|
+
import { VFileInput } from "vuetify/components/VFileInput";
|
|
6
|
+
import type { TextFieldModel, TextFieldProps } from "@xwiki/cristal-dsapi";
|
|
8
7
|
|
|
9
8
|
const { t } = useI18n({
|
|
10
9
|
messages,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { type TextFieldProps } from "@xwiki/cristal-dsapi";
|
|
3
|
-
import { computed } from "vue";
|
|
4
|
-
import { VTextField } from "vuetify/components/VTextField";
|
|
5
2
|
import messages from "../../translations";
|
|
3
|
+
import { computed } from "vue";
|
|
6
4
|
import { useI18n } from "vue-i18n";
|
|
5
|
+
import { VTextField } from "vuetify/components/VTextField";
|
|
6
|
+
import type { TextFieldProps } from "@xwiki/cristal-dsapi";
|
|
7
7
|
|
|
8
8
|
const { t } = useI18n({
|
|
9
9
|
messages,
|
package/src/vue/x-alert.vue
CHANGED
|
@@ -17,23 +17,21 @@ License along with this software; if not, write to the Free
|
|
|
17
17
|
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
|
+
<script setup lang="ts">
|
|
21
|
+
import type { AlertProps } from "@xwiki/cristal-dsapi";
|
|
22
|
+
|
|
23
|
+
defineProps<AlertProps>();
|
|
24
|
+
</script>
|
|
20
25
|
<template>
|
|
21
|
-
<v-alert :title="title" :type="type">
|
|
26
|
+
<v-alert :closable="closable" :title="title" :type="type" :text="description">
|
|
27
|
+
<x-btn
|
|
28
|
+
v-for="action of actions"
|
|
29
|
+
:key="action.name"
|
|
30
|
+
size="small"
|
|
31
|
+
variant="text"
|
|
32
|
+
@click="action.callback"
|
|
33
|
+
>{{ action.name }}</x-btn
|
|
34
|
+
>
|
|
22
35
|
<slot />
|
|
23
36
|
</v-alert>
|
|
24
37
|
</template>
|
|
25
|
-
<script lang="ts">
|
|
26
|
-
import type { PropType } from "vue";
|
|
27
|
-
import type { VAlert } from "vuetify/lib/components/VAlert/index.mjs";
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
components: {},
|
|
31
|
-
props: {
|
|
32
|
-
title: { type: String, required: true },
|
|
33
|
-
type: {
|
|
34
|
-
type: Object as PropType<VAlert["type"] | undefined>,
|
|
35
|
-
required: true,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
</script>
|
package/src/vue/x-breadcrumb.vue
CHANGED
package/src/vue/x-btn.vue
CHANGED
|
@@ -17,8 +17,41 @@ License along with this software; if not, write to the Free
|
|
|
17
17
|
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
|
+
<script lang="ts" setup>
|
|
21
|
+
import { computed } from "vue";
|
|
22
|
+
import type { BtnProps } from "@xwiki/cristal-dsapi";
|
|
23
|
+
|
|
24
|
+
const { variant } = defineProps<BtnProps>();
|
|
25
|
+
|
|
26
|
+
// Map the variants to corresponding vuetify colors.
|
|
27
|
+
const color = computed(() => {
|
|
28
|
+
let color = undefined;
|
|
29
|
+
switch (variant) {
|
|
30
|
+
case "default":
|
|
31
|
+
break;
|
|
32
|
+
case "primary":
|
|
33
|
+
color = "primary";
|
|
34
|
+
break;
|
|
35
|
+
case "success":
|
|
36
|
+
color = "success";
|
|
37
|
+
break;
|
|
38
|
+
case "neutral":
|
|
39
|
+
color = "secondary";
|
|
40
|
+
break;
|
|
41
|
+
case "warning":
|
|
42
|
+
color = "warning";
|
|
43
|
+
break;
|
|
44
|
+
case "danger":
|
|
45
|
+
color = "error";
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return color;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const vVariant = computed(() => (variant == "text" ? "text" : "tonal"));
|
|
52
|
+
</script>
|
|
20
53
|
<template>
|
|
21
|
-
<v-btn>
|
|
54
|
+
<v-btn :color="color" :variant="vVariant">
|
|
22
55
|
<slot />
|
|
23
56
|
</v-btn>
|
|
24
57
|
</template>
|
package/src/vue/x-divider.vue
CHANGED
package/src/vue/x-menu-item.vue
CHANGED
|
@@ -19,11 +19,11 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
|
19
19
|
-->
|
|
20
20
|
<script lang="ts" setup>
|
|
21
21
|
defineProps<{
|
|
22
|
-
|
|
22
|
+
value: string;
|
|
23
23
|
}>();
|
|
24
24
|
</script>
|
|
25
25
|
<template>
|
|
26
|
-
<v-list-item>
|
|
26
|
+
<v-list-item :value="value">
|
|
27
27
|
<slot name="default" />
|
|
28
28
|
</v-list-item>
|
|
29
29
|
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
See the LICENSE file distributed with this work for additional
|
|
3
|
+
information regarding copyright ownership.
|
|
4
|
+
|
|
5
|
+
This is free software; you can redistribute it and/or modify it
|
|
6
|
+
under the terms of the GNU Lesser General Public License as
|
|
7
|
+
published by the Free Software Foundation; either version 2.1 of
|
|
8
|
+
the License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This software is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
Lesser General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
License along with this software; if not, write to the Free
|
|
17
|
+
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
18
|
+
02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
|
+
-->
|
|
20
|
+
<script lang="ts" setup></script>
|
|
21
|
+
<template>
|
|
22
|
+
<v-list-subheader>
|
|
23
|
+
<slot name="default" />
|
|
24
|
+
</v-list-subheader>
|
|
25
|
+
</template>
|
package/src/vue/x-menu.vue
CHANGED
|
@@ -17,13 +17,15 @@ License along with this software; if not, write to the Free
|
|
|
17
17
|
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
|
-
<script lang="ts" setup>
|
|
21
|
-
defineProps<{
|
|
22
|
-
title: string;
|
|
23
|
-
}>();
|
|
24
|
-
</script>
|
|
20
|
+
<script lang="ts" setup></script>
|
|
25
21
|
<template>
|
|
26
|
-
|
|
22
|
+
<!-- v-menu needs to be attached inside Cristal DOM to fix its z-index.
|
|
23
|
+
We also reset the default z-index to set it in the style section. -->
|
|
24
|
+
<v-menu
|
|
25
|
+
:close-on-content-click="false"
|
|
26
|
+
attach="#xwCristalApp"
|
|
27
|
+
z-index="initial"
|
|
28
|
+
>
|
|
27
29
|
<template #activator="{ props }">
|
|
28
30
|
<span v-bind="props">
|
|
29
31
|
<slot name="activator" />
|
|
@@ -34,3 +36,8 @@ defineProps<{
|
|
|
34
36
|
</v-list>
|
|
35
37
|
</v-menu>
|
|
36
38
|
</template>
|
|
39
|
+
<style scoped>
|
|
40
|
+
.v-overlay {
|
|
41
|
+
z-index: var(--cr-z-index-dropdown);
|
|
42
|
+
}
|
|
43
|
+
</style>
|