From ff8071d01a5441287786db16e000a42b91e9694f Mon Sep 17 00:00:00 2001 From: Gustavo Henke Date: Fri, 16 Sep 2016 06:59:00 -0300 Subject: [PATCH] feat(selectize): add support for multiple selection Closes #295, closes #1787 --- .../demo-selectize-with-bootstrap.html | 19 +++++++++++++++++-- src/common.css | 7 ++++++- src/selectize/choices.tpl.html | 3 ++- src/selectize/match-multiple.tpl.html | 11 +++++++++++ src/selectize/select-multiple.tpl.html | 18 ++++++++++++++++++ 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 src/selectize/match-multiple.tpl.html create mode 100644 src/selectize/select-multiple.tpl.html diff --git a/docs/examples/demo-selectize-with-bootstrap.html b/docs/examples/demo-selectize-with-bootstrap.html index cf7528c59..97f23d15d 100644 --- a/docs/examples/demo-selectize-with-bootstrap.html +++ b/docs/examples/demo-selectize-with-bootstrap.html @@ -16,8 +16,8 @@ .input-group > .selectize-control > .selectize-input { border-bottom-right-radius: 0; border-top-right-radius: 0; - } - + } +

Selected: {{ctrl.person.selected.name}}

@@ -77,6 +77,21 @@ +
+ +
+ + + {{$item.name}} + +
+ +
+
+ +
+
+
diff --git a/src/common.css b/src/common.css index 3698f4a2e..fb08103a2 100644 --- a/src/common.css +++ b/src/common.css @@ -92,10 +92,15 @@ body > .select2-container.open { } /* Fix input width for Selectize theme */ -.selectize-control > .selectize-input > input { +.selectize-control.single > .selectize-input > input { width: 100%; } +/* Fix line break when there's at least one item selected with the Selectize theme */ +.selectize-control.multi > .selectize-input > input { + margin: 0 !important; +} + /* Fix dropdown width for Selectize theme */ .selectize-control > .selectize-dropdown { width: 100%; diff --git a/src/selectize/choices.tpl.html b/src/selectize/choices.tpl.html index 4214f9168..896025d80 100644 --- a/src/selectize/choices.tpl.html +++ b/src/selectize/choices.tpl.html @@ -1,4 +1,5 @@ -
+
diff --git a/src/selectize/match-multiple.tpl.html b/src/selectize/match-multiple.tpl.html new file mode 100644 index 000000000..49d37b2d7 --- /dev/null +++ b/src/selectize/match-multiple.tpl.html @@ -0,0 +1,11 @@ +
+ + + × + +
\ No newline at end of file diff --git a/src/selectize/select-multiple.tpl.html b/src/selectize/select-multiple.tpl.html new file mode 100644 index 000000000..b434c8ec6 --- /dev/null +++ b/src/selectize/select-multiple.tpl.html @@ -0,0 +1,18 @@ +
+
+
+ +
+
+
+
\ No newline at end of file