fomantic-ui 2.10.0-beta.6 → 2.10.0-beta.8
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.
- package/.eslintrc.js +0 -10
- package/README.md +4 -5
- package/changelog-setup.js +64 -70
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +94 -131
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +152 -205
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +305 -341
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +76 -116
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +58 -91
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +674 -977
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +80 -127
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +192 -274
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +325 -429
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +221 -313
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +67 -97
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +185 -254
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +103 -138
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +89 -139
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +253 -352
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +157 -223
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +122 -163
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +38 -57
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +242 -325
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +68 -98
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +116 -159
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +168 -233
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +99 -132
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +86 -141
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +134 -210
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +4100 -5721
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/gulpfile.js +5 -7
- package/package.json +1 -1
- package/scripts/nightly-version.js +7 -10
- package/src/definitions/behaviors/api.js +151 -204
- package/src/definitions/behaviors/form.js +324 -428
- package/src/definitions/behaviors/state.js +67 -97
- package/src/definitions/behaviors/visibility.js +133 -209
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/modules/accordion.js +93 -130
- package/src/definitions/modules/calendar.js +304 -340
- package/src/definitions/modules/checkbox.js +75 -115
- package/src/definitions/modules/dimmer.js +57 -90
- package/src/definitions/modules/dropdown.js +673 -976
- package/src/definitions/modules/embed.js +79 -126
- package/src/definitions/modules/flyout.js +191 -273
- package/src/definitions/modules/modal.js +220 -312
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +184 -253
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +88 -138
- package/src/definitions/modules/search.js +252 -351
- package/src/definitions/modules/shape.js +156 -222
- package/src/definitions/modules/sidebar.js +121 -162
- package/src/definitions/modules/slider.js +241 -324
- package/src/definitions/modules/sticky.js +115 -158
- package/src/definitions/modules/tab.js +167 -232
- package/src/definitions/modules/toast.js +98 -131
- package/src/definitions/modules/transition.js +85 -140
- package/tasks/admin/components/create.js +88 -108
- package/tasks/admin/components/init.js +26 -32
- package/tasks/admin/components/update.js +46 -53
- package/tasks/admin/distributions/create.js +71 -101
- package/tasks/admin/distributions/init.js +27 -33
- package/tasks/admin/distributions/update.js +45 -52
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +54 -63
- package/tasks/build/javascript.js +45 -53
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -7
- package/tasks/clean.js +2 -4
- package/tasks/collections/admin.js +13 -15
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +2 -4
- package/tasks/collections/install.js +2 -4
- package/tasks/collections/rtl.js +2 -4
- package/tasks/collections/various.js +2 -4
- package/tasks/config/admin/github.js +7 -9
- package/tasks/config/admin/templates/css-package.js +1 -3
- package/tasks/config/admin/templates/less-package.js +1 -3
- package/tasks/config/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +22 -30
- package/tasks/config/project/install.js +56 -70
- package/tasks/config/project/release.js +6 -8
- package/tasks/config/tasks.js +8 -12
- package/tasks/config/user.js +13 -17
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +24 -30
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +71 -98
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
2
|
+
* # Fomantic UI - 2.10.0-beta.8+62e258f
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(A,e,P){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,A.fn.progress=function(m){var b,e=A(this),h=Date.now(),x=[],y=m,w="string"==typeof y,V=[].slice.call(arguments,1);return e.each(function(){var i=A.isPlainObject(m)?A.extend(!0,{},A.fn.progress.settings,m):A.extend({},A.fn.progress.settings),r=i.className,t=i.metadata,e=i.namespace,n=i.selector,l=i.error,a="."+e,o="module-"+e,c=A(this),u=A(this).find(n.bar),s=A(this).find(n.progress),d=A(this).find(n.label),p=this,v=c.data(o),g=!1,f={helper:{sum:function(e){return Array.isArray(e)?e.reduce(function(e,t){return e+Number(t)},0):0},derivePrecision:function(e,t){for(var r=0,n=1,a=e/t;r<10&&!(1<(a*=n));)n=Math.pow(10,r++);return n},forceArray:function(e){return Array.isArray(e)?e:isNaN(e)?"string"==typeof e?e.split(","):[]:[e]}},initialize:function(){f.set.duration(),f.debug(p),f.read.metadata(),f.read.settings(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of progress",f),v=f,c.data(o,f)},destroy:function(){f.verbose("Destroying previous progress for",c),clearInterval(v.interval),f.remove.state(),c.removeData(o),v=void 0},reset:function(){f.remove.nextValue(),f.update.progress(0)},complete:function(e){(void 0===f.percent||f.percent<100)&&(f.remove.progressPoll(),!0!==e&&f.set.percent(100))},read:{metadata:function(){var e={percent:f.helper.forceArray(c.data(t.percent)),total:c.data(t.total),value:f.helper.forceArray(c.data(t.value))};void 0!==e.total&&(f.debug("Total value set from metadata",e.total),f.set.total(e.total)),0<e.value.length&&(f.debug("Current value set from metadata",e.value),f.set.value(e.value),f.set.progress(e.value)),0<e.percent.length&&(f.debug("Current percent value set from metadata",e.percent),f.set.percent(e.percent))},settings:function(){!1!==i.total&&(f.debug("Current total set in settings",i.total),f.set.total(i.total)),!1!==i.value&&(f.debug("Current value set in settings",i.value),f.set.value(i.value),f.set.progress(f.value)),!1!==i.percent&&(f.debug("Current percent set in settings",i.percent),f.set.percent(i.percent))}},bind:{transitionEnd:function(t){u.one("transitionend"+a,function(e){clearTimeout(f.failSafeTimer),t.call(this,e)}),f.failSafeTimer=setTimeout(function(){u.triggerHandler("transitionend")},i.duration+i.failSafeDelay),f.verbose("Adding fail safe timer",f.timer)}},increment:function(e){var t;e=f.has.total()?(t=f.get.value(),e||1):(t=f.get.percent(),e||f.get.randomValue()),f.debug("Incrementing percentage by",t,t=t+e,e),t=f.get.normalizedValue(t),f.set.progress(t)},decrement:function(e){var t,r;f.get.total()?(r=(t=f.get.value())-(e=e||1),f.debug("Decrementing value by",e,t)):(r=(t=f.get.percent())-(e=e||f.get.randomValue()),f.debug("Decrementing percentage by",e,t)),r=f.get.normalizedValue(r),f.set.progress(r)},has:{progressPoll:function(){return f.progressPoll},total:function(){return!1!==f.get.total()}},get:{text:function(e,t){var r=f.get.value(t=t||0),n=f.get.total(),a=g?f.get.displayPercent(t):f.get.percent(t),o=!1!==n?Math.max(0,n-r):100-a;return e=(e=e||"").replace("{value}",r).replace("{total}",n||0).replace("{left}",o).replace("{percent}",a).replace("{bar}",i.text.bars[t]||""),f.verbose("Adding variables to progress bar text",e),e},normalizedValue:function(e){if(e<0)return f.debug("Value cannot decrement below 0"),0;if(f.has.total()){if(e>f.total)return f.debug("Value cannot increment above total",f.total),f.total}else if(100<e)return f.debug("Value cannot increment above 100 percent"),100;return e},updateInterval:function(){return"auto"===i.updateInterval?i.duration:i.updateInterval},randomValue:function(){return f.debug("Generating random increment percentage"),Math.floor(Math.random()*i.random.max+i.random.min)},numericValue:function(e){return"string"==typeof e?""!==e.replace(/[^\d.]/g,"")&&+e.replace(/[^\d.]/g,""):e},displayPercent:function(e){var e=A(u[e]),t=e.width(),r=c.width(),e=parseInt(e.css("min-width"),10)<t?t/r*100:f.percent;return 0<i.precision?Math.round(e*(10*i.precision))/(10*i.precision):Math.round(e)},percent:function(e){return f.percent&&f.percent[e||0]||0},value:function(e){return f.nextValue||f.value&&f.value[e||0]||0},total:function(){return void 0!==f.total&&f.total}},create:{progressPoll:function(){f.progressPoll=setTimeout(function(){f.update.toNextValue(),f.remove.progressPoll()},f.get.updateInterval())}},is:{complete:function(){return f.is.success()||f.is.warning()||f.is.error()},success:function(){return c.hasClass(r.success)},warning:function(){return c.hasClass(r.warning)},error:function(){return c.hasClass(r.error)},active:function(){return c.hasClass(r.active)},visible:function(){return c.is(":visible")}},remove:{progressPoll:function(){f.verbose("Removing progress poll timer"),f.progressPoll&&(clearTimeout(f.progressPoll),delete f.progressPoll)},nextValue:function(){f.verbose("Removing progress value stored for next update"),delete f.nextValue},state:function(){f.verbose("Removing stored state"),delete f.total,delete f.percent,delete f.value},active:function(){f.verbose("Removing active state"),c.removeClass(r.active)},success:function(){f.verbose("Removing success state"),c.removeClass(r.success)},warning:function(){f.verbose("Removing warning state"),c.removeClass(r.warning)},error:function(){f.verbose("Removing error state"),c.removeClass(r.error)}},set:{barWidth:function(e){f.debug("set bar width with ",e),e=f.helper.forceArray(e);var a=-1,o=-1,i=f.helper.sum(e),s=u.length,l=1<s,t=e.map(function(e,t){var r=t===s-1&&0===i,n=A(u[t]);return 0===e&&l&&!r?n.css("display","none"):(l&&r&&n.css("background","transparent"),-1===a&&(a=t),o=t,n.css({display:"block",width:e+"%"})),parseFloat(e)});e.forEach(function(e,t){A(u[t]).css({borderTopLeftRadius:t===a?"":"0",borderBottomLeftRadius:t===a?"":"0",borderTopRightRadius:t===o?"":"0",borderBottomRightRadius:t===o?"":"0"})}),c.attr("data-percent",t)},duration:function(e){e=e||i.duration,f.verbose("Setting progress bar transition duration",e="number"==typeof e?e+"ms":e),u.css({"transition-duration":e})},percent:function(e){e=f.helper.forceArray(e).map(function(e){return e="string"==typeof e?+e.replace("%",""):e,i.limitValues?Math.max(0,Math.min(100,e)):e});var t,r=f.has.total(),n=f.helper.sum(e),a=1<e.length&&r,o=f.helper.sum(f.helper.forceArray(f.value));a&&o>f.total?f.error(l.sumExceedsTotal,o,f.total):!a&&100<n?f.error(l.tooHigh,n):n<0?f.error(l.tooLow,n):(t=0<i.precision?i.precision:a?f.helper.derivePrecision(Math.min.apply(null,f.value),f.total):0,o=e.map(function(e){return 0<t?Math.round(e*(10*t))/(10*t):Math.round(e)}),f.percent=o,r&&(f.value=e.map(function(e){return 0<t?Math.round(e/100*f.total*(10*t))/(10*t):Math.round(e/100*f.total*10)/10})),f.set.barWidth(e),f.set.labelInterval()),i.onChange.call(p,e,f.value,f.total)},labelInterval:function(){clearInterval(f.interval),f.bind.transitionEnd(function(){f.verbose("Bar finished animating, removing continuous label updates"),clearInterval(f.interval),g=!1,f.set.labels()}),g=!0,f.interval=setInterval(function(){A.contains(P.documentElement,p)||(clearInterval(f.interval),g=!1),f.set.labels()},i.framerate)},labels:function(){f.verbose("Setting both bar progress and outer label text"),f.set.barLabel(),f.set.state()},label:function(e){e&&(e=f.get.text(e),f.verbose("Setting label to text",e),d.text(e))},state:function(e){100===(e=void 0!==e?e:f.helper.sum(f.percent))?i.autoSuccess&&1===u.length&&!(f.is.warning()||f.is.error()||f.is.success())?(f.set.success(),f.debug("Automatically triggering success at 100%")):(f.verbose("Reached 100% removing active state"),f.remove.active(),f.remove.progressPoll()):0<e?(f.verbose("Adjusting active progress bar label",e),f.set.active()):(f.remove.active(),f.remove.warning(),f.remove.error(),f.remove.success(),f.set.label(i.text.active))},barLabel:function(r){s.each(function(e,t){t=A(t);void 0!==r?t.text(f.get.text(r,e)):"ratio"===i.label&&f.has.total()?(f.verbose("Adding ratio to bar label"),t.text(f.get.text(i.text.ratio,e))):"percent"===i.label&&(f.verbose("Adding percentage to bar label"),t.text(f.get.text(i.text.percent,e)))})},active:function(e){e=e||i.text.active,f.debug("Setting active state"),i.showActivity&&!f.is.active()&&c.addClass(r.active),f.remove.warning(),f.remove.error(),f.remove.success(),(e=i.onLabelUpdate("active",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onActive.call(p,f.value,f.total)})},success:function(e,t){e=e||i.text.success||i.text.active,f.debug("Setting success state"),c.addClass(r.success),f.remove.active(),f.remove.warning(),f.remove.error(),f.complete(t),e=i.text.success?i.onLabelUpdate("success",e,f.value,f.total):i.onLabelUpdate("active",e,f.value,f.total),f.set.label(e),f.bind.transitionEnd(function(){i.onSuccess.call(p,f.total)})},warning:function(e,t){e=e||i.text.warning,f.debug("Setting warning state"),c.addClass(r.warning),f.remove.active(),f.remove.success(),f.remove.error(),f.complete(t),(e=i.onLabelUpdate("warning",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onWarning.call(p,f.value,f.total)})},error:function(e,t){e=e||i.text.error,f.debug("Setting error state"),c.addClass(r.error),f.remove.active(),f.remove.success(),f.remove.warning(),f.complete(t),(e=i.onLabelUpdate("error",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onError.call(p,f.value,f.total)})},total:function(e){f.total=e},value:function(e){f.value=f.helper.forceArray(e)},progress:function(e){f.has.progressPoll()?(f.debug("Updated within interval, setting next update to use new value",e),f.set.nextValue(e)):(f.debug("First update in progress update interval, immediately updating",e),f.update.progress(e),f.create.progressPoll())},nextValue:function(e){f.nextValue=e}},update:{toNextValue:function(){var e=f.nextValue;e&&(f.debug("Update interval complete using last updated value",e),f.update.progress(e),f.remove.nextValue())},progress:function(e){var r=f.has.total(),e=(r&&f.set.value(e),f.helper.forceArray(e).map(function(e){var t;return!1===(e=f.get.numericValue(e))&&f.error(l.nonNumeric,e),e=f.get.normalizedValue(e),r?(t=0<f.total?e/f.total*100:100,f.debug("Calculating percent complete from total",t)):(t=e,f.debug("Setting value to exact percentage value",t)),t}));f.set.percent(e)}},setting:function(e,t){if(f.debug("Changing setting",e,t),A.isPlainObject(e))A.extend(!0,i,e);else{if(void 0===t)return i[e];A.isPlainObject(i[e])?A.extend(!0,i[e],t):i[e]=t}},internal:function(e,t){if(A.isPlainObject(e))A.extend(!0,f,e);else{if(void 0===t)return f[e];f[e]=t}},debug:function(){!i.silent&&i.debug&&(i.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,i.name+":"),f.debug.apply(console,arguments)))},verbose:function(){!i.silent&&i.verbose&&i.debug&&(i.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),f.verbose.apply(console,arguments)))},error:function(){i.silent||(f.error=Function.prototype.bind.call(console.error,console,i.name+":"),f.error.apply(console,arguments))},performance:{log:function(e){var t,r;i.performance&&(r=(t=Date.now())-(h||t),h=t,x.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:p,"Execution Time":r})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(function(){f.performance.display()},500)},display:function(){var e=i.name+":",r=0;h=!1,clearTimeout(f.performance.timer),A.each(x,function(e,t){r+=t["Execution Time"]}),e+=" "+r+"ms",0<x.length&&(console.groupCollapsed(e),console.table?console.table(x):A.each(x,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),x=[]}},invoke:function(n,e,t){var a,o,r,i,s=v;return e=e||V,t=t||p,"string"==typeof n&&void 0!==s&&(n=n.split(/[ .]/),a=n.length-1,A.each(n,function(e,t){var r=e!==a?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(A.isPlainObject(s[r])&&e!==a)s=s[r];else{if(void 0!==s[r])return o=s[r],!1;{if(!A.isPlainObject(s[t])||e===a)return void 0!==s[t]?o=s[t]:f.error(l.method,n),!1;s=s[t]}}})),"function"==typeof(i=o)&&"number"!=typeof i.nodeType?r=o.apply(t,e):void 0!==o&&(r=o),Array.isArray(b)?b.push(r):void 0!==b?b=[b,r]:void 0!==r&&(b=r),o}};w?(void 0===v&&f.initialize(),f.invoke(y)):(void 0!==v&&v.invoke("destroy"),f.initialize())}),void 0!==b?b:this},A.fn.progress.settings={name:"Progress",namespace:"progress",silent:!1,debug:!1,verbose:!1,performance:!0,random:{min:2,max:5},duration:300,updateInterval:"auto",autoSuccess:!0,showActivity:!0,limitValues:!0,label:"percent",precision:0,framerate:1e3/30,percent:!1,total:!1,value:!1,failSafeDelay:100,onLabelUpdate:function(e,t,r,n){return t},onChange:function(e,t,r){},onSuccess:function(e){},onActive:function(e,t){},onError:function(e,t){},onWarning:function(e,t){},error:{method:"The method you called is not defined.",nonNumeric:"Progress value is non numeric",tooHigh:"Value specified is above 100%",tooLow:"Value specified is below 0%",sumExceedsTotal:"Sum of multiple values exceed total"},regExp:{variable:/{\$*[\da-z]+}/gi},metadata:{percent:"percent",total:"total",value:"value"},selector:{bar:"> .bar",label:"> .label",progress:".bar > .progress"},text:{active:!1,error:!1,success:!1,warning:!1,percent:"{percent}%",ratio:"{value} of {total}",bars:[""]},className:{active:"active",error:"error",success:"success",warning:"warning"}}}(jQuery,window,document);
|
11
|
+
!function(A,e,P){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,A.fn.progress=function(m){let e=A(this),b=Date.now(),h=[],x=m,y="string"==typeof x,w=[].slice.call(arguments,1),V;return e.each(function(){let i=A.isPlainObject(m)?A.extend(!0,{},A.fn.progress.settings,m):A.extend({},A.fn.progress.settings),r=i.className,t=i.metadata;var e=i.namespace,n=i.selector;let l=i.error,a="."+e,o="module-"+e,c=A(this),u=A(this).find(n.bar),s=A(this).find(n.progress),d=A(this).find(n.label),p=this,v=c.data(o),g=!1,f;f={helper:{sum:function(e){return Array.isArray(e)?e.reduce(function(e,t){return e+Number(t)},0):0},derivePrecision:function(e,t){let r=0,n=1,a=e/t;for(;r<10&&!(1<(a*=n));)n=Math.pow(10,r++);return n},forceArray:function(e){return Array.isArray(e)?e:isNaN(e)?"string"==typeof e?e.split(","):[]:[e]}},initialize:function(){f.set.duration(),f.debug(p),f.read.metadata(),f.read.settings(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of progress",f),v=f,c.data(o,f)},destroy:function(){f.verbose("Destroying previous progress for",c),clearInterval(v.interval),f.remove.state(),c.removeData(o),v=void 0},reset:function(){f.remove.nextValue(),f.update.progress(0)},complete:function(e){(void 0===f.percent||f.percent<100)&&(f.remove.progressPoll(),!0!==e&&f.set.percent(100))},read:{metadata:function(){var e={percent:f.helper.forceArray(c.data(t.percent)),total:c.data(t.total),value:f.helper.forceArray(c.data(t.value))};void 0!==e.total&&(f.debug("Total value set from metadata",e.total),f.set.total(e.total)),0<e.value.length&&(f.debug("Current value set from metadata",e.value),f.set.value(e.value),f.set.progress(e.value)),0<e.percent.length&&(f.debug("Current percent value set from metadata",e.percent),f.set.percent(e.percent))},settings:function(){!1!==i.total&&(f.debug("Current total set in settings",i.total),f.set.total(i.total)),!1!==i.value&&(f.debug("Current value set in settings",i.value),f.set.value(i.value),f.set.progress(f.value)),!1!==i.percent&&(f.debug("Current percent set in settings",i.percent),f.set.percent(i.percent))}},bind:{transitionEnd:function(t){u.one("transitionend"+a,function(e){clearTimeout(f.failSafeTimer),t.call(this,e)}),f.failSafeTimer=setTimeout(function(){u.triggerHandler("transitionend")},i.duration+i.failSafeDelay),f.verbose("Adding fail safe timer",f.timer)}},increment:function(e){let t;var r;e=f.has.total()?(t=f.get.value(),e||1):(t=f.get.percent(),e||f.get.randomValue()),r=t+e,f.debug("Incrementing percentage by",t,r,e),r=f.get.normalizedValue(r),f.set.progress(r)},decrement:function(e){let t,r;f.get.total()?(t=f.get.value(),e=e||1,r=t-e,f.debug("Decrementing value by",e,t)):(t=f.get.percent(),e=e||f.get.randomValue(),r=t-e,f.debug("Decrementing percentage by",e,t)),r=f.get.normalizedValue(r),f.set.progress(r)},has:{progressPoll:function(){return f.progressPoll},total:function(){return!1!==f.get.total()}},get:{text:function(e,t){t=t||0;var r=f.get.value(t),n=f.get.total(),a=g?f.get.displayPercent(t):f.get.percent(t),o=!1!==n?Math.max(0,n-r):100-a;return e=(e=e||"").replace("{value}",r).replace("{total}",n||0).replace("{left}",o).replace("{percent}",a).replace("{bar}",i.text.bars[t]||""),f.verbose("Adding variables to progress bar text",e),e},normalizedValue:function(e){if(e<0)return f.debug("Value cannot decrement below 0"),0;if(f.has.total()){if(e>f.total)return f.debug("Value cannot increment above total",f.total),f.total}else if(100<e)return f.debug("Value cannot increment above 100 percent"),100;return e},updateInterval:function(){return"auto"===i.updateInterval?i.duration:i.updateInterval},randomValue:function(){return f.debug("Generating random increment percentage"),Math.floor(Math.random()*i.random.max+i.random.min)},numericValue:function(e){return"string"==typeof e?""!==e.replace(/[^\d.]/g,"")&&+e.replace(/[^\d.]/g,""):e},displayPercent:function(e){let t=A(u[e]);var e=t.width(),r=c.width(),e=parseInt(t.css("min-width"),10)<e?e/r*100:f.percent;return 0<i.precision?Math.round(e*(10*i.precision))/(10*i.precision):Math.round(e)},percent:function(e){return f.percent&&f.percent[e||0]||0},value:function(e){return f.nextValue||f.value&&f.value[e||0]||0},total:function(){return void 0!==f.total&&f.total}},create:{progressPoll:function(){f.progressPoll=setTimeout(function(){f.update.toNextValue(),f.remove.progressPoll()},f.get.updateInterval())}},is:{complete:function(){return f.is.success()||f.is.warning()||f.is.error()},success:function(){return c.hasClass(r.success)},warning:function(){return c.hasClass(r.warning)},error:function(){return c.hasClass(r.error)},active:function(){return c.hasClass(r.active)},visible:function(){return c.is(":visible")}},remove:{progressPoll:function(){f.verbose("Removing progress poll timer"),f.progressPoll&&(clearTimeout(f.progressPoll),delete f.progressPoll)},nextValue:function(){f.verbose("Removing progress value stored for next update"),delete f.nextValue},state:function(){f.verbose("Removing stored state"),delete f.total,delete f.percent,delete f.value},active:function(){f.verbose("Removing active state"),c.removeClass(r.active)},success:function(){f.verbose("Removing success state"),c.removeClass(r.success)},warning:function(){f.verbose("Removing warning state"),c.removeClass(r.warning)},error:function(){f.verbose("Removing error state"),c.removeClass(r.error)}},set:{barWidth:function(e){f.debug("set bar width with ",e),e=f.helper.forceArray(e);let a=-1,o=-1,i=f.helper.sum(e),s=u.length,l=1<s;var t=e.map(function(e,t){var r=t===s-1&&0===i;let n=A(u[t]);return 0===e&&l&&!r?n.css("display","none"):(l&&r&&n.css("background","transparent"),-1===a&&(a=t),o=t,n.css({display:"block",width:e+"%"})),parseFloat(e)});e.forEach(function(e,t){let r=A(u[t]);r.css({borderTopLeftRadius:t===a?"":"0",borderBottomLeftRadius:t===a?"":"0",borderTopRightRadius:t===o?"":"0",borderBottomRightRadius:t===o?"":"0"})}),c.attr("data-percent",t)},duration:function(e){e="number"==typeof(e=e||i.duration)?e+"ms":e,f.verbose("Setting progress bar transition duration",e),u.css({"transition-duration":e})},percent:function(e){e=f.helper.forceArray(e).map(function(e){return e="string"==typeof e?+e.replace("%",""):e,i.limitValues?Math.max(0,Math.min(100,e)):e});var r=f.has.total(),t=f.helper.sum(e),n=1<e.length&&r,a=f.helper.sum(f.helper.forceArray(f.value));if(n&&a>f.total)f.error(l.sumExceedsTotal,a,f.total);else if(!n&&100<t)f.error(l.tooHigh,t);else if(t<0)f.error(l.tooLow,t);else{let t=0<i.precision?i.precision:n?f.helper.derivePrecision(Math.min.apply(null,f.value),f.total):0;a=e.map(function(e){return 0<t?Math.round(e*(10*t))/(10*t):Math.round(e)});f.percent=a,r&&(f.value=e.map(function(e){return 0<t?Math.round(e/100*f.total*(10*t))/(10*t):Math.round(e/100*f.total*10)/10})),f.set.barWidth(e),f.set.labelInterval()}i.onChange.call(p,e,f.value,f.total)},labelInterval:function(){clearInterval(f.interval),f.bind.transitionEnd(function(){f.verbose("Bar finished animating, removing continuous label updates"),clearInterval(f.interval),g=!1,f.set.labels()}),g=!0,f.interval=setInterval(function(){A.contains(P.documentElement,p)||(clearInterval(f.interval),g=!1),f.set.labels()},i.framerate)},labels:function(){f.verbose("Setting both bar progress and outer label text"),f.set.barLabel(),f.set.state()},label:function(e){e&&(e=f.get.text(e),f.verbose("Setting label to text",e),d.text(e))},state:function(e){100===(e=void 0!==e?e:f.helper.sum(f.percent))?i.autoSuccess&&1===u.length&&!(f.is.warning()||f.is.error()||f.is.success())?(f.set.success(),f.debug("Automatically triggering success at 100%")):(f.verbose("Reached 100% removing active state"),f.remove.active(),f.remove.progressPoll()):0<e?(f.verbose("Adjusting active progress bar label",e),f.set.active()):(f.remove.active(),f.remove.warning(),f.remove.error(),f.remove.success(),f.set.label(i.text.active))},barLabel:function(n){s.each(function(e,t){let r=A(t);void 0!==n?r.text(f.get.text(n,e)):"ratio"===i.label&&f.has.total()?(f.verbose("Adding ratio to bar label"),r.text(f.get.text(i.text.ratio,e))):"percent"===i.label&&(f.verbose("Adding percentage to bar label"),r.text(f.get.text(i.text.percent,e)))})},active:function(e){e=e||i.text.active,f.debug("Setting active state"),i.showActivity&&!f.is.active()&&c.addClass(r.active),f.remove.warning(),f.remove.error(),f.remove.success(),(e=i.onLabelUpdate("active",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onActive.call(p,f.value,f.total)})},success:function(e,t){e=e||i.text.success||i.text.active,f.debug("Setting success state"),c.addClass(r.success),f.remove.active(),f.remove.warning(),f.remove.error(),f.complete(t),e=i.text.success?i.onLabelUpdate("success",e,f.value,f.total):i.onLabelUpdate("active",e,f.value,f.total),f.set.label(e),f.bind.transitionEnd(function(){i.onSuccess.call(p,f.total)})},warning:function(e,t){e=e||i.text.warning,f.debug("Setting warning state"),c.addClass(r.warning),f.remove.active(),f.remove.success(),f.remove.error(),f.complete(t),(e=i.onLabelUpdate("warning",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onWarning.call(p,f.value,f.total)})},error:function(e,t){e=e||i.text.error,f.debug("Setting error state"),c.addClass(r.error),f.remove.active(),f.remove.success(),f.remove.warning(),f.complete(t),(e=i.onLabelUpdate("error",e,f.value,f.total))&&f.set.label(e),f.bind.transitionEnd(function(){i.onError.call(p,f.value,f.total)})},total:function(e){f.total=e},value:function(e){f.value=f.helper.forceArray(e)},progress:function(e){f.has.progressPoll()?(f.debug("Updated within interval, setting next update to use new value",e),f.set.nextValue(e)):(f.debug("First update in progress update interval, immediately updating",e),f.update.progress(e),f.create.progressPoll())},nextValue:function(e){f.nextValue=e}},update:{toNextValue:function(){var e=f.nextValue;e&&(f.debug("Update interval complete using last updated value",e),f.update.progress(e),f.remove.nextValue())},progress:function(e){let r=f.has.total();r&&f.set.value(e);e=f.helper.forceArray(e).map(function(e){let t;return!1===(e=f.get.numericValue(e))&&f.error(l.nonNumeric,e),e=f.get.normalizedValue(e),r?(t=0<f.total?e/f.total*100:100,f.debug("Calculating percent complete from total",t)):(t=e,f.debug("Setting value to exact percentage value",t)),t});f.set.percent(e)}},setting:function(e,t){if(f.debug("Changing setting",e,t),A.isPlainObject(e))A.extend(!0,i,e);else{if(void 0===t)return i[e];A.isPlainObject(i[e])?A.extend(!0,i[e],t):i[e]=t}},internal:function(e,t){if(A.isPlainObject(e))A.extend(!0,f,e);else{if(void 0===t)return f[e];f[e]=t}},debug:function(){!i.silent&&i.debug&&(i.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,i.name+":"),f.debug.apply(console,arguments)))},verbose:function(){!i.silent&&i.verbose&&i.debug&&(i.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),f.verbose.apply(console,arguments)))},error:function(){i.silent||(f.error=Function.prototype.bind.call(console.error,console,i.name+":"),f.error.apply(console,arguments))},performance:{log:function(e){var t,r;i.performance&&(r=(t=Date.now())-(b||t),b=t,h.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:p,"Execution Time":r})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(function(){f.performance.display()},500)},display:function(){var e=i.name+":";let r=0;b=!1,clearTimeout(f.performance.timer),A.each(h,function(e,t){r+=t["Execution Time"]}),e+=" "+r+"ms",0<h.length&&(console.groupCollapsed(e),console.table?console.table(h):A.each(h,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),h=[]}},invoke:function(n,e,t){let a=v,o,i,r;var s;return e=e||w,t=t||p,"string"==typeof n&&void 0!==a&&(n=n.split(/[ .]/),o=n.length-1,A.each(n,function(e,t){var r=e!==o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(A.isPlainObject(a[r])&&e!==o)a=a[r];else{if(void 0!==a[r])return i=a[r],!1;{if(!A.isPlainObject(a[t])||e===o)return void 0!==a[t]?i=a[t]:f.error(l.method,n),!1;a=a[t]}}})),"function"==typeof(s=i)&&"number"!=typeof s.nodeType?r=i.apply(t,e):void 0!==i&&(r=i),Array.isArray(V)?V.push(r):void 0!==V?V=[V,r]:void 0!==r&&(V=r),i}},y?(void 0===v&&f.initialize(),f.invoke(x)):(void 0!==v&&v.invoke("destroy"),f.initialize())}),void 0!==V?V:this},A.fn.progress.settings={name:"Progress",namespace:"progress",silent:!1,debug:!1,verbose:!1,performance:!0,random:{min:2,max:5},duration:300,updateInterval:"auto",autoSuccess:!0,showActivity:!0,limitValues:!0,label:"percent",precision:0,framerate:1e3/30,percent:!1,total:!1,value:!1,failSafeDelay:100,onLabelUpdate:function(e,t,r,n){return t},onChange:function(e,t,r){},onSuccess:function(e){},onActive:function(e,t){},onError:function(e,t){},onWarning:function(e,t){},error:{method:"The method you called is not defined.",nonNumeric:"Progress value is non numeric",tooHigh:"Value specified is above 100%",tooLow:"Value specified is below 0%",sumExceedsTotal:"Sum of multiple values exceed total"},regExp:{variable:/{\$*[\da-z]+}/gi},metadata:{percent:"percent",total:"total",value:"value"},selector:{bar:"> .bar",label:"> .label",progress:".bar > .progress"},text:{active:!1,error:!1,success:!1,warning:!1,percent:"{percent}%",ratio:"{value} of {total}",bars:[""]},className:{active:"active",error:"error",success:"success",warning:"warning"}}}(jQuery,window,document);
|
package/dist/components/rail.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.8+62e258f - Rating
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -20,42 +20,38 @@
|
|
20
20
|
: globalThis;
|
21
21
|
|
22
22
|
$.fn.rating = function (parameters) {
|
23
|
-
|
24
|
-
$allModules = $(this),
|
23
|
+
let $allModules = $(this);
|
25
24
|
|
26
|
-
|
27
|
-
|
25
|
+
let time = Date.now();
|
26
|
+
let performance = [];
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
;
|
28
|
+
let query = arguments[0];
|
29
|
+
let methodInvoked = typeof query === 'string';
|
30
|
+
let queryArguments = [].slice.call(arguments, 1);
|
31
|
+
let returnedValue;
|
34
32
|
$allModules.each(function () {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
: $.extend({}, $.fn.rating.settings),
|
33
|
+
let settings = $.isPlainObject(parameters)
|
34
|
+
? $.extend(true, {}, $.fn.rating.settings, parameters)
|
35
|
+
: $.extend({}, $.fn.rating.settings);
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
let namespace = settings.namespace;
|
38
|
+
let className = settings.className;
|
39
|
+
let error = settings.error;
|
40
|
+
let metadata = settings.metadata;
|
41
|
+
let selector = settings.selector;
|
42
|
+
let cssVars = settings.cssVars;
|
46
43
|
|
47
|
-
|
48
|
-
|
44
|
+
let eventNamespace = '.' + namespace;
|
45
|
+
let moduleNamespace = 'module-' + namespace;
|
49
46
|
|
50
|
-
|
51
|
-
|
47
|
+
let element = this;
|
48
|
+
let instance = $(this).data(moduleNamespace);
|
52
49
|
|
53
|
-
|
54
|
-
|
50
|
+
let $module = $(this);
|
51
|
+
let $icon = $module.find(selector.icon);
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
;
|
53
|
+
let initialLoad;
|
54
|
+
let module;
|
59
55
|
|
60
56
|
module = {
|
61
57
|
|
@@ -81,16 +77,14 @@
|
|
81
77
|
module.verbose('Instantiating module', settings);
|
82
78
|
instance = module;
|
83
79
|
$module
|
84
|
-
.data(moduleNamespace, module)
|
85
|
-
;
|
80
|
+
.data(moduleNamespace, module);
|
86
81
|
},
|
87
82
|
|
88
83
|
destroy: function () {
|
89
84
|
module.verbose('Destroying previous instance', instance);
|
90
85
|
module.remove.events();
|
91
86
|
$module
|
92
|
-
.removeData(moduleNamespace)
|
93
|
-
;
|
87
|
+
.removeData(moduleNamespace);
|
94
88
|
},
|
95
89
|
|
96
90
|
refresh: function () {
|
@@ -99,54 +93,42 @@
|
|
99
93
|
|
100
94
|
setup: {
|
101
95
|
layout: function () {
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
html = $.fn.rating.settings.templates.icon(maxRating, icon)
|
106
|
-
;
|
96
|
+
let maxRating = module.get.maxRating();
|
97
|
+
let icon = module.get.icon();
|
98
|
+
let html = $.fn.rating.settings.templates.icon(maxRating, icon);
|
107
99
|
module.debug('Generating icon html dynamically');
|
108
100
|
$module
|
109
|
-
.html(html)
|
110
|
-
;
|
101
|
+
.html(html);
|
111
102
|
module.refresh();
|
112
103
|
},
|
113
104
|
},
|
114
105
|
|
115
106
|
event: {
|
116
107
|
mouseenter: function () {
|
117
|
-
|
118
|
-
$activeIcon = $(this)
|
119
|
-
;
|
108
|
+
let $activeIcon = $(this);
|
120
109
|
$activeIcon
|
121
110
|
.nextAll()
|
122
|
-
.removeClass(className.selected)
|
123
|
-
;
|
111
|
+
.removeClass(className.selected);
|
124
112
|
$module
|
125
|
-
.addClass(className.selected)
|
126
|
-
;
|
113
|
+
.addClass(className.selected);
|
127
114
|
$activeIcon
|
128
115
|
.addClass(className.selected)
|
129
116
|
.prevAll()
|
130
|
-
.addClass(className.selected)
|
131
|
-
;
|
117
|
+
.addClass(className.selected);
|
132
118
|
},
|
133
119
|
mouseleave: function () {
|
134
120
|
$module
|
135
|
-
.removeClass(className.selected)
|
136
|
-
;
|
121
|
+
.removeClass(className.selected);
|
137
122
|
$icon
|
138
|
-
.removeClass(className.selected)
|
139
|
-
;
|
123
|
+
.removeClass(className.selected);
|
140
124
|
},
|
141
125
|
click: function () {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
: settings.clearable
|
149
|
-
;
|
126
|
+
let $activeIcon = $(this);
|
127
|
+
let currentRating = module.get.rating();
|
128
|
+
let rating = $icon.index($activeIcon) + 1;
|
129
|
+
let canClear = settings.clearable === 'auto'
|
130
|
+
? $icon.length === 1
|
131
|
+
: settings.clearable;
|
150
132
|
if (canClear && currentRating === rating) {
|
151
133
|
module.clearRating();
|
152
134
|
} else {
|
@@ -166,8 +148,7 @@
|
|
166
148
|
$module
|
167
149
|
.on('mouseenter' + eventNamespace, selector.icon, module.event.mouseenter)
|
168
150
|
.on('mouseleave' + eventNamespace, selector.icon, module.event.mouseleave)
|
169
|
-
.on('click' + eventNamespace, selector.icon, module.event.click)
|
170
|
-
;
|
151
|
+
.on('click' + eventNamespace, selector.icon, module.event.click);
|
171
152
|
},
|
172
153
|
},
|
173
154
|
|
@@ -175,8 +156,7 @@
|
|
175
156
|
events: function () {
|
176
157
|
module.verbose('Removing events');
|
177
158
|
$module
|
178
|
-
.off(eventNamespace)
|
179
|
-
;
|
159
|
+
.off(eventNamespace);
|
180
160
|
},
|
181
161
|
initialLoad: function () {
|
182
162
|
initialLoad = false;
|
@@ -187,16 +167,14 @@
|
|
187
167
|
module.debug('Setting rating to interactive mode');
|
188
168
|
module.bind.events();
|
189
169
|
$module
|
190
|
-
.removeClass(className.disabled)
|
191
|
-
;
|
170
|
+
.removeClass(className.disabled);
|
192
171
|
},
|
193
172
|
|
194
173
|
disable: function () {
|
195
174
|
module.debug('Setting rating to read-only mode');
|
196
175
|
module.remove.events();
|
197
176
|
$module
|
198
|
-
.addClass(className.disabled)
|
199
|
-
;
|
177
|
+
.addClass(className.disabled);
|
200
178
|
},
|
201
179
|
|
202
180
|
is: {
|
@@ -210,7 +188,7 @@
|
|
210
188
|
|
211
189
|
get: {
|
212
190
|
icon: function () {
|
213
|
-
|
191
|
+
let icon = $module.data(metadata.icon);
|
214
192
|
if (icon) {
|
215
193
|
$module.removeData(metadata.icon);
|
216
194
|
}
|
@@ -236,9 +214,7 @@
|
|
236
214
|
return settings.maxRating;
|
237
215
|
},
|
238
216
|
rating: function () {
|
239
|
-
|
240
|
-
currentRating = $icon.filter('.' + className.active).length
|
241
|
-
;
|
217
|
+
let currentRating = $icon.filter('.' + className.active).length;
|
242
218
|
module.verbose('Current rating retrieved', currentRating);
|
243
219
|
|
244
220
|
return currentRating;
|
@@ -247,46 +223,38 @@
|
|
247
223
|
|
248
224
|
set: {
|
249
225
|
rating: function (rating) {
|
250
|
-
|
251
|
-
|
252
|
-
rating - 1
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
$
|
258
|
-
|
259
|
-
|
260
|
-
filledPercentage = (rating % 1) * 100
|
261
|
-
;
|
226
|
+
let ratingIndex = Math.floor(
|
227
|
+
rating - 1 >= 0
|
228
|
+
? rating - 1
|
229
|
+
: 0
|
230
|
+
);
|
231
|
+
let $activeIcon = $icon.eq(ratingIndex);
|
232
|
+
let $partialActiveIcon = rating <= 1
|
233
|
+
? $activeIcon
|
234
|
+
: $activeIcon.next();
|
235
|
+
let filledPercentage = (rating % 1) * 100;
|
262
236
|
$module
|
263
|
-
.removeClass(className.selected)
|
264
|
-
;
|
237
|
+
.removeClass(className.selected);
|
265
238
|
$icon
|
266
239
|
.removeClass(className.selected)
|
267
240
|
.removeClass(className.active)
|
268
|
-
.removeClass(className.partiallyActive)
|
269
|
-
;
|
241
|
+
.removeClass(className.partiallyActive);
|
270
242
|
if (rating > 0) {
|
271
243
|
module.verbose('Setting current rating to', rating);
|
272
244
|
$activeIcon
|
273
245
|
.prevAll()
|
274
246
|
.addBack()
|
275
|
-
.addClass(className.active)
|
276
|
-
;
|
247
|
+
.addClass(className.active);
|
277
248
|
if ($activeIcon.next() && rating % 1 !== 0) {
|
278
249
|
$partialActiveIcon
|
279
250
|
.addClass(className.partiallyActive)
|
280
|
-
.addClass(className.active)
|
281
|
-
;
|
251
|
+
.addClass(className.active);
|
282
252
|
$partialActiveIcon
|
283
|
-
.css(cssVars.filledCustomPropName, filledPercentage + '%')
|
284
|
-
;
|
253
|
+
.css(cssVars.filledCustomPropName, filledPercentage + '%');
|
285
254
|
if ($partialActiveIcon.css('backgroundColor') === 'transparent') {
|
286
255
|
$partialActiveIcon
|
287
256
|
.removeClass(className.partiallyActive)
|
288
|
-
.removeClass(className.active)
|
289
|
-
;
|
257
|
+
.removeClass(className.active);
|
290
258
|
}
|
291
259
|
}
|
292
260
|
}
|
@@ -350,11 +318,9 @@
|
|
350
318
|
},
|
351
319
|
performance: {
|
352
320
|
log: function (message) {
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
previousTime
|
357
|
-
;
|
321
|
+
let currentTime;
|
322
|
+
let executionTime;
|
323
|
+
let previousTime;
|
358
324
|
if (settings.performance) {
|
359
325
|
currentTime = Date.now();
|
360
326
|
previousTime = time || currentTime;
|
@@ -373,10 +339,8 @@
|
|
373
339
|
}, 500);
|
374
340
|
},
|
375
341
|
display: function () {
|
376
|
-
|
377
|
-
|
378
|
-
totalTime = 0
|
379
|
-
;
|
342
|
+
let title = settings.name + ':';
|
343
|
+
let totalTime = 0;
|
380
344
|
time = false;
|
381
345
|
clearTimeout(module.performance.timer);
|
382
346
|
$.each(performance, function (index, data) {
|
@@ -401,22 +365,19 @@
|
|
401
365
|
},
|
402
366
|
},
|
403
367
|
invoke: function (query, passedArguments, context) {
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
response
|
409
|
-
;
|
368
|
+
let object = instance;
|
369
|
+
let maxDepth;
|
370
|
+
let found;
|
371
|
+
let response;
|
410
372
|
passedArguments = passedArguments || queryArguments;
|
411
373
|
context = context || element;
|
412
374
|
if (typeof query === 'string' && object !== undefined) {
|
413
375
|
query = query.split(/[ .]/);
|
414
376
|
maxDepth = query.length - 1;
|
415
377
|
$.each(query, function (depth, value) {
|
416
|
-
|
378
|
+
let camelCaseValue = depth !== maxDepth
|
417
379
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
418
|
-
: query
|
419
|
-
;
|
380
|
+
: query;
|
420
381
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
421
382
|
object = object[camelCaseValue];
|
422
383
|
} else if (object[camelCaseValue] !== undefined) {
|
@@ -519,32 +480,21 @@
|
|
519
480
|
|
520
481
|
templates: {
|
521
482
|
escape: function (string) {
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
return escape[chr];
|
533
|
-
}
|
534
|
-
;
|
535
|
-
if (shouldEscape.test(string)) {
|
536
|
-
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
537
|
-
string = string.replace(badChars, escapedChar);
|
538
|
-
}
|
539
|
-
|
540
|
-
return string;
|
483
|
+
const badChars = /["'<>]|&(?![\d#A-Za-z]{1,12};)/g;
|
484
|
+
const escape = {
|
485
|
+
'"': '"',
|
486
|
+
'&': '&',
|
487
|
+
"'": ''',
|
488
|
+
'<': '<',
|
489
|
+
'>': '>',
|
490
|
+
};
|
491
|
+
|
492
|
+
return string.replace(badChars, (chr) => escape[chr]);
|
541
493
|
},
|
542
494
|
icon: function (maxRating, iconClass) {
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
escape = $.fn.rating.settings.templates.escape
|
547
|
-
;
|
495
|
+
let icon = 1;
|
496
|
+
let html = '';
|
497
|
+
let escape = $.fn.rating.settings.templates.escape;
|
548
498
|
while (icon <= maxRating) {
|
549
499
|
html += '<i class="' + escape(iconClass) + ' icon"></i>';
|
550
500
|
icon++;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
2
|
+
* # Fomantic UI - 2.10.0-beta.8+62e258f
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(A,e){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,A.fn.rating=function(f){
|
11
|
+
!function(A,e){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,A.fn.rating=function(f){let p=A(this),b=Date.now(),h=[],y=f,C="string"==typeof y,x=[].slice.call(arguments,1),R;return p.each(function(){let a=A.isPlainObject(f)?A.extend(!0,{},A.fn.rating.settings,f):A.extend({},A.fn.rating.settings);var e=a.namespace;let o=a.className,l=a.error,n=a.metadata,t=a.selector,r=a.cssVars,i="."+e,s="module-"+e,c=this,d=A(this).data(s),u=A(this),g=u.find(t.icon),m,v;v={initialize:function(){v.verbose("Initializing rating module",a),0===g.length&&v.setup.layout(),a.interactive&&!v.is.disabled()?v.enable():v.disable(),v.set.initialLoad(),v.set.rating(v.get.initialRating()),v.remove.initialLoad(),v.instantiate()},instantiate:function(){v.verbose("Instantiating module",a),d=v,u.data(s,v)},destroy:function(){v.verbose("Destroying previous instance",d),v.remove.events(),u.removeData(s)},refresh:function(){g=u.find(t.icon)},setup:{layout:function(){var e=v.get.maxRating(),n=v.get.icon(),e=A.fn.rating.settings.templates.icon(e,n);v.debug("Generating icon html dynamically"),u.html(e),v.refresh()}},event:{mouseenter:function(){let e=A(this);e.nextAll().removeClass(o.selected),u.addClass(o.selected),e.addClass(o.selected).prevAll().addClass(o.selected)},mouseleave:function(){u.removeClass(o.selected),g.removeClass(o.selected)},click:function(){var e=A(this),n=v.get.rating(),e=g.index(e)+1;("auto"===a.clearable?1===g.length:a.clearable)&&n===e?v.clearRating():v.set.rating(e)}},clearRating:function(){v.debug("Clearing current rating"),v.set.rating(0)},bind:{events:function(){v.verbose("Binding events"),u.on("mouseenter"+i,t.icon,v.event.mouseenter).on("mouseleave"+i,t.icon,v.event.mouseleave).on("click"+i,t.icon,v.event.click)}},remove:{events:function(){v.verbose("Removing events"),u.off(i)},initialLoad:function(){m=!1}},enable:function(){v.debug("Setting rating to interactive mode"),v.bind.events(),u.removeClass(o.disabled)},disable:function(){v.debug("Setting rating to read-only mode"),v.remove.events(),u.addClass(o.disabled)},is:{initialLoad:function(){return m},disabled:function(){return u.hasClass(o.disabled)}},get:{icon:function(){var e=u.data(n.icon);return e&&u.removeData(n.icon),e||a.icon},initialRating:function(){return void 0!==u.data(n.rating)?(u.removeData(n.rating),u.data(n.rating)):a.initialRating},maxRating:function(){return void 0!==u.data(n.maxRating)?(u.removeData(n.maxRating),u.data(n.maxRating)):a.maxRating},rating:function(){var e=g.filter("."+o.active).length;return v.verbose("Current rating retrieved",e),e}},set:{rating:function(e){var n=Math.floor(0<=e-1?e-1:0);let t=g.eq(n),i=e<=1?t:t.next();n=e%1*100;u.removeClass(o.selected),g.removeClass(o.selected).removeClass(o.active).removeClass(o.partiallyActive),0<e&&(v.verbose("Setting current rating to",e),t.prevAll().addBack().addClass(o.active),t.next()&&e%1!=0&&(i.addClass(o.partiallyActive).addClass(o.active),i.css(r.filledCustomPropName,n+"%"),"transparent"===i.css("backgroundColor")&&i.removeClass(o.partiallyActive).removeClass(o.active))),v.is.initialLoad()||a.onRate.call(c,e)},initialLoad:function(){m=!0}},setting:function(e,n){if(v.debug("Changing setting",e,n),A.isPlainObject(e))A.extend(!0,a,e);else{if(void 0===n)return a[e];A.isPlainObject(a[e])?A.extend(!0,a[e],n):a[e]=n}},internal:function(e,n){if(A.isPlainObject(e))A.extend(!0,v,e);else{if(void 0===n)return v[e];v[e]=n}},debug:function(){!a.silent&&a.debug&&(a.performance?v.performance.log(arguments):(v.debug=Function.prototype.bind.call(console.info,console,a.name+":"),v.debug.apply(console,arguments)))},verbose:function(){!a.silent&&a.verbose&&a.debug&&(a.performance?v.performance.log(arguments):(v.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),v.verbose.apply(console,arguments)))},error:function(){a.silent||(v.error=Function.prototype.bind.call(console.error,console,a.name+":"),v.error.apply(console,arguments))},performance:{log:function(e){var n,t;a.performance&&(t=(n=Date.now())-(b||n),b=n,h.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:c,"Execution Time":t})),clearTimeout(v.performance.timer),v.performance.timer=setTimeout(function(){v.performance.display()},500)},display:function(){let e=a.name+":",t=0;b=!1,clearTimeout(v.performance.timer),A.each(h,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",1<p.length&&(e+=" ("+p.length+")"),0<h.length&&(console.groupCollapsed(e),console.table?console.table(h):A.each(h,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),h=[]}},invoke:function(i,e,n){let a=d,o,r,t;var s;return e=e||x,n=n||c,"string"==typeof i&&void 0!==a&&(i=i.split(/[ .]/),o=i.length-1,A.each(i,function(e,n){var t=e!==o?n+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(A.isPlainObject(a[t])&&e!==o)a=a[t];else{if(void 0!==a[t])return r=a[t],!1;{if(!A.isPlainObject(a[n])||e===o)return void 0!==a[n]?r=a[n]:v.error(l.method,i),!1;a=a[n]}}})),"function"==typeof(s=r)&&"number"!=typeof s.nodeType?t=r.apply(n,e):void 0!==r&&(t=r),Array.isArray(R)?R.push(t):void 0!==R?R=[R,t]:void 0!==t&&(R=t),r}},C?(void 0===d&&v.initialize(),v.invoke(y)):(void 0!==d&&d.invoke("destroy"),v.initialize())}),void 0!==R?R:this},A.fn.rating.settings={name:"Rating",namespace:"rating",icon:"star",silent:!1,debug:!1,verbose:!1,performance:!0,initialRating:0,interactive:!0,maxRating:4,clearable:"auto",fireOnInit:!1,onRate:function(e){},error:{method:"The method you called is not defined"},metadata:{rating:"rating",maxRating:"maxRating",icon:"icon"},className:{active:"active",disabled:"disabled",selected:"selected",loading:"loading",partiallyActive:"partial"},cssVars:{filledCustomPropName:"--full"},selector:{icon:".icon"},templates:{escape:function(e){const n={'"':""","&":"&","'":"'","<":"<",">":">"};return e.replace(/["'<>]|&(?![\d#A-Za-z]{1,12};)/g,e=>n[e])},icon:function(e,n){let t=1,i="",a=A.fn.rating.settings.templates.escape;for(;t<=e;)i+='<i class="'+a(n)+' icon"></i>',t++;return i}}}}(jQuery,window,document);
|