@devtron-labs/devtron-fe-common-lib 1.20.3-pre-9 → 1.20.3-pre-10
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/{@code-editor-P2jsjZMo.js → @code-editor-DSCCeHlr.js} +5851 -5700
- package/dist/{@common-rjsf-h2fbxMxq.js → @common-rjsf-BuYoyjSG.js} +6 -6
- package/dist/{@framer-motion-CyE9ZrhW.js → @framer-motion-DMkBQPN0.js} +1 -1
- package/dist/{@react-dates-DZKuosYz.js → @react-dates-BjZWpiVv.js} +1 -1
- package/dist/{@react-select-D2LpysD2.js → @react-select-DtwlfcIG.js} +1 -1
- package/dist/{@react-virtualized-sticky-tree-ok_G4gcR.js → @react-virtualized-sticky-tree-M81Af3Qs.js} +1 -1
- package/dist/{@vendor-DwGKptu5.js → @vendor-DceGoESd.js} +133 -132
- package/dist/Common/Types.d.ts +12 -0
- package/dist/Pages-Devtron-2.0/CostVisibility/Shared/constants.d.ts +4 -0
- package/dist/Pages-Devtron-2.0/CostVisibility/Shared/index.d.ts +1 -0
- package/dist/Pages-Devtron-2.0/CostVisibility/Shared/types.d.ts +20 -0
- package/dist/Shared/Components/Charts/constants.d.ts +3 -11
- package/dist/Shared/Components/Charts/index.d.ts +1 -1
- package/dist/Shared/Components/Charts/plugins.d.ts +2 -3
- package/dist/Shared/Components/Charts/types.d.ts +39 -24
- package/dist/Shared/Components/Charts/utils.d.ts +61 -6
- package/dist/Shared/Components/PrometheusConfigurations/PrometheusConfigCard.d.ts +1 -1
- package/dist/Shared/Components/PrometheusConfigurations/types.d.ts +0 -1
- package/dist/index.js +871 -869
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
|
-
import { j as n,
|
1
|
+
import { j as n, aK as v, aM as J, aL as K } from "./@vendor-DceGoESd.js";
|
2
2
|
import V, { useState as q, useEffect as Y, forwardRef as G, useMemo as E } from "react";
|
3
3
|
import z, { getDefaultRegistry as Q } from "@rjsf/core";
|
4
|
-
import { T as O, j as F, c as S, b as N, S as X, i as Z, g as ee, a as te, d as R, e as ne } from "./@code-editor-
|
4
|
+
import { T as O, j as F, c as S, b as N, S as X, i as Z, g as ee, a as te, d as R, e as ne } from "./@code-editor-DSCCeHlr.js";
|
5
5
|
import { getUiOptions as B, getTemplate as $, getSubmitButtonOptions as re, ADDITIONAL_PROPERTY_FLAG as L, errorId as se, englishStringTranslator as ae, TranslatableString as oe, titleId as le, canExpand as ie, deepEquals as ce } from "@rjsf/utils";
|
6
6
|
import { ReactComponent as de } from "./assets/ic-add.cfaa779b.svg";
|
7
7
|
import { ReactComponent as ue } from "./assets/ic-warning.ecf7ff97.svg";
|
@@ -10,7 +10,7 @@ import './assets/@common-rjsf.css';const P = {
|
|
10
10
|
SELECT: "Please select an option",
|
11
11
|
INPUT: "Please enter an input",
|
12
12
|
OBJECT_KEY: "Please enter a value for the key"
|
13
|
-
}, pe = "Key not available",
|
13
|
+
}, pe = "Key not available", Je = {
|
14
14
|
"ui:submitButtonOptions": {
|
15
15
|
norender: !0
|
16
16
|
}
|
@@ -329,7 +329,7 @@ import './assets/@common-rjsf.css';const P = {
|
|
329
329
|
wrap: !1
|
330
330
|
});
|
331
331
|
o !== void 0 && (r = F([N(i, o), r]));
|
332
|
-
}), t && r ?
|
332
|
+
}), t && r ? J(t, K(t, r), !1, !1).newDocument : r);
|
333
333
|
}, Fe = ({ formData: e, schemaPathToUpdatePathMap: t }) => F([
|
334
334
|
...Object.entries(t).map(([s, r]) => {
|
335
335
|
if (s === r || !r)
|
@@ -507,7 +507,7 @@ import './assets/@common-rjsf.css';const P = {
|
|
507
507
|
Y(() => {
|
508
508
|
_(ee(8));
|
509
509
|
}, []);
|
510
|
-
const y = (g) => s ? u.filter((b) => g.some((
|
510
|
+
const y = (g) => s ? u.filter((b) => g.some((W) => R(W, b.value))) : u.find((b) => R(g, b.value));
|
511
511
|
return /* @__PURE__ */ n.jsx(
|
512
512
|
te,
|
513
513
|
{
|
@@ -595,7 +595,7 @@ import './assets/@common-rjsf.css';const P = {
|
|
595
595
|
] });
|
596
596
|
});
|
597
597
|
export {
|
598
|
-
|
598
|
+
Je as H,
|
599
599
|
qe as R,
|
600
600
|
Ke as a,
|
601
601
|
Se as b,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { aW as m, aX as lt, aY as R, aZ as Zr, a_ as Le, a$ as oe, b0 as T, b1 as $e, b2 as at, b3 as Gt, b4 as Q, b5 as $r, b6 as oi, b7 as si, b8 as ui, b9 as li, ba as fi, bb as ci, bc as vi, bd as di, be as qr, bf as pi, bg as hi, bh as mi, bi as gi, bj as yi, bk as Jr, bl as Pt, bm as he, bn as X, bo as bi, bp as Qr, bq as z, br as tn, bs as me, bt as Z, bu as Pi, bv as Ot, bw as Vi, bx as Ti, by as en, bz as Ft, bA as O, bB as ge, bC as Si, bD as se, bE as xi, bF as Ci } from "./@vendor-DceGoESd.js";
|
2
2
|
import * as Y from "react";
|
3
3
|
import Re, { createContext as St, useContext as F, useLayoutEffect as Ai, useEffect as N, useState as De, useRef as $, useCallback as ye, useMemo as Vt, forwardRef as wi, createElement as Ei, cloneElement as Li, Children as Ri, isValidElement as Di } from "react";
|
4
4
|
var qe = "production", Me = typeof process > "u" || process.env === void 0 ? qe : process.env.NODE_ENV || qe, tt = function(t) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Te from "react";
|
2
|
-
import {
|
2
|
+
import { bG as he, bH as Ke, bI as we, bJ as cn, bK as Le, bL as Je, bM as tt, bN as at, bO as et, bP as lt, bQ as nt, bR as so, bS as fn, bT as uo, bU as bt, bV as ei, bW as hn, bX as co, bY as fo, bZ as ho, b_ as vn, b$ as Fe, c0 as pn, c1 as ti, c2 as wn, c3 as ai, c4 as ni, c5 as ri, c6 as Rt, c7 as oi, c8 as ii, c9 as li } from "./@vendor-DceGoESd.js";
|
3
3
|
import { r as Ne, h as si, g as di } from "./@moment-CGWt8tF2.js";
|
4
4
|
import './assets/@react-dates.css';var Wt = {}, jt = {}, zt = {}, Nn;
|
5
5
|
function Ve() {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ca as xt, cb as v, b_ as re, cc as h, c5 as f, cd as Y, ce as U, cf as xe, cg as Bt, ch as Ue, ci as Ft, cj as Vt, ck as Et, cl as yt, cm as Wt, cn as Xt, co as ne, cp as Zt } from "./@vendor-DceGoESd.js";
|
2
2
|
import * as y from "react";
|
3
3
|
import { useRef as j, useState as ee, useMemo as q, useCallback as D, createContext as Nt, useContext as St, Component as Rt, Fragment as Be, useEffect as Qe, forwardRef as Ht } from "react";
|
4
4
|
import { createPortal as Tt } from "react-dom";
|
@@ -2,7 +2,7 @@ var v = Object.defineProperty;
|
|
2
2
|
var E = (a, h, e) => h in a ? v(a, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[h] = e;
|
3
3
|
var f = (a, h, e) => E(a, typeof h != "symbol" ? h + "" : h, e);
|
4
4
|
import u, { createRef as k } from "react";
|
5
|
-
import {
|
5
|
+
import { cq as x } from "./@vendor-DceGoESd.js";
|
6
6
|
const b = () => typeof navigator < "u" && /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor) ? "-webkit-sticky" : "sticky";
|
7
7
|
var g;
|
8
8
|
(function(a) {
|
@@ -80441,7 +80441,7 @@ export {
|
|
80441
80441
|
UIe as Z,
|
80442
80442
|
V5 as _,
|
80443
80443
|
lpe as a,
|
80444
|
-
|
80444
|
+
aj as a$,
|
80445
80445
|
ap as a0,
|
80446
80446
|
zIe as a1,
|
80447
80447
|
Xc as a2,
|
@@ -80452,33 +80452,33 @@ export {
|
|
80452
80452
|
VIe as a7,
|
80453
80453
|
Gce as a8,
|
80454
80454
|
pFe as a9,
|
80455
|
-
|
80456
|
-
|
80457
|
-
|
80458
|
-
|
80459
|
-
|
80460
|
-
|
80461
|
-
|
80462
|
-
|
80463
|
-
|
80464
|
-
|
80465
|
-
|
80466
|
-
|
80467
|
-
|
80468
|
-
|
80469
|
-
|
80470
|
-
|
80471
|
-
|
80472
|
-
|
80473
|
-
|
80474
|
-
|
80475
|
-
|
80476
|
-
|
80477
|
-
|
80478
|
-
|
80479
|
-
|
80480
|
-
|
80481
|
-
|
80455
|
+
gb as aA,
|
80456
|
+
wMe as aB,
|
80457
|
+
BFe as aC,
|
80458
|
+
ju as aD,
|
80459
|
+
o$e as aE,
|
80460
|
+
i$e as aF,
|
80461
|
+
bOe as aG,
|
80462
|
+
r4e as aH,
|
80463
|
+
V9e as aI,
|
80464
|
+
UB as aJ,
|
80465
|
+
Ot as aK,
|
80466
|
+
ere as aL,
|
80467
|
+
kD as aM,
|
80468
|
+
pi as aN,
|
80469
|
+
N9e as aO,
|
80470
|
+
I9e as aP,
|
80471
|
+
VFe as aQ,
|
80472
|
+
yee as aR,
|
80473
|
+
mee as aS,
|
80474
|
+
L9e as aT,
|
80475
|
+
B9e as aU,
|
80476
|
+
Ut as aV,
|
80477
|
+
aR as aW,
|
80478
|
+
zd as aX,
|
80479
|
+
U9e as aY,
|
80480
|
+
H9e as aZ,
|
80481
|
+
Rb as a_,
|
80482
80482
|
mFe as aa,
|
80483
80483
|
gFe as ab,
|
80484
80484
|
yFe as ac,
|
@@ -80492,112 +80492,113 @@ export {
|
|
80492
80492
|
Qx as ak,
|
80493
80493
|
ag as al,
|
80494
80494
|
dg as am,
|
80495
|
-
|
80496
|
-
|
80497
|
-
|
80498
|
-
|
80499
|
-
|
80500
|
-
|
80501
|
-
|
80502
|
-
|
80503
|
-
|
80504
|
-
|
80505
|
-
|
80506
|
-
|
80507
|
-
|
80495
|
+
ub as an,
|
80496
|
+
_Fe as ao,
|
80497
|
+
CFe as ap,
|
80498
|
+
wFe as aq,
|
80499
|
+
xFe as ar,
|
80500
|
+
LY as as,
|
80501
|
+
uf as at,
|
80502
|
+
ko as au,
|
80503
|
+
j9e as av,
|
80504
|
+
LFe as aw,
|
80505
|
+
jFe as ax,
|
80506
|
+
vb as ay,
|
80507
|
+
Ve as az,
|
80508
80508
|
He as b,
|
80509
|
-
|
80510
|
-
|
80511
|
-
|
80512
|
-
|
80513
|
-
|
80514
|
-
|
80515
|
-
|
80516
|
-
|
80517
|
-
|
80518
|
-
|
80519
|
-
|
80520
|
-
|
80521
|
-
|
80522
|
-
|
80523
|
-
|
80524
|
-
|
80525
|
-
|
80526
|
-
|
80527
|
-
|
80528
|
-
|
80529
|
-
|
80530
|
-
|
80531
|
-
|
80532
|
-
|
80533
|
-
|
80534
|
-
|
80535
|
-
|
80536
|
-
|
80537
|
-
|
80538
|
-
|
80539
|
-
|
80540
|
-
|
80541
|
-
|
80542
|
-
|
80543
|
-
|
80544
|
-
|
80545
|
-
|
80546
|
-
|
80547
|
-
|
80548
|
-
|
80549
|
-
|
80550
|
-
|
80551
|
-
|
80552
|
-
|
80553
|
-
|
80554
|
-
|
80555
|
-
|
80556
|
-
|
80557
|
-
|
80558
|
-
|
80559
|
-
|
80560
|
-
|
80561
|
-
|
80562
|
-
|
80563
|
-
|
80564
|
-
|
80565
|
-
|
80566
|
-
|
80567
|
-
|
80568
|
-
|
80569
|
-
|
80570
|
-
|
80571
|
-
|
80572
|
-
|
80509
|
+
Mn as b$,
|
80510
|
+
X9e as b0,
|
80511
|
+
J9e as b1,
|
80512
|
+
Q9e as b2,
|
80513
|
+
Y9e as b3,
|
80514
|
+
oj as b4,
|
80515
|
+
gj as b5,
|
80516
|
+
fIe as b6,
|
80517
|
+
PE as b7,
|
80518
|
+
aIe as b8,
|
80519
|
+
sIe as b9,
|
80520
|
+
FD as bA,
|
80521
|
+
pj as bB,
|
80522
|
+
OE as bC,
|
80523
|
+
uIe as bD,
|
80524
|
+
W9e as bE,
|
80525
|
+
xj as bF,
|
80526
|
+
Cv as bG,
|
80527
|
+
JOe as bH,
|
80528
|
+
Nn as bI,
|
80529
|
+
EFe as bJ,
|
80530
|
+
MQ as bK,
|
80531
|
+
GOe as bL,
|
80532
|
+
YOe as bM,
|
80533
|
+
SFe as bN,
|
80534
|
+
XOe as bO,
|
80535
|
+
nDe as bP,
|
80536
|
+
yAe as bQ,
|
80537
|
+
xAe as bR,
|
80538
|
+
TAe as bS,
|
80539
|
+
AFe as bT,
|
80540
|
+
OFe as bU,
|
80541
|
+
iAe as bV,
|
80542
|
+
DFe as bW,
|
80543
|
+
PFe as bX,
|
80544
|
+
LQ as bY,
|
80545
|
+
kFe as bZ,
|
80546
|
+
noe as b_,
|
80547
|
+
oIe as ba,
|
80548
|
+
rIe as bb,
|
80549
|
+
iIe as bc,
|
80550
|
+
Sj as bd,
|
80551
|
+
bie as be,
|
80552
|
+
nIe as bf,
|
80553
|
+
yie as bg,
|
80554
|
+
tIe as bh,
|
80555
|
+
gie as bi,
|
80556
|
+
Cj as bj,
|
80557
|
+
mie as bk,
|
80558
|
+
MD as bl,
|
80559
|
+
eIe as bm,
|
80560
|
+
$b as bn,
|
80561
|
+
lIe as bo,
|
80562
|
+
Lie as bp,
|
80563
|
+
G9e as bq,
|
80564
|
+
RD as br,
|
80565
|
+
Mie as bs,
|
80566
|
+
Pie as bt,
|
80567
|
+
Bie as bu,
|
80568
|
+
dd as bv,
|
80569
|
+
Z9e as bw,
|
80570
|
+
K9e as bx,
|
80571
|
+
cIe as by,
|
80572
|
+
Tie as bz,
|
80573
80573
|
mV as c,
|
80574
|
-
|
80575
|
-
|
80576
|
-
|
80577
|
-
|
80578
|
-
|
80579
|
-
|
80580
|
-
|
80581
|
-
|
80582
|
-
|
80583
|
-
|
80584
|
-
|
80585
|
-
|
80586
|
-
|
80587
|
-
|
80588
|
-
|
80589
|
-
|
80590
|
-
|
80591
|
-
|
80592
|
-
|
80593
|
-
|
80594
|
-
|
80595
|
-
|
80596
|
-
|
80597
|
-
|
80598
|
-
|
80599
|
-
|
80600
|
-
|
80574
|
+
MFe as c0,
|
80575
|
+
c3e as c1,
|
80576
|
+
TFe as c2,
|
80577
|
+
roe as c3,
|
80578
|
+
IFe as c4,
|
80579
|
+
yc as c5,
|
80580
|
+
$Fe as c6,
|
80581
|
+
RFe as c7,
|
80582
|
+
mAe as c8,
|
80583
|
+
FFe as c9,
|
80584
|
+
bc as ca,
|
80585
|
+
hIe as cb,
|
80586
|
+
vIe as cc,
|
80587
|
+
_Ie as cd,
|
80588
|
+
wIe as ce,
|
80589
|
+
EIe as cf,
|
80590
|
+
SIe as cg,
|
80591
|
+
ise as ch,
|
80592
|
+
xIe as ci,
|
80593
|
+
CIe as cj,
|
80594
|
+
gIe as ck,
|
80595
|
+
yIe as cl,
|
80596
|
+
mIe as cm,
|
80597
|
+
pIe as cn,
|
80598
|
+
bIe as co,
|
80599
|
+
kIe as cp,
|
80600
|
+
oZ as cq,
|
80601
|
+
gD as cr,
|
80601
80602
|
KIe as d,
|
80602
80603
|
ZIe as e,
|
80603
80604
|
QIe as f,
|
package/dist/Common/Types.d.ts
CHANGED
@@ -944,6 +944,17 @@ export type EnvironmentsGroupedByClustersType = {
|
|
944
944
|
clusterName: EnvironmentType['cluster'];
|
945
945
|
envList: EnvironmentType[];
|
946
946
|
}[];
|
947
|
+
export type ClusterCostModuleConfigPayload = {
|
948
|
+
enabled: true;
|
949
|
+
config?: Record<string, any>;
|
950
|
+
} | {
|
951
|
+
enabled: false;
|
952
|
+
config?: never;
|
953
|
+
};
|
954
|
+
interface ClusterCostModuleDetailsDTO extends Pick<ClusterCostModuleConfigPayload, 'enabled' | 'config'> {
|
955
|
+
installationStatus: 'Success' | 'Installing' | 'Upgrading' | 'NotInstalled' | 'Failed';
|
956
|
+
installationError?: string;
|
957
|
+
}
|
947
958
|
export interface ClusterDetailDTO {
|
948
959
|
category: ClusterEnvironmentCategoryType;
|
949
960
|
cluster_name: string;
|
@@ -959,6 +970,7 @@ export interface ClusterDetailDTO {
|
|
959
970
|
proxyUrl: string;
|
960
971
|
toConnectWithSSHTunnel: boolean;
|
961
972
|
clusterStatus: ClusterStatusType;
|
973
|
+
costModuleConfig: ClusterCostModuleDetailsDTO;
|
962
974
|
}
|
963
975
|
export interface ClusterDetailListType extends Omit<ClusterDetailDTO, 'server_url' | 'cluster_name' | 'prometheus_url' | 'id' | 'category' | 'clusterStatus'> {
|
964
976
|
serverUrl: ClusterDetailDTO['server_url'];
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { IconName } from '../../../Shared/Components';
|
2
|
+
import { ClusterProviderType } from './types';
|
3
|
+
export declare const CLUSTER_PROVIDER_TO_ICON_NAME: Record<ClusterProviderType, IconName | null>;
|
4
|
+
export declare const CLUSTER_PROVIDER_TO_LABEL: Record<ClusterProviderType, string>;
|
@@ -1,3 +1,6 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { RJSFFormSchema } from '../../../Common/RJSF';
|
3
|
+
import { ClusterDetailListType } from '../../../Common/Types';
|
1
4
|
export declare enum CostBreakdownViewType {
|
2
5
|
CLUSTERS = "clusters",
|
3
6
|
ENVIRONMENTS = "environments",
|
@@ -9,3 +12,20 @@ export declare enum CostBreakdownItemViewParamsType {
|
|
9
12
|
VIEW = "view",
|
10
13
|
DETAIL = "detail"
|
11
14
|
}
|
15
|
+
type RenderClusterFormParamsType = {
|
16
|
+
clusterDetails: ClusterDetailListType;
|
17
|
+
handleClose: () => void;
|
18
|
+
handleSuccess: () => void;
|
19
|
+
};
|
20
|
+
export interface CostVisibilityRenderContextType {
|
21
|
+
renderClusterForm: (params: RenderClusterFormParamsType) => JSX.Element;
|
22
|
+
}
|
23
|
+
export interface CostVisibilityRenderProviderProps extends CostVisibilityRenderContextType {
|
24
|
+
children: ReactNode;
|
25
|
+
}
|
26
|
+
export type ClusterProviderType = 'AWS' | 'GCP' | 'Azure' | 'Alibaba' | 'Scaleway' | 'Oracle' | 'OTC' | 'DigitalOcean' | 'Unknown';
|
27
|
+
export interface ClusterProviderDetailsType {
|
28
|
+
clusterProvider: ClusterProviderType;
|
29
|
+
costModuleSchema: RJSFFormSchema;
|
30
|
+
}
|
31
|
+
export {};
|
@@ -1,16 +1,8 @@
|
|
1
1
|
import { AppThemeType } from '../../Providers';
|
2
2
|
import { ChartColorKey } from './types';
|
3
|
-
export declare const LEGENDS_LABEL_CONFIG: {
|
4
|
-
readonly usePointStyle: true;
|
5
|
-
readonly pointStyle: "rectRounded";
|
6
|
-
readonly pointStyleWidth: 0;
|
7
|
-
readonly font: {
|
8
|
-
readonly family: "'IBM Plex Sans', 'Open Sans', 'Roboto'";
|
9
|
-
readonly size: 13;
|
10
|
-
readonly lineHeight: "150%";
|
11
|
-
readonly weight: 400;
|
12
|
-
};
|
13
|
-
};
|
14
3
|
export declare const CHART_COLORS: Record<AppThemeType, Record<ChartColorKey, string>>;
|
15
4
|
export declare const CHART_GRID_LINES_COLORS: Record<AppThemeType, string>;
|
5
|
+
export declare const CHART_AXIS_COLORS: Record<AppThemeType, string>;
|
6
|
+
export declare const CHART_AXIS_LABELS_COLOR: Record<AppThemeType, string>;
|
16
7
|
export declare const CHART_CANVAS_BACKGROUND_COLORS: Record<AppThemeType, string>;
|
8
|
+
export declare const LINE_DASH: number[];
|
@@ -1,4 +1,4 @@
|
|
1
1
|
export { default as Chart } from './Chart.component';
|
2
2
|
export { CHART_COLORS } from './constants';
|
3
|
-
export type { ChartColorKey, ChartProps, ChartType, SimpleDataset, SimpleDatasetForPie } from './types';
|
3
|
+
export type { ChartColorKey, ChartProps, ChartType, ReferenceLineConfigType, SimpleDataset, SimpleDatasetForPie, } from './types';
|
4
4
|
export { chartColorGenerator } from './utils';
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Plugin } from 'chart.js';
|
2
2
|
import { AppThemeType } from '../../Providers';
|
3
|
-
import {
|
4
|
-
export declare const
|
5
|
-
export declare const getSeparatorLinePlugin: (separatorIndex: number, chartType: ChartType, appTheme: AppThemeType) => Plugin;
|
3
|
+
import { ReferenceLineConfigType } from './types';
|
4
|
+
export declare const drawReferenceLine: (config: ReferenceLineConfigType, id: string, appTheme: AppThemeType) => Plugin;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
|
-
import {
|
2
|
+
import { TooltipOptions, TooltipPositionerFunction } from 'chart.js';
|
3
3
|
import { TooltipProps } from '../../../Common/Tooltip';
|
4
4
|
import { AppThemeType } from '../../Providers';
|
5
5
|
import { Never } from '../../types';
|
@@ -13,41 +13,49 @@ interface BaseSimpleDataset {
|
|
13
13
|
yAxisValues: number[];
|
14
14
|
}
|
15
15
|
export interface SimpleDataset extends BaseSimpleDataset {
|
16
|
-
|
16
|
+
color: ChartColorKey;
|
17
|
+
isClickable?: boolean;
|
18
|
+
}
|
19
|
+
export interface SimpleDatasetForLineAndArea extends Omit<SimpleDataset, 'isClickable'> {
|
20
|
+
isDashed?: boolean;
|
17
21
|
}
|
18
22
|
export interface SimpleDatasetForPie extends BaseSimpleDataset {
|
19
|
-
|
23
|
+
colors: Array<ChartColorKey>;
|
24
|
+
isClickable?: boolean[];
|
20
25
|
}
|
21
|
-
export interface
|
22
|
-
|
26
|
+
export interface ReferenceLineConfigType {
|
27
|
+
strokeWidth?: number;
|
28
|
+
color?: ChartColorKey;
|
29
|
+
value: number;
|
23
30
|
}
|
24
31
|
type XYAxisMax = {
|
25
32
|
xAxisMax?: number;
|
26
33
|
yAxisMax?: number;
|
34
|
+
/**
|
35
|
+
* Optional reference lines to draw across the chart
|
36
|
+
*/
|
37
|
+
referenceLines?: ReferenceLineConfigType[];
|
27
38
|
};
|
28
|
-
type
|
39
|
+
type OnChartClickHandler = (datasetName: string, value: number) => void;
|
40
|
+
export type TypeAndDatasetsType = ({
|
29
41
|
type: 'pie';
|
30
42
|
/**
|
31
43
|
* Needs to be memoized
|
32
44
|
*/
|
33
45
|
datasets: SimpleDatasetForPie;
|
34
|
-
|
35
|
-
averageLineValue?: never;
|
46
|
+
onChartClick?: OnChartClickHandler;
|
36
47
|
} & Never<XYAxisMax>) | ({
|
37
48
|
type: 'line';
|
38
|
-
datasets:
|
39
|
-
|
40
|
-
averageLineValue?: number;
|
49
|
+
datasets: SimpleDatasetForLineAndArea[];
|
50
|
+
onChartClick?: never;
|
41
51
|
} & XYAxisMax) | ({
|
42
52
|
type: 'area';
|
43
|
-
datasets:
|
44
|
-
|
45
|
-
averageLineValue?: number;
|
53
|
+
datasets: SimpleDatasetForLineAndArea;
|
54
|
+
onChartClick?: never;
|
46
55
|
} & XYAxisMax) | ({
|
47
56
|
type: Exclude<ChartType, 'pie' | 'line' | 'area'>;
|
48
57
|
datasets: SimpleDataset[];
|
49
|
-
|
50
|
-
averageLineValue?: never;
|
58
|
+
onChartClick?: OnChartClickHandler;
|
51
59
|
} & XYAxisMax);
|
52
60
|
export type ChartProps = {
|
53
61
|
id: string;
|
@@ -60,10 +68,7 @@ export type ChartProps = {
|
|
60
68
|
* @default false
|
61
69
|
*/
|
62
70
|
hideAxis?: boolean;
|
63
|
-
|
64
|
-
* Callback function for chart click events
|
65
|
-
*/
|
66
|
-
onChartClick?: ChartOptions['onClick'];
|
71
|
+
hideXAxisLabels?: boolean;
|
67
72
|
tooltipConfig?: {
|
68
73
|
getTooltipContent?: (args: Parameters<TooltipOptions['external']>[0]) => ReactNode;
|
69
74
|
/**
|
@@ -71,6 +76,10 @@ export type ChartProps = {
|
|
71
76
|
*/
|
72
77
|
placement?: TooltipProps['placement'];
|
73
78
|
};
|
79
|
+
/** A title for x axis */
|
80
|
+
xScaleTitle?: string;
|
81
|
+
/** A title for y axis */
|
82
|
+
yScaleTitle?: string;
|
74
83
|
} & TypeAndDatasetsType;
|
75
84
|
export type TransformDatasetProps = {
|
76
85
|
appTheme: AppThemeType;
|
@@ -78,18 +87,24 @@ export type TransformDatasetProps = {
|
|
78
87
|
type: 'pie';
|
79
88
|
dataset: SimpleDatasetForPie;
|
80
89
|
} | {
|
81
|
-
type: 'line';
|
82
|
-
dataset:
|
90
|
+
type: 'line' | 'area';
|
91
|
+
dataset: SimpleDatasetForLineAndArea;
|
83
92
|
} | {
|
84
|
-
type: Exclude<ChartType, 'pie' | 'line'>;
|
93
|
+
type: Exclude<ChartType, 'pie' | 'line' | 'area'>;
|
85
94
|
dataset: SimpleDataset;
|
86
95
|
});
|
87
96
|
export type GetBackgroundAndBorderColorProps = TransformDatasetProps;
|
88
97
|
export type TransformDataForChartProps = {
|
89
98
|
appTheme: AppThemeType;
|
90
99
|
} & TypeAndDatasetsType;
|
91
|
-
export interface GetDefaultOptionsParams
|
100
|
+
export interface GetDefaultOptionsParams {
|
101
|
+
chartProps: ChartProps;
|
92
102
|
appTheme: AppThemeType;
|
93
103
|
externalTooltipHandler: TooltipOptions['external'];
|
94
104
|
}
|
105
|
+
declare module 'chart.js' {
|
106
|
+
interface TooltipPositionerMap {
|
107
|
+
barElementCenterPositioner: TooltipPositionerFunction<'bar'>;
|
108
|
+
}
|
109
|
+
}
|
95
110
|
export {};
|