2019-11-13 07:00:25 +00:00
|
|
|
/**
|
2019-02-10 13:06:05 +00:00
|
|
|
* Widget are responsible for accepting the abstraction layer inputs, interpretting them into rederable props and
|
|
|
|
|
* spawing components based on those props
|
|
|
|
|
* Widgets are also responsible for dispatching actions and updating the state tree
|
|
|
|
|
*/
|
2019-03-18 15:10:30 +00:00
|
|
|
import {
|
|
|
|
|
WidgetType,
|
|
|
|
|
RenderMode,
|
2019-03-19 14:05:48 +00:00
|
|
|
RenderModes,
|
2019-09-09 09:08:54 +00:00
|
|
|
CSSUnits,
|
2019-11-25 05:07:27 +00:00
|
|
|
} from "constants/WidgetConstants";
|
2020-03-27 09:02:11 +00:00
|
|
|
import React, { Component, ReactNode } from "react";
|
2020-01-16 11:46:21 +00:00
|
|
|
import {
|
|
|
|
|
PositionType,
|
|
|
|
|
CSSUnit,
|
|
|
|
|
CONTAINER_GRID_PADDING,
|
|
|
|
|
} from "constants/WidgetConstants";
|
2019-11-13 07:00:25 +00:00
|
|
|
import DraggableComponent from "components/editorComponents/DraggableComponent";
|
|
|
|
|
import ResizableComponent from "components/editorComponents/ResizableComponent";
|
2020-02-18 10:41:52 +00:00
|
|
|
import { ExecuteActionPayload } from "constants/ActionConstants";
|
2019-11-13 07:00:25 +00:00
|
|
|
import PositionedContainer from "components/designSystems/appsmith/PositionedContainer";
|
2020-03-27 09:02:11 +00:00
|
|
|
import WidgetNameComponent from "components/editorComponents/WidgetNameComponent";
|
2019-11-04 14:22:50 +00:00
|
|
|
import shallowequal from "shallowequal";
|
2019-11-13 07:00:25 +00:00
|
|
|
import { PositionTypes } from "constants/WidgetConstants";
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
import { EditorContext } from "components/editorComponents/EditorContextProvider";
|
2019-11-25 05:07:27 +00:00
|
|
|
import ErrorBoundary from "components/editorComponents/ErrorBoundry";
|
2020-03-16 07:59:07 +00:00
|
|
|
import {
|
|
|
|
|
BASE_WIDGET_VALIDATION,
|
|
|
|
|
WidgetPropertyValidationType,
|
2020-10-21 04:25:32 +00:00
|
|
|
} from "utils/WidgetValidation";
|
2021-02-25 14:00:02 +00:00
|
|
|
import { DerivedPropertiesMap } from "utils/WidgetFactory";
|
2020-11-12 11:23:32 +00:00
|
|
|
import {
|
|
|
|
|
WidgetDynamicPathListProps,
|
|
|
|
|
WidgetEvaluatedProps,
|
|
|
|
|
} from "../utils/DynamicBindingUtils";
|
2021-03-01 09:45:54 +00:00
|
|
|
import { BatchPropertyUpdatePayload } from "actions/controlActions";
|
2020-03-06 09:45:21 +00:00
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
/***
|
|
|
|
|
* BaseWidget
|
|
|
|
|
*
|
|
|
|
|
* The abstract class which is extended/implemented by all widgets.
|
|
|
|
|
* Widgets must adhere to the abstractions provided by BaseWidget.
|
|
|
|
|
*
|
|
|
|
|
* Do not:
|
|
|
|
|
* 1) Use the context directly in the widgets
|
|
|
|
|
* 2) Update or access the dsl in the widgets
|
|
|
|
|
* 3) Call actions in widgets or connect the widgets to the entity reducers
|
|
|
|
|
*
|
|
|
|
|
*/
|
2019-02-11 18:22:23 +00:00
|
|
|
abstract class BaseWidget<
|
2019-10-03 16:24:29 +00:00
|
|
|
T extends WidgetProps,
|
2019-09-09 09:08:54 +00:00
|
|
|
K extends WidgetState
|
2019-04-02 16:12:08 +00:00
|
|
|
> extends Component<T, K> {
|
2019-11-13 07:00:25 +00:00
|
|
|
static contextType = EditorContext;
|
|
|
|
|
|
2019-11-19 12:44:58 +00:00
|
|
|
// Needed to send a default no validation option. In case a widget needs
|
|
|
|
|
// validation implement this in the widget class again
|
|
|
|
|
static getPropertyValidationMap(): WidgetPropertyValidationType {
|
2020-03-16 07:59:07 +00:00
|
|
|
return BASE_WIDGET_VALIDATION;
|
2019-11-19 12:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
2020-01-17 09:28:26 +00:00
|
|
|
static getDerivedPropertiesMap(): DerivedPropertiesMap {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-17 16:15:09 +00:00
|
|
|
static getDefaultPropertiesMap(): Record<string, string> {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
2021-01-04 10:16:08 +00:00
|
|
|
// TODO Find a way to enforce this, (dont let it be set)
|
2020-04-21 07:54:23 +00:00
|
|
|
static getMetaPropertiesMap(): Record<string, any> {
|
2020-04-17 16:15:09 +00:00
|
|
|
return {};
|
2020-02-18 10:41:52 +00:00
|
|
|
}
|
|
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
/**
|
|
|
|
|
* Widget abstraction to register the widget type
|
|
|
|
|
* ```javascript
|
|
|
|
|
* getWidgetType() {
|
|
|
|
|
* return "MY_AWESOME_WIDGET",
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
|
|
|
|
abstract getWidgetType(): WidgetType;
|
2019-10-03 16:24:29 +00:00
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
/**
|
|
|
|
|
* Widgets can execute actions using this `executeAction` method.
|
|
|
|
|
* Triggers may be specific to the widget
|
|
|
|
|
*/
|
2020-02-18 10:41:52 +00:00
|
|
|
executeAction(actionPayload: ExecuteActionPayload): void {
|
2019-10-03 16:24:29 +00:00
|
|
|
const { executeAction } = this.context;
|
2020-02-18 10:41:52 +00:00
|
|
|
executeAction && executeAction(actionPayload);
|
2019-10-03 16:24:29 +00:00
|
|
|
}
|
|
|
|
|
|
2020-01-09 11:39:26 +00:00
|
|
|
disableDrag(disable: boolean) {
|
|
|
|
|
const { disableDrag } = this.context;
|
|
|
|
|
disableDrag && disable !== undefined && disableDrag(disable);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-15 11:42:11 +00:00
|
|
|
updateWidget(
|
|
|
|
|
operationName: string,
|
|
|
|
|
widgetId: string,
|
|
|
|
|
widgetProperties: any,
|
|
|
|
|
): void {
|
|
|
|
|
const { updateWidget } = this.context;
|
|
|
|
|
updateWidget && updateWidget(operationName, widgetId, widgetProperties);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-16 10:29:08 +00:00
|
|
|
deleteWidgetProperty(propertyPaths: string[]): void {
|
|
|
|
|
const { deleteWidgetProperty } = this.context;
|
|
|
|
|
const { widgetId } = this.props;
|
|
|
|
|
if (deleteWidgetProperty && widgetId) {
|
|
|
|
|
deleteWidgetProperty(widgetId, propertyPaths);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-01 09:45:54 +00:00
|
|
|
batchUpdateWidgetProperty(updates: BatchPropertyUpdatePayload): void {
|
2021-02-16 10:29:08 +00:00
|
|
|
const { batchUpdateWidgetProperty } = this.context;
|
|
|
|
|
const { widgetId } = this.props;
|
|
|
|
|
if (batchUpdateWidgetProperty && widgetId) {
|
|
|
|
|
batchUpdateWidgetProperty(widgetId, updates);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-11 10:13:06 +00:00
|
|
|
updateWidgetProperty(propertyName: string, propertyValue: any): void {
|
2019-11-07 11:17:53 +00:00
|
|
|
const { updateWidgetProperty } = this.context;
|
2020-02-11 10:13:06 +00:00
|
|
|
const { widgetId } = this.props;
|
2020-11-11 11:32:14 +00:00
|
|
|
if (updateWidgetProperty && widgetId) {
|
2019-11-07 11:17:53 +00:00
|
|
|
updateWidgetProperty(widgetId, propertyName, propertyValue);
|
2020-11-11 11:32:14 +00:00
|
|
|
}
|
2019-11-07 11:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 09:45:21 +00:00
|
|
|
resetChildrenMetaProperty(widgetId: string) {
|
|
|
|
|
const { resetChildrenMetaProperty } = this.context;
|
|
|
|
|
resetChildrenMetaProperty(widgetId);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2020-03-27 09:02:11 +00:00
|
|
|
componentDidUpdate(prevProps: T) {}
|
|
|
|
|
|
|
|
|
|
componentDidMount(): void {}
|
|
|
|
|
/* eslint-enable @typescript-eslint/no-empty-function */
|
|
|
|
|
|
|
|
|
|
getComponentDimensions = () => {
|
|
|
|
|
return this.calculateWidgetBounds(
|
2019-03-19 14:47:18 +00:00
|
|
|
this.props.rightColumn,
|
|
|
|
|
this.props.leftColumn,
|
|
|
|
|
this.props.topRow,
|
|
|
|
|
this.props.bottomRow,
|
|
|
|
|
this.props.parentColumnSpace,
|
2019-09-09 09:08:54 +00:00
|
|
|
this.props.parentRowSpace,
|
|
|
|
|
);
|
2020-03-27 09:02:11 +00:00
|
|
|
};
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2019-02-11 18:22:23 +00:00
|
|
|
calculateWidgetBounds(
|
|
|
|
|
rightColumn: number,
|
|
|
|
|
leftColumn: number,
|
|
|
|
|
topRow: number,
|
|
|
|
|
bottomRow: number,
|
|
|
|
|
parentColumnSpace: number,
|
2019-09-09 09:08:54 +00:00
|
|
|
parentRowSpace: number,
|
2020-04-03 04:48:40 +00:00
|
|
|
): {
|
|
|
|
|
componentWidth: number;
|
|
|
|
|
componentHeight: number;
|
|
|
|
|
} {
|
2020-03-27 09:02:11 +00:00
|
|
|
return {
|
2019-09-25 17:24:23 +00:00
|
|
|
componentWidth: (rightColumn - leftColumn) * parentColumnSpace,
|
|
|
|
|
componentHeight: (bottomRow - topRow) * parentRowSpace,
|
2019-09-09 09:08:54 +00:00
|
|
|
};
|
2019-02-11 18:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
2020-03-17 09:01:29 +00:00
|
|
|
return this.getWidgetView();
|
2019-02-11 18:22:23 +00:00
|
|
|
}
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
makeResizable(content: ReactNode) {
|
|
|
|
|
return (
|
|
|
|
|
<ResizableComponent
|
|
|
|
|
{...this.props}
|
|
|
|
|
paddingOffset={PositionedContainer.padding}
|
|
|
|
|
>
|
|
|
|
|
{content}
|
|
|
|
|
</ResizableComponent>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
showWidgetName(content: ReactNode, showControls = false) {
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<WidgetNameComponent
|
|
|
|
|
widgetName={this.props.widgetName}
|
|
|
|
|
widgetId={this.props.widgetId}
|
|
|
|
|
parentId={this.props.parentId}
|
|
|
|
|
type={this.props.type}
|
|
|
|
|
showControls={showControls}
|
|
|
|
|
/>
|
|
|
|
|
{content}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makeDraggable(content: ReactNode) {
|
|
|
|
|
return <DraggableComponent {...this.props}>{content}</DraggableComponent>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makePositioned(content: ReactNode) {
|
|
|
|
|
const style = this.getPositionStyle();
|
|
|
|
|
return (
|
2020-05-21 06:15:12 +00:00
|
|
|
<PositionedContainer
|
|
|
|
|
widgetId={this.props.widgetId}
|
|
|
|
|
widgetType={this.props.type}
|
|
|
|
|
style={style}
|
|
|
|
|
>
|
2020-03-27 09:02:11 +00:00
|
|
|
{content}
|
|
|
|
|
</PositionedContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-21 06:14:50 +00:00
|
|
|
addErrorBoundary(content: ReactNode) {
|
|
|
|
|
return <ErrorBoundary>{content}</ErrorBoundary>;
|
2020-03-27 09:02:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getWidgetView(): ReactNode {
|
|
|
|
|
let content: ReactNode;
|
2019-03-18 15:10:30 +00:00
|
|
|
switch (this.props.renderMode) {
|
|
|
|
|
case RenderModes.CANVAS:
|
2020-03-27 09:02:11 +00:00
|
|
|
content = this.getCanvasView();
|
|
|
|
|
if (!this.props.detachFromLayout) {
|
|
|
|
|
content = this.makeResizable(content);
|
|
|
|
|
content = this.showWidgetName(content);
|
|
|
|
|
content = this.makeDraggable(content);
|
|
|
|
|
content = this.makePositioned(content);
|
2019-11-13 07:00:25 +00:00
|
|
|
}
|
2020-03-27 09:02:11 +00:00
|
|
|
return content;
|
|
|
|
|
|
|
|
|
|
// return this.getCanvasView();
|
2019-03-18 15:10:30 +00:00
|
|
|
case RenderModes.PAGE:
|
2020-03-27 09:02:11 +00:00
|
|
|
content = this.getPageView();
|
2019-11-13 07:00:25 +00:00
|
|
|
if (this.props.isVisible) {
|
2020-12-21 06:14:50 +00:00
|
|
|
content = this.addErrorBoundary(content);
|
2020-03-27 09:02:11 +00:00
|
|
|
if (!this.props.detachFromLayout) {
|
|
|
|
|
content = this.makePositioned(content);
|
|
|
|
|
}
|
|
|
|
|
return content;
|
2019-11-13 07:00:25 +00:00
|
|
|
}
|
|
|
|
|
return <React.Fragment />;
|
2019-03-18 15:10:30 +00:00
|
|
|
default:
|
2019-11-13 07:00:25 +00:00
|
|
|
throw Error("RenderMode not defined");
|
2019-03-18 15:10:30 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
abstract getPageView(): ReactNode;
|
2019-03-18 15:10:30 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
getCanvasView(): ReactNode {
|
|
|
|
|
const content = this.getPageView();
|
2020-12-21 06:14:50 +00:00
|
|
|
return this.addErrorBoundary(content);
|
2019-03-18 15:10:30 +00:00
|
|
|
}
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// TODO(abhinav): Maybe make this a pure component to bailout from updating altogether.
|
|
|
|
|
// This would involve making all widgets which have "states" to not have states,
|
|
|
|
|
// as they're extending this one.
|
2020-04-13 08:24:13 +00:00
|
|
|
shouldComponentUpdate(nextProps: WidgetProps, nextState: WidgetState) {
|
|
|
|
|
return (
|
|
|
|
|
!shallowequal(nextProps, this.props) ||
|
|
|
|
|
!shallowequal(nextState, this.state)
|
|
|
|
|
);
|
2019-11-04 14:22:50 +00:00
|
|
|
}
|
|
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
private getPositionStyle(): BaseStyle {
|
2020-03-27 09:02:11 +00:00
|
|
|
const { componentHeight, componentWidth } = this.getComponentDimensions();
|
2019-03-19 14:05:48 +00:00
|
|
|
return {
|
2019-11-13 07:00:25 +00:00
|
|
|
positionType: PositionTypes.ABSOLUTE,
|
2020-03-27 09:02:11 +00:00
|
|
|
componentHeight,
|
|
|
|
|
componentWidth,
|
2020-01-16 11:46:21 +00:00
|
|
|
yPosition:
|
|
|
|
|
this.props.topRow * this.props.parentRowSpace + CONTAINER_GRID_PADDING,
|
|
|
|
|
xPosition:
|
|
|
|
|
this.props.leftColumn * this.props.parentColumnSpace +
|
|
|
|
|
CONTAINER_GRID_PADDING,
|
2019-03-19 14:05:48 +00:00
|
|
|
xPositionUnit: CSSUnits.PIXEL,
|
2019-09-09 09:08:54 +00:00
|
|
|
yPositionUnit: CSSUnits.PIXEL,
|
|
|
|
|
};
|
2019-03-19 14:05:48 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// TODO(abhinav): These defaultProps seem unneccessary. Check it out.
|
|
|
|
|
static defaultProps: Partial<WidgetProps> | undefined = {
|
2019-09-19 22:25:37 +00:00
|
|
|
parentRowSpace: 1,
|
|
|
|
|
parentColumnSpace: 1,
|
2019-03-19 14:47:18 +00:00
|
|
|
topRow: 0,
|
2019-09-09 09:08:54 +00:00
|
|
|
leftColumn: 0,
|
|
|
|
|
};
|
2019-02-11 18:22:23 +00:00
|
|
|
}
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
export interface BaseStyle {
|
|
|
|
|
componentHeight: number;
|
|
|
|
|
componentWidth: number;
|
|
|
|
|
positionType: PositionType;
|
|
|
|
|
xPosition: number;
|
|
|
|
|
yPosition: number;
|
|
|
|
|
xPositionUnit: CSSUnit;
|
|
|
|
|
yPositionUnit: CSSUnit;
|
|
|
|
|
heightUnit?: CSSUnit;
|
|
|
|
|
widthUnit?: CSSUnit;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-12 13:06:05 +00:00
|
|
|
export type WidgetState = Record<string, unknown>;
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2020-04-13 08:24:13 +00:00
|
|
|
export interface WidgetBuilder<T extends WidgetProps, S extends WidgetState> {
|
2019-09-17 10:11:50 +00:00
|
|
|
buildWidget(widgetProps: T): JSX.Element;
|
2019-02-10 13:06:05 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export interface WidgetBaseProps {
|
2019-09-12 08:11:25 +00:00
|
|
|
widgetId: string;
|
2019-09-17 10:09:00 +00:00
|
|
|
type: WidgetType;
|
2019-09-12 08:11:25 +00:00
|
|
|
widgetName: string;
|
2020-03-27 09:02:11 +00:00
|
|
|
parentId: string;
|
|
|
|
|
renderMode: RenderMode;
|
2021-02-23 12:35:09 +00:00
|
|
|
version: number;
|
2020-03-27 09:02:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type WidgetRowCols = {
|
2019-08-29 11:22:09 +00:00
|
|
|
leftColumn: number;
|
|
|
|
|
rightColumn: number;
|
2020-03-27 09:02:11 +00:00
|
|
|
topRow: number;
|
|
|
|
|
bottomRow: number;
|
|
|
|
|
minHeight?: number; // Required to reduce the size of CanvasWidgets.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export interface WidgetPositionProps extends WidgetRowCols {
|
2019-08-29 11:22:09 +00:00
|
|
|
parentColumnSpace: number;
|
|
|
|
|
parentRowSpace: number;
|
2020-03-27 09:02:11 +00:00
|
|
|
// The detachFromLayout flag tells use about the following properties when enabled
|
|
|
|
|
// 1) Widget does not drag/resize
|
|
|
|
|
// 2) Widget CAN (but not neccessarily) be a dropTarget
|
|
|
|
|
// Examples: MainContainer is detached from layout,
|
|
|
|
|
// MODAL_WIDGET is also detached from layout.
|
|
|
|
|
detachFromLayout?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-21 04:25:32 +00:00
|
|
|
export const WIDGET_STATIC_PROPS = {
|
|
|
|
|
leftColumn: true,
|
|
|
|
|
rightColumn: true,
|
|
|
|
|
topRow: true,
|
|
|
|
|
bottomRow: true,
|
|
|
|
|
minHeight: true,
|
|
|
|
|
parentColumnSpace: true,
|
|
|
|
|
parentRowSpace: true,
|
|
|
|
|
children: true,
|
|
|
|
|
type: true,
|
|
|
|
|
widgetId: true,
|
|
|
|
|
widgetName: true,
|
|
|
|
|
parentId: true,
|
|
|
|
|
renderMode: true,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export interface WidgetDisplayProps {
|
|
|
|
|
//TODO(abhinav): Some of these props are mandatory
|
2019-09-13 10:45:49 +00:00
|
|
|
isVisible?: boolean;
|
2019-11-20 08:10:01 +00:00
|
|
|
isLoading: boolean;
|
2019-11-13 07:00:25 +00:00
|
|
|
isDisabled?: boolean;
|
2019-10-08 09:09:30 +00:00
|
|
|
backgroundColor?: string;
|
2019-02-10 13:06:05 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export interface WidgetDataProps
|
|
|
|
|
extends WidgetBaseProps,
|
|
|
|
|
WidgetPositionProps,
|
|
|
|
|
WidgetDisplayProps {}
|
|
|
|
|
|
2020-11-12 11:23:32 +00:00
|
|
|
export interface WidgetProps
|
|
|
|
|
extends WidgetDataProps,
|
|
|
|
|
WidgetDynamicPathListProps,
|
|
|
|
|
WidgetEvaluatedProps {
|
2020-03-27 09:02:11 +00:00
|
|
|
key?: string;
|
|
|
|
|
isDefaultClickDisabled?: boolean;
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
}
|
2019-09-17 10:11:50 +00:00
|
|
|
|
2019-09-06 09:30:22 +00:00
|
|
|
export interface WidgetCardProps {
|
2019-09-17 10:09:00 +00:00
|
|
|
type: WidgetType;
|
2019-08-29 11:22:09 +00:00
|
|
|
key?: string;
|
2019-09-26 11:37:09 +00:00
|
|
|
widgetCardName: string;
|
2019-08-21 12:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
2019-09-19 22:25:37 +00:00
|
|
|
export const WidgetOperations = {
|
|
|
|
|
MOVE: "MOVE",
|
|
|
|
|
RESIZE: "RESIZE",
|
|
|
|
|
ADD_CHILD: "ADD_CHILD",
|
|
|
|
|
UPDATE_PROPERTY: "UPDATE_PROPERTY",
|
|
|
|
|
DELETE: "DELETE",
|
2020-09-16 10:28:01 +00:00
|
|
|
ADD_CHILDREN: "ADD_CHILDREN",
|
2019-09-17 15:09:55 +00:00
|
|
|
};
|
|
|
|
|
|
2019-11-22 14:02:55 +00:00
|
|
|
export type WidgetOperation = typeof WidgetOperations[keyof typeof WidgetOperations];
|
2019-09-17 15:09:55 +00:00
|
|
|
|
2019-09-09 09:08:54 +00:00
|
|
|
export default BaseWidget;
|