@hpcc-js/dgrid2 2.5.0 → 3.1.1
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/index.js +323 -2816
- package/dist/index.js.map +7 -1
- package/package.json +32 -36
- package/src/__package__.ts +2 -2
- package/src/index.ts +2 -2
- package/src/reactTable.tsx +8 -6
- package/src/table.ts +27 -16
- package/types/__package__.d.ts +2 -3
- package/types/hooks.d.ts +0 -1
- package/types/index.d.ts +2 -3
- package/types/reactTable.d.ts +2 -2
- package/types/table.d.ts +28 -15
- package/dist/index.es6.js +0 -2943
- package/dist/index.es6.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/types/__package__.d.ts.map +0 -1
- package/types/hooks.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/reactTable.d.ts.map +0 -1
- package/types/table.d.ts.map +0 -1
- package/types-3.4/__package__.d.ts +0 -4
- package/types-3.4/hooks.d.ts +0 -6
- package/types-3.4/index.d.ts +0 -3
- package/types-3.4/reactTable.d.ts +0 -12
- package/types-3.4/table.d.ts +0 -33
package/package.json
CHANGED
|
@@ -1,52 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/dgrid2",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "hpcc-js - DGrid2",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"*": [
|
|
13
|
-
"types-3.4/index.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./dist/*": "./dist/*"
|
|
16
12
|
},
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"browser": "./dist/index.js",
|
|
15
|
+
"types": "./types/index.d.ts",
|
|
17
16
|
"files": [
|
|
18
17
|
"dist/*",
|
|
18
|
+
"src/*",
|
|
19
19
|
"types/*",
|
|
20
|
-
"
|
|
21
|
-
"src/*"
|
|
20
|
+
"font-awesome/**/*"
|
|
22
21
|
],
|
|
23
22
|
"scripts": {
|
|
24
|
-
"clean": "rimraf --glob lib* types dist *.tsbuildinfo",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"gen-legacy-types": "downlevel-dts ./types ./types-3.4",
|
|
33
|
-
"build": "npm run compile-es6 && npm run bundle",
|
|
34
|
-
"watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch",
|
|
35
|
-
"serve-vite": "vite --config ../../vite.config.js",
|
|
36
|
-
"stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
|
|
37
|
-
"lint": "eslint src/**/*.ts",
|
|
23
|
+
"clean": "rimraf --glob lib* types dist *.tsbuildinfo .turbo",
|
|
24
|
+
"bundle": "node esbuild.js",
|
|
25
|
+
"bundle-watch": "npm run bundle -- --development --watch",
|
|
26
|
+
"gen-types": "tsc --project tsconfig.json",
|
|
27
|
+
"gen-types-watch": "npm run gen-types -- --watch",
|
|
28
|
+
"build": "run-p gen-types bundle",
|
|
29
|
+
"lint": "eslint ./src",
|
|
30
|
+
"lint-fix": "eslint --fix src/**/*.ts",
|
|
38
31
|
"docs": "typedoc --options tdoptions.json .",
|
|
39
|
-
"
|
|
32
|
+
"test-browser": "vitest run --project browser",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"coverage": "vitest run --coverage",
|
|
35
|
+
"update": "npx --yes npm-check-updates -u -t minor",
|
|
36
|
+
"update-major": "npx --yes npm-check-updates -u"
|
|
40
37
|
},
|
|
41
38
|
"dependencies": {
|
|
42
|
-
"@hpcc-js/common": "^2.
|
|
43
|
-
"@hpcc-js/
|
|
44
|
-
"@hpcc-js/util": "^2.53.0"
|
|
39
|
+
"@hpcc-js/common": "^3.2.0",
|
|
40
|
+
"@hpcc-js/util": "^3.2.0"
|
|
45
41
|
},
|
|
46
42
|
"devDependencies": {
|
|
47
|
-
"@hpcc-js/
|
|
48
|
-
"
|
|
49
|
-
"
|
|
43
|
+
"@hpcc-js/esbuild-plugins": "^1.3.0",
|
|
44
|
+
"@hpcc-js/preact-shim": "^3.0.0",
|
|
45
|
+
"react-data-grid": "7.0.0-beta.47"
|
|
50
46
|
},
|
|
51
47
|
"repository": {
|
|
52
48
|
"type": "git",
|
|
@@ -59,5 +55,5 @@
|
|
|
59
55
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
60
56
|
},
|
|
61
57
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
62
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b4f63e027feea45ebdfc578ef9c85d107bd97322"
|
|
63
59
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/dgrid2";
|
|
2
|
-
export const PKG_VERSION = "
|
|
3
|
-
export const BUILD_VERSION = "2.
|
|
2
|
+
export const PKG_VERSION = "3.1.1";
|
|
3
|
+
export const BUILD_VERSION = "3.2.1";
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./__package__";
|
|
2
|
-
export * from "./table";
|
|
1
|
+
export * from "./__package__.ts";
|
|
2
|
+
export * from "./table.ts";
|
package/src/reactTable.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import DataGrid, { Column, SelectColumn, SortColumn } from "react-data-grid";
|
|
3
3
|
import { format, timeFormat, timeParse } from "@hpcc-js/common";
|
|
4
|
-
import { useData } from "./hooks";
|
|
5
|
-
import type { Table } from "./table";
|
|
4
|
+
import { useData } from "./hooks.ts";
|
|
5
|
+
import type { Table } from "./table.ts";
|
|
6
|
+
|
|
7
|
+
import "react-data-grid/lib/styles.css";
|
|
6
8
|
|
|
7
9
|
export type QuerySortItem = { attribute: string, descending: boolean };
|
|
8
10
|
function copyAndSort<T>(items: T[], attribute: string, descending?: boolean): T[] {
|
|
@@ -31,7 +33,7 @@ const EmptyRowsRenderer: React.FunctionComponent<EmptyRowsRendererProps> = ({
|
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
interface ColumnEx<TRow, TSummaryRow = unknown> extends Column<TRow, TSummaryRow> {
|
|
34
|
-
renderCell?: (props: any) =>
|
|
36
|
+
renderCell?: (props: any) => any;
|
|
35
37
|
__hpcc_pattern?: ReturnType<typeof timeParse>;
|
|
36
38
|
__hpcc_format?: ReturnType<typeof format> | ReturnType<typeof timeFormat>;
|
|
37
39
|
}
|
|
@@ -59,7 +61,7 @@ export const ReactTable: React.FunctionComponent<ReactTableProps> = ({
|
|
|
59
61
|
// Columns ---
|
|
60
62
|
React.useEffect(() => {
|
|
61
63
|
setListColumns([
|
|
62
|
-
...multiSelect ? [SelectColumn] : [],
|
|
64
|
+
...multiSelect ? [SelectColumn as ColumnEx<any[]>] : [],
|
|
63
65
|
...columns.map((column): ColumnEx<any[]> => {
|
|
64
66
|
const type = columnTypes[column] ?? "string";
|
|
65
67
|
let formatter;
|
|
@@ -143,13 +145,13 @@ export const ReactTable: React.FunctionComponent<ReactTableProps> = ({
|
|
|
143
145
|
rows={rows}
|
|
144
146
|
rowKeyGetter={rowKeyGetter}
|
|
145
147
|
rowHeight={20}
|
|
146
|
-
|
|
148
|
+
renderers={{ noRowsFallback: <EmptyRowsRenderer message={table.noDataMessage()} /> as any }}
|
|
147
149
|
className={table.darkMode() ? "rdg-dark" : "rdg-light"}
|
|
148
150
|
sortColumns={sortColumn ? [sortColumn] : []}
|
|
149
151
|
onSortColumnsChange={onSortColumnsChange}
|
|
150
152
|
selectedRows={selectedRows}
|
|
151
153
|
onSelectedRowsChange={multiSelect ? onSelectedRowsChange : undefined}
|
|
152
|
-
|
|
154
|
+
onCellClick={multiSelect ? undefined : (args, event) => onCellClick(args.row, args.column)}
|
|
153
155
|
aria-describedby={""}
|
|
154
156
|
aria-label={""}
|
|
155
157
|
aria-labelledby={""}
|
package/src/table.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { HTMLWidget
|
|
2
|
+
import { HTMLWidget } from "@hpcc-js/common";
|
|
3
3
|
import { render, unmountComponentAtNode } from "react-dom";
|
|
4
|
-
import { ReactTable } from "./reactTable";
|
|
4
|
+
import { ReactTable } from "./reactTable.tsx";
|
|
5
5
|
|
|
6
|
-
import "
|
|
6
|
+
import "./table.css";
|
|
7
7
|
|
|
8
8
|
export type ColumnType = "boolean" | "number" | "string" | "time";
|
|
9
9
|
|
|
@@ -15,19 +15,6 @@ export class Table extends HTMLWidget {
|
|
|
15
15
|
super();
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
@publish("...empty...", "string", "No Data Message")
|
|
19
|
-
noDataMessage: publish<this, string>;
|
|
20
|
-
@publish(false, "boolean", "Dark Mode")
|
|
21
|
-
darkMode: publish<this, boolean>;
|
|
22
|
-
@publish(false, "boolean", "Multiple Selection")
|
|
23
|
-
multiSelect: publish<this, boolean>;
|
|
24
|
-
@publish({}, "object", "Column Types (\"boolean\" | \"number\" | \"string\" | \"time\"")
|
|
25
|
-
columnTypes: publish<this, { [column: string]: ColumnType }>;
|
|
26
|
-
@publish({}, "object", "Column Patterns")
|
|
27
|
-
columnPatterns: publish<this, { [column: string]: string }>;
|
|
28
|
-
@publish({}, "object", "Column Formats")
|
|
29
|
-
columnFormats: publish<this, { [column: string]: string }>;
|
|
30
|
-
|
|
31
18
|
columnType(column: string): ColumnType;
|
|
32
19
|
columnType(column: string, type: ColumnType): this;
|
|
33
20
|
columnType(column: string, type?: ColumnType): ColumnType | this {
|
|
@@ -69,6 +56,7 @@ export class Table extends HTMLWidget {
|
|
|
69
56
|
super.enter(domNode, element);
|
|
70
57
|
this._div = element
|
|
71
58
|
.append("div")
|
|
59
|
+
.style("display", "grid")
|
|
72
60
|
;
|
|
73
61
|
}
|
|
74
62
|
|
|
@@ -90,3 +78,26 @@ export class Table extends HTMLWidget {
|
|
|
90
78
|
}
|
|
91
79
|
}
|
|
92
80
|
Table.prototype._class += " dgrid2_Table";
|
|
81
|
+
|
|
82
|
+
export interface Table {
|
|
83
|
+
noDataMessage(): string;
|
|
84
|
+
noDataMessage(_: string): this;
|
|
85
|
+
darkMode(): boolean;
|
|
86
|
+
darkMode(_: boolean): this;
|
|
87
|
+
multiSelect(): boolean;
|
|
88
|
+
multiSelect(_: boolean): this;
|
|
89
|
+
columnTypes(): { [column: string]: ColumnType };
|
|
90
|
+
columnTypes(_: { [column: string]: ColumnType }): this;
|
|
91
|
+
columnPatterns(): { [column: string]: string };
|
|
92
|
+
columnPatterns(_: { [column: string]: string }): this;
|
|
93
|
+
columnFormats(): { [column: string]: string };
|
|
94
|
+
columnFormats(_: { [column: string]: string }): this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Table.prototype.publish("noDataMessage", "...empty...", "string", "No Data Message");
|
|
98
|
+
Table.prototype.publish("darkMode", false, "boolean", "Dark Mode");
|
|
99
|
+
Table.prototype.publish("multiSelect", false, "boolean", "Multiple Selection");
|
|
100
|
+
Table.prototype.publish("columnTypes", {}, "object", "Column Types (\"boolean\" | \"number\" | \"string\" | \"time\"");
|
|
101
|
+
Table.prototype.publish("columnPatterns", {}, "object", "Column Patterns");
|
|
102
|
+
Table.prototype.publish("columnFormats", {}, "object", "Column Formats");
|
|
103
|
+
|
package/types/__package__.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const PKG_NAME = "@hpcc-js/dgrid2";
|
|
2
|
-
export declare const PKG_VERSION = "
|
|
3
|
-
export declare const BUILD_VERSION = "2.
|
|
4
|
-
//# sourceMappingURL=__package__.d.ts.map
|
|
2
|
+
export declare const PKG_VERSION = "3.1.1";
|
|
3
|
+
export declare const BUILD_VERSION = "3.2.1";
|
package/types/hooks.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from "./__package__";
|
|
2
|
-
export * from "./table";
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from "./__package__.ts";
|
|
2
|
+
export * from "./table.ts";
|
package/types/reactTable.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { Table } from "./table";
|
|
2
|
+
import type { Table } from "./table.ts";
|
|
3
|
+
import "react-data-grid/lib/styles.css";
|
|
3
4
|
export type QuerySortItem = {
|
|
4
5
|
attribute: string;
|
|
5
6
|
descending: boolean;
|
|
@@ -9,4 +10,3 @@ export interface ReactTableProps {
|
|
|
9
10
|
sort?: QuerySortItem;
|
|
10
11
|
}
|
|
11
12
|
export declare const ReactTable: React.FunctionComponent<ReactTableProps>;
|
|
12
|
-
//# sourceMappingURL=reactTable.d.ts.map
|
package/types/table.d.ts
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import { HTMLWidget
|
|
2
|
-
import "
|
|
1
|
+
import { HTMLWidget } from "@hpcc-js/common";
|
|
2
|
+
import "./table.css";
|
|
3
3
|
export type ColumnType = "boolean" | "number" | "string" | "time";
|
|
4
4
|
export declare class Table extends HTMLWidget {
|
|
5
5
|
protected _div: any;
|
|
6
6
|
constructor();
|
|
7
|
-
noDataMessage: publish<this, string>;
|
|
8
|
-
darkMode: publish<this, boolean>;
|
|
9
|
-
multiSelect: publish<this, boolean>;
|
|
10
|
-
columnTypes: publish<this, {
|
|
11
|
-
[column: string]: ColumnType;
|
|
12
|
-
}>;
|
|
13
|
-
columnPatterns: publish<this, {
|
|
14
|
-
[column: string]: string;
|
|
15
|
-
}>;
|
|
16
|
-
columnFormats: publish<this, {
|
|
17
|
-
[column: string]: string;
|
|
18
|
-
}>;
|
|
19
7
|
columnType(column: string): ColumnType;
|
|
20
8
|
columnType(column: string, type: ColumnType): this;
|
|
21
9
|
columnPattern(column: string): string;
|
|
@@ -30,4 +18,29 @@ export declare class Table extends HTMLWidget {
|
|
|
30
18
|
exit(domNode: any, element: any): void;
|
|
31
19
|
click(row: any, col: any, sel: any): void;
|
|
32
20
|
}
|
|
33
|
-
|
|
21
|
+
export interface Table {
|
|
22
|
+
noDataMessage(): string;
|
|
23
|
+
noDataMessage(_: string): this;
|
|
24
|
+
darkMode(): boolean;
|
|
25
|
+
darkMode(_: boolean): this;
|
|
26
|
+
multiSelect(): boolean;
|
|
27
|
+
multiSelect(_: boolean): this;
|
|
28
|
+
columnTypes(): {
|
|
29
|
+
[column: string]: ColumnType;
|
|
30
|
+
};
|
|
31
|
+
columnTypes(_: {
|
|
32
|
+
[column: string]: ColumnType;
|
|
33
|
+
}): this;
|
|
34
|
+
columnPatterns(): {
|
|
35
|
+
[column: string]: string;
|
|
36
|
+
};
|
|
37
|
+
columnPatterns(_: {
|
|
38
|
+
[column: string]: string;
|
|
39
|
+
}): this;
|
|
40
|
+
columnFormats(): {
|
|
41
|
+
[column: string]: string;
|
|
42
|
+
};
|
|
43
|
+
columnFormats(_: {
|
|
44
|
+
[column: string]: string;
|
|
45
|
+
}): this;
|
|
46
|
+
}
|