@jupytergis/base 0.13.2 → 0.14.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.
- package/lib/commands/BaseCommandIDs.d.ts +14 -13
- package/lib/commands/BaseCommandIDs.js +14 -14
- package/lib/commands/index.js +528 -130
- package/lib/commands/operationCommands.d.ts +22 -0
- package/lib/commands/operationCommands.js +305 -0
- package/lib/constants.js +11 -9
- package/lib/dialogs/ProcessingFormDialog.d.ts +1 -1
- package/lib/dialogs/ProcessingFormDialog.js +2 -2
- package/lib/dialogs/layerBrowserDialog.d.ts +2 -0
- package/lib/dialogs/layerBrowserDialog.js +12 -5
- package/lib/dialogs/layerCreationFormDialog.d.ts +7 -0
- package/lib/dialogs/layerCreationFormDialog.js +10 -2
- package/lib/dialogs/symbology/components/color_ramp/ColorRampControls.d.ts +2 -1
- package/lib/dialogs/symbology/components/color_ramp/ColorRampControls.js +21 -19
- package/lib/dialogs/symbology/components/color_ramp/ColorRampSelector.d.ts +3 -1
- package/lib/dialogs/symbology/components/color_ramp/ColorRampSelector.js +13 -5
- package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.js +6 -4
- package/lib/dialogs/symbology/vector_layer/types/Categorized.js +7 -11
- package/lib/dialogs/symbology/vector_layer/types/Graduated.js +7 -10
- package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +7 -8
- package/lib/formbuilder/creationform.d.ts +8 -8
- package/lib/formbuilder/creationform.js +130 -85
- package/lib/formbuilder/editform.d.ts +1 -7
- package/lib/formbuilder/editform.js +64 -52
- package/lib/formbuilder/formselectors.d.ts +5 -4
- package/lib/formbuilder/index.d.ts +1 -1
- package/lib/formbuilder/index.js +1 -1
- package/lib/formbuilder/objectform/SchemaForm.d.ts +36 -0
- package/lib/formbuilder/objectform/SchemaForm.js +77 -0
- package/lib/formbuilder/objectform/StoryEditorForm.d.ts +3 -9
- package/lib/formbuilder/objectform/StoryEditorForm.js +20 -14
- package/lib/formbuilder/objectform/components/LayerSelect.js +3 -8
- package/lib/formbuilder/objectform/components/SegmentFormSymbology.js +23 -10
- package/lib/formbuilder/objectform/components/SourcePropertiesField.d.ts +7 -0
- package/lib/formbuilder/objectform/components/SourcePropertiesField.js +29 -0
- package/lib/formbuilder/objectform/components/StorySegmentReset.js +1 -1
- package/lib/formbuilder/objectform/fileselectorwidget.js +1 -1
- package/lib/formbuilder/objectform/layer/heatmapLayerForm.d.ts +3 -12
- package/lib/formbuilder/objectform/layer/heatmapLayerForm.js +87 -55
- package/lib/formbuilder/objectform/layer/hillshadeLayerForm.d.ts +3 -8
- package/lib/formbuilder/objectform/layer/hillshadeLayerForm.js +36 -10
- package/lib/formbuilder/objectform/layer/layerform.d.ts +7 -9
- package/lib/formbuilder/objectform/layer/layerform.js +33 -20
- package/lib/formbuilder/objectform/layer/storySegmentLayerForm.d.ts +3 -5
- package/lib/formbuilder/objectform/layer/storySegmentLayerForm.js +73 -29
- package/lib/formbuilder/objectform/layer/vectorlayerform.d.ts +3 -14
- package/lib/formbuilder/objectform/layer/vectorlayerform.js +36 -29
- package/lib/formbuilder/objectform/layer/webGlLayerForm.d.ts +3 -10
- package/lib/formbuilder/objectform/layer/webGlLayerForm.js +37 -13
- package/lib/formbuilder/objectform/process/dissolveProcessForm.d.ts +8 -18
- package/lib/formbuilder/objectform/process/dissolveProcessForm.js +68 -56
- package/lib/formbuilder/objectform/processingForm.d.ts +12 -0
- package/lib/formbuilder/objectform/processingForm.js +33 -0
- package/lib/formbuilder/objectform/schemaUtils.d.ts +16 -0
- package/lib/formbuilder/objectform/schemaUtils.js +59 -0
- package/lib/formbuilder/objectform/source/geojsonsource.d.ts +3 -19
- package/lib/formbuilder/objectform/source/geojsonsource.js +94 -53
- package/lib/formbuilder/objectform/source/geotiffsource.d.ts +3 -20
- package/lib/formbuilder/objectform/source/geotiffsource.js +73 -74
- package/lib/formbuilder/objectform/source/pathbasedsource.d.ts +3 -19
- package/lib/formbuilder/objectform/source/pathbasedsource.js +76 -75
- package/lib/formbuilder/objectform/source/sourceform.d.ts +7 -8
- package/lib/formbuilder/objectform/source/sourceform.js +28 -11
- package/lib/formbuilder/objectform/source/tilesourceform.d.ts +3 -7
- package/lib/formbuilder/objectform/source/tilesourceform.js +63 -53
- package/lib/formbuilder/objectform/useSchemaFormState.d.ts +48 -0
- package/lib/formbuilder/objectform/useSchemaFormState.js +35 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/keybindings.json +10 -10
- package/lib/mainview/mainView.d.ts +11 -7
- package/lib/mainview/mainView.js +63 -36
- package/lib/mainview/mainviewmodel.js +2 -2
- package/lib/menus.js +8 -8
- package/lib/panelview/components/layers.js +5 -2
- package/lib/panelview/objectproperties.js +2 -2
- package/lib/panelview/rightpanel.js +17 -2
- package/lib/panelview/story-maps/SpectaPanel.d.ts +15 -0
- package/lib/panelview/story-maps/SpectaPanel.js +35 -0
- package/lib/panelview/story-maps/StoryViewerPanel.d.ts +24 -9
- package/lib/panelview/story-maps/StoryViewerPanel.js +22 -268
- package/lib/panelview/story-maps/{PreviewModeSwitch.js → components/PreviewModeSwitch.js} +1 -1
- package/lib/panelview/story-maps/components/SpectaDesktopView.d.ts +21 -0
- package/lib/panelview/story-maps/components/SpectaDesktopView.js +49 -0
- package/lib/panelview/story-maps/components/SpectaMobileView.d.ts +17 -0
- package/lib/panelview/story-maps/{MobileSpectaPanel.js → components/SpectaMobileView.js} +8 -22
- package/lib/panelview/story-maps/{StoryNavBar.d.ts → components/StoryNavBar.d.ts} +1 -1
- package/lib/panelview/story-maps/{StoryNavBar.js → components/StoryNavBar.js} +2 -4
- package/lib/panelview/story-maps/hooks/useStoryMap.d.ts +39 -0
- package/lib/panelview/story-maps/hooks/useStoryMap.js +252 -0
- package/lib/processing/index.d.ts +2 -2
- package/lib/processing/index.js +62 -35
- package/lib/processing/processingCommands.d.ts +1 -1
- package/lib/processing/processingCommands.js +26 -6
- package/lib/shared/components/Collapsible.d.ts +6 -0
- package/lib/shared/components/Collapsible.js +26 -0
- package/lib/statusbar/SpectaPresentationProgressBar.d.ts +7 -0
- package/lib/statusbar/SpectaPresentationProgressBar.js +40 -0
- package/lib/toolbar/widget.js +4 -2
- package/lib/tools.d.ts +6 -0
- package/lib/tools.js +9 -0
- package/lib/types.d.ts +29 -2
- package/lib/widget.js +14 -2
- package/package.json +2 -4
- package/style/base.css +23 -1
- package/style/dialog.css +5 -0
- package/style/leftPanel.css +14 -37
- package/style/shared/button.css +0 -10
- package/style/shared/switch.css +8 -7
- package/style/spectaProgressBar.css +144 -0
- package/style/storyPanel.css +33 -0
- package/style/symbologyDialog.css +2 -2
- package/lib/formbuilder/objectform/baseform.d.ts +0 -91
- package/lib/formbuilder/objectform/baseform.js +0 -231
- package/lib/panelview/story-maps/MobileSpectaPanel.d.ts +0 -7
- /package/lib/panelview/story-maps/{PreviewModeSwitch.d.ts → components/PreviewModeSwitch.d.ts} +0 -0
|
@@ -1,64 +1,96 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { deepCopy, loadFile } from "../../../tools";
|
|
3
|
+
import { SchemaForm } from '../SchemaForm';
|
|
4
|
+
import { processBaseSchema, removeFormEntry } from '../schemaUtils';
|
|
5
|
+
import { useSchemaFormState } from '../useSchemaFormState';
|
|
6
|
+
async function fetchFeatureNames(model, layerData, sourceData) {
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
|
+
let resolvedSource = sourceData;
|
|
9
|
+
if ((layerData === null || layerData === void 0 ? void 0 : layerData.source) && !resolvedSource) {
|
|
10
|
+
const currentSource = model.getSource(layerData.source);
|
|
11
|
+
if (!currentSource || currentSource.type !== 'GeoJSONSource') {
|
|
12
|
+
return [];
|
|
14
13
|
}
|
|
14
|
+
resolvedSource = currentSource.parameters;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
16
|
+
const source = model.getSource(layerData === null || layerData === void 0 ? void 0 : layerData.source);
|
|
17
|
+
if (!((_a = source === null || source === void 0 ? void 0 : source.parameters) === null || _a === void 0 ? void 0 : _a.path)) {
|
|
18
|
+
return [];
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
const jsonData = await loadFile({
|
|
21
|
+
filepath: source.parameters.path,
|
|
22
|
+
type: 'GeoJSONSource',
|
|
23
|
+
model,
|
|
24
|
+
});
|
|
25
|
+
const featureProps = (_d = (_c = (_b = jsonData === null || jsonData === void 0 ? void 0 : jsonData.features) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.properties) !== null && _d !== void 0 ? _d : {};
|
|
26
|
+
return Object.keys(featureProps);
|
|
27
|
+
}
|
|
28
|
+
export function HeatmapLayerPropertiesForm(props) {
|
|
29
|
+
const { schema: schemaProp, sourceData, syncData, model, filePath, formContext, sourceType, dialogOptions, formErrorSignal, sourceFormChangedSignal, } = props;
|
|
30
|
+
const { formData, schema, formContextValue, hasSchema, handleChangeBase, handleSubmitBase, } = useSchemaFormState({
|
|
31
|
+
sourceData,
|
|
32
|
+
schemaProp,
|
|
33
|
+
model,
|
|
34
|
+
syncData,
|
|
35
|
+
cancel: props.cancel,
|
|
36
|
+
onAfterChange: dialogOptions
|
|
37
|
+
? (data) => {
|
|
38
|
+
dialogOptions.layerData = Object.assign({}, data);
|
|
39
|
+
}
|
|
40
|
+
: undefined,
|
|
41
|
+
});
|
|
42
|
+
const [features, setFeatures] = useState([]);
|
|
43
|
+
const formDataRef = useRef(formData);
|
|
44
|
+
formDataRef.current = formData;
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
let cancelled = false;
|
|
47
|
+
fetchFeatureNames(model, formData)
|
|
48
|
+
.then(names => {
|
|
49
|
+
if (!cancelled) {
|
|
50
|
+
setFeatures(names);
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
.catch(() => {
|
|
54
|
+
if (!cancelled) {
|
|
55
|
+
setFeatures([]);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return () => {
|
|
59
|
+
cancelled = true;
|
|
60
|
+
};
|
|
61
|
+
}, [model, formData === null || formData === void 0 ? void 0 : formData.source]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (sourceType !== 'GeoJSONSource' || !sourceFormChangedSignal) {
|
|
36
64
|
return;
|
|
37
65
|
}
|
|
38
|
-
|
|
39
|
-
|
|
66
|
+
const handler = (_sender, sourceDataPayload) => {
|
|
67
|
+
fetchFeatureNames(model, formDataRef.current, sourceDataPayload).then(setFeatures);
|
|
68
|
+
};
|
|
69
|
+
sourceFormChangedSignal.connect(handler);
|
|
70
|
+
return () => {
|
|
71
|
+
sourceFormChangedSignal.disconnect(handler);
|
|
72
|
+
};
|
|
73
|
+
}, [sourceType, sourceFormChangedSignal, model]);
|
|
74
|
+
const uiSchema = useMemo(() => {
|
|
40
75
|
var _a;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
const builtUiSchema = {};
|
|
77
|
+
const dataCopy = deepCopy(formData);
|
|
78
|
+
removeFormEntry('color', formData, schema, builtUiSchema);
|
|
79
|
+
removeFormEntry('symbologyState', formData, schema, builtUiSchema);
|
|
80
|
+
removeFormEntry('blur', dataCopy, schema, builtUiSchema);
|
|
81
|
+
removeFormEntry('radius', dataCopy, schema, builtUiSchema);
|
|
82
|
+
processBaseSchema(dataCopy, schema, builtUiSchema, formContext, removeFormEntry);
|
|
83
|
+
if ((_a = schema.properties) === null || _a === void 0 ? void 0 : _a.source) {
|
|
84
|
+
const availableSources = model.getSourcesByType(sourceType);
|
|
85
|
+
schema.properties.source.enumNames =
|
|
86
|
+
Object.values(availableSources);
|
|
87
|
+
schema.properties.source.enum = Object.keys(availableSources);
|
|
50
88
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
filepath: source.parameters.path,
|
|
57
|
-
type: 'GeoJSONSource',
|
|
58
|
-
model: this.props.model,
|
|
59
|
-
});
|
|
60
|
-
const featureProps = jsonData.features[0].properties;
|
|
61
|
-
this.features = Object.keys(featureProps);
|
|
62
|
-
this.forceUpdate();
|
|
89
|
+
builtUiSchema.feature = { enum: features };
|
|
90
|
+
return builtUiSchema;
|
|
91
|
+
}, [schema, formData, formContext, model, sourceType, features]);
|
|
92
|
+
if (!hasSchema) {
|
|
93
|
+
return null;
|
|
63
94
|
}
|
|
95
|
+
return (React.createElement(SchemaForm, { schema: schema, formData: formData, onChange: handleChangeBase, onSubmit: handleSubmitBase, formContext: formContextValue, filePath: filePath, uiSchema: uiSchema, formErrorSignal: formErrorSignal }));
|
|
64
96
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
* The form to modify a hillshade layer.
|
|
5
|
-
*/
|
|
6
|
-
export declare class HillshadeLayerPropertiesForm extends LayerPropertiesForm {
|
|
7
|
-
protected processSchema(data: IDict<any> | undefined, schema: IDict, uiSchema: IDict): void;
|
|
8
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ILayerProps } from './layerform';
|
|
3
|
+
export declare function HillshadeLayerPropertiesForm(props: ILayerProps): React.ReactElement | null;
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { deepCopy } from "../../../tools";
|
|
3
|
+
import { SchemaForm } from '../SchemaForm';
|
|
4
|
+
import { processBaseSchema, removeFormEntry } from '../schemaUtils';
|
|
5
|
+
import { useSchemaFormState } from '../useSchemaFormState';
|
|
6
|
+
export function HillshadeLayerPropertiesForm(props) {
|
|
7
|
+
const { schema: schemaProp, sourceData, syncData, model, filePath, formContext, sourceType, dialogOptions, formErrorSignal, } = props;
|
|
8
|
+
const { formData, schema, formContextValue, hasSchema, handleChangeBase, handleSubmitBase, } = useSchemaFormState({
|
|
9
|
+
sourceData,
|
|
10
|
+
schemaProp,
|
|
11
|
+
model,
|
|
12
|
+
syncData,
|
|
13
|
+
cancel: props.cancel,
|
|
14
|
+
onAfterChange: dialogOptions
|
|
15
|
+
? (data) => {
|
|
16
|
+
dialogOptions.layerData = Object.assign({}, data);
|
|
17
|
+
}
|
|
18
|
+
: undefined,
|
|
19
|
+
});
|
|
20
|
+
const uiSchema = useMemo(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
const builtUiSchema = {};
|
|
23
|
+
const dataCopy = deepCopy(formData);
|
|
24
|
+
processBaseSchema(dataCopy, schema, builtUiSchema, formContext, removeFormEntry);
|
|
25
|
+
if ((_a = schema.properties) === null || _a === void 0 ? void 0 : _a.source) {
|
|
26
|
+
const availableSources = model.getSourcesByType(sourceType);
|
|
27
|
+
schema.properties.source.enumNames =
|
|
28
|
+
Object.values(availableSources);
|
|
29
|
+
schema.properties.source.enum = Object.keys(availableSources);
|
|
30
|
+
}
|
|
31
|
+
builtUiSchema.shadowColor = { 'ui:widget': 'color' };
|
|
32
|
+
return builtUiSchema;
|
|
33
|
+
}, [schema, formData, formContext, model, sourceType]);
|
|
34
|
+
if (!hasSchema) {
|
|
35
|
+
return null;
|
|
11
36
|
}
|
|
37
|
+
return (React.createElement(SchemaForm, { schema: schema, formData: formData, onChange: handleChangeBase, onSubmit: handleSubmitBase, formContext: formContextValue, filePath: filePath, uiSchema: uiSchema, formErrorSignal: formErrorSignal }));
|
|
12
38
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base (default) layer form and props.
|
|
3
|
+
* Used for RasterLayer and any layer type without a dedicated form.
|
|
4
|
+
*/
|
|
1
5
|
import { IDict, SourceType } from '@jupytergis/schema';
|
|
2
6
|
import { Signal } from '@lumino/signaling';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import type { IBaseFormProps } from "../../../types";
|
|
5
9
|
export interface ILayerProps extends IBaseFormProps {
|
|
6
10
|
/**
|
|
7
11
|
* The source type for the layer
|
|
@@ -17,10 +21,4 @@ export interface ILayerProps extends IBaseFormProps {
|
|
|
17
21
|
*/
|
|
18
22
|
dialogOptions?: any;
|
|
19
23
|
}
|
|
20
|
-
export declare
|
|
21
|
-
props: ILayerProps;
|
|
22
|
-
protected sourceFormChangedSignal: Signal<any, IDict<any>> | undefined;
|
|
23
|
-
constructor(props: ILayerProps);
|
|
24
|
-
protected processSchema(data: IDict<any> | undefined, schema: IDict, uiSchema: IDict): void;
|
|
25
|
-
protected onFormChange(e: IChangeEvent): void;
|
|
26
|
-
}
|
|
24
|
+
export declare function LayerPropertiesForm(props: ILayerProps): React.ReactElement | null;
|
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { deepCopy } from "../../../tools";
|
|
3
|
+
import { SchemaForm } from '../SchemaForm';
|
|
4
|
+
import { processBaseSchema, removeFormEntry } from '../schemaUtils';
|
|
5
|
+
import { useSchemaFormState } from '../useSchemaFormState';
|
|
6
|
+
export function LayerPropertiesForm(props) {
|
|
7
|
+
const { schema: schemaProp, sourceData, syncData, model, filePath, formContext, sourceType, dialogOptions, formErrorSignal, } = props;
|
|
8
|
+
const { formData, schema, formContextValue, hasSchema, handleChangeBase, handleSubmitBase, } = useSchemaFormState({
|
|
9
|
+
sourceData,
|
|
10
|
+
schemaProp,
|
|
11
|
+
model,
|
|
12
|
+
syncData,
|
|
13
|
+
cancel: props.cancel,
|
|
14
|
+
onAfterChange: dialogOptions
|
|
15
|
+
? (data) => {
|
|
16
|
+
dialogOptions.layerData = Object.assign({}, data);
|
|
17
|
+
}
|
|
18
|
+
: undefined,
|
|
19
|
+
});
|
|
20
|
+
const uiSchema = useMemo(() => {
|
|
8
21
|
var _a;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
onFormChange(e) {
|
|
19
|
-
super.onFormChange(e);
|
|
20
|
-
if (this.props.dialogOptions) {
|
|
21
|
-
this.props.dialogOptions.layerData = Object.assign({}, e.formData);
|
|
22
|
+
const builtUiSchema = {};
|
|
23
|
+
const dataCopy = deepCopy(formData);
|
|
24
|
+
processBaseSchema(dataCopy, schema, builtUiSchema, formContext, removeFormEntry);
|
|
25
|
+
if ((_a = schema.properties) === null || _a === void 0 ? void 0 : _a.source) {
|
|
26
|
+
const availableSources = model.getSourcesByType(sourceType);
|
|
27
|
+
schema.properties.source.enumNames =
|
|
28
|
+
Object.values(availableSources);
|
|
29
|
+
schema.properties.source.enum = Object.keys(availableSources);
|
|
22
30
|
}
|
|
31
|
+
return builtUiSchema;
|
|
32
|
+
}, [schema, formData, formContext, model, sourceType]);
|
|
33
|
+
if (!hasSchema) {
|
|
34
|
+
return null;
|
|
23
35
|
}
|
|
36
|
+
return (React.createElement(SchemaForm, { schema: schema, formData: formData, onChange: handleChangeBase, onSubmit: handleSubmitBase, formContext: formContextValue, filePath: filePath, uiSchema: uiSchema, formErrorSignal: formErrorSignal }));
|
|
24
37
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
export declare
|
|
4
|
-
protected processSchema(data: IStorySegmentLayer | undefined, schema: IDict, uiSchema: IDict): void;
|
|
5
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ILayerProps } from './layerform';
|
|
3
|
+
export declare function StorySegmentLayerPropertiesForm(props: ILayerProps): React.ReactElement | null;
|
|
@@ -1,35 +1,75 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { deepCopy } from "../../../tools";
|
|
3
|
+
import { SchemaForm } from '../SchemaForm';
|
|
3
4
|
import { ArrayFieldTemplate } from '../components/SegmentFormSymbology';
|
|
5
|
+
import { SourcePropertiesField } from '../components/SourcePropertiesField';
|
|
4
6
|
import StorySegmentReset from '../components/StorySegmentReset';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { processBaseSchema, removeFormEntry } from '../schemaUtils';
|
|
8
|
+
import { useSchemaFormState } from '../useSchemaFormState';
|
|
9
|
+
function getFirstSelectedStorySegmentLayerId(model) {
|
|
10
|
+
const selected = model.selected;
|
|
11
|
+
if (!selected) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
for (const key of Object.keys(selected)) {
|
|
15
|
+
const layer = model.getLayer(key);
|
|
16
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'StorySegmentLayer') {
|
|
17
|
+
return key;
|
|
11
18
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const StorySegmentResetField = (props) => {
|
|
23
|
+
const ctx = props.formContext;
|
|
24
|
+
return React.createElement(StorySegmentReset, { model: ctx === null || ctx === void 0 ? void 0 : ctx.model, layerId: ctx === null || ctx === void 0 ? void 0 : ctx.layerId });
|
|
25
|
+
};
|
|
26
|
+
export function StorySegmentLayerPropertiesForm(props) {
|
|
27
|
+
const { schema: schemaProp, sourceData, syncData, model, filePath, formContext, sourceType, dialogOptions, formErrorSignal, formSchemaRegistry, } = props;
|
|
28
|
+
const { formData, schema, formContextValue: baseFormContext, hasSchema, handleChangeBase, handleSubmitBase, } = useSchemaFormState({
|
|
29
|
+
sourceData,
|
|
30
|
+
schemaProp,
|
|
31
|
+
model,
|
|
32
|
+
syncData,
|
|
33
|
+
cancel: props.cancel,
|
|
34
|
+
onAfterChange: dialogOptions
|
|
35
|
+
? (data) => {
|
|
36
|
+
dialogOptions.layerData = Object.assign({}, data);
|
|
21
37
|
}
|
|
38
|
+
: undefined,
|
|
39
|
+
});
|
|
40
|
+
const layerId = useMemo(() => getFirstSelectedStorySegmentLayerId(model), [model, model.selected]);
|
|
41
|
+
const formContextValue = useMemo(() => (Object.assign(Object.assign({}, baseFormContext), { layerId, formSchemaRegistry })), [baseFormContext, layerId]);
|
|
42
|
+
const uiSchema = useMemo(() => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const builtUiSchema = {};
|
|
45
|
+
const dataCopy = deepCopy(formData);
|
|
46
|
+
processBaseSchema(dataCopy, schema, builtUiSchema, formContext, removeFormEntry);
|
|
47
|
+
if ((_a = schema.properties) === null || _a === void 0 ? void 0 : _a.source) {
|
|
48
|
+
const availableSources = model.getSourcesByType(sourceType);
|
|
49
|
+
schema.properties.source.enumNames =
|
|
50
|
+
Object.values(availableSources);
|
|
51
|
+
schema.properties.source.enum = Object.keys(availableSources);
|
|
52
|
+
}
|
|
53
|
+
removeFormEntry('zoom', dataCopy, schema, builtUiSchema);
|
|
54
|
+
const layerOverrideItems = (_b = schema.properties) === null || _b === void 0 ? void 0 : _b.layerOverride;
|
|
55
|
+
const itemsProps = layerOverrideItems === null || layerOverrideItems === void 0 ? void 0 : layerOverrideItems.items;
|
|
56
|
+
const itemsProperties = itemsProps === null || itemsProps === void 0 ? void 0 : itemsProps.properties;
|
|
57
|
+
if (itemsProperties) {
|
|
58
|
+
delete itemsProperties.color;
|
|
59
|
+
delete itemsProperties.symbologyState;
|
|
22
60
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
61
|
+
if (model.selected) {
|
|
62
|
+
builtUiSchema.extent = {
|
|
63
|
+
'ui:field': 'storySegmentReset',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
builtUiSchema.content = Object.assign(Object.assign({}, builtUiSchema.content), { markdown: {
|
|
27
67
|
'ui:widget': 'textarea',
|
|
28
68
|
'ui:options': {
|
|
29
69
|
rows: 10,
|
|
30
70
|
},
|
|
31
71
|
} });
|
|
32
|
-
|
|
72
|
+
builtUiSchema.layerOverride = Object.assign(Object.assign({}, builtUiSchema.layerOverride), { items: {
|
|
33
73
|
'ui:title': '',
|
|
34
74
|
targetLayer: {
|
|
35
75
|
'ui:field': 'layerSelect',
|
|
@@ -37,15 +77,19 @@ export class StorySegmentLayerPropertiesForm extends LayerPropertiesForm {
|
|
|
37
77
|
opacity: {
|
|
38
78
|
'ui:field': 'opacity',
|
|
39
79
|
},
|
|
80
|
+
sourceProperties: {
|
|
81
|
+
'ui:field': SourcePropertiesField,
|
|
82
|
+
},
|
|
40
83
|
}, 'ui:options': {
|
|
41
84
|
orderable: false,
|
|
42
85
|
}, 'ui:ArrayFieldTemplate': ArrayFieldTemplate });
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
86
|
+
return builtUiSchema;
|
|
87
|
+
}, [schema, formData, formContext, model, sourceType]);
|
|
88
|
+
const additionalFields = useMemo(() => ({
|
|
89
|
+
storySegmentReset: StorySegmentResetField,
|
|
90
|
+
}), []);
|
|
91
|
+
if (!hasSchema) {
|
|
92
|
+
return null;
|
|
50
93
|
}
|
|
94
|
+
return (React.createElement(SchemaForm, { schema: schema, formData: formData, onChange: handleChangeBase, onSubmit: handleSubmitBase, formContext: formContextValue, filePath: filePath, uiSchema: uiSchema, additionalFields: additionalFields, formErrorSignal: formErrorSignal }));
|
|
51
95
|
}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The form to modify a vector layer.
|
|
6
|
-
*/
|
|
7
|
-
export declare class VectorLayerPropertiesForm extends LayerPropertiesForm {
|
|
8
|
-
protected currentFormData: IVectorLayer;
|
|
9
|
-
private currentSourceId;
|
|
10
|
-
constructor(props: ILayerProps);
|
|
11
|
-
protected onFormSubmit(e: ISubmitEvent<any>): void;
|
|
12
|
-
protected onFormChange(e: IChangeEvent): void;
|
|
13
|
-
protected processSchema(data: IVectorLayer | undefined, schema: IDict, uiSchema: IDict): void;
|
|
14
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ILayerProps } from './layerform';
|
|
3
|
+
export declare function VectorLayerPropertiesForm(props: ILayerProps): React.ReactElement | null;
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { deepCopy } from "../../../tools";
|
|
3
|
+
import { SchemaForm } from '../SchemaForm';
|
|
4
|
+
import { processBaseSchema, removeFormEntry } from '../schemaUtils';
|
|
5
|
+
import { useSchemaFormState } from '../useSchemaFormState';
|
|
6
|
+
export function VectorLayerPropertiesForm(props) {
|
|
7
|
+
const { schema: schemaProp, sourceData, syncData, model, filePath, formContext, sourceType, dialogOptions, formErrorSignal, } = props;
|
|
8
|
+
const { formData, schema, formContextValue, hasSchema, handleChangeBase, handleSubmitBase, } = useSchemaFormState({
|
|
9
|
+
sourceData,
|
|
10
|
+
schemaProp,
|
|
11
|
+
model,
|
|
12
|
+
syncData,
|
|
13
|
+
cancel: props.cancel,
|
|
14
|
+
onAfterChange: dialogOptions
|
|
15
|
+
? (data) => {
|
|
16
|
+
dialogOptions.layerData = Object.assign({}, data);
|
|
17
|
+
}
|
|
18
|
+
: undefined,
|
|
19
|
+
});
|
|
20
|
+
const uiSchema = useMemo(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
const builtUiSchema = {};
|
|
23
|
+
const dataCopy = deepCopy(formData);
|
|
24
|
+
removeFormEntry('color', formData, schema, builtUiSchema);
|
|
25
|
+
removeFormEntry('symbologyState', formData, schema, builtUiSchema);
|
|
26
|
+
processBaseSchema(dataCopy, schema, builtUiSchema, formContext, removeFormEntry);
|
|
27
|
+
if ((_a = schema.properties) === null || _a === void 0 ? void 0 : _a.source) {
|
|
28
|
+
const availableSources = model.getSourcesByType(sourceType);
|
|
29
|
+
schema.properties.source.enumNames =
|
|
30
|
+
Object.values(availableSources);
|
|
31
|
+
schema.properties.source.enum = Object.keys(availableSources);
|
|
30
32
|
}
|
|
33
|
+
return builtUiSchema;
|
|
34
|
+
}, [schema, formData, formContext, model, sourceType]);
|
|
35
|
+
if (!hasSchema) {
|
|
36
|
+
return null;
|
|
31
37
|
}
|
|
38
|
+
return (React.createElement(SchemaForm, { schema: schema, formData: formData, onChange: handleChangeBase, onSubmit: handleSubmitBase, formContext: formContextValue, filePath: filePath, uiSchema: uiSchema, formErrorSignal: formErrorSignal }));
|
|
32
39
|
}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The form to modify a hillshade layer.
|
|
6
|
-
*/
|
|
7
|
-
export declare class WebGlLayerPropertiesForm extends LayerPropertiesForm {
|
|
8
|
-
protected onFormSubmit(e: ISubmitEvent<any>): void;
|
|
9
|
-
protected processSchema(data: IDict<any> | undefined, schema: IDict, uiSchema: IDict): void;
|
|
10
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ILayerProps } from './layerform';
|
|
3
|
+
export declare function WebGlLayerPropertiesForm(props: ILayerProps): React.ReactElement | null;
|
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { deepCopy } from "../../../tools";
|
|
3
|
+
import { SchemaForm } from '../SchemaForm';
|
|
4
|
+
import { processBaseSchema, removeFormEntry } from '../schemaUtils';
|
|
5
|
+
import { useSchemaFormState } from '../useSchemaFormState';
|
|
6
|
+
export function WebGlLayerPropertiesForm(props) {
|
|
7
|
+
const { schema: schemaProp, sourceData, syncData, model, filePath, formContext, sourceType, dialogOptions, formErrorSignal, } = props;
|
|
8
|
+
const { formData, schema, formContextValue, hasSchema, handleChangeBase, handleSubmitBase, } = useSchemaFormState({
|
|
9
|
+
sourceData,
|
|
10
|
+
schemaProp,
|
|
11
|
+
model,
|
|
12
|
+
syncData,
|
|
13
|
+
cancel: props.cancel,
|
|
14
|
+
onAfterChange: dialogOptions
|
|
15
|
+
? (data) => {
|
|
16
|
+
dialogOptions.layerData = Object.assign({}, data);
|
|
17
|
+
}
|
|
18
|
+
: undefined,
|
|
19
|
+
});
|
|
20
|
+
const uiSchema = useMemo(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
const builtUiSchema = {};
|
|
23
|
+
const dataCopy = deepCopy(formData);
|
|
24
|
+
removeFormEntry('color', formData, schema, builtUiSchema);
|
|
25
|
+
removeFormEntry('symbologyState', formData, schema, builtUiSchema);
|
|
26
|
+
processBaseSchema(dataCopy, schema, builtUiSchema, formContext, removeFormEntry);
|
|
27
|
+
if ((_a = schema.properties) === null || _a === void 0 ? void 0 : _a.source) {
|
|
28
|
+
const availableSources = model.getSourcesByType(sourceType);
|
|
29
|
+
schema.properties.source.enumNames =
|
|
30
|
+
Object.values(availableSources);
|
|
31
|
+
schema.properties.source.enum = Object.keys(availableSources);
|
|
32
|
+
}
|
|
33
|
+
return builtUiSchema;
|
|
34
|
+
}, [schema, formData, formContext, model, sourceType]);
|
|
35
|
+
if (!hasSchema) {
|
|
36
|
+
return null;
|
|
14
37
|
}
|
|
38
|
+
return (React.createElement(SchemaForm, { schema: schema, formData: formData, onChange: handleChangeBase, onSubmit: handleSubmitBase, formContext: formContextValue, filePath: filePath, uiSchema: uiSchema, formErrorSignal: formErrorSignal }));
|
|
15
39
|
}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
cancelButton: (() => void) | boolean;
|
|
9
|
-
syncData: (props: IDict) => void;
|
|
1
|
+
import { IJupyterGISModel } from '@jupytergis/schema';
|
|
2
|
+
import { Dialog } from '@jupyterlab/apputils';
|
|
3
|
+
import { Signal } from '@lumino/signaling';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { IBaseFormProps } from "../../../types";
|
|
6
|
+
export interface IDissolveFormProps extends IBaseFormProps {
|
|
7
|
+
ok?: Signal<Dialog<any>, number>;
|
|
10
8
|
model: IJupyterGISModel;
|
|
11
9
|
}
|
|
12
|
-
export declare
|
|
13
|
-
private model;
|
|
14
|
-
private features;
|
|
15
|
-
constructor(options: IDissolveFormOptions);
|
|
16
|
-
private fetchFieldNames;
|
|
17
|
-
handleFormChange(e: IChangeEvent): void;
|
|
18
|
-
private updateSchema;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
10
|
+
export declare function DissolveForm(props: IDissolveFormProps): React.ReactElement | null;
|