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nimport Themeable from '../../mixins/themeable'\n\n// Utils\nimport { keyCodes } from '../../util/helpers'\n\n// Component\nimport VBtn from '../VBtn'\nimport VMenu from '../VMenu'\n\n// Types\nimport { VNode, VNodeChildren } from 'vue'\nimport mixins from '../../util/mixins'\n\n/* @vue/component */\nexport default mixins(Returnable, Themeable).extend({\n name: 'v-edit-dialog',\n\n props: {\n cancelText: {\n default: 'Cancel',\n },\n large: Boolean,\n eager: Boolean,\n persistent: Boolean,\n saveText: {\n default: 'Save',\n },\n transition: {\n type: String,\n default: 'slide-x-reverse-transition',\n },\n },\n\n data () {\n return {\n isActive: false,\n }\n },\n\n watch: {\n isActive (val) {\n if (val) {\n this.$emit('open')\n setTimeout(this.focus, 50) // Give DOM time to paint\n } else {\n this.$emit('close')\n }\n },\n },\n\n methods: {\n cancel () {\n this.isActive = false\n this.$emit('cancel')\n },\n focus () {\n const input = (this.$refs.content as Element).querySelector('input')\n input && input.focus()\n },\n genButton (fn: Function, text: VNodeChildren): VNode {\n return this.$createElement(VBtn, {\n props: {\n text: true,\n color: 'primary',\n light: true,\n },\n on: { click: fn },\n }, text)\n },\n genActions (): VNode {\n return this.$createElement('div', {\n class: 'v-small-dialog__actions',\n }, [\n this.genButton(this.cancel, this.cancelText),\n this.genButton(() => {\n this.save(this.returnValue)\n this.$emit('save')\n }, this.saveText),\n ])\n },\n genContent (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-small-dialog__content',\n on: {\n keydown: (e: KeyboardEvent) => {\n const input = (this.$refs.content as Element).querySelector('input')\n e.keyCode === keyCodes.esc && this.cancel()\n if (e.keyCode === keyCodes.enter && input) {\n this.save(input.value)\n this.$emit('save')\n }\n },\n },\n ref: 'content',\n }, [this.$slots.input])\n },\n },\n\n render (h): VNode {\n return h(VMenu, {\n staticClass: 'v-small-dialog',\n class: this.themeClasses,\n props: {\n contentClass: 'v-small-dialog__menu-content',\n transition: this.transition,\n origin: 'top right',\n right: true,\n value: this.isActive,\n closeOnClick: !this.persistent,\n closeOnContentClick: false,\n eager: this.eager,\n light: this.light,\n dark: this.dark,\n },\n on: {\n input: (val: boolean) => (this.isActive = val),\n },\n scopedSlots: {\n activator: ({ on }) => {\n return h('span', {\n staticClass: 'v-small-dialog__activator',\n on,\n }, this.$slots.default)\n },\n },\n }, [\n this.genContent(),\n this.large ? this.genActions() : null,\n ])\n },\n})\n"],"sourceRoot":"","file":"VEditDialog.js"} |