@perspective-dev/viewer-datagrid 4.3.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.
@@ -1,17 +1,18 @@
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
- // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
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
+ */
12
13
 
13
- // Handles sub-cell scrolling via CSS transform offset by variables set during
14
- // rendering.
14
+ /* Handles sub-cell scrolling via CSS transform offset by variables set during */
15
+ /* rendering. */
15
16
  perspective-viewer-datagrid:not(.sub-cell-scroll-disabled) regular-table table,
16
17
  :host(:not(.sub-cell-scroll-disabled)) regular-table table {
17
18
  tbody td,
@@ -1,14 +1,15 @@
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
- // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
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
+ */
12
13
 
13
14
  :host {
14
15
  position: relative;
@@ -42,9 +43,9 @@
42
43
 
43
44
  &:hover {
44
45
  box-shadow:
45
- -4px 0 0 var(--icon--color),
46
- 4px 0 0 var(--icon--color);
47
- background-color: var(--icon--color);
46
+ -4px 0 0 var(--psp--color),
47
+ 4px 0 0 var(--psp--color);
48
+ background-color: var(--psp--color);
48
49
  }
49
50
  }
50
51
 
@@ -54,11 +55,11 @@
54
55
  }
55
56
 
56
57
  #scroll_lock.lock-scroll:before {
57
- -webkit-mask-image: var(--toolbar-scroll-lock-active--content);
58
+ -webkit-mask-image: var(--psp-toolbar-scroll-lock-active--content);
58
59
  }
59
60
 
60
61
  #scroll_lock:before {
61
- -webkit-mask-image: var(--toolbar-scroll-lock--content);
62
+ -webkit-mask-image: var(--psp-toolbar-scroll-lock--content);
62
63
  }
63
64
 
64
65
  #select_mode:before {
@@ -70,69 +71,75 @@
70
71
  }
71
72
 
72
73
  #edit_mode[data-edit-mode="READ_ONLY"]:before {
73
- -webkit-mask-image: var(--toolbar-edit-mode--read-only--content);
74
+ -webkit-mask-image: var(--psp-toolbar-edit-mode-read-only--content);
74
75
  }
75
76
 
76
77
  #edit_mode[data-edit-mode="EDIT"]:before {
77
- -webkit-mask-image: var(--toolbar-edit-mode--edit--content);
78
+ -webkit-mask-image: var(--psp-toolbar-edit-mode-edit--content);
78
79
  }
79
80
 
80
81
  :host(.aggregated) #toolbar #edit_mode[data-edit-mode="EDIT"]:before {
81
- -webkit-mask-image: var(--toolbar-edit-mode--read-only--content);
82
+ -webkit-mask-image: var(--psp-toolbar-edit-mode-read-only--content);
82
83
  }
83
84
 
84
85
  #edit_mode[data-edit-mode="SELECT_ROW"]:before {
85
- -webkit-mask-image: var(--toolbar-edit-mode--select-row--content);
86
+ -webkit-mask-image: var(--psp-toolbar-edit-mode-select-row--content);
86
87
  }
87
88
 
88
89
  #edit_mode[data-edit-mode="SELECT_COLUMN"]:before {
89
- -webkit-mask-image: var(--toolbar-edit-mode--select-column--content);
90
+ -webkit-mask-image: var(--psp-toolbar-edit-mode-select-column--content);
90
91
  }
91
92
 
92
93
  #edit_mode[data-edit-mode="SELECT_REGION"]:before {
93
- -webkit-mask-image: var(--toolbar-edit-mode--select-region--content);
94
+ -webkit-mask-image: var(--psp-toolbar-edit-mode-select-region--content);
94
95
  }
95
96
 
96
- // #edit_mode span:before {
97
- // content: var(--edit-mode-toggle--content, "N/A");
98
- // }
97
+ /* #edit_mode span:before { */
98
+ /* content: var(--edit-mode-toggle--content, "N/A"); */
99
+ /* } */
99
100
 
100
101
  #edit_mode[data-edit-mode="READ_ONLY"] span:before {
101
- content: var(--edit-mode--read-only--content, "Read Only");
102
+ content: var(--psp-label--edit-mode-read-only--content, "Read Only");
102
103
  }
103
104
 
104
105
  #edit_mode[data-edit-mode="EDIT"] span:before {
105
- content: var(--edit-mode--edit--content, "Editable");
106
+ content: var(--psp-label--edit-mode-edit--content, "Editable");
106
107
  }
107
108
 
108
109
  #edit_mode[data-edit-mode="SELECT_ROW"] span:before {
109
- content: var(--edit-mode--select-row--content, "Row Select");
110
+ content: var(--psp-label--edit-mode-select-row--content, "Row Select");
110
111
  }
111
112
 
112
113
  #edit_mode[data-edit-mode="SELECT_COLUMN"] span:before {
113
- content: var(--edit-mode--select-column--content, "Column Select");
114
+ content: var(
115
+ --psp-label--edit-mode-select-column--content,
116
+ "Column Select"
117
+ );
114
118
  }
115
119
 
116
120
  #edit_mode[data-edit-mode="SELECT_REGION"] span:before {
117
- content: var(--edit-mode--select-region--content, "Region Select");
121
+ content: var(
122
+ --psp-label--edit-mode-select-region--content,
123
+ "Region Select"
124
+ );
118
125
  }
119
126
 
120
127
  #scroll_lock span:before {
