|
1 |
- {"version":3,"sources":["../../src/mixins/groupable.ts"],"names":[],"mappings":";;;AACA,SAAsB,UAAU,iBAAhC,QAAyD,eAAzD;AAeA,OAAM,SAAU,OAAV,CACJ,SADI,EAEJ,KAFI,EAGJ,MAHI,EAGW;AAEf,WAAO,kBAAkB,SAAlB,EAA6B,KAA7B,EAAoC,MAApC,EAA4C,MAA5C,CAAmD;AACxD,cAAM,WADkD;AAGxD,eAAO;AACL,yBAAa;AACX,sBAAM,MADK;AAEX,uBAFW,sBAEJ;AACL,wBAAI,CAAC,KAAK,SAAL,CAAL,EAAsB,OAAO,SAAP;AAEtB,2BAAO,KAAK,SAAL,EAAgB,WAAvB;AACD;AANU,aADR;AASL,sBAAU;AATL,SAHiD;AAexD,YAfwD,kBAepD;AACF,mBAAO;AACL,0BAAU;AADL,aAAP;AAGD,SAnBuD;;AAqBxD,kBAAU;AACR,wBADQ,0BACI;AACV,oBAAI,CAAC,KAAK,WAAV,EAAuB,OAAO,EAAP;AAEvB,2CACG,KAAK,WADR,EACsB,KAAK,QAD3B;AAGD;AAPO,SArB8C;AA+BxD,eA/BwD,qBA+BjD;AACL,iBAAK,SAAL,KAAoB,KAAK,SAAL,EAAwB,QAAxB,CAAiC,IAAjC,CAApB;AACD,SAjCuD;AAmCxD,qBAnCwD,2BAmC3C;AACX,iBAAK,SAAL,KAAoB,KAAK,SAAL,EAAwB,UAAxB,CAAmC,IAAnC,CAApB;AACD,SArCuD;;AAuCxD,iBAAS;AACP,kBADO,oBACD;AACJ,qBAAK,KAAL,CAAW,QAAX;AACD;AAHM;AAvC+C,KAAnD,CAAP;AA6CD;AAED;AACA,IAAM,YAAY,QAAQ,WAAR,CAAlB;AAEA,eAAe,SAAf","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> = VueConstructor<ExtractVue<Registrable<T>> & {\n activeClass: string\n isActive: boolean\n groupClasses: object\n toggle (): void\n}>\n\nexport function factory<T extends string> (\n namespace: T,\n child?: string,\n parent?: string\n): Groupable<T> {\n return RegistrableInject(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\n/* eslint-disable-next-line no-redeclare */\nconst Groupable = factory('itemGroup')\n\nexport default Groupable\n"],"sourceRoot":""}
|