Skip to content

Commit ed7073e

Browse files
Solve a bug with object properties
1 parent b891b9b commit ed7073e

File tree

3 files changed

+311
-416
lines changed

3 files changed

+311
-416
lines changed
Lines changed: 93 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
import {
2-
IJupyterGISModel,
3-
JupyterGISDoc,
4-
SelectionType,
5-
} from '@jupytergis/schema';
1+
import { IJupyterGISModel, SelectionType } from '@jupytergis/schema';
62
import { IStateDB } from '@jupyterlab/statedb';
73
import { CommandRegistry } from '@lumino/commands';
84
import { MouseEvent as ReactMouseEvent } from 'react';
95
import * as React from 'react';
106

117
import { LayersBodyComponent } from './components/layers';
128
import {
13-
Tabs,
14-
TabsContent,
15-
TabsList,
16-
TabsTrigger,
9+
Tabs,
10+
TabsContent,
11+
TabsList,
12+
TabsTrigger,
1713
} from '../shared/components/Tabs';
1814
import StacBrowser from '../stacBrowser/StacBrowser';
1915
import FilterComponent from './components/filter-panel/Filter';
@@ -22,165 +18,104 @@ import FilterComponent from './components/filter-panel/Filter';
2218
* Options of the left panel widget.
2319
*/
2420
export interface ILeftPanelOptions {
25-
model: IJupyterGISModel;
26-
onSelect: ({ type, item, nodeId }: ILeftPanelClickHandlerParams) => void;
21+
model: IJupyterGISModel;
22+
onSelect: ({
23+
type,
24+
item,
25+
nodeId,
26+
}: ILeftPanelClickHandlerParams) => void;
2727
}
2828

2929
export interface ILayerPanelOptions extends ILeftPanelOptions {
30-
state: IStateDB;
30+
state: IStateDB;
3131
}
3232

3333
export interface ILeftPanelClickHandlerParams {
34-
type: SelectionType;
35-
item: string;
36-
nodeId?: string;
37-
event: ReactMouseEvent;
34+
type: SelectionType;
35+
item: string;
36+
nodeId?: string;
37+
event: ReactMouseEvent;
3838
}
3939

4040
interface ILeftComponentProps {
41-
model: IJupyterGISModel;
42-
state: IStateDB;
43-
commands: CommandRegistry;
41+
model: IJupyterGISModel;
42+
state: IStateDB;
43+
commands: CommandRegistry;
4444
}
4545

