@perspective-dev/viewer-datagrid 4.3.0 → 4.4.1

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.
Files changed (87) hide show
  1. package/dist/cdn/perspective-viewer-datagrid.js +4 -22
  2. package/dist/cdn/perspective-viewer-datagrid.js.map +4 -4
  3. package/dist/css/perspective-viewer-datagrid-toolbar.css +1 -1
  4. package/dist/css/perspective-viewer-datagrid.css +1 -1
  5. package/dist/esm/color_utils.d.ts +22 -0
  6. package/dist/esm/custom_elements/datagrid.d.ts +5 -5
  7. package/dist/esm/data_listener/format_cell.d.ts +1 -1
  8. package/dist/esm/data_listener/formatter_cache.d.ts +1 -1
  9. package/dist/esm/data_listener/index.d.ts +3 -2
  10. package/dist/esm/event_handlers/click/edit_click.d.ts +3 -2
  11. package/dist/esm/event_handlers/click.d.ts +4 -6
  12. package/dist/esm/event_handlers/dispatch_click.d.ts +3 -2
  13. package/dist/esm/event_handlers/expand_collapse.d.ts +1 -1
  14. package/dist/esm/event_handlers/focus.d.ts +4 -5
  15. package/dist/esm/event_handlers/header_click.d.ts +5 -3
  16. package/dist/esm/event_handlers/keydown/edit_keydown.d.ts +3 -4
  17. package/dist/esm/event_handlers/select_region.d.ts +3 -1
  18. package/dist/esm/event_handlers/sort.d.ts +8 -7
  19. package/dist/esm/model/create.d.ts +1 -1
  20. package/dist/esm/perspective-viewer-datagrid.js +3 -3
  21. package/dist/esm/perspective-viewer-datagrid.js.map +4 -4
  22. package/dist/esm/plugin/activate.d.ts +1 -1
  23. package/dist/esm/plugin/column_style_controls.d.ts +1 -1
  24. package/dist/esm/style_handlers/body.d.ts +3 -3
  25. package/dist/esm/style_handlers/column_header.d.ts +4 -3
  26. package/dist/esm/style_handlers/consolidated.d.ts +3 -47
  27. package/dist/esm/style_handlers/editable.d.ts +3 -2
  28. package/dist/esm/style_handlers/focus.d.ts +4 -4
  29. package/dist/esm/style_handlers/group_header.d.ts +1 -1
  30. package/dist/esm/style_handlers/table_cell/boolean.d.ts +1 -1
  31. package/dist/esm/style_handlers/table_cell/cell_flash.d.ts +1 -1
  32. package/dist/esm/style_handlers/table_cell/datetime.d.ts +6 -2
  33. package/dist/esm/style_handlers/table_cell/numeric.d.ts +1 -1
  34. package/dist/esm/style_handlers/table_cell/row_header.d.ts +1 -1
  35. package/dist/esm/style_handlers/table_cell/string.d.ts +1 -1
  36. package/dist/esm/style_handlers/types.d.ts +0 -4
  37. package/dist/esm/types.d.ts +10 -17
  38. package/package.json +3 -5
  39. package/src/css/mitered-headers.css +64 -0
  40. package/src/css/perspective-viewer-datagrid.css +6 -0
  41. package/src/{less/pro.less → css/pro.css} +32 -31
  42. package/src/css/regular_table.css +589 -0
  43. package/src/{less/row-hover.less → css/row-hover.css} +48 -29
  44. package/src/{less/scrollbar.less → css/scrollbar.css} +16 -15
  45. package/src/{less/sub-cell-scroll.less → css/sub-cell-scroll.css} +14 -13
  46. package/src/{less/toolbar.less → css/toolbar.css} +57 -39
  47. package/src/ts/color_utils.ts +144 -16
  48. package/src/ts/custom_elements/datagrid.ts +11 -12
  49. package/src/ts/custom_elements/toolbar.ts +4 -5
  50. package/src/ts/data_listener/format_cell.ts +28 -9
  51. package/src/ts/data_listener/formatter_cache.ts +1 -1
  52. package/src/ts/data_listener/index.ts +4 -8
  53. package/src/ts/event_handlers/click/edit_click.ts +7 -6
  54. package/src/ts/event_handlers/click.ts +39 -68
  55. package/src/ts/event_handlers/dispatch_click.ts +24 -25
  56. package/src/ts/event_handlers/expand_collapse.ts +7 -7
  57. package/src/ts/event_handlers/focus.ts +38 -35
  58. package/src/ts/event_handlers/header_click.ts +101 -62
  59. package/src/ts/event_handlers/keydown/edit_keydown.ts +49 -52
  60. package/src/ts/event_handlers/select_region.ts +144 -133
  61. package/src/ts/event_handlers/sort.ts +16 -24
  62. package/src/ts/model/column_overrides.ts +13 -4
  63. package/src/ts/model/create.ts +55 -59
  64. package/src/ts/model/toolbar.ts +23 -7
  65. package/src/ts/plugin/activate.ts +120 -92
  66. package/src/ts/plugin/column_style_controls.ts +1 -1
  67. package/src/ts/plugin/save.ts +1 -0
  68. package/src/ts/style_handlers/body.ts +56 -61
  69. package/src/ts/style_handlers/column_header.ts +16 -19
  70. package/src/ts/style_handlers/consolidated.ts +22 -123
  71. package/src/ts/style_handlers/editable.ts +10 -8
  72. package/src/ts/style_handlers/focus.ts +5 -5
  73. package/src/ts/style_handlers/group_header.ts +3 -2
  74. package/src/ts/style_handlers/table_cell/boolean.ts +3 -3
  75. package/src/ts/style_handlers/table_cell/cell_flash.ts +11 -11
  76. package/src/ts/style_handlers/table_cell/datetime.ts +14 -11
  77. package/src/ts/style_handlers/table_cell/numeric.ts +24 -25
  78. package/src/ts/style_handlers/table_cell/row_header.ts +2 -2
  79. package/src/ts/style_handlers/table_cell/string.ts +20 -18
  80. package/src/ts/style_handlers/types.ts +0 -10
  81. package/src/ts/types.ts +28 -20
  82. package/dist/esm/event_handlers/deselect_all.d.ts +0 -5
  83. package/dist/esm/event_handlers/row_select_click.d.ts +0 -4
  84. package/src/less/mitered-headers.less +0 -65
  85. package/src/less/regular_table.less +0 -526
  86. package/src/ts/event_handlers/deselect_all.ts +0 -28
  87. package/src/ts/event_handlers/row_select_click.ts +0 -92
