|
1 | | -import {componentConstructors, IComponentWrapper, registerComponentConstructor} from "./Base.tsx"; |
| 1 | +import {componentConstructors, registerComponentConstructor} from "./Base.tsx"; |
2 | 2 | import * as mui from "@mui/material"; |
3 | 3 | import * as icons from "@mui/icons-material"; |
4 | | -import {GenericComponent} from "./GenericComponent.tsx"; |
5 | 4 | import { DataGrid } from '@mui/x-data-grid'; |
6 | 5 | import Grid2 from "@mui/material/Unstable_Grid2" |
7 | 6 | import { SimpleTreeView, RichTreeView, TreeItem, TreeItem2 } from '@mui/x-tree-view'; |
@@ -58,45 +57,37 @@ const svgTagList = [ |
58 | 57 | "view", |
59 | 58 | ] |
60 | 59 |
|
61 | | -export function registerGenericComponent(id: string, elementType: any) { |
62 | | - registerComponentConstructor(id, class extends GenericComponent { |
63 | | - constructor(props: IComponentWrapper) { |
64 | | - super(elementType, props); |
65 | | - } |
66 | | - }); |
67 | | -} |
68 | | - |
69 | 60 | export function registerDefaultComponents() { |
70 | 61 | for (const tagName of htmlTagList) { |
71 | | - registerGenericComponent("html." + tagName, tagName) |
| 62 | + registerComponentConstructor("html." + tagName, tagName) |
72 | 63 | } |
73 | 64 |
|
74 | 65 | for (const tagName of svgTagList) { |
75 | | - registerGenericComponent("svg." + tagName, tagName) |
| 66 | + registerComponentConstructor("svg." + tagName, tagName) |
76 | 67 | } |
77 | 68 |
|
78 | 69 | for (const id in mui) { |
79 | 70 | if (id.charAt(0).toUpperCase() != id.charAt(0)) continue |
80 | | - registerGenericComponent("mui." + id, (mui as any)[id]) |
| 71 | + registerComponentConstructor("mui." + id, (mui as any)[id]) |
81 | 72 | } |
82 | 73 |
|
83 | 74 | for (const id in icons) { |
84 | 75 | if (id.charAt(0).toUpperCase() != id.charAt(0)) continue |
85 | | - registerGenericComponent("mui.icons." + id, (icons as any)[id]) |
| 76 | + registerComponentConstructor("mui.icons." + id, (icons as any)[id]) |
86 | 77 | } |
87 | 78 |
|
88 | | - registerGenericComponent("mui.DataGrid", DataGrid) |
89 | | - registerGenericComponent("mui.Grid2", Grid2) |
90 | | - registerGenericComponent("mui.SimpleTreeView", SimpleTreeView) |
91 | | - registerGenericComponent("mui.RichTreeView", RichTreeView) |
92 | | - registerGenericComponent("mui.TreeItem", TreeItem) |
93 | | - registerGenericComponent("mui.TreeItem2", TreeItem2) |
94 | | - registerGenericComponent("modelix.Dropdown", Dropdown) |
95 | | - registerGenericComponent("modelix.ReferenceTargetChooser", ReferenceTargetChooser) |
96 | | - registerGenericComponent("modelix.TextField", ModelixTextField) |
97 | | - registerGenericComponent("modelix.Spreadsheet", ModelixSpreadsheet) |
98 | | - registerGenericComponent("modelix.TextEditor", ModelixTextEditor) |
99 | | - registerGenericComponent("modelix.ImageBasedEditor", ModelixImageBasedEditor) |
| 79 | + registerComponentConstructor("mui.DataGrid", DataGrid) |
| 80 | + registerComponentConstructor("mui.Grid2", Grid2) |
| 81 | + registerComponentConstructor("mui.SimpleTreeView", SimpleTreeView) |
| 82 | + registerComponentConstructor("mui.RichTreeView", RichTreeView) |
| 83 | + registerComponentConstructor("mui.TreeItem", TreeItem) |
| 84 | + registerComponentConstructor("mui.TreeItem2", TreeItem2) |
| 85 | + registerComponentConstructor("modelix.Dropdown", Dropdown) |
| 86 | + registerComponentConstructor("modelix.ReferenceTargetChooser", ReferenceTargetChooser) |
| 87 | + registerComponentConstructor("modelix.TextField", ModelixTextField) |
| 88 | + registerComponentConstructor("modelix.Spreadsheet", ModelixSpreadsheet) |
| 89 | + registerComponentConstructor("modelix.TextEditor", ModelixTextEditor) |
| 90 | + registerComponentConstructor("modelix.ImageBasedEditor", ModelixImageBasedEditor) |
100 | 91 |
|
101 | 92 | const xhr = new XMLHttpRequest(); |
102 | 93 | xhr.open("POST", window.location + "../../../known-components", true); |
|
0 commit comments