@perspective-dev/workspace 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.
@@ -0,0 +1,124 @@
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
+ perspective-workspace,
14
+ perspective-workspace[theme="Pro Dark"],
15
+ perspective-indicator[theme="Pro Dark"] {
16
+ --psp-theme-name: "Pro Dark";
17
+ }
18
+
19
+ perspective-workspace perspective-viewer {
20
+ --psp-status-bar--height: 39px;
21
+ --psp-plugin-selector--height: 47px;
22
+ }
23
+
24
+ perspective-workspace perspective-viewer.widget-maximize {
25
+ --modal-panel--margin: -4px 0 -4px 0;
26
+ --psp-status-bar--border-radius: 6px 0 0 0;
27
+ --psp-main-column--margin: 3px 0 3px 3px;
28
+ --psp-main-column--border: 1px solid var(--psp-inactive--color);
29
+ --psp-main-column--border-width: 1px 0px 1px 1px;
30
+ --psp-main-column--border-radius: 6px 0 0 6px;
31
+ --settings-button--margin: 10px 0 0 0;
32
+ }
33
+
34
+ perspective-workspace {
35
+ /* perspective-workspace-pro-base */
36
+ font-family:
37
+ "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas",
38
+ "Liberation Mono", monospace;
39
+ --open-settings-button--content: "expand_more";
40
+ --close-settings-button--content: "expand_less";
41
+ --close-button--content: "\2715";
42
+ --master-divider--background-color: #243136;
43
+ --menu-maximize--content: "fullscreen";
44
+ --menu-minimize--content: "fullscreen_exit";
45
+ --menu-duplicate--content: "call_split";
46
+ --menu-master--content: "cast";
47
+ --menu-detail--content: "notes";
48
+ --menu-export--content: "file_download";
49
+ --menu-copy--content: "file_copy";
50
+ --menu-reset--content: "autorenew";
51
+ --menu-link--content: "link";
52
+ --menu-unlink--content: "link_off";
53
+ --menu-newmenu--content: "add";
54
+ --menu-close--content: "close";
55
+ --menu-new--content: "description";
56
+ --menu-newview--content: "file_copy";
57
+
58
+ --psp-workspace--tabbar--border: 1px solid var(--psp-inactive--color);
59
+ --psp-workspace--tabbar--border-width: 0px 1px 1px 1px;
60
+ --psp-workspace--tabbar--border-radius: 6px;
61
+ --psp-workspace--tabbar--border-color: var(--psp-inactive--color);
62
+ --psp-workspace--tabbar-tab--border-width: 1px 1px 0px 1px;
63
+
64
+ /* Workspace */
65
+ --psp-icon--column-drag-handle--mask-image: url("../svg/drag-handle.svg");
66
+ --psp-icon--bookmarks--mask-image: url("../svg/bookmark-icon.svg");
67
+
68
+ /* perspective-viewer-pro-dark--colors */
69
+ background-color: #242526;
70
+ --psp-workspace--split-panel-handle--background-color: #242526;
71
+ color: white;
72
+ --psp--color: white;
73
+ --psp-active--color: #2770a9;
74
+ --psp-error--color: #ff9485;
75
+ --psp-inactive--color: #61656e;
76
+ --psp-inactive--border-color: #4c505b;
77
+ --psp--background-color: #242526;
78
+ --psp-active--background: rgba(39, 113, 170, 0.5);
79
+ --psp-expression--operator--color: #c5c9d0;
80
+ --psp-expression--function--color: #22a0ce;
81
+ --psp-expression--error--color: rgb(255, 136, 136);
82
+ --psp-calendar--filter: invert(1);
83
+ --psp-warning--color: #242526;
84
+ --psp-warning--background: var(--psp--color);
85
+
86
+ --psp-icon--select-arrow--mask-image: var(
87
+ --psp-icon--select-arrow-light--mask-image
88
+ );
89
+
90
+ --psp-icon--select-arrow-hover--mask-image: var(
91
+ --psp-icon--select-arrow-dark--mask-image
92
+ );
93
+
94
+ /* Syntax */
95
+ --psp-code-editor--symbol--color: white;
96
+ --psp-code-editor--literal--color: #7dc3f0;
97
+ --psp-code-editor--operator--color: rgb(23, 166, 123);
98
+ --psp-code-editor--comment--color: rgb(204, 120, 48);
99
+ --psp-code-editor--column--color: #e18ee1;
100
+
101
+ background-color: #000202;
102
+ color: white;
103
+ --workspace-tabbar--background-color: #242526;
104
+ --workspace-secondary--color: #c5c9d0;
105
+ --psp-workspace--tabbar--border: 1px solid var(--psp-inactive--color);
106
+ --psp-workspace--tabbar--border-width: 1px 1px 1px 1px;
107
+ --psp-workspace--tabbar--border-radius: 6px;
108
+ --psp-workspace--tabbar--border-color: var(--psp-inactive--color);
109
+ --psp-workspace--tabbar-tab--border-width: 1px 1px 0 1px;
110
+ }
111
+
112
+ perspective-viewer[theme="Pro Dark"].workspace-master-widget {
113
+ --psp--background-color: #242526;
114
+ }
115
+
116
+ perspective-workspace-menu {
117
+ font-family:
118
+ "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas",
119
+ "Liberation Mono", monospace;
120
+ font-weight: 300;
121
+ background: #2a2c2f !important;
122
+ color: white !important;
123
+ border: 1px solid #3b3f46 !important;
124
+ }
@@ -1,16 +1,14 @@
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
- @import url("ref://pro.less");
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
+ * ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ */
14
12
 
