Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1625] Fix breadcrumbs router error #1627

Merged
merged 5 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/ui/src/components/va-breadcrumbs/VaBreadcrumbs.demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@
</va-breadcrumbs>
</VbCard>

<VbCard
title="Vertical"
>
<va-breadcrumbs vertical>
<va-breadcrumbs-item label="One" />
<va-breadcrumbs-item label="Two" />
<va-breadcrumbs-item label="Three" />
</va-breadcrumbs>
</VbCard>

<VbCard title="Color">
Color:
<va-breadcrumbs color="danger">
Expand Down
6 changes: 4 additions & 2 deletions packages/ui/src/components/va-breadcrumbs/VaBreadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ export default defineComponent({
}

const createSeparatorComponent = () => {
// Temp fix for https://github.com/vuejs/vue-next/issues/3666. Move `separatorNode` outside this method.
const separatorNode = (slots.separator ? slots.separator() : 0) || [props.separator]
// Temp fix for https://github.com/intlify/vue-i18n-next/issues/412
// `separatorNode` can be moved outside this method after update vuestic's minimal vue version to 3.1.0
// testing: have to monitor errors after leaving breadcrumbs page in doc
const separatorNode = slots.separator ? slots.separator() : [props.separator]

return h('span', {
class: ['va-breadcrumbs__separator'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ export default defineComponent({
setup: (props) => {
const { hasRouterLinkParams, hrefComputed } = useRouterLink(props)

const isDisabled = computed(() => props.disabled || hasRouterLinkParams.value)
const isDisabled = computed(() => props.disabled || !hasRouterLinkParams.value)

return { isDisabled, hrefComputed }
},
})
</script>

<style lang="scss">
@import "variables";

.va-breadcrumb-item {
display: var(--va-breadcrumb-item-display);
color: var(--va-breadcrumb-item-color);
Expand Down
16 changes: 2 additions & 14 deletions packages/ui/src/composables/useRouterLink.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
import { computed, PropType, getCurrentInstance } from 'vue'

export interface RouterLinkProps {
tag: string
to: string | Record<string, unknown>
replace: boolean
append: boolean
exact: boolean
activeClass: string
exactActiveClass: string
href: string
target: string
}
import { computed, PropType, getCurrentInstance, ExtractPropTypes } from 'vue'

export const useRouterLinkProps = {
tag: { type: String as PropType<string>, default: 'router-link' },
Expand All @@ -24,7 +12,7 @@ export const useRouterLinkProps = {
target: { type: String as PropType<string>, default: '' },
}

export const useRouterLink = (props: RouterLinkProps) => {
export const useRouterLink = (props: ExtractPropTypes<typeof useRouterLinkProps>) => {
const globalProperties = computed(() => getCurrentInstance()?.appContext.config.globalProperties)
const isNuxt = computed(() => !!globalProperties.value?.$nuxt)
const vueRouter = computed(() => globalProperties.value?.$router)
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/AlignMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class AlignMixinProps {
})
}

/** @deprecated */
export class AlignMixin extends Vue.with(AlignMixinProps) {
get alignComputed () {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type ClickOutsideOptions = {
onClickOutside: (e: Event | undefined) => void;
}

/** @deprecated */
class ClickOutsideMixin extends Vue {
// Set it `true` to prevent handling a bubbled event
// before handling a captured one for the first time
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/LoadingMixin/LoadingMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Props {
loading = prop<boolean>({ type: Boolean, default: false })
}

/** @deprecated */
export class LoadingMixin extends Vue.with(Props) {
isLoadingMixin!: boolean

Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/RouterLinkMixin/RouterLinkMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class RouterLinkProps {

const RouterLinkPropsMixin = Vue.with(RouterLinkProps)

/** @deprecated */
@Options({})
export class RouterLinkMixin extends mixins(
RouterLinkPropsMixin,
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/ScrollMixin/ScrollMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function getTargetElement (target: Element | string | null) {
return typeof target === 'string' ? document.querySelector(target) : target
}

/** @deprecated */
export function setupScroll (target: Element | string, onScrollCallback: (e: Event) => void) {
const scrollRoot = ref(null)
let targetElement: Element | null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SelectableListProps {

const SelectableListPropsMixin = Vue.with(SelectableListProps)

/** @deprecated */
export class SelectableListMixin extends mixins(
FormComponentMixin,
SelectableListPropsMixin,
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/SelectableMixin/SelectableMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Props {

const PropsMixin = Vue.with(Props)

/** @deprecated */
@Options({
emits: ['update:modelValue', 'focus', 'blur'],
})
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/SizeMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class SizeProps {
})
}

/** @deprecated */
export class SizeMixin extends mixins(Vue.with(SizeProps)) {
fontRegex = /(?<fontSize>\d+)(?<extension>px|rem)/i

Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/StatefulMixin/StatefulMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const PropsMixin = Vue.with(Props)

// TODO Definitions could be done better, but it's too complicated to bother.

/** @deprecated */
@Options({
emits: ['update:modelValue'],
})
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/mixins/StatefulMixin/cStatefulMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ref, computed, toRefs } from 'vue'
* if `stateful` prop is `false`
* Record<any, any> & Record<'modelValue', T>
*/
/** @deprecated */
export function useStateful<T, D extends T | undefined> (
props: { [key: string]: any, modelValue?: T },
emit: (event: 'update:modelValue', ...args: any[]) => void,
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/services/color-config/ColorMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Props {
})
}

/** @deprecated */
@Options({})
class ColorMixin extends Vue.with(Props) {
hasColorThemeMixin!: boolean
Expand Down