@jupytergis/base 0.6.0 → 0.6.2
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/lib/processing/index.js +4 -3
- package/lib/shared/components/Badge.d.ts +1 -1
- package/lib/shared/components/Badge.js +3 -2
- package/lib/shared/components/Button.d.ts +1 -1
- package/lib/shared/components/Button.js +2 -1
- package/lib/stacBrowser/components/StacFilterSection.js +12 -2
- package/lib/stacBrowser/components/StacPanelFilters.js +19 -3
- package/lib/toolbar/widget.d.ts +1 -0
- package/lib/toolbar/widget.js +23 -2
- package/package.json +5 -5
- package/style/shared/button.css +5 -0
- package/style/stacBrowser.css +17 -0
package/lib/processing/index.js
CHANGED
|
@@ -121,6 +121,7 @@ export async function executeSQLProcessing(model, geojsonString, gdalFunction, o
|
|
|
121
121
|
const processedBytes = await Gdal.getFileBytes(outputFilePath);
|
|
122
122
|
const processedGeoJSONString = new TextDecoder().decode(processedBytes);
|
|
123
123
|
Gdal.close(dataset);
|
|
124
|
+
const layerName = `${layerNamePrefix} ${processingType.charAt(0).toUpperCase() + processingType.slice(1)}`;
|
|
124
125
|
if (!embedOutputLayer) {
|
|
125
126
|
// Save the output as a file
|
|
126
127
|
const jgisFilePath = (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model.filePath;
|
|
@@ -146,7 +147,7 @@ export async function executeSQLProcessing(model, geojsonString, gdalFunction, o
|
|
|
146
147
|
type: 'VectorLayer',
|
|
147
148
|
parameters: { source: newSourceId },
|
|
148
149
|
visible: true,
|
|
149
|
-
name:
|
|
150
|
+
name: layerName,
|
|
150
151
|
};
|
|
151
152
|
model.sharedModel.addSource(newSourceId, sourceModel);
|
|
152
153
|
model.addLayer(UUID.uuid4(), layerModel);
|
|
@@ -157,14 +158,14 @@ export async function executeSQLProcessing(model, geojsonString, gdalFunction, o
|
|
|
157
158
|
const newSourceId = UUID.uuid4();
|
|
158
159
|
const sourceModel = {
|
|
159
160
|
type: 'GeoJSONSource',
|
|
160
|
-
name: `${
|
|
161
|
+
name: `${layerName} Source`,
|
|
161
162
|
parameters: { data: processedGeoJSON },
|
|
162
163
|
};
|
|
163
164
|
const layerModel = {
|
|
164
165
|
type: 'VectorLayer',
|
|
165
166
|
parameters: { source: newSourceId },
|
|
166
167
|
visible: true,
|
|
167
|
-
name:
|
|
168
|
+
name: layerName,
|
|
168
169
|
};
|
|
169
170
|
model.sharedModel.addSource(newSourceId, sourceModel);
|
|
170
171
|
model.addLayer(UUID.uuid4(), layerModel);
|
|
@@ -3,5 +3,5 @@ interface IBadgeProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
|
3
3
|
variant?: 'destructive' | 'outline' | 'secondary';
|
|
4
4
|
size?: 'sm' | 'lg' | 'icon';
|
|
5
5
|
}
|
|
6
|
-
declare function Badge({ variant, ...props }: IBadgeProps): React.JSX.Element;
|
|
6
|
+
declare function Badge({ variant, className, ...props }: IBadgeProps): React.JSX.Element;
|
|
7
7
|
export default Badge;
|
|
@@ -10,10 +10,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import * as React from 'react';
|
|
13
|
+
import { cn } from './utils';
|
|
13
14
|
function Badge(_a) {
|
|
14
|
-
var { variant } = _a, props = __rest(_a, ["variant"]);
|
|
15
|
+
var { variant, className } = _a, props = __rest(_a, ["variant", "className"]);
|
|
15
16
|
return (
|
|
16
17
|
// @ts-expect-error lol
|
|
17
|
-
React.createElement("div", Object.assign({ "data-variant": variant, className: 'jgis-badge' }, props)));
|
|
18
|
+
React.createElement("div", Object.assign({ "data-variant": variant, className: cn('jgis-badge', className) }, props)));
|
|
18
19
|
}
|
|
19
20
|
export default Badge;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
3
|
asChild?: boolean;
|
|
4
4
|
variant?: 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' | 'icon';
|
|
5
|
-
size?: 'sm' | 'lg' | 'icon';
|
|
5
|
+
size?: 'sm' | 'lg' | 'icon' | 'icon-sm';
|
|
6
6
|
}
|
|
7
7
|
declare const Button: React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
export { Button };
|
|
@@ -11,10 +11,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { Slot } from '@radix-ui/react-slot';
|
|
13
13
|
import * as React from 'react';
|
|
14
|
+
import { cn } from './utils';
|
|
14
15
|
const Button = React.forwardRef((_a, ref) => {
|
|
15
16
|
var { variant, className, size, asChild = false } = _a, props = __rest(_a, ["variant", "className", "size", "asChild"]);
|
|
16
17
|
const Comp = asChild ? Slot : 'button';
|
|
17
|
-
return (React.createElement(Comp, Object.assign({ "data-size": size, "data-variant": variant, className:
|
|
18
|
+
return (React.createElement(Comp, Object.assign({ "data-size": size, "data-variant": variant, className: cn('jgis-button', className), ref: ref }, props)));
|
|
18
19
|
});
|
|
19
20
|
Button.displayName = 'Button';
|
|
20
21
|
export { Button };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
1
3
|
import { ChevronRight } from 'lucide-react';
|
|
2
4
|
import React, { useMemo } from 'react';
|
|
3
5
|
import Badge from "../../shared/components/Badge";
|
|
6
|
+
import { Button } from "../../shared/components/Button";
|
|
4
7
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "../../shared/components/DropdownMenu";
|
|
5
8
|
const StacFilterSection = ({ section, data, selectedCollections, selectedData, handleCheckedChange, }) => {
|
|
6
9
|
const items = useMemo(() => {
|
|
@@ -38,12 +41,19 @@ const StacFilterSection = ({ section, data, selectedCollections, selectedData, h
|
|
|
38
41
|
} }, product.productCode))))))));
|
|
39
42
|
}
|
|
40
43
|
}, [section, data, selectedCollections, selectedData, handleCheckedChange]);
|
|
44
|
+
const isTriggerDisabled = (section === 'Platform' || section === 'Data / Product') &&
|
|
45
|
+
selectedCollections.length === 0;
|
|
41
46
|
return (React.createElement("div", { className: "jgis-stac-filter-section-container" },
|
|
42
47
|
React.createElement(DropdownMenu, { modal: false },
|
|
43
|
-
React.createElement(DropdownMenuTrigger, { className: "jgis-stac-filter-trigger" },
|
|
48
|
+
React.createElement(DropdownMenuTrigger, { className: "jgis-stac-filter-trigger", disabled: isTriggerDisabled },
|
|
44
49
|
section,
|
|
45
50
|
React.createElement(ChevronRight, { className: "DropdownMenuIcon" })),
|
|
46
51
|
React.createElement(DropdownMenuContent, { side: "right" }, items)),
|
|
47
|
-
React.createElement("div", { className: "jgis-stac-filter-section-badges" }, selectedData.map(data => (React.createElement(Badge, { key: data },
|
|
52
|
+
React.createElement("div", { className: "jgis-stac-filter-section-badges" }, selectedData.map(data => (React.createElement(Badge, { key: data, className: "jgis-stac-badge" },
|
|
53
|
+
React.createElement("span", null, data),
|
|
54
|
+
React.createElement(Button, { variant: "icon", size: "icon-sm", className: "jgis-stac-badge-icon", onClick: () => {
|
|
55
|
+
handleCheckedChange(data, '');
|
|
56
|
+
} },
|
|
57
|
+
React.createElement(FontAwesomeIcon, { icon: faXmark }))))))));
|
|
48
58
|
};
|
|
49
59
|
export default StacFilterSection;
|
|
@@ -6,7 +6,7 @@ import { Calendar } from "../../shared/components/Calendar";
|
|
|
6
6
|
import Checkbox from "../../shared/components/Checkbox";
|
|
7
7
|
import { Popover, PopoverContent, PopoverTrigger, } from "../../shared/components/Popover";
|
|
8
8
|
import StacFilterSection from "./StacFilterSection";
|
|
9
|
-
import { datasets as datasetsList, platforms, products, } from "../constants";
|
|
9
|
+
import { datasets as datasetsList, platforms as platformsList, products as productsList, } from "../constants";
|
|
10
10
|
const StacPanelFilters = ({ filterState, filterSetters, startTime, setStartTime, endTime, setEndTime, useWorldBBox, setUseWorldBBox, }) => {
|
|
11
11
|
const handleDatasetSelection = (dataset, collection) => {
|
|
12
12
|
const collections = new Set(filterState.collections);
|
|
@@ -19,6 +19,22 @@ const StacPanelFilters = ({ filterState, filterSetters, startTime, setStartTime,
|
|
|
19
19
|
});
|
|
20
20
|
if (datasetsForCollection.length === 0) {
|
|
21
21
|
collections.delete(collection);
|
|
22
|
+
const platforms = new Set(filterState.platforms);
|
|
23
|
+
const products = new Set(filterState.products);
|
|
24
|
+
// Remove platforms belonging to this collection
|
|
25
|
+
if (platformsList[collection]) {
|
|
26
|
+
platformsList[collection].forEach(platform => {
|
|
27
|
+
platforms.delete(platform);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// Remove products belonging to this collection
|
|
31
|
+
productsList
|
|
32
|
+
.filter(product => product.collections.includes(collection))
|
|
33
|
+
.forEach(product => {
|
|
34
|
+
products.delete(product.productCode);
|
|
35
|
+
});
|
|
36
|
+
filterSetters.platforms(platforms);
|
|
37
|
+
filterSetters.products(products);
|
|
22
38
|
}
|
|
23
39
|
}
|
|
24
40
|
else {
|
|
@@ -59,7 +75,7 @@ const StacPanelFilters = ({ filterState, filterSetters, startTime, setStartTime,
|
|
|
59
75
|
React.createElement(PopoverContent, null,
|
|
60
76
|
React.createElement(Calendar, { mode: "single", selected: endTime, onSelect: setEndTime, autoFocus: true })))),
|
|
61
77
|
React.createElement(StacFilterSection, { section: "Collection", data: datasetsList, selectedCollections: Array.from(filterState.collections), selectedData: Array.from(filterState.datasets), handleCheckedChange: handleDatasetSelection }),
|
|
62
|
-
React.createElement(StacFilterSection, { section: "Platform", data:
|
|
63
|
-
React.createElement(StacFilterSection, { section: "Data / Product", data:
|
|
78
|
+
React.createElement(StacFilterSection, { section: "Platform", data: platformsList, selectedCollections: Array.from(filterState.collections), selectedData: Array.from(filterState.platforms), handleCheckedChange: platform => handleToggle('platforms', platform) }),
|
|
79
|
+
React.createElement(StacFilterSection, { section: "Data / Product", data: productsList, selectedCollections: Array.from(filterState.collections), selectedData: Array.from(filterState.products), handleCheckedChange: product => handleToggle('products', product) })));
|
|
64
80
|
};
|
|
65
81
|
export default StacPanelFilters;
|
package/lib/toolbar/widget.d.ts
CHANGED
package/lib/toolbar/widget.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UsersItem } from '@jupyter/collaboration';
|
|
1
|
+
import { UsersItem, DefaultIconRenderer } from '@jupyter/collaboration';
|
|
2
2
|
import { CommandToolbarButton } from '@jupyterlab/apputils';
|
|
3
3
|
import { MenuSvg, ReactWidget, ReactiveToolbar, ToolbarButton, addIcon, redoIcon, undoIcon, } from '@jupyterlab/ui-components';
|
|
4
4
|
import { Widget } from '@lumino/widgets';
|
|
@@ -17,9 +17,29 @@ export class Separator extends Widget {
|
|
|
17
17
|
this.addClass(TOOLBAR_SEPARATOR_CLASS);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
function createUserIconRenderer(model) {
|
|
21
|
+
let selectedUserId;
|
|
22
|
+
return (props) => {
|
|
23
|
+
const { user } = props;
|
|
24
|
+
const isSelected = user.userId === selectedUserId;
|
|
25
|
+
const className = isSelected ? 'selected' : '';
|
|
26
|
+
const onClick = () => {
|
|
27
|
+
if (user.userId === selectedUserId) {
|
|
28
|
+
selectedUserId = undefined;
|
|
29
|
+
model.setUserToFollow(undefined);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
selectedUserId = user.userId;
|
|
33
|
+
model.setUserToFollow(user.userId);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return (React.createElement(DefaultIconRenderer, { user: user, onClick: onClick, className: className }));
|
|
37
|
+
};
|
|
38
|
+
}
|
|
20
39
|
export class ToolbarWidget extends ReactiveToolbar {
|
|
21
40
|
constructor(options) {
|
|
22
41
|
super();
|
|
42
|
+
this._model = options.model;
|
|
23
43
|
this.addClass('jGIS-toolbar-widget');
|
|
24
44
|
if (options.commands) {
|
|
25
45
|
const undoButton = new CommandToolbarButton({
|
|
@@ -102,7 +122,8 @@ export class ToolbarWidget extends ReactiveToolbar {
|
|
|
102
122
|
'temporal-controller-button';
|
|
103
123
|
this.addItem('spacer', ReactiveToolbar.createSpacerItem());
|
|
104
124
|
// Users
|
|
105
|
-
|
|
125
|
+
const iconRenderer = createUserIconRenderer(this._model);
|
|
126
|
+
this.addItem('users', ReactWidget.create(React.createElement(UsersItem, { model: this._model, iconRenderer: iconRenderer })));
|
|
106
127
|
}
|
|
107
128
|
}
|
|
108
129
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/base",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "A JupyterLab extension for 3D modelling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@jupyter/collaboration": "^3.1.0",
|
|
45
45
|
"@jupyter/react-components": "^0.16.6",
|
|
46
46
|
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
|
|
47
|
-
"@jupytergis/schema": "^0.6.
|
|
47
|
+
"@jupytergis/schema": "^0.6.2",
|
|
48
48
|
"@jupyterlab/application": "^4.3.0",
|
|
49
49
|
"@jupyterlab/apputils": "^4.3.0",
|
|
50
50
|
"@jupyterlab/completer": "^4.3.0",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"ol-stac": "^1.0.0-rc.10",
|
|
88
88
|
"pbf": "^4.0.1",
|
|
89
89
|
"pmtiles": "^3.0.7",
|
|
90
|
-
"proj4": "
|
|
91
|
-
"proj4-list": "
|
|
90
|
+
"proj4": "2.19.3",
|
|
91
|
+
"proj4-list": "1.0.4",
|
|
92
92
|
"react": "^18.0.1",
|
|
93
93
|
"react-day-picker": "^9.7.0",
|
|
94
94
|
"shpjs": "^6.1.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@types/colormap": "^2.3.4",
|
|
103
103
|
"@types/d3-color": "^3.1.0",
|
|
104
104
|
"@types/node": "^18.15.11",
|
|
105
|
-
"@types/proj4": "
|
|
105
|
+
"@types/proj4": "2.19.0",
|
|
106
106
|
"@types/shpjs": "^3.4.7",
|
|
107
107
|
"@types/uuid": "^10.0.0",
|
|
108
108
|
"rimraf": "^3.0.2",
|
package/style/shared/button.css
CHANGED
package/style/stacBrowser.css
CHANGED
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
gap: 0.15rem;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
.jgis-stac-filter-trigger:disabled {
|
|
60
|
+
cursor: not-allowed;
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
.jgis-stac-filter-section-container {
|
|
60
64
|
display: flex;
|
|
61
65
|
flex-direction: column;
|
|
@@ -72,3 +76,16 @@
|
|
|
72
76
|
width: 1rem;
|
|
73
77
|
height: 1rem;
|
|
74
78
|
}
|
|
79
|
+
|
|
80
|
+
.jgis-stac-badge {
|
|
81
|
+
gap: 0.25rem;
|
|
82
|
+
padding-right: 0.3rem !important;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.jgis-stac-badge-icon:hover {
|
|
86
|
+
background-color: color-mix(
|
|
87
|
+
in srgb,
|
|
88
|
+
var(--jp-error-color0),
|
|
89
|
+
transparent 20%
|
|
90
|
+
) !important;
|
|
91
|
+
}
|