From b9d2c82811ec730b2bdc9ad859acdac4a7dbe919 Mon Sep 17 00:00:00 2001 From: Flavio Corpa Date: Tue, 22 Dec 2020 11:03:01 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20all=20the=20unneeded=20custom=20constr?= =?UTF-8?q?uctors...=20=F0=9F=99=85=F0=9F=8F=BC=E2=80=8D=E2=99=82=EF=B8=8F?= =?UTF-8?q?=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Dropdown.elm | 69 ++---------------------------------------------- 1 file changed, 2 insertions(+), 67 deletions(-) diff --git a/src/Dropdown.elm b/src/Dropdown.elm index a22b213..3709420 100644 --- a/src/Dropdown.elm +++ b/src/Dropdown.elm @@ -1,7 +1,7 @@ module Dropdown exposing ( State, init , Msg - , Config, CustomBasicConfig, basic, custom, filterable, multi + , Config, basic, filterable, multi , withContainerAttributes, withPromptElement, withFilterPlaceholder, withSelectAttributes, withSearchAttributes, withOpenCloseButtons, withListAttributes , update, view , onOutsideClick @@ -11,7 +11,7 @@ module Dropdown exposing @docs State, init @docs Msg -@docs Config, CustomBasicConfig, basic, custom, filterable, multi +@docs Config, basic, filterable, multi @docs withContainerAttributes, withPromptElement, withFilterPlaceholder, withSelectAttributes, withSearchAttributes, withOpenCloseButtons, withListAttributes @docs update, view @docs onOutsideClick @@ -51,36 +51,6 @@ type OnSelectMsg msg item | MultipleSelection (List item -> Element msg) -{-| Type that holds the current custom config: - - - dropdownMsg: The message to wrap all the internal messages of the dropdown - - onSelectMsg: A message to trigger when an item is selected - - itemToPrompt: A function to get the Element to display from an item, to be used in the select part of the dropdown - - itemToElement: A function to get the Element to display from an item, to be used in the item list of the dropdown - - closeButton: An element to display as close button - - openButton: An element to display as open button - - promptElement: An element to be used in the prompt - - containerAttributes: A list of attributes to be passed to the container element. - - listAttributes: A list of attributes to be passed to the list element. - - searchAttributes: A list of attributes to be passed to the search element. - - selectAttributes: A list of attributes to be passed to the select element. - --} -type alias CustomBasicConfig item msg = - { closeButton : Element msg - , containerAttributes : List (Attribute msg) - , dropdownMsg : Msg item -> msg - , itemToElement : Bool -> Bool -> item -> Element msg - , selectionToPrompt : OnSelectMsg msg item - , listAttributes : List (Attribute msg) - , onSelectMsg : Maybe item -> msg - , openButton : Element msg - , promptElement : Element msg - , searchAttributes : List (Attribute msg) - , selectAttributes : List (Attribute msg) - } - - {-| Opaque type that holds the current state type alias Model = @@ -228,41 +198,6 @@ multi dropdownMsg onSelectMsg itemsToPrompt itemToElement = } -{-| Create a basic dropdown with custom configuration. This takes a config with: - - - dropdownMsg: The message to wrap all the internal messages of the dropdown - - onSelectMsg: A message to trigger when an item is selected - - selectionToPrompt: A function to get the Element to display from an item, to be used in the select part of the dropdown - - itemToElement: A function to get the Element to display from an item, to be used in the item list of the dropdown - - closeButton: An element to display as close button - - openButton: An element to display as open button - - promptElement: An element to be used in the prompt - - containerAttributes: A list of attributes to be passed to the container element. - - listAttributes: A list of attributes to be passed to the list element. - - searchAttributes: A list of attributes to be passed to the search element. - - selectAttributes: A list of attributes to be passed to the select element. - --} -custom : CustomBasicConfig item msg -> Config item msg -custom cfg = - Config - { closeButton = cfg.closeButton - , containerAttributes = cfg.containerAttributes - , dropdownMsg = cfg.dropdownMsg - , dropdownType = Basic - , filterPlaceholder = Nothing - , itemToElement = cfg.itemToElement - , selectionToPrompt = cfg.selectionToPrompt - , itemToText = \_ -> "" - , listAttributes = cfg.listAttributes - , onSelectMsg = cfg.onSelectMsg - , openButton = cfg.openButton - , promptElement = el [ width fill ] cfg.promptElement - , searchAttributes = cfg.searchAttributes - , selectAttributes = cfg.selectAttributes - } - - {-| Create a filterable configuration. This takes: - The message to wrap all the internal messages of the dropdown