/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../chunks/_rollupPluginBabelHelpers","../../../chunks/tslib.es6","../../../core/Accessor","../../../core/Collection","../../../core/accessorSupport/decorators/property","../../../core/arrayUtils","../../../core/has","../../../core/accessorSupport/ensureType","../../../core/accessorSupport/decorators/subclass"],(function(e,o,t,r,n,s,i,a,c){"use strict";let l=function(o){function t(t){var n;return(n=o.call(this,t)||this).cellClassNameGenerator=null,n.columnReorderingEnabled=!0,n.columns=new r,n.dataProvider=function(){var o=e._asyncToGenerator((function*({page:o,pageSize:t},r){const{store:s}=e._assertThisInitialized(n);r&&(s?r(yield s.fetchItems({page:o,pageSize:t})):r&&r([]))}));return function(e,t){return o.apply(this,arguments)}}(),n.multiSortEnabled=!1,n.pageSize=50,n.rowDetailsRenderer=null,n.store=null,n}e._inheritsLoose(t,o);var n=t.prototype;return n.closeColumnMenus=function(){var e;null==(e=this.columns)||e.forEach((e=>{e.menu&&e.menu.open&&e.menu.set("open",!1)}))},n.sortColumn=function(e,o){const t=this.findColumn(e);t&&(t.direction=o)},n.hideColumn=function(e){const o=this.findColumn(e);o&&!1===o.hidden&&(o.hidden=!0)},n.showColumn=function(e){const o=this.findColumn(e);o&&o.hidden&&(o.hidden=!1)},n.showAllColumns=function(){var e;null==(e=this.columns)||e.forEach((e=>{e.hidden&&(e.hidden=!1)}))},n.findColumn=function(e){const o=[];return this.columns.forEach((e=>{o.push(e),"columns"in e&&e.columns.forEach((e=>o.push(e)))})),o.find((o=>o.path===e))},n.getRowItemAt=function(e){return this.store&&this.store.getLocalItemAt(e)},n.refresh=function(){this.store&&(this.store.reset(),this.store.load())},e._createClass(t,[{key:"size",get:function(){return this.store&&this.store.count||0}},{key:"state",get:function(){const{store:e}=this;return e&&"disabled"!==e.state?"loading"===e.state?"loading":"loaded"===e.state?"loaded":"ready":"disabled"}}]),t}(t);o.__decorate([n.property()],l.prototype,"cellClassNameGenerator",void 0),o.__decorate([n.property()],l.prototype,"columnReorderingEnabled",void 0),o.__decorate([n.property()],l.prototype,"columns",void 0),o.__decorate([n.property()],l.prototype,"dataProvider",void 0),o.__decorate([n.property()],l.prototype,"multiSortEnabled",void 0),o.__decorate([n.property()],l.prototype,"pageSize",void 0),o.__decorate([n.property()],l.prototype,"rowDetailsRenderer",void 0),o.__decorate([n.property({readOnly:!0})],l.prototype,"size",null),o.__decorate([n.property()],l.prototype,"store",void 0),o.__decorate([n.property({readOnly:!0})],l.prototype,"state",null),l=o.__decorate([c.subclass("esri.widgets.FeatureTable.Grid.GridViewModel")],l);return l}));
