jky-component-lib 0.0.95 → 0.0.96

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.
@@ -28,6 +28,7 @@ declare const __VLS_component: import('vue').DefineComponent<AMapMarkerProps, {
28
28
  draggable: boolean;
29
29
  visible: boolean;
30
30
  updateMode: "incremental" | "full";
31
+ cluster: boolean;
31
32
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
33
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
33
34
  export default _default;
@@ -31,13 +31,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
31
31
  icon: {},
32
32
  offset: {},
33
33
  visible: { type: Boolean, default: true },
34
- updateMode: { default: "full" }
34
+ updateMode: { default: "full" },
35
+ cluster: { type: Boolean, default: false },
36
+ clusterOptions: {}
35
37
  },
36
38
  emits: ["click", "dragend", "mouseover", "mouseout"],
37
39
  setup(__props, { expose: __expose, emit: __emit }) {
38
40
  const props = __props;
39
41
  const emit = __emit;
40
42
  const markers = ref([]);
43
+ const clusterManager = ref(null);
41
44
  const amapContext = inject("amapContext", null);
42
45
  const mapInstance = (amapContext == null ? void 0 : amapContext.getMapInstance()) || null;
43
46
  const contentCleanupFns = /* @__PURE__ */ new WeakMap();
@@ -47,6 +50,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
47
50
  render(vnode, container);
48
51
  return container.firstElementChild || container;
49
52
  }
53
+ function createClusterManager() {
54
+ const AMap = window.AMap;
55
+ if (!AMap || !mapInstance)
56
+ return;
57
+ if (clusterManager.value) {
58
+ clusterManager.value.clearMarkers();
59
+ clusterManager.value = null;
60
+ }
61
+ const options = {
62
+ map: mapInstance
63
+ };
64
+ if (props.clusterOptions) {
65
+ Object.assign(options, props.clusterOptions);
66
+ }
67
+ clusterManager.value = new AMap.MarkerCluster(options);
68
+ }
50
69
  function createMarker(data) {
51
70
  const AMap = window.AMap;
52
71
  if (!AMap || !mapInstance) {
@@ -126,7 +145,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
126
145
  cleanupFn();
127
146
  contentCleanupFns.delete(marker);
128
147
  }
129
- mapInstance == null ? void 0 : mapInstance.remove(marker);
148
+ if (props.cluster && clusterManager.value) {
149
+ clusterManager.value.removeMarker(marker);
150
+ } else {
151
+ mapInstance == null ? void 0 : mapInstance.remove(marker);
152
+ }
130
153
  }
131
154
  });
132
155
  const markersToAdd = newMarkers.filter((data) => {
@@ -138,7 +161,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
138
161
  const marker = createMarker(data);
139
162
  if (marker) {
140
163
  newMarkersList.push(marker);
141
- mapInstance == null ? void 0 : mapInstance.add(marker);
164
+ if (props.cluster && clusterManager.value) {
165
+ clusterManager.value.addMarker(marker);
166
+ } else {
167
+ mapInstance == null ? void 0 : mapInstance.add(marker);
168
+ }
142
169
  }
143
170
  });
144
171
  markers.value.push(...newMarkersList);
@@ -148,12 +175,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
148
175
  if (!mapInstance)
149
176
  return;
150
177
  removeMarkers();
178
+ if (props.cluster && !clusterManager.value) {
179
+ createClusterManager();
180
+ }
151
181
  if (newMarkers && newMarkers.length > 0) {
152
182
  newMarkers.forEach((data) => {
153
183
  const marker = createMarker(data);
154
184
  if (marker) {
155
185
  markers.value.push(marker);
156
- mapInstance == null ? void 0 : mapInstance.add(marker);
186
+ if (props.cluster && clusterManager.value) {
187
+ clusterManager.value.addMarker(marker);
188
+ } else {
189
+ mapInstance == null ? void 0 : mapInstance.add(marker);
190
+ }
157
191
  }
158
192
  });
159
193
  }
