@abi-software/scaffoldvuer 1.8.1-beta.1 → 1.8.1-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.8.1-beta.1",
3
+ "version": "1.8.1-beta.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,6 +26,7 @@
26
26
  ref="annotationTooltip"
27
27
  :annotationDisplay="true"
28
28
  :annotationEntry="annotationEntry"
29
+ @annotation="$emit('confirm-comment', $event)"
29
30
  />
30
31
  <div v-if="createData.toBeDeleted" class="delete-container">
31
32
  <el-row>
@@ -104,6 +105,14 @@ export default {
104
105
  type: Boolean,
105
106
  default: false,
106
107
  },
108
+ annotationFeature: {
109
+ type: Object,
110
+ default: {},
111
+ },
112
+ offlineAnnotationEnabled: {
113
+ type: Boolean,
114
+ default: false,
115
+ },
107
116
  region: {
108
117
  type: String,
109
118
  default: "",
@@ -155,6 +164,8 @@ export default {
155
164
  "featureId": region + this.label,
156
165
  "resourceId": this.scaffoldUrl,
157
166
  "resource": this.scaffoldUrl,
167
+ "feature": this.annotationFeature,
168
+ "offline": this.offlineAnnotationEnabled,
158
169
  };
159
170
  }
160
171
  }
@@ -15,8 +15,11 @@
15
15
  :x="tData.x"
16
16
  :y="tData.y"
17
17
  :annotationDisplay="annotationDisplay"
18
+ :annotationFeature="annotationFeature"
19
+ :offlineAnnotationEnabled="offlineAnnotationEnabled"
18
20
  @confirm-create="confirmCreate($event)"
19
21
  @cancel-create="cancelCreate()"
22
+ @confirm-comment="confirmComment($event)"
20
23
  @confirm-delete="confirmDelete()"
21
24
  @tooltip-hide="onTooltipHide()"
22
25
  />
@@ -399,9 +402,10 @@ import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
399
402
  import { DrawToolbar } from '@abi-software/map-utilities'
400
403
  import '@abi-software/map-utilities/dist/style.css'
401
404
  import {
405
+ createNewAnnotationsWithFeatures,
402
406
  addUserAnnotationWithFeature,
403
407
  annotationFeaturesToPrimitives,
404
- getDeletableObjects,
408
+ getEditableObjects,
405
409
  getDrawnAnnotations,
406
410
  getEditableLines,
407
411
  getObjectsFromAnnotations,
@@ -805,6 +809,7 @@ export default {
805
809
  },
806
810
  openMapRef: undefined,
807
811
  backgroundIconRef: undefined,
812
+ annotationFeature: {},
808
813
  offlineAnnotationEnabled: false,
809
814
  offlineAnnotations: markRaw([]),
810
815
  authorisedUser: undefined,
@@ -1020,15 +1025,11 @@ export default {
1020
1025
  zincObjectRemoved: function (zincObject) {
1021
1026
  if (this.$module.scene) {
1022
1027
  // zincObjectAdded will be alled in sequential callback
1023
- const regionPath = zincObject.region.getFullPath();
1024
1028
  const groupName = zincObject.groupName;
1025
1029
  const objects = zincObject.region.findObjectsWithGroupName(groupName, false);
1026
1030
  //Remove relevant objects from the rest of the app.
1027
1031
  if (objects.length === 0) {
1028
1032
  this.$_searchIndex.removeZincObject(zincObject, zincObject.uuid);
1029
- if (this.offlineAnnotationEnabled) {
1030
- this.removeFromOfflineAnnotation(regionPath, groupName);
1031
- }
1032
1033
  }
1033
1034
  }
1034
1035
  },
@@ -1119,8 +1120,6 @@ export default {
1119
1120
  }
1120
1121
  annotation.region = regionPath;
1121
1122
  this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1122
- //Remove previous entry if there is matching region and group
1123
- this.removeFromOfflineAnnotation(regionPath, group);
1124
1123
  this.offlineAnnotations.push(annotation);
1125
1124
  sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1126
1125
  }
@@ -1205,6 +1204,25 @@ export default {
1205
1204
  this.$emit("annotation-close");
1206
1205
  }
1207
1206
  },