15
13
  .lm-cursor-backdrop {
16
14
  display: none;
@@ -19,42 +17,11 @@
19
17
  perspective-workspace,
20
18
  perspective-workspace[theme="Pro Light"],
21
19
  perspective-indicator[theme="Pro Light"] {
22
- --theme-name: "Pro Light";
20
+ --psp-theme-name: "Pro Light";
23
21
  }
24
22
 
25
23
  perspective-workspace {
26
- @include perspective-workspace-pro-base;
27
- @include perspective-viewer-pro--colors;
28
- background-color: #dadada;
29
- }
30
-
31
- perspective-workspace perspective-viewer.widget-maximize {
32
- --modal-panel--margin: -4px 0 -4px 0;
33
- --status-bar--border-radius: 6px 0 0 0;
34
- --main-column--margin: 3px 0 3px 3px;
35
- --main-column--border: 1px solid var(--inactive--color);
36
- --main-column--border-width: 1px 0px 1px 1px;
37
- --main-column--border-radius: 6px 0 0 6px;
38
- --settings-button--margin: 10px 0 0 0;
39
- }
40
-
41
- perspective-workspace perspective-viewer {
42
- --status-bar--height: 39px;
43
- --plugin-selector--height: 47px;
44
- }
45
-
46
- perspective-viewer[theme="Pro Light"].workspace-master-widget {
47
- background-color: #f2f4f6;
48
- --plugin--background: #f2f4f6;
49
- regular-table {
50
- td,
51
- th {
52
- border-color: #e0e4e9;
53
- }
54
- }
55
- }
56
-
57
- @mixin perspective-workspace-pro-base {
24
+ /* perspective-workspace-pro-base */
58
25
  font-family:
59
26
  "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas",
60
27
  "Liberation Mono", monospace;
@@ -76,21 +43,73 @@ perspective-viewer[theme="Pro Light"].workspace-master-widget {
76
43
  --menu-close--content: "close";
77
44
  --menu-new--content: "description";
78
45
  --menu-newview--content: "file_copy";
79
- --workspace-split-panel-handle--background-color: #f2f4f6;
46
+ --psp-workspace--split-panel-handle--background-color: #f2f4f6;
80
47
 
81
- --workspace-tabbar--border: 1px solid var(--inactive--color);
82
- --workspace-tabbar--border-width: 1px 1px 1px 1px;
83
- --workspace-tabbar--border-radius: 6px;
84
- --workspace-tabbar--border-color: var(--inactive--color);
85
- --workspace-tabbar-tab--border-width: 1px 1px 0px 1px;
48
+ --psp-workspace--tabbar--border: 1px solid var(--psp-inactive--color);
49
+ --psp-workspace--tabbar--border-width: 1px 1px 1px 1px;
50
+ --psp-workspace--tabbar--border-radius: 6px;
51
+ --psp-workspace--tabbar--border-color: var(--psp-inactive--color);
52
+ --psp-workspace--tabbar-tab--border-width: 1px 1px 0px 1px;
86
53
 
87
- // Workspace
88
- --column-drag-handle--mask-image: url("../svg/drag-handle.svg");
89
- --bookmarks--mask-image: url("../svg/bookmark-icon.svg");
54
+ /* Workspace */
55
+ --psp-icon--column-drag-handle--mask-image: url("../svg/drag-handle.svg");
56
+ --psp-icon--bookmarks--mask-image: url("../svg/bookmark-icon.svg");
57
+
58
+ /* perspective-viewer-pro--colors */
59
+ color: #161616;
60
+ background-color: #dadada;
61
+ --psp--color: #161616;
62
+ --psp-inactive--color: #ababab;
63
+ --psp-inactive--border-color: #dadada;
64
+
65
+ --psp-active--color: #2670a9;
66
+ --psp-error--color: #ff471e;
67
+ --psp--background-color: #ffffff;
68
+ --psp-icon-overflow-hint--color: rgba(0, 0, 0, 0.2);
69
+ --psp-select--background-color: none;
70
+ --psp-warning--background: #042121;
71
+ --psp-warning--color: #fdfffd;
72
+
73
+ --psp-icon--select-arrow--mask-image: var(
74
+ --psp-icon--select-arrow-dark--mask-image
75
+ );
76
+
77
+ --psp-icon--select-arrow-hover--mask-image: var(
78
+ --psp-icon--select-arrow-light--mask-image
79
+ );
80
+
81
+ /* TODO deprecate me */
82
+ --psp-icon-overflow-hint--color: #fdfffd;
83
+ }
84
+
85
+ perspective-workspace perspective-viewer.widget-maximize {
86
+ /* --modal-panel--margin: -4px 0 -4px 0; */
87
+ --psp-status-bar--border-radius: 6px 0 0 0;
88
+ --psp-main-column--margin: 3px 0 3px 3px;
89
+ --psp-main-column--border: 1px solid var(--psp-inactive--color);
90
+ --psp-main-column--border-width: 1px 0px 1px 1px;
91
+ --psp-main-column--border-radius: 6px 0 0 6px;
92
+ /* --settings-button--margin: 10px 0 0 0; */
93
+ }
94
+
95
+ perspective-workspace perspective-viewer {
96
+ --psp-status-bar--height: 39px;
97
+ --psp-plugin-selector--height: 47px;
98
+ }
99
+
100
+ perspective-viewer[theme="Pro Light"].workspace-master-widget {
101
+ background-color: #f2f4f6;
102
+ --psp--background-color: #f2f4f6;
103
+ regular-table {
104
+ td,
105
+ th {
106
+ border-color: #e0e4e9;
107
+ }
108
+ }
90
109
  }
91
110
 
92
111
  perspective-viewer {
93
- --bookmarks--mask-image: url("../svg/bookmark-icon.svg");
112
+ --psp-icon--bookmarks--mask-image: url("../svg/bookmark-icon.svg");
94
113
  }
95
114
 
96
115
  perspective-workspace-menu {
@@ -22,7 +22,7 @@ export { PerspectiveViewerWidget } from "./workspace/widget";
22
22
  export * from "./extensions";
23
23
  import { PerspectiveWorkspace, PerspectiveWorkspaceConfig } from "./workspace";
24
24
  import { bindTemplate, CustomElementProto } from "./utils/custom_elements";
25
- import style from "../../build/css/workspace.css";
25
+ import style from "../../dist/css/workspace.css";
26
26
  import template from "../html/workspace.html";
27
27
 
28
28
  export { PerspectiveWorkspaceConfig };
@@ -17,6 +17,7 @@ import { Signal } from "@lumino/signaling";
17
17
  import type {
18
18
  HTMLPerspectiveViewerCopyMenuElement,
19
19
  HTMLPerspectiveViewerExportMenuElement,
20
+ ViewerConfigUpdate,
20
21
  } from "@perspective-dev/viewer";
21
22
 
22
23
  import type { PerspectiveWorkspace } from "./workspace";
@@ -141,7 +142,7 @@ export const createCommands = (
141
142
  args.target_widget_name as string,
142
143
  )!;
143
144
 
144
- const config = await target_widget.save();
145
+ const config = (await target_widget.save()) as ViewerConfigUpdate;
145
146
  const new_widget = await workspace._createWidgetAndNode({
146
147
  config,
147
148
  slot: undefined,
@@ -149,7 +149,7 @@ export class PerspectiveDockPanel extends DockPanel {
149
149
  parseInt(
150
150
  window
151
151
  .getComputedStyle(this._workspace.element)
152
- .getPropertyValue("--workspace-spacing"),
152
+ .getPropertyValue("--psp-workspace--spacing"),
153
153
  ) || 0;
154
154
  1;
155
155
  }
@@ -67,11 +67,8 @@ export class PerspectiveViewerWidget extends Widget {
67
67
  }
68
68
 
69
69
  async save() {
70
- let config = {
71
- ...(await this.viewer.save()),
72
- };
73
-
74
- delete config["settings"];
70
+ let config = await this.viewer.save();
71
+ config["settings"] = false;
75
72
  return config;
76
73
  }
77
74
 
@@ -16,19 +16,18 @@ import { CommandRegistry } from "@lumino/commands";
16
16
  import { SplitPanel, Panel, DockPanel } from "@lumino/widgets";
17
17
  import uniqBy from "lodash/uniqBy";
18
18
  import { DebouncedFunc, DebouncedFuncLeading, isEqual } from "lodash";
19
- import { throttle } from "lodash";
20
- import debounce from "lodash/debounce";
21
19
  import type {
22
20
  HTMLPerspectiveViewerElement,
23
- ViewerConfigUpdate,
21
+ ViewerConfig,
24
22
  } from "@perspective-dev/viewer";
25
23
  import type * as psp from "@perspective-dev/client";
26
24
  import type * as psp_viewer from "@perspective-dev/viewer";
27
- import injectedStyles from "../../../build/css/injected.css";
25
+ import injectedStyles from "../../../dist/css/injected.css";
28
26
  import { PerspectiveDockPanel } from "./dockpanel";
29
27
  import { WorkspaceMenu } from "./menu";
30
28
  import { createCommands } from "./commands";
31
29
  import { PerspectiveViewerWidget } from "./widget";
30
+ import type { Filter } from "@perspective-dev/client";
32
31
 
33
32
  class AsyncMutex {
34
33
  _lock: Promise<unknown> | null;
@@ -329,7 +328,7 @@ export class PerspectiveWorkspace extends SplitPanel {
329
328
  for (const widget of this.masterPanel.widgets) {
330
329
  const psp_widget = widget as PerspectiveViewerWidget;
331
330
  layout.viewers[psp_widget.viewer.getAttribute("slot")!] =
332
- await psp_widget.save();
331
+ (await psp_widget.save()) as psp_viewer.ViewerConfigUpdate;
333
332
  }
334
333
 
335
334
  const widgets = PerspectiveDockPanel.getWidgets(
@@ -342,7 +341,8 @@ export class PerspectiveWorkspace extends SplitPanel {
342
341
  widgets.map(async (widget) => {
343
342
  const psp_widget = widget as PerspectiveViewerWidget;
344
343
  const slot = psp_widget.viewer.getAttribute("slot")!;
345
- layout.viewers[slot] = await psp_widget.save();
344
+ layout.viewers[slot] =
345
+ (await psp_widget.save()) as psp_viewer.ViewerConfigUpdate;
346
346
  layout.viewers[slot]!.settings = false;
347
347
  }),
348
348
  );
@@ -515,10 +515,18 @@ export class PerspectiveWorkspace extends SplitPanel {
515
515
 
516
516
  if (master) {
517
517
  widget.viewer.classList.add("workspace-master-widget");
518
- widget.viewer.toggleAttribute("selectable", true);
518
+ await widget.viewer.restore({
519
+ plugin_config: { edit_mode: "SELECT_ROW_TREE" },
520
+ });
521
+
522
+ widget.viewer.addEventListener(
523
+ "perspective-global-filter",
524
+ this.on_global_filter_callback,
525
+ );
526
+
519
527
  widget.viewer.addEventListener(
520
528
  "perspective-select",
521
- this.onPerspectiveSelect.bind(this),
529
+ this.on_select_callback,
522
530
  );
523
531
 
524
532
  // TODO remove event listener
@@ -613,7 +621,7 @@ export class PerspectiveWorkspace extends SplitPanel {
613
621
  this._unmaximize();
614
622
  }
615
623
 
616
- const config = await widget.save();
624
+ const config = (await widget.save()) as psp_viewer.ViewerConfigUpdate;
617
625
  config.settings = false;
618
626
  config.title = config.title ? `${config.title} (*)` : "";
619
627
  const duplicate = await this._createWidgetAndNode({
@@ -688,30 +696,26 @@ export class PerspectiveWorkspace extends SplitPanel {
688
696
  candidates: Set<string>,
689
697
  ) {
690
698
  const config = await viewer.save();
691
- const table = await viewer.getTable();
692
- const availableColumns = Object.keys(await table.schema());
693
- const currentFilters = config.filter || [];
694
- const columnAvailable = (filter: psp.Filter) =>
695
- filter[0] && availableColumns.includes(filter[0]);
696
-
697
- const clearColumns = new Set<string>(removeFilters.map((f) => f[0]));
698
- const validFilters = insertFilters.filter(columnAvailable);
699
- validFilters.push(
700
- ...currentFilters.filter(
701
- (x: [string, ..._: string[]]) =>
702
- !candidates.has(x[0]) && !clearColumns.has(x[0]),
703
- ),
704
- );
705
699
 
706
- const newFilters = uniqBy(validFilters, (item) => item[0]);
707
- await viewer.restore({ filter: newFilters });
700
+ await viewer.restore({
701
+ filter: config.filter
702
+ .filter((x) => !removeFilters.find((y) => y[0] === x[0]))
703
+ .concat(insertFilters),
704
+ });
708
705
  }
709
706
 
710
- async onPerspectiveSelect(event: CustomEvent) {
707
+ async onPerspectiveSelect(
708
+ filterFun: (config: ViewerConfig) => boolean,
709
+ event: CustomEvent,
710
+ ) {
711
711
  const config = await (
712
712
  event.target as HTMLPerspectiveViewerElement
713
713
  ).save();
714
714
 
715
+ if (!filterFun(config)) {
716
+ return;
717
+ }
718
+
715
719
  const candidates = new Set([
716
720
  ...(config["group_by"] || []),
717
721
  ...(config["split_by"] || []),
@@ -735,13 +739,26 @@ export class PerspectiveWorkspace extends SplitPanel {
735
739
  });
736
740
  }
737
741
 
742
+ private on_select_callback = this.onPerspectiveSelect.bind(
743
+ this,
744
+ (config) => config.plugin !== "Datagrid",
745
+ );
746
+
747
+ private on_global_filter_callback = this.onPerspectiveSelect.bind(
748
+ this,
749
+ // (config) => config.plugin === "Datagrid",
750
+ (config) => true,
751
+ );
752
+
738
753
  async makeMaster(widget: PerspectiveViewerWidget) {
739
754
  if (widget.viewer.hasAttribute("settings")) {
740
755
  await widget.toggleConfig();
741
756
  }
742
757
 
743
758
  widget.viewer.classList.add("workspace-master-widget");
744
- widget.viewer.toggleAttribute("selectable", true);
759
+ await widget.viewer.restore({
760
+ plugin_config: { edit_mode: "SELECT_ROW_TREE" },
761
+ });
745
762
  if (!this.masterPanel.isAttached) {
746
763
  this.detailPanel.close();
747
764
  this.setupMasterPanel(DEFAULT_WORKSPACE_SIZE);
@@ -750,15 +767,23 @@ export class PerspectiveWorkspace extends SplitPanel {
750
767
  this.masterPanel.addWidget(widget);
751
768
  widget.isHidden && widget.show();
752
769
  widget.viewer.restyleElement();
770
+
771
+ widget.viewer.addEventListener(
772
+ "perspective-global-filter",
773
+ this.on_global_filter_callback,
774
+ );
775
+
753
776
  widget.viewer.addEventListener(
754
777
  "perspective-select",
755
- this.onPerspectiveSelect.bind(this),
778
+ this.on_select_callback,
756
779
  );
757
780
  }
758
781
 
759
- makeDetail(widget: PerspectiveViewerWidget) {
782
+ async makeDetail(widget: PerspectiveViewerWidget) {
760
783
  widget.viewer.classList.remove("workspace-master-widget");
761
- widget.viewer.toggleAttribute("selectable", false);
784
+ await widget.viewer.restore({
785
+ plugin_config: { edit_mode: "READ_ONLY" },
786
+ });
762
787
  this.dockpanel.addWidget(widget, { mode: `split-left` });
763
788
  if (this.masterPanel.widgets.length === 0) {
764
789
  this.detailPanel.close();
@@ -768,9 +793,14 @@ export class PerspectiveWorkspace extends SplitPanel {
768
793
  }
769
794
 
770
795
  widget.viewer.restyleElement();
796
+ widget.viewer.removeEventListener(
797
+ "perspective-global-filter",
798
+ this.on_global_filter_callback,
799
+ );
800
+
771
801
  widget.viewer.removeEventListener(
772
802
  "perspective-select",
773
- this.onPerspectiveSelect.bind(this),
803
+ this.on_select_callback,
774
804
  );
775
805
  }
776
806
 
@@ -1,105 +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
- .lm-DockPanel {
14
- overflow: var(--dock-panel--overflow, hidden);
15
- position: absolute;
16
- background-color: var(--detail--background-color, transparent);
17
- padding: var(--workspace-spacing);
18
- top: 0;
19
- left: 0;
20
- right: 0;
21
- bottom: 0;
22
- &[data-mode="single-document"] {
23
- padding: 0px;
24
- }
25
- }
26
-
27
- .lm-Widget,
28
- .lm-Widget {
29
- cursor: inherit;
30
- }
31
-
32
- .lm-DockPanel.ew,
33
- .lm-DockPanel.ew .lm-Widget,
34
- .lm-SplitPanel.ew,
35
- .lm-SplitPanel.ew .lm-Widget {
36
- cursor: ew-resize !important;
37
- }
38
-
39
- .lm-DockPanel.ns,
40
- .lm-DockPanel.ns .lm-Widget,
41
- .lm-SplitPanel.ns,
42
- .lm-SplitPanel.ns .lm-Widget {
43
- cursor: ns-resize !important;
44
- }
45
-
46
- .workspace-master-widget {
47
- min-width: 100px !important;
48
- }
49
-
50
- .lm-DockPanel.resizing ::slotted(perspective-viewer),
51
- .lm-SplitPanel.resizing ::slotted(perspective-viewer) {
52
- pointer-events: none;
53
- }
54
-
55
- .widget-blur ::slotted(perspective-viewer) {
56
- opacity: 0.5;
57
- }
58
-
59
- .lm-DockPanel-handle.resizing {
60
- background-color: rgba(0, 0, 0, 0.05);
61
- }
62
-
63
- .perspective-scroll-panel {
64
- overflow: auto !important;
65
- }
66
-
67
- .lm-Panel {
68
- min-height: 100%;
69
- }
70
-
71
- .lm-DockPanel-handle {
72
- background-color: none;
73
- }
74
-
75
- .lm-SplitPanel-handle {
76
- background-color: var(--workspace-split-panel-handle--background-color);
77
- }
78
-
79
- .lm-SplitPanel-handle,
80
- .lm-DockPanel-handle {
81
- transition: background-color 0.3s ease-out;
82
- &:hover {
83
- background-color: rgba(0, 0, 0, 0.05);
84
- }
85
- }
86
-
87
- .lm-DockPanel-handle[data-orientation="horizontal"] {
88
- width: 10px !important;
89
- margin-left: -5px;
90
- }
91
-
92
- .lm-DockPanel-handle[data-orientation="vertical"] {
93
- height: 10px !important;
94
- margin-top: -5px;
95
- }
96
-
97
- .lm-DockPanel-overlay {
98
- background: rgba(75, 75, 75, 0.2);
99
- border: 1px dashed #666;
100
- border-radius: 6px;
101
- transition-property: top, left, right, bottom;
102
- transition-duration: 50ms;
103
- transition-timing-function: linear;
104
- margin: 0px;
105
- }