@cellaware/utils 8.11.3 → 8.11.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.
@@ -196,12 +196,12 @@ export declare function createTeamsTableRow(columnNames: string[], values: any[]
196
196
  }[];
197
197
  }[];
198
198
  };
199
- export declare function createTeamsTransposeTableRow(row: {
199
+ export declare function createTeamsTransposeColumnSet(row: {
200
200
  key: string;
201
201
  value: any;
202
202
  }, columnStyle: TeamsColumnStyle): {
203
203
  type: string;
204
- cells: any[];
204
+ columns: any[];
205
205
  };
206
206
  /**
207
207
  * **Important:** `html` and `teamsRows` output will be limited to **1,000 rows/24 rows** and **8 columns**, respectively.
@@ -1143,6 +1143,36 @@ function createTeamsTableCellText(value, columnStyle) {
1143
1143
  isSubtle
1144
1144
  };
1145
1145
  }
1146
+ function createTeamsTransposeColumnText(value, key, columnStyle) {
1147
+ // Same as ^^^, just a couple minor tweaks.
1148
+ let color = undefined;
1149
+ let weight = undefined;
1150
+ let isSubtle = undefined;
1151
+ let italic = undefined;
1152
+ for (const styles of columnStyle?.styles ?? []) {
1153
+ if (!!styles.color) {
1154
+ color = styles.color;
1155
+ }
1156
+ if (!!styles.weight) {
1157
+ weight = styles.weight;
1158
+ }
1159
+ if (!!styles.isSubtle) {
1160
+ isSubtle = styles.isSubtle;
1161
+ }
1162
+ if (!!styles.italic) {
1163
+ italic = styles.italic;
1164
+ }
1165
+ }
1166
+ const truncValue = truncateValue(value, 16);
1167
+ return {
1168
+ type: "TextBlock",
1169
+ text: italic ? `*${truncValue}*` : truncValue,
1170
+ size: key ? "Medium" : "Large",
1171
+ color,
1172
+ weight,
1173
+ isSubtle
1174
+ };
1175
+ }
1146
1176
  export function createTeamsTableRow(columnNames, values, rowStyles, columnStyles) {
1147
1177
  let rowStyle = undefined;
1148
1178
  for (const style of rowStyles ?? []) {
@@ -1168,21 +1198,28 @@ export function createTeamsTableRow(columnNames, values, rowStyles, columnStyles
1168
1198
  })
1169
1199
  };
1170
1200
  }
1171
- export function createTeamsTransposeTableRow(row, columnStyle) {
1172
- const keyCell = {
1173
- type: "TableCell",
1174
- items: [createTeamsTableCellText(row.key, {
1201
+ export function createTeamsTransposeColumnSet(row, columnStyle) {
1202
+ const keyColumn = {
1203
+ type: "Column",
1204
+ items: [createTeamsTransposeColumnText(row.key, true, {
1175
1205
  columnName: 'key',
1176
1206
  styles: [{ weight: 'Bolder' }]
1177
1207
  })]
1178
1208
  };
1179
- const valueCell = {
1180
- type: "TableCell",
1181
- items: [createTeamsTableCellText(row.value, columnStyle)]
1209
+ let style = undefined;
1210
+ for (const styles of columnStyle?.styles ?? []) {
1211
+ if (!!styles.style) {
1212
+ style = styles.style;
1213
+ }
1214
+ }
1215
+ const valueColumn = {
1216
+ type: "Column",
1217
+ style,
1218
+ items: [createTeamsTransposeColumnText(row.value, false, columnStyle)]
1182
1219
  };
1183
1220
  return {
1184
- type: "TableRow",
1185
- cells: [keyCell, valueCell]
1221
+ type: "ColumnSet",
1222
+ columns: [keyColumn, valueColumn]
1186
1223
  };
1187
1224
  }
1188
1225
  /**
@@ -1287,7 +1324,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
1287
1324
  }));
1288
1325
  for (let i = 0; i < transposedRows.length; i++) {
1289
1326
  htmlTransposeBuf += buildHtmlTransposeRow(transposedRows[i], htmlTransposeColumnStyles[i]);
1290
- teamsTranspose.push(createTeamsTransposeTableRow(transposedRows[i], mapTeamsTransposeStyles(htmlTransposeColumnStyles[i])));
1327
+ teamsTranspose.push(createTeamsTransposeColumnSet(transposedRows[i], mapTeamsTransposeStyles(htmlTransposeColumnStyles[i])));
1291
1328
  }
1292
1329
  }
1293
1330
  rowIdx++;
@@ -1346,7 +1383,7 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
1346
1383
  }));
1347
1384
  for (let i = 0; i < transposedRows.length; i++) {
1348
1385
  htmlTransposeBuf += buildHtmlTransposeRow(transposedRows[i], htmlTransposeColumnStyles[i]);
1349
- teamsTranspose.push(createTeamsTransposeTableRow(transposedRows[i], mapTeamsTransposeStyles(htmlTransposeColumnStyles[i])));
1386
+ teamsTranspose.push(createTeamsTransposeColumnSet(transposedRows[i], mapTeamsTransposeStyles(htmlTransposeColumnStyles[i])));
1350
1387
  }
1351
1388
  }
1352
1389
  rowIdx++;
@@ -118,6 +118,30 @@ export declare function createTeamsReportValueCard(lineTitle: string, columnName
118
118
  }[];
119
119
  })[];
120
120
  };
121
+ export declare function createTeamsReportRowCard(lineTitle: string, columnSets: any[], summary: string, reportTitle: string): {
122
+ type: string;
123
+ version: string;
124
+ msteams: {
125
+ width: string;
126
+ };
127
+ body: ({
128
+ type: string;
129
+ facts: {
130
+ title: string;
131
+ value: string;
132
+ }[];
133
+ } | {
134
+ type: string;
135
+ text: string;
136
+ size: string;
137
+ isSubtle: boolean;
138
+ wrap: boolean;
139
+ } | {
140
+ type: string;
141
+ roundedCorners: boolean;
142
+ items: any[];
143
+ })[];
144
+ };
121
145
  export declare function createTeamsReportChartCard(lineTitle: string, png: string, summary: string, reportTitle: string): {
122
146
  type: string;
123
147
  version: string;
@@ -136,6 +136,22 @@ export function createTeamsReportValueCard(lineTitle, columnName, value, styles,
136
136
  ]
137
137
  };
138
138
  }
139
+ export function createTeamsReportRowCard(lineTitle, columnSets, summary, reportTitle) {
140
+ return {
141
+ type: "AdaptiveCard",
142
+ version: "1.5",
143
+ msteams: { width: "Full" },
144
+ body: [
145
+ createTeamsTitleItem(reportTitle, lineTitle),
146
+ {
147
+ type: "Container",
148
+ roundedCorners: true,
149
+ items: columnSets
150
+ },
151
+ createTeamsSummaryItem(summary)
152
+ ]
153
+ };
154
+ }
139
155
  export function createTeamsReportChartCard(lineTitle, png, summary, reportTitle) {
140
156
  return {
141
157
  type: "AdaptiveCard",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.11.3",
3
+ "version": "8.11.5",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",