@cellaware/utils 8.6.21 → 8.6.23
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/chatwms/datagrid.js +10 -14
- package/dist/chatwms/integration.d.ts +5 -0
- package/dist/chatwms/integration.js +1 -0
- package/dist/chatwms/teams.d.ts +0 -1
- package/dist/chatwms/teams.js +1 -1
- package/dist/util.d.ts +8 -0
- package/dist/util.js +21 -0
- package/package.json +1 -1
package/dist/chatwms/datagrid.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDateString } from "../util.js";
|
|
1
|
+
import { isDateString, truncateValue } from "../util.js";
|
|
2
2
|
import { CHATWMS_DEFAULT_LANGUAGE } from "./user.js";
|
|
3
3
|
export function initDatagridState() {
|
|
4
4
|
return {
|
|
@@ -947,7 +947,7 @@ export function mapTeamsStyles(columnNames, htmlRowStyles, htmlColumnStyles, tea
|
|
|
947
947
|
function buildHtmlTableHeader(columnNames) {
|
|
948
948
|
let buf = '<table>\n\t<thead>\n\t\t<tr>';
|
|
949
949
|
for (const columnName of columnNames) {
|
|
950
|
-
buf += `\n\t\t\t<th>${columnName}</th>`;
|
|
950
|
+
buf += `\n\t\t\t<th>${truncateValue(columnName, 24)}</th>`;
|
|
951
951
|
}
|
|
952
952
|
buf += '\n\t\t</tr>\n\t</thead>';
|
|
953
953
|
buf += '\n\t<tbody>';
|
|
@@ -971,11 +971,12 @@ function buildHtmlRow(rowValues, rowStyles, columnStyles, columnCount) {
|
|
|
971
971
|
if (colIdx >= columnCount) {
|
|
972
972
|
break;
|
|
973
973
|
}
|
|
974
|
+
const truncValue = truncateValue(rowValue, 24);
|
|
974
975
|
if (columnStyles[colIdx].styles.length > 0) {
|
|
975
|
-
buf += `\n\t\t\t<td class="${columnStyles[colIdx].styles.join(' ')}">${
|
|
976
|
+
buf += `\n\t\t\t<td class="${columnStyles[colIdx].styles.join(' ')}">${truncValue}</td>`;
|
|
976
977
|
}
|
|
977
978
|
else {
|
|
978
|
-
buf += `\n\t\t\t<td>${
|
|
979
|
+
buf += `\n\t\t\t<td>${truncValue}</td>`;
|
|
979
980
|
}
|
|
980
981
|
colIdx++;
|
|
981
982
|
}
|
|
@@ -985,12 +986,9 @@ function buildHtmlRow(rowValues, rowStyles, columnStyles, columnCount) {
|
|
|
985
986
|
function createTeamsTableColumnText(columnName) {
|
|
986
987
|
return {
|
|
987
988
|
type: "TextBlock",
|
|
988
|
-
text: columnName,
|
|
989
|
+
text: truncateValue(columnName, 16),
|
|
989
990
|
size: "Small",
|
|
990
|
-
weight: "Bolder"
|
|
991
|
-
wrap: false,
|
|
992
|
-
maxLines: 1,
|
|
993
|
-
spacing: "None"
|
|
991
|
+
weight: "Bolder"
|
|
994
992
|
};
|
|
995
993
|
}
|
|
996
994
|
function createTeamsTableColumns(columnNames) {
|
|
@@ -1021,15 +1019,13 @@ function createTeamsTableCellText(value, columnStyle) {
|
|
|
1021
1019
|
italic = styles.italic;
|
|
1022
1020
|
}
|
|
1023
1021
|
}
|
|
1022
|
+
const truncValue = truncateValue(value, 16);
|
|
1024
1023
|
return {
|
|
1025
1024
|
type: "TextBlock",
|
|
1026
|
-
text: italic ? `*${
|
|
1025
|
+
text: italic ? `*${truncValue}*` : truncValue,
|
|
1027
1026
|
size: "Small",
|
|
1028
1027
|
color,
|
|
1029
|
-
weight
|
|
1030
|
-
wrap: false,
|
|
1031
|
-
maxLines: 1,
|
|
1032
|
-
spacing: "None",
|
|
1028
|
+
weight,
|
|
1033
1029
|
isSubtle
|
|
1034
1030
|
};
|
|
1035
1031
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/chatwms/teams.d.ts
CHANGED
package/dist/chatwms/teams.js
CHANGED
|
@@ -27,7 +27,7 @@ export function createTeamsTableCard(title, table, summary) {
|
|
|
27
27
|
type: "Table",
|
|
28
28
|
roundedCorners: true,
|
|
29
29
|
firstRowAsHeaders: true,
|
|
30
|
-
columns: table.length === 0 ? [] : table[0].cells.map(() => ({ width: 3 })),
|
|
30
|
+
// columns: table.length === 0 ? [] : table[0].cells.map(() => ({ width: 3 })),
|
|
31
31
|
rows: table
|
|
32
32
|
},
|
|
33
33
|
createTeamsSummaryItem(summary)
|
package/dist/util.d.ts
CHANGED
|
@@ -7,6 +7,14 @@ export declare function reverse(str: string): string;
|
|
|
7
7
|
export declare function base64Encode(str: string): string;
|
|
8
8
|
export declare function base64Decode(str: string): string;
|
|
9
9
|
export declare function isArrayLike(obj: any): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Default `idx` is 100.
|
|
12
|
+
*/
|
|
13
|
+
export declare function truncateValue(value: any, idx?: number): any;
|
|
14
|
+
/**
|
|
15
|
+
* Default `idx` is 100.
|
|
16
|
+
*/
|
|
17
|
+
export declare function truncateValuePreserveNewLines(value: string, idx?: number): string;
|
|
10
18
|
export declare function initDate(timeZone?: string): Date;
|
|
11
19
|
export declare function convertDateTimeZone(date: Date, timeZone: string): Date;
|
|
12
20
|
export declare function isDaylightSavingTime(timeZone?: string): boolean;
|
package/dist/util.js
CHANGED
|
@@ -17,6 +17,27 @@ export function isArrayLike(obj) {
|
|
|
17
17
|
obj.hasOwnProperty("length") &&
|
|
18
18
|
typeof obj.length === "number"));
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Default `idx` is 100.
|
|
22
|
+
*/
|
|
23
|
+
export function truncateValue(value, idx) {
|
|
24
|
+
if (!value || typeof value !== 'string') {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
let truncValue = truncateValuePreserveNewLines(value, idx);
|
|
28
|
+
if (truncValue.includes('\n')) {
|
|
29
|
+
truncValue = value.slice(0, truncValue.indexOf('\n')) + '...';
|
|
30
|
+
}
|
|
31
|
+
return truncValue;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Default `idx` is 100.
|
|
35
|
+
*/
|
|
36
|
+
export function truncateValuePreserveNewLines(value, idx) {
|
|
37
|
+
idx = idx ?? 100;
|
|
38
|
+
let truncValue = value.length > idx ? value.slice(0, idx) + '...' : value;
|
|
39
|
+
return truncValue;
|
|
40
|
+
}
|
|
20
41
|
// Dates --------------------------------------------------------------------------
|
|
21
42
|
export function initDate(timeZone) {
|
|
22
43
|
const date = new Date();
|