jsuites 5.5.0 → 5.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +8 -0
- package/dist/jsuites.js +25 -35
- package/dist/types/dropdown.d.ts +2 -2
- package/package.json +1 -1
package/changelog.md
CHANGED
package/dist/jsuites.js
CHANGED
|
@@ -6131,12 +6131,12 @@ function Dropdown() {
|
|
|
6131
6131
|
onfocus: null,
|
|
6132
6132
|
onblur: null,
|
|
6133
6133
|
oninsert: null,
|
|
6134
|
-
onbeforeinput: null,
|
|
6135
6134
|
onbeforeinsert: null,
|
|
6136
6135
|
onsearch: null,
|
|
6137
6136
|
onbeforesearch: null,
|
|
6138
6137
|
sortResults: false,
|
|
6139
6138
|
autofocus: false,
|
|
6139
|
+
prompt: null,
|
|
6140
6140
|
}
|
|
6141
6141
|
|
|
6142
6142
|
// Loop through our object
|
|
@@ -6446,34 +6446,11 @@ function Dropdown() {
|
|
|
6446
6446
|
}
|
|
6447
6447
|
}
|
|
6448
6448
|
|
|
6449
|
-
|
|
6450
|
-
* Add a new item
|
|
6451
|
-
* @param {string} title - title of the new item
|
|
6452
|
-
* @param {string} id - value/id of the new item
|
|
6453
|
-
*/
|
|
6454
|
-
obj.add = async function (title, id) {
|
|
6455
|
-
if (typeof (obj.options.onbeforeinput) == 'function') {
|
|
6456
|
-
let ret = await obj.options.onbeforeinput(obj, title);
|
|
6457
|
-
if (ret === false) {
|
|
6458
|
-
return false;
|
|
6459
|
-
} else if (ret) {
|
|
6460
|
-
if (typeof(ret) === 'object') {
|
|
6461
|
-
if (ret.title) {
|
|
6462
|
-
title = ret.title;
|
|
6463
|
-
}
|
|
6464
|
-
if (ret.id) {
|
|
6465
|
-
id = ret.id;
|
|
6466
|
-
}
|
|
6467
|
-
} else {
|
|
6468
|
-
title = ret;
|
|
6469
|
-
}
|
|
6470
|
-
}
|
|
6471
|
-
}
|
|
6472
|
-
|
|
6449
|
+
const add = function(title, id) {
|
|
6473
6450
|
if (! title) {
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
if (!title) {
|
|
6451
|
+
let current = obj.options.autocomplete == true ? obj.header.value : '';
|
|
6452
|
+
title = prompt(dictionary.translate('Add A New Option'), current);
|
|
6453
|
+
if (! title) {
|
|
6477
6454
|
return false;
|
|
6478
6455
|
}
|
|
6479
6456
|
}
|
|
@@ -6533,6 +6510,18 @@ function Dropdown() {
|
|
|
6533
6510
|
return item;
|
|
6534
6511
|
}
|
|
6535
6512
|
|
|
6513
|
+
/**
|
|
6514
|
+
* Add a new item
|
|
6515
|
+
* @param {string} title - title of the new item
|
|
6516
|
+
* @param {string} id - value/id of the new item
|
|
6517
|
+
*/
|
|
6518
|
+
obj.add = function (title, id) {
|
|
6519
|
+
if (typeof (obj.options.prompt) == 'function') {
|
|
6520
|
+
return obj.options.prompt.call(obj, add);
|
|
6521
|
+
}
|
|
6522
|
+
return add(title, id);
|
|
6523
|
+
}
|
|
6524
|
+
|
|
6536
6525
|
/**
|
|
6537
6526
|
* Create a new item
|
|
6538
6527
|
*/
|
|
@@ -12780,7 +12769,7 @@ var jSuites = {
|
|
|
12780
12769
|
...dictionary,
|
|
12781
12770
|
...helpers,
|
|
12782
12771
|
/** Current version */
|
|
12783
|
-
version: '5.5.
|
|
12772
|
+
version: '5.5.2',
|
|
12784
12773
|
/** Bind new extensions to Jsuites */
|
|
12785
12774
|
setExtensions: function(o) {
|
|
12786
12775
|
if (typeof(o) == 'object') {
|
|
@@ -12842,6 +12831,12 @@ const Events = function() {
|
|
|
12842
12831
|
|
|
12843
12832
|
tracking.state = [];
|
|
12844
12833
|
|
|
12834
|
+
// Block event to run twice
|
|
12835
|
+
if (window['jSuitesEvents'] === true) {
|
|
12836
|
+
return;
|
|
12837
|
+
}
|
|
12838
|
+
window['jSuitesEvents'] = true;
|
|
12839
|
+
|
|
12845
12840
|
const find = function(DOMElement, component) {
|
|
12846
12841
|
if (DOMElement[component.type] && DOMElement[component.type] == component) {
|
|
12847
12842
|
return true;
|
|
@@ -13288,15 +13283,10 @@ const Events = function() {
|
|
|
13288
13283
|
document.addEventListener('keydown', keyDown);
|
|
13289
13284
|
document.addEventListener('contextmenu', contextMenu);
|
|
13290
13285
|
document.addEventListener('input', input);
|
|
13291
|
-
|
|
13292
|
-
// Block same events twice
|
|
13293
|
-
window['jSuitesEvents'] = true;
|
|
13294
13286
|
}
|
|
13295
13287
|
|
|
13296
13288
|
if (typeof(document) !== "undefined" && ! tracking.state) {
|
|
13297
|
-
|
|
13298
|
-
Events();
|
|
13299
|
-
}
|
|
13289
|
+
Events();
|
|
13300
13290
|
}
|
|
13301
13291
|
|
|
13302
13292
|
/* harmony default export */ var jsuites = (jSuites);
|
package/dist/types/dropdown.d.ts
CHANGED
|
@@ -75,12 +75,12 @@ interface DropdownOptions {
|
|
|
75
75
|
onbeforesearch?: (obj: Dropdown, ajaxRequest: object) => boolean | null;
|
|
76
76
|
/** Event handler for processing search results */
|
|
77
77
|
onsearch?: (obj: Dropdown, result: object) => void;
|
|
78
|
-
/** Before adding a new element to the dropdown. This is async method */
|
|
79
|
-
onbeforeinput?: (obj: Dropdown, title: string) => string | Item;
|
|
80
78
|
/** Toggles the sorting of dropdown elements */
|
|
81
79
|
sortResults?: boolean;
|
|
82
80
|
/** Indicates if the dropdown should automatically receive focus upon creation */
|
|
83
81
|
autofocus?: boolean;
|
|
82
|
+
/** Custom prompt on insert new items */
|
|
83
|
+
prompt?: (addNewRow: (title: string, id: any) => void) => boolean;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
interface ItemContainer {
|
package/package.json
CHANGED