@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/package.json CHANGED
@@ -1,52 +1,48 @@
1
1
  {
2
2
  "name": "@hpcc-js/dgrid2",
3
- "version": "2.5.0",
3
+ "version": "3.1.1",
4
4
  "description": "hpcc-js - DGrid2",
5
- "main": "dist/index.js",
6
- "module": "dist/index.es6",
7
- "unpkg": "dist/index.min.js",
8
- "jsdelivr": "dist/index.min.js",
9
- "types": "types/index.d.ts",
10
- "typesVersions": {
11
- "<3.8": {
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
- "types-3.4/*",
21
- "src/*"
20
+ "font-awesome/**/*"
22
21
  ],
23
22
  "scripts": {
24
- "clean": "rimraf --glob lib* types dist *.tsbuildinfo",
25
- "compile-es6": "tsc --module es6 --outDir ./lib-es6",
26
- "compile-es6-watch": "npm run compile-es6 -- -w",
27
- "compile-umd": "tsc --module umd --outDir ./lib-umd",
28
- "compile-umd-watch": "npm run compile-umd -- -w",
29
- "bundle": "rollup -c",
30
- "bundle-watch": "npm run bundle -- -w",
31
- "minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
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
- "update": "npx --yes npm-check-updates -u -t minor"
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.73.0",
43
- "@hpcc-js/preact-shim": "^2.18.0",
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/bundle": "^2.12.0",
48
- "react-data-grid": "7.0.0-canary.49",
49
- "tslib": "2.7.0"
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": "fbbef050700b0e9d76ef99714856383d95155149"
58
+ "gitHead": "b4f63e027feea45ebdfc578ef9c85d107bd97322"
63
59
  }
@@ -1,3 +1,3 @@
1
1
  export const PKG_NAME = "@hpcc-js/dgrid2";
2
- export const PKG_VERSION = "2.5.0";
3
- export const BUILD_VERSION = "2.107.0";
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";
@@ -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) => React.JSX.Element;
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
- emptyRowsRenderer={() => <EmptyRowsRenderer message={table.noDataMessage()} />}
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
- onRowClick={multiSelect ? undefined : (rowIdx, row, column) => onCellClick(row, column)}
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, publish } from "@hpcc-js/common";
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 "../src/table.css";
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
+
@@ -1,4 +1,3 @@
1
1
  export declare const PKG_NAME = "@hpcc-js/dgrid2";
2
- export declare const PKG_VERSION = "2.5.0";
3
- export declare const BUILD_VERSION = "2.107.0";
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
@@ -1,3 +1,2 @@
1
1
  import { Widget } from "@hpcc-js/common";
2
2
  export declare function useData(widget: Widget): [string[], Array<string | number>[]];
3
- //# sourceMappingURL=hooks.d.ts.map
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";
@@ -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, publish } from "@hpcc-js/common";
2
- import "../src/table.css";
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
- //# sourceMappingURL=table.d.ts.map
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
+ }