Select2.dcl 1.16 KB
Newer Older
1 2
definition module iTasks.Extensions.Editors.Select2

3 4 5 6 7 8
/**
 * Allows you to replace standard HTML `select` boxes in editors with Select2
 * input fields (https://select2.org/). This lets the user search for options.
 */

from StdMaybe import :: Maybe
9
from iTasks.UI.Editor import :: Editor
10
from iTasks.UI.Editor.Controls import :: ChoiceText
11

12
/**
13 14 15 16 17
 * Replaces HTML `select` boxes in the editor with Select2 input fields
 * (https://select2.org/).
 *
 * @param When `True`, also the `select` boxes of child editors, which are
 *   added dynamically, are modified to use Select2.
18
 */
19
withSelect2 :: !Bool !(Editor a) -> Editor a
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

/**
 * A replacement for `dropdown` (iTasks.UI.Editor.Controls) using Select2 input
 * fields (https://select2.org/).
 */
select2Dropdown :: Editor ([ChoiceText], [Int])

/**
 * A replacement for `dropdownWithGroups` (iTasks.UI.Editor.Controls) using
 * Select2 input fields (https://select2.org/).
 */
select2DropdownWithGroups :: Editor ([(ChoiceText, Maybe String)], [Int])

/**
 * A replacement for `chooseWithDropdown` (iTasks.UI.Editor.Common) using
 * Select2 input fields (https://select2.org/).
 */
chooseWithSelect2Dropdown :: [String] -> Editor Int