Unverified Commit a5651159 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera
Browse files

feat: refactor optionsMerger to component util function

parent b3b2b717
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
<script>
import { onMounted, ref, inject, nextTick } from "vue";
import { remapEvents, propsBinder, optionsMerger } from "../utils.js";
import { remapEvents, propsBinder } from "../utils.js";
import {
  props as circleProps,
  setup as circleSetup,
@@ -30,7 +30,7 @@ export default {
    onMounted(async () => {
      const { circle, DomEvent } = await import("leaflet/dist/leaflet-src.esm");

      leafletRef.value = circle(props.latLng, optionsMerger(options, props));
      leafletRef.value = circle(props.latLng, options);

      const listeners = remapEvents(context.attrs);
      DomEvent.on(leafletRef.value, listeners);
+2 −5
Original line number Diff line number Diff line
<script>
import { onMounted, ref, inject, nextTick } from "vue";
import { remapEvents, propsBinder, optionsMerger } from "../utils.js";
import { remapEvents, propsBinder } from "../utils.js";
import {
  props as circleMarkerProps,
  setup as circleMarkerSetup,
@@ -32,10 +32,7 @@ export default {
        "leaflet/dist/leaflet-src.esm"
      );

      leafletRef.value = circleMarker(
        props.latLng,
        optionsMerger(options, props)
      );
      leafletRef.value = circleMarker(props.latLng, options);

      const listeners = remapEvents(context.attrs);
      DomEvent.on(leafletRef.value, listeners);
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ import {
  setup as controlSetup,
  render,
} from "../functions/control";
import { propsBinder, optionsMerger } from "../utils.js";
import { propsBinder } from "../utils.js";

export default {
  name: "LControl",
@@ -43,7 +43,7 @@ export default {
        },
      });

      leafletRef.value = new LControl(optionsMerger(options, props));
      leafletRef.value = new LControl(options);
      propsBinder(methods, leafletRef.value, props);
      registerControl({ leafletObject: leafletRef.value });

+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import {
  props as attributionControlProps,
  setup as attributionControlSetup,
} from "../functions/controlAttribution";
import { propsBinder, optionsMerger } from "../utils.js";
import { propsBinder } from "../utils.js";

export default {
  name: "LControlAttribution",
@@ -23,7 +23,7 @@ export default {
    onMounted(async () => {
      const { control } = await import("leaflet/dist/leaflet-src.esm");

      leafletRef.value = control.attribution(optionsMerger(options, props));
      leafletRef.value = control.attribution(options);
      propsBinder(methods, leafletRef.value, props);
      registerControl({ leafletObject: leafletRef.value });
      nextTick(() => context.emit("ready", leafletRef.value));
+3 −6
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import {
  props as layerControlProps,
  setup as layerControlSetup,
} from "../functions/controlLayers";
import { propsBinder, optionsMerger } from "../utils.js";
import { propsBinder } from "../utils.js";

export default {
  name: "LControlLayers",
@@ -23,11 +23,8 @@ export default {
    onMounted(async () => {
      const { control } = await import("leaflet/dist/leaflet-src.esm");

      leafletRef.value = control.layers(
        null,
        null,
        optionsMerger(options, props)
      );
      leafletRef.value = control.layers(null, null, options);

      propsBinder(methods, leafletRef.value, props);

      registerLayerControl({
Loading