diff --git a/app/client/cypress/fixtures/propertyPaneResponse.json b/app/client/cypress/fixtures/propertyPaneResponse.json deleted file mode 100644 index 4bf872cc31..0000000000 --- a/app/client/cypress/fixtures/propertyPaneResponse.json +++ /dev/null @@ -1,1142 +0,0 @@ -{ - "responseMeta": { - "status": 200, - "success": true - }, - "data": { - "id": "5dcceb61ae82b00004d7b2fe", - "userPermissions": [], - "config": { - "CONTAINER_WIDGET": [ - { - "id": "5.1", - "sectionName": "General", - "children": [ - { - "id": "5.1.1", - "helpText": "Use a html color name, HEX, RGB or RGBA value", - "placeholderText": "#FFFFFF / Gray / rgb(255, 99, 71)", - "propertyName": "backgroundColor", - "label": "Background Color", - "controlType": "INPUT_TEXT" - }, - { - "id": "5.1.2", - "helpText": "Controls the visibility of the widget", - "propertyName": "isVisible", - "label": "Visible", - "controlType": "SWITCH", - "isJSConvertible": true - }, - { - "id": "5.1.3", - "propertyName": "shouldScrollContents", - "label": "Scroll Contents", - "controlType": "SWITCH" - } - ] - } - ], - "DATE_PICKER_WIDGET": [ - { - "sectionName": "General", - "id": "6.1", - "children": [ - { - "id": "6.1.2", - "propertyName": "defaultDate", - "label": "Default Date", - "helpText": "Sets the default date of the widget. The date is updated if the default date changes", - "controlType": "DATE_PICKER", - "placeholderText": "Enter Default Date", - "isJSConvertible": true - }, - { - "id": "6.1.3", - "helpText": "Sets the format of the selected date", - "propertyName": "dateFormat", - "label": "Date Format", - "controlType": "DROP_DOWN", - "isJSConvertible": true, - "options": [ - { - "label": "YYYY-MM-DD", - "value": "YYYY-MM-DD" - }, - { - "label": "YYYY-MM-DD HH:mm", - "value": "YYYY-MM-DD HH:mm" - }, - { - "label": "YYYY-MM-DDTHH:mm:ss.sssZ", - "value": "YYYY-MM-DDTHH:mm:ss.sssZ" - }, - { - "label": "DD/MM/YYYY", - "value": "DD/MM/YYYY" - }, - { - "label": "DD/MM/YYYY HH:mm", - "value": "DD/MM/YYYY HH:mm" - } - ] - }, - { - "id": "6.1.4", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH" - }, - { - "id": "6.1.5", - "propertyName": "isDisabled", - "label": "Disabled", - "helpText": "Disables input to this widget", - "controlType": "SWITCH" - } - ] - }, - { - "sectionName": "Actions", - "id": "6.2", - "children": [ - { - "id": "6.2.1", - "propertyName": "onDateSelected", - "label": "onDateSelected", - "controlType": "ACTION_SELECTOR" - } - ] - } - ], - "TABLE_WIDGET": [ - { - "id": "7.1", - "sectionName": "General", - "children": [ - { - "id": "7.1.1", - "helpText": "Takes in an array of objects to display rows in the table. Bind data from an API using {{}}", - "propertyName": "tableData", - "label": "Table Data", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter [{ \"col1\": \"val1\" }]", - "inputType": "ARRAY" - }, - { - "id": "7.1.2", - "helpText": "Bind the Table.pageNo property in your API and call it onPageChange", - "propertyName": "serverSidePaginationEnabled", - "label": "Server Side Pagination", - "controlType": "SWITCH" - }, - { - "id": "7.1.3", - "helpText": "Controls the visibility of the widget", - "propertyName": "isVisible", - "isJSConvertible": true, - "label": "Visible", - "controlType": "SWITCH" - }, - { - "id": "7.1.4", - "helpText": "Enable PDF Export", - "propertyName": "exportPDF", - "label": "PDF Export", - "controlType": "SWITCH" - }, - { - "id": "7.1.5", - "helpText": "Enable Excel Export", - "propertyName": "exportExcel", - "label": "Excel Export", - "controlType": "SWITCH" - }, - { - "id": "7.1.6", - "helpText": "Enable CSV Export", - "propertyName": "exportCsv", - "label": "CSV Export", - "controlType": "SWITCH" - }, - { - "id": "7.1.7", - "helpText": "Existing Columns", - "propertyName": "columns", - "label": "Existing Columns", - "controlType": "PRIMARY_COLUMNS" - } - ] - }, - { - "id": "7.2", - "sectionName": "Actions", - "children": [ - { - "id": "7.2.1", - "helpText": "Adds a button action for every row. Reference the Table.selectedRow property in the action", - "propertyName": "columnActions", - "label": "Row Button", - "controlType": "COLUMN_ACTION_SELECTOR" - }, - { - "id": "7.2.2", - "helpText": "Triggers an action when a table row is selected", - "propertyName": "onRowSelected", - "label": "onRowSelected", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - }, - { - "id": "7.2.3", - "helpText": "Triggers an action when a table page is changed", - "propertyName": "onPageChange", - "label": "onPageChange", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "IMAGE_WIDGET": [ - { - "id": "3.1", - "sectionName": "General", - "children": [ - { - "id": "3.1.1", - "helpText": "Renders the url or Base64 in the widget", - "propertyName": "image", - "label": "Image", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter URL / Base64" - }, - { - "id": "3.1.2", - "helpText": "Renders the url or Base64 when no image is provided", - "propertyName": "defaultImage", - "label": "Default Image", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter URL / Base64" - }, - { - "id": "3.1.3", - "helpText": "Controls the visibility of the widget", - "propertyName": "isVisible", - "label": "Visible", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - } - ], - "RADIO_GROUP_WIDGET": [ - { - "id": "10.1", - "sectionName": "General", - "children": [ - { - "id": "10.1.2", - "helpText": "Displays a list of options for a user to select. Values must be unique", - "propertyName": "options", - "label": "Options", - "controlType": "OPTION_INPUT", - "isJSConvertible": true - }, - { - "id": "10.1.3", - "helpText": "Selects a value of the options entered by default", - "propertyName": "defaultOptionValue", - "label": "Default Selected Value", - "placeholderText": "Enter option value", - "controlType": "INPUT_TEXT" - }, - { - "id": "10.1.5", - "helpText": "Controls the visibility of the widget", - "propertyName": "isVisible", - "label": "Visible", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "10.2", - "sectionName": "Actions", - "children": [ - { - "id": "10.2.1", - "helpText": "Triggers an action when a user changes the selected option", - "propertyName": "onSelectionChange", - "label": "onSelectionChange", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "TABS_WIDGET": [ - { - "id": "16.1", - "sectionName": "General", - "children": [ - { - "id": "16.1.1", - "helpText": "Takes an array of tab names to render tabs", - "propertyName": "tabs", - "isJSConvertible": true, - "label": "Tabs", - "controlType": "TABS_INPUT" - }, - { - "id": "16.1.2", - "propertyName": "selectedTab", - "helpText": "Selects a tab name specified by default", - "placeholderText": "Enter tab name", - "label": "Default Tab", - "controlType": "INPUT_TEXT" - }, - { - "id": "16.1.5", - "propertyName": "shouldScrollContents", - "label": "Scroll Contents", - "controlType": "SWITCH" - }, - { - "id": "16.1.4", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - } - ], - "CHART_WIDGET": [ - { - "id": "13.1", - "sectionName": "General", - "children": [ - { - "id": "13.1.1", - "helpText": "Adds a title to the chart", - "placeholderText": "Enter title", - "propertyName": "chartName", - "label": "Title", - "controlType": "INPUT_TEXT" - }, - { - "id": "13.1.2", - "helpText": "Changes the visualisation of the chart data", - "propertyName": "chartType", - "label": "Chart Type", - "controlType": "DROP_DOWN", - "options": [ - { - "label": "Line Chart", - "value": "LINE_CHART" - }, - { - "label": "Bar Chart", - "value": "BAR_CHART" - }, - { - "label": "Pie Chart", - "value": "PIE_CHART" - }, - { - "label": "Column Chart", - "value": "COLUMN_CHART" - }, - { - "label": "Area Chart", - "value": "AREA_CHART" - } - ], - "isJSConvertible": true - }, - { - "id": "13.1.62", - "helpText": "Populates the chart with the data", - "propertyName": "chartData", - "placeholderText": "Enter [{ \"x\": \"val\", \"y\": \"val\" }]", - "label": "Chart Data", - "controlType": "CHART_DATA" - }, - { - "id": "13.1.3", - "helpText": "Specifies the label of the x-axis", - "propertyName": "xAxisName", - "placeholderText": "Enter label text", - "label": "x-axis Label", - "controlType": "INPUT_TEXT" - }, - { - "id": "13.1.5", - "helpText": "Specifies the label of the y-axis", - "propertyName": "yAxisName", - "placeholderText": "Enter label text", - "label": "y-axis Label", - "controlType": "INPUT_TEXT" - }, - { - "id": "13.1.4", - "helpText": "Enables scrolling inside the chart", - "propertyName": "allowHorizontalScroll", - "label": "Allow horizontal scroll", - "controlType": "SWITCH" - }, - { - "id": "13.1.7", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - } - ], - "MODAL_WIDGET": [ - { - "sectionName": "General", - "id": "18.1", - "children": [ - { - "id": "18.1.1", - "propertyName": "canOutsideClickClose", - "label": "Quick Dismiss", - "helpText": "Allows dismissing the modal when user taps outside", - "controlType": "SWITCH" - }, - { - "id": "18.1.2", - "propertyName": "size", - "label": "Modal Type", - "controlType": "DROP_DOWN", - "options": [ - { - "label": "Form Modal", - "value": "MODAL_LARGE" - }, - { - "label": "Alert Modal", - "value": "MODAL_SMALL" - } - ] - }, - { - "id": "18.1.3", - "propertyName": "shouldScrollContents", - "label": "Scroll Contents", - "controlType": "SWITCH" - } - ] - } - ], - "INPUT_WIDGET": [ - { - "id": "4.1", - "sectionName": "General", - "children": [ - { - "id": "4.1.2", - "helpText": "Changes the type of data captured in the input", - "propertyName": "inputType", - "label": "Data Type", - "controlType": "DROP_DOWN", - "options": [ - { - "label": "Text", - "value": "TEXT" - }, - { - "label": "Number", - "value": "NUMBER" - }, - { - "label": "Password", - "value": "PASSWORD" - }, - { - "label": "Phone Number", - "value": "PHONE_NUMBER" - }, - { - "label": "Email", - "value": "EMAIL" - } - ] - }, - { - "id": "4.1.3", - "helpText": "Sets a placeholder text for the input", - "propertyName": "placeholderText", - "label": "Placeholder", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter placeholder text" - }, - { - "id": "4.1.4", - "helpText": "Sets the default text of the widget. The text is updated if the default text changes", - "propertyName": "defaultText", - "label": "Default Input", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter default text" - }, - { - "id": "4.1.5", - "helpText": "Adds a validation to the input which displays an error on failure", - "propertyName": "regex", - "label": "Regex", - "controlType": "INPUT_TEXT", - "placeholderText": "^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$", - "inputType": "TEXT" - }, - { - "id": "4.1.6", - "helpText": "Displays the error message if the regex validation fails", - "propertyName": "errorMessage", - "label": "Error Message", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter error message", - "inputType": "TEXT" - }, - { - "id": "4.1.8", - "helpText": "Controls the visibility of the widget", - "propertyName": "isVisible", - "label": "Visible", - "controlType": "SWITCH", - "isJSConvertible": true - }, - { - "id": "4.1.9", - "helpText": "Disables input to this widget", - "propertyName": "isDisabled", - "label": "Disabled", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "4.2.1", - "sectionName": "Actions", - "children": [ - { - "id": "5.11.2", - "helpText": "Triggers an action when the text is changed", - "propertyName": "onTextChanged", - "label": "onTextChanged", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "DROP_DOWN_WIDGET": [ - { - "id": "8.1", - "sectionName": "General", - "children": [ - { - "id": "8.1.2", - "helpText": "Allows users to select either a single option or multiple options", - "propertyName": "selectionType", - "label": "Selection Type", - "controlType": "DROP_DOWN", - "options": [ - { - "label": "Single Select", - "value": "SINGLE_SELECT" - }, - { - "label": "Multi Select", - "value": "MULTI_SELECT" - } - ] - }, - { - "id": "8.1.3", - "helpText": "Allows users to select either a single option or multiple options. Values must be unique", - "propertyName": "options", - "label": "Options", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter [{label: \"label1\", value: \"value2\"}]" - }, - { - "id": "8.1.4", - "helpText": "Selects the option with value by default", - "propertyName": "defaultOptionValue", - "label": "Default Option", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter option value" - }, - { - "id": "8.1.6", - "helpText": "Controls the visibility of the widget", - "propertyName": "isVisible", - "label": "Visible", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "8.2", - "sectionName": "Actions", - "children": [ - { - "id": "8.2.1", - "helpText": "Triggers an action when a user selects an option", - "propertyName": "onOptionChange", - "label": "onOptionChange", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "FORM_BUTTON_WIDGET": [ - { - "id": "15.1", - "sectionName": "General", - "children": [ - { - "id": "15.1.1", - "propertyName": "text", - "label": "Label", - "helpText": "Sets the label of the button", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter label text" - }, - { - "id": "15.1.2", - "propertyName": "buttonStyle", - "label": "Button Style", - "helpText": "Changes the style of the button", - "controlType": "DROP_DOWN", - "options": [ - { - "label": "Primary Button", - "value": "PRIMARY_BUTTON" - }, - { - "label": "Secondary Button", - "value": "SECONDARY_BUTTON" - }, - { - "label": "Danger Button", - "value": "DANGER_BUTTON" - } - ] - }, - { - "id": "15.1.3", - "helpText": "Disables the button when the parent form has a required widget that is not filled", - "propertyName": "disabledWhenInvalid", - "label": "Disabled Invalid Forms", - "controlType": "SWITCH" - }, - { - "id": "15.1.4", - "helpText": "Resets the fields within the parent form when the click action succeeds", - "propertyName": "resetFormOnClick", - "label": "Reset Form on Success", - "controlType": "SWITCH", - "isJSConvertible": true - }, - { - "id": "15.1.5", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "15.2", - "sectionName": "Actions", - "children": [ - { - "id": "15.2.1", - "helpText": "Triggers an action when the button is clicked", - "propertyName": "onClick", - "label": "onClick", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "MAP_WIDGET": [ - { - "sectionName": "General", - "id": "25.1", - "children": [ - { - "id": "25.1.1", - "propertyName": "mapCenter", - "label": "Initial location", - "isJSConvertible": true, - "controlType": "LOCATION_SEARCH" - }, - { - "id": "25.1.4", - "propertyName": "defaultMarkers", - "label": "Default markers", - "controlType": "INPUT_TEXT", - "inputType": "ARRAY", - "helpText": "Sets the default markers on the map", - "placeholderText": "Enter [{ \"lat\": \"val1\", \"long\": \"val2\" }]" - }, - { - "id": "25.1.2", - "propertyName": "enableSearch", - "label": "Enable search location", - "helpText": "Enables locaton search", - "controlType": "SWITCH" - }, - { - "id": "25.1.3", - "propertyName": "enablePickLocation", - "label": "Enable pick location", - "helpText": "Allows a user to pick their location", - "controlType": "SWITCH" - }, - { - "id": "25.1.5", - "propertyName": "enableCreateMarker", - "label": "Create new marker", - "helpText": "Allows users to mark locations on the map", - "controlType": "SWITCH" - }, - { - "id": "25.1.6", - "propertyName": "zoomLevel", - "label": "Zoom Level", - "controlType": "STEP", - "helpText": "Changes the default zoom of the map", - "stepType": "ZOOM_PERCENTAGE" - }, - { - "id": "25.1.7", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "27", - "sectionName": "Actions", - "children": [ - { - "id": "27.1", - "propertyName": "onMarkerClick", - "label": "onMarkerClick", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - }, - { - "id": "27.2", - "propertyName": "onCreateMarker", - "label": "onCreateMarker", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "BUTTON_WIDGET": [ - { - "id": "1.1", - "sectionName": "General", - "children": [ - { - "id": "1.1.1", - "propertyName": "text", - "label": "Label", - "helpText": "Sets the label of the button", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter label text" - }, - { - "id": "1.1.2", - "propertyName": "buttonStyle", - "label": "Button Style", - "controlType": "DROP_DOWN", - "helpText": "Changes the style of the button", - "options": [ - { - "label": "Primary Button", - "value": "PRIMARY_BUTTON" - }, - { - "label": "Secondary Button", - "value": "SECONDARY_BUTTON" - }, - { - "label": "Danger Button", - "value": "DANGER_BUTTON" - } - ] - }, - { - "id": "1.1.3", - "propertyName": "isDisabled", - "label": "Disabled", - "controlType": "SWITCH", - "helpText": "Disables clicks to this widget", - "isJSConvertible": true - }, - { - "id": "1.1.4", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "1.2.1", - "sectionName": "Actions", - "children": [ - { - "id": "2.1", - "helpText": "Triggers an action when the button is clicked", - "propertyName": "onClick", - "label": "onClick", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "RICH_TEXT_EDITOR_WIDGET": [ - { - "id": "12.1", - "sectionName": "General", - "children": [ - { - "id": "12.1.1", - "propertyName": "defaultText", - "helpText": "Sets the default text of the widget. The text is updated if the default text changes", - "label": "Default text", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter HTML" - }, - { - "id": "12.1.2", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - }, - { - "id": "12.1.3", - "propertyName": "isDisabled", - "label": "Disable", - "helpText": "Disables input to this widget", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "12.2", - "sectionName": "Actions", - "children": [ - { - "id": "12.2.1", - "helpText": "Triggers an action when the text is changed", - "propertyName": "onTextChange", - "label": "onTextChange", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "FILE_PICKER_WIDGET": [ - { - "id": "11.1", - "sectionName": "General", - "children": [ - { - "id": "11.1.1", - "propertyName": "label", - "label": "Label", - "controlType": "INPUT_TEXT", - "helpText": "Sets the label of the button", - "placeholderText": "Enter label text", - "inputType": "TEXT" - }, - { - "id": "11.1.2", - "propertyName": "maxNumFiles", - "label": "Max No. files", - "helpText": "Sets the maximum number of files that can be uploaded at once", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter no. of files", - "inputType": "INTEGER" - }, - { - "id": "11.1.3", - "propertyName": "maxFileSize", - "helpText": "Sets the maximum size of each file that can be uploaded", - "label": "Max file size", - "controlType": "INPUT_TEXT", - "placeholderText": "File size in mb", - "inputType": "INTEGER" - }, - { - "id": "11.1.4", - "propertyName": "allowedFileTypes", - "helpText": "Restricts the type of files which can be uploaded", - "label": "Allowed File Types", - "controlType": "MULTI_SELECT", - "placeholderText": "Select file types", - "options": [ - { - "label": "Any File", - "value": "*" - }, - { - "label": "Images", - "value": "image/*" - }, - { - "label": "Videos", - "value": "video/*" - }, - { - "label": "Audio", - "value": "audio/*" - }, - { - "label": "Text", - "value": "text/*" - }, - { - "label": "MS Word", - "value": ".doc" - }, - { - "label": "JPEG", - "value": "image/jpeg" - }, - { - "label": "PNG", - "value": ".png" - } - ], - "isJSConvertible": true - }, - { - "id": "11.1.6", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - }, - { - "id": "11.1.7", - "propertyName": "uploadedFileUrlPaths", - "helpText": "Stores the url of the uploaded file so that it can be referenced in an action later", - "label": "Uploaded File URLs", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter [ \"url1\", \"url2\" ]", - "inputType": "TEXT" - } - ] - }, - { - "id": "11.2", - "sectionName": "Actions", - "children": [ - { - "id": "11.2.1", - "helpText": "Triggers an action when the user selects a file. Upload files to a CDN here and store their urls in uploadedFileUrls", - "propertyName": "onFilesSelected", - "label": "onFilesSelected", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "CHECKBOX_WIDGET": [ - { - "id": "9.1", - "sectionName": "General", - "children": [ - { - "id": "9.1.1", - "propertyName": "label", - "label": "Label", - "controlType": "INPUT_TEXT", - "helpText": "Displays a label next to the widget", - "placeholderText": "Enter label text" - }, - { - "id": "9.1.2", - "propertyName": "defaultCheckedState", - "label": "Default Selected", - "helpText": "Checks / un-checks the checkbox by default. Changes to the default selection update the widget state", - "controlType": "SWITCH", - "isJSConvertible": true - }, - { - "id": "9.1.4", - "propertyName": "isDisabled", - "label": "Disabled", - "controlType": "SWITCH", - "helpText": "Disables input to this widget", - "isJSConvertible": true - }, - { - "id": "9.1.5", - "propertyName": "isVisible", - "label": "Visible", - "helpText": "Controls the visibility of the widget", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - }, - { - "id": "9.2", - "sectionName": "Actions", - "children": [ - { - "id": "9.2.1", - "helpText": "Triggers an action when the check state is changed", - "propertyName": "onCheckChange", - "label": "onCheckChange", - "controlType": "ACTION_SELECTOR", - "isJSConvertible": true - } - ] - } - ], - "FORM_WIDGET": [ - { - "id": "14.1", - "sectionName": "General", - "children": [ - { - "id": "14.1.1", - "propertyName": "backgroundColor", - "label": "Background Color", - "helpText": "Use a html color name, HEX, RGB or RGBA value", - "placeholderText": "#FFFFFF / Gray / rgb(255, 99, 71)", - "controlType": "INPUT_TEXT" - }, - { - "id": "14.1.2", - "helpText": "Controls the visibility of the widget", - "propertyName": "isVisible", - "label": "Visible", - "controlType": "SWITCH", - "isJSConvertible": true - }, - { - "id": "14.1.3", - "propertyName": "shouldScrollContents", - "label": "Scroll Contents", - "controlType": "SWITCH" - } - ] - } - ], - "TEXT_WIDGET": [ - { - "id": "2.1", - "sectionName": "General", - "children": [ - { - "id": "2.1.1", - "propertyName": "text", - "helpText": "Sets the text of the widget", - "label": "Text", - "controlType": "INPUT_TEXT", - "placeholderText": "Enter text" - }, - { - "id": "2.1.3", - "propertyName": "textAlign", - "helpText": "Sets the alignments of the text", - "label": "Text Align", - "controlType": "DROP_DOWN", - "options": [ - { - "label": "Left", - "value": "LEFT" - }, - { - "label": "Center", - "value": "CENTER" - }, - { - "label": "Right", - "value": "RIGHT" - } - ] - }, - { - "id": "2.1.2", - "propertyName": "textStyle", - "helpText": "Sets the font and style of the text", - "label": "Text Style", - "controlType": "DROP_DOWN", - "options": [ - { - "label": "Heading", - "value": "HEADING" - }, - { - "label": "Label", - "value": "LABEL" - }, - { - "label": "Body", - "value": "BODY" - } - ] - }, - { - "id": "2.1.3", - "propertyName": "shouldScroll", - "label": "Enable Scroll", - "helpText": "Allows scrolling text instead of truncation", - "controlType": "SWITCH" - }, - { - "id": "2.1.4", - "propertyName": "isVisible", - "helpText": "Controls the visibility of the widget", - "label": "Visible", - "controlType": "SWITCH", - "isJSConvertible": true - } - ] - } - ] - }, - "name": "propertyPane", - "new": false - } -} \ No newline at end of file diff --git a/app/client/src/mockResponses/WidgetConfigResponse.tsx b/app/client/src/mockResponses/WidgetConfigResponse.tsx index 0c675d3526..c5782c1be5 100644 --- a/app/client/src/mockResponses/WidgetConfigResponse.tsx +++ b/app/client/src/mockResponses/WidgetConfigResponse.tsx @@ -2,6 +2,7 @@ import { WidgetConfigReducerState } from "reducers/entityReducers/widgetConfigRe import { WidgetProps } from "widgets/BaseWidget"; import moment from "moment-timezone"; import { generateReactKey } from "utils/generators"; +import { FileDataTypes } from "widgets/FilepickerWidget"; const WidgetConfigResponse: WidgetConfigReducerState = { config: { @@ -211,6 +212,7 @@ const WidgetConfigResponse: WidgetConfigReducerState = { columns: 4, maxNumFiles: 1, maxFileSize: 5, + fileDataType: FileDataTypes.Base64, widgetName: "FilePicker", isDefaultClickDisabled: true, version: 1, diff --git a/app/client/src/utils/autocomplete/EntityDefinitions.ts b/app/client/src/utils/autocomplete/EntityDefinitions.ts index 11384b5e31..af706aec92 100644 --- a/app/client/src/utils/autocomplete/EntityDefinitions.ts +++ b/app/client/src/utils/autocomplete/EntityDefinitions.ts @@ -220,7 +220,7 @@ export const entityDefinitions = { "Filepicker widget is used to allow users to upload files from their local machines to any cloud storage via API. Cloudinary and Amazon S3 have simple APIs for cloud storage uploads", "!url": "https://docs.appsmith.com/widget-reference/filepicker", isVisible: isVisible, - files: "[?]", + files: "[file]", isDisabled: "bool", uploadedFileUrls: "string", }, @@ -253,6 +253,11 @@ export const GLOBAL_DEFS = { title: "string", description: "string", }, + file: { + data: "string", + name: "text", + type: "file", + }, }; export const GLOBAL_FUNCTIONS = { diff --git a/app/client/src/widgets/FilepickerWidget.tsx b/app/client/src/widgets/FilepickerWidget.tsx index 8b6ea9a96c..4d9012ca27 100644 --- a/app/client/src/widgets/FilepickerWidget.tsx +++ b/app/client/src/widgets/FilepickerWidget.tsx @@ -112,6 +112,28 @@ class FilePickerWidget extends BaseWidget< isBindProperty: true, isTriggerProperty: false, }, + { + helpText: "Set the format of the data read from the files", + propertyName: "fileDataType", + label: "Data Format", + controlType: "DROP_DOWN", + options: [ + { + label: FileDataTypes.Base64, + value: FileDataTypes.Base64, + }, + { + label: FileDataTypes.Binary, + value: FileDataTypes.Binary, + }, + { + label: FileDataTypes.Text, + value: FileDataTypes.Text, + }, + ], + isBindProperty: false, + isTriggerProperty: false, + }, { propertyName: "isRequired", label: "Required", @@ -175,7 +197,7 @@ class FilePickerWidget extends BaseWidget< label: VALIDATION_TYPES.TEXT, maxNumFiles: VALIDATION_TYPES.NUMBER, allowedFileTypes: VALIDATION_TYPES.ARRAY, - files: VALIDATION_TYPES.ARRAY, + selectedFiles: VALIDATION_TYPES.ARRAY, isRequired: VALIDATION_TYPES.BOOLEAN, // onFilesSelected: VALIDATION_TYPES.ACTION_SELECTOR, }; @@ -184,13 +206,13 @@ class FilePickerWidget extends BaseWidget< static getDerivedPropertiesMap(): DerivedPropertiesMap { return { isValid: `{{ this.isRequired ? this.files.length > 0 : true }}`, - value: `{{this.files}}`, + files: `{{this.selectedFiles.map((file) => { return { ...file, data: this.fileDataType === "Base64" ? file.base64 : this.fileDataType === "Binary" ? file.raw : file.text } })}}`, }; } static getMetaPropertiesMap(): Record { return { - files: [], + selectedFiles: [], uploadedFileData: {}, }; } @@ -295,8 +317,8 @@ class FilePickerWidget extends BaseWidget< }); this.state.uppy.on("file-removed", (file: any) => { - const updatedFiles = this.props.files - ? this.props.files.filter((dslFile) => { + const updatedFiles = this.props.selectedFiles + ? this.props.selectedFiles.filter((dslFile) => { return file.id !== dslFile.id; }) : []; @@ -304,7 +326,9 @@ class FilePickerWidget extends BaseWidget< }); this.state.uppy.on("files-added", (files: any[]) => { - const dslFiles = this.props.files ? [...this.props.files] : []; + const dslFiles = this.props.selectedFiles + ? [...this.props.selectedFiles] + : []; const fileReaderPromises = files.map((file) => { const reader = new FileReader(); @@ -321,11 +345,17 @@ class FilePickerWidget extends BaseWidget< textReader.onloadend = () => { const text = textReader.result; const newFile = { + type: file.type, id: file.id, base64: base64data, - blob: file.data, raw: rawData, text: text, + data: + this.props.fileDataType === FileDataTypes.Base64 + ? base64data + : this.props.fileDataType === FileDataTypes.Binary + ? rawData + : text, name: file.meta ? file.meta.name : undefined, }; @@ -337,7 +367,10 @@ class FilePickerWidget extends BaseWidget< }); Promise.all(fileReaderPromises).then((files) => { - this.props.updateWidgetMetaProperty("files", dslFiles.concat(files)); + this.props.updateWidgetMetaProperty( + "selectedFiles", + dslFiles.concat(files), + ); }); }); @@ -384,9 +417,9 @@ class FilePickerWidget extends BaseWidget< componentDidUpdate(prevProps: FilePickerWidgetProps) { super.componentDidUpdate(prevProps); if ( - prevProps.files && - prevProps.files.length > 0 && - this.props.files === undefined + prevProps.selectedFiles && + prevProps.selectedFiles.length > 0 && + this.props.selectedFiles === undefined ) { this.state.uppy.reset(); } else if ( @@ -415,7 +448,7 @@ class FilePickerWidget extends BaseWidget< widgetId={this.props.widgetId} key={this.props.widgetId} label={this.props.label} - files={this.props.files || []} + files={this.props.selectedFiles || []} isLoading={this.props.isLoading || this.state.isLoading} isDisabled={this.props.isDisabled} /> @@ -436,13 +469,20 @@ export interface FilePickerWidgetProps extends WidgetProps, WithMeta { label: string; maxNumFiles?: number; maxFileSize?: number; - files?: any[]; + selectedFiles?: any[]; allowedFileTypes: string[]; onFilesSelected?: string; + fileDataType: FileDataTypes; isRequired?: boolean; uploadedFileUrlPaths?: string; } +export enum FileDataTypes { + Base64 = "Base64", + Text = "Text", + Binary = "Binary", +} + export default FilePickerWidget; export const ProfiledFilePickerWidget = Sentry.withProfiler( withMeta(FilePickerWidget), diff --git a/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/editor.json b/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/editor.json index 593c5b2512..2941a30a22 100644 --- a/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/editor.json +++ b/app/server/appsmith-plugins/amazons3Plugin/src/main/resources/editor.json @@ -137,7 +137,7 @@ "label": "Base64 Encode File - Yes/No", "configProperty": "actionConfiguration.pluginSpecifiedTemplates[5].value", "controlType": "DROP_DOWN", - "initialValue": "NO", + "initialValue": "YES", "options": [ { "label": "Yes",