Expand.js 3.54 KB
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.6/esri/copyright.txt for details.
//>>built
define("require exports ../core/tsSupport/declareExtendsHelper ../core/tsSupport/decorateHelper ../core/accessorSupport/decorators ./Widget ./support/widget dojo/i18n!../nls/common ./Expand/ExpandViewModel".split(" "),function(r,t,q,d,e,l,c,m,n){return function(p){function b(a){a=p.call(this)||this;a.autoCollapse=!1;a.collapseIconClass="";a.collapseTooltip="";a.content="";a.expanded=!1;a.expandIconClass="";a.expandTooltip="";a.group=null;a.iconNumber=0;a.view=null;a.viewModel=new n;return a}q(b,p);
b.prototype.expand=function(){this.viewModel.expanded=!0};b.prototype.collapse=function(){this.viewModel.expanded=!1};b.prototype.toggle=function(){this.viewModel.expanded=!this.viewModel.expanded};b.prototype.render=function(){var a=this.viewModel.expanded,b=this.expandTooltip||m.expand,d=this.collapseTooltip||m.collapse,b=a?d:b,d=this.collapseIconClass||"esri-icon-collapse",e=this.expandIconClass||"esri-icon-expand",d=(f={},f["esri-expand__icon--expanded"]=a,f[d]=a,f[e]=!a,f),f=(g={},g["esri-expand__container--expanded"]=
a,g),g=(h={},h["esri-expand__content--expanded"]=a,h),h=(k={},k["esri-expand__mask--expanded"]=a,k),k=(e=this.iconNumber)&&!a?c.tsx("span",{key:"expand__icon-number",class:"esri-expand__icon-number"},e):null,a=e&&a?c.tsx("span",{key:"expand__expand-icon-number",class:c.join("esri-expand__icon-number","esri-expand__icon-number--expanded")},e):null;return c.tsx("div",{class:"esri-expand esri-widget"},c.tsx("div",{bind:this,onclick:this._toggle,class:"esri-expand__mask",classes:h}),c.tsx("div",{class:"esri-expand__container",
classes:f},c.tsx("div",{class:"esri-expand__panel"},c.tsx("div",{bind:this,onclick:this._toggle,onkeydown:this._toggle,"aria-label":b,title:b,role:"button",tabindex:"0",class:"esri-widget-button"},k,c.tsx("span",{"aria-hidden":"true",class:"esri-collapse__icon",classes:d}),c.tsx("span",{class:"esri-icon-font-fallback-text"},b)),a),c.tsx("div",{class:"esri-expand__content",classes:g,bind:this},this._renderContent())));var f,g,h,k};b.prototype._toggle=function(){this.toggle()};b.prototype._renderContent=
function(){var a=this.content;return"string"===typeof a?c.tsx("div",{innerHTML:a}):a&&a.isInstanceOf&&a.isInstanceOf(l)?a.render():a instanceof HTMLElement?c.tsx("div",{bind:a,afterCreate:this._attachToNode}):a&&"function"===typeof a.postMixInProperties&&"function"===typeof a.buildRendering&&"function"===typeof a.postCreate&&"function"===typeof a.startup?c.tsx("div",{bind:a.domNode,afterCreate:this._attachToNode}):null};b.prototype._attachToNode=function(a){a.appendChild(this)};d([e.aliasOf("viewModel.autoCollapse")],
b.prototype,"autoCollapse",void 0);d([e.property(),c.renderable()],b.prototype,"collapseIconClass",void 0);d([e.property(),c.renderable()],b.prototype,"collapseTooltip",void 0);d([e.property(),c.renderable()],b.prototype,"content",void 0);d([e.aliasOf("viewModel.expanded"),c.renderable()],b.prototype,"expanded",void 0);d([e.property(),c.renderable()],b.prototype,"expandIconClass",void 0);d([e.property(),c.renderable()],b.prototype,"expandTooltip",void 0);d([e.aliasOf("viewModel.group")],b.prototype,
"group",void 0);d([e.property(),c.renderable()],b.prototype,"iconNumber",void 0);d([e.aliasOf("viewModel.view"),c.renderable()],b.prototype,"view",void 0);d([e.property({type:n}),c.renderable("viewModel.state")],b.prototype,"viewModel",void 0);d([c.accessibleHandler()],b.prototype,"_toggle",null);return b=d([e.subclass("esri.widgets.Expand")],b)}(e.declared(l))});