@@ -1,5 +1,5 @@
1
1
  import type { View } from "@perspective-dev/client";
2
- import type { DatagridPluginElement } from "../types.js";
2
+ import { type DatagridPluginElement } from "../types.js";
3
3
  /**
4
4
  * Lazy initialize this plugin with various listeners.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { ColumnType } from "@perspective-dev/client";
1
+ import type { ColumnType } from "@perspective-dev/client";
2
2
  import type { DatagridPluginElement } from "../types.js";
3
3
  interface NumberStyleOpts {
4
4
  datagrid_number_style: {
@@ -1,7 +1,7 @@
1
1
  import { RegularTableElement } from "regular-table";
2
- import { type DatagridModel, type PerspectiveViewerElement, type ColumnsConfig } from "../types.js";
3
- import { CollectedCell, LocalSelectedPositionMap, LocalSelectedRowsMap } from "./types.js";
2
+ import { type DatagridModel, type ColumnsConfig } from "../types.js";
3
+ import { CollectedCell } from "./types.js";
4
4
  /**
5
5
  * Apply styles to all body cells in a single pass.
6
6
  */
7
- export declare function applyBodyCellStyles(this: DatagridModel, cells: CollectedCell[], plugins: ColumnsConfig, isSettingsOpen: boolean, isSelectable: boolean, isEditable: boolean, regularTable: RegularTableElement, selectedRowsMap: LocalSelectedRowsMap, selectedPositionMap: LocalSelectedPositionMap, viewer: PerspectiveViewerElement): void;
7
+ export declare function applyBodyCellStyles(model: DatagridModel, cells: CollectedCell[], plugins: ColumnsConfig, isSettingsOpen: boolean, isSelectable: boolean, isEditable: boolean, regularTable: RegularTableElement): void;
@@ -1,13 +1,14 @@
1
1
  import { RegularTableElement } from "regular-table";
2
- import { type DatagridModel, type PerspectiveViewerElement } from "../types.js";
2
+ import { type DatagridModel } from "../types.js";
3
3
  import { CollectedHeaderRow } from "./types.js";
