{"version":3,"sources":["webpack:///./src/demo/usages/file-inputs.vue?6d99","webpack:///src/demo/usages/file-inputs.vue","webpack:///./src/demo/usages/file-inputs.vue?f0fc","webpack:///./src/demo/usages/file-inputs.vue","webpack:///../../../src/components/VFileInput/VFileInput.ts","webpack:///../../../src/components/VTextField/index.ts","webpack:///./src/demo/usages/usage.js"],"names":["render","_vm","this","_h","$createElement","_c","_self","_b","attrs","staticRenderFns","component","VFileInput","name","model","prop","event","props","chips","clearable","type","default","counterSizeString","counterString","hideInput","placeholder","prependIcon","readonly","showSize","Boolean","validator","v","includes","smallChips","truncateLength","Number","value","val","computed","classes","computedCounterValue","fileCount","isMultiple","lazyValue","$vuetify","lang","t","bytes","internalArrayValue","reduce","size","base","internalValue","get","set","isDirty","length","isLabelActive","$attrs","hasOwnProperty","text","map","file","truncatedText","hasChips","watch","handler","immediate","$refs","input","methods","clearableCallback","genChips","small","on","genControl","display","genInput","genPrependSlot","icon","genIcon","genSlot","genSelectionText","genSelections","children","$scopedSlots","index","staticClass","class","selection","genTextFieldSlot","node","click","onInput","files","e","onKeyDown","truncateText","str","charsKeepOneSide","Math","Object"],"mappings":"mHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,eAAeJ,EAAIM,GAAG,CAACC,MAAM,CAAC,MAAQ,eAAe,eAAeP,EAAIO,OAAM,KAC7KC,EAAkB,G,YCStB,GACE,OAAF,UCXka,I,6CCO9ZC,EAAY,eACd,EACAV,EACAS,GACA,EACA,KACA,KACA,MAIa,aAAAC,EAAiB,QAKhC,IAAkBA,EAAW,CAACC,aAAA,Q,kQCNf,qBAAkB,CAC/BC,KAD+B,eAG/BC,MAAO,CACLC,KADK,QAELC,MAAO,UAGTC,MAAO,CACLC,MADK,QAELC,UAAW,CACTC,KADS,QAETC,SAAS,GAEXC,kBAAmB,CACjBF,KADiB,OAEjBC,QAAS,kCA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AGA,e,2DCHe,QACbjF,MAAO,CACLR,MAAO,CACLW,KAAMiF,OACNhF,QAAS,iBAAO","file":"js/usages16.93ff1abd.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-file-input',_vm._b({attrs:{\"label\":\"File input\"}},'v-file-input',_vm.attrs,false))}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\n\r\n\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./file-inputs.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/vuetify-loader/lib/loader.js??ref--18-0!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./file-inputs.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./file-inputs.vue?vue&type=template&id=61cfa563&\"\nimport script from \"./file-inputs.vue?vue&type=script&lang=js&\"\nexport * from \"./file-inputs.vue?vue&type=script&lang=js&\"\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 { VFileInput } from 'vuetify/lib/components/VFileInput';\ninstallComponents(component, {VFileInput})\n","// Styles\nimport './VFileInput.sass'\n\n// Extensions\nimport VTextField from '../VTextField'\n\n// Components\nimport { VChip } from '../VChip'\n\n// Types\nimport { PropValidator } from 'vue/types/options'\n\n// Utilities\nimport { deepEqual, humanReadableFileSize, wrapInArray } from '../../util/helpers'\nimport { consoleError } from '../../util/console'\nimport { mergeStyles } from '../../util/mergeData'\n\nexport default VTextField.extend({\n name: 'v-file-input',\n\n model: {\n prop: 'value',\n event: 'change',\n },\n\n props: {\n chips: Boolean,\n clearable: {\n type: Boolean,\n default: true,\n },\n counterSizeString: {\n type: String,\n default: '$vuetify.fileInput.counterSize',\n },\n counterString: {\n type: String,\n default: '$vuetify.fileInput.counter',\n },\n hideInput: Boolean,\n placeholder: String,\n prependIcon: {\n type: String,\n default: '$file',\n },\n readonly: {\n type: Boolean,\n default: false,\n },\n showSize: {\n type: [Boolean, Number],\n default: false,\n validator: (v: boolean | number) => {\n return (\n typeof v === 'boolean' ||\n [1000, 1024].includes(v)\n )\n },\n } as PropValidator,\n smallChips: Boolean,\n truncateLength: {\n type: [Number, String],\n default: 22,\n },\n type: {\n type: String,\n default: 'file',\n },\n value: {\n default: undefined,\n validator: val => {\n return wrapInArray(val).every(v => v != null && typeof v === 'object')\n },\n } as PropValidator,\n },\n\n computed: {\n classes (): object {\n return {\n ...VTextField.options.computed.classes.call(this),\n 'v-file-input': true,\n }\n },\n computedCounterValue (): string {\n const fileCount = (this.isMultiple && this.lazyValue)\n ? this.lazyValue.length\n : (this.lazyValue instanceof File) ? 1 : 0\n\n if (!this.showSize) return this.$vuetify.lang.t(this.counterString, fileCount)\n\n const bytes = this.internalArrayValue.reduce((bytes: number, { size = 0 }: File) => {\n return bytes + size\n }, 0)\n\n return this.$vuetify.lang.t(\n this.counterSizeString,\n fileCount,\n humanReadableFileSize(bytes, this.base === 1024)\n )\n },\n internalArrayValue (): File[] {\n return wrapInArray(this.internalValue)\n },\n internalValue: {\n get (): File[] {\n return this.lazyValue\n },\n set (val: File | File[]) {\n this.lazyValue = val\n this.$emit('change', this.lazyValue)\n },\n },\n isDirty (): boolean {\n return this.internalArrayValue.length > 0\n },\n isLabelActive (): boolean {\n return this.isDirty\n },\n isMultiple (): boolean {\n return this.$attrs.hasOwnProperty('multiple')\n },\n text (): string[] {\n if (!this.isDirty) return [this.placeholder]\n\n return this.internalArrayValue.map((file: File) => {\n const {\n name = '',\n size = 0,\n } = file\n\n const truncatedText = this.truncateText(name)\n\n return !this.showSize\n ? truncatedText\n : `${truncatedText} (${humanReadableFileSize(size, this.base === 1024)})`\n })\n },\n base (): 1000 | 1024 | undefined {\n return typeof this.showSize !== 'boolean' ? this.showSize : undefined\n },\n hasChips (): boolean {\n return this.chips || this.smallChips\n },\n },\n\n watch: {\n readonly: {\n handler (v) {\n if (v === true) consoleError('readonly is not supported on ', this)\n },\n immediate: true,\n },\n value (v) {\n const value = this.isMultiple ? v : v ? [v] : []\n if (!deepEqual(value, this.$refs.input.files)) {\n // When the input value is changed programatically, clear the\n // internal input's value so that the `onInput` handler\n // can be triggered again if the user re-selects the exact\n // same file(s). Ideally, `input.files` should be\n // manipulated directly but that property is readonly.\n this.$refs.input.value = ''\n }\n },\n },\n\n methods: {\n clearableCallback () {\n this.internalValue = this.isMultiple ? [] : null\n this.$refs.input.value = ''\n },\n genChips () {\n if (!this.isDirty) return []\n\n return this.text.map((text, index) => this.$createElement(VChip, {\n props: { small: this.smallChips },\n on: {\n 'click:close': () => {\n const internalValue = this.internalValue\n internalValue.splice(index, 1)\n this.internalValue = internalValue // Trigger the watcher\n },\n },\n }, [text]))\n },\n genControl () {\n const render = VTextField.options.methods.genControl.call(this)\n\n if (this.hideInput) {\n render.data!.style = mergeStyles(\n render.data!.style,\n { display: 'none' }\n )\n }\n\n return render\n },\n genInput () {\n const input = VTextField.options.methods.genInput.call(this)\n\n // We should not be setting value\n // programmatically on the input\n // when it is using type=\"file\"\n delete input.data!.domProps!.value\n\n // This solves an issue in Safari where\n // nothing happens when adding a file\n // do to the input event not firing\n // https://github.com/vuetifyjs/vuetify/issues/7941\n delete input.data!.on!.input\n input.data!.on!.change = this.onInput\n\n return [this.genSelections(), input]\n },\n genPrependSlot () {\n if (!this.prependIcon) return null\n\n const icon = this.genIcon('prepend', () => {\n this.$refs.input.click()\n })\n\n return this.genSlot('prepend', 'outer', [icon])\n },\n genSelectionText (): string[] {\n const length = this.text.length\n\n if (length < 2) return this.text\n if (this.showSize && !this.counter) return [this.computedCounterValue]\n return [this.$vuetify.lang.t(this.counterString, length)]\n },\n genSelections () {\n const children = []\n\n if (this.isDirty && this.$scopedSlots.selection) {\n this.internalArrayValue.forEach((file: File, index: number) => {\n if (!this.$scopedSlots.selection) return\n\n children.push(\n this.$scopedSlots.selection({\n text: this.text[index],\n file,\n index,\n })\n )\n })\n } else {\n children.push(this.hasChips && this.isDirty ? this.genChips() : this.genSelectionText())\n }\n\n return this.$createElement('div', {\n staticClass: 'v-file-input__text',\n class: {\n 'v-file-input__text--placeholder': this.placeholder && !this.isDirty,\n 'v-file-input__text--chips': this.hasChips && !this.$scopedSlots.selection,\n },\n }, children)\n },\n genTextFieldSlot () {\n const node = VTextField.options.methods.genTextFieldSlot.call(this)\n\n node.data!.on = {\n ...(node.data!.on || {}),\n click: () => this.$refs.input.click(),\n }\n\n return node\n },\n onInput (e: Event) {\n const files = [...(e.target as HTMLInputElement).files || []]\n\n this.internalValue = this.isMultiple ? files : files[0]\n\n // Set initialValue here otherwise isFocused\n // watcher in VTextField will emit a change\n // event whenever the component is blurred\n this.initialValue = this.internalValue\n },\n onKeyDown (e: KeyboardEvent) {\n this.$emit('keydown', e)\n },\n truncateText (str: string) {\n if (str.length < Number(this.truncateLength)) return str\n const charsKeepOneSide = Math.floor((Number(this.truncateLength) - 1) / 2)\n return `${str.slice(0, charsKeepOneSide)}…${str.slice(str.length - charsKeepOneSide)}`\n },\n },\n})\n","import VTextField from './VTextField'\n\nexport { VTextField }\nexport default VTextField\n","export default {\n props: {\n attrs: {\n type: Object,\n default: () => ({}),\n },\n },\n}\n"],"sourceRoot":""}