1 line
1.6 KiB
Text
1 line
1.6 KiB
Text
|
{"version":3,"sources":["../../../src/mixins/toggleable/index.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;AAMM,SAAU,OAAV,GAAkD;AAAA;;AAAA,MAA/B,IAA+B,uEAAxB,OAAwB;AAAA,MAAf,KAAe,uEAAP,OAAO;AACtD,SAAO,aAAI,MAAJ,CAAW;AAChB,IAAA,IAAI,EAAE,YADU;AAGhB,IAAA,KAAK,EAAE;AAAE,MAAA,IAAI,EAAJ,IAAF;AAAQ,MAAA,KAAK,EAAL;AAAR,KAHS;AAKhB,IAAA,KAAK,sBACF,IADE,EACK;AAAE,MAAA,QAAQ,EAAE;AAAZ,KADL,CALW;AAShB,IAAA,IATgB,kBASZ;AACF,aAAO;AACL,QAAA,QAAQ,EAAE,CAAC,CAAC,KAAK,IAAL;AADP,OAAP;AAGD,KAbe;AAehB,IAAA,KAAK,wCACF,IADE,YACK,GADL,EACQ;AACT,WAAK,QAAL,GAAgB,CAAC,CAAC,GAAlB;AACD,KAHE,yDAIO,GAJP,EAIU;AACX,OAAC,CAAC,GAAF,KAAU,KAAK,IAAL,CAAV,IAAwB,KAAK,KAAL,CAAW,KAAX,EAAkB,GAAlB,CAAxB;AACD,KANE;AAfW,GAAX,CAAP;AAwBD;AAED;;;AACA,IAAM,UAAU,GAAG,OAAO,EAA1B;eAEe,U","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":"","file":"index.js"}
|