Resolve conflicts

This commit is contained in:
Josh Johnson 2017-09-06 08:48:42 +01:00
commit 26d4c2304e
7 changed files with 16 additions and 12 deletions

View file

@ -1,4 +1,4 @@
# Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) # Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) [![CDNJS](https://img.shields.io/cdnjs/v/choices.js.svg)](https://cdnjs.com/libraries/choices.js) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js)
A vanilla, lightweight (~15kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency. A vanilla, lightweight (~15kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
[Demo](https://joshuajohnson.co.uk/Choices/) [Demo](https://joshuajohnson.co.uk/Choices/)
@ -48,7 +48,7 @@ Or include Choices directly:
const choices = new Choices(element); const choices = new Choices(element);
// Pass reference // Pass reference
const choices = new Choices('[data-trigger']); const choices = new Choices('[data-trigger]');
const choices = new Choices('.js-choice'); const choices = new Choices('.js-choice');
// Pass jQuery element // Pass jQuery element

View file

@ -3,7 +3,7 @@
"version": "3.0.2", "version": "3.0.2",
"description": "A vanilla JS customisable text input/select box plugin", "description": "A vanilla JS customisable text input/select box plugin",
"main": "./src/scripts/dist/choices.min.js", "main": "./src/scripts/dist/choices.min.js",
"types": "index.d.ts", "types": "./index.d.ts",
"scripts": { "scripts": {
"start": "node server.js", "start": "node server.js",
"lint": "eslint assets/**/*.js", "lint": "eslint assets/**/*.js",
@ -96,4 +96,4 @@
"src/**/**/**/**/**/*.spec.js" "src/**/**/**/**/**/*.spec.js"
] ]
} }
} }

View file

@ -196,7 +196,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
// Merge options with user options // Merge options with user options
this.config = (0, _utils.extend)(defaultConfig, userConfig); this.config = (0, _utils.extend)(defaultConfig, Choices.userDefaults, userConfig);
if (this.config.renderSelectedChoices !== 'auto' && this.config.renderSelectedChoices !== 'always') { if (this.config.renderSelectedChoices !== 'auto' && this.config.renderSelectedChoices !== 'always') {
if (!this.config.silent) { if (!this.config.silent) {
@ -882,7 +882,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.dropdown.setAttribute('aria-expanded', 'true'); this.dropdown.setAttribute('aria-expanded', 'true');
var dimensions = this.dropdown.getBoundingClientRect(); var dimensions = this.dropdown.getBoundingClientRect();
var dropdownPos = Math.ceil(dimensions.top + window.scrollY + this.dropdown.offsetHeight); var dropdownPos = Math.ceil(dimensions.top + window.pageYOffset + this.dropdown.offsetHeight);
// If flip is enabled and the dropdown bottom position is // If flip is enabled and the dropdown bottom position is
// greater than the window height flip the dropdown. // greater than the window height flip the dropdown.
@ -2859,7 +2859,9 @@ return /******/ (function(modules) { // webpackBootstrap
return Choices; return Choices;
}(); }();
module.exports = Choices; Choices.userDefaults = {};
module.exports = Choices;
/***/ }), /***/ }),
/* 2 */ /* 2 */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -129,7 +129,7 @@ class Choices {
}; };
// Merge options with user options // Merge options with user options
this.config = extend(defaultConfig, userConfig); this.config = extend(defaultConfig, Choices.userDefaults, userConfig);
if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) { if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {
this.config.renderSelectedChoices = 'auto'; this.config.renderSelectedChoices = 'auto';
@ -2714,4 +2714,6 @@ class Choices {
/* ===== End of Private functions ====== */ /* ===== End of Private functions ====== */
} }
Choices.userDefaults = {};
module.exports = Choices; module.exports = Choices;

View file

@ -15,7 +15,7 @@ export default class Dropdown {
*/ */
getVerticalPos() { getVerticalPos() {
this.dimensions = this.element.getBoundingClientRect(); this.dimensions = this.element.getBoundingClientRect();
this.position = Math.ceil(this.dimensions.top + window.scrollY + this.element.offsetHeight); this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight);
return this.position; return this.position;
} }