From 53d133353070ed0087cad7ea27d0205158a7a4b6 Mon Sep 17 00:00:00 2001 From: "vicky-primathon.in" Date: Fri, 9 Apr 2021 15:50:48 +0530 Subject: [PATCH 01/12] use derivedProperty selectedIndexArr instead of computing selectedIndexes --- app/client/src/widgets/DropdownWidget.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/client/src/widgets/DropdownWidget.tsx b/app/client/src/widgets/DropdownWidget.tsx index d4adbd943b..b1632f223a 100644 --- a/app/client/src/widgets/DropdownWidget.tsx +++ b/app/client/src/widgets/DropdownWidget.tsx @@ -158,13 +158,7 @@ class DropdownWidget extends BaseWidget { const selectedIndex = _.findIndex(this.props.options, { value: this.props.selectedOptionValue, }); - const computedSelectedIndexArr = this.getSelectedOptionValueArr() - .map((opt: string) => - _.findIndex(this.props.options, { - value: opt, - }), - ) - .filter((i: number) => i > -1); + const computedSelectedIndexArr = this.props.selectedIndexArr || []; const { componentWidth, componentHeight } = this.getComponentDimensions(); return ( Date: Mon, 12 Apr 2021 13:07:05 +0530 Subject: [PATCH 02/12] Added cypress test case to test multi selected dropdown options are cleared in form reset --- app/client/cypress/fixtures/formResetDsl.json | 21 +++++++++++++++++++ .../FormWidgets/FormReset_spec.js | 12 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/app/client/cypress/fixtures/formResetDsl.json b/app/client/cypress/fixtures/formResetDsl.json index e45820cd8b..99048332fc 100644 --- a/app/client/cypress/fixtures/formResetDsl.json +++ b/app/client/cypress/fixtures/formResetDsl.json @@ -137,6 +137,27 @@ "parentId": "qrqizehc5b", "widgetId": "672gf8vm2q", "dynamicBindingPathList": [] + }, + { + "defaultOptionValue": "", + "dynamicBindingPathList": [], + "dynamicTriggerPathList": [], + "isLoading": false, + "isVisible": true, + "label": "", + "options": "[\n {\n \"label\": \"Option 1\",\n \"value\": \"1\"\n },\n {\n \"label\": \"Option 2\",\n \"value\": \"2\"\n },\n {\n \"label\": \"Option 3\",\n \"value\": \"3\"\n },\n {\n \"label\": \"Option 4\",\n \"value\": \"4\"\n },\n {\n \"label\": \"Option 5\",\n \"value\": \"5\"\n }\n]", + "parentId": "qrqizehc5b", + "parentColumnSpace": 71.5, + "parentRowSpace": 40, + "selectionType": "MULTI_SELECT", + "leftColumn": 6, + "rightColumn": 16, + "topRow": 9, + "bottomRow": 10, + "type": "DROP_DOWN_WIDGET", + "version": 1, + "widgetId": "dwh49bulj9", + "widgetName": "Dropdown1" } ], "blueprint": { diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js index 541586379a..837c8813e8 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormReset_spec.js @@ -12,6 +12,12 @@ describe("Form reset functionality", function() { .click() .should("have.class", "selected-row"); + cy.get(".t--draggable-dropdownwidget").click({ force: true }); + cy.get(".t--draggable-dropdownwidget").type("Option"); + cy.dropdownDynamic("Option 1"); + cy.dropdownDynamic("Option 2"); + cy.dropdownDynamic("Option 3"); + cy.get(widgetsPage.inputWidget + " " + "input") .invoke("attr", "value") .should("contain", "lindsay.ferguson@reqres.in"); @@ -26,6 +32,12 @@ describe("Form reset functionality", function() { .eq(2) .should("not.have.class", "selected-row"); + cy.get(".t-draggable-dropdownwidget .bp3-tag-input-values .bp3-tag").should( + ($span) => { + expect($span).to.have.length(0); + }, + ); + cy.get(widgetsPage.inputWidget + " " + "input") .invoke("attr", "value") .should("not.contain", "lindsay.ferguson@reqres.in"); From 7a9dfb2066c586a46fc8c46fa6755be01b1a893e Mon Sep 17 00:00:00 2001 From: "vicky-primathon.in" Date: Mon, 19 Apr 2021 10:31:17 +0530 Subject: [PATCH 03/12] Fixed table image cell alignment Added cypress test to validate image cell alingment --- ...nd_Table_Widget_API_Derived_Column_spec.js | 32 +++++++++++++++++++ .../TableComponent/TableStyledWrappers.tsx | 19 ++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_Table_Widget_API_Derived_Column_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_Table_Widget_API_Derived_Column_spec.js index e6d76b3bc6..f39a3eb08b 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_Table_Widget_API_Derived_Column_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Binding/Bind_Table_Widget_API_Derived_Column_spec.js @@ -4,6 +4,7 @@ const pages = require("../../../../locators/Pages.json"); const apiPage = require("../../../../locators/ApiEditor.json"); const publishPage = require("../../../../locators/publishWidgetspage.json"); const testdata = require("../../../../fixtures/testdata.json"); +const widgetsPage = require("../../../../locators/Widgets.json"); describe("Test Create Api and Bind to Table widget", function() { before(() => { @@ -41,6 +42,37 @@ describe("Test Create Api and Bind to Table widget", function() { cy.closePropertyPane(); }); + it("Check Image alignment is working as expected", function() { + cy.SearchEntityandOpen("Table1"); + cy.editColumn("avatar"); + cy.changeColumnType("Image"); + cy.closePropertyPane(); + cy.SearchEntityandOpen("Table1"); + cy.get(widgetsPage.centerAlign) + .first() + .click({ force: true }); + cy.closePropertyPane(); + cy.get(`.t--widget-tablewidget .tbody .image-cell`) + .first() + .should("have.css", "background-position", "50% 50%"); + cy.SearchEntityandOpen("Table1"); + cy.get(widgetsPage.rightAlign) + .first() + .click({ force: true }); + cy.closePropertyPane(); + cy.get(`.t--widget-tablewidget .tbody .image-cell`) + .first() + .should("have.css", "background-position", "100% 50%"); + cy.SearchEntityandOpen("Table1"); + cy.get(widgetsPage.leftAlign) + .first() + .click({ force: true }); + cy.closePropertyPane(); + cy.get(`.t--widget-tablewidget .tbody .image-cell`) + .first() + .should("have.css", "background-position", "0% 50%"); + }); + it("Update table json data and check the derived column values after update", function() { cy.SearchEntityandOpen("Table1"); cy.tableColumnDataValidation("id"); diff --git a/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx b/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx index c62791f814..6f8289ba98 100644 --- a/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx +++ b/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx @@ -283,6 +283,18 @@ const ALIGN_ITEMS = { BOTTOM: "flex-end", }; +const IMAGE_HORIZONTAL_ALIGN = { + LEFT: "left", + CENTER: "center", + RIGHT: "right", +}; + +const IMAGE_VERTICAL_ALIGN = { + TOP: "top", + CENTER: "center", + BOTTOM: "bottom", +}; + export const TableStyles = css<{ cellProperties?: CellLayoutProperties }>` font-weight: ${(props) => props?.cellProperties?.fontStyle?.includes(FontStyleTypes.BOLD) @@ -343,7 +355,12 @@ export const CellWrapper = styled.div<{ height: 100%; margin: 0 5px 0 0; border-radius: 4px; - background-position: start; + background-position-x: ${(props) => + props?.cellProperties?.horizontalAlignment && + IMAGE_HORIZONTAL_ALIGN[props?.cellProperties?.horizontalAlignment]}; + background-position-y: ${(props) => + props?.cellProperties?.verticalAlignment && + IMAGE_VERTICAL_ALIGN[props?.cellProperties?.verticalAlignment]}; background-repeat: no-repeat; background-size: contain; } From 934563a154689cadca9125c5cd7cd062c53394bd Mon Sep 17 00:00:00 2001 From: "vicky-primathon.in" Date: Mon, 19 Apr 2021 13:32:23 +0530 Subject: [PATCH 04/12] Removed background from selected dropdown item in table widget filters --- .../appsmith/TableComponent/TableStyledWrappers.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx b/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx index c62791f814..53d2f3a100 100644 --- a/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx +++ b/app/client/src/components/designSystems/appsmith/TableComponent/TableStyledWrappers.tsx @@ -450,7 +450,6 @@ export const RenderOptionWrapper = styled.div<{ selected: boolean }>` justify-content: space-between; align-items: center; width: 150px; - background: ${(props) => props.selected && Colors.GREEN}; position: relative; .title { color: ${(props) => (props.selected ? Colors.WHITE : Colors.OXFORD_BLUE)}; From 72d5ec5b6469e646166b06ed0b63399cfa5f2d72 Mon Sep 17 00:00:00 2001 From: "vicky-primathon.in" Date: Tue, 27 Apr 2021 11:29:52 +0530 Subject: [PATCH 05/12] Fix dropdown default value not trimmed before using for value selection --- app/client/src/workers/validations.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/client/src/workers/validations.ts b/app/client/src/workers/validations.ts index 9c5fcd05f2..e36f9b75fb 100644 --- a/app/client/src/workers/validations.ts +++ b/app/client/src/workers/validations.ts @@ -750,7 +750,9 @@ export const VALIDATORS: Record = { if (props) { if (props.selectionType === "SINGLE_SELECT") { - return VALIDATORS[VALIDATION_TYPES.TEXT](value, props, dataTree); + const defaultValue = + value && !Array.isArray(value) ? value.trim() : value; + return VALIDATORS[VALIDATION_TYPES.TEXT](defaultValue, props, dataTree); } else if (props.selectionType === "MULTI_SELECT") { if (typeof value === "string") { try { From 2e61174890489e4f73385d0677de317cfb783ebc Mon Sep 17 00:00:00 2001 From: Paul Li Date: Wed, 28 Apr 2021 01:43:03 -0400 Subject: [PATCH 06/12] BUG-1610 : Text gets cropped in the text widget even when there is good amount of space -- Change css line-height property into 1.2 --- .../src/components/designSystems/blueprint/TextComponent.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/client/src/components/designSystems/blueprint/TextComponent.tsx b/app/client/src/components/designSystems/blueprint/TextComponent.tsx index f359fec4de..e7928603f8 100644 --- a/app/client/src/components/designSystems/blueprint/TextComponent.tsx +++ b/app/client/src/components/designSystems/blueprint/TextComponent.tsx @@ -57,6 +57,7 @@ export const StyledText = styled(Text)<{ font-size: ${(props) => props?.fontSize && TEXT_SIZES[props?.fontSize]}; span { width: 100%; + line-height: 1.2; } `; From 6d5269fa3b971e5e64f953f9e244a3dec615268c Mon Sep 17 00:00:00 2001 From: "vicky-primathon.in" Date: Wed, 28 Apr 2021 12:43:08 +0530 Subject: [PATCH 07/12] Added cypress test to validate default value with enter works --- .../ClientSideTests/FormWidgets/Dropdown_spec.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Dropdown_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Dropdown_spec.js index 5c6d853449..140fe89090 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Dropdown_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Dropdown_spec.js @@ -15,7 +15,6 @@ describe("Dropdown Widget Functionality", function() { cy.testJsontext("options", JSON.stringify(data.input)); cy.testJsontext("defaultoption", "{{ undefined }}"); - cy.get(formWidgetsPage.dropdownWidget) .find(widgetLocators.dropdownSingleSelect) .click({ force: true }); @@ -27,6 +26,13 @@ describe("Dropdown Widget Functionality", function() { .find(widgetLocators.defaultSingleSelectValue) .should("have.text", "Option 3"); }); + it("Selects value with enter in default value", () => { + // cy.openPropertyPane("dropdownwidget"); + cy.testJsontext("defaultoption", "3\n"); + cy.get(formWidgetsPage.dropdownWidget) + .find(widgetLocators.defaultSingleSelectValue) + .should("have.text", "Option 3"); + }); it("Dropdown Widget Functionality", function() { cy.widgetText( "lock", From 7f7f6f666b9d0eb8117f26aaf2808f6842309f04 Mon Sep 17 00:00:00 2001 From: Satish Gandham Date: Wed, 28 Apr 2021 15:58:39 +0530 Subject: [PATCH 08/12] Development: Add eslint rules for code consistency (#4083) Co-authored-by: Satish Gandham Co-authored-by: Abhinav Jha --- app/client/.eslintrc.json | 8 +- app/client/src/AppErrorBoundry.tsx | 2 +- app/client/src/AppRouter.tsx | 18 +- app/client/src/LandingScreen.tsx | 4 +- app/client/src/components/ads/AppIcon.tsx | 4 +- app/client/src/components/ads/Button.tsx | 71 ++-- .../src/components/ads/ButtonTabComponent.tsx | 12 +- app/client/src/components/ads/Callout.tsx | 4 +- app/client/src/components/ads/Checkbox.tsx | 10 +- .../components/ads/ColorPickerComponent.tsx | 20 +- .../src/components/ads/ColorSelector.tsx | 16 +- .../src/components/ads/CopyToClipBoard.tsx | 12 +- .../components/ads/DatePickerComponent.tsx | 18 +- .../src/components/ads/DialogComponent.tsx | 26 +- .../src/components/ads/DraggableList.tsx | 8 +- app/client/src/components/ads/Dropdown.tsx | 48 +-- .../src/components/ads/EditableText.tsx | 28 +- .../components/ads/EditableTextWrapper.tsx | 20 +- app/client/src/components/ads/FilePicker.tsx | 36 +- .../src/components/ads/GifPlayerComponent.tsx | 30 +- app/client/src/components/ads/Icon.tsx | 2 +- .../src/components/ads/IconSelector.tsx | 10 +- .../src/components/ads/IconTabsComponent.tsx | 12 +- app/client/src/components/ads/Menu.tsx | 14 +- app/client/src/components/ads/MenuItem.tsx | 8 +- app/client/src/components/ads/MultiSwitch.tsx | 4 +- .../components/ads/MultiselectDropdown.tsx | 24 +- app/client/src/components/ads/Radio.tsx | 22 +- .../components/ads/RectangularSwitcher.tsx | 8 +- .../src/components/ads/ScrollIndicator.tsx | 8 +- app/client/src/components/ads/SearchInput.tsx | 18 +- app/client/src/components/ads/Spinner.tsx | 4 +- .../src/components/ads/StepComponent.tsx | 8 +- app/client/src/components/ads/Table.tsx | 2 +- .../src/components/ads/TableDropdown.tsx | 78 +++-- app/client/src/components/ads/Tabs.tsx | 8 +- .../src/components/ads/TagInputComponent.tsx | 16 +- app/client/src/components/ads/TextInput.tsx | 14 +- app/client/src/components/ads/Toast.tsx | 18 +- app/client/src/components/ads/Toggle.tsx | 12 +- app/client/src/components/ads/Tooltip.tsx | 16 +- .../src/components/ads/TreeDropdown.tsx | 20 +- .../components/ads/formFields/FieldError.tsx | 4 +- .../components/ads/formFields/FormMessage.tsx | 14 +- .../components/ads/formFields/TextField.tsx | 14 +- .../appsmith/ContainerComponent.tsx | 12 +- .../appsmith/CopyToClipBoard.tsx | 10 +- .../appsmith/CreatableDropdown.tsx | 12 +- .../appsmith/DraggableListComponent.tsx | 2 +- .../designSystems/appsmith/Dropdown.tsx | 14 +- .../appsmith/FilePickerComponent.tsx | 18 +- .../designSystems/appsmith/IconComponent.tsx | 10 +- .../designSystems/appsmith/ImageComponent.tsx | 94 +++--- .../designSystems/appsmith/MapComponent.tsx | 28 +- .../designSystems/appsmith/PopoverVideo.tsx | 14 +- .../appsmith/PositionedContainer.tsx | 12 +- .../appsmith/RichTextEditorComponent.tsx | 8 +- .../appsmith/SearchComponent.tsx | 2 +- .../designSystems/appsmith/StepComponent.tsx | 8 +- .../designSystems/appsmith/TabbedView.tsx | 6 +- .../TableComponent/AutoToolTipComponent.tsx | 22 +- .../appsmith/TableComponent/CascadeFields.tsx | 74 ++--- .../appsmith/TableComponent/Table.tsx | 68 ++-- .../TableComponent/TableActionIcon.tsx | 16 +- .../TableComponent/TableColumnsVisibility.tsx | 36 +- .../TableComponent/TableCompactMode.tsx | 24 +- .../TableComponent/TableDataDownload.tsx | 12 +- .../appsmith/TableComponent/TableFilters.tsx | 48 +-- .../appsmith/TableComponent/TableHeader.tsx | 46 +-- .../TableComponent/TablePagination.tsx | 16 +- .../TableComponent/TableUtilities.tsx | 67 ++-- .../appsmith/TableComponent/index.tsx | 58 ++-- .../designSystems/appsmith/TabsComponent.tsx | 6 +- .../appsmith/TextInputComponent.tsx | 10 +- .../designSystems/appsmith/VideoComponent.tsx | 48 ++- .../appsmith/header/DeployLinkButton.tsx | 42 ++- .../appsmith/header/ThreeDotsLoading.tsx | 4 +- .../appsmith/help/CollapsibleHelp.tsx | 2 +- .../appsmith/help/DocumentationSearch.tsx | 34 +- .../designSystems/appsmith/help/HelpModal.tsx | 14 +- .../blueprint/ButtonComponent.tsx | 36 +- .../blueprint/CheckboxComponent.tsx | 10 +- .../designSystems/blueprint/CloseButton.tsx | 6 +- .../blueprint/DatePickerComponent.tsx | 12 +- .../blueprint/DatePickerComponent2.tsx | 12 +- .../blueprint/DropdownComponent.tsx | 56 ++-- .../blueprint/InputComponent.tsx | 56 ++-- .../blueprint/ModalComponent.tsx | 18 +- .../blueprint/RadioGroupComponent.tsx | 6 +- .../blueprint/SpinnerComponent.tsx | 2 +- .../blueprint/SwitchComponent.tsx | 12 +- .../designSystems/blueprint/TextComponent.tsx | 12 +- .../editorComponents/ActionCreator.tsx | 98 +++--- .../editorComponents/ActionNameEditor.tsx | 34 +- .../editorComponents/ApiResponseView.tsx | 38 +-- .../components/editorComponents/Button.tsx | 2 +- .../components/editorComponents/Checkbox.tsx | 6 +- .../editorComponents/CloseEditor.tsx | 12 +- .../CodeEditor/BindingPrompt.tsx | 16 +- .../CodeEditor/CodeEditor.test.tsx | 12 +- .../CodeEditor/EvaluatedValuePopup.test.tsx | 10 +- .../CodeEditor/EvaluatedValuePopup.tsx | 60 ++-- .../editorComponents/CodeEditor/index.tsx | 74 ++--- .../editorComponents/ContextDropdown.tsx | 66 ++-- .../editorComponents/Debugger/DebugCTA.tsx | 12 +- .../Debugger/DebuggerLogs.tsx | 10 +- .../Debugger/DebuggerMessage.tsx | 4 +- .../Debugger/DebuggerTabs.tsx | 8 +- .../editorComponents/Debugger/EntityLink.tsx | 28 +- .../editorComponents/Debugger/Errors.tsx | 4 +- .../Debugger/FilterHeader.tsx | 18 +- .../editorComponents/Debugger/LogItem.tsx | 26 +- .../Debugger/Resizer/index.tsx | 4 +- .../editorComponents/Debugger/helpers.tsx | 4 +- .../editorComponents/Debugger/index.tsx | 8 +- .../editorComponents/DragLayerComponent.tsx | 18 +- .../editorComponents/DraggableComponent.tsx | 8 +- .../editorComponents/DropTargetComponent.tsx | 28 +- .../editorComponents/DropdownComponent.tsx | 36 +- .../components/editorComponents/Dropzone.tsx | 14 +- .../editorComponents/EditableText.tsx | 20 +- .../EditorContextProvider.tsx | 4 +- .../editorComponents/EntityNameComponent.tsx | 10 +- .../editorComponents/ErrorTooltip.tsx | 12 +- .../GlobalSearch/ActionLink.tsx | 4 +- .../GlobalSearch/AlgoliaSearchWrapper.tsx | 6 +- .../GlobalSearch/Description.tsx | 16 +- .../GlobalSearch/GlobalSearchHotKeys.tsx | 10 +- .../editorComponents/GlobalSearch/HelpBar.tsx | 8 +- .../GlobalSearch/Highlight.tsx | 4 +- .../GlobalSearch/ResultsNotFound.tsx | 40 +-- .../GlobalSearch/SearchBox.tsx | 12 +- .../GlobalSearch/SearchModal.tsx | 38 ++- .../GlobalSearch/SearchResults.tsx | 81 ++--- .../GlobalSearch/SetSearchResults.tsx | 4 +- .../editorComponents/GlobalSearch/index.tsx | 8 +- .../editorComponents/HelperTooltip.tsx | 18 +- .../HighlightedCode/index.tsx | 6 +- .../editorComponents/InputComponent.tsx | 8 +- .../editorComponents/LetterIcon.tsx | 4 +- .../LightningMenu/LightningMenuTrigger.tsx | 14 +- .../LightningMenu/helpers.tsx | 4 +- .../editorComponents/LightningMenu/index.tsx | 8 +- .../editorComponents/NavBarItem.tsx | 6 +- .../editorComponents/Onboarding/Boxed.tsx | 7 +- .../editorComponents/Onboarding/EndTour.tsx | 4 +- .../Onboarding/EndTourHelper.tsx | 4 +- .../editorComponents/Onboarding/Helper.tsx | 8 +- .../editorComponents/Onboarding/Indicator.tsx | 16 +- .../Onboarding/WelcomeHelper.tsx | 4 +- .../editorComponents/PageLoader.tsx | 4 +- .../editorComponents/ReadOnlyEditor.tsx | 4 +- .../editorComponents/RequestView.tsx | 10 +- .../editorComponents/ResizableComponent.tsx | 12 +- .../editorComponents/SelectComponent.tsx | 4 +- .../editorComponents/StoreAsDatasource.tsx | 4 +- .../WidgetNameComponent/DeleteControl.tsx | 4 +- .../WidgetNameComponent/HelpControl.tsx | 6 +- .../WidgetNameComponent/SettingsControl.tsx | 14 +- .../WidgetNameComponent/index.tsx | 6 +- .../form/CredentialsTooltip.tsx | 18 +- .../editorComponents/form/FieldError.tsx | 4 +- .../form/FormDialogComponent.tsx | 34 +- .../editorComponents/form/FormFooter.tsx | 22 +- .../editorComponents/form/FormMessage.tsx | 22 +- .../editorComponents/form/FormTextField.tsx | 14 +- .../form/fields/CheckboxField.tsx | 14 +- .../form/fields/DropdownField.tsx | 8 +- .../form/fields/DropdownFieldWrapper.tsx | 10 +- .../form/fields/DropdownWrapper.tsx | 6 +- .../fields/EmbeddedDatasourcePathField.tsx | 8 +- .../form/fields/KeyValueFieldArray.tsx | 62 ++-- .../form/fields/NumberField.tsx | 6 +- .../form/fields/RadioGroupField.tsx | 12 +- .../form/fields/RadioGroupWrapper.tsx | 14 +- .../form/fields/RequestDropdownField.tsx | 10 +- .../form/fields/SelectField.tsx | 16 +- .../form/fields/TagListField.tsx | 16 +- .../form/fields/TextField.tsx | 4 +- .../formControls/CheckboxControl.tsx | 2 +- .../formControls/DropDownControl.tsx | 6 +- .../DynamicInputTextControl.test.tsx | 16 +- .../formControls/DynamicInputTextControl.tsx | 8 +- .../DynamicTextFieldControl.test.tsx | 20 +- .../formControls/DynamicTextFieldControl.tsx | 12 +- .../formControls/FilePickerControl.tsx | 8 +- .../formControls/FixedKeyInputControl.tsx | 8 +- .../formControls/InputNumberControl.tsx | 10 +- .../formControls/InputTextControl.tsx | 22 +- .../formControls/KeyValueArrayControl.tsx | 176 +++++----- .../formControls/KeyValueInputControl.tsx | 10 +- .../components/formControls/SwitchControl.tsx | 18 +- .../ActionSelectorControl.tsx | 8 +- .../propertyControls/ChartDataControl.tsx | 46 +-- .../propertyControls/CodeEditorControl.tsx | 6 +- .../propertyControls/ColorPickerControl.tsx | 2 +- .../ColumnActionSelectorControl.tsx | 24 +- .../ComputeTablePropertyControl.tsx | 30 +- .../CustomFusionChartControl.tsx | 10 +- .../propertyControls/DatePickerControl.tsx | 12 +- .../propertyControls/DropDownControl.tsx | 8 +- .../propertyControls/IconTabControl.tsx | 2 +- .../propertyControls/InputTextControl.tsx | 30 +- .../propertyControls/KeyValueComponent.tsx | 24 +- .../LocationSearchControl.tsx | 16 +- .../propertyControls/MultiSelectControl.tsx | 10 +- .../propertyControls/MultiSwitchControl.tsx | 6 +- .../PrimaryColumnsControl.tsx | 32 +- .../propertyControls/StepControl.tsx | 8 +- .../propertyControls/SwitchControl.tsx | 2 +- .../propertyControls/TabControl.tsx | 28 +- .../src/components/stories/Button.stories.tsx | 10 +- .../components/stories/Callout.stories.tsx | 20 +- .../components/stories/Checkbox.stories.tsx | 20 +- .../stories/ColorSelector.stories.tsx | 20 +- .../components/stories/Dropdown.stories.tsx | 207 ++++++------ .../stories/EditableText.stories.tsx | 20 +- .../components/stories/FilePicker.stories.tsx | 2 +- .../src/components/stories/Icon.stories.tsx | 62 ++-- .../stories/IconSelector.stories.tsx | 48 +-- .../src/components/stories/Menu.stories.tsx | 46 +-- .../src/components/stories/Radio.stories.tsx | 76 ++--- .../stories/SearchInput.stories.tsx | 32 +- .../src/components/stories/Table.stories.tsx | 36 +- .../stories/TableDropdown.stories.tsx | 30 +- .../src/components/stories/Tabs.stories.tsx | 70 ++-- .../src/components/stories/Text.stories.tsx | 82 ++--- .../components/stories/TextInput.stories.tsx | 52 +-- .../src/components/stories/Toast.stories.tsx | 16 +- .../src/components/stories/Toggle.stories.tsx | 22 +- .../components/stories/Tooltip.stories.tsx | 38 ++- .../components/utils/CollapseComponent.tsx | 8 +- .../src/components/utils/EmptyDataState.tsx | 4 +- app/client/src/components/utils/Skeleton.tsx | 4 +- .../src/components/utils/TreeStructure.tsx | 4 +- app/client/src/globalStyles/index.tsx | 4 +- app/client/src/icons/ControlIcons.tsx | 2 +- app/client/src/icons/FormIcons.tsx | 6 +- app/client/src/icons/MenuIcons.tsx | 2 +- app/client/src/index.tsx | 10 +- app/client/src/pages/AppViewer/AppPage.tsx | 4 +- .../AppViewer/AppViewerPageContainer.tsx | 8 +- app/client/src/pages/AppViewer/index.tsx | 6 +- .../AppViewer/viewer/AppViewerHeader.tsx | 32 +- .../src/pages/AppViewer/viewer/PageTabs.tsx | 28 +- .../AppViewer/viewer/PageTabsContainer.tsx | 16 +- .../src/pages/AppViewer/viewer/SideNav.tsx | 14 +- .../pages/AppViewer/viewer/SideNavItem.tsx | 10 +- .../viewer/getAppViewerHeaderCTA.tsx | 2 +- .../pages/Applications/ApplicationCard.tsx | 84 ++--- .../pages/Applications/ApplicationLoaders.tsx | 8 +- .../Applications/CreateApplicationForm.tsx | 16 +- .../Applications/ForkApplicationModal.tsx | 22 +- .../ProductUpdatesModal/ReleaseComponent.tsx | 10 +- .../ProductUpdatesModal/UpdatesButton.tsx | 24 +- .../ProductUpdatesModal/index.tsx | 30 +- app/client/src/pages/Applications/index.tsx | 110 +++--- .../pages/Editor/APIEditor/ApiHomeScreen.tsx | 278 ++++++++-------- .../pages/Editor/APIEditor/CurlImportForm.tsx | 24 +- .../src/pages/Editor/APIEditor/Form.tsx | 90 +++-- .../src/pages/Editor/APIEditor/Pagination.tsx | 24 +- .../pages/Editor/APIEditor/PostBodyData.tsx | 32 +- .../Editor/APIEditor/ProviderTemplates.tsx | 56 ++-- .../Editor/APIEditor/RapidApiEditorForm.tsx | 56 ++-- .../Editor/APIEditor/ResultPagination.tsx | 2 +- .../src/pages/Editor/APIEditor/index.tsx | 28 +- .../src/pages/Editor/ActionSettings.tsx | 4 +- app/client/src/pages/Editor/Canvas.tsx | 4 +- .../src/pages/Editor/ConfirmRunModal.tsx | 6 +- .../Editor/DataSourceEditor/BackButton.tsx | 4 +- .../Editor/DataSourceEditor/Collapsible.tsx | 2 +- .../Editor/DataSourceEditor/Connected.tsx | 12 +- .../pages/Editor/DataSourceEditor/DBForm.tsx | 26 +- .../DataSourceEditor/DatasourceHome.tsx | 6 +- .../Editor/DataSourceEditor/FormTitle.tsx | 14 +- .../Editor/DataSourceEditor/JSONtoForm.tsx | 2 +- .../RestAPIDatasourceForm.tsx | 88 ++--- .../pages/Editor/DataSourceEditor/index.tsx | 34 +- .../src/pages/Editor/EditableAppName.tsx | 18 +- app/client/src/pages/Editor/EditorHeader.tsx | 60 ++-- app/client/src/pages/Editor/EditorSidebar.tsx | 313 +++++++++--------- .../src/pages/Editor/EntityNotFoundPane.tsx | 16 +- .../Editor/Explorer/Actions/ActionEntity.tsx | 18 +- .../Actions/ActionEntityContextMenu.tsx | 6 +- .../Editor/Explorer/Actions/ActionsGroup.tsx | 60 ++-- .../Explorer/Actions/MoreActionsMenu.tsx | 10 +- .../pages/Editor/Explorer/Actions/helpers.tsx | 8 +- .../Editor/Explorer/ContextMenuTrigger.tsx | 8 +- .../Datasources/DataSourceContextMenu.tsx | 10 +- .../Explorer/Datasources/DatasourceEntity.tsx | 32 +- .../Explorer/Datasources/DatasourceField.tsx | 10 +- .../Datasources/DatasourceStructure.tsx | 30 +- .../DatasourceStructureContainer.tsx | 54 +-- .../Explorer/Datasources/QueryTemplates.tsx | 6 +- .../Editor/Explorer/Entity/AddButton.tsx | 2 +- .../pages/Editor/Explorer/Entity/Collapse.tsx | 8 +- .../Editor/Explorer/Entity/CollapseToggle.tsx | 10 +- .../Editor/Explorer/Entity/EntityProperty.tsx | 22 +- .../pages/Editor/Explorer/Entity/Loader.tsx | 6 +- .../src/pages/Editor/Explorer/Entity/Name.tsx | 16 +- .../Editor/Explorer/Entity/Placeholder.tsx | 6 +- .../pages/Editor/Explorer/Entity/index.tsx | 18 +- .../pages/Editor/Explorer/EntityExplorer.tsx | 14 +- .../pages/Editor/Explorer/ExplorerIcons.tsx | 44 +-- .../pages/Editor/Explorer/ExplorerSearch.tsx | 8 +- .../pages/Editor/Explorer/ExplorerTitle.tsx | 4 +- .../pages/Editor/Explorer/JSDependencies.tsx | 8 +- .../Explorer/Onboarding/DBQueryGroup.tsx | 4 +- .../Editor/Explorer/Onboarding/Loading.tsx | 10 +- .../Editor/Explorer/Onboarding/index.tsx | 4 +- .../Editor/Explorer/Pages/PageContextMenu.tsx | 8 +- .../Editor/Explorer/Pages/PageEntity.tsx | 36 +- .../pages/Editor/Explorer/Pages/PageGroup.tsx | 14 +- .../Explorer/PluginGroup/PluginGroup.tsx | 24 +- .../pages/Editor/Explorer/TreeDropdown.tsx | 20 +- .../Explorer/Widgets/WidgetContextMenu.tsx | 10 +- .../Editor/Explorer/Widgets/WidgetEntity.tsx | 49 ++- .../Editor/Explorer/Widgets/WidgetGroup.tsx | 22 +- .../src/pages/Editor/Explorer/index.tsx | 4 +- app/client/src/pages/Editor/FormControl.tsx | 4 +- app/client/src/pages/Editor/GlobalHotKeys.tsx | 32 +- app/client/src/pages/Editor/HelpButton.tsx | 12 +- app/client/src/pages/Editor/MainContainer.tsx | 6 +- .../Editor/MainContainerLayoutControl.tsx | 10 +- .../Editor/PageListSidebar/PageListItem.tsx | 12 +- app/client/src/pages/Editor/Popper.tsx | 8 +- .../pages/Editor/PropertyPane/Generator.tsx | 14 +- .../PropertyPane/PanelPropertiesEditor.tsx | 28 +- .../Editor/PropertyPane/PropertyControl.tsx | 8 +- .../Editor/PropertyPane/PropertyHelpLabel.tsx | 12 +- .../PropertyPane/PropertyPaneGenerator.tsx | 14 +- .../Editor/PropertyPane/PropertySection.tsx | 4 +- .../src/pages/Editor/PropertyPane/index.tsx | 54 +-- .../pages/Editor/PropertyPaneHelpButton.tsx | 2 +- .../src/pages/Editor/PropertyPaneTitle.tsx | 16 +- .../QueryEditor/AddDatasourceSecurely.tsx | 12 +- .../Editor/QueryEditor/DatasourceCard.tsx | 18 +- .../Editor/QueryEditor/EditorJSONtoForm.tsx | 115 +++---- .../Editor/QueryEditor/QueryHomeScreen.tsx | 8 +- .../src/pages/Editor/QueryEditor/Table.tsx | 4 +- .../pages/Editor/QueryEditor/TemplateMenu.tsx | 10 +- .../src/pages/Editor/QueryEditor/index.tsx | 52 ++- .../pages/Editor/SaaSEditor/ActionForm.tsx | 4 +- .../Editor/SaaSEditor/DatasourceCard.tsx | 18 +- .../Editor/SaaSEditor/DatasourceForm.tsx | 86 +++-- .../src/pages/Editor/SaaSEditor/ListView.tsx | 10 +- .../src/pages/Editor/ShareApplicationForm.tsx | 10 +- app/client/src/pages/Editor/Welcome.tsx | 4 +- app/client/src/pages/Editor/WidgetCard.tsx | 10 +- .../src/pages/Editor/WidgetCardsPane.tsx | 4 +- app/client/src/pages/Editor/WidgetSidebar.tsx | 26 +- app/client/src/pages/Editor/WidgetsEditor.tsx | 6 +- app/client/src/pages/Editor/routes.tsx | 24 +- app/client/src/pages/UserAuth/FooterLinks.tsx | 22 +- .../src/pages/UserAuth/ForgotPassword.tsx | 20 +- app/client/src/pages/UserAuth/Login.tsx | 30 +- .../src/pages/UserAuth/ResetPassword.tsx | 22 +- app/client/src/pages/UserAuth/SignUp.tsx | 28 +- .../src/pages/UserAuth/ThirdPartyAuth.tsx | 12 +- app/client/src/pages/UserAuth/index.tsx | 12 +- .../src/pages/UserAuth/requiresAuthHOC.tsx | 4 +- app/client/src/pages/UserProfile/General.tsx | 16 +- app/client/src/pages/UserProfile/index.tsx | 10 +- app/client/src/pages/common/AppHeader.tsx | 14 +- app/client/src/pages/common/ClientError.tsx | 14 +- .../pages/common/CustomizedDropdown/Badge.tsx | 6 +- .../CustomizedDropdown/OrgDropdownData.tsx | 2 +- .../pages/common/CustomizedDropdown/index.tsx | 79 +++-- app/client/src/pages/common/ErrorPage.tsx | 4 +- .../src/pages/common/ErrorPageHeader.tsx | 14 +- app/client/src/pages/common/Loader.tsx | 4 +- app/client/src/pages/common/LoginHeader.tsx | 6 +- app/client/src/pages/common/NotFound.tsx | 14 +- app/client/src/pages/common/PageHeader.tsx | 14 +- .../src/pages/common/PageLoadingBar.tsx | 14 +- app/client/src/pages/common/PageNotFound.tsx | 14 +- app/client/src/pages/common/PageWrapper.tsx | 4 +- .../src/pages/common/ProfileDropdown.tsx | 18 +- app/client/src/pages/common/ProfileImage.tsx | 2 +- app/client/src/pages/common/ServerTimeout.tsx | 6 +- .../src/pages/common/ServerUnavailable.tsx | 6 +- app/client/src/pages/common/SubHeader.tsx | 12 +- app/client/src/pages/common/ThemeSwitcher.tsx | 4 +- .../pages/organization/AppInviteUsersForm.tsx | 44 ++- .../organization/CreateOrganizationForm.tsx | 24 +- app/client/src/pages/organization/General.tsx | 48 ++- .../src/pages/organization/ManageUsers.tsx | 4 +- app/client/src/pages/organization/Members.tsx | 30 +- .../pages/organization/OrgInviteUsersForm.tsx | 42 +-- .../src/pages/organization/defaultOrgPage.tsx | 12 +- app/client/src/pages/organization/index.tsx | 6 +- .../src/pages/organization/settings.tsx | 14 +- app/client/src/pages/organization/users.tsx | 28 +- app/client/src/pages/users/index.tsx | 10 +- app/client/src/resizable/index.tsx | 26 +- app/client/src/widgets/BaseWidget.tsx | 10 +- app/client/src/widgets/ButtonWidget.tsx | 18 +- app/client/src/widgets/ChartWidget/index.tsx | 16 +- app/client/src/widgets/CheckboxWidget.tsx | 12 +- app/client/src/widgets/DatePickerWidget.tsx | 12 +- app/client/src/widgets/DatePickerWidget2.tsx | 12 +- app/client/src/widgets/DropdownWidget.tsx | 20 +- app/client/src/widgets/FilepickerWidget.tsx | 10 +- app/client/src/widgets/FormButtonWidget.tsx | 18 +- app/client/src/widgets/IconWidget.tsx | 6 +- app/client/src/widgets/ImageWidget.tsx | 8 +- app/client/src/widgets/InputWidget.tsx | 22 +- .../src/widgets/ListWidget/ListComponent.tsx | 4 +- .../src/widgets/ListWidget/ListPagination.tsx | 12 +- .../src/widgets/ListWidget/ListWidget.tsx | 6 +- app/client/src/widgets/MapWidget.tsx | 32 +- app/client/src/widgets/ModalWidget.tsx | 28 +- app/client/src/widgets/RadioGroupWidget.tsx | 10 +- .../src/widgets/RichTextEditorWidget.tsx | 8 +- app/client/src/widgets/SwitchWidget.tsx | 10 +- app/client/src/widgets/TableWidget/index.tsx | 60 ++-- app/client/src/widgets/Tabs/TabsMigrator.tsx | 3 +- .../src/widgets/Tabs/TabsWidget.test.tsx | 10 +- app/client/src/widgets/TextWidget.tsx | 14 +- app/client/src/widgets/VideoWidget.tsx | 44 +-- 420 files changed, 4416 insertions(+), 4482 deletions(-) diff --git a/app/client/.eslintrc.json b/app/client/.eslintrc.json index 0e6d1239e1..fe0ab77466 100644 --- a/app/client/.eslintrc.json +++ b/app/client/.eslintrc.json @@ -28,7 +28,13 @@ "react/prop-types": 0, "@typescript-eslint/explicit-module-boundary-types": 0, "cypress/no-unnecessary-waiting": 0, - "cypress/no-assigning-return-values": 0 + "cypress/no-assigning-return-values": 0, + "react/function-component-definition": "warn", + "react/jsx-boolean-value": "error", + "react/self-closing-comp": "error", + "react/jsx-sort-props": "error", + "react/jsx-fragments": "error", + "react/jsx-no-useless-fragment": "error" }, "settings": { "react": { diff --git a/app/client/src/AppErrorBoundry.tsx b/app/client/src/AppErrorBoundry.tsx index 776993508a..172c4aab80 100644 --- a/app/client/src/AppErrorBoundry.tsx +++ b/app/client/src/AppErrorBoundry.tsx @@ -51,7 +51,7 @@ class AppErrorBoundary extends Component { if (this.state.hasError) { return ( - App crashed + App crashed

Oops! Something went wrong

diff --git a/app/client/src/AppRouter.tsx b/app/client/src/AppRouter.tsx index 9d91296f6e..1ba02d5b77 100644 --- a/app/client/src/AppRouter.tsx +++ b/app/client/src/AppRouter.tsx @@ -90,24 +90,24 @@ class AppRouter extends React.Component { <> - + - - - + + + - + - - + + diff --git a/app/client/src/LandingScreen.tsx b/app/client/src/LandingScreen.tsx index 3a3457aee1..8b456959a9 100755 --- a/app/client/src/LandingScreen.tsx +++ b/app/client/src/LandingScreen.tsx @@ -13,7 +13,7 @@ type Props = { authError: string; }; -const LandingScreen = (props: Props) => { +function LandingScreen(props: Props) { if (props.user && window.location.pathname === BASE_URL) { if (props.user.email === ANONYMOUS_USERNAME) { return ; @@ -25,7 +25,7 @@ const LandingScreen = (props: Props) => { return ; } return ; -}; +} const mapStateToProps = (state: AppState) => ({ user: getCurrentUser(state), diff --git a/app/client/src/components/ads/AppIcon.tsx b/app/client/src/components/ads/AppIcon.tsx index adb38cc047..bfc56042cd 100644 --- a/app/client/src/components/ads/AppIcon.tsx +++ b/app/client/src/components/ads/AppIcon.tsx @@ -223,7 +223,7 @@ export type AppIconProps = CommonComponentProps & { name: AppIconName; }; -const AppIcon = (props: AppIconProps) => { +function AppIcon(props: AppIconProps) { const styledProps = useMemo(() => appSizeHandler(props.size || Size.medium), [ props, ]); @@ -484,6 +484,6 @@ const AppIcon = (props: AppIconProps) => { {returnIcon} ) : null; -}; +} export default AppIcon; diff --git a/app/client/src/components/ads/Button.tsx b/app/client/src/components/ads/Button.tsx index 584a257d82..ea97229575 100644 --- a/app/client/src/components/ads/Button.tsx +++ b/app/client/src/components/ads/Button.tsx @@ -376,13 +376,13 @@ const IconSizeProp = (size?: Size) => { return size ? sizeMapping[size] : IconSize.SMALL; }; -const TextLoadingState = ({ text }: { text?: string }) => ( - {text} -); +function TextLoadingState({ text }: { text?: string }) { + return {text}; +} -const IconLoadingState = ({ size, icon }: { size?: Size; icon?: IconName }) => ( - -); +function IconLoadingState({ size, icon }: { size?: Size; icon?: IconName }) { + return ; +} const getIconContent = (props: ButtonProps) => props.icon ? ( @@ -410,39 +410,44 @@ const getButtonContent = (props: ButtonProps) => ( ); -const ButtonComponent = (props: ButtonProps) => ( - ) => - props.onClick && props.onClick(e) - } - > - {getButtonContent(props)} - -); +function ButtonComponent(props: ButtonProps) { + return ( + ) => + props.onClick && props.onClick(e) + } + > + {getButtonContent(props)} + + ); +} -const LinkButtonComponent = (props: ButtonProps) => ( - ) => - props.onClick && props.onClick(e) - } - > - {getButtonContent(props)} - -); +function LinkButtonComponent(props: ButtonProps) { + return ( + ) => + props.onClick && props.onClick(e) + } + > + {getButtonContent(props)} + + ); +} -const Button = (props: ButtonProps) => - props.tag === "button" ? ( +function Button(props: ButtonProps) { + return props.tag === "button" ? ( ) : ( ); +} export default Button; diff --git a/app/client/src/components/ads/ButtonTabComponent.tsx b/app/client/src/components/ads/ButtonTabComponent.tsx index 4fd11e6b73..4fe5bbe03f 100644 --- a/app/client/src/components/ads/ButtonTabComponent.tsx +++ b/app/client/src/components/ads/ButtonTabComponent.tsx @@ -41,7 +41,7 @@ interface ButtonTabComponentProps { selectButton: (value: string) => void; } -const ButtonTabComponent = (props: ButtonTabComponentProps) => { +function ButtonTabComponent(props: ButtonTabComponentProps) { return ( {props.options.map((option: ButtonTabOption, index: number) => { @@ -50,17 +50,17 @@ const ButtonTabComponent = (props: ButtonTabComponentProps) => { const isSelected = props.values.includes(option.value); return ( props.selectButton(option.value)} className={`t--button-tab-${option.value}`} + key={index} + onClick={() => props.selectButton(option.value)} + selected={isSelected} > - + ); })} ); -}; +} export default ButtonTabComponent; diff --git a/app/client/src/components/ads/Callout.tsx b/app/client/src/components/ads/Callout.tsx index a1eeabb6e8..2df99e39a2 100644 --- a/app/client/src/components/ads/Callout.tsx +++ b/app/client/src/components/ads/Callout.tsx @@ -73,14 +73,14 @@ Callout.defaultProps = { function Callout(props: CalloutProps) { return ( - + {props.text && props.variant !== Variant.info ? ( ) : null} {props.text} {props.label ? props.label : null} {props.closeButton ? ( -

-
+
{fileInfo.name} {fileInfo.size}KB
-
+
); -}; +} -const FilePicker = (props: FilePickerProps) => { +function FilePicker(props: FilePickerProps) { return ( ); -}; +} export default FilePicker; diff --git a/app/client/src/components/ads/GifPlayerComponent.tsx b/app/client/src/components/ads/GifPlayerComponent.tsx index abd58e55af..3074ee7e0d 100644 --- a/app/client/src/components/ads/GifPlayerComponent.tsx +++ b/app/client/src/components/ads/GifPlayerComponent.tsx @@ -52,24 +52,20 @@ const Overlay = styled.div` transition: 0.5s ease; `; -const GifPlayerComponent = (props: GifPlayerProps) => { +function GifPlayerComponent(props: GifPlayerProps) { const [startGif, setStartGif] = useState(false); - return ( - - {!startGif ? ( - setStartGif(!startGif)}> - - - - - Click to play - - - ) : ( - - )} - + return !startGif ? ( + setStartGif(!startGif)}> + + + + + Click to play + + + ) : ( + ); -}; +} export default GifPlayerComponent; diff --git a/app/client/src/components/ads/Icon.tsx b/app/client/src/components/ads/Icon.tsx index ac3a081541..d1e7283cab 100644 --- a/app/client/src/components/ads/Icon.tsx +++ b/app/client/src/components/ads/Icon.tsx @@ -364,7 +364,7 @@ const Icon = forwardRef( case "PARAGRAPH": case "PARAGRAPH_TWO": const ControlIcon = ControlIcons[props.name]; - returnIcon = ; + returnIcon = ; break; default: diff --git a/app/client/src/components/ads/IconSelector.tsx b/app/client/src/components/ads/IconSelector.tsx index e71b7f6317..61b0632d26 100644 --- a/app/client/src/components/ads/IconSelector.tsx +++ b/app/client/src/components/ads/IconSelector.tsx @@ -58,7 +58,7 @@ const IconBox = styled.div<{ selectedColor?: string }>` : null}; `; -const IconSelector = (props: IconSelectorProps) => { +function IconSelector(props: IconSelectorProps) { const iconRef = useRef(null); const [selected, setSelected] = useState(firstSelectedIcon()); const iconPaletteRef = React.createRef(); @@ -87,8 +87,8 @@ const IconSelector = (props: IconSelectorProps) => { return ( {props.iconPalette && @@ -96,19 +96,19 @@ const IconSelector = (props: IconSelectorProps) => { return ( { if (iconName !== selected) { setSelected(iconName); props.onSelect && props.onSelect(iconName); } }} + selectedColor={selected === iconName ? props.selectedColor : ""} > @@ -117,7 +117,7 @@ const IconSelector = (props: IconSelectorProps) => { ); -}; +} IconSelector.defaultProps = { fill: false, diff --git a/app/client/src/components/ads/IconTabsComponent.tsx b/app/client/src/components/ads/IconTabsComponent.tsx index 36dea7abc2..0ea7d8e293 100644 --- a/app/client/src/components/ads/IconTabsComponent.tsx +++ b/app/client/src/components/ads/IconTabsComponent.tsx @@ -38,7 +38,7 @@ interface IconTabsComponentProps { selectOption: (value: string) => void; } -const IconTabsComponent = (props: IconTabsComponentProps) => { +function IconTabsComponent(props: IconTabsComponentProps) { return ( {props.options.map((option: IconTabOption, index: number) => { @@ -47,17 +47,17 @@ const IconTabsComponent = (props: IconTabsComponentProps) => { const isSelected = props.value === option.value; return ( props.selectOption(option.value)} className={`t--icon-tab-${option.value}`} + key={index} + onClick={() => props.selectOption(option.value)} + selected={isSelected} > - + ); })} ); -}; +} export default IconTabsComponent; diff --git a/app/client/src/components/ads/Menu.tsx b/app/client/src/components/ads/Menu.tsx index 116dcfed15..dc3437cba9 100644 --- a/app/client/src/components/ads/Menu.tsx +++ b/app/client/src/components/ads/Menu.tsx @@ -24,18 +24,18 @@ const MenuOption = styled.div` font-family: ${(props) => props.theme.fonts[3]}; `; -const Menu = (props: MenuProps) => { +function Menu(props: MenuProps) { return ( {props.target} @@ -46,6 +46,6 @@ const Menu = (props: MenuProps) => { ); -}; +} export default Menu; diff --git a/app/client/src/components/ads/MenuItem.tsx b/app/client/src/components/ads/MenuItem.tsx index cf0b12e76c..6bf988dfa9 100644 --- a/app/client/src/components/ads/MenuItem.tsx +++ b/app/client/src/components/ads/MenuItem.tsx @@ -90,7 +90,7 @@ const IconContainer = styled.span` const MenuItem = forwardRef( (props: MenuItemProps, ref: Ref) => { return props.ellipsize && props.text.length > props.ellipsize ? ( - + ) : ( @@ -102,13 +102,13 @@ const MenuItemContent = forwardRef( (props: MenuItemProps, ref: Ref) => { return ( {props.icon ? : null} diff --git a/app/client/src/components/ads/MultiSwitch.tsx b/app/client/src/components/ads/MultiSwitch.tsx index e1382bafff..1e08617841 100644 --- a/app/client/src/components/ads/MultiSwitch.tsx +++ b/app/client/src/components/ads/MultiSwitch.tsx @@ -55,10 +55,10 @@ export default function MultiSwitch(props: MultiSwitchProps) { {props.tabs.map((tab) => ( props.onSelect(tab.title)} + selected={props.selected.value === tab.key} > - + {tab.title} diff --git a/app/client/src/components/ads/MultiselectDropdown.tsx b/app/client/src/components/ads/MultiselectDropdown.tsx index d4c258a1fd..57b3a9d6e2 100644 --- a/app/client/src/components/ads/MultiselectDropdown.tsx +++ b/app/client/src/components/ads/MultiselectDropdown.tsx @@ -166,7 +166,7 @@ type DropdownProps = CommonComponentProps & { selectAllQuantifier?: string; }; -const MultiSelectDropdown = (props: DropdownProps) => { +function MultiSelectDropdown(props: DropdownProps) { const [isOpen, setIsOpen] = useState(false); const [containerWidth, setContainerWidth] = useState("0px"); @@ -229,23 +229,23 @@ const MultiSelectDropdown = (props: DropdownProps) => { return ( setIsOpen(state)} boundary="scrollParent" + isOpen={isOpen && !props.disabled} + minimal + onInteraction={(state) => setIsOpen(state)} + position={Position.TOP_LEFT} > setIsOpen(!isOpen)} className={props.className} + disabled={props.disabled} + isOpen={isOpen} + onClick={() => setIsOpen(!isOpen)} > {props.selected.length @@ -260,12 +260,12 @@ const MultiSelectDropdown = (props: DropdownProps) => { {props.options.map((option: DropdownOption, index: number) => { return ( { optionClickHandler(option.value as string); }} - className="t--multi-dropdown-option" + selected={isItemSelected(option.value)} > {option.icon ? ( @@ -288,6 +288,6 @@ const MultiSelectDropdown = (props: DropdownProps) => { ); -}; +} export default MultiSelectDropdown; diff --git a/app/client/src/components/ads/Radio.tsx b/app/client/src/components/ads/Radio.tsx index 8d21f828db..2d89c7e2d3 100644 --- a/app/client/src/components/ads/Radio.tsx +++ b/app/client/src/components/ads/Radio.tsx @@ -129,29 +129,29 @@ export default function RadioComponent(props: RadioProps) { return ( onChangeHandler(e.target.value)} className={props.className} + columns={props.columns} + data-cy={props.cypressSelector} + onChange={(e: any) => onChangeHandler(e.target.value)} + rows={props.rows} > {props.options.map((option: OptionProps, index: number) => ( {option.label} option.onSelect && option.onSelect(e.target.value)} type="radio" value={option.value} - disabled={props.disabled || option.disabled} - onChange={(e) => option.onSelect && option.onSelect(e.target.value)} - checked={selected === option.value} - name="radio" /> - + ))} diff --git a/app/client/src/components/ads/RectangularSwitcher.tsx b/app/client/src/components/ads/RectangularSwitcher.tsx index 179c662ea9..08228fb044 100644 --- a/app/client/src/components/ads/RectangularSwitcher.tsx +++ b/app/client/src/components/ads/RectangularSwitcher.tsx @@ -100,14 +100,13 @@ export default function Switch(props: SwitchProps) { return ( ) => { if (!firstRender) { @@ -115,8 +114,9 @@ export default function Switch(props: SwitchProps) { } onChangeHandler(e.target.checked); }} + type="checkbox" /> - + Light diff --git a/app/client/src/components/ads/ScrollIndicator.tsx b/app/client/src/components/ads/ScrollIndicator.tsx index cc1c88a758..159164bc2d 100644 --- a/app/client/src/components/ads/ScrollIndicator.tsx +++ b/app/client/src/components/ads/ScrollIndicator.tsx @@ -47,7 +47,7 @@ interface Props { right?: string; mode?: "DARK" | "LIGHT"; } -const ScrollIndicator = ({ containerRef, top, bottom, right }: Props) => { +function ScrollIndicator({ containerRef, top, bottom, right }: Props) { const [{ thumbPosition }, setThumbPosition] = useSpring<{ thumbPosition: number; config: { @@ -105,10 +105,10 @@ const ScrollIndicator = ({ containerRef, top, bottom, right }: Props) => { return ( { /> ); -}; +} export default ScrollIndicator; diff --git a/app/client/src/components/ads/SearchInput.tsx b/app/client/src/components/ads/SearchInput.tsx index f0feeb39b2..6a3e6f27c2 100644 --- a/app/client/src/components/ads/SearchInput.tsx +++ b/app/client/src/components/ads/SearchInput.tsx @@ -118,30 +118,30 @@ const SearchInput = forwardRef( return ( - + setIsFocused(true)} onBlur={() => setIsFocused(false)} onChange={memoizedChangeHandler} + onFocus={() => setIsFocused(true)} + placeholder={props.placeholder ? props.placeholder : ""} /> {searchValue && props.variant === SearchVariant.BACKGROUND ? ( setSearchValue("")} + size={IconSize.MEDIUM} /> ) : null} diff --git a/app/client/src/components/ads/Spinner.tsx b/app/client/src/components/ads/Spinner.tsx index 4f1b24bcbd..a1e7cb7247 100644 --- a/app/client/src/components/ads/Spinner.tsx +++ b/app/client/src/components/ads/Spinner.tsx @@ -48,11 +48,11 @@ Spinner.defaultProp = { export default function Spinner(props: SpinnerProp) { return ( - + ); } diff --git a/app/client/src/components/ads/StepComponent.tsx b/app/client/src/components/ads/StepComponent.tsx index 8826f22b56..403fb24c77 100644 --- a/app/client/src/components/ads/StepComponent.tsx +++ b/app/client/src/components/ads/StepComponent.tsx @@ -63,7 +63,7 @@ interface StepComponentProps { onChange: (value: number) => void; } -export const StepComponent = (props: StepComponentProps) => { +export function StepComponent(props: StepComponentProps) { function decrease() { if (props.value < props.min) { return; @@ -80,11 +80,11 @@ export const StepComponent = (props: StepComponentProps) => { } return ( - + {props.displayFormat(props.value)} - + ); -}; +} export default StepComponent; diff --git a/app/client/src/components/ads/Table.tsx b/app/client/src/components/ads/Table.tsx index 4af94a42f1..fdfd1501be 100644 --- a/app/client/src/components/ads/Table.tsx +++ b/app/client/src/components/ads/Table.tsx @@ -138,8 +138,8 @@ function Table(props: TableProps) { return ( {cell.render("Cell")} diff --git a/app/client/src/components/ads/TableDropdown.tsx b/app/client/src/components/ads/TableDropdown.tsx index a27b050d87..9afcbdbf92 100644 --- a/app/client/src/components/ads/TableDropdown.tsx +++ b/app/client/src/components/ads/TableDropdown.tsx @@ -1,14 +1,14 @@ -import React, { Fragment, useState } from "react"; -import { CommonComponentProps, Classes } from "./common"; -import Text, { TextType } from "./Text"; -import styled from "styled-components"; +import { Position } from "@blueprintjs/core/lib/esm/common/position"; import { Popover, PopoverInteractionKind, } from "@blueprintjs/core/lib/esm/components/popover/popover"; -import { Position } from "@blueprintjs/core/lib/esm/common/position"; +import React, { useState } from "react"; +import styled from "styled-components"; +import { Classes, CommonComponentProps } from "./common"; import Icon, { IconSize } from "./Icon"; import Spinner from "./Spinner"; +import Text, { TextType } from "./Text"; type DropdownOption = { name: string; @@ -79,7 +79,7 @@ const Content = styled.div<{ isLoading?: boolean }>` } `; -const TableDropdown = (props: DropdownProps) => { +function TableDropdown(props: DropdownProps) { const [selectedIndex, setSelectedIndex] = useState(props.selectedIndex); const [isDropdownOpen, setIsDropdownOpen] = useState(false); const [selectedOption, setSelectedOption] = useState( @@ -93,41 +93,37 @@ const TableDropdown = (props: DropdownProps) => { setIsDropdownOpen(false); }; - return ( - - {props.isLoading ? ( - - ) : ( - setIsDropdownOpen(state)} - interactionKind={PopoverInteractionKind.CLICK} - > - - - {selectedOption.name} - - - - - {props.options.map((el: DropdownOption, index: number) => ( - optionSelector(index)} - > - {el.name} - {el.desc} - - ))} - - - )} - + return props.isLoading ? ( + + ) : ( + setIsDropdownOpen(state)} + position={props.position || Position.BOTTOM_LEFT} + usePortal={false} + > + + + {selectedOption.name} + + + + + {props.options.map((el: DropdownOption, index: number) => ( + optionSelector(index)} + > + {el.name} + {el.desc} + + ))} + + ); -}; +} export default TableDropdown; diff --git a/app/client/src/components/ads/Tabs.tsx b/app/client/src/components/ads/Tabs.tsx index 37b698a753..a70206d531 100644 --- a/app/client/src/components/ads/Tabs.tsx +++ b/app/client/src/components/ads/Tabs.tsx @@ -130,17 +130,17 @@ type TabbedViewComponentType = CommonComponentProps & { overflow?: boolean; }; -export const TabComponent = (props: TabbedViewComponentType) => { +export function TabComponent(props: TabbedViewComponentType) { return ( { props.onSelect && props.onSelect(index); }} + selectedIndex={props.selectedIndex} > {props.tabs.map((tab) => ( @@ -163,4 +163,4 @@ export const TabComponent = (props: TabbedViewComponentType) => { ); -}; +} diff --git a/app/client/src/components/ads/TagInputComponent.tsx b/app/client/src/components/ads/TagInputComponent.tsx index 79ad502e8c..38de855dc8 100644 --- a/app/client/src/components/ads/TagInputComponent.tsx +++ b/app/client/src/components/ads/TagInputComponent.tsx @@ -62,7 +62,7 @@ type TagInputProps = { * On addition or removal of tags, passes the comman separated string to input.onChange prop * @param props : TagInputProps */ -const TagInputComponent = (props: TagInputProps) => { +function TagInputComponent(props: TagInputProps) { const _values = props.input.value && props.input.value.length > 0 ? props.input.value.split(",") @@ -145,25 +145,25 @@ const TagInputComponent = (props: TagInputProps) => { return ( ); -}; +} export default TagInputComponent; diff --git a/app/client/src/components/ads/TextInput.tsx b/app/client/src/components/ads/TextInput.tsx index 5bf0b9f4e7..a7aee853bf 100644 --- a/app/client/src/components/ads/TextInput.tsx +++ b/app/client/src/components/ads/TextInput.tsx @@ -88,8 +88,8 @@ const StyledInput = styled((props) => { return props.asyncControl ? ( ) : ( @@ -200,17 +200,17 @@ const TextInput = forwardRef( return ( {ErrorMessage} diff --git a/app/client/src/components/ads/Toast.tsx b/app/client/src/components/ads/Toast.tsx index e31fafe90a..8685e03e1c 100644 --- a/app/client/src/components/ads/Toast.tsx +++ b/app/client/src/components/ads/Toast.tsx @@ -39,13 +39,13 @@ const WrappedToastContainer = styled.div` top: 4em; } `; -export const StyledToastContainer = (props: ToastOptions) => { +export function StyledToastContainer(props: ToastOptions) { return ( ); -}; +} const ToastBody = styled.div<{ variant?: Variant; @@ -110,19 +110,19 @@ const StyledDebugButton = styled(DebugButton)` margin-left: auto; `; -const ToastComponent = (props: ToastProps & { undoAction?: () => void }) => { +function ToastComponent(props: ToastProps & { undoAction?: () => void }) { const dispatch = useDispatch(); return ( {props.variant === Variant.success ? ( - + ) : props.variant === Variant.warning ? ( ) : null} @@ -139,7 +139,6 @@ const ToastComponent = (props: ToastProps & { undoAction?: () => void }) => {
{props.onUndo || props.dispatchableAction ? ( { if (props.dispatchableAction) { dispatch(props.dispatchableAction); @@ -148,6 +147,7 @@ const ToastComponent = (props: ToastProps & { undoAction?: () => void }) => { props.undoAction && props.undoAction(); } }} + type={TextType.H6} > UNDO @@ -155,7 +155,7 @@ const ToastComponent = (props: ToastProps & { undoAction?: () => void }) => {
); -}; +} export const Toaster = { show: (config: ToastProps) => { diff --git a/app/client/src/components/ads/Toggle.tsx b/app/client/src/components/ads/Toggle.tsx index 60ae853016..5ae09a22ff 100644 --- a/app/client/src/components/ads/Toggle.tsx +++ b/app/client/src/components/ads/Toggle.tsx @@ -126,21 +126,21 @@ export default function Toggle(props: ToggleProps) { return ( ) => onChangeHandler(e.target.checked) } + type="checkbox" /> - + {props.isLoading ? (
diff --git a/app/client/src/components/ads/Tooltip.tsx b/app/client/src/components/ads/Tooltip.tsx index 6c858528bd..da2b2d7b23 100644 --- a/app/client/src/components/ads/Tooltip.tsx +++ b/app/client/src/components/ads/Tooltip.tsx @@ -19,26 +19,26 @@ type TooltipProps = CommonComponentProps & { minimal?: boolean; }; -const TooltipComponent = (props: TooltipProps) => { +function TooltipComponent(props: TooltipProps) { return ( {props.children} ); -}; +} TooltipComponent.defaultProps = { position: Position.TOP, diff --git a/app/client/src/components/ads/TreeDropdown.tsx b/app/client/src/components/ads/TreeDropdown.tsx index a25274362f..bede261783 100644 --- a/app/client/src/components/ads/TreeDropdown.tsx +++ b/app/client/src/components/ads/TreeDropdown.tsx @@ -169,10 +169,11 @@ export default function TreeDropdown(props: TreeDropdownProps) { selectedOption.type === option.value; return ( e.stopPropagation() }, }} + text={option.label} > {option.children && option.children.map(renderTreeOption)} @@ -202,30 +202,30 @@ export default function TreeDropdown(props: TreeDropdownProps) { const defaultToggle = (