hy-dispatch-ui-v3 0.2.83 → 0.2.85

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.
Files changed (50) hide show
  1. package/dist/tailwind.css +54 -0
  2. package/es/bussiness/hyDeviceTree/deviceTree.vue.mjs +5 -0
  3. package/es/bussiness/hyDeviceTree/js/index.mjs +15 -5
  4. package/es/bussiness/hySelectDeviceTree/cpns/deviceItem.install.mjs +6 -0
  5. package/es/bussiness/hySelectDeviceTree/cpns/deviceItem.vue.mjs +113 -0
  6. package/es/bussiness/hySelectDeviceTree/index.mjs +7 -0
  7. package/es/bussiness/hySelectDeviceTree/js/index.mjs +35 -0
  8. package/es/bussiness/hySelectDeviceTree/selectDeviceTree.install.mjs +6 -0
  9. package/es/bussiness/hySelectDeviceTree/selectDeviceTree.vue.mjs +163 -0
  10. package/es/bussiness/hySelectDeviceTree/style/selectDeviceTree.scss +0 -0
  11. package/es/bussiness/index.mjs +1 -0
  12. package/es/components/hyForm/cpns/formItem.vue.mjs +493 -426
  13. package/es/components/hyForm/form.vue.mjs +12 -0
  14. package/es/components/hyIcon/icon.vue.mjs +10 -4
  15. package/es/components/hyMap/js/index.mjs +1 -0
  16. package/es/components-map.mjs +1 -0
  17. package/es/index.mjs +2 -0
  18. package/es/utils/device.mjs +42 -0
  19. package/es/utils/index.mjs +1 -0
  20. package/es/utils/map/hook/bigMap.mjs +103 -124
  21. package/es/utils/map/hook/gaode.mjs +3 -0
  22. package/es/utils/map/hook/leafletjs.mjs +78 -113
  23. package/es/utils/map/index.mjs +4 -4
  24. package/es/utils/map/js/mapProxy.mjs +24 -5
  25. package/es/version.mjs +1 -1
  26. package/lib/bussiness/hyDeviceTree/deviceTree.vue.js +5 -0
  27. package/lib/bussiness/hyDeviceTree/js/index.js +15 -5
  28. package/lib/bussiness/hySelectDeviceTree/cpns/deviceItem.install.js +6 -0
  29. package/lib/bussiness/hySelectDeviceTree/cpns/deviceItem.vue.js +117 -0
  30. package/lib/bussiness/hySelectDeviceTree/index.js +12 -0
  31. package/lib/bussiness/hySelectDeviceTree/js/index.js +37 -0
  32. package/lib/bussiness/hySelectDeviceTree/selectDeviceTree.install.js +6 -0
  33. package/lib/bussiness/hySelectDeviceTree/selectDeviceTree.vue.js +167 -0
  34. package/lib/bussiness/hySelectDeviceTree/style/selectDeviceTree.scss +0 -0
  35. package/lib/bussiness/index.js +4 -2
  36. package/lib/components/hyForm/cpns/formItem.vue.js +492 -425
  37. package/lib/components/hyForm/form.vue.js +12 -0
  38. package/lib/components/hyIcon/icon.vue.js +10 -4
  39. package/lib/components/hyMap/js/index.js +1 -0
  40. package/lib/components-map.js +1 -0
  41. package/lib/index.js +24 -20
  42. package/lib/utils/device.js +44 -0
  43. package/lib/utils/index.js +2 -0
  44. package/lib/utils/map/hook/bigMap.js +102 -123
  45. package/lib/utils/map/hook/gaode.js +3 -0
  46. package/lib/utils/map/hook/leafletjs.js +77 -112
  47. package/lib/utils/map/index.js +4 -4
  48. package/lib/utils/map/js/mapProxy.js +24 -4
  49. package/lib/version.js +1 -1
  50. package/package.json +1 -1
@@ -7,7 +7,7 @@ import 'leaflet.motion/dist/leaflet.motion.min';
7
7
  import 'leaflet.markercluster/dist/leaflet.markercluster-src.js';
8
8
  import 'leaflet-polylinedecorator/dist/leaflet.polylineDecorator';
9
9
  import { importCoordinate, exportCoordinate } from '../js/webgis.mjs';
