1
0
mirror of synced 2024-11-23 13:36:01 +03:00
Commit Graph

101 Commits

Author SHA1 Message Date
Kevin Brown
100015b205 Added back select2('val')
With the recent changes to how Select2 works internally, this really
isn't needed. This has been added to make the migration path
easier, and it just internally calls `val` on the underlying select
element. The only difference is that the `val` function will now
convert any non-string elements to strings.

The second argument (`triggerChange`) has not been migrated, as
Select2 now internally relies on the `change` event.

**Note:** As the old `initSelection` method has not been migrated,
it is not possible to set the `val` on remote data sources where
the value has not previously been selected.
2014-12-11 17:11:38 -05:00
Kevin Brown
4afb80b7ff 4.0 announcement 2014-12-10 22:31:07 -05:00
Kevin Brown
caf4ad73d7 Allow for custom sorting functions
This adds the `sorter` function, which works in the same way as the
old `sortResults` function.
2014-12-10 18:22:25 -05:00
Kevin Brown
14db3fc801 Support data-* attributes for configuration
The documentation is included, along with a few tests, which
explains the general rules for how it is parsed.
2014-12-10 15:23:39 -05:00
Kevin Brown
f6625d2347 Added dropdownParent
`dropdownParent` controls the location of the dropdown when it is
automatically added to the DOM. By default, this is the body
element but it can be modified based on where the user needs it.
2014-12-09 22:12:07 -05:00
Kevin Brown
f7d75b62fa Added more documentation
This adds documentation for a `dropdownParent` option which has
not yet been created, but will come in the next commit.
2014-12-09 22:02:16 -05:00
Kevin Brown
4cdda7e156 Finish off the incomplete options documentation
The documentation is not completely finished, but now we have no
placeholders waiting to be completed.
2014-12-09 20:30:57 -05:00
Kevin Brown
1ca71578d4 Added documentation footer
The documentation will be licensed under CC BY 3.0, instead of
under the MIT license like the rest of the code.
2014-12-05 21:48:31 -05:00
Kevin Brown
ab763b060d Added getting started guide to the home page 2014-12-05 21:21:40 -05:00
Kevin Brown
389c3ed866 More work on the release announcement 2014-11-25 19:42:53 -05:00
Kevin Brown
d9e254ed27 Fixed the theme example 2014-11-24 21:37:29 -05:00
Kevin Brown
ffed37013d Added back the allowClear option 2014-11-24 20:43:15 -05:00
Kevin Brown
dafa99bf40 Working on the classic theme 2014-11-24 20:08:24 -05:00
Kevin Brown
2bec6e2579 Automatically strip diacritics
This adds a dictionary for converting diacritics to a normalized
representation. This dictionary is used in the default matcher.

The code for stripping the diacritics was pulled from the current
implementation in Select2 3.x.
2014-11-19 18:12:59 -05:00
Kevin Brown
7e6782d580 Display a loading message when searching
Now when searching, a loading message is prepended to the top of
the results. This replaces the old spinner image and allows for it
to be translated across different languages.

The loading message can be styled differently and is passed
through the results formatters.
2014-11-19 17:22:37 -05:00
Kevin Brown
849a9c7a32 Started work on the classic theme
Some people like the old theme, so we're going to also include that
one as well as the easier-to-extend flat theme.
2014-11-19 14:26:52 -05:00
Kevin Brown
a2766b7ed6 Added destroy method
Now Select2 supports destroying itself, and all elements that it
creates.
2014-11-13 18:36:40 -05:00
Kevin Brown
78ee1bc01e Continued work on the documentation 2014-11-08 16:48:57 -05:00
Kevin Brown
10536370de Add support for initializing tags
This adds backwards compatibility for the old tags.
2014-11-07 20:31:27 -05:00
Kevin Brown
d306fcf82c Added default selection for AJAX 2014-11-07 20:20:37 -05:00
Kevin Brown
d411a0fa76 Fixed default selections for arrays 2014-11-07 19:53:50 -05:00
Kevin Brown
56dbbf8cdb Improve option generate speed
Now the options are mostly generated by hand before being passed
off to jQuery for templating. This fixes much of the speed issues
we had when they were entirely being generated through jQuery.
2014-11-06 13:40:36 -05:00
Kevin Brown
5454a908a1 Started working on the initial release announcement 2014-11-06 11:27:28 -05:00
Kevin Brown
c7e8f81595 Added Spanish translation and fixed the example 2014-11-05 11:25:41 -05:00
Kevin Brown
69fb428e01 Rewrote the matcher example 2014-11-05 11:09:55 -05:00
Kevin Brown
ed98443d47 Added matcher example and reworked compat
The matcher example now matches the old matcher example, and the
compatibility module has been turned into a function decorator
instead of a class decorator.
2014-11-05 11:03:53 -05:00
Kevin Brown
6e4336769f Fix AJAx example 2014-11-03 19:32:50 -05:00
Kevin Brown
5e3b63289c Added infinite scrolling support for AJAX 2014-11-03 19:10:36 -05:00
Kevin Brown
91cecd55ed Handle minimumInputLength 2014-11-01 22:59:59 -04:00
Kevin Brown
8b7924fc72 Templating for selections 2014-11-01 22:12:21 -04:00
Kevin Brown
98fb41b442 Bring over the repo results formatter 2014-11-01 22:05:21 -04:00
Kevin Brown
a3fa516761 Added basic templating to results 2014-11-01 21:57:14 -04:00
Kevin Brown
be4d091451 Working on remote data sets
This starts work on the example, which currently uses the GitHub
API.

