@nextcloud/vue
Version:
Nextcloud vue components
92 lines (91 loc) • 2.04 kB
JavaScript
import { A as ActionGlobalMixin } from "./actionGlobal-DqVa7c7G.mjs";
function GetParent(context, name) {
let parent = context.$parent;
while (parent) {
if (parent.$options.name === name) {
return parent;
}
parent = parent.$parent;
}
}
const ActionTextMixin = {
mixins: [ActionGlobalMixin],
props: {
/**
* Icon to show with the action, can be either a CSS class or an URL
*/
icon: {
type: String,
default: ""
},
/**
* The main text content of the entry.
*/
name: {
type: String,
default: ""
},
/**
* The title attribute of the element.
*/
title: {
type: String,
default: ""
},
/**
* Whether we close the Actions menu after the click
*/
closeAfterClick: {
type: Boolean,
default: false
},
/**
* Aria label for the button. Not needed if the button has text.
*/
ariaLabel: {
type: String,
default: null
},
/**
* @deprecated To be removed in @nextcloud/vue 9. Migration guide: remove ariaHidden prop from NcAction* components.
* @todo Add a check in @nextcloud/vue 9 that this prop is not provided,
* otherwise root element will inherit incorrect aria-hidden.
*/
ariaHidden: {
type: Boolean,
default: null
}
},
emits: [
"click"
],
computed: {
/**
* Check if icon prop is an URL
*
* @return {boolean} Whether the icon prop is an URL
*/
isIconUrl() {
try {
return !!new URL(this.icon, this.icon.startsWith("/") ? window.location.origin : void 0);
} catch {
return false;
}
}
},
methods: {
onClick(event) {
this.$emit("click", event);
if (this.closeAfterClick) {
const parent = GetParent(this, "NcActions");
if (parent && parent.closeMenu) {
parent.closeMenu(false);
}
}
}
}
};
export {
ActionTextMixin as A
};
//# sourceMappingURL=actionText-BMig9Egt.mjs.map