10
- import { createMapProxy, createWrappedHandlerStore } from '../js/mapProxy.mjs';
10
+ import { createNativeMapProxy, createWrappedHandlerStore } from '../js/mapProxy.mjs';
11
11
  import * as esriNS from 'esri-leaflet';
12
12
  import * as cluster from 'esri-leaflet-cluster';
13
13
  import related from 'esri-leaflet-related/dist/esri-leaflet-related';
@@ -63,22 +63,7 @@ const generalMapMethods = {
63
63
  */
64
64
  getBounds(target) {
65
65
  const bounds = target.getBounds();
66
- const southWest = bounds.getSouthWest();
67
- const northEast = bounds.getNorthEast();
68
- const center = bounds.getCenter();
69
- bounds.getSouthWest = () => {
70
- const { lat, lng } = latAndLngCheck(southWest);
71
- return L.latLng(lat, lng);
72
- };
73
- bounds.getNorthEast = () => {
74
- const { lat, lng } = latAndLngCheck(northEast);
75
- return L.latLng(lat, lng);
76
- };
77
- bounds.getCenter = () => {
78
- const { lat, lng } = latAndLngCheck(center);
79
- return L.latLng(lat, lng);
80
- };
81
- return bounds;
66
+ return L.latLngBounds(latAndLngCheck(bounds.getSouthWest()), latAndLngCheck(bounds.getNorthEast()));
82
67
  },
83
68
  /**
84
69
  * 包装Map实例
@@ -86,13 +71,7 @@ const generalMapMethods = {
86
71
  * @returns {Proxy} 包装后的Map
87
72
  */
88
73
  getMap(map) {
89
- return createMapProxy(getInitMap(map), {
90
- getCenter(target) {
91
- const center = target.getCenter();
92
- const { lng, lat } = latAndLngCheck(center);
93
- return L.latLng(lat, lng);
94
- }
95
- });
74
+ return getInitMap(map);
96
75
  },
97
76
  /**
98
77
  * 包装Bounds(导出转换)
@@ -101,22 +80,7 @@ const generalMapMethods = {
101
80
  */
102
81
  getBoundsExport(target) {
103
82
  const bounds = target.getBounds();
104
- const southWest = bounds.getSouthWest();
105
- const northEast = bounds.getNorthEast();
106
- const center = bounds.getCenter();
107
- bounds.getSouthWest = () => {
108
- const { lat, lng } = latAndLngCheckExport(southWest);
109
- return L.latLng(lat, lng);
110
- };
111
- bounds.getNorthEast = () => {
112
- const { lat, lng } = latAndLngCheckExport(northEast);
113
- return L.latLng(lat, lng);
114
- };
115
- bounds.getCenter = () => {
116
- const { lat, lng } = latAndLngCheckExport(center);
117
- return L.latLng(lat, lng);
118
- };
119
- return bounds;
83
+ return L.latLngBounds(latAndLngCheckExport(bounds.getSouthWest()), latAndLngCheckExport(bounds.getNorthEast()));
120
84
  }
121
85
  };
