@cmeslib/components 0.1.14 → 0.3.0-beta.0

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 (91) hide show
  1. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  2. package/es/components/demo/index.mjs +2 -4
  3. package/es/components/demo/src/demo-button-setup-tsx.vue.mjs +3 -3
  4. package/es/components/demo/src/demo-button-setup-tsx.vue2.mjs +3 -3
  5. package/es/components/demo/src/demo-button.vue.mjs +4 -4
  6. package/es/components/demo/src/demo-button.vue2.mjs +5 -5
  7. package/es/components/hifleet/index.d.ts +4 -0
  8. package/es/components/hifleet/index.mjs +1 -0
  9. package/es/components/hifleet/src/helper.d.ts +32 -0
  10. package/es/components/hifleet/src/helper.mjs +261 -0
  11. package/es/components/hifleet/src/index.vue.d.ts +37 -0
  12. package/es/components/hifleet/src/index.vue.mjs +6 -0
  13. package/es/components/hifleet/src/index.vue2.mjs +123 -0
  14. package/es/components/hifleet/src/map-data.d.ts +18 -0
  15. package/es/components/hifleet/src/map-data.mjs +238 -0
  16. package/es/components/hifleet/src/types.d.ts +28 -0
  17. package/es/components/hifleet/src/types.mjs +1 -0
  18. package/es/components/index.d.ts +2 -0
  19. package/es/components/index.mjs +4 -3
  20. package/es/components/selectors/index.d.ts +6 -0
  21. package/es/components/selectors/index.mjs +2 -0
  22. package/es/components/selectors/src/DeptTreeSelect.vue.d.ts +13 -0
  23. package/es/components/selectors/src/DeptTreeSelect.vue.mjs +5 -0
  24. package/es/components/selectors/src/DeptTreeSelect.vue2.mjs +63 -0
  25. package/es/components/selectors/src/UserTreeSelect.vue.d.ts +13 -0
  26. package/es/components/selectors/src/UserTreeSelect.vue.mjs +5 -0
  27. package/es/components/selectors/src/UserTreeSelect.vue2.mjs +82 -0
  28. package/es/components/selectors/src/types.d.ts +27 -0
  29. package/es/components/selectors/src/types.mjs +1 -0
  30. package/es/directives/demo/index.d.ts +2 -0
  31. package/es/directives/demo/index.mjs +8 -0
  32. package/es/directives/index.d.ts +1 -1
  33. package/es/directives/index.mjs +1 -5
  34. package/es/hooks/common/index.d.ts +1 -0
  35. package/es/hooks/common/index.mjs +1 -0
  36. package/es/hooks/common/src/globalSingleFlight.d.ts +27 -0
  37. package/es/hooks/common/src/globalSingleFlight.mjs +108 -0
  38. package/es/hooks/demo/index.d.ts +1 -0
  39. package/es/hooks/demo/index.mjs +5 -0
  40. package/es/hooks/index.d.ts +2 -0
  41. package/es/hooks/index.mjs +2 -0
  42. package/es/index.css +63 -0
  43. package/es/index.d.ts +1 -0
  44. package/es/index.mjs +7 -4
  45. package/es/types/env.d.mjs +1 -0
  46. package/lib/_virtual/_plugin-vue_export-helper.js +13 -0
  47. package/lib/components/demo/index.js +4 -6
  48. package/lib/components/demo/src/demo-button-setup-tsx.vue.js +1 -1
  49. package/lib/components/demo/src/demo-button-setup-tsx.vue2.js +2 -2
  50. package/lib/components/demo/src/demo-button.vue.js +3 -3
  51. package/lib/components/demo/src/demo-button.vue2.js +3 -3
  52. package/lib/components/hifleet/index.d.ts +4 -0
  53. package/lib/components/hifleet/index.js +7 -0
  54. package/lib/components/hifleet/src/helper.d.ts +32 -0
  55. package/lib/components/hifleet/src/helper.js +272 -0
  56. package/lib/components/hifleet/src/index.vue.d.ts +37 -0
  57. package/lib/components/hifleet/src/index.vue.js +10 -0
  58. package/lib/components/hifleet/src/index.vue2.js +127 -0
  59. package/lib/components/hifleet/src/map-data.d.ts +18 -0
  60. package/lib/components/hifleet/src/map-data.js +241 -0
  61. package/lib/components/hifleet/src/types.d.ts +28 -0
  62. package/lib/components/hifleet/src/types.js +2 -0
  63. package/lib/components/index.d.ts +3 -0
  64. package/lib/components/index.js +8 -4
  65. package/lib/components/selectors/index.d.ts +6 -0
  66. package/lib/components/selectors/index.js +9 -0
  67. package/lib/components/selectors/src/DeptTreeSelect.vue.d.ts +13 -0
  68. package/lib/components/selectors/src/DeptTreeSelect.vue.js +9 -0
  69. package/lib/components/selectors/src/DeptTreeSelect.vue2.js +67 -0
  70. package/lib/components/selectors/src/UserTreeSelect.vue.d.ts +13 -0
  71. package/lib/components/selectors/src/UserTreeSelect.vue.js +9 -0
  72. package/lib/components/selectors/src/UserTreeSelect.vue2.js +86 -0
  73. package/lib/components/selectors/src/types.d.ts +27 -0
  74. package/lib/components/selectors/src/types.js +2 -0
  75. package/lib/directives/demo/index.d.ts +2 -0
  76. package/lib/directives/demo/index.js +10 -0
  77. package/lib/directives/index.d.ts +1 -1
  78. package/lib/directives/index.js +4 -4
  79. package/lib/hooks/common/index.d.ts +1 -0
  80. package/lib/hooks/common/index.js +8 -0
  81. package/lib/hooks/common/src/globalSingleFlight.d.ts +27 -0
  82. package/lib/hooks/common/src/globalSingleFlight.js +111 -0
  83. package/lib/hooks/demo/index.d.ts +1 -0
  84. package/lib/hooks/demo/index.js +7 -0
  85. package/lib/hooks/index.d.ts +2 -0
  86. package/lib/hooks/index.js +10 -0
  87. package/lib/index.css +63 -0
  88. package/lib/index.d.ts +3 -0
  89. package/lib/index.js +15 -6
  90. package/lib/types/env.d.js +2 -0
  91. package/package.json +5 -3
