@vertexvis/viewer 0.20.0-testing.2 → 0.20.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/dist/cjs/controller-7a563053.js.map +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +6 -2
- package/dist/cjs/vertex-scene-tree.cjs.entry.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/controller.js.map +1 -1
- package/dist/collection/components/scene-tree/scene-tree.js +10 -5
- package/dist/collection/components/scene-tree/scene-tree.js.map +1 -1
- package/dist/components/controller.js.map +1 -1
- package/dist/components/vertex-scene-tree.js +6 -2
- package/dist/components/vertex-scene-tree.js.map +1 -1
- package/dist/esm/controller-3e0c973f.js.map +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +6 -2
- package/dist/esm/vertex-scene-tree.entry.js.map +1 -1
- package/dist/types/components/scene-tree/lib/controller.d.ts +2 -2
- package/dist/types/components/scene-tree/scene-tree.d.ts +1 -1
- package/dist/types/components.d.ts +1 -1
- package/dist/viewer/p-3556e68d.entry.js +5 -0
- package/dist/viewer/p-3556e68d.entry.js.map +1 -0
- package/dist/viewer/p-b39b374f.js.map +1 -1
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/readme.md +4 -4
- package/dist/viewer/p-0523168d.entry.js +0 -5
- package/dist/viewer/p-0523168d.entry.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{d as e,N as t,w as r,p as a,b as o}from"./p-e4ea1075.js";import{g as i}from"./p-446bdb50.js";import"./p-88c19f38.js";const n=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const i="";const n={};if(i!==""){n.resourcesUrl=new URL(".",i).href}else{n.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,r.location.href)).href;{l(n.resourcesUrl,o)}if(!r.customElements){return __sc_import_viewer("./p-093f9bdb.js").then((()=>n))}}return a(n)};const l=(a,o)=>{const i=n(t);try{r[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const n=new Map;r[i]=t=>{const s=new URL(t,a).href;let l=n.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=o.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${i}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(r[i].m);t.remove()}}));n.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{i();return o(JSON.parse('[["p-99de8cd6",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-0523168d",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-0669d984",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-3b53a9e5",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-710d16c2",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"stateMap":[32],"reset":[64]}]]],["p-2a0a824e",[[1,"vertex-viewer-view-cube",{"xPositiveLabel":[1,"x-positive-label"],"xNegativeLabel":[1,"x-negative-label"],"yPositiveLabel":[1,"y-positive-label"],"yNegativeLabel":[1,"y-negative-label"],"zPositiveLabel":[1,"z-positive-label"],"zNegativeLabel":[1,"z-negative-label"],"standardViewsOff":[4,"standard-views-off"],"animationDuration":[2,"animation-duration"],"triadOff":[4,"triad-off"],"worldOrientation":[1040],"camera":[1040],"viewer":[16],"boxLength":[32],"triadPosition":[32]}]]],["p-c0c6db45",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-298aa35a",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-c6e12cf7",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-f1bf192d",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-1e66b389",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"visibilityToggle":[4,"visibility-toggle"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"hoverController":[16]}]]],["p-9725f5fc",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-097909a8",[[1,"vertex-scene-tree-table-header"]]],["p-97aed77f",[[1,"vertex-scene-tree-table-resize-divider",{"dragging":[32]}]]],["p-2e194668",[[1,"vertex-scene-tree-toolbar-group"]]],["p-85f5c018",[[1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1025,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"cameraType":[1537,"camera-type"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"phantom":[16],"noDefaultLights":[4,"no-default-lights"],"experimentalRenderingOptions":[1,"experimental-rendering-options"],"featureLines":[16],"selectionHighlighting":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[64],"registerTapKeyInteraction":[64],"getInteractionTarget_DEPRECATED":[64],"addCursor":[64],"getInteractionHandlers":[64],"getKeyInteractions":[64],"getBaseInteractionHandler":[64],"getJwt":[64],"load":[64],"unload":[64],"scene":[64],"isSceneReady":[64]},[[0,"tap","handleTapEvent"]]]]],["p-293d308a",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-567d24fa",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-a6da475b",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"hovered":[1040]}]]],["p-a700d0b7",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]],["p-a7e1ccf7",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"invalidateStateCounter":[32]}]]],["p-a4979444",[[1,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-5e57d7bb",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-685355a4",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-71b46981",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64],"clear":[64]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-1efa143f",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-c489590d",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-bd4739c4",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-024f0f95",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-0c71a2c0",[[1,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-6e8a6f8e",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]]]'),e)}));
|
|
4
|
+
import{d as e,N as t,w as r,p as a,b as o}from"./p-e4ea1075.js";import{g as i}from"./p-446bdb50.js";import"./p-88c19f38.js";const n=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const i="";const n={};if(i!==""){n.resourcesUrl=new URL(".",i).href}else{n.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,r.location.href)).href;{l(n.resourcesUrl,o)}if(!r.customElements){return __sc_import_viewer("./p-093f9bdb.js").then((()=>n))}}return a(n)};const l=(a,o)=>{const i=n(t);try{r[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const n=new Map;r[i]=t=>{const s=new URL(t,a).href;let l=n.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=o.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${i}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(r[i].m);t.remove()}}));n.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{i();return o(JSON.parse('[["p-99de8cd6",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-3556e68d",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-0669d984",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-3b53a9e5",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-710d16c2",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"stateMap":[32],"reset":[64]}]]],["p-2a0a824e",[[1,"vertex-viewer-view-cube",{"xPositiveLabel":[1,"x-positive-label"],"xNegativeLabel":[1,"x-negative-label"],"yPositiveLabel":[1,"y-positive-label"],"yNegativeLabel":[1,"y-negative-label"],"zPositiveLabel":[1,"z-positive-label"],"zNegativeLabel":[1,"z-negative-label"],"standardViewsOff":[4,"standard-views-off"],"animationDuration":[2,"animation-duration"],"triadOff":[4,"triad-off"],"worldOrientation":[1040],"camera":[1040],"viewer":[16],"boxLength":[32],"triadPosition":[32]}]]],["p-c0c6db45",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-298aa35a",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-c6e12cf7",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-f1bf192d",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-1e66b389",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"visibilityToggle":[4,"visibility-toggle"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"hoverController":[16]}]]],["p-9725f5fc",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-097909a8",[[1,"vertex-scene-tree-table-header"]]],["p-97aed77f",[[1,"vertex-scene-tree-table-resize-divider",{"dragging":[32]}]]],["p-2e194668",[[1,"vertex-scene-tree-toolbar-group"]]],["p-85f5c018",[[1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1025,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"cameraType":[1537,"camera-type"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"phantom":[16],"noDefaultLights":[4,"no-default-lights"],"experimentalRenderingOptions":[1,"experimental-rendering-options"],"featureLines":[16],"selectionHighlighting":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[64],"registerTapKeyInteraction":[64],"getInteractionTarget_DEPRECATED":[64],"addCursor":[64],"getInteractionHandlers":[64],"getKeyInteractions":[64],"getBaseInteractionHandler":[64],"getJwt":[64],"load":[64],"unload":[64],"scene":[64],"isSceneReady":[64]},[[0,"tap","handleTapEvent"]]]]],["p-293d308a",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-567d24fa",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-a6da475b",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"hovered":[1040]}]]],["p-a700d0b7",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]],["p-a7e1ccf7",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"invalidateStateCounter":[32]}]]],["p-a4979444",[[1,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-5e57d7bb",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-685355a4",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-71b46981",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64],"clear":[64]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-1efa143f",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-c489590d",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-bd4739c4",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-024f0f95",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-0c71a2c0",[[1,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-6e8a6f8e",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]]]'),e)}));
|
|
5
5
|
//# sourceMappingURL=viewer.esm.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertexvis/viewer",
|
|
3
|
-
"version": "0.20.0
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "The Vertex SDK for viewing models.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vertex Developers <support@vertexvis.com> (https://developer.vertexvis.com)",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"@stencil/core": "^2.16.1",
|
|
51
51
|
"@types/classnames": "^2.3.1",
|
|
52
52
|
"@vertexvis/frame-streaming-protos": "^0.13.0",
|
|
53
|
-
"@vertexvis/geometry": "0.20.0
|
|
54
|
-
"@vertexvis/html-templates": "0.20.0
|
|
53
|
+
"@vertexvis/geometry": "0.20.0",
|
|
54
|
+
"@vertexvis/html-templates": "0.20.0",
|
|
55
55
|
"@vertexvis/scene-tree-protos": "^0.1.18",
|
|
56
56
|
"@vertexvis/scene-view-protos": "^0.2.1",
|
|
57
|
-
"@vertexvis/stream-api": "0.20.0
|
|
58
|
-
"@vertexvis/utils": "0.20.0
|
|
57
|
+
"@vertexvis/stream-api": "0.20.0",
|
|
58
|
+
"@vertexvis/utils": "0.20.0",
|
|
59
59
|
"@vertexvis/web-workers": "^0.1.0",
|
|
60
60
|
"camel-case": "^4.1.2",
|
|
61
61
|
"classnames": "^2.3.1",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@vertexvis/eslint-config-vertexvis-typescript": "^0.5.0",
|
|
83
83
|
"@vertexvis/rollup-plugin-web-workers": "^0.1.0",
|
|
84
84
|
"@vertexvis/typescript-config-vertexvis": "1.1.0",
|
|
85
|
-
"@vertexwebsdk/build": "0.20.0
|
|
85
|
+
"@vertexwebsdk/build": "0.20.0",
|
|
86
86
|
"abortcontroller-polyfill": "^1.7.3",
|
|
87
87
|
"chance": "^1.1.8",
|
|
88
88
|
"eslint": "^8.17.0",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"typedoc": "^0.22.17",
|
|
98
98
|
"typescript": "^4.5.4"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "ae91d518383d7df03db8076bead6da7adf40aedf"
|
|
101
101
|
}
|
package/readme.md
CHANGED
|
@@ -27,11 +27,11 @@ file that references our published JS bundles from a CDN.
|
|
|
27
27
|
<head>
|
|
28
28
|
<link
|
|
29
29
|
rel="stylesheet"
|
|
30
|
-
href="https://unpkg.com/@vertexvis/viewer@0.
|
|
30
|
+
href="https://unpkg.com/@vertexvis/viewer@0.20.0/dist/viewer/viewer.css"
|
|
31
31
|
/>
|
|
32
32
|
<script
|
|
33
33
|
type="module"
|
|
34
|
-
src="https://unpkg.com/@vertexvis/viewer@0.
|
|
34
|
+
src="https://unpkg.com/@vertexvis/viewer@0.20.0/dist/viewer/viewer.esm.js"
|
|
35
35
|
></script>
|
|
36
36
|
</head>
|
|
37
37
|
|
|
@@ -53,7 +53,7 @@ These utilities can be imported from a CDN as shown below:
|
|
|
53
53
|
</head>
|
|
54
54
|
<body>
|
|
55
55
|
<script type="module">
|
|
56
|
-
import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.
|
|
56
|
+
import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.20.0/dist/esm/index.mjs';
|
|
57
57
|
|
|
58
58
|
function main() {
|
|
59
59
|
const color = ColorMaterial.fromHex('#ff0000');
|
|
@@ -90,7 +90,7 @@ dependency to your `package.json`:
|
|
|
90
90
|
```json
|
|
91
91
|
{
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@vertexvis/viewer": "^0.
|
|
93
|
+
"@vertexvis/viewer": "^0.20.0"
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
```
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import{h as e,F as t,r as i,c as s,f as n,H as o,g as r}from"./p-e4ea1075.js";import{o as a}from"./p-a3a3abe7.js";import{a as l,w as d,S as c,b as h,c as u}from"./p-b39b374f.js";import{p}from"./p-737f680b.js";import{g as f}from"./p-2213b297.js";import{i as v}from"./p-67acaae6.js";import"./p-c93bea57.js";import"./p-88c19f38.js";import"./p-96daf338.js";import"./p-86a55f3b.js";import"./p-9c3e35fd.js";import"./p-db5aed84.js";import"./p-f37b0dd7.js";import"./p-10bf891d.js";import"./p-d312d59a.js";window.requestIdleCallback=window.requestIdleCallback||function(e){var t=Date.now();return setTimeout((function(){e({didTimeout:false,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})}),1)};window.cancelIdleCallback=window.cancelIdleCallback||function(e){clearTimeout(e)};function w(e){return e!=null&&e.nodeName==="VERTEX-SCENE-TREE-TABLE-CELL"}const m=({details:i},s)=>e("div",{class:"error"},e("div",{class:"error-section error-message"},e("span",null,i.message),i.link&&e(t,null,e("span",null," See our "),e("a",{href:i.link,target:"_blank"},"documentation")," ",e("span",null," for more information."))),e("div",{class:"error-section"},s));async function y(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.items((e=>e.where((e=>e.withItemId(t))).show())).execute({suppliedCorrelationId:i})}async function b(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.items((e=>e.where((e=>e.withItemId(t))).hide())).execute({suppliedCorrelationId:i})}async function g(e,t,{append:i=false,suppliedCorrelationId:s}){const n=await e.scene();return n.items((e=>[...i?[]:[e.where((e=>e.all())).deselect()],e.where((e=>e.withItemId(t))).select()])).execute({suppliedCorrelationId:s})}async function x(e,t,i,{append:s=true,suppliedCorrelationId:n}){const o=await e.scene();return o.items((e=>[...s?[]:[e.where((e=>e.all())).deselect()],e.where((e=>e.withSceneTreeRange({start:t,end:i}))).select()])).execute({suppliedCorrelationId:n})}async function C(e,t,i,s,{append:n=false,suppliedCorrelationId:o}){const r=await e.scene();return r.items((e=>[...n?[]:[e.where((e=>e.all())).deselect()],e.where((e=>e.withMetadata(t,i,s))).select()])).execute({suppliedCorrelationId:o})}async function E(e,t,{suppliedCorrelationId:i}={}){const s=await e.scene();return s.items((e=>e.where((e=>e.withItemId(t))).deselect())).execute({suppliedCorrelationId:i})}const I="button{border:none;background:transparent;cursor:pointer;margin:0;padding:0}.button{padding:0.5rem;border-radius:0.25rem}.button-secondary{color:var(--neutral-800);background-color:var(--neutral-300)}.button-secondary:hover{color:var(--neutral-900)}.button-secondary:hover:enabled{box-shadow:0 2px 2px rgb(0 0 0 / 20%)}.button-secondary:disabled{opacity:0.8}.button-secondary:hover:disabled{cursor:not-allowed}:host{--scene-tree-toolbar-separator:1px solid var(--neutral-300);width:300px;height:100%;user-select:none;-webkit-user-select:none;cursor:default;display:flex;flex-direction:column}.rows-scroll{position:relative;height:var(--scene-tree-row-height, 0);flex-grow:1}.rows{position:relative}.row{position:absolute;display:flex;align-items:center;width:100%;height:var(--scene-tree-row-height);padding:var(--scene-tree-row-padding);box-sizing:border-box}.row:hover{background-color:var(--scene-tree-row-hover-color)}.row.is-selected{background-color:var(--scene-tree-row-selected-color)}.expand-toggle{cursor:pointer;width:16px}.row-text{margin-left:0.25rem;width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.visibility-btn{display:flex;align-items:center;visibility:hidden;padding:4px}.visibility-btn.is-hidden{visibility:visible}.row:hover .visibility-btn{visibility:visible}.error,.empty-results{position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;font-size:0.875rem;width:100%;height:100%;padding:1rem;box-sizing:border-box;justify-content:center;background-color:white}.error-section{margin-top:1rem}.error-message{text-align:center}.search-toolbar,slot[name='header']::slotted(*){border-bottom:var(--scene-tree-toolbar-separator)}slot[name='footer']::slotted(:not(:last-child)){border-top:var(--scene-tree-toolbar-separator)}.header{display:flex;flex-direction:column}.footer{display:flex;flex-direction:column}.loading{position:absolute;top:150px;left:50%;transform:translate(-50%, -50%);text-align:center}";const R=25;const j=class{constructor(e){i(this,e);this.connectionError=s(this,"connectionError",7);this.firstRowRendered=s(this,"firstRowRendered",7);this.overScanCount=25;this.configEnv="platprod";this.metadataSearchExactMatch=false;this.metadataKeys=[];this.rows=[];this.totalRows=0;this.showLoader=false;this.showEmptyResults=false;this.stateMap={componentLoaded:false};this.attemptingRetry=false;this.firstCellRendered=false}async invalidateRows(){n(this.getLayoutElement())}async scrollToIndex(e,t={}){const{animate:i,position:s="middle"}=t;const n=Math.max(0,Math.min(e,this.totalRows));const o=this.getScrollToPosition(n,s);this.getLayoutElement().scrollToPosition(o,{behavior:i?"smooth":undefined})}async scrollToItem(e,t={}){var i;const s=this.totalRows;const n=await((i=this.controller)===null||i===void 0?void 0:i.expandParentNodes(e));if(n!=null&&s!==this.totalRows){return new Promise((e=>{const i=this.getLayoutElement();const s=async()=>{i.removeEventListener("layoutRendered",s);await this.scrollToIndex(n,t);e()};i.addEventListener("layoutRendered",s)}))}else if(n!=null){await this.scrollToIndex(n,t)}}async expandAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.expandAll())}async collapseAll(){var e;await((e=this.controller)===null||e===void 0?void 0:e.collapseAll())}async expandItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(!t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.expandNode(e))}}))}async collapseItem(e){await this.performRowOperation(e,(async({id:e,node:t})=>{var i;if(t.expanded){await((i=this.controller)===null||i===void 0?void 0:i.collapseNode(e))}}))}async toggleExpandItem(e){await this.performRowOperation(e,(async({node:e})=>{if(e.expanded){await this.collapseItem(e)}else{await this.expandItem(e)}}))}async toggleItemVisibility(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible||i.partiallyVisible){await b(e,t)}else{await y(e,t)}}))}async hideItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.visible){await b(e,t)}}))}async showItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(!i.visible){await y(e,t)}}))}async selectItem(e,t={}){var{recurseParent:i}=t,s=a(t,["recurseParent"]);await this.performRowOperation(e,(async({viewer:e,id:t})=>{var n,o,r,a;const l=await((n=this.controller)===null||n===void 0?void 0:n.fetchNodeAncestors(t))||[];const d=(o=this.stateMap.selectionPath)===null||o===void 0?void 0:o.includes(t);if(i&&d){const e=l.find((({selected:e})=>!e));if(e!=null){await this.selectItem(e,s);this.lastSelectedItemId=t}}else if(s.range&&this.lastSelectedItemId!=null){const i=await((r=this.controller)===null||r===void 0?void 0:r.expandParentNodes(t));const n=await((a=this.controller)===null||a===void 0?void 0:a.expandParentNodes(this.lastSelectedItemId));if(n&&i){const t=Math.min(n,i);const o=Math.max(n,i);await x(e,t,o,s)}}else{await g(e,t,s);this.lastSelectedItemId=t}this.stateMap.selectionPath=[...l.map((({id:e})=>(e===null||e===void 0?void 0:e.hex)||"")),t]}))}async deselectItem(e){await this.performRowOperation(e,(async({viewer:e,id:t,node:i})=>{if(i.selected){this.lastSelectedItemId=undefined;await E(e,t)}}))}async getRowAtIndex(e){return this.rows[e]}async getRowForEvent(e){const{clientY:t,target:i}=e;if(i!=null&&this.errorDetails==null&&f(this.el,i)&&w(i)){return this.getRowAtClientY(t)}else{return undefined}}getRowAtClientY(e){const t=this.getLayoutElement();const i=t.layoutOffset;const s=Math.floor((e-i+t.scrollOffset)/t.rowHeight);return this.getRowAtIndex(s)}async filterItems(e,t={}){var i;return(i=this.controller)===null||i===void 0?void 0:i.filter(e,t)}async selectFilteredItems(e,t){if(this.viewer!=null){const i=this.metadataSearchKeys!=null?this.metadataSearchKeys:this.metadataKeys;if(i.length===0){console.warn("No metadata keys were found to perform the selection. Defaulting to ['VERTEX_SCENE_ITEM_NAME']")}const s=i.length>0?i:["VERTEX_SCENE_ITEM_NAME"];await C(this.viewer,e,s,this.metadataSearchExactMatch,Object.assign({append:false},t))}}async fetchMetadataKeys(){var e,t;return(t=(e=this.controller)===null||e===void 0?void 0:e.fetchMetadataKeys())!==null&&t!==void 0?t:[]}disconnectedCallback(){var e,t;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();(t=this.controller)===null||t===void 0?void 0:t.cancel()}componentWillLoad(){var e;if(this.controller==null){const{sceneTreeHost:t}=this.getConfig().network;const i=new l(t,this.getConfig().flags.grpcUseStreamingWebSocketTransport?{transport:d}:undefined);this.controller=new c(i,100);(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}this.stateMap.onStateChangeDisposable=this.controller.onStateChange.on((e=>this.handleControllerStateChange(e)));this.connectToViewer()}async componentDidLoad(){var e;this.ensureLayoutDefined();this.updateLayoutElement();const t=this.getLayoutElement();const i=new ResizeObserver((()=>{this.invalidateRows()}));i.observe(t);this.stateMap.resizeObserver=i;this.stateMap.componentLoaded=true;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys);if(this.viewer==null){this.errorDetails=new h("MISSING_VIEWER",u.MISSING_VIEWER)}}componentWillRender(){this.updateLayoutElement()}render(){return e(o,null,e("div",{class:"header"},e("slot",{name:"header"},e("vertex-scene-tree-toolbar",{class:"search-toolbar"},e("vertex-scene-tree-search",{controller:this.controller})))),this.errorDetails!=null&&this.renderError(this.errorDetails),this.errorDetails==null&&e("div",{class:"rows-scroll"},this.showLoader&&e("slot",{name:"loading"},e("vertex-viewer-spinner",{class:"loading",size:"md"})),e("slot",null),this.showEmptyResults&&e("slot",{name:"empty-results"},e("div",{class:"empty-results"},"No Results Found."))),e("div",{class:"footer"},e("slot",{name:"footer"})))}renderError(t){if(t.code!==u.SCENE_TREE_DISABLED){return e(m,{details:t},e("button",{class:"button button-secondary",onClick:()=>this.retryConnectToViewer(),disabled:this.attemptingRetry},"Retry"))}else{return e(m,{details:t})}}handleViewerChanged(e,t){if(!this.stateMap.componentLoaded){return}this.connectToViewer()}handleControllerChanged(e){var t;if(!this.stateMap.componentLoaded){return}(t=this.stateMap.onStateChangeDisposable)===null||t===void 0?void 0:t.dispose();this.stateMap.onStateChangeDisposable=e.onStateChange.on((e=>this.handleControllerStateChange(e)));e.setMetadataKeys(this.metadataKeys)}handleMetadataKeysChanged(){var e;(e=this.controller)===null||e===void 0?void 0:e.setMetadataKeys(this.metadataKeys)}retryConnectToViewer(){this.attemptingRetry=true;this.errorDetails=undefined;this.connectToViewer()}connectToViewer(){var e,t;(e=this.stateMap.viewerDisposable)===null||e===void 0?void 0:e.dispose();if(this.viewer==null&&this.viewerSelector!=null){this.viewer=document.querySelector(this.viewerSelector)}if(this.viewer!=null){this.stateMap.viewerDisposable=(t=this.controller)===null||t===void 0?void 0:t.connectToViewer(this.viewer)}else{this.attemptingRetry=false}}scheduleClearUnusedData(){if(this.stateMap.idleCallbackId!=null){window.cancelIdleCallback(this.stateMap.idleCallbackId)}this.stateMap.idleCallbackId=window.requestIdleCallback((e=>{var t,i,s;const n=(t=e.timeRemaining)===null||t===void 0?void 0:t.call(e);if(n==null||n>=R){const e=this.getLayoutElement();const t=e.viewportStartIndex;const n=e.viewportEndIndex;const[o,r]=((i=this.controller)===null||i===void 0?void 0:i.getPageIndexesForRange(t,n))||[];if(o!=null&&r!=null){(s=this.controller)===null||s===void 0?void 0:s.invalidatePagesOutsideRange(o,r,50)}}else{this.scheduleClearUnusedData()}}))}handleControllerStateChange(e){this.showLoader=!!e.shouldShowLoading;this.showEmptyResults=!!e.shouldShowEmptyResults;this.rows=e.rows;this.totalRows=e.totalRows;if(e.connection.type==="failure"){this.errorDetails=e.connection.details;this.connectionError.emit(e.connection.details)}else if(e.connection.type==="disconnected"){this.errorDetails=new h("DISCONNECTED",u.DISCONNECTED)}else{this.errorDetails=undefined}if(e.connection.type==="connected"||e.connection.type==="failure"){this.attemptingRetry=false}}async performRowOperation(e,t){const i=typeof e==="number"?this.rows[e]:e;if(i==null){throw new Error(`Cannot perform scene tree operation. Row not found.`)}const s=v(i)?i.node:i;if(s.id==null){throw new Error(`Cannot perform scene tree operation. ID is undefined.`)}if(this.viewer==null){throw new Error(`Cannot perform scene tree operation. Cannot get reference to viewer.`)}await t({viewer:this.viewer,id:s.id.hex,node:s})}async handleSearch(e){const t=this.metadataSearchKeys!=null?this.metadataSearchKeys:this.metadataKeys;try{await this.filterItems(e.detail,{columns:t,exactMatch:this.metadataSearchExactMatch})}catch(e){console.error("Failed to filter tree with exception: ",e)}}async handleCellLoaded(){if(!this.firstCellRendered&&this.rows.length>0){this.firstCellRendered=true;this.firstRowRendered.emit()}}getScrollToPosition(e,t){var i;const s=this.getLayoutElement();const n=Math.max(0,Math.min(e,this.totalRows-1));const o=(i=s.layoutHeight)!==null&&i!==void 0?i:0;const r=s.rowHeight;if(t==="start"){return n*r}else if(t==="middle"){const e=n*r+r/2;return e-o/2}else{const e=n*r+r;return e-o}}getConfig(){return p(this.configEnv,this.config)}ensureLayoutDefined(){let e=this.el.querySelector("vertex-scene-tree-table-layout");if(e==null){e=document.createElement("vertex-scene-tree-table-layout");e.innerHTML=`\n <vertex-scene-tree-table-column>\n <template>\n <vertex-scene-tree-table-cell prop:value="{{row.node.name}}" expand-toggle visibility-toggle></vertex-scene-tree-table-cell>\n </template>\n </vertex-scene-tree-table-column>\n `;this.el.appendChild(e)}this.stateMap.layoutEl=e}updateLayoutElement(){const e=this.stateMap.layoutEl;if(e!=null){e.rows=this.rows;e.tree=this.el;e.totalRows=this.totalRows;e.controller=this.controller;e.rowData=this.rowData}else if(!this.stateMap.componentLoaded&&this.totalRows>0){console.debug("Scene tree has rows, but the component has not yet rendered")}}getLayoutElement(){if(this.stateMap.layoutEl!=null){return this.stateMap.layoutEl}else{throw new Error("Layout element is undefined")}}get el(){return r(this)}static get watchers(){return{viewer:["handleViewerChanged"],controller:["handleControllerChanged"],metadataKeys:["handleMetadataKeysChanged"]}}};j.style=I;export{j as vertex_scene_tree};
|
|
5
|
-
//# sourceMappingURL=p-0523168d.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../node_modules/requestidlecallback-polyfill/index.js","src/components/scene-tree-table-cell/utils.ts","src/components/scene-tree/errors.tsx","src/components/scene-tree/lib/viewer-ops.ts","src/components/scene-tree/scene-tree.css?tag=vertex-scene-tree&encapsulation=shadow","src/components/scene-tree/scene-tree.tsx"],"names":["window","requestIdleCallback","cb","start","Date","now","setTimeout","didTimeout","timeRemaining","Math","max","cancelIdleCallback","id","clearTimeout","isSceneTreeTableCellElement","el","nodeName","SceneTreeError","details","children","h","class","message","link","Fragment","href","target","async","showItem","viewer","suppliedCorrelationId","scene","items","op","where","q","withItemId","show","execute","hideItem","hide","selectItem","append","all","deselect","select","selectRangeInSceneTree","end","withSceneTreeRange","selectFilterResults","filter","keys","exactMatch","withMetadata","deselectItem","sceneTreeCss","MIN_CLEAR_UNUSED_DATA_MS","SceneTree","[object Object]","hostRef","this","overScanCount","configEnv","metadataSearchExactMatch","metadataKeys","rows","totalRows","showLoader","showEmptyResults","stateMap","componentLoaded","attemptingRetry","firstCellRendered","forceUpdate","getLayoutElement","index","options","animate","position","i","min","top","getScrollToPosition","scrollToPosition","behavior","undefined","itemId","rowsBeforeExpand","_a","controller","expandParentNodes","Promise","resolve","layoutEl","handleLayoutRendered","removeEventListener","scrollToIndex","addEventListener","expandAll","collapseAll","row","performRowOperation","node","expanded","expandNode","collapseNode","collapseItem","expandItem","visible","partiallyVisible","recurseParent","__rest","ancestors","fetchNodeAncestors","isInPath","_b","selectionPath","includes","nextNode","find","selected","lastSelectedItemId","range","currentRowIndex","_c","previouslySelectedIndex","_d","map","hex","event","clientY","errorDetails","getSceneTreeContainsElement","getRowAtClientY","layoutOffset","floor","scrollOffset","rowHeight","getRowAtIndex","term","definedMetadataKeys","metadataSearchKeys","length","console","warn","columnsToSearch","Object","assign","fetchMetadataKeys","viewerDisposable","dispose","cancel","sceneTreeHost","getConfig","network","client","SceneTreeAPIClient","flags","grpcUseStreamingWebSocketTransport","transport","webSocketSubscriptionTransportFactory","SceneTreeController","setMetadataKeys","onStateChangeDisposable","onStateChange","on","state","handleControllerStateChange","connectToViewer","ensureLayoutDefined","updateLayoutElement","resizeObserver","ResizeObserver","invalidateRows","observe","SceneTreeErrorDetails","SceneTreeErrorCode","MISSING_VIEWER","Host","name","renderError","size","code","SCENE_TREE_DISABLED","onClick","retryConnectToViewer","disabled","newViewer","oldViewer","newController","viewerSelector","document","querySelector","idleCallbackId","foo","remaining","call","startIndex","viewportStartIndex","endIndex","viewportEndIndex","getPageIndexesForRange","invalidatePagesOutsideRange","scheduleClearUnusedData","shouldShowLoading","shouldShowEmptyResults","connection","type","connectionError","emit","DISCONNECTED","rowOrIndex","Error","isLoadedRow","filterItems","detail","columns","e","error","firstRowRendered","constrainedIndex","viewportHeight","layoutHeight","rowCenterY","rowBottomY","parseConfig","config","layout","createElement","innerHTML","appendChild","tree","rowData","debug"],"mappings":";;;ifAAAA,OAAOC,oBACHD,OAAOC,qBACP,SAASC,GACL,IAAIC,EAAQC,KAAKC,MACjB,OAAOC,YAAW,WACdJ,EAAG,CACCK,WAAY,MACZC,cAAe,WACX,OAAOC,KAAKC,IAAI,EAAG,IAAMN,KAAKC,MAAQF,SAG/C,IAGXH,OAAOW,mBACHX,OAAOW,oBACP,SAASC,GACLC,aAAaD,aCjBLE,EACdC,GAGA,OAAOA,GAAM,MAASA,EAAWC,WAAa,+BCKzC,MAAMC,EAA2D,EACpEC,QAAAA,GACFC,IAGEC,EAAA,MAAA,CAAKC,MAAM,SACTD,EAAA,MAAA,CAAKC,MAAM,+BACTD,EAAA,OAAA,KAAOF,EAAQI,SACdJ,EAAQK,MACPH,EAACI,EAAQ,KACPJ,EAAA,OAAA,KAAA,aACAA,EAAA,IAAA,CAAGK,KAAMP,EAAQK,KAAMG,OAAO,UAAQ,iBAEjC,IACLN,EAAA,OAAA,KAAA,4BAINA,EAAA,MAAA,CAAKC,MAAM,iBAAiBF,ICnB3BQ,eAAeC,EACpBC,EACAjB,GACAkB,sBAAEA,GAA6C,IAE/C,MAAMC,QAAcF,EAAOE,QAC3B,OAAOA,EACJC,OAAOC,GAAOA,EAAGC,OAAOC,GAAMA,EAAEC,WAAWxB,KAAKyB,SAChDC,QAAQ,CAAER,sBAAAA,IAGRH,eAAeY,EACpBV,EACAjB,GACAkB,sBAAEA,GAA6C,IAE/C,MAAMC,QAAcF,EAAOE,QAC3B,OAAOA,EACJC,OAAOC,GAAOA,EAAGC,OAAOC,GAAMA,EAAEC,WAAWxB,KAAK4B,SAChDF,QAAQ,CACPR,sBAAAA,IAICH,eAAec,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,KAAOL,KAAKK,KACnBkK,EAAOI,KAAO3K,KAAK7C,GACnBoN,EAAOjK,UAAYN,KAAKM,UACxBiK,EAAO1I,WAAa7B,KAAK6B,WACzB0I,EAAOK,QAAU5K,KAAK4K,aACjB,IAAK5K,KAAKS,SAASC,iBAAmBV,KAAKM,UAAY,EAAG,CAC/D6E,QAAQ0F,MACN,gEAKE/K,mBACN,GAAIE,KAAKS,SAASwB,UAAY,KAAM,CAClC,OAAOjC,KAAKS,SAASwB,aAChB,CACL,MAAM,IAAIuH,MAAM","sourcesContent":["window.requestIdleCallback =\n window.requestIdleCallback ||\n function(cb) {\n var start = Date.now();\n return setTimeout(function() {\n cb({\n didTimeout: false,\n timeRemaining: function() {\n return Math.max(0, 50 - (Date.now() - start));\n },\n });\n }, 1);\n };\n\nwindow.cancelIdleCallback =\n window.cancelIdleCallback ||\n function(id) {\n clearTimeout(id);\n };\n","export function isSceneTreeTableCellElement(\n el: unknown\n): el is HTMLVertexSceneTreeTableCellElement {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return el != null && (el as any).nodeName === 'VERTEX-SCENE-TREE-TABLE-CELL';\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { Fragment, FunctionalComponent, h } from '@stencil/core';\n\nimport { SceneTreeErrorDetails } from './lib/errors';\n\ninterface SceneTreeErrorProps {\n details: SceneTreeErrorDetails;\n}\n\nexport const SceneTreeError: FunctionalComponent<SceneTreeErrorProps> = (\n { details },\n children\n) => {\n return (\n <div class=\"error\">\n <div class=\"error-section error-message\">\n <span>{details.message}</span>\n {details.link && (\n <Fragment>\n <span> See our </span>\n <a href={details.link} target=\"_blank\">\n documentation\n </a>{' '}\n <span> for more information.</span>\n </Fragment>\n )}\n </div>\n <div class=\"error-section\">{children}</div>\n </div>\n );\n};\n","export interface ViewerItemOptions {\n suppliedCorrelationId?: string;\n}\nexport interface ViewerSelectItemOptions extends ViewerItemOptions {\n append?: boolean;\n range?: boolean;\n}\n\nexport async function showItem(\n viewer: HTMLVertexViewerElement,\n id: string,\n { suppliedCorrelationId }: ViewerItemOptions = {}\n): Promise<void> {\n const scene = await viewer.scene();\n return scene\n .items((op) => op.where((q) => q.withItemId(id)).show())\n .execute({ suppliedCorrelationId });\n}\n\nexport async function hideItem(\n viewer: HTMLVertexViewerElement,\n id: string,\n { suppliedCorrelationId }: ViewerItemOptions = {}\n): Promise<void> {\n const scene = await viewer.scene();\n return scene\n .items((op) => op.where((q) => q.withItemId(id)).hide())\n .execute({\n suppliedCorrelationId,\n });\n}\n\nexport async function selectItem(\n viewer: HTMLVertexViewerElement,\n id: string,\n { append = false, suppliedCorrelationId }: ViewerSelectItemOptions\n): Promise<void> {\n const scene = await viewer.scene();\n return scene\n .items((op) => [\n ...(append ? [] : [op.where((q) => q.all()).deselect()]),\n op.where((q) => q.withItemId(id)).select(),\n ])\n .execute({ suppliedCorrelationId });\n}\n\nexport async function selectRangeInSceneTree(\n viewer: HTMLVertexViewerElement,\n start: number,\n end: number,\n { append = true, suppliedCorrelationId }: ViewerSelectItemOptions\n): Promise<void> {\n const scene = await viewer.scene();\n return scene\n .items((op) => [\n ...(append ? [] : [op.where((q) => q.all()).deselect()]),\n op.where((q) => q.withSceneTreeRange({ start, end })).select(),\n ])\n .execute({\n suppliedCorrelationId,\n });\n}\n\nexport async function selectFilterResults(\n viewer: HTMLVertexViewerElement,\n filter: string,\n keys: string[],\n exactMatch: boolean,\n { append = false, suppliedCorrelationId }: ViewerSelectItemOptions\n): Promise<void> {\n const scene = await viewer.scene();\n return scene\n .items((op) => [\n ...(append ? [] : [op.where((q) => q.all()).deselect()]),\n op.where((q) => q.withMetadata(filter, keys, exactMatch)).select(),\n ])\n .execute({\n suppliedCorrelationId,\n });\n}\n\nexport async function deselectItem(\n viewer: HTMLVertexViewerElement,\n id: string,\n { suppliedCorrelationId }: ViewerItemOptions = {}\n): Promise<void> {\n const scene = await viewer.scene();\n return scene\n .items((op) => op.where((q) => q.withItemId(id)).deselect())\n .execute({\n suppliedCorrelationId,\n });\n}\n","@import url('../../css/button.css');\n\n:host {\n /**\n * @prop --scene-tree-toolbar-separator: A CSS border value that specifies the\n * border between scene tree toolbars.\n */\n --scene-tree-toolbar-separator: 1px solid var(--neutral-300);\n\n width: 300px;\n height: 100%;\n user-select: none;\n -webkit-user-select: none;\n cursor: default;\n display: flex;\n flex-direction: column;\n}\n\n.rows-scroll {\n position: relative;\n height: var(--scene-tree-row-height, 0);\n flex-grow: 1;\n}\n\n.rows {\n position: relative;\n}\n\n.row {\n position: absolute;\n display: flex;\n align-items: center;\n width: 100%;\n height: var(--scene-tree-row-height);\n padding: var(--scene-tree-row-padding);\n box-sizing: border-box;\n}\n\n.row:hover {\n background-color: var(--scene-tree-row-hover-color);\n}\n\n.row.is-selected {\n background-color: var(--scene-tree-row-selected-color);\n}\n\n.expand-toggle {\n cursor: pointer;\n width: 16px;\n}\n\n.row-text {\n margin-left: 0.25rem;\n width: 100%;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.visibility-btn {\n display: flex;\n align-items: center;\n visibility: hidden;\n padding: 4px;\n}\n\n.visibility-btn.is-hidden {\n visibility: visible;\n}\n\n.row:hover .visibility-btn {\n visibility: visible;\n}\n\n.error,\n.empty-results {\n position: absolute;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n font-size: 0.875rem;\n width: 100%;\n height: 100%;\n padding: 1rem;\n box-sizing: border-box;\n justify-content: center;\n background-color: white;\n}\n\n.error-section {\n margin-top: 1rem;\n}\n\n.error-message {\n text-align: center;\n}\n\n.search-toolbar,\nslot[name='header']::slotted(*) {\n border-bottom: var(--scene-tree-toolbar-separator);\n}\n\nslot[name='footer']::slotted(:not(:last-child)) {\n border-top: var(--scene-tree-toolbar-separator);\n}\n\n.header {\n display: flex;\n flex-direction: column;\n}\n\n.footer {\n display: flex;\n flex-direction: column;\n}\n\n.loading {\n position: absolute;\n top: 150px;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n}\n","import 'requestidlecallback-polyfill';\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n forceUpdate,\n h,\n Host,\n Listen,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { ElementPool } from '@vertexvis/html-templates';\nimport { Node } from '@vertexvis/scene-tree-protos/scenetree/protos/domain_pb';\nimport { SceneTreeAPIClient } from '@vertexvis/scene-tree-protos/scenetree/protos/scene_tree_api_pb_service';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { Config, parseConfig, PartialConfig } from '../../lib/config';\nimport { Environment } from '../../lib/environment';\nimport { isSceneTreeTableCellElement } from '../scene-tree-table-cell/utils';\nimport { SceneTreeError } from './errors';\nimport {\n FilterTreeOptions,\n SceneTreeController,\n SceneTreeState,\n} from './lib/controller';\nimport { getSceneTreeContainsElement } from './lib/dom';\nimport { SceneTreeErrorCode, SceneTreeErrorDetails } from './lib/errors';\nimport { webSocketSubscriptionTransportFactory } from './lib/grpc';\nimport { isLoadedRow, Row } from './lib/row';\nimport {\n deselectItem,\n hideItem,\n selectFilterResults,\n selectItem,\n selectRangeInSceneTree,\n showItem,\n} from './lib/viewer-ops';\nimport {\n MetadataKey,\n RowArg,\n RowDataProvider,\n SceneTreeOperationOptions,\n ScrollToOptions,\n SelectItemOptions,\n} from './types';\n\n/**\n * The minimum amount of time provided by requestIdleCallback to clear purged\n * data. A value too low may cause contention with browser rendering. A value\n * too high will cause too many items to be accumulated.\n */\nconst MIN_CLEAR_UNUSED_DATA_MS = 25;\n\ninterface StateMap {\n idleCallbackId?: number;\n resizeObserver?: ResizeObserver;\n componentLoaded: boolean;\n\n client?: SceneTreeAPIClient;\n jwt?: string;\n\n onStateChangeDisposable?: Disposable;\n subscribeDisposable?: Disposable;\n viewerDisposable?: Disposable;\n\n elementPool?: ElementPool;\n template?: HTMLTemplateElement;\n\n selectionPath?: string[];\n\n layoutEl?: HTMLVertexSceneTreeTableLayoutElement;\n}\n\ntype OperationHandler = (data: {\n viewer: HTMLVertexViewerElement;\n id: string;\n node: Node.AsObject;\n}) => void | Promise<void>;\n\n/**\n * @slot header - A slot that places content above the rows in the tree. By\n * default, a search toolbar will be placed in this slot. Elements can be\n * stacked by assigning multiple elements to this slot.\n * @slot footer - A slot that places content below the rows in the tree.\n * Elements can be stacked by assigning multiple elements to this slot.\n */\n@Component({\n tag: 'vertex-scene-tree',\n styleUrl: 'scene-tree.css',\n shadow: true,\n})\nexport class SceneTree {\n /**\n * The number of offscreen rows above and below the viewport to render. Having\n * a higher number reduces the chance of the browser not displaying a row\n * while scrolling.\n */\n @Prop()\n public overScanCount = 25;\n\n /**\n * A CSS selector that points to a `<vertex-viewer>` element. Either this\n * property or `viewer` must be set.\n */\n @Prop()\n public viewerSelector?: string;\n\n /**\n * An instance of a `<vertex-viewer>` element. Either this property or\n * `viewerSelector` must be set.\n */\n @Prop({ reflect: true, mutable: true })\n public viewer?: HTMLVertexViewerElement | null;\n\n /**\n * A callback that is invoked immediately before a row is about to rendered.\n * This callback can return additional data that can be bound to in a\n * template.\n *\n * @example\n *\n * ```html\n * <script>\n * const table = document.querySelector('vertex-scene-tree-table');\n * table.rowData = (row) => {\n * return { func: () => console.log('row', row.node.name) };\n * }\n * </script>\n *\n * <vertex-scene-tree>\n * <vertex-scene-tree-table>\n * <vertex-scene-tree-table-column>\n * <template>\n * <button event:click=\"{{row.data.func}}\">Hi</button>\n * </template>\n * </vertex-scene-tree-table-column>\n * </vertex-scene-tree-table>\n * </vertex-scene-tree>\n * ```\n */\n @Prop()\n public rowData?: RowDataProvider;\n\n /**\n * An object to configure the scene tree.\n */\n @Prop()\n public config?: PartialConfig | string;\n\n /**\n * Sets the default environment for the viewer. This setting is used for\n * auto-configuring network hosts.\n *\n * Use the `config` property for manually setting hosts.\n */\n @Prop()\n public configEnv: Environment = 'platprod';\n\n @Prop({ mutable: true })\n public controller?: SceneTreeController;\n\n /**\n * Indicates whether the metadata search should use an exact match.\n */\n @Prop({ mutable: true })\n public metadataSearchExactMatch = false;\n\n /**\n * A list of the metadata keys that a scene tree search should be performed on.\n */\n @Prop({ mutable: true })\n public metadataSearchKeys?: MetadataKey[];\n\n /**\n * A list of part metadata keys that will be made available to each row. This\n * metadata can be used for data binding inside the scene tree's template.\n */\n @Prop()\n public metadataKeys: MetadataKey[] = [];\n\n /**\n * An event that is emitted when this <vertex-scene-tree> encounters a connection\n * error.\n */\n @Event()\n public connectionError!: EventEmitter<SceneTreeErrorDetails>;\n\n /**\n * An event that is emitted when the first row of this <vertex-scene-tree> has\n * been rendered.\n */\n @Event()\n public firstRowRendered!: EventEmitter<void>;\n\n @State()\n private rows: Row[] = [];\n\n @State()\n private totalRows = 0;\n\n @State()\n private showLoader = false;\n\n @State()\n private showEmptyResults = false;\n\n /**\n * This stores internal state that you want to preserve across live-reloads,\n * but shouldn't trigger a refresh if the data changes. Marking this with\n * @State to allow to preserve state across live-reloads.\n */\n @State()\n private stateMap: StateMap = {\n componentLoaded: false,\n };\n\n @State()\n private errorDetails: SceneTreeErrorDetails | undefined;\n\n @State()\n private attemptingRetry = false;\n\n @Element()\n private el!: HTMLElement;\n\n private lastSelectedItemId?: string;\n private firstCellRendered = false;\n\n /**\n * Schedules a render of the rows in the scene tree. Useful if any custom\n * data in your scene tree has changed, and you want to update the row's\n * contents.\n *\n * **Note:** This is an asynchronous operation. The update may happen on the\n * next frame.\n */\n @Method()\n public async invalidateRows(): Promise<void> {\n forceUpdate(this.getLayoutElement());\n }\n\n /**\n * Scrolls the tree to the given row index.\n *\n * @param index An index of the row to scroll to.\n * @param options A set of options to configure the scrolling behavior.\n */\n @Method()\n public async scrollToIndex(\n index: number,\n options: ScrollToOptions = {}\n ): Promise<void> {\n const { animate, position = 'middle' } = options;\n const i = Math.max(0, Math.min(index, this.totalRows));\n\n const top = this.getScrollToPosition(i, position);\n\n this.getLayoutElement().scrollToPosition(top, {\n behavior: animate ? 'smooth' : undefined,\n });\n }\n\n /**\n * Scrolls the tree to an item with the given ID. If the node for the item is\n * not expanded, the tree will expand each of its parent nodes.\n *\n * @param itemId An ID of an item to scroll to.\n * @param options A set of options to configure the scrolling behavior.\n * @returns A promise that resolves when the operation is finished.\n */\n @Method()\n public async scrollToItem(\n itemId: string,\n options: ScrollToOptions = {}\n ): Promise<void> {\n const rowsBeforeExpand = this.totalRows;\n const index = await this.controller?.expandParentNodes(itemId);\n\n if (index != null && rowsBeforeExpand !== this.totalRows) {\n return new Promise((resolve) => {\n const layoutEl = this.getLayoutElement();\n const handleLayoutRendered = async (): Promise<void> => {\n layoutEl.removeEventListener('layoutRendered', handleLayoutRendered);\n await this.scrollToIndex(index, options);\n resolve();\n };\n\n layoutEl.addEventListener('layoutRendered', handleLayoutRendered);\n });\n } else if (index != null) {\n await this.scrollToIndex(index, options);\n }\n }\n\n /**\n * Performs an API call to expand all nodes in the tree.\n */\n @Method()\n public async expandAll(): Promise<void> {\n await this.controller?.expandAll();\n }\n\n /**\n * Performs an API call to collapse all nodes in the tree.\n */\n @Method()\n public async collapseAll(): Promise<void> {\n await this.controller?.collapseAll();\n }\n\n /**\n * Performs an API call that will expand the node associated to the specified\n * row or row index.\n *\n * @param row A row, row index, or node to expand.\n */\n @Method()\n public async expandItem(row: RowArg): Promise<void> {\n await this.performRowOperation(row, async ({ id, node }) => {\n if (!node.expanded) {\n await this.controller?.expandNode(id);\n }\n });\n }\n\n /**\n * Performs an API call that will collapse the node associated to the\n * specified row or row index.\n *\n * @param row A row, row index, or node to collapse.\n */\n @Method()\n public async collapseItem(row: RowArg): Promise<void> {\n await this.performRowOperation(row, async ({ id, node }) => {\n if (node.expanded) {\n await this.controller?.collapseNode(id);\n }\n });\n }\n\n /**\n * Performs an API call that will either expand or collapse the node\n * associated to the given row or row index.\n *\n * @param row The row, row index, or node to collapse or expand.\n */\n @Method()\n public async toggleExpandItem(row: RowArg): Promise<void> {\n await this.performRowOperation(row, async ({ node }) => {\n if (node.expanded) {\n await this.collapseItem(node);\n } else {\n await this.expandItem(node);\n }\n });\n }\n\n /**\n * Performs an API call that will either hide or show the item associated to\n * the given row or row index.\n *\n * @param row The row, row index, or node to toggle visibility.\n */\n @Method()\n public async toggleItemVisibility(row: RowArg): Promise<void> {\n await this.performRowOperation(row, async ({ viewer, id, node }) => {\n if (node.visible || node.partiallyVisible) {\n await hideItem(viewer, id);\n } else {\n await showItem(viewer, id);\n }\n });\n }\n\n /**\n * Performs an API call that will hide the item associated to the given row\n * or row index.\n *\n * @param row The row, row index, or node to hide.\n */\n @Method()\n public async hideItem(row: RowArg): Promise<void> {\n await this.performRowOperation(row, async ({ viewer, id, node }) => {\n if (node.visible) {\n await hideItem(viewer, id);\n }\n });\n }\n\n /**\n * Performs an API call that will show the item associated to the given row\n * or row index.\n *\n * @param row The row, row index, or node to show.\n */\n @Method()\n public async showItem(row: RowArg): Promise<void> {\n await this.performRowOperation(row, async ({ viewer, id, node }) => {\n if (!node.visible) {\n await showItem(viewer, id);\n }\n });\n }\n\n /**\n * Performs an API call that will select the item associated to the given row\n * or row index.\n *\n * This method supports a `recurseParent` option that allows for recursively\n * selecting the next unselected parent node. This behavior is considered\n * stateful. Each call to `selectItem` will track the ancestry of the passed\n * in `rowArg`. If calling `selectItem` with a row not belonging to the\n * ancestry of a previous selection, then this method will perform a standard\n * selection.\n *\n * @param row The row, row index or node to select.\n * @param options A set of options to configure selection behavior.\n */\n @Method()\n public async selectItem(\n row: RowArg,\n { recurseParent, ...options }: SelectItemOptions = {}\n ): Promise<void> {\n await this.performRowOperation(row, async ({ viewer, id }) => {\n const ancestors = (await this.controller?.fetchNodeAncestors(id)) || [];\n const isInPath = this.stateMap.selectionPath?.includes(id);\n\n if (recurseParent && isInPath) {\n const nextNode = ancestors.find(({ selected }) => !selected);\n if (nextNode != null) {\n await this.selectItem(nextNode, options);\n this.lastSelectedItemId = id;\n }\n } else if (options.range && this.lastSelectedItemId != null) {\n const currentRowIndex = await this.controller?.expandParentNodes(id);\n const previouslySelectedIndex =\n await this.controller?.expandParentNodes(this.lastSelectedItemId);\n\n if (previouslySelectedIndex && currentRowIndex) {\n const start = Math.min(previouslySelectedIndex, currentRowIndex);\n const end = Math.max(previouslySelectedIndex, currentRowIndex);\n await selectRangeInSceneTree(viewer, start, end, options);\n }\n } else {\n await selectItem(viewer, id, options);\n this.lastSelectedItemId = id;\n }\n\n this.stateMap.selectionPath = [\n ...ancestors.map(({ id }) => id?.hex || ''),\n id,\n ];\n });\n }\n\n /**\n * Performs an API call that will deselect the item associated to the given\n * row or row index.\n *\n * @param row The row, row index, or node to deselect.\n */\n @Method()\n public async deselectItem(row: RowArg): Promise<void> {\n await this.performRowOperation(row, async ({ viewer, id, node }) => {\n if (node.selected) {\n this.lastSelectedItemId = undefined;\n await deselectItem(viewer, id);\n }\n });\n }\n\n /**\n * Returns a row at the given index. If the row data has not been loaded,\n * returns `undefined`.\n *\n * @param index The index of the row.\n * @returns A row, or `undefined` if the row hasn't been loaded.\n */\n @Method()\n public async getRowAtIndex(index: number): Promise<Row> {\n return this.rows[index];\n }\n\n /**\n * Returns the row data from the given mouse or pointer event. The event must\n * originate from a `vertex-scene-tree-table-cell` contained by this element,\n * otherwise `undefined` is returned.\n *\n * @param event A mouse or pointer event that originated from this component.\n * @returns A row, or `undefined` if the row hasn't been loaded.\n */\n @Method()\n public async getRowForEvent(event: MouseEvent | PointerEvent): Promise<Row> {\n const { clientY, target } = event;\n\n if (\n target != null &&\n this.errorDetails == null &&\n getSceneTreeContainsElement(this.el, target as HTMLElement) &&\n isSceneTreeTableCellElement(target)\n ) {\n return this.getRowAtClientY(clientY);\n } else {\n return undefined;\n }\n }\n\n /**\n * Returns the row data from the given vertical client position.\n *\n * @param clientY The vertical client position.\n * @returns A row or `undefined` if the row hasn't been loaded.\n */\n @Method()\n public getRowAtClientY(clientY: number): Promise<Row> {\n const layoutEl = this.getLayoutElement();\n const top = layoutEl.layoutOffset;\n const index = Math.floor(\n (clientY - top + layoutEl.scrollOffset) / layoutEl.rowHeight\n );\n return this.getRowAtIndex(index);\n }\n\n /**\n * Performs an async request that will filter the displayed items in the tree\n * that match the given term and options.\n *\n * @param term The filter term.\n * @param options The options to apply to the filter.\n * @returns A promise that completes when the request has completed. Note,\n * items are displayed asynchronously. So the displayed items may not reflect\n * the result of this filter when the promise completes.\n */\n @Method()\n public async filterItems(\n term: string,\n options: FilterTreeOptions = {}\n ): Promise<void> {\n return this.controller?.filter(term, options);\n }\n\n /**\n * Performs an async request that will select the filtered items in the tree\n * that match the given term.\n *\n * @param term The filter term.\n * @returns A promise that completes when the request has completed.\n */\n @Method()\n public async selectFilteredItems(\n term: string,\n options?: SceneTreeOperationOptions\n ): Promise<void> {\n if (this.viewer != null) {\n const definedMetadataKeys =\n this.metadataSearchKeys != null\n ? this.metadataSearchKeys\n : this.metadataKeys;\n\n if (definedMetadataKeys.length === 0) {\n console.warn(\n \"No metadata keys were found to perform the selection. Defaulting to ['VERTEX_SCENE_ITEM_NAME']\"\n );\n }\n\n const columnsToSearch =\n definedMetadataKeys.length > 0\n ? definedMetadataKeys\n : ['VERTEX_SCENE_ITEM_NAME'];\n\n await selectFilterResults(\n this.viewer,\n term,\n columnsToSearch,\n this.metadataSearchExactMatch,\n {\n append: false,\n ...options,\n }\n );\n }\n }\n\n /**\n * Fetches the metadata keys that are available to the scene tree. Metadata\n * keys can be assigned to the scene tree using the `metadataKeys` property.\n * The scene tree will fetch this metadata and make these values available\n * for data binding.\n *\n * @returns A promise that resolves with the names of available keys.\n */\n @Method()\n public async fetchMetadataKeys(): Promise<MetadataKey[]> {\n return this.controller?.fetchMetadataKeys() ?? [];\n }\n\n /**\n * @ignore\n */\n protected disconnectedCallback(): void {\n this.stateMap.viewerDisposable?.dispose();\n this.controller?.cancel();\n }\n\n /**\n * @ignore\n */\n protected componentWillLoad(): void {\n if (this.controller == null) {\n const { sceneTreeHost } = this.getConfig().network;\n const client = new SceneTreeAPIClient(\n sceneTreeHost,\n this.getConfig().flags.grpcUseStreamingWebSocketTransport\n ? {\n transport: webSocketSubscriptionTransportFactory,\n }\n : undefined\n );\n this.controller = new SceneTreeController(client, 100);\n this.controller?.setMetadataKeys(this.metadataKeys);\n }\n\n this.stateMap.onStateChangeDisposable = this.controller.onStateChange.on(\n (state) => this.handleControllerStateChange(state)\n );\n\n this.connectToViewer();\n }\n\n /**\n * @ignore\n */\n protected async componentDidLoad(): Promise<void> {\n this.ensureLayoutDefined();\n this.updateLayoutElement();\n\n const layoutEl = this.getLayoutElement();\n const resizeObserver = new ResizeObserver(() => {\n this.invalidateRows();\n });\n resizeObserver.observe(layoutEl);\n this.stateMap.resizeObserver = resizeObserver;\n\n this.stateMap.componentLoaded = true;\n\n this.controller?.setMetadataKeys(this.metadataKeys);\n\n if (this.viewer == null) {\n this.errorDetails = new SceneTreeErrorDetails(\n 'MISSING_VIEWER',\n SceneTreeErrorCode.MISSING_VIEWER\n );\n }\n }\n\n public componentWillRender(): void {\n // The controller can load data prior to the first render\n // ensure that this renders any time the state changes.\n this.updateLayoutElement();\n }\n\n /**\n * @ignore\n */\n protected render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <div class=\"header\">\n <slot name=\"header\">\n <vertex-scene-tree-toolbar class=\"search-toolbar\">\n <vertex-scene-tree-search controller={this.controller} />\n </vertex-scene-tree-toolbar>\n </slot>\n </div>\n\n {this.errorDetails != null && this.renderError(this.errorDetails)}\n\n {this.errorDetails == null && (\n <div class=\"rows-scroll\">\n {this.showLoader && (\n <slot name=\"loading\">\n <vertex-viewer-spinner class=\"loading\" size=\"md\" />\n </slot>\n )}\n <slot />\n {this.showEmptyResults && (\n <slot name=\"empty-results\">\n <div class=\"empty-results\">No Results Found.</div>\n </slot>\n )}\n </div>\n )}\n\n <div class=\"footer\">\n <slot name=\"footer\" />\n </div>\n </Host>\n );\n }\n\n private renderError(details: SceneTreeErrorDetails): h.JSX.IntrinsicElements {\n if (details.code !== SceneTreeErrorCode.SCENE_TREE_DISABLED) {\n return (\n <SceneTreeError details={details}>\n <button\n class=\"button button-secondary\"\n onClick={() => this.retryConnectToViewer()}\n disabled={this.attemptingRetry}\n >\n Retry\n </button>\n </SceneTreeError>\n );\n } else {\n return <SceneTreeError details={details} />;\n }\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(\n newViewer: HTMLVertexViewerElement | undefined,\n oldViewer: HTMLVertexViewerElement | undefined\n ): void {\n // StencilJS will invoke this callback even before the component has been\n // loaded. According to their docs, this shouldn't happen. Return if the\n // component hasn't been loaded.\n // See https://stenciljs.com/docs/reactive-data#watch-decorator\n if (!this.stateMap.componentLoaded) {\n return;\n }\n\n this.connectToViewer();\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChanged(newController: SceneTreeController): void {\n // StencilJS will invoke this callback even before the component has been\n // loaded. According to their docs, this shouldn't happen. Return if the\n // component hasn't been loaded.\n // See https://stenciljs.com/docs/reactive-data#watch-decorator\n if (!this.stateMap.componentLoaded) {\n return;\n }\n\n this.stateMap.onStateChangeDisposable?.dispose();\n\n this.stateMap.onStateChangeDisposable = newController.onStateChange.on(\n (state) => this.handleControllerStateChange(state)\n );\n\n newController.setMetadataKeys(this.metadataKeys);\n }\n\n /**\n * @ignore\n */\n @Watch('metadataKeys')\n protected handleMetadataKeysChanged(): void {\n this.controller?.setMetadataKeys(this.metadataKeys);\n }\n\n private retryConnectToViewer(): void {\n this.attemptingRetry = true;\n this.errorDetails = undefined;\n this.connectToViewer();\n }\n\n private connectToViewer(): void {\n this.stateMap.viewerDisposable?.dispose();\n\n if (this.viewer == null && this.viewerSelector != null) {\n this.viewer = document.querySelector(this.viewerSelector) as\n | HTMLVertexViewerElement\n | undefined;\n }\n\n if (this.viewer != null) {\n this.stateMap.viewerDisposable = this.controller?.connectToViewer(\n this.viewer\n );\n } else {\n this.attemptingRetry = false;\n }\n }\n\n private scheduleClearUnusedData(): void {\n if (this.stateMap.idleCallbackId != null) {\n window.cancelIdleCallback(this.stateMap.idleCallbackId);\n }\n\n this.stateMap.idleCallbackId = window.requestIdleCallback((foo) => {\n const remaining = foo.timeRemaining?.();\n\n if (remaining == null || remaining >= MIN_CLEAR_UNUSED_DATA_MS) {\n const layoutEl = this.getLayoutElement();\n const startIndex = layoutEl.viewportStartIndex;\n const endIndex = layoutEl.viewportEndIndex;\n const [start, end] =\n this.controller?.getPageIndexesForRange(startIndex, endIndex) || [];\n\n if (start != null && end != null) {\n this.controller?.invalidatePagesOutsideRange(start, end, 50);\n }\n } else {\n this.scheduleClearUnusedData();\n }\n });\n }\n\n private handleControllerStateChange(state: SceneTreeState): void {\n this.showLoader = !!state.shouldShowLoading;\n this.showEmptyResults = !!state.shouldShowEmptyResults;\n this.rows = state.rows;\n this.totalRows = state.totalRows;\n\n if (state.connection.type === 'failure') {\n this.errorDetails = state.connection.details;\n this.connectionError.emit(state.connection.details);\n } else if (state.connection.type === 'disconnected') {\n this.errorDetails = new SceneTreeErrorDetails(\n 'DISCONNECTED',\n SceneTreeErrorCode.DISCONNECTED\n );\n } else {\n this.errorDetails = undefined;\n }\n\n if (\n state.connection.type === 'connected' ||\n state.connection.type === 'failure'\n ) {\n this.attemptingRetry = false;\n }\n }\n\n private async performRowOperation(\n rowOrIndex: number | Row | Node.AsObject,\n op: OperationHandler\n ): Promise<void> {\n const row =\n typeof rowOrIndex === 'number' ? this.rows[rowOrIndex] : rowOrIndex;\n\n if (row == null) {\n throw new Error(`Cannot perform scene tree operation. Row not found.`);\n }\n\n const node = isLoadedRow(row) ? row.node : row;\n\n if (node.id == null) {\n throw new Error(`Cannot perform scene tree operation. ID is undefined.`);\n }\n\n if (this.viewer == null) {\n throw new Error(\n `Cannot perform scene tree operation. Cannot get reference to viewer.`\n );\n }\n\n await op({ viewer: this.viewer, id: node.id.hex, node });\n }\n\n @Listen('search')\n protected async handleSearch(event: CustomEvent<string>): Promise<void> {\n const columnsToSearch =\n this.metadataSearchKeys != null\n ? this.metadataSearchKeys\n : this.metadataKeys;\n\n try {\n await this.filterItems(event.detail, {\n columns: columnsToSearch,\n exactMatch: this.metadataSearchExactMatch,\n });\n } catch (e) {\n console.error('Failed to filter tree with exception: ', e);\n }\n }\n\n @Listen('cellLoaded')\n protected async handleCellLoaded(): Promise<void> {\n if (!this.firstCellRendered && this.rows.length > 0) {\n this.firstCellRendered = true;\n this.firstRowRendered.emit();\n }\n }\n\n private getScrollToPosition(\n index: number,\n position: ScrollToOptions['position']\n ): number {\n const layoutEl = this.getLayoutElement();\n const constrainedIndex = Math.max(0, Math.min(index, this.totalRows - 1));\n const viewportHeight = layoutEl.layoutHeight ?? 0;\n const rowHeight = layoutEl.rowHeight;\n\n if (position === 'start') {\n return constrainedIndex * rowHeight;\n } else if (position === 'middle') {\n const rowCenterY = constrainedIndex * rowHeight + rowHeight / 2;\n return rowCenterY - viewportHeight / 2;\n } else {\n const rowBottomY = constrainedIndex * rowHeight + rowHeight;\n return rowBottomY - viewportHeight;\n }\n }\n\n private getConfig(): Config {\n return parseConfig(this.configEnv, this.config);\n }\n\n private ensureLayoutDefined(): void {\n let layout = this.el.querySelector('vertex-scene-tree-table-layout');\n if (layout == null) {\n layout = document.createElement('vertex-scene-tree-table-layout');\n layout.innerHTML = `\n <vertex-scene-tree-table-column>\n <template>\n <vertex-scene-tree-table-cell prop:value=\"{{row.node.name}}\" expand-toggle visibility-toggle></vertex-scene-tree-table-cell>\n </template>\n </vertex-scene-tree-table-column>\n `;\n\n this.el.appendChild(layout);\n }\n this.stateMap.layoutEl = layout;\n }\n\n private updateLayoutElement(): void {\n const layout = this.stateMap.layoutEl;\n if (layout != null) {\n layout.rows = this.rows;\n layout.tree = this.el as HTMLVertexSceneTreeElement;\n layout.totalRows = this.totalRows;\n layout.controller = this.controller;\n layout.rowData = this.rowData;\n } else if (!this.stateMap.componentLoaded && this.totalRows > 0) {\n console.debug(\n 'Scene tree has rows, but the component has not yet rendered'\n );\n }\n }\n\n private getLayoutElement(): HTMLVertexSceneTreeTableLayoutElement {\n if (this.stateMap.layoutEl != null) {\n return this.stateMap.layoutEl;\n } else {\n throw new Error('Layout element is undefined');\n }\n }\n}\n"]}
|