initial commit of select2 v5 wip
This commit is contained in:
parent
04fce55967
commit
1eabe8379c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
.idea
|
||||||
node_modules
|
node_modules
|
||||||
dist/js/i18n/build.txt
|
dist/js/i18n/build.txt
|
||||||
.sass-cache
|
.sass-cache
|
||||||
|
321
CHANGELOG.md
321
CHANGELOG.md
@ -1,321 +0,0 @@
|
|||||||
# Change Log
|
|
||||||
|
|
||||||
## 4.0.7
|
|
||||||
|
|
||||||
### New features/improvements
|
|
||||||
- Do not close on select if Ctrl or Meta (Cmd) keys being held (#5222)
|
|
||||||
|
|
||||||
### Bug fixes
|
|
||||||
- Fixed issue where single select boxes would automatically reopen when they were closed (#5490, #5492)
|
|
||||||
|
|
||||||
### Miscellaneous
|
|
||||||
- Move almost and jquery-mousewheel to devDependencies (#5489)
|
|
||||||
|
|
||||||
## 4.0.6
|
|
||||||
|
|
||||||
### New features/improvements
|
|
||||||
- Add style property to package.json (#5019)
|
|
||||||
- Implement `clear` and `clearing` events (#5058)
|
|
||||||
- Add `scrollAfterSelect` option (#5150)
|
|
||||||
- Add missing diacritics (#4118, #4337, #5464)
|
|
||||||
|
|
||||||
### Bug fixes
|
|
||||||
- Fix up arrow error when there are no options in dropdown (#5127)
|
|
||||||
- Add `;` before beginning of factory wrapper (#5089)
|
|
||||||
- Fix IE11 issue with select losing focus after selecting an item (#4860)
|
|
||||||
- Clear tooltip from `select2-selection__rendered` when selection is cleared (#4640, #4746)
|
|
||||||
- Fix keyboard not closing when closing dropdown on iOS 10 (#4680)
|
|
||||||
- User-defined types not normalized properly when passed in as data (#4632)
|
|
||||||
- Perform deep merge for `Defaults.set()` (#4364)
|
|
||||||
- Fix "the results could not be loaded" displaying during AJAX request (#4356)
|
|
||||||
- Cache objects in `Utils.__cache` instead of using `$.data` (#4346, #5486)
|
|
||||||
- Removing the double event binding registration of `selection:update` (#4306)
|
|
||||||
|
|
||||||
#### Accessibility
|
|
||||||
- Improve `.select2-hidden-accessible` (#4908)
|
|
||||||
- Add role and aria-readonly attributes to single selection dropdown value (#4881)
|
|
||||||
|
|
||||||
### Translations
|
|
||||||
- Add Turkmen translations (`tk`) (#5125)
|
|
||||||
- Fix error in French translations (#5122)
|
|
||||||
- Add Albanian translation (`sq`) (#5199)
|
|
||||||
- Add Georgian translation (`ka`) (#5179)
|
|
||||||
- Add Nepali translation (`ne`) (#5295)
|
|
||||||
- Add Bangla translation (`bn`) (#5248)
|
|
||||||
- Add `removeAllItems` translation for clear "x" title (#5291)
|
|
||||||
- Fix wording in Vietnamese translations (#5387)
|
|
||||||
- Fix error in Russian translation (#5401)
|
|
||||||
|
|
||||||
### Miscellaneous
|
|
||||||
- Remove duplicate CSS selector in classic theme (#5115)
|
|
||||||
|
|
||||||
## 4.0.5
|
|
||||||
|
|
||||||
### Bug fixes
|
|
||||||
- Replace `autocapitalize=off` with `autocapitalize=none` (#4994)
|
|
||||||
|
|
||||||
### Translations
|
|
||||||
- Vietnamese: remove an unnecessary quote mark (#5059)
|
|
||||||
- Czech: Add missing commas and periods (#5052)
|
|
||||||
- Spanish: Update the 'errorLoading' message (#5032)
|
|
||||||
- Fix typo in Romanian (#5005)
|
|
||||||
- Improve French translation (#4988)
|
|
||||||
- Add Pashto translation (`ps`) (#4960)
|
|
||||||
- Add translations for lower and upper Sorbian (`dsb` and `hsb`) (#4949)
|
|
||||||
- Updates to Slovak (#4915)
|
|
||||||
- Fixed Norwegian `inputTooShort` message (#4817, 4896)
|
|
||||||
- Add Afrikaans translation (`af`) (#4850)
|
|
||||||
- Add Bosnian translation (`bs`) (#4504)
|
|
||||||
|
|
||||||
## 4.0.4
|
|
||||||
|
|
||||||
### New features / Improvements
|
|
||||||
- Make tag matching case insensitive [https://github.com/select2/select2/commit/cb9a90457867ffb14c7b1550bb67e872e0a5c2dd, https://github.com/select2/select2/commit/1167bace78cd3b1a918c1b04f3bac54674eab62b]
|
|
||||||
- Support selecting options with blank or `0` option values [https://github.com/select2/select2/commit/16b4840c0e2df0461998e3b464ee0a546173950d, https://github.com/select2/select2/commit/0358ee528765157234643d289bce6b8ca5889c72]
|
|
||||||
|
|
||||||
### Bug fixes
|
|
||||||
- Fix issue with entire form losing focus when tabbing away from a Select2 control (#4419)
|
|
||||||
- Fix UMD support for CommonJS [https://github.com/select2/select2/commit/45a877345482956021161203ac789c25f40a7d5e]
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
- Github Pages documentation has been deprecated, replaced with https://github.com/select2/docs
|
|
||||||
- Add django-autocomplete-light to integrations [https://github.com/select2/select2/pull/4597]
|
|
||||||
- Correct typo in options page [https://github.com/select2/select2/pull/4389]
|
|
||||||
- Correct misspelling in AJAX query parameters example [https://github.com/select2/select2/pull/4435]
|
|
||||||
- "highlight" should be "focus" in focus example [https://github.com/select2/select2/pull/4441]
|
|
||||||
- Correct misspelling in `<select>` serialization example [https://github.com/select2/select2/pull/4538]
|
|
||||||
- Correct typos in documentation [https://github.com/select2/select2/pull/4663]
|
|
||||||
|
|
||||||
### Translations
|
|
||||||
- Add `errorLoading` Hungarian translation [https://github.com/select2/select2/commit/7d1d13352321e21670ff1c6cba7413aa264fd57a]
|
|
||||||
- Add `errorLoading` German translation [https://github.com/select2/select2/commit/4df965219ea4c39147fde9335bc260840465933a]
|
|
||||||
- Add Slovene language [https://github.com/select2/select2/commit/8e6422c570a87da8d89c45daf0d253695a943c84]
|
|
||||||
- Add `errorLoading` Galician translation [https://github.com/select2/select2/commit/8fcc6202c37f4e06d951342bf142a3b906b6b8e3]
|
|
||||||
- Add `errorLoading` Thai translation [https://github.com/select2/select2/commit/625fc78ee616baedf64aa37357403b4b72c7363c]
|
|
||||||
- Add `searching` and `errorLoading` Finnish translations [https://github.com/select2/select2/pull/4730]
|
|
||||||
- Add `errorLoading` Turkish translation [https://github.com/select2/select2/commit/fd4a0825315c7055347726d5818c999279f96ff8, https://github.com/select2/select2/commit/751b36767f9f28b9de9428d5e8035c9a404915d9]
|
|
||||||
- Add Armenian language [https://github.com/select2/select2/commit/f6fa52dcc02341df1523f50348f2effc54ee2911]
|
|
||||||
|
|
||||||
## 4.0.3
|
|
||||||
|
|
||||||
This is the third bugfix release of Select2 4.0.0. It builds upon the [second bugfix release](https://github.com/select2/select2/releases/tag/4.0.2) and fixes many common issues.
|
|
||||||
|
|
||||||
### New features / Improvements
|
|
||||||
- The old `dropdownAutoWidth` option now properly works [https://github.com/select2/select2/commit/fe26b083eb830836061de1458e483782cefef424]
|
|
||||||
- A `focus` event on the original `<select>` is now handled [https://github.com/select2/select2/commit/31e7a1d4c52ed7477769fcad5d15166ae3c9b4d0]
|
|
||||||
- Adding and removing options now refreshes the selection automatically [https://github.com/select2/select2/commit/ea79a197e0ffe55aa600eed6d18cbd1c804c3176]
|
|
||||||
|
|
||||||
### Bug fixes
|
|
||||||
- `select2('option')` no longer mutate the arguments when working on multiple elements [https://github.com/select2/select2/commit/c2c1aeef31c95c6df5545c900a4e1782d712497c]
|
|
||||||
- Better detect aborted requests [https://github.com/select2/select2/commit/cfb66f5e4f71a56c46a6890c5dde4b7f24f11fa8]
|
|
||||||
- New options are now properly created during tokenization [https://github.com/select2/select2/commit/3b8cd2e36990e695e4cb4b966c8658e7ca1574dc]
|
|
||||||
- Fix positioning bug with non-static parents for the dropdown [https://github.com/select2/select2/pull/4267]
|
|
||||||
- Infinite scrolling no longer resets the keyboard focus [https://github.com/select2/select2/commit/e897d008a672da262ba84cee2a144578696ada29, https://github.com/select2/select2/commit/9f581285d88128b29a01fc1e5fd2d445d610b553]
|
|
||||||
- `selectOnClose` now works properly with `closeOnSelect` [https://github.com/select2/select2/commit/481c43883e23874e9c35879d173eb8cc5b994b12]
|
|
||||||
- Apply `ajax.delay` to empty search terms as well [https://github.com/select2/select2/commit/4b9e02f02211248be25ac4c16d4635cf38237bb9]
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
- Added example for attaching event listeners [https://github.com/select2/select2/commit/84d6b5d840f7f4e6b7a2fb3f08424bf5495c876d]
|
|
||||||
- Correct link to the [Select2 Bootstrap Theme](https://github.com/select2/select2-bootstrap-theme) [https://github.com/select2/select2/pull/4318]
|
|
||||||
- Added example for using a `<label>` [https://github.com/select2/select2/commit/3bc7f4ac78b58eff8cd17b3273596638c3c9c5c1]
|
|
||||||
- Add documentation for `ajax.url` [https://github.com/select2/select2/commit/5a831afb9a7d46e8f20aec21164cfbfd182024de]
|
|
||||||
- Added favicon [https://github.com/select2/select2/pull/4379]
|
|
||||||
|
|
||||||
### Translations
|
|
||||||
- Add Khmer translation [https://github.com/select2/select2/pull/4246]
|
|
||||||
- Added Norwegian bokmaal for `errorLoading` [https://github.com/select2/select2/pull/4259]
|
|
||||||
- Fixed pluralization in Lithuanian translation [https://github.com/select2/select2/commit/5b5eddd183c87bf43165b3a98e03eabe10e9fa58]
|
|
||||||
- Add French translation for `errorLoading` [https://github.com/select2/select2/commit/b1ea28bb7d8c02b3b352f558031ccfc8041122eb]
|
|
||||||
- Add Greek translation [https://github.com/select2/select2/pull/4139]
|
|
||||||
|
|
||||||
## 4.0.2
|
|
||||||
|
|
||||||
This is the second bugfix release of Select2 4.0.0. It builds upon the [first release candidate of Select2 4.0.2](https://github.com/select2/select2/releases/tag/4.0.2-rc.1) with some minor improvements.
|
|
||||||
|
|
||||||
### New features / Improvements
|
|
||||||
|
|
||||||
- Added `insertTag` option to control the placement of the `tags` option [https://github.com/select2/select2/pull/4008]
|
|
||||||
- Added handler for AJAX errors [https://github.com/select2/select2/issues/3501]
|
|
||||||
- Added insertTag to control the tag position [https://github.com/select2/select2/pull/4008]
|
|
||||||
|
|
||||||
### Bug fixes
|
|
||||||
|
|
||||||
- Fixed positioning issues with static dropdown parents [https://github.com/select2/select2/issues/3970]
|
|
||||||
- Fixed existing selections not always being respected with array data [https://github.com/select2/select2/issues/3990]
|
|
||||||
- Sanitize automatically generated ids so CSS identifiers can be used [https://github.com/select2/select2/issues/3618]
|
|
||||||
- Recursively apply defaults so AJAX defaults can be set [https://github.com/select2/select2/commit/983cd8e765c5345bfe7d3bdcc3b0c882a35461ca]
|
|
||||||
- No need to recalculate the top of the dropdown twice [https://github.com/select2/select2/pull/4155]
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
|
|
||||||
- Updated Bootstrap and Font Awesome dependencies [https://github.com/select2/select2/commit/a5e539b509778eabeb8ce79e191b3ee1e81f6deb, https://github.com/select2/select2/commit/81a4a68b113e0d3e0fb1d0f8b1c33ae1b48ba04f, https://github.com/select2/select2/commit/6369f5f173fb81ec692213782945cc737e248da5]
|
|
||||||
- Use Jekyll's highlighting instead of prettify [https://github.com/select2/select2/commit/54441e6a22be3969dd934ccb769f5d7dde684bfb, https://github.com/select2/select2/commit/74387b98632c75b06d15d83ad5359b9daf0f5dcb, https://github.com/select2/select2/commit/a126b53b4c90fac33b5d855894647cd8bcac3558, https://github.com/select2/select2/commit/75163d67cb80e4279965a97e9eeda5b171806085]
|
|
||||||
- Corrected responsive width example to properly show it working [https://github.com/select2/select2/commit/63d531a9c0ab51f05327492a56f3245777762b45]
|
|
||||||
- Replaced protocol-relative URLs with HTTPS protocol [https://github.com/select2/select2/pull/4127]
|
|
||||||
- Code snippets for mapping `id` and `text` [https://github.com/select2/select2/issues/4086]
|
|
||||||
- Document how to trigger `change` just for Select2 [https://github.com/select2/select2/issues/3620]
|
|
||||||
- Added notes about DOM events [https://github.com/select2/select2/commit/37dbe059fce4578b46b7561e6243b7fdc63ac002]
|
|
||||||
|
|
||||||
### Translations
|
|
||||||
- Correct Romanian translation [https://github.com/select2/select2/commit/72d905f9e026d49e7c600f37a1ce742c404654d7]
|
|
||||||
|
|
||||||
## 4.0.1
|
|
||||||
|
|
||||||
This is the first bugfix release of Select2 4.0.0. It builds upon the [first release candidate of Select2 4.0.1](https://github.com/select2/select2/releases/tag/4.0.1-rc.1) with some minor improvements.
|
|
||||||
|
|
||||||
### New features / improvements
|
|
||||||
- The option container is now passed in as the second argument when templating selections using `templateResult` [https://github.com/select2/select2/commit/dc516e7073605723be59bc727b96a3b3dea1ae5a]
|
|
||||||
- The option container is now passed in as the second argument when templating selections using `templateSelection` [https://github.com/select2/select2/pull/3324]
|
|
||||||
- You can immediately start typing to search when tabbing into a multiple select [https://github.com/select2/select2/commit/02cca7baa7b78e73cdcf393172ee3a54be387167, https://github.com/select2/select2/commit/79cdcc0956e242c1ce642bbaa93e538c54f4be0]
|
|
||||||
- All parameters passed in for AJAX requests are now set as query string parameters by default [https://github.com/select2/select2/issues/3548]
|
|
||||||
|
|
||||||
### Bug fixes
|
|
||||||
- The search box will now be properly sized after removing a selection [https://github.com/select2/select2/commit/5f80c5d9f81f3c5398c3e6e3e84fd6c67c8873f1]
|
|
||||||
- Dropdown results will now be spoken by screen readers [https://github.com/select2/select2/commit/9fae3d74e373fc646da4e39a0c2ab11efa808c3f]
|
|
||||||
- Options are now properly cloned when initializing multiple instances at once [https://github.com/select2/select2/commit/3c8366e8769233a6b20ade934fe629279e7be6ff]
|
|
||||||
- `selectOnClose` and now be used with `closeOnSelect` without getting a stack overflow [https://github.com/select2/select2/commit/393ca4cf7f7f7097d3a994bda3dbf195e945eba1]
|
|
||||||
- Fixed positioning with non-static parents [https://github.com/select2/select2/commit/c9216b4b966653dd63a67e815b47899ef5325298]
|
|
||||||
- Fixed bug where multiple selects with placeholders were buggy in IE [https://github.com/select2/select2/issues/3300]
|
|
||||||
- Fixed bug where AJAX selects could not be initialized with array data [https://github.com/select2/select2/pull/3375]
|
|
||||||
- `:all:` is now correctly removed when used in `containerCss` and `dropdownCss` options [https://github.com/select2/select2/pull/3464]
|
|
||||||
- Fixed bug where the multiple select search box would appear on the left in RTL mode [https://github.com/select2/select2/pull/3502]
|
|
||||||
- Change ALT + UP to close the dropdown instead of opening it [https://github.com/select2/select2/commit/d2346cc33186c2a00fa2dad29e8e559c42bfea00]
|
|
||||||
- Fix focus issue with the multiple select search box when the `change` event was triggered [https://github.com/select2/select2/commit/698fe7b9e187e182f679aa679eb8b0ecb64a846b, https://github.com/select2/select2/commit/88503d2c67dc7f4fb9395a17f17edfe4948cf738, https://github.com/select2/select2/commit/dd2990adead92593a2dffff6ae004ea8b647d130]
|
|
||||||
- Fix bug in `ArrayAdapter` where the existing `<option>` data would be used instead of the array data [https://github.com/select2/select2/pull/3565]
|
|
||||||
- Remove random call to `$dropdownContainer.width()` in the `AttachBody` decorator [https://github.com/select2/select2/pull/3654]
|
|
||||||
- Fix memory leak in `AttachBody` decorator [https://github.com/select2/select2/commit/671f5a2ce21005090e0b69059799cd3dd1fbbf84]
|
|
||||||
- Selections can no longer be removed when Select2 is in a disabled state [https://github.com/select2/select2/commit/68d068f1d2c7722d011d285a291d1f974bf09772, https://github.com/select2/select2/commit/7d8f86cbf85ebd2179195ff6a2a7a1c5dcb9da58]
|
|
||||||
- Remove redundant `open` event trigger [https://github.com/select2/select2/pull/3507]
|
|
||||||
- Correct references to `this` in `ajax.data` and `ajax.url` callback functions [https://github.com/select2/select2/issues/3361]
|
|
||||||
- Apply select2('option') calls on all elements [https://github.com/select2/select2/pull/3495]
|
|
||||||
|
|
||||||
### Design
|
|
||||||
|
|
||||||
- Fixed original `<select>` not always being hidden correctly in some cases [https://github.com/select2/select2/pull/3301]
|
|
||||||
- Fix potential issue with Bootstrap's gradients in Internet Explorer [https://github.com/select2/select2/pull/3307]
|
|
||||||
- Improve compatibility with Zurb Foundation [https://github.com/select2/select2/pull/3290]
|
|
||||||
- Remove padding on mobile safari search field in multiple selects [https://github.com/select2/select2/pull/3605]
|
|
||||||
- Fix the clear button appearing beneath long text [https://github.com/select2/select2/issues/3306]
|
|
||||||
- Migrate the CSS classes for the "Loading more results" message to BEM [https://github.com/select2/select2/issues/3889]
|
|
||||||
- Fix inline search not displaying properly in Safari [https://github.com/select2/select2/issues/3459]
|
|
||||||
|
|
||||||
### Documentation
|
|
||||||
|
|
||||||
- New documentation theme designed by @fk [https://github.com/select2/select2/pull/3376, https://github.com/select2/select2/pull/3467, https://github.com/select2/select2/pull/3488]
|
|
||||||
- Update ajax example to reflect pagination [https://github.com/select2/select2/pull/3357]
|
|
||||||
- Fix incorrect option name in `maxiumSelectionLength` example [https://github.com/select2/select2/pull/3454]
|
|
||||||
- Fix typos in the disabled mode/results examples [https://github.com/select2/select2/pull/3665]
|
|
||||||
- Fix `Option` parameters in the 4.0 announcement [https://github.com/select2/select2/pull/3547]
|
|
||||||
- Fix invalid JSON in the tags example within the 4.0 announcement [https://github.com/select2/select2/pull/3637]
|
|
||||||
|
|
||||||
### Translations
|
|
||||||
- Added Cyrillic variant of the Serbian language [https://github.com/select2/select2/pull/3943]
|
|
||||||
- Corrected Thai "no results found" translation [https://github.com/select2/select2/pull/3782]
|
|
||||||
- Swapped the `inputTooLong` and `inputTooShort` messages in the Galician translation [https://github.com/select2/select2/pull/3291]
|
|
||||||
- Fix improper grammar in Dutch translation [https://github.com/select2/select2/pull/3692]
|
|
||||||
- Add Japanese translation [https://github.com/select2/select2/pull/3477]
|
|
||||||
- Polish translation: Fixed typo in maximum selected message [https://github.com/select2/select2/pull/3587]
|
|
||||||
- Add Malay translation [https://github.com/select2/select2/pull/3635]
|
|
||||||
- Add `errorLoading` for Indonesian translation [https://github.com/select2/select2/pull/3635]
|
|
||||||
- Correct grammar issues in Hebrew translation [https://github.com/select2/select2/pull/3911]
|
|
||||||
- Add `errorLoading` for Danish translation [https://github.com/select2/select2/pull/3870]
|
|
||||||
- Add Arabic translation [https://github.com/select2/select2/pull/3859]
|
|
||||||
|
|
||||||
## 4.0.0
|
|
||||||
|
|
||||||
|
|
||||||
This builds upon [the second release candidate](https://github.com/select2/select2/tree/4.0.0-rc.2), **so review all previous release notes** before upgrading from previous versions of Select2.
|
|
||||||
|
|
||||||
### Supported environments
|
|
||||||
- jQuery 1.7.2+
|
|
||||||
- Modern browsers (Chrome, Firefox, Safari)
|
|
||||||
- Internet Explorer 8+
|
|
||||||
|
|
||||||
### New features
|
|
||||||
- Fully compatible with AMD and UMD based loaders.
|
|
||||||
- Advanced plugin system that [uses custom adapters](https://select2.org/advanced/adapters-and-decorators).
|
|
||||||
- Full support for `jQuery.noConflict`.
|
|
||||||
- A `<select>` is the recommended element and [can be used for all options](https://select2.org/upgrading/migrating-from-35#no-more-hidden-input-tags). There is limited backwards-compatible support for the `<input>` element in [full builds](https://select2.org/getting-started/builds-and-modules).
|
|
||||||
- [Declarative configuration through `data-*` attributes](https://select2.org/configuration/data-attributes)
|
|
||||||
- Easy to configure theme system and new default theme
|
|
||||||
- You can use more specific locales (like `en-US`) and Select2 will be able to determine what translation files to load.
|
|
||||||
|
|
||||||
### Breaking changes
|
|
||||||
- Select2 now uses the MIT license
|
|
||||||
- [The full build](https://select2.org/getting-started/builds-and-modules) of Select2 no longer includes jQuery - You must include jQuery separately on your page.
|
|
||||||
- Select2 will prevent the inner scrolling of modals (and other scrollable containers) when it is open to prevent the UI from breaking. [Read more at the commit.](https://github.com/select2/select2/commit/003d6053a9fff587c688008397e7d5824463fe99)
|
|
||||||
- jQuery is no longer listed as a dependency in the `bower.json`/`component.json` files.
|
|
||||||
- [`<select>` has replaced `<input type="hidden" />`](https://select2.org/upgrading/migrating-from-35#no-more-hidden-input-tags) for **all options** (_including remote data_)
|
|
||||||
- The [`matcher` has been revamped](https://select2.org/upgrading/migrating-from-35#advanced-matching-of-searches) to include full context, a compatibility module (`select2/compat/matcher`) has been created
|
|
||||||
- The [display always reflects the order](https://select2.org/upgrading/migrating-from-35#display-reflects-the-actual-order-of-the-values) data is sent to the server
|
|
||||||
- The click mask is no longer the default (again). You can get back the old functionality by wrapping your `selectionAdapter` with the `ClickMask` (`select2/selection/clickMask`) decorator.
|
|
||||||
- Select2 no longer stops the propagation of events happening within the dropdown and selection. You can use the `StopPropagation` modules available in the [full builds](https://select2.org/getting-started/builds-and-modules) to prevent this. [https://github.com/select2/select2/commit/8f8140e3b00c5d5bb232455137c4c633d7da4275]
|
|
||||||
- The enter key no longer toggles the state of multiple select items in the results, but instead will only select them. Use CTRL + Space instead to toggle the state. [https://github.com/select2/select2/commit/017c20109471fa5b835603faf5dc37f7c2c2ea45]
|
|
||||||
- Warnings will now be triggered in the developer console if Select2 detects an unsupported configuration.
|
|
||||||
|
|
||||||
#### Options
|
|
||||||
|
|
||||||
- The default value of the `width` option has been changed from `style` to `resolve`.
|
|
||||||
- The `copy` value for the `width` option has been renamed to `style`.
|
|
||||||
|
|
||||||
##### Renamed
|
|
||||||
- `formatSelection` -> `templateSelection`
|
|
||||||
- `formatResult` -> `templateResult`
|
|
||||||
- `sortResults` -> `sorter`
|
|
||||||
- `createSearchChoice` -> `createTag`
|
|
||||||
- `selectOnBlur` -> `selectOnClose`
|
|
||||||
- `ajax.jsonpCallback` -> `ajax.jsonp`
|
|
||||||
- `ajax.results` -> `ajax.processResults`
|
|
||||||
- `tags: [array,of,data]` -> `data: [array,of,data], tags: true`
|
|
||||||
- `placeholderOption` has been replaced by `placeholder.id` (`placeholder` -> `placeholder.text`)
|
|
||||||
|
|
||||||
##### [Internationalization](https://select2.org/i18n)
|
|
||||||
- `formatNoMatches` -> `language.noMatches`
|
|
||||||
- `formatSearching` -> `language.searching`
|
|
||||||
- `formatInputTooShort` -> `language.inputTooShort`
|
|
||||||
- `formatInputTooLong` -> `language.inputTooLong`
|
|
||||||
- `formatAjaxError` -> `language.errorLoading`
|
|
||||||
- `formatLoading` -> `language.loadingMore`
|
|
||||||
- `formatSelectionTooBig` -> `language.maximumSelected`
|
|
||||||
|
|
||||||
##### Deprecated/Removed
|
|
||||||
- `initSelection` - This is [no longer needed](https://select2.org/upgrading/migrating-from-35#removed-the-requirement-of-initselection) with `<select>` tags. Limited backwards compatibility in the [full build](https://select2.org/getting-started/builds-and-modules).
|
|
||||||
- `id` - Data objects should now always have `id` and `text` attributes that are strings, use [`$.map`](https://api.jquery.com/jquery.map/) when migrating
|
|
||||||
- `query` - Use a [custom data adapter](https://select2.org/upgrading/migrating-from-35#custom-data-adapters-instead-of-query) instead. Limited backwards compatibility in the [full build](https://select2.org/getting-started/builds-and-modules).
|
|
||||||
- `ajax.params` - All parameters passed to `ajax` will be passed to the AJAX data transport function
|
|
||||||
|
|
||||||
#### Methods
|
|
||||||
|
|
||||||
##### Renamed
|
|
||||||
- `.select2("val", [value])` -> `.val([value])`
|
|
||||||
- `.select2("enable", !disabled)` -> `.prop("disabled", disabled)`
|
|
||||||
|
|
||||||
##### Removed
|
|
||||||
- `.select2("onSortStart")` and `.select2("onSortEnd")` - A custom [selection adapter](https://select2.org/advanced/default-adapters/selection) should be created instead
|
|
||||||
- `.select2("data", data)` - Create the `<option>` tags for the objects that you would like to set, and set the `.val` to select them
|
|
||||||
- `.select2("readonly")` - There is [no way to make a `<select>` element read-only](http://stackoverflow.com/q/368813/359284), disable it instead
|
|
||||||
|
|
||||||
#### Events
|
|
||||||
|
|
||||||
##### New
|
|
||||||
- `select2:closing` is triggered before the dropdown is closed
|
|
||||||
- `select2:select` is triggered when an option is selected
|
|
||||||
|
|
||||||
##### Renamed
|
|
||||||
- `select2-close` is now `select2:close`
|
|
||||||
- `select2-open` is now `select2:open`
|
|
||||||
- `select2-opening` is now `select2:opening`
|
|
||||||
- `select2-selecting` is now `select2:selecting`
|
|
||||||
- `select2-removed` is now `select2:unselect`
|
|
||||||
- `select2-removing` is now `select2:unselecting`
|
|
||||||
|
|
||||||
##### Removed
|
|
||||||
- `select2-clearing` has been removed in favor of `select2:unselecting`
|
|
||||||
- `select2-highlight`
|
|
||||||
- `select2-loaded`
|
|
||||||
- `select2-focus` - Use the native `focus` event instead
|
|
||||||
- `select2-blur` - Use the native `blur` event instead
|
|
||||||
- All extra properties from the `change` event were removed
|
|
||||||
- `val` can be retrieved with `$element.val()` instead
|
|
||||||
- `added` can be retrieved by listening to `select2:select`
|
|
||||||
- `removed` can be retrieved by listening to `select2:unselect`
|
|
260
Gruntfile.js
260
Gruntfile.js
@ -1,260 +0,0 @@
|
|||||||
module.exports = function (grunt) {
|
|
||||||
// Full list of files that must be included by RequireJS
|
|
||||||
includes = [
|
|
||||||
'jquery.select2',
|
|
||||||
'almond',
|
|
||||||
|
|
||||||
'jquery-mousewheel' // shimmed for non-full builds
|
|
||||||
];
|
|
||||||
|
|
||||||
fullIncludes = [
|
|
||||||
'jquery',
|
|
||||||
|
|
||||||
'select2/compat/containerCss',
|
|
||||||
'select2/compat/dropdownCss',
|
|
||||||
|
|
||||||
'select2/compat/initSelection',
|
|
||||||
'select2/compat/inputData',
|
|
||||||
'select2/compat/matcher',
|
|
||||||
'select2/compat/query',
|
|
||||||
|
|
||||||
'select2/dropdown/attachContainer',
|
|
||||||
'select2/dropdown/stopPropagation',
|
|
||||||
|
|
||||||
'select2/selection/stopPropagation'
|
|
||||||
].concat(includes);
|
|
||||||
|
|
||||||
var i18nModules = [];
|
|
||||||
var i18nPaths = {};
|
|
||||||
|
|
||||||
var i18nFiles = grunt.file.expand({
|
|
||||||
cwd: 'src/js'
|
|
||||||
}, 'select2/i18n/*.js');
|
|
||||||
|
|
||||||
var testFiles = grunt.file.expand('tests/**/*.html');
|
|
||||||
var testUrls = testFiles.map(function (filePath) {
|
|
||||||
return 'http://localhost:9999/' + filePath;
|
|
||||||
});
|
|
||||||
|
|
||||||
var testBuildNumber = "unknown";
|
|
||||||
|
|
||||||
if (process.env.TRAVIS_JOB_ID) {
|
|
||||||
testBuildNumber = "travis-" + process.env.TRAVIS_JOB_ID;
|
|
||||||
} else {
|
|
||||||
var currentTime = new Date();
|
|
||||||
|
|
||||||
testBuildNumber = "manual-" + currentTime.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < i18nFiles.length; i++) {
|
|
||||||
var file = i18nFiles[i];
|
|
||||||
var name = file.split('.')[0];
|
|
||||||
|
|
||||||
i18nModules.push({
|
|
||||||
name: name
|
|
||||||
});
|
|
||||||
|
|
||||||
i18nPaths[name] = '../../' + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
var minifiedBanner = '/*! Select2 <%= package.version %> | https://github.com/select2/select2/blob/master/LICENSE.md */';
|
|
||||||
|
|
||||||
grunt.initConfig({
|
|
||||||
package: grunt.file.readJSON('package.json'),
|
|
||||||
|
|
||||||
concat: {
|
|
||||||
'dist': {
|
|
||||||
options: {
|
|
||||||
banner: grunt.file.read('src/js/wrapper.start.js'),
|
|
||||||
},
|
|
||||||
src: [
|
|
||||||
'dist/js/select2.js',
|
|
||||||
'src/js/wrapper.end.js'
|
|
||||||
],
|
|
||||||
dest: 'dist/js/select2.js'
|
|
||||||
},
|
|
||||||
'dist.full': {
|
|
||||||
options: {
|
|
||||||
banner: grunt.file.read('src/js/wrapper.start.js'),
|
|
||||||
},
|
|
||||||
src: [
|
|
||||||
'dist/js/select2.full.js',
|
|
||||||
'src/js/wrapper.end.js'
|
|
||||||
],
|
|
||||||
dest: 'dist/js/select2.full.js'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
connect: {
|
|
||||||
tests: {
|
|
||||||
options: {
|
|
||||||
base: '.',
|
|
||||||
hostname: '127.0.0.1',
|
|
||||||
port: 9999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
uglify: {
|
|
||||||
'dist': {
|
|
||||||
src: 'dist/js/select2.js',
|
|
||||||
dest: 'dist/js/select2.min.js',
|
|
||||||
options: {
|
|
||||||
banner: minifiedBanner
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'dist.full': {
|
|
||||||
src: 'dist/js/select2.full.js',
|
|
||||||
dest: 'dist/js/select2.full.min.js',
|
|
||||||
options: {
|
|
||||||
banner: minifiedBanner
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
qunit: {
|
|
||||||
all: {
|
|
||||||
options: {
|
|
||||||
urls: testUrls
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
jshint: {
|
|
||||||
options: {
|
|
||||||
jshintrc: true,
|
|
||||||
reporterOutput: ''
|
|
||||||
},
|
|
||||||
code: {
|
|
||||||
src: ['src/js/**/*.js']
|
|
||||||
},
|
|
||||||
tests: {
|
|
||||||
src: ['tests/**/*.js']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
sass: {
|
|
||||||
dist: {
|
|
||||||
options: {
|
|
||||||
outputStyle: 'compressed'
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
'dist/css/select2.min.css': [
|
|
||||||
'src/scss/core.scss',
|
|
||||||
'src/scss/theme/default/layout.css'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dev: {
|
|
||||||
options: {
|
|
||||||
outputStyle: 'nested'
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
'dist/css/select2.css': [
|
|
||||||
'src/scss/core.scss',
|
|
||||||
'src/scss/theme/default/layout.css'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
requirejs: {
|
|
||||||
'dist': {
|
|
||||||
options: {
|
|
||||||
baseUrl: 'src/js',
|
|
||||||
optimize: 'none',
|
|
||||||
name: 'select2/core',
|
|
||||||
out: 'dist/js/select2.js',
|
|
||||||
include: includes,
|
|
||||||
namespace: 'S2',
|
|
||||||
paths: {
|
|
||||||
'almond': require.resolve('almond').slice(0, -3),
|
|
||||||
'jquery': 'jquery.shim',
|
|
||||||
'jquery-mousewheel': 'jquery.mousewheel.shim'
|
|
||||||
},
|
|
||||||
wrap: {
|
|
||||||
startFile: 'src/js/banner.start.js',
|
|
||||||
endFile: 'src/js/banner.end.js'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'dist.full': {
|
|
||||||
options: {
|
|
||||||
baseUrl: 'src/js',
|
|
||||||
optimize: 'none',
|
|
||||||
name: 'select2/core',
|
|
||||||
out: 'dist/js/select2.full.js',
|
|
||||||
include: fullIncludes,
|
|
||||||
namespace: 'S2',
|
|
||||||
paths: {
|
|
||||||
'almond': require.resolve('almond').slice(0, -3),
|
|
||||||
'jquery': 'jquery.shim',
|
|
||||||
'jquery-mousewheel': require.resolve('jquery-mousewheel').slice(0, -3)
|
|
||||||
},
|
|
||||||
wrap: {
|
|
||||||
startFile: 'src/js/banner.start.js',
|
|
||||||
endFile: 'src/js/banner.end.js'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'i18n': {
|
|
||||||
options: {
|
|
||||||
baseUrl: 'src/js/select2/i18n',
|
|
||||||
dir: 'dist/js/i18n',
|
|
||||||
paths: i18nPaths,
|
|
||||||
modules: i18nModules,
|
|
||||||
namespace: 'S2',
|
|
||||||
wrap: {
|
|
||||||
start: minifiedBanner + grunt.file.read('src/js/banner.start.js'),
|
|
||||||
end: grunt.file.read('src/js/banner.end.js')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
watch: {
|
|
||||||
js: {
|
|
||||||
files: [
|
|
||||||
'src/js/select2/**/*.js',
|
|
||||||
'tests/**/*.js'
|
|
||||||
],
|
|
||||||
tasks: [
|
|
||||||
'compile',
|
|
||||||
'test',
|
|
||||||
'minify'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
css: {
|
|
||||||
files: [
|
|
||||||
'src/scss/**/*.scss'
|
|
||||||
],
|
|
||||||
tasks: [
|
|
||||||
'compile',
|
|
||||||
'minify'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
||||||
|
|
||||||
grunt.loadNpmTasks('grunt-sass');
|
|
||||||
|
|
||||||
grunt.registerTask('default', ['compile', 'test', 'minify']);
|
|
||||||
|
|
||||||
grunt.registerTask('compile', [
|
|
||||||
'requirejs:dist', 'requirejs:dist.full', 'requirejs:i18n',
|
|
||||||
'concat:dist', 'concat:dist.full',
|
|
||||||
'sass:dev'
|
|
||||||
]);
|
|
||||||
grunt.registerTask('minify', ['uglify', 'sass:dist']);
|
|
||||||
grunt.registerTask('test', ['connect:tests', 'qunit', 'jshint']);
|
|
||||||
|
|
||||||
grunt.registerTask('ci', ['compile', 'test']);
|
|
||||||
};
|
|
29
LICENSE.md
29
LICENSE.md
@ -1,21 +1,14 @@
|
|||||||
The MIT License (MIT)
|
Copyright 2018 Igor Vaynberg and Select2 contributors
|
||||||
|
|
||||||
Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||||
|
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
Software.
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||||
all copies or substantial portions of the Software.
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
140
README.md
140
README.md
@ -1,134 +1,46 @@
|
|||||||
Select2
|
# SELECT 2
|
||||||
=======
|
|
||||||
[![Build Status][travis-ci-image]][travis-ci-status]
|
|
||||||
[![cdnjs](https://img.shields.io/cdnjs/v/select2.svg)](https://cdnjs.com/libraries/select2)
|
|
||||||
[![jsdelivr](https://data.jsdelivr.com/v1/package/npm/select2/badge)](https://www.jsdelivr.com/package/npm/select2)
|
|
||||||
|
|
||||||
Select2 is a jQuery-based replacement for select boxes. It supports searching,
|
This branch represents work-in-progress for the next (5.x) version of Select2.
|
||||||
remote data sets, and pagination of results.
|
|
||||||
|
|
||||||
To get started, checkout examples and documentation at
|
Major features of this branch:
|
||||||
https://select2.org/
|
|
||||||
|
|
||||||
Use cases
|
## ADA support
|
||||||
---------
|
|
||||||
* Enhancing native selects with search.
|
|
||||||
* Enhancing native selects with a better multi-select interface.
|
|
||||||
* Loading data from JavaScript: easily load items via AJAX and have them
|
|
||||||
searchable.
|
|
||||||
* Nesting optgroups: native selects only support one level of nesting. Select2
|
|
||||||
does not have this restriction.
|
|
||||||
* Tagging: ability to add new items on the fly.
|
|
||||||
* Working with large, remote datasets: ability to partially load a dataset based
|
|
||||||
on the search term.
|
|
||||||
* Paging of large datasets: easy support for loading more pages when the results
|
|
||||||
are scrolled to the end.
|
|
||||||
* Templating: support for custom rendering of results and selections.
|
|
||||||
|
|
||||||
Browser compatibility
|
ADA support has been lacking in previous versions of Select2 which made it difficult in incorporate into applications
|
||||||
---------------------
|
where ADA is a requirement. In order to support ADA Select2 had to be redesigned from scratch.
|
||||||
* IE 8+
|
|
||||||
* Chrome 8+
|
|
||||||
* Firefox 10+
|
|
||||||
* Safari 3+
|
|
||||||
* Opera 10.6+
|
|
||||||
|
|
||||||
Select2 is automatically tested on the following browsers.
|
## Written in Preact
|
||||||
|
|
||||||
[![Sauce Labs Test Status][saucelabs-matrix]][saucelabs-status]
|
This version of Select2 is written in Preact. The reason behind this decision is that majority of bugs came from
|
||||||
|
state updates being inconsistently applied to the DOM, by using Preact we get DOM updates for free.
|
||||||
|
|
||||||
Usage
|
## Native Bridge / Usage Outside Preact
|
||||||
-----
|
|
||||||
You can source Select2 directly from a CDN like [JSDliver][jsdelivr] or
|
|
||||||
[CDNJS][cdnjs], [download it from this GitHub repo][releases], or use one of
|
|
||||||
the integrations below.
|
|
||||||
|
|
||||||
Integrations
|
The fact that the core component is written in Preact does not preclude the usage of Select2 in other environments. To
|
||||||
------------
|
this end `select25.js` is provided and allows usage of the widget via native JavaScript.
|
||||||
Third party developers have created plugins for platforms which allow Select2 to be integrated more natively and quickly. For many platforms, additional plugins are not required because Select2 acts as a standard `<select>` box.
|
|
||||||
|
|
||||||
Plugins
|
## TODO
|
||||||
|
|
||||||
* [Django]
|
- So far this branch contains prototype implementations of the Multi-Select and Single-Select widgets. This branch will act as a proof of
|
||||||
- [django-autocomplete-light]
|
concept. Once ADA compliance has been validated by the community the rest of the features will follow.
|
||||||
- [django-easy-select2]
|
|
||||||
- [django-select2]
|
|
||||||
* [Drupal] - [drupal-select2]
|
|
||||||
* [Meteor] - [meteor-select2]
|
|
||||||
* [Ruby on Rails][ruby-on-rails] - [select2-rails]
|
|
||||||
* [Wicket] - [wicketstuff-select2]
|
|
||||||
* [Yii 2][yii2] - [yii2-widget-select2]
|
|
||||||
* [Angularjs][angularjs] - [mdr-angular-select2]
|
|
||||||
|
|
||||||
Themes
|
- The visual design / initial theme is still incomplete
|
||||||
|
|
||||||
- [Bootstrap 3][bootstrap3] - [select2-bootstrap-theme]
|
- Mobile design and testing
|
||||||
- [Bootstrap 4][bootstrap4] - [select2-bootstrap4-theme]
|
|
||||||
- [Flat UI][flat-ui] - [select2-flat-theme]
|
|
||||||
- [Metro UI][metro-ui] - [select2-metro]
|
|
||||||
|
|
||||||
Missing an integration? Modify this `README` and make a pull request back here to Select2 on GitHub.
|
## Building
|
||||||
|
|
||||||
Internationalization (i18n)
|
`npm run dist`
|
||||||
---------------------------
|
|
||||||
Select2 supports multiple languages by simply including the right language JS
|
|
||||||
file (`dist/js/i18n/it.js`, `dist/js/i18n/nl.js`, etc.) after
|
|
||||||
`dist/js/select2.js`.
|
|
||||||
|
|
||||||
Missing a language? Just copy `src/js/select2/i18n/en.js`, translate it, and
|
## Developing
|
||||||
make a pull request back to Select2 here on GitHub.
|
|
||||||
|
|
||||||
Documentation
|
`npm run dev` and open `http://localhost:1234`.
|
||||||
-------------
|
Sources for dev playground are in `./dev/`
|
||||||
The documentation for Select2 is available
|
|
||||||
[through GitHub Pages][documentation] and is located within this repository
|
|
||||||
in the [`docs` folder][documentation-folder].
|
|
||||||
|
|
||||||
Community
|
## Reporting Bugs
|
||||||
---------
|
|
||||||
You can find out about the different ways to get in touch with the Select2
|
|
||||||
community at the [Select2 community page][community].
|
|
||||||
|
|
||||||
Copyright and license
|
Please tag GitHub issues and other threads using the `5.x` label
|
||||||
---------------------
|
|
||||||
The license is available within the repository in the [LICENSE][license] file.
|
|
||||||
|
|
||||||
[cdnjs]: http://www.cdnjs.com/libraries/select2
|
## Copyright and License
|
||||||
[community]: https://select2.org/getting-help
|
|
||||||
[documentation]: https://select2.org
|
|
||||||
[documentation-folder]: https://github.com/select2/select2/tree/master/docs
|
|
||||||
[freenode]: https://freenode.net/
|
|
||||||
[jsdelivr]: http://www.jsdelivr.com/#!select2
|
|
||||||
[license]: LICENSE.md
|
|
||||||
[releases]: https://github.com/select2/select2/releases
|
|
||||||
[saucelabs-matrix]: https://saucelabs.com/browser-matrix/select2.svg
|
|
||||||
[saucelabs-status]: https://saucelabs.com/u/select2
|
|
||||||
[travis-ci-image]: https://img.shields.io/travis/select2/select2/master.svg
|
|
||||||
[travis-ci-status]: https://travis-ci.org/select2/select2
|
|
||||||
|
|
||||||
[bootstrap3]: https://getbootstrap.com/
|
The license is available within the repository in the LICENSE file.
|
||||||
[bootstrap4]: https://getbootstrap.com/
|
|
||||||
[django]: https://www.djangoproject.com/
|
|
||||||
[django-autocomplete-light]: https://github.com/yourlabs/django-autocomplete-light
|
|
||||||
[django-easy-select2]: https://github.com/asyncee/django-easy-select2
|
|
||||||
[django-select2]: https://github.com/applegrew/django-select2
|
|
||||||
[drupal]: https://www.drupal.org/
|
|
||||||
[drupal-select2]: https://www.drupal.org/project/select2
|
|
||||||
[flat-ui]: http://designmodo.github.io/Flat-UI/
|
|
||||||
[meteor]: https://www.meteor.com/
|
|
||||||
[meteor-select2]: https://github.com/nate-strauser/meteor-select2
|
|
||||||
[metro-ui]: http://metroui.org.ua/
|
|
||||||
[select2-metro]: http://metroui.org.ua/select2.html
|
|
||||||
[ruby-on-rails]: http://rubyonrails.org/
|
|
||||||
[select2-bootstrap-theme]: https://github.com/select2/select2-bootstrap-theme
|
|
||||||
[select2-bootstrap4-theme]: https://github.com/ttskch/select2-bootstrap4-theme
|
|
||||||
[select2-flat-theme]: https://github.com/techhysahil/select2-Flat_Theme
|
|
||||||
[select2-rails]: https://github.com/argerim/select2-rails
|
|
||||||
[vue.js]: http://vuejs.org/
|
|
||||||
[select2-vue]: http://vuejs.org/examples/select2.html
|
|
||||||
[wicket]: https://wicket.apache.org/
|
|
||||||
[wicketstuff-select2]: https://github.com/wicketstuff/core/tree/master/select2-parent
|
|
||||||
[yii2]: http://www.yiiframework.com/
|
|
||||||
[yii2-widget-select2]: https://github.com/kartik-v/yii2-widget-select2
|
|
||||||
[angularjs]: https://angularjs.org/
|
|
||||||
[mdr-angular-select2]: https://github.com/modulr/mdr-angular-select2
|
|
||||||
|
13
bower.json
13
bower.json
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "select2",
|
|
||||||
"description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
|
|
||||||
"main": [
|
|
||||||
"dist/js/select2.js",
|
|
||||||
"src/scss/core.scss"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git@github.com:select2/select2.git"
|
|
||||||
}
|
|
||||||
}
|
|
50
bridge/src/ajax.ts
Normal file
50
bridge/src/ajax.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import { QueryFunction, QueryResult } from '../../control/src/search-controller';
|
||||||
|
import { extend } from '../../control/src/util';
|
||||||
|
export interface Ajax {
|
||||||
|
url: string;
|
||||||
|
params: (term: string, page: number) => object;
|
||||||
|
process: (data: string) => QueryResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createQueryFromAjax(ajax: Ajax): QueryFunction {
|
||||||
|
ajax = extend({}, ajax, {
|
||||||
|
params(term: string, page: number) {
|
||||||
|
return { term, page };
|
||||||
|
},
|
||||||
|
process(data: string) {
|
||||||
|
const json = JSON.parse(data);
|
||||||
|
return {
|
||||||
|
more: json.more,
|
||||||
|
values: json.values
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return (term: string, page: number, token: string) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let url = ajax.url;
|
||||||
|
const params = ajax.params(term, page);
|
||||||
|
if (params) {
|
||||||
|
let separator = url.indexOf('?') >= 0 ? '&' : '?';
|
||||||
|
Object.entries(params).forEach(([key, value]) => {
|
||||||
|
url += separator;
|
||||||
|
separator = '&';
|
||||||
|
url += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const request = new XMLHttpRequest();
|
||||||
|
request.open('GET', url, true);
|
||||||
|
request.onload = () => {
|
||||||
|
if (request.status >= 200 && request.status < 400) {
|
||||||
|
const data = ajax.process(request.responseText);
|
||||||
|
resolve({ values: data.values, more: data.more, token });
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
request.onerror = reject;
|
||||||
|
request.send();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
277
bridge/src/select25.tsx
Normal file
277
bridge/src/select25.tsx
Normal file
@ -0,0 +1,277 @@
|
|||||||
|
/** jsx:pragma h */
|
||||||
|
import { Component, h, render } from 'preact';
|
||||||
|
import { ItemRenderer, QueryFunction } from '../../control/src/abstract-select';
|
||||||
|
import { Dictionary } from '../../control/src/dictionary';
|
||||||
|
import { MultiSelect } from '../../control/src/multi-select';
|
||||||
|
import '../../control/src/select25.scss';
|
||||||
|
import { SingleSelect } from '../../control/src/single-select';
|
||||||
|
import { extend } from '../../control/src/util';
|
||||||
|
import { Ajax, createQueryFromAjax } from './ajax';
|
||||||
|
import { Store } from './store';
|
||||||
|
|
||||||
|
const forceImportOfH = h;
|
||||||
|
|
||||||
|
enum StoreKeys {
|
||||||
|
targetElement = 'te'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Options {
|
||||||
|
multiple: boolean;
|
||||||
|
containerStyle?: string;
|
||||||
|
containerClass?: string;
|
||||||
|
hiddenValue?: (values: any, options: Options) => string;
|
||||||
|
tabIndex?: number;
|
||||||
|
itemId: ((item: any) => string) | string;
|
||||||
|
itemLabel: ((item: any) => string) | string;
|
||||||
|
valueContent?: ItemRenderer;
|
||||||
|
resultContent?: ItemRenderer;
|
||||||
|
query?: QueryFunction;
|
||||||
|
ajax?: Ajax;
|
||||||
|
quiet?: number;
|
||||||
|
minimumCharacters?: number;
|
||||||
|
openOnFocus?: boolean;
|
||||||
|
dictionary?: string | Dictionary;
|
||||||
|
|
||||||
|
value: any;
|
||||||
|
values: any[];
|
||||||
|
allowClear?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
|
|
||||||
|
/** Single Select Label */
|
||||||
|
label?: string;
|
||||||
|
|
||||||
|
/** Multi Select Selected Values Listbox Label */
|
||||||
|
valuesLabel?: string;
|
||||||
|
/** Multi Select Add Value Combobox Label */
|
||||||
|
comboboxLabel?: string;
|
||||||
|
|
||||||
|
allowDuplicates: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_OPTIONS = {
|
||||||
|
allowClear: false,
|
||||||
|
dictionary: 'en_us',
|
||||||
|
hiddenValue: (values: any, options: Options) => {
|
||||||
|
const id = (item: any) => {
|
||||||
|
if (typeof options.itemId === 'function') {
|
||||||
|
return options.itemId(item);
|
||||||
|
} else {
|
||||||
|
return '' + item[options.itemId];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (values) {
|
||||||
|
if (Array.isArray(values)) {
|
||||||
|
if (values.length > 0) {
|
||||||
|
return values.map(id).join(',');
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return id(values);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
minimumCharacters: 0,
|
||||||
|
multiple: false,
|
||||||
|
openOnFocus: false
|
||||||
|
};
|
||||||
|
|
||||||
|
function triggerOnChange(element: HTMLElement, data: any) {
|
||||||
|
const event = document.createEvent('HTMLEvents');
|
||||||
|
event.initEvent('change', false, true);
|
||||||
|
event[data] = data;
|
||||||
|
element.dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
class MultiSelectWrapper extends Component<
|
||||||
|
{
|
||||||
|
element: HTMLInputElement;
|
||||||
|
options: Options;
|
||||||
|
},
|
||||||
|
{ values: any }
|
||||||
|
> {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = { values: props.options.values };
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidUpdate() {
|
||||||
|
this.setHiddenValue(this.state.values);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidMount() {
|
||||||
|
this.setHiddenValue(this.state.values);
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(props, state, context) {
|
||||||
|
const opts = this.props.options;
|
||||||
|
return (
|
||||||
|
<MultiSelect
|
||||||
|
containerClass={opts.containerClass}
|
||||||
|
containerStyle={opts.containerStyle}
|
||||||
|
valuesLabel={opts.valuesLabel}
|
||||||
|
comboboxLabel={opts.comboboxLabel}
|
||||||
|
itemId={opts.itemId}
|
||||||
|
itemLabel={opts.itemLabel}
|
||||||
|
valueContent={opts.valueContent}
|
||||||
|
resultContent={opts.resultContent}
|
||||||
|
query={opts.query}
|
||||||
|
quiet={opts.quiet}
|
||||||
|
minimumCharacters={opts.minimumCharacters}
|
||||||
|
openOnFocus={opts.openOnFocus}
|
||||||
|
dictionary={opts.dictionary}
|
||||||
|
tabIndex={opts.tabIndex}
|
||||||
|
allowDuplicates={opts.allowDuplicates}
|
||||||
|
values={this.state.values}
|
||||||
|
onChange={this.onChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public onChange = (values: any[]) => {
|
||||||
|
this.setState({ values });
|
||||||
|
this.setHiddenValue(values);
|
||||||
|
triggerOnChange(this.props.element, values);
|
||||||
|
};
|
||||||
|
|
||||||
|
private setHiddenValue(values: any) {
|
||||||
|
const { element, options } = this.props;
|
||||||
|
element.value = options.hiddenValue(values, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SingleSelectWrapper extends Component<
|
||||||
|
{
|
||||||
|
options: Options;
|
||||||
|
element: HTMLInputElement;
|
||||||
|
},
|
||||||
|
{ value: any }
|
||||||
|
> {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = { value: props.options.value };
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidMount() {
|
||||||
|
this.setHiddenValue(this.state.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidUpdate() {
|
||||||
|
this.setHiddenValue(this.state.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(props, state, context) {
|
||||||
|
const opts = this.props.options;
|
||||||
|
return (
|
||||||
|
<SingleSelect
|
||||||
|
label={opts.label}
|
||||||
|
comboboxLabel={opts.comboboxLabel}
|
||||||
|
containerClass={opts.containerClass}
|
||||||
|
containerStyle={opts.containerStyle}
|
||||||
|
allowClear={opts.allowClear}
|
||||||
|
placeholder={opts.placeholder}
|
||||||
|
itemId={opts.itemId}
|
||||||
|
itemLabel={opts.itemLabel}
|
||||||
|
valueContent={opts.valueContent}
|
||||||
|
resultContent={opts.resultContent}
|
||||||
|
query={opts.query}
|
||||||
|
quiet={opts.quiet}
|
||||||
|
minimumCharacters={opts.minimumCharacters}
|
||||||
|
openOnFocus={opts.openOnFocus} // TODO
|
||||||
|
dictionary={opts.dictionary}
|
||||||
|
tabIndex={opts.tabIndex}
|
||||||
|
allowDuplicates={opts.allowDuplicates}
|
||||||
|
value={this.state.value}
|
||||||
|
onChange={this.onChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public onChange = (value: any) => {
|
||||||
|
this.setState({ value });
|
||||||
|
this.setHiddenValue(value);
|
||||||
|
triggerOnChange(this.props.element, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
private setHiddenValue(value: any) {
|
||||||
|
const { element, options } = this.props;
|
||||||
|
element.value = options.hiddenValue(value, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function create<T>(element: HTMLInputElement, options: Options) {
|
||||||
|
// TODO make sure we are attached to hidden input
|
||||||
|
|
||||||
|
const store = Store.getStore(element);
|
||||||
|
|
||||||
|
options = extend({}, DEFAULT_OPTIONS, options);
|
||||||
|
if (!options.query && options.ajax) {
|
||||||
|
options.query = createQueryFromAjax(options.ajax);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options.tabIndex && element.tabIndex) {
|
||||||
|
options.tabIndex = element.tabIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.getAttribute('s25-style')) {
|
||||||
|
let style = options.containerStyle || '';
|
||||||
|
if (style.length > 0) {
|
||||||
|
style += ';';
|
||||||
|
}
|
||||||
|
style += element.getAttribute('s25-style');
|
||||||
|
options.containerStyle = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.getAttribute('s25-class')) {
|
||||||
|
let clazz = options.containerClass || '';
|
||||||
|
if (clazz.length > 0) {
|
||||||
|
clazz += ' ';
|
||||||
|
}
|
||||||
|
clazz += element.getAttribute('s25-class');
|
||||||
|
options.containerClass = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create placeholder element into which the control will be rendered
|
||||||
|
const parentElement = element.parentElement;
|
||||||
|
const targetElement = document.createElement('div');
|
||||||
|
parentElement.insertBefore(targetElement, element);
|
||||||
|
|
||||||
|
store.set(StoreKeys.targetElement, targetElement);
|
||||||
|
|
||||||
|
// render the replacement
|
||||||
|
if (options.multiple) {
|
||||||
|
render(<MultiSelectWrapper element={element} options={options} />, parentElement, targetElement);
|
||||||
|
} else {
|
||||||
|
render(<SingleSelectWrapper element={element} options={options} />, parentElement, targetElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroy(element: HTMLElement) {
|
||||||
|
if (!Store.hasStore(element)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const store = Store.getStore(element);
|
||||||
|
const targetElement = store.get(StoreKeys.targetElement);
|
||||||
|
const parentElement = element.parentElement;
|
||||||
|
render(null, parentElement, targetElement);
|
||||||
|
parentElement.removeChild(targetElement);
|
||||||
|
Store.removeStore(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
const select25 = {
|
||||||
|
create,
|
||||||
|
destroy
|
||||||
|
};
|
||||||
|
|
||||||
|
export { select25 };
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
select25: typeof select25;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.select25 = select25;
|
29
bridge/src/store.ts
Normal file
29
bridge/src/store.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
export class Store {
|
||||||
|
private static stores = new WeakMap();
|
||||||
|
|
||||||
|
private store = new Map();
|
||||||
|
|
||||||
|
public get(key: string): any {
|
||||||
|
return this.store.get(key);
|
||||||
|
}
|
||||||
|
public set(key: string, value: any) {
|
||||||
|
this.store.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getStore(key: any): Store {
|
||||||
|
let store = Store.stores.get(key);
|
||||||
|
if (!store) {
|
||||||
|
store = new Store();
|
||||||
|
Store.stores.set(key, store);
|
||||||
|
}
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static hasStore(key: any) {
|
||||||
|
return Store.stores.has(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static removeStore(key: any) {
|
||||||
|
Store.stores.delete(key);
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "select2",
|
|
||||||
"repo": "select/select2",
|
|
||||||
"description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
|
|
||||||
"version": "4.0.7",
|
|
||||||
"demo": "https://select2.org/",
|
|
||||||
"keywords": [
|
|
||||||
"jquery"
|
|
||||||
],
|
|
||||||
"main": "dist/js/select2.js",
|
|
||||||
"styles": [
|
|
||||||
"dist/css/select2.css"
|
|
||||||
],
|
|
||||||
"scripts": [
|
|
||||||
"dist/js/select2.js",
|
|
||||||
"dist/js/i18n/*.js"
|
|
||||||
],
|
|
||||||
"license": "MIT"
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "select2/select2",
|
|
||||||
"description": "Select2 is a jQuery based replacement for select boxes.",
|
|
||||||
"type": "component",
|
|
||||||
"homepage": "https://select2.org/",
|
|
||||||
"license": "MIT",
|
|
||||||
"extra": {
|
|
||||||
"component": {
|
|
||||||
"scripts": [
|
|
||||||
"dist/js/select2.js"
|
|
||||||
],
|
|
||||||
"styles": [
|
|
||||||
"dist/css/select2.css"
|
|
||||||
],
|
|
||||||
"files": [
|
|
||||||
"dist/js/select2.js",
|
|
||||||
"dist/js/i18n/*.js",
|
|
||||||
"dist/css/select2.css"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
361
control/src/abstract-select.tsx
Normal file
361
control/src/abstract-select.tsx
Normal file
@ -0,0 +1,361 @@
|
|||||||
|
import { Component, ComponentChild, h, h as createElement } from 'preact';
|
||||||
|
import * as announce from './announce';
|
||||||
|
import { Dictionary, getDictionary } from './dictionary';
|
||||||
|
import { DeepPartial, Key, merge, uuid } from './util';
|
||||||
|
const forceImportOfH = h;
|
||||||
|
|
||||||
|
type ToString = (item: any) => string;
|
||||||
|
|
||||||
|
export type ItemRenderer = (string) | ((item: any, h: typeof createElement) => ComponentChild);
|
||||||
|
|
||||||
|
export type QueryFunction = (search: string, page: number, token: string) => Promise<QueryResult>;
|
||||||
|
|
||||||
|
export interface QueryResult {
|
||||||
|
values: any[];
|
||||||
|
more: boolean;
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResultListState {
|
||||||
|
results: any[];
|
||||||
|
token: string;
|
||||||
|
active: number;
|
||||||
|
page: number;
|
||||||
|
|
||||||
|
showMinimumCharactersError: boolean;
|
||||||
|
showNoSearchResultsFound: boolean;
|
||||||
|
showLoadMoreResults: boolean;
|
||||||
|
}
|
||||||
|
export interface State {
|
||||||
|
search: string;
|
||||||
|
results: ResultListState;
|
||||||
|
loading: boolean;
|
||||||
|
open: boolean;
|
||||||
|
focused: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
containerStyle?: string;
|
||||||
|
containerClass?: string;
|
||||||
|
tabIndex?: number;
|
||||||
|
itemId: ToString | string;
|
||||||
|
itemLabel: ToString | string;
|
||||||
|
valueContent?: ItemRenderer;
|
||||||
|
resultContent?: ItemRenderer;
|
||||||
|
|
||||||
|
query: QueryFunction;
|
||||||
|
quiet?: number;
|
||||||
|
allowDuplicates?: boolean;
|
||||||
|
minimumCharacters?: number;
|
||||||
|
openOnFocus?: boolean;
|
||||||
|
dictionary?: string | Dictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
function MarkupRenderer({ markup }) {
|
||||||
|
return <div dangerouslySetInnerHTML={{ __html: markup }}> </div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_PROPS: Partial<Props> = {
|
||||||
|
allowDuplicates: false,
|
||||||
|
minimumCharacters: 0,
|
||||||
|
quiet: 50,
|
||||||
|
tabIndex: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
export abstract class AbstractSelect<P extends Props, S extends State> extends Component<P, S> {
|
||||||
|
private searchTimeout: number | undefined;
|
||||||
|
protected namespace: string;
|
||||||
|
|
||||||
|
constructor(props: P) {
|
||||||
|
super(props);
|
||||||
|
this.searchTimeout = undefined;
|
||||||
|
this.namespace = uuid();
|
||||||
|
// @ts-ignore
|
||||||
|
this.state = {
|
||||||
|
focused: false,
|
||||||
|
loading: false,
|
||||||
|
open: false,
|
||||||
|
results: {
|
||||||
|
active: -1,
|
||||||
|
page: 0,
|
||||||
|
results: undefined, // TODO rename to values
|
||||||
|
token: null,
|
||||||
|
|
||||||
|
showLoadMoreResults: false,
|
||||||
|
showMinimumCharactersError: false,
|
||||||
|
showNoSearchResultsFound: false
|
||||||
|
},
|
||||||
|
search: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public getItemId = (item: any): string => {
|
||||||
|
const id = this.props.itemId;
|
||||||
|
if (typeof id === 'function') {
|
||||||
|
return (id as ToString)(item);
|
||||||
|
} else {
|
||||||
|
return '' + item[id];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public getItemLabel = (item: any): string => {
|
||||||
|
const label = this.props.itemLabel;
|
||||||
|
if (typeof label === 'function') {
|
||||||
|
return (label as ToString)(item);
|
||||||
|
} else {
|
||||||
|
return '' + item[label];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public renderValue = (item: any): ComponentChild => {
|
||||||
|
return this.renderItem(item, 'valueContent');
|
||||||
|
};
|
||||||
|
|
||||||
|
public renderResult = (item: any): ComponentChild => {
|
||||||
|
return this.renderItem(item, 'resultContent');
|
||||||
|
};
|
||||||
|
|
||||||
|
private renderItem = (item: any, rendererName: keyof Props): ComponentChild => {
|
||||||
|
const renderer = this.props[rendererName] as ItemRenderer;
|
||||||
|
if (renderer) {
|
||||||
|
if (typeof renderer === 'function') {
|
||||||
|
const render = renderer(item, createElement);
|
||||||
|
if (typeof render === 'string') {
|
||||||
|
return <MarkupRenderer markup={render} />;
|
||||||
|
} else {
|
||||||
|
return render;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return <MarkupRenderer markup={item[renderer]} />;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return <MarkupRenderer markup={this.getItemLabel(item)} />;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
get dictionary(): Dictionary {
|
||||||
|
const dict = this.props.dictionary;
|
||||||
|
if (dict) {
|
||||||
|
if (typeof dict === 'string') {
|
||||||
|
return getDictionary(dict);
|
||||||
|
} else {
|
||||||
|
return dict as Dictionary;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return getDictionary();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected updateState(update: DeepPartial<S> | Array<DeepPartial<S>>, callback?: () => void) {
|
||||||
|
const state = merge(this.state, Array.isArray(update) ? update : [update]);
|
||||||
|
this.setState(state, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public search = (query, selectedValues, start?: DeepPartial<S>, callback?: () => void) => {
|
||||||
|
const dictionary = this.dictionary;
|
||||||
|
const { minimumCharacters, allowDuplicates, quiet, query: queryFunc } = this.props;
|
||||||
|
|
||||||
|
const current = this.state.results;
|
||||||
|
|
||||||
|
const minimumCharactersReached = query.length >= minimumCharacters;
|
||||||
|
const token = minimumCharactersReached ? uuid() : undefined;
|
||||||
|
|
||||||
|
const control = this;
|
||||||
|
|
||||||
|
this.updateState(
|
||||||
|
// @ts-ignore
|
||||||
|
[
|
||||||
|
start,
|
||||||
|
{
|
||||||
|
loading: minimumCharactersReached,
|
||||||
|
results: {
|
||||||
|
active: -1,
|
||||||
|
page: 0,
|
||||||
|
results: undefined,
|
||||||
|
showLoadMoreResults: false,
|
||||||
|
showMinimumCharactersError: !minimumCharactersReached,
|
||||||
|
showNoSearchResultsFound: false,
|
||||||
|
token
|
||||||
|
},
|
||||||
|
search: query
|
||||||
|
}
|
||||||
|
],
|
||||||
|
() => {
|
||||||
|
if (callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!minimumCharactersReached) {
|
||||||
|
// todo - throttle this announcement?
|
||||||
|
announce.politely(dictionary.minimumCharactersMessage(query.length, minimumCharacters!));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo - throttle this announcement?
|
||||||
|
// announce.politely(dictionary.searchResultsLoading());
|
||||||
|
|
||||||
|
const execute = async () => {
|
||||||
|
try {
|
||||||
|
const result = await queryFunc(query, 0, token!);
|
||||||
|
if (result.token !== control.state.results.token) {
|
||||||
|
// this is a stale result, ignore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let values = result.values || [];
|
||||||
|
if (!allowDuplicates && values.length > 0 && selectedValues.length > 0) {
|
||||||
|
const ids = new Set<string>();
|
||||||
|
selectedValues.forEach(v => ids.add(control.getItemId(v)));
|
||||||
|
values = values.filter(v => !ids.has(control.getItemId(v)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (values.length < 1) {
|
||||||
|
announce.politely(dictionary.noSearchResults());
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
control.updateState({
|
||||||
|
loading: false,
|
||||||
|
results: {
|
||||||
|
active: values.length > 0 ? 0 : -1,
|
||||||
|
page: 0,
|
||||||
|
results: values,
|
||||||
|
showLoadMoreResults: result.more,
|
||||||
|
showNoSearchResultsFound: values.length < 1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
// @ts-ignore
|
||||||
|
control.updateState({ loading: false });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (quiet && quiet > 0) {
|
||||||
|
if (control.searchTimeout) {
|
||||||
|
window.clearTimeout(control.searchTimeout);
|
||||||
|
}
|
||||||
|
control.searchTimeout = window.setTimeout(execute, quiet);
|
||||||
|
} else {
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
public loadMore() {
|
||||||
|
const {
|
||||||
|
loading,
|
||||||
|
search: query,
|
||||||
|
results: { page }
|
||||||
|
} = this.state;
|
||||||
|
const dict = this.dictionary;
|
||||||
|
const { query: queryFunc } = this.props;
|
||||||
|
const control = this;
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const token = uuid();
|
||||||
|
const nextPage = page + 1;
|
||||||
|
|
||||||
|
this.updateState(
|
||||||
|
// @ts-ignore
|
||||||
|
{
|
||||||
|
loading: true,
|
||||||
|
results: {
|
||||||
|
token
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async () => {
|
||||||
|
// TODO throttle?
|
||||||
|
// announce.politely(dict.searchResultsLoading());
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await queryFunc(query, nextPage, token);
|
||||||
|
|
||||||
|
const current = control.state.results;
|
||||||
|
|
||||||
|
if (result.token !== current.token) {
|
||||||
|
// this is a stale result, ignore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.values && result.values.length > 0) {
|
||||||
|
// @ts-ignore
|
||||||
|
control.updateState({
|
||||||
|
loading: false,
|
||||||
|
results: {
|
||||||
|
page: nextPage,
|
||||||
|
results: current.results.concat(result.values),
|
||||||
|
showLoadMoreResults: result.more
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
announce.politely(dict.noSearchResults());
|
||||||
|
// @ts-ignore
|
||||||
|
control.updateState({
|
||||||
|
loading: false,
|
||||||
|
results: {
|
||||||
|
showLoadMoreResults: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// @ts-ignore
|
||||||
|
control.updateState({ loading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected handleResultNavigationKeyDown(event: KeyboardEvent): boolean {
|
||||||
|
switch (event.key) {
|
||||||
|
case Key.ArrowUp:
|
||||||
|
case Key.Up:
|
||||||
|
this.selectPreviousSearchResult();
|
||||||
|
event.preventDefault();
|
||||||
|
return true;
|
||||||
|
case Key.ArrowDown:
|
||||||
|
case Key.Down:
|
||||||
|
this.selectNextSearchResult();
|
||||||
|
event.preventDefault();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected selectNextSearchResult() {
|
||||||
|
const { active, results } = this.state.results;
|
||||||
|
if (results && active < results.length - 1) {
|
||||||
|
// @ts-ignore
|
||||||
|
this.updateState({ results: { active: active + 1 } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected selectPreviousSearchResult() {
|
||||||
|
const { active } = this.state.results;
|
||||||
|
if (active > 0) {
|
||||||
|
// @ts-ignore
|
||||||
|
this.updateState({ results: { active: active - 1 } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getSelectedSearchResult() {
|
||||||
|
const { results, active } = this.state.results;
|
||||||
|
return results[active];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected selectSearchResult(index: number) {
|
||||||
|
const { active } = this.state.results;
|
||||||
|
if (active !== index) {
|
||||||
|
// @ts-ignore
|
||||||
|
this.updateState({ results: { active: index } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected hasSearchResults() {
|
||||||
|
const results = this.state.results.results;
|
||||||
|
return results && results.length > 0;
|
||||||
|
}
|
||||||
|
}
|
49
control/src/announce.ts
Normal file
49
control/src/announce.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
export function initialize() {
|
||||||
|
if (document.getElementById('s25-live')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const live = document.createElement('div');
|
||||||
|
live.setAttribute('id', 's25-live');
|
||||||
|
live.setAttribute('class', 's25-offscreen s25-live');
|
||||||
|
document.body.appendChild(live);
|
||||||
|
|
||||||
|
const assertive = document.createElement('div');
|
||||||
|
assertive.setAttribute('id', 's25-live-assertive');
|
||||||
|
assertive.setAttribute('role', 'log');
|
||||||
|
assertive.setAttribute('aria-live', 'assertive');
|
||||||
|
assertive.setAttribute('aria-relevant', 'additions');
|
||||||
|
live.appendChild(assertive);
|
||||||
|
|
||||||
|
const polite = document.createElement('div');
|
||||||
|
polite.setAttribute('id', 's25-live-polite');
|
||||||
|
polite.setAttribute('role', 'log');
|
||||||
|
polite.setAttribute('aria-live', 'polite');
|
||||||
|
polite.setAttribute('aria-relevant', 'additions');
|
||||||
|
live.appendChild(polite);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function assertively(message: string) {
|
||||||
|
add(message, document.getElementById('s25-live-assertive')!);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function politely(message: string) {
|
||||||
|
add(message, document.getElementById('s25-live-polite')!);
|
||||||
|
}
|
||||||
|
|
||||||
|
function add(message: string, container: HTMLElement) {
|
||||||
|
const node = document.createElement('div');
|
||||||
|
node.appendChild(document.createTextNode(message));
|
||||||
|
container.appendChild(node);
|
||||||
|
|
||||||
|
// clean up old nodes
|
||||||
|
|
||||||
|
let collection = document.getElementById('s25-live-assertive')!;
|
||||||
|
while (collection.firstChild && collection.firstChild !== node) {
|
||||||
|
collection.removeChild(collection.firstChild);
|
||||||
|
}
|
||||||
|
collection = document.getElementById('s25-live-polite')!;
|
||||||
|
while (collection.firstChild && collection.firstChild !== node) {
|
||||||
|
collection.removeChild(collection.firstChild);
|
||||||
|
}
|
||||||
|
}
|
58
control/src/dictionary.ts
Normal file
58
control/src/dictionary.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
export interface Dictionary {
|
||||||
|
valueAdded(itemLabel: string): string;
|
||||||
|
noSearchResults(): string;
|
||||||
|
searchResultsLoading(): string;
|
||||||
|
removeButtonTitle(): string;
|
||||||
|
clearButtonTitle(): string;
|
||||||
|
minimumCharactersMessage(len: number, min: number): string;
|
||||||
|
multiSelectInstructions(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EN_US: Dictionary = {
|
||||||
|
noSearchResults() {
|
||||||
|
return 'No results available';
|
||||||
|
},
|
||||||
|
|
||||||
|
searchResultsLoading() {
|
||||||
|
return 'Loading...';
|
||||||
|
},
|
||||||
|
|
||||||
|
removeButtonTitle() {
|
||||||
|
return 'Remove selected values';
|
||||||
|
},
|
||||||
|
|
||||||
|
clearButtonTitle() {
|
||||||
|
return 'Clear selection';
|
||||||
|
},
|
||||||
|
|
||||||
|
valueAdded(itemLabel: string) {
|
||||||
|
return itemLabel + ' added';
|
||||||
|
},
|
||||||
|
|
||||||
|
minimumCharactersMessage(len: number, min: number) {
|
||||||
|
const delta = min - len;
|
||||||
|
return 'Please enter ' + delta + ' more character' + (delta > 1 ? 's' : '');
|
||||||
|
},
|
||||||
|
|
||||||
|
multiSelectInstructions(): string {
|
||||||
|
return "Items can be removed from this list box by selecting them and activating 'Remove selected values' button. Items can be added by selecting them in the adjacent combobox.";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const dictionaries = new Map<string, Dictionary>();
|
||||||
|
dictionaries.set('en_us', EN_US);
|
||||||
|
|
||||||
|
export function getDictionary(dict?: string | undefined): Dictionary {
|
||||||
|
const fallback: Dictionary = dictionaries.get('en_us') as Dictionary;
|
||||||
|
|
||||||
|
if (!dict) {
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof dict === 'string') {
|
||||||
|
const instance = dictionaries.get(dict);
|
||||||
|
return instance ? instance : fallback;
|
||||||
|
} else {
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
}
|
108
control/src/dropdown.tsx
Normal file
108
control/src/dropdown.tsx
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import { Component, ComponentChild, Fragment, h, RefObject, render } from 'preact';
|
||||||
|
import { getScrollParents, MouseEventListener, throttle } from './util';
|
||||||
|
|
||||||
|
class ContextProvider extends Component<{ context: any }> {
|
||||||
|
public getChildContext() {
|
||||||
|
return this.props.context;
|
||||||
|
}
|
||||||
|
public render() {
|
||||||
|
return this.props.children;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Portal({ vnode, container }): null {
|
||||||
|
// @ts-ignore
|
||||||
|
const wrap = <ContextProvider context={this.context}>{vnode}</ContextProvider>;
|
||||||
|
render(wrap, container);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPortal(vnode, container): ComponentChild {
|
||||||
|
return h(Portal, { vnode, container });
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
controlRef: RefObject<HTMLElement>;
|
||||||
|
dropdownRef: RefObject<HTMLElement>;
|
||||||
|
class?: string;
|
||||||
|
onClick?: MouseEventListener;
|
||||||
|
onMouseDown?: MouseEventListener;
|
||||||
|
onFocusOut?: EventListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Dropdown extends Component<Props> {
|
||||||
|
private container?: HTMLElement;
|
||||||
|
private scrollParents?: EventTarget[];
|
||||||
|
private throttledPosition;
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.throttledPosition = throttle(50, this.position.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentWillMount() {
|
||||||
|
this.container = document.createElement('div');
|
||||||
|
if (this.props.class) {
|
||||||
|
this.container.className = this.props.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
this container needs to be able to receive focus so we can tell
|
||||||
|
it is not leaving the control - we consider dropdown part of the control
|
||||||
|
*/
|
||||||
|
this.container.tabIndex = -1;
|
||||||
|
if (this.props.onClick) {
|
||||||
|
this.container.addEventListener('click', this.props.onClick);
|
||||||
|
}
|
||||||
|
if (this.props.onMouseDown) {
|
||||||
|
this.container.addEventListener('mousedown', this.props.onMouseDown);
|
||||||
|
}
|
||||||
|
if (this.props.onFocusOut) {
|
||||||
|
this.container.addEventListener('focusout', this.props.onFocusOut);
|
||||||
|
}
|
||||||
|
document.body.appendChild(this.container);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidMount() {
|
||||||
|
this.props.dropdownRef.current = this.container;
|
||||||
|
this.scrollParents = getScrollParents(this.props.controlRef.current!);
|
||||||
|
this.scrollParents.forEach(parent => {
|
||||||
|
['resize', 'scroll', 'touchmove'].forEach(event => {
|
||||||
|
parent.addEventListener(event, this.throttledPosition);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.position();
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentWillUnmount() {
|
||||||
|
if (this.scrollParents) {
|
||||||
|
this.scrollParents.forEach(parent => {
|
||||||
|
['resize', 'scroll', 'touchmove'].forEach(event => {
|
||||||
|
parent.removeEventListener(event, this.throttledPosition);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
delete this.scrollParents;
|
||||||
|
this.scrollParents = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.dropdownRef.current = undefined;
|
||||||
|
this.container!.parentElement!.removeChild(this.container!);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidUpdate() {
|
||||||
|
this.position();
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(props) {
|
||||||
|
return createPortal(<Fragment>{this.props.children}</Fragment>, this.container!);
|
||||||
|
}
|
||||||
|
|
||||||
|
private position() {
|
||||||
|
const control = this.props.controlRef.current!;
|
||||||
|
const rect = control.getBoundingClientRect();
|
||||||
|
const style = `top: ${rect.top + rect.height + window.pageYOffset}px;
|
||||||
|
left: ${rect.left + window.pageXOffset}px;
|
||||||
|
width: ${rect.width}px;`;
|
||||||
|
this.container!.setAttribute('style', style);
|
||||||
|
}
|
||||||
|
}
|
28
control/src/icons.tsx
Normal file
28
control/src/icons.tsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { FunctionComponent, h } from 'preact';
|
||||||
|
|
||||||
|
const forceImportOfH = h;
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Toggle: FunctionComponent<Props> = ({ height, width }) => {
|
||||||
|
const viewBox = '0 0 ' + width + ' ' + height;
|
||||||
|
return (
|
||||||
|
<svg height={height} width={width} viewBox={viewBox} tabIndex={-1} focusable='false'>
|
||||||
|
<path d='M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z' />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
Toggle.displayName = 'Toggle';
|
||||||
|
|
||||||
|
export const Remove: FunctionComponent<Props> = ({ width, height }) => {
|
||||||
|
const viewBox = '0 0 ' + width + ' ' + height;
|
||||||
|
return (
|
||||||
|
<svg height={height} width={width} viewBox={viewBox} tabIndex={-1} focusable='false'>
|
||||||
|
<path d='M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z' />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
Remove.displayName = 'Remove';
|
475
control/src/multi-select.tsx
Normal file
475
control/src/multi-select.tsx
Normal file
@ -0,0 +1,475 @@
|
|||||||
|
import { createRef, Fragment, h, RefObject } from 'preact';
|
||||||
|
import {
|
||||||
|
AbstractSelect,
|
||||||
|
DEFAULT_PROPS as ABSTRACT_DEFAULT_PROPS,
|
||||||
|
Props as SearchControllerProps,
|
||||||
|
State as AbstractSelectState
|
||||||
|
} from './abstract-select';
|
||||||
|
import * as announce from './announce';
|
||||||
|
import { Dropdown } from './dropdown';
|
||||||
|
import { Remove, Toggle } from './icons';
|
||||||
|
import { ResultList } from './result-list';
|
||||||
|
import { style } from './style';
|
||||||
|
import { cn, extend, Key, scope } from './util';
|
||||||
|
|
||||||
|
const forceImportOfH = h;
|
||||||
|
|
||||||
|
export interface Props extends SearchControllerProps {
|
||||||
|
valuesLabel: string;
|
||||||
|
comboboxLabel: string;
|
||||||
|
values: any[];
|
||||||
|
onChange: (values: any[]) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ValueListState {
|
||||||
|
active: number;
|
||||||
|
selected: boolean[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State extends AbstractSelectState {
|
||||||
|
values: ValueListState;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_PROPS = extend({}, ABSTRACT_DEFAULT_PROPS, {});
|
||||||
|
|
||||||
|
export class MultiSelect extends AbstractSelect<Props, State> {
|
||||||
|
private containerRef: RefObject<HTMLDivElement>;
|
||||||
|
private dropdownRef: RefObject<HTMLElement>;
|
||||||
|
private bodyRef: RefObject<HTMLDivElement>;
|
||||||
|
private valuesRef: RefObject<HTMLDivElement>;
|
||||||
|
private searchRef: RefObject<HTMLInputElement>;
|
||||||
|
|
||||||
|
public static defaultProps = DEFAULT_PROPS;
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
const { values } = props;
|
||||||
|
|
||||||
|
this.valuesRef = createRef();
|
||||||
|
this.searchRef = createRef();
|
||||||
|
this.bodyRef = createRef();
|
||||||
|
this.containerRef = createRef();
|
||||||
|
this.dropdownRef = createRef();
|
||||||
|
|
||||||
|
this.state = extend(this.state, {
|
||||||
|
values: {
|
||||||
|
active: -1,
|
||||||
|
selected: values.map(v => false)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentWillMount() {
|
||||||
|
announce.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(props, state) {
|
||||||
|
const { values, tabIndex, minimumCharacters, valuesLabel, comboboxLabel } = props;
|
||||||
|
const {
|
||||||
|
open,
|
||||||
|
loading,
|
||||||
|
focused,
|
||||||
|
search,
|
||||||
|
values: { active, selected },
|
||||||
|
results
|
||||||
|
} = state;
|
||||||
|
const dictionary = this.dictionary;
|
||||||
|
|
||||||
|
let classes = cn(style.control, style.multi, { [style.open]: open }, { [style.focused]: focused });
|
||||||
|
if (props.containerClass && props.containerClass.length > 0) {
|
||||||
|
classes += ' ' + props.containerClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
const instructionsDomId = this.namespace + '-instructions';
|
||||||
|
const resultsDomId = this.namespace + '-results';
|
||||||
|
const resultsNamespace = this.namespace + '-res-';
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<div
|
||||||
|
class={classes}
|
||||||
|
ref={this.containerRef}
|
||||||
|
onFocusCapture={this.onFocusIn}
|
||||||
|
onBlurCapture={this.onFocusOut}
|
||||||
|
tabIndex={-1}
|
||||||
|
onMouseDown={this.focusSearchAndStopPropagation}
|
||||||
|
>
|
||||||
|
<div class={cn(style.body)} ref={this.bodyRef} onClick={this.onBodyClick}>
|
||||||
|
<div id={instructionsDomId} class={cn(style.offscreen)} style={{ display: 'none' }}>
|
||||||
|
{dictionary.multiSelectInstructions()}
|
||||||
|
</div>
|
||||||
|
{scope(() => {
|
||||||
|
const activeDescendant = active >= 0 ? this.namespace + '-vl-' + active : undefined;
|
||||||
|
if (values && values.length > 0) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={this.valuesRef}
|
||||||
|
class={cn(style.multiValues)}
|
||||||
|
tabIndex={tabIndex}
|
||||||
|
role='listbox'
|
||||||
|
aria-orientation='vertical'
|
||||||
|
aria-multiselectable='true'
|
||||||
|
aria-activedescendant={activeDescendant}
|
||||||
|
aria-label={valuesLabel}
|
||||||
|
aria-describedby={instructionsDomId}
|
||||||
|
onFocus={this.onValuesFocus}
|
||||||
|
onBlur={this.onValuesBlur}
|
||||||
|
onKeyDown={this.onValuesKeyDown}
|
||||||
|
>
|
||||||
|
{values.map((value: any, index: number) => {
|
||||||
|
const isSelected = selected[index];
|
||||||
|
const isActive = active === index;
|
||||||
|
const css = cn(style.item, {
|
||||||
|
[style.selected]: isSelected,
|
||||||
|
[style.active]: isActive
|
||||||
|
});
|
||||||
|
const id = this.namespace + '-vl-' + index;
|
||||||
|
const label = this.getItemLabel(value);
|
||||||
|
const render = this.renderValue(value);
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
id={id}
|
||||||
|
class={css}
|
||||||
|
role='option'
|
||||||
|
aria-selected={isSelected}
|
||||||
|
aria-label={label}
|
||||||
|
onMouseDown={(e: Event) => e.stopPropagation()}
|
||||||
|
onClick={this.onValueClick(index)}
|
||||||
|
>
|
||||||
|
<div class={style.content}>{render}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
{scope(() => {
|
||||||
|
const disabled = !selected.find(x => x === true);
|
||||||
|
const className = cn(style.remove, {
|
||||||
|
[style.offscreen]: values.length < 1
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className={className}
|
||||||
|
onClick={this.onRemoveSelectedClick}
|
||||||
|
onFocus={this.onRemoveSelectedFocus}
|
||||||
|
disabled={disabled}
|
||||||
|
aria-disabled={disabled}
|
||||||
|
title={dictionary.removeButtonTitle()}
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
<Remove width={20} height={20} />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<label htmlFor={undefined} className={style.offscreen}>
|
||||||
|
{props.comboboxLabel}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type='text'
|
||||||
|
ref={this.searchRef}
|
||||||
|
value={search}
|
||||||
|
class={cn(style.search)}
|
||||||
|
role='combobox'
|
||||||
|
aria-label={props.comboboxLabel}
|
||||||
|
aria-autocomplete='list'
|
||||||
|
aria-haspopup='true'
|
||||||
|
aria-owns={resultsDomId}
|
||||||
|
aria-controls={resultsDomId}
|
||||||
|
aria-expanded={open ? 'true' : 'false'}
|
||||||
|
aria-activedescendant={results.active >= 0 ? resultsNamespace + results.active : undefined}
|
||||||
|
aria-busy={loading}
|
||||||
|
onInput={this.onSearchInput}
|
||||||
|
onKeyDown={this.onSearchKeyDown}
|
||||||
|
onFocus={this.onSearchFocus}
|
||||||
|
/>
|
||||||
|
<div className={cn(style.toggle)} aria-hidden={true} tabIndex={-1} onClick={this.onToggleClick}>
|
||||||
|
<Toggle height={20} width={20} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{open && (
|
||||||
|
<Dropdown
|
||||||
|
class={cn(style.dropdown, style.multi)}
|
||||||
|
onClick={this.onDropdownClick}
|
||||||
|
controlRef={this.containerRef}
|
||||||
|
dropdownRef={this.dropdownRef}
|
||||||
|
>
|
||||||
|
<ResultList
|
||||||
|
namespace={resultsNamespace}
|
||||||
|
minimumCharacters={minimumCharacters}
|
||||||
|
dictionary={this.dictionary}
|
||||||
|
itemLabel={this.getItemLabel}
|
||||||
|
renderItem={this.renderResult}
|
||||||
|
listboxDomId={resultsDomId}
|
||||||
|
search={search}
|
||||||
|
{...this.state.results}
|
||||||
|
loading={loading}
|
||||||
|
onResultClicked={this.onResultClicked}
|
||||||
|
onMouseMove={this.onResultMouseMove}
|
||||||
|
onLoadMore={this.onLoadMoreResults}
|
||||||
|
/>
|
||||||
|
</Dropdown>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidMount() {
|
||||||
|
const css = this.props.containerStyle;
|
||||||
|
if (css && css.length > 0) {
|
||||||
|
this.containerRef.current!.setAttribute('style', css);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private onLoadMoreResults = () => {
|
||||||
|
this.loadMore();
|
||||||
|
};
|
||||||
|
|
||||||
|
private focusSearchAndStopPropagation = (event: Event) => {
|
||||||
|
this.searchRef.current!.focus();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onToggleClick = (event: MouseEvent) => {
|
||||||
|
const { open } = this.state;
|
||||||
|
if (open) {
|
||||||
|
this.close();
|
||||||
|
this.searchRef.current!.focus();
|
||||||
|
} else {
|
||||||
|
this.search(this.state.search, this.props.values, { open: true });
|
||||||
|
this.searchRef.current!.focus();
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onBodyClick = (event: MouseEvent) => {
|
||||||
|
if (event.target === this.bodyRef.current) {
|
||||||
|
// if the element itself was clicked, (white space inside the body)
|
||||||
|
this.searchRef.current!.focus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public onFocusIn = (event: FocusEvent) => {
|
||||||
|
this.updateState({ focused: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
public onFocusOut = (event: FocusEvent) => {
|
||||||
|
const receiver = event.relatedTarget as Node;
|
||||||
|
const container = this.containerRef.current!;
|
||||||
|
const dropdown = this.dropdownRef.current!;
|
||||||
|
const focused =
|
||||||
|
container.contains(receiver) || (dropdown && (dropdown === receiver || dropdown.contains(receiver)));
|
||||||
|
|
||||||
|
this.updateState({
|
||||||
|
focused
|
||||||
|
});
|
||||||
|
if (!focused) {
|
||||||
|
// this.closeIfOpen();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public onSearchFocus = (event: FocusEvent) => {
|
||||||
|
const { openOnFocus } = this.props;
|
||||||
|
const { open } = this.state;
|
||||||
|
if (!open && openOnFocus) {
|
||||||
|
this.search(this.searchRef.current!.value, this.props.values, { open: true });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public onResultMouseMove = (index: number, event: MouseEvent) => {
|
||||||
|
this.selectSearchResult(index);
|
||||||
|
};
|
||||||
|
|
||||||
|
public selectActiveResult = () => {
|
||||||
|
this.selectResult(this.getSelectedSearchResult());
|
||||||
|
};
|
||||||
|
|
||||||
|
public selectResult = (result: any) => {
|
||||||
|
const { values, onChange } = this.props;
|
||||||
|
const next = values.slice();
|
||||||
|
next.push(result);
|
||||||
|
|
||||||
|
this.close();
|
||||||
|
|
||||||
|
const label = this.getItemLabel(result);
|
||||||
|
announce.politely(this.dictionary.valueAdded(label));
|
||||||
|
|
||||||
|
onChange(next);
|
||||||
|
};
|
||||||
|
|
||||||
|
public toggleValue = (index: number) => {
|
||||||
|
const {
|
||||||
|
values: { selected }
|
||||||
|
} = this.state;
|
||||||
|
const next = selected.slice();
|
||||||
|
next[index] = !next[index];
|
||||||
|
this.updateState({ values: { selected: next, active: index } });
|
||||||
|
};
|
||||||
|
|
||||||
|
public onRemoveSelectedFocus = (event: FocusEvent) => {
|
||||||
|
this.closeIfOpen();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onRemoveSelectedClick = (event: Event) => {
|
||||||
|
const {
|
||||||
|
values: { selected }
|
||||||
|
} = this.state;
|
||||||
|
const { values, onChange } = this.props;
|
||||||
|
const next = values.slice().filter((value, index) => !selected[index]);
|
||||||
|
this.updateState({
|
||||||
|
values: {
|
||||||
|
selected: next.map(v => false)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
onChange(next);
|
||||||
|
|
||||||
|
this.searchRef.current!.focus();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onSearchInput = (event: Event) => {
|
||||||
|
const value = (event.target as HTMLInputElement).value;
|
||||||
|
this.search(value, this.props.values, { open: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
public onSearchKeyDown = (event: KeyboardEvent) => {
|
||||||
|
if (this.handleResultNavigationKeyDown(event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { open } = this.state;
|
||||||
|
|
||||||
|
if (open && this.hasSearchResults) {
|
||||||
|
switch (event.key) {
|
||||||
|
case Key.Enter:
|
||||||
|
this.selectActiveResult();
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
case Key.Escape:
|
||||||
|
if (open) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public onValueClick = (index: number) => (event: MouseEvent) => {
|
||||||
|
this.toggleValue(index);
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onValuesFocus = (event: Event) => {
|
||||||
|
const {
|
||||||
|
values: { active, selected }
|
||||||
|
} = this.state;
|
||||||
|
const { values } = this.props;
|
||||||
|
|
||||||
|
// highlight the first selected value
|
||||||
|
if (active < 0 && values.length > 0) {
|
||||||
|
let index = 0;
|
||||||
|
for (let i = 0; i < selected.length; i++) {
|
||||||
|
if (selected[i]) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.updateState({ values: { active: index } });
|
||||||
|
}
|
||||||
|
this.closeIfOpen();
|
||||||
|
};
|
||||||
|
|
||||||
|
public closeIfOpen() {
|
||||||
|
if (this.state.open) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public close = () => {
|
||||||
|
this.updateState({
|
||||||
|
open: false,
|
||||||
|
results: { results: undefined },
|
||||||
|
search: ''
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
public onValuesBlur = (event: Event) => {
|
||||||
|
this.updateState({ values: { active: -1 } });
|
||||||
|
};
|
||||||
|
|
||||||
|
public onValuesKeyDown = (event: KeyboardEvent) => {
|
||||||
|
const active = this.state.values.active;
|
||||||
|
const { values } = this.props;
|
||||||
|
|
||||||
|
switch (event.key) {
|
||||||
|
case Key.ArrowLeft:
|
||||||
|
case Key.ArrowUp:
|
||||||
|
case Key.Up:
|
||||||
|
case Key.Left: {
|
||||||
|
if (active > 0) {
|
||||||
|
this.updateState({ values: { active: active - 1 } });
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Key.ArrowRight:
|
||||||
|
case Key.Right:
|
||||||
|
case Key.ArrowDown:
|
||||||
|
case Key.Down: {
|
||||||
|
if (active < values.length - 1) {
|
||||||
|
this.updateState({ values: { active: active + 1 } });
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Key.PageDown: {
|
||||||
|
// TODO
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Key.PageUp: {
|
||||||
|
// TODO
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Key.Home: {
|
||||||
|
this.updateState({ values: { active: 0 } });
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Key.End: {
|
||||||
|
this.updateState({ values: { active: values.length - 1 } });
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Key.Space:
|
||||||
|
case Key.Spacebar: {
|
||||||
|
this.toggleValue(active);
|
||||||
|
event.preventDefault();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public onDropdownClick = (event: MouseEvent) => {
|
||||||
|
// result clicks do not make it this far because they do not propagate
|
||||||
|
// so this click is on something other than result
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.searchRef.current!.focus();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onResultClicked = (result: any, event: MouseEvent) => {
|
||||||
|
this.selectResult(result);
|
||||||
|
this.searchRef.current!.focus();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
}
|
190
control/src/result-list.tsx
Normal file
190
control/src/result-list.tsx
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
import { Component, ComponentChild, createRef, h, RefObject } from 'preact';
|
||||||
|
import { Dictionary } from './dictionary';
|
||||||
|
import { style } from './style';
|
||||||
|
import { calculateVerticalVisibility, cn } from './util';
|
||||||
|
|
||||||
|
const forceImportOfH = h;
|
||||||
|
|
||||||
|
// TODO if upon render loading is visible signal loadmore
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
// TODO consistenly call search a query
|
||||||
|
namespace: string;
|
||||||
|
search: string;
|
||||||
|
listboxDomId?: string;
|
||||||
|
results: any[];
|
||||||
|
token: string;
|
||||||
|
active: number;
|
||||||
|
page: number;
|
||||||
|
loading: boolean;
|
||||||
|
|
||||||
|
itemLabel: (item: any) => string;
|
||||||
|
renderItem: (item: any) => ComponentChild;
|
||||||
|
|
||||||
|
dictionary: Dictionary;
|
||||||
|
minimumCharacters: number;
|
||||||
|
|
||||||
|
showMinimumCharactersError: boolean;
|
||||||
|
showNoSearchResultsFound: boolean;
|
||||||
|
showLoadMoreResults: boolean;
|
||||||
|
|
||||||
|
onResultClicked: (result: any, event: MouseEvent) => void;
|
||||||
|
onMouseMove: (index: any, event: MouseEvent) => void;
|
||||||
|
onLoadMore: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ResultList extends Component<Props> {
|
||||||
|
private container: RefObject<HTMLElement>;
|
||||||
|
private lastMouseClientX?: number;
|
||||||
|
private lastMouseClientY?: number;
|
||||||
|
private loadMore: RefObject<HTMLElement>;
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.container = createRef();
|
||||||
|
this.loadMore = createRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
private getResultDomId(index: number) {
|
||||||
|
return this.props.namespace + index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(props, state, context) {
|
||||||
|
const { dictionary, minimumCharacters, showLoadMoreResults, results } = props;
|
||||||
|
const query = this.props.search;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class={style.body}>
|
||||||
|
<div
|
||||||
|
ref={this.container}
|
||||||
|
onScroll={this.onScroll}
|
||||||
|
class={style.searchResults}
|
||||||
|
aria-busy={props.loading}
|
||||||
|
style={{ maxHeight: '175px' }}
|
||||||
|
>
|
||||||
|
{props.loading && (
|
||||||
|
<div class={cn(style.searchResultsLoading, style.searchResultsMessage)}>
|
||||||
|
{dictionary.searchResultsLoading()}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{props.showNoSearchResultsFound && (
|
||||||
|
<div class={cn(style.noSearchResults, style.searchResultsMessage)}>
|
||||||
|
{dictionary.noSearchResults()}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{props.showMinimumCharactersError && (
|
||||||
|
<div class={cn(style.searchResultsMinimumError, style.searchResultsMessage)}>
|
||||||
|
{dictionary.minimumCharactersMessage(query.length, minimumCharacters)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{results && results.length > 0 && (
|
||||||
|
<div
|
||||||
|
class={style.options}
|
||||||
|
role='listbox'
|
||||||
|
id={props.listboxDomId}
|
||||||
|
aria-activedescendant={props.active >= 0 ? this.getResultDomId(props.active) : undefined}
|
||||||
|
>
|
||||||
|
{results.map((result, index) => {
|
||||||
|
const label = props.itemLabel(result);
|
||||||
|
const render = props.renderItem(result);
|
||||||
|
const active = props.active === index;
|
||||||
|
const css = cn(style.item, {
|
||||||
|
[style.active]: active
|
||||||
|
});
|
||||||
|
const id = this.getResultDomId(index);
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
id={id}
|
||||||
|
class={css}
|
||||||
|
role='option'
|
||||||
|
onClick={this.onResultClicked(result)}
|
||||||
|
onMouseMove={this.onMouseMove(index)}
|
||||||
|
aria-posinset={index + 1}
|
||||||
|
aria-setsize={showLoadMoreResults ? results.length + 1 : results}
|
||||||
|
aria-selected={active}
|
||||||
|
aria-label={label}
|
||||||
|
>
|
||||||
|
<div class={style.content}>{render}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{props.showLoadMoreResults && (
|
||||||
|
<div
|
||||||
|
ref={this.loadMore}
|
||||||
|
class={cn(style.searchResultsMinimumError, style.searchResultsMessage)}
|
||||||
|
>
|
||||||
|
{dictionary.searchResultsLoading()}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private onResultClicked = (result: any) => (event: MouseEvent) => {
|
||||||
|
this.props.onResultClicked(result, event);
|
||||||
|
};
|
||||||
|
|
||||||
|
private onMouseMove = (index: number) => (event: MouseEvent) => {
|
||||||
|
if (this.lastMouseClientX === event.clientX && this.lastMouseClientY === event.clientY) {
|
||||||
|
// the mouse did not move, the dropdown was scrolled instead, we do not change selected element because
|
||||||
|
// it will be scrolled into view and mess with the scrolling of the results in the dropdown
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.lastMouseClientX = event.clientX;
|
||||||
|
this.lastMouseClientY = event.clientY;
|
||||||
|
|
||||||
|
this.props.onMouseMove(index, event);
|
||||||
|
};
|
||||||
|
|
||||||
|
private onScroll = (event: Event) => {
|
||||||
|
if (!this.props.showLoadMoreResults) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const more = this.loadMore.current!;
|
||||||
|
const drop = this.container.current!;
|
||||||
|
|
||||||
|
const visibility = calculateVerticalVisibility(drop, more);
|
||||||
|
if (visibility !== 'hidden') {
|
||||||
|
this.props.onLoadMore();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public componentDidUpdate(prevProps: Props, prevState: Props) {
|
||||||
|
const { active, results, showLoadMoreResults } = this.props;
|
||||||
|
const { active: prevActive } = prevProps;
|
||||||
|
|
||||||
|
if (active !== prevActive) {
|
||||||
|
if (active >= 0 && results && results.length > 0 && active === results.length - 1 && showLoadMoreResults) {
|
||||||
|
// last result is selected and load more is shown, make sure it is scrolled into view
|
||||||
|
|
||||||
|
const drop = this.container.current!;
|
||||||
|
const el = this.loadMore.current!;
|
||||||
|
|
||||||
|
drop.scrollTop = el.offsetTop + el.offsetHeight - drop.clientHeight;
|
||||||
|
|
||||||
|
// console.log("scrolling to see load more");//, setting scrolltop", drop, el, el.offsetTop - drop.clientHeight);
|
||||||
|
} else if (active >= 0) {
|
||||||
|
// make sure it is scrolled into view
|
||||||
|
const id = this.getResultDomId(active);
|
||||||
|
const el = document.getElementById(id);
|
||||||
|
if (el != null) {
|
||||||
|
const drop = this.container!.current!;
|
||||||
|
const c = drop.getBoundingClientRect();
|
||||||
|
const e = el.getBoundingClientRect();
|
||||||
|
|
||||||
|
if (e.top < c.top && e.bottom <= c.bottom) {
|
||||||
|
const delta = c.top - e.top;
|
||||||
|
drop.scrollTop = drop.scrollTop - delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.top >= c.top && e.bottom > c.bottom) {
|
||||||
|
const delta = e.bottom - c.bottom;
|
||||||
|
drop.scrollTop = drop.scrollTop + delta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
311
control/src/select25.scss
Normal file
311
control/src/select25.scss
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
$focus-color: #4d90fe;
|
||||||
|
$item-bkg-color: #0073e6;
|
||||||
|
$item-text-color: #fff;
|
||||||
|
$remove-bkg-color: lighten($item-bkg-color, 50%);
|
||||||
|
$border: 1px solid #ddd;
|
||||||
|
$border-focus: 1px solid $focus-color;
|
||||||
|
$border-radius: 5px;
|
||||||
|
$dropdown-padding: 8px 10px;
|
||||||
|
|
||||||
|
.s25-hidden-accessible {
|
||||||
|
border: 0 !important;
|
||||||
|
clip: rect(0 0 0 0) !important;
|
||||||
|
-webkit-clip-path: inset(50%) !important;
|
||||||
|
clip-path: inset(50%) !important;
|
||||||
|
height: 1px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
position: absolute !important;
|
||||||
|
width: 1px !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-search {
|
||||||
|
font-size: 100%;
|
||||||
|
line-height: 24px;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-control {
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: 36px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
border: $border;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
|
||||||
|
&.s25-focused {
|
||||||
|
border: $border-focus;
|
||||||
|
|
||||||
|
&.s25-open {
|
||||||
|
border-bottom: none;
|
||||||
|
border-radius: $border-radius $border-radius 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-body {
|
||||||
|
margin: 3px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-toggle {
|
||||||
|
&:focus {
|
||||||
|
outline: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
display: inline-block;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-toggle {
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 30px;
|
||||||
|
width: 30px;
|
||||||
|
transition: right 0.2s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-control.s25-multi {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
|
.s25-body {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-right: 60px;
|
||||||
|
width: calc(100% - 60px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-multi-values {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.s25-item {
|
||||||
|
position: relative;
|
||||||
|
padding: 5px 12px 5px 18px;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
background-color: $item-bkg-color;
|
||||||
|
color: $item-text-color;
|
||||||
|
margin-right: 3px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
transition: 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: darken($item-bkg-color, 5%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.s25-active {
|
||||||
|
box-shadow: inset 0 0 0 3px #67b3ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.s25-item.s25-selected {
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: '✓';
|
||||||
|
position: absolute;
|
||||||
|
left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-label {
|
||||||
|
color: rgb(34, 34, 34);
|
||||||
|
font-size: 85%;
|
||||||
|
border-radius: $border-radius;
|
||||||
|
padding: 3px 3px 3px 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-multi-values:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-item {
|
||||||
|
cursor: pointer;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-search {
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 75px;
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-single.s25-control {
|
||||||
|
height: 36px;
|
||||||
|
|
||||||
|
.s25-body {
|
||||||
|
cursor: pointer;
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: calc(100% - 30px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-value {
|
||||||
|
border: 0px;
|
||||||
|
line-height: 27px;
|
||||||
|
padding-left: 3px;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-single.s25-dropdown {
|
||||||
|
.s25-search {
|
||||||
|
width: calc(100% - 16px);
|
||||||
|
padding: 6px;
|
||||||
|
margin: $dropdown-padding;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: $border;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-offscreen {
|
||||||
|
clip-path: inset(100%);
|
||||||
|
clip: rect(1px, 1px, 1px, 1px);
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-dropdown {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1000000;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: $border-focus;
|
||||||
|
border-top: $border;
|
||||||
|
border-radius: 0 0 $border-radius $border-radius;
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
|
|
||||||
|
.s25-body {
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-search-results {
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-options {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.s25-item {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
background-color: transparent;
|
||||||
|
color: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
padding: $dropdown-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-active {
|
||||||
|
background-color: lighten($item-bkg-color, 50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-no-search-results {
|
||||||
|
padding: $dropdown-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-search-results-message {
|
||||||
|
padding: $dropdown-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-search-results-loading {
|
||||||
|
padding: $dropdown-padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-remove {
|
||||||
|
border: 1px solid $remove-bkg-color;
|
||||||
|
border-radius: 0 $border-radius $border-radius 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 5px;
|
||||||
|
outline: none;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
transition: 0.2s, width 0.2s ease-out;
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
span svg {
|
||||||
|
fill: #ccc;
|
||||||
|
transition: fill 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(:disabled) {
|
||||||
|
background-color: $remove-bkg-color;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: darken($remove-bkg-color, 5%);
|
||||||
|
}
|
||||||
|
|
||||||
|
span svg {
|
||||||
|
fill: $item-bkg-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(.s25-offscreen) {
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
border: $border-focus;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-remove.s25-offscreen ~ .s25-toggle {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-placeholder {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
368
control/src/single-select.tsx
Normal file
368
control/src/single-select.tsx
Normal file
@ -0,0 +1,368 @@
|
|||||||
|
import { createRef, Fragment, h, RefObject } from 'preact';
|
||||||
|
import {
|
||||||
|
AbstractSelect,
|
||||||
|
DEFAULT_PROPS as ABSTRACT_DEFAULT_PROPS,
|
||||||
|
Props as AbstractSelectProps,
|
||||||
|
State as AbstractSelectState
|
||||||
|
} from './abstract-select';
|
||||||
|
import * as announce from './announce';
|
||||||
|
import { Dropdown } from './dropdown';
|
||||||
|
import { Remove, Toggle } from './icons';
|
||||||
|
import { ResultList } from './result-list';
|
||||||
|
import { style } from './style';
|
||||||
|
import { cn, DeepPartial, extend, Key, scope } from './util';
|
||||||
|
|
||||||
|
const forceImportOfH = h;
|
||||||
|
|
||||||
|
export interface Props extends AbstractSelectProps {
|
||||||
|
value: any;
|
||||||
|
label: string;
|
||||||
|
comboboxLabel: string;
|
||||||
|
onChange: (value: any) => void;
|
||||||
|
allowClear?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State extends AbstractSelectState {
|
||||||
|
value: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_PROPS = extend({}, ABSTRACT_DEFAULT_PROPS, { allowClear: false });
|
||||||
|
|
||||||
|
export class SingleSelect extends AbstractSelect<Props, State> {
|
||||||
|
private containerRef: RefObject<HTMLElement>;
|
||||||
|
private dropdownRef: RefObject<HTMLElement>;
|
||||||
|
private bodyRef: RefObject<HTMLElement>;
|
||||||
|
private searchRef: RefObject<HTMLInputElement>;
|
||||||
|
private valueRef: RefObject<HTMLElement>;
|
||||||
|
|
||||||
|
public static defaultProps = DEFAULT_PROPS;
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.searchRef = createRef();
|
||||||
|
this.bodyRef = createRef();
|
||||||
|
this.containerRef = createRef();
|
||||||
|
this.dropdownRef = createRef();
|
||||||
|
this.valueRef = createRef();
|
||||||
|
|
||||||
|
this.state = extend(this.state, { value: this.props.value });
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentWillMount() {
|
||||||
|
announce.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(props, state) {
|
||||||
|
const { minimumCharacters, tabIndex, label, allowClear, placeholder } = props;
|
||||||
|
const { value, open, loading, focused, search, results } = state;
|
||||||
|
|
||||||
|
let classes = cn(style.control, style.single, { [style.open]: open }, { [style.focused]: focused });
|
||||||
|
if (props.containerClass && props.containerClass.length > 0) {
|
||||||
|
classes += ' ' + props.containerClass;
|
||||||
|
}
|
||||||
|
const resultsDomId = this.namespace + '-results';
|
||||||
|
const optionDomId = this.namespace + '-val';
|
||||||
|
const resultsNamespace = this.namespace + '-res-';
|
||||||
|
const dictionary = this.dictionary;
|
||||||
|
const showPlaceholder = !value && placeholder && placeholder.length > 0;
|
||||||
|
const placeholderDomId = this.namespace + '-placeholder';
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<div
|
||||||
|
class={classes}
|
||||||
|
ref={this.containerRef}
|
||||||
|
onFocusCapture={this.onFocusIn}
|
||||||
|
onBlurCapture={this.onFocusOut}
|
||||||
|
tabIndex={-1}
|
||||||
|
onMouseDown={this.onContainerMouseDown}
|
||||||
|
>
|
||||||
|
<div class={cn(style.body)} ref={this.bodyRef}>
|
||||||
|
<div
|
||||||
|
aria-label={label}
|
||||||
|
role='listbox'
|
||||||
|
aria-activedescendant={optionDomId}
|
||||||
|
aria-expanded='false'
|
||||||
|
class={cn(style.value)}
|
||||||
|
tabIndex={tabIndex}
|
||||||
|
ref={this.valueRef}
|
||||||
|
onKeyDown={this.onValueKeyDown}
|
||||||
|
aria-describedby={showPlaceholder ? placeholderDomId : undefined}
|
||||||
|
>
|
||||||
|
{value && (
|
||||||
|
<div
|
||||||
|
class={style.item}
|
||||||
|
role='option'
|
||||||
|
aria-selected='true'
|
||||||
|
aria-label={this.getItemLabel(value)}
|
||||||
|
aria-setsize={-1}
|
||||||
|
aria-posinset={-1}
|
||||||
|
id={optionDomId}
|
||||||
|
>
|
||||||
|
<div class={style.content}>{this.renderValue(value)}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{showPlaceholder && (
|
||||||
|
<div class={cn(style.placeholder)} id={placeholderDomId}>
|
||||||
|
{placeholder}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{scope(() => {
|
||||||
|
const disabled = !value;
|
||||||
|
const clazz = cn(style.remove, { [style.offscreen]: !allowClear });
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
class={clazz}
|
||||||
|
onClick={this.onClearClick}
|
||||||
|
onFocus={this.onClearFocus}
|
||||||
|
onMouseDown={this.onClearMouseDown}
|
||||||
|
disabled={disabled}
|
||||||
|
aria-disabled={disabled}
|
||||||
|
title={dictionary.clearButtonTitle()}
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
<Remove width={20} height={20} />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<div className={style.toggle} aria-hidden={true}>
|
||||||
|
<Toggle height={20} width={20} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{open && (
|
||||||
|
<Dropdown
|
||||||
|
class={cn(style.dropdown, style.single)}
|
||||||
|
onMouseDown={this.onDropdownMouseDown}
|
||||||
|
controlRef={this.containerRef}
|
||||||
|
dropdownRef={this.dropdownRef}
|
||||||
|
onFocusOut={this.onFocusOut}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
type='text'
|
||||||
|
ref={this.searchRef}
|
||||||
|
value={search}
|
||||||
|
class={cn(style.search)}
|
||||||
|
role='combobox'
|
||||||
|
aria-autocomplete='list'
|
||||||
|
aria-haspopup='true'
|
||||||
|
aria-owns={resultsDomId}
|
||||||
|
aria-controls={resultsDomId}
|
||||||
|
aria-expanded={open ? 'true' : 'false'}
|
||||||
|
aria-activedescendant={
|
||||||
|
results.active >= 0 ? resultsNamespace + results.active : undefined
|
||||||
|
}
|
||||||
|
aria-busy={loading}
|
||||||
|
onInput={this.onSearchInput}
|
||||||
|
onKeyDown={this.onSearchKeyDown}
|
||||||
|
onFocus={this.onSearchFocus}
|
||||||
|
/>
|
||||||
|
<ResultList
|
||||||
|
namespace={resultsNamespace}
|
||||||
|
minimumCharacters={minimumCharacters}
|
||||||
|
dictionary={this.dictionary}
|
||||||
|
itemLabel={this.getItemLabel}
|
||||||
|
renderItem={this.renderResult}
|
||||||
|
listboxDomId={resultsDomId}
|
||||||
|
search={search}
|
||||||
|
{...this.state.results}
|
||||||
|
loading={loading}
|
||||||
|
onResultClicked={this.onResultClicked}
|
||||||
|
onMouseMove={this.onResultMouseMove}
|
||||||
|
onLoadMore={this.onLoadMoreResults}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Dropdown>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidMount() {
|
||||||
|
const css = this.props.containerStyle;
|
||||||
|
if (css && css.length > 0) {
|
||||||
|
this.containerRef.current!.setAttribute('style', css);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private onLoadMoreResults = () => {
|
||||||
|
this.loadMore();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onFocusIn = (event: FocusEvent) => {
|
||||||
|
this.updateState({ focused: true });
|
||||||
|
|
||||||
|
const { openOnFocus } = this.props;
|
||||||
|
const { open } = this.state;
|
||||||
|
if (!open && openOnFocus && this.searchRef.current !== document.activeElement) {
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public onFocusOut = (event: FocusEvent) => {
|
||||||
|
const receiver = event.relatedTarget as Node;
|
||||||
|
const container = this.containerRef.current;
|
||||||
|
const dropdown = this.dropdownRef.current;
|
||||||
|
const search = this.searchRef.current;
|
||||||
|
|
||||||
|
const focused =
|
||||||
|
container.contains(receiver) ||
|
||||||
|
(dropdown && (dropdown === receiver || dropdown.contains(receiver))) ||
|
||||||
|
receiver === search;
|
||||||
|
|
||||||
|
if (this.state.focused !== focused) {
|
||||||
|
this.updateState({
|
||||||
|
focused
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!focused) {
|
||||||
|
this.closeIfOpen();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public closeIfOpen() {
|
||||||
|
if (this.state.open) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public close = (state?: DeepPartial<State>) => {
|
||||||
|
const control = this;
|
||||||
|
control.valueRef.current!.focus();
|
||||||
|
this.updateState([
|
||||||
|
state,
|
||||||
|
{
|
||||||
|
open: false,
|
||||||
|
results: { results: null },
|
||||||
|
search: ''
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
private getValueAsArray() {
|
||||||
|
return this.state.value ? [this.state.value] : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private onContainerMouseDown = (event: MouseEvent) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
if (this.state.open) {
|
||||||
|
this.close();
|
||||||
|
} else {
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private open(query: string = '') {
|
||||||
|
this.search(query, this.getValueAsArray(), { open: true }, () => {
|
||||||
|
this.searchRef.current.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private onSearchFocus = (event: FocusEvent) => {
|
||||||
|
this.updateState({ focused: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
private onSearchInput = (event: Event) => {
|
||||||
|
const value = (event.target as HTMLInputElement).value;
|
||||||
|
this.search(value, this.getValueAsArray());
|
||||||
|
};
|
||||||
|
|
||||||
|
private onClearFocus = (event: FocusEvent) => {
|
||||||
|
this.closeIfOpen();
|
||||||
|
};
|
||||||
|
|
||||||
|
private onClearClick = (event: Event) => {
|
||||||
|
this.selectResult(undefined);
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
private onClearMouseDown = (event: Event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onSearchKeyDown = (event: KeyboardEvent) => {
|
||||||
|
if (this.handleResultNavigationKeyDown(event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { open } = this.state;
|
||||||
|
|
||||||
|
if (open && this.hasSearchResults) {
|
||||||
|
switch (event.key) {
|
||||||
|
case Key.Enter:
|
||||||
|
this.selectActiveResult();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
break;
|
||||||
|
case Key.Escape:
|
||||||
|
this.close();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
break;
|
||||||
|
case Key.Tab:
|
||||||
|
// TODO select on tab?
|
||||||
|
this.close();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public selectActiveResult = () => {
|
||||||
|
const { active } = this.state.results;
|
||||||
|
if (active >= 0) {
|
||||||
|
this.selectResult(this.getSelectedSearchResult());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public selectResult = (result: any) => {
|
||||||
|
const { onChange } = this.props;
|
||||||
|
|
||||||
|
this.close({ value: result });
|
||||||
|
|
||||||
|
// TODO announce?
|
||||||
|
// const label = this.getItemLabel(result);
|
||||||
|
|
||||||
|
onChange(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
private onValueKeyDown = (event: KeyboardEvent) => {
|
||||||
|
switch (event.key) {
|
||||||
|
case Key.Space:
|
||||||
|
case Key.ArrowDown:
|
||||||
|
case Key.Down:
|
||||||
|
this.open();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key.length === 1) {
|
||||||
|
// focus on search which will put the printable character into the field
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private onDropdownMouseDown = (event: MouseEvent) => {
|
||||||
|
this.searchRef.current.focus();
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
public onResultMouseMove = (index: number, event: MouseEvent) => {
|
||||||
|
this.selectSearchResult(index);
|
||||||
|
};
|
||||||
|
|
||||||
|
public onResultClicked = (result: any, event: MouseEvent) => {
|
||||||
|
this.selectResult(result);
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
}
|
31
control/src/style.ts
Normal file
31
control/src/style.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
export const enum style {
|
||||||
|
control = 's25-control',
|
||||||
|
content = 's25-content',
|
||||||
|
single = 's25-single',
|
||||||
|
multi = 's25-multi',
|
||||||
|
body = 's25-body',
|
||||||
|
focused = 's25-focused',
|
||||||
|
active = 's25-active',
|
||||||
|
live = 's25-live',
|
||||||
|
multiValues = 's25-multi-values',
|
||||||
|
value = 's25-value',
|
||||||
|
item = 's25-item',
|
||||||
|
selected = 's25-selected',
|
||||||
|
toggle = 's25-toggle',
|
||||||
|
remove = 's25-remove',
|
||||||
|
open = 's25-open',
|
||||||
|
label = 's25-label',
|
||||||
|
search = 's25-search',
|
||||||
|
offscreen = 's25-offscreen',
|
||||||
|
searchContainer = 's25-search-container',
|
||||||
|
dropdown = 's25-dropdown',
|
||||||
|
searchResults = 's25-search-results',
|
||||||
|
options = 's25-options',
|
||||||
|
noSearchResults = 's25-no-search-results',
|
||||||
|
searchResultsMessage = 's25-search-results-message',
|
||||||
|
searchResultsLoading = 's25-search-results-loading',
|
||||||
|
searchResultsMinimumError = 's25-search-results-minimum-error',
|
||||||
|
hiddenAccessible = 's25-hidden-accessible',
|
||||||
|
hidden = 's25-hidden',
|
||||||
|
placeholder = 's25-placeholder'
|
||||||
|
}
|
213
control/src/util.ts
Normal file
213
control/src/util.ts
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
import { ComponentChild } from 'preact';
|
||||||
|
|
||||||
|
export function extend(...params: object[]) {
|
||||||
|
for (let i = 1; i < arguments.length; i++) {
|
||||||
|
for (const key in arguments[i]) {
|
||||||
|
if (arguments[i].hasOwnProperty(key)) {
|
||||||
|
if (typeof arguments[0][key] === 'object' && typeof arguments[i][key] === 'object') {
|
||||||
|
extend(arguments[0][key], arguments[i][key]);
|
||||||
|
} else {
|
||||||
|
arguments[0][key] = arguments[i][key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arguments[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DeepPartial<T> = {
|
||||||
|
[P in keyof T]?: T[P] extends Array<infer U>
|
||||||
|
? Array<DeepPartial<U>>
|
||||||
|
: T[P] extends ReadonlyArray<infer V>
|
||||||
|
? ReadonlyArray<DeepPartial<V>>
|
||||||
|
: DeepPartial<T[P]>
|
||||||
|
};
|
||||||
|
|
||||||
|
export const merge = <T>(target: T, sources: Array<DeepPartial<T>>): T => {
|
||||||
|
if (!sources.length) {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
const source = sources.shift();
|
||||||
|
if (source === undefined) {
|
||||||
|
return merge(target, sources);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMergebleObject(target) && isMergebleObject(source)) {
|
||||||
|
Object.keys(source).forEach((key: string) => {
|
||||||
|
if (isMergebleObject(source[key])) {
|
||||||
|
if (!target[key]) {
|
||||||
|
target[key] = {};
|
||||||
|
}
|
||||||
|
merge(target[key], [source[key]]);
|
||||||
|
} else {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return merge(target, sources);
|
||||||
|
};
|
||||||
|
|
||||||
|
const isObject = (item: any): boolean => {
|
||||||
|
return item !== null && typeof item === 'object';
|
||||||
|
};
|
||||||
|
|
||||||
|
const isMergebleObject = (item): boolean => {
|
||||||
|
return isObject(item) && !Array.isArray(item);
|
||||||
|
};
|
||||||
|
|
||||||
|
export function cn(...values: any) {
|
||||||
|
const classes: string[] = [];
|
||||||
|
const hasOwnProperty = {}.hasOwnProperty;
|
||||||
|
|
||||||
|
for (const value of values) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
classes.push(value);
|
||||||
|
} else if (typeof value === 'object') {
|
||||||
|
for (const key in value as object) {
|
||||||
|
if (hasOwnProperty.call(value, key) && value[key]) {
|
||||||
|
classes.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return classes.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum Key {
|
||||||
|
// https://www.w3.org/TR/uievents-key/#named-key-attribute-values
|
||||||
|
ArrowDown = 'ArrowDown',
|
||||||
|
ArrowUp = 'ArrowUp',
|
||||||
|
ArrowLeft = 'ArrowLeft',
|
||||||
|
ArrowRight = 'ArrowRight',
|
||||||
|
Space = ' ',
|
||||||
|
Enter = 'Enter',
|
||||||
|
Tab = 'Tab',
|
||||||
|
Home = 'Home',
|
||||||
|
End = 'End',
|
||||||
|
PageUp = 'PageUp',
|
||||||
|
PageDown = 'PageDown',
|
||||||
|
Backspace = 'Backspace',
|
||||||
|
Delete = 'Delete',
|
||||||
|
Clear = 'Clear',
|
||||||
|
Escape = 'Escape',
|
||||||
|
// IE 11
|
||||||
|
Down = 'Down',
|
||||||
|
Up = 'Up',
|
||||||
|
Spacebar = 'Spacebar',
|
||||||
|
Left = 'Left',
|
||||||
|
Right = 'Right'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const uuid = (() => {
|
||||||
|
let counter = 0;
|
||||||
|
return () => 's25-' + counter++;
|
||||||
|
})();
|
||||||
|
|
||||||
|
export function throttle(delay: number, callback: () => void): () => void {
|
||||||
|
let timeout: number | undefined;
|
||||||
|
return () => {
|
||||||
|
if (timeout !== undefined) {
|
||||||
|
window.clearTimeout(timeout);
|
||||||
|
timeout = undefined;
|
||||||
|
} else {
|
||||||
|
timeout = window.setTimeout(() => {
|
||||||
|
callback();
|
||||||
|
timeout = undefined;
|
||||||
|
}, delay);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
export function debounce(quiet: number, delegate: (...args: any[]) => void, that: object) {
|
||||||
|
const args = Array.from(arguments);
|
||||||
|
if (quiet <= 0) {
|
||||||
|
return () => {
|
||||||
|
delegate.apply(that, args);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
let timeout: number | undefined;
|
||||||
|
return () => {
|
||||||
|
if (timeout) {
|
||||||
|
window.clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
timeout = window.setTimeout(() => {
|
||||||
|
timeout = undefined;
|
||||||
|
delegate.apply(that, args);
|
||||||
|
}, quiet);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getScrollParents(el: HTMLElement): EventTarget[] {
|
||||||
|
const style = window.getComputedStyle(el);
|
||||||
|
const elementPosition = style.position;
|
||||||
|
if (elementPosition === 'fixed') {
|
||||||
|
return [el];
|
||||||
|
}
|
||||||
|
|
||||||
|
const parents: Array<HTMLElement | Window> = [];
|
||||||
|
let parent = el.parentElement;
|
||||||
|
|
||||||
|
while (parent && parent.nodeType === 1) {
|
||||||
|
const css = window.getComputedStyle(parent);
|
||||||
|
if (/(overlay|scroll|auto)/.test(css.overflow + ' ' + css.overflowX + ' ' + css.overflowY)) {
|
||||||
|
if (elementPosition !== 'absolute' || ['relative', 'fixed', 'absolute'].indexOf(css.position || '') >= 0) {
|
||||||
|
parents.push(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parent = parent.parentElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (el.ownerDocument) {
|
||||||
|
parents.push(el.ownerDocument.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// iframe
|
||||||
|
if (el.ownerDocument !== document && el.ownerDocument && el.ownerDocument.defaultView) {
|
||||||
|
parents.push(el.ownerDocument.defaultView);
|
||||||
|
}
|
||||||
|
|
||||||
|
parents.push(window);
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function calculateVerticalVisibility(
|
||||||
|
container: HTMLElement,
|
||||||
|
element: HTMLElement
|
||||||
|
): 'hidden' | 'partial-top' | 'partial-bottom' | 'visible' {
|
||||||
|
const c = container.getBoundingClientRect();
|
||||||
|
const e = element.getBoundingClientRect();
|
||||||
|
|
||||||
|
if (e.bottom < c.top) {
|
||||||
|
// above the fold
|
||||||
|
return 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.top > c.bottom) {
|
||||||
|
// below the fold
|
||||||
|
return 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.top < c.top && e.bottom <= c.bottom) {
|
||||||
|
return 'partial-top';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.top >= c.top && e.bottom > c.bottom) {
|
||||||
|
return 'partial-bottom';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'visible';
|
||||||
|
}
|
||||||
|
|
||||||
|
export type MouseEventListener = (event: MouseEvent) => void;
|
||||||
|
export type KeyboardEventListener = (event: KeyboardEvent) => void;
|
||||||
|
export type EventListener = (event: Event) => void;
|
||||||
|
export type FocusEventListener = (event: FocusEvent) => void;
|
||||||
|
|
||||||
|
/** helper that makes it easier to declare a scope inside a jsx block */
|
||||||
|
export function scope(delegate: () => ComponentChild) {
|
||||||
|
return delegate();
|
||||||
|
}
|
64
control/test/__snapshots__/multi-select.unit.test.tsx.snap
Normal file
64
control/test/__snapshots__/multi-select.unit.test.tsx.snap
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`MultiSelect renders with empty values 1`] = `
|
||||||
|
<p>
|
||||||
|
<div class="s25-control s25-multi" tabIndex="-1">
|
||||||
|
<div class="s25-body">
|
||||||
|
<div id="s25-0-instructions" class="s25-offscreen" style="display: none;">Items can be removed from this list box by selecting them and activating
|
||||||
|
'Remove selected values' button. Items can be added by selecting them in
|
||||||
|
the adjacent combobox.</div>
|
||||||
|
<button class="s25-remove s25-offscreen" disabled
|
||||||
|
aria-disabled title="Remove selected values">
|
||||||
|
<span>
|
||||||
|
<Remove width="20" height="20"></Remove>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<label class="s25-offscreen">Add Value</label>
|
||||||
|
<input type="text" value class="s25-search" role="combobox"
|
||||||
|
aria-label="Add Value" aria-autocomplete="list" aria-haspopup="true" aria-owns="s25-0-results"
|
||||||
|
aria-controls="s25-0-results" aria-expanded="false" />
|
||||||
|
<div class="s25-toggle" aria-hidden tabIndex="-1">
|
||||||
|
<Toggle height="20" width="20"></Toggle>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`MultiSelect renders with values 1`] = `
|
||||||
|
<p>
|
||||||
|
<div class="s25-control s25-multi" tabIndex="-1">
|
||||||
|
<div class="s25-body">
|
||||||
|
<div id="s25-1-instructions" class="s25-offscreen" style="display: none;">Items can be removed from this list box by selecting them and activating
|
||||||
|
'Remove selected values' button. Items can be added by selecting them in
|
||||||
|
the adjacent combobox.</div>
|
||||||
|
<div class="s25-multi-values" tabIndex="0"
|
||||||
|
role="listbox" aria-orientation="vertical" aria-multiselectable="true"
|
||||||
|
aria-label="Selected Values" aria-describedby="s25-1-instructions">
|
||||||
|
<div id="s25-1-vl-0" class="s25-item" role="option" aria-label="undefined">
|
||||||
|
<div class="s25-content">
|
||||||
|
<MarkupRenderer markup="undefined"></MarkupRenderer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="s25-1-vl-1" class="s25-item" role="option" aria-label="undefined">
|
||||||
|
<div class="s25-content">
|
||||||
|
<MarkupRenderer markup="undefined"></MarkupRenderer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="s25-remove" disabled aria-disabled title="Remove selected values">
|
||||||
|
<span>
|
||||||
|
<Remove width="20" height="20"></Remove>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<label class="s25-offscreen">Add Value</label>
|
||||||
|
<input type="text" value class="s25-search" role="combobox"
|
||||||
|
aria-label="Add Value" aria-autocomplete="list" aria-haspopup="true" aria-owns="s25-1-results"
|
||||||
|
aria-controls="s25-1-results" aria-expanded="false" />
|
||||||
|
<div class="s25-toggle" aria-hidden tabIndex="-1">
|
||||||
|
<Toggle height="20" width="20"></Toggle>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
`;
|
245
control/test/countries.ts
Normal file
245
control/test/countries.ts
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
export const countries = [
|
||||||
|
{ name: 'United States', code: 'US' },
|
||||||
|
{ name: 'Mexico', code: 'MX' },
|
||||||
|
{ name: 'Afghanistan', code: 'AF' },
|
||||||
|
{ name: 'Aland Islands', code: 'AX' },
|
||||||
|
{ name: 'Albania', code: 'AL' },
|
||||||
|
{ name: 'Algeria', code: 'DZ' },
|
||||||
|
{ name: 'American Samoa', code: 'AS' },
|
||||||
|
{ name: 'Andorra', code: 'AD' },
|
||||||
|
{ name: 'Angola', code: 'AO' },
|
||||||
|
{ name: 'Anguilla', code: 'AI' },
|
||||||
|
{ name: 'Antarctica', code: 'AQ' },
|
||||||
|
{ name: 'Antigua and Barbuda', code: 'AG' },
|
||||||
|
{ name: 'Argentina', code: 'AR' },
|
||||||
|
{ name: 'Armenia', code: 'AM' },
|
||||||
|
{ name: 'Aruba', code: 'AW' },
|
||||||
|
{ name: 'Australia', code: 'AU' },
|
||||||
|
{ name: 'Austria', code: 'AT' },
|
||||||
|
{ name: 'Azerbaijan', code: 'AZ' },
|
||||||
|
{ name: 'Bahamas', code: 'BS' },
|
||||||
|
{ name: 'Bahrain', code: 'BH' },
|
||||||
|
{ name: 'Bangladesh', code: 'BD' },
|
||||||
|
{ name: 'Barbados', code: 'BB' },
|
||||||
|
{ name: 'Belarus', code: 'BY' },
|
||||||
|
{ name: 'Belgium', code: 'BE' },
|
||||||
|
{ name: 'Belize', code: 'BZ' },
|
||||||
|
{ name: 'Benin', code: 'BJ' },
|
||||||
|
{ name: 'Bermuda', code: 'BM' },
|
||||||
|
{ name: 'Bhutan', code: 'BT' },
|
||||||
|
{ name: 'Bolivia', code: 'BO' },
|
||||||
|
{ name: 'Bosnia and Herzegovina', code: 'BA' },
|
||||||
|
{ name: 'Botswana', code: 'BW' },
|
||||||
|
{ name: 'Bouvet Island', code: 'BV' },
|
||||||
|
{ name: 'Brazil', code: 'BR' },
|
||||||
|
{ name: 'British Indian Ocean Territory', code: 'IO' },
|
||||||
|
{ name: 'Brunei Darussalam', code: 'BN' },
|
||||||
|
{ name: 'Bulgaria', code: 'BG' },
|
||||||
|
{ name: 'Burkina Faso', code: 'BF' },
|
||||||
|
{ name: 'Burundi', code: 'BI' },
|
||||||
|
{ name: 'Cambodia', code: 'KH' },
|
||||||
|
{ name: 'Cameroon', code: 'CM' },
|
||||||
|
{ name: 'Canada', code: 'CA' },
|
||||||
|
{ name: 'Cape Verde', code: 'CV' },
|
||||||
|
{ name: 'Cayman Islands', code: 'KY' },
|
||||||
|
{ name: 'Central African Republic', code: 'CF' },
|
||||||
|
{ name: 'Chad', code: 'TD' },
|
||||||
|
{ name: 'Chile', code: 'CL' },
|
||||||
|
{ name: 'China', code: 'CN' },
|
||||||
|
{ name: 'Christmas Island', code: 'CX' },
|
||||||
|
{ name: 'Cocos (Keeling) Islands', code: 'CC' },
|
||||||
|
{ name: 'Colombia', code: 'CO' },
|
||||||
|
{ name: 'Comoros', code: 'KM' },
|
||||||
|
{ name: 'Congo', code: 'CG' },
|
||||||
|
{ name: 'Congo, The Democratic Republic of the', code: 'CD' },
|
||||||
|
{ name: 'Cook Islands', code: 'CK' },
|
||||||
|
{ name: 'Costa Rica', code: 'CR' },
|
||||||
|
{ name: "Cote D'Ivoire", code: 'CI' },
|
||||||
|
{ name: 'Croatia', code: 'HR' },
|
||||||
|
{ name: 'Cuba', code: 'CU' },
|
||||||
|
{ name: 'Cyprus', code: 'CY' },
|
||||||
|
{ name: 'Czech Republic', code: 'CZ' },
|
||||||
|
{ name: 'Denmark', code: 'DK' },
|
||||||
|
{ name: 'Djibouti', code: 'DJ' },
|
||||||
|
{ name: 'Dominica', code: 'DM' },
|
||||||
|
{ name: 'Dominican Republic', code: 'DO' },
|
||||||
|
{ name: 'Ecuador', code: 'EC' },
|
||||||
|
{ name: 'Egypt', code: 'EG' },
|
||||||
|
{ name: 'El Salvador', code: 'SV' },
|
||||||
|
{ name: 'Equatorial Guinea', code: 'GQ' },
|
||||||
|
{ name: 'Eritrea', code: 'ER' },
|
||||||
|
{ name: 'Estonia', code: 'EE' },
|
||||||
|
{ name: 'Ethiopia', code: 'ET' },
|
||||||
|
{ name: 'Falkland Islands (Malvinas)', code: 'FK' },
|
||||||
|
{ name: 'Faroe Islands', code: 'FO' },
|
||||||
|
{ name: 'Fiji', code: 'FJ' },
|
||||||
|
{ name: 'Finland', code: 'FI' },
|
||||||
|
{ name: 'France', code: 'FR' },
|
||||||
|
{ name: 'French Guiana', code: 'GF' },
|
||||||
|
{ name: 'French Polynesia', code: 'PF' },
|
||||||
|
{ name: 'French Southern Territories', code: 'TF' },
|
||||||
|
{ name: 'Gabon', code: 'GA' },
|
||||||
|
{ name: 'Gambia', code: 'GM' },
|
||||||
|
{ name: 'Georgia', code: 'GE' },
|
||||||
|
{ name: 'Germany', code: 'DE' },
|
||||||
|
{ name: 'Ghana', code: 'GH' },
|
||||||
|
{ name: 'Gibraltar', code: 'GI' },
|
||||||
|
{ name: 'Greece', code: 'GR' },
|
||||||
|
{ name: 'Greenland', code: 'GL' },
|
||||||
|
{ name: 'Grenada', code: 'GD' },
|
||||||
|
{ name: 'Guadeloupe', code: 'GP' },
|
||||||
|
{ name: 'Guam', code: 'GU' },
|
||||||
|
{ name: 'Guatemala', code: 'GT' },
|
||||||
|
{ name: 'Guernsey', code: 'GG' },
|
||||||
|
{ name: 'Guinea', code: 'GN' },
|
||||||
|
{ name: 'Guinea-Bissau', code: 'GW' },
|
||||||
|
{ name: 'Guyana', code: 'GY' },
|
||||||
|
{ name: 'Haiti', code: 'HT' },
|
||||||
|
{ name: 'Heard Island and Mcdonald Islands', code: 'HM' },
|
||||||
|
{ name: 'Holy See (Vatican City State)', code: 'VA' },
|
||||||
|
{ name: 'Honduras', code: 'HN' },
|
||||||
|
{ name: 'Hong Kong', code: 'HK' },
|
||||||
|
{ name: 'Hungary', code: 'HU' },
|
||||||
|
{ name: 'Iceland', code: 'IS' },
|
||||||
|
{ name: 'India', code: 'IN' },
|
||||||
|
{ name: 'Indonesia', code: 'ID' },
|
||||||
|
{ name: 'Iran, Islamic Republic Of', code: 'IR' },
|
||||||
|
{ name: 'Iraq', code: 'IQ' },
|
||||||
|
{ name: 'Ireland', code: 'IE' },
|
||||||
|
{ name: 'Isle of Man', code: 'IM' },
|
||||||
|
{ name: 'Israel', code: 'IL' },
|
||||||
|
{ name: 'Italy', code: 'IT' },
|
||||||
|
{ name: 'Jamaica', code: 'JM' },
|
||||||
|
{ name: 'Japan', code: 'JP' },
|
||||||
|
{ name: 'Jersey', code: 'JE' },
|
||||||
|
{ name: 'Jordan', code: 'JO' },
|
||||||
|
{ name: 'Kazakhstan', code: 'KZ' },
|
||||||
|
{ name: 'Kenya', code: 'KE' },
|
||||||
|
{ name: 'Kiribati', code: 'KI' },
|
||||||
|
{ name: "Korea, Democratic People'S Republic of", code: 'KP' },
|
||||||
|
{ name: 'Korea, Republic of', code: 'KR' },
|
||||||
|
{ name: 'Kuwait', code: 'KW' },
|
||||||
|
{ name: 'Kyrgyzstan', code: 'KG' },
|
||||||
|
{ name: "Lao People'S Democratic Republic", code: 'LA' },
|
||||||
|
{ name: 'Latvia', code: 'LV' },
|
||||||
|
{ name: 'Lebanon', code: 'LB' },
|
||||||
|
{ name: 'Lesotho', code: 'LS' },
|
||||||
|
{ name: 'Liberia', code: 'LR' },
|
||||||
|
{ name: 'Libyan Arab Jamahiriya', code: 'LY' },
|
||||||
|
{ name: 'Liechtenstein', code: 'LI' },
|
||||||
|
{ name: 'Lithuania', code: 'LT' },
|
||||||
|
{ name: 'Luxembourg', code: 'LU' },
|
||||||
|
{ name: 'Macao', code: 'MO' },
|
||||||
|
{ name: 'Macedonia, The Former Yugoslav Republic of', code: 'MK' },
|
||||||
|
{ name: 'Madagascar', code: 'MG' },
|
||||||
|
{ name: 'Malawi', code: 'MW' },
|
||||||
|
{ name: 'Malaysia', code: 'MY' },
|
||||||
|
{ name: 'Maldives', code: 'MV' },
|
||||||
|
{ name: 'Mali', code: 'ML' },
|
||||||
|
{ name: 'Malta', code: 'MT' },
|
||||||
|
{ name: 'Marshall Islands', code: 'MH' },
|
||||||
|
{ name: 'Martinique', code: 'MQ' },
|
||||||
|
{ name: 'Mauritania', code: 'MR' },
|
||||||
|
{ name: 'Mauritius', code: 'MU' },
|
||||||
|
{ name: 'Mayotte', code: 'YT' },
|
||||||
|
{ name: 'Micronesia, Federated States of', code: 'FM' },
|
||||||
|
{ name: 'Moldova, Republic of', code: 'MD' },
|
||||||
|
{ name: 'Monaco', code: 'MC' },
|
||||||
|
{ name: 'Mongolia', code: 'MN' },
|
||||||
|
{ name: 'Montserrat', code: 'MS' },
|
||||||
|
{ name: 'Morocco', code: 'MA' },
|
||||||
|
{ name: 'Mozambique', code: 'MZ' },
|
||||||
|
{ name: 'Myanmar', code: 'MM' },
|
||||||
|
{ name: 'Namibia', code: 'NA' },
|
||||||
|
{ name: 'Nauru', code: 'NR' },
|
||||||
|
{ name: 'Nepal', code: 'NP' },
|
||||||
|
{ name: 'Netherlands', code: 'NL' },
|
||||||
|
{ name: 'Netherlands Antilles', code: 'AN' },
|
||||||
|
{ name: 'New Caledonia', code: 'NC' },
|
||||||
|
{ name: 'New Zealand', code: 'NZ' },
|
||||||
|
{ name: 'Nicaragua', code: 'NI' },
|
||||||
|
{ name: 'Niger', code: 'NE' },
|
||||||
|
{ name: 'Nigeria', code: 'NG' },
|
||||||
|
{ name: 'Niue', code: 'NU' },
|
||||||
|
{ name: 'Norfolk Island', code: 'NF' },
|
||||||
|
{ name: 'Northern Mariana Islands', code: 'MP' },
|
||||||
|
{ name: 'Norway', code: 'NO' },
|
||||||
|
{ name: 'Oman', code: 'OM' },
|
||||||
|
{ name: 'Pakistan', code: 'PK' },
|
||||||
|
{ name: 'Palau', code: 'PW' },
|
||||||
|
{ name: 'Palestinian Territory, Occupied', code: 'PS' },
|
||||||
|
{ name: 'Panama', code: 'PA' },
|
||||||
|
{ name: 'Papua New Guinea', code: 'PG' },
|
||||||
|
{ name: 'Paraguay', code: 'PY' },
|
||||||
|
{ name: 'Peru', code: 'PE' },
|
||||||
|
{ name: 'Philippines', code: 'PH' },
|
||||||
|
{ name: 'Pitcairn', code: 'PN' },
|
||||||
|
{ name: 'Poland', code: 'PL' },
|
||||||
|
{ name: 'Portugal', code: 'PT' },
|
||||||
|
{ name: 'Puerto Rico', code: 'PR' },
|
||||||
|
{ name: 'Qatar', code: 'QA' },
|
||||||
|
{ name: 'Reunion', code: 'RE' },
|
||||||
|
{ name: 'Romania', code: 'RO' },
|
||||||
|
{ name: 'Russian Federation', code: 'RU' },
|
||||||
|
{ name: 'RWANDA', code: 'RW' },
|
||||||
|
{ name: 'Saint Helena', code: 'SH' },
|
||||||
|
{ name: 'Saint Kitts and Nevis', code: 'KN' },
|
||||||
|
{ name: 'Saint Lucia', code: 'LC' },
|
||||||
|
{ name: 'Saint Pierre and Miquelon', code: 'PM' },
|
||||||
|
{ name: 'Saint Vincent and the Grenadines', code: 'VC' },
|
||||||
|
{ name: 'Samoa', code: 'WS' },
|
||||||
|
{ name: 'San Marino', code: 'SM' },
|
||||||
|
{ name: 'Sao Tome and Principe', code: 'ST' },
|
||||||
|
{ name: 'Saudi Arabia', code: 'SA' },
|
||||||
|
{ name: 'Senegal', code: 'SN' },
|
||||||
|
{ name: 'Serbia and Montenegro', code: 'CS' },
|
||||||
|
{ name: 'Seychelles', code: 'SC' },
|
||||||
|
{ name: 'Sierra Leone', code: 'SL' },
|
||||||
|
{ name: 'Singapore', code: 'SG' },
|
||||||
|
{ name: 'Slovakia', code: 'SK' },
|
||||||
|
{ name: 'Slovenia', code: 'SI' },
|
||||||
|
{ name: 'Solomon Islands', code: 'SB' },
|
||||||
|
{ name: 'Somalia', code: 'SO' },
|
||||||
|
{ name: 'South Africa', code: 'ZA' },
|
||||||
|
{ name: 'South Georgia and the South Sandwich Islands', code: 'GS' },
|
||||||
|
{ name: 'Spain', code: 'ES' },
|
||||||
|
{ name: 'Sri Lanka', code: 'LK' },
|
||||||
|
{ name: 'Sudan', code: 'SD' },
|
||||||
|
{ name: 'Suriname', code: 'SR' },
|
||||||
|
{ name: 'Svalbard and Jan Mayen', code: 'SJ' },
|
||||||
|
{ name: 'Swaziland', code: 'SZ' },
|
||||||
|
{ name: 'Sweden', code: 'SE' },
|
||||||
|
{ name: 'Switzerland', code: 'CH' },
|
||||||
|
{ name: 'Syrian Arab Republic', code: 'SY' },
|
||||||
|
{ name: 'Taiwan, Province of China', code: 'TW' },
|
||||||
|
{ name: 'Tajikistan', code: 'TJ' },
|
||||||
|
{ name: 'Tanzania, United Republic of', code: 'TZ' },
|
||||||
|
{ name: 'Thailand', code: 'TH' },
|
||||||
|
{ name: 'Timor-Leste', code: 'TL' },
|
||||||
|
{ name: 'Togo', code: 'TG' },
|
||||||
|
{ name: 'Tokelau', code: 'TK' },
|
||||||
|
{ name: 'Tonga', code: 'TO' },
|
||||||
|
{ name: 'Trinidad and Tobago', code: 'TT' },
|
||||||
|
{ name: 'Tunisia', code: 'TN' },
|
||||||
|
{ name: 'Turkey', code: 'TR' },
|
||||||
|
{ name: 'Turkmenistan', code: 'TM' },
|
||||||
|
{ name: 'Turks and Caicos Islands', code: 'TC' },
|
||||||
|
{ name: 'Tuvalu', code: 'TV' },
|
||||||
|
{ name: 'Uganda', code: 'UG' },
|
||||||
|
{ name: 'Ukraine', code: 'UA' },
|
||||||
|
{ name: 'United Arab Emirates', code: 'AE' },
|
||||||
|
{ name: 'United Kingdom', code: 'GB' },
|
||||||
|
{ name: 'United States Minor Outlying Islands', code: 'UM' },
|
||||||
|
{ name: 'Uruguay', code: 'UY' },
|
||||||
|
{ name: 'Uzbekistan', code: 'UZ' },
|
||||||
|
{ name: 'Vanuatu', code: 'VU' },
|
||||||
|
{ name: 'Venezuela', code: 'VE' },
|
||||||
|
{ name: 'Viet Nam', code: 'VN' },
|
||||||
|
{ name: 'Virgin Islands, British', code: 'VG' },
|
||||||
|
{ name: 'Virgin Islands, U.S.', code: 'VI' },
|
||||||
|
{ name: 'Wallis and Futuna', code: 'WF' },
|
||||||
|
{ name: 'Western Sahara', code: 'EH' },
|
||||||
|
{ name: 'Yemen', code: 'YE' },
|
||||||
|
{ name: 'Zambia', code: 'ZM' },
|
||||||
|
{ name: 'Zimbabwe', code: 'ZW' }
|
||||||
|
];
|
42
control/test/multi-select.unit.test.tsx
Normal file
42
control/test/multi-select.unit.test.tsx
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { h } from 'preact';
|
||||||
|
import { MultiSelect } from '../src/multi-select';
|
||||||
|
import { countries } from './countries';
|
||||||
|
import { query, shallow } from './preact-util';
|
||||||
|
|
||||||
|
const forceImportOfH = h;
|
||||||
|
|
||||||
|
describe('MultiSelect', () => {
|
||||||
|
it('renders with empty values', () => {
|
||||||
|
const tree = shallow(
|
||||||
|
<MultiSelect
|
||||||
|
itemId='id'
|
||||||
|
itemLabel='text'
|
||||||
|
valuesLabel='Selected Values'
|
||||||
|
comboboxLabel='Add Value'
|
||||||
|
values={[]}
|
||||||
|
query={query}
|
||||||
|
onChange={() => {
|
||||||
|
/* noop */
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders with values', () => {
|
||||||
|
const tree = shallow(
|
||||||
|
<MultiSelect
|
||||||
|
itemId='id'
|
||||||
|
itemLabel='text'
|
||||||
|
valuesLabel='Selected Values'
|
||||||
|
comboboxLabel='Add Value'
|
||||||
|
values={[countries[0], countries[1]]}
|
||||||
|
query={query}
|
||||||
|
onChange={() => {
|
||||||
|
/* noop */
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
36
control/test/preact-util.ts
Normal file
36
control/test/preact-util.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { VNode } from 'preact';
|
||||||
|
import { render as renderToString, shallowRender as shallowRenderToString } from 'preact-render-to-string';
|
||||||
|
import * as pretty from 'pretty';
|
||||||
|
import { QueryFunction } from '../src/abstract-select';
|
||||||
|
import { countries } from './countries';
|
||||||
|
|
||||||
|
export function shallow(component: VNode): string {
|
||||||
|
return pretty(shallowRenderToString(component), { ocd: true });
|
||||||
|
}
|
||||||
|
export function deep(component: VNode): string {
|
||||||
|
return pretty(renderToString(component), { ocd: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
export const query: QueryFunction = (search, page, token) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
const results: any[] = [];
|
||||||
|
let count = 0;
|
||||||
|
const limit = 10;
|
||||||
|
const offset = page * limit;
|
||||||
|
for (const country of countries) {
|
||||||
|
if (country.name.toLowerCase().indexOf(search.toLowerCase()) >= 0) {
|
||||||
|
if (count >= offset) {
|
||||||
|
results.push(country);
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
if (count >= offset + limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
more: results.length >= limit,
|
||||||
|
token,
|
||||||
|
values: results
|
||||||
|
});
|
||||||
|
});
|
9
control/test/test1.int.test.ts
Normal file
9
control/test/test1.int.test.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
describe('Google', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
await page.goto('https://google.com');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be titled "Google"', async () => {
|
||||||
|
await expect(page.title()).resolves.toMatch('Google');
|
||||||
|
});
|
||||||
|
});
|
246
dev/countries-data.js
Normal file
246
dev/countries-data.js
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
window.select2countries = [
|
||||||
|
{ name: 'United States', code: 'US' },
|
||||||
|
{ name: 'Mexico', code: 'MX' },
|
||||||
|
|
||||||
|
{ name: 'Afghanistan', code: 'AF' },
|
||||||
|
{ name: 'Aland Islands', code: 'AX' },
|
||||||
|
{ name: 'Albania', code: 'AL' },
|
||||||
|
{ name: 'Algeria', code: 'DZ' },
|
||||||
|
{ name: 'American Samoa', code: 'AS' },
|
||||||
|
{ name: 'Andorra', code: 'AD' },
|
||||||
|
{ name: 'Angola', code: 'AO' },
|
||||||
|
{ name: 'Anguilla', code: 'AI' },
|
||||||
|
{ name: 'Antarctica', code: 'AQ' },
|
||||||
|
{ name: 'Antigua and Barbuda', code: 'AG' },
|
||||||
|
{ name: 'Argentina', code: 'AR' },
|
||||||
|
{ name: 'Armenia', code: 'AM' },
|
||||||
|
{ name: 'Aruba', code: 'AW' },
|
||||||
|
{ name: 'Australia', code: 'AU' },
|
||||||
|
{ name: 'Austria', code: 'AT' },
|
||||||
|
{ name: 'Azerbaijan', code: 'AZ' },
|
||||||
|
{ name: 'Bahamas', code: 'BS' },
|
||||||
|
{ name: 'Bahrain', code: 'BH' },
|
||||||
|
{ name: 'Bangladesh', code: 'BD' },
|
||||||
|
{ name: 'Barbados', code: 'BB' },
|
||||||
|
{ name: 'Belarus', code: 'BY' },
|
||||||
|
{ name: 'Belgium', code: 'BE' },
|
||||||
|
{ name: 'Belize', code: 'BZ' },
|
||||||
|
{ name: 'Benin', code: 'BJ' },
|
||||||
|
{ name: 'Bermuda', code: 'BM' },
|
||||||
|
{ name: 'Bhutan', code: 'BT' },
|
||||||
|
{ name: 'Bolivia', code: 'BO' },
|
||||||
|
{ name: 'Bosnia and Herzegovina', code: 'BA' },
|
||||||
|
{ name: 'Botswana', code: 'BW' },
|
||||||
|
{ name: 'Bouvet Island', code: 'BV' },
|
||||||
|
{ name: 'Brazil', code: 'BR' },
|
||||||
|
{ name: 'British Indian Ocean Territory', code: 'IO' },
|
||||||
|
{ name: 'Brunei Darussalam', code: 'BN' },
|
||||||
|
{ name: 'Bulgaria', code: 'BG' },
|
||||||
|
{ name: 'Burkina Faso', code: 'BF' },
|
||||||
|
{ name: 'Burundi', code: 'BI' },
|
||||||
|
{ name: 'Cambodia', code: 'KH' },
|
||||||
|
{ name: 'Cameroon', code: 'CM' },
|
||||||
|
{ name: 'Canada', code: 'CA' },
|
||||||
|
{ name: 'Cape Verde', code: 'CV' },
|
||||||
|
{ name: 'Cayman Islands', code: 'KY' },
|
||||||
|
{ name: 'Central African Republic', code: 'CF' },
|
||||||
|
{ name: 'Chad', code: 'TD' },
|
||||||
|
{ name: 'Chile', code: 'CL' },
|
||||||
|
{ name: 'China', code: 'CN' },
|
||||||
|
{ name: 'Christmas Island', code: 'CX' },
|
||||||
|
{ name: 'Cocos (Keeling) Islands', code: 'CC' },
|
||||||
|
{ name: 'Colombia', code: 'CO' },
|
||||||
|
{ name: 'Comoros', code: 'KM' },
|
||||||
|
{ name: 'Congo', code: 'CG' },
|
||||||
|
{ name: 'Congo, The Democratic Republic of the', code: 'CD' },
|
||||||
|
{ name: 'Cook Islands', code: 'CK' },
|
||||||
|
{ name: 'Costa Rica', code: 'CR' },
|
||||||
|
{ name: "Cote D'Ivoire", code: 'CI' },
|
||||||
|
{ name: 'Croatia', code: 'HR' },
|
||||||
|
{ name: 'Cuba', code: 'CU' },
|
||||||
|
{ name: 'Cyprus', code: 'CY' },
|
||||||
|
{ name: 'Czech Republic', code: 'CZ' },
|
||||||
|
{ name: 'Denmark', code: 'DK' },
|
||||||
|
{ name: 'Djibouti', code: 'DJ' },
|
||||||
|
{ name: 'Dominica', code: 'DM' },
|
||||||
|
{ name: 'Dominican Republic', code: 'DO' },
|
||||||
|
{ name: 'Ecuador', code: 'EC' },
|
||||||
|
{ name: 'Egypt', code: 'EG' },
|
||||||
|
{ name: 'El Salvador', code: 'SV' },
|
||||||
|
{ name: 'Equatorial Guinea', code: 'GQ' },
|
||||||
|
{ name: 'Eritrea', code: 'ER' },
|
||||||
|
{ name: 'Estonia', code: 'EE' },
|
||||||
|
{ name: 'Ethiopia', code: 'ET' },
|
||||||
|
{ name: 'Falkland Islands (Malvinas)', code: 'FK' },
|
||||||
|
{ name: 'Faroe Islands', code: 'FO' },
|
||||||
|
{ name: 'Fiji', code: 'FJ' },
|
||||||
|
{ name: 'Finland', code: 'FI' },
|
||||||
|
{ name: 'France', code: 'FR' },
|
||||||
|
{ name: 'French Guiana', code: 'GF' },
|
||||||
|
{ name: 'French Polynesia', code: 'PF' },
|
||||||
|
{ name: 'French Southern Territories', code: 'TF' },
|
||||||
|
{ name: 'Gabon', code: 'GA' },
|
||||||
|
{ name: 'Gambia', code: 'GM' },
|
||||||
|
{ name: 'Georgia', code: 'GE' },
|
||||||
|
{ name: 'Germany', code: 'DE' },
|
||||||
|
{ name: 'Ghana', code: 'GH' },
|
||||||
|
{ name: 'Gibraltar', code: 'GI' },
|
||||||
|
{ name: 'Greece', code: 'GR' },
|
||||||
|
{ name: 'Greenland', code: 'GL' },
|
||||||
|
{ name: 'Grenada', code: 'GD' },
|
||||||
|
{ name: 'Guadeloupe', code: 'GP' },
|
||||||
|
{ name: 'Guam', code: 'GU' },
|
||||||
|
{ name: 'Guatemala', code: 'GT' },
|
||||||
|
{ name: 'Guernsey', code: 'GG' },
|
||||||
|
{ name: 'Guinea', code: 'GN' },
|
||||||
|
{ name: 'Guinea-Bissau', code: 'GW' },
|
||||||
|
{ name: 'Guyana', code: 'GY' },
|
||||||
|
{ name: 'Haiti', code: 'HT' },
|
||||||
|
{ name: 'Heard Island and Mcdonald Islands', code: 'HM' },
|
||||||
|
{ name: 'Holy See (Vatican City State)', code: 'VA' },
|
||||||
|
{ name: 'Honduras', code: 'HN' },
|
||||||
|
{ name: 'Hong Kong', code: 'HK' },
|
||||||
|
{ name: 'Hungary', code: 'HU' },
|
||||||
|
{ name: 'Iceland', code: 'IS' },
|
||||||
|
{ name: 'India', code: 'IN' },
|
||||||
|
{ name: 'Indonesia', code: 'ID' },
|
||||||
|
{ name: 'Iran, Islamic Republic Of', code: 'IR' },
|
||||||
|
{ name: 'Iraq', code: 'IQ' },
|
||||||
|
{ name: 'Ireland', code: 'IE' },
|
||||||
|
{ name: 'Isle of Man', code: 'IM' },
|
||||||
|
{ name: 'Israel', code: 'IL' },
|
||||||
|
{ name: 'Italy', code: 'IT' },
|
||||||
|
{ name: 'Jamaica', code: 'JM' },
|
||||||
|
{ name: 'Japan', code: 'JP' },
|
||||||
|
{ name: 'Jersey', code: 'JE' },
|
||||||
|
{ name: 'Jordan', code: 'JO' },
|
||||||
|
{ name: 'Kazakhstan', code: 'KZ' },
|
||||||
|
{ name: 'Kenya', code: 'KE' },
|
||||||
|
{ name: 'Kiribati', code: 'KI' },
|
||||||
|
{ name: "Korea, Democratic People'S Republic of", code: 'KP' },
|
||||||
|
{ name: 'Korea, Republic of', code: 'KR' },
|
||||||
|
{ name: 'Kuwait', code: 'KW' },
|
||||||
|
{ name: 'Kyrgyzstan', code: 'KG' },
|
||||||
|
{ name: "Lao People'S Democratic Republic", code: 'LA' },
|
||||||
|
{ name: 'Latvia', code: 'LV' },
|
||||||
|
{ name: 'Lebanon', code: 'LB' },
|
||||||
|
{ name: 'Lesotho', code: 'LS' },
|
||||||
|
{ name: 'Liberia', code: 'LR' },
|
||||||
|
{ name: 'Libyan Arab Jamahiriya', code: 'LY' },
|
||||||
|
{ name: 'Liechtenstein', code: 'LI' },
|
||||||
|
{ name: 'Lithuania', code: 'LT' },
|
||||||
|
{ name: 'Luxembourg', code: 'LU' },
|
||||||
|
{ name: 'Macao', code: 'MO' },
|
||||||
|
{ name: 'Macedonia, The Former Yugoslav Republic of', code: 'MK' },
|
||||||
|
{ name: 'Madagascar', code: 'MG' },
|
||||||
|
{ name: 'Malawi', code: 'MW' },
|
||||||
|
{ name: 'Malaysia', code: 'MY' },
|
||||||
|
{ name: 'Maldives', code: 'MV' },
|
||||||
|
{ name: 'Mali', code: 'ML' },
|
||||||
|
{ name: 'Malta', code: 'MT' },
|
||||||
|
{ name: 'Marshall Islands', code: 'MH' },
|
||||||
|
{ name: 'Martinique', code: 'MQ' },
|
||||||
|
{ name: 'Mauritania', code: 'MR' },
|
||||||
|
{ name: 'Mauritius', code: 'MU' },
|
||||||
|
{ name: 'Mayotte', code: 'YT' },
|
||||||
|
{ name: 'Micronesia, Federated States of', code: 'FM' },
|
||||||
|
{ name: 'Moldova, Republic of', code: 'MD' },
|
||||||
|
{ name: 'Monaco', code: 'MC' },
|
||||||
|
{ name: 'Mongolia', code: 'MN' },
|
||||||
|
{ name: 'Montserrat', code: 'MS' },
|
||||||
|
{ name: 'Morocco', code: 'MA' },
|
||||||
|
{ name: 'Mozambique', code: 'MZ' },
|
||||||
|
{ name: 'Myanmar', code: 'MM' },
|
||||||
|
{ name: 'Namibia', code: 'NA' },
|
||||||
|
{ name: 'Nauru', code: 'NR' },
|
||||||
|
{ name: 'Nepal', code: 'NP' },
|
||||||
|
{ name: 'Netherlands', code: 'NL' },
|
||||||
|
{ name: 'Netherlands Antilles', code: 'AN' },
|
||||||
|
{ name: 'New Caledonia', code: 'NC' },
|
||||||
|
{ name: 'New Zealand', code: 'NZ' },
|
||||||
|
{ name: 'Nicaragua', code: 'NI' },
|
||||||
|
{ name: 'Niger', code: 'NE' },
|
||||||
|
{ name: 'Nigeria', code: 'NG' },
|
||||||
|
{ name: 'Niue', code: 'NU' },
|
||||||
|
{ name: 'Norfolk Island', code: 'NF' },
|
||||||
|
{ name: 'Northern Mariana Islands', code: 'MP' },
|
||||||
|
{ name: 'Norway', code: 'NO' },
|
||||||
|
{ name: 'Oman', code: 'OM' },
|
||||||
|
{ name: 'Pakistan', code: 'PK' },
|
||||||
|
{ name: 'Palau', code: 'PW' },
|
||||||
|
{ name: 'Palestinian Territory, Occupied', code: 'PS' },
|
||||||
|
{ name: 'Panama', code: 'PA' },
|
||||||
|
{ name: 'Papua New Guinea', code: 'PG' },
|
||||||
|
{ name: 'Paraguay', code: 'PY' },
|
||||||
|
{ name: 'Peru', code: 'PE' },
|
||||||
|
{ name: 'Philippines', code: 'PH' },
|
||||||
|
{ name: 'Pitcairn', code: 'PN' },
|
||||||
|
{ name: 'Poland', code: 'PL' },
|
||||||
|
{ name: 'Portugal', code: 'PT' },
|
||||||
|
{ name: 'Puerto Rico', code: 'PR' },
|
||||||
|
{ name: 'Qatar', code: 'QA' },
|
||||||
|
{ name: 'Reunion', code: 'RE' },
|
||||||
|
{ name: 'Romania', code: 'RO' },
|
||||||
|
{ name: 'Russian Federation', code: 'RU' },
|
||||||
|
{ name: 'RWANDA', code: 'RW' },
|
||||||
|
{ name: 'Saint Helena', code: 'SH' },
|
||||||
|
{ name: 'Saint Kitts and Nevis', code: 'KN' },
|
||||||
|
{ name: 'Saint Lucia', code: 'LC' },
|
||||||
|
{ name: 'Saint Pierre and Miquelon', code: 'PM' },
|
||||||
|
{ name: 'Saint Vincent and the Grenadines', code: 'VC' },
|
||||||
|
{ name: 'Samoa', code: 'WS' },
|
||||||
|
{ name: 'San Marino', code: 'SM' },
|
||||||
|
{ name: 'Sao Tome and Principe', code: 'ST' },
|
||||||
|
{ name: 'Saudi Arabia', code: 'SA' },
|
||||||
|
{ name: 'Senegal', code: 'SN' },
|
||||||
|
{ name: 'Serbia and Montenegro', code: 'CS' },
|
||||||
|
{ name: 'Seychelles', code: 'SC' },
|
||||||
|
{ name: 'Sierra Leone', code: 'SL' },
|
||||||
|
{ name: 'Singapore', code: 'SG' },
|
||||||
|
{ name: 'Slovakia', code: 'SK' },
|
||||||
|
{ name: 'Slovenia', code: 'SI' },
|
||||||
|
{ name: 'Solomon Islands', code: 'SB' },
|
||||||
|
{ name: 'Somalia', code: 'SO' },
|
||||||
|
{ name: 'South Africa', code: 'ZA' },
|
||||||
|
{ name: 'South Georgia and the South Sandwich Islands', code: 'GS' },
|
||||||
|
{ name: 'Spain', code: 'ES' },
|
||||||
|
{ name: 'Sri Lanka', code: 'LK' },
|
||||||
|
{ name: 'Sudan', code: 'SD' },
|
||||||
|
{ name: 'Suriname', code: 'SR' },
|
||||||
|
{ name: 'Svalbard and Jan Mayen', code: 'SJ' },
|
||||||
|
{ name: 'Swaziland', code: 'SZ' },
|
||||||
|
{ name: 'Sweden', code: 'SE' },
|
||||||
|
{ name: 'Switzerland', code: 'CH' },
|
||||||
|
{ name: 'Syrian Arab Republic', code: 'SY' },
|
||||||
|
{ name: 'Taiwan, Province of China', code: 'TW' },
|
||||||
|
{ name: 'Tajikistan', code: 'TJ' },
|
||||||
|
{ name: 'Tanzania, United Republic of', code: 'TZ' },
|
||||||
|
{ name: 'Thailand', code: 'TH' },
|
||||||
|
{ name: 'Timor-Leste', code: 'TL' },
|
||||||
|
{ name: 'Togo', code: 'TG' },
|
||||||
|
{ name: 'Tokelau', code: 'TK' },
|
||||||
|
{ name: 'Tonga', code: 'TO' },
|
||||||
|
{ name: 'Trinidad and Tobago', code: 'TT' },
|
||||||
|
{ name: 'Tunisia', code: 'TN' },
|
||||||
|
{ name: 'Turkey', code: 'TR' },
|
||||||
|
{ name: 'Turkmenistan', code: 'TM' },
|
||||||
|
{ name: 'Turks and Caicos Islands', code: 'TC' },
|
||||||
|
{ name: 'Tuvalu', code: 'TV' },
|
||||||
|
{ name: 'Uganda', code: 'UG' },
|
||||||
|
{ name: 'Ukraine', code: 'UA' },
|
||||||
|
{ name: 'United Arab Emirates', code: 'AE' },
|
||||||
|
{ name: 'United Kingdom', code: 'GB' },
|
||||||
|
{ name: 'United States Minor Outlying Islands', code: 'UM' },
|
||||||
|
{ name: 'Uruguay', code: 'UY' },
|
||||||
|
{ name: 'Uzbekistan', code: 'UZ' },
|
||||||
|
{ name: 'Vanuatu', code: 'VU' },
|
||||||
|
{ name: 'Venezuela', code: 'VE' },
|
||||||
|
{ name: 'Viet Nam', code: 'VN' },
|
||||||
|
{ name: 'Virgin Islands, British', code: 'VG' },
|
||||||
|
{ name: 'Virgin Islands, U.S.', code: 'VI' },
|
||||||
|
{ name: 'Wallis and Futuna', code: 'WF' },
|
||||||
|
{ name: 'Western Sahara', code: 'EH' },
|
||||||
|
{ name: 'Yemen', code: 'YE' },
|
||||||
|
{ name: 'Zambia', code: 'ZM' },
|
||||||
|
{ name: 'Zimbabwe', code: 'ZW' }
|
||||||
|
];
|
1328
dev/dist/countries-data.fd391f61.js
vendored
Normal file
1328
dev/dist/countries-data.fd391f61.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
dev/dist/countries-data.fd391f61.js.map
vendored
Normal file
1
dev/dist/countries-data.fd391f61.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
131
dev/dist/index.html
vendored
Normal file
131
dev/dist/index.html
vendored
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<!-- polyfill for IE11 -->
|
||||||
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>
|
||||||
|
<script src="/select25.63904fcd.js"></script>
|
||||||
|
<script src="/countries-data.fd391f61.js"></script>
|
||||||
|
<link rel="stylesheet" href="/select25.e5b29622.css">
|
||||||
|
<link rel="stylesheet" href="/select25.63904fcd.css"><script src="/select25.e5b29622.js"></script></head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
<input type="text" value="focus grabber 1" autofocus="">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<section style="width:450px">
|
||||||
|
<input type="hidden" id="countries1">
|
||||||
|
</section>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="button" id="destroy-multi" value="destroy">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="text" value="focus grabber 2">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<section style="width:450px">
|
||||||
|
<input type="hidden" id="countries2">
|
||||||
|
</section>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="text" value="focus grabber 3">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="select1">Select Single</label>
|
||||||
|
<select id="select1">
|
||||||
|
<option>first</option>
|
||||||
|
<option>second</option>
|
||||||
|
<option selected="">third</option>
|
||||||
|
<option>fourth</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="select2">Select Multiple</label>
|
||||||
|
<select id="select2" multiple="">
|
||||||
|
<option>first</option>
|
||||||
|
<option selected="">second</option>
|
||||||
|
<option selected="">third</option>
|
||||||
|
<option>fourth</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script>var query = function () {
|
||||||
|
// local implementation of query that simulates network delay
|
||||||
|
var countries = window.select2countries;
|
||||||
|
var previousTimeout = undefined;
|
||||||
|
var previousReject = undefined;
|
||||||
|
return function (search, page, token) {
|
||||||
|
if (previousReject != undefined) {
|
||||||
|
previousReject(new Error('cancelled'));
|
||||||
|
window.clearTimeout(previousTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
var delay = 150;
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
previousReject = reject;
|
||||||
|
previousTimeout = window.setTimeout(function () {
|
||||||
|
var results = [];
|
||||||
|
var count = 0;
|
||||||
|
var limit = 10;
|
||||||
|
var offset = page * limit;
|
||||||
|
|
||||||
|
for (var i = 0; i < countries.length; i++) {
|
||||||
|
var country = countries[i];
|
||||||
|
|
||||||
|
if (country.name.toLowerCase().indexOf(search.toLowerCase()) >= 0) {
|
||||||
|
if (count >= offset) {
|
||||||
|
results.push(country);
|
||||||
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (count >= offset + limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
previousTimeout = undefined;
|
||||||
|
previousReject = undefined;
|
||||||
|
resolve({
|
||||||
|
values: results,
|
||||||
|
more: results.length >= limit,
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
}, delay);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
document.getElementById('countries1').addEventListener("change", function (event) {
|
||||||
|
console.log("onchange fired on countries1", event);
|
||||||
|
});
|
||||||
|
window.select25.create(document.getElementById('countries1'), {
|
||||||
|
valuesLabel: "Selected Countries",
|
||||||
|
comboboxLabel: "Add Country",
|
||||||
|
itemId: 'code',
|
||||||
|
itemLabel: 'name',
|
||||||
|
minimumCharacters: 2,
|
||||||
|
multiple: true,
|
||||||
|
query: query,
|
||||||
|
quiet: 100,
|
||||||
|
values: [window.select2countries[0], window.select2countries[1], window.select2countries[1]]
|
||||||
|
});
|
||||||
|
document.getElementById("destroy-multi").addEventListener("click", function () {
|
||||||
|
window.select25.destroy(document.getElementById("countries1"));
|
||||||
|
});
|
||||||
|
window.select25.create(document.getElementById('countries2'), {
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: "Select Country",
|
||||||
|
itemId: 'code',
|
||||||
|
itemLabel: 'name',
|
||||||
|
minimumCharacters: 2,
|
||||||
|
query: query,
|
||||||
|
quiet: 100,
|
||||||
|
value: window.select2countries[0]
|
||||||
|
});</script>
|
||||||
|
|
||||||
|
</html>
|
431
dev/dist/index.js
vendored
Normal file
431
dev/dist/index.js
vendored
Normal file
@ -0,0 +1,431 @@
|
|||||||
|
// modules are defined as an array
|
||||||
|
// [ module function, map of requires ]
|
||||||
|
//
|
||||||
|
// map of requires is short require name -> numeric require
|
||||||
|
//
|
||||||
|
// anything defined in a previous bundle is accessed via the
|
||||||
|
// orig method which is the require for previous bundles
|
||||||
|
parcelRequire = (function(modules, cache, entry, globalName) {
|
||||||
|
// Save the require from previous bundle to this closure if any
|
||||||
|
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
|
||||||
|
var nodeRequire = typeof require === 'function' && require;
|
||||||
|
|
||||||
|
function newRequire(name, jumped) {
|
||||||
|
if (!cache[name]) {
|
||||||
|
if (!modules[name]) {
|
||||||
|
// if we cannot find the module within our internal map or
|
||||||
|
// cache jump to the current global require ie. the last bundle
|
||||||
|
// that was added to the page.
|
||||||
|
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
|
||||||
|
if (!jumped && currentRequire) {
|
||||||
|
return currentRequire(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are other bundles on this page the require from the
|
||||||
|
// previous one is saved to 'previousRequire'. Repeat this as
|
||||||
|
// many times as there are bundles until the module is found or
|
||||||
|
// we exhaust the require chain.
|
||||||
|
if (previousRequire) {
|
||||||
|
return previousRequire(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try the node require function if it exists.
|
||||||
|
if (nodeRequire && typeof name === 'string') {
|
||||||
|
return nodeRequire(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
var err = new Error("Cannot find module '" + name + "'");
|
||||||
|
err.code = 'MODULE_NOT_FOUND';
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
localRequire.resolve = resolve;
|
||||||
|
localRequire.cache = {};
|
||||||
|
|
||||||
|
var module = (cache[name] = new newRequire.Module(name));
|
||||||
|
|
||||||
|
modules[name][0].call(module.exports, localRequire, module, module.exports, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache[name].exports;
|
||||||
|
|
||||||
|
function localRequire(x) {
|
||||||
|
return newRequire(localRequire.resolve(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolve(x) {
|
||||||
|
return modules[name][1][x] || x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Module(moduleName) {
|
||||||
|
this.id = moduleName;
|
||||||
|
this.bundle = newRequire;
|
||||||
|
this.exports = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
newRequire.isParcelRequire = true;
|
||||||
|
newRequire.Module = Module;
|
||||||
|
newRequire.modules = modules;
|
||||||
|
newRequire.cache = cache;
|
||||||
|
newRequire.parent = previousRequire;
|
||||||
|
newRequire.register = function(id, exports) {
|
||||||
|
modules[id] = [
|
||||||
|
function(require, module) {
|
||||||
|
module.exports = exports;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
var error;
|
||||||
|
for (var i = 0; i < entry.length; i++) {
|
||||||
|
try {
|
||||||
|
newRequire(entry[i]);
|
||||||
|
} catch (e) {
|
||||||
|
// Save first error but execute all entries
|
||||||
|
if (!error) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.length) {
|
||||||
|
// Expose entry point to Node, AMD or browser globals
|
||||||
|
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||||
|
var mainExports = newRequire(entry[entry.length - 1]);
|
||||||
|
|
||||||
|
// CommonJS
|
||||||
|
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||||
|
module.exports = mainExports;
|
||||||
|
|
||||||
|
// RequireJS
|
||||||
|
} else if (typeof define === 'function' && define.amd) {
|
||||||
|
define(function() {
|
||||||
|
return mainExports;
|
||||||
|
});
|
||||||
|
|
||||||
|
// <script>
|
||||||
|
} else if (globalName) {
|
||||||
|
this[globalName] = mainExports;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override the current require with this new one
|
||||||
|
parcelRequire = newRequire;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
// throw error from earlier, _after updating parcelRequire_
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newRequire;
|
||||||
|
})(
|
||||||
|
{
|
||||||
|
'../node_modules/parcel-bundler/src/builtins/bundle-url.js': [
|
||||||
|
function(require, module, exports) {
|
||||||
|
var bundleURL = null;
|
||||||
|
|
||||||
|
function getBundleURLCached() {
|
||||||
|
if (!bundleURL) {
|
||||||
|
bundleURL = getBundleURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bundleURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBundleURL() {
|
||||||
|
// Attempt to find the URL of the current script and use that as the base URL
|
||||||
|
try {
|
||||||
|
throw new Error();
|
||||||
|
} catch (err) {
|
||||||
|
var matches = ('' + err.stack).match(
|
||||||
|
/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matches) {
|
||||||
|
return getBaseURL(matches[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBaseURL(url) {
|
||||||
|
return (
|
||||||
|
('' + url).replace(
|
||||||
|
/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)\/[^/]+$/,
|
||||||
|
'$1'
|
||||||
|
) + '/'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.getBundleURL = getBundleURLCached;
|
||||||
|
exports.getBaseURL = getBaseURL;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
'../node_modules/parcel-bundler/src/builtins/css-loader.js': [
|
||||||
|
function(require, module, exports) {
|
||||||
|
var bundle = require('./bundle-url');
|
||||||
|
|
||||||
|
function updateLink(link) {
|
||||||
|
var newLink = link.cloneNode();
|
||||||
|
|
||||||
|
newLink.onload = function() {
|
||||||
|
link.remove();
|
||||||
|
};
|
||||||
|
|
||||||
|
newLink.href = link.href.split('?')[0] + '?' + Date.now();
|
||||||
|
link.parentNode.insertBefore(newLink, link.nextSibling);
|
||||||
|
}
|
||||||
|
|
||||||
|
var cssTimeout = null;
|
||||||
|
|
||||||
|
function reloadCSS() {
|
||||||
|
if (cssTimeout) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cssTimeout = setTimeout(function() {
|
||||||
|
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
||||||
|
|
||||||
|
for (var i = 0; i < links.length; i++) {
|
||||||
|
if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) {
|
||||||
|
updateLink(links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cssTimeout = null;
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = reloadCSS;
|
||||||
|
},
|
||||||
|
{ './bundle-url': '../node_modules/parcel-bundler/src/builtins/bundle-url.js' }
|
||||||
|
],
|
||||||
|
'../node_modules/parcel-bundler/src/builtins/hmr-runtime.js': [
|
||||||
|
function(require, module, exports) {
|
||||||
|
var global = arguments[3];
|
||||||
|
var OVERLAY_ID = '__parcel__error__overlay__';
|
||||||
|
var OldModule = module.bundle.Module;
|
||||||
|
|
||||||
|
function Module(moduleName) {
|
||||||
|
OldModule.call(this, moduleName);
|
||||||
|
this.hot = {
|
||||||
|
data: module.bundle.hotData,
|
||||||
|
_acceptCallbacks: [],
|
||||||
|
_disposeCallbacks: [],
|
||||||
|
accept: function(fn) {
|
||||||
|
this._acceptCallbacks.push(fn || function() {});
|
||||||
|
},
|
||||||
|
dispose: function(fn) {
|
||||||
|
this._disposeCallbacks.push(fn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
module.bundle.hotData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.bundle.Module = Module;
|
||||||
|
var checkedAssets, assetsToAccept;
|
||||||
|
var parent = module.bundle.parent;
|
||||||
|
|
||||||
|
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||||
|
var hostname = '' || location.hostname;
|
||||||
|
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
|
var ws = new WebSocket(protocol + '://' + hostname + ':' + '57136' + '/');
|
||||||
|
|
||||||
|
ws.onmessage = function(event) {
|
||||||
|
checkedAssets = {};
|
||||||
|
assetsToAccept = [];
|
||||||
|
var data = JSON.parse(event.data);
|
||||||
|
|
||||||
|
if (data.type === 'update') {
|
||||||
|
var handled = false;
|
||||||
|
data.assets.forEach(function(asset) {
|
||||||
|
if (!asset.isNew) {
|
||||||
|
var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);
|
||||||
|
|
||||||
|
if (didAccept) {
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}); // Enable HMR for CSS by default.
|
||||||
|
|
||||||
|
handled =
|
||||||
|
handled ||
|
||||||
|
data.assets.every(function(asset) {
|
||||||
|
return asset.type === 'css' && asset.generated.js;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (handled) {
|
||||||
|
console.clear();
|
||||||
|
data.assets.forEach(function(asset) {
|
||||||
|
hmrApply(global.parcelRequire, asset);
|
||||||
|
});
|
||||||
|
assetsToAccept.forEach(function(v) {
|
||||||
|
hmrAcceptRun(v[0], v[1]);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'reload') {
|
||||||
|
ws.close();
|
||||||
|
|
||||||
|
ws.onclose = function() {
|
||||||
|
location.reload();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'error-resolved') {
|
||||||
|
console.log('[parcel] ✨ Error resolved');
|
||||||
|
removeErrorOverlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'error') {
|
||||||
|
console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
|
||||||
|
removeErrorOverlay();
|
||||||
|
var overlay = createErrorOverlay(data);
|
||||||
|
document.body.appendChild(overlay);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeErrorOverlay() {
|
||||||
|
var overlay = document.getElementById(OVERLAY_ID);
|
||||||
|
|
||||||
|
if (overlay) {
|
||||||
|
overlay.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createErrorOverlay(data) {
|
||||||
|
var overlay = document.createElement('div');
|
||||||
|
overlay.id = OVERLAY_ID; // html encode message and stack trace
|
||||||
|
|
||||||
|
var message = document.createElement('div');
|
||||||
|
var stackTrace = document.createElement('pre');
|
||||||
|
message.innerText = data.error.message;
|
||||||
|
stackTrace.innerText = data.error.stack;
|
||||||
|
overlay.innerHTML =
|
||||||
|
'<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' +
|
||||||
|
'<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' +
|
||||||
|
'<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' +
|
||||||
|
'<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' +
|
||||||
|
message.innerHTML +
|
||||||
|
'</div>' +
|
||||||
|
'<pre>' +
|
||||||
|
stackTrace.innerHTML +
|
||||||
|
'</pre>' +
|
||||||
|
'</div>';
|
||||||
|
return overlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getParents(bundle, id) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
|
||||||
|
if (!modules) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var parents = [];
|
||||||
|
var k, d, dep;
|
||||||
|
|
||||||
|
for (k in modules) {
|
||||||
|
for (d in modules[k][1]) {
|
||||||
|
dep = modules[k][1][d];
|
||||||
|
|
||||||
|
if (dep === id || (Array.isArray(dep) && dep[dep.length - 1] === id)) {
|
||||||
|
parents.push(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bundle.parent) {
|
||||||
|
parents = parents.concat(getParents(bundle.parent, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hmrApply(bundle, asset) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
|
||||||
|
if (!modules) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modules[asset.id] || !bundle.parent) {
|
||||||
|
var fn = new Function('require', 'module', 'exports', asset.generated.js);
|
||||||
|
asset.isNew = !modules[asset.id];
|
||||||
|
modules[asset.id] = [fn, asset.deps];
|
||||||
|
} else if (bundle.parent) {
|
||||||
|
hmrApply(bundle.parent, asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hmrAcceptCheck(bundle, id) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
|
||||||
|
if (!modules) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modules[id] && bundle.parent) {
|
||||||
|
return hmrAcceptCheck(bundle.parent, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkedAssets[id]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkedAssets[id] = true;
|
||||||
|
var cached = bundle.cache[id];
|
||||||
|
assetsToAccept.push([bundle, id]);
|
||||||
|
|
||||||
|
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getParents(global.parcelRequire, id).some(function(id) {
|
||||||
|
return hmrAcceptCheck(global.parcelRequire, id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function hmrAcceptRun(bundle, id) {
|
||||||
|
var cached = bundle.cache[id];
|
||||||
|
bundle.hotData = {};
|
||||||
|
|
||||||
|
if (cached) {
|
||||||
|
cached.hot.data = bundle.hotData;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
|
||||||
|
cached.hot._disposeCallbacks.forEach(function(cb) {
|
||||||
|
cb(bundle.hotData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
delete bundle.cache[id];
|
||||||
|
bundle(id);
|
||||||
|
cached = bundle.cache[id];
|
||||||
|
|
||||||
|
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
||||||
|
cached.hot._acceptCallbacks.forEach(function(cb) {
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
['../node_modules/parcel-bundler/src/builtins/hmr-runtime.js'],
|
||||||
|
null
|
||||||
|
);
|
||||||
|
//# sourceMappingURL=/index.js.map
|
1
dev/dist/index.js.map
vendored
Normal file
1
dev/dist/index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
261
dev/dist/select25.63904fcd.css
vendored
Normal file
261
dev/dist/select25.63904fcd.css
vendored
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
.s25-hidden-accessible {
|
||||||
|
border: 0 !important;
|
||||||
|
clip: rect(0 0 0 0) !important;
|
||||||
|
-webkit-clip-path: inset(50%) !important;
|
||||||
|
clip-path: inset(50%) !important;
|
||||||
|
height: 1px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
position: absolute !important;
|
||||||
|
width: 1px !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-search {
|
||||||
|
font-size: 100%;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
.s25-search:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-control {
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: 36px;
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.s25-control.s25-focused {
|
||||||
|
border: 1px solid #4d90fe;
|
||||||
|
}
|
||||||
|
.s25-control.s25-focused.s25-open {
|
||||||
|
border-bottom: none;
|
||||||
|
border-radius: 5px 5px 0 0;
|
||||||
|
}
|
||||||
|
.s25-control .s25-body {
|
||||||
|
margin: 3px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.s25-control .s25-toggle:focus {
|
||||||
|
outline: 0px;
|
||||||
|
}
|
||||||
|
.s25-control .s25-toggle svg {
|
||||||
|
display: inline-block;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.s25-control .s25-toggle {
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 30px;
|
||||||
|
width: 30px;
|
||||||
|
transition: right 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-control.s25-multi {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-body {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-right: 60px;
|
||||||
|
width: calc(100% - 60px);
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item {
|
||||||
|
position: relative;
|
||||||
|
padding: 5px 12px 5px 18px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #0073e6;
|
||||||
|
color: #fff;
|
||||||
|
margin-right: 3px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
transition: 0.2s;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item:hover {
|
||||||
|
background-color: #0066cd;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item.s25-active {
|
||||||
|
box-shadow: inset 0 0 0 3px #67b3ff;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item.s25-item.s25-selected {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item.s25-item.s25-selected:before {
|
||||||
|
content: '✓';
|
||||||
|
position: absolute;
|
||||||
|
left: 5px;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-label {
|
||||||
|
color: #222222;
|
||||||
|
font-size: 85%;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 3px 3px 3px 6px;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-item {
|
||||||
|
cursor: pointer;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-search {
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 75px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-search:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-single.s25-control {
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.s25-single.s25-control .s25-body {
|
||||||
|
cursor: pointer;
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: calc(100% - 30px);
|
||||||
|
}
|
||||||
|
.s25-single.s25-control .s25-value {
|
||||||
|
border: 0px;
|
||||||
|
line-height: 27px;
|
||||||
|
padding-left: 3px;
|
||||||
|
}
|
||||||
|
.s25-single.s25-control .s25-value:focus {
|
||||||
|
outline: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-single.s25-dropdown .s25-search {
|
||||||
|
width: calc(100% - 16px);
|
||||||
|
padding: 6px;
|
||||||
|
margin: 8px 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-offscreen {
|
||||||
|
clip-path: inset(100%);
|
||||||
|
clip: rect(1px, 1px, 1px, 1px);
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-dropdown {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1000000;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #4d90fe;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
border-radius: 0 0 5px 5px;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-body {
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-search-results {
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-options {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-options .s25-item {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: transparent;
|
||||||
|
color: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-options .s25-active {
|
||||||
|
background-color: #e6f3ff;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-no-search-results {
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-search-results-message {
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-search-results-loading {
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-remove {
|
||||||
|
border: 1px solid #e6f3ff;
|
||||||
|
border-radius: 0 5px 5px 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 5px;
|
||||||
|
outline: none;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
transition: 0.2s, width 0.2s ease-out;
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.s25-remove span svg {
|
||||||
|
fill: #ccc;
|
||||||
|
transition: fill 0.2s;
|
||||||
|
}
|
||||||
|
.s25-remove:not(:disabled) {
|
||||||
|
background-color: #e6f3ff;
|
||||||
|
}
|
||||||
|
.s25-remove:not(:disabled):hover {
|
||||||
|
background-color: #cde6ff;
|
||||||
|
}
|
||||||
|
.s25-remove:not(:disabled) span svg {
|
||||||
|
fill: #0073e6;
|
||||||
|
}
|
||||||
|
.s25-remove:not(.s25-offscreen) {
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
.s25-remove:focus {
|
||||||
|
border: 1px solid #4d90fe;
|
||||||
|
}
|
||||||
|
.s25-remove:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.s25-remove:active {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-remove.s25-offscreen ~ .s25-toggle {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-placeholder {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*# sourceMappingURL=/select25.63904fcd.css.map */
|
1
dev/dist/select25.63904fcd.css.map
vendored
Normal file
1
dev/dist/select25.63904fcd.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
4346
dev/dist/select25.63904fcd.js
vendored
Normal file
4346
dev/dist/select25.63904fcd.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
dev/dist/select25.63904fcd.js.map
vendored
Normal file
1
dev/dist/select25.63904fcd.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
261
dev/dist/select25.e5b29622.css
vendored
Normal file
261
dev/dist/select25.e5b29622.css
vendored
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
@charset "UTF-8";
|
||||||
|
.s25-hidden-accessible {
|
||||||
|
border: 0 !important;
|
||||||
|
clip: rect(0 0 0 0) !important;
|
||||||
|
-webkit-clip-path: inset(50%) !important;
|
||||||
|
clip-path: inset(50%) !important;
|
||||||
|
height: 1px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
position: absolute !important;
|
||||||
|
width: 1px !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-search {
|
||||||
|
font-size: 100%;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
.s25-search:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-control {
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: 36px;
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.s25-control.s25-focused {
|
||||||
|
border: 1px solid #4d90fe;
|
||||||
|
}
|
||||||
|
.s25-control.s25-focused.s25-open {
|
||||||
|
border-bottom: none;
|
||||||
|
border-radius: 5px 5px 0 0;
|
||||||
|
}
|
||||||
|
.s25-control .s25-body {
|
||||||
|
margin: 3px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.s25-control .s25-toggle:focus {
|
||||||
|
outline: 0px;
|
||||||
|
}
|
||||||
|
.s25-control .s25-toggle svg {
|
||||||
|
display: inline-block;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.s25-control .s25-toggle {
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 30px;
|
||||||
|
width: 30px;
|
||||||
|
transition: right 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-control.s25-multi {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-body {
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-right: 60px;
|
||||||
|
width: calc(100% - 60px);
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item {
|
||||||
|
position: relative;
|
||||||
|
padding: 5px 12px 5px 18px;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #0073e6;
|
||||||
|
color: #fff;
|
||||||
|
margin-right: 3px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
transition: 0.2s;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item:hover {
|
||||||
|
background-color: #0066cd;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item.s25-active {
|
||||||
|
box-shadow: inset 0 0 0 3px #67b3ff;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item.s25-item.s25-selected {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-item.s25-item.s25-selected:before {
|
||||||
|
content: '✓';
|
||||||
|
position: absolute;
|
||||||
|
left: 5px;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values .s25-label {
|
||||||
|
color: #222222;
|
||||||
|
font-size: 85%;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 3px 3px 3px 6px;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-multi-values:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-item {
|
||||||
|
cursor: pointer;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-search {
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 75px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.s25-control.s25-multi .s25-search:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-single.s25-control {
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.s25-single.s25-control .s25-body {
|
||||||
|
cursor: pointer;
|
||||||
|
flex-grow: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: calc(100% - 30px);
|
||||||
|
}
|
||||||
|
.s25-single.s25-control .s25-value {
|
||||||
|
border: 0px;
|
||||||
|
line-height: 27px;
|
||||||
|
padding-left: 3px;
|
||||||
|
}
|
||||||
|
.s25-single.s25-control .s25-value:focus {
|
||||||
|
outline: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-single.s25-dropdown .s25-search {
|
||||||
|
width: calc(100% - 16px);
|
||||||
|
padding: 6px;
|
||||||
|
margin: 8px 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-offscreen {
|
||||||
|
clip-path: inset(100%);
|
||||||
|
clip: rect(1px, 1px, 1px, 1px);
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-dropdown {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1000000;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #4d90fe;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
border-radius: 0 0 5px 5px;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-body {
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-search-results {
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
position: relative;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-options {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-options .s25-item {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: transparent;
|
||||||
|
color: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-options .s25-active {
|
||||||
|
background-color: #e6f3ff;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-no-search-results {
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-search-results-message {
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
.s25-dropdown .s25-search-results-loading {
|
||||||
|
padding: 8px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-remove {
|
||||||
|
border: 1px solid #e6f3ff;
|
||||||
|
border-radius: 0 5px 5px 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 5px;
|
||||||
|
outline: none;
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
transition: 0.2s, width 0.2s ease-out;
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.s25-remove span svg {
|
||||||
|
fill: #ccc;
|
||||||
|
transition: fill 0.2s;
|
||||||
|
}
|
||||||
|
.s25-remove:not(:disabled) {
|
||||||
|
background-color: #e6f3ff;
|
||||||
|
}
|
||||||
|
.s25-remove:not(:disabled):hover {
|
||||||
|
background-color: #cde6ff;
|
||||||
|
}
|
||||||
|
.s25-remove:not(:disabled) span svg {
|
||||||
|
fill: #0073e6;
|
||||||
|
}
|
||||||
|
.s25-remove:not(.s25-offscreen) {
|
||||||
|
width: 30px;
|
||||||
|
}
|
||||||
|
.s25-remove:focus {
|
||||||
|
border: 1px solid #4d90fe;
|
||||||
|
}
|
||||||
|
.s25-remove:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.s25-remove:active {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-remove.s25-offscreen ~ .s25-toggle {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.s25-placeholder {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*# sourceMappingURL=/select25.e5b29622.css.map */
|
1
dev/dist/select25.e5b29622.css.map
vendored
Normal file
1
dev/dist/select25.e5b29622.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
440
dev/dist/select25.e5b29622.js
vendored
Normal file
440
dev/dist/select25.e5b29622.js
vendored
Normal file
@ -0,0 +1,440 @@
|
|||||||
|
// modules are defined as an array
|
||||||
|
// [ module function, map of requires ]
|
||||||
|
//
|
||||||
|
// map of requires is short require name -> numeric require
|
||||||
|
//
|
||||||
|
// anything defined in a previous bundle is accessed via the
|
||||||
|
// orig method which is the require for previous bundles
|
||||||
|
parcelRequire = (function(modules, cache, entry, globalName) {
|
||||||
|
// Save the require from previous bundle to this closure if any
|
||||||
|
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
|
||||||
|
var nodeRequire = typeof require === 'function' && require;
|
||||||
|
|
||||||
|
function newRequire(name, jumped) {
|
||||||
|
if (!cache[name]) {
|
||||||
|
if (!modules[name]) {
|
||||||
|
// if we cannot find the module within our internal map or
|
||||||
|
// cache jump to the current global require ie. the last bundle
|
||||||
|
// that was added to the page.
|
||||||
|
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
|
||||||
|
if (!jumped && currentRequire) {
|
||||||
|
return currentRequire(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are other bundles on this page the require from the
|
||||||
|
// previous one is saved to 'previousRequire'. Repeat this as
|
||||||
|
// many times as there are bundles until the module is found or
|
||||||
|
// we exhaust the require chain.
|
||||||
|
if (previousRequire) {
|
||||||
|
return previousRequire(name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try the node require function if it exists.
|
||||||
|
if (nodeRequire && typeof name === 'string') {
|
||||||
|
return nodeRequire(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
var err = new Error("Cannot find module '" + name + "'");
|
||||||
|
err.code = 'MODULE_NOT_FOUND';
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
localRequire.resolve = resolve;
|
||||||
|
localRequire.cache = {};
|
||||||
|
|
||||||
|
var module = (cache[name] = new newRequire.Module(name));
|
||||||
|
|
||||||
|
modules[name][0].call(module.exports, localRequire, module, module.exports, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache[name].exports;
|
||||||
|
|
||||||
|
function localRequire(x) {
|
||||||
|
return newRequire(localRequire.resolve(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolve(x) {
|
||||||
|
return modules[name][1][x] || x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Module(moduleName) {
|
||||||
|
this.id = moduleName;
|
||||||
|
this.bundle = newRequire;
|
||||||
|
this.exports = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
newRequire.isParcelRequire = true;
|
||||||
|
newRequire.Module = Module;
|
||||||
|
newRequire.modules = modules;
|
||||||
|
newRequire.cache = cache;
|
||||||
|
newRequire.parent = previousRequire;
|
||||||
|
newRequire.register = function(id, exports) {
|
||||||
|
modules[id] = [
|
||||||
|
function(require, module) {
|
||||||
|
module.exports = exports;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
var error;
|
||||||
|
for (var i = 0; i < entry.length; i++) {
|
||||||
|
try {
|
||||||
|
newRequire(entry[i]);
|
||||||
|
} catch (e) {
|
||||||
|
// Save first error but execute all entries
|
||||||
|
if (!error) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.length) {
|
||||||
|
// Expose entry point to Node, AMD or browser globals
|
||||||
|
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||||
|
var mainExports = newRequire(entry[entry.length - 1]);
|
||||||
|
|
||||||
|
// CommonJS
|
||||||
|
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||||
|
module.exports = mainExports;
|
||||||
|
|
||||||
|
// RequireJS
|
||||||
|
} else if (typeof define === 'function' && define.amd) {
|
||||||
|
define(function() {
|
||||||
|
return mainExports;
|
||||||
|
});
|
||||||
|
|
||||||
|
// <script>
|
||||||
|
} else if (globalName) {
|
||||||
|
this[globalName] = mainExports;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override the current require with this new one
|
||||||
|
parcelRequire = newRequire;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
// throw error from earlier, _after updating parcelRequire_
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newRequire;
|
||||||
|
})(
|
||||||
|
{
|
||||||
|
'../node_modules/parcel-bundler/src/builtins/bundle-url.js': [
|
||||||
|
function(require, module, exports) {
|
||||||
|
var bundleURL = null;
|
||||||
|
|
||||||
|
function getBundleURLCached() {
|
||||||
|
if (!bundleURL) {
|
||||||
|
bundleURL = getBundleURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bundleURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBundleURL() {
|
||||||
|
// Attempt to find the URL of the current script and use that as the base URL
|
||||||
|
try {
|
||||||
|
throw new Error();
|
||||||
|
} catch (err) {
|
||||||
|
var matches = ('' + err.stack).match(
|
||||||
|
/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matches) {
|
||||||
|
return getBaseURL(matches[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBaseURL(url) {
|
||||||
|
return (
|
||||||
|
('' + url).replace(
|
||||||
|
/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)\/[^/]+$/,
|
||||||
|
'$1'
|
||||||
|
) + '/'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.getBundleURL = getBundleURLCached;
|
||||||
|
exports.getBaseURL = getBaseURL;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
],
|
||||||
|
'../node_modules/parcel-bundler/src/builtins/css-loader.js': [
|
||||||
|
function(require, module, exports) {
|
||||||
|
var bundle = require('./bundle-url');
|
||||||
|
|
||||||
|
function updateLink(link) {
|
||||||
|
var newLink = link.cloneNode();
|
||||||
|
|
||||||
|
newLink.onload = function() {
|
||||||
|
link.remove();
|
||||||
|
};
|
||||||
|
|
||||||
|
newLink.href = link.href.split('?')[0] + '?' + Date.now();
|
||||||
|
link.parentNode.insertBefore(newLink, link.nextSibling);
|
||||||
|
}
|
||||||
|
|
||||||
|
var cssTimeout = null;
|
||||||
|
|
||||||
|
function reloadCSS() {
|
||||||
|
if (cssTimeout) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cssTimeout = setTimeout(function() {
|
||||||
|
var links = document.querySelectorAll('link[rel="stylesheet"]');
|
||||||
|
|
||||||
|
for (var i = 0; i < links.length; i++) {
|
||||||
|
if (bundle.getBaseURL(links[i].href) === bundle.getBundleURL()) {
|
||||||
|
updateLink(links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cssTimeout = null;
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = reloadCSS;
|
||||||
|
},
|
||||||
|
{ './bundle-url': '../node_modules/parcel-bundler/src/builtins/bundle-url.js' }
|
||||||
|
],
|
||||||
|
'../control/src/select25.scss': [
|
||||||
|
function(require, module, exports) {
|
||||||
|
var reloadCSS = require('_css_loader');
|
||||||
|
|
||||||
|
module.hot.dispose(reloadCSS);
|
||||||
|
module.hot.accept(reloadCSS);
|
||||||
|
},
|
||||||
|
{ _css_loader: '../node_modules/parcel-bundler/src/builtins/css-loader.js' }
|
||||||
|
],
|
||||||
|
'../node_modules/parcel-bundler/src/builtins/hmr-runtime.js': [
|
||||||
|
function(require, module, exports) {
|
||||||
|
var global = arguments[3];
|
||||||
|
var OVERLAY_ID = '__parcel__error__overlay__';
|
||||||
|
var OldModule = module.bundle.Module;
|
||||||
|
|
||||||
|
function Module(moduleName) {
|
||||||
|
OldModule.call(this, moduleName);
|
||||||
|
this.hot = {
|
||||||
|
data: module.bundle.hotData,
|
||||||
|
_acceptCallbacks: [],
|
||||||
|
_disposeCallbacks: [],
|
||||||
|
accept: function(fn) {
|
||||||
|
this._acceptCallbacks.push(fn || function() {});
|
||||||
|
},
|
||||||
|
dispose: function(fn) {
|
||||||
|
this._disposeCallbacks.push(fn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
module.bundle.hotData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.bundle.Module = Module;
|
||||||
|
var checkedAssets, assetsToAccept;
|
||||||
|
var parent = module.bundle.parent;
|
||||||
|
|
||||||
|
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
||||||
|
var hostname = '' || location.hostname;
|
||||||
|
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
|
var ws = new WebSocket(protocol + '://' + hostname + ':' + '57136' + '/');
|
||||||
|
|
||||||
|
ws.onmessage = function(event) {
|
||||||
|
checkedAssets = {};
|
||||||
|
assetsToAccept = [];
|
||||||
|
var data = JSON.parse(event.data);
|
||||||
|
|
||||||
|
if (data.type === 'update') {
|
||||||
|
var handled = false;
|
||||||
|
data.assets.forEach(function(asset) {
|
||||||
|
if (!asset.isNew) {
|
||||||
|
var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);
|
||||||
|
|
||||||
|
if (didAccept) {
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}); // Enable HMR for CSS by default.
|
||||||
|
|
||||||
|
handled =
|
||||||
|
handled ||
|
||||||
|
data.assets.every(function(asset) {
|
||||||
|
return asset.type === 'css' && asset.generated.js;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (handled) {
|
||||||
|
console.clear();
|
||||||
|
data.assets.forEach(function(asset) {
|
||||||
|
hmrApply(global.parcelRequire, asset);
|
||||||
|
});
|
||||||
|
assetsToAccept.forEach(function(v) {
|
||||||
|
hmrAcceptRun(v[0], v[1]);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'reload') {
|
||||||
|
ws.close();
|
||||||
|
|
||||||
|
ws.onclose = function() {
|
||||||
|
location.reload();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'error-resolved') {
|
||||||
|
console.log('[parcel] ✨ Error resolved');
|
||||||
|
removeErrorOverlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.type === 'error') {
|
||||||
|
console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
|
||||||
|
removeErrorOverlay();
|
||||||
|
var overlay = createErrorOverlay(data);
|
||||||
|
document.body.appendChild(overlay);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeErrorOverlay() {
|
||||||
|
var overlay = document.getElementById(OVERLAY_ID);
|
||||||
|
|
||||||
|
if (overlay) {
|
||||||
|
overlay.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createErrorOverlay(data) {
|
||||||
|
var overlay = document.createElement('div');
|
||||||
|
overlay.id = OVERLAY_ID; // html encode message and stack trace
|
||||||
|
|
||||||
|
var message = document.createElement('div');
|
||||||
|
var stackTrace = document.createElement('pre');
|
||||||
|
message.innerText = data.error.message;
|
||||||
|
stackTrace.innerText = data.error.stack;
|
||||||
|
overlay.innerHTML =
|
||||||
|
'<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' +
|
||||||
|
'<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' +
|
||||||
|
'<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' +
|
||||||
|
'<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' +
|
||||||
|
message.innerHTML +
|
||||||
|
'</div>' +
|
||||||
|
'<pre>' +
|
||||||
|
stackTrace.innerHTML +
|
||||||
|
'</pre>' +
|
||||||
|
'</div>';
|
||||||
|
return overlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getParents(bundle, id) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
|
||||||
|
if (!modules) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var parents = [];
|
||||||
|
var k, d, dep;
|
||||||
|
|
||||||
|
for (k in modules) {
|
||||||
|
for (d in modules[k][1]) {
|
||||||
|
dep = modules[k][1][d];
|
||||||
|
|
||||||
|
if (dep === id || (Array.isArray(dep) && dep[dep.length - 1] === id)) {
|
||||||
|
parents.push(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bundle.parent) {
|
||||||
|
parents = parents.concat(getParents(bundle.parent, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hmrApply(bundle, asset) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
|
||||||
|
if (!modules) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modules[asset.id] || !bundle.parent) {
|
||||||
|
var fn = new Function('require', 'module', 'exports', asset.generated.js);
|
||||||
|
asset.isNew = !modules[asset.id];
|
||||||
|
modules[asset.id] = [fn, asset.deps];
|
||||||
|
} else if (bundle.parent) {
|
||||||
|
hmrApply(bundle.parent, asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hmrAcceptCheck(bundle, id) {
|
||||||
|
var modules = bundle.modules;
|
||||||
|
|
||||||
|
if (!modules) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modules[id] && bundle.parent) {
|
||||||
|
return hmrAcceptCheck(bundle.parent, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkedAssets[id]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkedAssets[id] = true;
|
||||||
|
var cached = bundle.cache[id];
|
||||||
|
assetsToAccept.push([bundle, id]);
|
||||||
|
|
||||||
|
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getParents(global.parcelRequire, id).some(function(id) {
|
||||||
|
return hmrAcceptCheck(global.parcelRequire, id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function hmrAcceptRun(bundle, id) {
|
||||||
|
var cached = bundle.cache[id];
|
||||||
|
bundle.hotData = {};
|
||||||
|
|
||||||
|
if (cached) {
|
||||||
|
cached.hot.data = bundle.hotData;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
|
||||||
|
cached.hot._disposeCallbacks.forEach(function(cb) {
|
||||||
|
cb(bundle.hotData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
delete bundle.cache[id];
|
||||||
|
bundle(id);
|
||||||
|
cached = bundle.cache[id];
|
||||||
|
|
||||||
|
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
|
||||||
|
cached.hot._acceptCallbacks.forEach(function(cb) {
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
['../node_modules/parcel-bundler/src/builtins/hmr-runtime.js'],
|
||||||
|
null
|
||||||
|
);
|
||||||
|
//# sourceMappingURL=/select25.e5b29622.js.map
|
1
dev/dist/select25.e5b29622.js.map
vendored
Normal file
1
dev/dist/select25.e5b29622.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
139
dev/index.html
Normal file
139
dev/index.html
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<!-- polyfill for IE11 -->
|
||||||
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>
|
||||||
|
<script src="../bridge/src/select25.tsx"></script>
|
||||||
|
<script src="countries-data.js"></script>
|
||||||
|
<link rel="stylesheet" href="../control/src/select25.scss" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
<input type="text" value="focus grabber 1" autofocus />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<section style="width:450px">
|
||||||
|
<input type="hidden" id="countries1" />
|
||||||
|
</section>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="button" id="destroy-multi" value="destroy" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="text" value="focus grabber 2" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<section style="width:450px">
|
||||||
|
<input type="hidden" id="countries2" />
|
||||||
|
</section>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<input type="text" value="focus grabber 3" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="select1">Select Single</label>
|
||||||
|
<select id="select1">
|
||||||
|
<option>first</option>
|
||||||
|
<option>second</option>
|
||||||
|
<option selected>third</option>
|
||||||
|
<option>fourth</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="select2">Select Multiple</label>
|
||||||
|
<select id="select2" multiple>
|
||||||
|
<option>first</option>
|
||||||
|
<option selected>second</option>
|
||||||
|
<option selected>third</option>
|
||||||
|
<option>fourth</option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
var query = (function () {
|
||||||
|
// local implementation of query that simulates network delay
|
||||||
|
var countries = window.select2countries;
|
||||||
|
|
||||||
|
var previousTimeout = undefined;
|
||||||
|
var previousReject = undefined;
|
||||||
|
|
||||||
|
return function (search, page, token) {
|
||||||
|
if (previousReject != undefined) {
|
||||||
|
previousReject(new Error('cancelled'));
|
||||||
|
window.clearTimeout(previousTimeout);
|
||||||
|
}
|
||||||
|
var delay = 150;
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
previousReject = reject;
|
||||||
|
previousTimeout = window.setTimeout(function () {
|
||||||
|
var results = [];
|
||||||
|
var count = 0;
|
||||||
|
var limit = 10;
|
||||||
|
var offset = page * limit;
|
||||||
|
for (var i = 0; i < countries.length; i++) {
|
||||||
|
var country = countries[i];
|
||||||
|
if (country.name.toLowerCase().indexOf(search.toLowerCase()) >= 0) {
|
||||||
|
if (count >= offset) {
|
||||||
|
results.push(country);
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
if (count >= offset + limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
previousTimeout = undefined;
|
||||||
|
previousReject = undefined;
|
||||||
|
resolve({
|
||||||
|
values: results,
|
||||||
|
more: results.length >= limit,
|
||||||
|
token: token
|
||||||
|
});
|
||||||
|
}, delay);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
document.getElementById('countries1').addEventListener("change", function (event) {
|
||||||
|
console.log("onchange fired on countries1", event);
|
||||||
|
})
|
||||||
|
|
||||||
|
window.select25.create(
|
||||||
|
document.getElementById('countries1'), {
|
||||||
|
valuesLabel: "Selected Countries",
|
||||||
|
comboboxLabel: "Add Country",
|
||||||
|
itemId: 'code',
|
||||||
|
itemLabel: 'name',
|
||||||
|
minimumCharacters: 2,
|
||||||
|
multiple: true,
|
||||||
|
query: query,
|
||||||
|
quiet: 100,
|
||||||
|
values: [window.select2countries[0], window.select2countries[1], window.select2countries[1]],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
document.getElementById("destroy-multi").addEventListener("click", function () {
|
||||||
|
window.select25.destroy(document.getElementById("countries1"));
|
||||||
|
});
|
||||||
|
|
||||||
|
window.select25.create(
|
||||||
|
document.getElementById('countries2'), {
|
||||||
|
allowClear: true,
|
||||||
|
placeholder: "Select Country",
|
||||||
|
itemId: 'code',
|
||||||
|
itemLabel: 'name',
|
||||||
|
minimumCharacters: 2,
|
||||||
|
query: query,
|
||||||
|
quiet: 100,
|
||||||
|
|
||||||
|
value: window.select2countries[0]
|
||||||
|
},
|
||||||
|
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
484
dist/css/select2.css
vendored
484
dist/css/select2.css
vendored
@ -1,484 +0,0 @@
|
|||||||
.select2-container {
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0;
|
|
||||||
position: relative;
|
|
||||||
vertical-align: middle; }
|
|
||||||
.select2-container .select2-selection--single {
|
|
||||||
box-sizing: border-box;
|
|
||||||
cursor: pointer;
|
|
||||||
display: block;
|
|
||||||
height: 28px;
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: none; }
|
|
||||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
|
||||||
display: block;
|
|
||||||
padding-left: 8px;
|
|
||||||
padding-right: 20px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap; }
|
|
||||||
.select2-container .select2-selection--single .select2-selection__clear {
|
|
||||||
position: relative; }
|
|
||||||
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
|
||||||
padding-right: 8px;
|
|
||||||
padding-left: 20px; }
|
|
||||||
.select2-container .select2-selection--multiple {
|
|
||||||
box-sizing: border-box;
|
|
||||||
cursor: pointer;
|
|
||||||
display: block;
|
|
||||||
min-height: 32px;
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: none; }
|
|
||||||
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
|
||||||
display: inline-block;
|
|
||||||
overflow: hidden;
|
|
||||||
padding-left: 8px;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap; }
|
|
||||||
.select2-container .select2-search--inline {
|
|
||||||
float: left; }
|
|
||||||
.select2-container .select2-search--inline .select2-search__field {
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: none;
|
|
||||||
font-size: 100%;
|
|
||||||
margin-top: 5px;
|
|
||||||
padding: 0; }
|
|
||||||
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
|
||||||
-webkit-appearance: none; }
|
|
||||||
|
|
||||||
.select2-dropdown {
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
left: -100000px;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 1051; }
|
|
||||||
|
|
||||||
.select2-results {
|
|
||||||
display: block; }
|
|
||||||
|
|
||||||
.select2-results__options {
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0; }
|
|
||||||
|
|
||||||
.select2-results__option {
|
|
||||||
padding: 6px;
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: none; }
|
|
||||||
.select2-results__option[aria-selected] {
|
|
||||||
cursor: pointer; }
|
|
||||||
|
|
||||||
.select2-container--open .select2-dropdown {
|
|
||||||
left: 0; }
|
|
||||||
|
|
||||||
.select2-container--open .select2-dropdown--above {
|
|
||||||
border-bottom: none;
|
|
||||||
border-bottom-left-radius: 0;
|
|
||||||
border-bottom-right-radius: 0; }
|
|
||||||
|
|
||||||
.select2-container--open .select2-dropdown--below {
|
|
||||||
border-top: none;
|
|
||||||
border-top-left-radius: 0;
|
|
||||||
border-top-right-radius: 0; }
|
|
||||||
|
|
||||||
.select2-search--dropdown {
|
|
||||||
display: block;
|
|
||||||
padding: 4px; }
|
|
||||||
.select2-search--dropdown .select2-search__field {
|
|
||||||
padding: 4px;
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box; }
|
|
||||||
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
|
||||||
-webkit-appearance: none; }
|
|
||||||
.select2-search--dropdown.select2-search--hide {
|
|
||||||
display: none; }
|
|
||||||
|
|
||||||
.select2-close-mask {
|
|
||||||
border: 0;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
display: block;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
min-height: 100%;
|
|
||||||
min-width: 100%;
|
|
||||||
height: auto;
|
|
||||||
width: auto;
|
|
||||||
opacity: 0;
|
|
||||||
z-index: 99;
|
|
||||||
background-color: #fff;
|
|
||||||
filter: alpha(opacity=0); }
|
|
||||||
|
|
||||||
.select2-hidden-accessible {
|
|
||||||
border: 0 !important;
|
|
||||||
clip: rect(0 0 0 0) !important;
|
|
||||||
-webkit-clip-path: inset(50%) !important;
|
|
||||||
clip-path: inset(50%) !important;
|
|
||||||
height: 1px !important;
|
|
||||||
overflow: hidden !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
position: absolute !important;
|
|
||||||
width: 1px !important;
|
|
||||||
white-space: nowrap !important; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-selection--single {
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
border-radius: 4px; }
|
|
||||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
|
||||||
color: #444;
|
|
||||||
line-height: 28px; }
|
|
||||||
.select2-container--default .select2-selection--single .select2-selection__clear {
|
|
||||||
cursor: pointer;
|
|
||||||
float: right;
|
|
||||||
font-weight: bold; }
|
|
||||||
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
|
||||||
color: #999; }
|
|
||||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
|
||||||
height: 26px;
|
|
||||||
position: absolute;
|
|
||||||
top: 1px;
|
|
||||||
right: 1px;
|
|
||||||
width: 20px; }
|
|
||||||
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
|
||||||
border-color: #888 transparent transparent transparent;
|
|
||||||
border-style: solid;
|
|
||||||
border-width: 5px 4px 0 4px;
|
|
||||||
height: 0;
|
|
||||||
left: 50%;
|
|
||||||
margin-left: -4px;
|
|
||||||
margin-top: -2px;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
width: 0; }
|
|
||||||
|
|
||||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
|
||||||
float: left; }
|
|
||||||
|
|
||||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
|
||||||
left: 1px;
|
|
||||||
right: auto; }
|
|
||||||
|
|
||||||
.select2-container--default.select2-container--disabled .select2-selection--single {
|
|
||||||
background-color: #eee;
|
|
||||||
cursor: default; }
|
|
||||||
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
|
||||||
display: none; }
|
|
||||||
|
|
||||||
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
|
||||||
border-color: transparent transparent #888 transparent;
|
|
||||||
border-width: 0 4px 5px 4px; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-selection--multiple {
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: text; }
|
|
||||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
|
||||||
box-sizing: border-box;
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 5px;
|
|
||||||
width: 100%; }
|
|
||||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
|
||||||
list-style: none; }
|
|
||||||
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
|
||||||
color: #999;
|
|
||||||
margin-top: 5px;
|
|
||||||
float: left; }
|
|
||||||
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
|
||||||
cursor: pointer;
|
|
||||||
float: right;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-top: 5px;
|
|
||||||
margin-right: 10px; }
|
|
||||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
|
||||||
background-color: #e4e4e4;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: default;
|
|
||||||
float: left;
|
|
||||||
margin-right: 5px;
|
|
||||||
margin-top: 5px;
|
|
||||||
padding: 0 5px; }
|
|
||||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
|
||||||
color: #999;
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-block;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-right: 2px; }
|
|
||||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
|
||||||
color: #333; }
|
|
||||||
|
|
||||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
|
||||||
float: right; }
|
|
||||||
|
|
||||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
|
||||||
margin-left: 5px;
|
|
||||||
margin-right: auto; }
|
|
||||||
|
|
||||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
|
||||||
margin-left: 2px;
|
|
||||||
margin-right: auto; }
|
|
||||||
|
|
||||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
|
||||||
border: solid black 1px;
|
|
||||||
outline: 0; }
|
|
||||||
|
|
||||||
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
|
||||||
background-color: #eee;
|
|
||||||
cursor: default; }
|
|
||||||
|
|
||||||
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
|
||||||
display: none; }
|
|
||||||
|
|
||||||
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
|
||||||
border-top-left-radius: 0;
|
|
||||||
border-top-right-radius: 0; }
|
|
||||||
|
|
||||||
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
|
||||||
border-bottom-left-radius: 0;
|
|
||||||
border-bottom-right-radius: 0; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
|
||||||
border: 1px solid #aaa; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-search--inline .select2-search__field {
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
outline: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
-webkit-appearance: textfield; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-results > .select2-results__options {
|
|
||||||
max-height: 200px;
|
|
||||||
overflow-y: auto; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-results__option[role=group] {
|
|
||||||
padding: 0; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-results__option[aria-disabled=true] {
|
|
||||||
color: #999; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
|
||||||
background-color: #ddd; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-results__option .select2-results__option {
|
|
||||||
padding-left: 1em; }
|
|
||||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
|
||||||
padding-left: 0; }
|
|
||||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
|
||||||
margin-left: -1em;
|
|
||||||
padding-left: 2em; }
|
|
||||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
|
||||||
margin-left: -2em;
|
|
||||||
padding-left: 3em; }
|
|
||||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
|
||||||
margin-left: -3em;
|
|
||||||
padding-left: 4em; }
|
|
||||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
|
||||||
margin-left: -4em;
|
|
||||||
padding-left: 5em; }
|
|
||||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
|
||||||
margin-left: -5em;
|
|
||||||
padding-left: 6em; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
|
||||||
background-color: #5897fb;
|
|
||||||
color: white; }
|
|
||||||
|
|
||||||
.select2-container--default .select2-results__group {
|
|
||||||
cursor: default;
|
|
||||||
display: block;
|
|
||||||
padding: 6px; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-selection--single {
|
|
||||||
background-color: #f7f7f7;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
border-radius: 4px;
|
|
||||||
outline: 0;
|
|
||||||
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
|
||||||
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
|
||||||
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
|
||||||
.select2-container--classic .select2-selection--single:focus {
|
|
||||||
border: 1px solid #5897fb; }
|
|
||||||
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
|
||||||
color: #444;
|
|
||||||
line-height: 28px; }
|
|
||||||
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
|
||||||
cursor: pointer;
|
|
||||||
float: right;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-right: 10px; }
|
|
||||||
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
|
||||||
color: #999; }
|
|
||||||
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
|
||||||
background-color: #ddd;
|
|
||||||
border: none;
|
|
||||||
border-left: 1px solid #aaa;
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
height: 26px;
|
|
||||||
position: absolute;
|
|
||||||
top: 1px;
|
|
||||||
right: 1px;
|
|
||||||
width: 20px;
|
|
||||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
|
||||||
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
|
||||||
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
|
||||||
border-color: #888 transparent transparent transparent;
|
|
||||||
border-style: solid;
|
|
||||||
border-width: 5px 4px 0 4px;
|
|
||||||
height: 0;
|
|
||||||
left: 50%;
|
|
||||||
margin-left: -4px;
|
|
||||||
margin-top: -2px;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
width: 0; }
|
|
||||||
|
|
||||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
|
||||||
float: left; }
|
|
||||||
|
|
||||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
|
||||||
border: none;
|
|
||||||
border-right: 1px solid #aaa;
|
|
||||||
border-radius: 0;
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
left: 1px;
|
|
||||||
right: auto; }
|
|
||||||
|
|
||||||
.select2-container--classic.select2-container--open .select2-selection--single {
|
|
||||||
border: 1px solid #5897fb; }
|
|
||||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
|
||||||
background: transparent;
|
|
||||||
border: none; }
|
|
||||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
|
||||||
border-color: transparent transparent #888 transparent;
|
|
||||||
border-width: 0 4px 5px 4px; }
|
|
||||||
|
|
||||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
|
||||||
border-top: none;
|
|
||||||
border-top-left-radius: 0;
|
|
||||||
border-top-right-radius: 0;
|
|
||||||
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
|
||||||
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
|
||||||
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
|
||||||
|
|
||||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
|
||||||
border-bottom: none;
|
|
||||||
border-bottom-left-radius: 0;
|
|
||||||
border-bottom-right-radius: 0;
|
|
||||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
|
||||||
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
|
||||||
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
|
||||||
background-repeat: repeat-x;
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-selection--multiple {
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: text;
|
|
||||||
outline: 0; }
|
|
||||||
.select2-container--classic .select2-selection--multiple:focus {
|
|
||||||
border: 1px solid #5897fb; }
|
|
||||||
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 5px; }
|
|
||||||
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
|
||||||
display: none; }
|
|
||||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
|
||||||
background-color: #e4e4e4;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: default;
|
|
||||||
float: left;
|
|
||||||
margin-right: 5px;
|
|
||||||
margin-top: 5px;
|
|
||||||
padding: 0 5px; }
|
|
||||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
|
||||||
color: #888;
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-block;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-right: 2px; }
|
|
||||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
|
||||||
color: #555; }
|
|
||||||
|
|
||||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
|
||||||
float: right;
|
|
||||||
margin-left: 5px;
|
|
||||||
margin-right: auto; }
|
|
||||||
|
|
||||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
|
||||||
margin-left: 2px;
|
|
||||||
margin-right: auto; }
|
|
||||||
|
|
||||||
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
|
||||||
border: 1px solid #5897fb; }
|
|
||||||
|
|
||||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
|
||||||
border-top: none;
|
|
||||||
border-top-left-radius: 0;
|
|
||||||
border-top-right-radius: 0; }
|
|
||||||
|
|
||||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
|
||||||
border-bottom: none;
|
|
||||||
border-bottom-left-radius: 0;
|
|
||||||
border-bottom-right-radius: 0; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
outline: 0; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-search--inline .select2-search__field {
|
|
||||||
outline: 0;
|
|
||||||
box-shadow: none; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-dropdown {
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid transparent; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-dropdown--above {
|
|
||||||
border-bottom: none; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-dropdown--below {
|
|
||||||
border-top: none; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-results > .select2-results__options {
|
|
||||||
max-height: 200px;
|
|
||||||
overflow-y: auto; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-results__option[role=group] {
|
|
||||||
padding: 0; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
|
||||||
color: grey; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
|
||||||
background-color: #3875d7;
|
|
||||||
color: white; }
|
|
||||||
|
|
||||||
.select2-container--classic .select2-results__group {
|
|
||||||
cursor: default;
|
|
||||||
display: block;
|
|
||||||
padding: 6px; }
|
|
||||||
|
|
||||||
.select2-container--classic.select2-container--open .select2-dropdown {
|
|
||||||
border-color: #5897fb; }
|
|
1
dist/css/select2.min.css
vendored
1
dist/css/select2.min.css
vendored
File diff suppressed because one or more lines are too long
3
dist/js/i18n/af.js
vendored
3
dist/js/i18n/af.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Verwyders asseblief "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Voer asseblief "+t+" of meer karakters";return n},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var t="Kies asseblief net "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"},removeAllItems:function(){return"Verwyder alle items"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ar.js
vendored
3
dist/js/i18n/ar.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum;return"الرجاء حذف "+t+" عناصر"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"الرجاء إضافة "+t+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){return"تستطيع إختيار "+e.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"},removeAllItems:function(){return"قم بإزالة كل العناصر"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/az.js
vendored
3
dist/js/i18n/az.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"},removeAllItems:function(){return"Bütün elementləri sil"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/bg.js
vendored
3
dist/js/i18n/bg.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"},removeAllItems:function(){return"Премахнете всички елементи"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/bn.js
vendored
3
dist/js/i18n/bn.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bn",[],function(){return{errorLoading:function(){return"ফলাফলগুলি লোড করা যায়নি।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="অনুগ্রহ করে "+t+" টি অক্ষর মুছে দিন।";return t!=1&&(n="অনুগ্রহ করে "+t+" টি অক্ষর মুছে দিন।"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n=t+" টি অক্ষর অথবা অধিক অক্ষর লিখুন।";return n},loadingMore:function(){return"আরো ফলাফল লোড হচ্ছে ..."},maximumSelected:function(e){var t=e.maximum+" টি আইটেম নির্বাচন করতে পারবেন।";return e.maximum!=1&&(t=e.maximum+" টি আইটেম নির্বাচন করতে পারবেন।"),t},noResults:function(){return"কোন ফলাফল পাওয়া যায়নি।"},searching:function(){return"অনুসন্ধান করা হচ্ছে ..."}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/bs.js
vendored
3
dist/js/i18n/bs.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bs",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Uklonite sve stavke"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ca.js
vendored
3
dist/js/i18n/ca.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"},removeAllItems:function(){return"Treu tots els elements"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/cs.js
vendored
3
dist/js/i18n/cs.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadejte o jeden znak méně.":n<=4?"Prosím, zadejte o "+e(n,!0)+" znaky méně.":"Prosím, zadejte o "+n+" znaků méně."},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadejte ještě jeden znak.":n<=4?"Prosím, zadejte ještě další "+e(n,!0)+" znaky.":"Prosím, zadejte ještě dalších "+n+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku.":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky.":"Můžete zvolit maximálně "+n+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"},removeAllItems:function(){return"Odstraňte všechny položky"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/da.js
vendored
3
dist/js/i18n/da.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Angiv venligst "+t+" tegn mindre"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Angiv venligst "+t+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"},removeAllItems:function(){return"Fjern alle elementer"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/de.js
vendored
3
dist/js/i18n/de.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Gegenstände"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/dsb.js
vendored
3
dist/js/i18n/dsb.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/dsb",[],function(){var e=["znamuško","znamušce","znamuška","znamuškow"],t=["zapisk","zapiska","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Pšosym lašuj "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Pšosym zapódaj nanejmjenjej "+r+" "+n(r,e)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(e){return"Móžoš jano "+e.maximum+" "+n(e.maximum,t)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"},removeAllItems:function(){return"Remove all items"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/el.js
vendored
3
dist/js/i18n/el.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"},removeAllItems:function(){return"Καταργήστε όλα τα στοιχεία"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/en.js
vendored
3
dist/js/i18n/en.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/es.js
vendored
3
dist/js/i18n/es.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/et.js
vendored
3
dist/js/i18n/et.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"},removeAllItems:function(){return"Eemalda kõik esemed"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/eu.js
vendored
3
dist/js/i18n/eu.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"},removeAllItems:function(){return"Kendu elementu guztiak"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/fa.js
vendored
3
dist/js/i18n/fa.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها میتوانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجهای یافت نشد"},searching:function(){return"در حال جستجو..."},removeAllItems:function(){return"همه موارد را حذف کنید"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/fi.js
vendored
3
dist/js/i18n/fi.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"},removeAllItems:function(){return"Poista kaikki kohteet"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/fr.js
vendored
3
dist/js/i18n/fr.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Supprimez "+t+" caractère"+(t>1?"s":"")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Saisissez au moins "+t+" caractère"+(t>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les articles"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/gl.js
vendored
3
dist/js/i18n/gl.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var t=e.input.length-e.maximum;return t===1?"Elimine un carácter":"Elimine "+t+" caracteres"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t===1?"Engada un carácter":"Engada "+t+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return e.maximum===1?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Elimina todos os elementos"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/he.js
vendored
3
dist/js/i18n/he.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"},removeAllItems:function(){return"הסר את כל הפריטים"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/hi.js
vendored
3
dist/js/i18n/hi.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."},removeAllItems:function(){return"सभी वस्तुओं को हटा दें"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/hr.js
vendored
3
dist/js/i18n/hr.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Ukloni sve stavke"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/hsb.js
vendored
3
dist/js/i18n/hsb.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hsb",[],function(){var e=["znamješko","znamješce","znamješka","znamješkow"],t=["zapisk","zapiskaj","zapiski","zapiskow"],n=function(t,n){if(t===1)return n[0];if(t===2)return n[1];if(t>2&&t<=4)return n[2];if(t>=5)return n[3]};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Prošu zhašej "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Prošu zapodaj znajmjeńša "+r+" "+n(r,e)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(e){return"Móžeš jenož "+e.maximum+" "+n(e.maximum,t)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"},removeAllItems:function(){return"Remove all items"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/hu.js
vendored
3
dist/js/i18n/hu.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"},removeAllItems:function(){return"Távolítson el minden elemet"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/hy.js
vendored
3
dist/js/i18n/hy.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Խնդրում ենք հեռացնել "+t+" նշան";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Խնդրում ենք մուտքագրել "+t+" կամ ավել նշաններ";return n},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(e){var t="Դուք կարող եք ընտրել առավելագույնը "+e.maximum+" կետ";return t},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"},removeAllItems:function(){return"Հեռացնել բոլոր տարրերը"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/id.js
vendored
3
dist/js/i18n/id.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Hapus semua item"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/is.js
vendored
3
dist/js/i18n/is.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"},removeAllItems:function(){return"Fjarlægðu öll atriði"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/it.js
vendored
3
dist/js/i18n/it.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ja.js
vendored
3
dist/js/i18n/ja.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"},removeAllItems:function(){return"すべてのアイテムを削除"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ka.js
vendored
3
dist/js/i18n/ka.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ka",[],function(){return{errorLoading:function(){return"მონაცემების ჩატვირთვა შეუძლებელია."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="გთხოვთ აკრიფეთ "+t+" სიმბოლოთი ნაკლები";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="გთხოვთ აკრიფეთ "+t+" სიმბოლო ან მეტი";return n},loadingMore:function(){return"მონაცემების ჩატვირთვა…"},maximumSelected:function(e){var t="თქვენ შეგიძლიათ აირჩიოთ არაუმეტეს "+e.maximum+" ელემენტი";return t},noResults:function(){return"რეზულტატი არ მოიძებნა"},searching:function(){return"ძიება…"},removeAllItems:function(){return"ამოიღე ყველა ელემენტი"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/km.js
vendored
3
dist/js/i18n/km.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."},removeAllItems:function(){return"លុបធាតុទាំងអស់"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ko.js
vendored
3
dist/js/i18n/ko.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"},removeAllItems:function(){return"모든 항목 삭제"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/lt.js
vendored
3
dist/js/i18n/lt.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"},removeAllItems:function(){return"Pašalinti visus elementus"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/lv.js
vendored
3
dist/js/i18n/lv.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"},removeAllItems:function(){return"Noņemt visus vienumus"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/mk.js
vendored
3
dist/js/i18n/mk.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"},removeAllItems:function(){return"Отстрани ги сите предмети"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ms.js
vendored
3
dist/js/i18n/ms.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Keluarkan semua item"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/nb.js
vendored
3
dist/js/i18n/nb.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Vennligst skriv inn "+t+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"},removeAllItems:function(){return"Fjern alle elementer"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ne.js
vendored
3
dist/js/i18n/ne.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ne",[],function(){return{errorLoading:function(){return"नतिजाहरु देखाउन सकिएन।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="कृपया "+t+" अक्षर मेटाउनुहोस्।";return t!=1&&(n+="कृपया "+t+" अक्षरहरु मेटाउनुहोस्।"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया बाँकी रहेका "+t+" वा अरु धेरै अक्षरहरु भर्नुहोस्।";return n},loadingMore:function(){return"अरु नतिजाहरु भरिँदैछन् …"},maximumSelected:function(e){var t="तँपाई "+e.maximum+" वस्तु मात्र छान्न पाउँनुहुन्छ।";return e.maximum!=1&&(t="तँपाई "+e.maximum+" वस्तुहरु मात्र छान्न पाउँनुहुन्छ।"),t},noResults:function(){return"कुनै पनि नतिजा भेटिएन।"},searching:function(){return"खोजि हुँदैछ…"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/nl.js
vendored
3
dist/js/i18n/nl.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/pl.js
vendored
3
dist/js/i18n/pl.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ps.js
vendored
3
dist/js/i18n/ps.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="د مهربانۍ لمخي "+t+" توری ړنګ کړئ";return t!=1&&(n=n.replace("توری","توري")),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لږ تر لږه "+t+" يا ډېر توري وليکئ";return n},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(e){var t="تاسو يوازي "+e.maximum+" قلم په نښه کولای سی";return e.maximum!=1&&(t=t.replace("قلم","قلمونه")),t},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."},removeAllItems:function(){return"ټول توکي لرې کړئ"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/pt-BR.js
vendored
3
dist/js/i18n/pt-BR.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/pt.js
vendored
3
dist/js/i18n/pt.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"caractere",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"},removeAllItems:function(){return"Remover todos os itens"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ro.js
vendored
3
dist/js/i18n/ro.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+" sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"},removeAllItems:function(){return"Eliminați toate elementele"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/ru.js
vendored
3
dist/js/i18n/ru.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите ещё хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/sk.js
vendored
3
dist/js/i18n/sk.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"},removeAllItems:function(){return"Odstráňte všetky položky"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/sl.js
vendored
3
dist/js/i18n/sl.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Prosim zbrišite "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Prosim vpišite še "+t+" znak";return t==2?n+="a":t!=1&&(n+="e"),n},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var t="Označite lahko največ "+e.maximum+" predmet";return e.maximum==2?t+="a":e.maximum!=1&&(t+="e"),t},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"},removeAllItems:function(){return"Odstranite vse elemente"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/sq.js
vendored
3
dist/js/i18n/sq.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sq",[],function(){return{errorLoading:function(){return"Rezultatet nuk mund të ngarkoheshin."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Të lutem fshi "+t+" karakter";return t!=1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Të lutem shkruaj "+t+" ose më shumë karaktere";return n},loadingMore:function(){return"Duke ngarkuar më shumë rezultate…"},maximumSelected:function(e){var t="Mund të zgjedhësh vetëm "+e.maximum+" element";return e.maximum!=1&&(t+="e"),t},noResults:function(){return"Nuk u gjet asnjë rezultat"},searching:function(){return"Duke kërkuar…"},removeAllItems:function(){return"Hiq të gjitha sendet"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/sr-Cyrl.js
vendored
3
dist/js/i18n/sr-Cyrl.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"},removeAllItems:function(){return"Уклоните све ставке"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/sr.js
vendored
3
dist/js/i18n/sr.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Уклоните све ставке"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/sv.js
vendored
3
dist/js/i18n/sv.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"},removeAllItems:function(){return"Ta bort alla objekt"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/th.js
vendored
3
dist/js/i18n/th.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"},removeAllItems:function(){return"ลบรายการทั้งหมด"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/tk.js
vendored
3
dist/js/i18n/tk.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tk",[],function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" harp bozuň.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ýene-de iň az "+t+" harp ýazyň.";return n},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(e){var t="Diňe "+e.maximum+" sanysyny saýlaň.";return t},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"},removeAllItems:function(){return"Remove all items"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/tr.js
vendored
3
dist/js/i18n/tr.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"},removeAllItems:function(){return"Tüm öğeleri kaldır"}}}),{define:e.define,require:e.require}})();
|
|
3
dist/js/i18n/uk.js
vendored
3
dist/js/i18n/uk.js
vendored
@ -1,3 +0,0 @@
|
|||||||
/*! Select2 4.0.7 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"},removeAllItems:function(){return"Видалити всі елементи"}}}),{define:e.define,require:e.require}})();
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user