@atlassian/aui 10.0.4 → 10.1.1
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/dist/aui/aui-css-deprecations.js +3 -1
- package/dist/aui/aui-css-deprecations.js.map +1 -1
- package/dist/aui/aui-prototyping-browserfocus.css +1 -1
- package/dist/aui/aui-prototyping-browserfocus.css.map +1 -1
- package/dist/aui/aui-prototyping-design-tokens-api-full.js +4 -10
- package/dist/aui/aui-prototyping-design-tokens-api-full.js.map +1 -1
- package/dist/aui/aui-prototyping-design-tokens-api.js +1 -10
- package/dist/aui/aui-prototyping-design-tokens-api.js.map +1 -1
- package/dist/aui/aui-prototyping-design-tokens-compatibility.css.map +1 -1
- package/dist/aui/aui-prototyping.css +6 -6
- package/dist/aui/aui-prototyping.css.map +1 -1
- package/dist/aui/aui-prototyping.js +64 -104
- package/dist/aui/aui-prototyping.js.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.css +6 -6
- package/dist/aui/aui-prototyping.nodeps.css.map +1 -1
- package/dist/aui/aui-prototyping.nodeps.js +64 -104
- package/dist/aui/aui-prototyping.nodeps.js.map +1 -1
- package/package.json +8 -7
- package/src/js/aui/blanket.js +1 -1
- package/src/js/aui/flag.js +1 -1
- package/src/js/aui/form-validation.js +1 -1
- package/src/js/aui/inline-dialog.js +30 -23
- package/src/js/aui/layer.js +1 -1
- package/src/js/aui/query-input.js +1 -1
- package/src/js/aui/restful-table/entry-model.js +2 -2
- package/src/js/aui/restful-table/event-handlers.js +1 -1
- package/src/js/aui/restful-table/row.js +1 -1
- package/src/js/aui/restful-table.js +2 -2
- package/src/js/aui/select2.js +3 -3
- package/src/js/aui/tabs.js +2 -2
- package/src/js/aui/when-i-type.js +2 -2
- package/src/js-vendor-effective/jquery.hotkeys/jquery.hotkeys.js +2 -2
- package/src/js-vendor-effective/select2/select2.js +31 -29
- package/src/js-vendor-effective/tablesorter/jquery.tablesorter.js +35 -35
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlassian/aui",
|
|
3
3
|
"description": "Atlassian User Interface library",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.1.1",
|
|
5
5
|
"author": "Atlassian Pty Ltd.",
|
|
6
6
|
"homepage": "https://aui.atlassian.com",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"//": "AUI's publishConfig is managed by its build scripts.",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"jquery": "^2 || ^3"
|
|
36
|
+
"jquery": "^2 || ^3 || ^4"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/tokens": "4.9.1",
|
|
@@ -58,17 +58,18 @@
|
|
|
58
58
|
"@types/backbone": "1.4.22",
|
|
59
59
|
"@types/jqueryui": "1.12.23",
|
|
60
60
|
"fs-extra": "9.1.0",
|
|
61
|
-
"ignore-emit-webpack-plugin": "2.0.6",
|
|
62
|
-
"jquery": "
|
|
63
|
-
"jquery-
|
|
61
|
+
"ignore-emit-webpack-plugin": "^2.0.6",
|
|
62
|
+
"jquery": "4.0.0",
|
|
63
|
+
"jquery-3": "npm:jquery@3.7.1",
|
|
64
64
|
"less": "4.2.0",
|
|
65
|
-
"react": "18.3.1"
|
|
65
|
+
"react": "18.3.1",
|
|
66
|
+
"webpack-merge": "6.0.1"
|
|
66
67
|
},
|
|
67
68
|
"scripts": {
|
|
68
69
|
"prepublishOnly": "yarn clean && cross-env NODE_ENV=production yarn build && node scripts/prepublishOnly.js",
|
|
69
70
|
"postpublish": "node scripts/postpublish.js",
|
|
70
71
|
"clean": "rm -rf ./dist",
|
|
71
|
-
"dist/build:prototyping": "
|
|
72
|
+
"dist/build:prototyping": "rspack --config webpack/dist.prototyping.webpack.config.js",
|
|
72
73
|
"build": "yarn dist/build:prototyping",
|
|
73
74
|
"watch": "yarn dist/build:prototyping --watch"
|
|
74
75
|
}
|
package/src/js/aui/blanket.js
CHANGED
package/src/js/aui/flag.js
CHANGED
|
@@ -183,7 +183,7 @@ function createArgumentAccessorFunction($field) {
|
|
|
183
183
|
|
|
184
184
|
function changeFieldState($field, state, message) {
|
|
185
185
|
$field.attr('data-' + ATTRIBUTE_FIELD_STATE, state);
|
|
186
|
-
$field.
|
|
186
|
+
$field.removeAttr('aria-invalid');
|
|
187
187
|
|
|
188
188
|
if (state === UNVALIDATED) {
|
|
189
189
|
return;
|
|
@@ -293,7 +293,7 @@ function InlineDialog(items, identifier, url, options) {
|
|
|
293
293
|
// lazy load popup contents
|
|
294
294
|
if (!contentLoading) {
|
|
295
295
|
contentLoading = true;
|
|
296
|
-
if (
|
|
296
|
+
if (typeof url === 'function') {
|
|
297
297
|
// If the passed in URL is a function, execute it. Otherwise simply load the content.
|
|
298
298
|
url(contents, trigger, doShowPopup);
|
|
299
299
|
} else {
|
|
@@ -441,7 +441,7 @@ function InlineDialog(items, identifier, url, options) {
|
|
|
441
441
|
*/
|
|
442
442
|
var bindHideOnExternalClick = function () {
|
|
443
443
|
if (!hasBoundOnExternalClick) {
|
|
444
|
-
$('body').
|
|
444
|
+
$('body').on('click.' + externalClickNamespace, function (e) {
|
|
445
445
|
var $target = $(e.target);
|
|
446
446
|
// hide the popup if the target of the event is not in the dialog
|
|
447
447
|
if (
|
|
@@ -539,18 +539,22 @@ function dimensionsOf(el) {
|
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
function getDimensions(popup, targetPosition, mousePosition, opts) {
|
|
542
|
-
var offsetX =
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
542
|
+
var offsetX =
|
|
543
|
+
typeof opts.offsetX === 'function'
|
|
544
|
+
? opts.offsetX(popup, targetPosition, mousePosition, opts)
|
|
545
|
+
: opts.offsetX;
|
|
546
|
+
var offsetY =
|
|
547
|
+
typeof opts.offsetY === 'function'
|
|
548
|
+
? opts.offsetY(popup, targetPosition, mousePosition, opts)
|
|
549
|
+
: opts.offsetY;
|
|
550
|
+
var arrowOffsetX =
|
|
551
|
+
typeof opts.arrowOffsetX === 'function'
|
|
552
|
+
? opts.arrowOffsetX(popup, targetPosition, mousePosition, opts)
|
|
553
|
+
: opts.arrowOffsetX;
|
|
554
|
+
var arrowOffsetY =
|
|
555
|
+
typeof opts.arrowOffsetY === 'function'
|
|
556
|
+
? opts.arrowOffsetY(popup, targetPosition, mousePosition, opts)
|
|
557
|
+
: opts.arrowOffsetY;
|
|
554
558
|
|
|
555
559
|
// Support positioning inside a scroll container other than <body>
|
|
556
560
|
var isConstrainedScroll = opts.container.toLowerCase() !== 'body';
|
|
@@ -703,15 +707,18 @@ function calculateWestPositions(popup, targetPosition, mousePosition, opts) {
|
|
|
703
707
|
}
|
|
704
708
|
|
|
705
709
|
function calculateNorthSouthPositions(popup, targetPosition, mousePosition, opts) {
|
|
706
|
-
var offsetX =
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
710
|
+
var offsetX =
|
|
711
|
+
typeof opts.offsetX === 'function'
|
|
712
|
+
? opts.offsetX(popup, targetPosition, mousePosition, opts)
|
|
713
|
+
: opts.offsetX;
|
|
714
|
+
var offsetY =
|
|
715
|
+
typeof opts.offsetY === 'function'
|
|
716
|
+
? opts.offsetY(popup, targetPosition, mousePosition, opts)
|
|
717
|
+
: opts.offsetY;
|
|
718
|
+
var arrowOffsetX =
|
|
719
|
+
typeof opts.arrowOffsetX === 'function'
|
|
720
|
+
? opts.arrowOffsetX(popup, targetPosition, mousePosition, opts)
|
|
721
|
+
: opts.arrowOffsetX;
|
|
715
722
|
|
|
716
723
|
var viewportDimensions = dimensionsOf(window);
|
|
717
724
|
var targetDimensions = dimensionsOf(targetPosition.target);
|
package/src/js/aui/layer.js
CHANGED
|
@@ -139,10 +139,10 @@ var EntryModel = Backbone.Model.extend({
|
|
|
139
139
|
$.each(attributes, function (name, value) {
|
|
140
140
|
if (!current[name]) {
|
|
141
141
|
if (typeof value === 'string') {
|
|
142
|
-
if (
|
|
142
|
+
if (value.trim() !== '') {
|
|
143
143
|
changed[name] = value;
|
|
144
144
|
}
|
|
145
|
-
} else if (
|
|
145
|
+
} else if (Array.isArray(value)) {
|
|
146
146
|
if (value.length !== 0) {
|
|
147
147
|
changed[name] = value;
|
|
148
148
|
}
|
|
@@ -290,7 +290,7 @@ export default Backbone.View.extend({
|
|
|
290
290
|
|
|
291
291
|
$cell = $('<td />').append($editableRegion).appendTo(instance.$el);
|
|
292
292
|
|
|
293
|
-
if (!contents ||
|
|
293
|
+
if (!contents || !String(contents).trim()) {
|
|
294
294
|
$cell.addClass(instance.classNames.NO_VALUE);
|
|
295
295
|
$editableRegion.html(
|
|
296
296
|
$('<em />').text(this.emptyText || I18n.getText('aui.enter.value'))
|
|
@@ -109,7 +109,7 @@ var RestfulTable = Backbone.View.extend({
|
|
|
109
109
|
// Let user know the table is loading
|
|
110
110
|
this.showGlobalLoading();
|
|
111
111
|
this.options.columns.forEach(function (column) {
|
|
112
|
-
var header =
|
|
112
|
+
var header = typeof column.header === 'function' ? column.header() : column.header;
|
|
113
113
|
if (typeof header === 'undefined') {
|
|
114
114
|
logger.warn(
|
|
115
115
|
'You have not specified [header] for column [' +
|
|
@@ -300,7 +300,7 @@ var RestfulTable = Backbone.View.extend({
|
|
|
300
300
|
|
|
301
301
|
fetchInitialResources: function () {
|
|
302
302
|
var instance = this;
|
|
303
|
-
if (
|
|
303
|
+
if (typeof this.options.resources.all === 'function') {
|
|
304
304
|
this.options.resources.all(function (entries) {
|
|
305
305
|
instance.populate(entries);
|
|
306
306
|
});
|
package/src/js/aui/select2.js
CHANGED
|
@@ -106,7 +106,7 @@ $.fn.auiSelect2 = function (first) {
|
|
|
106
106
|
// mask is created during opening event, before open
|
|
107
107
|
$('#select2-drop-mask').css('z-index', dropdownLayer.$el.css('z-index'));
|
|
108
108
|
|
|
109
|
-
if (options.multiple || $selectInput.
|
|
109
|
+
if (options.multiple || $selectInput.prop('multiple')) {
|
|
110
110
|
// This is a multi-select, exiting
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
@@ -137,7 +137,7 @@ $.fn.auiSelect2 = function (first) {
|
|
|
137
137
|
const $selectInput = $(this);
|
|
138
138
|
const wasAriaDescribedByCleared = $selectInput.data('was-ariadescribedby-cleared');
|
|
139
139
|
|
|
140
|
-
if (options.multiple || $selectInput.
|
|
140
|
+
if (options.multiple || $selectInput.prop('multiple') || wasAriaDescribedByCleared) {
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -153,7 +153,7 @@ $.fn.auiSelect2 = function (first) {
|
|
|
153
153
|
const $selectInput = $(this);
|
|
154
154
|
const $container = $selectInput.parent().find('.select2-container');
|
|
155
155
|
|
|
156
|
-
if (options.multiple || $selectInput.
|
|
156
|
+
if (options.multiple || $selectInput.prop('multiple')) {
|
|
157
157
|
if (searchLabel) {
|
|
158
158
|
$container.find('.select2-search-field label').text(searchLabel);
|
|
159
159
|
}
|
package/src/js/aui/tabs.js
CHANGED
|
@@ -207,7 +207,7 @@ function calculateResponsiveTabs(tabsContainer, index) {
|
|
|
207
207
|
var $dropdownTriggerTab = $tabsMenu.find('.aui-tabs-responsive-trigger').parent();
|
|
208
208
|
var $dropdownTrigger = $dropdownTriggerTab.find('a');
|
|
209
209
|
var dropdownId = $dropdownTrigger.attr('aria-controls');
|
|
210
|
-
var $dropdown = $(document.getElementById(dropdownId)).
|
|
210
|
+
var $dropdown = $(document.getElementById(dropdownId)).removeAttr('aria-checked');
|
|
211
211
|
var isResponsive = $dropdown.length > 0;
|
|
212
212
|
var totalTabsWidth = ResponsiveAdapter.totalTabsWidth($visibleTabs, $dropdown);
|
|
213
213
|
var needsResponsive = totalTabsWidth > $tabsContainer.outerWidth();
|
|
@@ -290,7 +290,7 @@ function switchToTab(tab) {
|
|
|
290
290
|
var dropdownId = $dropdownTriggerTab.attr('aria-controls');
|
|
291
291
|
var $dropdown = $(document.getElementById(dropdownId));
|
|
292
292
|
|
|
293
|
-
$dropdown.find('li a').
|
|
293
|
+
$dropdown.find('li a').removeAttr('aria-checked').removeClass('checked aui-dropdown2-checked');
|
|
294
294
|
$dropdown.find('li').removeClass('active-tab');
|
|
295
295
|
|
|
296
296
|
$tab.parent('li.menu-item')
|
|
@@ -76,7 +76,7 @@ function whenIType(keys) {
|
|
|
76
76
|
// Bind an arbitrary set of keys by calling bindKeyCombo on each triggering key combo.
|
|
77
77
|
// A string like "abc 123" means (a then b then c) OR (1 then 2 then 3). abc is one key combo, 123 is another.
|
|
78
78
|
function bindKeys(keys) {
|
|
79
|
-
var keyCombos = keys && keys.split ?
|
|
79
|
+
var keyCombos = keys && keys.split ? keys.trim().split(' ') : [keys];
|
|
80
80
|
|
|
81
81
|
keyCombos.forEach(function (keyCombo) {
|
|
82
82
|
bindKeyCombo(keyCombo);
|
|
@@ -562,7 +562,7 @@ whenIType.fromJSON = function (json, switchCtrlToMetaOnMac) {
|
|
|
562
562
|
);
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
-
if (
|
|
565
|
+
if (!Array.isArray(params)) {
|
|
566
566
|
logger.error(
|
|
567
567
|
'Badly formatted shortcut parameter. String or JSON Array of parameters required: ' +
|
|
568
568
|
param
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
|
|
67
67
|
function keyHandler( handleObj ) {
|
|
68
68
|
// Only care when a possible input has been specified
|
|
69
|
-
if ( !(jQuery.isPlainObject(handleObj.data) ||
|
|
69
|
+
if ( !(jQuery.isPlainObject(handleObj.data) || Array.isArray(handleObj.data) || typeof handleObj.data === "string") ) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
(function (data) {
|
|
80
80
|
if (typeof data === 'string') {
|
|
81
81
|
options.combo = [ data ];
|
|
82
|
-
} else if (
|
|
82
|
+
} else if (Array.isArray(data)) {
|
|
83
83
|
options.combo = data;
|
|
84
84
|
} else {
|
|
85
85
|
jQuery.extend(options, data);
|
|
@@ -320,7 +320,8 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
320
320
|
function syncCssClasses(dest, src, adapter) {
|
|
321
321
|
var classes, replacements = [], adapted;
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
const destClassesAttr = dest.attr("class");
|
|
324
|
+
classes = (destClassesAttr === undefined || destClassesAttr === null) ? "" : destClassesAttr.trim();
|
|
324
325
|
|
|
325
326
|
if (classes) {
|
|
326
327
|
classes = '' + classes; // for IE which returns object
|
|
@@ -332,7 +333,8 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
332
333
|
});
|
|
333
334
|
}
|
|
334
335
|
|
|
335
|
-
|
|
336
|
+
const srcClassesAttr = src.attr("class");
|
|
337
|
+
classes = (srcClassesAttr === undefined || srcClassesAttr === null) ? "" : srcClassesAttr.trim();
|
|
336
338
|
|
|
337
339
|
if (classes) {
|
|
338
340
|
classes = '' + classes; // for IE which returns object
|
|
@@ -428,7 +430,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
428
430
|
if (handler && typeof handler.abort === "function") { handler.abort(); }
|
|
429
431
|
|
|
430
432
|
if (options.params) {
|
|
431
|
-
if (
|
|
433
|
+
if (typeof options.params === 'function') {
|
|
432
434
|
$.extend(params, options.params.call(self));
|
|
433
435
|
} else {
|
|
434
436
|
$.extend(params, options.params);
|
|
@@ -481,12 +483,12 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
481
483
|
tmp,
|
|
482
484
|
text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
|
|
483
485
|
|
|
484
|
-
if (
|
|
486
|
+
if (Array.isArray(data)) {
|
|
485
487
|
tmp = data;
|
|
486
488
|
data = { results: tmp };
|
|
487
489
|
}
|
|
488
490
|
|
|
489
|
-
if (
|
|
491
|
+
if (data !== 'function') {
|
|
490
492
|
tmp = data;
|
|
491
493
|
data = function() { return tmp; };
|
|
492
494
|
}
|
|
@@ -495,7 +497,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
495
497
|
if (dataItem.text) {
|
|
496
498
|
text = dataItem.text;
|
|
497
499
|
// if text is not a function we assume it to be a key name
|
|
498
|
-
if (
|
|
500
|
+
if (text !== 'function') {
|
|
499
501
|
dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
|
|
500
502
|
text = function (item) { return item[dataText]; };
|
|
501
503
|
}
|
|
@@ -535,11 +537,11 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
535
537
|
|
|
536
538
|
// TODO javadoc
|
|
537
539
|
function tags(data) {
|
|
538
|
-
var isFunc =
|
|
540
|
+
var isFunc = typeof data === 'function';
|
|
539
541
|
return function (query) {
|
|
540
542
|
var t = query.term, filtered = {results: []};
|
|
541
543
|
var result = isFunc ? data(query) : data;
|
|
542
|
-
if (
|
|
544
|
+
if (Array.isArray(result)) {
|
|
543
545
|
$(result).each(function () {
|
|
544
546
|
var isObject = this.text !== undefined,
|
|
545
547
|
text = isObject ? this.text : this;
|
|
@@ -561,7 +563,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
561
563
|
* @param formatter
|
|
562
564
|
*/
|
|
563
565
|
function checkFormatter(formatter, formatterName) {
|
|
564
|
-
if (
|
|
566
|
+
if (typeof formatter === 'function') return true;
|
|
565
567
|
if (!formatter) return false;
|
|
566
568
|
if (typeof(formatter) === 'string') return true;
|
|
567
569
|
throw new Error(formatterName +" must be a string, function, or falsy value");
|
|
@@ -576,7 +578,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
576
578
|
* @returns {*}
|
|
577
579
|
*/
|
|
578
580
|
function evaluate(val, context) {
|
|
579
|
-
if (
|
|
581
|
+
if (typeof val === 'function') {
|
|
580
582
|
var args = Array.prototype.slice.call(arguments, 2);
|
|
581
583
|
return val.apply(context, args);
|
|
582
584
|
}
|
|
@@ -816,7 +818,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
816
818
|
|
|
817
819
|
this.lastSearchTerm = undefined;
|
|
818
820
|
|
|
819
|
-
if (
|
|
821
|
+
if (typeof this.opts.initSelection === 'function') {
|
|
820
822
|
// initialize selection based on the current value of the source element
|
|
821
823
|
this.initSelection();
|
|
822
824
|
|
|
@@ -1026,7 +1028,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
1026
1028
|
var elemTags = opts.element.data('tags');
|
|
1027
1029
|
|
|
1028
1030
|
// data-tags should actually be a boolean
|
|
1029
|
-
if (
|
|
1031
|
+
if (!Array.isArray(elemTags)) {
|
|
1030
1032
|
elemTags = [];
|
|
1031
1033
|
}
|
|
1032
1034
|
|
|
@@ -1045,7 +1047,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
1045
1047
|
|
|
1046
1048
|
// ajax.results -> ajax.processResults
|
|
1047
1049
|
if (opts.ajax != null) {
|
|
1048
|
-
if (
|
|
1050
|
+
if (typeof opts.ajax.processResults === 'function') {
|
|
1049
1051
|
opts.ajax.results = opts.ajax.processResults;
|
|
1050
1052
|
}
|
|
1051
1053
|
}
|
|
@@ -1055,32 +1057,32 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
1055
1057
|
var lang = opts.language;
|
|
1056
1058
|
|
|
1057
1059
|
// formatNoMatches -> language.noMatches
|
|
1058
|
-
if (
|
|
1060
|
+
if (typeof lang.noMatches === 'function') {
|
|
1059
1061
|
opts.formatNoMatches = lang.noMatches;
|
|
1060
1062
|
}
|
|
1061
1063
|
|
|
1062
1064
|
// formatSearching -> language.searching
|
|
1063
|
-
if (
|
|
1065
|
+
if (typeof lang.searching === 'function') {
|
|
1064
1066
|
opts.formatSearching = lang.searching;
|
|
1065
1067
|
}
|
|
1066
1068
|
|
|
1067
1069
|
// formatInputTooShort -> language.inputTooShort
|
|
1068
|
-
if (
|
|
1070
|
+
if (typeof lang.inputTooShort === 'function') {
|
|
1069
1071
|
opts.formatInputTooShort = lang.inputTooShort;
|
|
1070
1072
|
}
|
|
1071
1073
|
|
|
1072
1074
|
// formatInputTooLong -> language.inputTooLong
|
|
1073
|
-
if (
|
|
1075
|
+
if (typeof lang.inputTooLong === 'function') {
|
|
1074
1076
|
opts.formatInputTooLong = lang.inputTooLong;
|
|
1075
1077
|
}
|
|
1076
1078
|
|
|
1077
1079
|
// formatLoading -> language.loadingMore
|
|
1078
|
-
if (
|
|
1080
|
+
if (typeof lang.loadingMore === 'function') {
|
|
1079
1081
|
opts.formatLoading = lang.loadingMore;
|
|
1080
1082
|
}
|
|
1081
1083
|
|
|
1082
1084
|
// formatSelectionTooBig -> language.maximumSelected
|
|
1083
|
-
if (
|
|
1085
|
+
if (typeof lang.maximumSelected === 'function') {
|
|
1084
1086
|
opts.formatSelectionTooBig = lang.maximumSelected;
|
|
1085
1087
|
}
|
|
1086
1088
|
}
|
|
@@ -1152,7 +1154,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
1152
1154
|
opts.id = function (e) { return e[idKey]; };
|
|
1153
1155
|
}
|
|
1154
1156
|
|
|
1155
|
-
if (
|
|
1157
|
+
if (Array.isArray(opts.element.data("select2Tags"))) {
|
|
1156
1158
|
if ("tags" in opts) {
|
|
1157
1159
|
throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
|
|
1158
1160
|
}
|
|
@@ -1209,7 +1211,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
1209
1211
|
} else if ("tags" in opts) {
|
|
1210
1212
|
opts.query = tags(opts.tags);
|
|
1211
1213
|
if (opts.createSearchChoice === undefined) {
|
|
1212
|
-
opts.createSearchChoice = function (term) { return {id:
|
|
1214
|
+
opts.createSearchChoice = function (term) { return {id: (term === undefined || term === null) ? "" : term.trim(), text: (term === undefined || term === null) ? "" : term.trim()}; };
|
|
1213
1215
|
}
|
|
1214
1216
|
if (opts.initSelection === undefined) {
|
|
1215
1217
|
opts.initSelection = function (element, callback) {
|
|
@@ -1217,7 +1219,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
1217
1219
|
$(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () {
|
|
1218
1220
|
var obj = { id: this, text: this },
|
|
1219
1221
|
tags = opts.tags;
|
|
1220
|
-
if (
|
|
1222
|
+
if (typeof tags === 'function') tags=tags();
|
|
1221
1223
|
$(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
|
|
1222
1224
|
data.push(obj);
|
|
1223
1225
|
});
|
|
@@ -1904,7 +1906,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
1904
1906
|
var maxSelSize = this.getMaximumSelectionSize();
|
|
1905
1907
|
if (maxSelSize >=1) {
|
|
1906
1908
|
data = this.data();
|
|
1907
|
-
if (
|
|
1909
|
+
if (Array.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
|
|
1908
1910
|
render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
|
|
1909
1911
|
return;
|
|
1910
1912
|
}
|
|
@@ -2070,7 +2072,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
2070
2072
|
//Determine the placeholder option based on the specified placeholderOption setting
|
|
2071
2073
|
return (this.opts.placeholderOption === "first" && firstOption) ||
|
|
2072
2074
|
(typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
|
|
2073
|
-
} else if (
|
|
2075
|
+
} else if (firstOption.text() == null ? "" : firstOption.text().trim() === "" && firstOption.val() === "") {
|
|
2074
2076
|
//No explicit placeholder option specified, use the first if it's blank
|
|
2075
2077
|
return firstOption;
|
|
2076
2078
|
}
|
|
@@ -2116,7 +2118,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
2116
2118
|
}
|
|
2117
2119
|
|
|
2118
2120
|
return null;
|
|
2119
|
-
} else if (
|
|
2121
|
+
} else if (typeof this.opts.width === 'function') {
|
|
2120
2122
|
return this.opts.width();
|
|
2121
2123
|
} else {
|
|
2122
2124
|
return this.opts.width;
|
|
@@ -2530,7 +2532,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
2530
2532
|
}
|
|
2531
2533
|
return is_match;
|
|
2532
2534
|
},
|
|
2533
|
-
callback:
|
|
2535
|
+
callback: typeof callback !== 'function' ? $.noop : function() {
|
|
2534
2536
|
callback(match);
|
|
2535
2537
|
}
|
|
2536
2538
|
});
|
|
@@ -2822,7 +2824,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
2822
2824
|
}
|
|
2823
2825
|
return is_match;
|
|
2824
2826
|
},
|
|
2825
|
-
callback:
|
|
2827
|
+
callback: callback !== 'function' ? $.noop : function() {
|
|
2826
2828
|
// reorder matches based on the order they appear in the ids array because right now
|
|
2827
2829
|
// they are in the order in which they appear in data array
|
|
2828
2830
|
var ordered = [];
|
|
@@ -3625,7 +3627,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
3625
3627
|
return markup.join("");
|
|
3626
3628
|
},
|
|
3627
3629
|
transformVal: function(val) {
|
|
3628
|
-
return
|
|
3630
|
+
return (val === undefined || val === null) ? "" : val.trim();
|
|
3629
3631
|
},
|
|
3630
3632
|
formatSelection: function (data, container, escapeMarkup) {
|
|
3631
3633
|
return data ? escapeMarkup(this.text(data)) : undefined;
|
|
@@ -3642,7 +3644,7 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
3642
3644
|
id: function (e) { return e == undefined ? null : e.id; },
|
|
3643
3645
|
text: function (e) {
|
|
3644
3646
|
if (e && this.data && this.data.text) {
|
|
3645
|
-
if (
|
|
3647
|
+
if (typeof this.data.text === 'function') {
|
|
3646
3648
|
return this.data.text(e);
|
|
3647
3649
|
} else {
|
|
3648
3650
|
return e[this.data.text];
|