1 line
2.9 KiB
Text
1 line
2.9 KiB
Text
|
{"version":3,"sources":["../../../src/mixins/groupable/index.ts"],"names":[],"mappings":";;;;;;;;AACA;;;;AAgBM,SAAU,OAAV,CACJ,SADI,EAEJ,KAFI,EAGJ,MAHI,EAGW;AAEf;AACA,MAAM,CAAC,GAAG,yBAAwB,SAAxB,EAAmC,KAAnC,EAA0C,MAA1C,EAAkD,MAAlD,CAAyD;AACjE,IAAA,IAAI,EAAE,WAD2D;AAGjE,IAAA,KAAK,EAAE;AACL,MAAA,WAAW,EAAE;AACX,QAAA,IAAI,EAAE,MADK;AAEX,QAAA,OAFW,sBAEJ;AACL,cAAI,CAAC,KAAK,SAAL,CAAL,EAAsB,OAAO,SAAP;AAEtB,iBAAO,KAAK,SAAL,EAAgB,WAAvB;AACD;AANU,OADR;AASL,MAAA,QAAQ,EAAE;AATL,KAH0D;AAejE,IAAA,IAfiE,kBAe7D;AACF,aAAO;AACL,QAAA,QAAQ,EAAE;AADL,OAAP;AAGD,KAnBgE;AAqBjE,IAAA,QAAQ,EAAE;AACR,MAAA,YADQ,0BACI;AACV,YAAI,CAAC,KAAK,WAAV,EAAuB,OAAO,EAAP;AAEvB,mCACG,KAAK,WADR,EACsB,KAAK,QAD3B;AAGD;AAPO,KArBuD;AA+BjE,IAAA,OA/BiE,qBA+B1D;AACL,WAAK,SAAL,KAAoB,KAAK,SAAL,EAAwB,QAAxB,CAAiC,IAAjC,CAApB;AACD,KAjCgE;AAmCjE,IAAA,aAnCiE,2BAmCpD;AACX,WAAK,SAAL,KAAoB,KAAK,SAAL,EAAwB,UAAxB,CAAmC,IAAnC,CAApB;AACD,KArCgE;AAuCjE,IAAA,OAAO,EAAE;AACP,MAAA,MADO,oBACD;AACJ,aAAK,KAAL,CAAW,QAAX;AACD;AAHM;AAvCwD,GAAzD,CAAV;AA8CA,SAAO,CAAP;AACD;AAED;;;AACA,IAAM,SAAS,GAAG,OAAO,CAAC,WAAD,CAAzB;gBAEe,S","sourcesContent":["// Mixins\nimport { Registrable, inject as RegistrableInject } from '../registrable'\n\n// Utilities\nimport { ExtractVue } from '../../util/mixins'\nimport { PropValidator } from 'vue/types/options'\nimport { VueConstructor } from 'vue'\n\n/* eslint-disable-next-line no-use-before-define */\nexport type Groupable<T extends string, C extends VueConstructor | null = null> = VueConstructor<ExtractVue<Registrable<T, C>> & {\n activeClass: string\n isActive: boolean\n disabled: boolean\n groupClasses: object\n toggle (): void\n}>\n\nexport function factory<T extends string, C extends VueConstructor | null = null> (\n namespace: T,\n child?: string,\n parent?: string\n): Groupable<T, C> {\n // TODO: ts 3.4 broke directly returning this\n const R = RegistrableInject<T, C>(namespace, child, parent).extend({\n name: 'groupable',\n\n props: {\n activeClass: {\n type: String,\n default (): string | undefined {\n if (!this[namespace]) return undefined\n\n return this[namespace].activeClass\n },\n } as any as PropValidator<string>,\n disabled: Boolean,\n },\n\n data () {\n return {\n isActive: false,\n }\n },\n\n computed: {\n groupClasses (): object {\n if (!this.activeClass) return {}\n\n return {\n [this.activeClass]: this.isActive,\n }\n },\n },\n\n created () {\n this[namespace] && (this[namespace] as any).register(this)\n },\n\n beforeDestroy () {\n this[namespace] && (this[namespace] as any).unregister(this)\n },\n\n methods: {\n toggle () {\n this.$emit('change')\n },\n },\n })\n\n return R\n}\n\n/* eslint-disable-next-line no-redeclare */\nconst Groupable = factory('itemGroup')\n\nexport default Groupable\n"],"sourceRoot":"","file":"index.js"}
|