@@ -161,6 +195,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
161
195
  function addMarkers() {
162
196
  if (!mapInstance)
163
197
  return;
198
+ if (props.cluster && !clusterManager.value) {
199
+ createClusterManager();
200
+ }
164
201
  if (props.markers && props.markers.length > 0) {
165
202
  if (props.updateMode === "full") {
166
203
  fullUpdate(props.markers);
@@ -178,12 +215,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
178
215
  const marker = createMarker(singleMarker);
179
216
  if (marker) {
180
217
  markers.value.push(marker);
181
- mapInstance == null ? void 0 : mapInstance.add(marker);
218
+ if (props.cluster && clusterManager.value) {
219
+ clusterManager.value.addMarker(marker);
220
+ } else {
221
+ mapInstance == null ? void 0 : mapInstance.add(marker);
222
+ }
182
223
  }
183
224
  }
184
225
  }
185
226
  function removeMarkers() {
186
- if (!mapInstance || markers.value.length === 0)
227
+ if (markers.value.length === 0)
187
228
  return;
188
229
  markers.value.forEach((marker) => {
189
230
  const cleanupFn = contentCleanupFns.get(marker);
@@ -191,9 +232,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
191
232
  cleanupFn();
192
233
  contentCleanupFns.delete(marker);
193
234
  }
194
- mapInstance == null ? void 0 : mapInstance.remove(marker);
235
+ if (props.cluster && clusterManager.value) {
236
+ clusterManager.value.removeMarker(marker);
237
+ } else if (mapInstance) {
238
+ mapInstance.remove(marker);
239
+ }
195
240
  });
196
241
  markers.value = [];
242
+ if (props.cluster && clusterManager.value) {
243
+ clusterManager.value.clearMarkers();
244
+ clusterManager.value = null;
245
+ }
197
246
  }
