@perspective-dev/viewer-datagrid 4.2.0 → 4.4.0
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/dist/cdn/perspective-viewer-datagrid.js +5 -4
- package/dist/cdn/perspective-viewer-datagrid.js.map +4 -4
- package/dist/css/perspective-viewer-datagrid-toolbar.css +1 -1
- package/dist/css/perspective-viewer-datagrid.css +1 -1
- package/dist/esm/custom_elements/datagrid.d.ts +1 -0
- package/dist/esm/data_listener/format_tree_header.d.ts +1 -0
- package/dist/esm/event_handlers/row_select_click.d.ts +1 -1
- package/dist/esm/perspective-viewer-datagrid.js +3 -3
- package/dist/esm/perspective-viewer-datagrid.js.map +3 -3
- package/dist/esm/style_handlers/table_cell/datetime.d.ts +6 -2
- package/dist/esm/types.d.ts +3 -8
- package/package.json +3 -3
- package/src/css/mitered-headers.css +64 -0
- package/src/css/perspective-viewer-datagrid.css +6 -0
- package/src/{less/pro.less → css/pro.css} +32 -31
- package/src/{less/regular_table.less → css/regular_table.css} +196 -172
- package/src/{less/row-hover.less → css/row-hover.css} +28 -22
- package/src/{less/scrollbar.less → css/scrollbar.css} +16 -15
- package/src/{less/sub-cell-scroll.less → css/sub-cell-scroll.css} +14 -13
- package/src/{less/toolbar.less → css/toolbar.css} +46 -39
- package/src/ts/custom_elements/datagrid.ts +5 -0
- package/src/ts/data_listener/format_tree_header.ts +16 -0
- package/src/ts/data_listener/index.ts +24 -4
- package/src/ts/event_handlers/row_select_click.ts +19 -16
- package/src/ts/event_handlers/sort.ts +10 -7
- package/src/ts/model/create.ts +12 -8
- package/src/ts/plugin/draw.ts +1 -0
- package/src/ts/style_handlers/body.ts +20 -13
- package/src/ts/style_handlers/column_header.ts +9 -8
- package/src/ts/style_handlers/table_cell/datetime.ts +12 -9
- package/src/ts/types.ts +3 -7
- package/src/less/mitered-headers.less +0 -65
|
@@ -97,9 +97,11 @@ export function styleColumnHeaderRow(
|
|
|
97
97
|
regularTable: RegularTableElement,
|
|
98
98
|
is_menu_row: boolean,
|
|
99
99
|
): void {
|
|
100
|
-
const header_depth =
|
|
101
|
-
|
|
100
|
+
const header_depth =
|
|
101
|
+
this._config.group_by.length -
|
|
102
|
+
(this._config.group_rollup_mode === "flat" ? 1 : 0);
|
|
102
103
|
|
|
104
|
+
const selectedColumn = this._column_settings_selected_column;
|
|
103
105
|
for (const { element: td, metadata } of headerRow.cells) {
|
|
104
106
|
if (
|
|
105
107
|
!metadata ||
|
|
@@ -110,14 +112,13 @@ export function styleColumnHeaderRow(
|
|
|
110
112
|
|
|
111
113
|
const column_name =
|
|
112
114
|
metadata.column_header?.[this._config.split_by.length];
|
|
115
|
+
|
|
113
116
|
const sort = this._config.sort.find((x) => x[0] === column_name);
|
|
114
|
-
let needs_border =
|
|
115
|
-
metadata.type === "corner" &&
|
|
116
|
-
metadata.row_header_x === header_depth;
|
|
117
117
|
const is_corner = typeof metadata.x === "undefined";
|
|
118
|
-
needs_border =
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
const needs_border =
|
|
119
|
+
(metadata.type === "corner" &&
|
|
120
|
+
metadata.row_header_x === header_depth) ||
|
|
121
|
+
(!is_corner &&
|
|
121
122
|
(metadata.x + 1) % this._config.columns.length === 0);
|
|
122
123
|
|
|
123
124
|
td.classList.toggle("psp-header-border", needs_border);
|
|
@@ -17,20 +17,23 @@ import {
|
|
|
17
17
|
} from "../../color_utils.js";
|
|
18
18
|
import type { DatagridModel, ColumnConfig, ColorRecord } from "../../types.js";
|
|
19
19
|
|
|
20
|
+
interface PluginWithColor extends Omit<ColumnConfig, "color"> {
|
|
21
|
+
color?: ColorRecord;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
export function cell_style_datetime(
|
|
21
25
|
this: DatagridModel,
|
|
22
|
-
plugin:
|
|
26
|
+
plugin: PluginWithColor,
|
|
23
27
|
td: HTMLElement,
|
|
24
28
|
metadata: CellMetadata,
|
|
25
29
|
): void {
|
|
26
|
-
const colorRecord: ColorRecord =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// })();
|
|
30
|
+
const colorRecord: ColorRecord = (() => {
|
|
31
|
+
if (plugin?.color !== undefined) {
|
|
32
|
+
return plugin.color;
|
|
33
|
+
} else {
|
|
34
|
+
return this._color;
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
34
37
|
|
|
35
38
|
const [hex, r, g, b] = colorRecord;
|
|
36
39
|
|
package/src/ts/types.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
ColumnType,
|
|
18
18
|
SortDir,
|
|
19
19
|
ViewWindow,
|
|
20
|
+
ViewConfigUpdate,
|
|
20
21
|
} from "@perspective-dev/client";
|
|
21
22
|
import { RegularTableElement } from "regular-table";
|
|
22
23
|
import { CellMetadata, DataResponse } from "regular-table/dist/esm/types";
|
|
@@ -244,7 +245,7 @@ export type FormatterCache = Map<string, FormatterCacheEntry>;
|
|
|
244
245
|
export interface CellConfigResult {
|
|
245
246
|
row: Record<string, unknown>;
|
|
246
247
|
column_names: string[];
|
|
247
|
-
config:
|
|
248
|
+
config: ViewConfigUpdate;
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
// Custom event detail types
|
|
@@ -254,12 +255,7 @@ export interface PerspectiveClickDetail {
|
|
|
254
255
|
config: Partial<ViewConfig>;
|
|
255
256
|
}
|
|
256
257
|
|
|
257
|
-
export
|
|
258
|
-
selected: boolean;
|
|
259
|
-
row: Record<string, unknown>;
|
|
260
|
-
column_names?: string[];
|
|
261
|
-
config: Partial<ViewConfig>;
|
|
262
|
-
}
|
|
258
|
+
export { PerspectiveSelectDetail } from "@perspective-dev/viewer";
|
|
263
259
|
|
|
264
260
|
// Mouse event with handled flag
|
|
265
261
|
export interface HandledMouseEvent extends MouseEvent {
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
.psp-header-border:not(.psp-is-top):not(.psp-header-leaf) {
|
|
14
|
-
// right
|
|
15
|
-
box-shadow: 1px 0px var(--inactive--border-color, #8b868045);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.psp-header-group {
|
|
19
|
-
// bottom
|
|
20
|
-
box-shadow: 0px 10px 0 -9px var(--inactive--border-color, #8b868045);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.psp-is-top {
|
|
24
|
-
// top-miter-right
|
|
25
|
-
box-shadow: 5px 4px 0px -4px var(--inactive--border-color, #8b868045);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.psp-is-top.psp-header-group:not(.psp-header-group-corner) {
|
|
29
|
-
// top-miter-right and bottom
|
|
30
|
-
box-shadow:
|
|
31
|
-
5px 4px 0px -4px var(--inactive--border-color, #8b868045),
|
|
32
|
-
0px 10px 0 -9px var(--inactive--border-color, #8b868045);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.psp-header-border.psp-header-group {
|
|
36
|
-
&:not(.psp-is-top):not(.psp-header-group-corner) {
|
|
37
|
-
// right and bottom
|
|
38
|
-
box-shadow:
|
|
39
|
-
1px 0px var(--inactive--border-color, #8b868045),
|
|
40
|
-
0px 10px 0 -9px var(--inactive--border-color, #8b868045);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@mixin disabled-menu-funky-box-shadow {
|
|
45
|
-
tr.rt-autosize .psp-header-leaf.psp-header-border:not(.psp-menu-enabled) {
|
|
46
|
-
box-shadow: 1px 0px var(--inactive--border-color, #8b868045);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
perspective-viewer[settings] {
|
|
51
|
-
@include disabled-menu-funky-box-shadow;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
:host-context(perspective-viewer[settings]) {
|
|
55
|
-
@include disabled-menu-funky-box-shadow;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.psp-header-leaf.psp-header-border {
|
|
59
|
-
// bottom-miter-right
|
|
60
|
-
box-shadow: 5px -4px 0px -4px var(--inactive--border-color, #8b868045);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
tr:only-child th {
|
|
64
|
-
box-shadow: none !important;
|
|
65
|
-
}
|