Browse Source

Rebuild files

pull/1129/head
jlukic 10 years ago
parent
commit
3fdbf32719
14 changed files with 609 additions and 136 deletions
  1. 31
      build/less/definitions/behaviors/state.js
  2. 170
      build/less/definitions/modules/progress.js
  3. 35
      build/less/definitions/modules/progress.less
  4. 7
      build/less/themes/packages/default/modules/progress.variables
  5. 2
      build/minified/definitions/behaviors/state.min.js
  6. 2
      build/minified/definitions/modules/progress.min.css
  7. 2
      build/minified/definitions/modules/progress.min.js
  8. 40
      build/packaged/definitions/css/semantic.css
  9. 2
      build/packaged/definitions/css/semantic.min.css
  10. 201
      build/packaged/definitions/javascript/semantic.js
  11. 12
      build/packaged/definitions/javascript/semantic.min.js
  12. 31
      build/uncompressed/definitions/behaviors/state.js
  13. 40
      build/uncompressed/definitions/modules/progress.css
  14. 170
      build/uncompressed/definitions/modules/progress.js

31
build/less/definitions/behaviors/state.js

@ -126,6 +126,12 @@ $.fn.state = function(parameters) {
inactive: function() {
return !( $module.hasClass(className.active) );
},
state: function(state) {
if(className[state] === undefined) {
return false;
}
return $module.hasClass( className[state] );
},
enabled: function() {
return !( $module.is(settings.filter.active) );
@ -143,6 +149,9 @@ $.fn.state = function(parameters) {
},
input: function() {
return $module.is('input');
},
progress: function() {
return $module.is('.ui.progress');
}
},
@ -631,7 +640,10 @@ $.fn.state.settings = {
className: {
active : 'active',
disabled : 'disabled',
loading : 'loading'
error : 'error',
loading : 'loading',
success : 'success',
warning : 'warning'
},
selector: {
@ -648,14 +660,23 @@ $.fn.state.settings = {
button: {
disabled : true,
loading : true,
active : true
active : true,
},
progress: {
active : true,
success : true,
warning : true,
error : true
}
},
states : {
disabled: true,
loading : true,
active : true
active : true,
disabled : true,
error : true,
loading : true,
success : true,
warning : true
},
text : {

170
build/less/definitions/modules/progress.js

@ -48,6 +48,7 @@ $.fn.progress = function(parameters) {
$module = $(this),
$bar = $(this).find(selector.bar),
$progress = $(this).find(selector.progress),
$label = $(this).find(selector.label),
element = this,
instance = $module.data(moduleNamespace),
@ -71,6 +72,20 @@ $.fn.progress = function(parameters) {
;
},
destroy: function() {
module.verbose('Destroying previous dropdown for', $module);
$module
.removeData(moduleNamespace)
;
instance = undefined;
},
complete: function() {
if(module.percent === undefined || module.percent < 100) {
module.set.percent(100);
}
},
read: {
metadata: function() {
if( $module.data(metadata.percent) ) {
@ -106,7 +121,7 @@ $.fn.progress = function(parameters) {
incrementValue = incrementValue || 1;
newValue = startValue + incrementValue;
edgeValue = module.total;
module.debug('Incrementing completed by value', incrementValue, startValue, edgeValue);
module.debug('Incrementing value by', incrementValue, startValue, edgeValue);
if(newValue > edgeValue ) {
module.debug('Value cannot decrement above total', edgeValue);
newValue = edgeValue;
@ -136,7 +151,7 @@ $.fn.progress = function(parameters) {
startValue = module.value || 0;
decrementValue = -decrementValue || -1;
newValue = startValue + decrementValue;
module.debug('Decrementing completed by value', decrementValue, startValue);
module.debug('Decrementing value by', decrementValue, startValue);
if(newValue > module.total ) {
newValue = module.total;
}
@ -152,6 +167,21 @@ $.fn.progress = function(parameters) {
},
get: {
text: function(templateText) {
var
value = module.value || 0,
total = module.total || 0,
percent = module.percent || 0
;
templateText = templateText || '';
templateText = templateText
.replace('{value}', value)
.replace('{total}', total)
.replace('{percent}', percent)
;
module.debug('Adding variables to progress bar text', templateText);
return templateText;
},
randomValue: function() {
module.debug('Generating random increment percentage');
return Math.floor((Math.random() * settings.random.max) + settings.random.min);
@ -168,8 +198,10 @@ $.fn.progress = function(parameters) {
},
set: {
complete: function() {
module.set.percent(100);
barWidth: function(value) {
$bar
.css('width', value + '%')
;
},
initials: function() {
if(settings.value) {
@ -184,21 +216,91 @@ $.fn.progress = function(parameters) {
module.verbose('Current percent set in settings', settings.percent);
module.percent = settings.percent;
}
if(module.percent) {
module.set.percent(module.percent);
}
else if(module.value) {
module.set.progress(module.value);
}
},
percent: function(value) {
value = (typeof value == 'string')
? +(value.replace('%', ''))
: value
percent: function(percent) {
percent = (typeof percent == 'string')
? +(percent.replace('%', ''))
: percent
;
console.log(value);
if(value > 0 && value < 1) {
if(percent > 0 && percent < 1) {
module.verbose('Module percentage passed as decimal, converting');
value = value * 100;
percent = percent * 100;
}
// round percentage
if(settings.precision === 0) {
percent = Math.round(percent);
}
else {
percent = Math.round(percent * (10 * settings.precision) / (10 * settings.precision) );
}
module.percent = percent;
if(module.total) {
module.value = Math.round( (percent / 100) * module.total);
}
module.set.barWidth(percent);
module.set.barLabel();
if(percent === 100 && settings.autoSuccess) {
module.debug('Automatically triggering success at 100%');
module.set.success();
}
else if(settings.text.active) {
module.set.label(settings.text.active);
}
$.proxy(settings.onChange, element)(percent, module.value, module.total);
},
label: function(text) {
text = text || '';
if(text) {
text = module.get.text(text);
module.debug('Setting label to text', text);
$label.text(text);
}
},
barLabel: function(text) {
if(text !== undefined) {
$progress.text( module.get.text(text) );
}
else if(settings.label == 'ratio' && module.total) {
module.debug('Adding ratio to bar label');
$progress.text( module.get.text(settings.text.ratio) );
}
else if(settings.label == 'percent') {
module.debug('Adding percentage to bar label');
$progress.text( module.get.text(settings.text.percent) );
}
},
success : function(text) {
text = text || settings.text.success;
module.debug('Setting success state');
$module.addClass(className.success);
module.complete();
if(text) {
module.set.label(text);
}
},
warning : function(text) {
text = text || settings.text.warning;
module.debug('Setting warning state');
$module.addClass(className.warning);
module.complete();
if(text) {
module.set.label(text);
}
},
error : function(text) {
text = text || settings.text.error;
module.debug('Setting error state');
$module.addClass(className.error);
module.complete();
if(text) {
module.set.label(text);
}
module.percent = value;
$bar
.css('width', value + '%')
;
},
total: function(totalValue) {
module.total = totalValue;
@ -217,7 +319,7 @@ $.fn.progress = function(parameters) {
}
if(module.total) {
module.value = numericValue;
percentComplete = (numericValue / module.total);
percentComplete = (numericValue / module.total) * 100;
module.debug('Calculating percent complete from total', percentComplete);
module.set.percent( percentComplete );
}
@ -411,26 +513,32 @@ $.fn.progress.settings = {
name : 'Progress',
namespace : 'progress',
debug : true,
debug : false,
verbose : true,
performance : true,
random : {
min: 1,
max: 3
random : {
min : 1,
max : 3
},
label : 'percent',
autoSuccess : true,
precision : 1,
percent : false,
total : false,
value : false,
onChange : function(value){},
onChange : function(percent, value, total){},
error : {
method : 'The method you called is not defined.',
nonNumeric : 'Progress value is non numeric'
error : {
method : 'The method you called is not defined.',
nonNumeric : 'Progress value is non numeric'
},
regExp: {
variable: /\{\$*[A-z0-9]+\}/g
},
metadata: {
@ -439,12 +547,26 @@ $.fn.progress.settings = {
value : 'value'
},
selector : {
bar : '> .bar',
label : '> .label',
progress : '.bar > .progress'
},
text : {
active : false,
error : false,
success : false,
warning : false,
percent : '{percent}%',
ratio : '{value} of {total}'
},
className : {
error : 'error',
success : 'success',
warning : 'warning'
}
};

35
build/less/definitions/modules/progress.less

@ -67,6 +67,7 @@
/* Percent Complete */
.ui.progress .bar > .progress {
white-space: nowrap;
position: absolute;
width: @progressWidth;
font-size: @progressSize;
@ -77,6 +78,7 @@
color: @progressColor;
text-shadow: @progressTextShadow;
margin-top: @progressOffset;
font-weight: @progressFontWeight;
text-align: @progressTextAlign;
}
@ -90,9 +92,11 @@
left: @labelLeft;
bottom: @labelBottom;
color: @labelColor;
font-weight: @labelFontWeight;
text-shadow: @labelTextShadow;
margin-top: @labelOffset;
text-align: @labelTextAlign;
transition: @labelTransition;
}
@ -102,40 +106,49 @@
/*--------------
Successful
Success
---------------*/
.ui.successful.progress .bar {
.ui.progress.success .bar {
background-color: @successColor !important;
}
.ui.successful.progress .bar,
.ui.successful.progress .bar::after {
.ui.progress.success .bar,
.ui.progress.success .bar::after {
animation: none !important;
}
.ui.progress.success > .label {
color: @successHeaderColor;
}
/*--------------
Warning
---------------*/
.ui.warning.progress .bar {
.ui.progress.warning .bar {
background-color: @warningColor !important;
}
.ui.warning.progress .bar,
.ui.warning.progress .bar::after {
.ui.progress.warning .bar,
.ui.progress.warning .bar::after {
animation: none !important;
}
.ui.progress.warning > .label {
color: @warningHeaderColor;
}
/*--------------
Failed
Error
---------------*/
.ui.failed.progress .bar {
.ui.progress.error .bar {
background-color: @errorColor !important;
}
.ui.failed.progress .bar,
.ui.failed.progress .bar::after {
.ui.progress.error .bar,
.ui.progress.error .bar::after {
animation: none !important;
}
.ui.progress.error > .label {
color: @errorHeaderColor;
}
/*--------------
Active

7
build/less/themes/packages/default/modules/progress.variables

@ -24,8 +24,8 @@
@barBackground: #888888;
@barBorderRadius: @borderRadius;
@barTransition:
width 0.3s ease-in-out,
background-color 1s ease-out
width 0.5s @defaultEasing,
background-color 1s @defaultEasing
;
@ -39,6 +39,7 @@
@progressOffset: -0.5em;
@progressColor: @invertedLightTextColor;
@progressTextShadow: none;
@progressFontWeight: bold;
@progressTextAlign: left;
@labelWidth: 100%;
@ -52,7 +53,9 @@
@labelOffset: 0em;
@labelColor: @textColor;
@labelTextShadow: none;
@labelFontWeight: bold;
@labelTextAlign: center;
@labelTransition: color 1s @defaultEasing;
/*-------------------
States

2
build/minified/definitions/behaviors/state.min.js
File diff suppressed because it is too large
View File

2
build/minified/definitions/modules/progress.min.css

@ -11,4 +11,4 @@
* Released: 09/23/2014
*/
.ui.progress{position:relative;display:block;max-width:100%;border:1px solid rgba(0,0,0,.1);margin:1em 0 2.75em;box-shadow:none;background:#fafafa;padding:.325em;border-radius:.325em}.ui.progress:first-child{margin:0 0 2.75em}.ui.progress:last-child{margin:0 0 1.75em}.ui.progress .bar{display:block;line-height:1;position:relative;width:0;height:1.75em;background:#888;border-radius:.325em;-webkit-transition:width .3s ease-in-out,background-color 1s ease-out;transition:width .3s ease-in-out,background-color 1s ease-out}.ui.progress .bar>.progress{position:absolute;width:auto;font-size:.9em;top:50%;right:1em;left:auto;bottom:auto;color:rgba(255,255,255,.8);text-shadow:none;margin-top:-.5em;text-align:left}.ui.progress>.label{position:absolute;width:100%;font-size:1em;top:auto;right:auto;left:0;bottom:-1.75em;color:rgba(0,0,0,.8);text-shadow:none;margin-top:0;text-align:center}.ui.successful.progress .bar{background-color:#5bbd72!important}.ui.successful.progress .bar,.ui.successful.progress .bar::after{-webkit-animation:none!important;animation:none!important}.ui.warning.progress .bar{background-color:#f2c037!important}.ui.warning.progress .bar,.ui.warning.progress .bar::after{-webkit-animation:none!important;animation:none!important}.ui.failed.progress .bar{background-color:#d95c5c!important}.ui.failed.progress .bar,.ui.failed.progress .bar::after{-webkit-animation:none!important;animation:none!important}.ui.active.progress .bar{position:relative}.ui.active.progress .bar::after{content:'';opacity:0;position:absolute;top:0;left:0;right:0;bottom:0;background:#fff;border-radius:.325em;-webkit-animation:progress-active 2s ease infinite;animation:progress-active 2s ease infinite}@-webkit-keyframes progress-active{0%{opacity:0;width:0}50%{opacity:.3}100%{opacity:0;width:100%}}@keyframes progress-active{0%{opacity:0;width:0}50%{opacity:.3}100%{opacity:0;width:100%}}.ui.disabled.progress{opacity:.35}.ui.disabled.progress .bar,.ui.disabled.progress .bar::after{-webkit-animation:none!important;animation:none!important}.ui.progress.attached{background-color:transparent;position:relative;border:none;margin:0}.ui.progress.attached,.ui.progress.attached .bar{display:block;height:.25em;padding:0;overflow:hidden;border-radius:0 0 .325em .325em}.ui.progress.attached .bar{border-radius:0}.ui.progress.top.attached,.ui.progress.top.attached .bar{top:0;border-radius:.325em .325em 0 0}.ui.progress.top.attached .bar{border-radius:0}.ui.black.progress .bar{background-color:#1b1c1d}.ui.blue.progress .bar{background-color:#3b83c0}.ui.green.progress .bar{background-color:#5bbd72}.ui.orange.progress .bar{background-color:#e07b53}.ui.pink.progress .bar{background-color:#d9499a}.ui.purple.progress .bar{background-color:#564f8a}.ui.red.progress .bar{background-color:#d95c5c}.ui.teal.progress .bar{background-color:#00b5ad}.ui.yellow.progress .bar{background-color:#e9bd16}.ui.small.progress .bar{height:14px}
.ui.progress{position:relative;display:block;max-width:100%;border:1px solid rgba(0,0,0,.1);margin:1em 0 2.75em;box-shadow:none;background:#fafafa;padding:.325em;border-radius:.325em}.ui.progress:first-child{margin:0 0 2.75em}.ui.progress:last-child{margin:0 0 1.75em}.ui.progress .bar{display:block;line-height:1;position:relative;width:0;height:1.75em;background:#888;border-radius:.325em;-webkit-transition:width .5s ease,background-color 1s ease;transition:width .5s ease,background-color 1s ease}.ui.progress .bar>.progress{white-space:nowrap;position:absolute;width:auto;font-size:.9em;top:50%;right:1em;left:auto;bottom:auto;color:rgba(255,255,255,.8);text-shadow:none;margin-top:-.5em;font-weight:700;text-align:left}.ui.progress>.label{position:absolute;width:100%;font-size:1em;top:auto;right:auto;left:0;bottom:-1.75em;color:rgba(0,0,0,.8);font-weight:700;text-shadow:none;margin-top:0;text-align:center;-webkit-transition:color 1s ease;transition:color 1s ease}.ui.progress.success .bar{background-color:#5bbd72!important}.ui.progress.success .bar,.ui.progress.success .bar::after{-webkit-animation:none!important;animation:none!important}.ui.progress.success>.label{color:#336534}.ui.progress.warning .bar{background-color:#f2c037!important}.ui.progress.warning .bar,.ui.progress.warning .bar::after{-webkit-animation:none!important;animation:none!important}.ui.progress.warning>.label{color:#785f33}.ui.progress.error .bar{background-color:#d95c5c!important}.ui.progress.error .bar,.ui.progress.error .bar::after{-webkit-animation:none!important;animation:none!important}.ui.progress.error>.label{color:#973d3b}.ui.active.progress .bar{position:relative}.ui.active.progress .bar::after{content:'';opacity:0;position:absolute;top:0;left:0;right:0;bottom:0;background:#fff;border-radius:.325em;-webkit-animation:progress-active 2s ease infinite;animation:progress-active 2s ease infinite}@-webkit-keyframes progress-active{0%{opacity:0;width:0}50%{opacity:.3}100%{opacity:0;width:100%}}@keyframes progress-active{0%{opacity:0;width:0}50%{opacity:.3}100%{opacity:0;width:100%}}.ui.disabled.progress{opacity:.35}.ui.disabled.progress .bar,.ui.disabled.progress .bar::after{-webkit-animation:none!important;animation:none!important}.ui.progress.attached{background-color:transparent;position:relative;border:none;margin:0}.ui.progress.attached,.ui.progress.attached .bar{display:block;height:.25em;padding:0;overflow:hidden;border-radius:0 0 .325em .325em}.ui.progress.attached .bar{border-radius:0}.ui.progress.top.attached,.ui.progress.top.attached .bar{top:0;border-radius:.325em .325em 0 0}.ui.progress.top.attached .bar{border-radius:0}.ui.black.progress .bar{background-color:#1b1c1d}.ui.blue.progress .bar{background-color:#3b83c0}.ui.green.progress .bar{background-color:#5bbd72}.ui.orange.progress .bar{background-color:#e07b53}.ui.pink.progress .bar{background-color:#d9499a}.ui.purple.progress .bar{background-color:#564f8a}.ui.red.progress .bar{background-color:#d95c5c}.ui.teal.progress .bar{background-color:#00b5ad}.ui.yellow.progress .bar{background-color:#e9bd16}.ui.small.progress .bar{height:14px}

2
build/minified/definitions/modules/progress.min.js
File diff suppressed because it is too large
View File

40
build/packaged/definitions/css/semantic.css

@ -21466,11 +21466,12 @@ a.ui.nag {
height: 1.75em;
background: #888888;
border-radius: 0.325em;
-webkit-transition: width 0.3s ease-in-out, background-color 1s ease-out;
transition: width 0.3s ease-in-out, background-color 1s ease-out;
-webkit-transition: width 0.5s ease, background-color 1s ease;
transition: width 0.5s ease, background-color 1s ease;
}
/* Percent Complete */
.ui.progress .bar > .progress {
white-space: nowrap;
position: absolute;
width: auto;
font-size: 0.9em;
@ -21481,6 +21482,7 @@ a.ui.nag {
color: rgba(255, 255, 255, 0.8);
text-shadow: none;
margin-top: -0.5em;
font-weight: bold;
text-align: left;
}
/* Label */
@ -21493,46 +21495,58 @@ a.ui.nag {
left: 0%;
bottom: -1.75em;
color: rgba(0, 0, 0, 0.8);
font-weight: bold;
text-shadow: none;
margin-top: 0em;
text-align: center;
-webkit-transition: color 1s ease;
transition: color 1s ease;
}
/*******************************
States
*******************************/
/*--------------
Successful
Success
---------------*/
.ui.successful.progress .bar {
.ui.progress.success .bar {
background-color: #5bbd72 !important;
}
.ui.successful.progress .bar,
.ui.successful.progress .bar::after {
.ui.progress.success .bar,
.ui.progress.success .bar::after {
-webkit-animation: none !important;
animation: none !important;
}
.ui.progress.success > .label {
color: #336534;
}
/*--------------
Warning
---------------*/
.ui.warning.progress .bar {
.ui.progress.warning .bar {
background-color: #f2c037 !important;
}
.ui.warning.progress .bar,
.ui.warning.progress .bar::after {
.ui.progress.warning .bar,
.ui.progress.warning .bar::after {
-webkit-animation: none !important;
animation: none !important;
}
.ui.progress.warning > .label {
color: #785f33;
}
/*--------------
Failed
Error
---------------*/
.ui.failed.progress .bar {
.ui.progress.error .bar {
background-color: #d95c5c !important;
}
.ui.failed.progress .bar,
.ui.failed.progress .bar::after {
.ui.progress.error .bar,
.ui.progress.error .bar::after {
-webkit-animation: none !important;
animation: none !important;
}
.ui.progress.error > .label {
color: #973d3b;
}
/*--------------
Active
---------------*/

2
build/packaged/definitions/css/semantic.min.css
File diff suppressed because it is too large
View File

201
build/packaged/definitions/javascript/semantic.js

@ -1982,6 +1982,12 @@ $.fn.state = function(parameters) {
inactive: function() {
return !( $module.hasClass(className.active) );
},
state: function(state) {
if(className[state] === undefined) {
return false;
}
return $module.hasClass( className[state] );
},
enabled: function() {
return !( $module.is(settings.filter.active) );
@ -1999,6 +2005,9 @@ $.fn.state = function(parameters) {
},
input: function() {
return $module.is('input');
},
progress: function() {
return $module.is('.ui.progress');
}
},
@ -2487,7 +2496,10 @@ $.fn.state.settings = {
className: {
active : 'active',
disabled : 'disabled',
loading : 'loading'
error : 'error',
loading : 'loading',
success : 'success',
warning : 'warning'
},
selector: {
@ -2504,14 +2516,23 @@ $.fn.state.settings = {
button: {
disabled : true,
loading : true,
active : true
active : true,
},
progress: {
active : true,
success : true,
warning : true,
error : true
}
},
states : {
disabled: true,
loading : true,
active : true
active : true,
disabled : true,
error : true,
loading : true,
success : true,
warning : true
},
text : {
@ -10439,6 +10460,7 @@ $.fn.progress = function(parameters) {
$module = $(this),
$bar = $(this).find(selector.bar),
$progress = $(this).find(selector.progress),
$label = $(this).find(selector.label),
element = this,
instance = $module.data(moduleNamespace),
@ -10462,6 +10484,20 @@ $.fn.progress = function(parameters) {
;
},
destroy: function() {
module.verbose('Destroying previous dropdown for', $module);
$module
.removeData(moduleNamespace)
;
instance = undefined;
},
complete: function() {
if(module.percent === undefined || module.percent < 100) {
module.set.percent(100);
}
},
read: {
metadata: function() {
if( $module.data(metadata.percent) ) {
@ -10497,7 +10533,7 @@ $.fn.progress = function(parameters) {
incrementValue = incrementValue || 1;
newValue = startValue + incrementValue;
edgeValue = module.total;
module.debug('Incrementing completed by value', incrementValue, startValue, edgeValue);
module.debug('Incrementing value by', incrementValue, startValue, edgeValue);
if(newValue > edgeValue ) {
module.debug('Value cannot decrement above total', edgeValue);
newValue = edgeValue;
@ -10527,7 +10563,7 @@ $.fn.progress = function(parameters) {
startValue = module.value || 0;
decrementValue = -decrementValue || -1;
newValue = startValue + decrementValue;
module.debug('Decrementing completed by value', decrementValue, startValue);
module.debug('Decrementing value by', decrementValue, startValue);
if(newValue > module.total ) {
newValue = module.total;
}
@ -10543,6 +10579,21 @@ $.fn.progress = function(parameters) {
},
get: {
text: function(templateText) {
var
value = module.value || 0,
total = module.total || 0,
percent = module.percent || 0
;
templateText = templateText || '';
templateText = templateText
.replace('{value}', value)
.replace('{total}', total)
.replace('{percent}', percent)
;
module.debug('Adding variables to progress bar text', templateText);
return templateText;
},
randomValue: function() {
module.debug('Generating random increment percentage');
return Math.floor((Math.random() * settings.random.max) + settings.random.min);
@ -10559,8 +10610,10 @@ $.fn.progress = function(parameters) {
},
set: {
complete: function() {
module.set.percent(100);
barWidth: function(value) {
$bar
.css('width', value + '%')
;
},
initials: function() {
if(settings.value) {
@ -10575,21 +10628,91 @@ $.fn.progress = function(parameters) {
module.verbose('Current percent set in settings', settings.percent);
module.percent = settings.percent;
}
if(module.percent) {
module.set.percent(module.percent);
}
else if(module.value) {
module.set.progress(module.value);
}
},
percent: function(value) {
value = (typeof value == 'string')
? +(value.replace('%', ''))
: value
percent: function(percent) {
percent = (typeof percent == 'string')
? +(percent.replace('%', ''))
: percent
;
console.log(value);
if(value > 0 && value < 1) {
if(percent > 0 && percent < 1) {
module.verbose('Module percentage passed as decimal, converting');
value = value * 100;
percent = percent * 100;
}
// round percentage
if(settings.precision === 0) {
percent = Math.round(percent);
}
else {
percent = Math.round(percent * (10 * settings.precision) / (10 * settings.precision) );
}
module.percent = percent;
if(module.total) {
module.value = Math.round( (percent / 100) * module.total);
}
module.set.barWidth(percent);
module.set.barLabel();
if(percent === 100 && settings.autoSuccess) {
module.debug('Automatically triggering success at 100%');
module.set.success();
}
else if(settings.text.active) {
module.set.label(settings.text.active);
}
$.proxy(settings.onChange, element)(percent, module.value, module.total);
},
label: function(text) {
text = text || '';
if(text) {
text = module.get.text(text);
module.debug('Setting label to text', text);
$label.text(text);
}
},
barLabel: function(text) {
if(text !== undefined) {
$progress.text( module.get.text(text) );
}
else if(settings.label == 'ratio' && module.total) {
module.debug('Adding ratio to bar label');
$progress.text( module.get.text(settings.text.ratio) );
}
else if(settings.label == 'percent') {
module.debug('Adding percentage to bar label');
$progress.text( module.get.text(settings.text.percent) );
}
},
success : function(text) {
text = text || settings.text.success;
module.debug('Setting success state');
$module.addClass(className.success);
module.complete();
if(text) {
module.set.label(text);
}
},
warning : function(text) {
text = text || settings.text.warning;
module.debug('Setting warning state');
$module.addClass(className.warning);
module.complete();
if(text) {
module.set.label(text);
}
},
error : function(text) {
text = text || settings.text.error;
module.debug('Setting error state');
$module.addClass(className.error);
module.complete();
if(text) {
module.set.label(text);
}
module.percent = value;
$bar
.css('width', value + '%')
;
},
total: function(totalValue) {
module.total = totalValue;
@ -10608,7 +10731,7 @@ $.fn.progress = function(parameters) {
}
if(module.total) {
module.value = numericValue;
percentComplete = (numericValue / module.total);
percentComplete = (numericValue / module.total) * 100;
module.debug('Calculating percent complete from total', percentComplete);
module.set.percent( percentComplete );
}
@ -10802,26 +10925,32 @@ $.fn.progress.settings = {
name : 'Progress',
namespace : 'progress',
debug : true,
debug : false,
verbose : true,
performance : true,
random : {
min: 1,
max: 3
random : {
min : 1,
max : 3
},
label : 'percent',
autoSuccess : true,
precision : 1,
percent : false,
total : false,
value : false,
onChange : function(value){},
onChange : function(percent, value, total){},
error : {
method : 'The method you called is not defined.',
nonNumeric : 'Progress value is non numeric'
error : {
method : 'The method you called is not defined.',
nonNumeric : 'Progress value is non numeric'
},
regExp: {
variable: /\{\$*[A-z0-9]+\}/g
},
metadata: {
@ -10830,12 +10959,26 @@ $.fn.progress.settings = {
value : 'value'
},
selector : {
bar : '> .bar',
label : '> .label',
progress : '.bar > .progress'
},
text : {
active : false,
error : false,
success : false,
warning : false,
percent : '{percent}%',
ratio : '{value} of {total}'
},
className : {
error : 'error',
success : 'success',
warning : 'warning'
}
};

12
build/packaged/definitions/javascript/semantic.min.js
File diff suppressed because it is too large
View File

31
build/uncompressed/definitions/behaviors/state.js

@ -126,6 +126,12 @@ $.fn.state = function(parameters) {
inactive: function() {
return !( $module.hasClass(className.active) );
},
state: function(state) {
if(className[state] === undefined) {
return false;
}
return $module.hasClass( className[state] );
},
enabled: function() {
return !( $module.is(settings.filter.active) );
@ -143,6 +149,9 @@ $.fn.state = function(parameters) {
},
input: function() {
return $module.is('input');
},
progress: function() {
return $module.is('.ui.progress');
}
},
@ -631,7 +640,10 @@ $.fn.state.settings = {
className: {
active : 'active',
disabled : 'disabled',
loading : 'loading'
error : 'error',
loading : 'loading',
success : 'success',
warning : 'warning'
},
selector: {
@ -648,14 +660,23 @@ $.fn.state.settings = {
button: {
disabled : true,
loading : true,
active : true
active : true,
},
progress: {
active : true,
success : true,
warning : true,
error : true
}
},
states : {
disabled: true,
loading : true,
active : true
active : true,
disabled : true,
error : true,
loading : true,
success : true,
warning : true
},
text : {

40
build/uncompressed/definitions/modules/progress.css

@ -207,11 +207,12 @@
height: 1.75em;
background: #888888;
border-radius: 0.325em;
-webkit-transition: width 0.3s ease-in-out, background-color 1s ease-out;
transition: width 0.3s ease-in-out, background-color 1s ease-out;
-webkit-transition: width 0.5s ease, background-color 1s ease;
transition: width 0.5s ease, background-color 1s ease;
}
/* Percent Complete */
.ui.progress .bar > .progress {
white-space: nowrap;
position: absolute;
width: auto;
font-size: 0.9em;
@ -222,6 +223,7 @@
color: rgba(255, 255, 255, 0.8);
text-shadow: none;
margin-top: -0.5em;
font-weight: bold;
text-align: left;
}
/* Label */
@ -234,46 +236,58 @@
left: 0%;
bottom: -1.75em;
color: rgba(0, 0, 0, 0.8);
font-weight: bold;
text-shadow: none;
margin-top: 0em;
text-align: center;
-webkit-transition: color 1s ease;
transition: color 1s ease;
}
/*******************************
States
*******************************/
/*--------------
Successful
Success
---------------*/
.ui.successful.progress .bar {
.ui.progress.success .bar {
background-color: #5bbd72 !important;
}
.ui.successful.progress .bar,
.ui.successful.progress .bar::after {
.ui.progress.success .bar,
.ui.progress.success .bar::after {
-webkit-animation: none !important;
animation: none !important;
}
.ui.progress.success > .label {
color: #336534;
}
/*--------------
Warning
---------------*/
.ui.warning.progress .bar {
.ui.progress.warning .bar {
background-color: #f2c037 !important;
}
.ui.warning.progress .bar,
.ui.warning.progress .bar::after {
.ui.progress.warning .bar,
.ui.progress.warning .bar::after {
-webkit-animation: none !important;
animation: none !important;
}
.ui.progress.warning > .label {
color: #785f33;
}
/*--------------
Failed
Error
---------------*/
.ui.failed.progress .bar {
.ui.progress.error .bar {
background-color: #d95c5c !important;
}
.ui.failed.progress .bar,
.ui.failed.progress .bar::after {
.ui.progress.error .bar,
.ui.progress.error .bar::after {
-webkit-animation: none !important;
animation: none !important;
}
.ui.progress.error > .label {
color: #973d3b;
}
/*--------------
Active
---------------*/

170
build/uncompressed/definitions/modules/progress.js

@ -48,6 +48,7 @@ $.fn.progress = function(parameters) {
$module = $(this),
$bar = $(this).find(selector.bar),
$progress = $(this).find(selector.progress),
$label = $(this).find(selector.label),
element = this,
instance = $module.data(moduleNamespace),
@ -71,6 +72,20 @@ $.fn.progress = function(parameters) {
;
},
destroy: function() {
module.verbose('Destroying previous dropdown for', $module);
$module
.removeData(moduleNamespace)
;
instance = undefined;
},
complete: function() {
if(module.percent === undefined || module.percent < 100) {
module.set.percent(100);
}
},
read: {
metadata: function() {
if( $module.data(metadata.percent) ) {
@ -106,7 +121,7 @@ $.fn.progress = function(parameters) {
incrementValue = incrementValue || 1;
newValue = startValue + incrementValue;
edgeValue = module.total;
module.debug('Incrementing completed by value', incrementValue, startValue, edgeValue);
module.debug('Incrementing value by', incrementValue, startValue, edgeValue);
if(newValue > edgeValue ) {
module.debug('Value cannot decrement above total', edgeValue);
newValue = edgeValue;
@ -136,7 +151,7 @@ $.fn.progress = function(parameters) {
startValue = module.value || 0;
decrementValue = -decrementValue || -1;
newValue = startValue + decrementValue;
module.debug('Decrementing completed by value', decrementValue, startValue);
module.debug('Decrementing value by', decrementValue, startValue);
if(newValue > module.total ) {
newValue = module.total;
}
@ -152,6 +167,21 @@ $.fn.progress = function(parameters) {
},
get: {
text: function(templateText) {
var
value = module.value || 0,
total = module.total || 0,
percent = module.percent || 0
;
templateText = templateText || '';
templateText = templateText
.replace('{value}', value)
.replace('{total}', total)
.replace('{percent}', percent)
;
module.debug('Adding variables to progress bar text', templateText);
return templateText;
},
randomValue: function() {
module.debug('Generating random increment percentage');
return Math.floor((Math.random() * settings.random.max) + settings.random.min);
@ -168,8 +198,10 @@ $.fn.progress = function(parameters) {
},
set: {
complete: function() {
module.set.percent(100);
barWidth: function(value) {
$bar
.css('width', value + '%')
;
},
initials: function() {
if(settings.value) {
@ -184,21 +216,91 @@ $.fn.progress = function(parameters) {
module.verbose('Current percent set in settings', settings.percent);
module.percent = settings.percent;
}
if(module.percent) {
module.set.percent(module.percent);
}
else if(module.value) {
module.set.progress(module.value);
}
},
percent: function(value) {
value = (typeof value == 'string')
? +(value.replace('%', ''))
: value
percent: function(percent) {
percent = (typeof percent == 'string')
? +(percent.replace('%', ''))
: percent
;
console.log(value);
if(value > 0 && value < 1) {
if(percent > 0 && percent < 1) {
module.verbose('Module percentage passed as decimal, converting');
value = value * 100;
percent = percent * 100;
}
// round percentage
if(settings.precision === 0) {
percent = Math.round(percent);
}
else {
percent = Math.round(percent * (10 * settings.precision) / (10 * settings.precision) );
}
module.percent = percent;
if(module.total) {
module.value = Math.round( (percent / 100) * module.total);
}
module.set.barWidth(percent);
module.set.barLabel();
if(percent === 100 && settings.autoSuccess) {
module.debug('Automatically triggering success at 100%');
module.set.success();
}
else if(settings.text.active) {
module.set.label(settings.text.active);
}
$.proxy(settings.onChange, element)(percent, module.value, module.total);
},
label: function(text) {
text = text || '';
if(text) {
text = module.get.text(text);
module.debug('Setting label to text', text);
$label.text(text);
}
},
barLabel: function(text) {
if(text !== undefined) {
$progress.text( module.get.text(text) );
}
else if(settings.label == 'ratio' && module.total) {
module.debug('Adding ratio to bar label');
$progress.text( module.get.text(settings.text.ratio) );
}
else if(settings.label == 'percent') {
module.debug('Adding percentage to bar label');
$progress.text( module.get.text(settings.text.percent) );
}
},
success : function(text) {
text = text || settings.text.success;
module.debug('Setting success state');
$module.addClass(className.success);
module.complete();
if(text) {
module.set.label(text);
}
},
warning : function(text) {
text = text || settings.text.warning;
module.debug('Setting warning state');
$module.addClass(className.warning);
module.complete();
if(text) {
module.set.label(text);
}
},
error : function(text) {
text = text || settings.text.error;
module.debug('Setting error state');
$module.addClass(className.error);
module.complete();
if(text) {
module.set.label(text);
}
module.percent = value;
$bar
.css('width', value + '%')
;
},
total: function(totalValue) {
module.total = totalValue;
@ -217,7 +319,7 @@ $.fn.progress = function(parameters) {
}
if(module.total) {
module.value = numericValue;
percentComplete = (numericValue / module.total);
percentComplete = (numericValue / module.total) * 100;
module.debug('Calculating percent complete from total', percentComplete);
module.set.percent( percentComplete );
}
@ -411,26 +513,32 @@ $.fn.progress.settings = {
name : 'Progress',
namespace : 'progress',
debug : true,
debug : false,
verbose : true,
performance : true,
random : {
min: 1,
max: 3
random : {
min : 1,
max : 3
},
label : 'percent',
autoSuccess : true,
precision : 1,
percent : false,
total : false,
value : false,
onChange : function(value){},
onChange : function(percent, value, total){},
error : {
method : 'The method you called is not defined.',
nonNumeric : 'Progress value is non numeric'
error : {
method : 'The method you called is not defined.',
nonNumeric : 'Progress value is non numeric'
},
regExp: {
variable: /\{\$*[A-z0-9]+\}/g
},
metadata: {
@ -439,12 +547,26 @@ $.fn.progress.settings = {
value : 'value'
},
selector : {
bar : '> .bar',
label : '> .label',
progress : '.bar > .progress'
},
text : {
active : false,
error : false,
success : false,
warning : false,
percent : '{percent}%',
ratio : '{value} of {total}'
},
className : {
error : 'error',
success : 'success',
warning : 'warning'
}
};

Loading…
Cancel
Save