@topconsultnpm/sdkui-react-beta 6.14.37 → 6.14.39
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/lib/components/base/TMFileManagerUtils.js +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/helper/TMUtils.d.ts +5 -0
- package/lib/helper/TMUtils.js +20 -0
- package/package.json +1 -1
- package/lib/utils/TMUtils.d.ts +0 -5
- package/lib/utils/TMUtils.js +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { associateColumnsToRows } from "../../
|
|
1
|
+
import { associateColumnsToRows } from "../../helper";
|
|
2
2
|
// Function to find a specific file or folder based on its ID (used for finding nested items)
|
|
3
3
|
export const findFileItems = (items, id) => {
|
|
4
4
|
for (let item of items) {
|
|
@@ -76,6 +76,7 @@ export * from "./base/TMDeviceProvider";
|
|
|
76
76
|
export { default as TMDataGrid } from "./base/TMDataGrid";
|
|
77
77
|
export { default as TMFileManager } from "./base/TMFileManager";
|
|
78
78
|
export { default as TMFileManagerThumbnailItems } from "./base/TMFileManagerThumbnailItems";
|
|
79
|
+
export * from "./base/TMFileManagerUtils";
|
|
79
80
|
export { default as TMCounterContainer } from "./base/TMCounterContainer";
|
|
80
81
|
export * from "./base/TMCounterContainer";
|
|
81
82
|
export { default as TMAreaManager } from "./base/TMAreaManager";
|
package/lib/components/index.js
CHANGED
|
@@ -91,6 +91,7 @@ export * from "./base/TMDeviceProvider";
|
|
|
91
91
|
export { default as TMDataGrid } from "./base/TMDataGrid";
|
|
92
92
|
export { default as TMFileManager } from "./base/TMFileManager";
|
|
93
93
|
export { default as TMFileManagerThumbnailItems } from "./base/TMFileManagerThumbnailItems";
|
|
94
|
+
export * from "./base/TMFileManagerUtils";
|
|
94
95
|
export { default as TMCounterContainer } from "./base/TMCounterContainer";
|
|
95
96
|
export * from "./base/TMCounterContainer";
|
|
96
97
|
export { default as TMAreaManager } from "./base/TMAreaManager";
|
package/lib/helper/TMUtils.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import { DataColumnDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
|
1
2
|
export declare const getFileIcon: (fileExtension: string | undefined, fileCount: number | undefined, tooltipContent?: JSX.Element | string) => import("react/jsx-runtime").JSX.Element;
|
|
2
3
|
export declare function formatBytes(bytes: number | undefined, decimalPlaces?: number): string;
|
|
4
|
+
export interface RowData {
|
|
5
|
+
[key: string]: string | number | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const associateColumnsToRows: (columns: Array<DataColumnDescriptor> | undefined, rows: Array<Array<string>> | undefined) => Array<RowData>;
|
package/lib/helper/TMUtils.js
CHANGED
|
@@ -95,3 +95,23 @@ export function formatBytes(bytes, decimalPlaces = 2) {
|
|
|
95
95
|
const value = parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces));
|
|
96
96
|
return `${value} ${units[i]}`;
|
|
97
97
|
}
|
|
98
|
+
// Function to associate columns to rows and return an array of RowData objects
|
|
99
|
+
export const associateColumnsToRows = (columns, rows) => {
|
|
100
|
+
if (columns === undefined || rows === undefined)
|
|
101
|
+
return [];
|
|
102
|
+
// Map over each row and associate each value with the corresponding column's caption
|
|
103
|
+
return rows.map(row => {
|
|
104
|
+
// Create an empty object to hold the key-value pairs for each row
|
|
105
|
+
const rowObject = {};
|
|
106
|
+
// Loop through each cell in the row and map its value to the corresponding column's caption
|
|
107
|
+
row.forEach((value, index) => {
|
|
108
|
+
const column = columns[index]; // Get the column corresponding to the current index
|
|
109
|
+
// If a column exists at this index, add the value to the rowObject with the column's caption as the key
|
|
110
|
+
if (column && column.caption) {
|
|
111
|
+
rowObject[column.caption] = value;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
// Return the populated rowObject, which represents the row with columns as keys
|
|
115
|
+
return rowObject;
|
|
116
|
+
});
|
|
117
|
+
};
|
package/package.json
CHANGED
package/lib/utils/TMUtils.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { DataColumnDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
|
2
|
-
export interface RowData {
|
|
3
|
-
[key: string]: string | number | null;
|
|
4
|
-
}
|
|
5
|
-
export declare const associateColumnsToRows: (columns: Array<DataColumnDescriptor> | undefined, rows: Array<Array<string>> | undefined) => Array<RowData>;
|
package/lib/utils/TMUtils.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Function to associate columns to rows and return an array of RowData objects
|
|
2
|
-
export const associateColumnsToRows = (columns, rows) => {
|
|
3
|
-
if (columns === undefined || rows === undefined)
|
|
4
|
-
return [];
|
|
5
|
-
// Map over each row and associate each value with the corresponding column's caption
|
|
6
|
-
return rows.map(row => {
|
|
7
|
-
// Create an empty object to hold the key-value pairs for each row
|
|
8
|
-
const rowObject = {};
|
|
9
|
-
// Loop through each cell in the row and map its value to the corresponding column's caption
|
|
10
|
-
row.forEach((value, index) => {
|
|
11
|
-
const column = columns[index]; // Get the column corresponding to the current index
|
|
12
|
-
// If a column exists at this index, add the value to the rowObject with the column's caption as the key
|
|
13
|
-
if (column && column.caption) {
|
|
14
|
-
rowObject[column.caption] = value;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
// Return the populated rowObject, which represents the row with columns as keys
|
|
18
|
-
return rowObject;
|
|
19
|
-
});
|
|
20
|
-
};
|