Fix pickers; Add new select option
This commit is contained in:
@ -108,10 +108,6 @@ func (m *MultiSelect) Description(description string) *MultiSelect {
|
||||
|
||||
// Options sets the options of the multi-select field.
|
||||
func (m *MultiSelect) Options(hasNewOption bool, options ...Option[string]) *MultiSelect {
|
||||
if len(options) <= 0 {
|
||||
return m
|
||||
}
|
||||
|
||||
m.hasNewOption = hasNewOption
|
||||
|
||||
if m.hasNewOption {
|
||||
@ -121,6 +117,10 @@ func (m *MultiSelect) Options(hasNewOption bool, options ...Option[string]) *Mul
|
||||
options = append(newOption, options...)
|
||||
}
|
||||
|
||||
if len(options) <= 0 {
|
||||
return m
|
||||
}
|
||||
|
||||
for i, o := range options {
|
||||
for _, v := range *m.value {
|
||||
if o.Value == v {
|
||||
@ -326,6 +326,7 @@ func (m *MultiSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
selected := m.options[i].selected
|
||||
m.options[i].selected = !selected
|
||||
m.filteredOptions[m.cursor].selected = !selected
|
||||
m.finalize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user