@arcgis/common-components 4.29.0-beta.48 → 4.29.0-beta.49
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/dist/arcgis-common-components/arcgis-common-components.esm.js +1 -1
- package/dist/arcgis-common-components/p-d3d1695f.entry.js +1 -0
- package/dist/cjs/arcgis-field-info.cjs.entry.js +24 -19
- package/dist/cjs/arcgis-field-pick-list.cjs.entry.js +6 -18
- package/dist/components/arcgis-field-pick-list.js +6 -18
- package/dist/components/field-info.js +24 -19
- package/dist/esm/arcgis-field-info.entry.js +24 -19
- package/dist/esm/arcgis-field-pick-list.entry.js +6 -18
- package/package.json +6 -6
- package/dist/arcgis-common-components/p-77e17376.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-a91ab432.js";export{s as setNonce}from"./p-a91ab432.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((e=>t([["p-
|
|
1
|
+
import{p as e,b as t}from"./p-a91ab432.js";export{s as setNonce}from"./p-a91ab432.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((e=>t([["p-d3d1695f",[[1,"arcgis-field-info",{view:[16],layer:[16],fieldName:[1,"field-name"],hideStatistics:[4,"hide-statistics"],oneFeatureResponse:[32],oneFeatureResponseStatus:[32],statistics:[32],statisticsStatus:[32],uniqueValues:[32],uniqueValuesStatus:[32],_lang:[32],_t9nLocale:[32],_t9nStrings:[32]}]]],["p-7318a1d1",[[1,"arcgis-field-pick-list",{selectedFields:[1040],fields:[16],popoverProps:[16],layer:[16],mapView:[16],showFieldInfo:[4,"show-field-info"],showFieldName:[4,"show-field-name"],showDescription:[4,"show-description"],showSelectionAll:[4,"show-selection-all"],showCancel:[4,"show-cancel"],showSort:[4,"show-sort"],showFilterLength:[2,"show-filter-length"],multiple:[4],heading:[1],okBtnText:[1,"ok-btn-text"],filterPlaceholderText:[1,"filter-placeholder-text"],sortBy:[1,"sort-by"],lastSortyBy:[32],filterFields:[32],_lang:[32],_t9nLocale:[32],_t9nStrings:[32],setFocus:[64],reposition:[64]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,g as e,h as i,H as n,a as r,F as a}from"./p-a91ab432.js";import{F as l,a as o,b as c,i as u,c as d,d as h,e as f,f as g,U as m}from"./p-6c7d2684.js";var v,y;function p(t){return null!=t}function w(t){return"scene"===t.type?t.associatedLayer?.url:t.url}async function S(t){t.statisticsStatus=v.IN_PROGRESS;const{layer:s,view:e}=t;if("imagery"===s.type||"imagery-tile"===s.type||"stream"===s.type)throw new Error("could not get feature count");try{return await async function(t,s){return"feature"!==t.type||t.url?"feature"===t.type||"csv"===t.type||"scene"===t.type||"wfs"===t.type||"geojson"===t.type?await t.queryFeatureCount():!s||"stream"!==t.type&&"ogc-feature"!==t.type?void 0:async function(t,s){return(await s.whenLayerView(t)).queryFeatureCount()}(t,s):async function(t){const s=t.createQuery();s.outFields=["*"];const e=await t.queryFeatures(s);if(e.features?.length)return e.features.length;throw new Error("could not get feature count")}(t)}(s,e)}catch(t){return}}async function b(t){const{layer:s,modules:e}=t;if(["imagery","imagery-tile","stream","ogc-feature"].indexOf(s.type)>-1)throw new Error("cannot get feature from service");const i=new e.Query({where:"1=1",outFields:["*"],returnGeometry:!1});return s.queryFeatures(i)}!function(t){t.MISSING="missing",t.IN_PROGRESS="inProgress",t.SUCCESS="success",t.FAILED="failed"}(v||(v={})),function(t){t.NUMBER="number",t.STRING="string",t.DATE="date",t.DATE_ONLY="date-only",t.TIME_ONLY="time-only",t.TIMESTAMP_OFFSET="timestamp-offset",t.OID="oid",t.GUID="guid",t.UNKNOWN="unknown"}(y||(y={}));const _=class{constructor(e){t(this,e),this.arcgisFieldInfoComplete=s(this,"arcgisFieldInfoComplete",7),this.view=void 0,this.layer=void 0,this.fieldName=void 0,this.hideStatistics=!1,this.oneFeatureResponse=void 0,this.oneFeatureResponseStatus=v.MISSING,this.statistics=void 0,this.statisticsStatus=v.MISSING,this.uniqueValues=void 0,this.uniqueValuesStatus=v.MISSING,this._lang="",this._t9nLocale="",this._t9nStrings=void 0}async componentWillLoad(){await l(this,e("./assets"));const t=await o(),s=await c(),i=await u(),n=await d(),r=await h(),a=await f(),{view:m,layer:_,fieldName:$,hideStatistics:k}=this;let I;if("esri.layers.support.Sublayer"===_.declaredClass){const t=_,{whenOnce:s}=await g();m&&await s((()=>!m.updating)),I=await t.createFeatureLayer(),await I.load()}this.props={view:m,layer:I||_,fieldName:$,hideStatistics:k,modules:{esriLang:t,esriConfig:s,intl:i,Query:n,summaryStatistics:r,uniqueValues:a}},this.props.fieldInfo=function(t){const{layer:s,fieldName:e}=t;let i;const{popupTemplate:n}=s,r=n?n.fieldInfos:[];return("imagery-tile"===s.type||"imagery"===s.type&&s.rasterFields?.length?s.rasterFields:s.fields).filter((t=>t.name===e)).forEach((s=>{const n=r?r.filter((t=>t.fieldName===s.name)):null,a=n?.length?n[0].label:null;/^raster.(item|service)pixelvalue/iu.test(e)&&(s.type="double");const l={layerField:s,label:a||s.alias||s.name};l.codedValues=function(t,s){const{layer:e,modules:i}=s;if("feature"!==e.type)return;const n=e.typeIdField,r=e.types;let a;const l=e.fields.find((s=>s.name===t)),o=l.domain;return n&&r?(n===t?a=r.map((t=>({code:t.id,name:t.name}))):(a=[],r.forEach((s=>{if(s.domains&&s.domains[t]&&"inherited"!==s.domains[t].type)s.domains?.[t]?.codedValues&&s.domains[t].codedValues.forEach((async t=>{let s=!1;a.forEach((e=>{e.code===t.code&&(s=!0,-1===`, ${e.name},`.indexOf(`, ${t.name},`)&&(e.name+=`, ${t.name}`))})),s||a.push(i.esriLang.clone(t))}));else{const t=o;t?.codedValues&&t.codedValues.forEach((async t=>{let s=!1;a.forEach((e=>{e.code===t.code&&(s=!0,-1===`, ${e.name},`.indexOf(`, ${t.name},`)&&(e.name+=`, ${t.name}`))})),s||a.push(i.esriLang.clone(t))}))}}))),!a?.length&&o?.codedValues&&(a=i.esriLang.clone(o.codedValues))):o?.codedValues&&(a=l.domain.codedValues),a?.length?a:null}(e,t),function(t){switch(t.layerField.type){case"string":t.simpleFieldType=y.STRING;break;case"date":t.simpleFieldType=y.DATE;break;case"timestamp-offset":t.simpleFieldType=y.TIMESTAMP_OFFSET;break;case"date-only":t.simpleFieldType=y.DATE_ONLY;break;case"time-only":t.simpleFieldType=y.TIME_ONLY;break;case"oid":t.simpleFieldType=y.OID;break;case"guid":case"global-id":t.simpleFieldType=y.GUID;break;case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":t.simpleFieldType=y.NUMBER}}(l),l.simpleFieldType&&(i=l)})),i}(this.props),"scene"===_.type&&s.request.interceptors?.push({urls:`${w(_)}/${_.layerId}`,before(t){t.requestOptions.authMode="no-prompt"}}),this.oneFeatureResponseStatus=v.IN_PROGRESS;try{const t=await async function(t){const{view:s,layer:e}=t;if("imagery"===e.type||"imagery-tile"===e.type)throw new Error("could not get feature");if("feature"===e.type&&!e.url||"wfs"===e.type){const t=e.createQuery();t.start=0,t.num=5,t.outFields=["*"];const s=await e.queryFeatures(t);if(s.features?.length)return s;throw new Error("could not get feature")}{if(!s)return b(t);const i=await s.whenLayerView(e);if(i.availableFields.length===e.fields.length||["stream","ogc-feature"].indexOf(e.type)>-1&&i.availableFields.length>0){const s=e.createQuery();s.start=0,s.num=5,s.outFields=["*"];const n=await i.queryFeatures(s);return n.features?.length?n:b(t)}return b(t)}}(this.props);this.oneFeatureResponse=t,this.oneFeatureResponseStatus=v.SUCCESS}catch(t){this.oneFeatureResponseStatus=v.FAILED}if("stream"===_.type)return this.uniqueValuesStatus=v.FAILED,void(this.statisticsStatus=v.FAILED);if(k)this.uniqueValuesStatus=v.FAILED;else{this.uniqueValuesStatus=v.IN_PROGRESS;try{const t=await async function(t){const{layer:s,view:e,fieldName:i,modules:n}=t;if("imagery"===s.type||"imagery-tile"===s.type)throw new Error("could not get unique values for ImageryLayer/ImageryTileLayer");"feature"!==s.type||s.url||(s.outFields=["*"]);try{return await n.uniqueValues({layer:s,view:e,field:i})}catch(t){throw new Error("could not get unique values")}}(this.props);this.uniqueValues=t,this.uniqueValuesStatus=t?.uniqueValueInfos?.length?v.SUCCESS:v.FAILED}catch(t){this.uniqueValuesStatus=v.FAILED}}if(k)this.statisticsStatus=v.FAILED;else{this.statisticsStatus=v.IN_PROGRESS;try{const t=await async function(t){const{layer:s,view:e,fieldName:i,fieldInfo:n,modules:r}=t;if("imagery"===s.type||"imagery-tile"===s.type)throw new Error("could not get statistics for ImageryLayer/ImageryTileLayer");if(!n||"oid"===n.layerField.type||"guid"===n.layerField.type||"global-id"===n.layerField.type){const s=await S(t);return Promise.resolve({totalCount:s,nullcount:0})}try{const n=await r.summaryStatistics({layer:s,view:e,field:i});if(!p(n.count))throw new Error("could not get statistics");const a="sourceJSON"in s&&s.sourceJSON.maxRecordCount===n.count;if(p(n.nullcount)&&!a)return{...n,totalCount:n.count+n.nullcount};{const s=await S(t);return{...n,totalCount:s}}}catch(t){throw new Error("could not get statistics")}}(this.props);if(!p(t.totalCount)&&p(t.count)&&this.uniqueValuesStatus===v.SUCCESS){const s=this.uniqueValues.uniqueValueInfos;for(let e=0;e<s.length;e+=1){const i=s[e];if(null===i.value){t.totalCount=i.count+t.count;break}}p(t.totalCount)||(t.totalCount=t.count)}this.statistics=t,this.statisticsStatus=v.SUCCESS}catch(t){this.statisticsStatus=v.FAILED}}}async componentDidLoad(){const{props:t}=this,{modules:s}=t;s.intl.setLocale(this._lang)}disconnectedCallback(){m(this)}render(){const{props:t}=this,{fieldInfo:s}=t;return s?i(n,null,i("div",{class:"container"},this.renderFieldType(),this.renderFieldAlias(),this.renderFieldDescription(),this.renderFieldValueType(),this.renderFieldSampleValue(),this.renderFieldFormat(),this.renderFieldStatistics())):i(a,null)}renderFieldType(){const{_t9nStrings:t,props:s}=this,{fieldInfo:e}=s,n=this._getFieldTypeLabel(e.layerField.type);return i("div",{class:"section"},i("div",{class:"title"},t.fieldType),i("div",null,n))}renderFieldAlias(){const{_t9nStrings:t,props:s}=this,{fieldInfo:e}=s;return i("div",{class:"section"},i("div",{class:"title"},t.fieldAlias),i("div",null,e.label))}renderFieldDescription(){const{_t9nStrings:t,props:s}=this,{layer:e}=s;if("feature"!==e.type)return i(a,null);const{fieldInfo:n}=s,r=n.layerField.description;return i("div",{class:"section"},i("div",{class:"title"},t.fieldDescription),i("div",{class:{missing:!r}},r||t.fieldDescriptionNotSet))}renderFieldValueType(){const{_t9nStrings:t,props:s}=this,{layer:e}=s;if("feature"!==e.type)return i(a,null);const{fieldInfo:n}=s,r=this._getFieldValueTypeCamelCase(n);return i("div",{class:"section"},i("div",{class:"title"},t.fieldValueType),i("div",{class:r?"":"missing"},r?t.fieldValueTypes[r]:t.fieldValueTypeNotSet))}renderFieldSampleValue(){const{oneFeatureResponse:t,oneFeatureResponseStatus:s,statisticsStatus:e,statistics:n,uniqueValuesStatus:r,uniqueValues:l,_t9nStrings:o,props:c}=this,{layer:u,fieldName:d,fieldInfo:h}=c,{statistics:f}=o;let g;if(["imagery","imagery-tile"].indexOf(u.type)>-1)return i(a,null);if("stream"!==u.type&&[y.STRING,y.OID,y.GUID].indexOf(this._getStatisticsType(h))>-1&&r!==v.FAILED)return i(a,null);s===v.SUCCESS?t.features.forEach((t=>{(void 0===g||null===g&&null!==t.attributes[d])&&(g=t.attributes[d])})):e===v.SUCCESS?g=n.min:r===v.SUCCESS&&(g=l.uniqueValueInfos?.[0]?.value||l.uniqueValueInfos?.[1]?.value);const m=h.codedValues;return p(g)&&(g=m?m.find((t=>g===t.code))?.name||g:this._getDisplayString(g)),i("div",{class:"section"},i("div",{class:"title"},o.fieldSampleValue),i("div",{class:s===v.FAILED&&e===v.FAILED&&r===v.FAILED||!p(g)?"missing":""},s===v.SUCCESS||e===v.SUCCESS||r===v.SUCCESS?p(g)?`${g}`:f.allNulls:s===v.FAILED&&e===v.FAILED&&r===v.FAILED?o.fieldSampleNotAvailable:o.fieldSampleRetrieving))}renderFieldFormat(){const{_t9nStrings:t,props:s}=this,{fieldName:e,fieldInfo:n,layer:r}=s;if(-1===["single","double","long"].indexOf(n.layerField.type))return i(a,null);const l=r.popupTemplate;if(l?.fieldInfos){const s=l.fieldInfos?.filter((t=>t.fieldName===e));if(s?.length){const e=s[0];if(p(e?.format?.places)){const s=e.format.places;return i("div",{class:"section"},i("div",{class:"title"},t.fieldDecimalPlaces),i("div",null,t.fieldNumDecimalPlaces.replace("${number}",s.toString())))}}}return i("div",{class:"section"},i("div",{class:"title"},t.fieldDecimalPlaces),i("div",{class:"missing"},t.fieldDecimalPlacesNotAvailable))}renderFieldStatistics(){const{statisticsStatus:t,uniqueValuesStatus:s,hideStatistics:e,_t9nStrings:n,props:r}=this,{layer:l,fieldInfo:o}=r;return e||["stream","imagery","imagery-tile"].indexOf(l.type)>-1||["long"].indexOf(o.layerField.type)>-1?(this.arcgisFieldInfoComplete.emit(),i(a,null)):i("div",{class:"section"},i("div",{class:"title"},n.fieldStatistics),t&&t!==v.MISSING&&t!==v.IN_PROGRESS?t===v.FAILED&&s!==v.SUCCESS?this.renderNoStatistics():i("div",{key:"field-info-statistics-content",ref:()=>this.arcgisFieldInfoComplete.emit()},this.renderStatistics()):i("div",{key:"field-info-statistics-content",class:"missing"},n.fieldStatisticsRetrieving))}renderNoStatistics(){const{_t9nStrings:t}=this;return i("div",{key:"field-info-statistics-content",ref:()=>this.arcgisFieldInfoComplete.emit(),class:"missing"},t.fieldStatisticsNotAvailable)}renderStatistics(){const{props:t}=this,{fieldInfo:s}=t;switch(this._getStatisticsType(s)){case y.NUMBER:return this.renderNumberStatistics();case y.STRING:case y.OID:case y.GUID:return this.renderStringStatistics();case y.DATE:case y.DATE_ONLY:case y.TIME_ONLY:case y.TIMESTAMP_OFFSET:return this.renderDateStatistics();default:return i(a,null)}}renderNumberStatistics(){const{statistics:t,_t9nStrings:s}=this;if(!t)return this.renderNoStatistics();const{statistics:e}=s;return i("div",null,i("div",{class:"statistics-row"},i("div",null,e.numberOfValues),i("div",{class:"data"},this._printNumValue(t.totalCount))),p(t.sum)?i("div",{class:"statistics-row"},i("div",null,e.sumOfValues),i("div",{class:"data"},this._printNumValue(t.sum))):null,p(t.min)?i("div",{class:"statistics-row"},i("div",null,e.minimum),i("div",{class:"data"},this._printNumValue(t.min))):null,p(t.max)?i("div",{class:"statistics-row"},i("div",null,e.maximum),i("div",{class:"data"},this._printNumValue(t.max))):null,p(t.avg)?i("div",{class:"statistics-row"},i("div",null,e.average),i("div",{class:"data"},this._printNumValue(t.avg))):null,p(t.stddev)?i("div",{class:"statistics-row"},i("div",null,e.standardDeviation),i("div",{class:"data"},this._printNumValue(t.stddev))):null,this.renderNullValues())}renderStringStatistics(){const{statistics:t,uniqueValuesStatus:s,_t9nStrings:e}=this,{statistics:n}=e;return i("div",null,i("div",{class:"statistics-row"},i("div",null,n.numberOfValues),s!==v.SUCCESS?i("div",{class:"missing"},"--"):i("div",{class:"data"},this._printNumValue(t?.totalCount))),this.renderNullValues(),this.renderTopValues())}renderDateStatistics(){const{statistics:t,view:s,props:e,_t9nStrings:n}=this,{fieldInfo:r}=e;if(!t)return this.renderNoStatistics();const{statistics:a}=n,l=t.max-t.min,o=Math.floor(l/31536e6);let c=Math.floor((l-31536e6*o)/2628e6),u=Math.ceil((l-2628e6*c)/864e5);u>=30&&(c+=1,u=0);let d=1===o?a.timeSpanOptions.year:o>1?a.timeSpanOptions.years.replace("${years}",o.toString()):"";d+=o>0&&(c>0||u>0)?", ":"",d+=1===c?a.timeSpanOptions.month:c>1?a.timeSpanOptions.months.replace("${months}",c.toString()):"",d+=c>0&&u>0?", ":"",d+=1===u?a.timeSpanOptions.day:u>1?a.timeSpanOptions.days.replace("${days}",u.toString()):"";const h=r.simpleFieldType!==y.TIMESTAMP_OFFSET||!s||"unknown"!==s.timeZone,f=r.simpleFieldType===y.TIME_ONLY;return i("div",null,i("div",{class:"statistics-row"},i("div",null,a.numberOfValues),i("div",{class:"data"},this._printNumValue(t?.totalCount))),h&&p(t.min)?i("div",{class:"statistics-row"},i("div",null,f?a.minimumTime:a.minimumDate),i("div",{class:"data"},`${this._getDisplayString(t.min)}`)):null,h&&p(t.max)?i("div",{class:"statistics-row"},i("div",null,f?a.maximumTime:a.maximumDate),i("div",{class:"data"},`${this._getDisplayString(t.max)}`)):null,h&&p(t.avg)?i("div",{class:"statistics-row"},i("div",null,f?a.averageTime:a.averageDate),i("div",{class:"data"},`${this._getDisplayString(t.avg)}`)):null,h&&!f&&p(t.min)&&p(t.max)&&l>0?i("div",{class:"statistics-row"},i("div",null,a.timespan),i("div",{class:"data"},d)):null,this.renderNullValues())}renderTopValues(){const{uniqueValues:t,uniqueValuesStatus:s,_t9nStrings:e,props:n}=this,{fieldInfo:r}=n,{statistics:l}=e;if(t?.uniqueValueInfos?.length){const s=t.uniqueValueInfos;s.sort(((t,s)=>t.count<s.count?1:t.count>s.count?-1:0));const e=r.codedValues,n=s.filter((t=>null!==t.value)).filter(((t,s)=>t&&s<10)).map((t=>{let s=t.value;return e?e.forEach((t=>{s===t.code&&(s=t.name)})):s=this._getDisplayString(s),i("div",{class:"statistics-row"},i("div",{class:"data"},`${s}`),i("div",{class:'$"data" $"count"'},this._printNumValue(t.count)))}));return n.length?i("div",null,i("div",{class:"statistics-row-top-values"},i("div",null,s.length>10?l.topTenValues:l.topValues),i("div",null,l.count)),n):i(a,null)}return i("div",null,i("div",{class:"statistics-row-top-values"},i("div",null,l.topValues),i("div",null,l.count)),i("div",{class:"statistics-row"},i("div",{class:"missing"},s===v.FAILED?e.fieldUniqueValuesNotAvailable:e.fieldSampleRetrieving)))}renderNullValues(){const{statistics:t,uniqueValues:s,_t9nStrings:e}=this,{statistics:n}=e;let r=t?.nullcount;if(!p(r)&&s){const t=s.uniqueValueInfos;for(let s=0;s<t.length;s+=1){const e=t[s];if(null===e.value){r=e.count;break}}}return i("div",{class:"statistics-row"},i("div",null,n.numberOfNulls),p(r)?i("div",{class:"data"},`${Number.parseInt(r).toLocaleString()}`):i("div",{class:"missing"},"--"))}_getFieldTypeLabel(t){const{_t9nStrings:s}=this,e=s.fieldTypes;switch(t){case"small-integer":return e.smallInteger;case"big-integer":return e.bigInteger;case"integer":return e.integer;case"single":return e.single;case"double":return e.double;case"long":return e.long;case"string":default:return e.string;case"date":return e.date;case"date-only":return e.dateOnly;case"time-only":return e.timeOnly;case"timestamp-offset":return e.timestampOffset;case"oid":return e.oid;case"guid":return e.guid;case"global-id":return e.globalId}}_getStatisticsType(t){switch(t.layerField.type){case"small-integer":case"big-integer":case"integer":case"single":case"double":if(t.codedValues)return y.STRING;switch(t.layerField.valueType){case"name-or-title":case"type-or-category":case"description":case"location-or-place-name":case"ordered-or-ranked":case"binary":return y.STRING;default:return y.NUMBER}case"string":return y.STRING;case"date":return y.DATE;case"timestamp-offset":return y.TIMESTAMP_OFFSET;case"date-only":return y.DATE_ONLY;case"time-only":return y.TIME_ONLY;default:return y.STRING}}_getFieldValueTypeCamelCase(t){switch(t.layerField.valueType){case"count-or-amount":return"countOrAmount";case"percentage-or-ratio":return"percentageOrRatio";case"unique-identifier":return"uniqueIdentifier";case"name-or-title":return"nameOrTitle";case"type-or-category":return"typeOrCategory";case"location-or-place-name":return"locationOrPlaceName";case"ordered-or-ranked":return"orderedOrRanked";case"date-and-time":return"dateAndTime";default:return t.layerField.valueType}}_getDisplayString(t){const{props:s}=this,{fieldInfo:e}=s;switch(e.simpleFieldType){case y.DATE:return this._getDateString(t);case y.TIMESTAMP_OFFSET:return this._getTimestampOffsetString(t);case y.DATE_ONLY:return this._getDateOnlyString(t);case y.TIME_ONLY:return this._getTimeOnlyString(t);case y.NUMBER:return this._getNumberString(t);case y.GUID:return this._getGuidString(t);default:return`${t}`}}_getDateString(t){const{modules:s,view:e}=this.props;return s.intl.formatDate(t,e&&"unknown"===e.timeZone?{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}:{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:e?.timeZone||"system"})}_getTimestampOffsetString(t){const{modules:s,view:e}=this.props;return"string"==typeof t?s.intl.formatTimestamp(t,e&&"unknown"===e.timeZone?{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}:{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:e?.timeZone||"system"}):this._getDateString(t)}_getDateOnlyString(t){const{props:s}=this,{modules:e}=s;return e.intl.formatDateOnly(t,e.intl.convertDateFormatToIntlOptions("short-date"))}_getTimeOnlyString(t){const{props:s}=this,{modules:e}=s;return"string"==typeof t?e.intl.formatTimeOnly(t,e.intl.convertDateFormatToIntlOptions("short-date-long-time")):e.intl.formatDate(t,{...e.intl.convertDateFormatToIntlOptions("long-time"),timeZone:"utc"})}_getGuidString(t){return t.startsWith("{")?t:`{${t}}`}_getNumberString(t){return this.props.modules.intl.formatNumber(t)}_printNumValue(t){return p(t)?this._getNumberString(Math.round(100*t)/100):"--"}static get assetsDirs(){return["assets"]}get _hostElement(){return r(this)}};_.style=":host{height:100%}.container{padding:6px;background-color:white}.title{font-weight:bold;padding:5px 0}.missing{color:#a9a9a9}.data{color:#a9a9a9}.count{white-space:nowrap}.section{padding:6px 0}.statistics-row{border-top:1px solid #e0e0e0;padding:6px 0;display:flex;justify-content:space-between}.statistics-row-top-values{border-top:1px solid #e0e0e0;padding:20px 0 6px 0;display:flex;justify-content:space-between}";export{_ as arcgis_field_info}
|
|
@@ -63,13 +63,13 @@ function getFieldInfo(props) {
|
|
|
63
63
|
? popupFieldInfos.filter((fInfo) => fInfo.fieldName === layerField.name)
|
|
64
64
|
: null;
|
|
65
65
|
const label = list?.length ? list[0].label : null;
|
|
66
|
-
if (/^raster.(item|service)pixelvalue/
|
|
66
|
+
if (/^raster.(item|service)pixelvalue/iu.test(fieldName)) {
|
|
67
67
|
// e.g. "Raster.ServicePixelValue" | "Raster.ItemPixelValue" | "Raster.ServicePixelValue.Raw"
|
|
68
68
|
// layer.rasterFields reports them as type "string"
|
|
69
69
|
layerField.type = "double";
|
|
70
70
|
}
|
|
71
71
|
const featureFilterField = {
|
|
72
|
-
layerField
|
|
72
|
+
layerField,
|
|
73
73
|
label: label || layerField.alias || layerField.name
|
|
74
74
|
};
|
|
75
75
|
featureFilterField.codedValues = getCodedValues(fieldName, props);
|
|
@@ -215,13 +215,12 @@ function getCodedValues(fieldName, props) {
|
|
|
215
215
|
// layer has types
|
|
216
216
|
if (typeIdField === fieldName) {
|
|
217
217
|
// this is the field with the types
|
|
218
|
-
fieldDomains = types.map((type) =>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
});
|
|
218
|
+
fieldDomains = types.map((type) =>
|
|
219
|
+
// fake coded Values
|
|
220
|
+
({
|
|
221
|
+
code: type.id,
|
|
222
|
+
name: type.name
|
|
223
|
+
}));
|
|
225
224
|
}
|
|
226
225
|
else {
|
|
227
226
|
// field does not have types; look farther inside the types
|
|
@@ -426,7 +425,8 @@ const ArcgisFieldInfo = class {
|
|
|
426
425
|
// need to create a FeatureLayer
|
|
427
426
|
const sublayer = layer;
|
|
428
427
|
const { whenOnce } = await index$1.importCoreReactiveUtils();
|
|
429
|
-
|
|
428
|
+
if (view)
|
|
429
|
+
await whenOnce(() => !view.updating);
|
|
430
430
|
sublayerFL = await sublayer.createFeatureLayer();
|
|
431
431
|
await sublayerFL.load();
|
|
432
432
|
}
|
|
@@ -443,8 +443,8 @@ const ArcgisFieldInfo = class {
|
|
|
443
443
|
// don't prompt for a login if it's not accessible
|
|
444
444
|
if (layer.type === "scene") {
|
|
445
445
|
esriConfig.request.interceptors?.push({
|
|
446
|
-
urls: getQueryURL(layer)
|
|
447
|
-
before
|
|
446
|
+
urls: `${getQueryURL(layer)}/${layer.layerId}`,
|
|
447
|
+
before(params) {
|
|
448
448
|
params.requestOptions.authMode = "no-prompt";
|
|
449
449
|
}
|
|
450
450
|
});
|
|
@@ -494,7 +494,7 @@ const ArcgisFieldInfo = class {
|
|
|
494
494
|
this.uniqueValuesStatus === Status.SUCCESS) {
|
|
495
495
|
// take null values count from unique values and add with non-null count from statistics
|
|
496
496
|
const infos = this.uniqueValues.uniqueValueInfos;
|
|
497
|
-
for (let i = 0; i < infos.length; i
|
|
497
|
+
for (let i = 0; i < infos.length; i += 1) {
|
|
498
498
|
const info = infos[i];
|
|
499
499
|
if (info.value === null) {
|
|
500
500
|
statistics.totalCount = info.count + statistics.count;
|
|
@@ -641,7 +641,9 @@ const ArcgisFieldInfo = class {
|
|
|
641
641
|
const popFieldInfo = popFieldInfos[0];
|
|
642
642
|
if (isDefined(popFieldInfo?.format?.places)) {
|
|
643
643
|
const num = popFieldInfo.format.places;
|
|
644
|
-
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), index.h("div", null,
|
|
644
|
+
return (index.h("div", { class: "section" }, index.h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), index.h("div", null,
|
|
645
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
646
|
+
_t9nStrings.fieldNumDecimalPlaces.replace("${number}", num.toString()))));
|
|
645
647
|
}
|
|
646
648
|
}
|
|
647
649
|
}
|
|
@@ -717,21 +719,24 @@ const ArcgisFieldInfo = class {
|
|
|
717
719
|
let timeSpan = years === 1
|
|
718
720
|
? statStrings.timeSpanOptions.year
|
|
719
721
|
: years > 1
|
|
720
|
-
?
|
|
722
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
723
|
+
statStrings.timeSpanOptions.years.replace("${years}", years.toString())
|
|
721
724
|
: "";
|
|
722
725
|
timeSpan += years > 0 && (months > 0 || days > 0) ? ", " : "";
|
|
723
726
|
timeSpan +=
|
|
724
727
|
months === 1
|
|
725
728
|
? statStrings.timeSpanOptions.month
|
|
726
729
|
: months > 1
|
|
727
|
-
?
|
|
730
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
731
|
+
statStrings.timeSpanOptions.months.replace("${months}", months.toString())
|
|
728
732
|
: "";
|
|
729
733
|
timeSpan += months > 0 && days > 0 ? ", " : "";
|
|
730
734
|
timeSpan +=
|
|
731
735
|
days === 1
|
|
732
736
|
? statStrings.timeSpanOptions.day
|
|
733
737
|
: days > 1
|
|
734
|
-
?
|
|
738
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
739
|
+
statStrings.timeSpanOptions.days.replace("${days}", days.toString())
|
|
735
740
|
: "";
|
|
736
741
|
const showStats = fieldInfo.simpleFieldType !== SimpleFieldTypes.TIMESTAMP_OFFSET ||
|
|
737
742
|
!view ||
|
|
@@ -781,7 +786,7 @@ const ArcgisFieldInfo = class {
|
|
|
781
786
|
let count = statistics?.nullcount;
|
|
782
787
|
if (!isDefined(count) && uniqueValues) {
|
|
783
788
|
const infos = uniqueValues.uniqueValueInfos;
|
|
784
|
-
for (let i = 0; i < infos.length; i
|
|
789
|
+
for (let i = 0; i < infos.length; i += 1) {
|
|
785
790
|
const info = infos[i];
|
|
786
791
|
if (info.value === null) {
|
|
787
792
|
count = info.count;
|
|
@@ -789,7 +794,7 @@ const ArcgisFieldInfo = class {
|
|
|
789
794
|
}
|
|
790
795
|
}
|
|
791
796
|
}
|
|
792
|
-
return (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfNulls), !isDefined(count) ? (index.h("div", { class: "missing" }, "--")) : (index.h("div", { class: "data" }, `${
|
|
797
|
+
return (index.h("div", { class: "statistics-row" }, index.h("div", null, statStrings.numberOfNulls), !isDefined(count) ? (index.h("div", { class: "missing" }, "--")) : (index.h("div", { class: "data" }, `${Number.parseInt(count).toLocaleString()}`))));
|
|
793
798
|
}
|
|
794
799
|
// --------------------------------------------------------------------------
|
|
795
800
|
//
|
|
@@ -153,11 +153,7 @@ const ArcgisFieldPickList = class {
|
|
|
153
153
|
}
|
|
154
154
|
// check if filter has all current field info
|
|
155
155
|
filterContainsAll() {
|
|
156
|
-
return !!this.filterFields?.every((filter) =>
|
|
157
|
-
return this.selectedFields.some((curr) => {
|
|
158
|
-
return curr === filter;
|
|
159
|
-
});
|
|
160
|
-
});
|
|
156
|
+
return !!this.filterFields?.every((filter) => this.selectedFields.some((curr) => curr === filter));
|
|
161
157
|
}
|
|
162
158
|
// --------------------------------------------------------------------------
|
|
163
159
|
//
|
|
@@ -197,9 +193,7 @@ const ArcgisFieldPickList = class {
|
|
|
197
193
|
//select all
|
|
198
194
|
this.selectedFields = this.filterFields?.length
|
|
199
195
|
? [...new Set([...this.selectedFields, ...this.filterFields])]
|
|
200
|
-
: this.fields.map((field) =>
|
|
201
|
-
return field.name;
|
|
202
|
-
});
|
|
196
|
+
: this.fields.map((field) => field.name);
|
|
203
197
|
}
|
|
204
198
|
} }, this.selectDeselect() ? this._t9nStrings.deselectAll : this._t9nStrings.selectAll)));
|
|
205
199
|
return (index.h(index.Host, { class: "js-app-flyout" }, index.h("calcite-popover", { dir: index$1.C(this._hostElement), class: "popover", placement: this.popoverProps.placement || "leading-start", open: false, pointerDisabled: true, referenceElement: this.popoverProps.refElement, offsetDistance: this.popoverProps.offsetDistance || -Math.round(this.popoverProps.refElement.getBoundingClientRect().width), offsetSkidding: this.popoverProps.offsetSkidding || 0, overlayPositioning: this.popoverProps.overlayPositioning, triggerDisabled: this.popoverProps.triggerDisabled, autoClose: this.popoverProps.autoClose, label: this.heading || (this.multiple ? this._t9nStrings.headerSelect : this._t9nStrings.header), onCalcitePopoverClose: () => this.arcgisFieldPickListDismissed.emit(), ref: (node) => (this.popoverNode = node) }, index.h("calcite-flow", { ref: (node) => {
|
|
@@ -208,14 +202,12 @@ const ArcgisFieldPickList = class {
|
|
|
208
202
|
width: `${this.popoverProps.popoverWidth || this.popoverProps.refElement.getBoundingClientRect().width}px`
|
|
209
203
|
} }, index.h("calcite-flow-item", { ref: (el) => (this.panelElement = el), class: "panel", heading: this.heading || (this.multiple ? this._t9nStrings.headerSelect : this._t9nStrings.header), closable: true, onCalciteFlowItemClose: () => this.arcgisFieldPickListDismissed.emit() }, this.multiple && addBtn, this.showCancel && cancelBtn, index.h("calcite-pick-list", { multiple: this.multiple, ref: (node) => {
|
|
210
204
|
this.pickListNode = node;
|
|
211
|
-
}, class: "content", filterEnabled: this.fields.length >= this.showFilterLength
|
|
205
|
+
}, class: "content", filterEnabled: this.fields.length >= this.showFilterLength, filterPlaceholder: this.filterPlaceholderText ?? this._t9nStrings.filter, onCalciteListChange: async () => {
|
|
212
206
|
// keep original order. Add addional values at the end
|
|
213
207
|
const tempSelectedFields = await this.pickListNode.getSelectedItems();
|
|
214
208
|
this.selectedFields = [
|
|
215
209
|
...new Set([
|
|
216
|
-
...this.selectedFields.filter((item) =>
|
|
217
|
-
return tempSelectedFields.has(item);
|
|
218
|
-
}),
|
|
210
|
+
...this.selectedFields.filter((item) => tempSelectedFields.has(item)),
|
|
219
211
|
...tempSelectedFields.keys()
|
|
220
212
|
])
|
|
221
213
|
];
|
|
@@ -226,12 +218,8 @@ const ArcgisFieldPickList = class {
|
|
|
226
218
|
}, onCalciteListFilter: (event) => {
|
|
227
219
|
event.stopPropagation();
|
|
228
220
|
const node = event.target;
|
|
229
|
-
this.filterFields = node.filteredItems?.map((item) =>
|
|
230
|
-
|
|
231
|
-
});
|
|
232
|
-
} }, this.fields.length >= this.showFilterLength && this.showSort && sort, this.multiple && this.showSelectionAll && selectionBtn, [...this.getSortedList()].map((field) => {
|
|
233
|
-
return this.calciteValueList(field);
|
|
234
|
-
})))))));
|
|
221
|
+
this.filterFields = node.filteredItems?.map((item) => item.value);
|
|
222
|
+
} }, this.fields.length >= this.showFilterLength && this.showSort && sort, this.multiple && this.showSelectionAll && selectionBtn, [...this.getSortedList()].map((field) => this.calciteValueList(field))))))));
|
|
235
223
|
}
|
|
236
224
|
// --------------------------------------------------------------------------
|
|
237
225
|
//
|
|
@@ -162,11 +162,7 @@ const ArcgisFieldPickList$1 = /*@__PURE__*/ proxyCustomElement(class ArcgisField
|
|
|
162
162
|
}
|
|
163
163
|
// check if filter has all current field info
|
|
164
164
|
filterContainsAll() {
|
|
165
|
-
return !!this.filterFields?.every((filter) =>
|
|
166
|
-
return this.selectedFields.some((curr) => {
|
|
167
|
-
return curr === filter;
|
|
168
|
-
});
|
|
169
|
-
});
|
|
165
|
+
return !!this.filterFields?.every((filter) => this.selectedFields.some((curr) => curr === filter));
|
|
170
166
|
}
|
|
171
167
|
// --------------------------------------------------------------------------
|
|
172
168
|
//
|
|
@@ -206,9 +202,7 @@ const ArcgisFieldPickList$1 = /*@__PURE__*/ proxyCustomElement(class ArcgisField
|
|
|
206
202
|
//select all
|
|
207
203
|
this.selectedFields = this.filterFields?.length
|
|
208
204
|
? [...new Set([...this.selectedFields, ...this.filterFields])]
|
|
209
|
-
: this.fields.map((field) =>
|
|
210
|
-
return field.name;
|
|
211
|
-
});
|
|
205
|
+
: this.fields.map((field) => field.name);
|
|
212
206
|
}
|
|
213
207
|
} }, this.selectDeselect() ? this._t9nStrings.deselectAll : this._t9nStrings.selectAll)));
|
|
214
208
|
return (h(Host, { class: "js-app-flyout" }, h("calcite-popover", { dir: C(this._hostElement), class: "popover", placement: this.popoverProps.placement || "leading-start", open: false, pointerDisabled: true, referenceElement: this.popoverProps.refElement, offsetDistance: this.popoverProps.offsetDistance || -Math.round(this.popoverProps.refElement.getBoundingClientRect().width), offsetSkidding: this.popoverProps.offsetSkidding || 0, overlayPositioning: this.popoverProps.overlayPositioning, triggerDisabled: this.popoverProps.triggerDisabled, autoClose: this.popoverProps.autoClose, label: this.heading || (this.multiple ? this._t9nStrings.headerSelect : this._t9nStrings.header), onCalcitePopoverClose: () => this.arcgisFieldPickListDismissed.emit(), ref: (node) => (this.popoverNode = node) }, h("calcite-flow", { ref: (node) => {
|
|
@@ -217,14 +211,12 @@ const ArcgisFieldPickList$1 = /*@__PURE__*/ proxyCustomElement(class ArcgisField
|
|
|
217
211
|
width: `${this.popoverProps.popoverWidth || this.popoverProps.refElement.getBoundingClientRect().width}px`
|
|
218
212
|
} }, h("calcite-flow-item", { ref: (el) => (this.panelElement = el), class: "panel", heading: this.heading || (this.multiple ? this._t9nStrings.headerSelect : this._t9nStrings.header), closable: true, onCalciteFlowItemClose: () => this.arcgisFieldPickListDismissed.emit() }, this.multiple && addBtn, this.showCancel && cancelBtn, h("calcite-pick-list", { multiple: this.multiple, ref: (node) => {
|
|
219
213
|
this.pickListNode = node;
|
|
220
|
-
}, class: "content", filterEnabled: this.fields.length >= this.showFilterLength
|
|
214
|
+
}, class: "content", filterEnabled: this.fields.length >= this.showFilterLength, filterPlaceholder: this.filterPlaceholderText ?? this._t9nStrings.filter, onCalciteListChange: async () => {
|
|
221
215
|
// keep original order. Add addional values at the end
|
|
222
216
|
const tempSelectedFields = await this.pickListNode.getSelectedItems();
|
|
223
217
|
this.selectedFields = [
|
|
224
218
|
...new Set([
|
|
225
|
-
...this.selectedFields.filter((item) =>
|
|
226
|
-
return tempSelectedFields.has(item);
|
|
227
|
-
}),
|
|
219
|
+
...this.selectedFields.filter((item) => tempSelectedFields.has(item)),
|
|
228
220
|
...tempSelectedFields.keys()
|
|
229
221
|
])
|
|
230
222
|
];
|
|
@@ -235,12 +227,8 @@ const ArcgisFieldPickList$1 = /*@__PURE__*/ proxyCustomElement(class ArcgisField
|
|
|
235
227
|
}, onCalciteListFilter: (event) => {
|
|
236
228
|
event.stopPropagation();
|
|
237
229
|
const node = event.target;
|
|
238
|
-
this.filterFields = node.filteredItems?.map((item) =>
|
|
239
|
-
|
|
240
|
-
});
|
|
241
|
-
} }, this.fields.length >= this.showFilterLength && this.showSort && sort, this.multiple && this.showSelectionAll && selectionBtn, [...this.getSortedList()].map((field) => {
|
|
242
|
-
return this.calciteValueList(field);
|
|
243
|
-
})))))));
|
|
230
|
+
this.filterFields = node.filteredItems?.map((item) => item.value);
|
|
231
|
+
} }, this.fields.length >= this.showFilterLength && this.showSort && sort, this.multiple && this.showSelectionAll && selectionBtn, [...this.getSortedList()].map((field) => this.calciteValueList(field))))))));
|
|
244
232
|
}
|
|
245
233
|
// --------------------------------------------------------------------------
|
|
246
234
|
//
|
|
@@ -116,13 +116,13 @@ function getFieldInfo(props) {
|
|
|
116
116
|
? popupFieldInfos.filter((fInfo) => fInfo.fieldName === layerField.name)
|
|
117
117
|
: null;
|
|
118
118
|
const label = list?.length ? list[0].label : null;
|
|
119
|
-
if (/^raster.(item|service)pixelvalue/
|
|
119
|
+
if (/^raster.(item|service)pixelvalue/iu.test(fieldName)) {
|
|
120
120
|
// e.g. "Raster.ServicePixelValue" | "Raster.ItemPixelValue" | "Raster.ServicePixelValue.Raw"
|
|
121
121
|
// layer.rasterFields reports them as type "string"
|
|
122
122
|
layerField.type = "double";
|
|
123
123
|
}
|
|
124
124
|
const featureFilterField = {
|
|
125
|
-
layerField
|
|
125
|
+
layerField,
|
|
126
126
|
label: label || layerField.alias || layerField.name
|
|
127
127
|
};
|
|
128
128
|
featureFilterField.codedValues = getCodedValues(fieldName, props);
|
|
@@ -268,13 +268,12 @@ function getCodedValues(fieldName, props) {
|
|
|
268
268
|
// layer has types
|
|
269
269
|
if (typeIdField === fieldName) {
|
|
270
270
|
// this is the field with the types
|
|
271
|
-
fieldDomains = types.map((type) =>
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
271
|
+
fieldDomains = types.map((type) =>
|
|
272
|
+
// fake coded Values
|
|
273
|
+
({
|
|
274
|
+
code: type.id,
|
|
275
|
+
name: type.name
|
|
276
|
+
}));
|
|
278
277
|
}
|
|
279
278
|
else {
|
|
280
279
|
// field does not have types; look farther inside the types
|
|
@@ -481,7 +480,8 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
481
480
|
// need to create a FeatureLayer
|
|
482
481
|
const sublayer = layer;
|
|
483
482
|
const { whenOnce } = await importCoreReactiveUtils();
|
|
484
|
-
|
|
483
|
+
if (view)
|
|
484
|
+
await whenOnce(() => !view.updating);
|
|
485
485
|
sublayerFL = await sublayer.createFeatureLayer();
|
|
486
486
|
await sublayerFL.load();
|
|
487
487
|
}
|
|
@@ -498,8 +498,8 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
498
498
|
// don't prompt for a login if it's not accessible
|
|
499
499
|
if (layer.type === "scene") {
|
|
500
500
|
esriConfig.request.interceptors?.push({
|
|
501
|
-
urls: getQueryURL(layer)
|
|
502
|
-
before
|
|
501
|
+
urls: `${getQueryURL(layer)}/${layer.layerId}`,
|
|
502
|
+
before(params) {
|
|
503
503
|
params.requestOptions.authMode = "no-prompt";
|
|
504
504
|
}
|
|
505
505
|
});
|
|
@@ -549,7 +549,7 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
549
549
|
this.uniqueValuesStatus === Status.SUCCESS) {
|
|
550
550
|
// take null values count from unique values and add with non-null count from statistics
|
|
551
551
|
const infos = this.uniqueValues.uniqueValueInfos;
|
|
552
|
-
for (let i = 0; i < infos.length; i
|
|
552
|
+
for (let i = 0; i < infos.length; i += 1) {
|
|
553
553
|
const info = infos[i];
|
|
554
554
|
if (info.value === null) {
|
|
555
555
|
statistics.totalCount = info.count + statistics.count;
|
|
@@ -696,7 +696,9 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
696
696
|
const popFieldInfo = popFieldInfos[0];
|
|
697
697
|
if (isDefined(popFieldInfo?.format?.places)) {
|
|
698
698
|
const num = popFieldInfo.format.places;
|
|
699
|
-
return (h$1("div", { class: "section" }, h$1("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), h$1("div", null,
|
|
699
|
+
return (h$1("div", { class: "section" }, h$1("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), h$1("div", null,
|
|
700
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
701
|
+
_t9nStrings.fieldNumDecimalPlaces.replace("${number}", num.toString()))));
|
|
700
702
|
}
|
|
701
703
|
}
|
|
702
704
|
}
|
|
@@ -772,21 +774,24 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
772
774
|
let timeSpan = years === 1
|
|
773
775
|
? statStrings.timeSpanOptions.year
|
|
774
776
|
: years > 1
|
|
775
|
-
?
|
|
777
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
778
|
+
statStrings.timeSpanOptions.years.replace("${years}", years.toString())
|
|
776
779
|
: "";
|
|
777
780
|
timeSpan += years > 0 && (months > 0 || days > 0) ? ", " : "";
|
|
778
781
|
timeSpan +=
|
|
779
782
|
months === 1
|
|
780
783
|
? statStrings.timeSpanOptions.month
|
|
781
784
|
: months > 1
|
|
782
|
-
?
|
|
785
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
786
|
+
statStrings.timeSpanOptions.months.replace("${months}", months.toString())
|
|
783
787
|
: "";
|
|
784
788
|
timeSpan += months > 0 && days > 0 ? ", " : "";
|
|
785
789
|
timeSpan +=
|
|
786
790
|
days === 1
|
|
787
791
|
? statStrings.timeSpanOptions.day
|
|
788
792
|
: days > 1
|
|
789
|
-
?
|
|
793
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
794
|
+
statStrings.timeSpanOptions.days.replace("${days}", days.toString())
|
|
790
795
|
: "";
|
|
791
796
|
const showStats = fieldInfo.simpleFieldType !== SimpleFieldTypes.TIMESTAMP_OFFSET ||
|
|
792
797
|
!view ||
|
|
@@ -836,7 +841,7 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
836
841
|
let count = statistics?.nullcount;
|
|
837
842
|
if (!isDefined(count) && uniqueValues) {
|
|
838
843
|
const infos = uniqueValues.uniqueValueInfos;
|
|
839
|
-
for (let i = 0; i < infos.length; i
|
|
844
|
+
for (let i = 0; i < infos.length; i += 1) {
|
|
840
845
|
const info = infos[i];
|
|
841
846
|
if (info.value === null) {
|
|
842
847
|
count = info.count;
|
|
@@ -844,7 +849,7 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
844
849
|
}
|
|
845
850
|
}
|
|
846
851
|
}
|
|
847
|
-
return (h$1("div", { class: "statistics-row" }, h$1("div", null, statStrings.numberOfNulls), !isDefined(count) ? (h$1("div", { class: "missing" }, "--")) : (h$1("div", { class: "data" }, `${
|
|
852
|
+
return (h$1("div", { class: "statistics-row" }, h$1("div", null, statStrings.numberOfNulls), !isDefined(count) ? (h$1("div", { class: "missing" }, "--")) : (h$1("div", { class: "data" }, `${Number.parseInt(count).toLocaleString()}`))));
|
|
848
853
|
}
|
|
849
854
|
// --------------------------------------------------------------------------
|
|
850
855
|
//
|
|
@@ -59,13 +59,13 @@ function getFieldInfo(props) {
|
|
|
59
59
|
? popupFieldInfos.filter((fInfo) => fInfo.fieldName === layerField.name)
|
|
60
60
|
: null;
|
|
61
61
|
const label = list?.length ? list[0].label : null;
|
|
62
|
-
if (/^raster.(item|service)pixelvalue/
|
|
62
|
+
if (/^raster.(item|service)pixelvalue/iu.test(fieldName)) {
|
|
63
63
|
// e.g. "Raster.ServicePixelValue" | "Raster.ItemPixelValue" | "Raster.ServicePixelValue.Raw"
|
|
64
64
|
// layer.rasterFields reports them as type "string"
|
|
65
65
|
layerField.type = "double";
|
|
66
66
|
}
|
|
67
67
|
const featureFilterField = {
|
|
68
|
-
layerField
|
|
68
|
+
layerField,
|
|
69
69
|
label: label || layerField.alias || layerField.name
|
|
70
70
|
};
|
|
71
71
|
featureFilterField.codedValues = getCodedValues(fieldName, props);
|
|
@@ -211,13 +211,12 @@ function getCodedValues(fieldName, props) {
|
|
|
211
211
|
// layer has types
|
|
212
212
|
if (typeIdField === fieldName) {
|
|
213
213
|
// this is the field with the types
|
|
214
|
-
fieldDomains = types.map((type) =>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
});
|
|
214
|
+
fieldDomains = types.map((type) =>
|
|
215
|
+
// fake coded Values
|
|
216
|
+
({
|
|
217
|
+
code: type.id,
|
|
218
|
+
name: type.name
|
|
219
|
+
}));
|
|
221
220
|
}
|
|
222
221
|
else {
|
|
223
222
|
// field does not have types; look farther inside the types
|
|
@@ -422,7 +421,8 @@ const ArcgisFieldInfo = class {
|
|
|
422
421
|
// need to create a FeatureLayer
|
|
423
422
|
const sublayer = layer;
|
|
424
423
|
const { whenOnce } = await importCoreReactiveUtils();
|
|
425
|
-
|
|
424
|
+
if (view)
|
|
425
|
+
await whenOnce(() => !view.updating);
|
|
426
426
|
sublayerFL = await sublayer.createFeatureLayer();
|
|
427
427
|
await sublayerFL.load();
|
|
428
428
|
}
|
|
@@ -439,8 +439,8 @@ const ArcgisFieldInfo = class {
|
|
|
439
439
|
// don't prompt for a login if it's not accessible
|
|
440
440
|
if (layer.type === "scene") {
|
|
441
441
|
esriConfig.request.interceptors?.push({
|
|
442
|
-
urls: getQueryURL(layer)
|
|
443
|
-
before
|
|
442
|
+
urls: `${getQueryURL(layer)}/${layer.layerId}`,
|
|
443
|
+
before(params) {
|
|
444
444
|
params.requestOptions.authMode = "no-prompt";
|
|
445
445
|
}
|
|
446
446
|
});
|
|
@@ -490,7 +490,7 @@ const ArcgisFieldInfo = class {
|
|
|
490
490
|
this.uniqueValuesStatus === Status.SUCCESS) {
|
|
491
491
|
// take null values count from unique values and add with non-null count from statistics
|
|
492
492
|
const infos = this.uniqueValues.uniqueValueInfos;
|
|
493
|
-
for (let i = 0; i < infos.length; i
|
|
493
|
+
for (let i = 0; i < infos.length; i += 1) {
|
|
494
494
|
const info = infos[i];
|
|
495
495
|
if (info.value === null) {
|
|
496
496
|
statistics.totalCount = info.count + statistics.count;
|
|
@@ -637,7 +637,9 @@ const ArcgisFieldInfo = class {
|
|
|
637
637
|
const popFieldInfo = popFieldInfos[0];
|
|
638
638
|
if (isDefined(popFieldInfo?.format?.places)) {
|
|
639
639
|
const num = popFieldInfo.format.places;
|
|
640
|
-
return (h("div", { class: "section" }, h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), h("div", null,
|
|
640
|
+
return (h("div", { class: "section" }, h("div", { class: "title" }, _t9nStrings.fieldDecimalPlaces), h("div", null,
|
|
641
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
642
|
+
_t9nStrings.fieldNumDecimalPlaces.replace("${number}", num.toString()))));
|
|
641
643
|
}
|
|
642
644
|
}
|
|
643
645
|
}
|
|
@@ -713,21 +715,24 @@ const ArcgisFieldInfo = class {
|
|
|
713
715
|
let timeSpan = years === 1
|
|
714
716
|
? statStrings.timeSpanOptions.year
|
|
715
717
|
: years > 1
|
|
716
|
-
?
|
|
718
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
719
|
+
statStrings.timeSpanOptions.years.replace("${years}", years.toString())
|
|
717
720
|
: "";
|
|
718
721
|
timeSpan += years > 0 && (months > 0 || days > 0) ? ", " : "";
|
|
719
722
|
timeSpan +=
|
|
720
723
|
months === 1
|
|
721
724
|
? statStrings.timeSpanOptions.month
|
|
722
725
|
: months > 1
|
|
723
|
-
?
|
|
726
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
727
|
+
statStrings.timeSpanOptions.months.replace("${months}", months.toString())
|
|
724
728
|
: "";
|
|
725
729
|
timeSpan += months > 0 && days > 0 ? ", " : "";
|
|
726
730
|
timeSpan +=
|
|
727
731
|
days === 1
|
|
728
732
|
? statStrings.timeSpanOptions.day
|
|
729
733
|
: days > 1
|
|
730
|
-
?
|
|
734
|
+
? // eslint-disable-next-line no-template-curly-in-string
|
|
735
|
+
statStrings.timeSpanOptions.days.replace("${days}", days.toString())
|
|
731
736
|
: "";
|
|
732
737
|
const showStats = fieldInfo.simpleFieldType !== SimpleFieldTypes.TIMESTAMP_OFFSET ||
|
|
733
738
|
!view ||
|
|
@@ -777,7 +782,7 @@ const ArcgisFieldInfo = class {
|
|
|
777
782
|
let count = statistics?.nullcount;
|
|
778
783
|
if (!isDefined(count) && uniqueValues) {
|
|
779
784
|
const infos = uniqueValues.uniqueValueInfos;
|
|
780
|
-
for (let i = 0; i < infos.length; i
|
|
785
|
+
for (let i = 0; i < infos.length; i += 1) {
|
|
781
786
|
const info = infos[i];
|
|
782
787
|
if (info.value === null) {
|
|
783
788
|
count = info.count;
|
|
@@ -785,7 +790,7 @@ const ArcgisFieldInfo = class {
|
|
|
785
790
|
}
|
|
786
791
|
}
|
|
787
792
|
}
|
|
788
|
-
return (h("div", { class: "statistics-row" }, h("div", null, statStrings.numberOfNulls), !isDefined(count) ? (h("div", { class: "missing" }, "--")) : (h("div", { class: "data" }, `${
|
|
793
|
+
return (h("div", { class: "statistics-row" }, h("div", null, statStrings.numberOfNulls), !isDefined(count) ? (h("div", { class: "missing" }, "--")) : (h("div", { class: "data" }, `${Number.parseInt(count).toLocaleString()}`))));
|
|
789
794
|
}
|
|
790
795
|
// --------------------------------------------------------------------------
|
|
791
796
|
//
|
|
@@ -149,11 +149,7 @@ const ArcgisFieldPickList = class {
|
|
|
149
149
|
}
|
|
150
150
|
// check if filter has all current field info
|
|
151
151
|
filterContainsAll() {
|
|
152
|
-
return !!this.filterFields?.every((filter) =>
|
|
153
|
-
return this.selectedFields.some((curr) => {
|
|
154
|
-
return curr === filter;
|
|
155
|
-
});
|
|
156
|
-
});
|
|
152
|
+
return !!this.filterFields?.every((filter) => this.selectedFields.some((curr) => curr === filter));
|
|
157
153
|
}
|
|
158
154
|
// --------------------------------------------------------------------------
|
|
159
155
|
//
|
|
@@ -193,9 +189,7 @@ const ArcgisFieldPickList = class {
|
|
|
193
189
|
//select all
|
|
194
190
|
this.selectedFields = this.filterFields?.length
|
|
195
191
|
? [...new Set([...this.selectedFields, ...this.filterFields])]
|
|
196
|
-
: this.fields.map((field) =>
|
|
197
|
-
return field.name;
|
|
198
|
-
});
|
|
192
|
+
: this.fields.map((field) => field.name);
|
|
199
193
|
}
|
|
200
194
|
} }, this.selectDeselect() ? this._t9nStrings.deselectAll : this._t9nStrings.selectAll)));
|
|
201
195
|
return (h(Host, { class: "js-app-flyout" }, h("calcite-popover", { dir: C(this._hostElement), class: "popover", placement: this.popoverProps.placement || "leading-start", open: false, pointerDisabled: true, referenceElement: this.popoverProps.refElement, offsetDistance: this.popoverProps.offsetDistance || -Math.round(this.popoverProps.refElement.getBoundingClientRect().width), offsetSkidding: this.popoverProps.offsetSkidding || 0, overlayPositioning: this.popoverProps.overlayPositioning, triggerDisabled: this.popoverProps.triggerDisabled, autoClose: this.popoverProps.autoClose, label: this.heading || (this.multiple ? this._t9nStrings.headerSelect : this._t9nStrings.header), onCalcitePopoverClose: () => this.arcgisFieldPickListDismissed.emit(), ref: (node) => (this.popoverNode = node) }, h("calcite-flow", { ref: (node) => {
|
|
@@ -204,14 +198,12 @@ const ArcgisFieldPickList = class {
|
|
|
204
198
|
width: `${this.popoverProps.popoverWidth || this.popoverProps.refElement.getBoundingClientRect().width}px`
|
|
205
199
|
} }, h("calcite-flow-item", { ref: (el) => (this.panelElement = el), class: "panel", heading: this.heading || (this.multiple ? this._t9nStrings.headerSelect : this._t9nStrings.header), closable: true, onCalciteFlowItemClose: () => this.arcgisFieldPickListDismissed.emit() }, this.multiple && addBtn, this.showCancel && cancelBtn, h("calcite-pick-list", { multiple: this.multiple, ref: (node) => {
|
|
206
200
|
this.pickListNode = node;
|
|
207
|
-
}, class: "content", filterEnabled: this.fields.length >= this.showFilterLength
|
|
201
|
+
}, class: "content", filterEnabled: this.fields.length >= this.showFilterLength, filterPlaceholder: this.filterPlaceholderText ?? this._t9nStrings.filter, onCalciteListChange: async () => {
|
|
208
202
|
// keep original order. Add addional values at the end
|
|
209
203
|
const tempSelectedFields = await this.pickListNode.getSelectedItems();
|
|
210
204
|
this.selectedFields = [
|
|
211
205
|
...new Set([
|
|
212
|
-
...this.selectedFields.filter((item) =>
|
|
213
|
-
return tempSelectedFields.has(item);
|
|
214
|
-
}),
|
|
206
|
+
...this.selectedFields.filter((item) => tempSelectedFields.has(item)),
|
|
215
207
|
...tempSelectedFields.keys()
|
|
216
208
|
])
|
|
217
209
|
];
|
|
@@ -222,12 +214,8 @@ const ArcgisFieldPickList = class {
|
|
|
222
214
|
}, onCalciteListFilter: (event) => {
|
|
223
215
|
event.stopPropagation();
|
|
224
216
|
const node = event.target;
|
|
225
|
-
this.filterFields = node.filteredItems?.map((item) =>
|
|
226
|
-
|
|
227
|
-
});
|
|
228
|
-
} }, this.fields.length >= this.showFilterLength && this.showSort && sort, this.multiple && this.showSelectionAll && selectionBtn, [...this.getSortedList()].map((field) => {
|
|
229
|
-
return this.calciteValueList(field);
|
|
230
|
-
})))))));
|
|
217
|
+
this.filterFields = node.filteredItems?.map((item) => item.value);
|
|
218
|
+
} }, this.fields.length >= this.showFilterLength && this.showSort && sort, this.multiple && this.showSelectionAll && selectionBtn, [...this.getSortedList()].map((field) => this.calciteValueList(field))))))));
|
|
231
219
|
}
|
|
232
220
|
// --------------------------------------------------------------------------
|
|
233
221
|
//
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@arcgis/common-components",
|
|
3
3
|
"description": "ArcGIS Common Components",
|
|
4
4
|
"homepage": "https://developers.arcgis.com/javascript/latest/",
|
|
5
|
-
"version": "4.29.0-beta.
|
|
5
|
+
"version": "4.29.0-beta.49",
|
|
6
6
|
"module": "dist/components/index.js",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@stencil/core": "4.8.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@arcgis/components-plugins": "4.29.0-beta.
|
|
56
|
-
"@arcgis/components-utils": "4.29.0-beta.
|
|
55
|
+
"@arcgis/components-plugins": "4.29.0-beta.49",
|
|
56
|
+
"@arcgis/components-utils": "4.29.0-beta.49",
|
|
57
57
|
"@arcgis/core": ">=4.29.0-next <4.30",
|
|
58
|
-
"@arcgis/core-adapter": "4.29.0-beta.
|
|
59
|
-
"@arcgis/map-components": "4.29.0-beta.
|
|
58
|
+
"@arcgis/core-adapter": "4.29.0-beta.49",
|
|
59
|
+
"@arcgis/map-components": "4.29.0-beta.49",
|
|
60
60
|
"@arcgis/typescript-config": "1.0.0",
|
|
61
61
|
"@esri/calcite-components": "^2.1.0",
|
|
62
62
|
"@stencil/angular-output-target": "0.8.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"@arcgis/core": ">=4.29.0-next <4.30",
|
|
87
87
|
"@esri/calcite-components": "^2.1.0"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "346c710a59323519e7fbabc4d208f70b68a21946"
|
|
90
90
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,g as e,h as i,H as n,a as r,F as a}from"./p-a91ab432.js";import{F as l,a as o,b as c,i as u,c as d,d as h,e as f,f as g,U as m}from"./p-6c7d2684.js";var v,y;function p(t){return null!=t}function w(t){return"scene"===t.type?t.associatedLayer?.url:t.url}async function S(t){t.statisticsStatus=v.IN_PROGRESS;const{layer:s,view:e}=t;if("imagery"===s.type||"imagery-tile"===s.type||"stream"===s.type)throw new Error("could not get feature count");try{return await async function(t,s){return"feature"!==t.type||t.url?"feature"===t.type||"csv"===t.type||"scene"===t.type||"wfs"===t.type||"geojson"===t.type?await t.queryFeatureCount():!s||"stream"!==t.type&&"ogc-feature"!==t.type?void 0:async function(t,s){return(await s.whenLayerView(t)).queryFeatureCount()}(t,s):async function(t){const s=t.createQuery();s.outFields=["*"];const e=await t.queryFeatures(s);if(e.features?.length)return e.features.length;throw new Error("could not get feature count")}(t)}(s,e)}catch(t){return}}async function b(t){const{layer:s,modules:e}=t;if(["imagery","imagery-tile","stream","ogc-feature"].indexOf(s.type)>-1)throw new Error("cannot get feature from service");const i=new e.Query({where:"1=1",outFields:["*"],returnGeometry:!1});return s.queryFeatures(i)}!function(t){t.MISSING="missing",t.IN_PROGRESS="inProgress",t.SUCCESS="success",t.FAILED="failed"}(v||(v={})),function(t){t.NUMBER="number",t.STRING="string",t.DATE="date",t.DATE_ONLY="date-only",t.TIME_ONLY="time-only",t.TIMESTAMP_OFFSET="timestamp-offset",t.OID="oid",t.GUID="guid",t.UNKNOWN="unknown"}(y||(y={}));const _=class{constructor(e){t(this,e),this.arcgisFieldInfoComplete=s(this,"arcgisFieldInfoComplete",7),this.view=void 0,this.layer=void 0,this.fieldName=void 0,this.hideStatistics=!1,this.oneFeatureResponse=void 0,this.oneFeatureResponseStatus=v.MISSING,this.statistics=void 0,this.statisticsStatus=v.MISSING,this.uniqueValues=void 0,this.uniqueValuesStatus=v.MISSING,this._lang="",this._t9nLocale="",this._t9nStrings=void 0}async componentWillLoad(){await l(this,e("./assets"));const t=await o(),s=await c(),i=await u(),n=await d(),r=await h(),a=await f(),{view:m,layer:_,fieldName:k,hideStatistics:$}=this;let I;if("esri.layers.support.Sublayer"===_.declaredClass){const t=_,{whenOnce:s}=await g();m&&await s((()=>!m.updating)),I=await t.createFeatureLayer(),await I.load()}this.props={view:m,layer:I||_,fieldName:k,hideStatistics:$,modules:{esriLang:t,esriConfig:s,intl:i,Query:n,summaryStatistics:r,uniqueValues:a}},this.props.fieldInfo=function(t){const{layer:s,fieldName:e}=t;let i;const{popupTemplate:n}=s,r=n?n.fieldInfos:[];return("imagery-tile"===s.type||"imagery"===s.type&&s.rasterFields?.length?s.rasterFields:s.fields).filter((t=>t.name===e)).forEach((s=>{const n=r?r.filter((t=>t.fieldName===s.name)):null,a=n?.length?n[0].label:null;/^raster.(item|service)pixelvalue/i.test(e)&&(s.type="double");const l={layerField:s,label:a||s.alias||s.name};l.codedValues=function(t,s){const{layer:e,modules:i}=s;if("feature"!==e.type)return;const n=e.typeIdField,r=e.types;let a;const l=e.fields.find((s=>s.name===t)),o=l.domain;return n&&r?(n===t?a=r.map((t=>({code:t.id,name:t.name}))):(a=[],r.forEach((s=>{if(s.domains&&s.domains[t]&&"inherited"!==s.domains[t].type)s.domains?.[t]?.codedValues&&s.domains[t].codedValues.forEach((async t=>{let s=!1;a.forEach((e=>{e.code===t.code&&(s=!0,-1===`, ${e.name},`.indexOf(`, ${t.name},`)&&(e.name+=`, ${t.name}`))})),s||a.push(i.esriLang.clone(t))}));else{const t=o;t?.codedValues&&t.codedValues.forEach((async t=>{let s=!1;a.forEach((e=>{e.code===t.code&&(s=!0,-1===`, ${e.name},`.indexOf(`, ${t.name},`)&&(e.name+=`, ${t.name}`))})),s||a.push(i.esriLang.clone(t))}))}}))),!a?.length&&o?.codedValues&&(a=i.esriLang.clone(o.codedValues))):o?.codedValues&&(a=l.domain.codedValues),a?.length?a:null}(e,t),function(t){switch(t.layerField.type){case"string":t.simpleFieldType=y.STRING;break;case"date":t.simpleFieldType=y.DATE;break;case"timestamp-offset":t.simpleFieldType=y.TIMESTAMP_OFFSET;break;case"date-only":t.simpleFieldType=y.DATE_ONLY;break;case"time-only":t.simpleFieldType=y.TIME_ONLY;break;case"oid":t.simpleFieldType=y.OID;break;case"guid":case"global-id":t.simpleFieldType=y.GUID;break;case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":t.simpleFieldType=y.NUMBER}}(l),l.simpleFieldType&&(i=l)})),i}(this.props),"scene"===_.type&&s.request.interceptors?.push({urls:w(_)+"/"+_.layerId,before:function(t){t.requestOptions.authMode="no-prompt"}}),this.oneFeatureResponseStatus=v.IN_PROGRESS;try{const t=await async function(t){const{view:s,layer:e}=t;if("imagery"===e.type||"imagery-tile"===e.type)throw new Error("could not get feature");if("feature"===e.type&&!e.url||"wfs"===e.type){const t=e.createQuery();t.start=0,t.num=5,t.outFields=["*"];const s=await e.queryFeatures(t);if(s.features?.length)return s;throw new Error("could not get feature")}{if(!s)return b(t);const i=await s.whenLayerView(e);if(i.availableFields.length===e.fields.length||["stream","ogc-feature"].indexOf(e.type)>-1&&i.availableFields.length>0){const s=e.createQuery();s.start=0,s.num=5,s.outFields=["*"];const n=await i.queryFeatures(s);return n.features?.length?n:b(t)}return b(t)}}(this.props);this.oneFeatureResponse=t,this.oneFeatureResponseStatus=v.SUCCESS}catch(t){this.oneFeatureResponseStatus=v.FAILED}if("stream"===_.type)return this.uniqueValuesStatus=v.FAILED,void(this.statisticsStatus=v.FAILED);if($)this.uniqueValuesStatus=v.FAILED;else{this.uniqueValuesStatus=v.IN_PROGRESS;try{const t=await async function(t){const{layer:s,view:e,fieldName:i,modules:n}=t;if("imagery"===s.type||"imagery-tile"===s.type)throw new Error("could not get unique values for ImageryLayer/ImageryTileLayer");"feature"!==s.type||s.url||(s.outFields=["*"]);try{return await n.uniqueValues({layer:s,view:e,field:i})}catch(t){throw new Error("could not get unique values")}}(this.props);this.uniqueValues=t,this.uniqueValuesStatus=t?.uniqueValueInfos?.length?v.SUCCESS:v.FAILED}catch(t){this.uniqueValuesStatus=v.FAILED}}if($)this.statisticsStatus=v.FAILED;else{this.statisticsStatus=v.IN_PROGRESS;try{const t=await async function(t){const{layer:s,view:e,fieldName:i,fieldInfo:n,modules:r}=t;if("imagery"===s.type||"imagery-tile"===s.type)throw new Error("could not get statistics for ImageryLayer/ImageryTileLayer");if(!n||"oid"===n.layerField.type||"guid"===n.layerField.type||"global-id"===n.layerField.type){const s=await S(t);return Promise.resolve({totalCount:s,nullcount:0})}try{const n=await r.summaryStatistics({layer:s,view:e,field:i});if(!p(n.count))throw new Error("could not get statistics");const a="sourceJSON"in s&&s.sourceJSON.maxRecordCount===n.count;if(p(n.nullcount)&&!a)return{...n,totalCount:n.count+n.nullcount};{const s=await S(t);return{...n,totalCount:s}}}catch(t){throw new Error("could not get statistics")}}(this.props);if(!p(t.totalCount)&&p(t.count)&&this.uniqueValuesStatus===v.SUCCESS){const s=this.uniqueValues.uniqueValueInfos;for(let e=0;e<s.length;e++){const i=s[e];if(null===i.value){t.totalCount=i.count+t.count;break}}p(t.totalCount)||(t.totalCount=t.count)}this.statistics=t,this.statisticsStatus=v.SUCCESS}catch(t){this.statisticsStatus=v.FAILED}}}async componentDidLoad(){const{props:t}=this,{modules:s}=t;s.intl.setLocale(this._lang)}disconnectedCallback(){m(this)}render(){const{props:t}=this,{fieldInfo:s}=t;return s?i(n,null,i("div",{class:"container"},this.renderFieldType(),this.renderFieldAlias(),this.renderFieldDescription(),this.renderFieldValueType(),this.renderFieldSampleValue(),this.renderFieldFormat(),this.renderFieldStatistics())):i(a,null)}renderFieldType(){const{_t9nStrings:t,props:s}=this,{fieldInfo:e}=s,n=this._getFieldTypeLabel(e.layerField.type);return i("div",{class:"section"},i("div",{class:"title"},t.fieldType),i("div",null,n))}renderFieldAlias(){const{_t9nStrings:t,props:s}=this,{fieldInfo:e}=s;return i("div",{class:"section"},i("div",{class:"title"},t.fieldAlias),i("div",null,e.label))}renderFieldDescription(){const{_t9nStrings:t,props:s}=this,{layer:e}=s;if("feature"!==e.type)return i(a,null);const{fieldInfo:n}=s,r=n.layerField.description;return i("div",{class:"section"},i("div",{class:"title"},t.fieldDescription),i("div",{class:{missing:!r}},r||t.fieldDescriptionNotSet))}renderFieldValueType(){const{_t9nStrings:t,props:s}=this,{layer:e}=s;if("feature"!==e.type)return i(a,null);const{fieldInfo:n}=s,r=this._getFieldValueTypeCamelCase(n);return i("div",{class:"section"},i("div",{class:"title"},t.fieldValueType),i("div",{class:r?"":"missing"},r?t.fieldValueTypes[r]:t.fieldValueTypeNotSet))}renderFieldSampleValue(){const{oneFeatureResponse:t,oneFeatureResponseStatus:s,statisticsStatus:e,statistics:n,uniqueValuesStatus:r,uniqueValues:l,_t9nStrings:o,props:c}=this,{layer:u,fieldName:d,fieldInfo:h}=c,{statistics:f}=o;let g;if(["imagery","imagery-tile"].indexOf(u.type)>-1)return i(a,null);if("stream"!==u.type&&[y.STRING,y.OID,y.GUID].indexOf(this._getStatisticsType(h))>-1&&r!==v.FAILED)return i(a,null);s===v.SUCCESS?t.features.forEach((t=>{(void 0===g||null===g&&null!==t.attributes[d])&&(g=t.attributes[d])})):e===v.SUCCESS?g=n.min:r===v.SUCCESS&&(g=l.uniqueValueInfos?.[0]?.value||l.uniqueValueInfos?.[1]?.value);const m=h.codedValues;return p(g)&&(g=m?m.find((t=>g===t.code))?.name||g:this._getDisplayString(g)),i("div",{class:"section"},i("div",{class:"title"},o.fieldSampleValue),i("div",{class:s===v.FAILED&&e===v.FAILED&&r===v.FAILED||!p(g)?"missing":""},s===v.SUCCESS||e===v.SUCCESS||r===v.SUCCESS?p(g)?`${g}`:f.allNulls:s===v.FAILED&&e===v.FAILED&&r===v.FAILED?o.fieldSampleNotAvailable:o.fieldSampleRetrieving))}renderFieldFormat(){const{_t9nStrings:t,props:s}=this,{fieldName:e,fieldInfo:n,layer:r}=s;if(-1===["single","double","long"].indexOf(n.layerField.type))return i(a,null);const l=r.popupTemplate;if(l?.fieldInfos){const s=l.fieldInfos?.filter((t=>t.fieldName===e));if(s?.length){const e=s[0];if(p(e?.format?.places)){const s=e.format.places;return i("div",{class:"section"},i("div",{class:"title"},t.fieldDecimalPlaces),i("div",null,t.fieldNumDecimalPlaces.replace("${number}",s.toString())))}}}return i("div",{class:"section"},i("div",{class:"title"},t.fieldDecimalPlaces),i("div",{class:"missing"},t.fieldDecimalPlacesNotAvailable))}renderFieldStatistics(){const{statisticsStatus:t,uniqueValuesStatus:s,hideStatistics:e,_t9nStrings:n,props:r}=this,{layer:l,fieldInfo:o}=r;return e||["stream","imagery","imagery-tile"].indexOf(l.type)>-1||["long"].indexOf(o.layerField.type)>-1?(this.arcgisFieldInfoComplete.emit(),i(a,null)):i("div",{class:"section"},i("div",{class:"title"},n.fieldStatistics),t&&t!==v.MISSING&&t!==v.IN_PROGRESS?t===v.FAILED&&s!==v.SUCCESS?this.renderNoStatistics():i("div",{key:"field-info-statistics-content",ref:()=>this.arcgisFieldInfoComplete.emit()},this.renderStatistics()):i("div",{key:"field-info-statistics-content",class:"missing"},n.fieldStatisticsRetrieving))}renderNoStatistics(){const{_t9nStrings:t}=this;return i("div",{key:"field-info-statistics-content",ref:()=>this.arcgisFieldInfoComplete.emit(),class:"missing"},t.fieldStatisticsNotAvailable)}renderStatistics(){const{props:t}=this,{fieldInfo:s}=t;switch(this._getStatisticsType(s)){case y.NUMBER:return this.renderNumberStatistics();case y.STRING:case y.OID:case y.GUID:return this.renderStringStatistics();case y.DATE:case y.DATE_ONLY:case y.TIME_ONLY:case y.TIMESTAMP_OFFSET:return this.renderDateStatistics();default:return i(a,null)}}renderNumberStatistics(){const{statistics:t,_t9nStrings:s}=this;if(!t)return this.renderNoStatistics();const{statistics:e}=s;return i("div",null,i("div",{class:"statistics-row"},i("div",null,e.numberOfValues),i("div",{class:"data"},this._printNumValue(t.totalCount))),p(t.sum)?i("div",{class:"statistics-row"},i("div",null,e.sumOfValues),i("div",{class:"data"},this._printNumValue(t.sum))):null,p(t.min)?i("div",{class:"statistics-row"},i("div",null,e.minimum),i("div",{class:"data"},this._printNumValue(t.min))):null,p(t.max)?i("div",{class:"statistics-row"},i("div",null,e.maximum),i("div",{class:"data"},this._printNumValue(t.max))):null,p(t.avg)?i("div",{class:"statistics-row"},i("div",null,e.average),i("div",{class:"data"},this._printNumValue(t.avg))):null,p(t.stddev)?i("div",{class:"statistics-row"},i("div",null,e.standardDeviation),i("div",{class:"data"},this._printNumValue(t.stddev))):null,this.renderNullValues())}renderStringStatistics(){const{statistics:t,uniqueValuesStatus:s,_t9nStrings:e}=this,{statistics:n}=e;return i("div",null,i("div",{class:"statistics-row"},i("div",null,n.numberOfValues),s!==v.SUCCESS?i("div",{class:"missing"},"--"):i("div",{class:"data"},this._printNumValue(t?.totalCount))),this.renderNullValues(),this.renderTopValues())}renderDateStatistics(){const{statistics:t,view:s,props:e,_t9nStrings:n}=this,{fieldInfo:r}=e;if(!t)return this.renderNoStatistics();const{statistics:a}=n,l=t.max-t.min,o=Math.floor(l/31536e6);let c=Math.floor((l-31536e6*o)/2628e6),u=Math.ceil((l-2628e6*c)/864e5);u>=30&&(c+=1,u=0);let d=1===o?a.timeSpanOptions.year:o>1?a.timeSpanOptions.years.replace("${years}",o.toString()):"";d+=o>0&&(c>0||u>0)?", ":"",d+=1===c?a.timeSpanOptions.month:c>1?a.timeSpanOptions.months.replace("${months}",c.toString()):"",d+=c>0&&u>0?", ":"",d+=1===u?a.timeSpanOptions.day:u>1?a.timeSpanOptions.days.replace("${days}",u.toString()):"";const h=r.simpleFieldType!==y.TIMESTAMP_OFFSET||!s||"unknown"!==s.timeZone,f=r.simpleFieldType===y.TIME_ONLY;return i("div",null,i("div",{class:"statistics-row"},i("div",null,a.numberOfValues),i("div",{class:"data"},this._printNumValue(t?.totalCount))),h&&p(t.min)?i("div",{class:"statistics-row"},i("div",null,f?a.minimumTime:a.minimumDate),i("div",{class:"data"},`${this._getDisplayString(t.min)}`)):null,h&&p(t.max)?i("div",{class:"statistics-row"},i("div",null,f?a.maximumTime:a.maximumDate),i("div",{class:"data"},`${this._getDisplayString(t.max)}`)):null,h&&p(t.avg)?i("div",{class:"statistics-row"},i("div",null,f?a.averageTime:a.averageDate),i("div",{class:"data"},`${this._getDisplayString(t.avg)}`)):null,h&&!f&&p(t.min)&&p(t.max)&&l>0?i("div",{class:"statistics-row"},i("div",null,a.timespan),i("div",{class:"data"},d)):null,this.renderNullValues())}renderTopValues(){const{uniqueValues:t,uniqueValuesStatus:s,_t9nStrings:e,props:n}=this,{fieldInfo:r}=n,{statistics:l}=e;if(t?.uniqueValueInfos?.length){const s=t.uniqueValueInfos;s.sort(((t,s)=>t.count<s.count?1:t.count>s.count?-1:0));const e=r.codedValues,n=s.filter((t=>null!==t.value)).filter(((t,s)=>t&&s<10)).map((t=>{let s=t.value;return e?e.forEach((t=>{s===t.code&&(s=t.name)})):s=this._getDisplayString(s),i("div",{class:"statistics-row"},i("div",{class:"data"},`${s}`),i("div",{class:'$"data" $"count"'},this._printNumValue(t.count)))}));return n.length?i("div",null,i("div",{class:"statistics-row-top-values"},i("div",null,s.length>10?l.topTenValues:l.topValues),i("div",null,l.count)),n):i(a,null)}return i("div",null,i("div",{class:"statistics-row-top-values"},i("div",null,l.topValues),i("div",null,l.count)),i("div",{class:"statistics-row"},i("div",{class:"missing"},s===v.FAILED?e.fieldUniqueValuesNotAvailable:e.fieldSampleRetrieving)))}renderNullValues(){const{statistics:t,uniqueValues:s,_t9nStrings:e}=this,{statistics:n}=e;let r=t?.nullcount;if(!p(r)&&s){const t=s.uniqueValueInfos;for(let s=0;s<t.length;s++){const e=t[s];if(null===e.value){r=e.count;break}}}return i("div",{class:"statistics-row"},i("div",null,n.numberOfNulls),p(r)?i("div",{class:"data"},`${new Number(r).toLocaleString()}`):i("div",{class:"missing"},"--"))}_getFieldTypeLabel(t){const{_t9nStrings:s}=this,e=s.fieldTypes;switch(t){case"small-integer":return e.smallInteger;case"big-integer":return e.bigInteger;case"integer":return e.integer;case"single":return e.single;case"double":return e.double;case"long":return e.long;case"string":default:return e.string;case"date":return e.date;case"date-only":return e.dateOnly;case"time-only":return e.timeOnly;case"timestamp-offset":return e.timestampOffset;case"oid":return e.oid;case"guid":return e.guid;case"global-id":return e.globalId}}_getStatisticsType(t){switch(t.layerField.type){case"small-integer":case"big-integer":case"integer":case"single":case"double":if(t.codedValues)return y.STRING;switch(t.layerField.valueType){case"name-or-title":case"type-or-category":case"description":case"location-or-place-name":case"ordered-or-ranked":case"binary":return y.STRING;default:return y.NUMBER}case"string":return y.STRING;case"date":return y.DATE;case"timestamp-offset":return y.TIMESTAMP_OFFSET;case"date-only":return y.DATE_ONLY;case"time-only":return y.TIME_ONLY;default:return y.STRING}}_getFieldValueTypeCamelCase(t){switch(t.layerField.valueType){case"count-or-amount":return"countOrAmount";case"percentage-or-ratio":return"percentageOrRatio";case"unique-identifier":return"uniqueIdentifier";case"name-or-title":return"nameOrTitle";case"type-or-category":return"typeOrCategory";case"location-or-place-name":return"locationOrPlaceName";case"ordered-or-ranked":return"orderedOrRanked";case"date-and-time":return"dateAndTime";default:return t.layerField.valueType}}_getDisplayString(t){const{props:s}=this,{fieldInfo:e}=s;switch(e.simpleFieldType){case y.DATE:return this._getDateString(t);case y.TIMESTAMP_OFFSET:return this._getTimestampOffsetString(t);case y.DATE_ONLY:return this._getDateOnlyString(t);case y.TIME_ONLY:return this._getTimeOnlyString(t);case y.NUMBER:return this._getNumberString(t);case y.GUID:return this._getGuidString(t);default:return`${t}`}}_getDateString(t){const{modules:s,view:e}=this.props;return s.intl.formatDate(t,e&&"unknown"===e.timeZone?{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}:{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:e?.timeZone||"system"})}_getTimestampOffsetString(t){const{modules:s,view:e}=this.props;return"string"==typeof t?s.intl.formatTimestamp(t,e&&"unknown"===e.timeZone?{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}:{...s.intl.convertDateFormatToIntlOptions("short-date-short-time"),timeZone:e?.timeZone||"system"}):this._getDateString(t)}_getDateOnlyString(t){const{props:s}=this,{modules:e}=s;return e.intl.formatDateOnly(t,e.intl.convertDateFormatToIntlOptions("short-date"))}_getTimeOnlyString(t){const{props:s}=this,{modules:e}=s;return"string"==typeof t?e.intl.formatTimeOnly(t,e.intl.convertDateFormatToIntlOptions("short-date-long-time")):e.intl.formatDate(t,{...e.intl.convertDateFormatToIntlOptions("long-time"),timeZone:"utc"})}_getGuidString(t){return t.startsWith("{")?t:`{${t}}`}_getNumberString(t){return this.props.modules.intl.formatNumber(t)}_printNumValue(t){return p(t)?this._getNumberString(Math.round(100*t)/100):"--"}static get assetsDirs(){return["assets"]}get _hostElement(){return r(this)}};_.style=":host{height:100%}.container{padding:6px;background-color:white}.title{font-weight:bold;padding:5px 0}.missing{color:#a9a9a9}.data{color:#a9a9a9}.count{white-space:nowrap}.section{padding:6px 0}.statistics-row{border-top:1px solid #e0e0e0;padding:6px 0;display:flex;justify-content:space-between}.statistics-row-top-values{border-top:1px solid #e0e0e0;padding:20px 0 6px 0;display:flex;justify-content:space-between}";export{_ as arcgis_field_info}
|