@arcgis/common-components 5.2.0-next.25 → 5.2.0-next.27
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.
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as k}from"./NKMDS2IH.js";import{a as D}from"./N7C4DINF.js";import"./WLYFLEI6.js";import"./IUJ4ILLQ.js";import{D as V,E as _,F as v,G as u,J as L,h as w,j as $,k as m}from"./AFBKMYU6.js";export default $arcgis.t(([{substitute:F}])=>{var N=w`:host{display:block;--arcgis-histogram-bar-color: var(--calcite-color-border-1);--arcgis-histogram-stop-color: color-mix(in srgb, var(--calcite-color-brand) 80%, transparent)}.content{display:block;direction:ltr;width:100%;height:100%}.svg{display:block;width:100%;height:100%}.data-line{stroke:#888;stroke-width:1px;shape-rendering:crispEdges}.average-data-line{stroke-width:1px;shape-rendering:crispEdges;stroke:#444}.label,.data-line-symbol{font-size:12px;stroke:#fff;stroke-width:2px;paint-order:stroke;unicode-bidi:plaintext}.data-line-symbol{font-family:"Georgia, serif",sans-serif;font-style:italic}`;function B(t,n,i,e,r){let[s,a]=r;if(!t||a===0||s===0||i==null||n==null)return null;let o=i-n,l=(t.length>1?t[t.length-1].maxValue-t[0].minValue:0)/o,[c,h]=e==="vertical"?[a*l,s]:[a,s*l],p=t?t.map(g=>g.count):[],d=Math.max(...p);return t.map(g=>{let[f,b]=e==="vertical"?[c/t.length,d!==0?g.count/d*h:0]:[d!==0?g.count/d*c:0,h/t.length],{maxValue:C}=g,y=i-C,[S,z]=e==="vertical"?[0,y*(a/o)]:[s-b-y*(s/o),a-f];return[S,z,b,f]})}function O(t,n,i,e,r){let s=[];return t!=null&&s.push({value:t,symbol:"x\u0304",lineClass:"average-data-line"}),n!=null&&i!=null&&e!=null&&s.push(...H(i,e,n,t)),r&&s.push(...r),s}function A(t,n,i,e,r){if(i==null)return[0,0,0,0];let s=Math.round((r-i)/e*100)/100,[a,o]=t;if(n==="vertical"){let c=o-s*o||1;return c=Math.round(c)+.5,[0,"100%",c,c]}let l=s*a||1;return l=Math.round(l)+.5,[l,l,"100%",0]}function P(t,n,i,e,r){if(i==null)return[0,0];let s=Math.round((r-i)/e*100)/100,[a,o]=t;return n==="vertical"?[a,o-s*o]:[0,s*a]}function T(t,n,i){if(!t||t.length===0)return null;if(I(t)){let e=t.map(r=>({...r,color:E(r.color??i)}));return e.unshift({color:n,minValue:Number.NEGATIVE_INFINITY,maxValue:e[0].minValue}),e.push({color:n,minValue:e[e.length-1].maxValue,maxValue:Number.POSITIVE_INFINITY}),e}else return t.map(e=>({...e,color:E(e.color??i)}))}function R(t,n,i,e){if(!t||t.length===0)return i;if(I(t)){let r=G(t,n);if(r.length===0)return i;if(e){let{color:s=i,weight:a}=r[0],{color:o=i,weight:l}=r[1]??r[0],c=a+l;return`color-mix(in srgb, ${s} ${a/c*100}%, ${o} ${l/c*100}%)`}return r[0].color??i}return Y(t,n)}function G(t,n){let i=[];for(let e of t){let r=Math.max(0,Math.min(n.maxValue,e.maxValue)-Math.max(n.minValue,e.minValue));r>0&&i.push({color:e.color,weight:r})}return i.sort((e,r)=>r.weight-e.weight)}function Y(t,n){let i=(n.maxValue-n.minValue)/2+n.minValue;if(i>t[t.length-1].value)return t[t.length-1].color;for(let e=0;e<t.length-1;e++){let r=t[e],s=t[e+1];if(i<=r.value)return r.color;if(i<s.value){let a=(i-r.value)/(s.value-r.value)*100;return`color-mix(in srgb, ${r.color}, ${s.color} ${a}%)`}}return t[t.length-1].color}function I(t){return t[0]!=null&&"minValue"in t[0]}function E(t){if(typeof t=="string")return t;if(Array.isArray(t))return`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]??1})`;let{r:n,g:i,b:e,a:r=1}=t;return`rgba(${n}, ${i}, ${e}, ${r})`}function H(t,n,i,e){let r=.06*(n-t);return U(i,e).filter(s=>Math.abs(e-s)>r).map((s,a,o)=>{let l=o.length/2,c=s>e?"+":"-",h=a>=l?a-l+1:l-a;return{symbol:`${c}${h===1?"":h}\u03C3`,value:s}})}function U(t,n){if(n==null||t==null)return[];let i=1,e=[];for(let r=i*-1;r<=i;r++)r!==0&&e.push(n+r*t);return e}var M="var(--arcgis-histogram-bar-color)",q="var(--arcgis-histogram-stop-color)",x=class extends V{constructor(){super(...arguments),this._messages=D(),this._normalizedStops=null,this._formatLabel=n=>k(this._messages._lang,this._numberFormatterOptions).format(n),this._numberFormatterOptions={maximumFractionDigits:2},this.containerDimensions=[0,0],this.icon="graph-histogram",this.layout="horizontal",this.colorBlendingEnabled=!1}static{this.properties={containerDimensions:16,colorStops:0,icon:3,average:11,messageOverrides:0,standardDeviation:11,bins:0,dataLines:0,label:1,layout:3,max:11,min:11,colorBlendingEnabled:5}}static{this.styles=N}loaded(){let n=new ResizeObserver(r=>{for(let s of r){let{width:a,height:o}=s.contentRect;this.containerDimensions=[a,o]}}),{width:i,height:e}=this.el.getBoundingClientRect();this.containerDimensions=[i,e],n.observe(this.el)}willUpdate(n){n.has("colorStops")&&(this._normalizedStops=T(this.colorStops,M,q))}render(){let{label:n}=this;return $`<div role=img .ariaLabel=${n??void 0} class="content">${this._renderContent()}</div>`}_renderContent(){let{containerDimensions:[n,i]}=this,e="bg-fill",r=n?[m`<defs><clipPath id=${e}><rect height=${i??u} width=${n??u} x=0 y=0 /></clipPath></defs>`,m`<g style=${v({clipPath:`url(#${e})`})}><g>${this._renderBars()}</g></g>`,m`<g>${this._renderLines()}</g>`]:[];return $`<svg class="svg" xmlns=http://www.w3.org/2000/svg>${r}</svg>`}_renderBars(){let{bins:n,_messages:i}=this,e=B(this.bins,this.min,this.max,this.layout,this.containerDimensions);return!e||!n?null:e.map((r,s)=>{let[a,o,l,c]=r,h=n[s],p=i?.barLabel?F(i.barLabel,h):"";return m`<rect style=${v({fill:R(this._normalizedStops,h,M,this.colorBlendingEnabled)})} .ariaLabel=${p} data-index=${s??u} height=${c??u} role=img shape-rendering=crispEdges stroke-width=0 width=${l??u} x=${a??u} y=${o??u} />`})}_renderLines(){return O(this.average,this.standardDeviation,this.min,this.max,this.dataLines)?.map(n=>W({dataLine:n,containerDimensions:this.containerDimensions,layout:this.layout,min:this.min,max:this.max,labelFormatter:this._formatLabel}))}},W=t=>{let{containerDimensions:n,layout:i,min:e,max:r,dataLine:s,labelFormatter:a}=t,o=r!=null&&e!=null?r-e:0,[l,c,h,p]=A(n,i,e,o,s.value),[d,g]=P(n,i,e,o,s.value),f="symbol"in s?[m`<tspan class="data-line-symbol">${s.symbol}</tspan>`,m`<tspan>${a(s.value)}</tspan>`]:s.label,b="lineClass"in s&&s.lineClass?s.lineClass:"data-line";return m`<g><title>${s.value}</title><line class=${_(b)} shape-rendering=crispEdges x1=${l??u} x2=${c??u} y1=${h??u} y2=${p??u} /><text class="label" text-anchor=end transform=${(i==="horizontal"?"rotate(270)":void 0)??u} x=${d??u} y=${g-2}>${f}</text></g>`};L("arcgis-histogram",x);return x},"intl")
|
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 i,x as e}from"./AFBKMYU6.js";var a=e(i,{"arcgis-ckeditor5":[()=>import("./V5SIP2PW.js"),"canResizeVertically,currentLanguage,customConfig,customExpressionCheck:,editorType,groupFieldsAndExpressions,intlExpressionsGroupHeading,intlFieldsGroupHeading,intlTextPlaceHolder,mentionFields:,readOnly,textData;getData,setFocus"],"arcgis-ckeditor5-popover":[()=>import("./LBD3GPSD.js"),"guid,intlCancel,intlLabel,intlOk,refElement:;reposition"],"arcgis-color-input":[()=>import("./Q6B36HJB.js"),"_messages:,clearable,color,compact,disabled,hideRecentColors,messageOverrides:,placement,popoverProps:,showTransparency,storageId;close,setFocus;isOpen"],"arcgis-coordinate-system-picker":[()=>import("./FNF3USON.js"),"_messages:,autoFilterToDefault,defaultWkid,filterEnabled,hideCategories:,value:;getSRDescription"],"arcgis-coordinate-system-picker-tree":[()=>import("./L5RMOAO3.js"),"data:,value"],"arcgis-field-info":[()=>import("./ZFQOATQO.js"),"_messages:,fieldName,hideAlias,hideNumericFormat,hideStatistics,layer:,view:;refresh"],"arcgis-field-pick-list":[()=>import("./ZDMNUSIJ.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("./
|
|
2
|
+
import{I as i,x as e}from"./AFBKMYU6.js";var a=e(i,{"arcgis-ckeditor5":[()=>import("./V5SIP2PW.js"),"canResizeVertically,currentLanguage,customConfig,customExpressionCheck:,editorType,groupFieldsAndExpressions,intlExpressionsGroupHeading,intlFieldsGroupHeading,intlTextPlaceHolder,mentionFields:,readOnly,textData;getData,setFocus"],"arcgis-ckeditor5-popover":[()=>import("./LBD3GPSD.js"),"guid,intlCancel,intlLabel,intlOk,refElement:;reposition"],"arcgis-color-input":[()=>import("./Q6B36HJB.js"),"_messages:,clearable,color,compact,disabled,hideRecentColors,messageOverrides:,placement,popoverProps:,showTransparency,storageId;close,setFocus;isOpen"],"arcgis-coordinate-system-picker":[()=>import("./FNF3USON.js"),"_messages:,autoFilterToDefault,defaultWkid,filterEnabled,hideCategories:,value:;getSRDescription"],"arcgis-coordinate-system-picker-tree":[()=>import("./L5RMOAO3.js"),"data:,value"],"arcgis-field-info":[()=>import("./ZFQOATQO.js"),"_messages:,fieldName,hideAlias,hideNumericFormat,hideStatistics,layer:,view:;refresh"],"arcgis-field-pick-list":[()=>import("./ZDMNUSIJ.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("./EDYH6JAL.js"),"_messages:,average,bins:,colorBlendingEnabled,colorStops:,dataLines:,icon,label,layout,max,messageOverrides:,min,standardDeviation"],"arcgis-label-input":[()=>import("./2XA6O2MP.js"),"alignment,editing,labelFormatter:,readOnly,value;edit;getLabelBoundingClientRect"],"arcgis-picker-input":[()=>import("./XRARFMJ7.js"),"disabled,heading,iconEnd,intlDone,label,popoverProps:;close,setFocus"],"arcgis-ramp-color":[()=>import("./WEKRF34E.js"),"layout,max,min,stops:"],"arcgis-ramp-color-break":[()=>import("./VQLI4IE7.js"),"layout,max,min,stops:"],"arcgis-ramp-opacity":[()=>import("./MCZBUYS5.js"),"fillColor,layout,max,min,stops:"],"arcgis-slider":[()=>import("./ZPPRHEY3.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-input":[()=>import("./OBIWQRXY.js"),"disabled,flipLabels,label,max,min,scale,step,unitsLabel,value,withSteppers"],"arcgis-ticks":[()=>import("./TXYPZ6MB.js"),"interactive,interpolationExponent,labelFormatter:,labelPlacement,layout,max,min,mirrored,mode,showBaseline,showLabels,values"],"arcgis-unique-values-list":[()=>import("./YGG3CY7R.js"),"_messages:,fieldName,layer:,maxHeight,multiple,numberFormatOptions:,partialUniqueValues,selectedValues:,showFilterLength,sortBy,uniqueValues:,view:,visualizationSource;getUniqueValues,setFocus"],"arcgis-value-picker":[()=>import("./4W7JZPB6.js"),"autoDestroyDisabled,disabled,hideNextButton,hidePlayButton,hidePreviousButton,icon,label,layout,loop,messages:,playRate,state:;destroy;next,pause,play,previous"],"arcgis-value-picker-collection":[()=>import("./3P53QRGS.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue:,items:;destroy;reset,step"],"arcgis-value-picker-combobox":[()=>import("./L2JNUMXB.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue:,disabled,items:,messages:;destroy;reset,step"],"arcgis-value-picker-label":[()=>import("./LKUOAV7B.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue:,items:;destroy;reset,step"],"arcgis-value-picker-slider":[()=>import("./GVOQ2CB7.js"),"autoDestroyDisabled,canNext,canPlay,canPrevious,currentValue,disabled,labelFormatter:,labels:,layout,majorTicks:,max,min,minorTicks:,mirrored,steps:;destroy;reset,step"]});a({resourcesUrl:import.meta.url});var s=new CSSStyleSheet;s.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-input,arcgis-ticks,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,s];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,i)
|
|
@@ -3,16 +3,16 @@ import { c as M } from "../../chunks/runtime.js";
|
|
|
3
3
|
import { u as k } from "../../chunks/useT9n.js";
|
|
4
4
|
import { substitute as E } from "@arcgis/core/intl.js";
|
|
5
5
|
import { LitElement as I, nothing as h, safeStyleMap as v, safeClassMap as O } from "@arcgis/lumina";
|
|
6
|
-
import { css as R, html as y, svg as
|
|
6
|
+
import { css as R, html as y, svg as d } from "lit";
|
|
7
7
|
import { g as z } from "../../chunks/locale.js";
|
|
8
|
-
const F = R`:host{display:block;--arcgis-histogram-bar-color: var(--calcite-color-border-1);--arcgis-histogram-stop-color: color-mix(in srgb, var(--calcite-color-brand) 80%, transparent)}.content{display:block;direction:ltr}.svg{display:block;width:100%;height:100%}.data-line{stroke:#888;stroke-width:1px;shape-rendering:crispEdges}.average-data-line{stroke-width:1px;shape-rendering:crispEdges;stroke:#444}.label,.data-line-symbol{font-size:12px;stroke:#fff;stroke-width:2px;paint-order:stroke;unicode-bidi:plaintext}.data-line-symbol{font-family:"Georgia, serif",sans-serif;font-style:italic}`;
|
|
8
|
+
const F = R`:host{display:block;--arcgis-histogram-bar-color: var(--calcite-color-border-1);--arcgis-histogram-stop-color: color-mix(in srgb, var(--calcite-color-brand) 80%, transparent)}.content{display:block;direction:ltr;width:100%;height:100%}.svg{display:block;width:100%;height:100%}.data-line{stroke:#888;stroke-width:1px;shape-rendering:crispEdges}.average-data-line{stroke-width:1px;shape-rendering:crispEdges;stroke:#444}.label,.data-line-symbol{font-size:12px;stroke:#fff;stroke-width:2px;paint-order:stroke;unicode-bidi:plaintext}.data-line-symbol{font-family:"Georgia, serif",sans-serif;font-style:italic}`;
|
|
9
9
|
function S(t, r, n, e, i) {
|
|
10
10
|
const [s, a] = i;
|
|
11
11
|
if (!t || a === 0 || s === 0 || n == null || r == null)
|
|
12
12
|
return null;
|
|
13
|
-
const o = n - r, c = (t.length > 1 ? t[t.length - 1].maxValue - t[0].minValue : 0) / o, [u, g] = e === "vertical" ? [a * c, s] : [a, s * c], b = t ? t.map((m) => m.count) : [],
|
|
13
|
+
const o = n - r, c = (t.length > 1 ? t[t.length - 1].maxValue - t[0].minValue : 0) / o, [u, g] = e === "vertical" ? [a * c, s] : [a, s * c], b = t ? t.map((m) => m.count) : [], f = Math.max(...b);
|
|
14
14
|
return t.map((m) => {
|
|
15
|
-
const [p, $] = e === "vertical" ? [u / t.length,
|
|
15
|
+
const [p, $] = e === "vertical" ? [u / t.length, f !== 0 ? m.count / f * g : 0] : [f !== 0 ? m.count / f * u : 0, g / t.length], { maxValue: D } = m, x = n - D, [_, C] = e === "vertical" ? [0, x * (a / o)] : [s - $ - x * (s / o), a - p];
|
|
16
16
|
return [_, C, $, p];
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -161,14 +161,18 @@ class j extends I {
|
|
|
161
161
|
return y`<div role=img .ariaLabel=${r ?? void 0} class="content">${this._renderContent()}</div>`;
|
|
162
162
|
}
|
|
163
163
|
_renderContent() {
|
|
164
|
-
const { containerDimensions: [r, n] } = this, e = "bg-fill"
|
|
165
|
-
|
|
164
|
+
const { containerDimensions: [r, n] } = this, e = "bg-fill", i = r ? [
|
|
165
|
+
d`<defs><clipPath id=${e}><rect height=${n ?? h} width=${r ?? h} x=0 y=0 /></clipPath></defs>`,
|
|
166
|
+
d`<g style=${v({ clipPath: `url(#${e})` })}><g>${this._renderBars()}</g></g>`,
|
|
167
|
+
d`<g>${this._renderLines()}</g>`
|
|
168
|
+
] : [];
|
|
169
|
+
return y`<svg class="svg" xmlns=http://www.w3.org/2000/svg>${i}</svg>`;
|
|
166
170
|
}
|
|
167
171
|
_renderBars() {
|
|
168
172
|
const { bins: r, _messages: n } = this, e = S(this.bins, this.min, this.max, this.layout, this.containerDimensions);
|
|
169
173
|
return !e || !r ? null : e.map((i, s) => {
|
|
170
174
|
const [a, o, l, c] = i, u = r[s], g = n?.barLabel ? E(n.barLabel, u) : "";
|
|
171
|
-
return
|
|
175
|
+
return d`<rect style=${v({
|
|
172
176
|
fill: A(this._normalizedStops, u, V, this.colorBlendingEnabled)
|
|
173
177
|
})} .ariaLabel=${g} data-index=${s ?? h} height=${c ?? h} role=img shape-rendering=crispEdges stroke-width=0 width=${l ?? h} x=${a ?? h} y=${o ?? h} />`;
|
|
174
178
|
});
|
|
@@ -178,8 +182,8 @@ class j extends I {
|
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
184
|
const q = (t) => {
|
|
181
|
-
const { containerDimensions: r, layout: n, min: e, max: i, dataLine: s, labelFormatter: a } = t, o = i != null && e != null ? i - e : 0, [l, c, u, g] = N(r, n, e, o, s.value), [b,
|
|
182
|
-
return
|
|
185
|
+
const { containerDimensions: r, layout: n, min: e, max: i, dataLine: s, labelFormatter: a } = t, o = i != null && e != null ? i - e : 0, [l, c, u, g] = N(r, n, e, o, s.value), [b, f] = P(r, n, e, o, s.value), m = "symbol" in s ? [d`<tspan class="data-line-symbol">${s.symbol}</tspan>`, d`<tspan>${a(s.value)}</tspan>`] : s.label, p = "lineClass" in s && s.lineClass ? s.lineClass : "data-line";
|
|
186
|
+
return d`<g><title>${s.value}</title><line class=${O(p)} shape-rendering=crispEdges x1=${l ?? h} x2=${c ?? h} y1=${u ?? h} y2=${g ?? h} /><text class="label" text-anchor=end transform=${(n === "horizontal" ? "rotate(270)" : void 0) ?? h} x=${b ?? h} y=${f - 2}>${m}</text></g>`;
|
|
183
187
|
};
|
|
184
188
|
M("arcgis-histogram", j);
|
|
185
189
|
export {
|