@quillsql/react 2.10.5 → 2.10.7

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.
Files changed (84) hide show
  1. package/dist/cjs/Chart.d.ts +2 -2
  2. package/dist/cjs/Chart.d.ts.map +1 -1
  3. package/dist/cjs/Chart.js +11 -16
  4. package/dist/cjs/Context.d.ts +22 -39
  5. package/dist/cjs/Context.d.ts.map +1 -1
  6. package/dist/cjs/Context.js +11 -9
  7. package/dist/cjs/Dashboard.d.ts +117 -28
  8. package/dist/cjs/Dashboard.d.ts.map +1 -1
  9. package/dist/cjs/Dashboard.js +84 -411
  10. package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts +18 -1
  11. package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
  12. package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +8 -8
  13. package/dist/cjs/Table.d.ts.map +1 -1
  14. package/dist/cjs/Table.js +11 -1
  15. package/dist/cjs/components/Chart/BarChart.d.ts +2 -2
  16. package/dist/cjs/components/Chart/BarChart.js +2 -2
  17. package/dist/cjs/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
  18. package/dist/cjs/components/Chart/ChartTooltipFrame.js +1 -0
  19. package/dist/cjs/components/Chart/LineChart.d.ts +2 -2
  20. package/dist/cjs/components/Chart/LineChart.js +2 -2
  21. package/dist/cjs/components/Dashboard/DashboardGroup.d.ts +3 -0
  22. package/dist/cjs/components/Dashboard/DashboardGroup.d.ts.map +1 -0
  23. package/dist/cjs/components/Dashboard/DashboardGroup.js +16 -0
  24. package/dist/cjs/components/Dashboard/DashboardItem.d.ts +3 -0
  25. package/dist/cjs/components/Dashboard/DashboardItem.d.ts.map +1 -0
  26. package/dist/cjs/components/Dashboard/DashboardItem.js +64 -0
  27. package/dist/cjs/components/Dashboard/DashboardSection.d.ts +3 -0
  28. package/dist/cjs/components/Dashboard/DashboardSection.d.ts.map +1 -0
  29. package/dist/cjs/components/Dashboard/DashboardSection.js +7 -0
  30. package/dist/cjs/index.d.ts +1 -1
  31. package/dist/cjs/index.d.ts.map +1 -1
  32. package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +1 -1
  33. package/dist/cjs/internals/ReportBuilder/PivotModal.js +1 -1
  34. package/dist/cjs/utils/dashboard.d.ts +12 -0
  35. package/dist/cjs/utils/dashboard.d.ts.map +1 -0
  36. package/dist/cjs/utils/dashboard.js +150 -0
  37. package/dist/cjs/utils/styles.d.ts +17 -0
  38. package/dist/cjs/utils/styles.d.ts.map +1 -0
  39. package/dist/cjs/utils/styles.js +20 -0
  40. package/dist/cjs/utils/valueFormatter.d.ts +1 -1
  41. package/dist/cjs/utils/valueFormatter.d.ts.map +1 -1
  42. package/dist/esm/Chart.d.ts +2 -2
  43. package/dist/esm/Chart.d.ts.map +1 -1
  44. package/dist/esm/Chart.js +11 -16
  45. package/dist/esm/Context.d.ts +22 -39
  46. package/dist/esm/Context.d.ts.map +1 -1
  47. package/dist/esm/Context.js +11 -9
  48. package/dist/esm/Dashboard.d.ts +117 -28
  49. package/dist/esm/Dashboard.d.ts.map +1 -1
  50. package/dist/esm/Dashboard.js +80 -384
  51. package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts +18 -1
  52. package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
  53. package/dist/esm/DateRangePicker/dateRangePickerUtils.js +8 -8
  54. package/dist/esm/Table.d.ts.map +1 -1
  55. package/dist/esm/Table.js +11 -1
  56. package/dist/esm/components/Chart/BarChart.d.ts +2 -2
  57. package/dist/esm/components/Chart/BarChart.js +2 -2
  58. package/dist/esm/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
  59. package/dist/esm/components/Chart/ChartTooltipFrame.js +1 -0
  60. package/dist/esm/components/Chart/LineChart.d.ts +2 -2
  61. package/dist/esm/components/Chart/LineChart.js +2 -2
  62. package/dist/esm/components/Dashboard/DashboardGroup.d.ts +3 -0
  63. package/dist/esm/components/Dashboard/DashboardGroup.d.ts.map +1 -0
  64. package/dist/esm/components/Dashboard/DashboardGroup.js +13 -0
  65. package/dist/esm/components/Dashboard/DashboardItem.d.ts +3 -0
  66. package/dist/esm/components/Dashboard/DashboardItem.d.ts.map +1 -0
  67. package/dist/esm/components/Dashboard/DashboardItem.js +61 -0
  68. package/dist/esm/components/Dashboard/DashboardSection.d.ts +3 -0
  69. package/dist/esm/components/Dashboard/DashboardSection.d.ts.map +1 -0
  70. package/dist/esm/components/Dashboard/DashboardSection.js +4 -0
  71. package/dist/esm/index.d.ts +1 -1
  72. package/dist/esm/index.d.ts.map +1 -1
  73. package/dist/esm/index.js +1 -1
  74. package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +1 -1
  75. package/dist/esm/internals/ReportBuilder/PivotModal.js +1 -1
  76. package/dist/esm/utils/dashboard.d.ts +12 -0
  77. package/dist/esm/utils/dashboard.d.ts.map +1 -0
  78. package/dist/esm/utils/dashboard.js +146 -0
  79. package/dist/esm/utils/styles.d.ts +17 -0
  80. package/dist/esm/utils/styles.d.ts.map +1 -0
  81. package/dist/esm/utils/styles.js +16 -0
  82. package/dist/esm/utils/valueFormatter.d.ts +1 -1
  83. package/dist/esm/utils/valueFormatter.d.ts.map +1 -1
  84. package/package.json +2 -5
