@arcgis/common-components 5.1.0-next.48 → 5.1.0-next.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/ALJ22BX6.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-histogram/customElement.js +81 -88
- 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/LPG2EDKA.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{a as k}from"./EPX7DYFW.js";import{b as D}from"./6XD2GTPZ.js";import"./DWXXQFPQ.js";import{B as V,C as _,D as v,E as u,H as L,g as w,i as $,j as d}from"./7AMLQYVM.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}.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(m=>m.count):[],g=Math.max(...p);return t.map(m=>{let[f,b]=e==="vertical"?[c/t.length,g!==0?m.count/g*h:0]:[g!==0?m.count/g*c:0,h/t.length],{maxValue:C}=m,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";return n?$`<svg class="svg" xmlns=http://www.w3.org/2000/svg>${d`<defs><clipPath id=${e}><rect height=${i??u} width=${n??u} x=0 y=0 /></clipPath></defs><g style=${v({clipPath:`url(#${e})`})}><g>${this._renderBars()}</g></g><g>${this._renderLines()}</g>`}</svg>`:null}_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 d`<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),[g,m]=P(n,i,e,o,s.value),f="symbol"in s?[d`<tspan class="data-line-symbol">${s.symbol}</tspan>`,d`<tspan>${a(s.value)}</tspan>`]:s.label,b="lineClass"in s&&s.lineClass?s.lineClass:"data-line";return d`<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=${g??u} y=${m-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.1/LICENSE.txt */
|
|
2
|
-
import{G as i,v as e}from"./7AMLQYVM.js";var s=e(i,{"arcgis-ckeditor5":[()=>import("./DLNJ7OOB.js"),"canResizeVertically,currentLanguage,customConfig,customExpressionCheck:,editorType,groupFieldsAndExpressions,intlExpressionsGroupHeading,intlFieldsGroupHeading,intlTextPlaceHolder,mentionFields:,readOnly,textData;getData,setFocus"],"arcgis-ckeditor5-popover":[()=>import("./5EKB3CUO.js"),"guid,intlCancel,intlLabel,intlOk,refElement:;reposition"],"arcgis-color-input":[()=>import("./ELRD345Q.js"),"_messages:,clearable,color,compact,disabled,hideRecentColors,messageOverrides:,placement,popoverProps:,showTransparency,storageId;close,setFocus"],"arcgis-field-info":[()=>import("./E33LXBTL.js"),"_messages:,fieldName,hideAlias,hideNumericFormat,hideStatistics,layer:,view:;refresh"],"arcgis-field-pick-list":[()=>import("./LGOSLS6K.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{G as i,v as e}from"./7AMLQYVM.js";var s=e(i,{"arcgis-ckeditor5":[()=>import("./DLNJ7OOB.js"),"canResizeVertically,currentLanguage,customConfig,customExpressionCheck:,editorType,groupFieldsAndExpressions,intlExpressionsGroupHeading,intlFieldsGroupHeading,intlTextPlaceHolder,mentionFields:,readOnly,textData;getData,setFocus"],"arcgis-ckeditor5-popover":[()=>import("./5EKB3CUO.js"),"guid,intlCancel,intlLabel,intlOk,refElement:;reposition"],"arcgis-color-input":[()=>import("./ELRD345Q.js"),"_messages:,clearable,color,compact,disabled,hideRecentColors,messageOverrides:,placement,popoverProps:,showTransparency,storageId;close,setFocus"],"arcgis-field-info":[()=>import("./E33LXBTL.js"),"_messages:,fieldName,hideAlias,hideNumericFormat,hideStatistics,layer:,view:;refresh"],"arcgis-field-pick-list":[()=>import("./LGOSLS6K.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("./ALJ22BX6.js"),"_messages:,average,bins:,colorBlendingEnabled,colorStops:,dataLines:,icon,label,layout,max,messageOverrides:,min,standardDeviation"],"arcgis-label-input":[()=>import("./7JIHCVH3.js"),"alignment,editing,labelFormatter:,readOnly,value;edit;getLabelBoundingClientRect"],"arcgis-picker-input":[()=>import("./6UGM5LNE.js"),"disabled,heading,iconEnd,intlDone,label,popoverProps:;close,setFocus"],"arcgis-ramp-color":[()=>import("./ALWVIWUC.js"),"layout,max,min,stops:"],"arcgis-ramp-color-break":[()=>import("./E4EVLDYS.js"),"layout,max,min,stops:"],"arcgis-ramp-opacity":[()=>import("./HEQCNDQR.js"),"fillColor,layout,max,min,stops:"],"arcgis-slider":[()=>import("./HVUNL3EO.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("./SF2NJOD3.js"),"disabled,flipLabels,label,max,min,step,unitsLabel,value,withSteppers"],"arcgis-ticks":[()=>import("./N4R5SMWN.js"),"interactive,interpolationExponent,labelFormatter:,labelPlacement,layout,max,min,mirrored,mode,showBaseline,showLabels,values"],"arcgis-unique-values-list":[()=>import("./IYJJN26J.js"),"_messages:,fieldName,layer:,maxHeight,multiple,numberFormatOptions:,partialUniqueValues,selectedValues:,showFilterLength,sortBy,uniqueValues:,view:,visualizationSource;getUniqueValues,setFocus"]});s({resourcesUrl:import.meta.url});var a=new CSSStyleSheet;a.replaceSync("@layer{:not([hydrated]):is(arcgis-ckeditor5,arcgis-ckeditor5-popover,arcgis-color-input,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){visibility:hidden}:root{--arcgis-ckeditor5-initial-height: 30vh;--arcgis-ckeditor5-max-width: 35vw;--arcgis-ckeditor5-mentions-max-width: 33vw;--arcgis-common-ckeditor5-initial-height: 30vh;--arcgis-common-ckeditor5-max-width: 35vw;--arcgis-common-ckeditor5-mentions-max-width: 33vw}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,a];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)
|
|
@@ -1,128 +1,121 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { substitute as
|
|
5
|
-
import { LitElement as
|
|
6
|
-
import { css as R, html as
|
|
2
|
+
import { c as M } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as k } from "../../chunks/useT9n.js";
|
|
4
|
+
import { substitute as E } from "@arcgis/core/intl.js";
|
|
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 f } from "lit";
|
|
7
7
|
import { g as z } from "../../chunks/locale.js";
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
dataLine: "data-line",
|
|
13
|
-
averageDataLine: "average-data-line",
|
|
14
|
-
dataLineSymbol: "data-line-symbol"
|
|
15
|
-
}, F = R`:host{display:flex;--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:flex;flex:1;direction:ltr}.svg{display:inline-block;flex:1;overflow:hidden}.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}`;
|
|
16
|
-
function B(t, i, n, e, r) {
|
|
17
|
-
const [s, a] = r;
|
|
18
|
-
if (!t || a === 0 || s === 0 || n == null || i == null)
|
|
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}`;
|
|
9
|
+
function S(t, r, n, e, i) {
|
|
10
|
+
const [s, a] = i;
|
|
11
|
+
if (!t || a === 0 || s === 0 || n == null || r == null)
|
|
19
12
|
return null;
|
|
20
|
-
const o = n -
|
|
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) : [], d = Math.max(...b);
|
|
21
14
|
return t.map((m) => {
|
|
22
|
-
const [
|
|
23
|
-
return [
|
|
15
|
+
const [p, $] = e === "vertical" ? [u / t.length, d !== 0 ? m.count / d * g : 0] : [d !== 0 ? m.count / d * 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
|
+
return [_, C, $, p];
|
|
24
17
|
});
|
|
25
18
|
}
|
|
26
|
-
function
|
|
19
|
+
function B(t, r, n, e, i) {
|
|
27
20
|
const s = [];
|
|
28
21
|
return t != null && s.push({
|
|
29
22
|
value: t,
|
|
30
23
|
symbol: "x̄",
|
|
31
|
-
lineClass:
|
|
32
|
-
}),
|
|
24
|
+
lineClass: "average-data-line"
|
|
25
|
+
}), r != null && n != null && e != null && s.push(...G(n, e, r, t)), i && s.push(...i), s;
|
|
33
26
|
}
|
|
34
|
-
function
|
|
27
|
+
function N(t, r, n, e, i) {
|
|
35
28
|
if (n == null)
|
|
36
29
|
return [0, 0, 0, 0];
|
|
37
|
-
const s = Math.round((
|
|
38
|
-
if (
|
|
30
|
+
const s = Math.round((i - n) / e * 100) / 100, [a, o] = t;
|
|
31
|
+
if (r === "vertical") {
|
|
39
32
|
let c = o - s * o || 1;
|
|
40
33
|
return c = Math.round(c) + 0.5, [0, "100%", c, c];
|
|
41
34
|
}
|
|
42
35
|
let l = s * a || 1;
|
|
43
36
|
return l = Math.round(l) + 0.5, [l, l, "100%", 0];
|
|
44
37
|
}
|
|
45
|
-
function
|
|
38
|
+
function P(t, r, n, e, i) {
|
|
46
39
|
if (n == null)
|
|
47
40
|
return [0, 0];
|
|
48
|
-
const s = Math.round((
|
|
49
|
-
return
|
|
41
|
+
const s = Math.round((i - n) / e * 100) / 100, [a, o] = t;
|
|
42
|
+
return r === "vertical" ? [a, o - s * o] : [0, s * a];
|
|
50
43
|
}
|
|
51
|
-
function
|
|
44
|
+
function T(t, r, n) {
|
|
52
45
|
if (!t || t.length === 0)
|
|
53
46
|
return null;
|
|
54
|
-
if (
|
|
55
|
-
const e = t.map((
|
|
56
|
-
...
|
|
57
|
-
color:
|
|
47
|
+
if (L(t)) {
|
|
48
|
+
const e = t.map((i) => ({
|
|
49
|
+
...i,
|
|
50
|
+
color: w(i.color ?? n)
|
|
58
51
|
}));
|
|
59
52
|
return e.unshift({
|
|
60
|
-
color:
|
|
53
|
+
color: r,
|
|
61
54
|
minValue: Number.NEGATIVE_INFINITY,
|
|
62
55
|
maxValue: e[0].minValue
|
|
63
56
|
}), e.push({
|
|
64
|
-
color:
|
|
57
|
+
color: r,
|
|
65
58
|
minValue: e[e.length - 1].maxValue,
|
|
66
59
|
maxValue: Number.POSITIVE_INFINITY
|
|
67
60
|
}), e;
|
|
68
61
|
} else
|
|
69
62
|
return t.map((e) => ({
|
|
70
63
|
...e,
|
|
71
|
-
color:
|
|
64
|
+
color: w(e.color ?? n)
|
|
72
65
|
}));
|
|
73
66
|
}
|
|
74
|
-
function
|
|
67
|
+
function A(t, r, n, e) {
|
|
75
68
|
if (!t || t.length === 0)
|
|
76
69
|
return n;
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
70
|
+
if (L(t)) {
|
|
71
|
+
const i = H(t, r);
|
|
72
|
+
if (i.length === 0)
|
|
80
73
|
return n;
|
|
81
74
|
if (e) {
|
|
82
|
-
const { color: s = n, weight: a } =
|
|
75
|
+
const { color: s = n, weight: a } = i[0], { color: o = n, weight: l } = i[1] ?? i[0], c = a + l;
|
|
83
76
|
return `color-mix(in srgb, ${s} ${a / c * 100}%, ${o} ${l / c * 100}%)`;
|
|
84
77
|
}
|
|
85
|
-
return
|
|
78
|
+
return i[0].color ?? n;
|
|
86
79
|
}
|
|
87
|
-
return
|
|
80
|
+
return W(t, r);
|
|
88
81
|
}
|
|
89
|
-
function
|
|
82
|
+
function H(t, r) {
|
|
90
83
|
const n = [];
|
|
91
84
|
for (const e of t) {
|
|
92
|
-
const
|
|
93
|
-
|
|
85
|
+
const i = Math.max(0, Math.min(r.maxValue, e.maxValue) - Math.max(r.minValue, e.minValue));
|
|
86
|
+
i > 0 && n.push({ color: e.color, weight: i });
|
|
94
87
|
}
|
|
95
|
-
return n.sort((e,
|
|
88
|
+
return n.sort((e, i) => i.weight - e.weight);
|
|
96
89
|
}
|
|
97
|
-
function
|
|
98
|
-
const n = (
|
|
90
|
+
function W(t, r) {
|
|
91
|
+
const n = (r.maxValue - r.minValue) / 2 + r.minValue;
|
|
99
92
|
if (n > t[t.length - 1].value)
|
|
100
93
|
return t[t.length - 1].color;
|
|
101
94
|
for (let e = 0; e < t.length - 1; e++) {
|
|
102
|
-
const
|
|
103
|
-
if (n <=
|
|
104
|
-
return
|
|
95
|
+
const i = t[e], s = t[e + 1];
|
|
96
|
+
if (n <= i.value)
|
|
97
|
+
return i.color;
|
|
105
98
|
if (n < s.value) {
|
|
106
|
-
const a = (n -
|
|
107
|
-
return `color-mix(in srgb, ${
|
|
99
|
+
const a = (n - i.value) / (s.value - i.value) * 100;
|
|
100
|
+
return `color-mix(in srgb, ${i.color}, ${s.color} ${a}%)`;
|
|
108
101
|
}
|
|
109
102
|
}
|
|
110
103
|
return t[t.length - 1].color;
|
|
111
104
|
}
|
|
112
|
-
function
|
|
105
|
+
function L(t) {
|
|
113
106
|
return t[0] != null && "minValue" in t[0];
|
|
114
107
|
}
|
|
115
|
-
function
|
|
108
|
+
function w(t) {
|
|
116
109
|
if (typeof t == "string")
|
|
117
110
|
return t;
|
|
118
111
|
if (Array.isArray(t))
|
|
119
112
|
return `rgba(${t[0]}, ${t[1]}, ${t[2]}, ${t[3] ?? 1})`;
|
|
120
|
-
const { r
|
|
121
|
-
return `rgba(${
|
|
113
|
+
const { r, g: n, b: e, a: i = 1 } = t;
|
|
114
|
+
return `rgba(${r}, ${n}, ${e}, ${i})`;
|
|
122
115
|
}
|
|
123
|
-
function
|
|
124
|
-
const
|
|
125
|
-
return
|
|
116
|
+
function G(t, r, n, e) {
|
|
117
|
+
const i = 0.06 * (r - t);
|
|
118
|
+
return Y(n, e).filter((s) => Math.abs(e - s) > i).map((s, a, o) => {
|
|
126
119
|
const l = o.length / 2, c = s > e ? "+" : "-", u = a >= l ? a - l + 1 : l - a;
|
|
127
120
|
return {
|
|
128
121
|
symbol: `${c}${u === 1 ? "" : u}σ`,
|
|
@@ -130,18 +123,18 @@ function Y(t, i, n, e) {
|
|
|
130
123
|
};
|
|
131
124
|
});
|
|
132
125
|
}
|
|
133
|
-
function
|
|
134
|
-
if (
|
|
126
|
+
function Y(t, r) {
|
|
127
|
+
if (r == null || t == null)
|
|
135
128
|
return [];
|
|
136
129
|
const n = 1, e = [];
|
|
137
|
-
for (let
|
|
138
|
-
|
|
130
|
+
for (let i = n * -1; i <= n; i++)
|
|
131
|
+
i !== 0 && e.push(r + i * t);
|
|
139
132
|
return e;
|
|
140
133
|
}
|
|
141
|
-
const V = "var(--arcgis-histogram-bar-color)",
|
|
142
|
-
class
|
|
134
|
+
const V = "var(--arcgis-histogram-bar-color)", U = "var(--arcgis-histogram-stop-color)";
|
|
135
|
+
class j extends I {
|
|
143
136
|
constructor() {
|
|
144
|
-
super(...arguments), this._messages =
|
|
137
|
+
super(...arguments), this._messages = k(), this._normalizedStops = null, this._formatLabel = (r) => z(this._messages._lang, this._numberFormatterOptions).format(r), this._numberFormatterOptions = {
|
|
145
138
|
maximumFractionDigits: 2
|
|
146
139
|
}, this.containerDimensions = [0, 0], this.icon = "graph-histogram", this.layout = "horizontal", this.colorBlendingEnabled = !1;
|
|
147
140
|
}
|
|
@@ -152,43 +145,43 @@ class q extends k {
|
|
|
152
145
|
this.styles = F;
|
|
153
146
|
}
|
|
154
147
|
loaded() {
|
|
155
|
-
const
|
|
156
|
-
for (const s of
|
|
148
|
+
const r = new ResizeObserver((i) => {
|
|
149
|
+
for (const s of i) {
|
|
157
150
|
const { width: a, height: o } = s.contentRect;
|
|
158
151
|
this.containerDimensions = [a, o];
|
|
159
152
|
}
|
|
160
153
|
}), { width: n, height: e } = this.el.getBoundingClientRect();
|
|
161
|
-
this.containerDimensions = [n, e],
|
|
154
|
+
this.containerDimensions = [n, e], r.observe(this.el);
|
|
162
155
|
}
|
|
163
|
-
willUpdate(
|
|
164
|
-
|
|
156
|
+
willUpdate(r) {
|
|
157
|
+
r.has("colorStops") && (this._normalizedStops = T(this.colorStops, V, U));
|
|
165
158
|
}
|
|
166
159
|
render() {
|
|
167
|
-
const { label:
|
|
168
|
-
return
|
|
160
|
+
const { label: r } = this;
|
|
161
|
+
return y`<div role=img .ariaLabel=${r ?? void 0} class="content">${this._renderContent()}</div>`;
|
|
169
162
|
}
|
|
170
163
|
_renderContent() {
|
|
171
|
-
const { containerDimensions: [
|
|
172
|
-
return
|
|
164
|
+
const { containerDimensions: [r, n] } = this, e = "bg-fill";
|
|
165
|
+
return r ? y`<svg class="svg" xmlns=http://www.w3.org/2000/svg>${f`<defs><clipPath id=${e}><rect height=${n ?? h} width=${r ?? h} x=0 y=0 /></clipPath></defs><g style=${v({ clipPath: `url(#${e})` })}><g>${this._renderBars()}</g></g><g>${this._renderLines()}</g>`}</svg>` : null;
|
|
173
166
|
}
|
|
174
167
|
_renderBars() {
|
|
175
|
-
const { bins:
|
|
176
|
-
return !e || !
|
|
177
|
-
const [a, o, l, c] =
|
|
178
|
-
return
|
|
179
|
-
fill:
|
|
168
|
+
const { bins: r, _messages: n } = this, e = S(this.bins, this.min, this.max, this.layout, this.containerDimensions);
|
|
169
|
+
return !e || !r ? null : e.map((i, s) => {
|
|
170
|
+
const [a, o, l, c] = i, u = r[s], g = n?.barLabel ? E(n.barLabel, u) : "";
|
|
171
|
+
return f`<rect style=${v({
|
|
172
|
+
fill: A(this._normalizedStops, u, V, this.colorBlendingEnabled)
|
|
180
173
|
})} .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} />`;
|
|
181
174
|
});
|
|
182
175
|
}
|
|
183
176
|
_renderLines() {
|
|
184
|
-
return
|
|
177
|
+
return B(this.average, this.standardDeviation, this.min, this.max, this.dataLines)?.map((n) => q({ dataLine: n, containerDimensions: this.containerDimensions, layout: this.layout, min: this.min, max: this.max, labelFormatter: this._formatLabel }));
|
|
185
178
|
}
|
|
186
179
|
}
|
|
187
|
-
const
|
|
188
|
-
const { containerDimensions:
|
|
189
|
-
return
|
|
180
|
+
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, d] = P(r, n, e, o, s.value), m = "symbol" in s ? [f`<tspan class="data-line-symbol">${s.symbol}</tspan>`, f`<tspan>${a(s.value)}</tspan>`] : s.label, p = "lineClass" in s && s.lineClass ? s.lineClass : "data-line";
|
|
182
|
+
return f`<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=${d - 2}>${m}</text></g>`;
|
|
190
183
|
};
|
|
191
|
-
|
|
184
|
+
M("arcgis-histogram", j);
|
|
192
185
|
export {
|
|
193
|
-
|
|
186
|
+
j as ArcgisHistogram
|
|
194
187
|
};
|