diff --git a/frontend/taipy-gui/src/components/Taipy/DateRange.spec.tsx b/frontend/taipy-gui/src/components/Taipy/DateRange.spec.tsx index 19c701ea2b..cd4ac04f60 100644 --- a/frontend/taipy-gui/src/components/Taipy/DateRange.spec.tsx +++ b/frontend/taipy-gui/src/components/Taipy/DateRange.spec.tsx @@ -257,6 +257,16 @@ describe("DateRange with time Component", () => { expect(elts).toHaveLength(2); expect(elts[0].parentElement?.tagName).toBe("BUTTON"); }); + it("renders time dropdown with minutes steps", async () => { + const { getAllByTestId } = render( + + + + ); + const elts = getAllByTestId("CalendarIcon"); + expect(elts).toHaveLength(2); + expect(elts[0].parentElement?.tagName).toBe("BUTTON"); + }); it("displays the right info for string", async () => { const { getAllByTestId } = render( diff --git a/frontend/taipy-gui/src/components/Taipy/DateRange.tsx b/frontend/taipy-gui/src/components/Taipy/DateRange.tsx index 7af9f29936..7487bcbb76 100644 --- a/frontend/taipy-gui/src/components/Taipy/DateRange.tsx +++ b/frontend/taipy-gui/src/components/Taipy/DateRange.tsx @@ -42,6 +42,7 @@ interface DateRangeProps extends TaipyActiveProps, TaipyChangeProps { separator?: string; width?: string | number; analogic?: boolean; + minuteJump?: number; } const textFieldProps = { textField: { margin: "dense" } } as BaseDateTimePickerSlotProps; @@ -74,7 +75,7 @@ const analogicRenderers = { } const DateRange = (props: DateRangeProps) => { - const { updateVarName, withTime = false, id, propagate = true, separator = "-", analogic = false } = props; + const { updateVarName, withTime = false, id, propagate = true, separator = "-", analogic = false, minuteJump = 15 } = props; const dispatch = useDispatch(); const formatConfig = useFormatConfig(); const tz = formatConfig.timeZone; @@ -166,6 +167,7 @@ const DateRange = (props: DateRangeProps) => { format={props.format} sx={dateSx} viewRenderers={ analogic ? analogicRenderers : undefined } + timeSteps={{minutes:minuteJump}} /> {separator} { format={props.format} sx={dateSx} viewRenderers={ analogic ? analogicRenderers : undefined } + timeSteps={{minutes:minuteJump}} /> ) : ( diff --git a/frontend/taipy-gui/src/components/Taipy/DateSelector.spec.tsx b/frontend/taipy-gui/src/components/Taipy/DateSelector.spec.tsx index df193e49bc..f2097c49dd 100644 --- a/frontend/taipy-gui/src/components/Taipy/DateSelector.spec.tsx +++ b/frontend/taipy-gui/src/components/Taipy/DateSelector.spec.tsx @@ -216,6 +216,15 @@ describe("DateSelector with time Component", () => { const elt = getByTestId("CalendarIcon"); expect(elt.parentElement?.tagName).toBe("BUTTON"); }); + it("renders time dropdown with minutes steps", async () => { + const { getByTestId } = render( + + + + ); + const elt = getByTestId("CalendarIcon"); + expect(elt.parentElement?.tagName).toBe("BUTTON"); + }); it("displays the right info for string", async () => { const { getByTestId } = render( diff --git a/frontend/taipy-gui/src/components/Taipy/DateSelector.tsx b/frontend/taipy-gui/src/components/Taipy/DateSelector.tsx index fe1d7b2660..ba694a215e 100644 --- a/frontend/taipy-gui/src/components/Taipy/DateSelector.tsx +++ b/frontend/taipy-gui/src/components/Taipy/DateSelector.tsx @@ -47,6 +47,7 @@ interface DateSelectorProps extends TaipyActiveProps, TaipyChangeProps { label?: string; width?: string | number; analogic? :boolean; + minuteJump? :number; } const boxSx = { display: "inline-block" }; @@ -59,7 +60,7 @@ const analogicRenderers = { } const DateSelector = (props: DateSelectorProps) => { - const { updateVarName, withTime = false, id, propagate = true, analogic = false } = props; + const { updateVarName, withTime = false, id, propagate = true, analogic = false, minuteJump = 15 } = props; const dispatch = useDispatch(); const formatConfig = useFormatConfig(); const tz = formatConfig.timeZone; @@ -133,6 +134,7 @@ const DateSelector = (props: DateSelectorProps) => { format={props.format} sx={dateSx} viewRenderers={ analogic ? analogicRenderers : undefined } + timeSteps={{minutes: minuteJump}} /> ) : ( { const elt = getByTestId("ClockIcon"); expect(elt.parentElement?.tagName).toBe("BUTTON"); }); - + it("renders time dropdown with minutes steps", async () => { + const { getByTestId } = render( + + + + ); + const elt = getByTestId("ClockIcon"); + expect(elt.parentElement?.tagName).toBe("BUTTON"); + }); it("displays the right info for string", async () => { const { getByTestId } = render( diff --git a/frontend/taipy-gui/src/components/Taipy/TimeSelector.tsx b/frontend/taipy-gui/src/components/Taipy/TimeSelector.tsx index cbad868d0c..3d2e23be20 100644 --- a/frontend/taipy-gui/src/components/Taipy/TimeSelector.tsx +++ b/frontend/taipy-gui/src/components/Taipy/TimeSelector.tsx @@ -33,11 +33,12 @@ interface TimeSelectorProps extends TaipyActiveProps, TaipyChangeProps { label?: string; time: string; width?: string | number; + minuteJump?: number; } const boxSx = { display: "inline-block" }; const TimeSelector = (props: TimeSelectorProps) => { - const { analogic = false, id, updateVarName, propagate = true } = props; + const { analogic = false, id, updateVarName, propagate = true, minuteJump =15 } = props; const [value, setValue] = useState(() => getTime(props.defaultTime)); const dispatch = useDispatch(); const module = useModule(); @@ -102,6 +103,7 @@ const TimeSelector = (props: TimeSelectorProps) => { label={props.label} format={props.format} sx={timeSx} + timeSteps={{minutes:minuteJump}} /> ) ):( diff --git a/taipy/gui/_renderers/factory.py b/taipy/gui/_renderers/factory.py index a923f0c726..f564f7f455 100644 --- a/taipy/gui/_renderers/factory.py +++ b/taipy/gui/_renderers/factory.py @@ -162,6 +162,7 @@ class _Factory: ("active", PropertyType.dynamic_boolean, True), ("analogic", PropertyType.boolean), ("min", PropertyType.dynamic_date), + ("minute_jump", PropertyType.number), ("max", PropertyType.dynamic_date), ("editable", PropertyType.dynamic_boolean, True), ("hover_text", PropertyType.dynamic_string), @@ -188,6 +189,7 @@ class _Factory: ("hover_text", PropertyType.dynamic_string), ("label_start",), ("label_end",), + ("minute_jump", PropertyType.number), ("on_change", PropertyType.function), ("format",), ("width", PropertyType.string_or_number), @@ -607,9 +609,10 @@ class _Factory: ("active", PropertyType.dynamic_boolean, True), ("analogic", PropertyType.boolean), ("editable", PropertyType.dynamic_boolean, True), + ("format",), ("hover_text", PropertyType.dynamic_string), ("label",), - ("format",), + ("minute_jump", PropertyType.number), ("width", PropertyType.string_or_number), ] ) diff --git a/taipy/gui/viselements.json b/taipy/gui/viselements.json index 3e2437ec42..da598d3cac 100644 --- a/taipy/gui/viselements.json +++ b/taipy/gui/viselements.json @@ -320,6 +320,11 @@ "default_value": "False", "doc": "Whether or not to show the time part of the date." }, + { + "name": "minute_jump", + "type": "dynamic(int)", + "doc": "The time steps between two time unit options" + }, { "name": "format", "type": "str", @@ -380,6 +385,11 @@ "type": "str", "doc": "The format to apply to the value. See below." }, + { + "name": "minute_jump", + "type": "dynamic(int)", + "doc": "The time steps between two time unit options" + }, { "name": "editable", "type": "dynamic(bool)", @@ -426,6 +436,11 @@ "default_value": "False", "doc": "Whether or not to show the time part of the date." }, + { + "name": "minute_jump", + "type": "dynamic(int)", + "doc": "The time steps between two time unit options" + }, { "name": "format", "type": "str",