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

1733 Commits

Author SHA1 Message Date
Kevin Brown
05cbaf7bf7 Universally use the object query return
There was a plan to universally use an array as the return from
query methods, but now that we've realized pagination and extra
things are impossible without it, we're going back to the return
object. Anyone looking to migrate their data should be returning
an object with the key `results` containing what they previously
returned.

This should fix https://github.com/select2/select2/issues/2898
2015-01-07 21:11:32 -05:00
Kevin Brown
063859160d Add a few translations, label the others 2015-01-07 20:39:29 -05:00
Kevin Brown
e111ea0420 Added a few new translations
Also fixed the JSHint issues in the new Ukranian translation.
2015-01-07 20:11:58 -05:00
Kevin Brown
970e98c573 Merge pull request #2897 from ktaras/feature/adding-ukrainian-localization
Adds Ukrainian localization
2015-01-07 17:41:10 -05:00
ktaras
8a2cdac8ce Adds Ukrainian localization 2015-01-08 00:34:54 +02:00
Kevin Brown
f8fdcb6fa5 Added support for tokenization
This brings up both the `tokenizer` and `tokenSeparators` options.
2015-01-06 20:03:12 -05:00
Kevin Brown
938993302f Fixed SASS error
This fixes the SASS error caused by the `&[dir="rtl"]` selector in
the `_single.scss` and `_multiple.scss` files. We were expecting
these files to be nested within the `.select-container` class, which
would have made this a non-error as the `&` would refer to the
`.select2-container` class that was wrapping the `@import`.

This moves the `@import` statements into the `.select2-container`
class, so this no longer triggers an error in the Ruby version of
SASS.

This closes https://github.com/select2/select2/issues/2896
2015-01-06 17:54:33 -05:00
Kevin Brown
dcfaa5f628 Added Google Analytics 2015-01-05 19:30:15 -05:00
Kevin Brown
562669064b Called out 3.5.2 dodcs
Also migrated all of the links to the new location in the GitHub
organization.
2015-01-05 18:22:27 -05:00
Kevin Brown
ed24a51ea3 Updated docs to use the Select2 GitHub organization
Documentation will now be at https://select2.github.io
2015-01-02 21:12:41 -05:00
Kevin Brown
ad94b6faba Added jQuery.mousewheel support
jQuery.mousewheel will allow us to prevent the dropdown from
automatically closing when the user scrolls to the end of the list.
It is automatically bundled in the full versions of Select2 and
we don't require that it is included in order for Select2 to work.

jQuery.mousewheel was taken directly from the source repository
using the commit at

cc2c5d73ae
2015-01-02 20:32:14 -05:00
Kevin Brown
09e3a76bf9 Added pagination support for AJAX results
I'm still not quite sure how this should be handled for the general
case, but for the special case we have this for infinite scrolling,
only on AJAX data.
2015-01-02 19:58:09 -05:00
Kevin Brown
f1e86470ca Clone the options for group elements
This will always clone the options that are passed in when
initializing Select2 on multiple objects (like `$("select")`) so
it doesn't always assume that the configuration is the exact same.
This prevents any reference-based tricks for modifying the data
within Select2, but some would look at that as an upside.
2015-01-02 18:15:59 -05:00
Kevin Brown
12f7ed93f8 Added more migration information
The documentation for templates still needs to be created.

A warning is now generated in the console for applications using
the previous data attributes that have been migrated.
2014-12-27 21:47:18 -05:00
Kevin Brown
e7c2c70d1a Added RTL support to Select2
This works in the same way as the `lang` option, which pulls
directly from the `dir` property on DOM nodes.
2014-12-17 22:08:58 -05:00
Kevin Brown
0bc73941fe Support duplicate options
Now that the data objects have the `element` property, we can test
to make sure it's a DOM element and then use it for selecting the
option. This allows us to select multiple options with the same id,
as well as handle cases where that is already happening.

You cannot use `$e.val()` to select two options with the same id,
as jQuery will reject it, but you can set the second option to
`.selected = true`, which is supported.
2014-12-17 20:36:06 -05:00
Kevin Brown
fe136088f6 Fixed string to object conversion 2014-12-17 19:39:12 -05:00
Kevin Brown
ea41b627dc IE fixes and alt-arrow support
alt-down/up is the standard way of opening a select when using a
screen reader. This also fixes the gradient in IE, so now it
displays the right colors. Also added a note about Placeholders.js,
so the placeholders on multi-select boxes will work in IE 9 and
below.
2014-12-17 19:06:13 -05:00
Kevin Brown
358306ac8c Respect the disabled attribute
Added a disabled state for Select2. This will correctly listen to
property changes (so when the disabled property is changed) and
update the state of Select2 to reflect it.

Added a utility function to find a method to a different context.
2014-12-16 22:44:11 -05:00
Kevin Brown
1e44ab7ee1 Added the element reference in the data
This also fixes `_normalizeItem` for cases where `text` doesn't
exist, so it doesn't clobber the item.
2014-12-16 20:51:35 -05:00
Kevin Brown
33809f1fef Added some translations 2014-12-16 20:45:44 -05:00
Kevin Brown
8a78ff7415 Added five more translations
This also fixes a spelling error in "loading" in the last nine.
2014-12-15 21:16:37 -05:00
Kevin Brown
a6841618b0 Migrated 9 more translations 2014-12-15 20:27:38 -05:00
Kevin Brown
e23b8b5483 More work on the announcement 2014-12-11 18:11:03 -05:00
Kevin Brown
096d55b64d Fixed backspace on multiple selects 2014-12-11 18:10:46 -05:00
Kevin Brown
3ff78d8145 Added back select2("enable")
This also adds a console warning if the `enable` or `val` method is
called.
2014-12-11 17:42:05 -05:00
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
395e06aff5 Backspace unselects item in multiple selects
The backspace key now behaves very similar to how it does in other
multiple select boxes, such as the one that Stack Exchange uses.
When the user presses the backspace key, the last selected option
is unselected and the search box is filled with the text of the
option.
2014-12-10 19:19:48 -05:00
Kevin Brown
0de516f17a Add minimumResultsForSearch 2014-12-10 18:46:05 -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
ec1bd3387b Added lang attribute support
Select2 will now detect the language based on the `lang` attribute
of the `<select>` element or any parent elements.
2014-12-10 18:09:00 -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
f0017c024d Added support for a click mask
In past versions of Select2, a mask was used to detect clicks
outside of the dropdown. While this works with high accuracy, and
avoid many of the click issues we had with modals, it is no longer
the default close handler for Select2. It blocks any features on
the container from working without a second click, and introduces
odd edge cases that we cannot easily handle.
2014-12-05 22:44:41 -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
ce38cd5b9c Allow the dropdown to point up
Up until now, the container could only have a dropdown that was
displayed below the container. While this worked well, there are
some cases where the dropdown should be displayed above the
container. Most notably, this is when the conatainer is displayed
towards the bottom of the page, and displaying the dropdown would
cause the page to be extended. Because we close the dropdown
when the page is scrolled, the user would not be able to access any
options that were displayed outside of the viewpoint.

Because of the order that events are fired, we attach the handlers
for repositioning the dropdown after results are displayed when the
container is opened for the first time.  This allows it to be
registered after the results container registers their events, so
the dropdown is repositioned after the results have been displayed.

The logic for determining the direction that the dropdown will be
shown in is very similar to the positioning code used in
Select2 3.x. Unlike previous versions of Select2, a class is used
to indicate the direction of the dropdown, even if it is displaying
below the container.

The themes provided with Select2 have been updated to correctly
render the dropdown in both directions.
2014-12-05 20:09:42 -05:00
Kevin Brown
fda973c34f Started adding more translations 2014-11-26 23:19:04 -05:00
Kevin Brown
07575f051c Automatically close on scroll
This now matches how the browser works, where the dropdown is
closed when the window scrolls.

The arrow was also covering the clear placeholder icon, this has
now been fixed and the clear icon is now placed correctly.
2014-11-26 22:30:31 -05:00
Kevin Brown
e3647051de Added maximumInputLength support 2014-11-26 21:52:49 -05:00
Kevin Brown
43efd43d57 Add tests for the multiple selection container 2014-11-26 20:50:39 -05:00
Kevin Brown
7fc195f70d Fix hiding search
When the dropdown is in the dropdown that is attached to the body,
the call to `show` causes `display: inline` to be set directly on
the search container. This causes rendering issues, so this change
uses a class instead of calling `show` and `hide` directly.

This is most likely a jQuery bug of some form, as it only happens
when using the dropdown that is attached to the body.
2014-11-26 20:39:52 -05:00
Kevin Brown
4cab421966 Added tests for the single selection container 2014-11-26 20:25:56 -05:00
Kevin Brown
56d5778590 Finished off tests for tags
This also adds back the ability for tags to return `null` in order
for no tag to be added to the results.
2014-11-26 19:53:15 -05:00
Kevin Brown
76e4ea8340 Added tests for tags 2014-11-25 21:28:16 -05:00
Kevin Brown
16e565e28e Added tests for minimumInputLength 2014-11-25 20:12:17 -05:00
Kevin Brown
389c3ed866 More work on the release announcement 2014-11-25 19:42:53 -05:00