This commit is contained in:
darenhsu
2022-07-17 13:16:16 +08:00
parent 84759556ff
commit befd344ab0
28070 changed files with 4008428 additions and 1 deletions
+61
View File
@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _console = require("../../util/console");
var _vue = _interopRequireDefault(require("vue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Utilities
// Types
/**
* Bootable
* @mixin
*
* Used to add lazy content functionality to components
* Looks for change in "isActive" to automatically boot
* Otherwise can be set manually
*/
/* @vue/component */
var _default = _vue.default.extend().extend({
name: 'bootable',
props: {
eager: Boolean
},
data: function data() {
return {
isBooted: false
};
},
computed: {
hasContent: function hasContent() {
return this.isBooted || this.eager || this.isActive;
}
},
watch: {
isActive: function isActive() {
this.isBooted = true;
}
},
created: function created() {
/* istanbul ignore next */
if ('lazy' in this.$attrs) {
(0, _console.removed)('lazy', this);
}
},
methods: {
showLazyContent: function showLazyContent(content) {
return this.hasContent && content ? content() : [this.$createElement()];
}
}
});
exports.default = _default;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/mixins/bootable/index.ts"],"names":[],"mappings":";;;;;;;AACA;;AAGA;;;;AAJA;AAGA;;AAMA;;;;;;;;;AAQA;eACe,aAAI,MAAJ,GAA+B,MAA/B,CAAsC;AACnD,EAAA,IAAI,EAAE,UAD6C;AAGnD,EAAA,KAAK,EAAE;AACL,IAAA,KAAK,EAAE;AADF,GAH4C;AAOnD,EAAA,IAAI,EAAE;AAAA,WAAO;AACX,MAAA,QAAQ,EAAE;AADC,KAAP;AAAA,GAP6C;AAWnD,EAAA,QAAQ,EAAE;AACR,IAAA,UADQ,wBACE;AACR,aAAO,KAAK,QAAL,IAAiB,KAAK,KAAtB,IAA+B,KAAK,QAA3C;AACD;AAHO,GAXyC;AAiBnD,EAAA,KAAK,EAAE;AACL,IAAA,QADK,sBACG;AACN,WAAK,QAAL,GAAgB,IAAhB;AACD;AAHI,GAjB4C;AAuBnD,EAAA,OAvBmD,qBAuB5C;AACL;AACA,QAAI,UAAU,KAAK,MAAnB,EAA2B;AACzB,4BAAQ,MAAR,EAAgB,IAAhB;AACD;AACF,GA5BkD;AA8BnD,EAAA,OAAO,EAAE;AACP,IAAA,eADO,2BACU,OADV,EACiC;AACtC,aAAQ,KAAK,UAAL,IAAmB,OAApB,GAA+B,OAAO,EAAtC,GAA2C,CAAC,KAAK,cAAL,EAAD,CAAlD;AACD;AAHM;AA9B0C,CAAtC,C","sourcesContent":["// Utilities\nimport { removed } from '../../util/console'\n\n// Types\nimport Vue, { VNode } from 'vue'\ninterface Toggleable extends Vue {\n isActive?: boolean\n}\n\n/**\n * Bootable\n * @mixin\n *\n * Used to add lazy content functionality to components\n * Looks for change in \"isActive\" to automatically boot\n * Otherwise can be set manually\n */\n/* @vue/component */\nexport default Vue.extend<Vue & Toggleable>().extend({\n name: 'bootable',\n\n props: {\n eager: Boolean,\n },\n\n data: () => ({\n isBooted: false,\n }),\n\n computed: {\n hasContent (): boolean | undefined {\n return this.isBooted || this.eager || this.isActive\n },\n },\n\n watch: {\n isActive () {\n this.isBooted = true\n },\n },\n\n created () {\n /* istanbul ignore next */\n if ('lazy' in this.$attrs) {\n removed('lazy', this)\n }\n },\n\n methods: {\n showLazyContent (content?: () => VNode[]): VNode[] {\n return (this.hasContent && content) ? content() : [this.$createElement()]\n },\n },\n})\n"],"sourceRoot":"","file":"index.js"}