jky-component-lib 0.0.141 → 0.0.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/amap/AClusterMarker/AClusterMarker.vue.d.ts +55 -0
- package/dist/es/amap/AClusterMarker/AClusterMarker.vue.js +202 -0
- package/dist/es/amap/AClusterMarker/AClusterMarker.vue2.js +4 -0
- package/dist/es/amap/AClusterMarker/index.d.ts +4 -0
- package/dist/es/amap/AClusterMarker/index.js +7 -0
- package/dist/es/amap/AMap.vue.d.ts +2 -2
- package/dist/es/amap/AMap.vue.js +3 -1
- package/dist/es/amap/AMapPicker/AMapPicker.vue.js +1 -1
- package/dist/es/amap/AMarker.vue.d.ts +1 -1
- package/dist/es/amap/index.d.ts +5 -1
- package/dist/es/amap/index.js +4 -0
- package/dist/es/amap/style.css +5 -12
- package/dist/es/amap/style2.css +13 -2
- package/dist/es/amap/style3.css +2 -6
- package/dist/es/code-mirror-editor/CodeMirrorEditor.vue.js +1 -1
- package/dist/es/components.d.ts +1 -0
- package/dist/es/components.js +6 -2
- package/dist/es/draggable/Draggable.vue.d.ts +78 -0
- package/dist/es/draggable/Draggable.vue.js +130 -0
- package/dist/es/draggable/Draggable.vue3.js +5 -0
- package/dist/es/draggable/index.d.ts +4 -0
- package/dist/es/draggable/index.js +8 -0
- package/dist/es/draggable/style.css +16 -0
- package/dist/es/index.js +6 -1
- package/dist/es/package.json.js +1 -1
- package/dist/es/page-table/ActionColumn.vue.js +4 -3
- package/dist/es/style.css +193 -6
- package/dist/es/styles.css +1 -1
- package/dist/lib/amap/AClusterMarker/AClusterMarker.vue.d.ts +55 -0
- package/dist/lib/amap/AClusterMarker/AClusterMarker.vue.js +202 -0
- package/dist/lib/amap/AClusterMarker/AClusterMarker.vue2.js +4 -0
- package/dist/lib/amap/AClusterMarker/index.d.ts +4 -0
- package/dist/lib/amap/AClusterMarker/index.js +7 -0
- package/dist/lib/amap/AMap.vue.d.ts +2 -2
- package/dist/lib/amap/AMap.vue.js +3 -1
- package/dist/lib/amap/AMapPicker/AMapPicker.vue.js +1 -1
- package/dist/lib/amap/AMarker.vue.d.ts +1 -1
- package/dist/lib/amap/index.d.ts +5 -1
- package/dist/lib/amap/index.js +4 -0
- package/dist/lib/amap/style.css +5 -12
- package/dist/lib/amap/style2.css +13 -2
- package/dist/lib/amap/style3.css +2 -6
- package/dist/lib/code-mirror-editor/CodeMirrorEditor.vue.js +1 -1
- package/dist/lib/components.d.ts +1 -0
- package/dist/lib/components.js +59 -55
- package/dist/lib/draggable/Draggable.vue.d.ts +78 -0
- package/dist/lib/draggable/Draggable.vue.js +130 -0
- package/dist/lib/draggable/Draggable.vue3.js +5 -0
- package/dist/lib/draggable/index.d.ts +4 -0
- package/dist/lib/draggable/index.js +8 -0
- package/dist/lib/draggable/style.css +16 -0
- package/dist/lib/index.js +42 -37
- package/dist/lib/package.json.js +1 -1
- package/dist/lib/page-table/ActionColumn.vue.js +4 -3
- package/dist/lib/style.css +193 -6
- package/dist/lib/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AClusterMarkerProps, ClusterPoint } from './types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
AMap: any;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
type __VLS_Props = AClusterMarkerProps;
|
|
8
|
+
declare function updatePoints(newPoints: ClusterPoint[]): void;
|
|
9
|
+
declare function clearClusters(): void;
|
|
10
|
+
declare function destroy(): void;
|
|
11
|
+
type __VLS_PublicProps = {
|
|
12
|
+
modelValue?: ClusterPoint[];
|
|
13
|
+
} & __VLS_Props;
|
|
14
|
+
declare function __VLS_template(): {
|
|
15
|
+
attrs: Partial<{}>;
|
|
16
|
+
slots: {
|
|
17
|
+
default?(_: {}): any;
|
|
18
|
+
};
|
|
19
|
+
refs: {};
|
|
20
|
+
rootEl: any;
|
|
21
|
+
};
|
|
22
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
23
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
24
|
+
updatePoints: typeof updatePoints;
|
|
25
|
+
clearClusters: typeof clearClusters;
|
|
26
|
+
destroy: typeof destroy;
|
|
27
|
+
getClusterInstance: () => any;
|
|
28
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
29
|
+
"update:modelValue": (value: ClusterPoint[]) => any;
|
|
30
|
+
} & {
|
|
31
|
+
click: (cluster: any) => any;
|
|
32
|
+
mouseout: (cluster: any) => any;
|
|
33
|
+
mouseover: (cluster: any) => any;
|
|
34
|
+
ready: (cluster: any) => any;
|
|
35
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
36
|
+
"onUpdate:modelValue"?: ((value: ClusterPoint[]) => any) | undefined;
|
|
37
|
+
onClick?: ((cluster: any) => any) | undefined;
|
|
38
|
+
onMouseout?: ((cluster: any) => any) | undefined;
|
|
39
|
+
onMouseover?: ((cluster: any) => any) | undefined;
|
|
40
|
+
onReady?: ((cluster: any) => any) | undefined;
|
|
41
|
+
}>, {
|
|
42
|
+
gridSize: number;
|
|
43
|
+
visible: boolean;
|
|
44
|
+
zoomOnClick: boolean;
|
|
45
|
+
minClusterSize: number;
|
|
46
|
+
averageCenter: boolean;
|
|
47
|
+
enable: boolean;
|
|
48
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
49
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
50
|
+
export default _default;
|
|
51
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
52
|
+
new (): {
|
|
53
|
+
$slots: S;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { defineComponent, useModel, watch, onUnmounted, renderSlot, mergeModels } from "vue";
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
22
|
+
name: "JkyAClusterMarker",
|
|
23
|
+
inheritAttrs: false
|
|
24
|
+
}), {
|
|
25
|
+
__name: "AClusterMarker",
|
|
26
|
+
props: /* @__PURE__ */ mergeModels({
|
|
27
|
+
map: {},
|
|
28
|
+
points: {},
|
|
29
|
+
gridSize: { default: 60 },
|
|
30
|
+
styles: {},
|
|
31
|
+
visible: { type: Boolean, default: true },
|
|
32
|
+
zoomOnClick: { type: Boolean, default: true },
|
|
33
|
+
minClusterSize: { default: 2 },
|
|
34
|
+
maxZoom: {},
|
|
35
|
+
averageCenter: { type: Boolean, default: false },
|
|
36
|
+
renderClusterMarker: {},
|
|
37
|
+
renderMarker: {},
|
|
38
|
+
enable: { type: Boolean, default: true }
|
|
39
|
+
}, {
|
|
40
|
+
"modelValue": { default: () => [] },
|
|
41
|
+
"modelModifiers": {}
|
|
42
|
+
}),
|
|
43
|
+
emits: /* @__PURE__ */ mergeModels(["click", "mouseover", "mouseout", "ready"], ["update:modelValue"]),
|
|
44
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
45
|
+
const props = __props;
|
|
46
|
+
const emit = __emit;
|
|
47
|
+
const modelValue = useModel(__props, "modelValue");
|
|
48
|
+
let clusterInstance = null;
|
|
49
|
+
let mapInstance = null;
|
|
50
|
+
function initCluster(map) {
|
|
51
|
+
if (!map || !window.AMap)
|
|
52
|
+
return;
|
|
53
|
+
mapInstance = map;
|
|
54
|
+
if (!window.AMap.MarkerCluster) {
|
|
55
|
+
console.warn("AMap.MarkerCluster 插件未加载,请先加载插件");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (clusterInstance) {
|
|
59
|
+
clusterInstance.setMap(null);
|
|
60
|
+
clusterInstance = null;
|
|
61
|
+
}
|
|
62
|
+
const points = preparePoints();
|
|
63
|
+
const clusterOptions = {
|
|
64
|
+
gridSize: props.gridSize,
|
|
65
|
+
zoomOnClick: props.zoomOnClick,
|
|
66
|
+
minClusterSize: props.minClusterSize,
|
|
67
|
+
averageCenter: props.averageCenter
|
|
68
|
+
};
|
|
69
|
+
if (props.styles && props.styles.length > 0) {
|
|
70
|
+
clusterOptions.styles = props.styles.map((style) => ({
|
|
71
|
+
url: style.url,
|
|
72
|
+
size: style.size ? new window.AMap.Size(style.size[0], style.size[1]) : void 0,
|
|
73
|
+
offset: style.offset ? new window.AMap.Pixel(style.offset[0], style.offset[1]) : void 0,
|
|
74
|
+
textColor: style.textColor,
|
|
75
|
+
textSize: style.textSize
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
if (props.renderClusterMarker) {
|
|
79
|
+
clusterOptions.renderClusterMarker = props.renderClusterMarker;
|
|
80
|
+
}
|
|
81
|
+
if (props.renderMarker) {
|
|
82
|
+
clusterOptions.renderMarker = props.renderMarker;
|
|
83
|
+
}
|
|
84
|
+
clusterInstance = new window.AMap.MarkerCluster(map, points, clusterOptions);
|
|
85
|
+
clusterInstance.on("click", (cluster) => {
|
|
86
|
+
emit("click", cluster);
|
|
87
|
+
});
|
|
88
|
+
clusterInstance.on("mouseover", (cluster) => {
|
|
89
|
+
emit("mouseover", cluster);
|
|
90
|
+
});
|
|
91
|
+
clusterInstance.on("mouseout", (cluster) => {
|
|
92
|
+
emit("mouseout", cluster);
|
|
93
|
+
});
|
|
94
|
+
emit("ready", clusterInstance);
|
|
95
|
+
}
|
|
96
|
+
function preparePoints() {
|
|
97
|
+
const points = props.points || modelValue.value || [];
|
|
98
|
+
return points.map((point) => __spreadValues({
|
|
99
|
+
lnglat: point.lnglat,
|
|
100
|
+
title: point.title,
|
|
101
|
+
content: point.content
|
|
102
|
+
}, point.data));
|
|
103
|
+
}
|
|
104
|
+
function updatePoints(newPoints) {
|
|
105
|
+
if (!clusterInstance)
|
|
106
|
+
return;
|
|
107
|
+
clusterInstance.setMap(null);
|
|
108
|
+
const points = newPoints.map((point) => __spreadValues({
|
|
109
|
+
lnglat: point.lnglat,
|
|
110
|
+
title: point.title,
|
|
111
|
+
content: point.content
|
|
112
|
+
}, point.data));
|
|
113
|
+
clusterInstance.addMarkers(points);
|
|
114
|
+
}
|
|
115
|
+
function clearClusters() {
|
|
116
|
+
if (clusterInstance) {
|
|
117
|
+
clusterInstance.setMap(null);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function destroy() {
|
|
121
|
+
if (clusterInstance) {
|
|
122
|
+
clusterInstance.setMap(null);
|
|
123
|
+
clusterInstance = null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
__expose({
|
|
127
|
+
updatePoints,
|
|
128
|
+
clearClusters,
|
|
129
|
+
destroy,
|
|
130
|
+
getClusterInstance: () => clusterInstance
|
|
131
|
+
});
|
|
132
|
+
watch(
|
|
133
|
+
() => props.map,
|
|
134
|
+
(newMap) => {
|
|
135
|
+
if (newMap && props.enable) {
|
|
136
|
+
initCluster(newMap);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{ immediate: true }
|
|
140
|
+
);
|
|
141
|
+
watch(
|
|
142
|
+
() => props.points,
|
|
143
|
+
(newPoints) => {
|
|
144
|
+
if (clusterInstance && newPoints) {
|
|
145
|
+
updatePoints(newPoints);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{ deep: true }
|
|
149
|
+
);
|
|
150
|
+
watch(
|
|
151
|
+
() => modelValue.value,
|
|
152
|
+
(newValue) => {
|
|
153
|
+
if (clusterInstance && newValue) {
|
|
154
|
+
updatePoints(newValue);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{ deep: true }
|
|
158
|
+
);
|
|
159
|
+
watch(
|
|
160
|
+
() => props.gridSize,
|
|
161
|
+
() => {
|
|
162
|
+
if (mapInstance && props.enable) {
|
|
163
|
+
initCluster(mapInstance);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
watch(
|
|
168
|
+
() => props.styles,
|
|
169
|
+
() => {
|
|
170
|
+
if (mapInstance && props.enable) {
|
|
171
|
+
initCluster(mapInstance);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{ deep: true }
|
|
175
|
+
);
|
|
176
|
+
watch(
|
|
177
|
+
() => props.renderClusterMarker,
|
|
178
|
+
() => {
|
|
179
|
+
if (mapInstance && props.enable) {
|
|
180
|
+
initCluster(mapInstance);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
watch(
|
|
185
|
+
() => props.renderMarker,
|
|
186
|
+
() => {
|
|
187
|
+
if (mapInstance && props.enable) {
|
|
188
|
+
initCluster(mapInstance);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
onUnmounted(() => {
|
|
193
|
+
destroy();
|
|
194
|
+
});
|
|
195
|
+
return (_ctx, _cache) => {
|
|
196
|
+
return renderSlot(_ctx.$slots, "default");
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}));
|
|
200
|
+
export {
|
|
201
|
+
_sfc_main as default
|
|
202
|
+
};
|
|
@@ -16,20 +16,20 @@ declare const __VLS_component: import('vue').DefineComponent<AMapProps, {
|
|
|
16
16
|
removeMarker: (marker: any) => void;
|
|
17
17
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
18
18
|
click: (data: any) => any;
|
|
19
|
+
ready: (map: any) => any;
|
|
19
20
|
moveend: (center: {
|
|
20
21
|
lng: number;
|
|
21
22
|
lat: number;
|
|
22
23
|
}) => any;
|
|
23
24
|
zoomend: (zoom: number) => any;
|
|
24
|
-
ready: (map: any) => any;
|
|
25
25
|
}, string, import('vue').PublicProps, Readonly<AMapProps> & Readonly<{
|
|
26
26
|
onClick?: ((data: any) => any) | undefined;
|
|
27
|
+
onReady?: ((map: any) => any) | undefined;
|
|
27
28
|
onMoveend?: ((center: {
|
|
28
29
|
lng: number;
|
|
29
30
|
lat: number;
|
|
30
31
|
}) => any) | undefined;
|
|
31
32
|
onZoomend?: ((zoom: number) => any) | undefined;
|
|
32
|
-
onReady?: ((map: any) => any) | undefined;
|
|
33
33
|
}>, {
|
|
34
34
|
width: string;
|
|
35
35
|
height: string;
|
package/dist/es/amap/AMap.vue.js
CHANGED
|
@@ -78,7 +78,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
78
78
|
const isMapLoaded = ref(false);
|
|
79
79
|
const controls = ref({});
|
|
80
80
|
const getMapUrl = computed(() => {
|
|
81
|
-
const plugins = [
|
|
81
|
+
const plugins = [
|
|
82
|
+
"AMap.MarkerCluster"
|
|
83
|
+
];
|
|
82
84
|
if (props.showScale)
|
|
83
85
|
plugins.push("AMap.Scale");
|
|
84
86
|
if (props.showHawkEye)
|
|
@@ -108,7 +108,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
108
108
|
token: __props.token,
|
|
109
109
|
zoom: __props.zoom,
|
|
110
110
|
center: __props.center,
|
|
111
|
-
|
|
111
|
+
class: "w-full h-80",
|
|
112
112
|
onClick: handleMapClick
|
|
113
113
|
}, {
|
|
114
114
|
default: withCtx(() => {
|
|
@@ -25,8 +25,8 @@ declare const __VLS_component: import('vue').DefineComponent<AMapMarkerProps, {
|
|
|
25
25
|
onMouseout?: ((marker: any, data: MarkerData) => any) | undefined;
|
|
26
26
|
onMouseover?: ((marker: any, data: MarkerData) => any) | undefined;
|
|
27
27
|
}>, {
|
|
28
|
-
draggable: boolean;
|
|
29
28
|
visible: boolean;
|
|
29
|
+
draggable: boolean;
|
|
30
30
|
updateMode: "incremental" | "full";
|
|
31
31
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
32
32
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
package/dist/es/amap/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { InstallWithSFC } from '../utils';
|
|
2
|
+
import { default as AClusterMarker } from './AClusterMarker';
|
|
2
3
|
import { default as AMap } from './AMap.vue';
|
|
3
4
|
import { default as AMapPicker } from './AMapPicker/AMapPicker.vue';
|
|
4
5
|
import { default as AMarker } from './AMarker.vue';
|
|
5
6
|
import { default as ATrackPlayback } from './ATrackPlayback.vue';
|
|
7
|
+
export type * from './AClusterMarker/types';
|
|
8
|
+
export type * from './types';
|
|
6
9
|
export declare const JkyAMap: InstallWithSFC<typeof AMap>;
|
|
7
10
|
export declare const JkyAMapPicker: InstallWithSFC<typeof AMapPicker>;
|
|
11
|
+
export declare const JkyAClusterMarker: InstallWithSFC<typeof AClusterMarker>;
|
|
8
12
|
export declare const JkyAMarker: InstallWithSFC<typeof AMarker>;
|
|
9
13
|
export declare const JkyATrackPlayback: InstallWithSFC<typeof ATrackPlayback>;
|
|
10
14
|
export default JkyAMap;
|
|
11
|
-
export { AMapPicker, AMarker, ATrackPlayback };
|
|
15
|
+
export { AClusterMarker, AMapPicker, AMarker, ATrackPlayback };
|
package/dist/es/amap/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JkyAClusterMarker as JkyAClusterMarker$1 } from "./AClusterMarker/index.js";
|
|
1
2
|
import _sfc_main from "./AMap.vue.js";
|
|
2
3
|
/* empty css */
|
|
3
4
|
import _sfc_main$1 from "./AMapPicker/AMapPicker.vue.js";
|
|
@@ -8,12 +9,15 @@ import _sfc_main$3 from "./ATrackPlayback.vue.js";
|
|
|
8
9
|
import { installWithSFC } from "../utils/with-install.js";
|
|
9
10
|
const JkyAMap = installWithSFC(_sfc_main);
|
|
10
11
|
const JkyAMapPicker = installWithSFC(_sfc_main$1);
|
|
12
|
+
const JkyAClusterMarker = installWithSFC(JkyAClusterMarker$1);
|
|
11
13
|
const JkyAMarker = installWithSFC(_sfc_main$2);
|
|
12
14
|
const JkyATrackPlayback = installWithSFC(_sfc_main$3);
|
|
13
15
|
export {
|
|
16
|
+
JkyAClusterMarker$1 as AClusterMarker,
|
|
14
17
|
_sfc_main$1 as AMapPicker,
|
|
15
18
|
_sfc_main$2 as AMarker,
|
|
16
19
|
_sfc_main$3 as ATrackPlayback,
|
|
20
|
+
JkyAClusterMarker,
|
|
17
21
|
JkyAMap,
|
|
18
22
|
JkyAMapPicker,
|
|
19
23
|
JkyAMarker,
|
package/dist/es/amap/style.css
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/* AMap 高德地图组件样式 */
|
|
2
|
-
.jky-amap-container {
|
|
3
|
-
/* 地图容器样式 */
|
|
4
|
-
position: relative;
|
|
5
|
-
overflow: hidden;
|
|
6
1
|
|
|
7
|
-
|
|
8
|
-
.amap-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
display: none !important;
|
|
13
|
-
}
|
|
2
|
+
/* JkyAMarker 组件样式 - 参考高德官方示例 */
|
|
3
|
+
.amap-icon img,
|
|
4
|
+
.amap-marker-content img {
|
|
5
|
+
width: 25px;
|
|
6
|
+
height: 34px;
|
|
14
7
|
}
|
package/dist/es/amap/style2.css
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/* AMap 高德地图组件样式 */
|
|
2
|
+
.jky-amap-container {
|
|
3
|
+
/* 地图容器样式 */
|
|
4
|
+
position: relative;
|
|
5
|
+
overflow: hidden;
|
|
1
6
|
|
|
2
|
-
/*
|
|
3
|
-
|
|
7
|
+
/* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
|
|
8
|
+
.amap-logo {
|
|
9
|
+
display: none !important;
|
|
10
|
+
}
|
|
11
|
+
.amap-copyright {
|
|
12
|
+
display: none !important;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/dist/es/amap/style3.css
CHANGED
|
@@ -28,7 +28,7 @@ import { EditorState } from "@codemirror/state";
|
|
|
28
28
|
import { oneDark } from "@codemirror/theme-one-dark";
|
|
29
29
|
import { EditorView, lineNumbers } from "@codemirror/view";
|
|
30
30
|
import { basicSetup } from "codemirror";
|
|
31
|
-
const _hoisted_1 = { class: "j-code-mirror-editor min-h-
|
|
31
|
+
const _hoisted_1 = { class: "j-code-mirror-editor min-h-0 min-w-full" };
|
|
32
32
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
33
33
|
name: "JkyCodeMirrorEditor"
|
|
34
34
|
}), {
|
package/dist/es/components.d.ts
CHANGED
package/dist/es/components.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JkyAddInput } from "./add-input/index.js";
|
|
2
2
|
import { JkyAMap, JkyAMapPicker } from "./amap/index.js";
|
|
3
|
-
import { JkyAMarker, JkyATrackPlayback } from "./amap/index.js";
|
|
3
|
+
import { JkyAClusterMarker, JkyAMarker, JkyATrackPlayback } from "./amap/index.js";
|
|
4
4
|
import { JkyButton } from "./button/index.js";
|
|
5
5
|
import { JkyButtonNav } from "./button-nav/index.js";
|
|
6
6
|
import { JkyCodeMirrorEditor } from "./code-mirror-editor/index.js";
|
|
7
|
+
import { JkyDraggable } from "./draggable/index.js";
|
|
7
8
|
import { JkyForm, JkyFormItem, JkyAMapPickerItem } from "./form/index.js";
|
|
8
9
|
import { JkyMenu } from "./menu/index.js";
|
|
9
10
|
import { JkyModal } from "./modal/index.js";
|
|
@@ -33,9 +34,11 @@ const components = [
|
|
|
33
34
|
JkyTabs,
|
|
34
35
|
JkyModal,
|
|
35
36
|
JkyAMap,
|
|
36
|
-
JkyAMapPicker
|
|
37
|
+
JkyAMapPicker,
|
|
38
|
+
JkyDraggable
|
|
37
39
|
];
|
|
38
40
|
export {
|
|
41
|
+
JkyAClusterMarker,
|
|
39
42
|
JkyAMap,
|
|
40
43
|
JkyAMapPicker,
|
|
41
44
|
JkyAMapPickerItem,
|
|
@@ -46,6 +49,7 @@ export {
|
|
|
46
49
|
JkyButton,
|
|
47
50
|
JkyButtonNav,
|
|
48
51
|
JkyCodeMirrorEditor,
|
|
52
|
+
JkyDraggable,
|
|
49
53
|
JkyForm,
|
|
50
54
|
JkyFormItem,
|
|
51
55
|
JkyMenu,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { DraggableProps, DraggableSlots } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: Readonly<DraggableSlots> & DraggableSlots;
|
|
5
|
+
refs: {
|
|
6
|
+
dragRef: HTMLDivElement;
|
|
7
|
+
};
|
|
8
|
+
rootEl: HTMLDivElement;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import('vue').DefineComponent<DraggableProps, {
|
|
12
|
+
/** 手动保存位置 */
|
|
13
|
+
savePosition: () => void;
|
|
14
|
+
/** 重置位置到初始值 */
|
|
15
|
+
resetPosition: () => void;
|
|
16
|
+
/** 获取当前位置 */
|
|
17
|
+
getPosition: () => {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
/** 是否正在拖拽 */
|
|
22
|
+
isDragging: () => boolean;
|
|
23
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
24
|
+
change: (position: {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}) => any;
|
|
28
|
+
click: (event: MouseEvent) => any;
|
|
29
|
+
start: (position: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}) => any;
|
|
33
|
+
end: (position: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}) => any;
|
|
37
|
+
move: (position: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}) => any;
|
|
41
|
+
}, string, import('vue').PublicProps, Readonly<DraggableProps> & Readonly<{
|
|
42
|
+
onChange?: ((position: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}) => any) | undefined;
|
|
46
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
47
|
+
onStart?: ((position: {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
}) => any) | undefined;
|
|
51
|
+
onEnd?: ((position: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
}) => any) | undefined;
|
|
55
|
+
onMove?: ((position: {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
}) => any) | undefined;
|
|
59
|
+
}>, {
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
initialValue: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
};
|
|
65
|
+
storageKey: string;
|
|
66
|
+
persistPosition: boolean;
|
|
67
|
+
boundToViewport: boolean;
|
|
68
|
+
viewportMargin: number;
|
|
69
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
70
|
+
dragRef: HTMLDivElement;
|
|
71
|
+
}, HTMLDivElement>;
|
|
72
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
73
|
+
export default _default;
|
|
74
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
75
|
+
new (): {
|
|
76
|
+
$slots: S;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { defineComponent, ref, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, renderSlot } from "vue";
|
|
21
|
+
import { useDraggable } from "@vueuse/core";
|
|
22
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
23
|
+
name: "JkyDraggable"
|
|
24
|
+
}), {
|
|
25
|
+
__name: "Draggable",
|
|
26
|
+
props: {
|
|
27
|
+
disabled: { type: Boolean, default: false },
|
|
28
|
+
initialValue: { default: () => ({ x: 100, y: 100 }) },
|
|
29
|
+
storageKey: { default: "jky-draggable-position" },
|
|
30
|
+
persistPosition: { type: Boolean, default: true },
|
|
31
|
+
boundToViewport: { type: Boolean, default: true },
|
|
32
|
+
viewportMargin: { default: 0 }
|
|
33
|
+
},
|
|
34
|
+
emits: ["start", "move", "end", "change", "click"],
|
|
35
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
36
|
+
const props = __props;
|
|
37
|
+
const emit = __emit;
|
|
38
|
+
const dragRef = ref(null);
|
|
39
|
+
const startPosition = ref(null);
|
|
40
|
+
function getInitialPosition() {
|
|
41
|
+
if (!props.persistPosition) {
|
|
42
|
+
return props.initialValue || { x: 100, y: 100 };
|
|
43
|
+
}
|
|
44
|
+
const saved = localStorage.getItem(props.storageKey);
|
|
45
|
+
if (saved) {
|
|
46
|
+
try {
|
|
47
|
+
return JSON.parse(saved);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return props.initialValue || { x: 100, y: 100 };
|
|
52
|
+
}
|
|
53
|
+
function savePosition(x2, y2) {
|
|
54
|
+
if (!props.persistPosition)
|
|
55
|
+
return;
|
|
56
|
+
localStorage.setItem(props.storageKey, JSON.stringify({ x: x2, y: y2 }));
|
|
57
|
+
}
|
|
58
|
+
const { x, y, style, isDragging } = useDraggable(dragRef, {
|
|
59
|
+
initialValue: getInitialPosition(),
|
|
60
|
+
disabled: props.disabled,
|
|
61
|
+
preventDefault: true,
|
|
62
|
+
// stopPropagation: true,
|
|
63
|
+
onStart: () => {
|
|
64
|
+
startPosition.value = { x: x.value, y: y.value };
|
|
65
|
+
emit("start", { x: x.value, y: y.value });
|
|
66
|
+
},
|
|
67
|
+
onMove: () => {
|
|
68
|
+
emit("move", { x: x.value, y: y.value });
|
|
69
|
+
},
|
|
70
|
+
onEnd: (position) => {
|
|
71
|
+
savePosition(x.value, y.value);
|
|
72
|
+
emit("end", { x: x.value, y: y.value });
|
|
73
|
+
if (startPosition.value) {
|
|
74
|
+
const dx = Math.abs(position.x - startPosition.value.x);
|
|
75
|
+
const dy = Math.abs(position.y - startPosition.value.y);
|
|
76
|
+
if (dx < 3 && dy < 3) {
|
|
77
|
+
emit("click", new MouseEvent("click"));
|
|
78
|
+
}
|
|
79
|
+
startPosition.value = null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
watch([x, y], ([newX, newY]) => {
|
|
84
|
+
emit("change", { x: newX, y: newY });
|
|
85
|
+
if (isDragging.value) {
|
|
86
|
+
savePosition(newX, newY);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
watch([x, y], ([newX, newY]) => {
|
|
90
|
+
if (!props.boundToViewport || !dragRef.value)
|
|
91
|
+
return;
|
|
92
|
+
const maxX = window.innerWidth - dragRef.value.offsetWidth - props.viewportMargin;
|
|
93
|
+
const maxY = window.innerHeight - dragRef.value.offsetHeight - props.viewportMargin;
|
|
94
|
+
const clampedX = Math.max(props.viewportMargin, Math.min(newX, maxX));
|
|
95
|
+
const clampedY = Math.max(props.viewportMargin, Math.min(newY, maxY));
|
|
96
|
+
if (clampedX !== newX || clampedY !== newY) {
|
|
97
|
+
x.value = clampedX;
|
|
98
|
+
y.value = clampedY;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
__expose({
|
|
102
|
+
/** 手动保存位置 */
|
|
103
|
+
savePosition: () => savePosition(x.value, y.value),
|
|
104
|
+
/** 重置位置到初始值 */
|
|
105
|
+
resetPosition: () => {
|
|
106
|
+
const initial = props.initialValue || { x: 100, y: 100 };
|
|
107
|
+
x.value = initial.x;
|
|
108
|
+
y.value = initial.y;
|
|
109
|
+
savePosition(initial.x, initial.y);
|
|
110
|
+
},
|
|
111
|
+
/** 获取当前位置 */
|
|
112
|
+
getPosition: () => ({ x: x.value, y: y.value }),
|
|
113
|
+
/** 是否正在拖拽 */
|
|
114
|
+
isDragging: () => isDragging.value
|
|
115
|
+
});
|
|
116
|
+
return (_ctx, _cache) => {
|
|
117
|
+
return openBlock(), createElementBlock("div", {
|
|
118
|
+
ref_key: "dragRef",
|
|
119
|
+
ref: dragRef,
|
|
120
|
+
class: normalizeClass(["jky-draggable fixed z-9999 cursor-move select-none", { "jky-draggable--dragging": unref(isDragging) }]),
|
|
121
|
+
style: normalizeStyle(unref(style))
|
|
122
|
+
}, [
|
|
123
|
+
renderSlot(_ctx.$slots, "default")
|
|
124
|
+
], 6);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
export {
|
|
129
|
+
_sfc_main as default
|
|
130
|
+
};
|