@hpcc-js/dgrid2 2.5.3 → 2.5.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.
- package/LICENSE +43 -43
- package/README.md +5 -5
- package/dist/index.es6.js +2 -2
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/src/__package__.ts +3 -3
- package/src/hooks.ts +12 -12
- package/src/index.ts +2 -2
- package/src/reactTable.tsx +159 -159
- package/src/table.css +9 -9
- package/src/table.md +57 -57
- package/src/table.ts +92 -92
- package/types/__package__.d.ts +2 -2
- package/types/__package__.d.ts.map +1 -1
- package/types-3.4/__package__.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/dgrid2",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5",
|
|
4
4
|
"description": "hpcc-js - DGrid2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"update": "npx --yes npm-check-updates -u -t minor"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@hpcc-js/common": "^2.73.
|
|
43
|
-
"@hpcc-js/preact-shim": "^2.19.
|
|
42
|
+
"@hpcc-js/common": "^2.73.5",
|
|
43
|
+
"@hpcc-js/preact-shim": "^2.19.2",
|
|
44
44
|
"@hpcc-js/util": "^2.53.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
60
60
|
},
|
|
61
61
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "e9d09185b7cd29dce187ab524d6f03ad0e6abd0e"
|
|
63
63
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const PKG_NAME = "@hpcc-js/dgrid2";
|
|
2
|
-
export const PKG_VERSION = "2.5.
|
|
3
|
-
export const BUILD_VERSION = "2.108.
|
|
1
|
+
export const PKG_NAME = "@hpcc-js/dgrid2";
|
|
2
|
+
export const PKG_VERSION = "2.5.5";
|
|
3
|
+
export const BUILD_VERSION = "2.108.10";
|
package/src/hooks.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Widget } from "@hpcc-js/common";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
export function useData(widget: Widget): [string[], Array<string | number>[]] {
|
|
5
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6
|
-
const columns: string[] = React.useMemo(() => widget.columns(), [widget, widget.dataChecksum()]);
|
|
7
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8
|
-
const data: Array<string | number>[] = React.useMemo(() => widget.data(), [widget, widget.dataChecksum()]);
|
|
9
|
-
|
|
10
|
-
return [columns, data];
|
|
11
|
-
}
|
|
12
|
-
|
|
1
|
+
import { Widget } from "@hpcc-js/common";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
export function useData(widget: Widget): [string[], Array<string | number>[]] {
|
|
5
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6
|
+
const columns: string[] = React.useMemo(() => widget.columns(), [widget, widget.dataChecksum()]);
|
|
7
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8
|
+
const data: Array<string | number>[] = React.useMemo(() => widget.data(), [widget, widget.dataChecksum()]);
|
|
9
|
+
|
|
10
|
+
return [columns, data];
|
|
11
|
+
}
|
|
12
|
+
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./__package__";
|
|
2
|
-
export * from "./table";
|
|
1
|
+
export * from "./__package__";
|
|
2
|
+
export * from "./table";
|
package/src/reactTable.tsx
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import DataGrid, { Column, SelectColumn, SortColumn } from "react-data-grid";
|
|
3
|
-
import { format, timeFormat, timeParse } from "@hpcc-js/common";
|
|
4
|
-
import { useData } from "./hooks";
|
|
5
|
-
import type { Table } from "./table";
|
|
6
|
-
|
|
7
|
-
export type QuerySortItem = { attribute: string, descending: boolean };
|
|
8
|
-
function copyAndSort<T>(items: T[], attribute: string, descending?: boolean): T[] {
|
|
9
|
-
const key = attribute as keyof T;
|
|
10
|
-
return [...items].sort((a: T, b: T) => {
|
|
11
|
-
if (a[key] < b[key]) {
|
|
12
|
-
return descending ? 1 : -1;
|
|
13
|
-
} else if (a[key] > b[key]) {
|
|
14
|
-
return descending ? -1 : 1;
|
|
15
|
-
}
|
|
16
|
-
return 0;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface EmptyRowsRendererProps {
|
|
21
|
-
message: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const EmptyRowsRenderer: React.FunctionComponent<EmptyRowsRendererProps> = ({
|
|
25
|
-
message
|
|
26
|
-
}) => {
|
|
27
|
-
|
|
28
|
-
return <div style={{ textAlign: "center", gridColumn: "1/-1" }} >
|
|
29
|
-
{message}
|
|
30
|
-
</div>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
interface ColumnEx<TRow, TSummaryRow = unknown> extends Column<TRow, TSummaryRow> {
|
|
34
|
-
renderCell?: (props: any) => React.JSX.Element;
|
|
35
|
-
__hpcc_pattern?: ReturnType<typeof timeParse>;
|
|
36
|
-
__hpcc_format?: ReturnType<typeof format> | ReturnType<typeof timeFormat>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ReactTableProps {
|
|
40
|
-
table: Table;
|
|
41
|
-
sort?: QuerySortItem,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const ReactTable: React.FunctionComponent<ReactTableProps> = ({
|
|
45
|
-
table,
|
|
46
|
-
sort
|
|
47
|
-
}) => {
|
|
48
|
-
const [columns, data] = useData(table);
|
|
49
|
-
const multiSelect = table.multiSelect();
|
|
50
|
-
const columnTypes = table.columnTypes();
|
|
51
|
-
const columnPatterns = table.columnPatterns();
|
|
52
|
-
const columnFormats = table.columnFormats();
|
|
53
|
-
|
|
54
|
-
const [listColumns, setListColumns] = React.useState<ColumnEx<any[]>[]>([]);
|
|
55
|
-
const [sortColumn, setSortColumn] = React.useState<SortColumn>();
|
|
56
|
-
const [rows, setRows] = React.useState<any[]>([]);
|
|
57
|
-
const [selectedRows, setSelectedRows] = React.useState<ReadonlySet<number>>(new Set());
|
|
58
|
-
|
|
59
|
-
// Columns ---
|
|
60
|
-
React.useEffect(() => {
|
|
61
|
-
setListColumns([
|
|
62
|
-
...multiSelect ? [SelectColumn] : [],
|
|
63
|
-
...columns.map((column): ColumnEx<any[]> => {
|
|
64
|
-
const type = columnTypes[column] ?? "string";
|
|
65
|
-
let formatter;
|
|
66
|
-
let __hpcc_pattern;
|
|
67
|
-
let __hpcc_format;
|
|
68
|
-
switch (type) {
|
|
69
|
-
case "time":
|
|
70
|
-
__hpcc_pattern = columnPatterns[column] !== undefined ? timeParse(columnPatterns[column]) : undefined;
|
|
71
|
-
__hpcc_format = columnFormats[column] !== undefined ? timeFormat(columnFormats[column]) : undefined;
|
|
72
|
-
break;
|
|
73
|
-
case "number":
|
|
74
|
-
formatter = (props) => {
|
|
75
|
-
return <div style={{ textAlign: "right" }}>{props.row[props.column.key]}</div>;
|
|
76
|
-
};
|
|
77
|
-
// eslint-disable-next-line no-fallthrough
|
|
78
|
-
default:
|
|
79
|
-
__hpcc_format = columnFormats[column] !== undefined ? format(columnFormats[column]) : undefined;
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
key: column,
|
|
83
|
-
name: column,
|
|
84
|
-
resizable: true,
|
|
85
|
-
sortable: true,
|
|
86
|
-
minWidth: 80,
|
|
87
|
-
renderCell: formatter,
|
|
88
|
-
__hpcc_pattern,
|
|
89
|
-
__hpcc_format
|
|
90
|
-
};
|
|
91
|
-
})
|
|
92
|
-
]);
|
|
93
|
-
}, [columnFormats, columnPatterns, columnTypes, columns, multiSelect]);
|
|
94
|
-
|
|
95
|
-
const onSortColumnsChange = React.useCallback((sortColumns: SortColumn[]) => {
|
|
96
|
-
const futureSortColumn = sortColumns.slice(-1)[0];
|
|
97
|
-
const sorted = futureSortColumn !== undefined;
|
|
98
|
-
const isSortedDescending: boolean = futureSortColumn?.direction === "DESC";
|
|
99
|
-
setSortColumn(futureSortColumn);
|
|
100
|
-
setRows(copyAndSort(rows, sorted ? futureSortColumn.columnKey : "key", sorted ? isSortedDescending : false));
|
|
101
|
-
}, [rows]);
|
|
102
|
-
|
|
103
|
-
const rowKeyGetter = React.useCallback((row: any) => {
|
|
104
|
-
return row.key;
|
|
105
|
-
}, []);
|
|
106
|
-
|
|
107
|
-
const onSelectedRowsChange = React.useCallback((selectedRows: Set<any>) => {
|
|
108
|
-
setSelectedRows(selectedRows);
|
|
109
|
-
}, []);
|
|
110
|
-
|
|
111
|
-
const onCellClick = React.useCallback((row, column) => {
|
|
112
|
-
table.onRowClickCallback(row, column.key);
|
|
113
|
-
}, [table]);
|
|
114
|
-
|
|
115
|
-
// Rows ---
|
|
116
|
-
React.useEffect(() => {
|
|
117
|
-
let items = data.map((row, index) => {
|
|
118
|
-
const retVal = {
|
|
119
|
-
key: index
|
|
120
|
-
};
|
|
121
|
-
listColumns.forEach((column, index) => {
|
|
122
|
-
let val = row[index] as string;
|
|
123
|
-
if (column.__hpcc_pattern && column.__hpcc_format) {
|
|
124
|
-
val = column.__hpcc_format(column.__hpcc_pattern(val));
|
|
125
|
-
} else if (column.__hpcc_pattern) {
|
|
126
|
-
val = column.__hpcc_pattern(val).toString();
|
|
127
|
-
} else if (column.__hpcc_format) {
|
|
128
|
-
val = column.__hpcc_format(val as any);
|
|
129
|
-
}
|
|
130
|
-
retVal[column.key] = val;
|
|
131
|
-
});
|
|
132
|
-
return retVal;
|
|
133
|
-
});
|
|
134
|
-
if (sort?.attribute) {
|
|
135
|
-
items = copyAndSort(items, sort.attribute, sort.descending);
|
|
136
|
-
}
|
|
137
|
-
setRows(items);
|
|
138
|
-
}, [listColumns, data, sort]);
|
|
139
|
-
|
|
140
|
-
return <DataGrid
|
|
141
|
-
columns={listColumns}
|
|
142
|
-
headerRowHeight={24}
|
|
143
|
-
rows={rows}
|
|
144
|
-
rowKeyGetter={rowKeyGetter}
|
|
145
|
-
rowHeight={20}
|
|
146
|
-
emptyRowsRenderer={() => <EmptyRowsRenderer message={table.noDataMessage()} />}
|
|
147
|
-
className={table.darkMode() ? "rdg-dark" : "rdg-light"}
|
|
148
|
-
sortColumns={sortColumn ? [sortColumn] : []}
|
|
149
|
-
onSortColumnsChange={onSortColumnsChange}
|
|
150
|
-
selectedRows={selectedRows}
|
|
151
|
-
onSelectedRowsChange={multiSelect ? onSelectedRowsChange : undefined}
|
|
152
|
-
onRowClick={multiSelect ? undefined : (rowIdx, row, column) => onCellClick(row, column)}
|
|
153
|
-
aria-describedby={""}
|
|
154
|
-
aria-label={""}
|
|
155
|
-
aria-labelledby={""}
|
|
156
|
-
style={{ height: "100%" }}
|
|
157
|
-
/>;
|
|
158
|
-
};
|
|
159
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import DataGrid, { Column, SelectColumn, SortColumn } from "react-data-grid";
|
|
3
|
+
import { format, timeFormat, timeParse } from "@hpcc-js/common";
|
|
4
|
+
import { useData } from "./hooks";
|
|
5
|
+
import type { Table } from "./table";
|
|
6
|
+
|
|
7
|
+
export type QuerySortItem = { attribute: string, descending: boolean };
|
|
8
|
+
function copyAndSort<T>(items: T[], attribute: string, descending?: boolean): T[] {
|
|
9
|
+
const key = attribute as keyof T;
|
|
10
|
+
return [...items].sort((a: T, b: T) => {
|
|
11
|
+
if (a[key] < b[key]) {
|
|
12
|
+
return descending ? 1 : -1;
|
|
13
|
+
} else if (a[key] > b[key]) {
|
|
14
|
+
return descending ? -1 : 1;
|
|
15
|
+
}
|
|
16
|
+
return 0;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface EmptyRowsRendererProps {
|
|
21
|
+
message: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const EmptyRowsRenderer: React.FunctionComponent<EmptyRowsRendererProps> = ({
|
|
25
|
+
message
|
|
26
|
+
}) => {
|
|
27
|
+
|
|
28
|
+
return <div style={{ textAlign: "center", gridColumn: "1/-1" }} >
|
|
29
|
+
{message}
|
|
30
|
+
</div>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
interface ColumnEx<TRow, TSummaryRow = unknown> extends Column<TRow, TSummaryRow> {
|
|
34
|
+
renderCell?: (props: any) => React.JSX.Element;
|
|
35
|
+
__hpcc_pattern?: ReturnType<typeof timeParse>;
|
|
36
|
+
__hpcc_format?: ReturnType<typeof format> | ReturnType<typeof timeFormat>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ReactTableProps {
|
|
40
|
+
table: Table;
|
|
41
|
+
sort?: QuerySortItem,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const ReactTable: React.FunctionComponent<ReactTableProps> = ({
|
|
45
|
+
table,
|
|
46
|
+
sort
|
|
47
|
+
}) => {
|
|
48
|
+
const [columns, data] = useData(table);
|
|
49
|
+
const multiSelect = table.multiSelect();
|
|
50
|
+
const columnTypes = table.columnTypes();
|
|
51
|
+
const columnPatterns = table.columnPatterns();
|
|
52
|
+
const columnFormats = table.columnFormats();
|
|
53
|
+
|
|
54
|
+
const [listColumns, setListColumns] = React.useState<ColumnEx<any[]>[]>([]);
|
|
55
|
+
const [sortColumn, setSortColumn] = React.useState<SortColumn>();
|
|
56
|
+
const [rows, setRows] = React.useState<any[]>([]);
|
|
57
|
+
const [selectedRows, setSelectedRows] = React.useState<ReadonlySet<number>>(new Set());
|
|
58
|
+
|
|
59
|
+
// Columns ---
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
setListColumns([
|
|
62
|
+
...multiSelect ? [SelectColumn] : [],
|
|
63
|
+
...columns.map((column): ColumnEx<any[]> => {
|
|
64
|
+
const type = columnTypes[column] ?? "string";
|
|
65
|
+
let formatter;
|
|
66
|
+
let __hpcc_pattern;
|
|
67
|
+
let __hpcc_format;
|
|
68
|
+
switch (type) {
|
|
69
|
+
case "time":
|
|
70
|
+
__hpcc_pattern = columnPatterns[column] !== undefined ? timeParse(columnPatterns[column]) : undefined;
|
|
71
|
+
__hpcc_format = columnFormats[column] !== undefined ? timeFormat(columnFormats[column]) : undefined;
|
|
72
|
+
break;
|
|
73
|
+
case "number":
|
|
74
|
+
formatter = (props) => {
|
|
75
|
+
return <div style={{ textAlign: "right" }}>{props.row[props.column.key]}</div>;
|
|
76
|
+
};
|
|
77
|
+
// eslint-disable-next-line no-fallthrough
|
|
78
|
+
default:
|
|
79
|
+
__hpcc_format = columnFormats[column] !== undefined ? format(columnFormats[column]) : undefined;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
key: column,
|
|
83
|
+
name: column,
|
|
84
|
+
resizable: true,
|
|
85
|
+
sortable: true,
|
|
86
|
+
minWidth: 80,
|
|
87
|
+
renderCell: formatter,
|
|
88
|
+
__hpcc_pattern,
|
|
89
|
+
__hpcc_format
|
|
90
|
+
};
|
|
91
|
+
})
|
|
92
|
+
]);
|
|
93
|
+
}, [columnFormats, columnPatterns, columnTypes, columns, multiSelect]);
|
|
94
|
+
|
|
95
|
+
const onSortColumnsChange = React.useCallback((sortColumns: SortColumn[]) => {
|
|
96
|
+
const futureSortColumn = sortColumns.slice(-1)[0];
|
|
97
|
+
const sorted = futureSortColumn !== undefined;
|
|
98
|
+
const isSortedDescending: boolean = futureSortColumn?.direction === "DESC";
|
|
99
|
+
setSortColumn(futureSortColumn);
|
|
100
|
+
setRows(copyAndSort(rows, sorted ? futureSortColumn.columnKey : "key", sorted ? isSortedDescending : false));
|
|
101
|
+
}, [rows]);
|
|
102
|
+
|
|
103
|
+
const rowKeyGetter = React.useCallback((row: any) => {
|
|
104
|
+
return row.key;
|
|
105
|
+
}, []);
|
|
106
|
+
|
|
107
|
+
const onSelectedRowsChange = React.useCallback((selectedRows: Set<any>) => {
|
|
108
|
+
setSelectedRows(selectedRows);
|
|
109
|
+
}, []);
|
|
110
|
+
|
|
111
|
+
const onCellClick = React.useCallback((row, column) => {
|
|
112
|
+
table.onRowClickCallback(row, column.key);
|
|
113
|
+
}, [table]);
|
|
114
|
+
|
|
115
|
+
// Rows ---
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
let items = data.map((row, index) => {
|
|
118
|
+
const retVal = {
|
|
119
|
+
key: index
|
|
120
|
+
};
|
|
121
|
+
listColumns.forEach((column, index) => {
|
|
122
|
+
let val = row[index] as string;
|
|
123
|
+
if (column.__hpcc_pattern && column.__hpcc_format) {
|
|
124
|
+
val = column.__hpcc_format(column.__hpcc_pattern(val));
|
|
125
|
+
} else if (column.__hpcc_pattern) {
|
|
126
|
+
val = column.__hpcc_pattern(val).toString();
|
|
127
|
+
} else if (column.__hpcc_format) {
|
|
128
|
+
val = column.__hpcc_format(val as any);
|
|
129
|
+
}
|
|
130
|
+
retVal[column.key] = val;
|
|
131
|
+
});
|
|
132
|
+
return retVal;
|
|
133
|
+
});
|
|
134
|
+
if (sort?.attribute) {
|
|
135
|
+
items = copyAndSort(items, sort.attribute, sort.descending);
|
|
136
|
+
}
|
|
137
|
+
setRows(items);
|
|
138
|
+
}, [listColumns, data, sort]);
|
|
139
|
+
|
|
140
|
+
return <DataGrid
|
|
141
|
+
columns={listColumns}
|
|
142
|
+
headerRowHeight={24}
|
|
143
|
+
rows={rows}
|
|
144
|
+
rowKeyGetter={rowKeyGetter}
|
|
145
|
+
rowHeight={20}
|
|
146
|
+
emptyRowsRenderer={() => <EmptyRowsRenderer message={table.noDataMessage()} />}
|
|
147
|
+
className={table.darkMode() ? "rdg-dark" : "rdg-light"}
|
|
148
|
+
sortColumns={sortColumn ? [sortColumn] : []}
|
|
149
|
+
onSortColumnsChange={onSortColumnsChange}
|
|
150
|
+
selectedRows={selectedRows}
|
|
151
|
+
onSelectedRowsChange={multiSelect ? onSelectedRowsChange : undefined}
|
|
152
|
+
onRowClick={multiSelect ? undefined : (rowIdx, row, column) => onCellClick(row, column)}
|
|
153
|
+
aria-describedby={""}
|
|
154
|
+
aria-label={""}
|
|
155
|
+
aria-labelledby={""}
|
|
156
|
+
style={{ height: "100%" }}
|
|
157
|
+
/>;
|
|
158
|
+
};
|
|
159
|
+
|
package/src/table.css
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
.dgrid2_Table .rdg {
|
|
2
|
-
font-family: monospace, 'Courier New', Courier;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.dgrid2_Table .rdg-checkbox-label .rdg-checkbox {
|
|
6
|
-
block-size: 16px;
|
|
7
|
-
inline-size: 16px;
|
|
8
|
-
border-width: 2px;
|
|
9
|
-
box-shadow: inset 0 0 0 3px var(--rdg-background-color);
|
|
1
|
+
.dgrid2_Table .rdg {
|
|
2
|
+
font-family: monospace, 'Courier New', Courier;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dgrid2_Table .rdg-checkbox-label .rdg-checkbox {
|
|
6
|
+
block-size: 16px;
|
|
7
|
+
inline-size: 16px;
|
|
8
|
+
border-width: 2px;
|
|
9
|
+
box-shadow: inset 0 0 0 3px var(--rdg-background-color);
|
|
10
10
|
}
|
package/src/table.md
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
# Table
|
|
2
|
-
|
|
3
|
-
**Class**: `Table`
|
|
4
|
-
|
|
5
|
-
<ClientOnly>
|
|
6
|
-
<hpcc-vitepress preview_border="0px" style="width:100%;height:600px">
|
|
7
|
-
<div id="placeholder" style="height:400px">
|
|
8
|
-
</div>
|
|
9
|
-
<script type="module">
|
|
10
|
-
import { Table } from "@hpcc-js/dgrid2";
|
|
11
|
-
|
|
12
|
-
new Table()
|
|
13
|
-
.target("placeholder")
|
|
14
|
-
.columns(["Category", "Series-1", "Series-2", "Series-3", "Series-4"])
|
|
15
|
-
.data([
|
|
16
|
-
["A", -25, -23, -25, -22],
|
|
17
|
-
["B", -20, -21, -25, -21],
|
|
18
|
-
["C", -18, -20, -25, -19],
|
|
19
|
-
["D", -17, -17, -25, -18],
|
|
20
|
-
["E", -16, -15, -19, -18],
|
|
21
|
-
["F", -15, -14, -16, -16],
|
|
22
|
-
["G", -12, -10, -14, -15],
|
|
23
|
-
["H", -12, -8, -13, -15],
|
|
24
|
-
["I", -11, -6, -12, -12],
|
|
25
|
-
["J", -11, -6, -8, -12],
|
|
26
|
-
["K", -9, 0, -5, -10],
|
|
27
|
-
["L", -5, 1, -5, -9],
|
|
28
|
-
["M", -5, 2, -4, -8],
|
|
29
|
-
["N", -1, 4, -2, -7],
|
|
30
|
-
["O", 3, 7, 0, -5],
|
|
31
|
-
["P", 3, 8, 0, -3],
|
|
32
|
-
["Q", 4, 8, 7, 0],
|
|
33
|
-
["R", 6, 9, 11, 1],
|
|
34
|
-
["S", 9, 11, 11, 5],
|
|
35
|
-
["T", 10, 20, 12, 6],
|
|
36
|
-
["U", 12, 20, 16, 8],
|
|
37
|
-
["V", 12, 21, 18, 14],
|
|
38
|
-
["W", 14, 21, 18, 18],
|
|
39
|
-
["X", 15, 23, 21, 18],
|
|
40
|
-
["Y", 21, 23, 23, 21],
|
|
41
|
-
["Z", 23, 24, 24, 24]
|
|
42
|
-
])
|
|
43
|
-
.render()
|
|
44
|
-
;
|
|
45
|
-
</script>
|
|
46
|
-
</hpcc-vitepress>
|
|
47
|
-
</ClientOnly>
|
|
48
|
-
|
|
49
|
-
::: tip
|
|
50
|
-
See [Getting Started](../README) for details on how to include @hpcc-js/dgrid2 in your application
|
|
51
|
-
:::
|
|
52
|
-
|
|
53
|
-
## `Table`
|
|
54
|
-
|
|
55
|
-
## Events
|
|
56
|
-
|
|
57
|
-
## Credits
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
**Class**: `Table`
|
|
4
|
+
|
|
5
|
+
<ClientOnly>
|
|
6
|
+
<hpcc-vitepress preview_border="0px" style="width:100%;height:600px">
|
|
7
|
+
<div id="placeholder" style="height:400px">
|
|
8
|
+
</div>
|
|
9
|
+
<script type="module">
|
|
10
|
+
import { Table } from "@hpcc-js/dgrid2";
|
|
11
|
+
|
|
12
|
+
new Table()
|
|
13
|
+
.target("placeholder")
|
|
14
|
+
.columns(["Category", "Series-1", "Series-2", "Series-3", "Series-4"])
|
|
15
|
+
.data([
|
|
16
|
+
["A", -25, -23, -25, -22],
|
|
17
|
+
["B", -20, -21, -25, -21],
|
|
18
|
+
["C", -18, -20, -25, -19],
|
|
19
|
+
["D", -17, -17, -25, -18],
|
|
20
|
+
["E", -16, -15, -19, -18],
|
|
21
|
+
["F", -15, -14, -16, -16],
|
|
22
|
+
["G", -12, -10, -14, -15],
|
|
23
|
+
["H", -12, -8, -13, -15],
|
|
24
|
+
["I", -11, -6, -12, -12],
|
|
25
|
+
["J", -11, -6, -8, -12],
|
|
26
|
+
["K", -9, 0, -5, -10],
|
|
27
|
+
["L", -5, 1, -5, -9],
|
|
28
|
+
["M", -5, 2, -4, -8],
|
|
29
|
+
["N", -1, 4, -2, -7],
|
|
30
|
+
["O", 3, 7, 0, -5],
|
|
31
|
+
["P", 3, 8, 0, -3],
|
|
32
|
+
["Q", 4, 8, 7, 0],
|
|
33
|
+
["R", 6, 9, 11, 1],
|
|
34
|
+
["S", 9, 11, 11, 5],
|
|
35
|
+
["T", 10, 20, 12, 6],
|
|
36
|
+
["U", 12, 20, 16, 8],
|
|
37
|
+
["V", 12, 21, 18, 14],
|
|
38
|
+
["W", 14, 21, 18, 18],
|
|
39
|
+
["X", 15, 23, 21, 18],
|
|
40
|
+
["Y", 21, 23, 23, 21],
|
|
41
|
+
["Z", 23, 24, 24, 24]
|
|
42
|
+
])
|
|
43
|
+
.render()
|
|
44
|
+
;
|
|
45
|
+
</script>
|
|
46
|
+
</hpcc-vitepress>
|
|
47
|
+
</ClientOnly>
|
|
48
|
+
|
|
49
|
+
::: tip
|
|
50
|
+
See [Getting Started](../README) for details on how to include @hpcc-js/dgrid2 in your application
|
|
51
|
+
:::
|
|
52
|
+
|
|
53
|
+
## `Table`
|
|
54
|
+
|
|
55
|
+
## Events
|
|
56
|
+
|
|
57
|
+
## Credits
|