@jupytergis/base 0.6.2 → 0.8.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.
Files changed (60) hide show
  1. package/lib/annotations/components/Annotation.d.ts +2 -3
  2. package/lib/annotations/components/Annotation.js +2 -9
  3. package/lib/commands/BaseCommandIDs.d.ts +1 -0
  4. package/lib/commands/BaseCommandIDs.js +1 -0
  5. package/lib/commands/index.js +15 -0
  6. package/lib/constants.js +1 -0
  7. package/lib/dialogs/symbology/components/color_ramp/ColorRamp.js +1 -1
  8. package/lib/dialogs/symbology/hooks/useGetProperties.js +53 -19
  9. package/lib/dialogs/symbology/vector_layer/VectorRendering.js +3 -3
  10. package/lib/dialogs/symbology/vector_layer/types/Graduated.js +4 -2
  11. package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +2 -2
  12. package/lib/formbuilder/formselectors.js +3 -0
  13. package/lib/formbuilder/objectform/source/geojsonsource.d.ts +3 -1
  14. package/lib/formbuilder/objectform/source/geojsonsource.js +20 -4
  15. package/lib/index.d.ts +1 -1
  16. package/lib/index.js +1 -1
  17. package/lib/keybindings.json +2 -2
  18. package/lib/mainview/mainView.d.ts +8 -1
  19. package/lib/mainview/mainView.js +33 -4
  20. package/lib/mainview/mainviewwidget.d.ts +11 -4
  21. package/lib/mainview/mainviewwidget.js +3 -2
  22. package/lib/menus.js +4 -0
  23. package/lib/panelview/annotationPanel.d.ts +3 -17
  24. package/lib/panelview/annotationPanel.js +5 -22
  25. package/lib/panelview/components/filter-panel/Filter.d.ts +2 -19
  26. package/lib/panelview/components/filter-panel/Filter.js +26 -59
  27. package/lib/panelview/components/identify-panel/IdentifyPanel.d.ts +6 -14
  28. package/lib/panelview/components/identify-panel/IdentifyPanel.js +14 -52
  29. package/lib/panelview/components/layers.d.ts +10 -12
  30. package/lib/panelview/components/layers.js +109 -79
  31. package/lib/panelview/index.d.ts +0 -1
  32. package/lib/panelview/index.js +0 -1
  33. package/lib/panelview/leftpanel.d.ts +8 -47
  34. package/lib/panelview/leftpanel.js +32 -154
  35. package/lib/panelview/objectproperties.d.ts +20 -15
  36. package/lib/panelview/objectproperties.js +12 -34
  37. package/lib/panelview/rightpanel.d.ts +8 -22
  38. package/lib/panelview/rightpanel.js +32 -77
  39. package/lib/shared/components/Tabs.d.ts +7 -1
  40. package/lib/shared/components/Tabs.js +6 -1
  41. package/lib/stacBrowser/components/{StacPanelView.d.ts → StacPanel.d.ts} +2 -2
  42. package/lib/stacBrowser/components/{StacPanelView.js → StacPanel.js} +3 -3
  43. package/lib/stacBrowser/index.d.ts +1 -1
  44. package/lib/stacBrowser/index.js +1 -1
  45. package/lib/tools.js +26 -0
  46. package/lib/types.d.ts +1 -9
  47. package/lib/widget.d.ts +8 -3
  48. package/lib/widget.js +8 -4
  49. package/package.json +4 -2
  50. package/style/base.css +18 -2
  51. package/style/shared/tabs.css +16 -2
  52. package/style/stacBrowser.css +0 -6
  53. package/style/tabPanel.css +91 -0
  54. package/style/temporalSlider.css +1 -0
  55. package/lib/panelview/model.d.ts +0 -19
  56. package/lib/panelview/model.js +0 -30
  57. package/lib/stacBrowser/StacBrowser.d.ts +0 -7
  58. package/lib/stacBrowser/StacBrowser.js +0 -16
  59. package/lib/stacBrowser/StacPanel.d.ts +0 -14
  60. package/lib/stacBrowser/StacPanel.js +0 -16
