@cellaware/utils 8.6.23 → 8.6.24

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.
@@ -162,8 +162,36 @@ export interface TeamsColumnStyle {
162
162
  styles: TeamsColumnStyleAttributes[];
163
163
  }
164
164
  export declare function mapTeamsStyles(columnNames: string[], htmlRowStyles: string[], htmlColumnStyles: HtmlColumnStyle[], teamsRowStyles: string[], teamsColumnStyles: TeamsColumnStyle[]): [string[], TeamsColumnStyle[]];
165
+ export declare function createTeamsTableColumns(columnNames: string[]): {
166
+ type: string;
167
+ cells: {
168
+ type: string;
169
+ items: {
170
+ type: string;
171
+ text: any;
172
+ size: string;
173
+ weight: string;
174
+ }[];
175
+ }[];
176
+ };
177
+ export declare function createTeamsTableRow(columnNames: string[], values: any[], rowStyles?: string[], columnStyles?: TeamsColumnStyle[]): {
178
+ type: string;
179
+ style: string | undefined;
180
+ cells: {
181
+ type: string;
182
+ style: string | undefined;
183
+ items: {
184
+ type: string;
185
+ text: any;
186
+ size: string;
187
+ color: string | undefined;
188
+ weight: string | undefined;
189
+ isSubtle: true | undefined;
190
+ }[];
191
+ }[];
192
+ };
165
193
  /**
166
- * **Important:** `html` and `teamsRows` output will be limited to **1,000 rows/64 rows** and **8 columns**, respectively.
194
+ * **Important:** `html` and `teamsRows` output will be limited to **1,000 rows/24 rows** and **8 columns**, respectively.
167
195
  *
168
196
  * ~All outputs respect and will be filtered by optional `condition` argument.~
169
197
  */
@@ -991,7 +991,7 @@ function createTeamsTableColumnText(columnName) {
991
991
  weight: "Bolder"
992
992
  };
993
993
  }
994
- function createTeamsTableColumns(columnNames) {
994
+ export function createTeamsTableColumns(columnNames) {
995
995
  return {
996
996
  type: "TableRow",
997
997
  cells: columnNames.map((columnName) => ({
@@ -1029,9 +1029,9 @@ function createTeamsTableCellText(value, columnStyle) {
1029
1029
  isSubtle
1030
1030
  };
1031
1031
  }
1032
- function createTeamsTableRow(columnNames, values, rowStyles, columnStyles) {
1032
+ export function createTeamsTableRow(columnNames, values, rowStyles, columnStyles) {
1033
1033
  let rowStyle = undefined;
1034
- for (const style of rowStyles) {
1034
+ for (const style of rowStyles ?? []) {
1035
1035
  rowStyle = style;
1036
1036
  }
1037
1037
  return {
@@ -1039,7 +1039,7 @@ function createTeamsTableRow(columnNames, values, rowStyles, columnStyles) {
1039
1039
  style: rowStyle,
1040
1040
  cells: values.map((value, idx) => {
1041
1041
  const columnName = columnNames[idx];
1042
- const columnStyle = columnStyles.find(cs => cs.columnName === columnName);
1042
+ const columnStyle = columnStyles?.find(cs => cs.columnName === columnName);
1043
1043
  let style = undefined;
1044
1044
  for (const styles of columnStyle?.styles ?? []) {
1045
1045
  if (!!styles.style) {
@@ -1055,14 +1055,14 @@ function createTeamsTableRow(columnNames, values, rowStyles, columnStyles) {
1055
1055
  };
1056
1056
  }
1057
1057
  /**
1058
- * **Important:** `html` and `teamsRows` output will be limited to **1,000 rows/64 rows** and **8 columns**, respectively.
1058
+ * **Important:** `html` and `teamsRows` output will be limited to **1,000 rows/24 rows** and **8 columns**, respectively.
1059
1059
  *
1060
1060
  * ~All outputs respect and will be filtered by optional `condition` argument.~
1061
1061
  */
1062
1062
  export function transformDatagrid(rows, datagridState, locale, condition) {
1063
1063
  const HTML_ROWS = 1000;
1064
1064
  const HTML_COLS = 8;
1065
- const TEAMS_ROWS = 64;
1065
+ const TEAMS_ROWS = 24;
1066
1066
  const columnState = datagridState.columnState ?? [];
1067
1067
  const filterModel = datagridState.filterModel ?? {};
1068
1068
  const isPivotMode = !!datagridState.isPivotMode;
@@ -1,3 +1,30 @@
1
+ export declare function createTeamsTableItem(rows: any[]): ({
2
+ type: string;
3
+ cells: {
4
+ type: string;
5
+ items: {
6
+ type: string;
7
+ text: any;
8
+ size: string;
9
+ weight: string;
10
+ }[];
11
+ }[];
12
+ } | {
13
+ type: string;
14
+ style: string | undefined;
15
+ cells: {
16
+ type: string;
17
+ style: string | undefined;
18
+ items: {
19
+ type: string;
20
+ text: any;
21
+ size: string;
22
+ color: string | undefined;
23
+ weight: string | undefined;
24
+ isSubtle: true | undefined;
25
+ }[];
26
+ }[];
27
+ })[];
1
28
  export declare function createTeamsTableCard(title: string, table: any[], summary: string): {
2
29
  type: string;
3
30
  version: string;
@@ -1,4 +1,4 @@
1
- import { mapTeamsStyles } from "./datagrid.js";
1
+ import { createTeamsTableColumns, createTeamsTableRow, mapTeamsStyles } from "./datagrid.js";
2
2
  function createTeamsTitleItem(title) {
3
3
  return {
4
4
  type: "TextBlock",
@@ -16,6 +16,17 @@ function createTeamsSummaryItem(summary) {
16
16
  wrap: true
17
17
  };
18
18
  }
19
+ export function createTeamsTableItem(rows) {
20
+ if (rows.length === 0) {
21
+ return [];
22
+ }
23
+ const columnNames = Object.keys(rows[0]);
24
+ const teamsRows = rows.map(row => createTeamsTableRow(columnNames, columnNames.map(col => row[col])));
25
+ return [
26
+ createTeamsTableColumns(columnNames),
27
+ ...teamsRows
28
+ ];
29
+ }
19
30
  export function createTeamsTableCard(title, table, summary) {
20
31
  return {
21
32
  type: "AdaptiveCard",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "8.6.23",
3
+ "version": "8.6.24",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",