@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 3.16 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{millisecondsPerTimeUnit as e}from"../../../core/timeUtils.js";import{isTimeOnlyField as A}from"../../../layers/support/fieldUtils.js";import{format as t}from"../../../renderers/support/numberUtils.js";import{formatAnyDate as n,isAnyDateField as i}from"../../../smartMapping/support/utils.js";import a from"../../../symbols/SimpleLineSymbol.js";const o="<",l=">";function r(e,A,i,a){let r="";0===A?r=`${o} `:A===i&&(r=`${l} `);return r+(a?n(e,a):t(e))}const s=["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAAAAAAAAAHqZRakAAAANUlEQVQ4jWPMy8v7z0BFwMLAwMAwcdIkqhiWn5fHwEQVk5DAqIGjBo4aOGrgqIEQwEjtKgAATl0Hu6JrzFUAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAAAAAAAAAHqZRakAAAANUlEQVQ4jWPMy8v7z0BFwMLAwMAwaeIkqhiWl5/HwEQVk5DAqIGjBo4aOGrgqIEQwEjtKgAATl0Hu6sKxboAAAAASUVORK5CYII=","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAAAAAAAAAHqZRakAAAANUlEQVQ4jWPMy8v7z0BFwMLAwMAwadJEqhiWl5fPwEQVk5DAqIGjBo4aOGrgqIEQwEjtKgAATl0Hu75+IUcAAAAASUVORK5CYII="];async function u(e){if(!("visualVariables"in e)||!e.visualVariables)return null;const A=e.visualVariables.find((e=>"color"===e.type));if(!A)return null;let t=null,n=null;if(A.stops){if(1===A.stops.length)return A.stops[0].color;t=A.stops[0].value,n=A.stops[A.stops.length-1].value}const i=null!=t&&null!=n?t+(n-t)/2:0,{getColor:a}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return a(A,i)??null}async function p(e,A){const t=e.trailCap,n=e.trailWidth||1,i=A||await u(e)||e.color;return new a({cap:t,color:i,width:n})}function f(e,A){if(!A.field)return null;if("featureReduction"in e)switch(e.featureReduction?.type){case"cluster":case"binning":{const t=e.featureReduction.fields.find((({name:e})=>e.toLowerCase()===A.field.toLowerCase()));return t&&"getField"in e?e.getField(t.onStatisticField):null}}return"getField"in e?e.getField?.(A.field):null}function m(e,A){const t="popupTemplate"in e?e.popupTemplate?.fieldInfos:null;if(t?.length&&A)return t.find((e=>e.fieldName?.toLowerCase()===A.toLowerCase()))?.format?.dateFormat}function d(t,n,a){const o=f(t,n);if(!o||!i(o)&&!A(o))return null;let l=m(t,o.name);if(!l&&"date"===o.type){let A=0,t=0;n.stops?(A=n.stops?.at(0)?.value??A,t=n.stops?.at(-1)?.value??t):"minDataValue"in n&&"maxDataValue"in n&&(A=n.minDataValue??A,t=n.maxDataValue??t),l=t-A>2*e.days?"short-date":"short-date-short-time"}return{fieldType:o.type,format:l,timeZoneOptions:{layerTimeZone:"preferredTimeZone"in t?t.preferredTimeZone:null,viewTimeZone:a,datesInUnknownTimezone:"datesInUnknownTimezone"in t&&t.datesInUnknownTimezone}}}function c(e){if("authoringInfo"in e)return e.authoringInfo?.visualVariables?.find((({theme:e})=>"reference-size"===e))}export{r as createStopLabel,d as getDateFormatOptions,u as getMedianColor,c as getReferenceSizeAuthoringInfoVisualVariable,p as getSymbolForFlowRenderer,s as rgbImgSource,l as specialCharsGreaterThan,o as specialCharsLessThan};