Skip to content

Commit 7cda02a

Browse files
Merge pull request #12 from williamtroup/1.1.0
1.1.0
2 parents 095d833 + 23ac909 commit 7cda02a

30 files changed

+219
-154
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
Select.js
33

44
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Select.js%2C%20a%20free%20JavaScript%select%builder&url=https://github.com/williamtroup/Select.js&hashtags=javascript,html,select)
5-
[![npm](https://img.shields.io/badge/npmjs-v1.0.0-blue)](https://www.npmjs.com/package/jselect.js)
6-
[![nuget](https://img.shields.io/badge/nuget-v1.0.0-purple)](https://www.nuget.org/packages/jSelect.js/)
5+
[![npm](https://img.shields.io/badge/npmjs-v1.1.0-blue)](https://www.npmjs.com/package/jselect.js)
6+
[![nuget](https://img.shields.io/badge/nuget-v1.1.0-purple)](https://www.nuget.org/packages/jSelect.js/)
77
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/Select.js/blob/main/LICENSE.txt)
88
[![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/Select.js/discussions)
99
[![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://github.com/williamtroup)
1010
</h1>
1111

1212
> <p align="center">A lightweight, and easy-to-use, JavaScript library for creating multi-select drop-down lists!</p>
13-
> <p align="center">v1.0.0</p>
13+
> <p align="center">v1.1.0</p>
1414
<br />
1515
1616
![Select.js](docs/images/main.png)
@@ -20,15 +20,15 @@ Select.js
2020

2121
<h1>What features does Select.js have?</h1>
2222

23-
- Zero-dependencies and extremely lightweight!
24-
- Written in TypeScript, allowing greater support for React, Angular, and other libraries!
25-
- Maintains existing SELECT DOM element for FORM compatibility.
26-
- Easily select and de-select your list items, which are shown as tags!
27-
- Full API available via public functions.
28-
- Fully styled in CSS/SASS (including the buttons) and compatible with the Bootstrap library.
29-
- Full CSS theme support (using :root variables, with a default dark-mode theme).
30-
- Custom triggers for actions (when elements are rendered, selection is changed, etc).
31-
- Shortcut keys (click [here](docs/SHORTCUT_KEYS.md) to see the full list).
23+
- 😏 Zero-dependencies and extremely lightweight!
24+
- 🦾 Written in TypeScript, allowing greater support for React, Angular, and other libraries!
25+
- ✏️ Maintains existing SELECT DOM element for FORM compatibility, allowing easy editing.
26+
- ☑️ Easily select and de-select your list items, which are shown as tags!
27+
- 💻 Full API available via public functions.
28+
- 📱 Fully styled in CSS/SASS (including the buttons) and compatible with the Bootstrap library.
29+
- 🌈 Full CSS theme support (using :root variables, with a default dark-mode theme).
30+
- 🚀 Custom triggers for actions (when elements are rendered, selection is changed, etc).
31+
- 🔠 Shortcut keys (click [here](https://github.com/williamtroup/docs/SHORTCUT_KEYS.md) to see the full list).
3232
<br />
3333
<br />
3434

README_NUGET.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Select.js v1.0.0
1+
# Select.js v1.1.0
22

33
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Select.js%2C%20a%20free%20JavaScript%select%builder&url=https://github.com/williamtroup/Select.js&hashtags=javascript,html,select)
4-
[![npm](https://img.shields.io/badge/npmjs-v1.0.0-blue)](https://www.npmjs.com/package/jselect.js)
5-
[![nuget](https://img.shields.io/badge/nuget-v1.0.0-purple)](https://www.nuget.org/packages/jSelect.js/)
4+
[![npm](https://img.shields.io/badge/npmjs-v1.1.0-blue)](https://www.npmjs.com/package/jselect.js)
5+
[![nuget](https://img.shields.io/badge/nuget-v1.1.0-purple)](https://www.nuget.org/packages/jSelect.js/)
66
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/Select.js/blob/main/LICENSE.txt)
77
[![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/Select.js/discussions)
88
[![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://github.com/williamtroup)
@@ -12,15 +12,15 @@
1212

1313
## What features does Select.js have?
1414

15-
- Zero-dependencies and extremely lightweight!
16-
- Written in TypeScript, allowing greater support for React, Angular, and other libraries!
17-
- Maintains existing SELECT DOM element for FORM compatibility.
18-
- Easily select and de-select your list items, which are shown as tags!
19-
- Full API available via public functions.
20-
- Fully styled in CSS/SASS (including the buttons) and compatible with the Bootstrap library.
21-
- Full CSS theme support (using :root variables, with a default dark-mode theme).
22-
- Custom triggers for actions (when elements are rendered, selection is changed, etc).
23-
- Shortcut keys (click [here](https://github.com/williamtroup/docs/SHORTCUT_KEYS.md) to see the full list).
15+
- 😏 Zero-dependencies and extremely lightweight!
16+
- 🦾 Written in TypeScript, allowing greater support for React, Angular, and other libraries!
17+
- ✏️ Maintains existing SELECT DOM element for FORM compatibility, allowing easy editing.
18+
- ☑️ Easily select and de-select your list items, which are shown as tags!
19+
- 💻 Full API available via public functions.
20+
- 📱 Fully styled in CSS/SASS (including the buttons) and compatible with the Bootstrap library.
21+
- 🌈 Full CSS theme support (using :root variables, with a default dark-mode theme).
22+
- 🚀 Custom triggers for actions (when elements are rendered, selection is changed, etc).
23+
- 🔠 Shortcut keys (click [here](https://github.com/williamtroup/docs/SHORTCUT_KEYS.md) to see the full list).
2424

2525

2626
## What browsers are supported?

dist/select.esm.js

Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ var Is;
2121
return t(e) && typeof e === "function";
2222
}
2323
e.definedFunction = r;
24-
function l(e) {
24+
function s(e) {
2525
return t(e) && typeof e === "number";
2626
}
27-
e.definedNumber = l;
28-
function s(e) {
27+
e.definedNumber = s;
28+
function l(e) {
2929
return n(e) && e instanceof Array;
3030
}
31-
e.definedArray = s;
31+
e.definedArray = l;
3232
})(Is || (Is = {}));
3333

3434
var Trigger;
@@ -155,21 +155,24 @@ var Binding;
155155
t.render = Default2.getBoolean(t.render, true);
156156
t.dropDownShowDelay = Default2.getNumber(t.dropDownShowDelay, 50);
157157
t.showDropDownButton = Default2.getBoolean(t.showDropDownButton, true);
158+
t.showRemoveButtonOnLeft = Default2.getBoolean(t.showRemoveButtonOnLeft, false);
158159
t = i(t);
159160
t = r(t);
160161
return t;
161162
}
162163
t.get = o;
163164
function i(e) {
164-
e.removeText = Default2.getString(e.removeText, "X");
165-
e.noItemsSelectedText = Default2.getString(e.noItemsSelectedText, "There are no items selected");
165+
e.text = Default2.getObject(e.text, {});
166+
e.text.removeText = Default2.getString(e.text.removeText, "✖");
167+
e.text.noItemsSelectedText = Default2.getString(e.text.noItemsSelectedText, "There are no items selected");
166168
return e;
167169
}
168170
function r(e) {
169-
e.onRenderComplete = Default2.getFunction(e.onRenderComplete, null);
170-
e.onSelectedItemsChanged = Default2.getFunction(e.onSelectedItemsChanged, null);
171-
e.onDropDownShow = Default2.getFunction(e.onDropDownShow, null);
172-
e.onDropDownHide = Default2.getFunction(e.onDropDownHide, null);
171+
e.events = Default2.getObject(e.events, {});
172+
e.events.onRenderComplete = Default2.getFunction(e.events.onRenderComplete, null);
173+
e.events.onSelectedItemsChanged = Default2.getFunction(e.events.onSelectedItemsChanged, null);
174+
e.events.onDropDownShow = Default2.getFunction(e.events.onDropDownShow, null);
175+
e.events.onDropDownHide = Default2.getFunction(e.events.onDropDownHide, null);
173176
return e;
174177
}
175178
})(t = e.Options || (e.Options = {}));
@@ -212,17 +215,17 @@ var Config;
212215
if (Is.defined(t) && t.hasAttribute(Constants.SELECT_JS_ATTRIBUTE_NAME)) {
213216
const o = t.getAttribute(Constants.SELECT_JS_ATTRIBUTE_NAME);
214217
if (Is.definedString(o)) {
215-
const l = Default2.getObjectFromString(o, e);
216-
if (l.parsed && Is.definedObject(l.object)) {
217-
const e = Binding.Options.getForNewInstance(l.object, t);
218+
const s = Default2.getObjectFromString(o, e);
219+
if (s.parsed && Is.definedObject(s.object)) {
220+
const e = Binding.Options.getForNewInstance(s.object, t);
218221
if (e.render) {
219222
t.removeAttribute(Constants.SELECT_JS_ATTRIBUTE_NAME);
220223
const n = i(t);
221224
const o = r(n, t, e);
222-
s(o);
225+
l(o);
223226
u(o, false);
224-
a(o);
225-
Trigger.customEvent(e.onRenderComplete, e._currentView.element);
227+
f(o);
228+
Trigger.customEvent(e.events.onRenderComplete, e._currentView.element);
226229
}
227230
} else {
228231
if (!e.safeMode) {
@@ -256,46 +259,46 @@ var Config;
256259
break;
257260
}
258261
}
259-
const l = DomElement.create("div", "select-js");
262+
const s = DomElement.create("div", "select-js");
260263
if (Is.defined(i)) {
261-
t.insertBefore(l, i);
264+
t.insertBefore(s, i);
262265
} else {
263-
t.appendChild(l);
266+
t.appendChild(s);
264267
}
265268
t.removeChild(e);
266-
l.appendChild(e);
267-
return l;
269+
s.appendChild(e);
270+
return s;
268271
}
269272
function r(e, n, o) {
270273
const i = DomElement.create("div", "control");
271274
e.appendChild(i);
272275
const r = DomElement.create("div", "drop-down");
273276
r.style.display = "none";
274277
e.appendChild(r);
275-
const l = {
278+
const s = {
276279
control: i,
277280
dropDown: r,
278281
select: n,
279282
bindingOptions: o,
280283
multiSelectEnabled: n.hasAttribute("multiple")
281284
};
282285
if (!o.showDropDownButton) {
283-
i.onclick = () => f(l);
286+
i.onclick = () => a(s);
284287
}
285-
t.push(l);
286-
return l;
288+
t.push(s);
289+
return s;
287290
}
288-
function l(e) {
291+
function s(e) {
289292
if (e.bindingOptions.showDropDownButton) {
290-
const t = DomElement.create("div", "button");
293+
const t = DomElement.create("div", "open-close-button");
291294
e.control.appendChild(t);
292295
if (p(e)) {
293296
t.classList.add("button-open");
294297
}
295-
t.onclick = () => f(e);
298+
t.onclick = () => a(e);
296299
}
297300
}
298-
function s(e) {
301+
function l(e) {
299302
const t = e.select.options;
300303
const n = t.length;
301304
e.dropDown.innerHTML = "";
@@ -336,7 +339,7 @@ var Config;
336339
const o = n.length;
337340
let i = false;
338341
e.control.innerHTML = "";
339-
l(e);
342+
s(e);
340343
for (let t = 0; t < o; t++) {
341344
const o = n[t];
342345
if (o.selected) {
@@ -346,11 +349,11 @@ var Config;
346349
}
347350
if (!i) {
348351
const t = DomElement.create("div", "no-items-selected");
349-
t.innerHTML = e.bindingOptions.noItemsSelectedText;
352+
t.innerHTML = e.bindingOptions.text.noItemsSelectedText;
350353
e.control.appendChild(t);
351354
}
352355
if (t) {
353-
Trigger.customEvent(e.bindingOptions.onSelectedItemsChanged, m(e));
356+
Trigger.customEvent(e.bindingOptions.events.onSelectedItemsChanged, m(e));
354357
}
355358
}
356359
function d(e, t) {
@@ -360,30 +363,34 @@ var Config;
360363
o.innerHTML = e.select.options[t].text;
361364
n.appendChild(o);
362365
if (e.multiSelectEnabled) {
363-
const o = DomElement.create("div", "remove");
364-
o.innerHTML = e.bindingOptions.removeText;
365-
n.appendChild(o);
366-
o.onclick = n => {
366+
const i = DomElement.create("div", "remove");
367+
i.innerHTML = e.bindingOptions.text.removeText;
368+
if (e.bindingOptions.showRemoveButtonOnLeft) {
369+
n.insertBefore(i, o);
370+
} else {
371+
n.appendChild(i);
372+
}
373+
i.onclick = n => {
367374
DomElement.cancelBubble(n);
368375
e.select.options[t].selected = false;
369376
g(e);
370377
u(e);
371378
};
372379
}
373380
}
374-
function a(e) {
381+
function f(e) {
375382
const t = () => g(e);
376383
document.body.addEventListener("click", t);
377384
window.addEventListener("resize", t);
378385
window.addEventListener("click", t);
379386
}
380-
function f(e) {
387+
function a(e) {
381388
if (!p(e)) {
382389
setTimeout((function() {
383390
e.dropDown.style.display = "block";
384-
s(e);
391+
l(e);
385392
u(e, false);
386-
Trigger.customEvent(e.bindingOptions.onDropDownShow);
393+
Trigger.customEvent(e.bindingOptions.events.onDropDownShow);
387394
}), e.bindingOptions.dropDownShowDelay);
388395
} else {
389396
g(e);
@@ -393,7 +400,7 @@ var Config;
393400
if (e.dropDown !== null && e.dropDown.style.display !== "none") {
394401
e.dropDown.style.display = "none";
395402
u(e, false);
396-
Trigger.customEvent(e.bindingOptions.onDropDownHide);
403+
Trigger.customEvent(e.bindingOptions.events.onDropDownHide);
397404
}
398405
}
399406
function p(e) {
@@ -427,7 +434,7 @@ var Config;
427434
g(t[n]);
428435
}
429436
}
430-
const S = {
437+
const v = {
431438
setConfiguration: function(t) {
432439
if (Is.definedObject(t)) {
433440
let n = false;
@@ -442,10 +449,10 @@ var Config;
442449
e = Config.Options.get(o);
443450
}
444451
}
445-
return S;
452+
return v;
446453
},
447454
getVersion: function() {
448-
return "1.0.0";
455+
return "1.1.0";
449456
}
450457
};
451458
(() => {
@@ -455,7 +462,7 @@ var Config;
455462
D();
456463
}));
457464
if (!Is.defined(window.$select)) {
458-
window.$select = S;
465+
window.$select = v;
459466
}
460467
})();
461468
})();//# sourceMappingURL=select.esm.js.map

0 commit comments

Comments
 (0)