4
+ import type { HTMLPerspectiveViewerElement } from "@perspective-dev/viewer";
4
5
  /**
5
6
  * Apply selected column styling in response to column settings toggle events.
6
7
  * This is called directly (not as a style listener) when the user opens/closes
7
8
  * the column settings panel.
8
9
  */
9
- export declare function style_selected_column(this: DatagridModel, regularTable: RegularTableElement, viewer: PerspectiveViewerElement, selectedColumn: string | undefined): void;
10
+ export declare function style_selected_column(model: DatagridModel, regularTable: RegularTableElement, viewer: HTMLPerspectiveViewerElement, selectedColumn: string | undefined): void;
10
11
  /**
11
12
  * Style a single column header row.
12
13
  */
13
- export declare function styleColumnHeaderRow(this: DatagridModel, headerRow: CollectedHeaderRow, regularTable: RegularTableElement, is_menu_row: boolean): void;
14
+ export declare function styleColumnHeaderRow(model: DatagridModel, headerRow: CollectedHeaderRow, regularTable: RegularTableElement, is_menu_row: boolean): void;
@@ -1,54 +1,10 @@
1
1
  import { RegularTableElement } from "regular-table";
2
- import type { DatagridModel, PerspectiveViewerElement, ColumnsConfig, DatagridPluginElement, SelectedPosition } from "../types.js";
3
- import { CellMetadata } from "regular-table/dist/esm/types.js";
4
- interface CollectedCell {
5
- element: HTMLElement;
6
- metadata: CellMetadata;
7
- isHeader: boolean;
8
- }
9
- interface CollectedHeaderRow {
10
- row: HTMLTableRowElement;
11
- cells: Array<{
12
- element: HTMLTableCellElement;
13
- metadata: CellMetadata | undefined;
14
- }>;
15
- }
16
- /**
17
- * Context object passed through consolidated styling
18
- */
19
- export interface StyleContext {
20
- model: DatagridModel;
21
- regularTable: RegularTableElement;
22
- viewer: PerspectiveViewerElement;
23
- datagrid: DatagridPluginElement;
24
- plugins: ColumnsConfig;
25
- isSettingsOpen: boolean;
26
- isSelectable: boolean;
27
- isEditable: boolean;
28
- selectedRowsMap: Map<RegularTableElement, unknown[]>;
29
- selectedPositionMap: Map<RegularTableElement, SelectedPosition>;
30
- }
31
- type LocalSelectedRowsMap = WeakMap<RegularTableElement, unknown[]>;
32
- type LocalSelectedPositionMap = WeakMap<RegularTableElement, SelectedPosition>;
2
+ import type { DatagridModel, DatagridPluginElement, SelectedPositionMap } from "../types.js";
3
+ import type { HTMLPerspectiveViewerElement } from "@perspective-dev/viewer";
33
4
  /**
34
5
  * Consolidated style listener that handles all cell styling in a single pass.
35
6
  * This eliminates redundant DOM traversals and reduces layout thrashing by:
36
7
  * 1. Collecting all cell metadata in a read phase
37
8
  * 2. Applying all styles in a write phase
38
9
  */
39
- export declare function createConsolidatedStyleListener(datagrid: DatagridPluginElement, selectedRowsMap: LocalSelectedRowsMap, selectedPositionMap: LocalSelectedPositionMap): (this: DatagridModel, regularTable: RegularTableElement, viewer: PerspectiveViewerElement) => void;
40
- declare module "../types.js" {
41
- interface DatagridModel {
42
- _applyBodyCellStyles(cells: CollectedCell[], plugins: ColumnsConfig, isSettingsOpen: boolean, isSelectable: boolean, isEditable: boolean, regularTable: RegularTableElement, selectedRowsMap: LocalSelectedRowsMap, selectedPositionMap: LocalSelectedPositionMap, viewer: PerspectiveViewerElement): void;
43
- _applyGroupHeaderStyles(headerRows: CollectedHeaderRow[], regularTable: RegularTableElement): void;
44
- _applyColumnHeaderStyles(headerRows: CollectedHeaderRow[], regularTable: RegularTableElement, viewer: PerspectiveViewerElement): void;
45
- _applyFocusStyle(cells: CollectedCell[], regularTable: RegularTableElement, selectedPositionMap: LocalSelectedPositionMap): void;
46
- _styleColumnHeaderRow(headerRow: CollectedHeaderRow, regularTable: RegularTableElement, is_menu_row: boolean): void;
47
- }
48
- }
49
- /**
50
- * Install the styling methods on the DatagridModel prototype.
51
- * This should be called once during module initialization.
52
- */
53
- export declare function installConsolidatedStyleMethods(modelPrototype: any): void;
54
- export {};
10
+ export declare function createConsolidatedStyleListener(datagrid: DatagridPluginElement, model: DatagridModel, regularTable: RegularTableElement, viewer: HTMLPerspectiveViewerElement, selectedPositionMap: SelectedPositionMap): () => void;
@@ -1,7 +1,8 @@
1
1
  import { RegularTableElement } from "regular-table";
