From 473e0cf87846c0fba422b7890e0140ccdd67156d Mon Sep 17 00:00:00 2001 From: Gordon Smith Date: Fri, 29 Nov 2024 10:16:11 +0000 Subject: [PATCH] fix: Paged dgrid failing in strict mode Signed-off-by: Gordon Smith --- packages/dgrid-shim/src/gridHelper.ts | 4 ++-- packages/dgrid/.vscode/launch.json | 2 +- packages/dgrid/index.html | 3 ++- packages/dgrid/package.json | 4 +++- packages/dgrid/src/dgrid-shim.ts | 4 ++-- packages/dgrid/vite.config.ts | 1 + packages/eclwatch/index-preview.html | 13 ++++++++----- 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/dgrid-shim/src/gridHelper.ts b/packages/dgrid-shim/src/gridHelper.ts index d1fc93cbdc..adea1d8237 100644 --- a/packages/dgrid-shim/src/gridHelper.ts +++ b/packages/dgrid-shim/src/gridHelper.ts @@ -133,8 +133,8 @@ export const Pagination = declare([DGridPagination], { }); }, - _updateNavigation: function (total) { - this.inherited(arguments); + _updateNavigation: function _updateNavigation(total) { + this.inherited(_updateNavigation, arguments); if (total >= UNKNOWN_NUM_ROWS) { query(".dgrid-page-link:last-child", this.paginationNavigationNode).forEach(function (link) { diff --git a/packages/dgrid/.vscode/launch.json b/packages/dgrid/.vscode/launch.json index c5cfcf1c82..6a0f985a13 100644 --- a/packages/dgrid/.vscode/launch.json +++ b/packages/dgrid/.vscode/launch.json @@ -33,7 +33,7 @@ "name": "index.html", "request": "launch", "type": "msedge", - "url": "http://localhost:5506/index.html", + "url": "http://localhost:5506/dgrid/index.html", "runtimeArgs": [ "--disable-web-security" ], diff --git a/packages/dgrid/index.html b/packages/dgrid/index.html index 1ffc41f3cc..2d36703e42 100644 --- a/packages/dgrid/index.html +++ b/packages/dgrid/index.html @@ -24,7 +24,7 @@ } - + @@ -58,6 +58,7 @@

ESM Quick Test

.columns(simple.ND.columns) .data(simple.ND.data) .multiSelect(true) + .pagination(true) .render() ; diff --git a/packages/dgrid/package.json b/packages/dgrid/package.json index 1f676d45e5..ccf4b1a1a4 100644 --- a/packages/dgrid/package.json +++ b/packages/dgrid/package.json @@ -38,9 +38,11 @@ }, "dependencies": { "@hpcc-js/common": "^3.3.0", - "@hpcc-js/dgrid-shim": "^3.1.0", "@hpcc-js/util": "^3.3.0" }, + "peerDependencies": { + "@hpcc-js/dgrid-shim": "^3.1.0" + }, "devDependencies": { "@hpcc-js/esbuild-plugins": "^1.4.0", "@hpcc-js/ddl-shim": "^3.0.0", diff --git a/packages/dgrid/src/dgrid-shim.ts b/packages/dgrid/src/dgrid-shim.ts index 3784fce208..f5ed354a49 100644 --- a/packages/dgrid/src/dgrid-shim.ts +++ b/packages/dgrid/src/dgrid-shim.ts @@ -1,7 +1,7 @@ -import type * as dgrid_shim from "@hpcc-js/dgrid-shim"; +import * as dgrid_shim from "@hpcc-js/dgrid-shim"; if (!globalThis["@hpcc-js/dgrid-shim"]) { - console.error("dgrid-shim not loaded, please add `` or similar to your HTML file"); + console.error("dgrid-shim not loaded, please add `` or similar to your HTML file"); } export const Deferred = globalThis["@hpcc-js/dgrid-shim"].Deferred as typeof dgrid_shim.Deferred; diff --git a/packages/dgrid/vite.config.ts b/packages/dgrid/vite.config.ts index 0c0d753250..43fe8da0c3 100644 --- a/packages/dgrid/vite.config.ts +++ b/packages/dgrid/vite.config.ts @@ -7,6 +7,7 @@ import pkg from "./package.json" with { type: "json" }; const { alias, external, globals } = hpccBundleNames(pkg); export default defineConfig({ + root: resolve(__dirname, ".."), build: { lib: { entry: resolve(__dirname, "src/index.ts"), diff --git a/packages/eclwatch/index-preview.html b/packages/eclwatch/index-preview.html index df35123236..1f84fe69bb 100644 --- a/packages/eclwatch/index-preview.html +++ b/packages/eclwatch/index-preview.html @@ -23,6 +23,7 @@ margin-top: 20px; } + -

ESM Quick Test