@cellaware/utils 8.3.0 → 8.3.1

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.
@@ -124,7 +124,7 @@ export declare function codifyCondition(condition: DatagridCondition): string;
124
124
  */
125
125
  export declare function stripNumericValueFormat(value: string | number | undefined): any;
126
126
  export declare function transformDatagrid(rows: any[], datagridState: DatagridStateBase, locale: string, condition?: DatagridCondition): DatagridState;
127
- export declare function datagridToString(datagridState: DatagridState): {
127
+ export declare function datagridToString(datagridState: DatagridState, rowCnt?: number): {
128
128
  html: string;
129
129
  markdown: string;
130
130
  };
@@ -830,7 +830,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
830
830
  }
831
831
  return { ...datagridState, adjRowData: rows, chartRowData };
832
832
  }
833
- export function datagridToString(datagridState) {
833
+ export function datagridToString(datagridState, rowCnt) {
834
834
  let htmlBuf = '';
835
835
  let markdownBuf = '';
836
836
  if (datagridState.adjRowData.length === 0) {
@@ -846,6 +846,8 @@ export function datagridToString(datagridState) {
846
846
  markdown: markdownBuf
847
847
  };
848
848
  }
849
+ const totalRowCnt = datagridState.adjRowData.length;
850
+ rowCnt = rowCnt ?? totalRowCnt;
849
851
  // Header:
850
852
  htmlBuf += '<table>\n\t<thead>\n\t\t<tr>';
851
853
  let columns = [];
@@ -864,6 +866,9 @@ export function datagridToString(datagridState) {
864
866
  htmlBuf += '\n\t<tbody>';
865
867
  let rowIdx = 0;
866
868
  for (const row of datagridState.adjRowData) {
869
+ if (rowIdx >= rowCnt) {
870
+ break;
871
+ }
867
872
  let colIdx = 0;
868
873
  const rowStyles = [];
869
874
  const colStyles = [];
@@ -923,6 +928,10 @@ export function datagridToString(datagridState) {
923
928
  rowIdx++;
924
929
  }
925
930
  htmlBuf += '\n\t</tbody>\n</table>';
931
+ if (rowCnt < totalRowCnt) {
932
+ htmlBuf += `<b>Only the first ${rowCnt} are shown.</b>`;
933
+ markdownBuf += `\n**Only the first ${rowCnt} are shown.**\n\n`;
934
+ }
926
935
  return {
927
936
  html: htmlBuf,
928
937
  markdown: markdownBuf
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.3.0",
3
+ "version": "8.3.1",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",