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

1741 Commits

Author SHA1 Message Date
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
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
6d2b462e2b Better key event handling 2014-11-01 21:04:31 -04:00
Kevin Brown
e16c505c25 Move to a central key handler
This allows for any control to emit key events, and for the Select2
instance to handle them. So now the search box will allow for
results to be scrolled and selected, bringing back the old expected
functionality. This also stops triggering new queries when the
arrow keys are pressed.

The container will also be automatically focused when the dropdown
is closed, which is consistent with the old Select2.

The results will no longer be queried on initialization, but
instead will be queried when the dropdown is opened. This is more
consistent with the previous version of Select2.

The search box will now be cleared when the dropdown is closed.
2014-11-01 20:35:23 -04:00
Kevin Brown
3b575ad92f Register the click handler in the container
This shouldn't be in the core, it's much easier to override things
in the container.
2014-11-01 19:36:02 -04:00
Kevin Brown
130358e8ae Set up the click handler for closing
Now the dropdown will automatically be closed when the user clicks
outside of it.
2014-11-01 19:29:07 -04:00
Kevin Brown
f8ca597f02 Move all of the event binding into separate methods
This should make it easier to override in subclasses.
2014-11-01 19:05:08 -04:00
Kevin Brown
47d0bc4fe1 Allow the position of the tag to be customized. 2014-11-01 18:40:06 -04:00
Kevin Brown
8bdd83c44f Better support for tagging
This removes the special case for `<select>` elements and instead
handles everything tagging related within the `Tags` decorator.
2014-11-01 17:49:53 -04:00
Kevin Brown
b87a4a55e4 Fix automatically hiding the placeholder
The placeholder will not only be automatically hidden if the
results adapter was not already overridden. This will allow users
to override the results adapter to now hide the placeholder, if
they do not want that functionality.
2014-11-01 17:27:30 -04:00
Kevin Brown
e57e0b1870 Added decorator to remove the placeholder object
This will remove the placeholder object from the results list.
2014-11-01 17:21:46 -04:00
Kevin Brown
09a0bb89b8 Move placing the sections into methods
This allows them to be overridden, allowing for things like
attaching the dropdown to a different part of the DOM.

The id is also now generated in a function that can be overridden.
2014-11-01 17:08:59 -04:00
Kevin Brown
8bf86ebae1 Tweak the README
Now we point users to the `LICENSE.md` file for the license,
instead of including it in the README. This also removes the
example integrations, which are no longer officially maintained
by Select2.

The translation section has also been updated.
2014-11-01 16:05:47 -04:00
Kevin Brown
fef1ccfd81 Merge branch 'master' into select2-ng
This adds the package management files back into the repository
and also updates the README to reflect the future Select2 4.0.
2014-11-01 15:43:01 -04:00
Kevin Brown
6f6e4f50aa Added MIT license 2014-11-01 15:21:10 -04:00
Kevin Brown
4e19d87927 modified version identifiers in descriptors for release 3.5.2 2014-11-01 14:43:38 -04:00
Kevin Brown
db7cd1b373 Go back to hiding the original element
This was only done to maintain compatibility with labels, back
when we could capture the focus events from the original element.
Now that we handle them in a different way, this is no longer
needed.

This fixes #2769.
2014-11-01 14:39:06 -04:00
Kevin Brown
959b96eca6 Started work on the "No results found" message 2014-11-01 14:20:51 -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
20fcaa4449 Start working on translations
This adds a custom r.js build for i18n, which processes each JS
file in the `select2/i18n` directory and builds it.

So far only the "No results found" translation has been added.
2014-10-31 22:24:59 -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
8b77dcab98 Remove old start and end files 2014-10-31 20:17:40 -04:00
Kevin Brown
afbf30d09a Wrap JS
This will prevent leaking variables, and will remove the possibility
of Select2 not working well with other plugins which support
AMD loaders. The `define` and `require` methods are now aliased
under `$.Select2.amd` for use inside additional files, such as
translations.
2014-10-31 20:15:17 -04:00
Kevin Brown
8e70642b87 Lint the Gruntfile 2014-10-31 19:12:27 -04:00
Kevin Brown
e943f6ef08 Revert "Fixed Select2 jumping around in Chrome"
This reverts commit 0daee34626.
This results in artifacts being displayed in Chrome, and doesn't
fix the other jumping issue.
2014-10-31 18:27:33 -04:00
Kevin Brown
1de4be3749 Fixed TypeError when destroying Select2
This fixes #2587.
2014-10-31 18:15:32 -04:00
Kevin Brown
7581fa5708 Merge pull request #2588 from fabdouglas/patch-8
Redirect the focus of original input to Select2
2014-10-31 18:13:47 -04:00
Kevin Brown
0daee34626 Fixed Select2 jumping around in Chrome
This fixes #2769, where Select2 will jump around because of how
focus moves to the original element when selections are made.

Because absolute positioning pushed the original element out of the
viewport, bringing it back into the viewport should be the best
fix.
2014-10-31 18:10:13 -04:00
Kevin Brown
0ed9e0283d Merge pull request #2775 from Splaktar/patch-1
Update link for AngularUI
2014-10-31 16:32:56 -04:00
Kevin Brown
f16eb6c621 Merge pull request #2776 from bjornjohansen/master
Replaced nonexistent locale "no" with "nb" (Norwegian Bokmål).
2014-10-30 11:51:11 -04:00
Bjørn Johansen
d1c19eb012 Added the formatMatches string 2014-10-29 22:36:54 +01:00
Bjørn Johansen
3a9896dc4b Replaced nonexistent locale "no" with "nb" (Norwegian Bokmål). Added space before ellipsis for correct punctuation. 2014-10-29 22:13:48 +01:00
Michael Prentice
9ff939b534 Updated AngularJS link to HTTPS
HTTPS everywhere
2014-10-29 12:45:07 -04:00
Michael Prentice
fd9006047c Updated link for AngularUI
They have deprecated the original ui-select2 directive in favor of the new and better supported ui-select directive. This happened a couple weeks ago.
2014-10-29 12:41:03 -04:00