@hisptz/dhis2-analytics 2.0.3 → 2.0.5

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.
@@ -16,7 +16,12 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
16
  var HighCharts__default = /*#__PURE__*/_interopDefault(HighCharts);
17
17
  var HighchartsReact__default = /*#__PURE__*/_interopDefault(HighchartsReact);
18
18
 
19
- function ChartAnalyticsComponent({ analytics, config, containerProps }, ref) {
19
+ function ChartAnalyticsComponent({
20
+ analytics,
21
+ config,
22
+ containerProps,
23
+ setRef
24
+ }) {
20
25
  const id = react.useRef(`${dhis2Utils.uid()}-chart-item`);
21
26
  const { chart } = useChart_js.useChart({ id: id.current, analytics, config });
22
27
  if (!chart) {
@@ -26,7 +31,7 @@ function ChartAnalyticsComponent({ analytics, config, containerProps }, ref) {
26
31
  HighchartsReact__default.default,
27
32
  {
28
33
  immutable: true,
29
- ref,
34
+ ref: setRef,
30
35
  containerProps: { id: id.current, ...containerProps ?? {} },
31
36
  highcharts: HighCharts__default.default,
32
37
  options: { ...chart }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ChartAnalytics/DHIS2Chart.tsx"],"names":[],"mappings":"AAuBE;AAvBF,SAAS,WAAW;AACpB,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,SAAgB,YAAY,cAAc;AAC1C,SAAS,gBAAgB;AACzB,OAAO;AAGP,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,wBACR,EAAE,WAAW,QAAQ,eAAe,GACpC,KACC;AACD,QAAM,KAAK,OAAO,GAAG,IAAI,CAAC,aAAa;AACvC,QAAM,EAAE,MAAM,IAAI,SAAS,EAAE,IAAI,GAAG,SAAS,WAAW,OAAO,CAAC;AAEhE,MAAI,CAAC,OAAO;AACX,WAAO;AAAA,EACR;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAS;AAAA,MACT;AAAA,MACA,gBAAgB,EAAE,IAAI,GAAG,SAAS,GAAI,kBAAkB,CAAC,EAAG;AAAA,MAC5D,YAAY;AAAA,MACZ,SAAS,EAAE,GAAG,MAAM;AAAA;AAAA,EACrB;AAEF;AAgBO,MAAM,aAA4C;AAAA,EACxD;AACD;AAKO,MAAM,iBAAiB","sourcesContent":["import { uid } from \"@hisptz/dhis2-utils\";\nimport HighCharts from \"highcharts\";\nimport HighchartsReact from \"highcharts-react-official\";\nimport React, { forwardRef, useRef } from \"react\";\nimport { useChart } from \"./hooks/useChart.js\";\nimport \"./styles/custom-highchart.css\";\nimport { ChartAnalyticsProps } from \"./types/props.js\";\n\nexport * from \"./services/export.js\";\nexport * from \"./types/props.js\";\nexport * from \"./components/DownloadMenu/index.js\";\n\nfunction ChartAnalyticsComponent(\n\t{ analytics, config, containerProps }: ChartAnalyticsProps,\n\tref: React.ForwardedRef<HighchartsReact.RefObject>,\n) {\n\tconst id = useRef(`${uid()}-chart-item`);\n\tconst { chart } = useChart({ id: id.current, analytics, config });\n\n\tif (!chart) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<HighchartsReact\n\t\t\timmutable\n\t\t\tref={ref}\n\t\t\tcontainerProps={{ id: id.current, ...(containerProps ?? {}) }}\n\t\t\thighcharts={HighCharts}\n\t\t\toptions={{ ...chart }}\n\t\t/>\n\t);\n}\n\n/**\n * The `DHIS2Chart` component allows you to render a chart visualization from DHIS2 analytics data.\n * It accepts the DHIS2 analytics payload as well as configuration on how to visualize the data.\n *\n * @component\n *\n * @param {ChartAnalyticsProps} props\n * @param {Analytics} [props.analytics] - Analytics data from DHIS2\n * @param {ChartConfig} [props.config] - Visualization configuration. See stories for more information\n * @param {Record<string, any>} [props.containerProps] - Props that will be passed to the chart container\n * @param {forwardRef} forwardRef - A function that creates a higher order component that forwards the ref through the component tree.\n *\n * @returns {React.FC<ChartAnalyticsProps & { ref: React.Ref<unknown> }>} - The DHIS2 chart component with forward ref support.\n */\nexport const DHIS2Chart: React.FC<ChartAnalyticsProps> = forwardRef(\n\tChartAnalyticsComponent,\n);\n\n/**\n * @deprecated since `v2`. Use `DHIS2Chart` instead\n * */\nexport const ChartAnalytics = DHIS2Chart;\n"]}
1
+ {"version":3,"sources":["../../../src/components/ChartAnalytics/DHIS2Chart.tsx"],"names":[],"mappings":"AAyBE;AAzBF,SAAS,WAAW;AACpB,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,SAAgB,YAAY,cAAc;AAC1C,SAAS,gBAAgB;AACzB,OAAO;AAGP,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,wBAAwB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAwB;AACvB,QAAM,KAAK,OAAO,GAAG,IAAI,CAAC,aAAa;AACvC,QAAM,EAAE,MAAM,IAAI,SAAS,EAAE,IAAI,GAAG,SAAS,WAAW,OAAO,CAAC;AAEhE,MAAI,CAAC,OAAO;AACX,WAAO;AAAA,EACR;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAS;AAAA,MACT,KAAK;AAAA,MACL,gBAAgB,EAAE,IAAI,GAAG,SAAS,GAAI,kBAAkB,CAAC,EAAG;AAAA,MAC5D,YAAY;AAAA,MACZ,SAAS,EAAE,GAAG,MAAM;AAAA;AAAA,EACrB;AAEF;AAgBO,MAAM,aACZ;AAAA,EACC;AACD;AAKM,MAAM,iBAAiB","sourcesContent":["import { uid } from \"@hisptz/dhis2-utils\";\nimport HighCharts from \"highcharts\";\nimport HighchartsReact from \"highcharts-react-official\";\nimport React, { forwardRef, useRef } from \"react\";\nimport { useChart } from \"./hooks/useChart.js\";\nimport \"./styles/custom-highchart.css\";\nimport { ChartAnalyticsProps } from \"./types/props.js\";\n\nexport * from \"./services/export.js\";\nexport * from \"./types/props.js\";\nexport * from \"./components/DownloadMenu/index.js\";\n\nfunction ChartAnalyticsComponent({\n\tanalytics,\n\tconfig,\n\tcontainerProps,\n\tsetRef,\n}: ChartAnalyticsProps) {\n\tconst id = useRef(`${uid()}-chart-item`);\n\tconst { chart } = useChart({ id: id.current, analytics, config });\n\n\tif (!chart) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<HighchartsReact\n\t\t\timmutable\n\t\t\tref={setRef}\n\t\t\tcontainerProps={{ id: id.current, ...(containerProps ?? {}) }}\n\t\t\thighcharts={HighCharts}\n\t\t\toptions={{ ...chart }}\n\t\t/>\n\t);\n}\n\n/**\n * The `DHIS2Chart` component allows you to render a chart visualization from DHIS2 analytics data.\n * It accepts the DHIS2 analytics payload as well as configuration on how to visualize the data.\n *\n * @component\n *\n * @param {ChartAnalyticsProps} props\n * @param {Analytics} [props.analytics] - Analytics data from DHIS2\n * @param {ChartConfig} [props.config] - Visualization configuration. See stories for more information\n * @param {Record<string, any>} [props.containerProps] - Props that will be passed to the chart container\n * @param {forwardRef} forwardRef - A function that creates a higher order component that forwards the ref through the component tree.\n *\n * @returns {React.ForwardRefExoticComponent<ChartAnalyticsProps>} - The DHIS2 chart component with forward ref support.\n */\nexport const DHIS2Chart: React.ForwardRefExoticComponent<ChartAnalyticsProps> =\n\tforwardRef<HighchartsReact.RefObject, ChartAnalyticsProps>(\n\t\tChartAnalyticsComponent,\n\t);\n\n/**\n * @deprecated since `v2`. Use `DHIS2Chart` instead\n * */\nexport const ChartAnalytics = DHIS2Chart;\n"]}
@@ -11,13 +11,14 @@ var index_js$2 = require('./components/TableBody/index.js');
11
11
  function DHIS2PivotTable({
12
12
  analytics,
13
13
  config,
14
- tableProps
14
+ tableProps,
15
+ setRef
15
16
  }) {
16
17
  const engine = react.useMemo(
17
18
  () => new engine_js.DHIS2PivotTableEngine({ analytics, config }),
18
19
  [analytics, config]
19
20
  );
20
- return /* @__PURE__ */ jsxRuntime.jsx(engine_js$1.DHIS2PivotTableEngineProvider, { engine, children: /* @__PURE__ */ jsxRuntime.jsxs(index_js.PivotTable, { tableProps, children: [
21
+ return /* @__PURE__ */ jsxRuntime.jsx(engine_js$1.DHIS2PivotTableEngineProvider, { engine, children: /* @__PURE__ */ jsxRuntime.jsxs(index_js.PivotTable, { setRef, tableProps, children: [
21
22
  /* @__PURE__ */ jsxRuntime.jsx(index_js$1.TableHeaders, {}),
22
23
  /* @__PURE__ */ jsxRuntime.jsx(index_js$2.CustomPivotTableBody, {})
23
24
  ] }) });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DHIS2PivotTable/DHIS2PivotTable.tsx"],"names":[],"mappings":"AAwDG,SACC,KADD;AAvDH,SAAS,6BAA6B;AACtC,SAAgB,eAAe;AAC/B,SAAS,qCAAqC;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AAsC9B,SAAS,gBAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,QAAM,SAAS;AAAA,IACd,MAAM,IAAI,sBAAsB,EAAE,WAAW,OAAO,CAAC;AAAA,IACrD,CAAC,WAAW,MAAM;AAAA,EACnB;AAEA,SACC,oBAAC,iCAA8B,QAC9B,+BAAC,cAAW,YACX;AAAA,wBAAC,gBAAa;AAAA,IACd,oBAAC,wBAAqB;AAAA,KACvB,GACD;AAEF","sourcesContent":["import { Analytics, LegendSet } from \"@hisptz/dhis2-utils\";\nimport { DHIS2PivotTableEngine } from \"./services/engine.js\";\nimport React, { useMemo } from \"react\";\nimport { DHIS2PivotTableEngineProvider } from \"./state/engine.js\";\nimport { PivotTable } from \"./components/Table/index.js\";\nimport { TableHeaders } from \"./components/TableHeaders/index.js\";\nimport { CustomPivotTableBody } from \"./components/TableBody/index.js\";\nimport { DHIS2Dimension } from \"./interfaces/index.js\";\nimport { DataTableProps } from \"@dhis2/ui\";\n\nexport interface DHIS2PivotTableOptions {\n\tlegendSets?: LegendSet[];\n\thideEmptyColumns?: boolean;\n\thideEmptyRows?: boolean;\n\tshowRowTotals?: boolean;\n\tshowColumnTotals?: boolean;\n\tshowRowSubtotals?: boolean;\n\tshowColumnSubtotals?: boolean;\n\tfixColumnHeaders?: boolean;\n\tfixRowHeaders?: boolean;\n}\n\nexport interface DHIS2PivotTableProps {\n\tanalytics: Analytics;\n\ttableProps?: DataTableProps;\n\tconfig: {\n\t\tlayout: {\n\t\t\tcolumns: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\trows: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\tfilter?: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t};\n\t\toptions?: DHIS2PivotTableOptions;\n\t};\n}\n\nexport function DHIS2PivotTable({\n\tanalytics,\n\tconfig,\n\ttableProps,\n}: DHIS2PivotTableProps) {\n\tconst engine = useMemo(\n\t\t() => new DHIS2PivotTableEngine({ analytics, config }),\n\t\t[analytics, config],\n\t);\n\n\treturn (\n\t\t<DHIS2PivotTableEngineProvider engine={engine}>\n\t\t\t<PivotTable tableProps={tableProps}>\n\t\t\t\t<TableHeaders />\n\t\t\t\t<CustomPivotTableBody />\n\t\t\t</PivotTable>\n\t\t</DHIS2PivotTableEngineProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/components/DHIS2PivotTable/DHIS2PivotTable.tsx"],"names":[],"mappings":"AA0DG,SACC,KADD;AAzDH,SAAS,6BAA6B;AACtC,SAAgB,eAAe;AAC/B,SAAS,qCAAqC;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AAuC9B,SAAS,gBAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,QAAM,SAAS;AAAA,IACd,MAAM,IAAI,sBAAsB,EAAE,WAAW,OAAO,CAAC;AAAA,IACrD,CAAC,WAAW,MAAM;AAAA,EACnB;AAEA,SACC,oBAAC,iCAA8B,QAC9B,+BAAC,cAAW,QAAgB,YAC3B;AAAA,wBAAC,gBAAa;AAAA,IACd,oBAAC,wBAAqB;AAAA,KACvB,GACD;AAEF","sourcesContent":["import { Analytics, LegendSet } from \"@hisptz/dhis2-utils\";\nimport { DHIS2PivotTableEngine } from \"./services/engine.js\";\nimport React, { useMemo } from \"react\";\nimport { DHIS2PivotTableEngineProvider } from \"./state/engine.js\";\nimport { PivotTable } from \"./components/Table/index.js\";\nimport { TableHeaders } from \"./components/TableHeaders/index.js\";\nimport { CustomPivotTableBody } from \"./components/TableBody/index.js\";\nimport { DHIS2Dimension } from \"./interfaces/index.js\";\nimport { DataTableProps } from \"@dhis2/ui\";\n\nexport interface DHIS2PivotTableOptions {\n\tlegendSets?: LegendSet[];\n\thideEmptyColumns?: boolean;\n\thideEmptyRows?: boolean;\n\tshowRowTotals?: boolean;\n\tshowColumnTotals?: boolean;\n\tshowRowSubtotals?: boolean;\n\tshowColumnSubtotals?: boolean;\n\tfixColumnHeaders?: boolean;\n\tfixRowHeaders?: boolean;\n}\n\nexport interface DHIS2PivotTableProps {\n\tanalytics: Analytics;\n\ttableProps?: DataTableProps;\n\tsetRef?: (ref: HTMLTableElement) => void;\n\tconfig: {\n\t\tlayout: {\n\t\t\tcolumns: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\trows: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\tfilter?: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t};\n\t\toptions?: DHIS2PivotTableOptions;\n\t};\n}\n\nexport function DHIS2PivotTable({\n\tanalytics,\n\tconfig,\n\ttableProps,\n\tsetRef,\n}: DHIS2PivotTableProps) {\n\tconst engine = useMemo(\n\t\t() => new DHIS2PivotTableEngine({ analytics, config }),\n\t\t[analytics, config],\n\t);\n\n\treturn (\n\t\t<DHIS2PivotTableEngineProvider engine={engine}>\n\t\t\t<PivotTable setRef={setRef} tableProps={tableProps}>\n\t\t\t\t<TableHeaders />\n\t\t\t\t<CustomPivotTableBody />\n\t\t\t</PivotTable>\n\t\t</DHIS2PivotTableEngineProvider>\n\t);\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var ui = require('@dhis2/ui');
5
5
 
6
- function PivotTable({ tableProps, children }) {
7
- return /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable, { ...tableProps ?? {}, children });
6
+ function PivotTable({ tableProps, children, setRef }) {
7
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.DataTable, { ref: setRef, ...tableProps ?? {}, children }) });
8
8
  }
9
9
 
10
10
  exports.PivotTable = PivotTable;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/DHIS2PivotTable/components/Table/index.tsx"],"names":[],"mappings":"AAWQ;AAVR,SAAS,iBAAiC;AASnC,SAAS,WAAW,EAAE,YAAY,SAAS,GAAoB;AACrE,SAAO,oBAAC,aAAW,GAAI,cAAc,CAAC,GAAK,UAAS;AACrD","sourcesContent":["import React from \"react\";\nimport { DataTable, DataTableProps } from \"@dhis2/ui\";\n\nexport type PivotTableLayoutProps = DataTableProps;\n\nexport interface PivotTableProps {\n\tchildren: React.ReactNode;\n\ttableProps?: DataTableProps;\n}\n\nexport function PivotTable({ tableProps, children }: PivotTableProps) {\n\treturn <DataTable {...(tableProps ?? {})}>{children}</DataTable>;\n}\n"]}
1
+ {"version":3,"sources":["../../../../../src/components/DHIS2PivotTable/components/Table/index.tsx"],"names":[],"mappings":"AAaE,mBAGC,WAHD;AAZF,SAAS,iBAAiC;AAUnC,SAAS,WAAW,EAAE,YAAY,UAAU,OAAO,GAAoB;AAC7E,SACC,gCAGC,8BAAC,aAAU,KAAK,QAAgB,GAAI,cAAc,CAAC,GACjD,UACF,GACD;AAEF","sourcesContent":["import React from \"react\";\nimport { DataTable, DataTableProps } from \"@dhis2/ui\";\n\nexport type PivotTableLayoutProps = DataTableProps;\n\nexport interface PivotTableProps {\n\tchildren: React.ReactNode;\n\ttableProps?: DataTableProps;\n\tsetRef?: (ref: HTMLTableElement) => void;\n}\n\nexport function PivotTable({ tableProps, children, setRef }: PivotTableProps) {\n\treturn (\n\t\t<>\n\t\t\t{/*\n// @ts-ignore */}\n\t\t\t<DataTable ref={setRef as any} {...(tableProps ?? {})}>\n\t\t\t\t{children}\n\t\t\t</DataTable>\n\t\t</>\n\t);\n}\n"]}
@@ -9,7 +9,12 @@ export * from './services/export.js';
9
9
  export * from './types/props.js';
10
10
  export * from './components/DownloadMenu/index.js';
11
11
 
12
- function ChartAnalyticsComponent({ analytics, config, containerProps }, ref) {
12
+ function ChartAnalyticsComponent({
13
+ analytics,
14
+ config,
15
+ containerProps,
16
+ setRef
17
+ }) {
13
18
  const id = useRef(`${uid()}-chart-item`);
14
19
  const { chart } = useChart({ id: id.current, analytics, config });
15
20
  if (!chart) {
@@ -19,7 +24,7 @@ function ChartAnalyticsComponent({ analytics, config, containerProps }, ref) {
19
24
  HighchartsReact,
20
25
  {
21
26
  immutable: true,
22
- ref,
27
+ ref: setRef,
23
28
  containerProps: { id: id.current, ...containerProps ?? {} },
24
29
  highcharts: HighCharts,
25
30
  options: { ...chart }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ChartAnalytics/DHIS2Chart.tsx"],"names":[],"mappings":"AAuBE;AAvBF,SAAS,WAAW;AACpB,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,SAAgB,YAAY,cAAc;AAC1C,SAAS,gBAAgB;AACzB,OAAO;AAGP,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,wBACR,EAAE,WAAW,QAAQ,eAAe,GACpC,KACC;AACD,QAAM,KAAK,OAAO,GAAG,IAAI,CAAC,aAAa;AACvC,QAAM,EAAE,MAAM,IAAI,SAAS,EAAE,IAAI,GAAG,SAAS,WAAW,OAAO,CAAC;AAEhE,MAAI,CAAC,OAAO;AACX,WAAO;AAAA,EACR;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAS;AAAA,MACT;AAAA,MACA,gBAAgB,EAAE,IAAI,GAAG,SAAS,GAAI,kBAAkB,CAAC,EAAG;AAAA,MAC5D,YAAY;AAAA,MACZ,SAAS,EAAE,GAAG,MAAM;AAAA;AAAA,EACrB;AAEF;AAgBO,MAAM,aAA4C;AAAA,EACxD;AACD;AAKO,MAAM,iBAAiB","sourcesContent":["import { uid } from \"@hisptz/dhis2-utils\";\nimport HighCharts from \"highcharts\";\nimport HighchartsReact from \"highcharts-react-official\";\nimport React, { forwardRef, useRef } from \"react\";\nimport { useChart } from \"./hooks/useChart.js\";\nimport \"./styles/custom-highchart.css\";\nimport { ChartAnalyticsProps } from \"./types/props.js\";\n\nexport * from \"./services/export.js\";\nexport * from \"./types/props.js\";\nexport * from \"./components/DownloadMenu/index.js\";\n\nfunction ChartAnalyticsComponent(\n\t{ analytics, config, containerProps }: ChartAnalyticsProps,\n\tref: React.ForwardedRef<HighchartsReact.RefObject>,\n) {\n\tconst id = useRef(`${uid()}-chart-item`);\n\tconst { chart } = useChart({ id: id.current, analytics, config });\n\n\tif (!chart) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<HighchartsReact\n\t\t\timmutable\n\t\t\tref={ref}\n\t\t\tcontainerProps={{ id: id.current, ...(containerProps ?? {}) }}\n\t\t\thighcharts={HighCharts}\n\t\t\toptions={{ ...chart }}\n\t\t/>\n\t);\n}\n\n/**\n * The `DHIS2Chart` component allows you to render a chart visualization from DHIS2 analytics data.\n * It accepts the DHIS2 analytics payload as well as configuration on how to visualize the data.\n *\n * @component\n *\n * @param {ChartAnalyticsProps} props\n * @param {Analytics} [props.analytics] - Analytics data from DHIS2\n * @param {ChartConfig} [props.config] - Visualization configuration. See stories for more information\n * @param {Record<string, any>} [props.containerProps] - Props that will be passed to the chart container\n * @param {forwardRef} forwardRef - A function that creates a higher order component that forwards the ref through the component tree.\n *\n * @returns {React.FC<ChartAnalyticsProps & { ref: React.Ref<unknown> }>} - The DHIS2 chart component with forward ref support.\n */\nexport const DHIS2Chart: React.FC<ChartAnalyticsProps> = forwardRef(\n\tChartAnalyticsComponent,\n);\n\n/**\n * @deprecated since `v2`. Use `DHIS2Chart` instead\n * */\nexport const ChartAnalytics = DHIS2Chart;\n"]}
1
+ {"version":3,"sources":["../../../../src/components/ChartAnalytics/DHIS2Chart.tsx"],"names":[],"mappings":"AAyBE;AAzBF,SAAS,WAAW;AACpB,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,SAAgB,YAAY,cAAc;AAC1C,SAAS,gBAAgB;AACzB,OAAO;AAGP,cAAc;AACd,cAAc;AACd,cAAc;AAEd,SAAS,wBAAwB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAwB;AACvB,QAAM,KAAK,OAAO,GAAG,IAAI,CAAC,aAAa;AACvC,QAAM,EAAE,MAAM,IAAI,SAAS,EAAE,IAAI,GAAG,SAAS,WAAW,OAAO,CAAC;AAEhE,MAAI,CAAC,OAAO;AACX,WAAO;AAAA,EACR;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAS;AAAA,MACT,KAAK;AAAA,MACL,gBAAgB,EAAE,IAAI,GAAG,SAAS,GAAI,kBAAkB,CAAC,EAAG;AAAA,MAC5D,YAAY;AAAA,MACZ,SAAS,EAAE,GAAG,MAAM;AAAA;AAAA,EACrB;AAEF;AAgBO,MAAM,aACZ;AAAA,EACC;AACD;AAKM,MAAM,iBAAiB","sourcesContent":["import { uid } from \"@hisptz/dhis2-utils\";\nimport HighCharts from \"highcharts\";\nimport HighchartsReact from \"highcharts-react-official\";\nimport React, { forwardRef, useRef } from \"react\";\nimport { useChart } from \"./hooks/useChart.js\";\nimport \"./styles/custom-highchart.css\";\nimport { ChartAnalyticsProps } from \"./types/props.js\";\n\nexport * from \"./services/export.js\";\nexport * from \"./types/props.js\";\nexport * from \"./components/DownloadMenu/index.js\";\n\nfunction ChartAnalyticsComponent({\n\tanalytics,\n\tconfig,\n\tcontainerProps,\n\tsetRef,\n}: ChartAnalyticsProps) {\n\tconst id = useRef(`${uid()}-chart-item`);\n\tconst { chart } = useChart({ id: id.current, analytics, config });\n\n\tif (!chart) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<HighchartsReact\n\t\t\timmutable\n\t\t\tref={setRef}\n\t\t\tcontainerProps={{ id: id.current, ...(containerProps ?? {}) }}\n\t\t\thighcharts={HighCharts}\n\t\t\toptions={{ ...chart }}\n\t\t/>\n\t);\n}\n\n/**\n * The `DHIS2Chart` component allows you to render a chart visualization from DHIS2 analytics data.\n * It accepts the DHIS2 analytics payload as well as configuration on how to visualize the data.\n *\n * @component\n *\n * @param {ChartAnalyticsProps} props\n * @param {Analytics} [props.analytics] - Analytics data from DHIS2\n * @param {ChartConfig} [props.config] - Visualization configuration. See stories for more information\n * @param {Record<string, any>} [props.containerProps] - Props that will be passed to the chart container\n * @param {forwardRef} forwardRef - A function that creates a higher order component that forwards the ref through the component tree.\n *\n * @returns {React.ForwardRefExoticComponent<ChartAnalyticsProps>} - The DHIS2 chart component with forward ref support.\n */\nexport const DHIS2Chart: React.ForwardRefExoticComponent<ChartAnalyticsProps> =\n\tforwardRef<HighchartsReact.RefObject, ChartAnalyticsProps>(\n\t\tChartAnalyticsComponent,\n\t);\n\n/**\n * @deprecated since `v2`. Use `DHIS2Chart` instead\n * */\nexport const ChartAnalytics = DHIS2Chart;\n"]}
@@ -9,13 +9,14 @@ import { CustomPivotTableBody } from './components/TableBody/index.js';
9
9
  function DHIS2PivotTable({
10
10
  analytics,
11
11
  config,
12
- tableProps
12
+ tableProps,
13
+ setRef
13
14
  }) {
14
15
  const engine = useMemo(
15
16
  () => new DHIS2PivotTableEngine({ analytics, config }),
16
17
  [analytics, config]
17
18
  );
18
- return /* @__PURE__ */ jsx(DHIS2PivotTableEngineProvider, { engine, children: /* @__PURE__ */ jsxs(PivotTable, { tableProps, children: [
19
+ return /* @__PURE__ */ jsx(DHIS2PivotTableEngineProvider, { engine, children: /* @__PURE__ */ jsxs(PivotTable, { setRef, tableProps, children: [
19
20
  /* @__PURE__ */ jsx(TableHeaders, {}),
20
21
  /* @__PURE__ */ jsx(CustomPivotTableBody, {})
21
22
  ] }) });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/DHIS2PivotTable/DHIS2PivotTable.tsx"],"names":[],"mappings":"AAwDG,SACC,KADD;AAvDH,SAAS,6BAA6B;AACtC,SAAgB,eAAe;AAC/B,SAAS,qCAAqC;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AAsC9B,SAAS,gBAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,QAAM,SAAS;AAAA,IACd,MAAM,IAAI,sBAAsB,EAAE,WAAW,OAAO,CAAC;AAAA,IACrD,CAAC,WAAW,MAAM;AAAA,EACnB;AAEA,SACC,oBAAC,iCAA8B,QAC9B,+BAAC,cAAW,YACX;AAAA,wBAAC,gBAAa;AAAA,IACd,oBAAC,wBAAqB;AAAA,KACvB,GACD;AAEF","sourcesContent":["import { Analytics, LegendSet } from \"@hisptz/dhis2-utils\";\nimport { DHIS2PivotTableEngine } from \"./services/engine.js\";\nimport React, { useMemo } from \"react\";\nimport { DHIS2PivotTableEngineProvider } from \"./state/engine.js\";\nimport { PivotTable } from \"./components/Table/index.js\";\nimport { TableHeaders } from \"./components/TableHeaders/index.js\";\nimport { CustomPivotTableBody } from \"./components/TableBody/index.js\";\nimport { DHIS2Dimension } from \"./interfaces/index.js\";\nimport { DataTableProps } from \"@dhis2/ui\";\n\nexport interface DHIS2PivotTableOptions {\n\tlegendSets?: LegendSet[];\n\thideEmptyColumns?: boolean;\n\thideEmptyRows?: boolean;\n\tshowRowTotals?: boolean;\n\tshowColumnTotals?: boolean;\n\tshowRowSubtotals?: boolean;\n\tshowColumnSubtotals?: boolean;\n\tfixColumnHeaders?: boolean;\n\tfixRowHeaders?: boolean;\n}\n\nexport interface DHIS2PivotTableProps {\n\tanalytics: Analytics;\n\ttableProps?: DataTableProps;\n\tconfig: {\n\t\tlayout: {\n\t\t\tcolumns: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\trows: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\tfilter?: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t};\n\t\toptions?: DHIS2PivotTableOptions;\n\t};\n}\n\nexport function DHIS2PivotTable({\n\tanalytics,\n\tconfig,\n\ttableProps,\n}: DHIS2PivotTableProps) {\n\tconst engine = useMemo(\n\t\t() => new DHIS2PivotTableEngine({ analytics, config }),\n\t\t[analytics, config],\n\t);\n\n\treturn (\n\t\t<DHIS2PivotTableEngineProvider engine={engine}>\n\t\t\t<PivotTable tableProps={tableProps}>\n\t\t\t\t<TableHeaders />\n\t\t\t\t<CustomPivotTableBody />\n\t\t\t</PivotTable>\n\t\t</DHIS2PivotTableEngineProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/components/DHIS2PivotTable/DHIS2PivotTable.tsx"],"names":[],"mappings":"AA0DG,SACC,KADD;AAzDH,SAAS,6BAA6B;AACtC,SAAgB,eAAe;AAC/B,SAAS,qCAAqC;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;AAuC9B,SAAS,gBAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,QAAM,SAAS;AAAA,IACd,MAAM,IAAI,sBAAsB,EAAE,WAAW,OAAO,CAAC;AAAA,IACrD,CAAC,WAAW,MAAM;AAAA,EACnB;AAEA,SACC,oBAAC,iCAA8B,QAC9B,+BAAC,cAAW,QAAgB,YAC3B;AAAA,wBAAC,gBAAa;AAAA,IACd,oBAAC,wBAAqB;AAAA,KACvB,GACD;AAEF","sourcesContent":["import { Analytics, LegendSet } from \"@hisptz/dhis2-utils\";\nimport { DHIS2PivotTableEngine } from \"./services/engine.js\";\nimport React, { useMemo } from \"react\";\nimport { DHIS2PivotTableEngineProvider } from \"./state/engine.js\";\nimport { PivotTable } from \"./components/Table/index.js\";\nimport { TableHeaders } from \"./components/TableHeaders/index.js\";\nimport { CustomPivotTableBody } from \"./components/TableBody/index.js\";\nimport { DHIS2Dimension } from \"./interfaces/index.js\";\nimport { DataTableProps } from \"@dhis2/ui\";\n\nexport interface DHIS2PivotTableOptions {\n\tlegendSets?: LegendSet[];\n\thideEmptyColumns?: boolean;\n\thideEmptyRows?: boolean;\n\tshowRowTotals?: boolean;\n\tshowColumnTotals?: boolean;\n\tshowRowSubtotals?: boolean;\n\tshowColumnSubtotals?: boolean;\n\tfixColumnHeaders?: boolean;\n\tfixRowHeaders?: boolean;\n}\n\nexport interface DHIS2PivotTableProps {\n\tanalytics: Analytics;\n\ttableProps?: DataTableProps;\n\tsetRef?: (ref: HTMLTableElement) => void;\n\tconfig: {\n\t\tlayout: {\n\t\t\tcolumns: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\trows: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t\tfilter?: {\n\t\t\t\tdimension: DHIS2Dimension;\n\t\t\t\tlabel?: string;\n\t\t\t}[];\n\t\t};\n\t\toptions?: DHIS2PivotTableOptions;\n\t};\n}\n\nexport function DHIS2PivotTable({\n\tanalytics,\n\tconfig,\n\ttableProps,\n\tsetRef,\n}: DHIS2PivotTableProps) {\n\tconst engine = useMemo(\n\t\t() => new DHIS2PivotTableEngine({ analytics, config }),\n\t\t[analytics, config],\n\t);\n\n\treturn (\n\t\t<DHIS2PivotTableEngineProvider engine={engine}>\n\t\t\t<PivotTable setRef={setRef} tableProps={tableProps}>\n\t\t\t\t<TableHeaders />\n\t\t\t\t<CustomPivotTableBody />\n\t\t\t</PivotTable>\n\t\t</DHIS2PivotTableEngineProvider>\n\t);\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { DataTable } from '@dhis2/ui';
3
3
 
4
- function PivotTable({ tableProps, children }) {
5
- return /* @__PURE__ */ jsx(DataTable, { ...tableProps ?? {}, children });
4
+ function PivotTable({ tableProps, children, setRef }) {
5
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(DataTable, { ref: setRef, ...tableProps ?? {}, children }) });
6
6
  }
7
7
 
8
8
  export { PivotTable };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/DHIS2PivotTable/components/Table/index.tsx"],"names":[],"mappings":"AAWQ;AAVR,SAAS,iBAAiC;AASnC,SAAS,WAAW,EAAE,YAAY,SAAS,GAAoB;AACrE,SAAO,oBAAC,aAAW,GAAI,cAAc,CAAC,GAAK,UAAS;AACrD","sourcesContent":["import React from \"react\";\nimport { DataTable, DataTableProps } from \"@dhis2/ui\";\n\nexport type PivotTableLayoutProps = DataTableProps;\n\nexport interface PivotTableProps {\n\tchildren: React.ReactNode;\n\ttableProps?: DataTableProps;\n}\n\nexport function PivotTable({ tableProps, children }: PivotTableProps) {\n\treturn <DataTable {...(tableProps ?? {})}>{children}</DataTable>;\n}\n"]}
1
+ {"version":3,"sources":["../../../../../../src/components/DHIS2PivotTable/components/Table/index.tsx"],"names":[],"mappings":"AAaE,mBAGC,WAHD;AAZF,SAAS,iBAAiC;AAUnC,SAAS,WAAW,EAAE,YAAY,UAAU,OAAO,GAAoB;AAC7E,SACC,gCAGC,8BAAC,aAAU,KAAK,QAAgB,GAAI,cAAc,CAAC,GACjD,UACF,GACD;AAEF","sourcesContent":["import React from \"react\";\nimport { DataTable, DataTableProps } from \"@dhis2/ui\";\n\nexport type PivotTableLayoutProps = DataTableProps;\n\nexport interface PivotTableProps {\n\tchildren: React.ReactNode;\n\ttableProps?: DataTableProps;\n\tsetRef?: (ref: HTMLTableElement) => void;\n}\n\nexport function PivotTable({ tableProps, children, setRef }: PivotTableProps) {\n\treturn (\n\t\t<>\n\t\t\t{/*\n// @ts-ignore */}\n\t\t\t<DataTable ref={setRef as any} {...(tableProps ?? {})}>\n\t\t\t\t{children}\n\t\t\t</DataTable>\n\t\t</>\n\t);\n}\n"]}
@@ -16,11 +16,11 @@ export * from "./components/DownloadMenu/index.js";
16
16
  * @param {Record<string, any>} [props.containerProps] - Props that will be passed to the chart container
17
17
  * @param {forwardRef} forwardRef - A function that creates a higher order component that forwards the ref through the component tree.
18
18
  *
19
- * @returns {React.FC<ChartAnalyticsProps & { ref: React.Ref<unknown> }>} - The DHIS2 chart component with forward ref support.
19
+ * @returns {React.ForwardRefExoticComponent<ChartAnalyticsProps>} - The DHIS2 chart component with forward ref support.
20
20
  */
21
- export declare const DHIS2Chart: React.FC<ChartAnalyticsProps>;
21
+ export declare const DHIS2Chart: React.ForwardRefExoticComponent<ChartAnalyticsProps>;
22
22
  /**
23
23
  * @deprecated since `v2`. Use `DHIS2Chart` instead
24
24
  * */
25
- export declare const ChartAnalytics: React.FC<ChartAnalyticsProps>;
25
+ export declare const ChartAnalytics: React.ForwardRefExoticComponent<ChartAnalyticsProps>;
26
26
  //# sourceMappingURL=DHIS2Chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DHIS2Chart.d.ts","sourceRoot":"","sources":["../../../../src/components/ChartAnalytics/DHIS2Chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAElD,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AAuBnD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAEpD,CAAC;AAEF;;KAEK;AACL,eAAO,MAAM,cAAc,+BAAa,CAAC"}
1
+ {"version":3,"file":"DHIS2Chart.d.ts","sourceRoot":"","sources":["../../../../src/components/ChartAnalytics/DHIS2Chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAElD,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AAyBnD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,yBAAyB,CAAC,mBAAmB,CAG1E,CAAC;AAEH;;KAEK;AACL,eAAO,MAAM,cAAc,sDAAa,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { Analytics } from "@hisptz/dhis2-utils";
2
2
  import HighCharts, { DashStyleValue, YAxisOptions, YAxisPlotLinesLabelOptions } from "highcharts";
3
+ import HighchartsReact from "highcharts-react-official";
3
4
  export type ChartType = "column" | "pie" | "stacked-column" | "line" | "multi-series" | "bar" | "stacked-bar";
4
5
  export interface MultiSeriesConfig {
5
6
  series?: Array<{
@@ -39,6 +40,7 @@ export type ChartConfig = {
39
40
  export type ChartAnalyticsProps = {
40
41
  analytics: Analytics;
41
42
  config: ChartConfig;
43
+ setRef?: (ref: HighchartsReact.RefObject) => void;
42
44
  containerProps?: Record<string, any>;
43
45
  };
44
46
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChartAnalytics/types/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,UAAU,EAAE,EAAC,cAAc,EAAE,YAAY,EAAE,0BAA0B,EAAC,MAAM,YAAY,CAAC;AAEhG,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,gBAAgB,GAAG,MAAM,GAAG,cAAc,GAAG,KAAK,GAAG,aAAa,CAAC;AAE9G,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,QAAQ,GAAG,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,0BAA0B,CAAC;IACnC,MAAM,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,cAAc,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACL;AAED,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,EAAE;QACJ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KACzB,CAAC;IACF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACjH,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACxC,CAAC"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChartAnalytics/types/props.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,UAAU,EAAE,EAClB,cAAc,EACd,YAAY,EACZ,0BAA0B,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAExD,MAAM,MAAM,SAAS,GAClB,QAAQ,GACR,KAAK,GACL,gBAAgB,GAChB,MAAM,GACN,cAAc,GACd,KAAK,GACL,aAAa,CAAC;AAEjB,MAAM,WAAW,iBAAiB;IACjC,MAAM,CAAC,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,QAAQ,GAAG,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,0BAA0B,CAAC;IACnC,MAAM,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,cAAc,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACF;AAED,MAAM,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE;QACP,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KACtB,CAAC;IACF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAChB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAC3B,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,WAAW,CAAC,EAAE,iBAAiB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,CAAC,SAAS,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC,CAAC"}
@@ -15,6 +15,7 @@ export interface DHIS2PivotTableOptions {
15
15
  export interface DHIS2PivotTableProps {
16
16
  analytics: Analytics;
17
17
  tableProps?: DataTableProps;
18
+ setRef?: (ref: HTMLTableElement) => void;
18
19
  config: {
19
20
  layout: {
20
21
  columns: {
@@ -33,5 +34,5 @@ export interface DHIS2PivotTableProps {
33
34
  options?: DHIS2PivotTableOptions;
34
35
  };
35
36
  }
36
- export declare function DHIS2PivotTable({ analytics, config, tableProps, }: DHIS2PivotTableProps): import("react/jsx-runtime.js").JSX.Element;
37
+ export declare function DHIS2PivotTable({ analytics, config, tableProps, setRef, }: DHIS2PivotTableProps): import("react/jsx-runtime.js").JSX.Element;
37
38
  //# sourceMappingURL=DHIS2PivotTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DHIS2PivotTable.d.ts","sourceRoot":"","sources":["../../../../src/components/DHIS2PivotTable/DHIS2PivotTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAO3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACtC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE;QACP,MAAM,EAAE;YACP,OAAO,EAAE;gBACR,SAAS,EAAE,cAAc,CAAC;gBAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;aACf,EAAE,CAAC;YACJ,IAAI,EAAE;gBACL,SAAS,EAAE,cAAc,CAAC;gBAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;aACf,EAAE,CAAC;YACJ,MAAM,CAAC,EAAE;gBACR,SAAS,EAAE,cAAc,CAAC;gBAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;aACf,EAAE,CAAC;SACJ,CAAC;QACF,OAAO,CAAC,EAAE,sBAAsB,CAAC;KACjC,CAAC;CACF;AAED,wBAAgB,eAAe,CAAC,EAC/B,SAAS,EACT,MAAM,EACN,UAAU,GACV,EAAE,oBAAoB,8CActB"}
1
+ {"version":3,"file":"DHIS2PivotTable.d.ts","sourceRoot":"","sources":["../../../../src/components/DHIS2PivotTable/DHIS2PivotTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAO3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACtC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzC,MAAM,EAAE;QACP,MAAM,EAAE;YACP,OAAO,EAAE;gBACR,SAAS,EAAE,cAAc,CAAC;gBAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;aACf,EAAE,CAAC;YACJ,IAAI,EAAE;gBACL,SAAS,EAAE,cAAc,CAAC;gBAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;aACf,EAAE,CAAC;YACJ,MAAM,CAAC,EAAE;gBACR,SAAS,EAAE,cAAc,CAAC;gBAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;aACf,EAAE,CAAC;SACJ,CAAC;QACF,OAAO,CAAC,EAAE,sBAAsB,CAAC;KACjC,CAAC;CACF;AAED,wBAAgB,eAAe,CAAC,EAC/B,SAAS,EACT,MAAM,EACN,UAAU,EACV,MAAM,GACN,EAAE,oBAAoB,8CActB"}
@@ -4,6 +4,7 @@ export type PivotTableLayoutProps = DataTableProps;
4
4
  export interface PivotTableProps {
5
5
  children: React.ReactNode;
6
6
  tableProps?: DataTableProps;
7
+ setRef?: (ref: HTMLTableElement) => void;
7
8
  }
8
- export declare function PivotTable({ tableProps, children }: PivotTableProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function PivotTable({ tableProps, children, setRef }: PivotTableProps): import("react/jsx-runtime").JSX.Element;
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/DHIS2PivotTable/components/Table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,cAAc,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED,wBAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,eAAe,2CAEnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/DHIS2PivotTable/components/Table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,cAAc,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACzC;AAED,wBAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe,2CAU3E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hisptz/dhis2-analytics",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -36,8 +36,8 @@
36
36
  "tsup": "^8.0.1",
37
37
  "typescript": "^5.3.3",
38
38
  "usehooks-ts": "^2.9.2",
39
- "@repo/eslint-config": "0.0.0",
40
- "@repo/typescript-config": "0.0.0"
39
+ "@repo/typescript-config": "0.0.0",
40
+ "@repo/eslint-config": "0.0.0"
41
41
  },
42
42
  "dependencies": {
43
43
  "@react-leaflet/core": "^2.1.0",
@@ -55,8 +55,8 @@
55
55
  "react-query": "^3.39.3",
56
56
  "react-spring": "^9.6.1",
57
57
  "screenfull": "^6.0.2",
58
- "@hisptz/dhis2-utils": "2.0.3",
59
- "@hisptz/dhis2-ui": "2.0.3"
58
+ "@hisptz/dhis2-utils": "2.0.4",
59
+ "@hisptz/dhis2-ui": "2.0.4"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@dhis2/app-runtime": "^3.10.2",