From 7a73419cc1a46b372ca11b1af71208ad29f16107 Mon Sep 17 00:00:00 2001 From: Flaminia Cavallo Date: Mon, 14 Oct 2024 15:22:04 +0200 Subject: [PATCH] feat: add radio to decide how to align title and subtitle --- src/config/field-overrides/dataSet.js | 56 +++++++++++++++++++++++---- src/i18n/i18n_module_en.properties | 1 + 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/config/field-overrides/dataSet.js b/src/config/field-overrides/dataSet.js index 9dfa13393..2a29fcff4 100644 --- a/src/config/field-overrides/dataSet.js +++ b/src/config/field-overrides/dataSet.js @@ -45,6 +45,7 @@ class RenderAsTabsSettings extends React.Component { this.updateDisplayOption(newDisplayOptions) } + onRenderAsTabsChanged = (event) => { const renderAsTabs = event.target.value const tabsDirection = @@ -64,7 +65,7 @@ class RenderAsTabsSettings extends React.Component { const addCustomText = event.target.value const customText = addCustomText - ? {header: undefined, subheader: undefined} + ? {header: undefined, subheader: undefined, alignemt: 'center'} : undefined const newDisplayOptions = { @@ -74,10 +75,21 @@ class RenderAsTabsSettings extends React.Component { this.updateDisplayOption(newDisplayOptions) } + onCustomTextAlignmentChanged = (event) => { + const customText = + {...this.state.displayOptions.customText, align: event.target.value} + + const newDisplayOptions = { + ...this.state.displayOptions, + customText + } + this.updateDisplayOption(newDisplayOptions) + } + onCustomTextHeaderChanged = (event) => { const customText = - {header: event.target.value, subheader: this.state.displayOptions.customText.subheader || undefined} + {...this.state.displayOptions.customText, header: event.target.value} const newDisplayOptions = { ...this.state.displayOptions, @@ -88,7 +100,7 @@ class RenderAsTabsSettings extends React.Component { onCustomTextSubheaderChanged = (event) => { const customText = - {header: this.state.displayOptions.customText.header || undefined, subheader: event.target.value} + {...this.state.displayOptions.customText, subheader: event.target.value} const newDisplayOptions = { ...this.state.displayOptions, @@ -97,13 +109,13 @@ class RenderAsTabsSettings extends React.Component { this.updateDisplayOption(newDisplayOptions) } - render() { const state = this.state; const props = this.props; - const cssStyles = { + const customTextCssStyles = { display: 'flex', - flexDirection: 'column' + flexDirection: 'column', + marginLeft: '16px' }; return
@@ -133,13 +145,42 @@ class RenderAsTabsSettings extends React.Component { /> }
+
+ {state.displayOptions && state.displayOptions.customText && -
+ + + + + } + + {state.displayOptions && state.displayOptions.customText && +
} +
} } diff --git a/src/i18n/i18n_module_en.properties b/src/i18n/i18n_module_en.properties index 24a4dc0df..34ff3c49a 100644 --- a/src/i18n/i18n_module_en.properties +++ b/src/i18n/i18n_module_en.properties @@ -711,6 +711,7 @@ edit_right_side= Edit right side select_operator= Select operator left= Left right= Right +center=Center textual_expression_description= Textual expression description edit_validation_rule= Edit validation rule validation_rule= Validation rule