@@ -31,8 +31,25 @@ export declare const PRIMARY_CODES: {
31
31
  * comparison range) and returns a QuillDateRange based on that key and date.
32
32
  */
33
33
  export declare const COMPARISON_RANGE: {
34
- [key: string]: (range: QuillDateRange) => QuillDateRange | null;
34
+ readonly PREV_PERIOD: ({ start, end }: QuillDateRange) => {
35
+ start: Date;
36
+ end: Date;
37
+ };
38
+ readonly PREV_7_DAYS: ({ start }: QuillDateRange) => {
39
+ start: Date;
40
+ end: Date;
41
+ };
42
+ readonly PREV_30_DAYS: ({ start }: QuillDateRange) => {
43
+ start: Date;
44
+ end: Date;
45
+ };
46
+ readonly PREV_90_DAYS: ({ start }: QuillDateRange) => {
47
+ start: Date;
48
+ end: Date;
49
+ };
50
+ readonly NO_COMPARISON: (_: any) => null;
35
51
  };
52
+ export type ComparisonRangeKey = keyof typeof COMPARISON_RANGE;
36
53
  export declare const defaultOptions: DateRangePickerOption[];
37
54
  export declare const reportBuilderOptions: DateRangePickerOption[];
38
55
  export declare const getRangeFromPreset: (preset: string) => (string | Date | null)[];
