Skip to content

Commit

Permalink
Fix Vue default props in markers
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew44-mappable committed Oct 28, 2024
1 parent 446e1e4 commit 3343ace
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/markers/MMapDefaultMarker/vue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const MMapDefaultMarkerVuefyOptions: CustomVuefyOptions<
props: {
coordinates: {type: Object, required: true},
source: String,
zIndex: {type: Number, default: 0},
zIndex: {type: Number, default: undefined},
properties: Object,
id: String,
disableRoundCoordinates: {type: Boolean, default: undefined},
Expand Down
4 changes: 1 addition & 3 deletions src/markers/MMapPopupMarker/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {LngLat, MMapMarker, MMapMarkerProps} from '@mappable-world/mappable-types';
import {DefaultProps, defaultProps} from './props';
import {MMapPopupMarkerReactifyOverride} from './react';
import {MMapPopupMarkerVuefyOptions, MMapPopupMarkerVuefyOverride} from './vue';

Expand Down Expand Up @@ -30,9 +31,6 @@ export type MMapPopupMarkerProps = MMapMarkerProps & {
onOpen?: () => void;
};

const defaultProps = Object.freeze({position: 'top', offset: 0, show: true});
type DefaultProps = typeof defaultProps;

/**
* `MMapPopupMarker` is a popup with customized content.
* @example
Expand Down
2 changes: 2 additions & 0 deletions src/markers/MMapPopupMarker/props.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const defaultProps = Object.freeze({position: 'top', offset: 0, show: true});
export type DefaultProps = typeof defaultProps;
13 changes: 7 additions & 6 deletions src/markers/MMapPopupMarker/vue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import {MMapFeatureProps, MMapMarkerEventHandler} from '@mappable-world/mappable
import {CustomVuefyFn, CustomVuefyOptions} from '@mappable-world/mappable-types/modules/vuefy';
import type TVue from '@vue/runtime-core';
import {MMapPopupContentProps, MMapPopupMarker, MMapPopupMarkerProps, MMapPopupPositionProps} from '../';
import {defaultProps} from '../props';

export const MMapPopupMarkerVuefyOptions: CustomVuefyOptions<MMapPopupMarker> = {
props: {
coordinates: {type: Object, required: true},
source: String,
zIndex: {type: Number, default: 0},
zIndex: {type: Number, default: undefined},
properties: Object,
id: String,
disableRoundCoordinates: {type: Boolean, default: undefined},
hideOutsideViewport: {type: [Object, Boolean], default: false},
draggable: {type: Boolean, default: false},
hideOutsideViewport: {type: [Object, Boolean], default: undefined},
draggable: {type: Boolean, default: undefined},
mapFollowsOnDrag: {type: [Boolean, Object]},
onDragStart: Function as TVue.PropType<MMapMarkerEventHandler>,
onDragEnd: Function as TVue.PropType<MMapMarkerEventHandler>,
Expand All @@ -23,9 +24,9 @@ export const MMapPopupMarkerVuefyOptions: CustomVuefyOptions<MMapPopupMarker> =
onClick: Function as TVue.PropType<MMapFeatureProps['onClick']>,
onFastClick: Function as TVue.PropType<MMapFeatureProps['onFastClick']>,
content: {type: [Function, String] as TVue.PropType<MMapPopupContentProps>, required: true},
position: {type: String as TVue.PropType<MMapPopupPositionProps>},
offset: {type: Number, default: 0},
show: {type: Boolean, default: true},
position: {type: String as TVue.PropType<MMapPopupPositionProps>, default: defaultProps.position},
offset: {type: Number, default: defaultProps.offset},
show: {type: Boolean, default: defaultProps.show},
onClose: {type: Function as TVue.PropType<MMapPopupMarkerProps['onClose']>},
onOpen: {type: Function as TVue.PropType<MMapPopupMarkerProps['onOpen']>}
}
Expand Down

0 comments on commit 3343ace

Please sign in to comment.