fomantic-ui-sass 2.7.2 → 2.7.3
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.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/app/assets/javascripts/semantic-ui/accordion.js +0 -6
- data/app/assets/javascripts/semantic-ui/api.js +1 -1
- data/app/assets/javascripts/semantic-ui/calendar.js +40 -12
- data/app/assets/javascripts/semantic-ui/checkbox.js +9 -0
- data/app/assets/javascripts/semantic-ui/dimmer.js +2 -4
- data/app/assets/javascripts/semantic-ui/dropdown.js +9 -11
- data/app/assets/javascripts/semantic-ui/embed.js +0 -1
- data/app/assets/javascripts/semantic-ui/form.js +10 -16
- data/app/assets/javascripts/semantic-ui/modal.js +28 -17
- data/app/assets/javascripts/semantic-ui/nag.js +1 -20
- data/app/assets/javascripts/semantic-ui/popup.js +0 -4
- data/app/assets/javascripts/semantic-ui/progress.js +161 -102
- data/app/assets/javascripts/semantic-ui/rating.js +0 -1
- data/app/assets/javascripts/semantic-ui/search.js +2 -7
- data/app/assets/javascripts/semantic-ui/shape.js +68 -145
- data/app/assets/javascripts/semantic-ui/sidebar.js +14 -12
- data/app/assets/javascripts/semantic-ui/site.js +0 -1
- data/app/assets/javascripts/semantic-ui/state.js +0 -1
- data/app/assets/javascripts/semantic-ui/sticky.js +1 -7
- data/app/assets/javascripts/semantic-ui/tab.js +17 -4
- data/app/assets/javascripts/semantic-ui/transition.js +7 -23
- data/app/assets/javascripts/semantic-ui/visibility.js +1 -3
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +4 -3
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +16 -16
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +8 -4
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +12 -3
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +3 -11
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +3 -0
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +7 -5
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +5 -5
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +21 -4
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +0 -1
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +4 -0
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +6 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +72 -3
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +60 -41
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +73 -35
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +5 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +4 -1
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +4 -4
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +189 -3
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
- data/lib/fomantic/ui/sass/version.rb +2 -2
- metadata +3 -3
@@ -80,6 +80,7 @@ $.fn.modal = function(parameters) {
|
|
80
80
|
|
81
81
|
initialMouseDownInModal,
|
82
82
|
initialMouseDownInScrollbar,
|
83
|
+
initialBodyMargin = '',
|
83
84
|
|
84
85
|
elementEventNamespace,
|
85
86
|
id,
|
@@ -97,7 +98,9 @@ $.fn.modal = function(parameters) {
|
|
97
98
|
if ( settings.allowMultiple ) {
|
98
99
|
module.create.innerDimmer();
|
99
100
|
}
|
100
|
-
|
101
|
+
if (!settings.centered){
|
102
|
+
$module.addClass('top aligned');
|
103
|
+
}
|
101
104
|
module.refreshModals();
|
102
105
|
|
103
106
|
module.bind.events();
|
@@ -120,9 +123,6 @@ $.fn.modal = function(parameters) {
|
|
120
123
|
var
|
121
124
|
defaultSettings = {
|
122
125
|
debug : settings.debug,
|
123
|
-
variation : settings.centered
|
124
|
-
? false
|
125
|
-
: 'top aligned',
|
126
126
|
dimmerName : 'modals'
|
127
127
|
},
|
128
128
|
dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
|
@@ -305,7 +305,7 @@ $.fn.modal = function(parameters) {
|
|
305
305
|
isInModal = ($target.closest(selector.modal).length > 0),
|
306
306
|
isInDOM = $.contains(document.documentElement, event.target)
|
307
307
|
;
|
308
|
-
if(!isInModal && isInDOM && module.is.active() && $module.hasClass(className.
|
308
|
+
if(!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front) ) {
|
309
309
|
module.debug('Dimmer clicked, hiding all modals');
|
310
310
|
if(settings.allowMultiple) {
|
311
311
|
if(!module.hideAll()) {
|
@@ -330,7 +330,7 @@ $.fn.modal = function(parameters) {
|
|
330
330
|
if(keyCode == escapeKey) {
|
331
331
|
if(settings.closable) {
|
332
332
|
module.debug('Escape key pressed hiding modal');
|
333
|
-
if ( $module.hasClass(className.
|
333
|
+
if ( $module.hasClass(className.front) ) {
|
334
334
|
module.hide();
|
335
335
|
}
|
336
336
|
}
|
@@ -401,6 +401,7 @@ $.fn.modal = function(parameters) {
|
|
401
401
|
module.hideOthers(module.showModal);
|
402
402
|
}
|
403
403
|
else {
|
404
|
+
ignoreRepeatedEvents = false;
|
404
405
|
if( settings.allowMultiple ) {
|
405
406
|
if ( module.others.active() ) {
|
406
407
|
$otherModals.filter('.' + className.active).find(selector.dimmer).addClass('active');
|
@@ -481,8 +482,8 @@ $.fn.modal = function(parameters) {
|
|
481
482
|
onComplete : function() {
|
482
483
|
module.unbind.scrollLock();
|
483
484
|
if ( settings.allowMultiple ) {
|
484
|
-
$previousModal.addClass(className.
|
485
|
-
$module.removeClass(className.
|
485
|
+
$previousModal.addClass(className.front);
|
486
|
+
$module.removeClass(className.front);
|
486
487
|
|
487
488
|
if ( hideOthersToo ) {
|
488
489
|
$allModals.find(selector.dimmer).removeClass('active');
|
@@ -507,6 +508,7 @@ $.fn.modal = function(parameters) {
|
|
507
508
|
|
508
509
|
showDimmer: function() {
|
509
510
|
if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) {
|
511
|
+
module.save.bodyMargin();
|
510
512
|
module.debug('Showing dimmer');
|
511
513
|
$dimmable.dimmer('show');
|
512
514
|
}
|
@@ -519,6 +521,7 @@ $.fn.modal = function(parameters) {
|
|
519
521
|
if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
|
520
522
|
module.unbind.scrollLock();
|
521
523
|
$dimmable.dimmer('hide', function() {
|
524
|
+
module.restore.bodyMargin();
|
522
525
|
module.remove.clickaway();
|
523
526
|
module.remove.screenHeight();
|
524
527
|
});
|
@@ -597,6 +600,12 @@ $.fn.modal = function(parameters) {
|
|
597
600
|
if(!inCurrentModal) {
|
598
601
|
$focusedElement = $(document.activeElement).blur();
|
599
602
|
}
|
603
|
+
},
|
604
|
+
bodyMargin: function() {
|
605
|
+
initialBodyMargin = $body.css('margin-right');
|
606
|
+
var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
|
607
|
+
bodyScrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
608
|
+
$body.css('margin-right', (bodyMarginRightPixel + bodyScrollbarWidth) + 'px');
|
600
609
|
}
|
601
610
|
},
|
602
611
|
|
@@ -605,6 +614,9 @@ $.fn.modal = function(parameters) {
|
|
605
614
|
if($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
|
606
615
|
$focusedElement.focus();
|
607
616
|
}
|
617
|
+
},
|
618
|
+
bodyMargin: function() {
|
619
|
+
$body.css('margin-right', initialBodyMargin);
|
608
620
|
}
|
609
621
|
},
|
610
622
|
|
@@ -756,9 +768,6 @@ $.fn.modal = function(parameters) {
|
|
756
768
|
dimmerName : 'modals',
|
757
769
|
closable : 'auto',
|
758
770
|
useFlex : module.can.useFlex(),
|
759
|
-
variation : settings.centered
|
760
|
-
? false
|
761
|
-
: 'top aligned',
|
762
771
|
duration : {
|
763
772
|
show : settings.duration,
|
764
773
|
hide : settings.duration
|
@@ -795,7 +804,7 @@ $.fn.modal = function(parameters) {
|
|
795
804
|
;
|
796
805
|
$module
|
797
806
|
.css({
|
798
|
-
marginTop: (
|
807
|
+
marginTop: (!$module.hasClass('aligned') && module.can.fit())
|
799
808
|
? -(height / 2)
|
800
809
|
: 0,
|
801
810
|
marginLeft: -(width / 2)
|
@@ -807,7 +816,7 @@ $.fn.modal = function(parameters) {
|
|
807
816
|
if( module.can.fit() ) {
|
808
817
|
$body.css('height', '');
|
809
818
|
}
|
810
|
-
else {
|
819
|
+
else if(!$module.hasClass('bottom')) {
|
811
820
|
module.debug('Modal is taller than page content, resizing page height');
|
812
821
|
$body
|
813
822
|
.css('height', module.cache.height + (settings.padding * 2) )
|
@@ -815,8 +824,8 @@ $.fn.modal = function(parameters) {
|
|
815
824
|
}
|
816
825
|
},
|
817
826
|
active: function() {
|
818
|
-
$module.addClass(className.active + ' ' + className.
|
819
|
-
$otherModals.filter('.' + className.active).removeClass(className.
|
827
|
+
$module.addClass(className.active + ' ' + className.front);
|
828
|
+
$otherModals.filter('.' + className.active).removeClass(className.front);
|
820
829
|
},
|
821
830
|
scrolling: function() {
|
822
831
|
$dimmable.addClass(className.scrolling);
|
@@ -834,9 +843,11 @@ $.fn.modal = function(parameters) {
|
|
834
843
|
module.bind.scrollLock();
|
835
844
|
}
|
836
845
|
}
|
837
|
-
else {
|
846
|
+
else if (!$module.hasClass('bottom')){
|
838
847
|
module.verbose('Modal cannot fit on screen setting to scrolling');
|
839
848
|
module.set.scrolling();
|
849
|
+
} else {
|
850
|
+
module.verbose('Bottom aligned modal not fitting on screen is unsupported for scrolling');
|
840
851
|
}
|
841
852
|
},
|
842
853
|
undetached: function() {
|
@@ -1110,7 +1121,7 @@ $.fn.modal.settings = {
|
|
1110
1121
|
loading : 'loading',
|
1111
1122
|
scrolling : 'scrolling',
|
1112
1123
|
undetached : 'undetached',
|
1113
|
-
|
1124
|
+
front : 'front'
|
1114
1125
|
}
|
1115
1126
|
};
|
1116
1127
|
|
@@ -43,7 +43,6 @@ $.fn.nag = function(parameters) {
|
|
43
43
|
? $.extend(true, {}, $.fn.nag.settings, parameters)
|
44
44
|
: $.extend({}, $.fn.nag.settings),
|
45
45
|
|
46
|
-
className = settings.className,
|
47
46
|
selector = settings.selector,
|
48
47
|
error = settings.error,
|
49
48
|
namespace = settings.namespace,
|
@@ -53,7 +52,6 @@ $.fn.nag = function(parameters) {
|
|
53
52
|
|
54
53
|
$module = $(this),
|
55
54
|
|
56
|
-
$close = $module.find(selector.close),
|
57
55
|
$context = (settings.context)
|
58
56
|
? $(settings.context)
|
59
57
|
: $('body'),
|
@@ -61,24 +59,7 @@ $.fn.nag = function(parameters) {
|
|
61
59
|
element = this,
|
62
60
|
instance = $module.data(moduleNamespace),
|
63
61
|
|
64
|
-
|
65
|
-
moduleHeight,
|
66
|
-
|
67
|
-
contextWidth,
|
68
|
-
contextHeight,
|
69
|
-
contextOffset,
|
70
|
-
|
71
|
-
yOffset,
|
72
|
-
yPosition,
|
73
|
-
|
74
|
-
timer,
|
75
|
-
module,
|
76
|
-
|
77
|
-
requestAnimationFrame = window.requestAnimationFrame
|
78
|
-
|| window.mozRequestAnimationFrame
|
79
|
-
|| window.webkitRequestAnimationFrame
|
80
|
-
|| window.msRequestAnimationFrame
|
81
|
-
|| function(callback) { setTimeout(callback, 0); }
|
62
|
+
module
|
82
63
|
;
|
83
64
|
module = {
|
84
65
|
|
@@ -450,10 +450,6 @@ $.fn.popup = function(parameters) {
|
|
450
450
|
hide: function(callback) {
|
451
451
|
callback = $.isFunction(callback) ? callback : function(){};
|
452
452
|
module.debug('Hiding pop-up');
|
453
|
-
if(settings.onHide.call($popup, element) === false) {
|
454
|
-
module.debug('onHide callback returned false, cancelling popup animation');
|
455
|
-
return;
|
456
|
-
}
|
457
453
|
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
458
454
|
$popup
|
459
455
|
.transition({
|
@@ -56,8 +56,8 @@ $.fn.progress = function(parameters) {
|
|
56
56
|
moduleNamespace = 'module-' + namespace,
|
57
57
|
|
58
58
|
$module = $(this),
|
59
|
-
$
|
60
|
-
$
|
59
|
+
$bars = $(this).find(selector.bar),
|
60
|
+
$progresses = $(this).find(selector.progress),
|
61
61
|
$label = $(this).find(selector.label),
|
62
62
|
|
63
63
|
element = this,
|
@@ -67,14 +67,29 @@ $.fn.progress = function(parameters) {
|
|
67
67
|
transitionEnd,
|
68
68
|
module
|
69
69
|
;
|
70
|
-
|
71
70
|
module = {
|
71
|
+
helper: {
|
72
|
+
sum: function (nums) {
|
73
|
+
return nums.reduce(function (left, right) {
|
74
|
+
return left + right;
|
75
|
+
}, 0);
|
76
|
+
},
|
77
|
+
forceArray: function (element) {
|
78
|
+
return Array.isArray(element)
|
79
|
+
? element
|
80
|
+
: !isNaN(element)
|
81
|
+
? [element]
|
82
|
+
: typeof element == 'string'
|
83
|
+
? element.split(',')
|
84
|
+
: []
|
85
|
+
;
|
86
|
+
}
|
87
|
+
},
|
72
88
|
|
73
89
|
initialize: function() {
|
74
|
-
module.debug('Initializing progress bar', settings);
|
75
|
-
|
76
90
|
module.set.duration();
|
77
91
|
module.set.transitionEvent();
|
92
|
+
module.debug(element);
|
78
93
|
|
79
94
|
module.read.metadata();
|
80
95
|
module.read.settings();
|
@@ -113,21 +128,21 @@ $.fn.progress = function(parameters) {
|
|
113
128
|
metadata: function() {
|
114
129
|
var
|
115
130
|
data = {
|
116
|
-
percent : $module.data(metadata.percent),
|
131
|
+
percent : module.helper.forceArray($module.data(metadata.percent)),
|
117
132
|
total : $module.data(metadata.total),
|
118
|
-
value : $module.data(metadata.value)
|
133
|
+
value : module.helper.forceArray($module.data(metadata.value))
|
119
134
|
}
|
120
135
|
;
|
121
136
|
if(data.total) {
|
122
137
|
module.debug('Total value set from metadata', data.total);
|
123
138
|
module.set.total(data.total);
|
124
139
|
}
|
125
|
-
if(
|
140
|
+
if(data.value.length > 0) {
|
126
141
|
module.debug('Current value set from metadata', data.value);
|
127
142
|
module.set.value(data.value);
|
128
143
|
module.set.progress(data.value);
|
129
144
|
}
|
130
|
-
if(
|
145
|
+
if(data.percent.length > 0) {
|
131
146
|
module.debug('Current percent value set from metadata', data.percent);
|
132
147
|
module.set.percent(data.percent);
|
133
148
|
}
|
@@ -154,14 +169,14 @@ $.fn.progress = function(parameters) {
|
|
154
169
|
var
|
155
170
|
transitionEnd = module.get.transitionEnd()
|
156
171
|
;
|
157
|
-
$
|
172
|
+
$bars
|
158
173
|
.one(transitionEnd + eventNamespace, function(event) {
|
159
174
|
clearTimeout(module.failSafeTimer);
|
160
175
|
callback.call(this, event);
|
161
176
|
})
|
162
177
|
;
|
163
178
|
module.failSafeTimer = setTimeout(function() {
|
164
|
-
$
|
179
|
+
$bars.triggerHandler(transitionEnd);
|
165
180
|
}, settings.duration + settings.failSafeDelay);
|
166
181
|
module.verbose('Adding fail safe timer', module.timer);
|
167
182
|
}
|
@@ -169,23 +184,19 @@ $.fn.progress = function(parameters) {
|
|
169
184
|
|
170
185
|
increment: function(incrementValue) {
|
171
186
|
var
|
172
|
-
maxValue,
|
173
187
|
startValue,
|
174
188
|
newValue
|
175
189
|
;
|
176
190
|
if( module.has.total() ) {
|
177
191
|
startValue = module.get.value();
|
178
192
|
incrementValue = incrementValue || 1;
|
179
|
-
newValue = startValue + incrementValue;
|
180
193
|
}
|
181
194
|
else {
|
182
195
|
startValue = module.get.percent();
|
183
196
|
incrementValue = incrementValue || module.get.randomValue();
|
184
|
-
|
185
|
-
newValue = startValue + incrementValue;
|
186
|
-
maxValue = 100;
|
187
|
-
module.debug('Incrementing percentage by', startValue, newValue);
|
188
197
|
}
|
198
|
+
newValue = startValue + incrementValue;
|
199
|
+
module.debug('Incrementing percentage by', startValue, newValue, incrementValue);
|
189
200
|
newValue = module.get.normalizedValue(newValue);
|
190
201
|
module.set.progress(newValue);
|
191
202
|
},
|
@@ -221,13 +232,14 @@ $.fn.progress = function(parameters) {
|
|
221
232
|
},
|
222
233
|
|
223
234
|
get: {
|
224
|
-
text: function(templateText) {
|
235
|
+
text: function(templateText, index) {
|
225
236
|
var
|
226
|
-
|
237
|
+
index_ = index || 0,
|
238
|
+
value = module.value[index_] || 0,
|
227
239
|
total = module.total || 0,
|
228
240
|
percent = (animating)
|
229
|
-
? module.get.displayPercent()
|
230
|
-
: module.percent || 0,
|
241
|
+
? module.get.displayPercent(index_)
|
242
|
+
: module.percent[index_] || 0,
|
231
243
|
left = (module.total > 0)
|
232
244
|
? (total - value)
|
233
245
|
: (100 - percent)
|
@@ -238,6 +250,7 @@ $.fn.progress = function(parameters) {
|
|
238
250
|
.replace('{total}', total)
|
239
251
|
.replace('{left}', left)
|
240
252
|
.replace('{percent}', percent)
|
253
|
+
.replace('{bar}', settings.text.bars[index_] || '')
|
241
254
|
;
|
242
255
|
module.verbose('Adding variables to progress bar text', templateText);
|
243
256
|
return templateText;
|
@@ -302,25 +315,28 @@ $.fn.progress = function(parameters) {
|
|
302
315
|
|
303
316
|
// gets current displayed percentage (if animating values this is the intermediary value)
|
304
317
|
displayPercent: function() {
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
318
|
+
return $bars.map(function(index, element) {
|
319
|
+
var
|
320
|
+
$bar = $(element),
|
321
|
+
barWidth = $bar.width(),
|
322
|
+
totalWidth = $module.width(),
|
323
|
+
minDisplay = parseInt($bar.css('min-width'), 10),
|
324
|
+
displayPercent = (barWidth > minDisplay)
|
325
|
+
? (barWidth / totalWidth * 100)
|
326
|
+
: module.percent
|
327
|
+
;
|
328
|
+
return (settings.precision > 0)
|
329
|
+
? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
|
330
|
+
: Math.round(displayPercent)
|
331
|
+
;
|
332
|
+
}).toArray();
|
317
333
|
},
|
318
334
|
|
319
|
-
percent: function() {
|
320
|
-
return module.percent || 0;
|
335
|
+
percent: function(index) {
|
336
|
+
return module.percent[index || 0] || 0;
|
321
337
|
},
|
322
|
-
value: function() {
|
323
|
-
return module.nextValue || module.value || 0;
|
338
|
+
value: function(index) {
|
339
|
+
return module.nextValue || module.value[index || 0] || 0;
|
324
340
|
},
|
325
341
|
total: function() {
|
326
342
|
return module.total || false;
|
@@ -394,19 +410,46 @@ $.fn.progress = function(parameters) {
|
|
394
410
|
},
|
395
411
|
|
396
412
|
set: {
|
397
|
-
barWidth: function(
|
398
|
-
|
399
|
-
|
413
|
+
barWidth: function(values) {
|
414
|
+
module.debug("set bar width with ", values);
|
415
|
+
values = module.helper.forceArray(values);
|
416
|
+
var total = module.helper.sum(values);
|
417
|
+
if(total > 100) {
|
418
|
+
module.error(error.tooHigh, total);
|
400
419
|
}
|
401
|
-
else if (
|
402
|
-
module.error(error.tooLow,
|
420
|
+
else if (total < 0) {
|
421
|
+
module.error(error.tooLow, total);
|
403
422
|
}
|
404
423
|
else {
|
405
|
-
|
406
|
-
|
407
|
-
|
424
|
+
var firstNonZeroIndex = -1;
|
425
|
+
var lastNonZeroIndex = -1;
|
426
|
+
var percents = values.map(function(value, index) {
|
427
|
+
var $bar = $($bars[index]);
|
428
|
+
if (value === 0) {
|
429
|
+
$bar.css('display', 'none');
|
430
|
+
} else {
|
431
|
+
if (firstNonZeroIndex == -1) {
|
432
|
+
firstNonZeroIndex = index;
|
433
|
+
}
|
434
|
+
lastNonZeroIndex = index;
|
435
|
+
$bar.css({
|
436
|
+
display: 'block',
|
437
|
+
width: value + '%'
|
438
|
+
});
|
439
|
+
}
|
440
|
+
return parseInt(value, 10);
|
441
|
+
});
|
442
|
+
values.forEach(function(_, index) {
|
443
|
+
var $bar = $($bars[index]);
|
444
|
+
$bar.css({
|
445
|
+
borderTopLeftRadius: index == firstNonZeroIndex ? '' : 0,
|
446
|
+
borderBottomLeftRadius: index == firstNonZeroIndex ? '' : 0,
|
447
|
+
borderTopRightRadius: index == lastNonZeroIndex ? '' : 0,
|
448
|
+
borderBottomRightRadius: index == lastNonZeroIndex ? '' : 0
|
449
|
+
});
|
450
|
+
});
|
408
451
|
$module
|
409
|
-
.attr('data-percent',
|
452
|
+
.attr('data-percent', percents)
|
410
453
|
;
|
411
454
|
}
|
412
455
|
},
|
@@ -417,41 +460,48 @@ $.fn.progress = function(parameters) {
|
|
417
460
|
: duration
|
418
461
|
;
|
419
462
|
module.verbose('Setting progress bar transition duration', duration);
|
420
|
-
$
|
463
|
+
$bars
|
421
464
|
.css({
|
422
465
|
'transition-duration': duration
|
423
466
|
})
|
424
467
|
;
|
425
468
|
},
|
426
|
-
percent: function(
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
469
|
+
percent: function(percents) {
|
470
|
+
percents = module.helper.forceArray(percents).map(function(percent) {
|
471
|
+
return (typeof percent == 'string')
|
472
|
+
? +(percent.replace('%', ''))
|
473
|
+
: percent
|
474
|
+
;
|
475
|
+
});
|
431
476
|
// round display percentage
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
module.percent = percent;
|
437
|
-
if( !module.has.total() ) {
|
438
|
-
module.value = (settings.precision > 0)
|
439
|
-
? Math.round( (percent / 100) * module.total * (10 * settings.precision)) / (10 * settings.precision)
|
440
|
-
: Math.round( (percent / 100) * module.total * 10) / 10
|
477
|
+
percents = percents.map(function(percent){
|
478
|
+
return (settings.precision > 0)
|
479
|
+
? Math.round(percent * (10 * settings.precision)) / (10 * settings.precision)
|
480
|
+
: Math.round(percent)
|
441
481
|
;
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
482
|
+
});
|
483
|
+
module.percent = percents;
|
484
|
+
if( !module.has.total() ) {
|
485
|
+
module.value = percents.map(function(percent){
|
486
|
+
return (settings.precision > 0)
|
487
|
+
? Math.round( (percent / 100) * module.total * (10 * settings.precision)) / (10 * settings.precision)
|
488
|
+
: Math.round( (percent / 100) * module.total * 10) / 10
|
448
489
|
;
|
490
|
+
});
|
491
|
+
if(settings.limitValues) {
|
492
|
+
module.value = module.value.map(function(value) {
|
493
|
+
return (value > 100)
|
494
|
+
? 100
|
495
|
+
: (module.value < 0)
|
496
|
+
? 0
|
497
|
+
: module.value;
|
498
|
+
});
|
449
499
|
}
|
450
500
|
}
|
451
|
-
module.set.barWidth(
|
501
|
+
module.set.barWidth(percents);
|
452
502
|
module.set.labelInterval();
|
453
503
|
module.set.labels();
|
454
|
-
settings.onChange.call(element,
|
504
|
+
settings.onChange.call(element, percents, module.value, module.total);
|
455
505
|
},
|
456
506
|
labelInterval: function() {
|
457
507
|
var
|
@@ -492,7 +542,7 @@ $.fn.progress = function(parameters) {
|
|
492
542
|
state: function(percent) {
|
493
543
|
percent = (percent !== undefined)
|
494
544
|
? percent
|
495
|
-
: module.percent
|
545
|
+
: module.helper.sum(module.percent)
|
496
546
|
;
|
497
547
|
if(percent === 100) {
|
498
548
|
if(settings.autoSuccess && !(module.is.warning() || module.is.error() || module.is.success())) {
|
@@ -515,17 +565,20 @@ $.fn.progress = function(parameters) {
|
|
515
565
|
}
|
516
566
|
},
|
517
567
|
barLabel: function(text) {
|
518
|
-
|
519
|
-
$progress
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
568
|
+
$progresses.map(function(index, element){
|
569
|
+
var $progress = $(element);
|
570
|
+
if (text !== undefined) {
|
571
|
+
$progress.text( module.get.text(text, index) );
|
572
|
+
}
|
573
|
+
else if (settings.label == 'ratio' && module.total) {
|
574
|
+
module.verbose('Adding ratio to bar label');
|
575
|
+
$progress.text( module.get.text(settings.text.ratio, index) );
|
576
|
+
}
|
577
|
+
else if (settings.label == 'percent') {
|
578
|
+
module.verbose('Adding percentage to bar label');
|
579
|
+
$progress.text( module.get.text(settings.text.percent, index) );
|
580
|
+
}
|
581
|
+
});
|
529
582
|
},
|
530
583
|
active: function(text) {
|
531
584
|
text = text || settings.text.active;
|
@@ -603,7 +656,7 @@ $.fn.progress = function(parameters) {
|
|
603
656
|
module.total = totalValue;
|
604
657
|
},
|
605
658
|
value: function(value) {
|
606
|
-
module.value = value;
|
659
|
+
module.value = module.helper.forceArray(value);
|
607
660
|
},
|
608
661
|
progress: function(value) {
|
609
662
|
if(!module.has.progressPoll()) {
|
@@ -632,26 +685,31 @@ $.fn.progress = function(parameters) {
|
|
632
685
|
module.remove.nextValue();
|
633
686
|
}
|
634
687
|
},
|
635
|
-
progress: function(
|
636
|
-
var
|
637
|
-
|
638
|
-
|
639
|
-
value = module.get.numericValue(value);
|
640
|
-
if(value === false) {
|
641
|
-
module.error(error.nonNumeric, value);
|
642
|
-
}
|
643
|
-
value = module.get.normalizedValue(value);
|
644
|
-
if( module.has.total() ) {
|
645
|
-
module.set.value(value);
|
646
|
-
percentComplete = (value / module.total) * 100;
|
647
|
-
module.debug('Calculating percent complete from total', percentComplete);
|
648
|
-
module.set.percent( percentComplete );
|
649
|
-
}
|
650
|
-
else {
|
651
|
-
percentComplete = value;
|
652
|
-
module.debug('Setting value to exact percentage value', percentComplete);
|
653
|
-
module.set.percent( percentComplete );
|
688
|
+
progress: function(values) {
|
689
|
+
var hasTotal = module.has.total();
|
690
|
+
if (hasTotal) {
|
691
|
+
module.set.value(values);
|
654
692
|
}
|
693
|
+
var percentCompletes = module.helper.forceArray(values).map(function(value) {
|
694
|
+
var
|
695
|
+
percentComplete
|
696
|
+
;
|
697
|
+
value = module.get.numericValue(value);
|
698
|
+
if (value === false) {
|
699
|
+
module.error(error.nonNumeric, value);
|
700
|
+
}
|
701
|
+
value = module.get.normalizedValue(value);
|
702
|
+
if (hasTotal) {
|
703
|
+
percentComplete = (value / module.total) * 100;
|
704
|
+
module.debug('Calculating percent complete from total', percentComplete);
|
705
|
+
}
|
706
|
+
else {
|
707
|
+
percentComplete = value;
|
708
|
+
module.debug('Setting value to exact percentage value', percentComplete);
|
709
|
+
}
|
710
|
+
return percentComplete;
|
711
|
+
});
|
712
|
+
module.set.percent( percentCompletes );
|
655
713
|
}
|
656
714
|
},
|
657
715
|
|
@@ -911,7 +969,8 @@ $.fn.progress.settings = {
|
|
911
969
|
success : false,
|
912
970
|
warning : false,
|
913
971
|
percent : '{percent}%',
|
914
|
-
ratio : '{value} of {total}'
|
972
|
+
ratio : '{value} of {total}',
|
973
|
+
bars : ['']
|
915
974
|
},
|
916
975
|
|
917
976
|
className : {
|