1
0
mirror of synced 2024-11-22 21:16:10 +03:00
Commit Graph

1624 Commits

Author SHA1 Message Date
Kevin Brown
d9e254ed27 Fixed the theme example 2014-11-24 21:37:29 -05:00
Kevin Brown
ac5d584f3d Added the arrow for the dropdown 2014-11-24 21:33:22 -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
e686bce9d0 Converted classic theme to BEM
This should be the last of the changes.
2014-11-24 19:11:02 -05:00
Kevin Brown
3e54fc97e5 Finish the core switch to BEM
This switches all of the dropdown components to use BEM.
2014-11-24 18:59:19 -05:00
Kevin Brown
8cb074ccef Finished switching main container to BEM 2014-11-24 18:38:58 -05:00
Kevin Brown
7933eb77c1 Switch the multiple selection container
This switches the container to use BEM for the class naming.
2014-11-24 18:30:58 -05:00
Kevin Brown
971422f92e Start the switch to BEM
This is inspired by https://github.com/ivaynberg/select2/issues/2826
and starts the general transition to using selectors with a lower
specificity. This should make it considerably easier to override
the styles in the long run.

Unfortunately libsass does not support the SASS 3.3 style for BEM
where we can just use `&__m` for defining sub-modules. For now we
are still using a limited amount of nesting, but nowhere near as
much as we did in the past.
2014-11-24 18:11:03 -05:00
Kevin Brown
f1c02db189 Automatically resize the search box
Now the search box is automatically resized for placeholders to
fit the available space, so we don't need to worry about the
placeholder not being visible. When the placeholder doesn't need
to be visible, the size of the search box is determined based on
the length of the current search term.
2014-11-22 20:32:25 -05:00
Kevin Brown
217cd4cfd0 Added inline searching for multiple selects
This adds a search box to the main container for multiple select
boxes, similar to the what the old version had. This can still be
swapped out such that the search box displays above the results
like it previously did.

The placeholder for multiple selects will also now use the input
attribute of the search box instead of generating a custom element.

This also changes the selector for the search container to
`.select2-search`, which is consistent with the old class and
reduces the complexity of the selectors.

This fixes an issue with how decorators worked, where the constructor
from the parent class would clobber the custom constructor that is
generated for the new decorated class. This has been fixed by
excluding the constructor from the list of fields which are
transferred when decorating classes.
2014-11-22 19:21:46 -05:00
Kevin Brown
f382f3d02d Merge pull request #2755 from kupishkis/2753
After clearSearch nextSearchTerm is not cleared
2014-11-21 08:47:35 -05:00
Kevin Brown
9913cb7c25 Merge pull request #2730 from od3n/master
updated Malay & Indonesian translations
2014-11-20 21:46:38 -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
5ec201ca30 Built out the translations
This migrates over the required English translations under their
new names.

The "Searching" message has also been adjusted to use "Searching..."
instead of "Loading more results...", which is what it used to
say sometimes.

This also changes the AJAX handler to call `abort` when needed.
2014-11-19 17:48:46 -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
28c56e7885 Better accessibility for multiple select boxes 2014-11-19 15:50:53 -05:00
Kevin Brown
cee8c18c23 Change how the results are highlighted
Previously, a result was no longer highlighted when the mouse was
no longer over it. While this was useful for resetting the
highlight automatically, we started doing this when a new result
was highlighted to make sure that we never had multiple options
highlighted.