@@ -0,0 +1,9 @@
1
+ var _export_sfc = (sfc, props) => {
2
+ const target = sfc.__vccOpts || sfc;
3
+ for (const [key, val] of props) {
4
+ target[key] = val;
5
+ }
6
+ return target;
7
+ };
8
+
9
+ export { _export_sfc as default };
@@ -1,5 +1,3 @@
1
- import './src/demo-button.vue.mjs';
2
- import './src/demo-button-setup-tsx.vue.mjs';
3
- export { default as DemoButtonTsx } from './src/demo-button-tsx.mjs';
4
- export { default as DemoButton } from './src/demo-button.vue2.mjs';
1
+ export { default as DemoButton } from './src/demo-button.vue.mjs';
5
2
  export { default as DemoButtonSetupTsx } from './src/demo-button-setup-tsx.vue2.mjs';
3
+ export { default as DemoButtonTsx } from './src/demo-button-tsx.mjs';
@@ -1,5 +1,5 @@
1
- import script from './demo-button-setup-tsx.vue2.mjs';
1
+ import _sfc_main from './demo-button-setup-tsx.vue2.mjs';
2
2
 
3
- script.__file = "packages/cmeslib-components/components/demo/src/demo-button-setup-tsx.vue";
4
3
 
5
- export { script as default };
4
+
5
+ export { _sfc_main as default };
@@ -1,8 +1,8 @@
1
1
  import { jsxs, jsx } from 'vue/jsx-runtime';
2
- import { defineComponent, ref, createElementBlock, openBlock, createVNode } from 'vue';
2
+ import { defineComponent, ref, openBlock, createElementBlock, createVNode } from 'vue';
3
3
  import { ElButton } from 'element-plus';
4
4
 
