Skip to content

Commit

Permalink
feat(core): add set method to configurator
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Nov 5, 2024
1 parent 19cc299 commit f2ae396
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components",
"description": "Collection of core functionalities to author BIM apps.",
"version": "2.4.0-alpha.23",
"version": "2.4.0-alpha.27",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/core/ConfigManager/src/configurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ export abstract class Configurator<
configManager.list.set(this.uuid, this);
}

set(data: Partial<U>) {
for (const name in data) {
if (name in this) {
const key = name as keyof this;
this[key] = (data[name] as any).value;
}
}
}

copyEntry(controlEntry: ControlEntry): ControlEntry {
if (controlEntry.type === "Boolean") {
const entry = controlEntry as BooleanSettingsControl;
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/core/Types/src/component-with-ui.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Component } from "./component";
import { Configurator } from "../../ConfigManager";
import { Components } from "../../Components";

export type ComponentUIElement = {
name: string;
id: string;
icon: string;
componentID: string;
get: () => { element: HTMLElement; config?: Configurator<any, any> };
get: (components: Components) => {
element: HTMLElement;
config?: Configurator;
};
};

export abstract class ComponentWithUI extends Component {
Expand Down
4 changes: 2 additions & 2 deletions packages/front/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components-front",
"description": "Collection of frontend tools to author BIM apps.",
"version": "2.4.0-alpha.23",
"version": "2.4.0-alpha.27",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down Expand Up @@ -47,7 +47,7 @@
"web-ifc": "0.0.61"
},
"dependencies": {
"@thatopen/components": ">=2.4.0-alpha.21",
"@thatopen/components": ">=2.4.0-alpha.27",
"camera-controls": "2.7.3",
"dexie": "^4.0.4",
"earcut": "^2.2.4",
Expand Down

0 comments on commit f2ae396

Please sign in to comment.