UNPKG

@nextcloud/vue

Version:
1 lines 4.73 kB
{"version":3,"file":"actionText-6c35d3fc.mjs","sources":["../../src/utils/GetParent.js","../../src/mixins/actionText.js"],"sourcesContent":["/**\n * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\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 */\nconst GetParent = function(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 * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport actionGlobal from './actionGlobal.js'\nimport GetParent from '../utils/GetParent.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: '',\n\t\t},\n\t\t/**\n\t\t * aria-hidden attribute for the icon slot\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\tisIconUrl() {\n\t\t\ttry {\n\t\t\t\treturn new URL(this.icon)\n\t\t\t} catch (error) {\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":["GetParent","context","name","parent","ActionTextMixin","actionGlobal","event"],"mappings":";AA6BA,MAAMA,IAAY,SAASC,GAASC,GAAM;AACzC,MAAIC,IAASF,EAAQ;AACrB,SAAOE,KAAQ;AACd,QAAIA,EAAO,SAAS,SAASD;AAC5B,aAAOC;AAERA,QAASA,EAAO;AAAA,EAElB;AAAA,GCbeC,IAAA,EACd,QAAQ,CAACC,CAAY,GACrB,OAAO,EAIN,MAAM,EACL,MAAM,QACN,SAAS,GACT,GAID,MAAM,EACL,MAAM,QACN,SAAS,GACT,GAID,OAAO,EACN,MAAM,QACN,SAAS,GACT,GAID,iBAAiB,EAChB,MAAM,SACN,SAAS,GACT,GAID,WAAW,EACV,MAAM,QACN,SAAS,GACT,GAID,YAAY,EACX,MAAM,SACN,SAAS,KACT,EACD,GAED,OAAO,CACN,OACA,GAED,UAAU,EACT,YAAY;AACX,MAAI;AACH,WAAO,IAAI,IAAI,KAAK,IAAI;AAAA,EACxB,QAAC;AACD,WAAO;AAAA,EACP;AACD,EACD,GAED,SAAS,EACR,QAAQC,GAAO;AAQd,MAFA,KAAK,MAAM,SAASA,CAAK,GAErB,KAAK,iBAAiB;AACzB,UAAMH,IAASH,EAAU,MAAM,WAAW;AACtCG,SAAUA,EAAO,aACpBA,EAAO,UAAU,EAAK;AAAA,EAGxB;AAAA,EACD,EACF;"}