From 12bcdff5eed537865902b3933b8aa6a33d3335c3 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Sun, 29 May 2022 19:03:40 +0300 Subject: [PATCH] Property for timeshift bar (#1909) Signed-off-by: Alexander Platov --- .../calendar/DatePickerPopup.svelte | 2 + .../components/calendar/DateRangePopup.svelte | 41 ++++++++++--------- .../calendar/DateRangePresenter.svelte | 2 + .../calendar/DateTimeRangePresenter.svelte | 3 +- packages/ui/src/popups.ts | 13 ++++-- .../components/editor/CardChecklist.svelte | 1 + .../src/components/DateTimePresenter.svelte | 2 + .../src/components/DateEditor.svelte | 2 + .../src/components/DatePresenter.svelte | 3 +- 9 files changed, 44 insertions(+), 25 deletions(-) diff --git a/packages/ui/src/components/calendar/DatePickerPopup.svelte b/packages/ui/src/components/calendar/DatePickerPopup.svelte index f8d0b9a765..70fd03b2d7 100644 --- a/packages/ui/src/components/calendar/DatePickerPopup.svelte +++ b/packages/ui/src/components/calendar/DatePickerPopup.svelte @@ -32,6 +32,7 @@ if (modalHTML) $dpstore.popup = modalHTML } $: component = $dpstore.component + $: shift = $dpstore.shift function _update (result: any): void { fitPopup() @@ -106,6 +107,7 @@ {#if $dpstore.component} _update(ev.detail)} on:change={(ev) => _change(ev.detail)} diff --git a/packages/ui/src/components/calendar/DateRangePopup.svelte b/packages/ui/src/components/calendar/DateRangePopup.svelte index 068a6ee245..0b175a635f 100644 --- a/packages/ui/src/components/calendar/DateRangePopup.svelte +++ b/packages/ui/src/components/calendar/DateRangePopup.svelte @@ -23,6 +23,7 @@ export let minutes: number[] = [5, 15, 30] export let hours: number[] = [1, 2, 4, 8, 12] export let days: number[] = [1, 3, 7, 30] + export let shift: boolean = false const dispatch = createEventDispatcher() @@ -53,25 +54,27 @@ } }} /> -
- - {#each values as value} - {#if typeof value === 'number'} -
{ - const shiftedDate = new Date(today.getTime() + value * base) - dispatch('change', shiftedDate) - }} - > - -
- {:else if value === 'divider'} -
- {/if} - {/each} - -
+ {#if shift} +
+ + {#each values as value} + {#if typeof value === 'number'} +
{ + const shiftedDate = new Date(today.getTime() + value * base) + dispatch('change', shiftedDate) + }} + > + +
+ {:else if value === 'divider'} +
+ {/if} + {/each} + +
+ {/if}