2019-09-18 10:19:50 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import PropertyControlFactory from "./PropertyControlFactory";
|
2020-04-14 05:35:16 +00:00
|
|
|
import {
|
|
|
|
|
PropertyControls,
|
|
|
|
|
PropertyControlPropsType,
|
|
|
|
|
} from "components/propertyControls";
|
|
|
|
|
import BaseControl from "components/propertyControls/BaseControl";
|
2019-09-18 10:19:50 +00:00
|
|
|
class PropertyControlRegistry {
|
|
|
|
|
static registerPropertyControlBuilders() {
|
2020-04-14 05:35:16 +00:00
|
|
|
Object.values(PropertyControls).forEach(
|
|
|
|
|
(Control: typeof BaseControl & { getControlType: () => string }) => {
|
|
|
|
|
const controlType = Control.getControlType();
|
2022-06-03 05:07:02 +00:00
|
|
|
PropertyControlFactory.registerControlBuilder(
|
|
|
|
|
controlType,
|
|
|
|
|
{
|
|
|
|
|
buildPropertyControl(
|
|
|
|
|
controlProps: PropertyControlPropsType,
|
|
|
|
|
): JSX.Element {
|
|
|
|
|
return <Control {...controlProps} />;
|
|
|
|
|
},
|
2020-04-14 05:35:16 +00:00
|
|
|
},
|
2022-06-03 05:07:02 +00:00
|
|
|
Control.canDisplayValueInUI,
|
2022-06-28 12:23:03 +00:00
|
|
|
Control.getInputComputedValue,
|
2022-06-03 05:07:02 +00:00
|
|
|
);
|
2020-04-14 05:35:16 +00:00
|
|
|
},
|
|
|
|
|
);
|
2019-09-18 10:19:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default PropertyControlRegistry;
|