198
247
  __expose({
199
248
  getMarkers: () => markers.value,
@@ -1,14 +1,7 @@
1
- /* AMap 高德地图组件样式 */
2
- .jky-amap-container {
3
- /* 地图容器样式 */
4
- position: relative;
5
- overflow: hidden;
6
1
 
7
- /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
- .amap-logo {
9
- display: none !important;
10
- }
11
- .amap-copyright {
12
- display: none !important;
13
- }
2
+ /* JkyAMarker 组件样式 - 参考高德官方示例 */
3
+ .amap-icon img,
4
+ .amap-marker-content img {
5
+ width: 25px;
6
+ height: 34px;
14
7
  }
@@ -1,7 +1,14 @@
1
+ /* AMap 高德地图组件样式 */
2
+ .jky-amap-container {
3
+ /* 地图容器样式 */
4
+ position: relative;
5
+ overflow: hidden;
1
6
 
2
- /* JkyAMarker 组件样式 - 参考高德官方示例 */
3
- .amap-icon img,
4
- .amap-marker-content img {
5
- width: 25px;
6
- height: 34px;
7
+ /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
+ .amap-logo {
9
+ display: none !important;
10
+ }
11
+ .amap-copyright {
12
+ display: none !important;
13
+ }
7
14
  }
@@ -72,6 +72,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
72
72
  responsive: { type: Boolean, default: true },
73
73
  grid: { type: [Boolean, Object], default: false },
74
74
  className: {},
75
+ formClass: {},
75
76
  readonly: { type: Boolean },
76
77
  disabled: { type: Boolean },
77
78
  watchDeep: { type: Boolean, default: true },
@@ -154,7 +155,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
154
155
  if (props.inline && props.grid) {
155
156
  classes.push("jky-form--grid");
156
157
  }
157
- return classes;
158
+ return [...classes, props.formClass || ""];
158
159
  });
159
160
  const _gridStyle = computed(() => {
160
161
  if (!props.inline || !props.grid || typeof props.grid === "boolean") {
@@ -1,4 +1,4 @@
1
- const version = "0.0.95";
1
+ const version = "0.0.96";
2
2
  export {
3
3
  version
4
4
  };
@@ -324,7 +324,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
324
324
  }, [
325
325
  __props.filterItems && __props.filterItems.length > 0 ? (openBlock(), createBlock(unref(ElCard), {
326
326
  key: 0,
327
- class: "mb-4 jky-page-table__filter-card"
327
+ class: "mb-3 jky-page-table__filter-card"
328
328
  }, {
329
329
  default: withCtx(() => [
330
330
  createVNode(unref(JkyForm), mergeProps({
@@ -28,6 +28,7 @@ declare const __VLS_component: import('vue').DefineComponent<AMapMarkerProps, {
28
28
  draggable: boolean;
29
29
  visible: boolean;
30
30
  updateMode: "incremental" | "full";
31
+ cluster: boolean;
31
32
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
33
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
33
34
  export default _default;
@@ -33,13 +33,16 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
33
33
  icon: {},
34
34
  offset: {},
35
35
  visible: { type: Boolean, default: true },
36
- updateMode: { default: "full" }
36
+ updateMode: { default: "full" },
37
+ cluster: { type: Boolean, default: false },
38
+ clusterOptions: {}
37
39
  },
38
40
  emits: ["click", "dragend", "mouseover", "mouseout"],
39
41
  setup(__props, { expose: __expose, emit: __emit }) {
40
42
  const props = __props;
41
43
  const emit = __emit;
42
44
  const markers = vue.ref([]);
45
+ const clusterManager = vue.ref(null);
43
46
  const amapContext = vue.inject("amapContext", null);
44
47
  const mapInstance = (amapContext == null ? void 0 : amapContext.getMapInstance()) || null;
45
48
  const contentCleanupFns = /* @__PURE__ */ new WeakMap();
@@ -49,6 +52,22 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
49
52
  vue.render(vnode, container);
50
53
  return container.firstElementChild || container;
51
54
  }
55
+ function createClusterManager() {
56
+ const AMap = window.AMap;
57
+ if (!AMap || !mapInstance)
58
+ return;
59
+ if (clusterManager.value) {
60
+ clusterManager.value.clearMarkers();
61
+ clusterManager.value = null;
62
+ }
63
+ const options = {
64
+ map: mapInstance
65
+ };
66
+ if (props.clusterOptions) {
67
+ Object.assign(options, props.clusterOptions);
68
+ }
69
+ clusterManager.value = new AMap.MarkerCluster(options);
70
+ }
52
71
  function createMarker(data) {
53
72
  const AMap = window.AMap;
54
73
  if (!AMap || !mapInstance) {
@@ -128,7 +147,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
128
147
  cleanupFn();
129
148
  contentCleanupFns.delete(marker);
130
149
  }
131
- mapInstance == null ? void 0 : mapInstance.remove(marker);
150
+ if (props.cluster && clusterManager.value) {
151
+ clusterManager.value.removeMarker(marker);
152
+ } else {
153
+ mapInstance == null ? void 0 : mapInstance.remove(marker);
154
+ }
132
155
  }
133
156
  });
134
157
  const markersToAdd = newMarkers.filter((data) => {
@@ -140,7 +163,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
140
163
  const marker = createMarker(data);
141
164
  if (marker) {
142
165
  newMarkersList.push(marker);
143
- mapInstance == null ? void 0 : mapInstance.add(marker);
166
+ if (props.cluster && clusterManager.value) {
167
+ clusterManager.value.addMarker(marker);
168
+ } else {
169
+ mapInstance == null ? void 0 : mapInstance.add(marker);
170
+ }
144
171
  }
145
172
  });
146
173
  markers.value.push(...newMarkersList);
@@ -150,12 +177,19 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
150
177
  if (!mapInstance)
151
178
  return;
152
179
  removeMarkers();
180
+ if (props.cluster && !clusterManager.value) {
181
+ createClusterManager();
182
+ }
153
183
  if (newMarkers && newMarkers.length > 0) {
154
184
  newMarkers.forEach((data) => {
155
185
  const marker = createMarker(data);
156
186
  if (marker) {
157
187
  markers.value.push(marker);
158
- mapInstance == null ? void 0 : mapInstance.add(marker);
188
+ if (props.cluster && clusterManager.value) {
189
+ clusterManager.value.addMarker(marker);
190
+ } else {
191
+ mapInstance == null ? void 0 : mapInstance.add(marker);
192
+ }
159
193
  }
160
194
  });
161
195
  }
@@ -163,6 +197,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
163
197
  function addMarkers() {
164
198
  if (!mapInstance)
165
199
  return;
200
+ if (props.cluster && !clusterManager.value) {
201
+ createClusterManager();
202
+ }
166
203
  if (props.markers && props.markers.length > 0) {
167
204
  if (props.updateMode === "full") {
168
205
  fullUpdate(props.markers);
@@ -180,12 +217,16 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
180
217
  const marker = createMarker(singleMarker);
181
218
  if (marker) {
182
219
  markers.value.push(marker);
183
- mapInstance == null ? void 0 : mapInstance.add(marker);
220
+ if (props.cluster && clusterManager.value) {
221
+ clusterManager.value.addMarker(marker);
222
+ } else {
223
+ mapInstance == null ? void 0 : mapInstance.add(marker);
224
+ }
184
225
  }
185
226
  }
186
227
  }
187
228
  function removeMarkers() {
188
- if (!mapInstance || markers.value.length === 0)
229
+ if (markers.value.length === 0)
189
230
  return;
190
231
  markers.value.forEach((marker) => {
191
232
  const cleanupFn = contentCleanupFns.get(marker);
@@ -193,9 +234,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
193
234
  cleanupFn();
194
235
  contentCleanupFns.delete(marker);
195
236
  }
196
- mapInstance == null ? void 0 : mapInstance.remove(marker);
237
+ if (props.cluster && clusterManager.value) {
238
+ clusterManager.value.removeMarker(marker);
239
+ } else if (mapInstance) {
240
+ mapInstance.remove(marker);
241
+ }
197
242
  });
198
243
  markers.value = [];
244
+ if (props.cluster && clusterManager.value) {
245
+ clusterManager.value.clearMarkers();
246
+ clusterManager.value = null;
247
+ }
199
248
  }
200
249
  __expose({
201
250
  getMarkers: () => markers.value,
@@ -1,14 +1,7 @@
1
- /* AMap 高德地图组件样式 */
2
- .jky-amap-container {
3
- /* 地图容器样式 */
4
- position: relative;
5
- overflow: hidden;
6
1
 
7
- /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
- .amap-logo {
9
- display: none !important;
10
- }
11
- .amap-copyright {
12
- display: none !important;
13
- }
2
+ /* JkyAMarker 组件样式 - 参考高德官方示例 */
3
+ .amap-icon img,
4
+ .amap-marker-content img {
5
+ width: 25px;
6
+ height: 34px;
14
7
  }
@@ -1,7 +1,14 @@
1
+ /* AMap 高德地图组件样式 */
2
+ .jky-amap-container {
3
+ /* 地图容器样式 */
4
+ position: relative;
5
+ overflow: hidden;
1
6
 
2
- /* JkyAMarker 组件样式 - 参考高德官方示例 */
3
- .amap-icon img,
4
- .amap-marker-content img {
5
- width: 25px;
6
- height: 34px;
7
+ /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
+ .amap-logo {
9
+ display: none !important;
10
+ }
11
+ .amap-copyright {
12
+ display: none !important;
13
+ }
7
14
  }
@@ -74,6 +74,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
74
74
  responsive: { type: Boolean, default: true },
75
75
  grid: { type: [Boolean, Object], default: false },
76
76
  className: {},
77
+ formClass: {},
77
78
  readonly: { type: Boolean },
78
79
  disabled: { type: Boolean },
79
80
  watchDeep: { type: Boolean, default: true },
@@ -156,7 +157,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
156
157
  if (props.inline && props.grid) {
157
158
  classes.push("jky-form--grid");
158
159
  }
159
- return classes;
160
+ return [...classes, props.formClass || ""];
160
161
  });
161
162
  const _gridStyle = vue.computed(() => {
162
163
  if (!props.inline || !props.grid || typeof props.grid === "boolean") {
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const version = "0.0.95";
3
+ const version = "0.0.96";
4
4
  exports.version = version;
@@ -326,7 +326,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
326
326
  }, [
327
327
  __props.filterItems && __props.filterItems.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElCard), {
328
328
  key: 0,
329
- class: "mb-4 jky-page-table__filter-card"
329
+ class: "mb-3 jky-page-table__filter-card"
330
330
  }, {
331
331
  default: vue.withCtx(() => [
332
332
  vue.createVNode(vue.unref(index.JkyForm), vue.mergeProps({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jky-component-lib",
3
3
  "type": "module",
4
- "version": "0.0.95",
4
+ "version": "0.0.96",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },