@arcgis/common-components 5.2.0-next.66 → 5.2.0-next.67
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/cdn/2C7SVAMP.js +2 -0
- package/dist/cdn/5WGBTOWN.js +2 -0
- package/dist/cdn/ETMH4DV6.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-color-input/customElement.d.ts +2 -1
- package/dist/components/arcgis-field-info/customElement.js +1 -3
- package/dist/components/arcgis-field-pick-list/customElement.js +23 -23
- package/dist/components/arcgis-unique-values-list/customElement.js +99 -79
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +3 -3
- package/dist/cdn/2NC4IS67.js +0 -2
- package/dist/cdn/7NUOY4MH.js +0 -2
- package/dist/cdn/TJOSKSQ7.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as x,b as j,c as k,d as R,e as v,f as z,g as b,h as y,i as B,j as K,k as I,l as P,m as F,n as X,o as Y,p as E,q as w,r as $,s as L}from"./Z5QBBHLD.js";import{a as J,b as p}from"./XRQOTHR7.js";import{a as Q}from"./7KADEPAK.js";import"./4BK7PZE3.js";import"./TWW63D32.js";import{a as S}from"./TJ7PO6GP.js";import{C as V,D as U,E as N,J as G,h as H,j as d,n as _,o as C,s as D}from"./PECTYCLV.js";export default $arcgis.t(([se,O,f,M,q,ae,re,ee,ne])=>{function oe(a){return a.associatedLayer?.url}var le={dateStyle:"short",timeStyle:"short"},de={timeStyle:"medium"};function ue(a){let{layer:e,fieldName:t}=a,i,r=M.supportsFieldConfiguration(e),s;"popupTemplate"in e&&(s=e.popupTemplate);let n=s?s.fieldInfos:[];return ie(a)?.filter(l=>l.name===t).forEach(l=>{let u=!r&&n?n.filter(m=>m.fieldName===l.name):void 0,c=r?e.getFieldAlias(t):u?.length?u[0].label:l.alias;/^raster.(item|service)pixelvalue/iu.test(t)&&(l.type="double");let o={layerField:l,label:c||l.name};o.codedValues=fe(t,a),pe(o),o.simpleFieldType&&(i=o)}),i}function ie(a){let{layer:e}=a;return y(e)||$(e)||b(e)&&e.rasterFields.length?e.rasterFields:e.fields}async function te(a){a.statisticsStatus="in-progress";let{layer:e,view:t}=a;if(y(e)||$(e)||F(e)||w(e))throw new Error("could not get feature count");try{return await ge(e,t)}catch{return}}async function ce(a){let{layer:e,view:t,fieldName:i,fieldInfo:r}=a;if(y(e)||$(e)||w(e))throw new Error("could not get statistics for ImageryTileLayer/WCSLayer/VoxelLayer");if(!r||r.layerField.type==="oid"||r.layerField.type==="guid"||r.layerField.type==="global-id")return{totalCount:await te(a),nullcount:0};try{let s=await ae({layer:e,view:t,field:i,outStatisticTypes:{exclude:["median"]}});if(!p(s.count))throw new Error("could not get statistics");let n="sourceJSON"in e&&e.sourceJSON.maxRecordCount===s.count;if(p(s.nullcount)&&!n)return{...s,totalCount:s.count+s.nullcount};{let l=await te(a);return{...s,totalCount:l}}}catch{throw new Error("could not get statistics")}}async function me(a){let{layer:e,view:t,fieldName:i}=a;if(y(e)||$(e)||w(e))throw new Error("could not get unique values for ImageryLayer/ImageryTileLayer/WCSLayer/VoxelLayer");R(e)&&(e.outFields=["*"]);try{return await re({layer:e,view:t,field:i})}catch{throw new Error("could not get unique values")}}function pe(a){switch(a.layerField.type){case"string":a.simpleFieldType="string";break;case"date":a.simpleFieldType="date";break;case"timestamp-offset":a.simpleFieldType="timestamp-offset";break;case"date-only":a.simpleFieldType="date-only";break;case"time-only":a.simpleFieldType="time-only";break;case"oid":a.simpleFieldType="oid";break;case"guid":case"global-id":a.simpleFieldType="guid";break;case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":a.simpleFieldType="number";break;default:a.simpleFieldType="string"}}function fe(a,e){let{layer:t}=e;if(E(t)&&t.subtypeField===a){let u=t.parent?.subtypes?.find(c=>c.code===t.subtypeCode);if(u)return[new ee({code:u.code,name:u.name})]}if(!v(t)&&!b(t))return;let i=v(t)?t.typeIdField:void 0,r=v(t)?t.types:void 0,s,n=ie(e)?.find(u=>u.name===a),l=n?.domain;return v(t)&&i&&r?(i===a?s=r.map(u=>new ee({code:u.id,name:u.name})):(s=[],r.forEach(u=>{if(!u.domains[a]||u.domains[a].type==="inherited"){let c=l;c?.codedValues&&c.codedValues.forEach(o=>{let m=!1;s.forEach(g=>{g.code===o.code&&(m=!0,`, ${g.name},`.includes(`, ${o.name},`)||(g.name+=`, ${o.name}`))}),m||s.push(q.clone(o))})}else u.domains[a].codedValues&&u.domains[a].codedValues.forEach(c=>{let o=!1;s.forEach(m=>{m.code===c.code&&(o=!0,`, ${m.name},`.includes(`, ${c.name},`)||(m.name+=`, ${c.name}`))}),o||s.push(q.clone(c))})})),!s.length&&l?.codedValues&&(s=q.clone(l.codedValues))):l?.codedValues&&(s=n?.domain?.codedValues),s?.length?s:void 0}async function he(a){let{view:e,layer:t}=a;if(b(t)||y(t)||$(t))throw new Error("could not get feature");if(v(t)&&!t.url||L(t)){let i=t.createQuery();i.start=0,i.num=5,i.outFields=["*"];let r=await t.queryFeatures(i);if(r.features.length)return r;throw new Error("could not get feature")}else{if(!e)return await A(a);let i;if(E(t)||X(t)){let s=t.parent;for(;Y(s)||K(s);)s=s.parent;B(s)&&(i=await e.whenLayerView(s))}else i=await e.whenLayerView(t);let r=i.availableFields.length===t.fields.length;if(i&&(r||(F(t)||I(t))&&i.availableFields.length>0)){let s=i.createQuery();s.start=0,s.num=5,s.outFields=["*"];let n=await i.queryFeatures(s);return n.features?.length?n:await A(a)}else return await A(a)}}async function A(a){let{layer:e}=a;if(b(e)||y(e)||F(e)||I(e))throw new Error("cannot get feature from service");let t=new ne({where:"1=1",outFields:["*"],returnGeometry:!1});return"sourceJSON"in e&&e.sourceJSON?.advancedQueryCapabilities?.supportsPagination&&(t.num=1),await e.queryFeatures(t)}async function ge(a,e){if(R(a))return await ve(a);if(v(a)||j(a)||P(a)||L(a)||z(a))return await a.queryFeatureCount();if(e&&(F(a)||I(a)))return await ye(a,e)}async function ve(a){let e=a.createQuery();e.outFields=["*"];let t=await a.queryFeatures(e);if(t.features.length)return t.features.length;throw new Error("could not get feature count")}async function ye(a,e){return await(await e.whenLayerView(a)).queryFeatureCount()}var Fe=H`:host{height:100%}.container{padding:var(--calcite-space-xs);background-color:var(--calcite-color-surface-2)}.title{font-weight:700;padding:5px 0}.missing,.data{color:#a9a9a9}.count{white-space:nowrap}.section{padding:var(--calcite-space-xs) 0}.statistics-row{border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);padding:var(--calcite-space-xs) 0;display:flex;justify-content:space-between}.statistics-row-top-values{border-top:var(--calcite-border-width-sm) solid var(--calctie-color-border-2);padding:20px 0 var(--calcite-space-xs) 0;display:flex;justify-content:space-between}`,Z=class extends U{constructor(){super(...arguments),this._messages=Q({blocking:!0}),this.initialized=!1,this._propWatcherTask=new J(this,{task:async([e,t])=>{let i=p(e)&&p(t);if(p(e)||_("error",this,C("layer")),p(t)||_("error",this,C("fieldName")),!i)throw new Error;await this.processProps(),this._propWatcherTask.autoRun=!1},args:()=>[this.layer,this.fieldName]}),this.oneFeatureResponseStatus="missing",this.statisticsStatus="missing",this.uniqueValuesStatus="missing",this.hideAlias=!1,this.hideNumericFormat=!1,this.hideStatistics=!1,this.arcgisComplete=D(),this.arcgisFieldInfoComplete=D()}static{this.properties={oneFeatureResponseStatus:16,oneFeatureResponse:16,statisticsStatus:16,statistics:16,uniqueValuesStatus:16,uniqueValues:16,view:0,layer:0,fieldName:1,hideAlias:5,hideNumericFormat:5,hideStatistics:5}}static{this.styles=Fe}async refresh(){await this.processProps(),this.requestUpdate()}async willUpdate(e){this.initialized&&(e.has("fieldName")||e.has("layer"))&&await this.processProps()}disconnectedCallback(){super.disconnectedCallback(),this.timeZoneHandle?.remove()}async processProps(){let{view:e,layer:t,fieldName:i,hideStatistics:r}=this;if(!t||!i)return;let s;if(t.declaredClass==="esri.layers.support.Sublayer"){let n=t;e&&await O.whenOnce(()=>!e.updating),s=await n.createFeatureLayer(),await s?.load()}if(this.oneFeatureResponseStatus="missing",this.oneFeatureResponse=void 0,this.statisticsStatus="missing",this.statistics=void 0,this.uniqueValuesStatus="missing",this.uniqueValues=void 0,this.props={view:e,layer:s??t,fieldName:i,hideStatistics:r},this.props.fieldInfo=ue(this.props),!this.props.fieldInfo){_("error",this,`Field ${i} does not exist in layer.`);return}P(t)&&se.request.interceptors?.push({urls:`${oe(t)}/${t.layerId}`,before(n){n.requestOptions.authMode="no-prompt"}}),this.processPropsPart2()}async processPropsPart2(){let{layer:e,hideStatistics:t}=this;if(await this.requestOneFeature(),F(e)||x(e)||k(e)){this.uniqueValuesStatus="failed",this.statisticsStatus="failed";return}t?this.uniqueValuesStatus="failed":await this.requestUniqueValues(),t?this.statisticsStatus="failed":await this.requestStatistics(),this.setUpTimeZoneHandle(),this.initialized=!0}async requestOneFeature(){this.oneFeatureResponseStatus="in-progress";try{let e=await he(this.props);this.oneFeatureResponse=e,this.oneFeatureResponseStatus="success"}catch{this.oneFeatureResponseStatus="failed"}}async requestUniqueValues(){return this.uniqueValuesStatus="in-progress",await new Promise(async e=>{try{let t=await me(this.props);this.uniqueValues=t,t?.uniqueValueInfos?.length?this.uniqueValuesStatus="success":this.uniqueValuesStatus="failed"}catch{this.uniqueValuesStatus="failed"}finally{e()}})}async requestStatistics(){return await new Promise(async e=>{try{let t=await ce(this.props);if(!p(t.totalCount)&&p(t.count)&&this.uniqueValuesStatus==="success"){let i=this.uniqueValues?.uniqueValueInfos??[];for(let r=0;r<i.length;r++){let s=i[r];if(s.value===null){t.totalCount=s.count+t.count;break}}t.totalCount??=t.count}this.statistics=t,this.statisticsStatus="success"}catch{this.statisticsStatus="failed"}finally{e()}})}setUpTimeZoneHandle(){this.timeZoneHandle?.remove();let{props:e}=this,{view:t,fieldInfo:i}=e;["date","timestamp-offset"].includes(this._getStatisticsType(i))&&(this.timeZoneHandle=O.watch(()=>t?.timeZone,()=>this.requestUpdate()))}_getFieldTypeLabel(e){let{_messages:t}=this,i=t.fieldTypes;switch(e){case"big-integer":return i.bigInteger;case"date":return i.date;case"date-only":return i.dateOnly;case"double":return i.double;case"global-id":return i.globalId;case"guid":return i.guid;case"integer":return i.integer;case"long":return i.long;case"oid":return i.oid;case"single":return i.single;case"small-integer":return i.smallInteger;case"string":return i.string;case"time-only":return i.timeOnly;case"timestamp-offset":return i.timestampOffset;default:return i.string}}_getStatisticsType(e){switch(e.layerField.type){case"big-integer":case"double":case"integer":case"single":case"small-integer":{if(e.codedValues)return"string";switch(e.layerField.valueType){case"url":case"binary":case"description":case"location-or-place-name":case"name-or-title":case"ordered-or-ranked":case"type-or-category":return"string";default:return"number"}}case"date":return"date";case"date-only":return"date-only";case"string":return"string";case"time-only":return"time-only";case"timestamp-offset":return"timestamp-offset";default:return"string"}}_getFieldValueTypeCamelCase(e){switch(e.layerField.valueType){case"count-or-amount":return"countOrAmount";case"date-and-time":return"dateAndTime";case"location-or-place-name":return"locationOrPlaceName";case"name-or-title":return"nameOrTitle";case"ordered-or-ranked":return"orderedOrRanked";case"percentage-or-ratio":return"percentageOrRatio";case"type-or-category":return"typeOrCategory";case"unique-identifier":return"uniqueIdentifier";case"phone-number":return"phoneNumber";case"email-address":return"emailAddress";default:return e.layerField.valueType??void 0}}_getDisplayString(e,t){let{props:i}=this,{fieldInfo:r}=i;switch(r.simpleFieldType){case"date":return this._getDateString(e,t);case"date-only":return this._getDateOnlyString(e,t);case"guid":return this._getGuidString(e);case"number":return this._getNumberString(e,t);case"time-only":return this._getTimeOnlyString(e,t);case"timestamp-offset":return this._getTimestampOffsetString(e,t);default:return`${e}`}}_getDateString(e,t){let{view:i}=this.props;return i&&i.timeZone==="unknown"?f.formatDate(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:"utc"}):f.formatDate(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:i?.timeZone||"system"})}_getTimestampOffsetString(e,t){let{view:i}=this.props;return typeof e=="string"?i&&i.timeZone==="unknown"?f.formatTimestamp(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:"utc"}):f.formatTimestamp(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:i?.timeZone||"system"}):this._getDateString(e,t)}_getDateOnlyString(e,t){return f.formatDateOnly(e,this.getIntlDateTimeFormattingOptions("short-date",t))}_getTimeOnlyString(e,t){return typeof e=="string"?f.formatTimeOnly(e,this.getIntlDateTimeFormattingOptions("short-date-long-time",t)):f.formatDate(e,{...this.getIntlDateTimeFormattingOptions("long-time",{...t,isTimeOnly:!0}),timeZone:"utc"})}_getGuidString(e){return e.startsWith("{")?e:`{${e}}`}_getNumberString(e,t){let i=t?.useFieldFormatting?e:Math.round(e*100)/100;return f.formatNumber(i,this.getIntlNumberFormattingOptions(t))}_printNumValue(e,t){return p(e)?this._getNumberString(e,t):"--"}_setCompleteRef(e){if(this.completeRefHandler&&clearInterval(this.completeRefHandler),e){let t=0;this.completeRefHandler=setInterval(()=>{(t>130||this.isFinished(this.uniqueValuesStatus)&&this.isFinished(this.statisticsStatus))&&(clearInterval(this.completeRefHandler),this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit()),t++},1e3)}}getCurrentFieldFormat(){let{props:e}=this,{layer:t,fieldName:i}=e;return(this.originalLayerSupportsFieldConfigs()?t.getFieldConfiguration(i):void 0)?.fieldFormat??void 0}getIntlNumberFormattingOptions(e){let t=this.getCurrentFieldFormat();if(!e?.useFieldFormatting)return t?{useGrouping:["always","auto"].includes(t.useGrouping)}:f.convertNumberFormatToIntlOptions({digitSeparator:this.getPopupTemplateFieldInfo()?.format?.digitSeparator??!0});let i=t?{minimumFractionDigits:t.minimumFractionDigits,maximumFractionDigits:t.maximumFractionDigits,useGrouping:["always","auto"].includes(t.useGrouping)}:void 0;if(i)return i;let r=this.getPopupTemplateFieldInfo();return f.convertNumberFormatToIntlOptions({digitSeparator:r?.format?.digitSeparator??!0,places:r?.format?.places??2})}getIntlDateTimeFormattingOptions(e,t){let i=this.getCurrentFieldFormat();if(!t?.useFieldFormatting)return i?t?.isTimeOnly?de:le:f.convertDateFormatToIntlOptions(e);let r=i?{dateStyle:t?.isTimeOnly?void 0:i.dateStyle??void 0,year:i.dateStyle?void 0:i.year??void 0,month:i.dateStyle?void 0:i.month??void 0,timeStyle:i.timeStyle??void 0,hourCycle:i.hour12==="never"?"h23":"h11"}:void 0;if(r)return r;let s=this.getPopupTemplateFieldInfo();return f.convertDateFormatToIntlOptions(s?.format?.dateFormat??e)}originalLayerSupportsFieldConfigs(){let{layer:e}=this;return M.supportsFieldConfiguration(e)}getPopupTemplateFieldInfo(){let{props:e}=this,{layer:t,fieldName:i}=e;return("popupTemplate"in t?t.popupTemplate:void 0)?.fieldInfos?.find(r=>r.fieldName===i)}isFinished(e){return["success","failed"].includes(e)}render(){return this._propWatcherTask.render({pending:()=>d`<calcite-scrim loading></calcite-scrim>`,complete:()=>{let{props:e}=this,{fieldInfo:t}=e;return t?d`<div class="container">${this.renderFieldType()}${this.renderFieldAlias()}${this.renderFieldDescription()}${this.renderFieldValueType()}${this.renderFieldSampleValue()}${this.renderFieldNumericFormat()}${this.renderFieldStatistics()}</div>`:""},error:()=>""})}renderFieldType(){let{_messages:e,props:t}=this,{fieldInfo:i}=t,r=this._getFieldTypeLabel(i.layerField.type);return d`<div class="section"><div class="title">${e.fieldType}</div><div>${r}</div></div>`}renderFieldAlias(){let{_messages:e,props:t,hideAlias:i}=this,{fieldInfo:r}=t;return i?"":d`<div class="section"><div class="title">${e.fieldAlias}</div><div>${r.label}</div></div>`}renderFieldDescription(){let{_messages:e,props:t}=this,{layer:i}=t;if(!v(i))return"";let{fieldInfo:r}=t,s=r.layerField.description;return d`<div class="section"><div class="title">${e.fieldDescription}</div><div class=${N({missing:!s})}>${s||e.fieldDescriptionNotSet}</div></div>`}renderFieldValueType(){let{_messages:e,props:t}=this,{layer:i}=t;if(!v(i))return"";let{fieldInfo:r}=t,s=this._getFieldValueTypeCamelCase(r);return d`<div class="section"><div class="title">${e.fieldValueType}</div><div class=${N(s?"":"missing")}>${s?e.fieldValueTypes[s]:e.fieldValueTypeNotSet}</div></div>`}renderFieldSampleValue(){let{oneFeatureResponse:e,oneFeatureResponseStatus:t,statisticsStatus:i,statistics:r,uniqueValuesStatus:s,uniqueValues:n,_messages:l,props:u}=this,{layer:c,fieldName:o,fieldInfo:m}=u,{statistics:g}=l,h;if(y(c)||w(c)||!F(c)&&["string","oid","guid"].includes(this._getStatisticsType(m))&&s!=="failed")return"";t==="success"?e.features.forEach(T=>{(h===void 0||h===null&&T.attributes[o]!==null)&&(h=T.attributes[o])}):i==="success"?h=r?.min??void 0:s==="success"&&(h=n?.uniqueValueInfos?.[0]?.value??n?.uniqueValueInfos?.[1]?.value??void 0);let W=m.codedValues;return p(h)&&(W?h=W.find(T=>h===T.code)?.name||h:h=this._getDisplayString(h,{useFieldFormatting:!0})),d`<div class="section"><div class="title">${l.fieldSampleValue}</div><div class=${N(t==="failed"&&i==="failed"&&s==="failed"||!p(h)?"missing":"")}>${t==="success"||i==="success"||s==="success"?h?.toString()??g.allNulls:t==="failed"&&i==="failed"&&s==="failed"?l.fieldSampleNotAvailable:l.fieldSampleRetrieving}</div></div>`}renderFieldNumericFormat(){let{_messages:e,props:t,hideNumericFormat:i}=this,{fieldName:r,fieldInfo:s,layer:n}=t;if(i||!["double","long","single"].includes(s.layerField.type))return"";let l=this.originalLayerSupportsFieldConfigs()?n.getFieldConfiguration(r):void 0;if(l?.fieldFormat){let{minimumFractionDigits:c,maximumFractionDigits:o}=l.fieldFormat;return d`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldMinimumFractionDigits.replace("${number}",c.toString())}</div><div>${e.fieldMaximumFractionDigits.replace("${number}",o.toString())}</div></div>`}let u="popupTemplate"in n?n.popupTemplate:void 0;if(u?.fieldInfos){let c=u.fieldInfos?.filter(o=>o.fieldName===r);if(c?.length){let o=c[0];if(p(o?.format?.places)){let m=o.format.places;return d`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldNumDecimalPlaces.replace("${number}",m.toString())}</div></div>`}}}return d`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div class="missing">${e.fieldDecimalPlacesNotAvailable}</div></div>`}renderFieldStatistics(){let{statisticsStatus:e,uniqueValuesStatus:t,hideStatistics:i,_messages:r,props:s}=this,{layer:n,fieldInfo:l}=s;return i?(this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit(),""):x(n)||k(n)||F(n)||y(n)||w(n)||["long"].includes(l.layerField.type)?(this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit(),""):d`<div class="section"><div class="title">${r.fieldStatistics}</div>${!this.isFinished(t)&&!this.isFinished(e)?this.renderWaitingForStatistics():e==="failed"&&t==="failed"?this.renderNoStatistics():this.renderStatistics()}</div>`}renderWaitingForStatistics(){let{_messages:e}=this;return S("field-info-statistics-content",d`<div class="missing">${e.fieldStatisticsRetrieving}</div>`)}renderNoStatistics(){let{_messages:e}=this;return S("field-info-statistics-content",d`<div class="missing" ${V(this._setCompleteRef)}>${e.fieldStatisticsNotAvailable}</div>`)}renderStatistics(){let{props:e}=this,{fieldInfo:t}=e;switch(this._getStatisticsType(t)){case"number":return this.renderNumberStatistics();case"guid":case"oid":case"string":return this.renderStringStatistics();case"date":case"date-only":case"time-only":case"timestamp-offset":return this.renderDateStatistics();default:return""}}renderNumberStatistics(){let{statistics:e,_messages:t}=this;if(!e)return this.renderWaitingForStatistics();let{statistics:i}=t;return S("field-info-statistics-content",d`<div ${V(this._setCompleteRef)}><div class="statistics-row"><div>${i.numberOfValues}</div><div class="data">${this._printNumValue(e.totalCount)}</div></div>${p(e.sum)?d`<div class="statistics-row"><div>${i.sumOfValues}</div><div class="data">${this._printNumValue(e.sum)}</div></div>`:null}${p(e.min)?d`<div class="statistics-row"><div>${i.minimum}</div><div class="data">${this._printNumValue(e.min)}</div></div>`:null}${p(e.max)?d`<div class="statistics-row"><div>${i.maximum}</div><div class="data">${this._printNumValue(e.max)}</div></div>`:null}${p(e.avg)?d`<div class="statistics-row"><div>${i.average}</div><div class="data">${this._printNumValue(e.avg)}</div></div>`:null}${p(e.stddev)?d`<div class="statistics-row"><div>${i.standardDeviation}</div><div class="data">${this._printNumValue(e.stddev)}</div></div>`:null}${this.renderNullValues()}</div>`)}renderStringStatistics(){let{statistics:e,uniqueValuesStatus:t,_messages:i}=this,{statistics:r}=i;return S("field-info-statistics-content",d`<div ${V(this._setCompleteRef)}><div class="statistics-row"><div>${r.numberOfValues}</div>${t!=="success"?d`<div class="missing">--</div>`:d`<div class="data">${this._printNumValue(e?.totalCount)}</div>`}</div>${this.renderNullValues()}${this.renderTopValues()}</div>`)}renderDateStatistics(){let{statistics:e,view:t,props:i,_messages:r}=this,{fieldInfo:s}=i;if(!e||!p(e.max)||!p(e.min))return this.renderWaitingForStatistics();let{statistics:n}=r,l=e.max-e.min,u=Math.floor(l/31536e6),c=Math.floor((l-u*31536e6)/2628e6),o=Math.ceil((l-c*2628e6)/864e5);o>=30&&(c+=1,o=0);let m=u===1?n.timeSpanOptions.year:u>1?n.timeSpanOptions.years.replace("${years}",u.toString()):"";m+=u>0&&(c>0||o>0)?", ":"",m+=c===1?n.timeSpanOptions.month:c>1?n.timeSpanOptions.months.replace("${months}",c.toString()):"",m+=c>0&&o>0?", ":"",m+=o===1?n.timeSpanOptions.day:o>1?n.timeSpanOptions.days.replace("${days}",o.toString()):"";let g=s.simpleFieldType!=="timestamp-offset"||!t||t.timeZone!=="unknown",h=s.simpleFieldType==="time-only";return S("field-info-statistics-content",d`<div ${V(this._setCompleteRef)}><div class="statistics-row"><div>${n.numberOfValues}</div><div class="data">${this._printNumValue(e?.totalCount)}</div></div>${g&&p(e.min)?d`<div class="statistics-row"><div>${h?n.minimumTime:n.minimumDate}</div><div class="data">${this._getDisplayString(e.min)}</div></div>`:null}${g&&p(e.max)?d`<div class="statistics-row"><div>${h?n.maximumTime:n.maximumDate}</div><div class="data">${this._getDisplayString(e.max)}</div></div>`:null}${g&&p(e.avg)?d`<div class="statistics-row"><div>${h?n.averageTime:n.averageDate}</div><div class="data">${this._getDisplayString(e.avg)}</div></div>`:null}${g&&!h&&p(e.min)&&p(e.max)&&l>0?d`<div class="statistics-row"><div>${n.timespan}</div><div class="data">${m}</div></div>`:null}${this.renderNullValues()}</div>`)}renderTopValues(){let{uniqueValues:e,uniqueValuesStatus:t,_messages:i,props:r}=this,{fieldInfo:s}=r,{statistics:n}=i;if(e?.uniqueValueInfos?.length){let l=e.uniqueValueInfos;l.sort((o,m)=>o.count<m.count?1:o.count>m.count?-1:0);let u=s.codedValues,c=l.filter(o=>o.value!==null).filter((o,m)=>o&&m<10).map(o=>{let m=o.value;return u?u.forEach(g=>{m===g.code&&(m=g.name)}):m=this._getDisplayString(m),d`<div class="statistics-row"><div class="data">${`${m}`}</div><div class="count">${this._printNumValue(o.count)}</div></div>`});return c.length?d`<div><div class="statistics-row-top-values"><div>${l.length>10?n.topTenValues:n.topValues}</div><div>${n.count}</div></div>${c}</div>`:""}else return d`<div><div class="statistics-row-top-values"><div>${n.topValues}</div><div>${n.count}</div></div><div class="statistics-row"><div class="missing">${t==="failed"?i.fieldUniqueValuesNotAvailable:i.fieldSampleRetrieving}</div></div></div>`}renderNullValues(){let{statistics:e,uniqueValues:t,_messages:i}=this,{statistics:r}=i,s=e?.nullcount;if(!p(s)&&t){let n=t.uniqueValueInfos;for(let l=0;l<n.length;l++){let u=n[l];if(u.value===null){s=u.count;break}}}return d`<div class="statistics-row"><div>${r.numberOfNulls}</div>${p(s)?d`<div class="data">${this._printNumValue(s)}</div>`:d`<div class="missing">--</div>`}</div>`}};G("arcgis-field-info",Z);return Z},"config","core/reactiveUtils","intl","applications/PortalApp/layerUtils","core/lang","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","layers/support/CodedValue","rest/support/Query")
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as u}from"./Y5Y7IXOV.js";import{a as b,b as k}from"./XRQOTHR7.js";import{a as B}from"./7KADEPAK.js";import"./4BK7PZE3.js";import"./TWW63D32.js";import{a as f}from"./TJ7PO6GP.js";import{B as r,C as d,D as v,E as C,F as g,G as h,H as S,J as x,h as $,j as l,n as m,o as y,s as a}from"./PECTYCLV.js";var n=new Map;n.set("oid","key");n.set("guid","key");n.set("global-id","key");n.set("blob","binary");n.set("integer","integer");n.set("small-integer","integer");n.set("big-integer","integer");n.set("single","number");n.set("double","number");n.set("long","number");n.set("number","number");n.set("date","date-time");n.set("date-only","calendar");n.set("time-only","clock");n.set("timestamp-offset","time-zone");n.set("string","string");var L=({fieldType:w})=>l`<calcite-icon scale=s .icon=${n.get(w)}></calcite-icon>`,E=$`.panel{min-height:250px}.content{max-height:50vh}.field-icons{display:flex;align-items:center;padding:0 var(--calcite-space-sm)}.selection-button-div{padding:var(--calcite-space-2xs) var(--calcite-space-sm-plus)}.no-match-text{padding:var(--calcite-space-md)}.footer{width:100%}.add-cancel-buttons{display:flex;align-content:space-between}`,F=class extends v{constructor(){super(...arguments),this._messages=B({blocking:!0}),this.popoverNode=r(),this.listNode=r(),this.flowElement=r(),this.panelElement=r(),this.dropdownNode=r(),this.fieldInfoFlowItemEl=r(),this.allLists=[],this.filterText="",this.panelCutOffHeight=0,this.initialized=!1,this._propWatcherTask=new b(this,{task:async([e])=>{if(!this.listOnly&&!k(e?.refElement))throw m("error",this,y("popoverProps")),new Error;this._propWatcherTask.autoRun=!1},args:()=>[this.popoverProps]}),this.fields=[],this.selectedFields=[],this.listOnly=!1,this.showFieldInfo=!1,this.showFieldTypeIcon=!1,this.showFieldName=!1,this.showDescription=!1,this.showSelectionAll=!1,this.showCancel=!0,this.hideCancel=!1,this.showSort=!0,this.hideSort=!1,this.showFilterLength=10,this.multiple=!1,this.sortBy="default",this.groupFieldsAndExpressions=!1,this.arcgisChange=a(),this.arcgisClose=a(),this.arcgisFieldPickListChange=a(),this.arcgisFieldPickListDismissed=a(),this.arcgisFieldPickListSortByChange=a(),this.arcgisSortByChange=a(),this.arcgisEditField=a(),this.arcgisDeleteField=a()}static{this.properties={lastSortBy:16,filterFields:16,mapView:0,view:0,layer:0,fields:0,selectedFields:0,listOnly:5,popoverProps:0,showFieldInfo:5,showFieldTypeIcon:5,showFieldName:5,showDescription:5,showSelectionAll:5,showCancel:5,hideCancel:5,showSort:5,hideSort:5,showFilterLength:9,multiple:5,heading:1,okBtnText:1,filterPlaceholderText:1,filterNoResultsText:1,sortBy:1,groupFieldsAndExpressions:5,fieldsGroupHeading:1,expressionsGroupHeading:1,customExpressionCheck:0}}static{this.styles=E}async reposition(){await this.popoverNode.value?.reposition()}async setFocus(){setTimeout(()=>requestAnimationFrame(()=>{this.listOnly?this.listNode.value?.setFocus():this.panelElement.value?.setFocus()}),1)}async setDisabled(e){this.panelElement.value&&(this.panelElement.value.disabled=e)}load(){!this.view&&this.mapView&&(this.view=this.mapView),!this.showCancel&&!this.hideCancel&&(this.hideCancel=!0),!this.showSort&&!this.hideSort&&(this.hideSort=!0),this.listOnly&&this.showFieldInfo&&(this.showFieldInfo=!1,m("info",this,"showFieldInfo is not supported if listOnly is true.")),!this.multiple&&this.selectedFields.length>1&&(this.selectedFields=[this.selectedFields[0]]),this.lastSortBy=this.sortBy??this.lastSortBy,this.updateGroupedLists(),this.initialized=!0}willUpdate(e){this.initialized&&(e.has("fields")||e.has("sortBy")||e.has("lastSortBy")||e.has("customExpressionCheck"))&&(e.has("sortBy")&&(this.lastSortBy=this.sortBy??this.lastSortBy),this.updateGroupedLists())}loaded(){this.setUpObserver(),this.listOnly?this.listNode.value?.setFocus():(this.flowElement.value?.setFocus(),this.checkMaxHeight())}disconnectedCallback(){super.disconnectedCallback(),this.observer?.disconnect()}setUpObserver(){this.observer=new MutationObserver(e=>{for(let t of e)t.attributeName==="style"&&this.popoverNode.value&&this.dropdownNode.value&&this.popoverNode.value.style.visibility==="hidden"&&(this.dropdownNode.value.open=!1)})}checkMaxHeight(){setTimeout(()=>this.checkPanelMaxHeight(),200),setTimeout(()=>this.checkPanelMaxHeight(),500),setTimeout(()=>this.checkPanelMaxHeight(),1e3),setTimeout(()=>this.checkPanelMaxHeight(),1500)}checkPanelMaxHeight(){if(this.panelCutOffHeight===0){let e=this.panelElement.value?.getBoundingClientRect();if(e&&e.bottom>window.innerHeight){this.panelCutOffHeight=e.height-(e.bottom-window.innerHeight)-5;let t=this.listNode.value?.getBoundingClientRect();t&&(this.listNode.value.style.maxHeight=`${t.height-(e.bottom-window.innerHeight)-5}px`)}}}getSortedList(e){let t=[...e],i=t.filter(s=>s.type==="none");return t=t.filter(s=>s.type!=="none"),this.lastSortBy==="display"?t.sort((s,o)=>s.alias.localeCompare(o.alias)):this.lastSortBy==="field"?t.sort((s,o)=>s.name.localeCompare(o.name)):this.lastSortBy==="type"&&t.sort((s,o)=>s.type.localeCompare(o.type)),t=t.concat(i),t}isExpression(e){return this.customExpressionCheck?this.customExpressionCheck(e):e.name.includes(u.expression)}canDeselectAll(){let e=this.getAllFields();return this.filterFields?.length?this.filterContainsAll():this.selectedFields.length===e.length}filterContainsAll(){return!!this.filterFields?.every(e=>this.selectedFields.some(t=>t===e))}showFieldInfoCheck(e){let{layer:t}=this;return this.showFieldInfo?!(!t||this.isExpression(e)||e.name.includes(u.relationship)||e.type==="none"):!1}updateGroupedLists(){if(this.fields)if(this.allLists=[],this.usingCustomGroups())for(let e of this.fields)this.allLists.push({title:e.title,fields:[...this.getSortedList(e.fields)]});else this.allLists=this.groupFieldsAndExpressions?[{title:this.expressionsGroupHeading,fields:[...this.getSortedList(this.fields)].filter(e=>this.isExpression(e))},{title:this.fieldsGroupHeading,fields:[...this.getSortedList(this.fields)].filter(e=>!this.isExpression(e))}]:[{title:void 0,fields:[...this.getSortedList(this.fields)]}]}addFieldInfoFlowItem(e,t){let i=this.flowElement.value,s=S(l`<calcite-flow-item selected .heading=${e.alias??e.name} .description=${e.name} class="panel" style=${g(this.panelCutOffHeight>0?`max-height: ${this.panelCutOffHeight}px`:"max-height: 50vh")} @calciteFlowItemBack=${o=>{o.currentTarget.remove(),this.fieldInfoFlowItemEl.value.selected=!1,this.panelElement.value.selected=!0,setTimeout(()=>{t.setFocus()},300)}} ${d(this.fieldInfoFlowItemEl)}><arcgis-field-info lang=${this._messages._lang??h} .fieldName=${e.name} .layer=${this.layer} .view=${this.view} class="content"></arcgis-field-info></calcite-flow-item>`);i.appendChild(s),this.panelElement.value.selected=!1,this.fieldInfoFlowItemEl?.value.setFocus()}usingCustomGroups(){return!!this.fields.length&&"fields"in this.fields[0]}getAllFields(){return this.allLists.map(e=>e.fields).flat()}setSortBy(e){this.lastSortBy=e,this.updateGroupedLists(),this.arcgisSortByChange.emit(this.lastSortBy),this.arcgisFieldPickListSortByChange.emit(this.lastSortBy),this.reorderSelectedFieldsByCurrentListOrder()&&(this.arcgisChange.emit({selectedFields:this.selectedFields}),this.arcgisFieldPickListChange.emit({selectedFields:this.selectedFields}))}reorderSelectedFieldsByCurrentListOrder(){if(!this.selectedFields.length)return!1;let e=this.getAllFields().map(o=>o.name),t=new Set(this.selectedFields),i=e.filter(o=>t.has(o)),s=i.length!==this.selectedFields.length||i.some((o,p)=>o!==this.selectedFields[p]);return s&&(this.selectedFields=[...i]),s}render(){return this._propWatcherTask.render({complete:()=>{if(this.listOnly)return this.renderList();let e=this.heading||(this.multiple?this._messages.headerSelect:this._messages.header),t=this.popoverProps;return this.el.classList.add("js-app-flyout"),f(`${t.autoClose}`,l`<calcite-popover .placement=${t.placement??"leading-start"} open pointer-disabled .referenceElement=${t.refElement} .offsetDistance=${t.offsetDistance??-Math.round(t.refElement.getBoundingClientRect().width)} .offsetSkidding=${t.offsetSkidding??0} .overlayPositioning=${t.overlayPositioning} trigger-disabled .autoClose=${t.autoClose} .label=${this.heading??(this.multiple?this._messages.headerSelect:this._messages.header)??""} @calcitePopoverClose=${()=>{this.arcgisClose.emit(),this.arcgisFieldPickListDismissed.emit()}} ${d(this.popoverNode)}><calcite-flow style=${g({width:`${t.popoverWidth??t.refElement.getBoundingClientRect().width}px`,...t.maxHeight&&{maxHeight:t.maxHeight}})} ${d(this.flowElement)}><calcite-flow-item class="panel" .heading=${e} closable @calciteFlowItemClose=${()=>{this.arcgisClose.emit(),this.arcgisFieldPickListDismissed.emit()}} ${d(this.panelElement)}><slot slot=content-top name=content-top></slot>${this.renderList()}<slot slot=content-bottom name=content-bottom></slot>${(this.multiple||!this.hideCancel)&&l`<div slot=footer class="footer"><slot name=content-footer></slot>${this.multiple&&!this.hideCancel?l`<div class="add-cancel-buttons">${this.renderAddButton()}${this.renderCancelButton()}</div>`:l`${this.renderAddButton()}${this.renderCancelButton()}`}</div>`||""}</calcite-flow-item></calcite-flow></calcite-popover>`)},error:()=>""})}renderList(){let e=this.heading||(this.multiple?this._messages.headerSelect:this._messages.header),t=this.getAllFields(),i=t.length>=this.showFilterLength;return l`${t.length?l`<calcite-list .label=${e} .selectionMode=${this.multiple?"multiple":"single"} class=${C(this.listOnly?"":"content")} .filterEnabled=${i} .filterPlaceholder=${this.filterPlaceholderText??this._messages.filter} @calciteListChange=${()=>{let s=this.listNode.value.selectedItems.map(c=>c.value),o=this.selectedFields.filter(c=>s.includes(c)),p=s.filter(c=>!this.selectedFields.includes(c));this.selectedFields=[...new Set([...o,...p])],this.reorderSelectedFieldsByCurrentListOrder(),this.arcgisChange.emit({selectedFields:this.selectedFields}),this.arcgisFieldPickListChange.emit({selectedFields:this.selectedFields}),this.multiple||(this.arcgisClose.emit({selectedFields:this.selectedFields}),this.arcgisFieldPickListDismissed.emit({selectedFields:this.selectedFields}))}} @calciteListFilter=${s=>{s.stopPropagation(),this.filterFields=this.listNode.value.filteredItems?.map(o=>o.value),this.filterText=this.listNode.value.filterText}} ${d(this.listNode)}>${this.renderSortButton()}<slot name=content-center></slot>${this.multiple&&this.showSelectionAll&&(!i||!this.filterText||this.filterFields?.length)?this.renderSelectionButton():null}${this.renderListItems()}</calcite-list>`:l`<slot name=no-fields></slot>`}${this.filterFields&&!this.filterFields.length&&this.listNode.value&&this.filterNoResultsText?.length!==0?l`<div class="no-match-text">${this.filterNoResultsText??this._messages.noMatches}</div>`:null}`}renderSortButton(){let e=this.getAllFields();if(!(e.length>=this.showFilterLength&&!this.hideSort))return"";let t=e.every(i=>!!i.type);return l`<calcite-dropdown slot=filter-actions-end placement=bottom-end overlay-positioning=fixed .disabled=${this.filterFields?this.filterFields.length<4:!1} @calciteDropdownOpen=${()=>{this.observer?.disconnect(),this.popoverNode.value&&this.observer?.observe(this.popoverNode.value,{attributes:!0})}} @calciteDropdownClose=${()=>this.observer?.disconnect()} ${d(this.dropdownNode)}><calcite-action slot=trigger .text=${this._messages.sort??""} title=${this._messages.sort??h}><calcite-icon scale=s icon=sortDescending flip-rtl></calcite-icon></calcite-action><calcite-dropdown-group><calcite-dropdown-item .selected=${this.lastSortBy==="default"} @calciteDropdownItemSelect=${()=>this.setSortBy("default")}>${this._messages.default}</calcite-dropdown-item><calcite-dropdown-item .selected=${this.lastSortBy==="display"} @calciteDropdownItemSelect=${()=>this.setSortBy("display")}>${this._messages.displayName}</calcite-dropdown-item>${t&&l`<calcite-dropdown-item .selected=${this.lastSortBy==="type"} @calciteDropdownItemSelect=${()=>this.setSortBy("type")}>${this._messages.type}</calcite-dropdown-item>`||""}<calcite-dropdown-item .selected=${this.lastSortBy==="field"} @calciteDropdownItemSelect=${()=>this.setSortBy("field")}>${this._messages.fieldName}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`}renderSelectionButton(){return l`<div class="selection-button-div"><calcite-button appearance=transparent scale=s width=full @click=${()=>{if(this.canDeselectAll())this.selectedFields=this.filterFields?.length?this.selectedFields.filter(e=>!this.filterFields?.includes(e)):[];else if(this.filterFields?.length)this.selectedFields=[...new Set([...this.selectedFields,...this.filterFields])];else{let e=this.getAllFields();this.selectedFields=e.map(t=>t.name)}this.reorderSelectedFieldsByCurrentListOrder(),this.arcgisChange.emit({selectedFields:this.selectedFields}),this.arcgisFieldPickListChange.emit({selectedFields:this.selectedFields})}}>${this.canDeselectAll()?this._messages.deselectAll:this._messages.selectAll}</calcite-button></div>`}renderListItems(){let e=this.allLists.filter(t=>!!t.fields.length);return e.length===1&&!e[0].title?e[0].fields.map(t=>this.renderCalciteListItem(t)):e.map(t=>l`<calcite-list-item-group .heading=${t.title}>${t.fields.map(i=>this.renderCalciteListItem(i))}</calcite-list-item-group>`)}renderCalciteListItem(e){let t=this.showFieldInfoCheck(e),i=this.showFieldTypeIcon&&!!e.type;return f(e.name,l`<calcite-list-item .label=${e.alias||e.name} .description=${(()=>{if(this.showFieldName&&e.hideFieldName!==!0)return`{${e.name}}`;if(this.showDescription&&e.hideDescription!==!0&&e.description)return e.description})()} .value=${e.name} .selected=${!this.multiple&&e.name===this.selectedFields[0]||this.multiple&&this.selectedFields.includes(e.name)} .metadata=${{label:e.alias,fieldName:e.name}}>${i&&l`<div slot=actions-end class="field-icons">${L({fieldType:e.type})}</div>`||""}${this.renderInfoAction(e,t)}${this.renderEditAction(e)}${this.renderDeleteAction(e)}</calcite-list-item>`)}renderInfoAction(e,t){let{_messages:i}=this;return t?l`<calcite-action slot=actions-end .text=${i.info} title=${i.info??h} scale=s icon=information @click=${s=>{s.stopPropagation();let o=s.currentTarget;this.addFieldInfoFlowItem(e,o)}}></calcite-action>`:""}renderEditAction(e){let{_messages:t}=this;return e.showEditAction?l`<calcite-action slot=actions-end .text=${t.edit} title=${t.edit??h} scale=s icon=pencil @click=${i=>{i.stopPropagation(),this.arcgisEditField.emit({fieldName:e.name})}}></calcite-action>`:""}renderDeleteAction(e){let{_messages:t}=this;return e.showDeleteAction?l`<calcite-action slot=actions-end .text=${t.delete} title=${t.delete??h} scale=s icon=trash @click=${i=>{i.stopPropagation(),this.arcgisDeleteField.emit({fieldName:e.name})}}></calcite-action>`:""}renderAddButton(){return this.multiple?l`<calcite-button .appearance=${this.hideCancel?"outline-fill":"solid"} .width=${this.hideCancel?"full":"half"} @click=${()=>{this.arcgisClose.emit({selectedFields:this.selectedFields}),this.arcgisFieldPickListDismissed.emit({selectedFields:this.selectedFields})}}>${this.okBtnText||(this.multiple?this._messages.done:this._messages.ok)}</calcite-button>`:""}renderCancelButton(){return this.hideCancel?"":l`<calcite-button appearance=outline-fill .width=${this.multiple?"half":"full"} @click=${()=>{this.arcgisClose.emit(),this.arcgisFieldPickListDismissed.emit()}}>${this._messages.cancel}</calcite-button>`}};x("arcgis-field-pick-list",F);export{F as ArcgisFieldPickList};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{e as w,g as x,o as E,p as D}from"./Z5QBBHLD.js";import{a as B,b as f,c as T}from"./XRQOTHR7.js";import{a as A}from"./7KADEPAK.js";import"./4BK7PZE3.js";import"./TWW63D32.js";import{a as C}from"./TJ7PO6GP.js";import{B as R,C as U,D as H,J as _,h as O,j as Z,n as $,o as F,s as I}from"./PECTYCLV.js";export default $arcgis.t(([{formatDate:N,convertDateFormatToIntlOptions:y,formatDateOnly:ie,formatTimeOnly:se,formatTimestamp:M,formatNumber:ae},ne,K,{clone:S}])=>{function W(i){return new Date(`1970-01-01T${i}Z`).getTime()}function P(i){return new Date(`${i} 00:00:00`).getTime()}function oe(i,e,s){let t;return e==="unknown"?t=N(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):t=N(i,{...y("short-date-short-time"),timeZone:e}),t}function le(i){return i?ie(i,y("short-date")):""}function re(i){let e;return typeof i=="string"?e=se(i,y("short-date-long-time")):e=N(i,{...y("long-time"),timeZone:"utc"}),e}function ue(i,e){return typeof i=="string"?e&&"timeZone"in e&&e.timeZone==="unknown"?M(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):M(i,{...y("short-date-short-time"),timeZone:e&&"timeZone"in e&&e.timeZone?e.timeZone:"system"}):e&&"timeZone"in e&&e.timeZone==="unknown"?N(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):N(i,{...y("short-date-short-time"),timeZone:e&&"timeZone"in e&&e.timeZone?e.timeZone:"system"})}function j(i,e,s){if(!w(i)&&!D(i)&&!E(i)&&!x(i))return;let t;return T(i,s).fields.forEach(l=>{let a=l.name,c="domain"in l?l.domain:void 0;if(!x(i)&&i.subtypeField===a){let m;E(i)||w(i)?m=i.subtypes:m=i.parent.subtypes,m.forEach(r=>{D(i)&&i.subtypeCode!==r.code||(e.name===a&&(t=t||[],t.push({code:r.code,name:r.name})),r.domains&&Object.keys(r.domains).forEach(n=>{if(e.name===n){let o=r.domains[n];o?.type==="coded-value"&&o?.codedValues&&o.codedValues.forEach(u=>{let d=!1;t=t||[],t.forEach(g=>{g.code===u.code&&(d=!0,`| ${g.name} |`.includes(`| ${u.name} |`)||(g.name+=` | ${u.name}`))}),d||t.push({code:u.code,name:u.name})})}}))})}if(e.name===a&&(w(i)||x(i))){let m=w(i)?i.typeIdField:void 0,r=w(i)?i.types:void 0;w(i)&&m&&r?(m===a?t=r.map(n=>({code:n.id,name:n.name})):(t=t||[],r.forEach(n=>{if(!n.domains?.[a]||n.domains[a].type==="inherited"){let o=c;o?.codedValues&&o.codedValues.forEach(u=>{let d=!1;t.forEach(g=>{g.code===u.code&&(d=!0,`| ${g.name} |`.includes(`| ${u.name} |`)||(g.name+=` | ${u.name}`))}),d||t.push(S(u))})}else n.domains?.[a]?.codedValues&&n.domains[a].codedValues.forEach(o=>{let u=!1;t.forEach(d=>{d.code===o.code&&(u=!0,`| ${d.name} |`.includes(`| ${o.name} |`)||(d.name+=` | ${o.name}`))}),u||t.push(S(o))})})),!t?.length&&c?.codedValues&&(t=S(c.codedValues))):c?.codedValues&&(t=c.codedValues)}}),t}function L(i,e){let s=e;if(s){let t="";for(let l=0;l<s.length;l++){let a=s[l];a.code==i&&(t+=(t.length?" | ":"")+a.name)}return t.length||(t=`${i}`),t}return i}function G(i){return["small-integer","big-integer","integer","single","double","long"].includes(i.type)}function J(i){switch(i.type){case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":return"number";case"blob":case"geometry":case"global-id":case"guid":case"oid":case"raster":case"xml":return;default:return i.type}}var de=O`:host{width:100%}.container{min-height:30px}.popover-unique-list{width:100%;overflow-y:auto}.unique-values-content-list-msg{font-size:75%;margin:5px}.count{padding:0 6px;font-size:smaller;white-space:nowrap}`,k=class extends H{constructor(){super(...arguments),this.dropdownNode=R(),this.initialized=!1,this._messages=A({blocking:!0}),this._propWatcherTask=new B(this,{task:async([e,s,t])=>{let l=f(e)&&f(s)||f(t);if(!f(t)&&!f(e)&&!f(s)?$("error",this,F("uniqueValues")):f(t)||(f(e)||$("error",this,F("layer")),f(s)||$("error",this,F("fieldName"))),f(e)&&f(s)){let{visualizationSource:a}=this;if(!T(e,a).fields?.filter(c=>c.name===s))throw $("error",this,"Field could not be found."),new Error}if(!l)throw new Error;await this.processProps(),this._propWatcherTask.autoRun=!1},args:()=>[this.layer,this.fieldName,this.uniqueValues]}),this.initialRender=!0,this.multiple=!1,this.partialUniqueValues=!1,this.showFilterLength=10,this.arcgisChange=I(),this.arcgisSortByChange=I(),this.arcgisLoad=I()}static{this.properties={initialRender:16,view:0,layer:0,visualizationSource:1,fieldName:1,uniqueValues:0,numberFormatOptions:0,selectedValues:0,sortBy:1,multiple:5,partialUniqueValues:5,showFilterLength:9,maxHeight:9}}static{this.styles=de}async setFocus(){this.listNode?.setFocus()}async getUniqueValues(){let{fieldInfo:e}=this;if(f(e?.uniqueValueInfos)){let{uniqueValueInfos:s,partialUniqueValues:t}=e;return{uniqueValues:s,partialUniqueValues:t}}}loaded(){this.layer&&this.fieldInfo&&(setTimeout(()=>this.initialRender=!1,800),this.listNode?.setFocus())}async willUpdate(e){this.initialized&&(e.has("layer")||e.has("visualizationSource")||e.has("fieldName")||e.has("uniqueValues"))&&(await this.processProps(),this.requestUpdate()),e.has("maxHeight")&&this.maxHeight&&this.listNode?.setAttribute("style",`max-height: ${this.maxHeight||400}px`)}async processProps(){let{layer:e,fieldName:s,view:t,visualizationSource:l}=this,a=(e?T(e,l):void 0)?.fields?.filter(c=>c.name===s)?.[0];if(!a){$("error",this,`Field '${s}' not found in layer`),this.fieldInfo={layerField:a,fieldDomains:void 0,simpleType:void 0,partialUniqueValues:!1,uniqueValueInfos:[]};return}if(f(this.uniqueValues))this.fieldInfo={layerField:a,fieldDomains:e&&a?j(e,a,l):void 0,simpleType:e&&a?J(a):void 0,partialUniqueValues:this.partialUniqueValues??!1,uniqueValueInfos:this.uniqueValues},this.arcgisLoad.emit();else if(e&&a){this.fieldInfo={layerField:a,fieldDomains:j(e,a,l),simpleType:J(a),partialUniqueValues:!1};let{fieldInfo:c}=this;try{let m=await ne({layer:e,view:t,field:s,sqlWhere:"definitionExpression"in e?e.definitionExpression??void 0:void 0,forBinning:l==="feature-reduction"}),r=G(a),n=m.uniqueValueInfos.filter(o=>f(o.value)?a.type==="string"&&!r||a.type==="guid"?o.value!=="<Null>"&&`${o.value}`.trim()!=="":(G(a)||a.type,o.value!=="<Null>"&&o.value!==""):!1);n.sort((o,u)=>o.count>u.count?-1:o.count<u.count?1:0),c.fieldDomains?.length&&c.fieldDomains.forEach(o=>{n.find(u=>u.value===o.code)||n.push({value:o.code,count:0})}),c.uniqueValueInfos=n,c.partialUniqueValues=m.uniqueValueInfos.length===2e3,this.initialized||this.arcgisLoad.emit(),this.setUpTimeZoneHandle(),this.initialized=!0}catch(m){if($("error",this,`uniqueValues() - ${m.message}`),this.hasFieldDomains(c)){let r=[];c.fieldDomains.forEach(n=>{r.find(o=>o.value===n.code)||r.push({value:n.code,count:void 0})})}this.initialized=!0}setTimeout(()=>{this.initialRender=!1,this.listNode?.setFocus()},800)}}setListRef(e){let{maxHeight:s}=this;this.listNode=e,s&&e?.setAttribute("style",`max-height: ${s||400}px`)}onSortMenuSelect(e){let s=e.currentTarget.selectedItems?.[0].getAttribute("data-value");this.sortBy=s||void 0,this.arcgisSortByChange.emit(s||void 0)}setUpTimeZoneHandle(){this.timeZoneHandle?.remove();let{view:e,fieldInfo:s}=this;s.simpleType&&["date","timestamp-offset"].includes(s.simpleType)&&(this.timeZoneHandle=K.watch(()=>e?.timeZone,()=>this.requestUpdate()))}isSameLists(e,s){if(!e&&!s)return!0;if(!e||!s||e?.length!==s?.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==s[t])return!1;return!0}hasFieldDomains(e){return!!e.fieldDomains?.length}render(){return this._propWatcherTask.render({complete:()=>{let{fieldInfo:e,selectedValues:s,sortBy:t,multiple:l,initialRender:a,showFilterLength:c,_messages:m}=this,{fieldDomains:r,uniqueValueInfos:n,partialUniqueValues:o,layerField:u}=e,d=u?.type;if(!n?.length)return"";let g=d?["small-integer","big-integer","integer","single","double","long","oid"].includes(d):!1,Q=d?["date","date-only","time-only"].includes(d):!1,X=v=>{v.sort((h,p)=>h.count<=p.count?1:-1)},Y=v=>{let h=r?.length;v.sort((p,V)=>{if(!h&&g)return(typeof p.value=="string"?Number.parseFloat(p.value):p.value)-(typeof V.value=="string"?Number.parseFloat(V.value):V.value);{let q=h?L(p.value,r):p.label??p.value,b=h?L(V.value,r):V.label??V.value;return`${q}`.startsWith("_")?1:`${b}`.startsWith("_")?-1:`${q}`.localeCompare(`${b}`)}})},ee=(v,h)=>{v.sort((p,V)=>{let q=h?.indexOf(p.value)??-1,b=h?.indexOf(V.value)??-1;return q===b||q>-1&&b>-1?0:q>b?-1:1})};Y(n),!t||t==="count"?X(n):t==="selected"&&ee(n,s);let te=n.map(v=>this.renderUniqueValue(v)),z;return o&&!a&&(z=Z`<div class="unique-values-content-list-msg">${m.errors.tooManyUniqueValues}</div>`),Z`<div class="container"><calcite-list .label=${m.values} class="popover-unique-list" .filterEnabled=${n.length>=c} .selectionMode=${l?"multiple":"single"} .filterPlaceholder=${m.searchValues} @calciteListChange=${v=>{let h=v.currentTarget.selectedItems.map(p=>p.value);!r&&d==="date-only"?h=h?.map(p=>P(p)):!r&&d==="time-only"?h=h?.map(p=>W(p)):d&&["date","oid","small-integer","big-integer","integer","long"].includes(d)?h=h?.map(p=>Number.parseInt(p)):d&&["single","double"].includes(d)&&(h=h?.map(p=>Number.parseFloat(p))),!this.isSameLists(h,this.selectedValues)&&(this.selectedValues=h,this.arcgisChange.emit(h))}} @calciteListFilter=${()=>{this.dropdownNode.value&&(this.dropdownNode.value.disabled=this.listNode.filteredItems.length<4)}} ${U(this.setListRef)}>${n.length>=c&&!a?this.renderSort(g,Q):null}${te}</calcite-list>${z}</div>`},error:()=>""})}renderSort(e,s){let{sortBy:t,_messages:l}=this;return Z`<calcite-dropdown slot=filter-actions-end placement=bottom-end overlay-positioning=fixed @calciteDropdownSelect=${this.onSortMenuSelect} ${U(this.dropdownNode)}><calcite-action slot=trigger .label=${l.sortValues} text><calcite-icon scale=s icon=sortDescending flip-rtl></calcite-icon></calcite-action><calcite-dropdown-group><calcite-dropdown-item .selected=${t==="count"||!f(t)} data-value=count>${l.sortByCount}</calcite-dropdown-item><calcite-dropdown-item .selected=${t==="name"} data-value=name>${e||s?l.sortAscending:l.sortAlphabetical}</calcite-dropdown-item><calcite-dropdown-item .selected=${t==="selected"} data-value=selected>${l.sortSelected}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`}renderUniqueValue(e){let{selectedValues:s,initialRender:t,view:l,fieldInfo:a,numberFormatOptions:c}=this,{fieldDomains:m,uniqueValueInfos:r,simpleType:n}=a,o=l&&"timeZone"in l&&l.timeZone||"system",u=m?.length?L(e.value,m):n==="date"?oe(e.value,o):n==="date-only"?le(e.value):n==="time-only"?re(e.value):n==="timestamp-offset"?ue(e.value,l):typeof e.value=="number"?ae(e.value,c):e.label??e.value,d=s?n==="date-only"?s.includes(m?.length?e.value:P(e.value)):n==="time-only"?s.includes(m?.length?e.value:W(e.value)):s.includes(e.value):!1;return C(`list-item_${e.value}`,Z`<calcite-list-item .label=${`${u}`} .value=${`${e.value}`} .selected=${d}>${f(e.count)&&(r.length>200&&!t||r.length<=200)?Z`<div class="count" slot=actions-end>${`${e.count}`}</div>`:null}</calcite-list-item>`)}};_("arcgis-unique-values-list",k);return k},"intl","smartMapping/statistics/uniqueValues","core/reactiveUtils","core/lang")
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{I as a,x as e}from"./PECTYCLV.js";var i=e(a,{"arcgis-ckeditor5":[()=>import("./XG35NKST.js"),"canResizeVertically,currentLanguage,customConfig,customExpressionCheck:,editorType,groupFieldsAndExpressions,intlExpressionsGroupHeading,intlFieldsGroupHeading,intlTextPlaceHolder,mentionFields:,readOnly,textData;getData,setFocus"],"arcgis-ckeditor5-popover":[()=>import("./HY65JC4L.js"),"guid,intlCancel,intlLabel,intlOk,refElement:;reposition"],"arcgis-color-input":[()=>import("./GPWZ4YLQ.js"),"_messages:,clearable,color,compact,disabled,hideRecentColors,messageOverrides:,placement,popoverProps:,showTransparency,storageId;close,setFocus;isOpen"],"arcgis-coordinate-system-picker":[()=>import("./XQRXHSM5.js"),"_messages:,autoFilterToDefault,defaultWkid,filterEnabled,hideCategories:,value:;getSRDescription"],"arcgis-coordinate-system-picker-tree":[()=>import("./J2J3YRCY.js"),"data:,value"],"arcgis-field-info":[()=>import("./
|
|
2
|
+
import{I as a,x as e}from"./PECTYCLV.js";var i=e(a,{"arcgis-ckeditor5":[()=>import("./XG35NKST.js"),"canResizeVertically,currentLanguage,customConfig,customExpressionCheck:,editorType,groupFieldsAndExpressions,intlExpressionsGroupHeading,intlFieldsGroupHeading,intlTextPlaceHolder,mentionFields:,readOnly,textData;getData,setFocus"],"arcgis-ckeditor5-popover":[()=>import("./HY65JC4L.js"),"guid,intlCancel,intlLabel,intlOk,refElement:;reposition"],"arcgis-color-input":[()=>import("./GPWZ4YLQ.js"),"_messages:,clearable,color,compact,disabled,hideRecentColors,messageOverrides:,placement,popoverProps:,showTransparency,storageId;close,setFocus;isOpen"],"arcgis-coordinate-system-picker":[()=>import("./XQRXHSM5.js"),"_messages:,autoFilterToDefault,defaultWkid,filterEnabled,hideCategories:,value:;getSRDescription"],"arcgis-coordinate-system-picker-tree":[()=>import("./J2J3YRCY.js"),"data:,value"],"arcgis-field-info":[()=>import("./2C7SVAMP.js"),"_messages:,fieldName,hideAlias,hideNumericFormat,hideStatistics,layer:,view:;refresh"],"arcgis-field-pick-list":[()=>import("./5WGBTOWN.js"),"_messages:,customExpressionCheck:,expressionsGroupHeading,fields:,fieldsGroupHeading,filterNoResultsText,filterPlaceholderText,groupFieldsAndExpressions,heading,hideCancel,hideSort,layer:,listOnly,mapView:,multiple,okBtnText,popoverProps:,selectedFields:,showCancel,showDescription,showFieldInfo,showFieldName,showFieldTypeIcon,showFilterLength,showSelectionAll,showSort,sortBy,view:;reposition,setDisabled,setFocus"],"arcgis-histogram":[()=>import("./UK2G5LXU.js"),"_messages:,average,bins:,colorBlendingEnabled,colorStops:,dataLines:,icon,label,labelFormatter:,layout,max,messageOverrides:,min,standardDeviation,standardDeviationCount"],"arcgis-label-input":[()=>import("./BOSIIV32.js"),"alignment,editing,labelFormatter:,readOnly,value;edit;getLabelBoundingClientRect"],"arcgis-picker-input":[()=>import("./TTH3HGVV.js"),"disabled,heading,iconEnd,intlDone,label,popoverProps:;close,setFocus"],"arcgis-ramp-color":[()=>import("./JZRBBRRT.js"),"layout,max,min,stops:"],"arcgis-ramp-color-break":[()=>import("./XCIAOWMG.js"),"layout,max,min,stops:"],"arcgis-ramp-opacity":[()=>import("./SQL3PEL7.js"),"fillColor,layout,max,min,stops:"],"arcgis-slider":[()=>import("./SJFYZOCS.js"),"activeValue:,allowValuesOverlap,autoDestroyDisabled,disabled,fillPlacement,fullRangeMax,fullRangeMin,keyboardLargeStep,labelFormatter:,layout,max,messageOverrides:,messages:,min,mirrored,popoverLabel,popoverPlacement,precision,rangeLabelsEditingEnabled,rangeLabelsPlacement,segmentsDraggingDisabled,showRangeLabels,steps,valueLabelsDisplay,valueLabelsEditingEnabled,valueLabelsPlacement,values;destroy"],"arcgis-slider-field":[()=>import("./CA7QB7UT.js"),"activeValue:,disabled,fieldType,fillPlacement,label,labelFormatter:,layout,max,messageOverrides:,messages:,min,mirrored,popoverLabel,rangeLabelsEditingEnabled,rangeLabelsPlacement,showRangeLabels,valueLabelsDisplay,valueLabelsEditingEnabled,valueLabelsPlacement,values,valuesAsDateOnly:,valuesAsFieldType:,valuesAsNumbers:,valuesAsTimeOnly:,valuesAsTimestampOffset:"],"arcgis-slider-input":[()=>import("./DFDXMCOB.js"),"disabled,flipLabels,label,max,min,scale,step,unitsLabel,value,withSteppers"],"arcgis-ticks":[()=>import("./T62KUQBN.js"),"interactive,interpolationExponent,labelFormatter:,labelPlacement,layout,max,min,mirrored,mode,showBaseline,showLabels,values"],"arcgis-toolbar":[()=>import("./JJY3CFBU.js"),"barElement:,layout,relativePosition,scale,toolbarKind,tooltipAppearance"],"arcgis-toolbar-action":[()=>import("./FBLD2E3Y.js"),"actionElement:,active,appearance,disabled,icon,iconFlipRtl,indicator,kind,labelText,loading,textEnabled,tooltipText;;measure,proxiedRender"],"arcgis-toolbar-group":[()=>import("./CH6HYVI6.js"),"preferEndSlot,priority;;measure,proxiedRender"],"arcgis-toolbar-item":[()=>import("./XW5YJXMI.js"),"actionElement:,active,disabled,icon,iconFlipRtl,labelText,lastActivated:,loading,tooltipText;;measure,proxiedRender"],"arcgis-toolbar-more-button":[()=>import("./2YGG7LXT.js"),"menuAppearance,overflowActionLabel,priority;;measure,proxiedRender"],"arcgis-toolbar-split-button":[()=>import("./YCQN4TJE.js"),"menuAppearance,overflowActionLabel,priority;;measure,proxiedRender"],"arcgis-unique-values-list":[()=>import("./ETMH4DV6.js"),"_messages:,fieldName,layer:,maxHeight,multiple,numberFormatOptions:,partialUniqueValues,selectedValues:,showFilterLength,sortBy,uniqueValues:,view:,visualizationSource;getUniqueValues,setFocus"],"arcgis-value-picker":[()=>import("./PTJVWB67.js"),"autoDestroyDisabled,disabled,hideNextButton,hidePlayButton,hidePreviousButton,icon,label,layout,loop,messages:,playRate,state:;destroy;next,pause,play,previous"],"arcgis-value-picker-collection":[()=>import("./WVOAAHEV.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue:,items:;destroy;reset,step"],"arcgis-value-picker-combobox":[()=>import("./FJAIY6NX.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue:,disabled,items:,messages:;destroy;reset,step"],"arcgis-value-picker-label":[()=>import("./PHM5ZZMN.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue:,items:;destroy;reset,step"],"arcgis-value-picker-slider":[()=>import("./OVZV6YGZ.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue,disabled,labelFormatter:,labels:,layout,majorTicks:,max,min,minorTicks:,mirrored,steps:;destroy;reset,step"]});i({resourcesUrl:import.meta.url});var r=new CSSStyleSheet;r.replaceSync("@layer{:not([hydrated]):is(arcgis-ckeditor5,arcgis-ckeditor5-popover,arcgis-color-input,arcgis-coordinate-system-picker,arcgis-coordinate-system-picker-tree,arcgis-field-info,arcgis-field-pick-list,arcgis-histogram,arcgis-label-input,arcgis-picker-input,arcgis-ramp-color,arcgis-ramp-color-break,arcgis-ramp-opacity,arcgis-slider,arcgis-slider-field,arcgis-slider-input,arcgis-ticks,arcgis-toolbar,arcgis-toolbar-action,arcgis-toolbar-group,arcgis-toolbar-item,arcgis-toolbar-more-button,arcgis-toolbar-split-button,arcgis-unique-values-list,arcgis-value-picker,arcgis-value-picker-collection,arcgis-value-picker-combobox,arcgis-value-picker-label,arcgis-value-picker-slider){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,r];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,a)
|
|
@@ -58,8 +58,9 @@ export abstract class ArcgisColorInput extends LitElement {
|
|
|
58
58
|
selectColor?: string | undefined;
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
|
+
* @deprecated
|
|
62
|
+
* use popoverProps.placement instead.
|
|
61
63
|
* Determines where the popup color picker will be positioned relative to the color input.
|
|
62
|
-
*
|
|
63
64
|
* @default "auto"
|
|
64
65
|
*/
|
|
65
66
|
accessor placement: Popover["placement"];
|
|
@@ -343,9 +343,7 @@ class Fe extends Q {
|
|
|
343
343
|
setUpTimeZoneHandle() {
|
|
344
344
|
this.timeZoneHandle?.remove();
|
|
345
345
|
const { props: e } = this, { view: t, fieldInfo: i } = e;
|
|
346
|
-
["date", "timestamp-offset"].includes(this._getStatisticsType(i)) && (this.timeZoneHandle = x.watch(() => t?.timeZone, () =>
|
|
347
|
-
this.requestUpdate();
|
|
348
|
-
}));
|
|
346
|
+
["date", "timestamp-offset"].includes(this._getStatisticsType(i)) && (this.timeZoneHandle = x.watch(() => t?.timeZone, () => this.requestUpdate()));
|
|
349
347
|
}
|
|
350
348
|
_getFieldTypeLabel(e) {
|
|
351
349
|
const { _messages: t } = this, i = t.fieldTypes;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { keyed as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { createRef as
|
|
2
|
+
import { c as w } from "../../chunks/runtime.js";
|
|
3
|
+
import { keyed as u } from "lit/directives/keyed.js";
|
|
4
|
+
import { LitElement as y, createEvent as a, renderElement as $, nothing as h, safeStyleMap as f, safeClassMap as v } from "@arcgis/lumina";
|
|
5
|
+
import { createRef as r, ref as c } from "lit/directives/ref.js";
|
|
6
6
|
import { html as l, css as C } from "lit";
|
|
7
7
|
import { Task as S } from "@lit/task";
|
|
8
|
-
import { log as
|
|
9
|
-
import { F
|
|
8
|
+
import { log as g, composeMissingPropertyMessage as x } from "@arcgis/toolkit/log";
|
|
9
|
+
import { F } from "../../chunks/internal-types.js";
|
|
10
10
|
import { i as b } from "../../chunks/general.js";
|
|
11
11
|
import { u as k } from "../../chunks/useT9n.js";
|
|
12
12
|
const n = /* @__PURE__ */ new Map();
|
|
@@ -26,23 +26,23 @@ n.set("date-only", "calendar");
|
|
|
26
26
|
n.set("time-only", "clock");
|
|
27
27
|
n.set("timestamp-offset", "time-zone");
|
|
28
28
|
n.set("string", "string");
|
|
29
|
-
const
|
|
30
|
-
class I extends
|
|
29
|
+
const B = ({ fieldType: m }) => l`<calcite-icon scale=s .icon=${n.get(m)}></calcite-icon>`, L = C`.panel{min-height:250px}.content{max-height:50vh}.field-icons{display:flex;align-items:center;padding:0 var(--calcite-space-sm)}.selection-button-div{padding:var(--calcite-space-2xs) var(--calcite-space-sm-plus)}.no-match-text{padding:var(--calcite-space-md)}.footer{width:100%}.add-cancel-buttons{display:flex;align-content:space-between}`;
|
|
30
|
+
class I extends y {
|
|
31
31
|
constructor() {
|
|
32
|
-
super(...arguments), this._messages = k({ blocking: !0 }), this.popoverNode =
|
|
32
|
+
super(...arguments), this._messages = k({ blocking: !0 }), this.popoverNode = r(), this.listNode = r(), this.flowElement = r(), this.panelElement = r(), this.dropdownNode = r(), this.fieldInfoFlowItemEl = r(), this.allLists = [], this.filterText = "", this.panelCutOffHeight = 0, this.initialized = !1, this._propWatcherTask = new S(this, {
|
|
33
33
|
task: async ([e]) => {
|
|
34
34
|
if (!this.listOnly && !b(e?.refElement))
|
|
35
|
-
throw
|
|
35
|
+
throw g("error", this, x("popoverProps")), new Error();
|
|
36
36
|
this._propWatcherTask.autoRun = !1;
|
|
37
37
|
},
|
|
38
38
|
args: () => [this.popoverProps]
|
|
39
|
-
}), this.fields = [], this.selectedFields = [], this.listOnly = !1, this.showFieldInfo = !1, this.showFieldTypeIcon = !1, this.showFieldName = !1, this.showDescription = !1, this.showSelectionAll = !1, this.showCancel = !0, this.hideCancel = !1, this.showSort = !0, this.hideSort = !1, this.showFilterLength = 10, this.multiple = !1, this.sortBy = "default", this.groupFieldsAndExpressions = !1, this.arcgisChange =
|
|
39
|
+
}), this.fields = [], this.selectedFields = [], this.listOnly = !1, this.showFieldInfo = !1, this.showFieldTypeIcon = !1, this.showFieldName = !1, this.showDescription = !1, this.showSelectionAll = !1, this.showCancel = !0, this.hideCancel = !1, this.showSort = !0, this.hideSort = !1, this.showFilterLength = 10, this.multiple = !1, this.sortBy = "default", this.groupFieldsAndExpressions = !1, this.arcgisChange = a(), this.arcgisClose = a(), this.arcgisFieldPickListChange = a(), this.arcgisFieldPickListDismissed = a(), this.arcgisFieldPickListSortByChange = a(), this.arcgisSortByChange = a(), this.arcgisEditField = a(), this.arcgisDeleteField = a();
|
|
40
40
|
}
|
|
41
41
|
static {
|
|
42
42
|
this.properties = { lastSortBy: 16, filterFields: 16, mapView: 0, view: 0, layer: 0, fields: 0, selectedFields: 0, listOnly: 5, popoverProps: 0, showFieldInfo: 5, showFieldTypeIcon: 5, showFieldName: 5, showDescription: 5, showSelectionAll: 5, showCancel: 5, hideCancel: 5, showSort: 5, hideSort: 5, showFilterLength: 9, multiple: 5, heading: 1, okBtnText: 1, filterPlaceholderText: 1, filterNoResultsText: 1, sortBy: 1, groupFieldsAndExpressions: 5, fieldsGroupHeading: 1, expressionsGroupHeading: 1, customExpressionCheck: 0 };
|
|
43
43
|
}
|
|
44
44
|
static {
|
|
45
|
-
this.styles =
|
|
45
|
+
this.styles = L;
|
|
46
46
|
}
|
|
47
47
|
async reposition() {
|
|
48
48
|
await this.popoverNode.value?.reposition();
|
|
@@ -56,10 +56,10 @@ class I extends $ {
|
|
|
56
56
|
this.panelElement.value && (this.panelElement.value.disabled = e);
|
|
57
57
|
}
|
|
58
58
|
load() {
|
|
59
|
-
!this.view && this.mapView && (this.view = this.mapView), !this.showCancel && !this.hideCancel && (this.hideCancel = !0), !this.showSort && !this.hideSort && (this.hideSort = !0), this.listOnly && this.showFieldInfo && (this.showFieldInfo = !1,
|
|
59
|
+
!this.view && this.mapView && (this.view = this.mapView), !this.showCancel && !this.hideCancel && (this.hideCancel = !0), !this.showSort && !this.hideSort && (this.hideSort = !0), this.listOnly && this.showFieldInfo && (this.showFieldInfo = !1, g("info", this, "showFieldInfo is not supported if listOnly is true.")), !this.multiple && this.selectedFields.length > 1 && (this.selectedFields = [this.selectedFields[0]]), this.lastSortBy = this.sortBy ?? this.lastSortBy, this.updateGroupedLists(), this.initialized = !0;
|
|
60
60
|
}
|
|
61
61
|
willUpdate(e) {
|
|
62
|
-
(e.has("fields") || e.has("lastSortBy") || e.has("customExpressionCheck")) && this.updateGroupedLists();
|
|
62
|
+
this.initialized && (e.has("fields") || e.has("sortBy") || e.has("lastSortBy") || e.has("customExpressionCheck")) && (e.has("sortBy") && (this.lastSortBy = this.sortBy ?? this.lastSortBy), this.updateGroupedLists());
|
|
63
63
|
}
|
|
64
64
|
loaded() {
|
|
65
65
|
this.setUpObserver(), this.listOnly ? this.listNode.value?.setFocus() : (this.flowElement.value?.setFocus(), this.checkMaxHeight());
|
|
@@ -92,7 +92,7 @@ class I extends $ {
|
|
|
92
92
|
return t = t.filter((i) => i.type !== "none"), this.lastSortBy === "display" ? t.sort((i, o) => i.alias.localeCompare(o.alias)) : this.lastSortBy === "field" ? t.sort((i, o) => i.name.localeCompare(o.name)) : this.lastSortBy === "type" && t.sort((i, o) => i.type.localeCompare(o.type)), t = t.concat(s), t;
|
|
93
93
|
}
|
|
94
94
|
isExpression(e) {
|
|
95
|
-
return this.customExpressionCheck ? this.customExpressionCheck(e) : e.name.includes(
|
|
95
|
+
return this.customExpressionCheck ? this.customExpressionCheck(e) : e.name.includes(F.expression);
|
|
96
96
|
}
|
|
97
97
|
canDeselectAll() {
|
|
98
98
|
const e = this.getAllFields();
|
|
@@ -103,7 +103,7 @@ class I extends $ {
|
|
|
103
103
|
}
|
|
104
104
|
showFieldInfoCheck(e) {
|
|
105
105
|
const { layer: t } = this;
|
|
106
|
-
return this.showFieldInfo ? !(!t || this.isExpression(e) || e.name.includes(
|
|
106
|
+
return this.showFieldInfo ? !(!t || this.isExpression(e) || e.name.includes(F.relationship) || e.type === "none") : !1;
|
|
107
107
|
}
|
|
108
108
|
updateGroupedLists() {
|
|
109
109
|
if (!this.fields)
|
|
@@ -132,7 +132,7 @@ class I extends $ {
|
|
|
132
132
|
];
|
|
133
133
|
}
|
|
134
134
|
addFieldInfoFlowItem(e, t) {
|
|
135
|
-
const s = this.flowElement.value, i =
|
|
135
|
+
const s = this.flowElement.value, i = $(l`<calcite-flow-item selected .heading=${e.alias ?? e.name} .description=${e.name} class="panel" style=${f(this.panelCutOffHeight > 0 ? `max-height: ${this.panelCutOffHeight}px` : "max-height: 50vh")} @calciteFlowItemBack=${(o) => {
|
|
136
136
|
o.currentTarget.remove(), this.fieldInfoFlowItemEl.value.selected = !1, this.panelElement.value.selected = !0, setTimeout(() => {
|
|
137
137
|
t.setFocus();
|
|
138
138
|
}, 300);
|
|
@@ -164,14 +164,14 @@ class I extends $ {
|
|
|
164
164
|
if (this.listOnly)
|
|
165
165
|
return this.renderList();
|
|
166
166
|
const e = this.heading || (this.multiple ? this._messages.headerSelect : this._messages.header), t = this.popoverProps;
|
|
167
|
-
return this.el.classList.add("js-app-flyout"), l`<calcite-popover .placement=${t.placement ?? "leading-start"} open pointer-disabled .referenceElement=${t.refElement} .offsetDistance=${t.offsetDistance ?? -Math.round(t.refElement.getBoundingClientRect().width)} .offsetSkidding=${t.offsetSkidding ?? 0} .overlayPositioning=${t.overlayPositioning} trigger-disabled .autoClose=${t.autoClose} .label=${this.heading ?? (this.multiple ? this._messages.headerSelect : this._messages.header) ?? ""} @calcitePopoverClose=${() => {
|
|
167
|
+
return this.el.classList.add("js-app-flyout"), u(`${t.autoClose}`, l`<calcite-popover .placement=${t.placement ?? "leading-start"} open pointer-disabled .referenceElement=${t.refElement} .offsetDistance=${t.offsetDistance ?? -Math.round(t.refElement.getBoundingClientRect().width)} .offsetSkidding=${t.offsetSkidding ?? 0} .overlayPositioning=${t.overlayPositioning} trigger-disabled .autoClose=${t.autoClose} .label=${this.heading ?? (this.multiple ? this._messages.headerSelect : this._messages.header) ?? ""} @calcitePopoverClose=${() => {
|
|
168
168
|
this.arcgisClose.emit(), this.arcgisFieldPickListDismissed.emit();
|
|
169
|
-
}} ${c(this.popoverNode)}><calcite-flow style=${
|
|
169
|
+
}} ${c(this.popoverNode)}><calcite-flow style=${f({
|
|
170
170
|
width: `${t.popoverWidth ?? t.refElement.getBoundingClientRect().width}px`,
|
|
171
171
|
...t.maxHeight && { maxHeight: t.maxHeight }
|
|
172
172
|
})} ${c(this.flowElement)}><calcite-flow-item class="panel" .heading=${e} closable @calciteFlowItemClose=${() => {
|
|
173
173
|
this.arcgisClose.emit(), this.arcgisFieldPickListDismissed.emit();
|
|
174
|
-
}} ${c(this.panelElement)}><slot slot=content-top name=content-top></slot>${this.renderList()}<slot slot=content-bottom name=content-bottom></slot>${(this.multiple || !this.hideCancel) && l`<div slot=footer class="footer"><slot name=content-footer></slot>${this.multiple && !this.hideCancel ? l`<div class="add-cancel-buttons">${this.renderAddButton()}${this.renderCancelButton()}</div>` : l`${this.renderAddButton()}${this.renderCancelButton()}`}</div>` || ""}</calcite-flow-item></calcite-flow></calcite-popover
|
|
174
|
+
}} ${c(this.panelElement)}><slot slot=content-top name=content-top></slot>${this.renderList()}<slot slot=content-bottom name=content-bottom></slot>${(this.multiple || !this.hideCancel) && l`<div slot=footer class="footer"><slot name=content-footer></slot>${this.multiple && !this.hideCancel ? l`<div class="add-cancel-buttons">${this.renderAddButton()}${this.renderCancelButton()}</div>` : l`${this.renderAddButton()}${this.renderCancelButton()}`}</div>` || ""}</calcite-flow-item></calcite-flow></calcite-popover>`);
|
|
175
175
|
},
|
|
176
176
|
error: () => ""
|
|
177
177
|
});
|
|
@@ -213,7 +213,7 @@ class I extends $ {
|
|
|
213
213
|
}
|
|
214
214
|
renderCalciteListItem(e) {
|
|
215
215
|
const t = this.showFieldInfoCheck(e), s = this.showFieldTypeIcon && !!e.type;
|
|
216
|
-
return
|
|
216
|
+
return u(e.name, l`<calcite-list-item .label=${e.alias || e.name} .description=${(() => {
|
|
217
217
|
if (this.showFieldName && e.hideFieldName !== !0)
|
|
218
218
|
return `{${e.name}}`;
|
|
219
219
|
if (this.showDescription && e.hideDescription !== !0 && e.description)
|
|
@@ -221,7 +221,7 @@ class I extends $ {
|
|
|
221
221
|
})()} .value=${e.name} .selected=${!this.multiple && e.name === this.selectedFields[0] || this.multiple && this.selectedFields.includes(e.name)} .metadata=${{
|
|
222
222
|
label: e.alias,
|
|
223
223
|
fieldName: e.name
|
|
224
|
-
}}>${s && l`<div slot=actions-end class="field-icons">${
|
|
224
|
+
}}>${s && l`<div slot=actions-end class="field-icons">${B({ fieldType: e.type })}</div>` || ""}${this.renderInfoAction(e, t)}${this.renderEditAction(e)}${this.renderDeleteAction(e)}</calcite-list-item>`);
|
|
225
225
|
}
|
|
226
226
|
renderInfoAction(e, t) {
|
|
227
227
|
const { _messages: s } = this;
|
|
@@ -254,7 +254,7 @@ class I extends $ {
|
|
|
254
254
|
}}>${this._messages.cancel}</calcite-button>`;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
|
|
257
|
+
w("arcgis-field-pick-list", I);
|
|
258
258
|
export {
|
|
259
259
|
I as ArcgisFieldPickList
|
|
260
260
|
};
|