2019-11-25 05:07:27 +00:00
|
|
|
import { WidgetConfigReducerState } from "reducers/entityReducers/widgetConfigReducer";
|
2020-04-14 05:35:16 +00:00
|
|
|
import { WidgetProps } from "widgets/BaseWidget";
|
2020-04-23 06:12:13 +00:00
|
|
|
import moment from "moment-timezone";
|
2019-09-12 08:11:25 +00:00
|
|
|
|
|
|
|
|
const WidgetConfigResponse: WidgetConfigReducerState = {
|
2019-09-18 10:19:50 +00:00
|
|
|
config: {
|
|
|
|
|
BUTTON_WIDGET: {
|
|
|
|
|
text: "Submit",
|
|
|
|
|
buttonStyle: "PRIMARY_BUTTON",
|
|
|
|
|
rows: 1,
|
2020-03-27 12:06:30 +00:00
|
|
|
columns: 2,
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Button",
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
isDisabled: false,
|
|
|
|
|
isVisible: true,
|
2020-02-13 09:32:24 +00:00
|
|
|
isDefaultClickDisabled: true,
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
TEXT_WIDGET: {
|
2020-05-09 06:55:20 +00:00
|
|
|
text: "Label",
|
2019-09-18 10:19:50 +00:00
|
|
|
textStyle: "LABEL",
|
2020-05-11 14:19:58 +00:00
|
|
|
textAlign: "LEFT",
|
2019-09-18 10:19:50 +00:00
|
|
|
rows: 1,
|
2020-03-27 12:06:30 +00:00
|
|
|
columns: 4,
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Text",
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
2020-03-20 11:17:30 +00:00
|
|
|
RICH_TEXT_EDITOR_WIDGET: {
|
2020-04-15 11:42:11 +00:00
|
|
|
defaultText: "This is the initial <b>content</b> of the editor",
|
2020-03-20 11:17:30 +00:00
|
|
|
rows: 5,
|
|
|
|
|
columns: 8,
|
|
|
|
|
isDisabled: false,
|
|
|
|
|
isVisible: true,
|
|
|
|
|
widgetName: "RichTextEditor",
|
2020-04-15 11:42:11 +00:00
|
|
|
isDefaultClickDisabled: true,
|
2020-03-20 11:17:30 +00:00
|
|
|
},
|
2019-09-18 10:19:50 +00:00
|
|
|
IMAGE_WIDGET: {
|
2019-11-14 17:06:32 +00:00
|
|
|
defaultImage:
|
2020-05-11 11:28:07 +00:00
|
|
|
"https://res.cloudinary.com/drako999/image/upload/v1589196259/default.png",
|
2019-09-18 10:19:50 +00:00
|
|
|
imageShape: "RECTANGLE",
|
|
|
|
|
image: "",
|
|
|
|
|
rows: 3,
|
2020-05-11 11:29:17 +00:00
|
|
|
columns: 4,
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Image",
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
INPUT_WIDGET: {
|
|
|
|
|
inputType: "TEXT",
|
2020-01-21 12:48:42 +00:00
|
|
|
rows: 1,
|
2020-05-22 13:08:57 +00:00
|
|
|
label: "",
|
2020-05-11 11:00:53 +00:00
|
|
|
columns: 5,
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Input",
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
2020-04-14 05:35:16 +00:00
|
|
|
// SWITCH_WIDGET: {
|
|
|
|
|
// isOn: false,
|
|
|
|
|
// label: "Switch",
|
|
|
|
|
// rows: 1,
|
|
|
|
|
// columns: 4,
|
|
|
|
|
// widgetName: "Switch",
|
|
|
|
|
// },
|
|
|
|
|
ICON_WIDGET: {
|
|
|
|
|
widgetName: "Icon",
|
2019-09-18 10:19:50 +00:00
|
|
|
rows: 1,
|
2020-04-14 05:35:16 +00:00
|
|
|
columns: 1,
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
CONTAINER_WIDGET: {
|
|
|
|
|
backgroundColor: "#FFFFFF",
|
2020-05-09 06:55:20 +00:00
|
|
|
rows: 10,
|
2019-10-31 05:28:11 +00:00
|
|
|
columns: 8,
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Container",
|
2020-03-27 09:02:11 +00:00
|
|
|
containerStyle: "card",
|
|
|
|
|
children: [],
|
|
|
|
|
blueprint: {
|
|
|
|
|
view: [
|
|
|
|
|
{
|
|
|
|
|
type: "CANVAS_WIDGET",
|
|
|
|
|
position: { top: 0, left: 0 },
|
|
|
|
|
props: {
|
|
|
|
|
containerStyle: "none",
|
|
|
|
|
canExtend: false,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
children: [],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
DATE_PICKER_WIDGET: {
|
2020-03-20 11:03:50 +00:00
|
|
|
isDisabled: false,
|
2019-09-18 10:19:50 +00:00
|
|
|
datePickerType: "DATE_PICKER",
|
|
|
|
|
rows: 1,
|
2020-05-22 13:08:57 +00:00
|
|
|
label: "",
|
2019-11-06 12:12:41 +00:00
|
|
|
dateFormat: "DD/MM/YYYY",
|
2020-05-11 11:00:53 +00:00
|
|
|
columns: 5,
|
2019-11-06 12:12:41 +00:00
|
|
|
widgetName: "DatePicker",
|
2020-04-23 06:12:13 +00:00
|
|
|
defaultDate: moment().toISOString(true),
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
TABLE_WIDGET: {
|
2020-01-21 12:48:42 +00:00
|
|
|
rows: 7,
|
2020-05-09 06:55:20 +00:00
|
|
|
columns: 8,
|
2019-10-31 05:28:11 +00:00
|
|
|
label: "Data",
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Table",
|
2019-11-14 17:06:32 +00:00
|
|
|
tableData: [
|
|
|
|
|
{
|
2020-01-16 09:34:36 +00:00
|
|
|
id: 2381224,
|
|
|
|
|
email: "michael.lawson@reqres.in",
|
|
|
|
|
userName: "Michael Lawson",
|
|
|
|
|
productName: "Chicken Sandwich",
|
|
|
|
|
orderAmount: 4.99,
|
2019-11-14 17:06:32 +00:00
|
|
|
},
|
|
|
|
|
{
|
2020-01-16 09:34:36 +00:00
|
|
|
id: 2736212,
|
|
|
|
|
email: "lindsay.ferguson@reqres.in",
|
|
|
|
|
userName: "Lindsay Ferguson",
|
|
|
|
|
productName: "Tuna Salad",
|
|
|
|
|
orderAmount: 9.99,
|
2019-11-14 17:06:32 +00:00
|
|
|
},
|
|
|
|
|
{
|
2020-01-16 09:34:36 +00:00
|
|
|
id: 6788734,
|
|
|
|
|
email: "tobias.funke@reqres.in",
|
|
|
|
|
userName: "Tobias Funke",
|
|
|
|
|
productName: "Beef steak",
|
|
|
|
|
orderAmount: 19.99,
|
2019-11-14 17:06:32 +00:00
|
|
|
},
|
|
|
|
|
],
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
DROP_DOWN_WIDGET: {
|
|
|
|
|
rows: 1,
|
2020-05-11 11:00:53 +00:00
|
|
|
columns: 5,
|
2020-05-22 13:08:57 +00:00
|
|
|
label: "",
|
2019-09-23 10:27:45 +00:00
|
|
|
selectionType: "SINGLE_SELECT",
|
2019-10-31 05:28:11 +00:00
|
|
|
options: [
|
2020-05-25 09:32:01 +00:00
|
|
|
{ label: "Vegetarian", value: "VEG" },
|
|
|
|
|
{ label: "Non-Vegetarian", value: "NON_VEG" },
|
|
|
|
|
{ label: "Vegan", value: "VEGAN" },
|
2019-10-31 05:28:11 +00:00
|
|
|
],
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Dropdown",
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
CHECKBOX_WIDGET: {
|
|
|
|
|
rows: 1,
|
|
|
|
|
columns: 3,
|
2020-05-09 06:55:20 +00:00
|
|
|
label: "Label",
|
2019-09-18 10:19:50 +00:00
|
|
|
defaultCheckedState: true,
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Checkbox",
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
RADIO_GROUP_WIDGET: {
|
2020-01-21 12:48:42 +00:00
|
|
|
rows: 2,
|
2020-03-27 12:06:30 +00:00
|
|
|
columns: 3,
|
2020-05-22 13:08:57 +00:00
|
|
|
label: "",
|
2019-09-18 10:19:50 +00:00
|
|
|
options: [
|
2020-05-25 09:32:01 +00:00
|
|
|
{ id: "1", label: "Male", value: "M" },
|
|
|
|
|
{ id: "2", label: "Female", value: "F" },
|
2019-09-18 10:19:50 +00:00
|
|
|
],
|
2020-02-24 14:55:09 +00:00
|
|
|
defaultOptionValue: "1",
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "RadioGroup",
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
|
|
|
|
ALERT_WIDGET: {
|
|
|
|
|
alertType: "NOTIFICATION",
|
|
|
|
|
intent: "SUCCESS",
|
|
|
|
|
rows: 3,
|
|
|
|
|
columns: 3,
|
|
|
|
|
header: "",
|
|
|
|
|
message: "",
|
2019-10-03 17:06:44 +00:00
|
|
|
widgetName: "Alert",
|
2019-09-18 10:19:50 +00:00
|
|
|
},
|
2019-11-04 14:22:50 +00:00
|
|
|
FILE_PICKER_WIDGET: {
|
2020-02-21 13:17:52 +00:00
|
|
|
rows: 1,
|
|
|
|
|
files: [],
|
2020-03-18 09:47:26 +00:00
|
|
|
label: "Select Files",
|
2020-02-21 13:17:52 +00:00
|
|
|
columns: 4,
|
2019-11-04 14:22:50 +00:00
|
|
|
widgetName: "FilePicker",
|
2020-02-25 06:48:41 +00:00
|
|
|
isDefaultClickDisabled: true,
|
2019-11-04 14:22:50 +00:00
|
|
|
},
|
2020-04-15 11:42:11 +00:00
|
|
|
TABS_WIDGET: {
|
|
|
|
|
rows: 7,
|
|
|
|
|
columns: 8,
|
|
|
|
|
shouldScrollContents: false,
|
|
|
|
|
widgetName: "Tabs",
|
|
|
|
|
tabs: [
|
|
|
|
|
{ label: "Tab 1", id: "tab1" },
|
|
|
|
|
{ label: "Tab 2", id: "tab2" },
|
|
|
|
|
],
|
|
|
|
|
selectedTab: "Tab 1",
|
|
|
|
|
blueprint: {
|
|
|
|
|
view: [
|
|
|
|
|
{
|
|
|
|
|
type: "CANVAS_WIDGET",
|
|
|
|
|
position: { top: 0, left: 0 },
|
|
|
|
|
size: { rows: 6, cols: 16 },
|
|
|
|
|
props: {
|
|
|
|
|
containerStyle: "none",
|
|
|
|
|
canExtend: false,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
children: [],
|
|
|
|
|
tabId: "tab1",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "CANVAS_WIDGET",
|
|
|
|
|
position: { top: 0, left: 0 },
|
|
|
|
|
size: { rows: 6, cols: 16 },
|
|
|
|
|
props: {
|
|
|
|
|
containerStyle: "none",
|
|
|
|
|
canExtend: false,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
children: [],
|
|
|
|
|
tabId: "tab2",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-03-27 09:02:11 +00:00
|
|
|
MODAL_WIDGET: {
|
|
|
|
|
rows: 456,
|
|
|
|
|
columns: 456,
|
|
|
|
|
size: "MODAL_SMALL",
|
|
|
|
|
canEscapeKeyClose: true,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
canOutsideClickClose: true,
|
2020-03-27 10:56:26 +00:00
|
|
|
shouldScrollContents: true,
|
2020-03-27 09:02:11 +00:00
|
|
|
isVisible: false,
|
|
|
|
|
widgetName: "Modal",
|
|
|
|
|
children: [],
|
|
|
|
|
blueprint: {
|
|
|
|
|
view: [
|
|
|
|
|
{
|
|
|
|
|
type: "CANVAS_WIDGET",
|
|
|
|
|
position: { left: 0, top: 0 },
|
|
|
|
|
props: {
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
canExtend: true,
|
|
|
|
|
isVisible: true,
|
|
|
|
|
isDisabled: false,
|
|
|
|
|
shouldScrollContents: false,
|
|
|
|
|
children: [],
|
|
|
|
|
blueprint: {
|
|
|
|
|
view: [
|
2020-04-14 05:35:16 +00:00
|
|
|
{
|
|
|
|
|
type: "ICON_WIDGET",
|
|
|
|
|
position: { left: 15, top: 0 },
|
|
|
|
|
size: { rows: 1, cols: 1 },
|
|
|
|
|
props: {
|
|
|
|
|
iconName: "cross",
|
|
|
|
|
iconSize: 24,
|
|
|
|
|
color: "#040627",
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-03-27 09:02:11 +00:00
|
|
|
{
|
|
|
|
|
type: "TEXT_WIDGET",
|
|
|
|
|
position: { left: 0, top: 0 },
|
2020-04-14 05:35:16 +00:00
|
|
|
size: { rows: 1, cols: 15 },
|
2020-03-27 09:02:11 +00:00
|
|
|
props: {
|
|
|
|
|
text: "Modal Title",
|
|
|
|
|
textStyle: "HEADING",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "BUTTON_WIDGET",
|
|
|
|
|
position: { left: 10, top: 4 },
|
|
|
|
|
size: { rows: 1, cols: 3 },
|
|
|
|
|
props: {
|
|
|
|
|
text: "Cancel",
|
|
|
|
|
buttonStyle: "SECONDARY_BUTTON",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "BUTTON_WIDGET",
|
|
|
|
|
position: { left: 13, top: 4 },
|
|
|
|
|
size: { rows: 1, cols: 3 },
|
|
|
|
|
props: {
|
|
|
|
|
text: "Confirm",
|
|
|
|
|
buttonStyle: "PRIMARY_BUTTON",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2020-04-14 05:35:16 +00:00
|
|
|
operations: [
|
|
|
|
|
{
|
|
|
|
|
type: "MODIFY_PROPS",
|
|
|
|
|
fn: (
|
|
|
|
|
widget: WidgetProps & { children?: WidgetProps[] },
|
|
|
|
|
parent?: WidgetProps & { children?: WidgetProps[] },
|
|
|
|
|
) => {
|
|
|
|
|
const iconChild =
|
|
|
|
|
widget.children &&
|
|
|
|
|
widget.children.find(
|
|
|
|
|
child => child.type === "ICON_WIDGET",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (iconChild && parent) {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
widgetId: iconChild.widgetId,
|
|
|
|
|
propertyName: "onClick",
|
|
|
|
|
propertyValue: `{{closeModal('${parent.widgetName}')}}`,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2020-03-27 09:02:11 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
CANVAS_WIDGET: {
|
|
|
|
|
rows: 0,
|
|
|
|
|
columns: 0,
|
|
|
|
|
widgetName: "Canvas",
|
|
|
|
|
},
|
2020-03-13 12:06:41 +00:00
|
|
|
CHART_WIDGET: {
|
|
|
|
|
rows: 8,
|
|
|
|
|
columns: 6,
|
|
|
|
|
widgetName: "Chart",
|
|
|
|
|
chartType: "LINE_CHART",
|
|
|
|
|
chartName: "Sales on working days",
|
2020-04-15 11:42:11 +00:00
|
|
|
allowHorizontalScroll: false,
|
2020-06-02 11:27:24 +00:00
|
|
|
singleChartData: [
|
2020-03-13 12:06:41 +00:00
|
|
|
{
|
2020-06-02 11:27:24 +00:00
|
|
|
x: "Mon",
|
|
|
|
|
y: 10000,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
x: "Tue",
|
|
|
|
|
y: 12000,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
x: "Wed",
|
|
|
|
|
y: 32000,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
x: "Thu",
|
|
|
|
|
y: 28000,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
x: "Fri",
|
|
|
|
|
y: 14000,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
x: "Sat",
|
|
|
|
|
y: 19000,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
x: "Sun",
|
|
|
|
|
y: 36000,
|
2020-03-13 12:06:41 +00:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
xAxisName: "Last Week",
|
|
|
|
|
yAxisName: "Total Order Revenue $",
|
|
|
|
|
},
|
2020-03-06 09:45:21 +00:00
|
|
|
FORM_BUTTON_WIDGET: {
|
|
|
|
|
rows: 1,
|
|
|
|
|
columns: 3,
|
|
|
|
|
widgetName: "FormButton",
|
|
|
|
|
text: "Submit",
|
2020-03-06 14:05:24 +00:00
|
|
|
isDefaultClickDisabled: true,
|
2020-03-06 09:45:21 +00:00
|
|
|
},
|
|
|
|
|
FORM_WIDGET: {
|
2020-03-18 09:47:26 +00:00
|
|
|
rows: 13,
|
2020-05-11 11:00:53 +00:00
|
|
|
columns: 7,
|
2020-03-06 09:45:21 +00:00
|
|
|
widgetName: "Form",
|
2020-03-27 09:02:11 +00:00
|
|
|
backgroundColor: "white",
|
|
|
|
|
children: [],
|
2020-03-06 09:45:21 +00:00
|
|
|
blueprint: {
|
|
|
|
|
view: [
|
|
|
|
|
{
|
2020-03-27 09:02:11 +00:00
|
|
|
type: "CANVAS_WIDGET",
|
2020-03-06 09:45:21 +00:00
|
|
|
position: { top: 0, left: 0 },
|
|
|
|
|
props: {
|
2020-03-27 09:02:11 +00:00
|
|
|
containerStyle: "none",
|
|
|
|
|
canExtend: false,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
children: [],
|
|
|
|
|
blueprint: {
|
|
|
|
|
view: [
|
|
|
|
|
{
|
|
|
|
|
type: "TEXT_WIDGET",
|
|
|
|
|
size: { rows: 1, cols: 12 },
|
|
|
|
|
position: { top: 0, left: 0 },
|
|
|
|
|
props: {
|
2020-05-18 11:05:57 +00:00
|
|
|
text: "Form",
|
2020-03-27 09:02:11 +00:00
|
|
|
textStyle: "HEADING",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "FORM_BUTTON_WIDGET",
|
|
|
|
|
size: { rows: 1, cols: 4 },
|
|
|
|
|
position: { top: 11, left: 12 },
|
|
|
|
|
props: {
|
|
|
|
|
text: "Submit",
|
|
|
|
|
buttonStyle: "PRIMARY_BUTTON",
|
|
|
|
|
disabledWhenInvalid: true,
|
|
|
|
|
resetFormOnClick: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: "FORM_BUTTON_WIDGET",
|
|
|
|
|
size: { rows: 1, cols: 4 },
|
|
|
|
|
position: { top: 11, left: 8 },
|
|
|
|
|
props: {
|
|
|
|
|
text: "Reset",
|
|
|
|
|
buttonStyle: "SECONDARY_BUTTON",
|
|
|
|
|
disabledWhenInvalid: false,
|
|
|
|
|
resetFormOnClick: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2020-03-06 09:45:21 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-04-15 11:42:11 +00:00
|
|
|
MAP_WIDGET: {
|
|
|
|
|
rows: 12,
|
|
|
|
|
columns: 8,
|
|
|
|
|
isDisabled: false,
|
|
|
|
|
isVisible: true,
|
|
|
|
|
widgetName: "Map",
|
|
|
|
|
enableSearch: true,
|
|
|
|
|
zoomLevel: 50,
|
|
|
|
|
enablePickLocation: true,
|
|
|
|
|
allowZoom: true,
|
2020-05-07 10:51:37 +00:00
|
|
|
mapCenter: { lat: -34.397, long: 150.644 },
|
|
|
|
|
defaultMarkers: [{ lat: -34.397, long: 150.644, title: "Test A" }],
|
2020-04-15 11:42:11 +00:00
|
|
|
},
|
2019-09-13 10:45:49 +00:00
|
|
|
},
|
2019-09-18 10:19:50 +00:00
|
|
|
configVersion: 1,
|
2019-09-12 08:11:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default WidgetConfigResponse;
|