UNPKG

yuang-framework-ui-pc

Version:

yuang-framework-ui-pc Library

96 lines (95 loc) 3.19 kB
"use strict"; const vue = require("vue"); const core = require("../utils/core"); const receiver = require("../ele-config-provider/receiver"); const util = require("../ele-pro-layout/util"); const EleDialog = require("../ele-dialog/index"); const MapView = require("./components/map-view"); const props = require("./props"); const _sfc_main = vue.defineComponent({ name: "EleMapPicker", components: { EleDialog, MapView }, props: props.mapPickerProps, emits: props.mapPickerEmits, setup(props$1, { emit }) { const { lang, globalConfig } = receiver.useLocale("map", props$1); const isResponsive = util.useResponsive(props$1); const mapRef = vue.ref(null); const aMapKey = vue.computed(() => props$1.mapKey || globalConfig.mapKey); const mapProps = vue.computed(() => { return core.pick(props$1, props.mapPropKeys); }); const updateModelValue = (visible) => { emit("update:modelValue", visible); }; const handleMapDone = (ins) => { emit("mapDone", ins); }; const handleDone = (result) => { emit("done", result); }; vue.watch( () => props$1.modelValue, (visible) => { if (visible) { mapRef.value && mapRef.value.showInitSelected(); } } ); return { lang, isResponsive, mapRef, aMapKey, mapProps, updateModelValue, handleMapDone, handleDone }; } }); const _export_sfc = (sfc, props2) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props2) { target[key] = val; } return target; }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_MapView = vue.resolveComponent("MapView"); const _component_EleDialog = vue.resolveComponent("EleDialog"); return vue.openBlock(), vue.createBlock(_component_EleDialog, vue.mergeProps({ width: "740px", title: _ctx.lang.title }, _ctx.modalProps || {}, { modelValue: _ctx.modelValue, class: ["ele-map-picker", { "is-responsive": _ctx.isResponsive }], "onUpdate:modelValue": _ctx.updateModelValue }), vue.createSlots({ default: vue.withCtx(() => [ vue.createVNode(_component_MapView, vue.mergeProps(_ctx.mapProps, { ref: "mapRef", message: _ctx.lang.message, clickMessage: _ctx.lang.clickMessage, searchPlaceholder: _ctx.lang.placeholder, okText: _ctx.lang.ok, mapKey: _ctx.aMapKey, mode: _ctx.keywordMode ? "keyword" : _ctx.mode, onMapDone: _ctx.handleMapDone, onDone: _ctx.handleDone }), null, 16, ["message", "clickMessage", "searchPlaceholder", "okText", "mapKey", "mode", "onMapDone", "onDone"]) ]), _: 2 }, [ vue.renderList(Object.keys(_ctx.$slots).filter((k) => "default" !== k), (name) => { return { name, fn: vue.withCtx((slotProps) => [ vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps || {}))) ]) }; }) ]), 1040, ["title", "modelValue", "class", "onUpdate:modelValue"]); } const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); module.exports = index;