@jupyterlab/settingeditor 4.0.0-alpha.1 → 4.0.0-alpha.10
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/SettingsFormEditor.d.ts +114 -0
- package/lib/SettingsFormEditor.js +261 -0
- package/lib/SettingsFormEditor.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/inspector.js +23 -29
- package/lib/inspector.js.map +1 -1
- package/lib/{settingeditor.d.ts → jsonsettingeditor.d.ts} +5 -6
- package/lib/{settingeditor.js → jsonsettingeditor.js} +25 -43
- package/lib/jsonsettingeditor.js.map +1 -0
- package/lib/plugineditor.d.ts +3 -3
- package/lib/plugineditor.js +2 -6
- package/lib/plugineditor.js.map +1 -1
- package/lib/pluginlist.d.ts +58 -22
- package/lib/pluginlist.js +246 -109
- package/lib/pluginlist.js.map +1 -1
- package/lib/raweditor.d.ts +1 -1
- package/lib/raweditor.js +1 -2
- package/lib/raweditor.js.map +1 -1
- package/lib/settingseditor.d.ts +81 -0
- package/lib/settingseditor.js +117 -0
- package/lib/settingseditor.js.map +1 -0
- package/lib/settingspanel.d.ts +54 -0
- package/lib/settingspanel.js +90 -0
- package/lib/settingspanel.js.map +1 -0
- package/lib/tokens.d.ts +12 -2
- package/lib/tokens.js +4 -1
- package/lib/tokens.js.map +1 -1
- package/package.json +21 -17
- package/style/base.css +407 -85
- package/style/index.css +1 -0
- package/style/index.js +1 -0
- package/lib/settingeditor.js.map +0 -1
- package/lib/splitpanel.d.ts +0 -13
- package/lib/splitpanel.js +0 -26
- package/lib/splitpanel.js.map +0 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ISettingRegistry, Settings } from '@jupyterlab/settingregistry';
|
|
2
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
3
|
+
import { ArrayFieldTemplateProps, Field, ObjectFieldTemplateProps, UiSchema } from '@rjsf/core';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { PluginList } from './pluginlist';
|
|
6
|
+
/**
|
|
7
|
+
* Namespace for a React component that prepares the settings for a
|
|
8
|
+
* given plugin to be rendered in the FormEditor.
|
|
9
|
+
*/
|
|
10
|
+
export declare namespace SettingsFormEditor {
|
|
11
|
+
/**
|
|
12
|
+
* Props passed to the SettingsFormEditor component
|
|
13
|
+
*/
|
|
14
|
+
interface IProps {
|
|
15
|
+
/**
|
|
16
|
+
* Settings object with schema and user defined values.
|
|
17
|
+
*/
|
|
18
|
+
settings: Settings;
|
|
19
|
+
/**
|
|
20
|
+
* Dictionary used for custom field renderers in the form.
|
|
21
|
+
*/
|
|
22
|
+
renderers: {
|
|
23
|
+
[id: string]: Field;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Whether the form is collapsed or not.
|
|
27
|
+
*/
|
|
28
|
+
isCollapsed: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Callback with the collapse state value.
|
|
31
|
+
*/
|
|
32
|
+
onCollapseChange: (v: boolean) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Translator object
|
|
35
|
+
*/
|
|
36
|
+
translator: ITranslator;
|
|
37
|
+
/**
|
|
38
|
+
* Callback to update the plugin list when a validation error occurs.
|
|
39
|
+
*/
|
|
40
|
+
hasError: (error: boolean) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Handler for when selection change is triggered by scrolling
|
|
43
|
+
* in the SettingsPanel.
|
|
44
|
+
*/
|
|
45
|
+
onSelect: (id: string) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Sends whether this editor has unsaved changes to the parent class.
|
|
48
|
+
*/
|
|
49
|
+
updateDirtyState: (dirty: boolean) => void;
|
|
50
|
+
/**
|
|
51
|
+
* List of strings that match search value.
|
|
52
|
+
*/
|
|
53
|
+
filteredValues: string[] | null;
|
|
54
|
+
}
|
|
55
|
+
interface IState {
|
|
56
|
+
/**
|
|
57
|
+
* Indicates whether the settings have been modified. Used for hiding
|
|
58
|
+
* the "Restore to Default" button when there are no changes.
|
|
59
|
+
*/
|
|
60
|
+
isModified: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Form UI schema
|
|
63
|
+
*/
|
|
64
|
+
uiSchema: UiSchema;
|
|
65
|
+
/**
|
|
66
|
+
* Filtered schema
|
|
67
|
+
*/
|
|
68
|
+
filteredSchema: ISettingRegistry.ISchema;
|
|
69
|
+
/**
|
|
70
|
+
* Array Field template
|
|
71
|
+
*/
|
|
72
|
+
arrayFieldTemplate?: React.StatelessComponent<ArrayFieldTemplateProps<any>>;
|
|
73
|
+
/**
|
|
74
|
+
* Object Field template
|
|
75
|
+
*/
|
|
76
|
+
objectFieldTemplate?: React.StatelessComponent<ObjectFieldTemplateProps<any>>;
|
|
77
|
+
/**
|
|
78
|
+
* Form context
|
|
79
|
+
*/
|
|
80
|
+
formContext?: any;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A React component that prepares the settings for a
|
|
85
|
+
* given plugin to be rendered in the FormEditor.
|
|
86
|
+
*/
|
|
87
|
+
export declare class SettingsFormEditor extends React.Component<SettingsFormEditor.IProps, SettingsFormEditor.IState> {
|
|
88
|
+
constructor(props: SettingsFormEditor.IProps);
|
|
89
|
+
componentDidMount(): void;
|
|
90
|
+
componentDidUpdate(prevProps: SettingsFormEditor.IProps): void;
|
|
91
|
+
/**
|
|
92
|
+
* Handler for edits made in the form editor.
|
|
93
|
+
* @param data - Form data sent from the form editor
|
|
94
|
+
*/
|
|
95
|
+
handleChange(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Handler for the "Restore to defaults" button - clears all
|
|
98
|
+
* modified settings then calls `setFormData` to restore the
|
|
99
|
+
* values.
|
|
100
|
+
*/
|
|
101
|
+
reset: (event: React.MouseEvent) => Promise<void>;
|
|
102
|
+
render(): JSX.Element;
|
|
103
|
+
/**
|
|
104
|
+
* Callback on plugin selection
|
|
105
|
+
* @param list Plugin list
|
|
106
|
+
* @param id Plugin id
|
|
107
|
+
*/
|
|
108
|
+
protected onSelect: (list: PluginList, id: string) => void;
|
|
109
|
+
private _onChange;
|
|
110
|
+
private _setUiSchema;
|
|
111
|
+
private _setFilteredSchema;
|
|
112
|
+
private _debouncer;
|
|
113
|
+
private _formData;
|
|
114
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
import { showErrorMessage } from '@jupyterlab/apputils';
|
|
6
|
+
import { caretDownIcon, caretRightIcon } from '@jupyterlab/ui-components';
|
|
7
|
+
import { reduce } from '@lumino/algorithm';
|
|
8
|
+
import { JSONExt } from '@lumino/coreutils';
|
|
9
|
+
import { Debouncer } from '@lumino/polling';
|
|
10
|
+
import Form, { utils } from '@rjsf/core';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* Indentation to use when saving the settings as JSON document.
|
|
14
|
+
*/
|
|
15
|
+
const JSON_INDENTATION = 4;
|
|
16
|
+
/**
|
|
17
|
+
* Template to allow for custom buttons to re-order/remove entries in an array.
|
|
18
|
+
* Necessary to create accessible buttons.
|
|
19
|
+
*/
|
|
20
|
+
const CustomArrayTemplateFactory = (translator) => {
|
|
21
|
+
const trans = translator.load('jupyterlab');
|
|
22
|
+
const factory = (props) => {
|
|
23
|
+
var _a;
|
|
24
|
+
return (React.createElement("div", { className: props.className },
|
|
25
|
+
React.createElement(props.TitleField, { title: props.title, required: props.required, id: `${props.idSchema.$id}-title` }),
|
|
26
|
+
React.createElement(props.DescriptionField, { id: `${props.idSchema.$id}-description`, description: (_a = props.schema.description) !== null && _a !== void 0 ? _a : '' }),
|
|
27
|
+
props.items.map(item => {
|
|
28
|
+
return (React.createElement("div", { key: item.key, className: item.className },
|
|
29
|
+
item.children,
|
|
30
|
+
React.createElement("div", { className: "jp-ArrayOperations" },
|
|
31
|
+
React.createElement("button", { className: "jp-mod-styled jp-mod-reject", onClick: item.onReorderClick(item.index, item.index - 1), disabled: !item.hasMoveUp }, trans.__('Move Up')),
|
|
32
|
+
React.createElement("button", { className: "jp-mod-styled jp-mod-reject", onClick: item.onReorderClick(item.index, item.index + 1), disabled: !item.hasMoveDown }, trans.__('Move Down')),
|
|
33
|
+
React.createElement("button", { className: "jp-mod-styled jp-mod-warn", onClick: item.onDropIndexClick(item.index), disabled: !item.hasRemove }, trans.__('Remove')))));
|
|
34
|
+
}),
|
|
35
|
+
props.canAdd && (React.createElement("button", { className: "jp-mod-styled jp-mod-reject", onClick: props.onAddClick }, trans.__('Add')))));
|
|
36
|
+
};
|
|
37
|
+
factory.displayName = 'CustomArrayTemplate';
|
|
38
|
+
return factory;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Template with custom add button, necessary for accessiblity and internationalization.
|
|
42
|
+
*/
|
|
43
|
+
const CustomObjectTemplateFactory = (translator) => {
|
|
44
|
+
const trans = translator.load('jupyterlab');
|
|
45
|
+
const factory = (props) => {
|
|
46
|
+
const { TitleField, DescriptionField } = props;
|
|
47
|
+
return (React.createElement("fieldset", { id: props.idSchema.$id },
|
|
48
|
+
(props.uiSchema['ui:title'] || props.title) && (React.createElement(TitleField, { id: `${props.idSchema.$id}__title`, title: props.title || props.uiSchema['ui:title'], required: props.required })),
|
|
49
|
+
props.description && (React.createElement(DescriptionField, { id: `${props.idSchema.$id}__description`, description: props.description })),
|
|
50
|
+
props.properties.map(property => property.content),
|
|
51
|
+
utils.canExpand(props.schema, props.uiSchema, props.formData) && (React.createElement("button", { className: "jp-mod-styled jp-mod-reject", onClick: props.onAddClick(props.schema), disabled: props.disabled || props.readonly }, trans.__('Add')))));
|
|
52
|
+
};
|
|
53
|
+
factory.displayName = 'CustomObjectTemplate';
|
|
54
|
+
return factory;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Renders the modified indicator and errors
|
|
58
|
+
*/
|
|
59
|
+
const CustomTemplate = (props) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const { formData, schema, label, displayLabel, id, formContext, errors, rawErrors, children, onKeyChange, onDropPropertyClick } = props;
|
|
62
|
+
/**
|
|
63
|
+
* Determine if the field has been modified
|
|
64
|
+
* Schema Id is formatted as 'root_<field name>.<nexted field name>'
|
|
65
|
+
* This logic parses out the field name to find the default value
|
|
66
|
+
* before determining if the field has been modified.
|
|
67
|
+
*/
|
|
68
|
+
const schemaIds = id.split('_');
|
|
69
|
+
schemaIds.shift();
|
|
70
|
+
const schemaId = schemaIds.join('.');
|
|
71
|
+
let defaultValue;
|
|
72
|
+
if (schemaIds.length === 1) {
|
|
73
|
+
defaultValue = formContext.settings.default(schemaId);
|
|
74
|
+
}
|
|
75
|
+
else if (schemaIds.length > 1) {
|
|
76
|
+
const allDefaultsForObject = {};
|
|
77
|
+
allDefaultsForObject[schemaIds[0]] = formContext.settings.default(schemaIds[0]);
|
|
78
|
+
defaultValue = reduce(schemaIds, (acc, val, i) => {
|
|
79
|
+
return acc === null || acc === void 0 ? void 0 : acc[val];
|
|
80
|
+
}, allDefaultsForObject);
|
|
81
|
+
}
|
|
82
|
+
const isModified = schemaId !== '' &&
|
|
83
|
+
formData !== undefined &&
|
|
84
|
+
defaultValue !== undefined &&
|
|
85
|
+
!schema.properties &&
|
|
86
|
+
schema.type !== 'array' &&
|
|
87
|
+
!JSONExt.deepEqual(formData, defaultValue);
|
|
88
|
+
const isRoot = schemaId === '';
|
|
89
|
+
const needsDescription = !isRoot &&
|
|
90
|
+
schema.type != 'object' &&
|
|
91
|
+
id !=
|
|
92
|
+
'jp-SettingsEditor-@jupyterlab/shortcuts-extension:shortcuts_shortcuts';
|
|
93
|
+
// While we can implement "remove" button for array items in array template,
|
|
94
|
+
// object templates do not provide a way to do this; instead we need to add
|
|
95
|
+
// buttons here (and first check if the field can be removed = is additional).
|
|
96
|
+
const isAdditional = schema.hasOwnProperty(utils.ADDITIONAL_PROPERTY_FLAG);
|
|
97
|
+
return (React.createElement("div", { className: `form-group ${displayLabel || schema.type === 'boolean' ? 'small-field' : ''}` },
|
|
98
|
+
// Only show the modified indicator if there are no errors
|
|
99
|
+
isModified && !rawErrors && React.createElement("div", { className: "jp-modifiedIndicator" }),
|
|
100
|
+
// Shows a red indicator for fields that have validation errors
|
|
101
|
+
rawErrors && React.createElement("div", { className: "jp-modifiedIndicator jp-errorIndicator" }),
|
|
102
|
+
React.createElement("div", { className: "jp-FormGroup-content" },
|
|
103
|
+
displayLabel && !isRoot && label && !isAdditional && (React.createElement("h3", { className: "jp-FormGroup-fieldLabel jp-FormGroup-contentItem" }, label)),
|
|
104
|
+
isAdditional && (React.createElement("input", { className: "jp-FormGroup-contentItem jp-mod-styled", type: "text", onBlur: event => onKeyChange(event.target.value), defaultValue: label })),
|
|
105
|
+
React.createElement("div", { className: `${isRoot
|
|
106
|
+
? 'jp-root'
|
|
107
|
+
: schema.type === 'object'
|
|
108
|
+
? 'jp-objectFieldWrapper'
|
|
109
|
+
: 'jp-inputFieldWrapper jp-FormGroup-contentItem'}` }, children),
|
|
110
|
+
isAdditional && (React.createElement("button", { className: "jp-FormGroup-contentItem jp-mod-styled jp-mod-warn jp-FormGroup-removeButton", onClick: onDropPropertyClick(label) }, 'Remove')),
|
|
111
|
+
schema.description && needsDescription && (React.createElement("div", { className: "jp-FormGroup-description" }, schema.description)),
|
|
112
|
+
isModified && schema.default !== undefined && (React.createElement("div", { className: "jp-FormGroup-default" },
|
|
113
|
+
"Default: ", (_a = schema.default) === null || _a === void 0 ? void 0 :
|
|
114
|
+
_a.toLocaleString())),
|
|
115
|
+
React.createElement("div", { className: "validationErrors" }, errors))));
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* A React component that prepares the settings for a
|
|
119
|
+
* given plugin to be rendered in the FormEditor.
|
|
120
|
+
*/
|
|
121
|
+
export class SettingsFormEditor extends React.Component {
|
|
122
|
+
constructor(props) {
|
|
123
|
+
super(props);
|
|
124
|
+
/**
|
|
125
|
+
* Handler for the "Restore to defaults" button - clears all
|
|
126
|
+
* modified settings then calls `setFormData` to restore the
|
|
127
|
+
* values.
|
|
128
|
+
*/
|
|
129
|
+
this.reset = async (event) => {
|
|
130
|
+
event.stopPropagation();
|
|
131
|
+
for (const field in this.props.settings.user) {
|
|
132
|
+
await this.props.settings.remove(field);
|
|
133
|
+
}
|
|
134
|
+
this._formData = this.props.settings.composite;
|
|
135
|
+
this.setState({ isModified: false });
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Callback on plugin selection
|
|
139
|
+
* @param list Plugin list
|
|
140
|
+
* @param id Plugin id
|
|
141
|
+
*/
|
|
142
|
+
this.onSelect = (list, id) => {
|
|
143
|
+
if (id === this.props.settings.id) {
|
|
144
|
+
this.props.onCollapseChange(false);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
this._onChange = (e) => {
|
|
148
|
+
this.props.hasError(e.errors.length !== 0);
|
|
149
|
+
this._formData = e.formData;
|
|
150
|
+
if (e.errors.length === 0) {
|
|
151
|
+
this.props.updateDirtyState(true);
|
|
152
|
+
void this._debouncer.invoke();
|
|
153
|
+
}
|
|
154
|
+
this.props.onSelect(this.props.settings.id);
|
|
155
|
+
};
|
|
156
|
+
const { settings } = props;
|
|
157
|
+
this._formData = settings.composite;
|
|
158
|
+
this.state = {
|
|
159
|
+
isModified: settings.isModified,
|
|
160
|
+
uiSchema: {},
|
|
161
|
+
filteredSchema: this.props.settings.schema,
|
|
162
|
+
arrayFieldTemplate: CustomArrayTemplateFactory(this.props.translator),
|
|
163
|
+
objectFieldTemplate: CustomObjectTemplateFactory(this.props.translator),
|
|
164
|
+
formContext: { settings: this.props.settings }
|
|
165
|
+
};
|
|
166
|
+
this.handleChange = this.handleChange.bind(this);
|
|
167
|
+
this._debouncer = new Debouncer(this.handleChange);
|
|
168
|
+
}
|
|
169
|
+
componentDidMount() {
|
|
170
|
+
this._setUiSchema();
|
|
171
|
+
this._setFilteredSchema();
|
|
172
|
+
}
|
|
173
|
+
componentDidUpdate(prevProps) {
|
|
174
|
+
this._setUiSchema(prevProps.renderers);
|
|
175
|
+
this._setFilteredSchema(prevProps.filteredValues);
|
|
176
|
+
if (prevProps.translator !== this.props.translator) {
|
|
177
|
+
this.setState({
|
|
178
|
+
arrayFieldTemplate: CustomArrayTemplateFactory(this.props.translator),
|
|
179
|
+
objectFieldTemplate: CustomObjectTemplateFactory(this.props.translator)
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (prevProps.settings !== this.props.settings) {
|
|
183
|
+
this.setState({ formContext: { settings: this.props.settings } });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Handler for edits made in the form editor.
|
|
188
|
+
* @param data - Form data sent from the form editor
|
|
189
|
+
*/
|
|
190
|
+
handleChange() {
|
|
191
|
+
// Prevent unnecessary save when opening settings that haven't been modified.
|
|
192
|
+
if (!this.props.settings.isModified &&
|
|
193
|
+
this.props.settings.isDefault(this._formData)) {
|
|
194
|
+
this.props.updateDirtyState(false);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
this.props.settings
|
|
198
|
+
.save(JSON.stringify(this._formData, undefined, JSON_INDENTATION))
|
|
199
|
+
.then(() => {
|
|
200
|
+
this.props.updateDirtyState(false);
|
|
201
|
+
this.setState({ isModified: this.props.settings.isModified });
|
|
202
|
+
})
|
|
203
|
+
.catch((reason) => {
|
|
204
|
+
this.props.updateDirtyState(false);
|
|
205
|
+
const trans = this.props.translator.load('jupyterlab');
|
|
206
|
+
showErrorMessage(trans.__('Error saving settings.'), reason);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
render() {
|
|
210
|
+
const trans = this.props.translator.load('jupyterlab');
|
|
211
|
+
const icon = this.props.isCollapsed ? caretRightIcon : caretDownIcon;
|
|
212
|
+
return (React.createElement("div", null,
|
|
213
|
+
React.createElement("div", { className: "jp-SettingsHeader", onClick: () => {
|
|
214
|
+
this.props.onCollapseChange(!this.props.isCollapsed);
|
|
215
|
+
this.props.onSelect(this.props.settings.id);
|
|
216
|
+
} },
|
|
217
|
+
React.createElement("header", { className: "jp-SettingsTitle" },
|
|
218
|
+
React.createElement(icon.react, { tag: "span", elementPosition: "center", className: "jp-SettingsTitle-caret" }),
|
|
219
|
+
React.createElement("h2", null, this.props.settings.schema.title),
|
|
220
|
+
React.createElement("div", { className: "jp-SettingsHeader-description" }, this.props.settings.schema.description)),
|
|
221
|
+
this.state.isModified && (React.createElement("button", { className: "jp-RestoreButton", onClick: this.reset }, trans.__('Restore to Defaults')))),
|
|
222
|
+
!this.props.isCollapsed && (React.createElement(Form, { schema: this.state.filteredSchema, formData: this._formData, FieldTemplate: CustomTemplate, ArrayFieldTemplate: this.state.arrayFieldTemplate, ObjectFieldTemplate: this.state.objectFieldTemplate, uiSchema: this.state.uiSchema, fields: this.props.renderers, formContext: this.state.formContext, liveValidate: true, idPrefix: `jp-SettingsEditor-${this.props.settings.id}`, onChange: this._onChange }))));
|
|
223
|
+
}
|
|
224
|
+
_setUiSchema(prevRenderers) {
|
|
225
|
+
var _a;
|
|
226
|
+
if (!prevRenderers ||
|
|
227
|
+
!JSONExt.deepEqual(Object.keys(prevRenderers).sort(), Object.keys(this.props.renderers).sort())) {
|
|
228
|
+
/**
|
|
229
|
+
* Construct uiSchema to pass any custom renderers to the form editor.
|
|
230
|
+
*/
|
|
231
|
+
const uiSchema = {};
|
|
232
|
+
for (const id in this.props.renderers) {
|
|
233
|
+
if (Object.keys((_a = this.props.settings.schema.properties) !== null && _a !== void 0 ? _a : {}).includes(id)) {
|
|
234
|
+
uiSchema[id] = {
|
|
235
|
+
'ui:field': id
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
this.setState({ uiSchema });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
_setFilteredSchema(prevFilteredValues) {
|
|
243
|
+
var _a, _b, _c, _d;
|
|
244
|
+
if (prevFilteredValues === undefined ||
|
|
245
|
+
!JSONExt.deepEqual(prevFilteredValues, this.props.filteredValues)) {
|
|
246
|
+
/**
|
|
247
|
+
* Only show fields that match search value.
|
|
248
|
+
*/
|
|
249
|
+
const filteredSchema = JSONExt.deepCopy(this.props.settings.schema);
|
|
250
|
+
if ((_b = (_a = this.props.filteredValues) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 > 0) {
|
|
251
|
+
for (const field in filteredSchema.properties) {
|
|
252
|
+
if (!((_c = this.props.filteredValues) === null || _c === void 0 ? void 0 : _c.includes((_d = filteredSchema.properties[field].title) !== null && _d !== void 0 ? _d : field))) {
|
|
253
|
+
delete filteredSchema.properties[field];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
this.setState({ filteredSchema });
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=SettingsFormEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsFormEditor.js","sourceRoot":"","sources":["../src/SettingsFormEditor.tsx"],"names":[],"mappings":"AAAA;;;+EAG+E;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG1E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAA6B,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,IAAI,EAAE,EAOX,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC;AA8F3B;;;GAGG;AACH,MAAM,0BAA0B,GAAG,CACjC,UAAuB,EACY,EAAE;I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AC;qBACzC;iBACF;aACF;YAED,IAAI,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;SACnC;IACH,CAAC;CAIF"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC"}
|
package/lib/inspector.js
CHANGED
|
@@ -42,9 +42,8 @@ class InspectorConnector extends DataConnector {
|
|
|
42
42
|
constructor(editor, translator) {
|
|
43
43
|
super();
|
|
44
44
|
this._current = 0;
|
|
45
|
-
this.translator = translator || nullTranslator;
|
|
46
45
|
this._editor = editor;
|
|
47
|
-
this._trans =
|
|
46
|
+
this._trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab');
|
|
48
47
|
}
|
|
49
48
|
/**
|
|
50
49
|
* Fetch inspection requests.
|
|
@@ -63,50 +62,45 @@ class InspectorConnector extends DataConnector {
|
|
|
63
62
|
metadata: {}
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
|
-
resolve({ data:
|
|
65
|
+
resolve({ data: this.render(errors), metadata: {} });
|
|
67
66
|
}, 100));
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
|
-
_validate(raw) {
|
|
71
|
-
const editor = this._editor;
|
|
72
|
-
if (!editor.settings) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
const { id, schema, version } = editor.settings;
|
|
76
|
-
const data = { composite: {}, user: {} };
|
|
77
|
-
const validator = editor.registry.validator;
|
|
78
|
-
return validator.validateData({ data, id, raw, schema, version }, false);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A namespace for private module data.
|
|
83
|
-
*/
|
|
84
|
-
var Private;
|
|
85
|
-
(function (Private) {
|
|
86
69
|
/**
|
|
87
70
|
* Render validation errors as an HTML string.
|
|
88
71
|
*/
|
|
89
|
-
|
|
90
|
-
return {
|
|
72
|
+
render(errors) {
|
|
73
|
+
return {
|
|
74
|
+
'text/markdown': errors.map(this.renderError.bind(this)).join('')
|
|
75
|
+
};
|
|
91
76
|
}
|
|
92
|
-
Private.render = render;
|
|
93
77
|
/**
|
|
94
78
|
* Render an individual validation error as a markdown string.
|
|
95
79
|
*/
|
|
96
|
-
|
|
80
|
+
renderError(error) {
|
|
97
81
|
var _a;
|
|
98
82
|
switch (error.keyword) {
|
|
99
83
|
case 'additionalProperties':
|
|
100
|
-
return `**\`[additional property error]\`**
|
|
101
|
-
|
|
84
|
+
return `**\`[${this._trans.__('additional property error')}]\`**
|
|
85
|
+
${this._trans.__('`%1` is not a valid property', (_a = error.params) === null || _a === void 0 ? void 0 : _a.additionalProperty)}`;
|
|
102
86
|
case 'syntax':
|
|
103
|
-
return `**\`[syntax error]\`** *${error.message}*`;
|
|
87
|
+
return `**\`[${this._trans.__('syntax error')}]\`** *${error.message}*`;
|
|
104
88
|
case 'type':
|
|
105
|
-
return `**\`[type error]\`**
|
|
89
|
+
return `**\`[${this._trans.__('type error')}]\`**
|
|
106
90
|
\`${error.dataPath}\` ${error.message}`;
|
|
107
91
|
default:
|
|
108
|
-
return `**\`[error]\`** *${error.message}*`;
|
|
92
|
+
return `**\`[${this._trans.__('error')}]\`** *${error.message}*`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
_validate(raw) {
|
|
96
|
+
const editor = this._editor;
|
|
97
|
+
if (!editor.settings) {
|
|
98
|
+
return null;
|
|
109
99
|
}
|
|
100
|
+
const { id, schema, version } = editor.settings;
|
|
101
|
+
const data = { composite: {}, user: {} };
|
|
102
|
+
const validator = editor.registry.validator;
|
|
103
|
+
return validator.validateData({ data, id, raw, schema, version }, false);
|
|
110
104
|
}
|
|
111
|
-
}
|
|
105
|
+
}
|
|
112
106
|
//# sourceMappingURL=inspector.js.map
|
package/lib/inspector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspector.js","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAE/E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAEL,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAIjC;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAiB,EACjB,UAAgC,EAChC,UAAwB;IAExB,UAAU,GAAG,UAAU,IAAI,cAAc,CAAC;IAC1C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC;QACnC,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAAC;QAC1D,UAAU,EAAE,UAAU;KACvB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC;QACpC,SAAS;QACT,UAAU,EACR,UAAU;YACV,IAAI,kBAAkB,CAAC;gBACrB,gBAAgB,EAAE,yBAAyB;gBAC3C,UAAU,EAAE,UAAU;aACvB,CAAC;KACL,CAAC,CAAC;IAEH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IACvC,SAAS,CAAC,MAAM,GAAG,OAAO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AAI,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;CAKF"}
|
|
@@ -7,15 +7,15 @@ import { CommandRegistry } from '@lumino/commands';
|
|
|
7
7
|
import { JSONObject } from '@lumino/coreutils';
|
|
8
8
|
import { Message } from '@lumino/messaging';
|
|
9
9
|
import { ISignal } from '@lumino/signaling';
|
|
10
|
-
import {
|
|
10
|
+
import { SplitPanel } from '@lumino/widgets';
|
|
11
11
|
/**
|
|
12
12
|
* An interface for modifying and saving application settings.
|
|
13
13
|
*/
|
|
14
|
-
export declare class
|
|
14
|
+
export declare class JsonSettingEditor extends SplitPanel {
|
|
15
15
|
/**
|
|
16
16
|
* Create a new setting editor.
|
|
17
17
|
*/
|
|
18
|
-
constructor(options:
|
|
18
|
+
constructor(options: JsonSettingEditor.IOptions);
|
|
19
19
|
/**
|
|
20
20
|
* The state database key for the editor's state management.
|
|
21
21
|
*/
|
|
@@ -93,15 +93,14 @@ export declare class SettingEditor extends Widget {
|
|
|
93
93
|
private _fetching;
|
|
94
94
|
private _instructions;
|
|
95
95
|
private _list;
|
|
96
|
-
private _panel;
|
|
97
96
|
private _saving;
|
|
98
97
|
private _state;
|
|
99
98
|
private _when;
|
|
100
99
|
}
|
|
101
100
|
/**
|
|
102
|
-
* A namespace for `
|
|
101
|
+
* A namespace for `JsonSettingEditor` statics.
|
|
103
102
|
*/
|
|
104
|
-
export declare namespace
|
|
103
|
+
export declare namespace JsonSettingEditor {
|
|
105
104
|
/**
|
|
106
105
|
* The instantiation options for a setting editor.
|
|
107
106
|
*/
|