The `ajax.delay` option has been added that allows for debouncing
requests made within a certain number of milliseconds.
2014-11-01 21:36:36 -04:00
Kevin Brown
9bb993cee9 Added Translation object
This continues the work to get translations built into Select2.
2014-10-31 23:03:03 -04:00
Kevin Brown
65875bf8e7 Better handle AMD across files
Now that `define` and `require` are never made public, we have to
build everything to support `$.fn.select2.amd` while also working
with other AMD loaders.
2014-10-31 21:13:43 -04:00
Kevin Brown
86cd7245d2 Working on the contributor pages 2014-10-21 21:44:01 -04:00
Kevin Brown
19033f60f7 Added disabled example 2014-10-21 21:44:01 -04:00
Kevin Brown
5dd7df33bb Allow programmatic access of Select2 2014-10-21 21:44:01 -04:00
Kevin Brown
a728d948c1 Added some content to the tagging section 2014-10-21 21:44:01 -04:00
Kevin Brown
559a93bcb6 Added basic implementation of tags
Tags no longer takes an array, as pre-existing tags should already
exist as options in the data adapter.  A compatibility module will
later be added to convert tag data that is passed in to array data.

Tags allow for users to enter their own options, which will be
added to the beginning of the results list.
2014-10-21 21:44:01 -04:00
Kevin Brown
cc9419928e Working on accessibility
This makes quite a few changes, one of the major ones being the
removal of classes for marking options as selected or selectable,
and instead using the ARIA attributes which should already be
present.
2014-10-21 21:44:00 -04:00
Kevin Brown
3d1dc36711 Added support for placeholders
Placeholder support has been implemented as a separate module, so
any selection container should be able to be decorated and get
instant placeholder support. It hooks into the updating method of
selections, and determines when to display the placeholder based
on the options that are being updated.

It works in the same way as the old placeholders. If no options
are selected and being displayed, like in the case of a multiple
select, then the placeholder will always be shown.  If one option
is being displayed, and the id of the placeholder matches the id
of the selected element, then the placeholder will be shown.  This
is similar to the functionality that was present in Select2 2.x,
where the placeholder could be passed in as an object that would
be compared to the selection.

This still requires that, for single selects, the first element
must match the placeholder id.  Because the default placeholder id
is a blank string, this will maintain backwards compatibility with
past versions where the first option should be blank.  This can
still be overridden to point at a different id, keeping support
for systems where the placeholder doesn't use a blank value.

**Note:** This does not hide the blank option for single selects,
but that will still be maintained for backwards compatibility
within the results module.  It will not depend on a placeholder
being present, but instead will hide any options with blank text.
2014-10-21 21:43:59 -04:00
Kevin Brown
5b98f690c1 Fixed examples page 2014-10-21 21:43:59 -04:00
Kevin Brown
6375e2ee09 Working on searching results 2014-10-21 21:43:59 -04:00
Kevin Brown
ac7e7dae24 Added example for disabled results 2014-10-21 21:43:59 -04:00
Kevin Brown
acd469c658 Added optgroup support 2014-10-21 21:43:58 -04:00
Kevin Brown
fd5603be11 Examples use groups now 2014-10-21 21:43:58 -04:00
Kevin Brown
c51a6d6cee Examples are good for now 2014-10-21 21:43:58 -04:00
Kevin Brown
d386849c1f Started building out the examples
This also adds the `select2` function back to jQuery, so you can
still initialize Select2 using the old syntax.
2014-10-21 21:43:58 -04:00
Kevin Brown
4ae3439dbc Started building the docs site 2014-10-21 21:43:58 -04:00
Kevin Brown
c74aeeb5c8 Start working on docs 2014-10-21 21:43:58 -04:00