@hpcc-js/dgrid2 3.2.0 → 3.2.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/dgrid2",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "hpcc-js - DGrid2",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
@@ -37,14 +37,20 @@
37
37
  "update-major": "npx --yes npm-check-updates -u"
38
38
  },
39
39
  "dependencies": {
40
- "@hpcc-js/common": "^3.3.0",
41
- "@hpcc-js/util": "^3.3.0"
40
+ "@hpcc-js/common": "^3.3.1",
41
+ "@hpcc-js/util": "^3.3.1"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^18.0.0",
45
+ "react-dom": "^18.0.0"
42
46
  },
43
47
  "devDependencies": {
44
- "@hpcc-js/esbuild-plugins": "^1.4.0",
45
- "@preact/preset-vite": "2.9.2",
46
- "preact": "10.25.0",
47
- "react-data-grid": "7.0.0-beta.47"
48
+ "@hpcc-js/esbuild-plugins": "^1.4.1",
49
+ "@types/react": "^18.0.0",
50
+ "@types/react-dom": "^18.0.0",
51
+ "@vitejs/plugin-react": "4.3.4",
52
+ "react-data-grid": "7.0.0-beta.47",
53
+ "vite-plugin-html": "3.2.2"
48
54
  },
49
55
  "repository": {
50
56
  "type": "git",
@@ -57,5 +63,5 @@
57
63
  "url": "https://github.com/hpcc-systems/Visualization/issues"
58
64
  },
59
65
  "homepage": "https://github.com/hpcc-systems/Visualization",
60
- "gitHead": "145a4d4c8189c70f08e9804e63959d6dd398bd9f"
66
+ "gitHead": "521692e7cfd01c274d5cfff0c54e79d1686d3dd6"
61
67
  }
package/src/hooks.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from "preact/compat";
1
+ import React from "react";
2
2
  import { Widget } from "@hpcc-js/common";
3
3
 
4
4
  export function useData(widget: Widget): [string[], Array<string | number>[]] {
@@ -1,5 +1,4 @@
1
- import { FunctionComponent } from "preact";
2
- import { useCallback, useEffect, useState } from "preact/hooks";
1
+ import React, { FunctionComponent, useCallback, useEffect, useState } from "react";
3
2
  import DataGrid, { Column, SelectColumn, SortColumn } from "react-data-grid";
4
3
  import { format, timeFormat, timeParse } from "@hpcc-js/common";
5
4
  import { useData } from "./hooks.ts";
package/src/table.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { render, createElement } from "preact";
1
+ import { createElement } from "react";
2
+ import { createRoot } from "react-dom/client";
2
3
  import { HTMLWidget } from "@hpcc-js/common";
3
4
  import { ReactTable } from "./reactTable.tsx";
4
5
 
@@ -9,6 +10,8 @@ export type ColumnType = "boolean" | "number" | "string" | "time";
9
10
  export class Table extends HTMLWidget {
10
11
 
11
12
  protected _div;
13
+ protected _root: any;
14
+ protected _component: any;
12
15
 
13
16
  constructor() {
14
17
  super();
@@ -57,13 +60,15 @@ export class Table extends HTMLWidget {
57
60
  .append("div")
58
61
  .style("display", "grid")
59
62
  ;
63
+ this._root = createRoot(this._div.node(), { identifierPrefix: this.id() });
64
+ this._component = createElement(ReactTable, { table: this });
60
65
  }
61
66
 
62
67
  update(domNode, element) {
63
68
  super.update(domNode, element);
64
69
  this._div.style("width", this.width() + "px");
65
70
  this._div.style("height", this.height() + "px");
66
- render(createElement(ReactTable, { table: this }), this._div.node());
71
+ this._root.render(this._component);
67
72
  }
68
73
 
69
74
  exit(domNode, element) {
@@ -1,4 +1,4 @@
1
- import { FunctionComponent } from "preact";
1
+ import { FunctionComponent } from "react";
2
2
  import type { Table } from "./table.ts";
3
3
  import "react-data-grid/lib/styles.css";
4
4
  export type QuerySortItem = {
package/types/table.d.ts CHANGED
@@ -3,6 +3,8 @@ 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
+ protected _root: any;
7
+ protected _component: any;
6
8
  constructor();
7
9
  columnType(column: string): ColumnType;
8
10
  columnType(column: string, type: ColumnType): this;