jupyterlab_tabular_data_viewer_extension 1.2.17 → 1.2.20

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/lib/index.js CHANGED
@@ -73,7 +73,9 @@ const plugin = {
73
73
  },
74
74
  execute: async () => {
75
75
  if (lastContextMenuRow) {
76
- const jsonString = JSON.stringify(lastContextMenuRow, null, 2);
76
+ // Filter out internal metadata fields before copying
77
+ const { __row_index__, ...rowData } = lastContextMenuRow;
78
+ const jsonString = JSON.stringify(rowData, null, 2);
77
79
  await navigator.clipboard.writeText(jsonString);
78
80
  // console.log('Row copied to clipboard as JSON');
79
81
  // Clean up highlight after copy
package/lib/widget.js CHANGED
@@ -261,9 +261,7 @@ export class TabularDataViewer extends Widget {
261
261
  if (reset) {
262
262
  this._totalRows = response.totalRows;
263
263
  }
264
- // Calculate starting row number (1-indexed)
265
- const startingRowNumber = this._data.length - response.data.length + 1;
266
- this._renderData(response.data, startingRowNumber);
264
+ this._renderData(response.data);
267
265
  this._updateStatusBar();
268
266
  }
269
267
  catch (error) {
@@ -377,14 +375,14 @@ export class TabularDataViewer extends Widget {
377
375
  /**
378
376
  * Render data rows
379
377
  */
380
- _renderData(rows, startingRowNumber = 1) {
381
- rows.forEach((row, index) => {
378
+ _renderData(rows) {
379
+ rows.forEach((row) => {
382
380
  const tr = document.createElement('tr');
383
381
  tr.className = 'jp-TabularDataViewer-row';
384
- // Add row number cell
382
+ // Add row number cell using original row index from backend
385
383
  const rowNumCell = document.createElement('td');
386
384
  rowNumCell.className = 'jp-TabularDataViewer-cell jp-TabularDataViewer-rowNumberCell';
387
- rowNumCell.textContent = String(startingRowNumber + index);
385
+ rowNumCell.textContent = String(row['__row_index__'] || '');
388
386
  tr.appendChild(rowNumCell);
389
387
  this._columns.forEach(col => {
390
388
  const td = document.createElement('td');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jupyterlab_tabular_data_viewer_extension",
3
- "version": "1.2.17",
3
+ "version": "1.2.20",
4
4
  "description": "Jupyterlab extension to browse tabular data files (Parquet, Excel, CSV, TSV) with filtering and sorting capabilities",
5
5
  "keywords": [
6
6
  "jupyter",
package/src/index.ts CHANGED
@@ -120,7 +120,9 @@ const plugin: JupyterFrontEndPlugin<void> = {
120
120
  },
121
121
  execute: async () => {
122
122
  if (lastContextMenuRow) {
123
- const jsonString = JSON.stringify(lastContextMenuRow, null, 2);
123
+ // Filter out internal metadata fields before copying
124
+ const { __row_index__, ...rowData } = lastContextMenuRow;
125
+ const jsonString = JSON.stringify(rowData, null, 2);
124
126
  await navigator.clipboard.writeText(jsonString);
125
127
  // console.log('Row copied to clipboard as JSON');
126
128
 
package/src/widget.ts CHANGED
@@ -292,9 +292,7 @@ export class TabularDataViewer extends Widget {
292
292
  this._totalRows = response.totalRows;
293
293
  }
294
294
 
295
- // Calculate starting row number (1-indexed)
296
- const startingRowNumber = this._data.length - response.data.length + 1;
297
- this._renderData(response.data, startingRowNumber);
295
+ this._renderData(response.data);
298
296
  this._updateStatusBar();
299
297
  } catch (error) {
300
298
  this._showError(`Failed to load data: ${error}`);
@@ -426,15 +424,15 @@ export class TabularDataViewer extends Widget {
426
424
  /**
427
425
  * Render data rows
428
426
  */
429
- private _renderData(rows: any[], startingRowNumber: number = 1): void {
430
- rows.forEach((row, index) => {
427
+ private _renderData(rows: any[]): void {
428
+ rows.forEach((row) => {
431
429
  const tr = document.createElement('tr');
432
430
  tr.className = 'jp-TabularDataViewer-row';
433
431
 
434
- // Add row number cell
432
+ // Add row number cell using original row index from backend
435
433
  const rowNumCell = document.createElement('td');
436
434
  rowNumCell.className = 'jp-TabularDataViewer-cell jp-TabularDataViewer-rowNumberCell';
437
- rowNumCell.textContent = String(startingRowNumber + index);
435
+ rowNumCell.textContent = String(row['__row_index__'] || '');
438
436
  tr.appendChild(rowNumCell);
439
437
 
440
438
  this._columns.forEach(col => {