UNPKG

cheetah-framework

Version:

Cheetah Framework JS used in all our applications

45 lines (38 loc) 958 B
/* global cheetahApp */ import Vue from 'vue' const dialogDefaultOptions = { /** * Max width that dialog can get. * Fullscreen at true will override the maxWidth. */ maxWidth: 1200, fullscreen: null } Vue.config.optionMergeStrategies.dialog = function (toVal, fromVal) { if (!fromVal) { return toVal } if (!toVal) { return fromVal } return _.merge({}, dialogDefaultOptions, fromVal) } export default { dialog: dialogDefaultOptions, computed: { dialogProps () { return { appendToBody: true, closeOnClickModal: false, fullscreen: this.fullscreen, width: this.fullscreen ? null : Math.min(this.$options.dialog.maxWidth, (cheetahApp.windowWidth - 100)) + 'px' } }, fullscreen () { if (this.$options.dialog.fullscreen === false) { return false } return this.$options.dialog.fullscreen === true || cheetahApp.windowWidth < 800 } } }