Skip to content

Commit a984570

Browse files
Merge pull request #276 from jupytercalpoly/dev
0.7.3
2 parents 0f82f3b + 9888adb commit a984570

File tree

4 files changed

+65
-28
lines changed

4 files changed

+65
-28
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab-tabular-data-editor",
3-
"version": "0.7.2",
3+
"version": "0.7.3",
44
"description": "EXPERIMENTAL: JupyterLab Tabular Data Editor for CSV files",
55
"keywords": [
66
"jupyter",

src/index.ts

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -503,13 +503,48 @@ function buildContextMenu(
503503

504504
export default [extension];
505505

506+
export const SIZES = {
507+
rowHeight: 21,
508+
columnWidth: 100,
509+
rowHeaderWidth: 60,
510+
columnHeaderHeight: 24
511+
};
512+
513+
const DATATYPE_ICON_SIZE = 15;
514+
506515
const DATATYPE_ICON = {
507516
colorLight: '#1e88e5',
508517
colorDark: '#2196f3',
509518
position: {
510-
size: 16,
519+
size: DATATYPE_ICON_SIZE,
511520
left: 2,
512-
top: 10
521+
top: SIZES.columnHeaderHeight / 2 - DATATYPE_ICON_SIZE / 2 + 1 / 2
522+
}
523+
};
524+
525+
const GHOST_COLUMN_ICON_SIZE = 16;
526+
527+
const GHOST_COLUMN_ICON = {
528+
colorLight: '#616161',
529+
colorDark: '#bdbdbd',
530+
position: {
531+
size: GHOST_COLUMN_ICON_SIZE,
532+
// To center.
533+
left: SIZES.columnWidth / 2 - GHOST_COLUMN_ICON_SIZE / 2,
534+
top: SIZES.columnHeaderHeight / 2 - GHOST_COLUMN_ICON_SIZE / 2
535+
}
536+
};
537+
538+
const GHOST_ROW_ICON_SIZE = 12;
539+
540+
const GHOST_ROW_ICON = {
541+
colorLight: '#616161',
542+
colorDark: '#bdbdbd',
543+
position: {
544+
size: GHOST_ROW_ICON_SIZE,
545+
// To center.
546+
left: SIZES.rowHeaderWidth / 2 - GHOST_ROW_ICON_SIZE / 2,
547+
top: SIZES.rowHeight / 2 - GHOST_ROW_ICON_SIZE / 2
513548
}
514549
};
515550

@@ -519,17 +554,13 @@ export const LIGHT_EXTRA_STYLE: PaintedGrid.ExtraStyle = {
519554
icons: {
520555
'ghost-column': {
521556
icon: addIcon,
522-
color: '#616161',
523-
size: 18,
524-
left: 63 /* set to columnWidth / 2 - size / 2 to make centered */,
525-
top: 9 /* set to columnHeaderHeight / 2 - size / 2 to make centered */
557+
color: GHOST_COLUMN_ICON.colorLight,
558+
...GHOST_COLUMN_ICON.position
526559
},
527560
'ghost-row': {
528561
icon: addIcon,
529-
color: '#616161',
530-
size: 12,
531-
left: 26 /* set to rowHeaderWidth / 2 - size / 2 to make centered */,
532-
top: 6 /* set to rowHeight / 2 - size / 2 to make centered. */
562+
color: GHOST_ROW_ICON.colorLight,
563+
...GHOST_ROW_ICON.position
533564
},
534565
string: {
535566
icon: new LabIcon({ name: 'tde:string', svgstr: stringSvgString }),
@@ -567,17 +598,13 @@ export const DARK_EXTRA_STYLE: PaintedGrid.ExtraStyle = {
567598
icons: {
568599
'ghost-column': {
569600
icon: addIcon,
570-
color: '#bdbdbd',
571-
size: 18,
572-
left: 63 /* set to columnWidth / 2 - size / 2 to make centered */,
573-
top: 9 /* set to columnHeaderHeight / 2 - size / 2 to make centered */
601+
color: GHOST_COLUMN_ICON.colorDark,
602+
...GHOST_COLUMN_ICON.position
574603
},
575604
'ghost-row': {
576605
icon: addIcon,
577-
color: '#bdbdbd',
578-
size: 12,
579-
left: 26 /* set to rowHeaderWidth / 2 - size / 2 to make centered */,
580-
top: 6 /* set to rowHeight / 2 - size / 2 to make centered. */
606+
color: GHOST_ROW_ICON.colorDark,
607+
...GHOST_ROW_ICON.position
581608
},
582609
string: {
583610
icon: new LabIcon({ name: 'tde:string', svgstr: stringSvgString }),
@@ -649,7 +676,7 @@ namespace Private {
649676
textColor: '#111111',
650677
matchBackgroundColor: '#FAE480',
651678
currentMatchBackgroundColor: '#F5C800',
652-
horizontalAlignment: 'center'
679+
horizontalAlignment: 'left'
653680
};
654681

655682
/**
@@ -659,7 +686,7 @@ namespace Private {
659686
textColor: '#F5F5F5',
660687
matchBackgroundColor: 'rgba(0, 84, 168, 0.5)',
661688
currentMatchBackgroundColor: '#0055AA',
662-
horizontalAlignment: 'center'
689+
horizontalAlignment: 'left'
663690
};
664691
}
665692

src/widget.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,15 @@ export class DSVEditor extends Widget {
6666
// Initialize the data grid.
6767
this._grid = new PaintedGrid({
6868
defaultSizes: {
69-
rowHeight: 24,
70-
columnWidth: 144,
71-
rowHeaderWidth: 64,
72-
columnHeaderHeight: 36
69+
rowHeight: 21,
70+
columnWidth: 100,
71+
rowHeaderWidth: 60,
72+
columnHeaderHeight: 24
7373
},
7474
headerVisibility: 'all'
7575
});
7676

7777
this._grid.addClass(CSV_GRID_CLASS);
78-
this._grid.headerVisibility = 'all';
7978
const keyHandler = new BasicKeyHandler();
8079
this._grid.keyHandler = keyHandler;
8180

@@ -453,14 +452,24 @@ export class DSVEditor extends Widget {
453452
: rendererConfig.horizontalAlignment,
454453
backgroundColor: this._searchService.cellBackgroundColorRendererFunc(
455454
rendererConfig
456-
)
455+
),
456+
font: '11px sans-serif'
457+
});
458+
const rowHeaderRenderer = new TextRenderer({
459+
textColor: rendererConfig.textColor,
460+
horizontalAlignment: 'center',
461+
backgroundColor: this._searchService.cellBackgroundColorRendererFunc(
462+
rendererConfig
463+
),
464+
font: '11px sans-serif'
457465
});
458466
const headerRenderer = new HeaderTextRenderer({
459467
textColor: rendererConfig.textColor,
460468
horizontalAlignment: isDataFormatted ? 'left' : 'center',
461469
backgroundColor: this._searchService.cellBackgroundColorRendererFunc(
462470
rendererConfig
463471
),
472+
font: '11px sans-serif',
464473
indent: 25,
465474
dataDetection: isDataFormatted
466475
});
@@ -469,7 +478,7 @@ export class DSVEditor extends Widget {
469478
body: renderer,
470479
'column-header': headerRenderer,
471480
'corner-header': renderer,
472-
'row-header': renderer
481+
'row-header': rowHeaderRenderer
473482
});
474483
}
475484

style/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ input[type='checkbox'] {
127127
.jp-Toolbar-item .bp3-button-text .jp-ToolbarButtonComponent-label {
128128
color: var(--jp-ui-font-color3);
129129
padding-right: 10px;
130+
font-size: var(--jp-ui-font-size1);
130131
}
131132

132133
/* Default styles for the toggle switch */

0 commit comments

Comments
 (0)