ochre-sdk 1.3.17 → 1.3.18

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.
@@ -455,6 +455,24 @@ function parseMapComponent(parameters) {
455
455
  let maximumBounds = null;
456
456
  const maximumBoundsProperty = componentReader.value("maximum-bounds");
457
457
  if (maximumBoundsProperty !== null) maximumBounds = parseBounds(String(maximumBoundsProperty));
458
+ const layerSettings = [];
459
+ for (const layerReader of componentReader.nestedAllByValue("customize-special", "arcgis-layer")) {
460
+ const uuid = layerReader.uuid("use-layer");
461
+ if (uuid == null) continue;
462
+ const opacity = layerReader.value("opacity-percent");
463
+ const filterFields = layerReader.stringValues("filter-field");
464
+ layerSettings.push({
465
+ uuid,
466
+ isBasemap: layerReader.value("is-basemap"),
467
+ isDisplayedByDefault: layerReader.value("displayed-by-default"),
468
+ opacity: typeof opacity === "number" ? Math.min(Math.max(opacity, 0), 100) / 100 : null,
469
+ ochreLinkField: layerReader.stringValue("ochre-link-field"),
470
+ periodField: layerReader.stringValue("period-field"),
471
+ periodOrder: layerReader.stringValues("period-order"),
472
+ filterFields: filterFields.length > 0 ? filterFields : null,
473
+ markerColor: layerReader.stringValue("marker-color")
474
+ });
475
+ }
458
476
  return {
459
477
  component: "map",
460
478
  linkUuids,
@@ -462,6 +480,7 @@ function parseMapComponent(parameters) {
462
480
  customBasemap,
463
481
  initialBounds,
464
482
  maximumBounds,
483
+ layerSettings,
465
484
  ...properties
466
485
  };
467
486
  }
@@ -44,6 +44,7 @@ export declare class WebsitePresentationReader<T extends LanguageCodes> {
44
44
  * @returns The string, or null when the property is unset or not string-like
45
45
  */
46
46
  stringValue(label: string): string | null;
47
+ stringValues(label: string): Array<string>;
47
48
  uuid(label: string): string | null;
48
49
  multilingualValue(label: string, options: ParserOptions<T>): MultilingualString<T> | null;
49
50
  /**
@@ -63,6 +63,17 @@ var WebsitePresentationReader = class WebsitePresentationReader {
63
63
  if (typeof value === "string") return value;
64
64
  return typeof value === "number" ? value.toString() : null;
65
65
  }
66
+ stringValues(label) {
67
+ const values = [];
68
+ for (const property of this.sourceProperties) {
69
+ if (getProperty([property], { label }) == null) continue;
70
+ for (const { content } of property.values) {
71
+ const value = typeof content === "number" ? content.toString() : content;
72
+ if (typeof value === "string" && value.trim() !== "") values.push(value.trim());
73
+ }
74
+ }
75
+ return values;
76
+ }
66
77
  uuid(label) {
67
78
  return this.valueNode(label)?.uuid ?? null;
68
79
  }
@@ -426,6 +426,17 @@ export type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
426
426
  customBasemap: string | null;
427
427
  initialBounds: [[number, number], [number, number]] | null;
428
428
  maximumBounds: [[number, number], [number, number]] | null;
429
+ layerSettings: Array<{
430
+ uuid: string;
431
+ isBasemap: boolean | null;
432
+ isDisplayedByDefault: boolean | null;
433
+ opacity: number | null;
434
+ ochreLinkField: string | null;
435
+ periodField: string | null;
436
+ periodOrder: Array<string>;
437
+ filterFields: Array<string> | null;
438
+ markerColor: string | null;
439
+ }>;
429
440
  isControlsDisplayed: boolean;
430
441
  isInteractive: boolean;
431
442
  isClustered: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",