{"version":3,"sources":["webpack:///../../../src/components/VForm/VForm.ts","webpack:///./src/modules/value-proposition/EditValueProposition.vue?2d1a","webpack:///./src/modules/value-proposition/EditValueProposition.vue","webpack:///./src/modules/value-proposition/EditValueProposition.vue?39d9","webpack:///./src/modules/value-proposition/EditValueProposition.vue?6944"],"names":["name","provide","form","this","inheritAttrs","props","disabled","lazyValidation","readonly","value","Boolean","data","inputs","watchers","errorBag","watch","handler","errors","Object","deep","immediate","methods","watchInput","watcher","input","val","_uid","valid","shouldValidate","validate","filter","reset","resetErrorBag","setTimeout","resetValidation","register","unregister","found","find","i","unwatch","render","h","staticClass","attrs","novalidate","attrs$","on","submit","e","$slots","_vm","_h","$createElement","_c","_self","_v","ref","nativeOn","$event","preventDefault","submitForm","model","staticRenderFns","extend","components","InputFieldCpt","InputRichTextCpt","created","valueProposition","getValueProposition","getDataAndDefaultValidationProps","postValueProposition","handleValidationErrors","success","component","VBtn","VForm"],"mappings":"+OAoBe,sBAAO,EAAD,KAEnB,eAAmB,SAFN,OAIN,CACPA,KADO,SAGPC,QAHO,WAIL,MAAO,CAAEC,KAAMC,OAGjBC,cAPO,EASPC,MAAO,CACLC,SADK,QAELC,eAFK,QAGLC,SAHK,QAILC,MAAOC,SAGTC,KAAM,iBAAO,CACXC,OADW,GAEXC,SAFW,GAGXC,SAAU,KAGZC,MAAO,CACLD,SAAU,CACRE,QADQ,SACD,GACL,IAAMC,EAASC,OAAA,oBAAf,GAEAf,KAAA,mBAEFgB,MANQ,EAORC,WAAW,IAIfC,QAAS,CACPC,WADO,SACG,GAAY,WACdC,EAAW,SAAAC,GACf,OAAOA,EAAA,mBAA0B,SAAAC,GAC/B,OAAU,EAAV,SAAyBD,EAAzB,UACC,CAAEJ,WAAW,KAGZP,EAAqB,CACzBa,KAAMF,EADmB,KAEzBG,MAAO,aACPC,eAAgB,cAiBlB,OAdIzB,KAAJ,eAEEU,EAAA,eAA0BW,EAAA,yBAAgC,SAAAC,GACxD,IAGI,0BAA6BD,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ACQ,EAAIK,GAAG,4BAA4BF,EAAG,SAAS,CAACG,IAAI,OAAOC,SAAS,CAAC,OAAS,SAASC,GAAgC,OAAxBA,EAAOC,iBAAwBT,EAAIU,WAAWF,MAAW,CAACL,EAAG,gBAAgB,CAACV,MAAM,CAAC,MAAQO,EAAIW,MAAM,KAAO,QAAQ,MAAQ,WAAWR,EAAG,mBAAmB,CAACV,MAAM,CAAC,MAAQO,EAAIW,MAAM,KAAO,OAAO,MAAQ,uBAAuBR,EAAG,MAAM,CAACX,YAAY,gBAAgB,CAACW,EAAG,QAAQ,CAACV,MAAM,CAAC,MAAQ,UAAU,UAAY,IAAIG,GAAG,CAAC,MAAQI,EAAIU,aAAa,CAACV,EAAIK,GAAG,aAAa,IAAI,IAAI,IACpmBO,EAAkB,G,wEC4BP,SAAIC,OAAO,CACxBhE,KAAM,uBACNiE,WAAY,CACVC,cAAA,OACAC,iBAAA,QAEFxD,KAAM,iBAAO,CACXmD,MAAO,IAAI,OAAyB,CAAE7C,OAAQ,OAE1CmD,QATkB,WASX,wKACQ,OAAWC,mBAAmBC,sBAAsBC,mCAD5D,OACX,EAAKT,MADM,qDAGbzC,QAAS,CACDwC,WADC,WACS,wKACR,OAAWQ,mBAAmBG,qBAAqB,EAAKV,OAAOW,uBAAuB,EAAKX,OADnF,OAEd,OAAqBY,QAAQ,2BAFf,iDC1C6Y,I,yDCO7ZC,EAAY,eACd,EACAlC,EACAsB,GACA,EACA,KACA,KACA,MAIa,aAAAY,EAAiB,QAMhC,IAAkBA,EAAW,CAACC,OAAA,KAAKC,QAAA","file":"js/valueProposition~31ecd969.d9b7f373.js","sourcesContent":["// Components\nimport VInput from '../VInput/VInput'\n\n// Mixins\nimport mixins from '../../util/mixins'\nimport BindsAttrs from '../../mixins/binds-attrs'\nimport { provide as RegistrableProvide } from '../../mixins/registrable'\n\n// Helpers\nimport { VNode } from 'vue'\n\ntype ErrorBag = Record<number, boolean>\ntype VInputInstance = InstanceType<typeof VInput>\ntype Watchers = {\n  _uid: number\n  valid: () => void\n  shouldValidate: () => void\n}\n\n/* @vue/component */\nexport default mixins(\n  BindsAttrs,\n  RegistrableProvide('form')\n  /* @vue/component */\n).extend({\n  name: 'v-form',\n\n  provide (): object {\n    return { form: this }\n  },\n\n  inheritAttrs: false,\n\n  props: {\n    disabled: Boolean,\n    lazyValidation: Boolean,\n    readonly: Boolean,\n    value: Boolean,\n  },\n\n  data: () => ({\n    inputs: [] as VInputInstance[],\n    watchers: [] as Watchers[],\n    errorBag: {} as ErrorBag,\n  }),\n\n  watch: {\n    errorBag: {\n      handler (val) {\n        const errors = Object.values(val).includes(true)\n\n        this.$emit('input', !errors)\n      },\n      deep: true,\n      immediate: true,\n    },\n  },\n\n  methods: {\n    watchInput (input: any): Watchers {\n      const watcher = (input: any): (() => void) => {\n        return input.$watch('hasError', (val: boolean) => {\n          this.$set(this.errorBag, input._uid, val)\n        }, { immediate: true })\n      }\n\n      const watchers: Watchers = {\n        _uid: input._uid,\n        valid: () => {},\n        shouldValidate: () => {},\n      }\n\n      if (this.lazyValidation) {\n        // Only start watching inputs if we need to\n        watchers.shouldValidate = input.$watch('shouldValidate', (val: boolean) => {\n          if (!val) return\n\n          // Only watch if we're not already doing it\n          if (this.errorBag.hasOwnProperty(input._uid)) return\n\n          watchers.valid = watcher(input)\n        })\n      } else {\n        watchers.valid = watcher(input)\n      }\n\n      return watchers\n    },\n    /** @public */\n    validate (): boolean {\n      return this.inputs.filter(input => !input.validate(true)).length === 0\n    },\n    /** @public */\n    reset (): void {\n      this.inputs.forEach(input => input.reset())\n      this.resetErrorBag()\n    },\n    resetErrorBag () {\n      if (this.lazyValidation) {\n        // Account for timeout in validatable\n        setTimeout(() => {\n          this.errorBag = {}\n        }, 0)\n      }\n    },\n    /** @public */\n    resetValidation () {\n      this.inputs.forEach(input => input.resetValidation())\n      this.resetErrorBag()\n    },\n    register (input: VInputInstance) {\n      this.inputs.push(input)\n      this.watchers.push(this.watchInput(input))\n    },\n    unregister (input: VInputInstance) {\n      const found = this.inputs.find(i => i._uid === input._uid)\n\n      if (!found) return\n\n      const unwatch = this.watchers.find(i => i._uid === found._uid)\n      if (unwatch) {\n        unwatch.valid()\n        unwatch.shouldValidate()\n      }\n\n      this.watchers = this.watchers.filter(i => i._uid !== found._uid)\n      this.inputs = this.inputs.filter(i => i._uid !== found._uid)\n      this.$delete(this.errorBag, found._uid)\n    },\n  },\n\n  render (h): VNode {\n    return h('form', {\n      staticClass: 'v-form',\n      attrs: {\n        novalidate: true,\n        ...this.attrs$,\n      },\n      on: {\n        submit: (e: Event) => this.$emit('submit', e),\n      },\n    }, this.$slots.default)\n  },\n})\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:\"headline\"},[_vm._v(\"Edit Value Proposition\")]),_c('v-form',{ref:\"form\",nativeOn:{\"submit\":function($event){$event.preventDefault();return _vm.submitForm($event)}}},[_c('InputFieldCpt',{attrs:{\"model\":_vm.model,\"prop\":\"title\",\"label\":\"Title\"}}),_c('InputRichTextCpt',{attrs:{\"model\":_vm.model,\"prop\":\"text\",\"label\":\"Value Proposition\"}}),_c('div',{staticClass:\"form-actions\"},[_c('v-btn',{attrs:{\"color\":\"primary\",\"depressed\":\"\"},on:{\"click\":_vm.submitForm}},[_vm._v(\" Save \")])],1)],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\r\nimport Vue from 'vue';\r\n\r\nimport { ApiService, NotificationProvider } from '@/core/services';\r\nimport { GetValuePropositionModel } from '@/core/webapi';\r\nimport { InputFieldCpt, InputRichTextCpt } from '@/core/components';\r\n\r\nexport default Vue.extend({\r\n  name: 'EditValueProposition',\r\n  components: {\r\n    InputFieldCpt,\r\n    InputRichTextCpt,\r\n  },\r\n  data: () => ({\r\n    model: new GetValuePropositionModel({ errors: [] } as any),\r\n  }),\r\n  async created() {\r\n    this.model = await ApiService.valueProposition().getValueProposition().getDataAndDefaultValidationProps();\r\n  },\r\n  methods: {\r\n    async submitForm() {\r\n      await ApiService.valueProposition().postValueProposition(this.model).handleValidationErrors(this.model);\r\n      NotificationProvider.success('Value proposition saved');\r\n    },\r\n  },\r\n});\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./EditValueProposition.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./EditValueProposition.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./EditValueProposition.vue?vue&type=template&id=58fa4a74&\"\nimport script from \"./EditValueProposition.vue?vue&type=script&lang=ts&\"\nexport * from \"./EditValueProposition.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VBtn } from 'vuetify/lib/components/VBtn';\nimport { VForm } from 'vuetify/lib/components/VForm';\ninstallComponents(component, {VBtn,VForm})\n"],"sourceRoot":""}