@nextcloud/vue
Version:
Nextcloud vue components
1 lines • 2.31 kB
Source Map (JSON)
{"version":3,"file":"actionGlobal-ec7003e8.cjs","sources":["../../src/mixins/actionGlobal.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 */\nimport Vue from 'vue'\n\nexport default {\n\tbefore() {\n\t\t// all actions requires a valid text content\n\t\t// if none, forbid the component mount and throw error\n\t\tif (!this.$slots.default || this.text.trim() === '') {\n\t\t\tVue.util.warn(`${this.$options.name} cannot be empty and requires a meaningful text content`, this)\n\t\t\tthis.$destroy()\n\t\t\tthis.$el.remove()\n\t\t}\n\t},\n\n\tbeforeUpdate() {\n\t\tthis.text = this.getText()\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// $slots are not reactive.\n\t\t\t// We need to update the content manually\n\t\t\ttext: this.getText(),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tisLongText() {\n\t\t\treturn this.text && this.text.trim().length > 20\n\t\t},\n\t},\n\n\tmethods: {\n\t\tgetText() {\n\t\t\treturn this.$slots.default ? this.$slots.default[0].text.trim() : ''\n\t\t},\n\t},\n}\n"],"names":["ActionGlobalMixin","Vue"],"mappings":"oCAuBeA,EAAA,CACd,QAAS,EAGJ,CAAC,KAAK,OAAO,SAAW,KAAK,KAAK,KAAM,IAAK,MAChDC,EAAI,KAAK,KAAK,GAAG,KAAK,SAAS,IAA+D,0DAAA,IAAI,EAClG,KAAK,SAAU,EACf,KAAK,IAAI,OAAQ,EAElB,EAED,cAAe,CACd,KAAK,KAAO,KAAK,QAAS,CAC1B,EAED,MAAO,CACN,MAAO,CAGN,KAAM,KAAK,QAAS,CACpB,CACD,EAED,SAAU,CACT,YAAa,CACZ,OAAO,KAAK,MAAQ,KAAK,KAAK,KAAI,EAAG,OAAS,EAC9C,CACD,EAED,QAAS,CACR,SAAU,CACT,OAAO,KAAK,OAAO,QAAU,KAAK,OAAO,QAAQ,CAAC,EAAE,KAAK,KAAM,EAAG,EAClE,CACD,CACF"}