UNPKG

@nextcloud/vue

Version:
1 lines 4 kB
{"version":3,"file":"actionText-D2-z0ud3.cjs","sources":["../../src/utils/GetParent.js","../../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\n/**\n * Get the first parent component matching the provided name\n *\n * @param {object} context the context to search from (usually this)\n * @param {string} name the parent name\n * @return {object|undefined} the parent component\n */\nfunction GetParent(context, name) {\n\tlet parent = context.$parent\n\twhile (parent) {\n\t\tif (parent.$options.name === name) {\n\t\t\treturn parent\n\t\t}\n\t\tparent = parent.$parent\n\t}\n}\n\nexport default GetParent\n","/**\n * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport GetParent from '../utils/GetParent.js'\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\t/**\n\t\t * @deprecated To be removed in @nextcloud/vue 9. Migration guide: remove ariaHidden prop from NcAction* components.\n\t\t * @todo Add a check in @nextcloud/vue 9 that this prop is not provided,\n\t\t * otherwise root element will inherit incorrect aria-hidden.\n\t\t */\n\t\tariaHidden: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: [\n\t\t'click',\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\tconst parent = GetParent(this, 'NcActions')\n\t\t\t\tif (parent && parent.closeMenu) {\n\t\t\t\t\tparent.closeMenu(false)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t},\n}\n"],"names":["actionGlobal"],"mappings":";;AAYA,SAAS,UAAU,SAAS,MAAM;AACjC,MAAI,SAAS,QAAQ;AACrB,SAAO,QAAQ;AACd,QAAI,OAAO,SAAS,SAAS,MAAM;AAClC,aAAO;AAAA,IACR;AACA,aAAS,OAAO;AAAA,EACjB;AACD;ACZA,MAAA,kBAAe;AAAA,EACd,QAAQ,CAACA,aAAAA,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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