@arcgis/common-components 4.29.0-beta.54 → 4.29.0-beta.56
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-f85349ef.entry.js +1 -0
- package/dist/cjs/arcgis-field-info.cjs.entry.js +2 -2
- package/dist/components/field-info.js +2 -2
- package/dist/esm/arcgis-field-info.entry.js +2 -2
- package/package.json +12 -13
- package/dist/arcgis-common-components/p-efab92a8.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-f85349ef",[[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{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{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{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++){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{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"},`${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}
|
|
@@ -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++) {
|
|
498
498
|
const info = infos[i];
|
|
499
499
|
if (info.value === null) {
|
|
500
500
|
statistics.totalCount = info.count + statistics.count;
|
|
@@ -786,7 +786,7 @@ const ArcgisFieldInfo = class {
|
|
|
786
786
|
let count = statistics?.nullcount;
|
|
787
787
|
if (!isDefined(count) && uniqueValues) {
|
|
788
788
|
const infos = uniqueValues.uniqueValueInfos;
|
|
789
|
-
for (let i = 0; i < infos.length; i
|
|
789
|
+
for (let i = 0; i < infos.length; i++) {
|
|
790
790
|
const info = infos[i];
|
|
791
791
|
if (info.value === null) {
|
|
792
792
|
count = info.count;
|
|
@@ -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++) {
|
|
553
553
|
const info = infos[i];
|
|
554
554
|
if (info.value === null) {
|
|
555
555
|
statistics.totalCount = info.count + statistics.count;
|
|
@@ -841,7 +841,7 @@ const ArcgisFieldInfo = /*@__PURE__*/ proxyCustomElement(class ArcgisFieldInfo e
|
|
|
841
841
|
let count = statistics?.nullcount;
|
|
842
842
|
if (!isDefined(count) && uniqueValues) {
|
|
843
843
|
const infos = uniqueValues.uniqueValueInfos;
|
|
844
|
-
for (let i = 0; i < infos.length; i
|
|
844
|
+
for (let i = 0; i < infos.length; i++) {
|
|
845
845
|
const info = infos[i];
|
|
846
846
|
if (info.value === null) {
|
|
847
847
|
count = info.count;
|
|
@@ -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++) {
|
|
494
494
|
const info = infos[i];
|
|
495
495
|
if (info.value === null) {
|
|
496
496
|
statistics.totalCount = info.count + statistics.count;
|
|
@@ -782,7 +782,7 @@ const ArcgisFieldInfo = class {
|
|
|
782
782
|
let count = statistics?.nullcount;
|
|
783
783
|
if (!isDefined(count) && uniqueValues) {
|
|
784
784
|
const infos = uniqueValues.uniqueValueInfos;
|
|
785
|
-
for (let i = 0; i < infos.length; i
|
|
785
|
+
for (let i = 0; i < infos.length; i++) {
|
|
786
786
|
const info = infos[i];
|
|
787
787
|
if (info.value === null) {
|
|
788
788
|
count = info.count;
|
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.56",
|
|
6
6
|
"module": "dist/components/index.js",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"start": "yarn build:dev --watch --serve --no-open",
|
|
34
34
|
"start:storybook": "storybook dev -c .storybook/internal --quiet",
|
|
35
|
-
"start:external-storybook": "kill-port 6019 && storybook dev -c .storybook/external -p 6019 --quiet",
|
|
36
35
|
"watch": "yarn build:dev --watch",
|
|
37
36
|
"build": "yarn pre && yarn build:components",
|
|
38
37
|
"build:dev": "yarn pre && yarn build:components:dev",
|
|
@@ -52,21 +51,21 @@
|
|
|
52
51
|
"@stencil/core": "4.8.2"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
|
-
"@arcgis/components-plugins": "4.29.0-beta.
|
|
56
|
-
"@arcgis/components-utils": "4.29.0-beta.
|
|
54
|
+
"@arcgis/components-plugins": "4.29.0-beta.56",
|
|
55
|
+
"@arcgis/components-utils": "4.29.0-beta.56",
|
|
57
56
|
"@arcgis/core": ">=4.29.0-next <4.30",
|
|
58
|
-
"@arcgis/core-adapter": "4.29.0-beta.
|
|
59
|
-
"@arcgis/map-components": "4.29.0-beta.
|
|
57
|
+
"@arcgis/core-adapter": "4.29.0-beta.56",
|
|
58
|
+
"@arcgis/map-components": "4.29.0-beta.56",
|
|
60
59
|
"@arcgis/typescript-config": "1.0.0",
|
|
61
60
|
"@esri/calcite-components": "^2.1.0",
|
|
62
61
|
"@stencil/angular-output-target": "0.8.1",
|
|
63
62
|
"@stencil/react-output-target": "0.5.3",
|
|
64
63
|
"@stencil/sass": "^3.0.0",
|
|
65
|
-
"@storybook/addon-a11y": "^7.6.
|
|
66
|
-
"@storybook/addon-essentials": "^7.6.
|
|
67
|
-
"@storybook/addon-links": "^7.6.
|
|
68
|
-
"@storybook/web-components": "^7.6.
|
|
69
|
-
"@storybook/web-components-vite": "^7.6.
|
|
64
|
+
"@storybook/addon-a11y": "^7.6.6",
|
|
65
|
+
"@storybook/addon-essentials": "^7.6.6",
|
|
66
|
+
"@storybook/addon-links": "^7.6.6",
|
|
67
|
+
"@storybook/web-components": "^7.6.6",
|
|
68
|
+
"@storybook/web-components-vite": "^7.6.6",
|
|
70
69
|
"@types/jest": "^29.5.0",
|
|
71
70
|
"eslint": "^8.55.0",
|
|
72
71
|
"jest": "^29.5.0",
|
|
@@ -78,7 +77,7 @@
|
|
|
78
77
|
"react-dom": "^18.2.0",
|
|
79
78
|
"resolve-pkg": "^2.0.0",
|
|
80
79
|
"rimraf": "^5.0.0",
|
|
81
|
-
"storybook": "^7.6.
|
|
80
|
+
"storybook": "^7.6.6",
|
|
82
81
|
"typescript": "5.2.2",
|
|
83
82
|
"vite": "^4.5.1"
|
|
84
83
|
},
|
|
@@ -86,5 +85,5 @@
|
|
|
86
85
|
"@arcgis/core": ">=4.29.0-next <4.30",
|
|
87
86
|
"@esri/calcite-components": "^2.1.0"
|
|
88
87
|
},
|
|
89
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "f7cbfe51eab17f0adb35a79bbeef3992baee40bb"
|
|
90
89
|
}
|
|
@@ -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{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{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{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{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}
|