added action events to widgets
This commit is contained in:
parent
a33074af79
commit
6bd89d65a1
|
|
@ -1,5 +1,4 @@
|
|||
import Api, { HttpMethod } from "./Api"
|
||||
import { ContainerWidgetProps } from "../widgets/ContainerWidget"
|
||||
import { ApiResponse } from "./ApiResponses"
|
||||
import { APIRequest } from './ApiRequests';
|
||||
|
||||
|
|
@ -25,36 +24,33 @@ export interface QueryConfig {
|
|||
queryString: string
|
||||
}
|
||||
|
||||
export interface PageResponse extends ApiResponse {
|
||||
pageWidget: ContainerWidgetProps<any>;
|
||||
export interface ActionCreatedResponse extends ApiResponse {
|
||||
actionId: string
|
||||
}
|
||||
|
||||
export interface SavePageResponse {
|
||||
pageId: string;
|
||||
export interface ActionUpdatedResponse extends ActionCreatedResponse {
|
||||
|
||||
}
|
||||
|
||||
class ActionAPI extends Api {
|
||||
static url = "/actions"
|
||||
|
||||
static createAPI(createAPI: CreateActionRequest<APIConfig>): Promise<PageResponse> {
|
||||
static createAPI(createAPI: CreateActionRequest<APIConfig>): Promise<ActionCreatedResponse> {
|
||||
return Api.post(ActionAPI.url, createAPI)
|
||||
}
|
||||
|
||||
static updateAPI(updateAPI: UpdateActionRequest<APIConfig>): Promise<PageResponse> {
|
||||
static updateAPI(updateAPI: UpdateActionRequest<APIConfig>): Promise<ActionUpdatedResponse> {
|
||||
return Api.post(ActionAPI.url, updateAPI)
|
||||
}
|
||||
|
||||
static createQuery(createQuery: CreateActionRequest<QueryConfig>): Promise<PageResponse> {
|
||||
static createQuery(createQuery: CreateActionRequest<QueryConfig>): Promise<ActionCreatedResponse> {
|
||||
return Api.post(ActionAPI.url, createQuery)
|
||||
}
|
||||
|
||||
static updateQuery(updateQuery: UpdateActionRequest<QueryConfig>): Promise<PageResponse> {
|
||||
static updateQuery(updateQuery: UpdateActionRequest<QueryConfig>): Promise<ActionUpdatedResponse> {
|
||||
return Api.post(ActionAPI.url, updateQuery)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export default ActionAPI
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export type ActionType =
|
|||
| "EXECUTE_JS"
|
||||
| "SET_VALUE"
|
||||
| "DOWNLOAD_DATA"
|
||||
|
||||
|
||||
export interface ActionPayload {
|
||||
actionType: ActionType
|
||||
contextParams: Record<string, string>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import React from "react";
|
|||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||
import { WidgetType } from "../constants/WidgetConstants";
|
||||
import CalloutComponent from "../editorComponents/CalloutComponent";
|
||||
import { ActionPayload } from '../constants/ActionConstants';
|
||||
|
||||
class AlertWidget extends BaseWidget<AlertWidgetProps, IWidgetState> {
|
||||
getPageView() {
|
||||
|
|
@ -23,6 +24,7 @@ export interface AlertWidgetProps extends IWidgetProps {
|
|||
intent: MessageIntent
|
||||
header: string
|
||||
message: string
|
||||
onPrimaryClick: ActionPayload[]
|
||||
}
|
||||
|
||||
export default AlertWidget;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import * as React from "react"
|
|||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||
import { WidgetType } from "../constants/WidgetConstants"
|
||||
import ButtonComponent from "../editorComponents/ButtonComponent"
|
||||
import { ActionPayload } from '../constants/ActionConstants';
|
||||
|
||||
class ButtonWidget extends BaseWidget<ButtonWidgetProps, IWidgetState> {
|
||||
|
||||
|
|
@ -21,13 +22,12 @@ class ButtonWidget extends BaseWidget<ButtonWidgetProps, IWidgetState> {
|
|||
}
|
||||
}
|
||||
|
||||
export
|
||||
|
||||
export type ButtonStyle = "PRIMARY_BUTTON" | "SECONDARY_BUTTON" | "SUCCESS_BUTTON" | "DANGER_BUTTON"
|
||||
|
||||
export interface ButtonWidgetProps extends IWidgetProps {
|
||||
text?: string;
|
||||
buttonStyle?: ButtonStyle
|
||||
onClick?: ActionPayload[]
|
||||
}
|
||||
|
||||
export default ButtonWidget
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import React from "react"
|
|||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||
import { WidgetType } from "../constants/WidgetConstants"
|
||||
import CheckboxComponent from "../editorComponents/CheckboxComponent"
|
||||
import { ActionPayload } from '../constants/ActionConstants';
|
||||
|
||||
class CheckboxWidget extends BaseWidget<CheckboxWidgetProps, IWidgetState> {
|
||||
getPageView() {
|
||||
|
|
@ -24,6 +25,7 @@ class CheckboxWidget extends BaseWidget<CheckboxWidgetProps, IWidgetState> {
|
|||
export interface CheckboxWidgetProps extends IWidgetProps {
|
||||
label: string
|
||||
defaultCheckedState: boolean
|
||||
onCheckChange?: ActionPayload[]
|
||||
}
|
||||
|
||||
export default CheckboxWidget
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from "react";
|
||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||
import { WidgetType } from "../constants/WidgetConstants";
|
||||
import { Moment } from 'moment';
|
||||
import { ActionPayload } from '../constants/ActionConstants';
|
||||
|
||||
class DatePickerWidget extends BaseWidget<
|
||||
DatePickerWidgetProps,
|
||||
|
|
@ -29,6 +29,8 @@ export interface DatePickerWidgetProps extends IWidgetProps {
|
|||
enableTime: boolean
|
||||
label: string
|
||||
datePickerType: DatePickerType
|
||||
onDateSelected: ActionPayload[]
|
||||
onDateRangeSelected: ActionPayload[]
|
||||
}
|
||||
|
||||
export default DatePickerWidget;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React from "react";
|
||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||
import { WidgetType } from "../constants/WidgetConstants";
|
||||
import { ActionPayload } from '../constants/ActionConstants';
|
||||
|
||||
class DropdownWidget extends BaseWidget<DropdownWidgetProps, IWidgetState> {
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ export interface DropdownWidgetProps extends IWidgetProps {
|
|||
label?: string
|
||||
type: SelectionType
|
||||
options?: DropdownOption[]
|
||||
onOptionSelected?: ActionPayload[]
|
||||
}
|
||||
|
||||
export default DropdownWidget;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
|||
import { WidgetType } from "../constants/WidgetConstants"
|
||||
import RadioGroupComponent from "../editorComponents/RadioGroupComponent"
|
||||
import { IOptionProps } from "@blueprintjs/core"
|
||||
import { ActionPayload } from '../constants/ActionConstants';
|
||||
|
||||
class RadioGroupWidget extends BaseWidget<
|
||||
RadioGroupWidgetProps,
|
||||
|
|
@ -36,6 +37,7 @@ export interface RadioGroupWidgetProps extends IWidgetProps {
|
|||
label: string
|
||||
options: RadioOption[]
|
||||
defaultOptionValue: string
|
||||
onOptionSelected?: ActionPayload[]
|
||||
}
|
||||
|
||||
export default RadioGroupWidget
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from "react";
|
||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||
import { WidgetType } from "../constants/WidgetConstants";
|
||||
import TextComponent from "../editorComponents/TextComponent";
|
||||
import { ActionPayload } from '../constants/ActionConstants';
|
||||
|
||||
class TableWidget extends BaseWidget<TableWidgetProps, IWidgetState> {
|
||||
|
||||
|
|
@ -22,6 +22,9 @@ export interface TableWidgetProps extends IWidgetProps {
|
|||
pageKey?: string;
|
||||
label: string
|
||||
tableData?: object[]
|
||||
onPageChange?: ActionPayload[]
|
||||
onRowSelected?: ActionPayload[]
|
||||
onColumnActionClick?: Record<string, ActionPayload[]>
|
||||
}
|
||||
|
||||
export default TableWidget;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user