Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Paged dgrid failing in strict mode #4321

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/dgrid-shim/src/gridHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/dgrid/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
3 changes: 2 additions & 1 deletion packages/dgrid/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
</style>

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@hpcc-js/dgrid-shim@2.26.0/dist/index.min.js"></script>
<script type="text/javascript" src="../dgrid-shim/dist/index.js"></script>
</head>

<body onresize="doResize()">
Expand All @@ -42,6 +42,7 @@ <h1>ESM Quick Test</h1>
["Jill", "Marcus", [], [["Flappy", "parrot"], ["Stinky", "cat"], ["Rolf", "dog"]]],
["Susan", "Robert", [["Jack", "m", 4], ["Alice", "f", 6]], []]
])
.pagination(true)
.render()
;
</script>
Expand Down
4 changes: 3 additions & 1 deletion packages/dgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/dgrid/src/dgrid-shim.ts
Original file line number Diff line number Diff line change
@@ -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 `<script src=\"https://cdn.jsdelivr.net/npm/@hpcc-js/dgrid-shim@2.26.0/dist/index.min.js\"></script>` or similar to your HTML file");
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");
}

export const Deferred = globalThis["@hpcc-js/dgrid-shim"].Deferred as typeof dgrid_shim.Deferred;
Expand Down
3 changes: 3 additions & 0 deletions packages/dgrid/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import pkg from "./package.json" with { type: "json" };
const { alias, external, globals } = hpccBundleNames(pkg);

export default defineConfig({
// Setting root to the `Visualizations/packages` folder to simplify debugging of dgrid-shim
root: resolve(__dirname, ".."),
build: {
outDir: resolve(__dirname, "dist"),
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: pkg.name,
Expand Down
13 changes: 8 additions & 5 deletions packages/eclwatch/index-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
margin-top: 20px;
}
</style>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@hpcc-js/[email protected]/dist/index.min.js"></script>
<script type="importmap">
{
"imports": {
Expand All @@ -33,8 +34,9 @@
"@hpcc-js/api": "../api/dist/index.js",
"@hpcc-js/chart": "../chart/dist/index.js",
"@hpcc-js/codemirror": "../codemirror/dist/index.js",
"@hpcc-js/comms": "../comms/dist/index.js",
"@hpcc-js/comms": "../comms/dist/index.browser.js",
"@hpcc-js/dgrid": "../dgrid/dist/index.js",
"@hpcc-js/dgrid2": "../dgrid2/dist/index.js",
"@hpcc-js/react": "../react/dist/index.js",
"@hpcc-js/html": "../html/dist/index.js",
"@hpcc-js/graph": "../graph/dist/index.js",
Expand All @@ -47,22 +49,23 @@
}
}
</script>
<link rel="stylesheet" href="./dist/index.css">
</head>

<body onresize="doResize()">
<h1>ESM Quick Test</h1>
<div id="placeholder"></div>
<script type="module">
import { ECLArchiveViewer } from "@hpcc-js/eclwatch";
import { WUResult } from "@hpcc-js/eclwatch";

const ESP_URL = "http://localhost:8010/";
const WUID = "W20241115-101614";

window.__widget = new ECLArchiveViewer()
const RESULT_NAME = "Result 3";
window.__widget = new WUResult()
.target("placeholder")
.baseUrl(ESP_URL)
.wuid(WUID)
.resultName(RESULT_NAME)
.pagination(true)
.render()
;
</script>
Expand Down