Update dependencies (#886)
This commit is contained in:
43
vendor/github.com/nlopes/slack/dialog_select.go
generated
vendored
43
vendor/github.com/nlopes/slack/dialog_select.go
generated
vendored
@@ -21,10 +21,11 @@ type DialogInputSelect struct {
|
||||
DialogInput
|
||||
Value string `json:"value,omitempty"` //Optional.
|
||||
DataSource SelectDataSource `json:"data_source,omitempty"` //Optional. Allowed values: "users", "channels", "conversations", "external".
|
||||
SelectedOptions string `json:"selected_options,omitempty"` //Optional. Default value for "external" only
|
||||
SelectedOptions []DialogSelectOption `json:"selected_options,omitempty"` //Optional. May hold at most one element, for use with "external" only.
|
||||
Options []DialogSelectOption `json:"options,omitempty"` //One of options or option_groups is required.
|
||||
OptionGroups []DialogOptionGroup `json:"option_groups,omitempty"` //Provide up to 100 options.
|
||||
MinQueryLength int `json:"min_query_length,omitempty"` //Optional. minimum characters before query is sent.
|
||||
Hint string `json:"hint,omitempty"` //Optional. Additional hint text.
|
||||
}
|
||||
|
||||
// DialogSelectOption is an option for the user to select from the menu
|
||||
@@ -54,14 +55,7 @@ func NewStaticSelectDialogInput(name, label string, options []DialogSelectOption
|
||||
}
|
||||
|
||||
// NewGroupedSelectDialogInput creates grouped options select input for Dialogs.
|
||||
func NewGroupedSelectDialogInput(name, label string, groups map[string]map[string]string) *DialogInputSelect {
|
||||
optionGroups := []DialogOptionGroup{}
|
||||
for groupName, options := range groups {
|
||||
optionGroups = append(optionGroups, DialogOptionGroup{
|
||||
Label: groupName,
|
||||
Options: optionsFromMap(options),
|
||||
})
|
||||
}
|
||||
func NewGroupedSelectDialogInput(name, label string, options []DialogOptionGroup) *DialogInputSelect {
|
||||
return &DialogInputSelect{
|
||||
DialogInput: DialogInput{
|
||||
Type: InputTypeSelect,
|
||||
@@ -69,34 +63,15 @@ func NewGroupedSelectDialogInput(name, label string, groups map[string]map[strin
|
||||
Label: label,
|
||||
},
|
||||
DataSource: DialogDataSourceStatic,
|
||||
OptionGroups: optionGroups,
|
||||
}
|
||||
OptionGroups: options}
|
||||
}
|
||||
|
||||
func optionsFromArray(options []string) []DialogSelectOption {
|
||||
selectOptions := make([]DialogSelectOption, len(options))
|
||||
for idx, value := range options {
|
||||
selectOptions[idx] = DialogSelectOption{
|
||||
Label: value,
|
||||
Value: value,
|
||||
}
|
||||
// NewDialogOptionGroup creates a DialogOptionGroup from several select options
|
||||
func NewDialogOptionGroup(label string, options ...DialogSelectOption) DialogOptionGroup {
|
||||
return DialogOptionGroup{
|
||||
Label: label,
|
||||
Options: options,
|
||||
}
|
||||
return selectOptions
|
||||
}
|
||||
|
||||
func optionsFromMap(options map[string]string) []DialogSelectOption {
|
||||
selectOptions := make([]DialogSelectOption, len(options))
|
||||
idx := 0
|
||||
var option DialogSelectOption
|
||||
for key, value := range options {
|
||||
option = DialogSelectOption{
|
||||
Label: key,
|
||||
Value: value,
|
||||
}
|
||||
selectOptions[idx] = option
|
||||
idx++
|
||||
}
|
||||
return selectOptions
|
||||
}
|
||||
|
||||
// NewConversationsSelect returns a `Conversations` select
|
||||
|
||||
Reference in New Issue
Block a user