@devgateway/dvz-ui-react 1.9.7 → 1.9.8
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/cjs/embeddable/chart/colors/ManualColors.js +1 -1
- package/dist/cjs/embeddable/chart/data/Line.js +1 -1
- package/dist/cjs/embeddable/common/colors/ManualColors.js +1 -1
- package/dist/esm/embeddable/chart/colors/ManualColors.js +73 -41
- package/dist/esm/embeddable/chart/data/Line.js +132 -128
- package/dist/esm/embeddable/common/colors/ManualColors.js +66 -35
- package/dist/types/embeddable/chart/colors/ManualColors.d.ts +2 -0
- package/dist/types/embeddable/common/colors/ManualColors.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("./Colors.js");class
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("./Colors.js");class F extends I.default{constructor(o,e,h,O,j,c,m,N,g,n={},d,x,f,_){if(super(h,O,j,N,g),this.type=e,this._manualColor={},x&&(this._manualColor[x]=n?n.Overall:null),o!=="csv"){const b=s=>{const t=c?[...c]:[],u=t[s]?t[s].items||[]:[];n!=null&&n!=null&&Object.keys(n).forEach(i=>{const l=u.filter(r=>r.code===i||r.value===i||r.id===i||r.label===i),a=n[i];if(this._manualColor[i]=a,l.length>0){const r=l[0];r.value!==void 0&&(this._manualColor[r.value]=a),r.label!==void 0&&(this._manualColor[r.label]=a),r.code!==void 0&&(this._manualColor[r.code]=a),r.id!==void 0&&(this._manualColor[r.id]=a);const C=f&&(f[i]||r.value&&f[r.value]||r.code&&f[r.code]);if(C&&(this._manualColor[C]=a),r.labels){let y;d&&(y=r.labels[d.toUpperCase()]),y&&(this._manualColor[y]=a),Object.values(r.labels).forEach(p=>{p&&(this._manualColor[p]=a)})}}})},z=s=>s==null?void 0:s.map(u=>{var l,a;const i=(l=u.group)==null?void 0:l.label;return!i||(a=u.label)!=null&&a.includes(i)?u:{...u,label:`${i} - ${u.label}`}}),E=()=>{var s;return m&&m.size>0?[...m]:(s=_==null?void 0:_.metadata)!=null&&s.measures&&_.metadata.measures.length>0?(_.metadata.measures=z(_.metadata.measures),_.metadata.measures):[]},B=()=>{const s=E();n!=null&&n!=null&&Object.keys(n).forEach(t=>{const u=[...s].filter(l=>l.value===t||l.code===t||l.id===t||l.label===t),i=n[t];if(this._manualColor[t]=i,u.length>0){const l=u[0];l.value!==void 0&&(this._manualColor[l.value]=i),l.label!==void 0&&(this._manualColor[l.label]=i),l.code!==void 0&&(this._manualColor[l.code]=i),l.id!==void 0&&(this._manualColor[l.id]=i);const a=f&&(f[t]||l.value&&f[l.value]||l.code&&f[l.code]);if(a&&(this._manualColor[a]=i),l.labels){let r;d&&(r=l.labels[d.toUpperCase()]),r&&(this._manualColor[r]=i),Object.values(l.labels).forEach(C=>{C&&(this._manualColor[C]=i)})}}})},v=e==="line"?1:h==="index"?0:1;!c||c.size===0?B():c.size==1&&v==1?g=="measure"?b(0):B():c.size==1&&v==0?b(0):b(v)}else this._manualColor=n&&n[h]?n[h]:{}}getColor(o,e){if(this._manualColor[o])return this._manualColor[o];if(e){if(this.indexBy&&e[this.indexBy]&&this._manualColor[e[this.indexBy]])return this._manualColor[e[this.indexBy]];if(e.id&&this._manualColor[e.id])return this._manualColor[e.id];if(e.label&&this._manualColor[e.label])return this._manualColor[e.label];if(e.value&&this._manualColor[e.value])return this._manualColor[e.value];if(e.code&&this._manualColor[e.code])return this._manualColor[e.code];if(e.measure&&this._manualColor[e.measure])return this._manualColor[e.measure];if(e.measureFieldName&&this._manualColor[e.measureFieldName])return this._manualColor[e.measureFieldName]}if(this.colorBy==="index"){const h=this._manualColor[o]||e&&this.indexBy&&this._manualColor[e[this.indexBy]];return h||"#555555"}return this.colorBy==="id"&&this._manualColor[o]?this._manualColor[o]:"#555555"}getColorByIndex(o){return this._manualColor[o]?this._manualColor[o]:"#555555"}getColorByKey(o){return this._manualColor[o]?this._manualColor[o]:"#555555"}}exports.default=F;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("react/jsx-runtime"),I=require("react"),f=require("./Utils.js"),P=t=>{const{data:e,measures:s,swap:g,dimensions:v,locale:h,customLabels:c}=t;let l={};const p=v.filter(y=>y!=""),R=new Set;if(p.length==0&&e){const y=f.measuresMap(e),O=new Set,N=new Set;let E=[],L;if(e.metadata&&e.metadata.measures){const T=e.metadata.measures.filter(n=>s.includes(n.value)).sort((n,r)=>n.position!=null&&r.position!=null&&n.position!=r.position?n.position-r.position:0);E=[],L="measure",O.add("measure");const o={};Object.keys(e).forEach(n=>{o[n]=e[n]}),T.forEach(n=>{const r={},w=c[n.value]||f.getTranslatedValue(y[n.value],h);r.type="measure",r.measureFieldName=n.value,r.measure=w,r[w]=e[n.value],r.variables=o,E.push(r),N.add(w),R.add(y[n.value])}),l={categories:O,indexBy:L,keys:Array.from(N),measuresMetadata:R,data:E}}}return l},U=t=>{const{data:e,measures:s,dimensions:g,overallLabel:v}=t;if(g.length==1&&e.children){if(!(e.children.filter(c=>c.value==v).length>0)){const c={};c.type=g[0],c.value=v,c.label=v,Object.keys(e).forEach(l=>{["children","metadata","type","value"].includes(l)||(c[l]=e[l])}),e.children=[c,...e.children]}}else g.length==2&&e.children&&e.children.forEach(h=>{if(!(h.children.filter(l=>l.value==v).length>0)){const l={};l.type=g[1],l.value=v,l.label=v,Object.keys(h).forEach(p=>{["children","metadata","type","value"].includes(p)||(l[p]=h[p])}),h.children=[l,...h.children]}});return e},z=t=>{var E,L,T;let e={};const{data:s,measures:g,swap:v,dimensions:h,includeOverall:c,locale:l,customLabels:p,colorBy:R,hiddenBars:y}=t,O=h.filter(o=>o!=""),N=s.metadata.measures.filter(o=>g.includes(o.value)).sort((o,n)=>o.position!=null&&n.position!=null&&o.position!=n.position?o.position-n.position:0);if(c&&g.length==1&&U(t),O.length==0&&s)e=P(t);else if(s&&s.children&&s.children.length>0&&O.length>0){const o=f.measuresMap(s),n=f.typesMap(s),r=new Set,w=new Set,F=new Set,q=new Set,M=[],A=s.children[0].type,x=((T=(L=(E=s==null?void 0:s.metadata)==null?void 0:E.types)==null?void 0:L.find(d=>d.dimension==O[0]))==null?void 0:T.items)||[];t.sort=="alphabetically"?x.sort((d,u)=>f.alphaSort(t.sortReverse,l,d.value,u.value)):t.sort=="values"?x.sort((d,u)=>f.numericSort(t.sortReverse,d.value,u.value)):t.sort=="date"&&x.sort((d,u)=>f.dateSort(t.sortReverse,d.value,u.value)),N.forEach(d=>{const u=d.value,j={variables:{}},a=p[u]||f.getTranslatedValue(o[u],l);j.id=a,j.label=a,j.measure=u,j.measureFieldName=u,F.add(o[u]),q.add(a);const i=[];x.forEach(D=>{const S=s.children.find(B=>B.value===D.value);if(S){const B={};Object.keys(S).forEach(m=>{B[m]=S[m]}),B.value=S[u],B[S.type]=S.value.toString(),w.add(n[S.type]),i.push({x:S.value,y:S[u],variables:B}),j.data=i}}),M.push(j)});const V=Array.from(q);let J=(y==null?void 0:y.length)>0&&(M==null?void 0:M.length)>0?M.filter(d=>y.indexOf(d[A])==-1):M;e={metadata:s.metadata,indexBy:A,categories:r,dimensionsMetadata:w,measuresMetadata:F,keys:V,data:J}}return I.Children.map(t.children,o=>I.cloneElement(o,{options:e}))},G=t=>{var O,N,E,L,T,o,n;const{data:e,measures:s,includeOverall:g,dimensions:v,hiddenBars:h,colorBy:c,locale:l,customLabels:p={}}=t,R=v.filter(r=>r!="");let y={};if(g&&U(t),R.length==0&&e)y=P(t);else if(e&&e.children&&e.children.length>0&&R.length>0){const r=f.measuresMap(e),w=f.typesMap(e),F=s[0],q=new Set,M=new Set,A=[],x=[],V=(O=e.children[0])==null?void 0:O.type,J=((L=(E=(N=e==null?void 0:e.metadata)==null?void 0:N.types)==null?void 0:E.find(a=>a.dimension==R[0]))==null?void 0:L.items)||[],d=((n=(o=(T=e==null?void 0:e.metadata)==null?void 0:T.types)==null?void 0:o.find(a=>a.dimension==R[1]))==null?void 0:n.items)||[];t.sortSecondDimension=="alphabetically"?d.sort((a,i)=>f.alphaSort(t.sortReverseSecondDimension,l,a.value,i.value)):t.sortSecondDimension=="date"&&d.sort((a,i)=>f.dateSort(t.sortReverseSecondDimension,a.value,i.value)),M.add(r[F]),d.forEach(a=>{const i={variables:{}},D=p&&p[a.value]||f.getTranslatedValue(a,l)||a.value;i.id=D,i.label=D,i.code=a.code||a.value,i.value=a.value,A.push(D);const S=[];J.forEach(B=>{var K;const m=e.children.find(b=>b.value===B.value);if(m){q.add(w[m==null?void 0:m.type]);const b=(K=m==null?void 0:m.children)==null?void 0:K.find(k=>k.value===a.value);if(b){q.add(w[b==null?void 0:b.type]);const k={};Object.keys(b).forEach(_=>{k[_]=b[_]}),k.value=b[s[0]],k[m.type]=m.value.toString(),k[b.type]=b.value.toString(),S.push({x:m.value,y:b[s[0]],variables:k}),A.indexOf(m.value)==-1&&A.push(m.value)}}}),i.data=S,x.push(i)}),x.forEach(a=>{A.forEach(i=>{a.data.find(D=>D.x==i)||a.data.push({x:i,y:null,variables:{}})})}),x.forEach(a=>{a.data.sort((i,D)=>t.sort=="alphabetically"?f.alphaSort(t.sortReverse,l,i.x,D.x):t.sort=="date"?f.dateSort(t.sortReverse,i.x,D.x):0)});const u=c=="id"?x:x.filter(a=>h.indexOf(a[V])==-1),j=[...A];y={metadata:e.metadata,dimensionsMetadata:q,measuresMetadata:M,indexBy:V,keys:c=="index"?j:j.filter(a=>h.indexOf(a)==-1),data:u}}return C.jsx(C.Fragment,{children:I.Children.map(t.children,r=>I.cloneElement(r,{options:y}))})},H=t=>{const{data:e,measures:s,dimensions:g}=t,v=JSON.parse(JSON.stringify(e));return g.length===1?C.jsx(z,{...t,data:v}):C.jsx(G,{...t,data:v})};exports.default=H;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const D=require("./Colors.js");class F extends D.default{constructor(n,l,h,O,j,f,d,E,b,o,C,p,t){if(super(h,O,j,E,b),this.type=l,this._manualColor={},p&&(this._manualColor[p]=o?o.Overall:null),n!="csv"){const v=u=>{const _=(f?[...f]:[])[u];let s=[];_&&(s=_.items||[]),o!=null&&o!=null&&Object.keys(o).forEach(e=>{const c=s.filter(i=>i.code===e||i.value===e||i.id===e||i.label===e),r=o[e];if(this._manualColor[e]=r,c.length>0){const i=c[0];i.value!==void 0&&(this._manualColor[i.value]=r),i.label!==void 0&&(this._manualColor[i.label]=r),i.code!==void 0&&(this._manualColor[i.code]=r),i.id!==void 0&&(this._manualColor[i.id]=r);const B=t&&(t[e]||i.value&&t[i.value]||i.code&&t[i.code]);if(B&&(this._manualColor[B]=r),i.labels){let y;C&&(y=i.labels[C.toUpperCase()]),y&&(this._manualColor[y]=r),Object.values(i.labels).forEach(g=>{g&&(this._manualColor[g]=r)})}}})},x=()=>{const u=d?[...d]:[];o!=null&&o!=null&&Object.keys(o).forEach(a=>{const _=u.filter(e=>e.value===a||e.code===a||e.id===a||e.label===a),s=o[a];if(this._manualColor[a]=s,_.length>0){const e=_[0];e.value!==void 0&&(this._manualColor[e.value]=s),e.label!==void 0&&(this._manualColor[e.label]=s),e.code!==void 0&&(this._manualColor[e.code]=s),e.id!==void 0&&(this._manualColor[e.id]=s);const c=t&&(t[a]||e.value&&t[e.value]||e.code&&t[e.code]);if(c&&(this._manualColor[c]=s),e.labels){let r;C&&(r=e.labels[C.toUpperCase()]),r&&(this._manualColor[r]=s),Object.values(e.labels).forEach(i=>{i&&(this._manualColor[i]=s)})}}})},z=()=>{Object.keys(o).forEach(u=>{this._manualColor[u]=o[u]})},m=l=="line"?1:h==="index"?0:1;!f&&!d?z():!f||f.size===0?x():f.size==1&&m==1?b=="measure"?v(0):x():f.size==1&&m==0?v(0):v(m)}else this._manualColor=o&&o[h]?o[h]:{}}getColor(n,l){if(this._manualColor[n])return this._manualColor[n];if(l){if(this.indexBy&&l[this.indexBy]&&this._manualColor[l[this.indexBy]])return this._manualColor[l[this.indexBy]];if(l.id&&this._manualColor[l.id])return this._manualColor[l.id];if(l.label&&this._manualColor[l.label])return this._manualColor[l.label];if(l.value&&this._manualColor[l.value])return this._manualColor[l.value];if(l.code&&this._manualColor[l.code])return this._manualColor[l.code];if(l.measure&&this._manualColor[l.measure])return this._manualColor[l.measure];if(l.measureFieldName&&this._manualColor[l.measureFieldName])return this._manualColor[l.measureFieldName]}if(this.colorBy==="index"){const h=this._manualColor[n]||l&&this.indexBy&&this._manualColor[l[this.indexBy]];return h||"#5555"}return this.colorBy==="id"&&this._manualColor[n]?this._manualColor[n]:"#5555"}getColorByIndex(n){return this._manualColor[n]?this._manualColor[n]:"#5555"}getColorByKey(n){return this._manualColor[n]?this._manualColor[n]:"#5555"}}exports.default=F;
|
|
@@ -1,56 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
class
|
|
3
|
-
constructor(
|
|
4
|
-
if (super(
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import I from "./Colors.js";
|
|
2
|
+
class $ extends I {
|
|
3
|
+
constructor(o, e, h, O, N, c, m, j, x, n = {}, d, g, f, _) {
|
|
4
|
+
if (super(h, O, N, j, x), this.type = e, this._manualColor = {}, g && (this._manualColor[g] = n ? n.Overall : null), o !== "csv") {
|
|
5
|
+
const b = (s) => {
|
|
6
|
+
const t = c ? [...c] : [], u = t[s] ? t[s].items || [] : [];
|
|
7
|
+
n != null && n != null && Object.keys(n).forEach((i) => {
|
|
8
|
+
const l = u.filter((r) => r.code === i || r.value === i || r.id === i || r.label === i), a = n[i];
|
|
9
|
+
if (this._manualColor[i] = a, l.length > 0) {
|
|
10
|
+
const r = l[0];
|
|
11
|
+
r.value !== void 0 && (this._manualColor[r.value] = a), r.label !== void 0 && (this._manualColor[r.label] = a), r.code !== void 0 && (this._manualColor[r.code] = a), r.id !== void 0 && (this._manualColor[r.id] = a);
|
|
12
|
+
const C = f && (f[i] || r.value && f[r.value] || r.code && f[r.code]);
|
|
13
|
+
if (C && (this._manualColor[C] = a), r.labels) {
|
|
14
|
+
let y;
|
|
15
|
+
d && (y = r.labels[d.toUpperCase()]), y && (this._manualColor[y] = a), Object.values(r.labels).forEach((B) => {
|
|
16
|
+
B && (this._manualColor[B] = a);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
11
19
|
}
|
|
12
20
|
});
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
}, z = (s) => s == null ? void 0 : s.map((u) => {
|
|
22
|
+
var l, a;
|
|
23
|
+
const i = (l = u.group) == null ? void 0 : l.label;
|
|
24
|
+
return !i || (a = u.label) != null && a.includes(i) ? u : {
|
|
25
|
+
...u,
|
|
26
|
+
label: `${i} - ${u.label}`
|
|
18
27
|
};
|
|
19
|
-
}),
|
|
20
|
-
var
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
),
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
}), E = () => {
|
|
29
|
+
var s;
|
|
30
|
+
return m && m.size > 0 ? [...m] : (s = _ == null ? void 0 : _.metadata) != null && s.measures && _.metadata.measures.length > 0 ? (_.metadata.measures = z(
|
|
31
|
+
_.metadata.measures
|
|
32
|
+
), _.metadata.measures) : [];
|
|
33
|
+
}, p = () => {
|
|
34
|
+
const s = E();
|
|
35
|
+
n != null && n != null && Object.keys(n).forEach((t) => {
|
|
36
|
+
const u = [...s].filter((l) => l.value === t || l.code === t || l.id === t || l.label === t), i = n[t];
|
|
37
|
+
if (this._manualColor[t] = i, u.length > 0) {
|
|
38
|
+
const l = u[0];
|
|
39
|
+
l.value !== void 0 && (this._manualColor[l.value] = i), l.label !== void 0 && (this._manualColor[l.label] = i), l.code !== void 0 && (this._manualColor[l.code] = i), l.id !== void 0 && (this._manualColor[l.id] = i);
|
|
40
|
+
const a = f && (f[t] || l.value && f[l.value] || l.code && f[l.code]);
|
|
41
|
+
if (a && (this._manualColor[a] = i), l.labels) {
|
|
42
|
+
let r;
|
|
43
|
+
d && (r = l.labels[d.toUpperCase()]), r && (this._manualColor[r] = i), Object.values(l.labels).forEach((C) => {
|
|
44
|
+
C && (this._manualColor[C] = i);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
32
47
|
}
|
|
33
48
|
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const p = o === "line" ? 1 : u === "index" ? 0 : 1;
|
|
37
|
-
n ? n.size == 1 && p == 1 ? _ == "measure" ? d(0) : m() : d(p) : m();
|
|
49
|
+
}, v = e === "line" ? 1 : h === "index" ? 0 : 1;
|
|
50
|
+
!c || c.size === 0 ? p() : c.size == 1 && v == 1 ? x == "measure" ? b(0) : p() : c.size == 1 && v == 0 ? b(0) : b(v);
|
|
38
51
|
} else
|
|
39
|
-
this._manualColor =
|
|
52
|
+
this._manualColor = n && n[h] ? n[h] : {};
|
|
40
53
|
}
|
|
41
|
-
getColor(
|
|
54
|
+
getColor(o, e) {
|
|
55
|
+
if (this._manualColor[o])
|
|
56
|
+
return this._manualColor[o];
|
|
57
|
+
if (e) {
|
|
58
|
+
if (this.indexBy && e[this.indexBy] && this._manualColor[e[this.indexBy]])
|
|
59
|
+
return this._manualColor[e[this.indexBy]];
|
|
60
|
+
if (e.id && this._manualColor[e.id])
|
|
61
|
+
return this._manualColor[e.id];
|
|
62
|
+
if (e.label && this._manualColor[e.label])
|
|
63
|
+
return this._manualColor[e.label];
|
|
64
|
+
if (e.value && this._manualColor[e.value])
|
|
65
|
+
return this._manualColor[e.value];
|
|
66
|
+
if (e.code && this._manualColor[e.code])
|
|
67
|
+
return this._manualColor[e.code];
|
|
68
|
+
if (e.measure && this._manualColor[e.measure])
|
|
69
|
+
return this._manualColor[e.measure];
|
|
70
|
+
if (e.measureFieldName && this._manualColor[e.measureFieldName])
|
|
71
|
+
return this._manualColor[e.measureFieldName];
|
|
72
|
+
}
|
|
42
73
|
if (this.colorBy === "index") {
|
|
43
|
-
const
|
|
44
|
-
return
|
|
74
|
+
const h = this._manualColor[o] || e && this.indexBy && this._manualColor[e[this.indexBy]];
|
|
75
|
+
return h || "#555555";
|
|
45
76
|
}
|
|
46
|
-
return this.colorBy === "id" && this._manualColor[
|
|
77
|
+
return this.colorBy === "id" && this._manualColor[o] ? this._manualColor[o] : "#555555";
|
|
47
78
|
}
|
|
48
|
-
getColorByIndex(
|
|
79
|
+
getColorByIndex(o) {
|
|
80
|
+
return this._manualColor[o] ? this._manualColor[o] : "#555555";
|
|
49
81
|
}
|
|
50
|
-
getColorByKey(
|
|
51
|
-
return this._manualColor[
|
|
82
|
+
getColorByKey(o) {
|
|
83
|
+
return this._manualColor[o] ? this._manualColor[o] : "#555555";
|
|
52
84
|
}
|
|
53
85
|
}
|
|
54
86
|
export {
|
|
55
|
-
|
|
87
|
+
$ as default
|
|
56
88
|
};
|
|
@@ -1,165 +1,169 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { measuresMap as
|
|
4
|
-
const
|
|
5
|
-
const { data: e, measures:
|
|
6
|
-
let
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
1
|
+
import { jsx as T, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import J from "react";
|
|
3
|
+
import { measuresMap as z, typesMap as Q, alphaSort as V, numericSort as Y, dateSort as q, getTranslatedValue as G } from "./Utils.js";
|
|
4
|
+
const U = (t) => {
|
|
5
|
+
const { data: e, measures: s, swap: y, dimensions: f, locale: v, customLabels: c } = t;
|
|
6
|
+
let l = {};
|
|
7
|
+
const S = f.filter((h) => h != ""), L = /* @__PURE__ */ new Set();
|
|
8
|
+
if (S.length == 0 && e) {
|
|
9
|
+
const h = z(e), D = /* @__PURE__ */ new Set(), B = /* @__PURE__ */ new Set();
|
|
10
10
|
let E = [], j;
|
|
11
11
|
if (e.metadata && e.metadata.measures) {
|
|
12
|
-
const
|
|
12
|
+
const N = e.metadata.measures.filter((n) => s.includes(n.value)).sort((n, r) => n.position != null && r.position != null && n.position != r.position ? n.position - r.position : 0);
|
|
13
13
|
E = [], j = "measure", D.add("measure");
|
|
14
|
-
const
|
|
15
|
-
Object.keys(e).forEach((
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
}),
|
|
14
|
+
const o = {};
|
|
15
|
+
Object.keys(e).forEach((n) => {
|
|
16
|
+
o[n] = e[n];
|
|
17
|
+
}), N.forEach((n) => {
|
|
18
|
+
const r = {}, O = c[n.value] || G(h[n.value], v);
|
|
19
|
+
r.type = "measure", r.measureFieldName = n.value, r.measure = O, r[O] = e[n.value], r.variables = o, E.push(r), B.add(O), L.add(h[n.value]);
|
|
20
|
+
}), l = {
|
|
21
21
|
categories: D,
|
|
22
22
|
indexBy: j,
|
|
23
|
-
keys: Array.from(
|
|
24
|
-
measuresMetadata:
|
|
23
|
+
keys: Array.from(B),
|
|
24
|
+
measuresMetadata: L,
|
|
25
25
|
data: E
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
return
|
|
30
|
-
},
|
|
31
|
-
const { data: e, measures:
|
|
32
|
-
if (
|
|
33
|
-
if (!(e.children.filter((
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
["children", "metadata", "type", "value"].includes(
|
|
37
|
-
}), e.children = [
|
|
29
|
+
return l;
|
|
30
|
+
}, W = (t) => {
|
|
31
|
+
const { data: e, measures: s, dimensions: y, overallLabel: f } = t;
|
|
32
|
+
if (y.length == 1 && e.children) {
|
|
33
|
+
if (!(e.children.filter((c) => c.value == f).length > 0)) {
|
|
34
|
+
const c = {};
|
|
35
|
+
c.type = y[0], c.value = f, c.label = f, Object.keys(e).forEach((l) => {
|
|
36
|
+
["children", "metadata", "type", "value"].includes(l) || (c[l] = e[l]);
|
|
37
|
+
}), e.children = [c, ...e.children];
|
|
38
38
|
}
|
|
39
|
-
} else
|
|
40
|
-
if (!(v.children.filter((
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
["children", "metadata", "type", "value"].includes(
|
|
44
|
-
}), v.children = [
|
|
39
|
+
} else y.length == 2 && e.children && e.children.forEach((v) => {
|
|
40
|
+
if (!(v.children.filter((l) => l.value == f).length > 0)) {
|
|
41
|
+
const l = {};
|
|
42
|
+
l.type = y[1], l.value = f, l.label = f, Object.keys(v).forEach((S) => {
|
|
43
|
+
["children", "metadata", "type", "value"].includes(S) || (l[S] = v[S]);
|
|
44
|
+
}), v.children = [l, ...v.children];
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
return e;
|
|
48
|
-
},
|
|
49
|
-
var
|
|
48
|
+
}, Z = (t) => {
|
|
49
|
+
var E, j, N;
|
|
50
50
|
let e = {};
|
|
51
51
|
const {
|
|
52
|
-
data:
|
|
53
|
-
measures:
|
|
54
|
-
swap:
|
|
52
|
+
data: s,
|
|
53
|
+
measures: y,
|
|
54
|
+
swap: f,
|
|
55
55
|
dimensions: v,
|
|
56
|
-
includeOverall:
|
|
57
|
-
locale:
|
|
58
|
-
customLabels:
|
|
59
|
-
colorBy:
|
|
60
|
-
hiddenBars:
|
|
61
|
-
} = t, D = v.filter((
|
|
62
|
-
if (
|
|
63
|
-
e =
|
|
64
|
-
else if (
|
|
65
|
-
const
|
|
66
|
-
t.sort == "alphabetically" ?
|
|
67
|
-
(
|
|
68
|
-
) : t.sort == "values" ?
|
|
69
|
-
(
|
|
70
|
-
) : t.sort == "date" &&
|
|
71
|
-
(
|
|
72
|
-
),
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
Object.keys(
|
|
81
|
-
|
|
82
|
-
}),
|
|
56
|
+
includeOverall: c,
|
|
57
|
+
locale: l,
|
|
58
|
+
customLabels: S,
|
|
59
|
+
colorBy: L,
|
|
60
|
+
hiddenBars: h
|
|
61
|
+
} = t, D = v.filter((o) => o != ""), B = s.metadata.measures.filter((o) => y.includes(o.value)).sort((o, n) => o.position != null && n.position != null && o.position != n.position ? o.position - n.position : 0);
|
|
62
|
+
if (c && y.length == 1 && W(t), D.length == 0 && s)
|
|
63
|
+
e = U(t);
|
|
64
|
+
else if (s && s.children && s.children.length > 0 && D.length > 0) {
|
|
65
|
+
const o = z(s), n = Q(s), r = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ new Set(), w = [], A = s.children[0].type, p = ((N = (j = (E = s == null ? void 0 : s.metadata) == null ? void 0 : E.types) == null ? void 0 : j.find((d) => d.dimension == D[0])) == null ? void 0 : N.items) || [];
|
|
66
|
+
t.sort == "alphabetically" ? p.sort(
|
|
67
|
+
(d, u) => V(t.sortReverse, l, d.value, u.value)
|
|
68
|
+
) : t.sort == "values" ? p.sort(
|
|
69
|
+
(d, u) => Y(t.sortReverse, d.value, u.value)
|
|
70
|
+
) : t.sort == "date" && p.sort(
|
|
71
|
+
(d, u) => q(t.sortReverse, d.value, u.value)
|
|
72
|
+
), B.forEach((d) => {
|
|
73
|
+
const u = d.value, R = { variables: {} }, a = S[u] || G(o[u], l);
|
|
74
|
+
R.id = a, R.label = a, R.measure = u, R.measureFieldName = u, C.add(o[u]), F.add(a);
|
|
75
|
+
const i = [];
|
|
76
|
+
p.forEach((x) => {
|
|
77
|
+
const g = s.children.find((M) => M.value === x.value);
|
|
78
|
+
if (g) {
|
|
79
|
+
const M = {};
|
|
80
|
+
Object.keys(g).forEach((m) => {
|
|
81
|
+
M[m] = g[m];
|
|
82
|
+
}), M.value = g[u], M[g.type] = g.value.toString(), O.add(n[g.type]), i.push({ x: g.value, y: g[u], variables: M }), R.data = i;
|
|
83
83
|
}
|
|
84
|
-
}),
|
|
84
|
+
}), w.push(R);
|
|
85
85
|
});
|
|
86
|
-
const
|
|
87
|
-
let
|
|
86
|
+
const I = Array.from(F);
|
|
87
|
+
let K = (h == null ? void 0 : h.length) > 0 && (w == null ? void 0 : w.length) > 0 ? w.filter((d) => h.indexOf(d[A]) == -1) : w;
|
|
88
88
|
e = {
|
|
89
|
-
metadata:
|
|
90
|
-
indexBy:
|
|
91
|
-
categories:
|
|
92
|
-
dimensionsMetadata:
|
|
93
|
-
measuresMetadata:
|
|
94
|
-
keys:
|
|
95
|
-
data:
|
|
89
|
+
metadata: s.metadata,
|
|
90
|
+
indexBy: A,
|
|
91
|
+
categories: r,
|
|
92
|
+
dimensionsMetadata: O,
|
|
93
|
+
measuresMetadata: C,
|
|
94
|
+
keys: I,
|
|
95
|
+
data: K
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
return
|
|
98
|
+
return J.Children.map(
|
|
99
99
|
t.children,
|
|
100
|
-
(
|
|
100
|
+
(o) => J.cloneElement(o, { options: e })
|
|
101
101
|
);
|
|
102
|
-
},
|
|
103
|
-
var
|
|
102
|
+
}, _ = (t) => {
|
|
103
|
+
var D, B, E, j, N, o, n;
|
|
104
104
|
const {
|
|
105
105
|
data: e,
|
|
106
|
-
measures:
|
|
107
|
-
includeOverall:
|
|
108
|
-
dimensions:
|
|
106
|
+
measures: s,
|
|
107
|
+
includeOverall: y,
|
|
108
|
+
dimensions: f,
|
|
109
109
|
hiddenBars: v,
|
|
110
|
-
colorBy:
|
|
111
|
-
locale:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
110
|
+
colorBy: c,
|
|
111
|
+
locale: l,
|
|
112
|
+
customLabels: S = {}
|
|
113
|
+
} = t, L = f.filter((r) => r != "");
|
|
114
|
+
let h = {};
|
|
115
|
+
if (y && W(t), L.length == 0 && e)
|
|
116
|
+
h = U(t);
|
|
117
|
+
else if (e && e.children && e.children.length > 0 && L.length > 0) {
|
|
118
|
+
const r = z(e), O = Q(e), C = s[0], F = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), A = [], p = [], I = (D = e.children[0]) == null ? void 0 : D.type, K = ((j = (E = (B = e == null ? void 0 : e.metadata) == null ? void 0 : B.types) == null ? void 0 : E.find((a) => a.dimension == L[0])) == null ? void 0 : j.items) || [], d = ((n = (o = (N = e == null ? void 0 : e.metadata) == null ? void 0 : N.types) == null ? void 0 : o.find((a) => a.dimension == L[1])) == null ? void 0 : n.items) || [];
|
|
119
|
+
t.sortSecondDimension == "alphabetically" ? d.sort(
|
|
120
|
+
(a, i) => V(t.sortReverseSecondDimension, l, a.value, i.value)
|
|
121
|
+
) : t.sortSecondDimension == "date" && d.sort(
|
|
122
|
+
(a, i) => q(t.sortReverseSecondDimension, a.value, i.value)
|
|
123
|
+
), w.add(r[C]), d.forEach((a) => {
|
|
124
|
+
const i = { variables: {} }, x = S && S[a.value] || G(a, l) || a.value;
|
|
125
|
+
i.id = x, i.label = x, i.code = a.code || a.value, i.value = a.value, A.push(x);
|
|
126
|
+
const g = [];
|
|
127
|
+
K.forEach((M) => {
|
|
128
|
+
var H;
|
|
129
|
+
const m = e.children.find((b) => b.value === M.value);
|
|
130
|
+
if (m) {
|
|
131
|
+
F.add(O[m == null ? void 0 : m.type]);
|
|
132
|
+
const b = (H = m == null ? void 0 : m.children) == null ? void 0 : H.find((k) => k.value === a.value);
|
|
133
|
+
if (b) {
|
|
134
|
+
F.add(O[b == null ? void 0 : b.type]);
|
|
135
|
+
const k = {};
|
|
136
|
+
Object.keys(b).forEach((P) => {
|
|
137
|
+
k[P] = b[P];
|
|
138
|
+
}), k.value = b[s[0]], k[m.type] = m.value.toString(), k[b.type] = b.value.toString(), g.push({ x: m.value, y: b[s[0]], variables: k }), A.indexOf(m.value) == -1 && A.push(m.value);
|
|
139
|
+
}
|
|
136
140
|
}
|
|
137
|
-
}),
|
|
138
|
-
}),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
}), i.data = g, p.push(i);
|
|
142
|
+
}), p.forEach((a) => {
|
|
143
|
+
A.forEach((i) => {
|
|
144
|
+
a.data.find((x) => x.x == i) || a.data.push({ x: i, y: null, variables: {} });
|
|
141
145
|
});
|
|
142
|
-
}),
|
|
143
|
-
|
|
146
|
+
}), p.forEach((a) => {
|
|
147
|
+
a.data.sort((i, x) => t.sort == "alphabetically" ? V(t.sortReverse, l, i.x, x.x) : t.sort == "date" ? q(t.sortReverse, i.x, x.x) : 0);
|
|
144
148
|
});
|
|
145
|
-
const
|
|
146
|
-
|
|
149
|
+
const u = c == "id" ? p : p.filter((a) => v.indexOf(a[I]) == -1), R = [...A];
|
|
150
|
+
h = {
|
|
147
151
|
metadata: e.metadata,
|
|
148
|
-
dimensionsMetadata:
|
|
149
|
-
measuresMetadata:
|
|
150
|
-
indexBy:
|
|
151
|
-
keys:
|
|
152
|
-
data:
|
|
152
|
+
dimensionsMetadata: F,
|
|
153
|
+
measuresMetadata: w,
|
|
154
|
+
indexBy: I,
|
|
155
|
+
keys: c == "index" ? R : R.filter((a) => v.indexOf(a) == -1),
|
|
156
|
+
data: u
|
|
153
157
|
};
|
|
154
158
|
}
|
|
155
|
-
return /* @__PURE__ */
|
|
159
|
+
return /* @__PURE__ */ T(X, { children: J.Children.map(
|
|
156
160
|
t.children,
|
|
157
|
-
(
|
|
161
|
+
(r) => J.cloneElement(r, { options: h })
|
|
158
162
|
) });
|
|
159
|
-
},
|
|
160
|
-
const { data: e, measures:
|
|
161
|
-
return
|
|
163
|
+
}, ae = (t) => {
|
|
164
|
+
const { data: e, measures: s, dimensions: y } = t, f = JSON.parse(JSON.stringify(e));
|
|
165
|
+
return y.length === 1 ? /* @__PURE__ */ T(Z, { ...t, data: f }) : /* @__PURE__ */ T(_, { ...t, data: f });
|
|
162
166
|
};
|
|
163
167
|
export {
|
|
164
|
-
|
|
168
|
+
ae as default
|
|
165
169
|
};
|
|
@@ -1,50 +1,81 @@
|
|
|
1
|
-
import
|
|
2
|
-
class
|
|
3
|
-
constructor(
|
|
4
|
-
if (super(
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import D from "./Colors.js";
|
|
2
|
+
class A extends D {
|
|
3
|
+
constructor(n, l, h, g, j, f, d, E, b, o, C, p, t) {
|
|
4
|
+
if (super(h, g, j, E, b), this.type = l, this._manualColor = {}, p && (this._manualColor[p] = o ? o.Overall : null), n != "csv") {
|
|
5
|
+
const m = (u) => {
|
|
6
|
+
const _ = (f ? [...f] : [])[u];
|
|
7
|
+
let s = [];
|
|
8
|
+
_ && (s = _.items || []), o != null && o != null && Object.keys(o).forEach((e) => {
|
|
9
|
+
const c = s.filter((i) => i.code === e || i.value === e || i.id === e || i.label === e), r = o[e];
|
|
10
|
+
if (this._manualColor[e] = r, c.length > 0) {
|
|
11
|
+
const i = c[0];
|
|
12
|
+
i.value !== void 0 && (this._manualColor[i.value] = r), i.label !== void 0 && (this._manualColor[i.label] = r), i.code !== void 0 && (this._manualColor[i.code] = r), i.id !== void 0 && (this._manualColor[i.id] = r);
|
|
13
|
+
const B = t && (t[e] || i.value && t[i.value] || i.code && t[i.code]);
|
|
14
|
+
if (B && (this._manualColor[B] = r), i.labels) {
|
|
15
|
+
let y;
|
|
16
|
+
C && (y = i.labels[C.toUpperCase()]), y && (this._manualColor[y] = r), Object.values(i.labels).forEach((O) => {
|
|
17
|
+
O && (this._manualColor[O] = r);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
12
20
|
}
|
|
13
21
|
});
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
}, x = () => {
|
|
23
|
+
const u = d ? [...d] : [];
|
|
24
|
+
o != null && o != null && Object.keys(o).forEach((a) => {
|
|
25
|
+
const _ = u.filter((e) => e.value === a || e.code === a || e.id === a || e.label === a), s = o[a];
|
|
26
|
+
if (this._manualColor[a] = s, _.length > 0) {
|
|
27
|
+
const e = _[0];
|
|
28
|
+
e.value !== void 0 && (this._manualColor[e.value] = s), e.label !== void 0 && (this._manualColor[e.label] = s), e.code !== void 0 && (this._manualColor[e.code] = s), e.id !== void 0 && (this._manualColor[e.id] = s);
|
|
29
|
+
const c = t && (t[a] || e.value && t[e.value] || e.code && t[e.code]);
|
|
30
|
+
if (c && (this._manualColor[c] = s), e.labels) {
|
|
31
|
+
let r;
|
|
32
|
+
C && (r = e.labels[C.toUpperCase()]), r && (this._manualColor[r] = s), Object.values(e.labels).forEach((i) => {
|
|
33
|
+
i && (this._manualColor[i] = s);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
22
36
|
}
|
|
23
37
|
});
|
|
24
|
-
},
|
|
25
|
-
Object.keys(
|
|
26
|
-
this._manualColor[
|
|
38
|
+
}, z = () => {
|
|
39
|
+
Object.keys(o).forEach((u) => {
|
|
40
|
+
this._manualColor[u] = o[u];
|
|
27
41
|
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const m = _ == "line" ? 1 : r === "index" ? 0 : 1;
|
|
31
|
-
!h && !u ? B() : h ? h.size == 1 && m == 1 ? a == "measure" ? y(0) : b() : y(m) : b();
|
|
42
|
+
}, v = l == "line" ? 1 : h === "index" ? 0 : 1;
|
|
43
|
+
!f && !d ? z() : !f || f.size === 0 ? x() : f.size == 1 && v == 1 ? b == "measure" ? m(0) : x() : f.size == 1 && v == 0 ? m(0) : m(v);
|
|
32
44
|
} else
|
|
33
|
-
this._manualColor =
|
|
45
|
+
this._manualColor = o && o[h] ? o[h] : {};
|
|
34
46
|
}
|
|
35
|
-
getColor(
|
|
47
|
+
getColor(n, l) {
|
|
48
|
+
if (this._manualColor[n])
|
|
49
|
+
return this._manualColor[n];
|
|
50
|
+
if (l) {
|
|
51
|
+
if (this.indexBy && l[this.indexBy] && this._manualColor[l[this.indexBy]])
|
|
52
|
+
return this._manualColor[l[this.indexBy]];
|
|
53
|
+
if (l.id && this._manualColor[l.id])
|
|
54
|
+
return this._manualColor[l.id];
|
|
55
|
+
if (l.label && this._manualColor[l.label])
|
|
56
|
+
return this._manualColor[l.label];
|
|
57
|
+
if (l.value && this._manualColor[l.value])
|
|
58
|
+
return this._manualColor[l.value];
|
|
59
|
+
if (l.code && this._manualColor[l.code])
|
|
60
|
+
return this._manualColor[l.code];
|
|
61
|
+
if (l.measure && this._manualColor[l.measure])
|
|
62
|
+
return this._manualColor[l.measure];
|
|
63
|
+
if (l.measureFieldName && this._manualColor[l.measureFieldName])
|
|
64
|
+
return this._manualColor[l.measureFieldName];
|
|
65
|
+
}
|
|
36
66
|
if (this.colorBy === "index") {
|
|
37
|
-
const
|
|
38
|
-
return
|
|
67
|
+
const h = this._manualColor[n] || l && this.indexBy && this._manualColor[l[this.indexBy]];
|
|
68
|
+
return h || "#5555";
|
|
39
69
|
}
|
|
40
|
-
return this.colorBy === "id" && this._manualColor[
|
|
70
|
+
return this.colorBy === "id" && this._manualColor[n] ? this._manualColor[n] : "#5555";
|
|
41
71
|
}
|
|
42
|
-
getColorByIndex(
|
|
72
|
+
getColorByIndex(n) {
|
|
73
|
+
return this._manualColor[n] ? this._manualColor[n] : "#5555";
|
|
43
74
|
}
|
|
44
|
-
getColorByKey(
|
|
45
|
-
return this._manualColor[
|
|
75
|
+
getColorByKey(n) {
|
|
76
|
+
return this._manualColor[n] ? this._manualColor[n] : "#5555";
|
|
46
77
|
}
|
|
47
78
|
}
|
|
48
79
|
export {
|
|
49
|
-
|
|
80
|
+
A as default
|
|
50
81
|
};
|
|
@@ -2,7 +2,9 @@ import { default as Colors } from './Colors';
|
|
|
2
2
|
export default CustomColors;
|
|
3
3
|
declare class CustomColors extends Colors {
|
|
4
4
|
constructor(app: any, type: any, colorBy: any, scheme: any, data: any, dimensionsMetadata: any, measuresMetadata: any, keys: any, indexBy: any, manualColors: {} | undefined, locale: any, overallLabel: any, customLabels: any, options: any);
|
|
5
|
+
type: any;
|
|
5
6
|
_manualColor: any;
|
|
6
7
|
getColor(id: any, datum: any): any;
|
|
8
|
+
getColorByIndex(value: any): any;
|
|
7
9
|
getColorByKey(value: any): any;
|
|
8
10
|
}
|
|
@@ -2,7 +2,9 @@ import { default as Colors } from './Colors';
|
|
|
2
2
|
export default CustomColors;
|
|
3
3
|
declare class CustomColors extends Colors {
|
|
4
4
|
constructor(app: any, type: any, colorBy: any, scheme: any, data: any, dimensionsMetadata: any, measuresMetadata: any, keys: any, indexBy: any, manualColors: any, locale: any, overallLabel: any, customLabels: any);
|
|
5
|
+
type: any;
|
|
5
6
|
_manualColor: any;
|
|
6
7
|
getColor(id: any, datum: any): any;
|
|
8
|
+
getColorByIndex(value: any): any;
|
|
7
9
|
getColorByKey(value: any): any;
|
|
8
10
|
}
|