From 969e9142b1a4c02b5008b757fc8fb2b0271cf184 Mon Sep 17 00:00:00 2001 From: Taylor Date: Mon, 18 Apr 2022 13:16:39 -0400 Subject: [PATCH 1/3] fix(chart & explore): make to show label of slidercontrol --- .../components/controls/SliderControl.tsx | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/SliderControl.tsx b/superset-frontend/src/explore/components/controls/SliderControl.tsx index 5907e26ba8348..d438d8c0ed4d4 100644 --- a/superset-frontend/src/explore/components/controls/SliderControl.tsx +++ b/superset-frontend/src/explore/components/controls/SliderControl.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import React from 'react'; +import React, { ReactNode } from 'react'; import Slider from 'src/components/Slider'; import ControlHeader from 'src/explore/components/ControlHeader'; @@ -24,13 +24,57 @@ type SliderControlProps = { onChange: (value: number) => void; value: number; default?: number; + name: string; + description: string; + + // ControlHeader props + label: string; + renderTrigger?: boolean; + validationErrors?: string[]; + rightNode?: ReactNode; + leftNode?: ReactNode; + hovered?: boolean; + warning?: string; + danger?: string; + onClick?: () => void; + tooltipOnClick?: () => void; }; export default function SliderControl(props: SliderControlProps) { - const { onChange = () => {}, default: defaultValue, ...rest } = props; + const { + default: defaultValue, + name, + label, + description, + renderTrigger, + rightNode, + leftNode, + validationErrors, + hovered, + warning, + danger, + onClick, + tooltipOnClick, + onChange = () => {}, + ...rest + } = props; + const headerProps = { + name, + label, + description, + renderTrigger, + rightNode, + leftNode, + validationErrors, + onClick, + hovered, + tooltipOnClick, + warning, + danger, + }; return ( <> - + ); From e92a8ea26153ea386d52cd515f9c55d03ba31beb Mon Sep 17 00:00:00 2001 From: Taylor Date: Tue, 19 Apr 2022 08:31:05 -0400 Subject: [PATCH 2/3] fix(chart & explore): make to update SliderControl props --- .../components/controls/SliderControl.tsx | 55 +++++++------------ 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/SliderControl.tsx b/superset-frontend/src/explore/components/controls/SliderControl.tsx index d438d8c0ed4d4..0704fbfa2d7aa 100644 --- a/superset-frontend/src/explore/components/controls/SliderControl.tsx +++ b/superset-frontend/src/explore/components/controls/SliderControl.tsx @@ -16,48 +16,33 @@ * specific language governing permissions and limitations * under the License. */ -import React, { ReactNode } from 'react'; +import React from 'react'; import Slider from 'src/components/Slider'; -import ControlHeader from 'src/explore/components/ControlHeader'; +import ControlHeader, {ControlHeaderProps} from 'src/explore/components/ControlHeader'; -type SliderControlProps = { +type SliderControlProps = ControlHeaderProps & { onChange: (value: number) => void; value: number; default?: number; - name: string; - description: string; - - // ControlHeader props - label: string; - renderTrigger?: boolean; - validationErrors?: string[]; - rightNode?: ReactNode; - leftNode?: ReactNode; - hovered?: boolean; - warning?: string; - danger?: string; - onClick?: () => void; - tooltipOnClick?: () => void; }; -export default function SliderControl(props: SliderControlProps) { - const { - default: defaultValue, - name, - label, - description, - renderTrigger, - rightNode, - leftNode, - validationErrors, - hovered, - warning, - danger, - onClick, - tooltipOnClick, - onChange = () => {}, - ...rest - } = props; +export default function SliderControl({ + default: defaultValue, + name, + label, + description, + renderTrigger, + rightNode, + leftNode, + validationErrors, + hovered, + warning, + danger, + onClick, + tooltipOnClick, + onChange = () => {}, + ...rest}: SliderControlProps) { + const headerProps = { name, label, From e66dd36c92a6857df6cb3d8e70e2480b89ce255b Mon Sep 17 00:00:00 2001 From: Taylor Date: Tue, 19 Apr 2022 14:59:53 -0400 Subject: [PATCH 3/3] fix(chart & explore): make to fix lint --- .../src/explore/components/controls/SliderControl.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/explore/components/controls/SliderControl.tsx b/superset-frontend/src/explore/components/controls/SliderControl.tsx index 0704fbfa2d7aa..a2d3b7c2bced1 100644 --- a/superset-frontend/src/explore/components/controls/SliderControl.tsx +++ b/superset-frontend/src/explore/components/controls/SliderControl.tsx @@ -18,7 +18,9 @@ */ import React from 'react'; import Slider from 'src/components/Slider'; -import ControlHeader, {ControlHeaderProps} from 'src/explore/components/ControlHeader'; +import ControlHeader, { + ControlHeaderProps, +} from 'src/explore/components/ControlHeader'; type SliderControlProps = ControlHeaderProps & { onChange: (value: number) => void; @@ -41,8 +43,8 @@ export default function SliderControl({ onClick, tooltipOnClick, onChange = () => {}, - ...rest}: SliderControlProps) { - + ...rest +}: SliderControlProps) { const headerProps = { name, label,