Spinner.js 2.2 KB

1234567
  1. // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  2. // See https://js.arcgis.com/4.7/esri/copyright.txt for details.
  3. //>>built
  4. define("require exports ../core/tsSupport/declareExtendsHelper ../core/tsSupport/decorateHelper ../core/promiseUtils ../core/watchUtils ../core/accessorSupport/decorators ./Widget ./support/AnchorElementViewModel ./support/widget".split(" "),function(p,q,k,e,l,m,d,n,g,f){return function(h){function b(a){a=h.call(this)||this;a._animationDelay=500;a._animationPromise=null;a.location=null;a.view=null;a.visible=!1;a.viewModel=new g;return a}k(b,h);b.prototype.postInitialize=function(){var a=this;this.own([m.watch(this,
  5. "visible",function(b){return a._visibleChange(b)})])};b.prototype.destroy=function(){this._cancelAnimationPromise()};b.prototype.show=function(a){var b=this,c=a.location;a=a.promise;c&&(this.viewModel.location=c);this.visible=!0;a&&a.always(function(){return b.hide()})};b.prototype.hide=function(){this.visible=!1};b.prototype.render=function(){var a=this.visible,b=!!this.viewModel.screenLocation,a=(c={},c["esri-spinner--start"]=a&&b,c["esri-spinner--finish"]=!a&&b,c),c=this._getPositionStyles();return f.tsx("div",
  6. {class:"esri-spinner",classes:a,styles:c});var c};b.prototype._cancelAnimationPromise=function(){this._animationPromise&&(this._animationPromise.cancel(),this._animationPromise=null)};b.prototype._visibleChange=function(a){var b=this;a?this.viewModel.screenLocationEnabled=!0:(this._cancelAnimationPromise(),this._animationPromise=l.after(this._animationDelay).then(function(){b.viewModel.screenLocationEnabled=!1;b._animationPromise=null}))};b.prototype._getPositionStyles=function(){var a=this.viewModel,
  7. b=a.screenLocation,a=a.view;if(!a||!b)return{};a=a.padding;return{left:b.x-a.left+"px",top:b.y-a.top+"px"}};e([d.aliasOf("viewModel.location")],b.prototype,"location",void 0);e([d.aliasOf("viewModel.view")],b.prototype,"view",void 0);e([d.property(),f.renderable()],b.prototype,"visible",void 0);e([d.property({type:g}),f.renderable(["viewModel.screenLocation","viewModel.screenLocationEnabled"])],b.prototype,"viewModel",void 0);return b=e([d.subclass("esri.widgets.Spinner")],b)}(d.declared(n))});