121
- content: var(--scroll-lock-toggle--content, "Free Scroll");
128
+ content: var(--psp-label--scroll-lock-toggle--content, "Free Scroll");
122
129
  }
123
130
 
124
131
  #scroll_lock.lock-scroll span:before {
125
- content: var(--scroll-lock-alt-toggle--content, "Align Scroll");
132
+ content: var(--psp-label--scroll-lock-alt-toggle--content, "Align Scroll");
126
133
  }
127
134
 
128
- // The icon.
135
+ /* The icon. */
129
136
  .button:before {
130
137
  width: 21px;
131
138
  height: 21px;
132
139
  content: "";
133
140
  -webkit-mask-size: cover;
134
141
  mask-size: cover;
135
- background-color: var(--icon--color);
142
+ background-color: var(--psp--color);
136
143
  }
137
144
 
138
145
  .button.editable:before,
@@ -167,8 +174,8 @@
167
174
  .hover-target:focus-within .button,
168
175
  .hover-target:hover .button {
169
176
  position: relative;
170
- background-color: var(--icon--color);
171
- color: var(--plugin--background);
177
+ background-color: var(--psp--color);
178
+ color: var(--psp--background-color);
172
179
  opacity: 1;
173
180
  display: flex;
174
181
  align-items: center;
@@ -177,10 +184,10 @@
177
184
 
178
185
  .hover-target:focus-within .button:before,
179
186
  .hover-target:hover .button:before {
180
- background-color: var(--plugin--background);
187
+ background-color: var(--psp--background-color);
181
188
  }
182
189
 
183
- // The label.
190
+ /* The label. */
184
191
  .hover-target:focus-within .button > span,
185
192
  .hover-target:hover .button > span {
186
193
  display: block;
@@ -194,7 +201,7 @@
194
201
  white-space: pre-wrap;
195
202
  line-height: 1;
196
203
  font-size: 9px;
197
- background-color: var(--icon--color);
204
+ background-color: var(--psp--color);
198
205
  width: 35px;
199
206
  text-align: center;
200
207
  border-radius: 0 0 3px 3px;
@@ -152,15 +152,15 @@ export async function createModel(
152
152
  ]);
153
153
 
154
154
  const _plugin_background = chroma(
155
- get_rule(regular, "--plugin--background", "#FFFFFF"),
155
+ get_rule(regular, "--psp--background-color", "#FFFFFF"),
156
156
  ).rgb();
157
157
 
158
158
  const _pos_fg_color = make_color_record(
159
- get_rule(regular, "--rt-pos-cell--color", "#338DCD"),
159
+ get_rule(regular, "--psp-datagrid--pos-cell--color", "#338DCD"),
160
160
  );
161
161
 
162
162
  const _neg_fg_color = make_color_record(
163
- get_rule(regular, "--rt-neg-cell--color", "#FF5942"),
163
+ get_rule(regular, "--psp-datagrid--neg-cell--color", "#FF5942"),
164
164
  );
165
165
 
166
166
  const _pos_bg_color = make_color_record(
@@ -172,7 +172,7 @@ export async function createModel(
172
172
  );
173
173
 
174
174
  const _color = make_color_record(
175
- get_rule(regular, "--active--color", "#ff0000"),
175
+ get_rule(regular, "--psp-active--color", "#ff0000"),
176
176
  );
177
177
 
178
178
  const _schema: Schema = {
@@ -65,18 +65,20 @@ export function applyBodyCellStyles(
65
65
 
66
66
  // Calculate aggregate depth visibility
67
67
  // @ts-ignore
68
- metadata._is_hidden_by_aggregate_depth = ((x?: number) =>
69
- x === 0 || x === undefined
70
- ? false
71
- : x - 1 <
72
- Math.min(
73
- this._config.group_by.length,
74
- plugin?.aggregate_depth || 0,
75
- ))(
76
- (metadata.row_header as unknown[] | undefined)?.filter(
77
- (x) => x !== undefined,
78
- )?.length,
79
- );
68
+ metadata._is_hidden_by_aggregate_depth =
69
+ this._config.group_rollup_mode === "rollup" &&
70
+ ((x?: number) =>
71
+ x === 0 || x === undefined
72
+ ? false
73
+ : x - 1 <
74
+ Math.min(
75
+ this._config.group_by.length,
76
+ plugin?.aggregate_depth || 0,
77
+ ))(
78
+ (metadata.row_header as unknown[] | undefined)?.filter(
79
+ (x) => x !== undefined,
80
+ )?.length,
81
+ );
80
82
 
81
83
  // Apply type-specific cell styling
82
84
  if (is_numeric) {
@@ -92,7 +94,7 @@ export function applyBodyCellStyles(
92
94
  } else if (type === "string") {
93
95
  cell_style_string.call(this, plugin as any, td, metadata as any);
94
96
  } else if (type === "date" || type === "datetime") {
95
- cell_style_datetime.call(this, plugin as any, td, metadata as any);
97
+ cell_style_datetime.call(this, plugin as any, td, metadata);
96
98
  } else {
97
99
  td.style.backgroundColor = "";
98
100
  td.style.color = "";
@@ -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: ColumnConfig,
26
+ plugin: PluginWithColor,
23
27
  td: HTMLElement,
24
28
  metadata: CellMetadata,
25
29
  ): void {
26
- const colorRecord: ColorRecord = //(() => {
27
- // if (plugin?.color !== undefined) {
28
- // return plugin.color;
29
- // } else {
30
- // return
31
- this._color;
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
 
@@ -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
- }