4646
export const LeftPanelComponent = (options: ILeftComponentProps) => {
47-
return (
48-
<div
49-
style={{
50-
width: 250,
51-
position: 'absolute',
52-
top: 30,
53-
left: 0,
54-
}}
55-
>
56-
<Tabs defaultValue="filters" className="jgis-stac-browser-main">
57-
<TabsList
58-
style={{
59-
borderRadius: 5,
60-
fontSize: 10,
61-
}}
62-
>
63-
<TabsTrigger className="jGIS-layer-browser-category" value="layers">
64-
Layers
65-
</TabsTrigger>
66-
<TabsTrigger className="jGIS-layer-browser-category" value="stac">
67-
Stac Browser
68-
</TabsTrigger>
69-
<TabsTrigger className="jGIS-layer-browser-category" value="filters">
70-
Filters
71-
</TabsTrigger>
72-
</TabsList>
73-
<TabsContent
74-
value="layers"
75-
style={{
76-
borderRadius: 5,
77-
fontSize: 10,
78-
backgroundColor: '#eef',
79-
}}
80-
>
81-
<LayersBodyComponent
82-
model={options.model}
83-
commands={options.commands}
84-
state={options.state}
85-
></LayersBodyComponent>
86-
</TabsContent>
87-
<TabsContent value="stac">
88-
<StacBrowser controlPanelModel={options.model}></StacBrowser>
89-
</TabsContent>
90-
<TabsContent
91-
value="filters"
92-
style={{
93-
borderRadius: 5,
94-
backgroundColor: '#eef',
95-
}}
96-
>
97-
<FilterComponent model={options.model}></FilterComponent>,
98-
</TabsContent>
99-
</Tabs>
100-
</div>
101-
);
47+
return (
48+
<div
49+
style={{
50+
width: 250,
51+
position: 'absolute',
52+
top: 30,
53+
left: 0,
54+
}}
55+
>
56+
<Tabs
57+
defaultValue="filters"
58+
className="jgis-stac-browser-main"
59+
>
60+
<TabsList
61+
style={{
62+
borderRadius: 5,
63+
fontSize: 10,
64+
}}
65+
>
66+
<TabsTrigger
67+
className="jGIS-layer-browser-category"
68+
value="layers"
69+
>
70+
Layers
71+
</TabsTrigger>
72+
<TabsTrigger
73+
className="jGIS-layer-browser-category"
74+
value="stac"
75+
>
76+
Stac Browser
77+
</TabsTrigger>
78+
<TabsTrigger
79+
className="jGIS-layer-browser-category"
80+
value="filters"
81+
>
82+
Filters
83+
</TabsTrigger>
84+
</TabsList>
85+
<TabsContent
86+
value="layers"
87+
style={{
88+
borderRadius: 5,
89+
fontSize: 10,
90+
backgroundColor: '#eef',
91+
}}
92+
>
93+
<LayersBodyComponent
94+
model={options.model}
95+
commands={options.commands}
96+
state={options.state}
97+
></LayersBodyComponent>
98+
</TabsContent>
99+
<TabsContent value="stac">
100+
<StacBrowser
101+
controlPanelModel={
102+
options.model
103+
}
104+
></StacBrowser>
105+
</TabsContent>
106+
<TabsContent
107+
value="filters"
108+
style={{
109+
borderRadius: 5,
110+
backgroundColor: '#eef',
111+
}}
112+
>
113+
<FilterComponent
114+
model={options.model}
115+
></FilterComponent>
116+
,
117+
</TabsContent>
118+
</Tabs>
119+
</div>
120+
);
102121
};
103-
104-
// export class LeftPanelWidget extends SidePanel {
105-
// constructor(options: LeftPanelWidget.IOptions) {
106-
// super();
107-
// this.addClass('jGIS-sidepanel-widget');
108-
// this.addClass('data-jgis-keybinding');
109-
// this.node.tabIndex = 0;
110-
111-
// this._model = options.model;
112-
// this._state = options.state;
113-
// this._commands = options.commands;
114-
115-
// const header = new ControlPanelHeader();
116-
// this.header.addWidget(header);
117-
118-
// const stacPanel = new StacPanel({
119-
// model: this._model,
120-
// });
121-
122-
// stacPanel.title.caption = 'STAC';
123-
// stacPanel.title.label = 'STAC';
124-
// this.addWidget(stacPanel);
125-
126-
// const filterPanel = new FilterPanel({
127-
// model: this._model,
128-
// });
129-
130-
// filterPanel.title.caption = 'Filters';
131-
// filterPanel.title.label = 'Filters';
132-
// this.addWidget(filterPanel);
133-
// }
134-
135-
// dispose(): void {
136-
// super.dispose();
137-
// }
138-
139-
// protected onAfterAttach(msg: Message): void {
140-
// super.onAfterAttach(msg);
141-
// const node = this.node;
142-
// node.addEventListener('mouseup', this);
143-
// }
144-
145-
// protected onBeforeDetach(msg: Message): void {
146-
// super.onBeforeDetach(msg);
147-
// const node = this.node;
148-
// node.removeEventListener('mouseup', this);
149-
// }
150-
151-
// handleEvent(event: Event): void {
152-
// switch (event.type) {
153-
// case 'mouseup':
154-
// this._mouseUpEvent(event as MouseEvent);
155-
// break;
156-
// default:
157-
// break;
158-
// }
159-
// }
160-
161-
// private _mouseUpEvent(event: MouseEvent): void {
162-
// // If we click on empty space in the layer panel, keep the focus on the last selected element
163-
// const node = document.getElementById(this._lastSelectedNodeId);
164-
// if (!node) {
165-
// return;
166-
// }
167-
168-
// node.focus();
169-
// }
170-
171-
// private _lastSelectedNodeId: string;
172-
// private _model: IJupyterGISModel;
173-
// }
174-
175-
export namespace LeftPanelWidget {
176-
export interface IOptions {
177-
model: IJupyterGISModel;
178-
state: IStateDB;
179-
commands: CommandRegistry;
180-
}
181-
182-
export interface IProps {
183-
filePath?: string;
184-
sharedModel?: JupyterGISDoc;
185-
}
186-
}

0 commit comments

Comments
 (0)