@@ -1,154 +1,32 @@
1
- import { SidePanel } from '@jupyterlab/ui-components';
2
- import { CommandIDs } from "../constants";
3
- import StacPanel from "../stacBrowser/StacPanel";
4
- import { FilterPanel } from './components/filter-panel/Filter';
5
- import { LayersPanel } from './components/layers';
6
- import { ControlPanelHeader } from './header';
7
- export class LeftPanelWidget extends SidePanel {
8
- constructor(options) {
9
- super();
10
- /**
11
- * Function to call when a layer is selected from a component of the panel.
12
- *
13
- * @param item - the selected layer or group.
14
- */
15
- this._onSelect = ({ type, item, nodeId, event, }) => {
16
- var _a, _b;
17
- if (!this._model || !nodeId) {
18
- return;
19
- }
20
- const { jGISModel } = this._model;
21
- const selectedValue = (_b = (_a = jGISModel === null || jGISModel === void 0 ? void 0 : jGISModel.localState) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.value;
22
- const node = document.getElementById(nodeId);
23
- if (!node) {
24
- return;
25
- }
26
- node.tabIndex = 0;
27
- node.focus();
28
- // Early return if no selection exists
29
- if (!selectedValue) {
30
- this.resetSelected(type, nodeId, item);
31
- return;
32
- }
33
- // Don't want to reset selected if right clicking a selected item
34
- if (!event.ctrlKey && event.button === 2 && item in selectedValue) {
35
- return;
36
- }
37
- // Reset selection for normal left click
38
- if (!event.ctrlKey) {
39
- this.resetSelected(type, nodeId, item);
40
- return;
41
- }
42
- if (nodeId) {
43
- // Check if new selection is the same type as previous selections
44
- const isSelectedSameType = Object.values(selectedValue).some(selection => selection.type === type);
45
- if (!isSelectedSameType) {
46
- // Selecting a new type, so reset selected
47
- this.resetSelected(type, nodeId, item);
48
- return;
49
- }
50
- // If types are the same add the selection
51
- const updatedSelectedValue = Object.assign(Object.assign({}, selectedValue), { [item]: { type, selectedNodeId: nodeId } });
52
- this._lastSelectedNodeId = nodeId;
53
- jGISModel.syncSelected(updatedSelectedValue, this.id);
54
- this._notifyCommands();
55
- }
56
- };
57
- this.addClass('jGIS-sidepanel-widget');
58
- this.addClass('data-jgis-keybinding');
59
- this.node.tabIndex = 0;
60
- this._model = options.model;
61
- this._state = options.state;
62
- this._commands = options.commands;
63
- const header = new ControlPanelHeader();
64
- this.header.addWidget(header);
65
- const layerTree = new LayersPanel({
66
- model: this._model,
67
- state: this._state,
68
- onSelect: this._onSelect,
69
- });
70
- layerTree.title.caption = 'Layer tree';
71
- layerTree.title.label = 'Layers';
72
- this.addWidget(layerTree);
73
- const stacPanel = new StacPanel({
74
- model: this._model,
75
- tracker: options.tracker,
76
- });
77
- stacPanel.title.caption = 'STAC';
78
- stacPanel.title.label = 'STAC';
79
- this.addWidget(stacPanel);
80
- const filterPanel = new FilterPanel({
81
- model: this._model,
82
- tracker: options.tracker,
83
- });
84
- filterPanel.title.caption = 'Filters';
85
- filterPanel.title.label = 'Filters';
86
- this.addWidget(filterPanel);
87
- this._handleFileChange = () => {
88
- var _a;
89
- header.title.label = ((_a = this._currentModel) === null || _a === void 0 ? void 0 : _a.filePath) || '-';
90
- };
91
- options.tracker.currentChanged.connect((_, changed) => {
92
- if (changed) {
93
- if (this._currentModel) {
94
- this._currentModel.pathChanged.disconnect(this._handleFileChange);
95
- }
96
- this._currentModel = changed.model;
97
- header.title.label = changed.model.filePath;
98
- this._currentModel.pathChanged.connect(this._handleFileChange);
99
- }
100
- else {
101
- header.title.label = '-';
102
- this._currentModel = null;
103
- }
104
- });
105
- }
106
- dispose() {
107
- super.dispose();
108
- }
109
- onAfterAttach(msg) {
110
- super.onAfterAttach(msg);
111
- const node = this.node;
112
- node.addEventListener('mouseup', this);
113
- }
114
- onBeforeDetach(msg) {
115
- super.onBeforeDetach(msg);
116
- const node = this.node;
117
- node.removeEventListener('mouseup', this);
118
- }
119
- handleEvent(event) {
120
- switch (event.type) {
121
- case 'mouseup':
122
- this._mouseUpEvent(event);
123
- break;
124
- default:
125
- break;
126
- }
127
- }
128
- _mouseUpEvent(event) {
129
- // If we click on empty space in the layer panel, keep the focus on the last selected element
130
- const node = document.getElementById(this._lastSelectedNodeId);
131
- if (!node) {
132
- return;
133
- }
134
- node.focus();
135
- }
136
- resetSelected(type, nodeId, item) {
137
- var _a, _b;
138
- const selection = {};
139
- if (item && nodeId) {
140
- selection[item] = {
141
- type,
142
- selectedNodeId: nodeId,
143
- };
144
- this._lastSelectedNodeId = nodeId;
145
- }
146
- (_b = (_a = this._model) === null || _a === void 0 ? void 0 : _a.jGISModel) === null || _b === void 0 ? void 0 : _b.syncSelected(selection, this.id);
147
- this._notifyCommands();
148
- }
149
- _notifyCommands() {
150
- // Notify commands that need updating
151
- this._commands.notifyCommandChanged(CommandIDs.identify);
152
- this._commands.notifyCommandChanged(CommandIDs.temporalController);
153
- }
154
- }
1
+ import * as React from 'react';
2
+ import { LayersBodyComponent } from './components/layers';
3
+ import { PanelTabs, TabsContent, TabsList, TabsTrigger, } from '../shared/components/Tabs';
4
+ import StacPanel from '../stacBrowser/components/StacPanel';
5
+ import FilterComponent from './components/filter-panel/Filter';
6
+ export const LeftPanel = (props) => {
7
+ const tabInfo = [
8
+ { name: 'layers', title: 'Layers' },
9
+ { name: 'stac', title: 'Stac Browser' },
10
+ { name: 'filters', title: 'Filters' },
11
+ ];
12
+ const [curTab, setCurTab] = React.useState(tabInfo[0].name);
13
+ return (React.createElement("div", { className: "jgis-left-panel-container" },
14
+ React.createElement(PanelTabs, { curTab: curTab, className: "jgis-panel-tabs" },
15
+ React.createElement(TabsList, null, tabInfo.map(e => {
16
+ return (React.createElement(TabsTrigger, { className: "jGIS-layer-browser-category", value: e.name, onClick: () => {
17
+ if (curTab !== e.name) {
18
+ setCurTab(e.name);
19
+ }
20
+ else {
21
+ setCurTab('');
22
+ }
23
+ } }, e.title));
24
+ })),
25
+ React.createElement(TabsContent, { value: "layers", className: "jgis-panel-tab-content jp-gis-layerPanel" },
26
+ React.createElement(LayersBodyComponent, { model: props.model, commands: props.commands, state: props.state })),
27
+ React.createElement(TabsContent, { value: "stac" },
28
+ React.createElement(StacPanel, { model: props.model })),
29
+ React.createElement(TabsContent, { value: "filters", className: "jgis-panel-tab-content" },
30
+ React.createElement(FilterComponent, { model: props.model }),
31
+ ","))));
32
+ };
@@ -1,17 +1,22 @@
1
- import { IJGISFormSchemaRegistry, IJupyterGISTracker } from '@jupytergis/schema';
2
- import { PanelWithToolbar } from '@jupyterlab/ui-components';
3
- import { Panel } from '@lumino/widgets';
4
- import { IControlPanelModel } from "../types";
5
- export declare class ObjectProperties extends PanelWithToolbar {
6
- constructor(params: ObjectProperties.IOptions);
1
+ import { IJGISFormSchemaRegistry, IJupyterGISModel } from '@jupytergis/schema';
2
+ import * as React from 'react';
3
+ interface IStates {
4
+ model: IJupyterGISModel | undefined;
5
+ clientId: number | null;
6
+ id: string;
7
+ selectedObject?: string;
8
+ setSelectedObject: any;
7
9
  }
8
- export declare namespace ObjectProperties {
9
- /**
10
- * Instantiation options for `ObjectProperties`.
11
- */
12
- interface IOptions extends Panel.IOptions {
13
- controlPanelModel: IControlPanelModel;
14
- formSchemaRegistry: IJGISFormSchemaRegistry;
15
- tracker: IJupyterGISTracker;
16
- }
10
+ interface IProps {
11
+ formSchemaRegistry: IJGISFormSchemaRegistry;
12
+ model: IJupyterGISModel;
13
+ selectedObject: string | undefined;
14
+ setSelectedObject: any;
17
15
  }
16
+ export declare class ObjectPropertiesReact extends React.Component<IProps, IStates> {
17
+ constructor(props: IProps);
18
+ private _sharedJGISModelChanged;
19
+ private _onClientSharedStateChanged;
20
+ render(): React.ReactNode;
21
+ }
22
+ export {};
@@ -1,20 +1,9 @@
1
- import { ReactWidget } from '@jupyterlab/apputils';
2
- import { PanelWithToolbar } from '@jupyterlab/ui-components';
3
1
  import * as React from 'react';
4
2
  import { v4 as uuid } from 'uuid';
5
3
  import { EditForm } from "../formbuilder/editform";
6
- export class ObjectProperties extends PanelWithToolbar {
7
- constructor(params) {
8
- super(params);
9
- this.title.label = 'Objects Properties';
10
- const body = ReactWidget.create(React.createElement(ObjectPropertiesReact, { cpModel: params.controlPanelModel, tracker: params.tracker, formSchemaRegistry: params.formSchemaRegistry }));
11
- this.addWidget(body);
12
- this.addClass('jGIS-sidebar-propertiespanel');
13
- }
14
- }
15
- class ObjectPropertiesReact extends React.Component {
4
+ export class ObjectPropertiesReact extends React.Component {
16
5
  constructor(props) {
17
- var _a, _b, _c;
6
+ var _a, _b;
18
7
  super(props);
19
8
  this._sharedJGISModelChanged = () => {
20
9
  this.forceUpdate();
@@ -35,44 +24,33 @@ class ObjectPropertiesReact extends React.Component {
35
24
  const selectedObjectIds = Object.keys(selection || {});
36
25
  // Only show object properties if ONE object is selected
37
26
  if (selection === undefined || selectedObjectIds.length !== 1) {
27
+ this.state.setSelectedObject(undefined);
38
28
  this.setState(old => (Object.assign(Object.assign({}, old), { selectedObject: undefined })));
39
29
  return;
40
30
  }
41
31
  const selectedObject = selectedObjectIds[0];
42
32
  if (selectedObject !== this.state.selectedObject) {
33
+ this.state.setSelectedObject(selectedObject);
43
34
  this.setState(old => (Object.assign(Object.assign({}, old), { selectedObject })));
44
35
  }
45
36
  }
46
37
  };
47
38
  this.state = {
48
- model: (_a = props.tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model,
49
- clientId: null,
39
+ clientId: props.model.getClientId(),
50
40
  id: uuid(),
41
+ model: props.model,
42
+ selectedObject: props.selectedObject,
43
+ setSelectedObject: props.setSelectedObject,
51
44
  };
52
- (_b = this.props.cpModel.jGISModel) === null || _b === void 0 ? void 0 : _b.sharedLayersChanged.connect(this._sharedJGISModelChanged);
53
- (_c = this.props.cpModel.jGISModel) === null || _c === void 0 ? void 0 : _c.sharedSourcesChanged.connect(this._sharedJGISModelChanged);
54
- this.props.cpModel.documentChanged.connect((_, changed) => {
55
- if (changed) {
56
- this.props.cpModel.disconnect(this._sharedJGISModelChanged);
57
- this.props.cpModel.disconnect(this._onClientSharedStateChanged);
58
- changed.model.sharedLayersChanged.connect(this._sharedJGISModelChanged);
59
- changed.model.sharedSourcesChanged.connect(this._sharedJGISModelChanged);
60
- changed.model.clientStateChanged.connect(this._onClientSharedStateChanged);
61
- this.setState(old => (Object.assign(Object.assign({}, old), { model: changed.model, filePath: changed.model.filePath, clientId: changed.model.getClientId() })));
62
- }
63
- else {
64
- this.setState({
65
- model: undefined,
66
- selectedObject: undefined,
67
- });
68
- }
69
- });
45
+ this.props.model.clientStateChanged.connect(this._onClientSharedStateChanged);
46
+ (_a = this.props.model) === null || _a === void 0 ? void 0 : _a.sharedLayersChanged.connect(this._sharedJGISModelChanged);
47
+ (_b = this.props.model) === null || _b === void 0 ? void 0 : _b.sharedSourcesChanged.connect(this._sharedJGISModelChanged);
70
48
  }
71
49
  render() {
72
50
  var _a;
73
51
  const selectedObject = this.state.selectedObject;
74
52
  if (!selectedObject || !this.state.model) {
75
- return React.createElement("div", null);
53
+ return React.createElement("div", { style: { textAlign: 'center' } }, "No layer selected");
76
54
  }
77
55
  let layerId = undefined;
78
56
  let sourceId = undefined;
@@ -1,23 +1,9 @@
1
- import { IAnnotationModel, IJGISFormSchemaRegistry, IJupyterGISTracker, JupyterGISDoc } from '@jupytergis/schema';
2
- import { SidePanel } from '@jupyterlab/ui-components';
3
- import { IControlPanelModel } from "../types";
4
- export declare class RightPanelWidget extends SidePanel {
5
- constructor(options: RightPanelWidget.IOptions);
6
- dispose(): void;
7
- private _currentModel;
8
- private _handleFileChange;
9
- private _model;
10
- private _annotationModel;
11
- }
12
- export declare namespace RightPanelWidget {
13
- interface IOptions {
14
- model: IControlPanelModel;
15
- tracker: IJupyterGISTracker;
16
- formSchemaRegistry: IJGISFormSchemaRegistry;
17
- annotationModel: IAnnotationModel;
18
- }
19
- interface IProps {
20
- filePath?: string;
21
- sharedModel?: JupyterGISDoc;
22
- }
1
+ import { IAnnotationModel, IJGISFormSchemaRegistry, IJupyterGISModel } from '@jupytergis/schema';
2
+ import * as React from 'react';
3
+ interface IRightPanelProps {
4
+ formSchemaRegistry: IJGISFormSchemaRegistry;
5
+ annotationModel: IAnnotationModel;
6
+ model: IJupyterGISModel;
23
7
  }
8
+ export declare const RightPanel: React.FC<IRightPanelProps>;
9
+ export {};
@@ -1,77 +1,32 @@
1
- import { SidePanel } from '@jupyterlab/ui-components';
2
- import { Annotations } from './annotationPanel';
3
- import IdentifyPanel from './components/identify-panel/IdentifyPanel';
4
- import { ControlPanelHeader } from './header';
5
- import { ObjectProperties } from './objectproperties';
6
- export class RightPanelWidget extends SidePanel {
7
- constructor(options) {
8
- super();
9
- this.addClass('jGIS-sidepanel-widget');
10
- this.addClass('data-jgis-keybinding');
11
- this.node.tabIndex = 0;
12
- this._model = options.model;
13
- this._annotationModel = options.annotationModel;
14
- const header = new ControlPanelHeader();
15
- this.header.addWidget(header);
16
- const properties = new ObjectProperties({
17
- controlPanelModel: this._model,
18
- formSchemaRegistry: options.formSchemaRegistry,
19
- tracker: options.tracker,
20
- });
21
- this.addWidget(properties);
22
- const annotations = new Annotations({
23
- rightPanelModel: this._model,
24
- annotationModel: this._annotationModel,
25
- });
26
- this.addWidget(annotations);
27
- const identifyPanel = new IdentifyPanel({
28
- model: this._model,
29
- tracker: options.tracker,
30
- });
31
- identifyPanel.title.caption = 'Identify';
32
- identifyPanel.title.label = 'Identify';
33
- identifyPanel.addClass('jgis-scrollable');
34
- this.addWidget(identifyPanel);
35
- this._handleFileChange = () => {
36
- var _a;
37
- header.title.label = ((_a = this._currentModel) === null || _a === void 0 ? void 0 : _a.filePath) || '-';
38
- };
39
- this._model.documentChanged.connect((_, changed) => {
40
- if (changed) {
41
- if (changed.model.sharedModel.editable) {
42
- header.title.label = changed.model.filePath;
43
- properties.show();
44
- }
45
- else {
46
- header.title.label = `${changed.model.filePath} - Read Only`;
47
- properties.hide();
48
- }
49
- }
50
- else {
51
- header.title.label = '-';
52
- }
53
- });
54
- options.tracker.currentChanged.connect(async (_, changed) => {
55
- var _a;
56
- if (changed) {
57
- if (this._currentModel) {
58
- this._currentModel.pathChanged.disconnect(this._handleFileChange);
59
- }
60
- this._currentModel = changed.model;
61
- header.title.label = this._currentModel.filePath;
62
- this._currentModel.pathChanged.connect(this._handleFileChange);
63
- this._annotationModel.model =
64
- ((_a = options.tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model) || undefined;
65
- // await changed.context.ready;
66
- }
67
- else {
68
- header.title.label = '-';
69
- this._currentModel = null;
70
- this._annotationModel.model = undefined;
71
- }
72
- });
73
- }
74
- dispose() {
75
- super.dispose();
76
- }
77
- }
1
+ import * as React from 'react';
2
+ import { AnnotationsPanel } from './annotationPanel';
3
+ import { IdentifyPanelComponent } from './components/identify-panel/IdentifyPanel';
4
+ import { ObjectPropertiesReact } from './objectproperties';
5
+ import { PanelTabs, TabsContent, TabsList, TabsTrigger, } from '../shared/components/Tabs';
6
+ export const RightPanel = props => {
7
+ const [selectedObjectProperties, setSelectedObjectProperties] = React.useState(undefined);
8
+ const tabInfo = [
9
+ { name: 'objectProperties', title: 'Object Properties' },
10
+ { name: 'annotations', title: 'Annotations' },
11
+ { name: 'identifyPanel', title: 'Identify Features' },
12
+ ];
13
+ const [curTab, setCurTab] = React.useState(tabInfo[0].name);
14
+ return (React.createElement("div", { className: "jgis-right-panel-container" },
15
+ React.createElement(PanelTabs, { className: "jgis-panel-tabs", curTab: curTab },
16
+ React.createElement(TabsList, null, tabInfo.map(e => {
17
+ return (React.createElement(TabsTrigger, { className: "jGIS-layer-browser-category", value: e.name, onClick: () => {
18
+ if (curTab !== e.name) {
19
+ setCurTab(e.name);
20
+ }
21
+ else {
22
+ setCurTab('');
23
+ }
24
+ } }, e.title));
25
+ })),
26
+ React.createElement(TabsContent, { value: "objectProperties", className: "jgis-panel-tab-content" },
27
+ React.createElement(ObjectPropertiesReact, { setSelectedObject: setSelectedObjectProperties, selectedObject: selectedObjectProperties, formSchemaRegistry: props.formSchemaRegistry, model: props.model })),
28
+ React.createElement(TabsContent, { value: "annotations" },
29
+ React.createElement(AnnotationsPanel, { annotationModel: props.annotationModel, jgisModel: props.model })),
30
+ React.createElement(TabsContent, { value: "identifyPanel", className: "jgis-panel-tab-content" },
31
+ React.createElement(IdentifyPanelComponent, { model: props.model })))));
32
+ };
@@ -1,7 +1,13 @@
1
1
  import * as TabsPrimitive from '@radix-ui/react-tabs';
2
2
  import * as React from 'react';
3
+ interface IPanelTabProps {
4
+ className: string;
5
+ curTab: string | undefined;
6
+ children: any;
7
+ }
3
8
  declare const Tabs: React.FC<React.ComponentProps<typeof TabsPrimitive.Root>>;
9
+ declare const PanelTabs: React.FC<IPanelTabProps>;
4
10
  declare const TabsList: React.FC<React.ComponentProps<typeof TabsPrimitive.List>>;
5
11
  declare const TabsTrigger: React.FC<React.ComponentProps<typeof TabsPrimitive.Trigger>>;
6
12
  declare const TabsContent: React.FC<React.ComponentProps<typeof TabsPrimitive.Content>>;
7
- export { Tabs, TabsContent, TabsList, TabsTrigger };
13
+ export { Tabs, TabsContent, TabsList, TabsTrigger, PanelTabs };
@@ -16,6 +16,11 @@ const Tabs = (_a) => {
16
16
  var { className } = _a, props = __rest(_a, ["className"]);
17
17
  return (React.createElement(TabsPrimitive.Root, Object.assign({ "data-slot": "tabs", className: cn('TabsList', className) }, props)));
18
18
  };
19
+ const PanelTabs = ({ className, curTab, children, }) => {
20
+ return (React.createElement(TabsPrimitive.Root, { "data-slot": "tabs", className: cn('TabsList', className), value: curTab, onValueChange: () => {
21
+ return;
22
+ }, children: children }));
23
+ };
19
24
  const TabsList = (_a) => {
20
25
  var { className } = _a, props = __rest(_a, ["className"]);
21
26
  return (React.createElement(TabsPrimitive.List, Object.assign({ "data-slot": "tabs-list", className: cn('jgis-tabs-list', className) }, props)));
@@ -28,4 +33,4 @@ const TabsContent = (_a) => {
28
33
  var { className } = _a, props = __rest(_a, ["className"]);
29
34
  return (React.createElement(TabsPrimitive.Content, Object.assign({ "data-slot": "tabs-content", className: cn('jgis-tabs-content', className) }, props)));
30
35
  };
31
- export { Tabs, TabsContent, TabsList, TabsTrigger };
36
+ export { Tabs, TabsContent, TabsList, TabsTrigger, PanelTabs };
@@ -3,5 +3,5 @@ import React from 'react';
3
3
  interface IStacViewProps {
4
4
  model?: IJupyterGISModel;
5
5
  }
6
- declare const StacPanelView: ({ model }: IStacViewProps) => React.JSX.Element | null;
7
- export default StacPanelView;
6
+ declare const StacPanel: ({ model }: IStacViewProps) => React.JSX.Element | null;
7
+ export default StacPanel;
@@ -3,12 +3,12 @@ import { Tabs, TabsContent, TabsList, TabsTrigger, } from "../../shared/componen
3
3
  import useStacSearch from "../hooks/useStacSearch";
4
4
  import StacPanelFilters from './StacPanelFilters';
5
5
  import StacPanelResults from './StacPanelResults';
6
- const StacPanelView = ({ model }) => {
6
+ const StacPanel = ({ model }) => {
7
7
  const { filterState, filterSetters, results, startTime, setStartTime, endTime, setEndTime, totalPages, currentPage, totalResults, handlePaginationClick, handleResultClick, formatResult, isLoading, useWorldBBox, setUseWorldBBox, } = useStacSearch({ model });
8
8
  if (!model) {
9
9
  return null;
10
10
  }
11
- return (React.createElement(Tabs, { defaultValue: "filters", className: "jgis-stac-browser-main" },
11
+ return (React.createElement(Tabs, { defaultValue: "filters", className: "jgis-panel-tabs" },
12
12
  React.createElement(TabsList, { style: { borderRadius: 0 } },
13
13
  React.createElement(TabsTrigger, { className: "jGIS-layer-browser-category", value: "filters" }, "Filters"),
14
14
  React.createElement(TabsTrigger, { className: "jGIS-layer-browser-category", value: "results" }, `Results (${totalResults})`)),
@@ -17,4 +17,4 @@ const StacPanelView = ({ model }) => {
17
17
  React.createElement(TabsContent, { value: "results" },
18
18
  React.createElement(StacPanelResults, { results: results, currentPage: currentPage, totalPages: totalPages, handlePaginationClick: handlePaginationClick, handleResultClick: handleResultClick, formatResult: formatResult, isLoading: isLoading }))));
19
19
  };
20
- export default StacPanelView;
20
+ export default StacPanel;
@@ -1 +1 @@
1
- export * from './StacBrowser';
1
+ export * from './components/StacPanel';
@@ -1 +1 @@
1
- export * from './StacBrowser';
1
+ export * from './components/StacPanel';
package/lib/tools.js CHANGED
@@ -3,6 +3,7 @@ import { PathExt, URLExt } from '@jupyterlab/coreutils';
3
3
  import { ServerConnection } from '@jupyterlab/services';
4
4
  import { VectorTile } from '@mapbox/vector-tile';
5
5
  import * as d3Color from 'd3-color';
6
+ import { compressors } from 'hyparquet-compressors';
6
7
  import Protobuf from 'pbf';
7
8
  import shp from 'shpjs';
8
9
  import RASTER_LAYER_GALLERY from "../rasterlayer_gallery/raster_layer_gallery.json";
@@ -411,6 +412,21 @@ export const loadFile = async (fileInfo) => {
411
412
  showErrorMessage('Network error', `Failed to fetch ${filepath}`);
412
413
  throw new Error(`Failed to fetch ${filepath}`);
413
414
  }
415
+ case 'GeoParquetSource': {
416
+ const cached = await getFromIndexedDB(filepath);
417
+ if (cached) {
418
+ return cached.file;
419
+ }
420
+ const { asyncBufferFromUrl, toGeoJson } = await import('geoparquet');
421
+ const file = await asyncBufferFromUrl({ url: filepath });
422
+ const geojson = await toGeoJson({ file });
423
+ if (geojson) {
424
+ await saveToIndexedDB(filepath, geojson);
425
+ return geojson;
426
+ }
427
+ showErrorMessage('Network error', `Failed to fetch ${filepath}`);
428
+ throw new Error(`Failed to fetch ${filepath}`);
429
+ }
414
430
  default: {
415
431
  throw new Error(`Unsupported URL handling for source type: ${type}`);
416
432
  }
@@ -467,6 +483,16 @@ export const loadFile = async (fileInfo) => {
467
483
  throw new Error('Invalid file format for tiff content.');
468
484
  }
469
485
  }
486
+ case 'GeoParquetSource': {
487
+ if (typeof file.content === 'string') {
488
+ const { toGeoJson } = await import('geoparquet');
489
+ const arrayBuffer = await stringToArrayBuffer(file.content);
490
+ return await toGeoJson({ file: arrayBuffer, compressors });
491
+ }
492
+ else {
493
+ throw new Error('Invalid file format for GeoParquet content.');
494
+ }
495
+ }
470
496
  default: {
471
497
  throw new Error(`Unsupported source type: ${type}`);
472
498
  }
package/lib/types.d.ts CHANGED
@@ -1,17 +1,9 @@
1
- import { IDict, IJupyterGISDoc, IJupyterGISModel, IJupyterGISTracker, IJupyterGISWidget } from '@jupytergis/schema';
1
+ import { IDict, IJupyterGISWidget } from '@jupytergis/schema';
2
2
  import { WidgetTracker } from '@jupyterlab/apputils';
3
- import { ISignal } from '@lumino/signaling';
4
3
  import { Map } from 'ol';
5
4
  export { IDict };
6
5
  export type ValueOf<T> = T[keyof T];
7
6
  export type JupyterGISTracker = WidgetTracker<IJupyterGISWidget>;
8
- export interface IControlPanelModel {
9
- disconnect(f: any): void;
10
- documentChanged: ISignal<IJupyterGISTracker, IJupyterGISWidget | null>;
11
- filePath: string | undefined;
12
- jGISModel: IJupyterGISModel | undefined;
13
- sharedModel: IJupyterGISDoc | undefined;
14
- }
15
7
  export type SymbologyTab = 'color' | 'radius';
16
8
  export type VectorRenderType = 'Single Symbol' | 'Canonical' | 'Graduated' | 'Categorized' | 'Heatmap';
17
9
  /**
package/lib/widget.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { IJupyterGISDocumentWidget, IJupyterGISModel, IJupyterGISOutputWidget } from '@jupytergis/schema';
1
+ import { IAnnotationModel, IJGISFormSchemaRegistry, IJupyterGISDocumentWidget, IJupyterGISModel, IJupyterGISOutputWidget } from '@jupytergis/schema';
2
2
  import { MainAreaWidget } from '@jupyterlab/apputils';
3
3
  import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
4
4
  import { DocumentWidget } from '@jupyterlab/docregistry';
5
5
  import { IObservableMap, ObservableMap } from '@jupyterlab/observables';
6
+ import { IStateDB } from '@jupyterlab/statedb';
6
7
  import { CommandRegistry } from '@lumino/commands';
7
8
  import { JSONValue } from '@lumino/coreutils';
8
9
  import { ISignal } from '@lumino/signaling';
@@ -39,12 +40,12 @@ export declare namespace JupyterGISOutputWidget {
39
40
  }
40
41
  }
41
42
  export declare class JupyterGISPanel extends SplitPanel {
42
- constructor(options: JupyterGISPanel.IOptions);
43
+ constructor({ model, consoleTracker, state, commandRegistry, formSchemaRegistry, annotationModel, ...consoleOption }: JupyterGISPanel.IOptions);
43
44
  _initModel(options: {
44
45
  model: IJupyterGISModel;
45
46
  commandRegistry: CommandRegistry;
46
47
  }): void;
47
- _initView(): void;
48
+ _initView(formSchemaRegistry?: IJGISFormSchemaRegistry, annotationModel?: IAnnotationModel): void;
48
49
  get jupyterGISMainViewPanel(): JupyterGISMainViewPanel;
49
50
  get viewChanged(): ISignal<ObservableMap<JSONValue>, IObservableMap.IChangedArgs<JSONValue>>;
50
51
  /**
@@ -57,6 +58,7 @@ export declare class JupyterGISPanel extends SplitPanel {
57
58
  executeConsole(): void;
58
59
  removeConsole(): void;
59
60
  toggleConsole(jgisPath: string): Promise<void>;
61
+ private _state;
60
62
  private _mainViewModel;
61
63
  private _view;
62
64
  private _jupyterGISMainViewPanel;
@@ -69,6 +71,9 @@ export declare namespace JupyterGISPanel {
69
71
  interface IOptions extends Partial<ConsoleView.IOptions> {
70
72
  model: IJupyterGISModel;
71
73
  commandRegistry: CommandRegistry;
74
+ state?: IStateDB;
72
75
  consoleTracker?: IConsoleTracker;
76
+ formSchemaRegistry?: IJGISFormSchemaRegistry;
77
+ annotationModel?: IAnnotationModel;
73
78
  }
74
79
  }