fomantic-ui 2.10.0-beta.62 → 2.10.0-beta.64
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 -1
- package/changelog-setup.js +10 -10
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +40 -41
- 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 +57 -61
- 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 +186 -187
- 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 +29 -30
- 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 +22 -23
- 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 +293 -337
- 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 +33 -35
- 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 +74 -81
- 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 +141 -146
- 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 +80 -81
- 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 +27 -28
- 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 +62 -72
- 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 +51 -55
- 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 +33 -34
- 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 +96 -109
- 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 +44 -45
- 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 +56 -64
- 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 +16 -17
- 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 +143 -148
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +24 -25
- 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 +42 -43
- 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 +57 -66
- 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 +32 -33
- 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 +38 -45
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +76 -77
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +1753 -1884
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/scripts/nightly-version.js +3 -3
- package/src/definitions/behaviors/api.js +56 -60
- package/src/definitions/behaviors/form.js +140 -145
- package/src/definitions/behaviors/state.js +23 -24
- package/src/definitions/behaviors/visibility.js +75 -76
- package/src/definitions/globals/site.js +15 -16
- package/src/definitions/modules/accordion.js +39 -40
- package/src/definitions/modules/calendar.js +185 -186
- package/src/definitions/modules/checkbox.js +28 -29
- package/src/definitions/modules/dimmer.js +21 -22
- package/src/definitions/modules/dropdown.js +292 -336
- package/src/definitions/modules/embed.js +32 -34
- package/src/definitions/modules/flyout.js +73 -80
- package/src/definitions/modules/modal.js +79 -80
- package/src/definitions/modules/nag.js +26 -27
- package/src/definitions/modules/popup.js +61 -71
- package/src/definitions/modules/progress.js +50 -54
- package/src/definitions/modules/rating.js +32 -33
- package/src/definitions/modules/search.js +95 -108
- package/src/definitions/modules/shape.js +43 -44
- package/src/definitions/modules/sidebar.js +55 -63
- package/src/definitions/modules/slider.js +142 -147
- package/src/definitions/modules/sticky.js +41 -42
- package/src/definitions/modules/tab.js +56 -65
- package/src/definitions/modules/toast.js +31 -32
- package/src/definitions/modules/transition.js +37 -44
- package/tasks/admin/components/create.js +11 -11
- package/tasks/admin/components/init.js +11 -12
- package/tasks/admin/components/update.js +19 -20
- package/tasks/admin/distributions/create.js +24 -36
- package/tasks/admin/distributions/init.js +11 -12
- package/tasks/admin/distributions/update.js +18 -19
- package/tasks/admin/register.js +7 -7
- package/tasks/build/assets.js +1 -1
- package/tasks/build/css.js +1 -1
- package/tasks/build/javascript.js +1 -1
- package/tasks/config/admin/github.js +1 -1
- package/tasks/config/admin/templates/css-package.js +1 -1
- package/tasks/config/admin/templates/less-package.js +1 -1
- package/tasks/config/project/config.js +6 -6
- package/tasks/config/project/install.js +12 -12
- package/tasks/config/project/release.js +5 -11
- package/tasks/config/tasks.js +5 -5
- package/tasks/config/user.js +1 -4
- package/tasks/docs/metadata.js +11 -12
- package/tasks/install.js +9 -9
- package/test/meteor/assets.js +1 -1
- package/test/modules/module.spec.js +18 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.64+bcb9c73
|
|
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(V,W,N){"use strict";function G(t){return"function"==typeof t&&"number"!=typeof t.nodeType}W=void 0!==W&&W.Math===Math?W:globalThis,V.fn.popup=function(...t){let e=V(this),E=V(N),x=V(W),k=V("body"),S="ontouchstart"in N.documentElement?"touchstart":"click",A=Date.now(),D=[],O=t[0],j="string"==typeof O,F=t.slice(1),R=function(t,e){let o;return[W,N].includes(t)?o=V(t):0===(o=V(e.document).find(t)).length&&(o=e.frameElement?R(t,e.parent):k),o},H;return e.each(function(){let p=V.isPlainObject(O)?V.extend(!0,{},V.fn.popup.settings,O):V.extend({},V.fn.popup.settings),i=p.selector,u=p.className,c=p.error,d=p.metadata;var t=p.namespace;let e="."+p.namespace,o="module-"+t,f=V(this),r=R(p.context,W),n=R(p.scrollContext,W),s=R(p.boundary,W),h=p.target?R(p.target,W):f,g,l,v=0,m=!1,a=!1,b=this,w=f.data(o),y,P,C,T;T={initialize:function(){T.debug("Initializing",f),T.createID(),T.bind.events(),!T.exists()&&p.preserve&&T.create(),p.observeChanges&&T.observeChanges(),T.instantiate()},instantiate:function(){T.verbose("Storing instance",T),w=T,f.data(o,w)},observeChanges:function(){(y=new MutationObserver(T.event.documentChanged)).observe(N,{childList:!0,subtree:!0}),T.debug("Setting up mutation observer",y)},refresh:function(){p.popup?g=E.find(p.popup).eq(0):p.inline&&(g=h.nextAll(i.popup).eq(0),p.popup=g),p.popup?(T.set.invisible(),l=T.get.offsetParent(),T.remove.invisible(),p.movePopup&&T.has.popup()&&T.get.offsetParent(g)[0]!==l[0]&&(T.debug("Moving popup to the same offset parent as target"),g.detach().appendTo(l))):l=p.inline?T.get.offsetParent(h):T.has.popup()?T.get.offsetParent(g):k,l.is("html")&&l[0]!==k[0]&&(T.debug("Setting page as offset parent"),l=k),T.get.variation()&&T.set.variation()},reposition:function(){T.refresh(),T.set.position()},destroy:function(){T.debug("Destroying previous module"),y&&y.disconnect(),g&&!p.preserve&&T.removePopup(),clearTimeout(T.hideTimer),clearTimeout(T.showTimer),T.unbind.close(),T.unbind.events(),f.removeData(o)},event:{start:function(t){var e=V.isPlainObject(p.delay)?p.delay.show:p.delay;clearTimeout(T.hideTimer),(!a||a&&p.addTouchEvents)&&(T.showTimer=setTimeout(function(){T.show()},e))},end:function(){var t=V.isPlainObject(p.delay)?p.delay.hide:p.delay;clearTimeout(T.showTimer),T.hideTimer=setTimeout(function(){T.hide()},t)},touchstart:function(t){a=!0,p.addTouchEvents&&T.show()},resize:function(){T.is.visible()&&T.set.position()},documentChanged:function(t){Array.prototype.forEach.call(t,function(t){t.removedNodes&&Array.prototype.forEach.call(t.removedNodes,function(t){(t===b||0<V(t).find(b).length)&&(T.debug("Element removed from DOM, tearing down events"),T.destroy())})})},hideGracefully:function(t){let e=V(t.target);var o=N.documentElement.contains(t.target),n=0<e.closest(i.popup).length;t&&!n&&o?(T.debug("Click occurred outside popup hiding popup"),T.hide()):T.debug("Click was inside popup, keeping popup open")}},create:function(){let t=h.next(i.popup);var e=!p.popup&&0===t.length&&f.attr("title");let o=T.get.html();var n=T.get.title(),e=T.get.content(e);o||e||n?(T.debug("Creating pop-up html"),o=o||p.templates.popup({title:n,content:e}),g=V("<div/>").addClass(u.popup).data(d.activator,f).html(o),p.inline?(T.verbose("Inserting popup element inline",g),g.insertAfter(f)):(T.verbose("Appending popup element to body",g),g.appendTo(r)),T.refresh(),T.set.variation(),p.hoverable&&T.bind.popup(),p.onCreate.call(g,b)):p.popup?(E.find(p.popup).data(d.activator,f),T.verbose("Used popup specified in settings"),T.refresh(),p.hoverable&&T.bind.popup()):0<t.length?(T.verbose("Pre-existing popup found"),p.inline=!0,p.popup=t.data(d.activator,f),T.refresh(),p.hoverable&&T.bind.popup()):T.debug("No content specified skipping display",b)},createID:function(){C=(Math.random().toString(16)+"000000000").slice(2,10),P="."+C,T.verbose("Creating unique id for element",C)},toggle:function(){T.debug("Toggling pop-up"),T.is.hidden()?(T.debug("Popup is hidden, showing pop-up"),T.unbind.close(),T.show()):(T.debug("Popup is visible, hiding pop-up"),T.hide())},show:function(t=function(){}){T.debug("Showing pop-up",p.transition),!T.is.hidden()||T.is.active()&&T.is.dropdown()||(T.exists()||T.create(),!1===p.onShow.call(g,b)?T.debug("onShow callback returned false, cancelling popup animation"):(p.preserve||p.popup||T.refresh(),g&&T.set.position()&&(T.save.conditions(),p.exclusive&&T.hideAll(),T.animate.show(t))))},hide:function(t=function(){}){(T.is.visible()||T.is.animating())&&(!1===p.onHide.call(g,b)?T.debug("onHide callback returned false, cancelling popup animation"):(T.remove.visible(),T.unbind.close(),T.restore.conditions(),T.animate.hide(t)))},hideAll:function(){E.find(i.popup).filter("."+u.popupVisible).each(function(){V(this).data(d.activator).popup("hide")})},exists:function(){return!!g&&(p.inline||p.popup?T.has.popup():0<g.closest(r).length)},removePopup:function(){T.has.popup()&&!p.popup&&(T.debug("Removing popup",g),g.remove(),g=void 0,p.onRemove.call(g,b))},save:{conditions:function(){T.cache={title:f.attr("title")},T.cache.title&&f.removeAttr("title"),T.verbose("Saving original attributes",T.cache.title)}},restore:{conditions:function(){return T.cache&&T.cache.title&&(f.attr("title",T.cache.title),T.verbose("Restoring original attributes",T.cache.title)),!0}},supports:{svg:function(){return"undefined"!=typeof SVGGraphicsElement}},animate:{show:function(t){t=G(t)?t:function(){},p.transition&&T.can.useElement("transition")&&(T.set.visible(),g.transition({animation:(p.transition.showMethod||p.transition)+" in",queue:!1,debug:p.debug,verbose:p.verbose,silent:p.silent,duration:p.transition.showDuration||p.duration,onComplete:function(){T.bind.close(),t.call(g,b),p.onVisible.call(g,b)}}))},hide:function(t){t=G(t)?t:function(){},T.debug("Hiding pop-up"),p.transition&&void 0!==V.fn.transition?g.transition({animation:(p.transition.hideMethod||p.transition)+" out",queue:!1,duration:p.transition.hideDuration||p.duration,debug:p.debug,verbose:p.verbose,silent:p.silent,onComplete:function(){T.reset(),t.call(g,b),p.onHidden.call(g,b)}}):T.error(c.noTransition)}},change:{content:function(t){g.html(t)}},get:{html:function(){return f.removeData(d.html),f.data(d.html)||p.html},title:function(){return f.removeData(d.title),f.data(d.title)||p.title},content:function(t){return f.removeData(d.content),f.data(d.content)||p.content||t},variation:function(){return f.removeData(d.variation),f.data(d.variation)||p.variation},popup:function(){return g},popupOffset:function(){return g.offset()},calculations:function(){let t=T.get.offsetParent(g);var e=h[0],o=s[0]===W,n=h.offset(),i=p.inline||p.popup&&p.movePopup?h.offsetParent().offset():{top:0,left:0},r=o?{top:0,left:0}:s.offset();let a={};o=o?{top:x.scrollTop(),left:x.scrollLeft()}:{top:0,left:0};return a={target:{element:h[0],width:h.outerWidth(),height:h.outerHeight(),top:n.top-i.top,left:n.left-i.left,margin:{}},popup:{width:g.outerWidth(),height:g.outerHeight()},parent:{width:l.outerWidth(),height:l.outerHeight()},screen:{top:r.top,left:r.left,scroll:{top:o.top,left:o.left},width:s.width(),height:s.height()}},t[0]!==l[0]&&(n=t.offset(),a.target.top-=n.top,a.target.left-=n.left,a.parent.width=t.outerWidth(),a.parent.height=t.outerHeight()),p.setFluidWidth&&T.is.fluid()&&(a.container={width:g.parent().outerWidth()},a.popup.width=a.container.width),a.target.margin.top=p.inline?parseInt(W.getComputedStyle(e).getPropertyValue("margin-top"),10):0,a.target.margin.left=p.inline?T.is.rtl()?parseInt(W.getComputedStyle(e).getPropertyValue("margin-right"),10):parseInt(W.getComputedStyle(e).getPropertyValue("margin-left"),10):0,i=a.screen,a.boundary={top:i.top+i.scroll.top,bottom:i.top+i.scroll.top+i.height,left:i.left+i.scroll.left,right:i.left+i.scroll.left+i.width},a},id:function(){return C},startEvent:function(){return"hover"===p.on?"mouseenter":"focus"===p.on&&"focus"},scrollEvent:function(){return"scroll"},endEvent:function(){return"hover"===p.on?"mouseleave":"focus"===p.on&&"blur"},distanceFromBoundary:function(t,e=T.get.calculations()){let o={};var n=e.popup,e=e.boundary;return t&&(o={top:t.top-e.top,left:t.left-e.left,right:e.right-(t.left+n.width),bottom:e.bottom-(t.top+n.height)},T.verbose("Distance from boundaries determined",t,o)),o},offsetParent:function(t){let n=(void 0!==t?t:h)[0].parentNode,i=V(n);if(n){let t="none"===i.css("transform"),e="static"===i.css("position"),o=i.is("body");for(;n&&!o&&e&&t;)n=n.parentNode,i=V(n),t="none"===i.css("transform"),e="static"===i.css("position"),o=i.is("body")}return i&&0<i.length?i:V()},positions:function(){return{"top left":!1,"top center":!1,"top right":!1,"bottom left":!1,"bottom center":!1,"bottom right":!1,"left center":!1,"right center":!1}},nextPosition:function(t){var e=t.split(" "),o=e[0],e=e[1],n="top"===o||"bottom"===o;let i=!1,r=!1,a=!1;return m||(T.verbose("All available positions available"),m=T.get.positions()),T.debug("Recording last position tried",t),m[t]=!0,"opposite"===p.prefer&&(a=(a=[{top:"bottom",bottom:"top",left:"right",right:"left"}[o],e]).join(" "),i=!0===m[a],T.debug("Trying opposite strategy",a)),"adjacent"===p.prefer&&n&&(a=(a=[o,{left:"center",center:"right",right:"left"}[e]]).join(" "),r=!0===m[a],T.debug("Trying adjacent strategy",a)),(r||i)&&(T.debug("Using backup position",a),a={"top left":"top center","top center":"top right","top right":"right center","right center":"bottom right","bottom right":"bottom center","bottom center":"bottom left","bottom left":"left center","left center":"top left"}[t]),a}},set:{position:function(n=f.data(d.position)||p.position,i=T.get.calculations()){if(0!==h.length&&0!==g.length){let t,e;var r,a,s,l;let o;if(t=f.data(d.offset)||p.offset,e=p.distanceAway,r=i.target,a=i.popup,s=i.parent,T.should.centerArrow(i)&&(T.verbose("Adjusting offset to center arrow on small target element"),"top left"!==n&&"bottom left"!==n||(t=(t+=r.width/2)-p.arrowPixelsFromEdge),"top right"!==n&&"bottom right"!==n||(t=(t-=r.width/2)+p.arrowPixelsFromEdge)),0===r.width&&0===r.height&&!T.is.svg(r.element))return T.debug("Popup target is hidden, no action taken"),!1;switch(p.inline&&(T.debug("Adding margin to calculation",r.margin),"left center"===n||"right center"===n?(t+=r.margin.top,e+=-r.margin.left):"top left"===n||"top center"===n||"top right"===n?(t+=r.margin.left,e-=r.margin.top):(t+=r.margin.left,e+=r.margin.top)),T.debug("Determining popup position from calculations",n,i),T.is.rtl()&&(n=n.replace(/left|right/g,function(t){return"left"===t?"right":"left"}),T.debug("RTL: Popup position updated",n)),n=v===p.maxSearchDepth&&"string"==typeof p.lastResort?p.lastResort:n){case"top left":o={top:"auto",bottom:s.height-r.top+e,left:r.left+t,right:"auto"};break;case"top center":o={bottom:s.height-r.top+e,left:r.left+r.width/2-a.width/2+t,top:"auto",right:"auto"};break;case"top right":o={bottom:s.height-r.top+e,right:s.width-r.left-r.width-t,top:"auto",left:"auto"};break;case"left center":o={top:r.top+r.height/2-a.height/2+t,right:s.width-r.left+e,left:"auto",bottom:"auto"};break;case"right center":o={top:r.top+r.height/2-a.height/2+t,left:r.left+r.width+e,bottom:"auto",right:"auto"};break;case"bottom left":o={top:r.top+r.height+e,left:r.left+t,bottom:"auto",right:"auto"};break;case"bottom center":o={top:r.top+r.height+e,left:r.left+r.width/2-a.width/2+t,bottom:"auto",right:"auto"};break;case"bottom right":o={top:r.top+r.height+e,right:s.width-r.left-r.width-t,left:"auto",bottom:"auto"}}if(void 0===o&&T.error(c.invalidPosition,n),T.debug("Calculated popup positioning values",o),g.css(o).removeClass(u.position).addClass(n),T.set.invisible(),l=T.get.popupOffset(),l=T.get.distanceFromBoundary(l,i),!p.forcePosition&&T.is.offstage(l,n)){if(T.debug("Position is outside viewport",n),v<p.maxSearchDepth)return v++,n=T.get.nextPosition(n),T.debug("Trying new position",n),!!g&&T.set.position(n,i);if(!p.lastResort)return T.debug("Popup could not find a position to display",g),T.error(c.cannotPlace,b),T.remove.attempts(),T.remove.invisible(),T.reset(),p.onUnplaceable.call(g,b),!1;T.debug("No position found, showing with last position")}return T.debug("Position is on stage",n),T.remove.attempts(),T.remove.invisible(),p.setFluidWidth&&T.is.fluid()&&T.set.fluidWidth(i),!0}T.error(c.notFound)},fluidWidth:function(t=T.get.calculations()){T.debug("Automatically setting element width to parent width",t.parent.width),g.css("width",t.container.width)},loading:function(){g.addClass(u.loading)},invisible:function(){g.addClass(u.invisible)},variation:function(t=T.get.variation()){t&&T.has.popup()&&(T.verbose("Adding variation to popup",t),g.addClass(t))},visible:function(){f.addClass(u.visible)}},remove:{loading:function(){g.removeClass(u.loading)},invisible:function(){g.removeClass(u.invisible)},variation:function(t=T.get.variation()){t&&(T.verbose("Removing variation",t),g.removeClass(t))},visible:function(){f.removeClass(u.visible)},attempts:function(){T.verbose("Resetting all searched positions"),v=0,m=!1}},bind:{events:function(){T.debug("Binding popup events to module"),"click"===p.on&&f.on(S+e,T.toggle),"hover"===p.on&&f.on("touchstart"+e,T.event.touchstart),T.get.startEvent()&&f.on(T.get.startEvent()+e,T.event.start).on(T.get.endEvent()+e,T.event.end),p.target&&T.debug("Target set to element",h),x.on("resize"+P,T.event.resize)},popup:function(){T.verbose("Allowing hover events on popup to prevent closing"),g&&T.has.popup()&&g.on("mouseenter"+e,T.event.start).on("mouseleave"+e,T.event.end)},close:function(){(!0===p.hideOnScroll||"auto"===p.hideOnScroll&&"click"!==p.on)&&T.bind.closeOnScroll(),T.is.closable()?T.bind.clickaway():"hover"===p.on&&a&&T.bind.touchClose()},closeOnScroll:function(){T.verbose("Binding scroll close event to document"),n.one(T.get.scrollEvent()+P,T.event.hideGracefully)},touchClose:function(){T.verbose("Binding popup touchclose event to document"),E.on("touchstart"+P,function(t){T.verbose("Touched away from popup"),T.event.hideGracefully.call(b,t)})},clickaway:function(){T.verbose("Binding popup close event to document"),E.on(S+P,function(t){T.verbose("Clicked away from popup"),T.event.hideGracefully.call(b,t)})}},unbind:{events:function(){x.off(P),f.off(e)},close:function(){E.off(P),n.off(P)}},can:{useElement:function(t){return void 0!==V.fn[t]||(T.error(c.noElement.replace("{element}",t)),!1)}},has:{popup:function(){return g&&0<g.length}},should:{centerArrow:function(t){return!T.is.basic()&&t.target.width<=2*p.arrowPixelsFromEdge}},is:{closable:function(){return"auto"===p.closable?"hover"!==p.on:p.closable},offstage:function(t,o){let n=[];return V.each(t,function(t,e){e<-p.jitter&&(T.debug("Position exceeds allowable distance from edge",t,e,o),n.push(t))}),0<n.length},svg:function(t){return T.supports.svg()&&t instanceof SVGGraphicsElement},basic:function(){return f.hasClass(u.basic)},active:function(){return f.hasClass(u.active)},animating:function(){return void 0!==g&&g.hasClass(u.animating)},fluid:function(){return void 0!==g&&g.hasClass(u.fluid)},visible:function(){return void 0!==g&&g.hasClass(u.popupVisible)},dropdown:function(){return f.hasClass(u.dropdown)},hidden:function(){return!T.is.visible()},rtl:function(){return"rtl"===f.attr("dir")||"rtl"===f.css("direction")||"rtl"===k.attr("dir")||"rtl"===k.css("direction")||"rtl"===r.attr("dir")||"rtl"===r.css("direction")}},reset:function(){T.remove.visible(),p.preserve?void 0!==V.fn.transition&&g.transition("remove transition"):T.removePopup()},setting:function(t,e){if(V.isPlainObject(t))V.extend(!0,p,t);else{if(void 0===e)return p[t];p[t]=e}},internal:function(t,e){if(V.isPlainObject(t))V.extend(!0,T,t);else{if(void 0===e)return T[t];T[t]=e}},debug:function(...t){!p.silent&&p.debug&&(p.performance?T.performance.log(t):(T.debug=Function.prototype.bind.call(console.info,console,p.name+":"),T.debug.apply(console,t)))},verbose:function(...t){!p.silent&&p.verbose&&p.debug&&(p.performance?T.performance.log(t):(T.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),T.verbose.apply(console,t)))},error:function(...t){p.silent||(T.error=Function.prototype.bind.call(console.error,console,p.name+":"),T.error.apply(console,t))},performance:{log:function(t){var e,o;p.performance&&(o=(e=Date.now())-(A||e),A=e,D.push({Name:t[0],Arguments:t.slice(1),Element:b,"Execution Time":o})),clearTimeout(T.performance.timer),T.performance.timer=setTimeout(function(){T.performance.display()},500)},display:function(){var t=p.name+":";let o=0;A=!1,clearTimeout(T.performance.timer),V.each(D,function(t,e){o+=e["Execution Time"]}),t+=" "+o+"ms",0<D.length&&(console.groupCollapsed(t),console.table(D),console.groupEnd()),D=[]}},invoke:function(n,t=F,e=b){let i=w,r,a,o;return"string"==typeof n&&void 0!==i&&(n=n.split(/[ .]/),r=n.length-1,V.each(n,function(t,e){var o=t!==r?e+n[t+1].charAt(0).toUpperCase()+n[t+1].slice(1):n;if(V.isPlainObject(i[o])&&t!==r)i=i[o];else{if(void 0!==i[o])return a=i[o],!1;{if(!V.isPlainObject(i[e])||t===r)return void 0!==i[e]?a=i[e]:T.error(c.method,n),!1;i=i[e]}}})),G(a)?o=a.apply(e,t):void 0!==a&&(o=a),Array.isArray(H)?H.push(o):void 0!==H?H=[H,o]:void 0!==o&&(H=o),a}},j?(void 0===w&&T.initialize(),T.invoke(O)):(void 0!==w&&w.invoke("destroy"),T.initialize())}),void 0!==H?H:this},V.fn.popup.settings={name:"Popup",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"popup",observeChanges:!0,onCreate:function(){},onRemove:function(){},onShow:function(){},onVisible:function(){},onHide:function(){},onUnplaceable:function(){},onHidden:function(){},on:"hover",boundary:W,addTouchEvents:!0,position:"top left",forcePosition:!1,variation:"",movePopup:!0,target:!1,popup:!1,inline:!1,preserve:!1,hoverable:!1,content:!1,html:!1,title:!1,closable:!0,hideOnScroll:"auto",exclusive:!1,context:"body",scrollContext:W,prefer:"opposite",lastResort:!1,arrowPixelsFromEdge:20,delay:{show:50,hide:70},setFluidWidth:!0,duration:200,transition:"scale",distanceAway:0,jitter:2,offset:0,maxSearchDepth:15,error:{invalidPosition:"The position you specified is not a valid position",cannotPlace:"Popup does not fit within the boundaries of the viewport",method:"The method you called is not defined.",noElement:"This module requires ui {element}",notFound:"The target or popup you specified does not exist on the page"},metadata:{activator:"activator",content:"content",html:"html",offset:"offset",position:"position",title:"title",variation:"variation"},className:{active:"active",basic:"basic",animating:"animating",dropdown:"dropdown",invisible:"invisible",fluid:"fluid",loading:"loading",popup:"ui popup",position:"top left center bottom right",visible:"visible",popupVisible:"visible"},selector:{popup:".ui.popup"},templates:{escape:function(t){const e={'"':""","&":"&","'":"'","<":"<",">":">"};return String(t).replace(/["&'<>]/g,t=>e[t])},popup:function(t){let e="",o=V.fn.popup.settings.templates.escape;return void 0!==t&&(t.title&&(t.title=o(t.title),e+='<div class="header">'+t.title+"</div>"),t.content&&(t.content=o(t.content),e+='<div class="content">'+t.content+"</div>")),e}}}}(jQuery,window,document);
|
|
11
|
+
!function(V,W,N){"use strict";function G(t){return"function"==typeof t&&"number"!=typeof t.nodeType}W=void 0!==W&&W.Math===Math?W:globalThis,V.fn.popup=function(...t){const e=V(this),E=V(N),x=V(W),k=V("body"),S="ontouchstart"in N.documentElement?"touchstart":"click";let A=Date.now(),D=[];const O=t[0],j="string"==typeof O,F=t.slice(1),R=function(t,e){let o;return[W,N].includes(t)?o=V(t):0===(o=V(e.document).find(t)).length&&(o=e.frameElement?R(t,e.parent):k),o};let H;return e.each(function(){const p=V.isPlainObject(O)?V.extend(!0,{},V.fn.popup.settings,O):V.extend({},V.fn.popup.settings),i=p.selector,u=p.className,c=p.error,d=p.metadata;var t=p.namespace;const e="."+p.namespace,o="module-"+t,f=V(this),r=R(p.context,W),n=R(p.scrollContext,W),s=R(p.boundary,W),h=p.target?R(p.target,W):f;let g,l,v=0,m=!1,a=!1;const b=this;let w=f.data(o),y,P,C;const T={initialize:function(){T.debug("Initializing",f),T.createID(),T.bind.events(),!T.exists()&&p.preserve&&T.create(),p.observeChanges&&T.observeChanges(),T.instantiate()},instantiate:function(){T.verbose("Storing instance",T),w=T,f.data(o,w)},observeChanges:function(){(y=new MutationObserver(T.event.documentChanged)).observe(N,{childList:!0,subtree:!0}),T.debug("Setting up mutation observer",y)},refresh:function(){p.popup?g=E.find(p.popup).eq(0):p.inline&&(g=h.nextAll(i.popup).eq(0),p.popup=g),p.popup?(T.set.invisible(),l=T.get.offsetParent(),T.remove.invisible(),p.movePopup&&T.has.popup()&&T.get.offsetParent(g)[0]!==l[0]&&(T.debug("Moving popup to the same offset parent as target"),g.detach().appendTo(l))):l=p.inline?T.get.offsetParent(h):T.has.popup()?T.get.offsetParent(g):k,l.is("html")&&l[0]!==k[0]&&(T.debug("Setting page as offset parent"),l=k),T.get.variation()&&T.set.variation()},reposition:function(){T.refresh(),T.set.position()},destroy:function(){T.debug("Destroying previous module"),y&&y.disconnect(),g&&!p.preserve&&T.removePopup(),clearTimeout(T.hideTimer),clearTimeout(T.showTimer),T.unbind.close(),T.unbind.events(),f.removeData(o)},event:{start:function(t){var e=V.isPlainObject(p.delay)?p.delay.show:p.delay;clearTimeout(T.hideTimer),(!a||a&&p.addTouchEvents)&&(T.showTimer=setTimeout(function(){T.show()},e))},end:function(){var t=V.isPlainObject(p.delay)?p.delay.hide:p.delay;clearTimeout(T.showTimer),T.hideTimer=setTimeout(function(){T.hide()},t)},touchstart:function(t){a=!0,p.addTouchEvents&&T.show()},resize:function(){T.is.visible()&&T.set.position()},documentChanged:function(t){Array.prototype.forEach.call(t,function(t){t.removedNodes&&Array.prototype.forEach.call(t.removedNodes,function(t){(t===b||0<V(t).find(b).length)&&(T.debug("Element removed from DOM, tearing down events"),T.destroy())})})},hideGracefully:function(t){const e=V(t.target);var o=N.documentElement.contains(t.target),n=0<e.closest(i.popup).length;t&&!n&&o?(T.debug("Click occurred outside popup hiding popup"),T.hide()):T.debug("Click was inside popup, keeping popup open")}},create:function(){const t=h.next(i.popup);var e=!p.popup&&0===t.length&&f.attr("title");let o=T.get.html();var n=T.get.title(),e=T.get.content(e);o||e||n?(T.debug("Creating pop-up html"),o=o||p.templates.popup({title:n,content:e}),g=V("<div/>").addClass(u.popup).data(d.activator,f).html(o),p.inline?(T.verbose("Inserting popup element inline",g),g.insertAfter(f)):(T.verbose("Appending popup element to body",g),g.appendTo(r)),T.refresh(),T.set.variation(),p.hoverable&&T.bind.popup(),p.onCreate.call(g,b)):p.popup?(E.find(p.popup).data(d.activator,f),T.verbose("Used popup specified in settings"),T.refresh(),p.hoverable&&T.bind.popup()):0<t.length?(T.verbose("Pre-existing popup found"),p.inline=!0,p.popup=t.data(d.activator,f),T.refresh(),p.hoverable&&T.bind.popup()):T.debug("No content specified skipping display",b)},createID:function(){C=(Math.random().toString(16)+"000000000").slice(2,10),P="."+C,T.verbose("Creating unique id for element",C)},toggle:function(){T.debug("Toggling pop-up"),T.is.hidden()?(T.debug("Popup is hidden, showing pop-up"),T.unbind.close(),T.show()):(T.debug("Popup is visible, hiding pop-up"),T.hide())},show:function(t=function(){}){T.debug("Showing pop-up",p.transition),!T.is.hidden()||T.is.active()&&T.is.dropdown()||(T.exists()||T.create(),!1===p.onShow.call(g,b)?T.debug("onShow callback returned false, cancelling popup animation"):(p.preserve||p.popup||T.refresh(),g&&T.set.position()&&(T.save.conditions(),p.exclusive&&T.hideAll(),T.animate.show(t))))},hide:function(t=function(){}){(T.is.visible()||T.is.animating())&&(!1===p.onHide.call(g,b)?T.debug("onHide callback returned false, cancelling popup animation"):(T.remove.visible(),T.unbind.close(),T.restore.conditions(),T.animate.hide(t)))},hideAll:function(){E.find(i.popup).filter("."+u.popupVisible).each(function(){V(this).data(d.activator).popup("hide")})},exists:function(){return!!g&&(p.inline||p.popup?T.has.popup():0<g.closest(r).length)},removePopup:function(){T.has.popup()&&!p.popup&&(T.debug("Removing popup",g),g.remove(),g=void 0,p.onRemove.call(g,b))},save:{conditions:function(){T.cache={title:f.attr("title")},T.cache.title&&f.removeAttr("title"),T.verbose("Saving original attributes",T.cache.title)}},restore:{conditions:function(){return T.cache&&T.cache.title&&(f.attr("title",T.cache.title),T.verbose("Restoring original attributes",T.cache.title)),!0}},supports:{svg:function(){return"undefined"!=typeof SVGGraphicsElement}},animate:{show:function(t){t=G(t)?t:function(){},p.transition&&T.can.useElement("transition")&&(T.set.visible(),g.transition({animation:(p.transition.showMethod||p.transition)+" in",queue:!1,debug:p.debug,verbose:p.verbose,silent:p.silent,duration:p.transition.showDuration||p.duration,onComplete:function(){T.bind.close(),t.call(g,b),p.onVisible.call(g,b)}}))},hide:function(t){t=G(t)?t:function(){},T.debug("Hiding pop-up"),p.transition&&void 0!==V.fn.transition?g.transition({animation:(p.transition.hideMethod||p.transition)+" out",queue:!1,duration:p.transition.hideDuration||p.duration,debug:p.debug,verbose:p.verbose,silent:p.silent,onComplete:function(){T.reset(),t.call(g,b),p.onHidden.call(g,b)}}):T.error(c.noTransition)}},change:{content:function(t){g.html(t)}},get:{html:function(){return f.removeData(d.html),f.data(d.html)||p.html},title:function(){return f.removeData(d.title),f.data(d.title)||p.title},content:function(t){return f.removeData(d.content),f.data(d.content)||p.content||t},variation:function(){return f.removeData(d.variation),f.data(d.variation)||p.variation},popup:function(){return g},popupOffset:function(){return g.offset()},calculations:function(){const t=T.get.offsetParent(g);var e=h[0],o=s[0]===W,n=h.offset(),i=p.inline||p.popup&&p.movePopup?h.offsetParent().offset():{top:0,left:0},r=o?{top:0,left:0}:s.offset(),o=o?{top:x.scrollTop(),left:x.scrollLeft()}:{top:0,left:0};const a={target:{element:h[0],width:h.outerWidth(),height:h.outerHeight(),top:n.top-i.top,left:n.left-i.left,margin:{}},popup:{width:g.outerWidth(),height:g.outerHeight()},parent:{width:l.outerWidth(),height:l.outerHeight()},screen:{top:r.top,left:r.left,scroll:{top:o.top,left:o.left},width:s.width(),height:s.height()}};t[0]!==l[0]&&(n=t.offset(),a.target.top-=n.top,a.target.left-=n.left,a.parent.width=t.outerWidth(),a.parent.height=t.outerHeight()),p.setFluidWidth&&T.is.fluid()&&(a.container={width:g.parent().outerWidth()},a.popup.width=a.container.width),a.target.margin.top=p.inline?parseInt(W.getComputedStyle(e).getPropertyValue("margin-top"),10):0,a.target.margin.left=p.inline?T.is.rtl()?parseInt(W.getComputedStyle(e).getPropertyValue("margin-right"),10):parseInt(W.getComputedStyle(e).getPropertyValue("margin-left"),10):0;i=a.screen;return a.boundary={top:i.top+i.scroll.top,bottom:i.top+i.scroll.top+i.height,left:i.left+i.scroll.left,right:i.left+i.scroll.left+i.width},a},id:function(){return C},startEvent:function(){return"hover"===p.on?"mouseenter":"focus"===p.on&&"focus"},scrollEvent:function(){return"scroll"},endEvent:function(){return"hover"===p.on?"mouseleave":"focus"===p.on&&"blur"},distanceFromBoundary:function(t,e=T.get.calculations()){let o={};var n=e.popup,e=e.boundary;return t&&(o={top:t.top-e.top,left:t.left-e.left,right:e.right-(t.left+n.width),bottom:e.bottom-(t.top+n.height)},T.verbose("Distance from boundaries determined",t,o)),o},offsetParent:function(t){let n=(void 0!==t?t:h)[0].parentNode,i=V(n);if(n){let t="none"===i.css("transform"),e="static"===i.css("position"),o=i.is("body");for(;n&&!o&&e&&t;)n=n.parentNode,i=V(n),t="none"===i.css("transform"),e="static"===i.css("position"),o=i.is("body")}return i&&0<i.length?i:V()},positions:function(){return{"top left":!1,"top center":!1,"top right":!1,"bottom left":!1,"bottom center":!1,"bottom right":!1,"left center":!1,"right center":!1}},nextPosition:function(t){var e=t.split(" "),o=e[0],e=e[1],n="top"===o||"bottom"===o;let i=!1,r=!1,a=!1;return m||(T.verbose("All available positions available"),m=T.get.positions()),T.debug("Recording last position tried",t),m[t]=!0,"opposite"===p.prefer&&(a=(a=[{top:"bottom",bottom:"top",left:"right",right:"left"}[o],e]).join(" "),i=!0===m[a],T.debug("Trying opposite strategy",a)),"adjacent"===p.prefer&&n&&(a=(a=[o,{left:"center",center:"right",right:"left"}[e]]).join(" "),r=!0===m[a],T.debug("Trying adjacent strategy",a)),(r||i)&&(T.debug("Using backup position",a),a={"top left":"top center","top center":"top right","top right":"right center","right center":"bottom right","bottom right":"bottom center","bottom center":"bottom left","bottom left":"left center","left center":"top left"}[t]),a}},set:{position:function(n=f.data(d.position)||p.position,i=T.get.calculations()){if(0!==h.length&&0!==g.length){let t,e,o;t=f.data(d.offset)||p.offset,e=p.distanceAway;var r=i.target,a=i.popup,s=i.parent;if(T.should.centerArrow(i)&&(T.verbose("Adjusting offset to center arrow on small target element"),"top left"!==n&&"bottom left"!==n||(t=(t+=r.width/2)-p.arrowPixelsFromEdge),"top right"!==n&&"bottom right"!==n||(t=(t-=r.width/2)+p.arrowPixelsFromEdge)),0===r.width&&0===r.height&&!T.is.svg(r.element))return T.debug("Popup target is hidden, no action taken"),!1;switch(p.inline&&(T.debug("Adding margin to calculation",r.margin),"left center"===n||"right center"===n?(t+=r.margin.top,e+=-r.margin.left):"top left"===n||"top center"===n||"top right"===n?(t+=r.margin.left,e-=r.margin.top):(t+=r.margin.left,e+=r.margin.top)),T.debug("Determining popup position from calculations",n,i),T.is.rtl()&&(n=n.replace(/left|right/g,function(t){return"left"===t?"right":"left"}),T.debug("RTL: Popup position updated",n)),n=v===p.maxSearchDepth&&"string"==typeof p.lastResort?p.lastResort:n){case"top left":o={top:"auto",bottom:s.height-r.top+e,left:r.left+t,right:"auto"};break;case"top center":o={bottom:s.height-r.top+e,left:r.left+r.width/2-a.width/2+t,top:"auto",right:"auto"};break;case"top right":o={bottom:s.height-r.top+e,right:s.width-r.left-r.width-t,top:"auto",left:"auto"};break;case"left center":o={top:r.top+r.height/2-a.height/2+t,right:s.width-r.left+e,left:"auto",bottom:"auto"};break;case"right center":o={top:r.top+r.height/2-a.height/2+t,left:r.left+r.width+e,bottom:"auto",right:"auto"};break;case"bottom left":o={top:r.top+r.height+e,left:r.left+t,bottom:"auto",right:"auto"};break;case"bottom center":o={top:r.top+r.height+e,left:r.left+r.width/2-a.width/2+t,bottom:"auto",right:"auto"};break;case"bottom right":o={top:r.top+r.height+e,right:s.width-r.left-r.width-t,left:"auto",bottom:"auto"}}void 0===o&&T.error(c.invalidPosition,n),T.debug("Calculated popup positioning values",o),g.css(o).removeClass(u.position).addClass(n),T.set.invisible();var l=T.get.popupOffset(),l=T.get.distanceFromBoundary(l,i);if(!p.forcePosition&&T.is.offstage(l,n)){if(T.debug("Position is outside viewport",n),v<p.maxSearchDepth)return v++,n=T.get.nextPosition(n),T.debug("Trying new position",n),!!g&&T.set.position(n,i);if(!p.lastResort)return T.debug("Popup could not find a position to display",g),T.error(c.cannotPlace,b),T.remove.attempts(),T.remove.invisible(),T.reset(),p.onUnplaceable.call(g,b),!1;T.debug("No position found, showing with last position")}return T.debug("Position is on stage",n),T.remove.attempts(),T.remove.invisible(),p.setFluidWidth&&T.is.fluid()&&T.set.fluidWidth(i),!0}T.error(c.notFound)},fluidWidth:function(t=T.get.calculations()){T.debug("Automatically setting element width to parent width",t.parent.width),g.css("width",t.container.width)},loading:function(){g.addClass(u.loading)},invisible:function(){g.addClass(u.invisible)},variation:function(t=T.get.variation()){t&&T.has.popup()&&(T.verbose("Adding variation to popup",t),g.addClass(t))},visible:function(){f.addClass(u.visible)}},remove:{loading:function(){g.removeClass(u.loading)},invisible:function(){g.removeClass(u.invisible)},variation:function(t=T.get.variation()){t&&(T.verbose("Removing variation",t),g.removeClass(t))},visible:function(){f.removeClass(u.visible)},attempts:function(){T.verbose("Resetting all searched positions"),v=0,m=!1}},bind:{events:function(){T.debug("Binding popup events to module"),"click"===p.on&&f.on(S+e,T.toggle),"hover"===p.on&&f.on("touchstart"+e,T.event.touchstart),T.get.startEvent()&&f.on(T.get.startEvent()+e,T.event.start).on(T.get.endEvent()+e,T.event.end),p.target&&T.debug("Target set to element",h),x.on("resize"+P,T.event.resize)},popup:function(){T.verbose("Allowing hover events on popup to prevent closing"),g&&T.has.popup()&&g.on("mouseenter"+e,T.event.start).on("mouseleave"+e,T.event.end)},close:function(){(!0===p.hideOnScroll||"auto"===p.hideOnScroll&&"click"!==p.on)&&T.bind.closeOnScroll(),T.is.closable()?T.bind.clickaway():"hover"===p.on&&a&&T.bind.touchClose()},closeOnScroll:function(){T.verbose("Binding scroll close event to document"),n.one(T.get.scrollEvent()+P,T.event.hideGracefully)},touchClose:function(){T.verbose("Binding popup touchclose event to document"),E.on("touchstart"+P,function(t){T.verbose("Touched away from popup"),T.event.hideGracefully.call(b,t)})},clickaway:function(){T.verbose("Binding popup close event to document"),E.on(S+P,function(t){T.verbose("Clicked away from popup"),T.event.hideGracefully.call(b,t)})}},unbind:{events:function(){x.off(P),f.off(e)},close:function(){E.off(P),n.off(P)}},can:{useElement:function(t){return void 0!==V.fn[t]||(T.error(c.noElement.replace("{element}",t)),!1)}},has:{popup:function(){return g&&0<g.length}},should:{centerArrow:function(t){return!T.is.basic()&&t.target.width<=2*p.arrowPixelsFromEdge}},is:{closable:function(){return"auto"===p.closable?"hover"!==p.on:p.closable},offstage:function(t,o){const n=[];return V.each(t,function(t,e){e<-p.jitter&&(T.debug("Position exceeds allowable distance from edge",t,e,o),n.push(t))}),0<n.length},svg:function(t){return T.supports.svg()&&t instanceof SVGGraphicsElement},basic:function(){return f.hasClass(u.basic)},active:function(){return f.hasClass(u.active)},animating:function(){return void 0!==g&&g.hasClass(u.animating)},fluid:function(){return void 0!==g&&g.hasClass(u.fluid)},visible:function(){return void 0!==g&&g.hasClass(u.popupVisible)},dropdown:function(){return f.hasClass(u.dropdown)},hidden:function(){return!T.is.visible()},rtl:function(){return"rtl"===f.attr("dir")||"rtl"===f.css("direction")||"rtl"===k.attr("dir")||"rtl"===k.css("direction")||"rtl"===r.attr("dir")||"rtl"===r.css("direction")}},reset:function(){T.remove.visible(),p.preserve?void 0!==V.fn.transition&&g.transition("remove transition"):T.removePopup()},setting:function(t,e){if(V.isPlainObject(t))V.extend(!0,p,t);else{if(void 0===e)return p[t];p[t]=e}},internal:function(t,e){if(V.isPlainObject(t))V.extend(!0,T,t);else{if(void 0===e)return T[t];T[t]=e}},debug:function(...t){!p.silent&&p.debug&&(p.performance?T.performance.log(t):(T.debug=Function.prototype.bind.call(console.info,console,p.name+":"),T.debug.apply(console,t)))},verbose:function(...t){!p.silent&&p.verbose&&p.debug&&(p.performance?T.performance.log(t):(T.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),T.verbose.apply(console,t)))},error:function(...t){p.silent||(T.error=Function.prototype.bind.call(console.error,console,p.name+":"),T.error.apply(console,t))},performance:{log:function(t){var e,o;p.performance&&(o=(e=Date.now())-(A||e),A=e,D.push({Name:t[0],Arguments:t.slice(1),Element:b,"Execution Time":o})),clearTimeout(T.performance.timer),T.performance.timer=setTimeout(function(){T.performance.display()},500)},display:function(){var t=p.name+":";let o=0;A=!1,clearTimeout(T.performance.timer),V.each(D,function(t,e){o+=e["Execution Time"]}),t+=" "+o+"ms",0<D.length&&(console.groupCollapsed(t),console.table(D),console.groupEnd()),D=[]}},invoke:function(n,t=F,e=b){let i=w,r,a,o;return"string"==typeof n&&void 0!==i&&(n=n.split(/[ .]/),r=n.length-1,V.each(n,function(t,e){var o=t!==r?e+n[t+1].charAt(0).toUpperCase()+n[t+1].slice(1):n;if(V.isPlainObject(i[o])&&t!==r)i=i[o];else{if(void 0!==i[o])return a=i[o],!1;{if(!V.isPlainObject(i[e])||t===r)return void 0!==i[e]?a=i[e]:T.error(c.method,n),!1;i=i[e]}}})),G(a)?o=a.apply(e,t):void 0!==a&&(o=a),Array.isArray(H)?H.push(o):void 0!==H?H=[H,o]:void 0!==o&&(H=o),a}};j?(void 0===w&&T.initialize(),T.invoke(O)):(void 0!==w&&w.invoke("destroy"),T.initialize())}),void 0!==H?H:this},V.fn.popup.settings={name:"Popup",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"popup",observeChanges:!0,onCreate:function(){},onRemove:function(){},onShow:function(){},onVisible:function(){},onHide:function(){},onUnplaceable:function(){},onHidden:function(){},on:"hover",boundary:W,addTouchEvents:!0,position:"top left",forcePosition:!1,variation:"",movePopup:!0,target:!1,popup:!1,inline:!1,preserve:!1,hoverable:!1,content:!1,html:!1,title:!1,closable:!0,hideOnScroll:"auto",exclusive:!1,context:"body",scrollContext:W,prefer:"opposite",lastResort:!1,arrowPixelsFromEdge:20,delay:{show:50,hide:70},setFluidWidth:!0,duration:200,transition:"scale",distanceAway:0,jitter:2,offset:0,maxSearchDepth:15,error:{invalidPosition:"The position you specified is not a valid position",cannotPlace:"Popup does not fit within the boundaries of the viewport",method:"The method you called is not defined.",noElement:"This module requires ui {element}",notFound:"The target or popup you specified does not exist on the page"},metadata:{activator:"activator",content:"content",html:"html",offset:"offset",position:"position",title:"title",variation:"variation"},className:{active:"active",basic:"basic",animating:"animating",dropdown:"dropdown",invisible:"invisible",fluid:"fluid",loading:"loading",popup:"ui popup",position:"top left center bottom right",visible:"visible",popupVisible:"visible"},selector:{popup:".ui.popup"},templates:{escape:function(t){const e={'"':""","&":"&","'":"'","<":"<",">":">"};return String(t).replace(/["&'<>]/g,t=>e[t])},popup:function(t){let e="";const o=V.fn.popup.settings.templates.escape;return void 0!==t&&(t.title&&(t.title=o(t.title),e+='<div class="header">'+t.title+"</div>"),t.content&&(t.content=o(t.content),e+='<div class="content">'+t.content+"</div>")),e}}}}(jQuery,window,document);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - Progress
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,42 +20,41 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.progress = function (...args) {
|
|
23
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
24
|
|
|
25
25
|
let time = Date.now();
|
|
26
26
|
let performance = [];
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const parameters = args[0];
|
|
29
|
+
const methodInvoked = typeof parameters === 'string';
|
|
30
|
+
const queryArguments = args.slice(1);
|
|
31
31
|
|
|
32
32
|
let returnedValue;
|
|
33
33
|
|
|
34
34
|
$allModules.each(function () {
|
|
35
|
-
|
|
35
|
+
const settings = $.isPlainObject(parameters)
|
|
36
36
|
? $.extend(true, {}, $.fn.progress.settings, parameters)
|
|
37
37
|
: $.extend({}, $.fn.progress.settings);
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
const className = settings.className;
|
|
40
|
+
const metadata = settings.metadata;
|
|
41
|
+
const namespace = settings.namespace;
|
|
42
|
+
const selector = settings.selector;
|
|
43
|
+
const error = settings.error;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const eventNamespace = '.' + namespace;
|
|
46
|
+
const moduleNamespace = 'module-' + namespace;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const $module = $(this);
|
|
49
|
+
const $bars = $(this).find(selector.bar);
|
|
50
|
+
const $progresses = $(this).find(selector.progress);
|
|
51
|
+
const $label = $(this).find(selector.label);
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
const element = this;
|
|
54
54
|
let instance = $module.data(moduleNamespace);
|
|
55
55
|
|
|
56
56
|
let animating = false;
|
|
57
|
-
|
|
58
|
-
module = {
|
|
57
|
+
const module = {
|
|
59
58
|
helper: {
|
|
60
59
|
sum: function (nums) {
|
|
61
60
|
return Array.isArray(nums) ? nums.reduce(function (left, right) {
|
|
@@ -146,7 +145,7 @@
|
|
|
146
145
|
|
|
147
146
|
read: {
|
|
148
147
|
metadata: function () {
|
|
149
|
-
|
|
148
|
+
const data = {
|
|
150
149
|
percent: module.helper.forceArray($module.data(metadata.percent)),
|
|
151
150
|
total: $module.data(metadata.total),
|
|
152
151
|
value: module.helper.forceArray($module.data(metadata.value)),
|
|
@@ -212,7 +211,7 @@
|
|
|
212
211
|
module.set.progress(newValue);
|
|
213
212
|
},
|
|
214
213
|
decrement: function (decrementValue) {
|
|
215
|
-
|
|
214
|
+
const total = module.get.total();
|
|
216
215
|
let startValue;
|
|
217
216
|
let newValue;
|
|
218
217
|
if (total) {
|
|
@@ -241,12 +240,12 @@
|
|
|
241
240
|
|
|
242
241
|
get: {
|
|
243
242
|
text: function (templateText = '', index = 0) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
243
|
+
const value = module.get.value(index);
|
|
244
|
+
const total = module.get.total();
|
|
245
|
+
const percent = animating
|
|
247
246
|
? module.get.displayPercent(index)
|
|
248
247
|
: module.get.percent(index);
|
|
249
|
-
|
|
248
|
+
const left = total !== false
|
|
250
249
|
? Math.max(0, total - value)
|
|
251
250
|
: 100 - percent;
|
|
252
251
|
templateText = templateText
|
|
@@ -305,11 +304,11 @@
|
|
|
305
304
|
|
|
306
305
|
// gets current displayed percentage (if animating values, this is the intermediary value)
|
|
307
306
|
displayPercent: function (index) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
307
|
+
const $bar = $($bars[index]);
|
|
308
|
+
const barWidth = $bar.width();
|
|
309
|
+
const totalWidth = $module.width();
|
|
310
|
+
const minDisplay = parseInt($bar.css('min-width'), 10);
|
|
311
|
+
const displayPercent = barWidth > minDisplay
|
|
313
312
|
? (barWidth / totalWidth) * 100
|
|
314
313
|
: module.percent;
|
|
315
314
|
|
|
@@ -401,12 +400,12 @@
|
|
|
401
400
|
values = module.helper.forceArray(values);
|
|
402
401
|
let firstNonZeroIndex = -1;
|
|
403
402
|
let lastNonZeroIndex = -1;
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
403
|
+
const valuesSum = module.helper.sum(values);
|
|
404
|
+
const barCounts = $bars.length;
|
|
405
|
+
const isMultiple = barCounts > 1;
|
|
406
|
+
const percents = values.map(function (value, index) {
|
|
407
|
+
const allZero = index === barCounts - 1 && valuesSum === 0;
|
|
408
|
+
const $bar = $($bars[index]);
|
|
410
409
|
if (value === 0 && isMultiple && !allZero) {
|
|
411
410
|
$bar.css('display', 'none');
|
|
412
411
|
} else {
|
|
@@ -426,7 +425,7 @@
|
|
|
426
425
|
return parseFloat(value);
|
|
427
426
|
});
|
|
428
427
|
values.forEach(function (_, index) {
|
|
429
|
-
|
|
428
|
+
const $bar = $($bars[index]);
|
|
430
429
|
$bar.css({
|
|
431
430
|
borderTopLeftRadius: index === firstNonZeroIndex ? '' : '0',
|
|
432
431
|
borderBottomLeftRadius: index === firstNonZeroIndex ? '' : '0',
|
|
@@ -457,10 +456,10 @@
|
|
|
457
456
|
? Math.max(0, Math.min(100, percent))
|
|
458
457
|
: percent;
|
|
459
458
|
});
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
459
|
+
const hasTotal = module.has.total();
|
|
460
|
+
const totalPercent = module.helper.sum(percents);
|
|
461
|
+
const isMultipleValues = percents.length > 1 && hasTotal;
|
|
462
|
+
const sumTotal = module.helper.sum(module.helper.forceArray(module.value));
|
|
464
463
|
if (isMultipleValues && sumTotal > module.total) {
|
|
465
464
|
// Sum values instead of percents to avoid precision issues when summing floats
|
|
466
465
|
module.error(error.sumExceedsTotal, sumTotal, module.total);
|
|
@@ -470,14 +469,14 @@
|
|
|
470
469
|
} else if (totalPercent < 0) {
|
|
471
470
|
module.error(error.tooLow, totalPercent);
|
|
472
471
|
} else {
|
|
473
|
-
|
|
472
|
+
const autoPrecision = settings.precision > 0
|
|
474
473
|
? settings.precision
|
|
475
474
|
: (isMultipleValues
|
|
476
475
|
? module.helper.derivePrecision(Math.min.apply(null, module.value), module.total)
|
|
477
476
|
: 0);
|
|
478
477
|
|
|
479
478
|
// round display percentage
|
|
480
|
-
|
|
479
|
+
const roundedPercents = percents.map(function (percent) {
|
|
481
480
|
return autoPrecision > 0
|
|
482
481
|
? Math.round(percent * (10 * autoPrecision)) / (10 * autoPrecision)
|
|
483
482
|
: Math.round(percent);
|
|
@@ -496,7 +495,7 @@
|
|
|
496
495
|
settings.onChange.call(element, percents, module.value, module.total);
|
|
497
496
|
},
|
|
498
497
|
labelInterval: function () {
|
|
499
|
-
|
|
498
|
+
const animationCallback = function () {
|
|
500
499
|
module.verbose('Bar finished animating, removing continuous label updates');
|
|
501
500
|
clearInterval(module.interval);
|
|
502
501
|
animating = false;
|
|
@@ -506,7 +505,7 @@
|
|
|
506
505
|
module.bind.transitionEnd(animationCallback);
|
|
507
506
|
animating = true;
|
|
508
507
|
module.interval = setInterval(function () {
|
|
509
|
-
|
|
508
|
+
const isInDOM = document.documentElement.contains(element);
|
|
510
509
|
if (!isInDOM) {
|
|
511
510
|
clearInterval(module.interval);
|
|
512
511
|
animating = false;
|
|
@@ -526,10 +525,7 @@
|
|
|
526
525
|
$label.text(text);
|
|
527
526
|
}
|
|
528
527
|
},
|
|
529
|
-
state: function (percent) {
|
|
530
|
-
percent = percent !== undefined
|
|
531
|
-
? percent
|
|
532
|
-
: module.helper.sum(module.percent);
|
|
528
|
+
state: function (percent = module.helper.sum(module.percent)) {
|
|
533
529
|
if (percent === 100) {
|
|
534
530
|
if (settings.autoSuccess && $bars.length === 1 && !(module.is.warning() || module.is.error() || module.is.success())) {
|
|
535
531
|
module.set.success();
|
|
@@ -552,7 +548,7 @@
|
|
|
552
548
|
},
|
|
553
549
|
barLabel: function (text) {
|
|
554
550
|
$progresses.each(function (index, element) {
|
|
555
|
-
|
|
551
|
+
const $progress = $(element);
|
|
556
552
|
if (text !== undefined) {
|
|
557
553
|
$progress.text(module.get.text(text, index));
|
|
558
554
|
} else if (settings.label === 'ratio' && module.has.total()) {
|
|
@@ -651,7 +647,7 @@
|
|
|
651
647
|
|
|
652
648
|
update: {
|
|
653
649
|
toNextValue: function () {
|
|
654
|
-
|
|
650
|
+
const nextValue = module.nextValue;
|
|
655
651
|
if (nextValue) {
|
|
656
652
|
module.debug('Update interval complete using last updated value', nextValue);
|
|
657
653
|
module.update.progress(nextValue);
|
|
@@ -659,11 +655,11 @@
|
|
|
659
655
|
}
|
|
660
656
|
},
|
|
661
657
|
progress: function (values) {
|
|
662
|
-
|
|
658
|
+
const hasTotal = module.has.total();
|
|
663
659
|
if (hasTotal) {
|
|
664
660
|
module.set.value(values);
|
|
665
661
|
}
|
|
666
|
-
|
|
662
|
+
const percentCompletes = module.helper.forceArray(values).map(function (value) {
|
|
667
663
|
let percentComplete;
|
|
668
664
|
value = module.get.numericValue(value);
|
|
669
665
|
if (value === false) {
|
|
@@ -781,7 +777,7 @@
|
|
|
781
777
|
query = query.split(/[ .]/);
|
|
782
778
|
maxDepth = query.length - 1;
|
|
783
779
|
$.each(query, function (depth, value) {
|
|
784
|
-
|
|
780
|
+
const camelCaseValue = depth !== maxDepth
|
|
785
781
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
786
782
|
: query;
|
|
787
783
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.64+bcb9c73
|
|
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(V,e,A){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,V.fn.progress=function(...e){let t=V(this),m=Date.now(),b=[],h=e[0],x="string"==typeof h,y=e.slice(1),w;return t.each(function(){let i=V.isPlainObject(h)?V.extend(!0,{},V.fn.progress.settings,h):V.extend({},V.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=V(this),u=V(this).find(n.bar),s=V(this).find(n.progress),d=V(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=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=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.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=V(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=V(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=V(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=i.duration){e="number"==typeof e?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.documentElement.contains(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=V(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=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=i.text.success||i.text.active,t=!1){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=i.text.warning,t=!1){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=i.text.error,t=!1){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),V.isPlainObject(e))V.extend(!0,i,e);else{if(void 0===t)return i[e];V.isPlainObject(i[e])?V.extend(!0,i[e],t):i[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,f,e);else{if(void 0===t)return f[e];f[e]=t}},debug:function(...e){!i.silent&&i.debug&&(i.performance?f.performance.log(e):(f.debug=Function.prototype.bind.call(console.info,console,i.name+":"),f.debug.apply(console,e)))},verbose:function(...e){!i.silent&&i.verbose&&i.debug&&(i.performance?f.performance.log(e):(f.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),f.verbose.apply(console,e)))},error:function(...e){i.silent||(f.error=Function.prototype.bind.call(console.error,console,i.name+":"),f.error.apply(console,e))},performance:{log:function(e){var t,r;i.performance&&(r=(t=Date.now())-(m||t),m=t,b.push({Name:e[0],Arguments:e.slice(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;m=!1,clearTimeout(f.performance.timer),V.each(b,function(e,t){r+=t["Execution Time"]}),e+=" "+r+"ms",0<b.length&&(console.groupCollapsed(e),console.table(b),console.groupEnd()),b=[]}},invoke:function(n,e=y,t=p){let a=v,o,i,r;var s;return"string"==typeof n&&void 0!==a&&(n=n.split(/[ .]/),o=n.length-1,V.each(n,function(e,t){var r=e!==o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(V.isPlainObject(a[r])&&e!==o)a=a[r];else{if(void 0!==a[r])return i=a[r],!1;{if(!V.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(w)?w.push(r):void 0!==w?w=[w,r]:void 0!==r&&(w=r),i}},x?(void 0===v&&f.initialize(),f.invoke(h)):(void 0!==v&&v.invoke("destroy"),f.initialize())}),void 0!==w?w:this},V.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(V,e,A){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,V.fn.progress=function(...e){const t=V(this);let m=Date.now(),b=[];const h=e[0],x="string"==typeof h,y=e.slice(1);let w;return t.each(function(){const i=V.isPlainObject(h)?V.extend(!0,{},V.fn.progress.settings,h):V.extend({},V.fn.progress.settings),r=i.className,t=i.metadata;var e=i.namespace,n=i.selector;const l=i.error,a="."+e,o="module-"+e,c=V(this),u=V(this).find(n.bar),s=V(this).find(n.progress),d=V(this).find(n.label),p=this;let v=c.data(o),g=!1;const 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=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=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.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){const t=V(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;const 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;const n=V(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){const r=V(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=i.duration){e="number"==typeof e?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 t=f.has.total(),r=f.helper.sum(e),n=1<e.length&&t,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<r)f.error(l.tooHigh,r);else if(r<0)f.error(l.tooLow,r);else{const o=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<o?Math.round(e*(10*o))/(10*o):Math.round(e)});f.percent=a,t&&(f.value=e.map(function(e){return 0<o?Math.round(e/100*f.total*(10*o))/(10*o):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.documentElement.contains(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=f.helper.sum(f.percent)){100===e?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){const r=V(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=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=i.text.success||i.text.active,t=!1){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=i.text.warning,t=!1){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=i.text.error,t=!1){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){const 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),V.isPlainObject(e))V.extend(!0,i,e);else{if(void 0===t)return i[e];V.isPlainObject(i[e])?V.extend(!0,i[e],t):i[e]=t}},internal:function(e,t){if(V.isPlainObject(e))V.extend(!0,f,e);else{if(void 0===t)return f[e];f[e]=t}},debug:function(...e){!i.silent&&i.debug&&(i.performance?f.performance.log(e):(f.debug=Function.prototype.bind.call(console.info,console,i.name+":"),f.debug.apply(console,e)))},verbose:function(...e){!i.silent&&i.verbose&&i.debug&&(i.performance?f.performance.log(e):(f.verbose=Function.prototype.bind.call(console.info,console,i.name+":"),f.verbose.apply(console,e)))},error:function(...e){i.silent||(f.error=Function.prototype.bind.call(console.error,console,i.name+":"),f.error.apply(console,e))},performance:{log:function(e){var t,r;i.performance&&(r=(t=Date.now())-(m||t),m=t,b.push({Name:e[0],Arguments:e.slice(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;m=!1,clearTimeout(f.performance.timer),V.each(b,function(e,t){r+=t["Execution Time"]}),e+=" "+r+"ms",0<b.length&&(console.groupCollapsed(e),console.table(b),console.groupEnd()),b=[]}},invoke:function(n,e=y,t=p){let a=v,o,i,r;var s;return"string"==typeof n&&void 0!==a&&(n=n.split(/[ .]/),o=n.length-1,V.each(n,function(e,t){var r=e!==o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(V.isPlainObject(a[r])&&e!==o)a=a[r];else{if(void 0!==a[r])return i=a[r],!1;{if(!V.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(w)?w.push(r):void 0!==w?w=[w,r]:void 0!==r&&(w=r),i}};x?(void 0===v&&f.initialize(),f.invoke(h)):(void 0!==v&&v.invoke("destroy"),f.initialize())}),void 0!==w?w:this},V.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.64+bcb9c73 - Rating
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,40 +20,39 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.rating = function (...args) {
|
|
23
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
24
|
|
|
25
25
|
let time = Date.now();
|
|
26
26
|
let performance = [];
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const parameters = args[0];
|
|
29
|
+
const methodInvoked = typeof parameters === 'string';
|
|
30
|
+
const queryArguments = args.slice(1);
|
|
31
31
|
let returnedValue;
|
|
32
32
|
$allModules.each(function () {
|
|
33
|
-
|
|
33
|
+
const settings = $.isPlainObject(parameters)
|
|
34
34
|
? $.extend(true, {}, $.fn.rating.settings, parameters)
|
|
35
35
|
: $.extend({}, $.fn.rating.settings);
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const namespace = settings.namespace;
|
|
38
|
+
const className = settings.className;
|
|
39
|
+
const error = settings.error;
|
|
40
|
+
const metadata = settings.metadata;
|
|
41
|
+
const selector = settings.selector;
|
|
42
|
+
const cssVars = settings.cssVars;
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const eventNamespace = '.' + namespace;
|
|
45
|
+
const moduleNamespace = 'module-' + namespace;
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const element = this;
|
|
48
48
|
let instance = $(this).data(moduleNamespace);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const $module = $(this);
|
|
51
51
|
let $icon = $module.find(selector.icon);
|
|
52
52
|
|
|
53
53
|
let initialLoad;
|
|
54
|
-
let module;
|
|
55
54
|
|
|
56
|
-
module = {
|
|
55
|
+
const module = {
|
|
57
56
|
|
|
58
57
|
initialize: function () {
|
|
59
58
|
module.verbose('Initializing rating module', settings);
|
|
@@ -93,9 +92,9 @@
|
|
|
93
92
|
|
|
94
93
|
setup: {
|
|
95
94
|
layout: function () {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
const maxRating = module.get.maxRating();
|
|
96
|
+
const icon = module.get.icon();
|
|
97
|
+
const html = $.fn.rating.settings.templates.icon(maxRating, icon);
|
|
99
98
|
module.debug('Generating icon html dynamically');
|
|
100
99
|
$module
|
|
101
100
|
.html(html);
|
|
@@ -105,7 +104,7 @@
|
|
|
105
104
|
|
|
106
105
|
event: {
|
|
107
106
|
mouseenter: function () {
|
|
108
|
-
|
|
107
|
+
const $activeIcon = $(this);
|
|
109
108
|
$activeIcon
|
|
110
109
|
.nextAll()
|
|
111
110
|
.removeClass(className.selected);
|
|
@@ -123,10 +122,10 @@
|
|
|
123
122
|
.removeClass(className.selected);
|
|
124
123
|
},
|
|
125
124
|
click: function () {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
const $activeIcon = $(this);
|
|
126
|
+
const currentRating = module.get.rating();
|
|
127
|
+
const rating = $icon.index($activeIcon) + 1;
|
|
128
|
+
const canClear = settings.clearable === 'auto'
|
|
130
129
|
? $icon.length === 1
|
|
131
130
|
: settings.clearable;
|
|
132
131
|
if (canClear && currentRating === rating) {
|
|
@@ -188,7 +187,7 @@
|
|
|
188
187
|
|
|
189
188
|
get: {
|
|
190
189
|
icon: function () {
|
|
191
|
-
|
|
190
|
+
const icon = $module.data(metadata.icon);
|
|
192
191
|
if (icon) {
|
|
193
192
|
$module.removeData(metadata.icon);
|
|
194
193
|
}
|
|
@@ -214,7 +213,7 @@
|
|
|
214
213
|
return settings.maxRating;
|
|
215
214
|
},
|
|
216
215
|
rating: function () {
|
|
217
|
-
|
|
216
|
+
const currentRating = $icon.filter('.' + className.active).length;
|
|
218
217
|
module.verbose('Current rating retrieved', currentRating);
|
|
219
218
|
|
|
220
219
|
return currentRating;
|
|
@@ -223,14 +222,14 @@
|
|
|
223
222
|
|
|
224
223
|
set: {
|
|
225
224
|
rating: function (rating) {
|
|
226
|
-
|
|
225
|
+
const ratingIndex = Math.floor(
|
|
227
226
|
Math.max(rating - 1, 0)
|
|
228
227
|
);
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
const $activeIcon = $icon.eq(ratingIndex);
|
|
229
|
+
const $partialActiveIcon = rating <= 1
|
|
231
230
|
? $activeIcon
|
|
232
231
|
: $activeIcon.next();
|
|
233
|
-
|
|
232
|
+
const filledPercentage = (rating % 1) * 100;
|
|
234
233
|
$module
|
|
235
234
|
.removeClass(className.selected);
|
|
236
235
|
$icon
|
|
@@ -365,7 +364,7 @@
|
|
|
365
364
|
query = query.split(/[ .]/);
|
|
366
365
|
maxDepth = query.length - 1;
|
|
367
366
|
$.each(query, function (depth, value) {
|
|
368
|
-
|
|
367
|
+
const camelCaseValue = depth !== maxDepth
|
|
369
368
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
370
369
|
: query;
|
|
371
370
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -483,7 +482,7 @@
|
|
|
483
482
|
icon: function (maxRating, iconClass) {
|
|
484
483
|
let icon = 1;
|
|
485
484
|
let html = '';
|
|
486
|
-
|
|
485
|
+
const escape = $.fn.rating.settings.templates.escape;
|
|
487
486
|
while (icon <= maxRating) {
|
|
488
487
|
html += '<i class="' + escape(iconClass) + ' icon"></i>';
|
|
489
488
|
icon++;
|