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

fix: NcUserBubble properties #4743

Merged
merged 3 commits into from
Nov 4, 2023
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
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)
susnux marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related?


declare const SCOPE_VERSION: string

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