Feature/date picker
This commit is contained in:
parent
6bc39636a2
commit
3881fe699c
|
|
@ -46,18 +46,18 @@ class DatePickerComponent extends React.Component<DatePickerComponentProps> {
|
|||
}
|
||||
|
||||
formatDate = (date: Date): string => {
|
||||
if (this.props.defaultTimezone) {
|
||||
if (this.props.timezone) {
|
||||
return moment(date)
|
||||
.tz(this.props.defaultTimezone)
|
||||
.tz(this.props.timezone)
|
||||
.format(this.props.dateFormat);
|
||||
}
|
||||
return moment(date).format(this.props.dateFormat);
|
||||
};
|
||||
|
||||
parseDate = (dateStr: string): Date => {
|
||||
if (this.props.defaultTimezone) {
|
||||
if (this.props.timezone) {
|
||||
return moment(dateStr)
|
||||
.tz(this.props.defaultTimezone)
|
||||
.tz(this.props.timezone)
|
||||
.toDate();
|
||||
}
|
||||
return moment(dateStr).toDate();
|
||||
|
|
@ -76,7 +76,7 @@ export interface DatePickerComponentProps extends ComponentProps {
|
|||
selectedDate?: Date;
|
||||
minDate?: Date;
|
||||
maxDate?: Date;
|
||||
defaultTimezone?: string;
|
||||
timezone?: string;
|
||||
datePickerType: DatePickerType;
|
||||
onDateSelected: (date: Date) => void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ function getActions(
|
|||
onSuccessAction: ActionPayload | undefined;
|
||||
onErrorAction: ActionPayload | undefined;
|
||||
} {
|
||||
let action: ActionPayload | undefined = actionPayloads && actionPayloads[0];
|
||||
let onSuccessAction: ActionPayload | undefined =
|
||||
const action: ActionPayload | undefined = actionPayloads && actionPayloads[0];
|
||||
const onSuccessAction: ActionPayload | undefined =
|
||||
action && action.onSuccess && action.onSuccess[0];
|
||||
let onErrorAction: ActionPayload | undefined =
|
||||
const onErrorAction: ActionPayload | undefined =
|
||||
action && action.onError && action.onError[0];
|
||||
return {
|
||||
action,
|
||||
|
|
@ -181,7 +181,7 @@ class ActionSelectorControl extends BaseControl<
|
|||
break;
|
||||
}
|
||||
|
||||
let onActionSelect = this.onActionSelect;
|
||||
const onActionSelect = this.onActionSelect;
|
||||
switch (actionResolutionType) {
|
||||
case ACTION_RESOLUTION_TYPE.SUCCESS:
|
||||
onTypeSelect = this.onSuccessActionSelect;
|
||||
|
|
@ -223,7 +223,7 @@ class ActionSelectorControl extends BaseControl<
|
|||
const actionPayloads: ActionPayload[] = this.props.propertyValue
|
||||
? this.props.propertyValue.slice()
|
||||
: [];
|
||||
let actionPayload = actionPayloads[0];
|
||||
const actionPayload = actionPayloads[0];
|
||||
|
||||
if (actionPayload && actionPayload.actionType !== item.value) {
|
||||
actionPayload.actionId = "";
|
||||
|
|
@ -240,12 +240,12 @@ class ActionSelectorControl extends BaseControl<
|
|||
const actionPayloads: ActionPayload[] = this.props.propertyValue
|
||||
? this.props.propertyValue.slice()
|
||||
: [];
|
||||
let actionPayload = actionPayloads[0];
|
||||
const actionPayload = actionPayloads[0];
|
||||
|
||||
if (actionPayload) {
|
||||
const successActionPayloads: ActionPayload[] =
|
||||
actionPayload.onSuccess || [];
|
||||
let successActionPayload = successActionPayloads[0];
|
||||
const successActionPayload = successActionPayloads[0];
|
||||
if (successActionPayload) {
|
||||
successActionPayload.actionId = "";
|
||||
successActionPayload.actionType = item.value as ActionType;
|
||||
|
|
@ -263,11 +263,11 @@ class ActionSelectorControl extends BaseControl<
|
|||
const actionPayloads: ActionPayload[] = this.props.propertyValue
|
||||
? this.props.propertyValue.slice()
|
||||
: [];
|
||||
let actionPayload = actionPayloads[0];
|
||||
const actionPayload = actionPayloads[0];
|
||||
|
||||
if (actionPayload) {
|
||||
const errorActionPayloads: ActionPayload[] = actionPayload.onError || [];
|
||||
let errorActionPayload = errorActionPayloads[0];
|
||||
const errorActionPayload = errorActionPayloads[0];
|
||||
if (errorActionPayload) {
|
||||
errorActionPayload.actionId = "";
|
||||
errorActionPayload.actionType = item.value as ActionType;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ class TimeZoneControl extends BaseControl<TimeZoneControlProps> {
|
|||
}
|
||||
|
||||
onTimeZoneSelected = (timezone: string): void => {
|
||||
console.log(timezone);
|
||||
this.updateProperty(this.props.propertyName, timezone);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ export const ReduxActionTypes: { [key: string]: string } = {
|
|||
LOAD_API_RESPONSE: "LOAD_API_RESPONSE",
|
||||
LOAD_QUERY_RESPONSE: "LOAD_QUERY_RESPONSE",
|
||||
EXECUTE_ACTION: "EXECUTE_ACTION",
|
||||
EXECUTE_ACTION_SUCCESS: "EXECUTE_ACTION",
|
||||
EXECUTE_ACTION_SUCCESS: "EXECUTE_ACTION_SUCCESS",
|
||||
EXECUTE_ACTION_ERROR: "EXECUTE_ACTION_ERROR",
|
||||
LOAD_CANVAS_ACTIONS: "LOAD_CANVAS_ACTIONS",
|
||||
SAVE_PAGE_INIT: "SAVE_PAGE_INIT",
|
||||
SAVE_PAGE_SUCCESS: "SAVE_PAGE_SUCCESS",
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ const PropertyPaneConfigResponse: PropertyPaneConfigState = {
|
|||
id: "9.5",
|
||||
label: "Timezone",
|
||||
placeholderText: "Select Timezone",
|
||||
propertyName: "defaultTimezone",
|
||||
propertyName: "timezone",
|
||||
controlType: "TIMEZONE_PICKER",
|
||||
},
|
||||
{
|
||||
|
|
@ -392,12 +392,6 @@ const PropertyPaneConfigResponse: PropertyPaneConfigState = {
|
|||
label: "Visible",
|
||||
controlType: "SWITCH",
|
||||
},
|
||||
{
|
||||
id: "11.6",
|
||||
propertyName: "tableData",
|
||||
label: "Enter data array",
|
||||
controlType: "INPUT_TEXT",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ import {
|
|||
} from "redux-saga/effects";
|
||||
import { ActionPayload, PageAction } from "../constants/ActionConstants";
|
||||
import ActionAPI, {
|
||||
ActionApiResponse,
|
||||
ActionCreateUpdateResponse,
|
||||
ExecuteActionRequest,
|
||||
RestAction,
|
||||
ActionApiResponse,
|
||||
} from "../api/ActionAPI";
|
||||
import { AppState, DataTree } from "../reducers";
|
||||
import _ from "lodash";
|
||||
|
|
@ -33,6 +33,7 @@ import { API_EDITOR_ID_URL, API_EDITOR_URL } from "../constants/routes";
|
|||
import { getDynamicBoundValue } from "../utils/DynamicBindingUtils";
|
||||
import history from "../utils/history";
|
||||
import { createUpdateBindingsMap } from "../actions/bindingActions";
|
||||
/* eslint-disable no-use-before-define */
|
||||
|
||||
const getDataTree = (state: AppState): DataTree => {
|
||||
return state.entities;
|
||||
|
|
@ -81,17 +82,27 @@ export function* executeAPIQueryActionSaga(apiAction: ActionPayload) {
|
|||
...response,
|
||||
};
|
||||
if (apiAction.onError) {
|
||||
yield call(executeActionSaga, apiAction.onError);
|
||||
yield put({
|
||||
type: ReduxActionTypes.EXECUTE_ACTION,
|
||||
payload: apiAction.onError,
|
||||
});
|
||||
}
|
||||
yield put({
|
||||
type: ReduxActionTypes.EXECUTE_ACTION_ERROR,
|
||||
payload: { [apiAction.actionId]: payload },
|
||||
});
|
||||
} else {
|
||||
if (apiAction.onSuccess) {
|
||||
yield call(executeActionSaga, apiAction.onSuccess);
|
||||
yield put({
|
||||
type: ReduxActionTypes.EXECUTE_ACTION,
|
||||
payload: apiAction.onSuccess,
|
||||
});
|
||||
}
|
||||
yield put({
|
||||
type: ReduxActionTypes.EXECUTE_ACTION_SUCCESS,
|
||||
payload: { [apiAction.actionId]: payload },
|
||||
});
|
||||
}
|
||||
yield put({
|
||||
type: ReduxActionTypes.EXECUTE_ACTION_SUCCESS,
|
||||
payload: { [apiAction.actionId]: payload },
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class DatePickerWidget extends BaseWidget<DatePickerWidgetProps, WidgetState> {
|
|||
dateFormat={this.props.dateFormat}
|
||||
style={this.getPositionStyle()}
|
||||
widgetId={this.props.widgetId}
|
||||
defaultTimezone={this.props.defaultTimezone}
|
||||
timezone={this.props.timezone}
|
||||
enableTimePicker={this.props.enableTimePicker}
|
||||
defaultDate={this.props.defaultDate}
|
||||
datePickerType={"DATE_PICKER"}
|
||||
|
|
@ -41,7 +41,7 @@ export type DatePickerType = "DATE_PICKER" | "DATE_RANGE_PICKER";
|
|||
export interface DatePickerWidgetProps extends WidgetProps {
|
||||
defaultDate?: Date;
|
||||
selectedDate: Date;
|
||||
defaultTimezone?: string;
|
||||
timezone?: string;
|
||||
enableTimePicker: boolean;
|
||||
dateFormat: string;
|
||||
label: string;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export interface InputWidgetProps extends WidgetProps {
|
|||
maxChars?: number;
|
||||
minNum?: number;
|
||||
maxNum?: number;
|
||||
onTextChanged: ActionPayload[];
|
||||
onTextChanged?: ActionPayload[];
|
||||
label: string;
|
||||
inputValidators: InputValidator[];
|
||||
focusIndex?: number;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user