@@ -1 +1 @@
1
- {"version":3,"file":"dateRangePickerUtils.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/dateRangePickerUtils.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,eAAO,MAAM,WAAW,WAAY,MAAM,aAKzC,CAAC;AAEF,eAAO,MAAM,UAAU,MAAO,MAAM,UAAU,MAAM,WAEnD,CAAC;AAEF,eAAO,MAAM,2BAA2B,kBACvB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,gBAU1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,kBACrB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,SAU1C,CAAC;AAEF,eAAO,MAAM,cAAc,cACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACzB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBAWzC,CAAC;AAEF,eAAO,MAAM,YAAY,YACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACvB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBASzC,CAAC;AAEF;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAA;CASjE,CA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AAI,kBACb,IAAI,GAAG,IAAI,uBA0C5B,CAAC;AAyHF,eAAO,MAAM,mBAAmB,cACnB,IAAI,GAAG,IAAI,WACb,IAAI,GAAG,IAAI,WACX,MAAM,WAyChB,CAAC;;AAEF,yEAAyE"}
@@ -67,14 +67,14 @@ exports.PRIMARY_RANGE = {
67
67
  * Maps between the keys of primary range and the short code.
68
68
  */
69
69
  exports.PRIMARY_CODES = {
70
- THIS_WEEK: "wk",
71
- THIS_MONTH: "m",
72
- THIS_YEAR: "y",
73
- LAST_7_DAYS: "w",
74
- LAST_30_DAYS: "t",
75
- LAST_90_DAYS: "90d",
76
- LAST_6_MONTHS: "6m",
77
- ALL_TIME: "at",
70
+ THIS_WEEK: 'wk',
71
+ THIS_MONTH: 'm',
72
+ THIS_YEAR: 'y',
73
+ LAST_7_DAYS: 'w',
74
+ LAST_30_DAYS: 't',
75
+ LAST_90_DAYS: '90d',
76
+ LAST_6_MONTHS: '6m',
77
+ ALL_TIME: 'at',
78
78
  };
79
79
  /**
80
80
  * A helpful map between comparison range keys and a function that takes the
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAcxE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBA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,EAAE,OAAO,CAAC;CACxB,kDAomBA;AA2UD,eAAe,KAAK,CAAC"}
package/dist/cjs/Table.js CHANGED
@@ -50,6 +50,16 @@ const Table = ({ chartId, columns, rows, containerStyle, csvFilename, showDownlo
50
50
  const compareValues = (a, b, column) => {
51
51
  const valueA = a[column];
52
52
  const valueB = b[column];
53
+ // Null checks
54
+ if (valueA === null && valueB === null) {
55
+ return 0; // Both values are null, consider them equal
56
+ }
57
+ else if (valueA === null) {
58
+ return -1; // ValueA is null, consider it smaller
59
+ }
60
+ else if (valueB === null) {
61
+ return 1; // ValueB is null, consider it smaller
62
+ }
53
63
  // For numbers
54
64
  if (!isNaN(valueA) && !isNaN(valueB)) {
55
65
  return valueA - valueB;
@@ -448,7 +458,7 @@ const ChartUpdater = ({ chartId, containerStyle, dashboard, dispatch, client, da
448
458
  filters: [...Object.values(dashboardFilters)],
449
459
  };
450
460
  const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'omit', hostedBody, cloudBody);
451
- if (resp && resp.name !== "error") {
461
+ if (resp && resp.name !== 'error') {
452
462
  if (resp.compareRows) {
453
463
  (0, merge_1.mergeComparisonRange)(resp);
454
464
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export default function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive, hideXAxis, hideYAxis, hideCartesionGrid, }: {
2
+ export default function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, }: {
3
3
  colors: string[];
4
4
  yAxisFields: any[];
5
5
  data: any[];
@@ -13,6 +13,6 @@ export default function BarChart({ colors, yAxisFields, data, containerStyle, xA
13
13
  isAnimationActive: boolean;
14
14
  hideXAxis: boolean;
15
15
  hideYAxis: boolean;
16
- hideCartesionGrid: boolean;
16
+ hideCartesianGrid: boolean;
17
17
  }): import("react/jsx-runtime").JSX.Element;
18
18
  //# sourceMappingURL=BarChart.d.ts.map
@@ -11,7 +11,7 @@ const axisFormatter_1 = require("../../utils/axisFormatter");
11
11
  const color_1 = require("../../utils/color");
12
12
  const ChartTooltip_1 = __importDefault(require("../../components/Chart/ChartTooltip"));
13
13
  const getDomain_1 = __importDefault(require("../../utils/getDomain"));
14
- function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesionGrid = false, }) {
14
+ function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, }) {
15
15
  if (!data || data.length === 0) {
16
16
  return ((0, jsx_runtime_1.jsx)("div", { style: {
17
17
  display: 'flex',
@@ -27,7 +27,7 @@ function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxis
27
27
  return ((0, jsx_runtime_1.jsx)("div", { style: {
28
28
  ...containerStyle,
29
29
  boxSizing: 'content-box',
30
- }, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: '100%', children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { data: data, layout: 'horizontal', children: [!hideCartesionGrid && ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { width: 44, hide: hideYAxis, axisLine: false, tickLine: false, type: "number", domain: (0, getDomain_1.default)(data, yAxisFields), tick: { transform: 'translate(-3, 0)' }, style: {
30
+ }, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: '100%', children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { data: data, layout: 'horizontal', children: [!hideCartesianGrid && ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { width: 44, hide: hideYAxis, axisLine: false, tickLine: false, type: "number", domain: (0, getDomain_1.default)(data, yAxisFields), tick: { transform: 'translate(-3, 0)' }, style: {
31
31
  fontSize: '12px',
32
32
  fontFamily: theme.chartLabelFontFamily,
33
33
  }, tickFormatter: (tick) => (0, axisFormatter_1.axisFormatter)({
@@ -1 +1 @@
1
- {"version":3,"file":"ChartTooltipFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/ChartTooltipFrame.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;CACZ,2CAiBA"}
1
+ {"version":3,"file":"ChartTooltipFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/ChartTooltipFrame.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;CACZ,2CAkBA"}
@@ -9,6 +9,7 @@ function ChartTooltipFrame({ children, theme, }) {
9
9
  borderWidth: 1,
10
10
  background: theme?.backgroundColor || '#ffffff',
11
11
  borderRadius: '6px',
12
+ zIndex: 40,
12
13
  boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
13
14
  }, children: children }));
14
15
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export default function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive, hideXAxis, hideYAxis, hideCartesionGrid, }: {
2
+ export default function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, }: {
3
3
  colors: string[];
4
4
  yAxisFields: any[];
5
5
  data: any[];
@@ -11,6 +11,6 @@ export default function LineChart({ colors, yAxisFields, data, containerStyle, x
11
11
  isAnimationActive: boolean;
12
12
  hideXAxis: boolean;
13
13
  hideYAxis: boolean;
14
- hideCartesionGrid: boolean;
14
+ hideCartesianGrid: boolean;
15
15
  }): import("react/jsx-runtime").JSX.Element | null;
16
16
  //# sourceMappingURL=LineChart.d.ts.map
@@ -11,7 +11,7 @@ const axisFormatter_1 = require("../../utils/axisFormatter");
11
11
  const color_1 = require("../../utils/color");
12
12
  const ChartTooltip_1 = __importDefault(require("../../components/Chart/ChartTooltip"));
13
13
  const getDomain_1 = __importDefault(require("../../utils/getDomain"));
14
- function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesionGrid = false, }) {
14
+ function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, }) {
15
15
  if (!yAxisFields || !yAxisFields.length) {
16
16
  return null;
17
17
  }
@@ -27,7 +27,7 @@ function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxi
27
27
  color: theme.secondaryTextColor,
28
28
  }, children: "No results found for specified time period." }));
29
29
  }
30
- return ((0, jsx_runtime_1.jsx)("div", { style: { ...containerStyle, boxSizing: 'content-box' }, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: '100%', children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, { data: data, children: [!hideCartesionGrid && ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: xAxisField, hide: hideXAxis, tick: { transform: 'translate(0, 6)' }, style: {
30
+ return ((0, jsx_runtime_1.jsx)("div", { style: { ...containerStyle }, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: '100%', children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, { data: data, children: [!hideCartesianGrid && ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: xAxisField, hide: hideXAxis, tick: { transform: 'translate(0, 6)' }, style: {
31
31
  fontSize: '12px',
32
32
  fontFamily: theme?.chartLabelFontFamily ||
33
33
  theme?.fontFamily ||
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export default function DashboardGroup({ children }: any): JSX.Element;
3
+ //# sourceMappingURL=DashboardGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardGroup.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAiBrE"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ function DashboardGroup({ children }) {
5
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
6
+ boxSizing: 'content-box',
7
+ width: `100%`,
8
+ listStyleType: 'none',
9
+ marginBottom: 50,
10
+ display: 'grid',
11
+ gridGap: 25,
12
+ gridTemplateColumns: `repeat(auto-fill,minmax(400px, 1fr))`,
13
+ gridTemplateRows: `repeat(${170}px)`,
14
+ }, children: children }));
15
+ }
16
+ exports.default = DashboardGroup;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export default function DashboardItem({ dashboardItem, onClickDashboardItem, children, }: any): JSX.Element;
3
+ //# sourceMappingURL=DashboardItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardItem.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardItem.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,aAAa,EACb,oBAA+B,EAC/B,QAAQ,GACT,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAkGnB"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const Context_1 = require("../../Context");
6
+ function DashboardItem({ dashboardItem, onClickDashboardItem = () => { }, children, }) {
7
+ const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
8
+ return ((0, jsx_runtime_1.jsx)("div", { onClick: () => onClickDashboardItem(dashboardItem), style: {
9
+ height: '100%',
10
+ cursor: 'pointer',
11
+ boxSizing: 'content-box',
12
+ paddingRight: 25,
13
+ minHeight: 400,
14
+ borderRadius: 8,
15
+ paddingTop: 20,
16
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
17
+ width: '100%',
18
+ height: '100%',
19
+ boxSizing: 'content-box',
20
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
21
+ width: '100%',
22
+ height: '100%',
23
+ boxSizing: 'content-box',
24
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ justifyContent: 'space-between',
28
+ height: '100%',
29
+ boxSizing: 'content-box',
30
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
31
+ display: 'flex',
32
+ flexDirection: 'row',
33
+ justifyContent: 'space-between',
34
+ boxSizing: 'content-box',
35
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
36
+ fontFamily: theme.fontFamily,
37
+ color: theme.primaryTextColor,
38
+ boxSizing: 'content-box',
39
+ fontSize: 18,
40
+ fontWeight: '500',
41
+ textOverflow: 'ellipsis',
42
+ // marginLeft: 25,
43
+ padding: 0,
44
+ whiteSpace: 'nowrap',
45
+ display: 'block',
46
+ maxWidth: '100%',
47
+ overflow: 'hidden',
48
+ }, children: dashboardItem?.name }), onClickDashboardItem ? ((0, jsx_runtime_1.jsx)("div", { style: {
49
+ fontFamily: theme.fontFamily,
50
+ color: theme.primaryTextColor,
51
+ boxSizing: 'content-box',
52
+ fontWeight: '500',
53
+ fontSize: 14,
54
+ minWidth: 14 * 7,
55
+ display: 'flex',
56
+ alignItems: 'center',
57
+ justifyContent: 'flex-end',
58
+ }, children: 'view report →' })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: {
59
+ padding: 0,
60
+ height: '100%',
61
+ boxSizing: 'content-box',
62
+ }, children: children })] }) }) }) }, dashboardItem?.name));
63
+ }
64
+ exports.default = DashboardItem;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export default function DashboardSection({ children }: any): JSX.Element;
3
+ //# sourceMappingURL=DashboardSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DashboardSection.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardSection.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAMvE"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ function DashboardSection({ children }) {
5
+ return ((0, jsx_runtime_1.jsx)("div", { style: { width: '100%' }, children: children }));
6
+ }
7
+ exports.default = DashboardSection;
@@ -1,4 +1,4 @@
1
- export { default as Dashboard } from './Dashboard';
1
+ export { default as Dashboard, type DashboardProps, type DashboardItemProps, type DashboardItemData, type AxisFormat, } from './Dashboard';
2
2
  export { default as QuillProvider } from './QuillProvider';
3
3
  export { default as Chart } from './Chart';
4
4
  export { default as Table } from './Table';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAG,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
@@ -56,7 +56,7 @@ export declare function generatePivotTable(pivot: Pivot, data: any, dateRange: a
56
56
  rows: any[];
57
57
  columns: {
58
58
  label: any;
59
- field: string | number | boolean;
59
+ field: string;
60
60
  }[];
61
61
  };
62
62
  //# sourceMappingURL=PivotModal.d.ts.map
@@ -479,7 +479,7 @@ function generatePivotTitle(pivot) {
479
479
  }
480
480
  function getDateRange(dateRange, column, data) {
481
481
  if (!dateRange || !dateRange[0]) {
482
- if (data.length == 0) {
482
+ if (data.length == 0 || !data[0][column]) {
483
483
  return { start: new Date(), end: new Date() };
484
484
  }
485
485
  const firstDate = data[0][column] === null ? null : new Date(data[0][column]);
@@ -0,0 +1,12 @@
1
+ import { DashboardItemData } from '../Dashboard';
2
+ /**
3
+ * Returns a cleaned version of the dashboard item we store in state. We clean
4
+ * the dashboard item so that we aren't exposing unnecessary details to the
5
+ * client and also so that we can give the developer using our items a stable
6
+ * interface to build amazing dashboards on top of.
7
+ * @param item
8
+ */
9
+ export declare function cleanDashboardItem(item: {
10
+ [key: string]: any;
11
+ } | undefined): DashboardItemData | undefined;
12
+ //# sourceMappingURL=dashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../../src/utils/dashboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CA4B/B"}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanDashboardItem = void 0;
4
+ const react_1 = require("react");
5
+ const valueFormatter_1 = require("./valueFormatter");
6
+ const PivotModal_1 = require("../internals/ReportBuilder/PivotModal");
7
+ const Context_1 = require("../Context");
8
+ /**
9
+ * Returns a cleaned version of the dashboard item we store in state. We clean
10
+ * the dashboard item so that we aren't exposing unnecessary details to the
11
+ * client and also so that we can give the developer using our items a stable
12
+ * interface to build amazing dashboards on top of.
13
+ * @param item
14
+ */
15
+ function cleanDashboardItem(item) {
16
+ if (!item)
17
+ return undefined;
18
+ const pivotTable = getPivotTable(item);
19
+ const { primaryAggregation, comparisonAggregation, aggregationPercentChange, } = getAggragations(pivotTable, item);
20
+ return {
21
+ id: item._id,
22
+ name: item.name,
23
+ dashboardName: item.dashboardName,
24
+ rows: item.rows,
25
+ compareRows: item.compareRows,
26
+ columns: item.columns,
27
+ chartType: item.chartType,
28
+ dateField: item.dateField,
29
+ pivot: item.pivot,
30
+ primaryAggregation,
31
+ comparisonAggregation,
32
+ aggregationPercentChange,
33
+ yAxisFields: extractPivotedYAxis(pivotTable, item),
34
+ xAxisLabel: item.xAxisLabel,
35
+ xAxisField: item.xAxisField,
36
+ xAxisFormat: item.xAxisFormat,
37
+ order: item.order,
38
+ filtersApplied: item.filtersApplied,
39
+ };
40
+ }
41
+ exports.cleanDashboardItem = cleanDashboardItem;
42
+ /**
43
+ * Extracts the aggregations from the item, if any.
44
+ */
45
+ function getAggragations(pivotTable, item) {
46
+ const yAxisFields = extractPivotedYAxis(pivotTable, item);
47
+ const rows = extractPivotedData(pivotTable, item);
48
+ // extract the aggragation for the primary range.
49
+ const mainKey = yAxisFields[0]?.field ?? item.pivot?.valueField;
50
+ const primary = mainKey
51
+ ? rows.reduce((sum, row) => sum + parseFloat(row[mainKey]), 0)
52
+ : 0;
53
+ // extract the aggragation for the comparison range, if applicable.
54
+ const compKey = yAxisFields[1]?.field ?? item.pivot?.valueField;
55
+ const comparison = compKey
56
+ ? rows.reduce((sum, row) => sum + parseFloat(row[compKey]), 0)
57
+ : 0;
58
+ return {
59
+ primaryAggregation: formatAggragation(item, primary),
60
+ comparisonAggregation: formatAggragation(item, comparison),
61
+ aggregationPercentChange: formatPercentageWithSign(comparison, primary),
62
+ };
63
+ }
64
+ /**
65
+ * Applies a valueFormatter to the given value based on the format in the item.
66
+ */
67
+ function formatAggragation(item, value) {
68
+ if (!value)
69
+ return undefined;
70
+ return (0, valueFormatter_1.valueFormatter)({
71
+ value,
72
+ field: item.pivot?.valueField,
73
+ fields: item.yAxisFields,
74
+ });
75
+ }
76
+ /**
77
+ * Formats the percentage change from a to b with the sign included.
78
+ */
79
+ function formatPercentageWithSign(a, b) {
80
+ const formatter = new Intl.NumberFormat('en-US', {
81
+ style: 'percent',
82
+ signDisplay: 'exceptZero',
83
+ minimumFractionDigits: 2,
84
+ maximumFractionDigits: 2,
85
+ });
86
+ return formatter.format(Number(b - a));
87
+ }
88
+ /**
89
+ * Extract and transform the data from itemInfo.
90
+ */
91
+ function getPivotTable(itemInfo, config = undefined) {
92
+ if (!itemInfo)
93
+ return [];
94
+ const { dashboardFilters } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
95
+ const dateFilter = Object.values(dashboardFilters ?? {}).find((filter) => filter.filterType == 'date_range');
96
+ const pivot = itemInfo?.pivot || config?.pivot;
97
+ const data = itemInfo ? itemInfo : config;
98
+ return pivot && data?.rows
99
+ ? (0, PivotModal_1.generatePivotTable)(pivot, JSON.parse(JSON.stringify(data.rows)), // deep copy
100
+ dateFilter?.startDate
101
+ ? [dateFilter?.startDate, dateFilter?.endDate, null]
102
+ : [null, null, null], Boolean(dateFilter?.comparisonRange?.startDate), -1, dateFilter?.comparisonRange?.startDate
103
+ ? [
104
+ dateFilter?.comparisonRange.startDate,
105
+ dateFilter?.comparisonRange.endDate,
106
+ null,
107
+ ]
108
+ : [null, null, null])
109
+ : null;
110
+ }
111
+ /**
112
+ * Returns the data list based on whether the table is pivoted and if there is
113
+ * a config value passed into this component.
114
+ */
115
+ function extractPivotedData(pivotTable, item, config = undefined) {
116
+ if (pivotTable)
117
+ return pivotTable.rows;
118
+ if (config) {
119
+ if (config.bucketedRows.length > 0)
120
+ return config.bucketedRows;
121
+ return config.rows;
122
+ }
123
+ return item.rows;
124
+ }
125
+ /**
126
+ * Extracts the yAxis from the pivot table, if one exists.
127
+ */
128
+ function extractPivotedYAxis(pivotTable, itemInfo, config = undefined) {
129
+ if (!pivotTable)
130
+ return [];
131
+ const pivot = itemInfo?.pivot || config?.pivot;
132
+ const yAxisFields = config ? config.yAxisFields : itemInfo?.yAxisFields;
133
+ const pivotTableYAxis = yAxisFields
134
+ ? (0, PivotModal_1.generatePivotTableYAxis)(pivot, pivotTable.columns, yAxisFields?.[0]?.format)
135
+ : null;
136
+ const fields = pivotTableYAxis
137
+ ? pivotTableYAxis
138
+ : config
139
+ ? config.yAxisFields
140
+ : itemInfo.yAxisFields;
141
+ if (fields.length == 1) {
142
+ const sampleField = fields[0];
143
+ fields[fields.length] = {
144
+ ...sampleField,
145
+ field: `comparison_${sampleField.field}`,
146
+ label: `comparison ${sampleField.label}`,
147
+ };
148
+ }
149
+ return fields;
150
+ }
@@ -0,0 +1,17 @@
1
+ import { CSSProperties } from 'react';
2
+ export type StyleInput = string | CSSProperties | undefined;
3
+ export type StyleProps = {
4
+ className: string;
5
+ } | {
6
+ style: CSSProperties;
7
+ } | {};
8
+ /**
9
+ * Converts the given styles to a props object that can be passed directly into
10
+ * a jsx/tsx component. Converts to className if styles is a string, otherwise
11
+ * treats it as CSSProperties.
12
+ *
13
+ * Example:
14
+ * <div {...styleToProps(containerStyle)}>...</div>
15
+ */
16
+ export declare function styleToProps(styles: StyleInput): StyleProps;
17
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG,EAAE,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAO3D"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.styleToProps = void 0;
4
+ /**
5
+ * Converts the given styles to a props object that can be passed directly into
6
+ * a jsx/tsx component. Converts to className if styles is a string, otherwise
7
+ * treats it as CSSProperties.
8
+ *
9
+ * Example:
10
+ * <div {...styleToProps(containerStyle)}>...</div>
11
+ */
12
+ function styleToProps(styles) {
13
+ if (!styles)
14
+ return {};
15
+ if (typeof styles === 'string') {
16
+ return { className: styles };
17
+ }
18
+ return { style: styles };
19
+ }
20
+ exports.styleToProps = styleToProps;
@@ -12,6 +12,6 @@ type Props = {
12
12
  /**
13
13
  * Pretty-prints the given values to their nice-looking string form.
14
14
  */
15
- export declare const valueFormatter: ({ value, field, fields, }: Props) => string | number | boolean;
15
+ export declare const valueFormatter: ({ value, field, fields, }: Props) => string;
16
16
  export {};
17
17
  //# sourceMappingURL=valueFormatter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"valueFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/valueFormatter.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,8BAIxB,KAAK,KAAG,MAAM,GAAG,MAAM,GAAG,OA+B5B,CAAC"}
1
+ {"version":3,"file":"valueFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/valueFormatter.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,8BAIxB,KAAK,KAAG,MA+BV,CAAC"}
@@ -8,7 +8,7 @@ interface BaseChartProps {
8
8
  isAnimationActive?: boolean;
9
9
  hideXAxis?: boolean;
10
10
  hideYAxis?: boolean;
11
- hideCartesionGrid?: boolean;
11
+ hideCartesianGrid?: boolean;
12
12
  }
13
13
  interface WithChartId extends BaseChartProps {
14
14
  chartId: string;
@@ -35,6 +35,6 @@ interface WithConfig extends BaseChartProps {
35
35
  config: DashboardItem | any;
36
36
  }
37
37
  type ChartProps = WithChartId | WithConfig;
38
- declare const Chart: ({ chartId, config, colors, containerStyle, query, SelectComponent, dateRangeFilterDisabled, isAnimationActive, hideXAxis, hideYAxis, hideCartesionGrid, }: ChartProps) => import("react/jsx-runtime").JSX.Element;
38
+ declare const Chart: ({ chartId, config, colors, containerStyle, query, SelectComponent, dateRangeFilterDisabled, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, }: ChartProps) => import("react/jsx-runtime").JSX.Element;
39
39
  export default Chart;
40
40
  //# sourceMappingURL=Chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart.tsx"],"names":[],"mappings":";AA2BA,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,UAAU,WAAY,SAAQ,cAAc;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,WAAW,GACnB,cAAc,GACd,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,cAAc,GACd,UAAU,GACV,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,UAAU,GACV,SAAS,GACT,QAAQ,CAAC;AAEb,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MA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