* WIP: Performance improvements in entity explorer * WIP: Achieve feature parity for entity explorer with release * Update unit tests * Add sentry profiling to current page entity properties component * Fix page add/delete not showing up on entity explorer issue. Update memoization logic for pagegroup entity * Deal with the ban-ts-ignore eslint issues * Update unit tests * Fix widget entity children visibility * Fix tests and code * Fix tests for scenarios where the collapsed entities are unmount, as this is a part of the performance optimization * Filter undefined children when generating structureDSL * Remove rule from eslintrc Consolidate createPage test command * Update CreatePage tests to remove redundant dsl updates * Revert CreatePage test changes, as adding more checks within this command globally causes other tests to have issues. * re-enable eslint rule, as without it CI tests fail * Revert to ban-ts-comment * Fix typescript ban-ts-ignore issue by upgrading react-scripts and fixing typescript issue across the application * Typescript errors handled Co-authored-by: vicky-primathon.in <vicky.bansal@primathon.in>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
/***
|
|
* Controls are rendered in the property panel from the property config
|
|
* Controls are higher order components that update a widgets property
|
|
*/
|
|
import { Component } from "react";
|
|
import _ from "lodash";
|
|
import { ControlType } from "constants/PropertyControlConstants";
|
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
abstract class BaseControl<P extends ControlProps, S = {}> extends Component<
|
|
P,
|
|
S
|
|
> {
|
|
updateProperty(propertyName: string, propertyValue: any) {
|
|
if (!_.isNil(this.props.onPropertyChange))
|
|
this.props.onPropertyChange(propertyName, propertyValue);
|
|
}
|
|
}
|
|
|
|
export interface ControlBuilder<T extends ControlProps> {
|
|
buildPropertyControl(controlProps: T): JSX.Element;
|
|
}
|
|
|
|
export interface ControlProps extends ControlData, ControlFunctions {
|
|
key?: string;
|
|
}
|
|
|
|
export interface ControlData {
|
|
id: string;
|
|
label: string;
|
|
propertyName: string;
|
|
helpText?: string;
|
|
isJSConvertible?: boolean;
|
|
controlType: ControlType;
|
|
propertyValue?: any;
|
|
isValid: boolean;
|
|
errorMessage?: string;
|
|
expected: string;
|
|
evaluatedValue: any;
|
|
validationMessage?: string;
|
|
dataTreePath?: string;
|
|
}
|
|
|
|
export interface ControlFunctions {
|
|
onPropertyChange?: (propertyName: string, propertyValue: string) => void;
|
|
}
|
|
|
|
export default BaseControl;
|