112 lines
5.0 KiB
JavaScript
112 lines
5.0 KiB
JavaScript
import Locale from "element-ui/lib/mixins/locale";
|
|
import EleCropper from "../ele-cropper/index";
|
|
import EleModal from "../ele-modal/index";
|
|
import props from "./props";
|
|
function normalizeComponent(scriptExports, render2, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
if (render2) {
|
|
options.render = render2;
|
|
options.staticRenderFns = staticRenderFns;
|
|
options._compiled = true;
|
|
}
|
|
if (functionalTemplate) {
|
|
options.functional = true;
|
|
}
|
|
if (scopeId) {
|
|
options._scopeId = "data-v-" + scopeId;
|
|
}
|
|
var hook;
|
|
if (moduleIdentifier) {
|
|
hook = function(context) {
|
|
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
context = __VUE_SSR_CONTEXT__;
|
|
}
|
|
if (injectStyles) {
|
|
injectStyles.call(this, context);
|
|
}
|
|
if (context && context._registeredComponents) {
|
|
context._registeredComponents.add(moduleIdentifier);
|
|
}
|
|
};
|
|
options._ssrRegister = hook;
|
|
} else if (injectStyles) {
|
|
hook = shadowMode ? function() {
|
|
injectStyles.call(
|
|
this,
|
|
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
);
|
|
} : injectStyles;
|
|
}
|
|
if (hook) {
|
|
if (options.functional) {
|
|
options._injectStyles = hook;
|
|
var originalRender = options.render;
|
|
options.render = function renderWithStyleInjection(h, context) {
|
|
hook.call(context);
|
|
return originalRender(h, context);
|
|
};
|
|
} else {
|
|
var existing = options.beforeCreate;
|
|
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
}
|
|
}
|
|
return {
|
|
exports: scriptExports,
|
|
options
|
|
};
|
|
}
|
|
const _sfc_main = {
|
|
name: "EleCropperDialog",
|
|
mixins: [Locale],
|
|
components: { EleCropper, EleModal },
|
|
props,
|
|
emits: ["crop", "open", "closed", "update:show"],
|
|
data() {
|
|
return {
|
|
enable: false
|
|
};
|
|
},
|
|
methods: {
|
|
onOpen() {
|
|
this.enable = true;
|
|
this.$emit("open");
|
|
},
|
|
onClosed() {
|
|
if (this.destroyOnClose) {
|
|
this.enable = false;
|
|
}
|
|
this.$emit("closed");
|
|
},
|
|
onCrop(result) {
|
|
this.$emit("crop", result);
|
|
},
|
|
updateVisible(value) {
|
|
this.$emit("update:show", value);
|
|
}
|
|
}
|
|
};
|
|
var _sfc_render = function render() {
|
|
var _vm = this, _c = _vm._self._c;
|
|
return _c("EleModal", { attrs: { "visible": _vm.show, "title": _vm.title || _vm.t("ele.cropper.title"), "width": _vm.width, "top": _vm.top, "modal": _vm.modal, "modal-append-to-body": _vm.modalAppendToBody, "append-to-body": _vm.appendToBody, "lock-scroll": _vm.lockScroll, "custom-class": _vm.customClass, "close-on-click-modal": _vm.closeOnClickModal, "close-on-press-escape": _vm.closeOnPressEscape, "show-close": _vm.showClose, "destroy-on-close": _vm.destroyOnClose, "movable": _vm.movable, "move-out": _vm.moveOut, "move-out-positive": _vm.moveOutPositive, "resizable": _vm.resizable, "maxable": _vm.maxable, "multiple": _vm.multiple, "fullscreen": _vm.fullscreen, "inner": _vm.inner, "reset-on-close": _vm.resetOnClose, "centered": _vm.centered, "mask-keep-alive": false }, on: { "open": _vm.onOpen, "closed": _vm.onClosed, "update:visible": _vm.updateVisible }, scopedSlots: _vm._u([_vm._l(Object.keys(_vm.$scopedSlots).filter((s) => s !== "default"), function(name) {
|
|
return { key: name, fn: function(props2) {
|
|
return [_vm._t(name, null, null, props2 || {})];
|
|
} };
|
|
})], null, true) }, [_vm.enable ? _c("EleCropper", { attrs: { "src": _vm.src, "image-type": _vm.imageType, "accept": _vm.accept, "tools": _vm.tools, "show-preview": _vm.showPreview, "preview-width": _vm.previewWidth, "ok-text": _vm.okText, "to-blob": _vm.toBlob, "options": _vm.options, "cropped-options": _vm.croppedOptions, "aspect-ratio": _vm.aspectRatio, "view-mode": _vm.viewMode, "drag-mode": _vm.dragMode, "initial-aspect-ratio": _vm.initialAspectRatio, "min-container-width": _vm.minContainerWidth, "min-container-height": _vm.minContainerHeight, "min-canvas-width": _vm.minCanvasWidth, "min-canvas-height": _vm.minCanvasHeight, "min-crop-box-width": _vm.minCropBoxWidth, "min-crop-box-height": _vm.minCropBoxHeight, "cropped-width": _vm.croppedWidth, "cropped-height": _vm.croppedHeight, "cropped-min-width": _vm.croppedMinWidth, "cropped-min-height": _vm.croppedMinHeight, "cropped-max-width": _vm.croppedMaxWidth, "cropped-max-height": _vm.croppedMaxHeight, "cropped-fill-color": _vm.croppedFillColor, "image-smoothing-enabled": _vm.imageSmoothingEnabled, "image-smoothing-quality": _vm.imageSmoothingQuality }, on: { "crop": _vm.onCrop } }) : _vm._e()], 1);
|
|
};
|
|
var _sfc_staticRenderFns = [];
|
|
var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
_sfc_main,
|
|
_sfc_render,
|
|
_sfc_staticRenderFns,
|
|
false,
|
|
null,
|
|
null,
|
|
null,
|
|
null
|
|
);
|
|
const index = __component__.exports;
|
|
export {
|
|
index as default
|
|
};
|