122
86
  function latAndLngCheck(item) {
@@ -136,6 +100,7 @@ function latAndLngCheckExport(item) {
136
100
  function latLngListCheck(dataList = []) {
137
101
  return dataList.map((item) => {
138
102
  const isArray = Array.isArray(item);
103
+ if (isArray && (item.length === 0 || typeof item[0] === "object")) return latLngListCheck(item);
139
104
  const { lat, lng } = latAndLngCheck(item);
140
105
  return isArray ? [lat, lng] : { ...item, lat, lng };
141
106
  });
@@ -143,6 +108,7 @@ function latLngListCheck(dataList = []) {
143
108
  function latLngListCheckExport(dataList = []) {
144
109
  return dataList.map((item) => {
145
110
  const isArray = Array.isArray(item);
111
+ if (isArray && (item.length === 0 || typeof item[0] === "object")) return latLngListCheckExport(item);
146
112
  const { lat, lng } = latAndLngCheckExport(item);
147
113
  return isArray ? [lat, lng] : { ...item, lat, lng };
148
114
  });
@@ -159,32 +125,15 @@ function circleToPolygonPoints(center, radius, asObject = false) {
159
125
  return points;
160
126
  }
161
127
  function wrapDrawLayer(layer) {
162
- const bounds = layer.getBounds();
163
- if (!layer.getLatLngs) {
164
- layer.getLatLngs = () => {
165
- const points = circleToPolygonPoints(layer.getLatLng(), layer.getRadius() / 1e3, true);
166
- return [latLngListCheckExport(points)];
167
- };
168
- } else {
169
- const latLngList = layer.getLatLngs();
170
- layer.getLatLngs = () => {
171
- const item = JSON.parse(JSON.stringify(latLngList[0]));
172
- return [latLngListCheckExport([...item])];
173
- };
174
- }
175
- layer.getBounds = () => {
176
- const southWest = bounds.getSouthWest();
177
- const northEast = bounds.getNorthEast();
178
- bounds.getSouthWest = () => {
179
- const { lat, lng } = latAndLngCheckExport(southWest);
180
- return L.latLng(lat, lng);
181
- };
182
- bounds.getNorthEast = () => {
183
- const { lat, lng } = latAndLngCheckExport(northEast);
184
- return L.latLng(lat, lng);
185
- };
186
- return bounds;
187
- };
128
+ return createNativeMapProxy(layer, {
129
+ getLatLngs: function(target) {
130
+ const points = target.getLatLngs ? target.getLatLngs() : [circleToPolygonPoints(target.getLatLng(), target.getRadius() / 1e3, true)];
131
+ return latLngListCheckExport(points);
132
+ },
133
+ getBounds: function(target) {
134
+ return generalMapMethods.getBoundsExport(target);
135
+ }
136
+ });
188
137
  }
189
138
  function createClickHandler(fn, context, target, withOriginEvent = false) {
190
139
  return (e) => {
@@ -276,14 +225,15 @@ class Leafletjs extends EventEmitter {
276
225
  return generalMapMethods.getBoundsExport(target);
277
226
  },
278
227
  getLatLngs: function(target) {
279
- const latLngList = target.getLatLngs();
280
- const item = JSON.parse(JSON.stringify(latLngList[0]));
281
- return [latLngListCheckExport([...item])];
228
+ return latLngListCheckExport(target.getLatLngs());
282
229
  },
283
230
  // 修改位置
284
231
  setLatLngs: function(target, lngLatList = []) {
285
232
  return target.setLatLngs(latLngListCheck(lngLatList));
286
233
  },
234
+ addLatLng: function(target, point) {
235
+ return target.addLatLng(latAndLngCheck(point));
236
+ },
287
237
  on: function(target, types, fn, context) {
288
238
  if (types === "click") {
289
239
  const customClickHandler = createClickHandler(fn, context, target);
@@ -297,7 +247,7 @@ class Leafletjs extends EventEmitter {
297
247
  return target.off(types, wrappedFn || fn, context);
298
248
  }
299
249
  };
300
- return createMapProxy(polygon, handlers);
250
+ return createNativeMapProxy(polygon, handlers);
301
251
  });
302
252
  this.initParams = request;
303
253
  this.tileLayerList = [];
@@ -330,16 +280,23 @@ class Leafletjs extends EventEmitter {
330
280
  wrappedHandlers.clear();
331
281
  }
332
282
  },
333
- fitBounds: function(target, params) {
334
- if (!Array.isArray(params)) {
335
- params = [params];
336
- }
337
- const fitBoundsList = params.map(
338
- (item) => createMapProxy(item, {
339
- getBounds: (boundsTarget) => generalMapMethods.getBounds(boundsTarget)
340
- })
341
- );
342
- return target.fitBounds(fitBoundsList);
283
+ fitBounds: function(target, params, options) {
284
+ const bounds = L.latLngBounds();
285
+ const extendBounds = (item) => {
286
+ if (item?.getBounds) {
287
+ const layer = item.getInitLayer ? item.getInitLayer() : item;
288
+ bounds.extend(layer.getBounds());
289
+ } else if (item?.getSouthWest) {
290
+ bounds.extend(latAndLngCheck(item.getSouthWest()));
291
+ bounds.extend(latAndLngCheck(item.getNorthEast()));
292
+ } else if (Array.isArray(item) && (item.length === 0 || typeof item[0] === "object")) {
293
+ item.forEach(extendBounds);
294
+ } else {
295
+ bounds.extend(latAndLngCheck(item));
296
+ }
297
+ };
298
+ extendBounds(params);
299
+ return target.fitBounds(bounds, options);
343
300
  },
344
301
  // 获取中心点
345
302
  getCenter: function(target) {
@@ -353,18 +310,7 @@ class Leafletjs extends EventEmitter {
353
310
  },
354
311
  // 四个角
355
312
  getBounds: function(target) {
356
- const bounds = target.getBounds();
357
- const southWest = bounds.getSouthWest();
358
- const northEast = bounds.getNorthEast();
359
- bounds.getSouthWest = () => {
360
- const { lat: lat2, lng: lng2 } = latAndLngCheckExport(southWest);
361
- return L.latLng(lat2, lng2);
362
- };
363
- bounds.getNorthEast = () => {
364
- const { lat: lat2, lng: lng2 } = latAndLngCheckExport(northEast);
365
- return L.latLng(lat2, lng2);
366
- };
367
- return bounds;
313
+ return generalMapMethods.getBoundsExport(target);
368
314
  },
369
315
  // 移动至目标位置
370
316
  panTo: function(target, center2, options) {
@@ -385,7 +331,7 @@ class Leafletjs extends EventEmitter {
385
331
  } else if (types === "pm:create") {
386
332
  const customClickHandler = (e) => {
387
333
  const newEvent = { ...e };
388
- wrapDrawLayer(newEvent.layer);
334
+ newEvent.layer = wrapDrawLayer(newEvent.layer);
389
335
  fn.call(context || target, newEvent);
390
336
  };
391
337
  wrappedHandlers.remember(types, fn, customClickHandler);
@@ -402,7 +348,7 @@ class Leafletjs extends EventEmitter {
402
348
  _this.setLayersUrl(target, satelliteMap !== 2);
403
349
  }
404
350
  };
405
- const map = createMapProxy(newMap, handlers);
351
+ const map = createNativeMapProxy(newMap, handlers);
406
352
  map.id = createUniqueId();
407
353
  map.whenReady(() => {
408
354
  if (option.completeCallbacks) {
@@ -549,16 +495,16 @@ class Leafletjs extends EventEmitter {
549
495
  }
550
496
  // 地图图层
551
497
  layerGroup(map, markers = []) {
552
- const layerGroup = L.layerGroup(markers).addTo(getInitMap(map));
498
+ const layerGroup = L.layerGroup(markers.map((item) => item.getInitLayer?.() || item)).addTo(getInitMap(map));
553
499
  const handlers = {
554
500
  addLayer: function(target, addItem) {
555
- return target.addLayer(addItem);
501
+ return target.addLayer(addItem.getInitLayer?.() || addItem);
556
502
  },
557
503
  clearLayers: function(target) {
558
504
  return target.clearLayers();
559
505
  }
560
506
  };
561
- return createMapProxy(layerGroup, handlers);
507
+ return createNativeMapProxy(layerGroup, handlers);
562
508
  }
563
509
  // 获取esri对象
564
510
  esriFn() {
@@ -629,7 +575,7 @@ class Leafletjs extends EventEmitter {
629
575
  // 更改标记位置。
630
576
  setLatLng: function(target, lngAndLat) {
631
577
  const { lat, lng } = latAndLngCheck(lngAndLat);
632
- target.setLatLng([lat, lng]);
578
+ return target.setLatLng([lat, lng]);
633
579
  },
634
580
  setIcon: function(target, iconParams) {
635
581
  target.setIcon(iconParams.divIcon);
@@ -647,7 +593,7 @@ class Leafletjs extends EventEmitter {
647
593
  return target.off(types, wrappedFn || fn, context);
648
594
  }
649
595
  };
650
- const markerProxy = createMapProxy(marker, handlers);
596
+ const markerProxy = createNativeMapProxy(marker, handlers);
651
597
  marker._proxy = markerProxy;
652
598
  return markerProxy;
653
599
  }
@@ -683,6 +629,9 @@ class Leafletjs extends EventEmitter {
683
629
  addLayers: function(target, markerList2 = []) {
684
630
  target.addLayers(toNativeMarkers(markerList2, target));
685
631
  },
632
+ clearLayers: function(target) {
633
+ target.clearLayers();
634
+ },
686
635
  // 销毁聚合内所有 marker 并清空图层
687
636
  destroyAll: function(target) {
688
637
  target.getLayers().forEach((layer) => {
@@ -696,7 +645,7 @@ class Leafletjs extends EventEmitter {
696
645
  target.clearLayers();
697
646
  }
698
647
  };
699
- const newDisplayCluster = createMapProxy(displayCluster, handlers);
648
+ const newDisplayCluster = createNativeMapProxy(displayCluster, handlers);
700
649
  newDisplayCluster.addLayers(markerList);
701
650
  return newDisplayCluster;
702
651
  }
@@ -715,6 +664,12 @@ class Leafletjs extends EventEmitter {
715
664
  latLngList = [lat, lng];
716
665
  const circle = L.circle(latLngList, option);
717
666
  const handlers = {
667
+ getLatLng: function(target) {
668
+ return L.latLng(latAndLngCheckExport(target.getLatLng()));
669
+ },
670
+ setLatLng: function(target, point) {
671
+ return target.setLatLng(latAndLngCheck(point));
672
+ },
718
673
  addTo: function(target, map) {
719
674
  return target.addTo(generalMapMethods.getMap(map));
720
675
  },
@@ -728,7 +683,7 @@ class Leafletjs extends EventEmitter {
728
683
  return [latLngListCheckExport(points)];
729
684
  }
730
685
  };
731
- return createMapProxy(circle, handlers);
686
+ return createNativeMapProxy(circle, handlers);
732
687
  }
733
688
  // 自定义 popup
734
689
  Popup(option) {
@@ -738,6 +693,10 @@ class Leafletjs extends EventEmitter {
738
693
  };
739
694
  const popup = L.popup(option);
740
695
  const handlers = {
696
+ getLatLng: function(target) {
697
+ const point = target.getLatLng();
698
+ return point ? L.latLng(latAndLngCheckExport(point)) : point;
699
+ },
741
700
  addTo: function(target, map) {
742
701
  return target.addTo(generalMapMethods.getMap(map));
743
702
  },
@@ -762,7 +721,7 @@ class Leafletjs extends EventEmitter {
762
721
  return target.setLatLng(latLngList);
763
722
  }
764
723
  };
765
- return createMapProxy(popup, handlers);
724
+ return createNativeMapProxy(popup, handlers);
766
725
  }
767
726
  // 自定义 线条
768
727
  Polyline(latLngList = [], option = {}) {
@@ -772,6 +731,9 @@ class Leafletjs extends EventEmitter {
772
731
  const polyline = L.polyline(latLngList, option);
773
732
  const wrappedHandlers = createWrappedHandlerStore();
774
733
  const handlers = {
734
+ getLatLngs: function(target) {
735
+ return latLngListCheckExport(target.getLatLngs());
736
+ },
775
737
  addTo: function(target, map) {
776
738
  return target.addTo(generalMapMethods.getMap(map));
777
739
  },
@@ -800,22 +762,25 @@ class Leafletjs extends EventEmitter {
800
762
  return target.off(types, wrappedFn || fn, context);
801
763
  }
802
764
  };
803
- return createMapProxy(polyline, handlers);
765
+ return createNativeMapProxy(polyline, handlers);
804
766
  }
805
767
  MotionPolyline(latLngList = [], option = {}, motionOption = {}, markerOption = {}) {
806
768
  if (latLngList && latLngList.length !== 0) {
807
769
  latLngList = latLngListCheck(latLngList);
808
770
  }
809
771
  const polyline = L.motion.polyline(latLngList, option, motionOption, markerOption);
810
- return createMapProxy(polyline, {
772
+ return createNativeMapProxy(polyline, {
811
773
  addTo: function(target, map) {
812
774
  return target.addTo(generalMapMethods.getMap(map));
813
775
  }
814
776
  });
815
777
  }
816
778
  motionSeq(motion, options) {
817
- const seq = L.motion.seq(motion, options);
818
- return createMapProxy(seq, {
779
+ const seq = L.motion.seq(
780
+ motion.map((item) => item.getInitLayer?.() || item),
781
+ options
782
+ );
783
+ return createNativeMapProxy(seq, {
819
784
  addTo: function(target, map) {
820
785
  return target.addTo(generalMapMethods.getMap(map));
821
786
  }
@@ -898,7 +863,7 @@ class Leafletjs extends EventEmitter {
898
863
  trackPolyline = null;
899
864
  }
900
865
  };
901
- return createMapProxy(marker, handlers);
866
+ return createNativeMapProxy(marker, handlers);
902
867
  }
903
868
  // 创建绘画工具 rectangle 正方形 circle 圆形 polygon 多边形
904
869
  CreatePm(pmType = "rectangle", options = {}, map) {
@@ -924,7 +889,7 @@ class Leafletjs extends EventEmitter {
924
889
  map.on("pm:create", (e) => {
925
890
  layer = e.layer;
926
891
  if (options.onChange) {
927
- const pointsList = latLngListCheckExport(layer.getLatLngs()[0]);
892
+ const pointsList = layer.getLatLngs()[0];
928
893
  options.onChange(pointsList);
929
894
  }
930
895
  });
@@ -942,7 +907,7 @@ class Leafletjs extends EventEmitter {
942
907
  enableDraw(toolType);
943
908
  }
944
909
  };
945
- return createMapProxy({}, handlers);
910
+ return createNativeMapProxy({}, handlers);
946
911
  }
947
912
  // 电子围栏
948
913
  CreateFence(pmType = "rectangle", options = {}, map) {
@@ -970,7 +935,7 @@ class Leafletjs extends EventEmitter {
970
935
  pm.close();
971
936
  };
972
937
  const onChange = (pointList) => {
973
- setPolygon(latLngListCheck(pointList));
938
+ setPolygon(pointList);
974
939
  };
975
940
  const pm = this.CreatePm(
976
941
  pmType,
@@ -990,7 +955,7 @@ class Leafletjs extends EventEmitter {
990
955
  setPolygon(circleToPolygonPoints(lnglat, radius / 2e3));
991
956
  },
992
957
  setPolygon: function(target, pointList) {
993
- setPolygon(latLngListCheck(pointList));
958
+ setPolygon(pointList);
994
959
  },
995
960
  startDraw: function(target, toolType = "rectangle") {
996
961
  clearPolygon();
@@ -1011,7 +976,7 @@ class Leafletjs extends EventEmitter {
1011
976
  target.setMouseTool(toolType);
1012
977
  }
1013
978
  };
1014
- return createMapProxy(pm, handlers);
979
+ return createNativeMapProxy(pm, handlers);
1015
980
  }
1016
981
  // 测距工具 labelColor labelFillColor lineColor
1017
982
  RangingTool(options = {}, map) {
@@ -1304,7 +1269,7 @@ class Leafletjs extends EventEmitter {
1304
1269
  rangingPointsEnd = null;
1305
1270
  }
1306
1271
  };
1307
- return createMapProxy({}, handlers);
1272
+ return createNativeMapProxy({}, handlers);
1308
1273
  }
1309
1274
  }
1310
1275
 
@@ -86,11 +86,11 @@ function setMapServer(mapType, mapConfig = {}) {
86
86
  return promise;
87
87
  }
88
88
  function setPoiServer(mapConfig) {
89
- const data = mapConfig;
90
- data.mapCoordinate = typeof data.bmCorrect === "number" ? data.bmCorrect : data.mapCoordinate;
89
+ const data = { ...mapConfig };
90
+ data.mapCoordinate = data.mapCoordinate ?? (typeof data.bmCorrect === "number" ? data.bmCorrect : void 0);
91
91
  data.serverCoordinate = 1;
92
- data.projectCoordinate = 1;
93
- data.projectPoiCoordinate = 1;
92
+ data.projectCoordinate = data.projectCoordinate ?? 1;
93
+ data.projectPoiCoordinate = data.projectPoiCoordinate ?? data.projectCoordinate;
94
94
  data.poiServer = data.poiServer || {};
95
95
  let city = data.poiServer.city || "";
96
96
  city = city.split("-");
@@ -1,17 +1,36 @@
1
- const createMapProxy = (target, handlers = {}) => {
2
- return new Proxy(target, {
1
+ const nativeTargets = /* @__PURE__ */ new WeakMap();
2
+ const rawGetters = /* @__PURE__ */ new Set(["getInitMap", "getRawMap", "getInitMarker", "getInitLayer"]);
3
+ const unwrapNative = (value) => {
4
+ if (Array.isArray(value)) return value.map(unwrapNative);
5
+ while (value && nativeTargets.has(value)) value = nativeTargets.get(value);
6
+ return value;
7
+ };
8
+ const createMapProxy = (target, handlers = {}, nativeMethods = false) => {
9
+ const proxy = new Proxy(target, {
3
10
  get(_target, prop) {
11
+ if (nativeMethods && prop === "getInitLayer") return () => unwrapNative(_target);
4
12
  if (handlers[prop]) {
5
- return (...args) => handlers[prop](_target, ...args);
13
+ return (...args) => {
14
+ const result = handlers[prop](_target, ...args);
15
+ return nativeMethods && result === _target && !rawGetters.has(prop) ? proxy : result;
16
+ };
6
17
  }
7
- return _target[prop];
18
+ const value = _target[prop];
19
+ if (!nativeMethods || typeof value !== "function") return value;
20
+ return (...args) => {
21
+ const result = value.apply(_target, args.map(unwrapNative));
22
+ return result === _target && !rawGetters.has(prop) ? proxy : result;
23
+ };
8
24
  },
9
25
  set(_target, prop, value) {
10
26
  if (prop === "_proxy") return true;
11
27
  return Reflect.set(_target, prop, value);
12
28
  }
13
29
  });
30
+ if (nativeMethods) nativeTargets.set(proxy, target);
31
+ return proxy;
14
32
  };
33
+ const createNativeMapProxy = (target, handlers = {}) => createMapProxy(target, handlers, true);
15
34
  const createWrappedHandlerStore = () => {
16
35
  const wrappedHandlerMap = /* @__PURE__ */ new Map();
17
36
  return {
@@ -35,4 +54,4 @@ const createWrappedHandlerStore = () => {
35
54
  };
36
55
  };
37
56
 
38
- export { createMapProxy, createWrappedHandlerStore, createMapProxy as default };
57
+ export { createMapProxy, createNativeMapProxy, createWrappedHandlerStore, createMapProxy as default };
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.2.82";
1
+ const version = "0.2.84";
2
2
 
3
3
  export { version };
@@ -16,6 +16,11 @@ const __default__ = vue.defineComponent({
16
16
  });
17
17
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
18
18
  props: {
19
+ // 外部自定义树形数据接收 promise
20
+ customDataFn: {
21
+ type: Function,
22
+ default: null
23
+ },
19
24
  // 数据获取类型 custom 自定义数据
20
25
  type: {
21
26
  type: String,
@@ -21,11 +21,20 @@ function useDeviceTree(hy) {
21
21
  emits("onRefreshData");
22
22
  return;
23
23
  }
24
- const data = await organization.orgListWithDev3Api({
25
- showDevice: true,
26
- showGroup: false,
27
- ...props.requestParams
28
- });
24
+ let data = {};
25
+ if (props.customDataFn) {
26
+ data = await props.customDataFn({
27
+ showDevice: true,
28
+ showGroup: false,
29
+ ...props.requestParams
30
+ });
31
+ } else {
32
+ data = await organization.orgListWithDev3Api({
33
+ showDevice: true,
34
+ showGroup: false,
35
+ ...props.requestParams
36
+ });
37
+ }
29
38
  hy.hyTreeRef.value.getData(data).then(() => {
30
39
  emits("on-load");
31
40
  });
@@ -80,6 +89,7 @@ function useDeviceTree(hy) {
80
89
  emits("on-dblclick", list);
81
90
  }
82
91
  function onSelectedDataList(list) {
92
+ console.log("\u9009\u4E2D\u7684\u8BBE\u5907");
83
93
  emits("on-selectedDataList", list);
84
94
  }
85
95
  function singleRemovalFn(row, isForce = false) {
@@ -0,0 +1,6 @@
1
+ import '../../../utils/index.js';
2
+ import { withInstall } from '../../../utils/handler.js';
3
+ import _sfc_main from './deviceItem.vue.js';
4
+
5
+ const _wrapped = withInstall(_sfc_main);
6
+ export { _wrapped as default }
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ require('../../../utils/index.js');
7
+ require('../../../components/index.js');
8
+ var index = require('../../../components/hyTooltip/index.js');
9
+ var index$1 = require('../../../components/hyIcon/index.js');
10
+ var device = require('../../../utils/device.js');
11
+
12
+ const _sfc_main = {
13
+ __name: "deviceItem",
14
+ props: {
15
+ deleteFn: {
16
+ type: Function
17
+ },
18
+ index: {
19
+ type: Number,
20
+ default() {
21
+ return null;
22
+ }
23
+ },
24
+ source: {
25
+ type: Object,
26
+ default() {
27
+ return {};
28
+ }
29
+ }
30
+ },
31
+ setup(__props) {
32
+ const props = __props;
33
+ return (_ctx, _cache) => {
34
+ return vue.openBlock(), vue.createBlock(vue.unref(index.HyTooltip), null, {
35
+ content: vue.withCtx(() => [
36
+ vue.createElementVNode("div", { class: "w-full flex flex-col gap-3" }, [
37
+ __props.source.devName ? (vue.openBlock(), vue.createElementBlock("div", {
38
+ key: 0,
39
+ class: "flex"
40
+ }, [
41
+ vue.createElementVNode("div", {
42
+ class: "w-20 flex-shrink-0 text-auxiliary",
43
+ style: { "text-align-last": "justify" }
44
+ }, "\u8BBE\u5907\u540D\u79F0"),
45
+ vue.createElementVNode("span", { class: "text-auxiliary" }, ":"),
46
+ vue.createElementVNode(
47
+ "span",
48
+ { class: "ml-1" },
49
+ vue.toDisplayString(__props.source.devName),
50
+ 1
51
+ /* TEXT */
52
+ )
53
+ ])) : vue.createCommentVNode("v-if", true),
54
+ __props.source.deviceId ? (vue.openBlock(), vue.createElementBlock("div", {
55
+ key: 1,
56
+ class: "flex"
57
+ }, [
58
+ vue.createElementVNode("div", {
59
+ class: "w-20 flex-shrink-0 text-auxiliary",
60
+ style: { "text-align-last": "justify" }
61
+ }, "\uFF29\uFF2D\uFF25\uFF29"),
62
+ vue.createElementVNode("span", { class: "text-auxiliary" }, ":"),
63
+ vue.createElementVNode(
64
+ "span",
65
+ { class: "ml-1" },
66
+ vue.toDisplayString(__props.source.deviceId),
67
+ 1
68
+ /* TEXT */
69
+ )
70
+ ])) : vue.createCommentVNode("v-if", true),
71
+ __props.source.name ? (vue.openBlock(), vue.createElementBlock("div", {
72
+ key: 2,
73
+ class: "flex"
74
+ }, [
75
+ vue.createElementVNode("div", {
76
+ class: "w-20 flex-shrink-0 text-auxiliary",
77
+ style: { "text-align-last": "justify" }
78
+ }, "\u5F53\u524D\u7528\u6237"),
79
+ vue.createElementVNode("span", { class: "text-auxiliary" }, ":"),
80
+ vue.createElementVNode(
81
+ "span",
82
+ { class: "ml-1" },
83
+ vue.toDisplayString(__props.source.name),
84
+ 1
85
+ /* TEXT */
86
+ )
87
+ ])) : vue.createCommentVNode("v-if", true)
88
+ ])
89
+ ]),
90
+ default: vue.withCtx(() => [
91
+ vue.createElementVNode("div", { class: "w-full h-8 rounded bg-background-2 flex items-center box-border px-2 text-sm text-main mb-2 cursor-pointer group" }, [
92
+ vue.createVNode(vue.unref(index$1.HyIcon), {
93
+ svgName: vue.unref(device.getDeviceTypeIcon)(__props.source.deviceType, __props.source.onlineState),
94
+ class: "w-3 h-4 mr-1"
95
+ }, null, 8, ["svgName"]),
96
+ vue.createElementVNode(
97
+ "span",
98
+ { class: "truncate" },
99
+ vue.toDisplayString(__props.source.devName),
100
+ 1
101
+ /* TEXT */
102
+ ),
103
+ vue.createVNode(vue.unref(index$1.HyIcon), {
104
+ onClick: ($event) => __props.deleteFn(__props.source, __props.index),
105
+ svgName: "ops-linear-delete-v3",
106
+ class: "w-4 h-4 text-danger ml-auto opacity-0 group-hover:opacity-100"
107
+ }, null, 8, ["onClick"])
108
+ ])
109
+ ]),
110
+ _: 1
111
+ /* STABLE */
112
+ });
113
+ };
114
+ }
115
+ };
116
+
117
+ exports.default = _sfc_main;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('../../utils/index.js');
6
+ var selectDeviceTree = require('./selectDeviceTree.vue.js');
7
+ var handler = require('../../utils/handler.js');
8
+
9
+ const HySelectDeviceTree = handler.withInstall(selectDeviceTree.default);
10
+
11
+ exports.HySelectDeviceTree = HySelectDeviceTree;
12
+ exports.default = HySelectDeviceTree;