Skip to content

Commit f2ae396

Browse files
committed
feat(core): add set method to configurator
1 parent 19cc299 commit f2ae396

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thatopen/components",
33
"description": "Collection of core functionalities to author BIM apps.",
4-
"version": "2.4.0-alpha.23",
4+
"version": "2.4.0-alpha.27",
55
"author": "That Open Company",
66
"contributors": [
77
"Antonio Gonzalez Viegas (https://github.com/agviegas)",

packages/core/src/core/ConfigManager/src/configurator.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ export abstract class Configurator<
4848
configManager.list.set(this.uuid, this);
4949
}
5050

51+
set(data: Partial<U>) {
52+
for (const name in data) {
53+
if (name in this) {
54+
const key = name as keyof this;
55+
this[key] = (data[name] as any).value;
56+
}
57+
}
58+
}
59+
5160
copyEntry(controlEntry: ControlEntry): ControlEntry {
5261
if (controlEntry.type === "Boolean") {
5362
const entry = controlEntry as BooleanSettingsControl;

packages/core/src/core/Types/src/component-with-ui.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { Component } from "./component";
22
import { Configurator } from "../../ConfigManager";
3+
import { Components } from "../../Components";
34

45
export type ComponentUIElement = {
56
name: string;
67
id: string;
78
icon: string;
89
componentID: string;
9-
get: () => { element: HTMLElement; config?: Configurator<any, any> };
10+
get: (components: Components) => {
11+
element: HTMLElement;
12+
config?: Configurator;
13+
};
1014
};
1115

1216
export abstract class ComponentWithUI extends Component {

packages/front/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thatopen/components-front",
33
"description": "Collection of frontend tools to author BIM apps.",
4-
"version": "2.4.0-alpha.23",
4+
"version": "2.4.0-alpha.27",
55
"author": "That Open Company",
66
"contributors": [
77
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
@@ -47,7 +47,7 @@
4747
"web-ifc": "0.0.61"
4848
},
4949
"dependencies": {
50-
"@thatopen/components": ">=2.4.0-alpha.21",
50+
"@thatopen/components": ">=2.4.0-alpha.27",
5151
"camera-controls": "2.7.3",
5252
"dexie": "^4.0.4",
5353
"earcut": "^2.2.4",

0 commit comments

Comments
 (0)