@abi-software/map-side-bar 2.14.1 → 2.14.2-demo.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.14.1",
3
+ "version": "2.14.2-demo.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,21 +12,6 @@
12
12
  @click="toggleTitleExpansion"
13
13
  >
14
14
  <span>{{ capitalise(displayTitle) }}</span>
15
- <template v-if="entry.featuresAlert">
16
- <el-popover
17
- width="250"
18
- trigger="hover"
19
- :teleported="false"
20
- popper-class="popover-origin-help"
21
- >
22
- <template #reference>
23
- <el-icon class="alert"><el-icon-warn-triangle-filled /></el-icon>
24
- </template>
25
- <span style="word-break: keep-all">
26
- {{ entry.featuresAlert }}
27
- </span>
28
- </el-popover>
29
- </template>
30
15
  </div>
31
16
  <button
32
17
  v-if="showTitleToggle"
@@ -41,7 +26,19 @@
41
26
  </el-icon>
42
27
  </button>
43
28
  </div>
44
- <div class="subtitle"><strong>Id: </strong>{{ entry.featureId[0] }}</div>
29
+ <div class="subtitle">
30
+ <strong>Id: </strong>{{ entry.featureId[0] }}
31
+ <el-button
32
+ round
33
+ size="small"
34
+ class="alert-chip"
35
+ @click="showAlertMessage"
36
+ v-if="entry.featuresAlert"
37
+ >
38
+ <el-icon class="alert"><el-icon-warn-triangle-filled /></el-icon>
39
+ Notes
40
+ </el-button>
41
+ </div>
45
42
  <div v-if="hasProvenanceTaxonomyLabel" class="subtitle">
46
43
  {{ provSpeciesDescription }}
47
44
  </div>
@@ -290,6 +287,22 @@
290
287
  @trackEvent="onTrackEvent"
291
288
  />
292
289
  </div>
290
+
291
+ <div
292
+ ref="alertElement"
293
+ class="content-container content-container-alert"
294
+ v-if="entry.featuresAlert"
295
+ >
296
+ <div class="block attribute-title-container">
297
+ <span class="attribute-title">Alert</span>
298
+ </div>
299
+ <div class="block">
300
+ <div class="alert-block"
301
+ v-for="alert in entry.featuresAlert"
302
+ v-html="formatAlertText(alert)"
303
+ ></div>
304
+ </div>
305
+ </div>
293
306
  </div>
294
307
  </template>
295
308
 
@@ -784,6 +797,14 @@ export default {
784
797
  contentArray.push(contentString);
785
798
  }
786
799
 
800
+ // Alert
801
+ if (this.entry.featuresAlert) {
802
+ const alertContent = this.entry.featuresAlert
803
+ .map((alert) => this.formatAlertText(alert))
804
+ .join('\n');
805
+ contentArray.push(`<div><strong>Alert</strong></div>\n${alertContent}`);
806
+ }
807
+
787
808
  return contentArray.join('\n\n<br>');
788
809
  },
789
810
  getConnectivityDatasets: function (label) {
@@ -910,6 +931,51 @@ export default {
910
931
  onTrackEvent: function (data) {
911
932
  EventBus.emit('trackEvent', data);
912
933
  },
934
+ showAlertMessage: function () {
935
+ // scroll to alert message
936
+ this.$nextTick(() => {
937
+ const alertElement = this.$refs.alertElement;
938
+ if (alertElement) {
939
+ alertElement.scrollIntoView({
940
+ behavior: 'smooth',
941
+ block: 'start',
942
+ inline: 'nearest',
943
+ });
944
+ }
945
+ });
946
+ },
947
+ formatAlertText: function (text) {
948
+ if (!text) return '';
949
+ const escaped = text
950
+ .replace(/&/g, '&amp;')
951
+ .replace(/</g, '&lt;')
952
+ .replace(/>/g, '&gt;');
953
+ const linkified = escaped.replace(
954
+ /(https?:\/\/[^\s"<>\[]+)/g,
955
+ (url) => {
956
+ const parts = url.match(/^(.*?)([\].,;:!?]*)$/);
957
+ const cleanUrl = parts ? parts[1] : url;
958
+ const suffix = parts ? parts[2] : '';
959
+ return `<a href="${cleanUrl}" target="_blank" rel="noopener noreferrer">${cleanUrl}</a>${suffix}`;
960
+ }
961
+ );
962
+
963
+ const normalised = linkified
964
+ .replace(/\\n/g, '\n')
965
+ .replace(/\r\n/g, '\n')
966
+ .replace(/\r/g, '\n');
967
+
968
+ return normalised
969
+ .split('\n')
970
+ .map((line) => {
971
+ const withBoldLabel = line.replace(
972
+ /^\s*([A-Za-z][^:<]{0,120}:)/,
973
+ '<strong>$1</strong>'
974
+ );
975
+ return `<div class="alert-line">${withBoldLabel}</div>`;
976
+ })
977
+ .join('\n');
978
+ },
913
979
  },
914
980
  mounted: function () {
915
981
  this.updatedCopyContent = this.getUpdateCopyContent();
@@ -1088,15 +1154,6 @@ export default {
1088
1154
  text-transform: uppercase;
1089
1155
  }
1090
1156
 
1091
- .main {
1092
- .el-button.is-round {
1093
- border-radius: 4px;
1094
- padding: 9px 20px 10px 20px;
1095
- display: flex;
1096
- height: 36px;
1097
- }
1098
- }
1099
-
1100
1157
  .button {
1101
1158
  margin-left: 0px !important;
1102
1159
  margin-top: 0px !important;
@@ -1419,10 +1476,6 @@ export default {
1419
1476
 
1420
1477
  .content-container-connectivity {
1421
1478
  position: relative;
1422
-
1423
- &:not([style*="display: none"]) ~ .content-container-references {
1424
- margin-top: -1.25rem;
1425
- }
1426
1479
  }
1427
1480
 
1428
1481
  .attribute-content {
@@ -1466,4 +1519,48 @@ export default {
1466
1519
  margin-bottom: 0.5em;
1467
1520
  }
1468
1521
  }
1522
+
1523
+ .alert-block {
1524
+ background-color: var(--el-color-warning-light-9);
1525
+ border: 1px dashed var(--el-color-warning);
1526
+ padding: 0.75rem;
1527
+ border-radius: 4px;
1528
+
1529
+ :deep(.alert-line + .alert-line) {
1530
+ margin-top: 0.5rem;
1531
+ }
1532
+
1533
+ :deep(a) {
1534
+ color: $app-primary-color;
1535
+ word-break: break-all;
1536
+
1537
+ &:hover {
1538
+ opacity: 0.8;
1539
+ }
1540
+ }
1541
+ }
1542
+
1543
+ .alert-chip {
1544
+ margin-left: 5px;
1545
+ background-color: $app-primary-color;
1546
+ border-color: $app-primary-color;
1547
+ color: #fff;
1548
+
1549
+ &:hover {
1550
+ color: #fff !important;
1551
+ background-color: #ac76c5 !important;
1552
+ border: 1px solid #ac76c5 !important;
1553
+ }
1554
+
1555
+ :deep(> span) {
1556
+ gap: 2px;
1557
+ }
1558
+
1559
+ .alert {
1560
+ width: 1rem;
1561
+ height: 1rem;
1562
+ color: inherit;
1563
+ margin: 0;
1564
+ }
1565
+ }
1469
1566
  </style>