You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
2.6 KiB
8 lines
2.6 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define(["../../../chunks/languageUtils","../support/errorsupport","../support/FeatureSet","../support/IdSet","../support/OrderbyClause"],function(g,k,l,h,p){class m extends l{constructor(a){super(a);this._orderbyclause=null;this.declaredClass="esri.arcade.featureset.actions.OrderBy";this._maxProcessing=100;this._orderbyclause=a.orderbyclause;this._parent=a.parentfeatureset}async _getSet(a){if(null===this._wset){await this._ensureLoaded();const b=await this._getFilteredSet("",null,null,this._orderbyclause, |
|
a);this._checkCancelled(a);this._wset=b}return this._wset}async manualOrderSet(a,b){a=await this.getIdColumnDictionary(a,[],-1,b);this._orderbyclause?.order(a);b=new h([],[],!0,null);for(let e=0;e<a.length;e++)b._known.push(a[e].id);return b}async getIdColumnDictionary(a,b,e,c){if(e<a._known.length-1){var d=this._maxQueryRate();if("GETPAGES"===a._known[e+1])return await g.tick(this._parent._expandPagedSet(a,d,0,0,c)),this.getIdColumnDictionary(a,b,e,c);d=e+1;const f=[];for(;d<a._known.length&&"GETPAGES"!== |
|
a._known[d];)f.push(a._known[d]),d++;e+=f.length;d=await g.tick(this._parent._getFeatureBatch(f,c));this._checkCancelled(c);for(const n of d)b.push({id:n.attributes[this.objectIdField],feature:n});return this.getIdColumnDictionary(a,b,e,c)}return 0<a._candidates.length?(await g.tick(this._refineSetBlock(a,this._maxProcessingRate(),c)),this._checkCancelled(c),this.getIdColumnDictionary(a,b,e,c)):b}_isInFeatureSet(a){return this._parent._isInFeatureSet(a)}_getFeatures(a,b,e,c){return this._parent._getFeatures(a, |
|
b,e,c)}_featureFromCache(a){if(void 0===this._featureCache[a]){const b=this._parent._featureFromCache(a);return void 0===b?void 0:null===b?null:this._featureCache[a]=b}return this._featureCache[a]}async _fetchAndRefineFeatures(){throw new k.FeatureSetError(k.FeatureSetErrorCodes.NeverReach);}async _getFilteredSet(a,b,e,c,d){await this._ensureLoaded();c=await this._parent._getFilteredSet(a,b,e,null===c?this._orderbyclause:c,d);this._checkCancelled(d);const f=new h(c._candidates.slice(0),c._known.slice(0), |
|
c._ordered,this._clonePageDefinition(c.pagesDefinition));a=!0;0<c._candidates.length&&(a=!1);return!1===f._ordered?(d=await this.manualOrderSet(f,d),!1!==a||null===b&&null===e||(d=new h(d._candidates.slice(0).concat(d._known.slice(0)),[],d._ordered,this._clonePageDefinition(d.pagesDefinition))),d):f}static registerAction(){l._featuresetFunctions.orderBy=function(a){return""===a?this:new m({parentfeatureset:this,orderbyclause:new p(a)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}return m}); |