@cellaware/utils 8.3.0 → 8.3.2
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
|
};
|
package/dist/chatwms/datagrid.js
CHANGED
|
@@ -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,11 @@ export function datagridToString(datagridState) {
|
|
|
923
928
|
rowIdx++;
|
|
924
929
|
}
|
|
925
930
|
htmlBuf += '\n\t</tbody>\n</table>';
|
|
931
|
+
if (rowCnt < totalRowCnt) {
|
|
932
|
+
const message = `Displaying the first ${rowCnt} rows.`;
|
|
933
|
+
htmlBuf += `<b style="position: relative; top: -8px; left: 8px; font-style: italic;">${message}</b>`;
|
|
934
|
+
markdownBuf += `\n**${message}**\n\n`;
|
|
935
|
+
}
|
|
926
936
|
return {
|
|
927
937
|
html: htmlBuf,
|
|
928
938
|
markdown: markdownBuf
|