2
- import type { DatagridModel, PerspectiveViewerElement } from "../types.js";
2
+ import type { DatagridModel } from "../types.js";
3
+ import type { HTMLPerspectiveViewerElement } from "@perspective-dev/viewer";
3
4
  import { CollectedHeaderRow } from "./types.js";
4
5
  /**
5
6
  * Apply styles to column header rows.
6
7
  */
7
- export declare function applyColumnHeaderStyles(this: DatagridModel, headerRows: CollectedHeaderRow[], regularTable: RegularTableElement, viewer: PerspectiveViewerElement): void;
8
+ export declare function applyColumnHeaderStyles(model: DatagridModel, headerRows: CollectedHeaderRow[], regularTable: RegularTableElement, viewer: HTMLPerspectiveViewerElement): void;
@@ -1,11 +1,11 @@
1
1
  import { RegularTableElement } from "regular-table";
2
- import type { DatagridModel, SelectedPosition } from "../types.js";
3
- import { CollectedCell, LocalSelectedPositionMap } from "./types.js";
2
+ import type { DatagridModel, SelectedPositionMap } from "../types.js";
3
+ import { CollectedCell } from "./types.js";
4
4
  /**
5
5
  * Apply focus style to the selected cell.
6
6
  * Optimized to use collected cells instead of querySelectorAll.
7
7
  */
8
- export declare function applyFocusStyle(this: DatagridModel, cells: CollectedCell[], regularTable: RegularTableElement, selectedPositionMap: LocalSelectedPositionMap): void;
8
+ export declare function applyFocusStyle(_model: DatagridModel, cells: CollectedCell[], regularTable: RegularTableElement, selectedPositionMap: SelectedPositionMap): void;
9
9
  /**
10
10
  * Standalone function to focus the selected cell.
11
11
  * This collects cells from the table and tries to focus the selected position.
@@ -13,4 +13,4 @@ export declare function applyFocusStyle(this: DatagridModel, cells: CollectedCel
13
13
  *
14
14
  * Used by edit_keydown.ts for keyboard navigation.
15
15
  */
16
- export declare function focusSelectedCell(regularTable: RegularTableElement, selectedPositionMap: Map<RegularTableElement, SelectedPosition>): boolean;
16
+ export declare function focusSelectedCell(regularTable: RegularTableElement, selectedPositionMap: SelectedPositionMap): boolean;
@@ -4,4 +4,4 @@ import { CollectedHeaderRow } from "./types.js";
4
4
  /**
5
5
  * Apply styles to group header rows.
6
6
  */
7
- export declare function applyGroupHeaderStyles(this: DatagridModel, headerRows: CollectedHeaderRow[], regularTable: RegularTableElement): void;
7
+ export declare function applyGroupHeaderStyles(model: DatagridModel, headerRows: CollectedHeaderRow[], regularTable: RegularTableElement): void;
@@ -1,3 +1,3 @@
1
1
  import { CellMetadata } from "regular-table/dist/esm/types.js";
2
2
  import type { DatagridModel, ColumnConfig } from "../../types.js";
3
- export declare function cell_style_boolean(this: DatagridModel, _plugin: ColumnConfig | undefined, td: HTMLElement, metadata: CellMetadata): void;
3
+ export declare function cell_style_boolean(model: DatagridModel, _plugin: ColumnConfig | undefined, td: HTMLElement, metadata: CellMetadata): void;
@@ -1,3 +1,3 @@
1
1
  import { CellMetadataBody } from "regular-table/dist/esm/types.js";
2
2
  import type { DatagridModel, ColorRecord } from "../../types.js";