1207
+ /**
1208
+ * Internal only.
1209
+ * Confirm delete of user created primitive.
1210
+ * This is only called from callback.
1211
+ */
1212
+ confirmComment: function (payload) {
1213
+ if (this._editingZincObject?.isEditable) {
1214
+ let annotation = payload
1215
+ this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1216
+ this.existDrawnFeatures.push(payload.feature);
1217
+ if (this.offlineAnnotationEnabled) {
1218
+ annotation.group = this._editingZincObject.groupName;;
1219
+ annotation.region = this._editingZincObject.region.getFullPath();
1220
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1221
+ this.offlineAnnotations.push(annotation);
1222
+ sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1223
+ }
1224
+ }
1225
+ },
1208
1226
  /**
1209
1227
  * Internal only.
1210
1228
  * Confirm delete of user created primitive.
@@ -1221,6 +1239,8 @@ export default {
1221
1239
  const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1222
1240
  childRegion.removeZincObject(this._editingZincObject);
1223
1241
  if (this.offlineAnnotationEnabled) {
1242
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1243
+ this.offlineAnnotations = this.offlineAnnotations.filter(offline => offline.item.id !== annotation.item.id);
1224
1244
  sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1225
1245
  }
1226
1246
  }
@@ -1493,6 +1513,14 @@ export default {
1493
1513
  }
1494
1514
  }
1495
1515
  } else {
1516
+ const zincObject = getEditableObjects(event);
1517
+ this._editingZincObject = zincObject;
1518
+ if (zincObject) {
1519
+ const regionPath = this._editingZincObject.region.getFullPath() + "/";
1520
+ const group = this._editingZincObject.groupName;
1521
+ this.annotationFeature = createNewAnnotationsWithFeatures(this._editingZincObject,
1522
+ regionPath, group, this.url, '').feature;
1523
+ }
1496
1524
  //Make sure the tooltip is displayed with annotaion mode
1497
1525
  if (this.activeDrawMode === "Edit") {
1498
1526
  const editing = getEditableLines(event);
@@ -1501,10 +1529,8 @@ export default {
1501
1529
  editing.vertexIndex, editing.point);
1502
1530
  }
1503
1531
  } else if (this.activeDrawMode === "Delete") {
1504
- const zincObject = getDeletableObjects(event);
1505
1532
  if (zincObject) {
1506
1533
  this.createData.toBeDeleted = true;
1507
- this._editingZincObject = zincObject;
1508
1534
  }
1509
1535
  }
1510
1536
  if (this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString") {
@@ -1955,6 +1981,8 @@ export default {
1955
1981
  "featureId": region + this.tData.label,
1956
1982
  "resourceId": this.url,
1957
1983
  "resource": this.url,
1984
+ "feature": this.annotationFeature,
1985
+ "offline": this.offlineAnnotationEnabled,
1958
1986
  };
1959
1987
  this.$emit('annotation-open', {
1960
1988
  annotationEntry: annotationEntry,
@@ -1962,6 +1990,7 @@ export default {
1962
1990
  confirmCreate: this.confirmCreate,
1963
1991
  cancelCreate: this.cancelCreate,
1964
1992
  confirmDelete: this.confirmDelete,
1993
+ confirmComment: this.confirmComment
1965
1994
  });
1966
1995
  return;
1967
1996
  }
@@ -7,7 +7,6 @@ export {}
7
7
 
8
8
  declare module 'vue' {
9
9
  export interface GlobalComponents {
10
- ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
11
10
  ElButton: typeof import('element-plus/es')['ElButton']
12
11
  ElCol: typeof import('element-plus/es')['ElCol']
13
12
  ElCollapse: typeof import('element-plus/es')['ElCollapse']
@@ -20,7 +19,6 @@ declare module 'vue' {
20
19
  ElIconDelete: typeof import('@element-plus/icons-vue')['Delete']
21
20
  ElIconPlus: typeof import('@element-plus/icons-vue')['Plus']
22
21
  ElIconWarningFilled: typeof import('@element-plus/icons-vue')['WarningFilled']
23
- ElInput: typeof import('element-plus/es')['ElInput']
24
22
  ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
25
23
  ElMain: typeof import('element-plus/es')['ElMain']
26
24
  ElOption: typeof import('element-plus/es')['ElOption']
@@ -28,9 +26,6 @@ declare module 'vue' {
28
26
  ElRow: typeof import('element-plus/es')['ElRow']
29
27
  ElSelect: typeof import('element-plus/es')['ElSelect']
30
28
  ElSlider: typeof import('element-plus/es')['ElSlider']
31
- ElSwitch: typeof import('element-plus/es')['ElSwitch']
32
- ElTable: typeof import('element-plus/es')['ElTable']
33
- ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
34
29
  ElTabPane: typeof import('element-plus/es')['ElTabPane']
35
30
  ElTabs: typeof import('element-plus/es')['ElTabs']
36
31
  LinesControls: typeof import('./components/LinesControls.vue')['default']
@@ -47,7 +47,7 @@ export const getEditableLines = (event) => {
47
47
  return undefined;
48
48
  }
49
49
 
50
- export const getDeletableObjects = (event) => {
50
+ export const getEditableObjects = (event) => {
51
51
  const zincObjects = event.zincObjects;
52
52
  if (zincObjects.length > 0 && zincObjects[0]) {
53
53
  const zincObject = zincObjects[0];
@@ -289,7 +289,7 @@ const getCoordinatesForAnnotationFeature = (zincObject) => {
289
289
  return coords;
290
290
  }
291
291
 
292
- const createNewAnnotationsWithFeatures = (zincObject, region, group, scaffoldUrl, comment) => {
292
+ export const createNewAnnotationsWithFeatures = (zincObject, region, group, scaffoldUrl, comment) => {
293
293
  let type = undefined;
294
294
  if (zincObject.isPointset) {
295
295
  type = "MultiPoint";