@abi-software/map-side-bar 2.3.2-beta.3 → 2.3.2-beta.5

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.3.2-beta.3",
3
+ "version": "2.3.2-beta.5",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@abi-software/gallery": "^1.1.1",
42
- "@abi-software/map-utilities": "^1.0.1-beta.2",
42
+ "@abi-software/map-utilities": "^1.0.1-beta.3",
43
43
  "@abi-software/svg-sprite": "^1.0.0",
44
44
  "@element-plus/icons-vue": "^2.3.1",
45
45
  "algoliasearch": "^4.10.5",
@@ -396,38 +396,54 @@ export default {
396
396
  contentArray.push(`<div>${this.entry.paths}</div>`);
397
397
  }
398
398
 
399
+ function transformData(title, items, itemsWithDatasets = []) {
400
+ let contentString = `<div><strong>${title}</strong></div>`;
401
+ const transformedItems = [];
402
+ items.forEach((item) => {
403
+ let itemNames = [];
404
+ item.split(',').forEach((name) => {
405
+ const match = itemsWithDatasets.find((a) => a.name === name.trim());
406
+ if (match) {
407
+ itemNames.push(`${capitalise(name)} (${match.id})`);
408
+ } else {
409
+ itemNames.push(`${capitalise(name)}`);
410
+ }
411
+ });
412
+ transformedItems.push(itemNames.join(','));
413
+ });
414
+ const contentList = transformedItems
415
+ .map((item) => `<li>${item}</li>`)
416
+ .join('\n');
417
+ contentString += '\n';
418
+ contentString += `<ul>${contentList}</ul>`;
419
+ return contentString;
420
+ }
421
+
399
422
  // Origins
400
423
  if (this.entry.origins?.length) {
401
- let originsContent = '<div><strong>Origin</strong></div>';
402
- const origins = this.entry.origins
403
- .map((item) => `<li>${capitalise(item)}</li>`)
404
- .join('\n');
405
- originsContent += '\n';
406
- originsContent += `<ul>${origins}</ul>`;
407
- contentArray.push(originsContent);
424
+ const title = 'Origin';
425
+ const origins = this.entry.origins;
426
+ const originsWithDatasets = this.entry.originsWithDatasets;
427
+ const transformedOrigins = transformData(title, origins, originsWithDatasets);
428
+ contentArray.push(transformedOrigins);
408
429
  }
409
430
 
410
431
  // Components
411
432
  if (this.entry.components?.length) {
412
- contentArray.push();
413
- let componentsContent = '<div><strong>Components</strong></div>';
414
- const components = this.entry.components
415
- .map((item) => `<li>${capitalise(item)}</li>`)
416
- .join('\n');
417
- componentsContent += '\n';
418
- componentsContent += `<ul>${components}</ul>`;
419
- contentArray.push(componentsContent);
433
+ const title = 'Components';
434
+ const components = this.entry.components;
435
+ const componentsWithDatasets = this.entry.componentsWithDatasets;
436
+ const transformedComponents = transformData(title, components, componentsWithDatasets);
437
+ contentArray.push(transformedComponents);
420
438
  }
421
439
 
422
440
  // Destination
423
441
  if (this.entry.destinations?.length) {
424
- let destinationsContent = '<div><strong>Destination</strong></div>';
425
- const destinations = this.entry.destinations
426
- .map((item) => `<li>${capitalise(item)}</li>`)
427
- .join('\n');
428
- destinationsContent += '\n';
429
- destinationsContent += `<ul>${destinations}</ul>`;
430
- contentArray.push(destinationsContent);
442
+ const title = 'Destination';
443
+ const destinations = this.entry.destinations;
444
+ const destinationsWithDatasets = this.entry.destinationsWithDatasets;
445
+ const transformedDestinations = transformData(title, destinations, destinationsWithDatasets);
446
+ contentArray.push(transformedDestinations);
431
447
  }
432
448
 
433
449
  return contentArray.join('\n\n<br>');