3
- export declare function style_cell_flash(this: DatagridModel, metadata: CellMetadataBody, td: HTMLElement, [, , , , , pos_s, pos_e]: ColorRecord, [, , , , , neg_s, neg_e]: ColorRecord, is_settings_open: boolean): void;
3
+ export declare function style_cell_flash(model: DatagridModel, metadata: CellMetadataBody, td: HTMLElement, [, , , , , pos_s, pos_e]: ColorRecord, [, , , , , neg_s, neg_e]: ColorRecord, is_settings_open: boolean): void;
@@ -1,3 +1,7 @@
1
1
  import { CellMetadata } from "regular-table/dist/esm/types.js";
2
- import type { DatagridModel, ColumnConfig } from "../../types.js";
3
- export declare function cell_style_datetime(this: DatagridModel, plugin: ColumnConfig, td: HTMLElement, metadata: CellMetadata): void;
2
+ import type { DatagridModel, ColumnConfig, ColorRecord } from "../../types.js";
3
+ interface PluginWithColor extends Omit<ColumnConfig, "color"> {
4
+ color?: ColorRecord;
5
+ }
6
+ export declare function cell_style_datetime(model: DatagridModel, plugin: PluginWithColor, td: HTMLElement, metadata: CellMetadata): void;
7
+ export {};
@@ -11,5 +11,5 @@ interface PluginWithColors extends Omit<ColumnConfig, "pos_fg_color" | "neg_fg_c
11
11
  pos_fg_color?: ColorRecord;
12
12
  neg_fg_color?: ColorRecord;
13
13
  }
14
- export declare function cell_style_numeric(this: DatagridModel, plugin: PluginWithColors | undefined, td: HTMLElement, metadata: CellMetaWithExtras, is_settings_open: boolean): void;
14
+ export declare function cell_style_numeric(model: DatagridModel, plugin: PluginWithColors | undefined, td: HTMLElement, metadata: CellMetaWithExtras, is_settings_open: boolean): void;
15
15
  export {};
@@ -1,4 +1,4 @@
1
1
  import { CellMetadataRowHeader } from "regular-table/dist/esm/types.js";
2
2
  import type { DatagridModel } from "../../types.js";
3
3
  import { RegularTableElement } from "regular-table";
