@jupytergis/base 0.13.3 → 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 +523 -117
- package/lib/commands/operationCommands.d.ts +22 -0
- package/lib/commands/operationCommands.js +305 -0
- package/lib/constants.js +9 -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 +62 -35
- 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/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,231 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { FormComponent } from '@jupyterlab/ui-components';
|
|
13
|
-
import validatorAjv8 from '@rjsf/validator-ajv8';
|
|
14
|
-
import * as React from 'react';
|
|
15
|
-
import { deepCopy } from "../../tools";
|
|
16
|
-
import { LayerSelect } from './components/LayerSelect';
|
|
17
|
-
import OpacitySlider from './components/OpacitySlider';
|
|
18
|
-
const WrappedFormComponent = props => {
|
|
19
|
-
const rest = __rest(props, []);
|
|
20
|
-
const fields = {
|
|
21
|
-
opacity: OpacitySlider,
|
|
22
|
-
layerSelect: LayerSelect,
|
|
23
|
-
};
|
|
24
|
-
return (React.createElement(FormComponent, Object.assign({}, rest, { validator: validatorAjv8, fields: Object.assign({}, fields) })));
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Generate a form to edit a layer/source type. This class is meant to be sub-classed to create more refined forms for specific layers/sources.
|
|
28
|
-
*
|
|
29
|
-
* It will be up to the user of this class to actually perform the creation/edit using syncdata.
|
|
30
|
-
*/
|
|
31
|
-
export class BaseForm extends React.Component {
|
|
32
|
-
constructor(props) {
|
|
33
|
-
var _a;
|
|
34
|
-
super(props);
|
|
35
|
-
/** Skip syncData for the initial onChange (RJSF populating form), only sync on user edits. */
|
|
36
|
-
this.isInitialLoadRef = true;
|
|
37
|
-
this.currentFormData = deepCopy(this.props.sourceData);
|
|
38
|
-
if (props.schema) {
|
|
39
|
-
const applied = this.applySchemaDefaults(this.currentFormData, props.schema);
|
|
40
|
-
if (applied) {
|
|
41
|
-
props.syncData((_a = this.currentFormData) !== null && _a !== void 0 ? _a : {});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
this.state = {
|
|
45
|
-
schema: props.schema,
|
|
46
|
-
extraErrors: {},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
componentDidUpdate(prevProps, prevState) {
|
|
50
|
-
if (prevProps.sourceData !== this.props.sourceData) {
|
|
51
|
-
this.currentFormData = deepCopy(this.props.sourceData);
|
|
52
|
-
// if (this.props.schema) {
|
|
53
|
-
// const applied = this.applySchemaDefaults(
|
|
54
|
-
// this.currentFormData,
|
|
55
|
-
// this.props.schema as RJSFSchema,
|
|
56
|
-
// );
|
|
57
|
-
// if (applied) {
|
|
58
|
-
// this.props.syncData(this.currentFormData ?? {});
|
|
59
|
-
// }
|
|
60
|
-
const schema = deepCopy(this.props.schema);
|
|
61
|
-
this.setState(old => (Object.assign(Object.assign({}, old), { schema })));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
componentDidMount() {
|
|
65
|
-
if (this.props.formErrorSignal) {
|
|
66
|
-
const extraErrors = Object.keys(Object.assign({}, this.state.extraErrors)).length > 0;
|
|
67
|
-
this.setState(old => (Object.assign(Object.assign({}, old), this.state.extraErrors)));
|
|
68
|
-
this.props.formErrorSignal.emit(extraErrors);
|
|
69
|
-
}
|
|
70
|
-
this.isInitialLoadRef = false;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Fills null/undefined values in data with schema defaults (mutates data).
|
|
74
|
-
* @returns true if any null/undefined was replaced by a default
|
|
75
|
-
*/
|
|
76
|
-
applySchemaDefaults(data, schema) {
|
|
77
|
-
if (!data || !schema.properties) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
let applied = false;
|
|
81
|
-
const props = schema.properties;
|
|
82
|
-
for (const [key, propSchema] of Object.entries(props)) {
|
|
83
|
-
if (propSchema === null ||
|
|
84
|
-
propSchema === undefined ||
|
|
85
|
-
typeof propSchema !== 'object') {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
const val = data[key];
|
|
89
|
-
if (val === null || val === undefined) {
|
|
90
|
-
if ('default' in propSchema &&
|
|
91
|
-
propSchema.default !== undefined) {
|
|
92
|
-
data[key] = deepCopy(propSchema.default);
|
|
93
|
-
applied = true;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else if (propSchema.type === 'object' &&
|
|
97
|
-
typeof val === 'object' &&
|
|
98
|
-
val !== null &&
|
|
99
|
-
!Array.isArray(val) &&
|
|
100
|
-
propSchema.properties) {
|
|
101
|
-
if (this.applySchemaDefaults(val, propSchema)) {
|
|
102
|
-
applied = true;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return applied;
|
|
107
|
-
}
|
|
108
|
-
processSchema(data, schema, uiSchema) {
|
|
109
|
-
if (!schema['properties']) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
Object.entries(schema['properties']).forEach(([k, v]) => {
|
|
113
|
-
uiSchema[k] = {};
|
|
114
|
-
if (v['type'] === 'array') {
|
|
115
|
-
// Remove array buttons
|
|
116
|
-
uiSchema[k] = Object.assign({ 'ui:options': {
|
|
117
|
-
orderable: false,
|
|
118
|
-
removable: false,
|
|
119
|
-
addable: false,
|
|
120
|
-
} }, uiSchema[k]);
|
|
121
|
-
if (v['items']['type'] === 'array') {
|
|
122
|
-
uiSchema[k] = Object.assign({ items: Object.assign({ 'ui:options': {
|
|
123
|
-
orderable: false,
|
|
124
|
-
removable: false,
|
|
125
|
-
addable: false,
|
|
126
|
-
} }, uiSchema[k]['items']) }, uiSchema[k]);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (v['type'] === 'object') {
|
|
130
|
-
this.processSchema(data, v, uiSchema[k]);
|
|
131
|
-
}
|
|
132
|
-
if (k === 'opacity') {
|
|
133
|
-
uiSchema[k] = {
|
|
134
|
-
'ui:field': 'opacity',
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
// Don't show readOnly properties when it's a form for updating an object
|
|
138
|
-
if (v['readOnly']) {
|
|
139
|
-
if (this.props.formContext === 'create') {
|
|
140
|
-
delete v['readOnly'];
|
|
141
|
-
}
|
|
142
|
-
if (this.props.formContext === 'update') {
|
|
143
|
-
this.removeFormEntry(k, data, schema, uiSchema);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Remove a specific entry from the form. Can be used in subclasses if needed while under processSchema.
|
|
150
|
-
* @param entry The entry name
|
|
151
|
-
* @param data The form data
|
|
152
|
-
* @param schema The form schema
|
|
153
|
-
* @param uiSchema The form uiSchema
|
|
154
|
-
*/
|
|
155
|
-
removeFormEntry(entry, data, schema, uiSchema) {
|
|
156
|
-
if (data) {
|
|
157
|
-
delete data[entry];
|
|
158
|
-
}
|
|
159
|
-
if (schema.properties) {
|
|
160
|
-
delete schema.properties[entry];
|
|
161
|
-
}
|
|
162
|
-
delete uiSchema[entry];
|
|
163
|
-
if (schema.required && schema.required.includes(entry)) {
|
|
164
|
-
schema.required.splice(schema.required.indexOf(entry), 1);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
syncData(properties) {
|
|
168
|
-
if (!properties) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
this.props.syncData(properties);
|
|
172
|
-
}
|
|
173
|
-
onFormChange(e) {
|
|
174
|
-
this.currentFormData = e.formData;
|
|
175
|
-
if (this.props.formChangedSignal) {
|
|
176
|
-
this.props.formChangedSignal.emit(this.currentFormData || {});
|
|
177
|
-
}
|
|
178
|
-
if (this.props.formErrorSignal) {
|
|
179
|
-
const extraErrors = Object.keys(this.state.extraErrors).length > 0;
|
|
180
|
-
this.props.formErrorSignal.emit(extraErrors);
|
|
181
|
-
}
|
|
182
|
-
if (this.props.formContext === 'update') {
|
|
183
|
-
if (!this.isInitialLoadRef) {
|
|
184
|
-
this.syncData(this.currentFormData);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
this.isInitialLoadRef = false;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
onFormBlur(id, value) {
|
|
192
|
-
// This is a no-op here
|
|
193
|
-
}
|
|
194
|
-
onFormSubmit(e) {
|
|
195
|
-
this.currentFormData = e.formData;
|
|
196
|
-
this.syncData(this.currentFormData);
|
|
197
|
-
this.props.cancel && this.props.cancel();
|
|
198
|
-
}
|
|
199
|
-
render() {
|
|
200
|
-
var _a, _b;
|
|
201
|
-
if (this.props.schema) {
|
|
202
|
-
const schema = Object.assign(Object.assign({}, this.state.schema), { additionalProperties: true });
|
|
203
|
-
const formData = this.currentFormData;
|
|
204
|
-
const uiSchema = {
|
|
205
|
-
additionalProperties: {
|
|
206
|
-
'ui:label': false,
|
|
207
|
-
classNames: 'jGIS-hidden-field',
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
this.processSchema(formData, schema, uiSchema);
|
|
211
|
-
const submitRef = React.createRef();
|
|
212
|
-
// When the parent "ok" button gets clicked, submit
|
|
213
|
-
(_a = this.props.ok) === null || _a === void 0 ? void 0 : _a.connect(() => {
|
|
214
|
-
var _a;
|
|
215
|
-
(_a = submitRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
216
|
-
});
|
|
217
|
-
return (React.createElement("div", { className: "jGIS-property-panel", "data-path": (_b = this.props.filePath) !== null && _b !== void 0 ? _b : '' },
|
|
218
|
-
React.createElement("div", { className: "jGIS-property-outer", onKeyUp: (e) => {
|
|
219
|
-
var _a;
|
|
220
|
-
if (e.key === 'Enter') {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
(_a = submitRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
223
|
-
}
|
|
224
|
-
} },
|
|
225
|
-
React.createElement(WrappedFormComponent, { schema: schema, uiSchema: uiSchema, formData: formData, formContext: {
|
|
226
|
-
model: this.props.model,
|
|
227
|
-
formData,
|
|
228
|
-
}, onSubmit: this.onFormSubmit.bind(this), onChange: this.onFormChange.bind(this), onBlur: this.onFormBlur.bind(this), ok: this.props.ok, cancel: this.props.cancel, liveValidate: true, children: React.createElement("button", { ref: submitRef, type: "submit", style: { display: 'none' } }), extraErrors: this.state.extraErrors }))));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
/package/lib/panelview/story-maps/{PreviewModeSwitch.d.ts → components/PreviewModeSwitch.d.ts}
RENAMED
|
File without changes
|