5
- var script = /* @__PURE__ */ defineComponent({
5
+ var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "demo-button-setup-tsx",
7
7
  setup(__props) {
8
8
  const count = ref(0);
@@ -21,4 +21,4 @@ var script = /* @__PURE__ */ defineComponent({
21
21
  }
22
22
  });
23
23
 
24
- export { script as default };
24
+ export { _sfc_main as default };
@@ -1,6 +1,6 @@
1
- import script from './demo-button.vue2.mjs';
1
+ import _sfc_main from './demo-button.vue2.mjs';
2
+ import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
2
3
 
3
- script.__scopeId = "data-v-45226689";
4
- script.__file = "packages/cmeslib-components/components/demo/src/demo-button.vue";
4
+ var demoButton = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-eab32df7"]]);
5
5
 
6
- export { script as default };
6
+ export { demoButton as default };
@@ -1,8 +1,8 @@
1
- import { defineComponent, onMounted, createBlock, openBlock, unref, withCtx, createTextVNode } from 'vue';
1
+ import { defineComponent, onMounted, openBlock, createBlock, unref, withCtx, createTextVNode } from 'vue';
2
2
  import { ElButton } from 'element-plus';
3
- import { initHiFleet } from '@cmeslib/utils';
3
+ import { loadHiFleetResources } from '@cmeslib/utils';
4
4
 
5
- var script = /* @__PURE__ */ defineComponent({
5
+ var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "demo-button",
7
7
  props: {
8
8
  type: { type: String, required: false }
@@ -12,7 +12,7 @@ var script = /* @__PURE__ */ defineComponent({
12
12
  console.log("Button clicked");
13
13
  };
14
14
  onMounted(() => {
15
- initHiFleet("demo-button", 34);
15
+ loadHiFleetResources();
16
16
  });
17
17
  return (_ctx, _cache) => {
18
18
  return openBlock(), createBlock(unref(ElButton), {
@@ -34,4 +34,4 @@ var script = /* @__PURE__ */ defineComponent({
34
34
  }
35
35
  });
36
36
 
37
- export { script as default };
37
+ export { _sfc_main as default };
@@ -0,0 +1,4 @@
1
+ import HiFleetMap from './src/index.vue';
2
+ import type { HiFleetMapInitResponse } from './src/types';
3
+ export { HiFleetMap };
4
+ export type { HiFleetMapInitResponse };
@@ -0,0 +1 @@
1
+ export { default as HiFleetMap } from './src/index.vue.mjs';
@@ -0,0 +1,32 @@
1
+ import type { LayerGroup, LatLngExpression } from 'leaflet';
2
+ import { LineOptions, MapObj } from './types';
3
+ export declare function init(mapId: string, defaultMapType?: string): MapObj;
4
+ export declare const mapType: import("vue").Ref<string, string>;
5
+ export declare function changMapType(type: string, map: any, app: any): string;
6
+ export declare function mathLngFn(lnglng: number, multiple: number): any;
7
+ /**
8
+ * @param points [[维度,经度]]
9
+ * @param options // 更多配置详阅 https://leafletjs.com/reference.html#polyline
10
+ * @param layer 图层
11
+ */
12
+ export declare function displayPredictLine(points: LatLngExpression[], layer: LayerGroup, options?: LineOptions): void;
13
+ /**
14
+ * @param points [[维度,经度]]
15
+ * @param options // 更多配置详阅 https://leafletjs.com/reference.html#polyline
16
+ * @param layer 图层
17
+ */
18
+ export declare function displayRealLine(points: LatLngExpression[], layer: LayerGroup, options?: LineOptions): void;
19
+ /**
20
+ * @param points [[经度,维度]]
21
+ * @param type [经,纬]字段 key值
22
+ */
23
+ export declare function objectDayLineTransform(points: any, type: any): any[];
24
+ /**
25
+ * @param points [[经度,维度]]
26
+ */
27
+ export declare function dayLineTransform(points: any): any[];
28
+ export declare function convertLines(arg: any): any[];
29
+ /**
30
+ * 设置图标
31
+ */
32
+ export declare function setPointIcon(type: string): import("leaflet").Icon<import("leaflet").IconOptions>;
@@ -0,0 +1,261 @@
1
+ import { ref, nextTick } from 'vue';
2
+
3
+ function init(mapId, defaultMapType = "normal") {
4
+ const app = window.hifleet.create({ el: mapId });
5
+ const map = app.getMap();
6
+ const featureLayer = window.L.layerGroup();
7
+ const solidLineLayer = window.L.layerGroup();
8
+ const dottedLineLayer = window.L.layerGroup();
9
+ const lineLayer = window.L.layerGroup();
10
+ const tooltipLayer = window.L.layerGroup();
11
+ const markerLayer = window.L.layerGroup();
12
+ const mapEle = document.getElementsByClassName("leaflet-control-attribution");
13
+ for (let i = 0; i < mapEle.length; i++) {
14
+ const item = mapEle[i];
15
+ item.style.display = "none";
16
+ }
17
+ if (defaultMapType === "satellite") {
18
+ changMapType("satellite", map, app);
19
+ } else {
20
+ changMapType("normal", map, app);
21
+ app.setSeaMapMode();
22
+ }
23
+ featureLayer.addTo(map);
24
+ solidLineLayer.addTo(map);
25
+ dottedLineLayer.addTo(map);
26
+ lineLayer.addTo(map);
27
+ tooltipLayer.addTo(map);
28
+ markerLayer.addTo(map);
29
+ const EVENT = app.EVENT;
30
+ const latlngInfoObj = ref();
31
+ latlngInfoObj.value = {
32
+ lng: "",
33
+ lat: "",
34
+ lngDegree: "",
35
+ latDegree: ""
36
+ };
37
+ map.on("mousemove", (result) => {
38
+ const lnglng = +result.latlng.lng;
39
+ const latlng = +result.latlng.lat;
40
+ const multiple = Math.abs(+(lnglng / 360 + "").split(".")[0]);
41
+ const lng = mathLngFn(lnglng, multiple);
42
+ const lngDegreeArr = (lng + "").split(".");
43
+ const lngX = Math.abs(+lngDegreeArr[0]);
44
+ const lngY = ((Math.abs(lng) - lngX) * 60).toFixed(3);
45
+ const lngDegree = lngX + "\xB0" + lngY + " " + (lng >= 0 ? "E" : "W");
46
+ const latDegreeArr = (latlng + "").split(".");
47
+ const latX = Math.abs(+latDegreeArr[0]);
48
+ const latY = ((Math.abs(latlng) - latX) * 60).toFixed(3);
49
+ const latDegree = latX + "\xB0" + latY + " " + (latlng >= 0 ? "N" : "S");
50
+ latlngInfoObj.value = {
51
+ lng: lng.toFixed(5),
52
+ lat: latlng.toFixed(5),
53
+ lngDegree,
54
+ latDegree
55
+ };
56
+ });
57
+ const mapObj = {
58
+ mapInfo: {
59
+ // 地图对象
60
+ app,
61
+ map,
62
+ EVENT
63
+ },
64
+ latlngInfoObj,
65
+ // 经纬度信息
66
+ layerGroup: {
67
+ // 默认建图层
68
+ featureLayer,
69
+ solidLineLayer,
70
+ dottedLineLayer,
71
+ lineLayer,
72
+ tooltipLayer,
73
+ markerLayer
74
+ }
75
+ };
76
+ return mapObj;
77
+ }
78
+ let globalLayer;
79
+ const mapType = ref("normal");
80
+ function changMapType(type = mapType.value, map, app) {
81
+ switch (type) {
82
+ case "normal":
83
+ if (globalLayer) {
84
+ map.removeLayer(globalLayer);
85
+ globalLayer = null;
86
+ }
87
+ app.openMap();
88
+ app.changeMap({ lang: "cn", key: "global" });
89
+ break;
90
+ case "satellite":
91
+ if (globalLayer) {
92
+ map.removeLayer(globalLayer);
93
+ globalLayer = null;
94
+ }
95
+ app.openMap();
96
+ app.changeMap({ lang: "cn", key: "satellite" });
97
+ break;
98
+ case "global":
99
+ app.closeMap();
100
+ globalLayer = window.L.tileLayer(
101
+ "https://api.hifleet.com/nauticalmap/en/token?usertoken=uhzt76EZeisfeaj9mfjRe7wUhvQbokxgEYkBlfnXlR53HDfWXhpBuiIp7ZwY00S8&x={x}&y={y}&z={z}"
102
+ ).addTo(map);
103
+ break;
104
+ }
105
+ nextTick(() => {
106
+ if (map) {
107
+ map.invalidateSize(true);
108
+ }
109
+ });
110
+ mapType.value = type;
111
+ return type;
112
+ }
113
+ function mathLngFn(lnglng, multiple) {
114
+ let lng;
115
+ if (lnglng >= 0) {
116
+ lng = Math.abs(lnglng - 360 * multiple) < 180 ? lnglng - 360 * multiple : lnglng - 360 * multiple - 360;
117
+ } else {
118
+ lng = Math.abs(lnglng + 360 * multiple) < 180 ? lnglng + 360 * multiple : lnglng + 360 * multiple + 360;
119
+ }
120
+ return lng;
121
+ }
122
+ function displayPredictLine(points, layer, options = { weight: 2, color: "#F95E5A" }) {
123
+ const predictFeature = window.L.polyline(points, {
124
+ // snakingPause: 200,
125
+ color: options.color,
126
+ // 线的颜色
127
+ weight: options.weight,
128
+ // 线的宽度
129
+ dashArray: [10, 10]
130
+ // 虚线间隔的设置
131
+ // zIndex: 9
132
+ }).addTo(layer);
133
+ window.L.polylineDecorator(predictFeature, {
134
+ patterns: [
135
+ // defines a pattern of 10px-wide dashes, repeated every 20px on the line
136
+ {
137
+ offset: 30,
138
+ repeat: 100,
139
+ symbol: window.L.Symbol.arrowHead({
140
+ pixelSize: 8,
141
+ polygon: false,
142
+ pathOptions: { color: "#F95E5A", weight: 2, stroke: true }
143
+ })
144
+ }
145
+ ]
146
+ }).addTo(layer);
147
+ }
148
+ function displayRealLine(points, layer, options = { weight: 2, color: "#F95E5A" }) {
149
+ const realFeature = window.L.polyline(points, {
150
+ // snakingPause: 200,
151
+ color: options.color,
152
+ // 线的颜色
153
+ weight: options.weight
154
+ // 线的宽度
155
+ // zIndex: 9
156
+ }).addTo(layer);
157
+ window.L.polylineDecorator(realFeature, {
158
+ patterns: [
159
+ // defines a pattern of 10px-wide dashes, repeated every 20px on the line
160
+ {
161
+ offset: 30,
162
+ repeat: 100,
163
+ symbol: window.L.Symbol.arrowHead({
164
+ pixelSize: 8,
165
+ polygon: false,
166
+ pathOptions: { color: "#F95E5A", weight: 2, stroke: true }
167
+ })
168
+ }
169
+ ]
170
+ }).addTo(layer);
171
+ }
172
+ function objectDayLineTransform(points, type) {
173
+ if (!type || !type.length) {
174
+ return [];
175
+ }
176
+ const result = [];
177
+ let iscrossdaylineleft = false;
178
+ let iscrossdaylineright = false;
179
+ for (let i = 0; i < points.length; i++) {
180
+ const firstcoor = [points[i][type[1]], points[i][type[0]]];
181
+ let subFCoords = {};
182
+ if (iscrossdaylineleft) {
183
+ subFCoords = { ...points[i], [type[0]]: firstcoor[1] + 360, [type[1]]: firstcoor[0] };
184
+ } else if (iscrossdaylineright) {
185
+ subFCoords = { ...points[i], [type[0]]: firstcoor[1] - 360, [type[1]]: firstcoor[0] };
186
+ } else {
187
+ subFCoords = { ...points[i] };
188
+ }
189
+ result.push(subFCoords);
190
+ if (i < points.length - 1) {
191
+ const secondcoor = [points[i + 1][type[1]], points[i + 1][type[0]]];
192
+ const diff = Math.abs(firstcoor[1] - secondcoor[1]);
193
+ if (diff > 240) {
194
+ if (firstcoor[1] > 0) {
195
+ if (iscrossdaylineright) {
196
+ iscrossdaylineright = false;
197
+ } else iscrossdaylineleft = true;
198
+ } else {
199
+ if (iscrossdaylineleft) {
200
+ iscrossdaylineleft = false;
201
+ } else {
202
+ iscrossdaylineright = true;
203
+ }
204
+ }
205
+ }
206
+ }
207
+ }
208
+ return result;
209
+ }
210
+ function dayLineTransform(points) {
211
+ const result = [];
212
+ let iscrossdaylineleft = false;
213
+ let iscrossdaylineright = false;
214
+ for (let i = 0; i < points.length; i++) {
215
+ const firstcoor = [points[i][1], points[i][0]];
216
+ let subFCoords = [];
217
+ if (iscrossdaylineleft) {
218
+ subFCoords = [firstcoor[1] + 360, firstcoor[0]];
219
+ } else if (iscrossdaylineright) {
220
+ subFCoords = [firstcoor[1] - 360, firstcoor[0]];
221
+ } else {
222
+ subFCoords = [firstcoor[1], firstcoor[0]];
223
+ }
224
+ result.push(subFCoords);
225
+ if (i < points.length - 1) {
226
+ const secondcoor = [points[i + 1][1], points[i + 1][0]];
227
+ const diff = Math.abs(firstcoor[1] - secondcoor[1]);
228
+ if (diff > 240) {
229
+ if (firstcoor[1] > 0) {
230
+ if (iscrossdaylineright) {
231
+ iscrossdaylineright = false;
232
+ } else iscrossdaylineleft = true;
233
+ } else {
234
+ if (iscrossdaylineleft) {
235
+ iscrossdaylineleft = false;
236
+ } else {
237
+ iscrossdaylineright = true;
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
243
+ return result;
244
+ }
245
+ function convertLines(arg) {
246
+ const arr = [];
247
+ arg.map((item) => {
248
+ const _arr = [item[1], item[0]];
249
+ arr.push(_arr);
250
+ });
251
+ return arr;
252
+ }
253
+ function setPointIcon(type) {
254
+ return window.L.icon({
255
+ iconUrl: type === "ship" || type === "repair" ? "./img/" + type + ".png" : "./img/" + type + ".svg",
256
+ iconSize: [30, 30],
257
+ iconAnchor: [15, 15]
258
+ });
259
+ }
260
+
261
+ export { changMapType, convertLines, dayLineTransform, displayPredictLine, displayRealLine, init, mapType, mathLngFn, objectDayLineTransform, setPointIcon };
@@ -0,0 +1,37 @@
1
+ import type { HiFleetMapInitResponse } from './types';
2
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ mapId: {
4
+ type: StringConstructor;
5
+ required: true;
6
+ };
7
+ height: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ width: {
12
+ type: StringConstructor;
13
+ default: string;
14
+ };
15
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
16
+ init: (obj: HiFleetMapInitResponse) => any;
17
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
18
+ mapId: {
19
+ type: StringConstructor;
20
+ required: true;
21
+ };
22
+ height: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ width: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ }>> & Readonly<{
31
+ onInit?: (obj: HiFleetMapInitResponse) => any;
32
+ }>, {
33
+ height: string;
34
+ width: string;
35
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import _sfc_main from './index.vue2.mjs';
2
+ import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
3
+
4
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0b224a81"]]);
5
+
6
+ export { index as default };
@@ -0,0 +1,123 @@
1
+ import { defineComponent, ref, onMounted, resolveDirective, withDirectives, openBlock, createElementBlock, normalizeStyle, createElementVNode, Fragment, renderList, unref, toDisplayString } from 'vue';
2
+ import { loadHiFleetResources } from '@cmeslib/utils';
3
+ import { init, changMapType, mapType } from './helper.mjs';
4
+ import { useGlobalSingleFlight } from '../../../hooks/common/src/globalSingleFlight.mjs';
5
+
6
+ const _hoisted_1 = ["id"];
7
+ const _hoisted_2 = { class: "hifleet-map-container-maptype" };
8
+ const _hoisted_3 = ["onClick"];
9
+ const _hoisted_4 = { class: "map__position--wrapper" };
10
+ var _sfc_main = /* @__PURE__ */ defineComponent({
11
+ __name: "index",
12
+ props: {
13
+ mapId: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ height: {
18
+ type: String,
19
+ default: "400px"
20
+ },
21
+ width: {
22
+ type: String,
23
+ default: "100%"
24
+ }
25
+ },
26
+ emits: ["init"],
27
+ setup(__props, { emit: __emit }) {
28
+ const sf = useGlobalSingleFlight("hifleet", loadHiFleetResources, { cache: true, cloneOnHit: true });
29
+ defineComponent({
30
+ name: "HiFleetMap"
31
+ });
32
+ const props = __props;
33
+ const emit = __emit;
34
+ const mapLoading = ref(false);
35
+ const mapTypeList = [
36
+ { label: "Map", prop: "normal" },
37
+ { label: "Global Map", prop: "global" },
38
+ { label: "Satellite Map", prop: "satellite" }
39
+ ];
40
+ const toggleIcon = ref(false);
41
+ let app;
42
+ let map;
43
+ let latlngInfoObj = {
44
+ lat: "",
45
+ latDegree: "",
46
+ lng: "",
47
+ lngDegree: ""
48
+ };
49
+ onMounted(async () => {
50
+ await sf.run();
51
+ const mapObj = init(props.mapId);
52
+ app = mapObj.mapInfo.app;
53
+ map = mapObj.mapInfo.map;
54
+ latlngInfoObj = mapObj.latlngInfoObj;
55
+ toggleIcon.value = true;
56
+ emit("init", { app, map, L: window.L });
57
+ });
58
+ return (_ctx, _cache) => {
59
+ const _directive_loading = resolveDirective("loading");
60
+ return withDirectives((openBlock(), createElementBlock(
61
+ "div",
62
+ {
63
+ class: "hifleet-map-container",
64
+ style: normalizeStyle({ width: __props.width, height: __props.height })
65
+ },
66
+ [
67
+ createElementVNode("div", {
68
+ id: __props.mapId,
69
+ style: { width: "100%", height: "100%" }
70
+ }, null, 8, _hoisted_1),
71
+ createElementVNode("ul", _hoisted_2, [
72
+ (openBlock(), createElementBlock(
73
+ Fragment,
74
+ null,
75
+ renderList(mapTypeList, (item) => {
76
+ return createElementVNode("li", {
77
+ key: item.prop,
78
+ style: normalizeStyle({ color: unref(mapType) === item.prop ? "var(--el-color-primary)" : "#666" }),
79
+ class: "map__type--li",
80
+ onClick: ($event) => unref(changMapType)(item.prop, unref(map), unref(app))
81
+ }, toDisplayString(item.label), 13, _hoisted_3);
82
+ }),
83
+ 64
84
+ /* STABLE_FRAGMENT */
85
+ ))
86
+ ]),
87
+ createElementVNode("div", _hoisted_4, [
88
+ createElementVNode(
89
+ "div",
90
+ {
91
+ class: "map__position--des",
92
+ onClick: _cache[0] || (_cache[0] = ($event) => toggleIcon.value = !toggleIcon.value)
93
+ },
94
+ toDisplayString(toggleIcon.value ? "DD" : "DM"),
95
+ 1
96
+ /* TEXT */
97
+ ),
98
+ createElementVNode(
99
+ "div",
100
+ null,
101
+ "\u7EAC\u5EA6: " + toDisplayString(toggleIcon.value ? unref(latlngInfoObj).lat : unref(latlngInfoObj).latDegree),
102
+ 1
103
+ /* TEXT */
104
+ ),
105
+ createElementVNode(
106
+ "div",
107
+ null,
108
+ "\u7ECF\u5EA6: " + toDisplayString(toggleIcon.value ? unref(latlngInfoObj).lng : unref(latlngInfoObj).lngDegree),
109
+ 1
110
+ /* TEXT */
111
+ )
112
+ ])
113
+ ],
114
+ 4
115
+ /* STYLE */
116
+ )), [
117
+ [_directive_loading, mapLoading.value]
118
+ ]);
119
+ };
120
+ }
121
+ });
122
+
123
+ export { _sfc_main as default };
@@ -0,0 +1,18 @@
1
+ export declare const solidLineData: {
2
+ code: number;
3
+ message: string;
4
+ data: {
5
+ mmsi: string;
6
+ posTime: string;
7
+ lon: number;
8
+ lat: number;
9
+ cog: number;
10
+ heading: number;
11
+ sog: number;
12
+ }[];
13
+ };
14
+ export declare const dottedLineData: {
15
+ code: number;
16
+ data: string;
17
+ message: string;
18
+ };