@procore/bim-webviewer-sdk 17.9.0-rc.6 → 17.10.0-rc.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.
@@ -34,6 +34,8 @@ export class FloorPlanComponent {
34
34
  currentElevation: number;
35
35
  levels: {};
36
36
  elevation: {};
37
+ levelFullNames: {};
38
+ _levelTree: import("./levelTree").TreeNode[] | null;
37
39
  plans: {};
38
40
  isModalOpen: boolean;
39
41
  INTERACTION_STATE: {
@@ -47,6 +49,9 @@ export class FloorPlanComponent {
47
49
  elevationRanges: Map<any, any>;
48
50
  closeDropdowns: ((event: any) => void) | undefined;
49
51
  init(): void;
52
+ _initLevelsMap(levels: any, groupByTier: any): void;
53
+ _buildPlansMap(plans: any): void;
54
+ _pruneLevelsWithoutPlans(): void;
50
55
  initCanvas(image: any): void;
51
56
  initImage: (() => void) | undefined;
52
57
  CloseAllDropdowns(event: any): void;
@@ -63,6 +68,7 @@ export class FloorPlanComponent {
63
68
  UpdateBluePointModel(camPos: any, camDir: any, applyOffsetToPoint?: boolean): void;
64
69
  CreateBluePoint(): HTMLDivElement;
65
70
  CreateImage(): void;
71
+ _toggleGroupLabel(event: any): boolean;
66
72
  onClickLevels(event: any): void;
67
73
  onClickPlans(event: any): void;
68
74
  closeModal(): void;
@@ -74,6 +80,8 @@ export class FloorPlanComponent {
74
80
  createCloseModal(): HTMLDivElement;
75
81
  createDropDown(dropdown: any, selectContainer: any, selectChosen: any, selectDrop: any, ulResults: any): any;
76
82
  populateLevelsDropDown(ulResults: any, levels: any): void;
83
+ _renderLevelTree(parentUl: any, nodes: any): void;
84
+ _expandAndScrollToLevel(levelId: any): void;
77
85
  populateDropDown(ulResults: any, options: any): void;
78
86
  createBigPlan(): HTMLDivElement;
79
87
  dispose(): void;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Tier-tree builder for bim_level name parsing.
3
+ *
4
+ * The bim_levels API returns names that encode the full Location path as
5
+ * "Tier A > Tier B > Leaf Level". This module splits those paths into a
6
+ * recursive tree that FloorPlanComponent uses to render the levels dropdown
7
+ * as a grouped accordion when groupLevelsByTier is enabled.
8
+ */
9
+ /**
10
+ * Splits a level name on " > " separators and returns the tier path segments
11
+ * plus the leaf display label.
12
+ *
13
+ * @param {string} name Raw level name, e.g. "Building A > Floor 2 > 2F"
14
+ * @returns {{ tiers: string[], leaf: string }}
15
+ */
16
+ export function parseLevelName(name: string): {
17
+ tiers: string[];
18
+ leaf: string;
19
+ };
20
+ /**
21
+ * Builds a recursive tier tree from a pruned levels array (levels that have
22
+ * no plans have already been removed by the caller).
23
+ *
24
+ * Returns **null** when no tiered levels exist (all levels are flat) so
25
+ * that the caller can fall back to flat rendering unchanged.
26
+ *
27
+ * @param {Array<{id: number|string, name: string, elevation?: number|null}>} levels
28
+ * @returns {TreeNode[]|null}
29
+ *
30
+ * @typedef {{ type: 'group', name: string, path: string, depth: number, children: TreeNode[] }} GroupNode
31
+ * @typedef {{ type: 'level', level: object, leaf: string, depth: number }} LevelNode
32
+ * @typedef {GroupNode|LevelNode} TreeNode
33
+ */
34
+ export function buildLevelTree(levels: Array<{
35
+ id: number | string;
36
+ name: string;
37
+ elevation?: number | null;
38
+ }>): TreeNode[] | null;
39
+ /**
40
+ * Finds the group paths that are direct ancestors of the given level id in
41
+ * the tree. Returns an array of path strings ordered from root to parent,
42
+ * e.g. ["Building A", "Building A>Floor 1"].
43
+ *
44
+ * @param {TreeNode[]} tree
45
+ * @param {number|string} levelId
46
+ * @returns {string[]}
47
+ */
48
+ export function findAncestorGroupPaths(tree: TreeNode[], levelId: number | string): string[];
49
+ /**
50
+ * Builds a recursive tier tree from a pruned levels array (levels that have
51
+ * no plans have already been removed by the caller).
52
+ *
53
+ * Returns **null** when no tiered levels exist (all levels are flat) so
54
+ * that the caller can fall back to flat rendering unchanged.
55
+ */
56
+ export type GroupNode = {
57
+ type: "group";
58
+ name: string;
59
+ path: string;
60
+ depth: number;
61
+ children: TreeNode[];
62
+ };
63
+ /**
64
+ * Builds a recursive tier tree from a pruned levels array (levels that have
65
+ * no plans have already been removed by the caller).
66
+ *
67
+ * Returns **null** when no tiered levels exist (all levels are flat) so
68
+ * that the caller can fall back to flat rendering unchanged.
69
+ */
70
+ export type LevelNode = {
71
+ type: "level";
72
+ level: object;
73
+ leaf: string;
74
+ depth: number;
75
+ };
76
+ /**
77
+ * Builds a recursive tier tree from a pruned levels array (levels that have
78
+ * no plans have already been removed by the caller).
79
+ *
80
+ * Returns **null** when no tiered levels exist (all levels are flat) so
81
+ * that the caller can fall back to flat rendering unchanged.
82
+ */
83
+ export type TreeNode = GroupNode | LevelNode;
@@ -45,6 +45,18 @@ export type CommonOptions = {
45
45
  locale?: string;
46
46
  baseUrl?: string;
47
47
  accessToken?: string;
48
+ /**
49
+ * When true, the floor-plan levels dropdown groups levels into a collapsible
50
+ * accordion by their Location tier path (the segments of level.name split on
51
+ * " > "). Falls back to the flat list when fewer than two distinct top-level
52
+ * groups are present so that untiered projects are unaffected.
53
+ *
54
+ * Requires bim_levels to be fetched with view=extended so that level.name
55
+ * contains the full Location path.
56
+ *
57
+ * @default false
58
+ */
59
+ groupLevelsByTier?: boolean;
48
60
  debug?: boolean;
49
61
  multiselect?: boolean;
50
62
  selection?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/bim-webviewer-sdk",
3
- "version": "17.9.0-rc.6",
3
+ "version": "17.10.0-rc.0",
4
4
  "description": "Procore BIM Webviewer SDK",
5
5
  "main": "dist/Procore.Bim.Webviewer.js",
6
6
  "types": "dist/Procore.Bim.Webviewer.d.ts",