4
- export declare function cell_style_row_header(this: DatagridModel, regularTable: RegularTableElement, td: HTMLElement, metadata: CellMetadataRowHeader): void;
4
+ export declare function cell_style_row_header(model: DatagridModel, regularTable: RegularTableElement, td: HTMLElement, metadata: CellMetadataRowHeader): void;
@@ -7,5 +7,5 @@ interface CellMetaWithExtras {
7
7
  interface PluginWithColor extends Omit<ColumnConfig, "color"> {
8
8
  color?: ColorRecord;
9
9
  }
10
- export declare function cell_style_string(this: DatagridModel, plugin: PluginWithColor | undefined, td: HTMLElement, metadata: CellMetaWithExtras): void;
10
+ export declare function cell_style_string(model: DatagridModel, plugin: PluginWithColor | undefined, td: HTMLElement, metadata: CellMetaWithExtras): void;
11
11
  export {};
@@ -1,6 +1,4 @@
1
- import { RegularTableElement } from "regular-table";
2
1
  import { CellMetadata, CellMetadataBody, CellMetadataRowHeader } from "regular-table/dist/esm/types.js";
3
- import type { SelectedPosition } from "../types.js";
4
2
  export interface CollectedCell {
5
3
  element: HTMLElement;
6
4
  metadata: CellMetadataRowHeader | CellMetadataBody;
@@ -13,5 +11,3 @@ export interface CollectedHeaderRow {
13
11
  metadata: CellMetadata | undefined;
14
12
  }>;
15
13
  }
16
- export type LocalSelectedRowsMap = WeakMap<RegularTableElement, unknown[]>;
17
- export type LocalSelectedPositionMap = WeakMap<RegularTableElement, SelectedPosition>;
@@ -1,9 +1,10 @@
1
1
  import type { View, Table, ViewConfig, ColumnType, SortDir, ViewWindow, ViewConfigUpdate } from "@perspective-dev/client";
2
- import { RegularTableElement } from "regular-table";
3
- import { CellMetadata, DataResponse } from "regular-table/dist/esm/types";
2
+ import type { HTMLPerspectiveViewerElement, ViewerConfig } from "@perspective-dev/viewer";
3
+ import type { RegularTableElement } from "regular-table";
4
+ import type { CellMetadata, DataResponse } from "regular-table/dist/esm/types";
4
5
  export type { RegularTableElement as RegularTable };
5
6
  export declare function get_psp_type(model: DatagridModel, metadata: CellMetadata): ColumnType;
6
- export type EditMode = "READ_ONLY" | "EDIT" | "SELECT_COLUMN" | "SELECT_ROW" | "SELECT_REGION";
7
+ export type EditMode = "READ_ONLY" | "EDIT" | "SELECT_COLUMN" | "SELECT_ROW" | "SELECT_REGION" | "SELECT_ROW_TREE";
7
8
  export type ColorRecord = [
8
9
  string,
9
10
  number,
@@ -100,10 +101,11 @@ export interface DatagridModel {
100
101
  _view: View;
101
102
  _table: Table;
102
103
  _table_schema: Schema;
103
- _config: ViewConfig;
104
+ _config: ViewerConfig;
104
105
  _num_rows: number;
105
106
  _num_columns?: number;
106
107
  _schema: Schema;
108
+ _theme: string;
107
109
  _ids: unknown[][];
108
110
  _plugin_background: number[];
109
111
  _color: ColorRecord;
@@ -115,6 +117,8 @@ export interface DatagridModel {
115
117
  _column_types: ColumnType[];
116
118
  _is_editable: boolean[];
117
119
  _edit_mode: EditMode;
120
+ _tree_selection_id?: unknown[];
121
+ _last_insert_configs?: ViewConfigUpdate[];
118
122
  _selection_state: SelectionState;
119
123
  _row_header_types: ColumnType[];
120
124
  _series_color_map: Map<string, Map<string, number>>;
@@ -135,17 +139,6 @@ export interface DatagridModel {
135
139
  export declare const PRIVATE_PLUGIN_SYMBOL: unique symbol;
136
140
  export type DataListener = (regularTable: RegularTableElement, x0: number, y0: number, x1: number, y1: number) => Promise<DataResponse>;
137
141
  export type StyleListener = () => void;
138
- export interface PerspectiveViewerElement extends HTMLElement {
139
- getView(): Promise<View>;
140
- getTable(): Promise<Table>;
141
- getEditPort(): Promise<number>;
142
- restore(config: Partial<ViewConfig>): Promise<void>;
143
- toggleColumnSettings(columnName?: string): Promise<void>;
144
- hasAttribute(name: string): boolean;
145
- setSelection(viewport?: ViewWindow): void;
146
- dispatchEvent(event: Event): boolean;
147
- children: HTMLCollectionOf<HTMLElement>;
148
- }
149
142
  export interface DatagridToolbarElement extends HTMLElement {
150
143
  setEditButton(button: HTMLElement): void;
151
144
  setScrollLockButton(button: HTMLElement): void;
@@ -165,7 +158,7 @@ export interface PerspectiveClickDetail {
165
158
  column_names: string[];
166
159
  config: Partial<ViewConfig>;
167
160
  }
168
- export { PerspectiveSelectDetail } from "@perspective-dev/viewer";
161
+ export { PerspectiveSelectDetail } from "@perspective-dev/viewer/src/ts/extensions.js";
169
162
  export interface HandledMouseEvent extends MouseEvent {
170
163
  handled?: boolean;
171
164
  }
@@ -184,5 +177,5 @@ export interface DatagridPluginElement extends HTMLElement {
184
177
  _reset_select?: boolean;
185
178
  _reset_column_size?: boolean;
186
179
  }
187
- export type SelectedRowsMap = WeakMap<RegularTableElement, Set<number>>;
188
180
  export type SelectedPositionMap = WeakMap<RegularTableElement, SelectedPosition>;
181
+ export declare function isEditableMode(model: DatagridModel, viewer: HTMLPerspectiveViewerElement, allowed?: boolean): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perspective-dev/viewer-datagrid",
3
- "version": "4.3.0",
3
+ "version": "4.4.1",
4
4
  "description": "Perspective datagrid plugin based on `regular-table`",
5
5
  "unpkg": "dist/cdn/perspective-viewer-datagrid.js",
6
6
  "jsdelivr": "dist/cdn/perspective-viewer-datagrid.js",
@@ -31,14 +31,12 @@
31
31
  "dependencies": {
32
32
  "@perspective-dev/client": "",
33
33
  "@perspective-dev/viewer": "",
34
- "chroma-js": ">=3 <4",
35
- "regular-table": "=0.8.3"
34
+ "regular-table": "=0.8.4"
36
35
  },
37
36
  "devDependencies": {
38
- "@prospective.co/procss": "0.1.18",
37
+ "lightningcss": "^1.29.0",
39
38
  "@perspective-dev/esbuild-plugin": "",
40
39
  "@perspective-dev/test": "",
41
- "@types/chroma-js": "^3.1.2",
42
40
  "prettier": ">=3 <4",
43
41
  "typescript": ">=5 <6",
44
42
  "zx": ">=8 <9"
@@ -0,0 +1,64 @@
1
+ /* ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2
+ * ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
3
+ * ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
4
+ * ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
5
+ * ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
6
+ * ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
7
+ * ┃ Copyright (c) 2017, the Perspective Authors. ┃
8
+ * ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
9
+ * ┃ This file is part of the Perspective library, distributed under the terms ┃
10
+ * ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11
+ * ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12
+ */
13
+
14
+ .psp-header-border:not(.psp-is-top):not(.psp-header-leaf) {
15
+ /* right */
16
+ box-shadow: 1px 0px var(--psp-inactive--border-color, #8b868045);
17
+ }
18
+
19
+ .psp-header-group {
20
+ /* bottom */
21
+ box-shadow: 0px 10px 0 -9px var(--psp-inactive--border-color, #8b868045);
22
+ }
23
+
24
+ .psp-is-top {
25
+ /* top-miter-right */
26
+ box-shadow: 5px 4px 0px -4px var(--psp-inactive--border-color, #8b868045);
27
+ }
28
+
29
+ .psp-is-top.psp-header-group:not(.psp-header-group-corner) {
30
+ /* top-miter-right and bottom */
31
+ box-shadow:
32
+ 5px 4px 0px -4px var(--psp-inactive--border-color, #8b868045),
33
+ 0px 10px 0 -9px var(--psp-inactive--border-color, #8b868045);
34
+ }
35
+
36
+ .psp-header-border.psp-header-group {
37
+ &:not(.psp-is-top):not(.psp-header-group-corner) {
38
+ /* right and bottom */
39
+ box-shadow:
40
+ 1px 0px var(--psp-inactive--border-color, #8b868045),
41
+ 0px 10px 0 -9px var(--psp-inactive--border-color, #8b868045);
42
+ }
43
+ }
44
+
45
+ perspective-viewer[settings]
46
+ tr.rt-autosize
47
+ .psp-header-leaf.psp-header-border:not(.psp-menu-enabled) {
48
+ box-shadow: 1px 0px var(--psp-inactive--border-color, #8b868045);
49
+ }
50
+
51
+ :host-context(perspective-viewer[settings])
52
+ tr.rt-autosize
53
+ .psp-header-leaf.psp-header-border:not(.psp-menu-enabled) {
54
+ box-shadow: 1px 0px var(--psp-inactive--border-color, #8b868045);
55
+ }
56
+
57
+ .psp-header-leaf.psp-header-border {
58
+ /* bottom-miter-right */
59
+ box-shadow: 5px -4px 0px -4px var(--psp-inactive--border-color, #8b868045);
60
+ }
61
+
62
+ tr:only-child th {
63
+ box-shadow: none !important;
64
+ }
@@ -0,0 +1,6 @@
1
+ @import "./pro.css";
2
+ @import "./mitered-headers.css";
3
+ @import "./row-hover.css";
4
+ @import "./sub-cell-scroll.css";
5
+ @import "./scrollbar.css";
6
+ @import "./regular_table.css";
@@ -1,22 +1,21 @@
1
- // ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2
- // ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
3
- // ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
4
- // ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
5
- // ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
6
- // ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
7
- // ┃ Copyright (c) 2017, the Perspective Authors. ┃
8
- // ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
9
- // ┃ This file is part of the Perspective library, distributed under the terms ┃
10
- // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11
- // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12
-
13
- @row-height: 19px;
1
+ /* ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2
+ * ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
3
+ * ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
4
+ * ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
5
+ * ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
6
+ * ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
7
+ * ┃ Copyright (c) 2017, the Perspective Authors. ┃
8
+ * ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
9
+ * ┃ This file is part of the Perspective library, distributed under the terms ┃
10
+ * ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11
+ * ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12
+ */
14
13
 
15
14
  regular-table {
16
15
  padding: 0;
17
16
  margin: 12px 0 0 12px;
18
17
  font-family: inherit;
19
- --rt-hover--border-color: var(--inactive--color, #c5c9d080);
18
+ --psp-datagrid--hover--border-color: var(--psp-inactive--color, #c5c9d080);
20
19
 
21
20
  div[tabindex] {
22
21
  outline: none;
@@ -35,7 +34,7 @@ regular-table {
35
34
  text-align: center;
36
35
  }
37
36
 
38
- // Header groups should overflow and not contribute to auto-sizing.
37
+ /* Header groups should overflow and not contribute to auto-sizing. */
39
38
  thead tr:not(.rt-autosize) th {
40
39
  overflow: hidden;
41
40
  max-width: 0px;
@@ -70,7 +69,7 @@ regular-table {
70
69
  text-align: left;
71
70
  }
72
71
 
73
- // frozen rows
72
+ /* frozen rows */
74
73
 
75
74
  thead tr:last-child th {
76
75
  border-bottom: 1px solid #8b868045;
@@ -95,12 +94,11 @@ regular-table {
95
94
  td,
96
95
  th {
97
96
  white-space: nowrap;
98
- font-size: 12px;
99
97
  padding-right: 5px;
100
98
  padding-left: 5px;
101
99
  padding-top: 0px;
102
100
  padding-bottom: 0px;
103
- height: @row-height;
101
+ height: var(--psp-datagrid--row--height, 19px);
104
102
  }
105
103
 
106
104
  table * {
@@ -116,7 +114,7 @@ regular-table {
116
114
  span.rt-row-header-icon {
117
115
  color: #aaa;
118
116
  padding-right: 4px;
119
- font-family: var(--button--font-family);
117
+ font-family: var(--psp-button--font-family);
120
118
  }
121
119
 
122
120
  span.rt-column-header-icon {
@@ -124,7 +122,7 @@ regular-table {
124
122
  padding-left: 3px;
125
123
  display: inline-block;
126
124
  width: 10px;
127
- font-family: var(--button--font-family);
125
+ font-family: var(--psp-button--font-family);
128
126
  }
129
127
 
130
128
  span.rt-row-header-icon:hover {
@@ -141,17 +139,17 @@ regular-table {
141
139
  text-overflow: ellipsis;
142
140
  }
143
141
 
144
- // OPTIONAL zebra striping
142
+ /* OPTIONAL zebra striping */
145
143
 
146
- // @zebra-stripe-color: rgb(238,238,238);
144
+ /* @zebra-stripe-color: rgb(238,238,238); */
147
145
 
148
- // tbody tr:nth-child(even) td:not(.rt-group-header) {
149
- // background: @zebra-stripe-color;
150
- // }
146
+ /* tbody tr:nth-child(even) td:not(.rt-group-header) { */
147
+ /* background: @zebra-stripe-color; */
148
+ /* } */
151
149
 
152
- // tbody tr:nth-child(even) span.rt-group-name {
153
- // background: @zebra-stripe-color;
154
- // }
150
+ /* tbody tr:nth-child(even) span.rt-group-name { */
151
+ /* background: @zebra-stripe-color; */
152
+ /* } */
155
153
 
156
154
  td span.rt-group-name,
157
155
  th span.rt-group-name {
@@ -182,15 +180,18 @@ regular-table {
182
180
  }
183
181
 
184
182
  a {
185
- color: var(--rt-pos-cell--color);
183
+ color: var(--psp-datagrid--pos-cell--color);
186
184
  }
187
185
 
188
186
  a:visited {
189
- color: var(--active--color);
187
+ color: var(--psp-active--color);
190
188
  }
191
189
 
192
190
  td.psp-null:after,
193
191
  th.psp-null:after {
194
- content: var(--null--content, "-");
192
+ content: var(--psp-label--null--content, "-");
193
+ color: var(--psp-label--null--color, inherit);
194
+ font-size: var(--psp-label--null--font-size, inherit);
195
+ vertical-align: middle;
195
196
  }
196
197
  }