Now, a result will always be highlighted until the highlight is
removed when the next result is highlighted. While this shouldn't
affect many users, it is closer to how native select boxes work.
This also allows users using keyboard navigation to jump between
mouse and keyboard navigation without the highlight reseting to
the top of the results.
2014-11-19 14:29:28 -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
69e8e6e355 Merge pull request #2808 from yuks/patch-1
formatMatches translation added
2014-11-14 17:38:28 -05:00
Yuksel
ced4bf692c formatMatches translation added 2014-11-14 22:17:49 +01: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
a8377e3681 Merge pull request #2789 from RustyToms/drop_above_dropHeight_fix
recalculate $dropdown height after drop-above class added
2014-11-13 17:56:14 -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
5535f072e1 Focus the search upon opening 2014-11-07 20:16:59 -05:00
Kevin Brown
07e82d6be8 Automatically create options on select 2014-11-07 20:13:59 -05:00
Kevin Brown
d411a0fa76 Fixed default selections for arrays 2014-11-07 19:53:50 -05:00
Kevin Brown
e3deb3ae03 Remove jQuery from building the options
This fixes many of the speed issues the results had when working
with large data sets. jQuery has been completely dropped, with the
exception of setting the data, which does not require a jQuery
object but instead works directly with the DOM. This does not
include options with children, which still uses jQuery to deal
with the nested objects.

This only works with IE 8+, which is fine.
2014-11-07 19:37:07 -05:00
Kevin Brown
8ecc35d504 Fix caching when querying
This fixes caching when querying, so the data object no longer
needs to be completely regenerated whenever the `<option>` is
queried.

While this does not fix the speed issues on the first opening of
the instance, it does fix the speed issues during searching.
2014-11-07 19:07:01 -05:00
Kevin Brown
05ddbec1a7 Improve data array speeds
This improves the speeds of creating the `<option>` tags for array
data. By creating the HTML ahead of time and putting it into an
`<option>` element before passing it to jQuery, it cuts down on the
time it takes for jQuery to process the HTML string and convert it
into DOM elements. This proved to be incredibly slow.

This also changes the `item` function to return early when the
data exists. The `$e.data` call has also been switched to a
`$.data` call, which doesn't need to check the DOM to see if the
data attributes already exist. This cuts down on a bit of wasted
time, as the `data` key should never be present in the DOM, and it
should be ignored if it is.
2014-11-07 11:17:37 -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
8158e151ff Added test to make sure the options are generated 2014-11-06 12:12:43 -05:00
Kevin Brown
8ea23610f1 Convert array data to options immediately
This converts individual objects passed in through the `array`
parameter to `<option>` tags when Select2 is initialized. This
removes a lot of duplicate code from the `ArrayAdapter`, and keeps
everything closer to the native `<select>` element.

This introduces a breaking change from previous versions of Select2,
where the initial value for array data was blank, even if a blank
option was not present in the original array of objects. Now the
first object passed in will be selected by default, following the
behavior of a standard `<select>` element.

This breaking change does not affect `<select multiple="multiple">`
elements, which by default have no selection.
2014-11-06 12:05:12 -05:00
Kevin Brown
5454a908a1 Started working on the initial release announcement 2014-11-06 11:27:28 -05:00
Kevin Brown
6d029f3f2f Merge pull request #2786 from exabugs/master
Delete 'StarHack' code. Because select2 support IE8+.
2014-11-05 17:48:33 -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
Jonathan Toms
a83ae7858a recalculate $dropdown height after drop-above class added 2014-11-05 00:10:15 -05:00
exabugs
7f75f46e5b Delete 'StarHuck' code. Because select2 support IE8+. 2014-11-04 22:04:30 +09:00
Kevin Brown
6e4336769f Fix AJAx example 2014-11-03 19:32:50 -05:00
Kevin Brown
0bc4832995 Better infinite scroll
Only show the "No results found" message when there are no results
visible in the list. This avoid issues when loading more data, and
it returns no results.

Only try to see if the load more button is visible if it is present
in the DOM. This prevents making continuous requests when there are
no more results.
2014-11-03 19:24:29 -05:00
Kevin Brown
5e3b63289c Added infinite scrolling support for AJAX 2014-11-03 19:10:36 -05:00
Kevin Brown
78bcd6e831 Added docs build for grunt 2014-11-03 19:09:38 -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