fomantic-ui-sass 2.7.8 → 2.8.1
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 +1 -1
- data/app/assets/javascripts/semantic-ui/calendar.js +41 -18
- data/app/assets/javascripts/semantic-ui/dropdown.js +58 -33
- data/app/assets/javascripts/semantic-ui/form.js +9 -4
- data/app/assets/javascripts/semantic-ui/modal.js +96 -33
- data/app/assets/javascripts/semantic-ui/popup.js +8 -8
- data/app/assets/javascripts/semantic-ui/progress.js +10 -8
- data/app/assets/javascripts/semantic-ui/rating.js +35 -6
- data/app/assets/javascripts/semantic-ui/sidebar.js +2 -3
- data/app/assets/javascripts/semantic-ui/slider.js +78 -29
- data/app/assets/javascripts/semantic-ui/tab.js +1 -1
- data/app/assets/javascripts/semantic-ui/toast.js +395 -121
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +741 -143
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +35 -35
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +73 -117
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +11 -11
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +976 -191
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +1 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +51 -81
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +12 -12
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +35 -14
- data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +12312 -0
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +111 -66
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +70 -31
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +28 -28
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +218 -69
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +20 -20
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +52 -51
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +85 -91
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +8 -8
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +11 -11
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +31 -10
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +38 -38
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +16 -17
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +6 -6
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +14 -124
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +21 -21
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +181 -110
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +12 -12
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +121 -30
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +71 -72
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +44 -26
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +246 -21
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +16 -13
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +12 -14
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +20 -23
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +542 -155
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +16 -16
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +42 -17
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +9 -9
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +20 -5
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +33 -12
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +60 -46
- data/lib/fomantic/ui/sass/version.rb +2 -2
- metadata +2 -1
@@ -168,7 +168,7 @@ $.fn.form = function(parameters) {
|
|
168
168
|
}
|
169
169
|
|
170
170
|
$field.on('change click keyup keydown blur', function(e) {
|
171
|
-
$(this).
|
171
|
+
$(this).triggerHandler(e.type + ".dirty");
|
172
172
|
});
|
173
173
|
|
174
174
|
$field.on('change.dirty click.dirty keyup.dirty keydown.dirty blur.dirty', module.determine.isDirty);
|
@@ -203,7 +203,7 @@ $.fn.form = function(parameters) {
|
|
203
203
|
}
|
204
204
|
if(isDropdown) {
|
205
205
|
module.verbose('Resetting dropdown value', $element, defaultValue);
|
206
|
-
$element.dropdown('clear');
|
206
|
+
$element.dropdown('clear', true);
|
207
207
|
}
|
208
208
|
else if(isCheckbox) {
|
209
209
|
$field.prop('checked', false);
|
@@ -242,7 +242,7 @@ $.fn.form = function(parameters) {
|
|
242
242
|
}
|
243
243
|
if(isDropdown) {
|
244
244
|
module.verbose('Resetting dropdown value', $element, defaultValue);
|
245
|
-
$element.dropdown('restore defaults');
|
245
|
+
$element.dropdown('restore defaults', true);
|
246
246
|
}
|
247
247
|
else if(isCheckbox) {
|
248
248
|
module.verbose('Resetting checkbox value', $element, defaultValue);
|
@@ -991,6 +991,8 @@ $.fn.form = function(parameters) {
|
|
991
991
|
$parent = $el.parent(),
|
992
992
|
isCheckbox = ($el.filter(selector.checkbox).length > 0),
|
993
993
|
isDropdown = $parent.is(selector.uiDropdown) && module.can.useElement('dropdown'),
|
994
|
+
$calendar = $el.closest(selector.uiCalendar),
|
995
|
+
isCalendar = ($calendar.length > 0 && module.can.useElement('calendar')),
|
994
996
|
value = (isCheckbox)
|
995
997
|
? $el.is(':checked')
|
996
998
|
: $el.val()
|
@@ -998,6 +1000,9 @@ $.fn.form = function(parameters) {
|
|
998
1000
|
if (isDropdown) {
|
999
1001
|
$parent.dropdown('save defaults');
|
1000
1002
|
}
|
1003
|
+
else if (isCalendar) {
|
1004
|
+
$calendar.calendar('refresh');
|
1005
|
+
}
|
1001
1006
|
$el.data(metadata.defaultValue, value);
|
1002
1007
|
$el.data(metadata.isDirty, false);
|
1003
1008
|
});
|
@@ -1053,7 +1058,7 @@ $.fn.form = function(parameters) {
|
|
1053
1058
|
}
|
1054
1059
|
else if(isCheckbox) {
|
1055
1060
|
module.verbose('Setting checkbox value', value, $element);
|
1056
|
-
if(value === true) {
|
1061
|
+
if(value === true || value === 1) {
|
1057
1062
|
$element.checkbox('check');
|
1058
1063
|
}
|
1059
1064
|
else {
|
@@ -81,6 +81,7 @@ $.fn.modal = function(parameters) {
|
|
81
81
|
initialMouseDownInModal,
|
82
82
|
initialMouseDownInScrollbar,
|
83
83
|
initialBodyMargin = '',
|
84
|
+
tempBodyMargin = '',
|
84
85
|
|
85
86
|
elementEventNamespace,
|
86
87
|
id,
|
@@ -90,6 +91,7 @@ $.fn.modal = function(parameters) {
|
|
90
91
|
module = {
|
91
92
|
|
92
93
|
initialize: function() {
|
94
|
+
module.cache = {};
|
93
95
|
module.verbose('Initializing dimmer', $context);
|
94
96
|
|
95
97
|
module.create.id();
|
@@ -279,13 +281,14 @@ $.fn.modal = function(parameters) {
|
|
279
281
|
},
|
280
282
|
mousedown: function(event) {
|
281
283
|
var
|
282
|
-
$target = $(event.target)
|
284
|
+
$target = $(event.target),
|
285
|
+
isRtl = module.is.rtl();
|
283
286
|
;
|
284
287
|
initialMouseDownInModal = ($target.closest(selector.modal).length > 0);
|
285
288
|
if(initialMouseDownInModal) {
|
286
289
|
module.verbose('Mouse down event registered inside the modal');
|
287
290
|
}
|
288
|
-
initialMouseDownInScrollbar = module.is.scrolling() && $(window).outerWidth() - settings.scrollbarWidth <= event.clientX;
|
291
|
+
initialMouseDownInScrollbar = module.is.scrolling() && ((!isRtl && $(window).outerWidth() - settings.scrollbarWidth <= event.clientX) || (isRtl && settings.scrollbarWidth >= event.clientX));
|
289
292
|
if(initialMouseDownInScrollbar) {
|
290
293
|
module.verbose('Mouse down event registered inside the scrollbar');
|
291
294
|
}
|
@@ -388,6 +391,7 @@ $.fn.modal = function(parameters) {
|
|
388
391
|
if( module.is.animating() || !module.is.active() ) {
|
389
392
|
module.showDimmer();
|
390
393
|
module.cacheSizes();
|
394
|
+
module.set.bodyMargin();
|
391
395
|
if(module.can.useFlex()) {
|
392
396
|
module.remove.legacy();
|
393
397
|
}
|
@@ -605,12 +609,10 @@ $.fn.modal = function(parameters) {
|
|
605
609
|
}
|
606
610
|
},
|
607
611
|
bodyMargin: function() {
|
608
|
-
initialBodyMargin = $body.css('margin-right');
|
612
|
+
initialBodyMargin = $body.css('margin-'+(module.can.leftBodyScrollbar() ? 'left':'right'));
|
609
613
|
var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
|
610
|
-
bodyScrollbarWidth = window.innerWidth - document.documentElement.clientWidth
|
611
|
-
|
612
|
-
$body.css('margin-right', diffPos + 'px');
|
613
|
-
$body.find(selector.bodyFixed).css('padding-right', diffPos + 'px');
|
614
|
+
bodyScrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
615
|
+
tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
|
614
616
|
}
|
615
617
|
},
|
616
618
|
|
@@ -621,8 +623,9 @@ $.fn.modal = function(parameters) {
|
|
621
623
|
}
|
622
624
|
},
|
623
625
|
bodyMargin: function() {
|
624
|
-
|
625
|
-
$body.
|
626
|
+
var position = module.can.leftBodyScrollbar() ? 'left':'right';
|
627
|
+
$body.css('margin-'+position, initialBodyMargin);
|
628
|
+
$body.find(selector.bodyFixed.replace('right',position)).css('padding-'+position, initialBodyMargin);
|
626
629
|
}
|
627
630
|
},
|
628
631
|
|
@@ -634,6 +637,11 @@ $.fn.modal = function(parameters) {
|
|
634
637
|
$module.removeClass(className.legacy);
|
635
638
|
},
|
636
639
|
clickaway: function() {
|
640
|
+
if (!settings.detachable) {
|
641
|
+
$module
|
642
|
+
.off('mousedown' + elementEventNamespace)
|
643
|
+
;
|
644
|
+
}
|
637
645
|
$dimmer
|
638
646
|
.off('mousedown' + elementEventNamespace)
|
639
647
|
;
|
@@ -676,8 +684,8 @@ $.fn.modal = function(parameters) {
|
|
676
684
|
modalWidth = $module.outerWidth(),
|
677
685
|
modalHeight = $module.outerHeight()
|
678
686
|
;
|
679
|
-
if(module.cache === undefined || modalHeight !== 0) {
|
680
|
-
module.cache
|
687
|
+
if(module.cache.pageHeight === undefined || modalHeight !== 0) {
|
688
|
+
$.extend(module.cache, {
|
681
689
|
pageHeight : $(document).outerHeight(),
|
682
690
|
width : modalWidth,
|
683
691
|
height : modalHeight + settings.offset,
|
@@ -685,7 +693,7 @@ $.fn.modal = function(parameters) {
|
|
685
693
|
contextHeight : (settings.context == 'body')
|
686
694
|
? $(window).height()
|
687
695
|
: $dimmable.height(),
|
688
|
-
};
|
696
|
+
});
|
689
697
|
module.cache.topOffset = -(module.cache.height / 2);
|
690
698
|
}
|
691
699
|
$module.removeClass(className.loading);
|
@@ -693,11 +701,14 @@ $.fn.modal = function(parameters) {
|
|
693
701
|
},
|
694
702
|
|
695
703
|
can: {
|
704
|
+
leftBodyScrollbar: function(){
|
705
|
+
if(module.cache.leftBodyScrollbar === undefined) {
|
706
|
+
module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
|
707
|
+
}
|
708
|
+
return module.cache.leftBodyScrollbar;
|
709
|
+
},
|
696
710
|
useFlex: function() {
|
697
|
-
return
|
698
|
-
? settings.detachable && !module.is.ie()
|
699
|
-
: settings.useFlex
|
700
|
-
;
|
711
|
+
return settings.useFlex && settings.detachable && !module.is.ie();
|
701
712
|
},
|
702
713
|
fit: function() {
|
703
714
|
var
|
@@ -721,11 +732,14 @@ $.fn.modal = function(parameters) {
|
|
721
732
|
return $module.hasClass(className.active);
|
722
733
|
},
|
723
734
|
ie: function() {
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
735
|
+
if(module.cache.isIE === undefined) {
|
736
|
+
var
|
737
|
+
isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
|
738
|
+
isIE = ('ActiveXObject' in window)
|
739
|
+
;
|
740
|
+
module.cache.isIE = (isIE11 || isIE);
|
741
|
+
}
|
742
|
+
return module.cache.isIE;
|
729
743
|
},
|
730
744
|
animating: function() {
|
731
745
|
return $module.transition('is supported')
|
@@ -739,6 +753,33 @@ $.fn.modal = function(parameters) {
|
|
739
753
|
modernBrowser: function() {
|
740
754
|
// appName for IE11 reports 'Netscape' can no longer use
|
741
755
|
return !(window.ActiveXObject || 'ActiveXObject' in window);
|
756
|
+
},
|
757
|
+
rtl: function() {
|
758
|
+
if(module.cache.isRTL === undefined) {
|
759
|
+
module.cache.isRTL = $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl';
|
760
|
+
}
|
761
|
+
return module.cache.isRTL;
|
762
|
+
},
|
763
|
+
safari: function() {
|
764
|
+
if(module.cache.isSafari === undefined) {
|
765
|
+
module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
|
766
|
+
}
|
767
|
+
return module.cache.isSafari;
|
768
|
+
},
|
769
|
+
edge: function(){
|
770
|
+
if(module.cache.isEdge === undefined) {
|
771
|
+
module.cache.isEdge = !!window.setImmediate && !module.is.ie();
|
772
|
+
}
|
773
|
+
return module.cache.isEdge;
|
774
|
+
},
|
775
|
+
firefox: function(){
|
776
|
+
if(module.cache.isFirefox === undefined) {
|
777
|
+
module.cache.isFirefox = !!window.InstallTrigger;
|
778
|
+
}
|
779
|
+
return module.cache.isFirefox;
|
780
|
+
},
|
781
|
+
iframe: function() {
|
782
|
+
return !(self === top);
|
742
783
|
}
|
743
784
|
},
|
744
785
|
|
@@ -757,7 +798,19 @@ $.fn.modal = function(parameters) {
|
|
757
798
|
$input.focus();
|
758
799
|
}
|
759
800
|
},
|
801
|
+
bodyMargin: function() {
|
802
|
+
var position = module.can.leftBodyScrollbar() ? 'left':'right';
|
803
|
+
if(settings.detachable || module.can.fit()) {
|
804
|
+
$body.css('margin-'+position, tempBodyMargin + 'px');
|
805
|
+
}
|
806
|
+
$body.find(selector.bodyFixed.replace('right',position)).css('padding-'+position, tempBodyMargin + 'px');
|
807
|
+
},
|
760
808
|
clickaway: function() {
|
809
|
+
if (!settings.detachable) {
|
810
|
+
$module
|
811
|
+
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
812
|
+
;
|
813
|
+
}
|
761
814
|
$dimmer
|
762
815
|
.on('mousedown' + elementEventNamespace, module.event.mousedown)
|
763
816
|
;
|
@@ -806,18 +859,28 @@ $.fn.modal = function(parameters) {
|
|
806
859
|
}
|
807
860
|
},
|
808
861
|
modalOffset: function() {
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
862
|
+
if (!settings.detachable) {
|
863
|
+
var canFit = module.can.fit();
|
864
|
+
$module
|
865
|
+
.css({
|
866
|
+
top: (!$module.hasClass('aligned') && canFit)
|
867
|
+
? $(document).scrollTop() + (module.cache.contextHeight - module.cache.height) / 2
|
868
|
+
: !canFit || $module.hasClass('top')
|
869
|
+
? $(document).scrollTop() + settings.padding
|
870
|
+
: $(document).scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding),
|
871
|
+
marginLeft: -(module.cache.width / 2)
|
872
|
+
})
|
873
|
+
;
|
874
|
+
} else {
|
875
|
+
$module
|
876
|
+
.css({
|
877
|
+
marginTop: (!$module.hasClass('aligned') && module.can.fit())
|
878
|
+
? -(module.cache.height / 2)
|
879
|
+
: settings.padding / 2,
|
880
|
+
marginLeft: -(module.cache.width / 2)
|
881
|
+
})
|
882
|
+
;
|
883
|
+
}
|
821
884
|
module.verbose('Setting modal offset for legacy mode');
|
822
885
|
},
|
823
886
|
screenHeight: function() {
|
@@ -286,18 +286,18 @@ $.fn.popup = function(parameters) {
|
|
286
286
|
}
|
287
287
|
settings.onCreate.call($popup, element);
|
288
288
|
}
|
289
|
-
else if(
|
290
|
-
|
291
|
-
|
292
|
-
settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
|
289
|
+
else if(settings.popup) {
|
290
|
+
$(settings.popup).data(metadata.activator, $module);
|
291
|
+
module.verbose('Used popup specified in settings');
|
293
292
|
module.refresh();
|
294
293
|
if(settings.hoverable) {
|
295
294
|
module.bind.popup();
|
296
295
|
}
|
297
296
|
}
|
298
|
-
else if(
|
299
|
-
|
300
|
-
|
297
|
+
else if($target.next(selector.popup).length !== 0) {
|
298
|
+
module.verbose('Pre-existing popup found');
|
299
|
+
settings.inline = true;
|
300
|
+
settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
|
301
301
|
module.refresh();
|
302
302
|
if(settings.hoverable) {
|
303
303
|
module.bind.popup();
|
@@ -1134,7 +1134,7 @@ $.fn.popup = function(parameters) {
|
|
1134
1134
|
return !module.is.visible();
|
1135
1135
|
},
|
1136
1136
|
rtl: function () {
|
1137
|
-
return $module.css('direction')
|
1137
|
+
return $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl';
|
1138
1138
|
}
|
1139
1139
|
},
|
1140
1140
|
|
@@ -151,10 +151,12 @@ $.fn.progress = function(parameters) {
|
|
151
151
|
module.update.progress(0);
|
152
152
|
},
|
153
153
|
|
154
|
-
complete: function() {
|
154
|
+
complete: function(keepState) {
|
155
155
|
if(module.percent === undefined || module.percent < 100) {
|
156
156
|
module.remove.progressPoll();
|
157
|
-
|
157
|
+
if(keepState !== true){
|
158
|
+
module.set.percent(100);
|
159
|
+
}
|
158
160
|
}
|
159
161
|
},
|
160
162
|
|
@@ -647,14 +649,14 @@ $.fn.progress = function(parameters) {
|
|
647
649
|
settings.onActive.call(element, module.value, module.total);
|
648
650
|
});
|
649
651
|
},
|
650
|
-
success : function(text) {
|
652
|
+
success : function(text, keepState) {
|
651
653
|
text = text || settings.text.success || settings.text.active;
|
652
654
|
module.debug('Setting success state');
|
653
655
|
$module.addClass(className.success);
|
654
656
|
module.remove.active();
|
655
657
|
module.remove.warning();
|
656
658
|
module.remove.error();
|
657
|
-
module.complete();
|
659
|
+
module.complete(keepState);
|
658
660
|
if(settings.text.success) {
|
659
661
|
text = settings.onLabelUpdate('success', text, module.value, module.total);
|
660
662
|
module.set.label(text);
|
@@ -667,14 +669,14 @@ $.fn.progress = function(parameters) {
|
|
667
669
|
settings.onSuccess.call(element, module.total);
|
668
670
|
});
|
669
671
|
},
|
670
|
-
warning : function(text) {
|
672
|
+
warning : function(text, keepState) {
|
671
673
|
text = text || settings.text.warning;
|
672
674
|
module.debug('Setting warning state');
|
673
675
|
$module.addClass(className.warning);
|
674
676
|
module.remove.active();
|
675
677
|
module.remove.success();
|
676
678
|
module.remove.error();
|
677
|
-
module.complete();
|
679
|
+
module.complete(keepState);
|
678
680
|
text = settings.onLabelUpdate('warning', text, module.value, module.total);
|
679
681
|
if(text) {
|
680
682
|
module.set.label(text);
|
@@ -683,14 +685,14 @@ $.fn.progress = function(parameters) {
|
|
683
685
|
settings.onWarning.call(element, module.value, module.total);
|
684
686
|
});
|
685
687
|
},
|
686
|
-
error : function(text) {
|
688
|
+
error : function(text, keepState) {
|
687
689
|
text = text || settings.text.error;
|
688
690
|
module.debug('Setting error state');
|
689
691
|
$module.addClass(className.error);
|
690
692
|
module.remove.active();
|
691
693
|
module.remove.success();
|
692
694
|
module.remove.warning();
|
693
|
-
module.complete();
|
695
|
+
module.complete(keepState);
|
694
696
|
text = settings.onLabelUpdate('error', text, module.value, module.total);
|
695
697
|
if(text) {
|
696
698
|
module.set.label(text);
|
@@ -47,6 +47,7 @@ $.fn.rating = function(parameters) {
|
|
47
47
|
className = settings.className,
|
48
48
|
metadata = settings.metadata,
|
49
49
|
selector = settings.selector,
|
50
|
+
cssVars = settings.cssVars,
|
50
51
|
|
51
52
|
eventNamespace = '.' + namespace,
|
52
53
|
moduleNamespace = 'module-' + namespace,
|
@@ -248,10 +249,17 @@ $.fn.rating = function(parameters) {
|
|
248
249
|
set: {
|
249
250
|
rating: function(rating) {
|
250
251
|
var
|
251
|
-
ratingIndex = (
|
252
|
-
|
253
|
-
|
254
|
-
|
252
|
+
ratingIndex = Math.floor(
|
253
|
+
(rating - 1 >= 0)
|
254
|
+
? (rating - 1)
|
255
|
+
: 0
|
256
|
+
),
|
257
|
+
$activeIcon = $icon.eq(ratingIndex),
|
258
|
+
$partialActiveIcon = rating <= 1
|
259
|
+
? $activeIcon
|
260
|
+
: $activeIcon.next()
|
261
|
+
,
|
262
|
+
filledPercentage = (rating % 1) * 100
|
255
263
|
;
|
256
264
|
$module
|
257
265
|
.removeClass(className.selected)
|
@@ -259,14 +267,30 @@ $.fn.rating = function(parameters) {
|
|
259
267
|
$icon
|
260
268
|
.removeClass(className.selected)
|
261
269
|
.removeClass(className.active)
|
270
|
+
.removeClass(className.partiallyActive)
|
262
271
|
;
|
263
272
|
if(rating > 0) {
|
264
273
|
module.verbose('Setting current rating to', rating);
|
265
274
|
$activeIcon
|
266
275
|
.prevAll()
|
267
276
|
.addBack()
|
268
|
-
|
277
|
+
.addClass(className.active)
|
269
278
|
;
|
279
|
+
if($activeIcon.next() && rating % 1 !== 0) {
|
280
|
+
$partialActiveIcon
|
281
|
+
.addClass(className.partiallyActive)
|
282
|
+
.addClass(className.active)
|
283
|
+
;
|
284
|
+
$partialActiveIcon
|
285
|
+
.css(cssVars.filledCustomPropName, filledPercentage + '%')
|
286
|
+
;
|
287
|
+
if($partialActiveIcon.css('backgroundColor') === 'transparent') {
|
288
|
+
$partialActiveIcon
|
289
|
+
.removeClass(className.partiallyActive)
|
290
|
+
.removeClass(className.active)
|
291
|
+
;
|
292
|
+
}
|
293
|
+
}
|
270
294
|
}
|
271
295
|
if(!module.is.initialLoad()) {
|
272
296
|
settings.onRate.call(element, rating);
|
@@ -499,7 +523,12 @@ $.fn.rating.settings = {
|
|
499
523
|
active : 'active',
|
500
524
|
disabled : 'disabled',
|
501
525
|
selected : 'selected',
|
502
|
-
loading : 'loading'
|
526
|
+
loading : 'loading',
|
527
|
+
partiallyActive : 'partial'
|
528
|
+
},
|
529
|
+
|
530
|
+
cssVars : {
|
531
|
+
filledCustomPropName : '--full'
|
503
532
|
},
|
504
533
|
|
505
534
|
selector : {
|