semantic-ui-sass 1.7.3.0 → 1.8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/assets/javascripts/semantic-ui/api.js +22 -11
- data/app/assets/javascripts/semantic-ui/checkbox.js +1 -1
- data/app/assets/javascripts/semantic-ui/dropdown.js +204 -105
- data/app/assets/javascripts/semantic-ui/form.js +259 -43
- data/app/assets/javascripts/semantic-ui/popup.js +4 -3
- data/app/assets/javascripts/semantic-ui/search.js +310 -152
- data/app/assets/javascripts/semantic-ui/sidebar.js +18 -7
- data/app/assets/javascripts/semantic-ui/sticky.js +1 -1
- data/app/assets/javascripts/semantic-ui/transition.js +35 -23
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +31 -1
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +21 -20
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +15 -3
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +70 -31
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +11 -8
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +9 -19
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +55 -28
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +2 -1
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +5 -2
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +2 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1557 -538
- data/app/assets/stylesheets/semantic-ui/modules/_video.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
- data/lib/semantic/ui/sass/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72dcf881ec1e91a60899de41d3af1792e9853974
|
4
|
+
data.tar.gz: 448d5c2f58c7a09609e7847ecbec2615b058d7c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1252eba432c362083d54dfb6be761a2a931e4ba8d05b1e1b33b51c9f33f764e9431c1287d1f407253e4e7a97e11dfc85a1c494da2dec3824ede1345d26177bf3
|
7
|
+
data.tar.gz: 6cc0c00132bfa3fd30785ccc436c9b48fcea2bf186ec43c7ef295b6725310dcfb00798c36098610878a951efa4274fbd4d85f778bd419e5519014c3e916ff3db
|
data/CHANGELOG.md
CHANGED
@@ -83,7 +83,8 @@ $.api = $.fn.api = function(parameters) {
|
|
83
83
|
.on(triggerEvent + eventNamespace, module.event.trigger)
|
84
84
|
;
|
85
85
|
}
|
86
|
-
else {
|
86
|
+
else if(settings.on == 'now') {
|
87
|
+
module.debug('Querying API now', triggerEvent);
|
87
88
|
module.query();
|
88
89
|
}
|
89
90
|
}
|
@@ -181,17 +182,18 @@ $.api = $.fn.api = function(parameters) {
|
|
181
182
|
|
182
183
|
module.verbose('Creating AJAX request with settings', ajaxSettings);
|
183
184
|
|
184
|
-
if(
|
185
|
-
module.request = module.create.request();
|
186
|
-
module.xhr = module.create.xhr();
|
187
|
-
}
|
188
|
-
else {
|
185
|
+
if( module.is.loading() ) {
|
189
186
|
// throttle additional requests
|
190
187
|
module.timer = setTimeout(function() {
|
191
188
|
module.request = module.create.request();
|
192
189
|
module.xhr = module.create.xhr();
|
193
190
|
}, settings.throttle);
|
194
191
|
}
|
192
|
+
else {
|
193
|
+
// immediately on first request
|
194
|
+
module.request = module.create.request();
|
195
|
+
module.xhr = module.create.xhr();
|
196
|
+
}
|
195
197
|
|
196
198
|
},
|
197
199
|
|
@@ -421,7 +423,7 @@ $.api = $.fn.api = function(parameters) {
|
|
421
423
|
;
|
422
424
|
},
|
423
425
|
xhr: function() {
|
424
|
-
$.ajax(ajaxSettings)
|
426
|
+
return $.ajax(ajaxSettings)
|
425
427
|
.always(module.event.xhr.always)
|
426
428
|
.done(module.event.xhr.done)
|
427
429
|
.fail(module.event.xhr.fail)
|
@@ -548,7 +550,7 @@ $.api = $.fn.api = function(parameters) {
|
|
548
550
|
var
|
549
551
|
url
|
550
552
|
;
|
551
|
-
action = action || $module.data(
|
553
|
+
action = action || $module.data(metadata.action) || settings.action || false;
|
552
554
|
if(action) {
|
553
555
|
module.debug('Looking up url for action', action, settings.api);
|
554
556
|
if(settings.api[action] !== undefined) {
|
@@ -563,6 +565,17 @@ $.api = $.fn.api = function(parameters) {
|
|
563
565
|
}
|
564
566
|
},
|
565
567
|
|
568
|
+
abort: function() {
|
569
|
+
var
|
570
|
+
xhr = module.get.xhr()
|
571
|
+
;
|
572
|
+
if( xhr && xhr.state() !== 'resolved') {
|
573
|
+
module.debug('Cancelling API request');
|
574
|
+
xhr.abort();
|
575
|
+
module.request.rejectWith(settings.apiSettings);
|
576
|
+
}
|
577
|
+
},
|
578
|
+
|
566
579
|
// reset state
|
567
580
|
reset: function() {
|
568
581
|
module.remove.error();
|
@@ -827,9 +840,7 @@ $.api.settings = {
|
|
827
840
|
},
|
828
841
|
|
829
842
|
metadata: {
|
830
|
-
action : 'action'
|
831
|
-
request : 'request',
|
832
|
-
xhr : 'xhr'
|
843
|
+
action : 'action'
|
833
844
|
}
|
834
845
|
};
|
835
846
|
|
@@ -73,7 +73,14 @@ $.fn.dropdown = function(parameters) {
|
|
73
73
|
|
74
74
|
initialize: function() {
|
75
75
|
module.debug('Initializing dropdown', settings);
|
76
|
-
|
76
|
+
|
77
|
+
if( module.is.alreadySetup() ) {
|
78
|
+
module.error(error.alreadySetup);
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
module.setup.layout();
|
82
|
+
}
|
83
|
+
|
77
84
|
module.save.defaults();
|
78
85
|
module.set.selected();
|
79
86
|
|
@@ -104,6 +111,9 @@ $.fn.dropdown = function(parameters) {
|
|
104
111
|
.off(eventNamespace)
|
105
112
|
.removeData(moduleNamespace)
|
106
113
|
;
|
114
|
+
$menu
|
115
|
+
.off(eventNamespace)
|
116
|
+
;
|
107
117
|
$document
|
108
118
|
.off(elementNamespace)
|
109
119
|
;
|
@@ -112,8 +122,14 @@ $.fn.dropdown = function(parameters) {
|
|
112
122
|
observeChanges: function() {
|
113
123
|
if('MutationObserver' in window) {
|
114
124
|
observer = new MutationObserver(function(mutations) {
|
115
|
-
module.
|
116
|
-
|
125
|
+
if( module.is.selectMutation(mutations) ) {
|
126
|
+
module.debug('<select> modified, recreating menu');
|
127
|
+
module.setup.select();
|
128
|
+
}
|
129
|
+
else {
|
130
|
+
module.debug('DOM tree modified, updating selector cache');
|
131
|
+
module.refresh();
|
132
|
+
}
|
117
133
|
});
|
118
134
|
observer.observe(element, {
|
119
135
|
childList : true,
|
@@ -162,24 +178,27 @@ $.fn.dropdown = function(parameters) {
|
|
162
178
|
},
|
163
179
|
select: function() {
|
164
180
|
var
|
165
|
-
selectValues
|
181
|
+
selectValues = module.get.selectValues()
|
166
182
|
;
|
167
183
|
module.debug('Dropdown initialized on a select', selectValues);
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
184
|
+
if( $module.is('select') ) {
|
185
|
+
$input = $module;
|
186
|
+
}
|
187
|
+
// see if select is placed correctly already
|
188
|
+
if($input.parent(selector.dropdown).length > 0) {
|
189
|
+
module.debug('UI dropdown already exists. Creating dropdown menu only');
|
172
190
|
$module = $input.closest(selector.dropdown);
|
173
|
-
|
174
|
-
|
191
|
+
$menu = $module.children(selector.menu);
|
192
|
+
if($menu.length === 0) {
|
193
|
+
$menu = $('<div />')
|
175
194
|
.addClass(className.menu)
|
176
|
-
.html( settings.templates.menu( selectValues ))
|
177
195
|
.appendTo($module)
|
178
196
|
;
|
179
197
|
}
|
198
|
+
$menu.html( settings.templates.menu( selectValues ));
|
180
199
|
}
|
181
200
|
else {
|
182
|
-
module.debug('Creating entire dropdown from
|
201
|
+
module.debug('Creating entire dropdown from select');
|
183
202
|
$module = $('<div />')
|
184
203
|
.attr('class', $input.attr('class') )
|
185
204
|
.addClass(className.selection)
|
@@ -197,9 +216,14 @@ $.fn.dropdown = function(parameters) {
|
|
197
216
|
},
|
198
217
|
|
199
218
|
refresh: function() {
|
219
|
+
module.verbose('Refreshing selector cache');
|
200
220
|
$text = $module.find(selector.text);
|
201
221
|
$search = $module.find(selector.search);
|
202
222
|
$input = $module.find(selector.input);
|
223
|
+
$combo = ($module.prev().find(selector.text).length > 0)
|
224
|
+
? $module.prev().find(selector.text)
|
225
|
+
: $module.prev()
|
226
|
+
;
|
203
227
|
$menu = $module.children(selector.menu);
|
204
228
|
$item = $menu.find(selector.item);
|
205
229
|
},
|
@@ -219,7 +243,10 @@ $.fn.dropdown = function(parameters) {
|
|
219
243
|
? callback
|
220
244
|
: function(){}
|
221
245
|
;
|
222
|
-
if( module.
|
246
|
+
if( module.is.searchSelection() && module.is.allFiltered() ) {
|
247
|
+
return;
|
248
|
+
}
|
249
|
+
if( module.can.show() && !module.is.active() ) {
|
223
250
|
module.debug('Showing dropdown');
|
224
251
|
module.animate.show(function() {
|
225
252
|
if( module.can.click() ) {
|
@@ -291,7 +318,6 @@ $.fn.dropdown = function(parameters) {
|
|
291
318
|
},
|
292
319
|
mouseEvents: function() {
|
293
320
|
module.verbose('Mouse detected binding mouse events');
|
294
|
-
|
295
321
|
if( module.is.searchSelection() ) {
|
296
322
|
$module
|
297
323
|
.on('mousedown' + eventNamespace, selector.menu, module.event.menu.activate)
|
@@ -465,77 +491,115 @@ $.fn.dropdown = function(parameters) {
|
|
465
491
|
},
|
466
492
|
keydown: function(event) {
|
467
493
|
var
|
468
|
-
$
|
469
|
-
$
|
494
|
+
$currentlySelected = $item.not(className.filtered).filter('.' + className.selected).eq(0),
|
495
|
+
$activeItem = $menu.children('.' + className.active).eq(0),
|
496
|
+
$selectedItem = ($currentlySelected.length > 0)
|
497
|
+
? $currentlySelected
|
498
|
+
: $activeItem,
|
499
|
+
$visibleItems = ($selectedItem.length > 0)
|
500
|
+
? $selectedItem.siblings(':not(.' + className.filtered +')').andSelf()
|
501
|
+
: $menu.children(':not(.' + className.filtered +')'),
|
502
|
+
$subMenu = $selectedItem.children(selector.menu),
|
503
|
+
$parentMenu = $selectedItem.closest(selector.menu),
|
504
|
+
isSubMenuItem = $parentMenu[0] !== $menu[0],
|
505
|
+
inVisibleMenu = $parentMenu.is(':visible'),
|
470
506
|
pressedKey = event.which,
|
471
507
|
keys = {
|
472
|
-
enter
|
473
|
-
escape
|
474
|
-
|
475
|
-
|
508
|
+
enter : 13,
|
509
|
+
escape : 27,
|
510
|
+
leftArrow : 37,
|
511
|
+
upArrow : 38,
|
512
|
+
rightArrow : 39,
|
513
|
+
downArrow : 40
|
476
514
|
},
|
477
|
-
|
478
|
-
|
479
|
-
|
515
|
+
hasSubMenu = ($subMenu.length> 0),
|
516
|
+
hasSelectedItem = ($selectedItem.length > 0),
|
517
|
+
lastVisibleIndex = ($visibleItems.size() - 1),
|
480
518
|
$nextItem,
|
481
519
|
newIndex
|
482
520
|
;
|
483
|
-
//
|
484
|
-
if(!hasSelectedItem) {
|
485
|
-
$selectedItem = $item.filter('.' + className.active).eq(0);
|
486
|
-
hasSelectedItem = ($selectedItem.length > 0);
|
487
|
-
}
|
488
|
-
// close shortcuts
|
489
|
-
if(pressedKey == keys.escape) {
|
490
|
-
module.verbose('Escape key pressed, closing dropdown');
|
491
|
-
module.hide();
|
492
|
-
}
|
493
|
-
// open menu
|
494
|
-
if(pressedKey == keys.downArrow) {
|
495
|
-
module.verbose('Down key pressed, showing dropdown');
|
496
|
-
module.show();
|
497
|
-
}
|
498
|
-
// result shortcuts
|
521
|
+
// visible menu keyboard shortcuts
|
499
522
|
if(module.is.visible()) {
|
523
|
+
// enter (select or sub-menu)
|
500
524
|
if(pressedKey == keys.enter && hasSelectedItem) {
|
501
|
-
|
502
|
-
|
525
|
+
if(hasSubMenu && !settings.allowCategorySelection) {
|
526
|
+
module.verbose('Pressed enter on unselectable category, opening sub menu');
|
527
|
+
pressedKey = keys.rightArrow;
|
528
|
+
}
|
529
|
+
else {
|
530
|
+
module.verbose('Enter key pressed, choosing selected item');
|
531
|
+
module.event.item.click.call($selectedItem, event);
|
532
|
+
}
|
533
|
+
}
|
534
|
+
// left arrow (hide sub-menu)
|
535
|
+
if(pressedKey == keys.leftArrow) {
|
536
|
+
if(isSubMenuItem) {
|
537
|
+
module.verbose('Left key pressed, closing sub-menu');
|
538
|
+
module.animate.hide(false, $parentMenu);
|
539
|
+
$selectedItem
|
540
|
+
.removeClass(className.selected)
|
541
|
+
;
|
542
|
+
$parentMenu
|
543
|
+
.closest(selector.item)
|
544
|
+
.addClass(className.selected)
|
545
|
+
;
|
546
|
+
}
|
547
|
+
event.preventDefault();
|
548
|
+
}
|
549
|
+
// right arrow (show sub-menu)
|
550
|
+
if(pressedKey == keys.rightArrow) {
|
551
|
+
if(hasSubMenu) {
|
552
|
+
module.verbose('Right key pressed, opening sub-menu');
|
553
|
+
module.animate.show(false, $subMenu);
|
554
|
+
$selectedItem
|
555
|
+
.removeClass(className.selected)
|
556
|
+
;
|
557
|
+
$subMenu
|
558
|
+
.find(selector.item).eq(0)
|
559
|
+
.addClass(className.selected)
|
560
|
+
;
|
561
|
+
}
|
503
562
|
event.preventDefault();
|
504
|
-
return false;
|
505
563
|
}
|
506
|
-
|
507
|
-
|
508
|
-
|
564
|
+
// up arrow (traverse menu up)
|
565
|
+
if(pressedKey == keys.upArrow) {
|
566
|
+
$nextItem = (hasSelectedItem && inVisibleMenu)
|
567
|
+
? $selectedItem.prevAll(selector.item + ':not(.' + className.filtered + ')').eq(0)
|
568
|
+
: $item.eq(0)
|
569
|
+
;
|
570
|
+
if($visibleItems.index( $nextItem ) < 0) {
|
571
|
+
module.verbose('Up key pressed but reached top of current menu');
|
572
|
+
return;
|
509
573
|
}
|
510
574
|
else {
|
511
|
-
$nextItem = $selectedItem.prevAll(selector.item + ':not(.' + className.filtered + ')').eq(0);
|
512
|
-
}
|
513
|
-
if(currentIndex !== 0) {
|
514
575
|
module.verbose('Up key pressed, changing active item');
|
515
|
-
$
|
516
|
-
.removeClass(
|
576
|
+
$selectedItem
|
577
|
+
.removeClass(className.selected)
|
517
578
|
;
|
518
579
|
$nextItem
|
519
|
-
.addClass(
|
580
|
+
.addClass(className.selected)
|
520
581
|
;
|
521
582
|
module.set.scrollPosition($nextItem);
|
522
583
|
}
|
523
584
|
event.preventDefault();
|
524
585
|
}
|
525
|
-
|
526
|
-
|
527
|
-
|
586
|
+
// down arrow (traverse menu down)
|
587
|
+
if(pressedKey == keys.downArrow) {
|
588
|
+
$nextItem = (hasSelectedItem && inVisibleMenu)
|
589
|
+
? $nextItem = $selectedItem.nextAll(selector.item + ':not(.' + className.filtered + ')').eq(0)
|
590
|
+
: $item.eq(0)
|
591
|
+
;
|
592
|
+
if($nextItem.length === 0) {
|
593
|
+
module.verbose('Down key pressed but reached bottom of current menu');
|
594
|
+
return;
|
528
595
|
}
|
529
596
|
else {
|
530
|
-
$nextItem = $selectedItem.nextAll(selector.item + ':not(.' + className.filtered + ')').eq(0);
|
531
|
-
}
|
532
|
-
if(currentIndex + 1 < $visibleItems.length ) {
|
533
597
|
module.verbose('Down key pressed, changing active item');
|
534
598
|
$item
|
535
|
-
.removeClass(
|
599
|
+
.removeClass(className.selected)
|
536
600
|
;
|
537
601
|
$nextItem
|
538
|
-
.addClass(
|
602
|
+
.addClass(className.selected)
|
539
603
|
;
|
540
604
|
module.set.scrollPosition($nextItem);
|
541
605
|
}
|
@@ -543,7 +607,19 @@ $.fn.dropdown = function(parameters) {
|
|
543
607
|
}
|
544
608
|
}
|
545
609
|
else {
|
610
|
+
// enter (open menu)
|
546
611
|
if(pressedKey == keys.enter) {
|
612
|
+
module.verbose('Enter key pressed, showing dropdown');
|
613
|
+
module.show();
|
614
|
+
}
|
615
|
+
// escape (close menu)
|
616
|
+
if(pressedKey == keys.escape) {
|
617
|
+
module.verbose('Escape key pressed, closing dropdown');
|
618
|
+
module.hide();
|
619
|
+
}
|
620
|
+
// down arrow (open menu)
|
621
|
+
if(pressedKey == keys.downArrow) {
|
622
|
+
module.verbose('Down key pressed, showing dropdown');
|
547
623
|
module.show();
|
548
624
|
}
|
549
625
|
}
|
@@ -581,35 +657,33 @@ $.fn.dropdown = function(parameters) {
|
|
581
657
|
item: {
|
582
658
|
mouseenter: function(event) {
|
583
659
|
var
|
584
|
-
$
|
585
|
-
$otherMenus
|
660
|
+
$subMenu = $(this).children(selector.menu),
|
661
|
+
$otherMenus = $(this).siblings(selector.item).children(selector.menu)
|
586
662
|
;
|
587
|
-
if( $
|
663
|
+
if( $subMenu.length > 0 ) {
|
588
664
|
clearTimeout(module.itemTimer);
|
589
665
|
module.itemTimer = setTimeout(function() {
|
666
|
+
module.verbose('Showing sub-menu', $subMenu);
|
590
667
|
$.each($otherMenus, function() {
|
591
668
|
module.animate.hide(false, $(this));
|
592
669
|
});
|
593
|
-
module.
|
594
|
-
module.animate.show(false, $currentMenu);
|
670
|
+
module.animate.show(false, $subMenu);
|
595
671
|
}, settings.delay.show);
|
596
672
|
event.preventDefault();
|
597
673
|
}
|
598
674
|
},
|
599
|
-
|
600
675
|
mouseleave: function(event) {
|
601
676
|
var
|
602
|
-
$
|
677
|
+
$subMenu = $(this).children(selector.menu)
|
603
678
|
;
|
604
|
-
if($
|
679
|
+
if($subMenu.length > 0) {
|
605
680
|
clearTimeout(module.itemTimer);
|
606
681
|
module.itemTimer = setTimeout(function() {
|
607
|
-
module.verbose('Hiding sub-menu', $
|
608
|
-
module.animate.hide(false, $
|
682
|
+
module.verbose('Hiding sub-menu', $subMenu);
|
683
|
+
module.animate.hide(false, $subMenu);
|
609
684
|
}, settings.delay.hide);
|
610
685
|
}
|
611
686
|
},
|
612
|
-
|
613
687
|
click: function (event) {
|
614
688
|
var
|
615
689
|
$choice = $(this),
|
@@ -621,23 +695,17 @@ $.fn.dropdown = function(parameters) {
|
|
621
695
|
module.remove.searchTerm();
|
622
696
|
module.determine.selectAction(text, value);
|
623
697
|
},
|
624
|
-
|
625
|
-
|
698
|
+
hasSubMenu = ($subMenu.length > 0),
|
699
|
+
isBubbledEvent = ($subMenu.find($target).length > 0)
|
626
700
|
;
|
627
|
-
if(
|
628
|
-
return false;
|
629
|
-
}
|
630
|
-
if(!openingSubMenu || settings.allowCategorySelection) {
|
701
|
+
if(!isBubbledEvent && (!hasSubMenu || settings.allowCategorySelection)) {
|
631
702
|
callback();
|
632
703
|
}
|
633
704
|
}
|
634
|
-
|
635
705
|
},
|
636
|
-
|
637
706
|
resetStyle: function() {
|
638
707
|
$(this).removeAttr('style');
|
639
708
|
}
|
640
|
-
|
641
709
|
},
|
642
710
|
|
643
711
|
determine: {
|
@@ -691,31 +759,23 @@ $.fn.dropdown = function(parameters) {
|
|
691
759
|
|
692
760
|
nothing: function() {},
|
693
761
|
|
694
|
-
|
695
|
-
module.hide(function() {
|
696
|
-
module.remove.filteredItem();
|
697
|
-
});
|
698
|
-
},
|
699
|
-
|
700
|
-
select: function(text, value) {
|
762
|
+
activate: function(text, value) {
|
701
763
|
value = (value !== undefined)
|
702
764
|
? value
|
703
765
|
: text
|
704
766
|
;
|
705
767
|
module.set.selected(value);
|
706
|
-
module.set.value(value);
|
707
768
|
module.hide(function() {
|
708
769
|
module.remove.filteredItem();
|
709
770
|
});
|
710
771
|
},
|
711
772
|
|
712
|
-
|
773
|
+
select: function(text, value) {
|
713
774
|
value = (value !== undefined)
|
714
775
|
? value
|
715
776
|
: text
|
716
777
|
;
|
717
778
|
module.set.selected(value);
|
718
|
-
module.set.value(value);
|
719
779
|
module.hide(function() {
|
720
780
|
module.remove.filteredItem();
|
721
781
|
});
|
@@ -727,7 +787,12 @@ $.fn.dropdown = function(parameters) {
|
|
727
787
|
: text
|
728
788
|
;
|
729
789
|
module.set.selected(value);
|
730
|
-
module.
|
790
|
+
module.hide(function() {
|
791
|
+
module.remove.filteredItem();
|
792
|
+
});
|
793
|
+
},
|
794
|
+
|
795
|
+
hide: function() {
|
731
796
|
module.hide(function() {
|
732
797
|
module.remove.filteredItem();
|
733
798
|
});
|
@@ -766,7 +831,7 @@ $.fn.dropdown = function(parameters) {
|
|
766
831
|
}
|
767
832
|
},
|
768
833
|
choiceValue: function($choice, choiceText) {
|
769
|
-
choiceText = choiceText || module.get.choiceText($
|
834
|
+
choiceText = choiceText || module.get.choiceText($choice);
|
770
835
|
return ($choice.data(metadata.value) !== undefined)
|
771
836
|
? $choice.data(metadata.value)
|
772
837
|
: (typeof choiceText === 'string')
|
@@ -900,7 +965,7 @@ $.fn.dropdown = function(parameters) {
|
|
900
965
|
;
|
901
966
|
module.debug('Restoring default text', defaultText);
|
902
967
|
module.set.text(defaultText);
|
903
|
-
$text.addClass(
|
968
|
+
$text.addClass(className.placeholder);
|
904
969
|
},
|
905
970
|
defaultValue: function() {
|
906
971
|
var
|
@@ -910,7 +975,6 @@ $.fn.dropdown = function(parameters) {
|
|
910
975
|
module.debug('Restoring default value', defaultValue);
|
911
976
|
if(defaultValue.length) {
|
912
977
|
module.set.selected(defaultValue);
|
913
|
-
module.set.value(defaultValue);
|
914
978
|
}
|
915
979
|
else {
|
916
980
|
module.remove.activeItem();
|
@@ -923,6 +987,7 @@ $.fn.dropdown = function(parameters) {
|
|
923
987
|
save: {
|
924
988
|
defaults: function() {
|
925
989
|
module.save.defaultText();
|
990
|
+
module.save.placeholderText();
|
926
991
|
module.save.defaultValue();
|
927
992
|
},
|
928
993
|
defaultValue: function() {
|
@@ -930,9 +995,25 @@ $.fn.dropdown = function(parameters) {
|
|
930
995
|
},
|
931
996
|
defaultText: function() {
|
932
997
|
$module.data(metadata.defaultText, $text.text() );
|
998
|
+
},
|
999
|
+
placeholderText: function() {
|
1000
|
+
if($text.hasClass(className.placeholder)) {
|
1001
|
+
$module.data(metadata.placeholderText, $text.text());
|
1002
|
+
}
|
933
1003
|
}
|
934
1004
|
},
|
935
1005
|
|
1006
|
+
clear: function() {
|
1007
|
+
var
|
1008
|
+
placeholderText = $module.data(metadata.placeholderText)
|
1009
|
+
;
|
1010
|
+
module.set.text(placeholderText);
|
1011
|
+
module.set.value('');
|
1012
|
+
module.remove.activeItem();
|
1013
|
+
module.remove.selectedItem();
|
1014
|
+
$text.addClass(className.placeholder);
|
1015
|
+
},
|
1016
|
+
|
936
1017
|
set: {
|
937
1018
|
filtered: function() {
|
938
1019
|
var
|
@@ -1060,20 +1141,21 @@ $.fn.dropdown = function(parameters) {
|
|
1060
1141
|
selected: function(value) {
|
1061
1142
|
var
|
1062
1143
|
$selectedItem = module.get.item(value),
|
1063
|
-
selectedText
|
1144
|
+
selectedText,
|
1145
|
+
selectedValue
|
1064
1146
|
;
|
1065
1147
|
if($selectedItem) {
|
1066
1148
|
module.debug('Setting selected menu item to', $selectedItem);
|
1067
|
-
|
1068
1149
|
module.remove.activeItem();
|
1069
1150
|
module.remove.selectedItem();
|
1070
1151
|
$selectedItem
|
1071
1152
|
.addClass(className.active)
|
1072
1153
|
.addClass(className.selected)
|
1073
1154
|
;
|
1074
|
-
|
1075
|
-
|
1155
|
+
selectedText = module.get.choiceText($selectedItem);
|
1156
|
+
selectedValue = module.get.choiceValue($selectedItem, selectedText);
|
1076
1157
|
module.set.text(selectedText);
|
1158
|
+
module.set.value(selectedValue);
|
1077
1159
|
settings.onChange.call(element, value, selectedText, $selectedItem);
|
1078
1160
|
}
|
1079
1161
|
}
|
@@ -1124,6 +1206,9 @@ $.fn.dropdown = function(parameters) {
|
|
1124
1206
|
active: function() {
|
1125
1207
|
return $module.hasClass(className.active);
|
1126
1208
|
},
|
1209
|
+
alreadySetup: function() {
|
1210
|
+
return ($module.is('select') && $module.parent(selector.dropdown).length > 0);
|
1211
|
+
},
|
1127
1212
|
animating: function($subMenu) {
|
1128
1213
|
return ($subMenu)
|
1129
1214
|
? $subMenu.is(':animated') || $subMenu.transition && $subMenu.transition('is animating')
|
@@ -1139,6 +1224,18 @@ $.fn.dropdown = function(parameters) {
|
|
1139
1224
|
: $menu.is(':hidden')
|
1140
1225
|
;
|
1141
1226
|
},
|
1227
|
+
selectMutation: function(mutations) {
|
1228
|
+
var
|
1229
|
+
selectChanged = false
|
1230
|
+
;
|
1231
|
+
$.each(mutations, function(index, mutation) {
|
1232
|
+
if(mutation.target && $(mutation.target).is('select')) {
|
1233
|
+
selectChanged = true;
|
1234
|
+
return true;
|
1235
|
+
}
|
1236
|
+
});
|
1237
|
+
return selectChanged;
|
1238
|
+
},
|
1142
1239
|
search: function() {
|
1143
1240
|
return $module.hasClass(className.search);
|
1144
1241
|
},
|
@@ -1196,8 +1293,8 @@ $.fn.dropdown = function(parameters) {
|
|
1196
1293
|
? 'slide up'
|
1197
1294
|
: 'slide down'
|
1198
1295
|
;
|
1296
|
+
module.verbose('Automatically determining animation based on animation direction', settings.transition);
|
1199
1297
|
}
|
1200
|
-
|
1201
1298
|
if(settings.transition == 'none') {
|
1202
1299
|
callback.call(element);
|
1203
1300
|
}
|
@@ -1571,16 +1668,18 @@ $.fn.dropdown.settings = {
|
|
1571
1668
|
namespace : 'dropdown',
|
1572
1669
|
|
1573
1670
|
error : {
|
1574
|
-
action
|
1575
|
-
|
1576
|
-
|
1671
|
+
action : 'You called a dropdown action that was not defined',
|
1672
|
+
alreadySetup : 'Once a select has been initialized behaviors must be called on the created ui dropdown',
|
1673
|
+
method : 'The method you called is not defined.',
|
1674
|
+
transition : 'The requested transition was not found'
|
1577
1675
|
},
|
1578
1676
|
|
1579
1677
|
metadata: {
|
1580
|
-
defaultText
|
1581
|
-
defaultValue
|
1582
|
-
|
1583
|
-
|
1678
|
+
defaultText : 'defaultText',
|
1679
|
+
defaultValue : 'defaultValue',
|
1680
|
+
placeholderText : 'placeholderText',
|
1681
|
+
text : 'text',
|
1682
|
+
value : 'value'
|
1584
1683
|
},
|
1585
1684
|
|
1586
1685
|
selector : {
|