@nextcloud/vue
Version:
Nextcloud vue components
1 lines • 3.08 kB
Source Map (JSON)
{"version":3,"file":"actionText-DYzDdbVe.mjs","sources":["../../src/mixins/actionText.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { warn } from 'vue'\nimport { NC_ACTIONS_CLOSE_MENU } from '../components/NcActions/useNcActions.ts'\nimport actionGlobal from './actionGlobal.js'\n\nexport default {\n\tmixins: [actionGlobal],\n\tprops: {\n\t\t/**\n\t\t * Icon to show with the action, can be either a CSS class or an URL\n\t\t */\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\t/**\n\t\t * The main text content of the entry.\n\t\t */\n\t\tname: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\t/**\n\t\t * The title attribute of the element.\n\t\t */\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t\t/**\n\t\t * Whether we close the Actions menu after the click\n\t\t */\n\t\tcloseAfterClick: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t\t/**\n\t\t * Aria label for the button. Not needed if the button has text.\n\t\t */\n\t\tariaLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tinject: {\n\t\tcloseMenu: {\n\t\t\tfrom: NC_ACTIONS_CLOSE_MENU,\n\t\t},\n\t},\n\n\temits: [\n\t\t'click',\n\t],\n\n\tcreated() {\n\t\tif ('ariaHidden' in this.$attrs) {\n\t\t\twarn('[NcAction*]: Do not set the ariaHidden attribute as the root element will inherit the incorrect aria-hidden.')\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Check if icon prop is an URL\n\t\t *\n\t\t * @return {boolean} Whether the icon prop is an URL\n\t\t */\n\t\tisIconUrl() {\n\t\t\ttry {\n\t\t\t\treturn !!(new URL(this.icon, this.icon.startsWith('/') ? window.location.origin : undefined))\n\t\t\t} catch {\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\tonClick(event) {\n\t\t\t/**\n\t\t\t * Emitted when the action is clicked\n\t\t\t *\n\t\t\t * @type {Event}\n\t\t\t */\n\t\t\tthis.$emit('click', event)\n\n\t\t\tif (this.closeAfterClick) {\n\t\t\t\tthis.closeMenu(false)\n\t\t\t}\n\t\t},\n\t},\n}\n"],"names":["actionGlobal"],"mappings":";;;AASA,MAAA,kBAAe;AAAA,EACd,QAAQ,CAACA,iBAAY;AAAA,EACrB,OAAO;AAAA;AAAA;AAAA;AAAA,IAIN,MAAM;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACZ;AAAA;AAAA;AAAA;AAAA,IAIE,MAAM;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACZ;AAAA;AAAA;AAAA;AAAA,IAIE,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACZ;AAAA;AAAA;AAAA;AAAA,IAIE,iBAAiB;AAAA,MAChB,MAAM;AAAA,MACN,SAAS;AAAA,IACZ;AAAA;AAAA;AAAA;AAAA,IAIE,WAAW;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACZ;AAAA,EACA;AAAA,EAEC,QAAQ;AAAA,IACP,WAAW;AAAA,MACV,MAAM;AAAA,IACT;AAAA,EACA;AAAA,EAEC,OAAO;AAAA,IACN;AAAA,EACF;AAAA,EAEC,UAAU;AACT,QAAI,gBAAgB,KAAK,QAAQ;AAChC,WAAK,8GAA8G;AAAA,IACpH;AAAA,EACD;AAAA,EAEA,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMT,YAAY;AACX,UAAI;AACH,eAAO,CAAC,CAAE,IAAI,IAAI,KAAK,MAAM,KAAK,KAAK,WAAW,GAAG,IAAI,OAAO,SAAS,SAAS,MAAS;AAAA,MAC5F,QAAQ;AACP,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACF;AAAA,EAEC,SAAS;AAAA,IACR,QAAQ,OAAO;AAMd,WAAK,MAAM,SAAS,KAAK;AAEzB,UAAI,KAAK,iBAAiB;AACzB,aAAK,UAAU,KAAK;AAAA,MACrB;AAAA,IACD;AAAA,EACF;AACA;"}