@nextcloud/vue
Version:
Nextcloud vue components
1 lines • 4.71 kB
Source Map (JSON)
{"version":3,"file":"actionText-bef01778.cjs","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":"4DA6BMA,EAAY,SAASC,EAASC,EAAM,CACzC,IAAIC,EAASF,EAAQ,QACrB,KAAOE,GAAQ,CACd,GAAIA,EAAO,SAAS,OAASD,EAC5B,OAAOC,EAERA,EAASA,EAAO,OAAA,CAElB,ECbeC,EAAA,CACd,OAAQ,CAACC,EAAAA,iBAAY,EACrB,MAAO,CAIN,KAAM,CACL,KAAM,OACN,QAAS,EACT,EAID,KAAM,CACL,KAAM,OACN,QAAS,EACT,EAID,MAAO,CACN,KAAM,OACN,QAAS,EACT,EAID,gBAAiB,CAChB,KAAM,QACN,QAAS,EACT,EAID,UAAW,CACV,KAAM,OACN,QAAS,EACT,EAID,WAAY,CACX,KAAM,QACN,QAAS,IACT,CACD,EAED,MAAO,CACN,OACA,EAED,SAAU,CACT,WAAY,CACX,GAAI,CACH,OAAO,IAAI,IAAI,KAAK,IAAI,CACxB,MAAC,CACD,MAAO,EACP,CACD,CACD,EAED,QAAS,CACR,QAAQC,EAAO,CAQd,GAFA,KAAK,MAAM,QAASA,CAAK,EAErB,KAAK,gBAAiB,CACzB,MAAMH,EAASH,EAAU,KAAM,WAAW,EACtCG,GAAUA,EAAO,WACpBA,EAAO,UAAU,EAAK,CAGxB,CAAA,CACD,CACF"}