Skip to content

Commit 752283e

Browse files
author
Kevin Kotosky
committed
added in sortable support for ie10 and 11
1 parent 29c6f6e commit 752283e

8 files changed

+45
-56
lines changed

bower.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

dist/select.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.12.0 - 2015-06-04T17:31:50.812Z
4+
* Version: 0.12.0 - 2015-06-05T17:52:29.869Z
55
* License: MIT
66
*/
77

dist/select.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.12.0 - 2015-06-04T17:31:50.811Z
4+
* Version: 0.12.0 - 2015-06-05T17:52:29.866Z
55
* License: MIT
66
*/
77

@@ -288,7 +288,6 @@ uis.controller('uiSelectCtrl',
288288

289289
// Most of the time the user does not want to empty the search input when in typeahead mode
290290
function _resetSearchInput() {
291-
console.log('reset search input');
292291
if (ctrl.resetSearchInput || (ctrl.resetSearchInput === undefined && uiSelectConfig.resetSearchInput)) {
293292
ctrl.search = EMPTY_SEARCH;
294293
//reset activeIndex
@@ -311,7 +310,7 @@ uis.controller('uiSelectCtrl',
311310
}
312311

313312
// When the user clicks on ui-select, displays the dropdown list
314-
ctrl.activate = function(initSearchValue, editing) {
313+
ctrl.activate = function(initSearchValue) {
315314
if (!ctrl.disabled && !ctrl.open) {
316315

317316
$scope.$broadcast('uis:activate');
@@ -396,10 +395,6 @@ uis.controller('uiSelectCtrl',
396395
}
397396
}
398397
};
399-
ctrl.editTag = function(item, thing) {
400-
console.log(item);
401-
console.log(thing);
402-
}
403398
// See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L259
404399
$scope.$watchCollection(ctrl.parserResult.source, function(items) {
405400
if (items === undefined || items === null) {
@@ -1120,7 +1115,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', '$log', function
11201115
//the dropdown should remove that item
11211116
$select.refreshItems();
11221117
$select.sizeSearchInput();
1123-
}
1118+
};
11241119
ctrl.editTag = function(item, index) {
11251120
var editSearch = $select.selected[index];
11261121
$select.searchInput[0].focus();
@@ -1134,7 +1129,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', '$log', function
11341129
$select.activeIndex = 0;
11351130
$select.searchInput[0].focus();
11361131
});
1137-
}
1132+
};
11381133
// Remove item from multiple select
11391134
ctrl.removeChoice = function(index){
11401135

@@ -1676,9 +1671,15 @@ uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', f
16761671
});
16771672

16781673
element.on('dragstart', function(e) {
1674+
var dataTransfer;
16791675
element.addClass(draggingClassName);
1680-
1681-
(e.dataTransfer || e.originalEvent.dataTransfer).setData('text/plain', scope.$index);
1676+
if (e.dataTransfer) {
1677+
dataTransfer = e.dataTransfer;
1678+
} else {
1679+
dataTransfer = e.originalEvent.dataTransfer;
1680+
}
1681+
var stringIndex = ''+scope.$index;
1682+
dataTransfer.setData('Text', stringIndex);
16821683
});
16831684

16841685
element.on('dragend', function() {
@@ -1720,7 +1721,15 @@ uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', f
17201721
var dropHandler = function(e) {
17211722
e.preventDefault();
17221723

1723-
var droppedItemIndex = parseInt((e.dataTransfer || e.originalEvent.dataTransfer).getData('text/plain'), 10);
1724+
var data;
1725+
1726+
if (e.dataTransfer) {
1727+
data = e.dataTransfer;
1728+
} else {
1729+
data = e.originalEvent.dataTransfer;
1730+
}
1731+
1732+
var droppedItemIndex = data.getData('Text');
17241733

17251734
// prevent event firing multiple times in firefox
17261735
$timeout.cancel(dropTimeout);

dist/select.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/select.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uiSelectController.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ uis.controller('uiSelectCtrl',
5151

5252
// Most of the time the user does not want to empty the search input when in typeahead mode
5353
function _resetSearchInput() {
54-
console.log('reset search input');
5554
if (ctrl.resetSearchInput || (ctrl.resetSearchInput === undefined && uiSelectConfig.resetSearchInput)) {
5655
ctrl.search = EMPTY_SEARCH;
5756
//reset activeIndex
@@ -74,7 +73,7 @@ uis.controller('uiSelectCtrl',
7473
}
7574

7675
// When the user clicks on ui-select, displays the dropdown list
77-
ctrl.activate = function(initSearchValue, editing) {
76+
ctrl.activate = function(initSearchValue) {
7877
if (!ctrl.disabled && !ctrl.open) {
7978

8079
$scope.$broadcast('uis:activate');
@@ -159,10 +158,6 @@ uis.controller('uiSelectCtrl',
159158
}
160159
}
161160
};
162-
ctrl.editTag = function(item, thing) {
163-
console.log(item);
164-
console.log(thing);
165-
}
166161
// See https://github.com/angular/angular.js/blob/v1.2.15/src/ng/directive/ngRepeat.js#L259
167162
$scope.$watchCollection(ctrl.parserResult.source, function(items) {
168163
if (items === undefined || items === null) {

src/uiSelectMultipleDirective.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', '$log', function
2525
//the dropdown should remove that item
2626
$select.refreshItems();
2727
$select.sizeSearchInput();
28-
}
28+
};
2929
ctrl.editTag = function(item, index) {
3030
var editSearch = $select.selected[index];
3131
$select.searchInput[0].focus();
@@ -39,7 +39,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', '$log', function
3939
$select.activeIndex = 0;
4040
$select.searchInput[0].focus();
4141
});
42-
}
42+
};
4343
// Remove item from multiple select
4444
ctrl.removeChoice = function(index){
4545

src/uiSelectSortDirective.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', f
2929
});
3030

3131
element.on('dragstart', function(e) {
32+
var dataTransfer;
3233
element.addClass(draggingClassName);
33-
34-
(e.dataTransfer || e.originalEvent.dataTransfer).setData('text/plain', scope.$index);
34+
if (e.dataTransfer) {
35+
dataTransfer = e.dataTransfer;
36+
} else {
37+
dataTransfer = e.originalEvent.dataTransfer;
38+
}
39+
var stringIndex = ''+scope.$index;
40+
dataTransfer.setData('Text', stringIndex);
3541
});
3642

3743
element.on('dragend', function() {
@@ -73,7 +79,15 @@ uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', f
7379
var dropHandler = function(e) {
7480
e.preventDefault();
7581

76-
var droppedItemIndex = parseInt((e.dataTransfer || e.originalEvent.dataTransfer).getData('text/plain'), 10);
82+
var data;
83+
84+
if (e.dataTransfer) {
85+
data = e.dataTransfer;
86+
} else {
87+
data = e.originalEvent.dataTransfer;
88+
}
89+
90+
var droppedItemIndex = data.getData('Text');
7791

7892
// prevent event firing multiple times in firefox
7993
$timeout.cancel(dropTimeout);

0 commit comments

Comments
 (0)