@thatopen/ui-obc
Version:
Collection of web components (UI components) implementations to use with @thatopen/components.
607 lines (536 loc) • 21.8 kB
TypeScript
import * as BUI from '@thatopen/ui';
import { Button } from '@thatopen/ui';
import { CSSResult } from 'lit';
import * as FRAGS from '@thatopen/fragments';
import { LitElement } from 'lit';
import * as OBC from '@thatopen/components';
import * as OBF from '@thatopen/components-front';
import { Panel } from '@thatopen/ui';
import { StatefullComponent } from '@thatopen/ui';
import { Table } from '@thatopen/ui';
import { TemplateResult } from 'lit-html';
import * as THREE from 'three';
import { UpdateFunction } from '@thatopen/ui';
export declare const buttons: {
loadFrag: (state: LoadFragState) => [element: Button, update: UpdateFunction<LoadFragState>, currentState: () => LoadFragState];
loadIfc: (state: LoadIfcState) => [element: Button, update: UpdateFunction<LoadIfcState>, currentState: () => LoadIfcState];
};
declare namespace commentsList {
export {
commentsList_2 as commentsList,
commentsListTemplate,
CommentsListActions,
CommentsListTableData,
CommentsListState
}
}
/**
* Creates a Topic Comments List component with the given UI state.
*
* @param state - The initial state of the Topic Comments List component.
* @param autoUpdate - A flag indicating whether the component should automatically update based on events happening in the BCFTopic component.
* Default value is `true`.
*
* @returns A tuple containing the created Topic Comments List component and a function to update it.
*/
declare const commentsList_2: (state: CommentsListState, autoUpdate?: boolean) => [element: BUI.Table<CommentsListTableData>, update: BUI.UpdateFunction<CommentsListState>, currentState: () => CommentsListState];
declare interface CommentsListActions {
delete: boolean;
}
declare interface CommentsListState {
topic: OBC.Topic;
viewpoint?: OBC.Viewpoint;
styles?: TopicUserStyles;
actions?: Partial<CommentsListActions>;
missingDataMessage?: string;
}
declare type CommentsListTableData = {
guid: string;
Comment: string;
author: string;
};
declare const commentsListTemplate: BUI.StatefullComponent<CommentsListState>;
declare interface DataStyles {
users: TopicUserStyles;
}
export declare const forms: {
topic: (state: TopicFormUI) => [element: Panel, update: UpdateFunction<TopicFormUI>, currentState: () => TopicFormUI];
};
declare interface FormValue {
title: string;
status: string;
type: string;
priority: string;
assignedTo: string;
labels: Iterable<string>;
stage: string;
description: string;
}
declare namespace itemsData {
export {
itemsData_2 as itemsData,
ModelIdMap,
ItemsDataTableData,
ItemsDataState,
itemsDataTemplate
}
}
/**
* Creates an instance of ElementProperties component.
*
* @param state - The initial state for the ElementProperties component.
* @returns A new instance of ElementProperties component.
*
*/
declare const itemsData_2: (state: ItemsDataState) => [element: BUI.Table<ItemsDataTableData>, update: BUI.UpdateFunction<ItemsDataState>, currentState: () => ItemsDataState];
/**
* UI State to render an item data table
*/
declare interface ItemsDataState {
/**
* The main entry point of @thatopen/components in your app
*/
components: OBC.Components;
/**
* The collection of items per model to show its data in the table
*/
modelIdMap: {
[key: string]: Set<number>;
};
/**
* Display a warning instead of the table in case there is no selection
* @default true
*/
emptySelectionWarning?: boolean;
defaultItemNameKey?: string;
itemsDataConfig?: FRAGS.ItemsDataConfig;
}
declare type ItemsDataTableData = {
Name: string;
Value: any;
};
/**
* Heloooooooooo
*/
declare const itemsDataTemplate: (_state: ItemsDataState) => BUI.TemplateResult<1>;
/**
* Interface representing the state of the LoadIfcUI component. It contains a reference to the Components object from the @thatopen/components library.
*/
declare interface LoadFragState {
components: OBC.Components;
world?: OBC.World;
}
/**
* Interface representing the state of the LoadIfcUI component. It contains a reference to the Components object from the @thatopen/components library.
*/
declare interface LoadIfcState {
components: OBC.Components;
worldName?: string;
modelUserData?: Record<string, any>;
}
/**
* Manager class is responsible for initializing the custom elements for the BIM application. It uses the BUIManager from "@thatopen/ui" to define custom elements for 2D and 3D views.
*/
export declare class Manager {
/**
* Initializes the custom elements for the BIM application.
*
* @remarks
* This method should be called once during the application's initialization.
*
*/
static init(): void;
}
declare type ModelIdMap = {
[key: string]: Set<number>;
};
declare namespace modelsList {
export {
modelsList_2 as modelsList,
modelsListTemplate,
ModelsListState,
ModelsListTableData
}
}
/**
* Creates a table component for displaying a list of models.
*
* @param state - The initial state of the models list component.
* @param autoUpdate - A flag indicating whether the component should automatically update when fragments are loaded or disposed.
* Default value is `true`.
*
* @returns A tuple containing the table component element and a function to update the component.
*
* @remarks
* This function creates a table component using the provided state and template.
* If `autoUpdate` is set to `true`, the component will automatically update when fragments are loaded or disposed.
*/
declare const modelsList_2: (state: ModelsListState, autoUpdate?: boolean) => [element: BUI.Table<ModelsListTableData>, update: BUI.UpdateFunction<ModelsListState>, currentState: () => ModelsListState];
declare interface ModelsListState {
components: OBC.Components;
missingDataMessage?: string;
metaDataTags?: string[];
actions?: {
visibility?: boolean;
download?: boolean;
dispose?: boolean;
};
}
declare type ModelsListTableData = {
Name: string;
modelId: string;
metadata: string;
};
declare const modelsListTemplate: (state: ModelsListState) => BUI.TemplateResult<1>;
export declare const sections: {
topicViewpoints: (state: topicViewpoints.TopicViewpointsSectionUI) => [element: HTMLDivElement, update: UpdateFunction<topicViewpoints.TopicViewpointsSectionUI>, currentState: () => topicViewpoints.TopicViewpointsSectionUI];
topicViewpointsSectionTemplate: StatefullComponent<topicViewpoints.TopicViewpointsSectionUI>;
topicRelations: (state: topicRelations.TopicRelationsSectionsUI) => [element: HTMLDivElement, update: UpdateFunction<topicRelations.TopicRelationsSectionsUI>, currentState: () => topicRelations.TopicRelationsSectionsUI];
topicRelationsSectionTemplate: StatefullComponent<topicRelations.TopicRelationsSectionsUI>;
topicInformation: (state: topicInformation.TopicInformationSectionState) => [element: HTMLDivElement, update: UpdateFunction<topicInformation.TopicInformationSectionState>, currentState: () => topicInformation.TopicInformationSectionState];
topicInformationSectionTemplate: StatefullComponent<topicInformation.TopicInformationSectionState>;
topicComments: (state: topicComments.TopicCommentsSectionState) => [element: HTMLDivElement, update: UpdateFunction<topicComments.TopicCommentsSectionState>, currentState: () => topicComments.TopicCommentsSectionState];
topicCommentsSectionTemplate: StatefullComponent<topicComments.TopicCommentsSectionState>;
};
declare namespace spatialTree {
export {
spatialTree_2 as spatialTree,
spatialTreeTemplate,
SpatialTreeState,
SpatialTreeData
}
}
/**
* Creates a relations tree component with the given state and optional auto-update feature.
*
* @param state - The initial state of the relations tree component.
* @param autoUpdate - A flag indicating whether the component should automatically update when related data changes.
* Default is `true`.
*
* @returns A tuple containing the root element of the relations tree component and a function to update the component's state.
*
* @remarks
* This function creates a relations tree component using the provided state and optional auto-update feature.
* If `autoUpdate` is `true`, the component will automatically update when related data changes, such as
* when fragments are disposed or relations are indexed.
*
*/
declare const spatialTree_2: (state: SpatialTreeState, autoUpdate?: boolean) => [element: BUI.Table<SpatialTreeData>, update: BUI.UpdateFunction<SpatialTreeState>, currentState: () => SpatialTreeState];
declare type SpatialTreeData = {
modelId: string;
localId: number;
Name: string;
children: string;
};
declare interface SpatialTreeState {
components: OBC.Components;
models: Iterable<FRAGS.FragmentsModel>;
selectHighlighterName?: string;
}
declare const spatialTreeTemplate: (state: SpatialTreeState) => BUI.TemplateResult<1>;
export declare const tables: {
commentsList: (state: commentsList.CommentsListState, autoUpdate?: boolean) => [element: Table<commentsList.CommentsListTableData>, update: UpdateFunction<commentsList.CommentsListState>, currentState: () => commentsList.CommentsListState];
commentsListTemplate: StatefullComponent<commentsList.CommentsListState>;
topicsList: (state: topicsList.TopicsListState, autoUpdate?: boolean) => [element: Table<topicsList.TopicsListTableData>, update: UpdateFunction<topicsList.TopicsListState>, currentState: () => topicsList.TopicsListState];
topicsListTemplate: StatefullComponent<topicsList.TopicsListState>;
viewpointsList: (state: viewpointsList.ViewpointsListState, autoUpdate?: boolean) => [element: Table<viewpointsList.ViewpointsListTableData>, update: UpdateFunction<viewpointsList.ViewpointsListState>, currentState: () => viewpointsList.ViewpointsListState];
viewpointsListTemplate: StatefullComponent<viewpointsList.ViewpointsListState>;
modelsList: (state: modelsList.ModelsListState, autoUpdate?: boolean) => [element: Table<modelsList.ModelsListTableData>, update: UpdateFunction<modelsList.ModelsListState>, currentState: () => modelsList.ModelsListState];
modelsListTemplate: (state: modelsList.ModelsListState) => TemplateResult<1>;
itemsData: (state: itemsData.ItemsDataState) => [element: Table<itemsData.ItemsDataTableData>, update: UpdateFunction<itemsData.ItemsDataState>, currentState: () => itemsData.ItemsDataState];
itemsDataTemplate: (_state: itemsData.ItemsDataState) => TemplateResult<1>;
spatialTree: (state: spatialTree.SpatialTreeState, autoUpdate?: boolean) => [element: Table<spatialTree.SpatialTreeData>, update: UpdateFunction<spatialTree.SpatialTreeState>, currentState: () => spatialTree.SpatialTreeState];
spatialTreeTemplate: (state: spatialTree.SpatialTreeState) => TemplateResult<1>;
};
declare namespace topicComments {
export {
topicComments_2 as topicComments,
topicCommentsSectionTemplate,
TopicCommentsSectionActions,
TopicCommentsSectionState
}
}
declare const topicComments_2: (state: TopicCommentsSectionState) => [element: HTMLDivElement, update: BUI.UpdateFunction<TopicCommentsSectionState>, currentState: () => TopicCommentsSectionState];
export declare interface TopicCommentsSectionActions extends CommentsListActions {
add: boolean;
}
export declare interface TopicCommentsSectionState {
topic: OBC.Topic;
showInput?: boolean;
styles?: TopicUserStyles;
actions?: Partial<TopicCommentsSectionActions>;
}
export declare const topicCommentsSectionTemplate: BUI.StatefullComponent<TopicCommentsSectionState>;
export declare interface TopicDataStyles {
[name: string]: {
icon?: string;
style?: Record<string, string>;
};
}
/**
* Represents the UI elements and configuration for a topic form in the OBC system.
*
* @interface TopicFormUI
*/
declare interface TopicFormUI {
/**
* The main components entry point of your app.
*/
components: OBC.Components;
/**
* The topic data to be used in the form. This can be undefined if no topic is being edited.
*/
topic?: OBC.Topic;
/**
* The initial values for the form fields. Can be a partial raw topic object.
*/
value?: Partial<FormValue>;
/**
* Callback function triggered when the form is submitted.
*
* @param {OBC.Topic} topic - The topic created/updated from the form.
* @returns {void | Promise<void>} - A void or a promise that resolves to void.
*/
onSubmit?: (topic: OBC.Topic) => void | Promise<void>;
/**
* Callback function triggered when the form is canceled.
*
* @returns {void | Promise<void>} - A void or a promise that resolves to void.
*/
onCancel?: () => void | Promise<void>;
/**
* Custom styles for the form components.
*/
styles?: Partial<DataStyles>;
}
declare namespace topicInformation {
export {
topicInformation_2 as topicInformation,
topicInformationSectionTemplate,
TopicInformationSectionActions,
TopicInformationSectionState
}
}
declare const topicInformation_2: (state: TopicInformationSectionState) => [element: HTMLDivElement, update: BUI.UpdateFunction<TopicInformationSectionState>, currentState: () => TopicInformationSectionState];
export declare interface TopicInformationSectionActions {
update: boolean;
}
export declare interface TopicInformationSectionState {
components: OBC.Components;
topic: OBC.Topic;
editing?: boolean;
styles?: Partial<TopicStyles>;
actions?: Partial<TopicInformationSectionActions>;
}
export declare const topicInformationSectionTemplate: BUI.StatefullComponent<TopicInformationSectionState>;
declare namespace topicRelations {
export {
topicRelations_2 as topicRelations,
topicRelationsSectionTemplate,
TopicRelationsSectionActions,
TopicRelationsSectionsUI
}
}
declare const topicRelations_2: (state: TopicRelationsSectionsUI) => [element: HTMLDivElement, update: BUI.UpdateFunction<TopicRelationsSectionsUI>, currentState: () => TopicRelationsSectionsUI];
export declare interface TopicRelationsSectionActions {
link: boolean;
}
export declare interface TopicRelationsSectionsUI {
components: OBC.Components;
topic: OBC.Topic;
linking?: boolean;
actions?: Partial<TopicRelationsSectionActions>;
}
export declare const topicRelationsSectionTemplate: BUI.StatefullComponent<TopicRelationsSectionsUI>;
declare namespace topicsList {
export {
topicsList_2 as topicsList,
topicsListTemplate,
TopicsListTableData,
TopicsListState
}
}
/**
* Creates a BCF Topics List component with the given UI state.
*
* @param state - The initial state of the BCF Topics List component.
* @param autoUpdate - A flag indicating whether the component should automatically update based on events happening in the BCFTopic component.
* Default value is `true`.
*
* @returns A tuple containing the created BCF Topics List component and a function to update it.
*/
declare const topicsList_2: (state: TopicsListState, autoUpdate?: boolean) => [element: BUI.Table<TopicsListTableData>, update: BUI.UpdateFunction<TopicsListState>, currentState: () => TopicsListState];
declare interface TopicsListState {
components: OBC.Components;
topics?: Iterable<OBC.Topic>;
dataStyles?: TopicStyles;
missingDataMessage?: string;
}
declare type TopicsListTableData = {
Guid: string;
Title: string;
Status: string;
Description: string;
Author: string;
Assignee: string;
Date: string;
DueDate: string;
Type: string;
Priority: string;
};
declare const topicsListTemplate: BUI.StatefullComponent<TopicsListState>;
export declare interface TopicStyles {
priorities?: TopicDataStyles;
statuses?: TopicDataStyles;
types?: TopicDataStyles;
users?: TopicUserStyles;
}
export declare interface TopicUserStyles {
[email: string]: {
name: string;
picture?: string;
};
}
declare namespace topicViewpoints {
export {
topicViewpoints_2 as topicViewpoints,
topicViewpointsSectionTemplate,
TopicViewpointsSectionActions,
TopicViewpointsSectionUI
}
}
declare const topicViewpoints_2: (state: TopicViewpointsSectionUI) => [element: HTMLDivElement, update: BUI.UpdateFunction<TopicViewpointsSectionUI>, currentState: () => TopicViewpointsSectionUI];
export declare interface TopicViewpointsSectionActions extends ViewpointsListActions {
add: boolean;
link: boolean;
}
export declare const topicViewpointsSectionTemplate: BUI.StatefullComponent<TopicViewpointsSectionUI>;
export declare interface TopicViewpointsSectionUI {
components: OBC.Components;
topic: OBC.Topic;
linking?: boolean;
world?: OBC.World;
actions?: Partial<TopicViewpointsSectionActions>;
}
/**
* A custom 3D view cube component for BIM applications. HTML tag: bim-view-cube
*/
export declare class ViewCube extends LitElement {
/**
* CSS styles for the component.
*/
static styles: CSSResult;
private _defaults;
size?: number;
rightText?: string;
leftText?: string;
topText?: string;
bottomText?: string;
frontText?: string;
backText?: string;
private _cssMatrix3D;
private _matrix;
private _onRightClick;
private _onLeftClick;
private _onTopClick;
private _onBottomClick;
private _onFrontClick;
private _onBackClick;
private _camera;
set camera(value: THREE.Camera | null);
get camera(): THREE.Camera | null;
private _epsilon;
updateOrientation(): void;
protected render(): TemplateResult<1>;
}
declare namespace viewpointsList {
export {
viewpointsList_2 as viewpointsList,
ViewpointsListTableData,
ViewpointsListActions,
ViewpointsListState,
viewpointsListTemplate
}
}
/**
* Creates a Viewpoints component with the given UI state.
*
* @param state - The initial state of the Viewpoints component.
* @param autoUpdate - A flag indicating whether the component should automatically update based on events happening in the BCFTopic component.
* Default value is `true`.
*
* @returns A tuple containing the created Viewpoints component and a function to update it.
*/
declare const viewpointsList_2: (state: ViewpointsListState, autoUpdate?: boolean) => [element: BUI.Table<ViewpointsListTableData>, update: BUI.UpdateFunction<ViewpointsListState>, currentState: () => ViewpointsListState];
declare interface ViewpointsListActions {
selectComponents: boolean;
colorizeComponent: boolean;
resetColors: boolean;
updateCamera: boolean;
delete: boolean;
unlink: boolean;
}
declare interface ViewpointsListState {
components: OBC.Components;
topic?: OBC.Topic;
actions?: Partial<ViewpointsListActions>;
onViewpointEnter?: (viewpoint: OBC.Viewpoint) => void | Promise<void>;
missingDataMessage?: string;
}
declare type ViewpointsListTableData = {
Guid: string;
Title: string;
Actions: string;
};
declare const viewpointsListTemplate: BUI.StatefullComponent<ViewpointsListState>;
/**
* A world for BIM Apps.
* @element bim-world
*/
export declare class World extends LitElement {
static styles: CSSResult;
name?: string;
world: OBC.SimpleWorld<OBC.SimpleScene, OBC.OrthoPerspectiveCamera, OBC.SimpleRenderer> | null;
private _components;
set components(value: OBC.Components | null);
get components(): OBC.Components | null;
private _viewport;
connectedCallback(): void;
disconnectedCallback(): void;
dispose(): void;
firstUpdated(): void;
private onSlotChange;
protected render(): BUI.TemplateResult<1>;
}
/**
* A custom 2D Scene component for BIM applications. HTML tag: bim-world-2d
*/
export declare class World2D extends LitElement {
/**
* CSS styles for the component.
*/
static styles: CSSResult;
private _gridColor?;
set gridColor(value: string | undefined);
get gridColor(): string | undefined;
private _gridScaleX?;
set gridScaleX(value: number | undefined);
get gridScaleX(): number | undefined;
private _gridScaleY?;
set gridScaleY(value: number | undefined);
get gridScaleY(): number | undefined;
get gridOffsetX(): number;
set gridOffsetX(value: number);
get gridOffsetY(): number;
set gridOffsetY(value: number);
private _grid;
set components(components: OBC.Components);
private _world;
get world(): OBC.SimpleWorld<OBC.SimpleScene, OBC.OrthoPerspectiveCamera, OBF.RendererWith2D> | null;
private resize;
dispose(): void;
connectedCallback(): void;
disconnectedCallback(): void;
protected render(): TemplateResult<1>;
}
export { }