From 031334915fe4d87749bfb3d3baea61659aceec55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=9A=D0=BE?= =?UTF-8?q?=D1=88=D0=B5=D0=BB=D0=B5=D0=B2?= Date: Sat, 18 May 2024 21:43:06 +0300 Subject: [PATCH 1/2] added 'NoDeleteAfterSelect' and 'NoDeleteAfterCancel' datepicker options --- datepicker/options.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/datepicker/options.go b/datepicker/options.go index 9e52a29..835250f 100644 --- a/datepicker/options.go +++ b/datepicker/options.go @@ -80,3 +80,17 @@ func WithPrefix(s string) Option { w.prefix = s } } + +// NoDeleteAfterSelect is a keyboard option that prevents the hide keyboard after select +func NoDeleteAfterSelect() Option { + return func(dp *DatePicker) { + dp.deleteOnSelect = false + } +} + +// NoDeleteAfterCancel is a keyboard option that prevents the hide keyboard after cancel +func NoDeleteAfterCancel() Option { + return func(dp *DatePicker) { + dp.deleteOnCancel = false + } +} From 9fe0ad15c0758261baf288bf3c5b1ad35ef59d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=9A=D0=BE?= =?UTF-8?q?=D1=88=D0=B5=D0=BB=D0=B5=D0=B2?= Date: Sat, 18 May 2024 22:56:09 +0300 Subject: [PATCH 2/2] 'NoDeleteAfterSelect' and 'NoDeleteAfterCancel' for slider --- slider/options.go | 14 ++++++++++++++ slider/slider.go | 8 +++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/slider/options.go b/slider/options.go index 78443ce..5996d9c 100644 --- a/slider/options.go +++ b/slider/options.go @@ -33,3 +33,17 @@ func WithPrefix(s string) Option { w.prefix = s } } + +// NoDeleteAfterSelect is a keyboard option that prevents the hide widget after select +func NoDeleteAfterSelect() Option { + return func(s *Slider) { + s.deleteOnSelect = false + } +} + +// NoDeleteAfterCancel is a keyboard option that prevents the hide widget after cancel +func NoDeleteAfterCancel() Option { + return func(s *Slider) { + s.deleteOnCancel = false + } +} diff --git a/slider/slider.go b/slider/slider.go index 1015188..99da7fd 100644 --- a/slider/slider.go +++ b/slider/slider.go @@ -46,9 +46,11 @@ type Slider struct { func New(slides []Slide, opts ...Option) *Slider { s := &Slider{ - prefix: bot.RandomString(16), - slides: slides, - onError: defaultOnError, + prefix: bot.RandomString(16), + slides: slides, + onError: defaultOnError, + deleteOnSelect: true, + deleteOnCancel: true, } for _, opt := range opts {