Skip to content

gi-nx


gi-nx / WorkspacePropertyTree

ts
type WorkspacePropertyTree = {
  items: {
     root: {
        children: string[];
        id: string;
        isExpanded?: boolean;
     };
   } & Record<string, 
     | {
     data: UserDefinedWorkspaceProperty;
     id: string;
   }
     | {
     children: string[];
     id: string;
     isExpanded?: boolean;
  }>;
  rootId: string;
};

items is a flat map keyed by item id. Each entry is either a leaf (with a data payload) or a group (with a children: string[] list). The well-known root group anchors the tree; its children is the top-level item order.

Example

typescript
const properties: WorkspacePropertyTree = {
  rootId: 'root',
  items: {
    root: { id: 'root', children: ['climateZone', 'buildingGroup'] },
    climateZone: {
      id: 'climateZone',
      data: {
        name: 'climateZone',
        label: 'Climate Zone',
        type: 'select',
        options: ['A', 'B', 'C'],
        defaultValue: 'A'
      }
    },
    buildingGroup: { id: 'buildingGroup', children: ['far'], isExpanded: true },
    far: {
      id: 'far',
      data: {
        name: 'far',
        label: 'Floor Area Ratio',
        type: 'number',
        defaultValue: 2.5
      }
    }
  }
};

Properties

PropertyType
items{ root: { children: string[]; id: string; isExpanded?: boolean; }; } & Record<string, | { data: UserDefinedWorkspaceProperty; id: string; } | { children: string[]; id: string; isExpanded?: boolean; }>
rootIdstring

References