|
1 |
- {"version":3,"sources":["../../src/mixins/toggleable.ts"],"names":[],"mappings":";;AAAA,OAAO,GAAP,MAAoC,KAApC;AAMA,OAAM,SAAU,OAAV,GAAkD;AAAA;;AAAA,QAA/B,IAA+B,uEAAxB,OAAwB;AAAA,QAAf,KAAe,uEAAP,OAAO;;AACtD,WAAO,IAAI,MAAJ,CAAW;AAChB,cAAM,YADU;AAGhB,eAAO,EAAE,UAAF,EAAQ,YAAR,EAHS;AAKhB,mCACG,IADH,EACU,EAAE,UAAU,KAAZ,EADV,CALgB;AAShB,YATgB,kBASZ;AACF,mBAAO;AACL,0BAAU,CAAC,CAAC,KAAK,IAAL;AADP,aAAP;AAGD,SAbe;;AAehB,qDACG,IADH,YACU,GADV,EACa;AACT,iBAAK,QAAL,GAAgB,CAAC,CAAC,GAAlB;AACD,SAHH,yDAIY,GAJZ,EAIe;AACX,aAAC,CAAC,GAAF,KAAU,KAAK,IAAL,CAAV,IAAwB,KAAK,KAAL,CAAW,KAAX,EAAkB,GAAlB,CAAxB;AACD,SANH;AAfgB,KAAX,CAAP;AAwBD;AAED;AACA,IAAM,aAAa,SAAnB;AAEA,eAAe,UAAf","sourcesContent":["import Vue, { VueConstructor } from 'vue'\n\n/* eslint-disable-next-line no-use-before-define */\nexport type Toggleable<T extends string = 'value'> = VueConstructor<Vue & { isActive: boolean } & Record<T, any>>\n\nexport function factory<T extends string = 'value'> (prop?: T, event?: string): Toggleable<T>\nexport function factory (prop = 'value', event = 'input') {\n return Vue.extend({\n name: 'toggleable',\n\n model: { prop, event },\n\n props: {\n [prop]: { required: false }\n },\n\n data () {\n return {\n isActive: !!this[prop]\n }\n },\n\n watch: {\n [prop] (val) {\n this.isActive = !!val\n },\n isActive (val) {\n !!val !== this[prop] && this.$emit(event, val)\n }\n }\n })\n}\n\n/* eslint-disable-next-line no-redeclare */\nconst Toggleable = factory()\n\nexport default Toggleable\n"],"sourceRoot":""}
|