PromucFlow_constructor/app/client/src/constants/ActionConstants.tsx

85 lines
1.7 KiB
TypeScript
Raw Normal View History

import { AlertType, MessageIntent } from "../widgets/AlertWidget";
2019-11-05 12:08:41 +00:00
import { DropdownOption } from "../widgets/DropdownWidget";
2019-09-16 10:37:38 +00:00
export type EventType =
| "ON_CLICK"
| "ON_HOVER"
| "ON_TOGGLE"
| "ON_LOAD"
| "ON_TEXT_CHANGE"
| "ON_SUBMIT"
| "ON_CHECK_CHANGE"
| "ON_SELECT"
| "ON_DATE_SELECTED"
| "ON_DATE_RANGE_SELECTED";
2019-09-16 10:37:38 +00:00
export type ActionType =
2019-09-12 13:44:25 +00:00
| "API"
2019-09-16 10:37:38 +00:00
| "QUERY"
| "NAVIGATION"
| "ALERT"
| "JS_FUNCTION"
| "SET_VALUE"
| "DOWNLOAD";
2019-09-12 12:19:46 +00:00
2019-11-05 12:08:41 +00:00
export enum ActionType1 {
"API",
"QUERY",
"NAVIGATION",
"ALERT",
"JS_FUNCTION",
"SET_VALUE",
"DOWNLOAD",
}
export const PropertyPaneActionDropdownOptions: DropdownOption[] = [
{ label: "Call API", value: "API" },
// { label: "Run Query", value: "QUERY" },
];
export interface ActionPayload {
actionId: string;
2019-09-16 10:37:38 +00:00
actionType: ActionType;
contextParams: Record<string, string>;
}
2019-09-16 10:37:38 +00:00
export type NavigationType = "NEW_TAB" | "INLINE";
export interface NavigateActionPayload extends ActionPayload {
2019-09-16 10:37:38 +00:00
pageUrl: string;
navigationType: NavigationType;
}
export interface ShowAlertActionPayload extends ActionPayload {
2019-09-16 10:37:38 +00:00
header: string;
message: string;
alertType: AlertType;
intent: MessageIntent;
2019-09-12 08:11:25 +00:00
}
export interface SetValueActionPayload extends ActionPayload {
2019-09-16 10:37:38 +00:00
header: string;
message: string;
alertType: AlertType;
intent: MessageIntent;
2019-03-21 17:42:23 +00:00
}
2019-08-20 13:19:19 +00:00
export interface ExecuteJSActionPayload extends ActionPayload {
2019-09-16 10:37:38 +00:00
jsFunctionId: string;
2019-08-21 12:49:16 +00:00
}
2019-09-16 10:37:38 +00:00
export type DownloadFiletype = "CSV" | "XLS" | "JSON" | "TXT";
export interface DownloadDataActionPayload extends ActionPayload {
2019-09-16 10:37:38 +00:00
data: JSON;
fileName: string;
fileType: DownloadFiletype;
2019-09-12 13:44:25 +00:00
}
export interface PageAction {
2019-10-21 15:12:45 +00:00
id: string;
2019-09-16 10:37:38 +00:00
actionType: ActionType;
2019-10-21 15:12:45 +00:00
name: string;
jsonPathKeys?: string[];
2019-09-16 10:37:38 +00:00
}