@quillsql/react 2.16.12 → 2.16.14

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/index.cjs CHANGED
@@ -24491,8 +24491,9 @@ async function getExportData(client, dashboardFilters, reportId, getToken, event
24491
24491
  }) : [];
24492
24492
  const fetchResp = await quillFetch({
24493
24493
  client,
24494
- task: "item",
24494
+ task: "report",
24495
24495
  metadata: {
24496
+ reportId,
24496
24497
  dashboardItemId: reportId,
24497
24498
  clientId: client.publicKey,
24498
24499
  databaseType: client?.databaseType,
@@ -24503,9 +24504,19 @@ async function getExportData(client, dashboardFilters, reportId, getToken, event
24503
24504
  },
24504
24505
  getToken
24505
24506
  });
24506
- const resp = await parseFetchResponse(client, "item", fetchResp, getToken);
24507
+ const resp = await parseFetchResponse(client, "report", fetchResp, getToken);
24508
+ const candidateItem = resp && resp?.rows !== void 0 ? resp : resp?.item ?? resp?.report ?? resp?.data ?? resp;
24507
24509
  const cleanedReport = await cleanDashboardItem({
24508
- item: resp,
24510
+ item: candidateItem ?? {
24511
+ _id: resp?._id ?? reportId,
24512
+ id: resp?.id ?? reportId,
24513
+ name: resp?.name,
24514
+ rows: resp?.rows ?? [],
24515
+ columns: resp?.columns ?? [],
24516
+ fields: resp?.fields ?? [],
24517
+ pivotRows: resp?.pivotRows ?? [],
24518
+ pivotColumns: resp?.pivotColumns ?? []
24519
+ },
24509
24520
  dashboardFilters,
24510
24521
  client,
24511
24522
  customFields,
@@ -24588,10 +24599,14 @@ var useExport = (reportId, {
24588
24599
  flags,
24589
24600
  schemaData?.customFields
24590
24601
  );
24602
+ const exportRows = resp?.pivot && resp?.pivotRows && downloadOptions?.usePivotRows ? resp.pivotRows : resp?.rows;
24603
+ const exportFields = resp?.pivot && resp?.pivotColumns && downloadOptions?.usePivotRows ? resp.pivotColumns : resp?.columns;
24604
+ const rowsToExport = exportRows && exportRows.length > 0 ? exportRows : dashboardReport?.rows ?? dashboardReport?.pivotRows ?? [];
24605
+ const fieldsToExport = exportFields && exportFields.length > 0 ? exportFields : dashboardReport?.columns ?? dashboardReport?.pivotColumns ?? [];
24591
24606
  downloadCSV({
24592
- rows: resp.pivot && resp.pivotRows && downloadOptions?.usePivotRows ? resp.pivotRows : resp.rows,
24593
- fields: resp.pivot && resp.pivotColumns && downloadOptions?.usePivotRows ? resp.pivotColumns : resp.columns,
24594
- name: resp.name
24607
+ rows: rowsToExport ?? [],
24608
+ fields: fieldsToExport,
24609
+ name: resp?.name || dashboardReport?.name || reports?.[reportId]?.name || "report"
24595
24610
  });
24596
24611
  setIsCSVLoading(false);
24597
24612
  },
@@ -53450,12 +53465,15 @@ var CHART_TYPE_STYLES = {
53450
53465
  table: { height: "700px", width: "1000px" }
53451
53466
  };
53452
53467
  var DEFAULT_STYLE = { height: "400px", width: "600px" };
53453
- function StaticChart({
53454
- reportId,
53455
- onClickChartElement,
53456
- containerStyle,
53457
- showLegend = false
53458
- }) {
53468
+ var MIN_CHART_HEIGHT_PX = 240;
53469
+ function StaticChart(props) {
53470
+ const {
53471
+ reportId,
53472
+ onClickChartElement,
53473
+ containerStyle,
53474
+ showLegend = false,
53475
+ className
53476
+ } = props;
53459
53477
  const {
53460
53478
  report,
53461
53479
  loading,
@@ -53465,9 +53483,15 @@ function StaticChart({
53465
53483
  prevPage,
53466
53484
  sortRows
53467
53485
  } = useDashboardReportInternal(reportId);
53468
- const mergedStyle = {
53469
- ...report?.chartType ? CHART_TYPE_STYLES[report.chartType] || DEFAULT_STYLE : DEFAULT_STYLE,
53470
- ...containerStyle
53486
+ const baseStyle = report?.chartType && CHART_TYPE_STYLES[report.chartType] ? CHART_TYPE_STYLES[report.chartType] : DEFAULT_STYLE;
53487
+ const mergedStyle = className ? { ...containerStyle ?? {} } : { ...baseStyle, ...containerStyle ?? {} };
53488
+ const safeContainerStyle = {
53489
+ ...mergedStyle,
53490
+ // Avoid enforcing a fallback minHeight when a className is meant to set
53491
+ // the sizing via CSS. Only apply the safety net when className is absent.
53492
+ ...!className && {
53493
+ minHeight: mergedStyle.minHeight ?? (typeof mergedStyle.height === "number" && mergedStyle.height > 0 ? mergedStyle.height : typeof mergedStyle.height === "string" ? mergedStyle.height.trim().endsWith("%") ? `${MIN_CHART_HEIGHT_PX}px` : mergedStyle.height : `${MIN_CHART_HEIGHT_PX}px`)
53494
+ }
53471
53495
  };
53472
53496
  const onPageChange = (page) => {
53473
53497
  if (page == pageNumber - 1) {
@@ -53492,7 +53516,8 @@ function StaticChart({
53492
53516
  } : void 0,
53493
53517
  onClickChartElement,
53494
53518
  loading,
53495
- containerStyle: mergedStyle,
53519
+ className,
53520
+ containerStyle: safeContainerStyle,
53496
53521
  showLegend,
53497
53522
  onPageChange,
53498
53523
  tableRowsLoading: pageLoading,
package/dist/index.d.cts CHANGED
@@ -2503,13 +2503,22 @@ interface ChartEditorProps {
2503
2503
  */
2504
2504
  declare function ChartEditor({ isOpen, reportId, isAdmin, chartBuilderTitle, chartBuilderButtonLabel, onAddToDashboardComplete, onSubmitEditReport, onDiscardChanges, destinationDashboard, destinationSection, organizationName, isHorizontalView, onDelete, setIsOpen, SelectComponent, TextInputComponent, ButtonComponent, SecondaryButtonComponent, HeaderComponent, SubHeaderComponent, LabelComponent, TextComponent, DeleteButtonComponent, ModalComponent, CardComponent, PopoverComponent, LoadingComponent, TableComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, ErrorMessageComponent, ChartBuilderFormContainer, ErrorComponent, hideDeleteButton, hideSubmitButton, showTableFormatOptions, showDashboardFilterFields, chartBuilderOptions, onClickChartElement, onClickChartError, }: ChartEditorProps): react_jsx_runtime.JSX.Element;
2505
2505
 
2506
- interface StaticChartProps {
2506
+ interface StaticChartBaseProps {
2507
2507
  reportId: string;
2508
2508
  onClickChartElement?: (data: any) => void;
2509
- containerStyle?: React.CSSProperties;
2510
2509
  showLegend?: boolean;
2511
2510
  }
2512
- declare function StaticChart({ reportId, onClickChartElement, containerStyle, showLegend, }: StaticChartProps): react_jsx_runtime.JSX.Element;
2511
+ type StaticChartProps = (StaticChartBaseProps & {
2512
+ className: string;
2513
+ containerStyle?: never;
2514
+ }) | (StaticChartBaseProps & {
2515
+ containerStyle: React.CSSProperties;
2516
+ className?: never;
2517
+ }) | (StaticChartBaseProps & {
2518
+ className?: undefined;
2519
+ containerStyle?: undefined;
2520
+ });
2521
+ declare function StaticChart(props: StaticChartProps): react_jsx_runtime.JSX.Element;
2513
2522
 
2514
2523
  declare const quillFormat: ({ value, format, }: {
2515
2524
  value: any;
package/dist/index.d.ts CHANGED
@@ -2503,13 +2503,22 @@ interface ChartEditorProps {
2503
2503
  */
2504
2504
  declare function ChartEditor({ isOpen, reportId, isAdmin, chartBuilderTitle, chartBuilderButtonLabel, onAddToDashboardComplete, onSubmitEditReport, onDiscardChanges, destinationDashboard, destinationSection, organizationName, isHorizontalView, onDelete, setIsOpen, SelectComponent, TextInputComponent, ButtonComponent, SecondaryButtonComponent, HeaderComponent, SubHeaderComponent, LabelComponent, TextComponent, DeleteButtonComponent, ModalComponent, CardComponent, PopoverComponent, LoadingComponent, TableComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, ErrorMessageComponent, ChartBuilderFormContainer, ErrorComponent, hideDeleteButton, hideSubmitButton, showTableFormatOptions, showDashboardFilterFields, chartBuilderOptions, onClickChartElement, onClickChartError, }: ChartEditorProps): react_jsx_runtime.JSX.Element;
2505
2505
 
2506
- interface StaticChartProps {
2506
+ interface StaticChartBaseProps {
2507
2507
  reportId: string;
2508
2508
  onClickChartElement?: (data: any) => void;
2509
- containerStyle?: React.CSSProperties;
2510
2509
  showLegend?: boolean;
2511
2510
  }
2512
- declare function StaticChart({ reportId, onClickChartElement, containerStyle, showLegend, }: StaticChartProps): react_jsx_runtime.JSX.Element;
2511
+ type StaticChartProps = (StaticChartBaseProps & {
2512
+ className: string;
2513
+ containerStyle?: never;
2514
+ }) | (StaticChartBaseProps & {
2515
+ containerStyle: React.CSSProperties;
2516
+ className?: never;
2517
+ }) | (StaticChartBaseProps & {
2518
+ className?: undefined;
2519
+ containerStyle?: undefined;
2520
+ });
2521
+ declare function StaticChart(props: StaticChartProps): react_jsx_runtime.JSX.Element;
2513
2522
 
2514
2523
  declare const quillFormat: ({ value, format, }: {
2515
2524
  value: any;
package/dist/index.js CHANGED
@@ -24511,8 +24511,9 @@ async function getExportData(client, dashboardFilters, reportId, getToken, event
24511
24511
  }) : [];
24512
24512
  const fetchResp = await quillFetch({
24513
24513
  client,
24514
- task: "item",
24514
+ task: "report",
24515
24515
  metadata: {
24516
+ reportId,
24516
24517
  dashboardItemId: reportId,
24517
24518
  clientId: client.publicKey,
24518
24519
  databaseType: client?.databaseType,
@@ -24523,9 +24524,19 @@ async function getExportData(client, dashboardFilters, reportId, getToken, event
24523
24524
  },
24524
24525
  getToken
24525
24526
  });
24526
- const resp = await parseFetchResponse(client, "item", fetchResp, getToken);
24527
+ const resp = await parseFetchResponse(client, "report", fetchResp, getToken);
24528
+ const candidateItem = resp && resp?.rows !== void 0 ? resp : resp?.item ?? resp?.report ?? resp?.data ?? resp;
24527
24529
  const cleanedReport = await cleanDashboardItem({
24528
- item: resp,
24530
+ item: candidateItem ?? {
24531
+ _id: resp?._id ?? reportId,
24532
+ id: resp?.id ?? reportId,
24533
+ name: resp?.name,
24534
+ rows: resp?.rows ?? [],
24535
+ columns: resp?.columns ?? [],
24536
+ fields: resp?.fields ?? [],
24537
+ pivotRows: resp?.pivotRows ?? [],
24538
+ pivotColumns: resp?.pivotColumns ?? []
24539
+ },
24529
24540
  dashboardFilters,
24530
24541
  client,
24531
24542
  customFields,
@@ -24608,10 +24619,14 @@ var useExport = (reportId, {
24608
24619
  flags,
24609
24620
  schemaData?.customFields
24610
24621
  );
24622
+ const exportRows = resp?.pivot && resp?.pivotRows && downloadOptions?.usePivotRows ? resp.pivotRows : resp?.rows;
24623
+ const exportFields = resp?.pivot && resp?.pivotColumns && downloadOptions?.usePivotRows ? resp.pivotColumns : resp?.columns;
24624
+ const rowsToExport = exportRows && exportRows.length > 0 ? exportRows : dashboardReport?.rows ?? dashboardReport?.pivotRows ?? [];
24625
+ const fieldsToExport = exportFields && exportFields.length > 0 ? exportFields : dashboardReport?.columns ?? dashboardReport?.pivotColumns ?? [];
24611
24626
  downloadCSV({
24612
- rows: resp.pivot && resp.pivotRows && downloadOptions?.usePivotRows ? resp.pivotRows : resp.rows,
24613
- fields: resp.pivot && resp.pivotColumns && downloadOptions?.usePivotRows ? resp.pivotColumns : resp.columns,
24614
- name: resp.name
24627
+ rows: rowsToExport ?? [],
24628
+ fields: fieldsToExport,
24629
+ name: resp?.name || dashboardReport?.name || reports?.[reportId]?.name || "report"
24615
24630
  });
24616
24631
  setIsCSVLoading(false);
24617
24632
  },
@@ -53643,12 +53658,15 @@ var CHART_TYPE_STYLES = {
53643
53658
  table: { height: "700px", width: "1000px" }
53644
53659
  };
53645
53660
  var DEFAULT_STYLE = { height: "400px", width: "600px" };
53646
- function StaticChart({
53647
- reportId,
53648
- onClickChartElement,
53649
- containerStyle,
53650
- showLegend = false
53651
- }) {
53661
+ var MIN_CHART_HEIGHT_PX = 240;
53662
+ function StaticChart(props) {
53663
+ const {
53664
+ reportId,
53665
+ onClickChartElement,
53666
+ containerStyle,
53667
+ showLegend = false,
53668
+ className
53669
+ } = props;
53652
53670
  const {
53653
53671
  report,
53654
53672
  loading,
@@ -53658,9 +53676,15 @@ function StaticChart({
53658
53676
  prevPage,
53659
53677
  sortRows
53660
53678
  } = useDashboardReportInternal(reportId);
53661
- const mergedStyle = {
53662
- ...report?.chartType ? CHART_TYPE_STYLES[report.chartType] || DEFAULT_STYLE : DEFAULT_STYLE,
53663
- ...containerStyle
53679
+ const baseStyle = report?.chartType && CHART_TYPE_STYLES[report.chartType] ? CHART_TYPE_STYLES[report.chartType] : DEFAULT_STYLE;
53680
+ const mergedStyle = className ? { ...containerStyle ?? {} } : { ...baseStyle, ...containerStyle ?? {} };
53681
+ const safeContainerStyle = {
53682
+ ...mergedStyle,
53683
+ // Avoid enforcing a fallback minHeight when a className is meant to set
53684
+ // the sizing via CSS. Only apply the safety net when className is absent.
53685
+ ...!className && {
53686
+ minHeight: mergedStyle.minHeight ?? (typeof mergedStyle.height === "number" && mergedStyle.height > 0 ? mergedStyle.height : typeof mergedStyle.height === "string" ? mergedStyle.height.trim().endsWith("%") ? `${MIN_CHART_HEIGHT_PX}px` : mergedStyle.height : `${MIN_CHART_HEIGHT_PX}px`)
53687
+ }
53664
53688
  };
53665
53689
  const onPageChange = (page) => {
53666
53690
  if (page == pageNumber - 1) {
@@ -53685,7 +53709,8 @@ function StaticChart({
53685
53709
  } : void 0,
53686
53710
  onClickChartElement,
53687
53711
  loading,
53688
- containerStyle: mergedStyle,
53712
+ className,
53713
+ containerStyle: safeContainerStyle,
53689
53714
  showLegend,
53690
53715
  onPageChange,
53691
53716
  tableRowsLoading: pageLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.12",
3
+ "version": "2.16.14",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {