@hpcc-js/dgrid 3.5.9 → 3.7.0

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/src/dgrid-shim.ts CHANGED
@@ -1,12 +1,20 @@
1
- import * as dgrid_shim from "@hpcc-js/dgrid-shim";
2
-
3
- if (!globalThis["@hpcc-js/dgrid-shim"]) {
4
- console.error("dgrid-shim not loaded, please add `<script src=\"https://cdn.jsdelivr.net/npm/@hpcc-js/dgrid-shim/dist/index.min.js\"></script>` or similar to your HTML file");
5
- }
6
-
7
- export const Deferred = globalThis["@hpcc-js/dgrid-shim"].Deferred as typeof dgrid_shim.Deferred;
8
- export const Memory = globalThis["@hpcc-js/dgrid-shim"].Memory as typeof dgrid_shim.Memory;
9
- export const QueryResults = globalThis["@hpcc-js/dgrid-shim"].QueryResults as typeof dgrid_shim.QueryResults;
10
- export const Grid = globalThis["@hpcc-js/dgrid-shim"].Grid as typeof dgrid_shim.Grid;
11
- export const PagingGrid = globalThis["@hpcc-js/dgrid-shim"].PagingGrid as typeof dgrid_shim.PagingGrid;
12
- export const domConstruct = globalThis["@hpcc-js/dgrid-shim"].domConstruct as typeof dgrid_shim.domConstruct;
1
+ import type * as dgrid_shim from "@hpcc-js/dgrid-shim";
2
+
3
+ // Note: Resolved at build time and inlined into the dgrid bundle.
4
+ // @ts-expect-error
5
+ import dgridShimBundle from "@hpcc-js/dgrid-shim/dist/index.js?raw";
6
+ const loadDgridShim = new Function("globalThis", "var self = globalThis; var window = globalThis;" + dgridShimBundle);
7
+
8
+ if (!globalThis["@hpcc-js/dgrid-shim"]) {
9
+ loadDgridShim(globalThis);
10
+ if (!globalThis["@hpcc-js/dgrid-shim"]) {
11
+ console.error("dgrid-shim failed to load from inlined bundle");
12
+ }
13
+ }
14
+
15
+ export const Deferred = globalThis["@hpcc-js/dgrid-shim"].Deferred as typeof dgrid_shim.Deferred;
16
+ export const Memory = globalThis["@hpcc-js/dgrid-shim"].Memory as typeof dgrid_shim.Memory;
17
+ export const QueryResults = globalThis["@hpcc-js/dgrid-shim"].QueryResults as typeof dgrid_shim.QueryResults;
18
+ export const Grid = globalThis["@hpcc-js/dgrid-shim"].Grid as typeof dgrid_shim.Grid;
19
+ export const PagingGrid = globalThis["@hpcc-js/dgrid-shim"].PagingGrid as typeof dgrid_shim.PagingGrid;
20
+ export const domConstruct = globalThis["@hpcc-js/dgrid-shim"].domConstruct as typeof dgrid_shim.domConstruct;
package/src/i18n.js CHANGED
@@ -1,12 +1,12 @@
1
- // eslint-disable-next-line no-undef
2
- define({
3
- load: function (name, req, onload, config) {
4
- if (config.isBuild) {
5
- onload();
6
- } else {
7
- req([name], function (value) {
8
- onload(value.root);
9
- });
10
- }
11
- }
1
+ // eslint-disable-next-line no-undef
2
+ define({
3
+ load: function (name, req, onload, config) {
4
+ if (config.isBuild) {
5
+ onload();
6
+ } else {
7
+ req([name], function (value) {
8
+ onload(value.root);
9
+ });
10
+ }
11
+ }
12
12
  });
package/src/index.ts CHANGED
@@ -1,10 +1,10 @@
1
- export * from "./__package__.ts";
2
- export * from "./Common.ts";
3
- export * from "./DatasourceStore.ts";
4
- export * from "./DatasourceTable.ts";
5
- export * from "./DBStore.ts";
6
- export * from "./RowFormatter.ts";
7
- export * from "./Table.ts";
8
-
9
- // Must be last...
10
- export { Deferred, Memory, QueryResults, Grid, PagingGrid, domConstruct } from "./dgrid-shim.ts";
1
+ export * from "./__package__.ts";
2
+ export * from "./Common.ts";
3
+ export * from "./DatasourceStore.ts";
4
+ export * from "./DatasourceTable.ts";
5
+ export * from "./DBStore.ts";
6
+ export * from "./RowFormatter.ts";
7
+ export * from "./Table.ts";
8
+
9
+ // Must be last...
10
+ export { Deferred, Memory, QueryResults, Grid, PagingGrid, domConstruct } from "./dgrid-shim.ts";
package/types/Common.d.ts CHANGED
@@ -1,12 +1,14 @@
1
- import { HTMLWidget } from "@hpcc-js/common";
1
+ import { HTMLWidget, Selection } from "@hpcc-js/common";
2
+ import { Grid, PagingGrid } from "./dgrid-shim.ts";
2
3
  import { DBStore } from "./DBStore.ts";
4
+ import { type ColumnType } from "./RowFormatter.ts";
3
5
  import "../src/Common.css";
4
6
  export declare class Common extends HTMLWidget {
5
- protected _columns: any[];
7
+ protected _columns: ColumnType[];
6
8
  protected _store: DBStore;
7
- protected _dgridDiv: any;
8
- protected _dgrid: any;
9
- protected _prevPaging: any;
9
+ protected _dgridDiv: Selection<HTMLDivElement, unknown, HTMLElement, unknown>;
10
+ protected _dgrid: typeof PagingGrid | typeof Grid;
11
+ protected _prevPaging: boolean;
10
12
  private _prevSortBy;
11
13
  private _prevSortByDescending;
12
14
  private _prevMultiSelect;
@@ -22,6 +24,7 @@ export declare class Common extends HTMLWidget {
22
24
  update(domNode: any, element: any): void;
23
25
  exit(domNode: any, element: any): void;
24
26
  click(row: any, col: any, sel: any, more: any): void;
27
+ dblclickColResize(column: any, dgridColumn: any): void;
25
28
  }
26
29
  export interface Common {
27
30
  noDataMessage(): string;
@@ -5,6 +5,7 @@ export interface ColumnType {
5
5
  idx: number;
6
6
  className: string;
7
7
  sortable: boolean;
8
+ hidden: boolean;
8
9
  isSet: boolean;
9
10
  width?: number;
10
11
  formatter?: CellFormatter;
package/types/Table.d.ts CHANGED
@@ -46,10 +46,17 @@ export declare class Table extends Common {
46
46
  formatterFunc(): CellFormatter | undefined;
47
47
  renderCellFunc(): CellRenderer | undefined;
48
48
  click(row: any, col: any, sel: any): void;
49
+ dblclickColResize(column: string, dgridColumn: any): void;
49
50
  }
50
51
  export interface Table {
51
52
  columnWidth(): "auto" | "none";
52
53
  columnWidth(_: "auto" | "none"): this;
54
+ columnWidthAutoSampleSize(): number;
55
+ columnWidthAutoSampleSize(_: number): this;
56
+ columnWidthAutoFontName(): string;
57
+ columnWidthAutoFontName(_: string): this;
58
+ columnWidthAutoFontSize(): number;
59
+ columnWidthAutoFontSize(_: number): this;
53
60
  columnFormats(): ColumnFormat[];
54
61
  columnFormats(_: ColumnFormat[]): this;
55
62
  }
@@ -1,4 +1,4 @@
1
- import * as dgrid_shim from "@hpcc-js/dgrid-shim";
1
+ import type * as dgrid_shim from "@hpcc-js/dgrid-shim";
2
2
  export declare const Deferred: typeof dgrid_shim.Deferred;
3
3
  export declare const Memory: typeof dgrid_shim.Memory;
4
4
  export declare const QueryResults: typeof dgrid_shim.QueryResults;