Skip to content

Commit

Permalink
Merge pull request #4743 from nextcloud-libraries/fix/ncuser-bubble
Browse files Browse the repository at this point in the history
fix: NcUserBubble properties
  • Loading branch information
susnux committed Nov 4, 2023
2 parents 23007be + cda5090 commit 0a6b503
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/components/NcUserBubble/NcUserBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This component has the following slot:

```vue
<p>
Some text before <NcUserBubble user="admin" display-name="Admin Example" :url="'/test'">@admin@foreign-host.com</NcUserBubble> and after the bubble.
Some text before <NcUserBubble user="admin" display-name="Admin Example" url="/test">@admin@foreign-host.com</NcUserBubble> and after the bubble.
<NcUserBubble avatar-image="icon-group" display-name="test group xyz" :primary="true">Hey there!</NcUserBubble>
</p>
```
Expand All @@ -58,7 +58,15 @@ This component has the following slot:
</template>
</NcUserBubble>
</template>

<script>
export default {
methods: {
alert() {
alert('Removed')
},
},
}
</script>
<style>
.icon-close {
display: block;
Expand Down Expand Up @@ -115,6 +123,7 @@ This component has the following slot:
import NcUserBubbleDiv from './NcUserBubbleDiv.vue'
import NcAvatar from '../NcAvatar/index.js'
import NcPopover from '../NcPopover/index.js'
import Vue from 'vue'
export default {
name: 'NcUserBubble',
Expand Down Expand Up @@ -143,7 +152,7 @@ export default {
*/
displayName: {
type: String,
required: true,
default: undefined,
},
/**
* Whether or not to display the user-status
Expand All @@ -158,10 +167,10 @@ export default {
url: {
type: String,
default: undefined,
validator: url => {
validator: (url) => {
try {
url = new URL(url)
return !!url
url = new URL(url, url?.startsWith?.('/') ? window.location.href : undefined)
return true
} catch (error) {
return false
}
Expand Down Expand Up @@ -270,6 +279,11 @@ export default {
}
},
},
mounted() {
if (!this.displayName && !this.user) {
Vue.util.warn('[NcUserBubble] At least `displayName` or `user` property should be set.')
}
},
methods: {
onOpenChange(state) {
this.$emit('update:open', state)
Expand Down
6 changes: 6 additions & 0 deletions src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare const PRODUCTION: boolean

declare const SCOPE_VERSION: string

// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare const TRANSLATIONS: { locale: string, translations: any }[]

0 comments on commit 0a6b503

Please sign in to comment.