From d546ecf772d5f12c90d1662951ef6f4369bea117 Mon Sep 17 00:00:00 2001 From: Vitali Pinchuk <146737590+vitPinchuk@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:07:14 +0300 Subject: [PATCH] Update position of Query fields for initial values (#455) * elements fields updated * remove as unused * Formatting * Update Initial Fields Editor * Update test * tests update * Formatting * Remove unused aria-label * Update CHANGELOG.md --------- Co-authored-by: Mikhail Volkov Co-authored-by: asimonok --- CHANGELOG.md | 3 +- .../ElementEditor/ElementEditor.tsx | 69 +---------- .../FormElementsEditor.styles.ts | 3 + .../FormElementsEditor.test.tsx | 72 ----------- .../FormElementsEditor/FormElementsEditor.tsx | 25 ++-- .../InitialFieldsEditor.test.tsx | 115 ++++++++++++++++++ .../InitialFieldsEditor.tsx | 80 ++++++++++++ src/components/InitialFieldsEditor/index.ts | 1 + src/components/index.ts | 1 + src/constants/tests.ts | 6 + src/module.ts | 26 ++++ src/utils/tests.ts | 6 +- 12 files changed, 250 insertions(+), 157 deletions(-) create mode 100644 src/components/InitialFieldsEditor/InitialFieldsEditor.test.tsx create mode 100644 src/components/InitialFieldsEditor/InitialFieldsEditor.tsx create mode 100644 src/components/InitialFieldsEditor/index.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d360407c..585d306f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## 4.2.0 (IN PROGRESS) +## 4.2.0 (2024-07-18) ### Features / Enhancements @@ -8,6 +8,7 @@ - Improved unit tests (#447) - Updated Business Forms tutorial (#451) - Updated the logic for comparing values with the initial values (#454) +- Updated position of Query fields for initial values (#455) ## 4.1.0 (2024-07-09) diff --git a/src/components/ElementEditor/ElementEditor.tsx b/src/components/ElementEditor/ElementEditor.tsx index 4bfcce6f..1ab101f9 100644 --- a/src/components/ElementEditor/ElementEditor.tsx +++ b/src/components/ElementEditor/ElementEditor.tsx @@ -22,12 +22,11 @@ import { LINK_TARGET_OPTIONS, OPTIONS_SOURCE_OPTIONS, OptionsSource, - RequestMethod, STRING_ELEMENT_OPTIONS, TEST_IDS, TIME_TRANSFORMATION_OPTIONS, } from '../../constants'; -import { CodeLanguage, LocalFormElement, QueryField } from '../../types'; +import { CodeLanguage, LocalFormElement } from '../../types'; import { formatNumberValue, getElementWithNewType, @@ -69,21 +68,6 @@ interface Props { */ layoutSectionOptions: SelectableValue[]; - /** - * Initial Request Method - */ - initialMethod?: RequestMethod; - - /** - * Query Fields - */ - queryFields: QueryField[]; - - /** - * Is Query Fields Enabled - */ - isQueryFieldsEnabled: boolean; - /** * Data */ @@ -93,16 +77,7 @@ interface Props { /** * Element Editor */ -export const ElementEditor: React.FC = ({ - element, - onChange, - onChangeOption, - layoutSectionOptions, - initialMethod, - isQueryFieldsEnabled, - queryFields, - data, -}) => { +export const ElementEditor: React.FC = ({ element, onChange, onChangeOption, layoutSectionOptions, data }) => { /** * Styles */ @@ -526,46 +501,6 @@ export const ElementEditor: React.FC = ({ )} - {initialMethod === RequestMethod.DATASOURCE && ( - - - ) => { - onChange({ - ...element, - fieldName: event.target.value, - }); - }} - data-testid={TEST_IDS.formElementsEditor.fieldNamePicker} - /> - - - )} - {isQueryFieldsEnabled && ( - - - ) => { + onChangeElement({ + ...element, + fieldName: event.target.value, + }); + }} + data-testid={TEST_IDS.initialFieldsEditor.fieldNamePicker} + /> + ) : ( +