2020-10-19 16:38:49 +00:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import {
|
|
|
|
faEnvelope,
|
|
|
|
faLock,
|
2020-10-20 21:28:24 +00:00
|
|
|
faLockOpen,
|
2020-10-20 21:25:59 +00:00
|
|
|
faGlobe
|
2020-10-19 16:38:49 +00:00
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
library.add(
|
|
|
|
faEnvelope,
|
2020-10-20 21:25:59 +00:00
|
|
|
faGlobe,
|
2020-10-19 16:38:49 +00:00
|
|
|
faLock,
|
2020-10-20 21:28:24 +00:00
|
|
|
faLockOpen
|
2020-10-19 16:38:49 +00:00
|
|
|
)
|
|
|
|
|
2019-03-03 13:15:41 +00:00
|
|
|
const ScopeSelector = {
|
|
|
|
props: [
|
|
|
|
'showAll',
|
|
|
|
'userDefault',
|
|
|
|
'originalScope',
|
|
|
|
'initialScope',
|
|
|
|
'onScopeChange'
|
|
|
|
],
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
currentScope: this.initialScope
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
showNothing () {
|
|
|
|
return !this.showPublic && !this.showUnlisted && !this.showPrivate && !this.showDirect
|
|
|
|
},
|
|
|
|
showPublic () {
|
|
|
|
return this.originalScope !== 'direct' && this.shouldShow('public')
|
|
|
|
},
|
|
|
|
showUnlisted () {
|
|
|
|
return this.originalScope !== 'direct' && this.shouldShow('unlisted')
|
|
|
|
},
|
|
|
|
showPrivate () {
|
|
|
|
return this.originalScope !== 'direct' && this.shouldShow('private')
|
|
|
|
},
|
|
|
|
showDirect () {
|
|
|
|
return this.shouldShow('direct')
|
|
|
|
},
|
|
|
|
css () {
|
|
|
|
return {
|
2019-07-05 07:02:14 +00:00
|
|
|
public: { selected: this.currentScope === 'public' },
|
|
|
|
unlisted: { selected: this.currentScope === 'unlisted' },
|
|
|
|
private: { selected: this.currentScope === 'private' },
|
|
|
|
direct: { selected: this.currentScope === 'direct' }
|
2019-03-03 13:15:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
shouldShow (scope) {
|
|
|
|
return this.showAll ||
|
|
|
|
this.currentScope === scope ||
|
|
|
|
this.originalScope === scope ||
|
|
|
|
this.userDefault === scope ||
|
2019-03-30 10:34:13 +00:00
|
|
|
scope === 'direct'
|
2019-03-03 13:15:41 +00:00
|
|
|
},
|
|
|
|
changeVis (scope) {
|
|
|
|
this.currentScope = scope
|
|
|
|
this.onScopeChange && this.onScopeChange(scope)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ScopeSelector
|