@jupyterlab/metadataform 4.0.0-alpha.16 → 4.0.0-alpha.17
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/form.d.ts +22 -0
- package/lib/form.js +38 -0
- package/lib/form.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/metadataform.d.ts +98 -0
- package/lib/metadataform.js +402 -0
- package/lib/metadataform.js.map +1 -0
- package/lib/metadataformProvider.d.ts +8 -0
- package/lib/metadataformProvider.js +26 -0
- package/lib/metadataformProvider.js.map +1 -0
- package/lib/token.d.ts +197 -0
- package/lib/token.js +12 -0
- package/lib/token.js.map +1 -0
- package/package.json +9 -11
package/lib/form.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module metadataform
|
|
4
|
+
*/
|
|
5
|
+
import { ReactWidget } from '@jupyterlab/apputils';
|
|
6
|
+
import { MetadataForm } from './token';
|
|
7
|
+
/**
|
|
8
|
+
* A ReactWidget with the form itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FormWidget extends ReactWidget {
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new FormWidget.
|
|
13
|
+
*/
|
|
14
|
+
constructor(props: MetadataForm.IProps);
|
|
15
|
+
/**
|
|
16
|
+
* Render the form.
|
|
17
|
+
* @returns - The rendered form
|
|
18
|
+
*/
|
|
19
|
+
render(): JSX.Element;
|
|
20
|
+
private _props;
|
|
21
|
+
private _templateFactory;
|
|
22
|
+
}
|
package/lib/form.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
/**
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @module metadataform
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import Form from '@rjsf/core';
|
|
9
|
+
import { ReactWidget } from '@jupyterlab/apputils';
|
|
10
|
+
import { RJSFTemplatesFactory } from '@jupyterlab/ui-components';
|
|
11
|
+
/**
|
|
12
|
+
* A ReactWidget with the form itself.
|
|
13
|
+
*/
|
|
14
|
+
export class FormWidget extends ReactWidget {
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new FormWidget.
|
|
17
|
+
*/
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super();
|
|
20
|
+
this.addClass('jp-FormWidget');
|
|
21
|
+
this._props = props;
|
|
22
|
+
this._templateFactory = new RJSFTemplatesFactory({
|
|
23
|
+
translator: this._props.translator,
|
|
24
|
+
compact: true,
|
|
25
|
+
showModifiedFromDefault: props.showModified
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Render the form.
|
|
30
|
+
* @returns - The rendered form
|
|
31
|
+
*/
|
|
32
|
+
render() {
|
|
33
|
+
return (React.createElement(Form, { schema: this._props.properties, formData: this._props.formData, formContext: this._props, FieldTemplate: this._templateFactory.fieldTemplate, ArrayFieldTemplate: this._templateFactory.arrayTemplate, ObjectFieldTemplate: this._templateFactory.objectTemplate, uiSchema: this._props.uiSchema, liveValidate: true, idPrefix: `jp-MetadataForm-${this._props.pluginId}`, onChange: (e) => {
|
|
34
|
+
this._props.metadataFormWidget.updateMetadata(e.formData);
|
|
35
|
+
} }));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=form.js.map
|
package/lib/form.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../src/form.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAsB,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,C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Modified BSD License.
|
|
3
|
+
/**
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @module metadataform
|
|
6
|
+
*/
|
|
7
|
+
export * from './form';
|
|
8
|
+
export * from './metadataform';
|
|
9
|
+
export * from './metadataformProvider';
|
|
10
|
+
export * from './token';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module metadataform
|
|
4
|
+
*/
|
|
5
|
+
import { NotebookTools } from '@jupyterlab/notebook';
|
|
6
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
7
|
+
import { PartialJSONObject, ReadonlyPartialJSONObject } from '@lumino/coreutils';
|
|
8
|
+
import { Message } from '@lumino/messaging';
|
|
9
|
+
import { Widget } from '@lumino/widgets';
|
|
10
|
+
import { MetadataForm } from './token';
|
|
11
|
+
import { FormWidget } from './form';
|
|
12
|
+
/**
|
|
13
|
+
* A class that create a metadata form widget
|
|
14
|
+
*/
|
|
15
|
+
export declare class MetadataFormWidget extends NotebookTools.Tool implements MetadataForm.IMetadataForm {
|
|
16
|
+
/**
|
|
17
|
+
* Construct an empty widget.
|
|
18
|
+
*/
|
|
19
|
+
constructor(options: MetadataForm.IOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Get the form object itself.
|
|
22
|
+
*/
|
|
23
|
+
get form(): FormWidget | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Get the list of existing metadataKey (array of string).
|
|
26
|
+
*
|
|
27
|
+
* ## NOTE:
|
|
28
|
+
* The list contains also the conditional fields, which are not necessary
|
|
29
|
+
* displayed and filled.
|
|
30
|
+
*/
|
|
31
|
+
get metadataKeys(): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Get the properties of a MetadataKey.
|
|
34
|
+
*
|
|
35
|
+
* @param metadataKey - metadataKey (string).
|
|
36
|
+
*/
|
|
37
|
+
getProperties(metadataKey: string): PartialJSONObject | null;
|
|
38
|
+
/**
|
|
39
|
+
* Set properties to a metadataKey.
|
|
40
|
+
*
|
|
41
|
+
* @param metadataKey - metadataKey (string).
|
|
42
|
+
* @param properties - the properties to add or modify.
|
|
43
|
+
*/
|
|
44
|
+
setProperties(metadataKey: string, properties: PartialJSONObject): void;
|
|
45
|
+
/**
|
|
46
|
+
* Update the metadata of the current cell or notebook.
|
|
47
|
+
*
|
|
48
|
+
* @param formData - the cell metadata set in the form.
|
|
49
|
+
* @param reload - whether to update the form after updating the metadata.
|
|
50
|
+
*
|
|
51
|
+
* ## Notes
|
|
52
|
+
* Metadata are updated from root only. If some metadata is nested,
|
|
53
|
+
* the whole root object must be updated.
|
|
54
|
+
* This function build an object with all the root object to update
|
|
55
|
+
* in metadata before performing update.
|
|
56
|
+
*/
|
|
57
|
+
updateMetadata(formData: ReadonlyPartialJSONObject, reload?: boolean): void;
|
|
58
|
+
/**
|
|
59
|
+
* Set the content of the widget.
|
|
60
|
+
*/
|
|
61
|
+
protected setContent(content: Widget | null): void;
|
|
62
|
+
/**
|
|
63
|
+
* Build widget.
|
|
64
|
+
*/
|
|
65
|
+
protected buildWidget(props: MetadataForm.IProps): void;
|
|
66
|
+
/**
|
|
67
|
+
* Update the form when the widget is displayed.
|
|
68
|
+
*/
|
|
69
|
+
protected onAfterShow(msg: Message): void;
|
|
70
|
+
/**
|
|
71
|
+
* Handle a change to the active cell.
|
|
72
|
+
*/
|
|
73
|
+
protected onActiveCellChanged(msg: Message): void;
|
|
74
|
+
/**
|
|
75
|
+
* Handle a change to the active cell metadata.
|
|
76
|
+
*/
|
|
77
|
+
protected onActiveCellMetadataChanged(msg: Message): void;
|
|
78
|
+
protected onActiveNotebookPanelChanged(msg: Message): void;
|
|
79
|
+
/**
|
|
80
|
+
* Handle a change to the active notebook metadata.
|
|
81
|
+
*/
|
|
82
|
+
protected onActiveNotebookPanelMetadataChanged(msg: Message): void;
|
|
83
|
+
/**
|
|
84
|
+
* Update the form with current cell metadata, and remove inconsistent fields.
|
|
85
|
+
*/
|
|
86
|
+
private _update;
|
|
87
|
+
protected translator: ITranslator;
|
|
88
|
+
private _form;
|
|
89
|
+
private _metadataSchema;
|
|
90
|
+
private _metaInformation;
|
|
91
|
+
private _uiSchema;
|
|
92
|
+
private _trans;
|
|
93
|
+
private _placeholder;
|
|
94
|
+
private _updatingMetadata;
|
|
95
|
+
private _pluginId;
|
|
96
|
+
private _showModified;
|
|
97
|
+
private _notebookModelNull;
|
|
98
|
+
}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
/**
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @module metadataform
|
|
6
|
+
*/
|
|
7
|
+
import { NotebookTools } from '@jupyterlab/notebook';
|
|
8
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
9
|
+
import { JSONExt } from '@lumino/coreutils';
|
|
10
|
+
import { SingletonLayout, Widget } from '@lumino/widgets';
|
|
11
|
+
import { FormWidget } from './form';
|
|
12
|
+
/**
|
|
13
|
+
* A class that create a metadata form widget
|
|
14
|
+
*/
|
|
15
|
+
export class MetadataFormWidget extends NotebookTools.Tool {
|
|
16
|
+
/**
|
|
17
|
+
* Construct an empty widget.
|
|
18
|
+
*/
|
|
19
|
+
constructor(options) {
|
|
20
|
+
super();
|
|
21
|
+
this._form = undefined;
|
|
22
|
+
this._notebookModelNull = false;
|
|
23
|
+
this._metadataSchema = options.metadataSchema;
|
|
24
|
+
this._metaInformation = options.metaInformation;
|
|
25
|
+
this._uiSchema = options.uiSchema || {};
|
|
26
|
+
this._pluginId = options.pluginId;
|
|
27
|
+
this._showModified = options.showModified || false;
|
|
28
|
+
this.translator = options.translator || nullTranslator;
|
|
29
|
+
this._trans = this.translator.load('jupyterlab');
|
|
30
|
+
this._updatingMetadata = false;
|
|
31
|
+
const layout = (this.layout = new SingletonLayout());
|
|
32
|
+
const node = document.createElement('div');
|
|
33
|
+
const content = document.createElement('div');
|
|
34
|
+
content.textContent = this._trans.__('No metadata.');
|
|
35
|
+
content.className = 'jp-MetadataForm-placeholderContent';
|
|
36
|
+
node.appendChild(content);
|
|
37
|
+
this._placeholder = new Widget({ node });
|
|
38
|
+
this._placeholder.addClass('jp-MetadataForm-placeholder');
|
|
39
|
+
layout.widget = this._placeholder;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the form object itself.
|
|
43
|
+
*/
|
|
44
|
+
get form() {
|
|
45
|
+
return this._form;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get the list of existing metadataKey (array of string).
|
|
49
|
+
*
|
|
50
|
+
* ## NOTE:
|
|
51
|
+
* The list contains also the conditional fields, which are not necessary
|
|
52
|
+
* displayed and filled.
|
|
53
|
+
*/
|
|
54
|
+
get metadataKeys() {
|
|
55
|
+
var _a;
|
|
56
|
+
const metadataKeys = [];
|
|
57
|
+
// MetadataKey from schema.
|
|
58
|
+
for (let metadataKey of Object.keys(this._metadataSchema.properties)) {
|
|
59
|
+
metadataKeys.push(metadataKey);
|
|
60
|
+
}
|
|
61
|
+
// Possible additional metadataKeys from conditional schema.
|
|
62
|
+
(_a = this._metadataSchema.allOf) === null || _a === void 0 ? void 0 : _a.forEach(conditional => {
|
|
63
|
+
if (conditional.then !== undefined) {
|
|
64
|
+
if (conditional.then.properties !== undefined) {
|
|
65
|
+
let properties = conditional.then
|
|
66
|
+
.properties;
|
|
67
|
+
for (let metadataKey of Object.keys(properties)) {
|
|
68
|
+
if (!metadataKeys.includes(metadataKey))
|
|
69
|
+
metadataKeys.push(metadataKey);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (conditional.else !== undefined) {
|
|
74
|
+
if (conditional.else.properties !== undefined) {
|
|
75
|
+
let properties = conditional.else
|
|
76
|
+
.properties;
|
|
77
|
+
for (let metadataKey of Object.keys(properties)) {
|
|
78
|
+
if (!metadataKeys.includes(metadataKey))
|
|
79
|
+
metadataKeys.push(metadataKey);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return metadataKeys;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get the properties of a MetadataKey.
|
|
88
|
+
*
|
|
89
|
+
* @param metadataKey - metadataKey (string).
|
|
90
|
+
*/
|
|
91
|
+
getProperties(metadataKey) {
|
|
92
|
+
return (JSONExt.deepCopy(this._metadataSchema.properties[metadataKey]) || null);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Set properties to a metadataKey.
|
|
96
|
+
*
|
|
97
|
+
* @param metadataKey - metadataKey (string).
|
|
98
|
+
* @param properties - the properties to add or modify.
|
|
99
|
+
*/
|
|
100
|
+
setProperties(metadataKey, properties) {
|
|
101
|
+
Object.entries(properties).forEach(([key, value]) => {
|
|
102
|
+
this._metadataSchema.properties[metadataKey][key] = value;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Update the metadata of the current cell or notebook.
|
|
107
|
+
*
|
|
108
|
+
* @param formData - the cell metadata set in the form.
|
|
109
|
+
* @param reload - whether to update the form after updating the metadata.
|
|
110
|
+
*
|
|
111
|
+
* ## Notes
|
|
112
|
+
* Metadata are updated from root only. If some metadata is nested,
|
|
113
|
+
* the whole root object must be updated.
|
|
114
|
+
* This function build an object with all the root object to update
|
|
115
|
+
* in metadata before performing update.
|
|
116
|
+
*/
|
|
117
|
+
updateMetadata(formData, reload) {
|
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
119
|
+
if (this.notebookTools == undefined)
|
|
120
|
+
return;
|
|
121
|
+
const notebook = this.notebookTools.activeNotebookPanel;
|
|
122
|
+
const cell = this.notebookTools.activeCell;
|
|
123
|
+
if (cell == null)
|
|
124
|
+
return;
|
|
125
|
+
this._updatingMetadata = true;
|
|
126
|
+
// An object representing the cell metadata to modify.
|
|
127
|
+
const cellMetadataObject = {};
|
|
128
|
+
// An object representing the notebook metadata to modify.
|
|
129
|
+
const notebookMetadataObject = {};
|
|
130
|
+
for (let [metadataKey, value] of Object.entries(formData)) {
|
|
131
|
+
// Continue if the metadataKey does not exist in schema.
|
|
132
|
+
if (!this.metadataKeys.includes(metadataKey))
|
|
133
|
+
continue;
|
|
134
|
+
// Continue if the metadataKey is a notebook level one and there is no NotebookModel.
|
|
135
|
+
if (((_a = this._metaInformation[metadataKey]) === null || _a === void 0 ? void 0 : _a.level) === 'notebook' &&
|
|
136
|
+
this._notebookModelNull)
|
|
137
|
+
continue;
|
|
138
|
+
// Continue if the metadataKey is not applicable to the cell type.
|
|
139
|
+
if (((_b = this._metaInformation[metadataKey]) === null || _b === void 0 ? void 0 : _b.cellTypes) &&
|
|
140
|
+
!((_d = (_c = this._metaInformation[metadataKey]) === null || _c === void 0 ? void 0 : _c.cellTypes) === null || _d === void 0 ? void 0 : _d.includes(cell.model.type))) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
let currentMetadata;
|
|
144
|
+
let metadataObject;
|
|
145
|
+
// Linking the working variable to the corresponding metadata and representation.
|
|
146
|
+
if (((_e = this._metaInformation[metadataKey]) === null || _e === void 0 ? void 0 : _e.level) === 'notebook') {
|
|
147
|
+
// Working on notebook metadata.
|
|
148
|
+
currentMetadata = notebook.model.metadata;
|
|
149
|
+
metadataObject = notebookMetadataObject;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// Working on cell metadata.
|
|
153
|
+
currentMetadata = cell.model.metadata;
|
|
154
|
+
metadataObject = cellMetadataObject;
|
|
155
|
+
}
|
|
156
|
+
// Remove first and last '/' if necessary and split the path.
|
|
157
|
+
let nestedKey = metadataKey
|
|
158
|
+
.replace(/^\/+/, '')
|
|
159
|
+
.replace(/\/+$/, '')
|
|
160
|
+
.split('/');
|
|
161
|
+
let baseMetadataKey = nestedKey[0];
|
|
162
|
+
if (baseMetadataKey == undefined)
|
|
163
|
+
continue;
|
|
164
|
+
let writeFinalData = value !== undefined &&
|
|
165
|
+
(((_g = (_f = this._metaInformation[metadataKey]) === null || _f === void 0 ? void 0 : _f.writeDefault) !== null && _g !== void 0 ? _g : true) ||
|
|
166
|
+
value !== ((_h = this._metaInformation[metadataKey]) === null || _h === void 0 ? void 0 : _h.default));
|
|
167
|
+
// If metadata key is at root of metadata no need to go further.
|
|
168
|
+
if (nestedKey.length == 1) {
|
|
169
|
+
if (writeFinalData)
|
|
170
|
+
metadataObject[baseMetadataKey] = value;
|
|
171
|
+
else
|
|
172
|
+
metadataObject[baseMetadataKey] = undefined;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
let intermediateMetadataKeys = nestedKey.slice(1, -1);
|
|
176
|
+
let finalMetadataKey = nestedKey[nestedKey.length - 1];
|
|
177
|
+
// Deep copy of the metadata if not already done.
|
|
178
|
+
if (!(baseMetadataKey in metadataObject)) {
|
|
179
|
+
metadataObject[baseMetadataKey] = currentMetadata[baseMetadataKey];
|
|
180
|
+
}
|
|
181
|
+
if (metadataObject[baseMetadataKey] === undefined)
|
|
182
|
+
metadataObject[baseMetadataKey] = {};
|
|
183
|
+
// Let's have an object which points to the nested key.
|
|
184
|
+
let workingObject = metadataObject[baseMetadataKey];
|
|
185
|
+
let finalObjectReached = true;
|
|
186
|
+
for (let nested of intermediateMetadataKeys) {
|
|
187
|
+
// If one of the nested object does not exist, this object is created
|
|
188
|
+
// only if there is a final data to write.
|
|
189
|
+
if (!(nested in workingObject)) {
|
|
190
|
+
if (!writeFinalData) {
|
|
191
|
+
finalObjectReached = false;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
else
|
|
195
|
+
workingObject[nested] = {};
|
|
196
|
+
}
|
|
197
|
+
workingObject = workingObject[nested];
|
|
198
|
+
}
|
|
199
|
+
// Write the value to the nested key or remove all empty object before the nested key,
|
|
200
|
+
// only if the final object has been reached.
|
|
201
|
+
if (finalObjectReached) {
|
|
202
|
+
if (!writeFinalData)
|
|
203
|
+
delete workingObject[finalMetadataKey];
|
|
204
|
+
else
|
|
205
|
+
workingObject[finalMetadataKey] = value;
|
|
206
|
+
}
|
|
207
|
+
// If the final nested data has been deleted, let see if there is not remaining
|
|
208
|
+
// empty objects to remove.
|
|
209
|
+
if (!writeFinalData) {
|
|
210
|
+
metadataObject[baseMetadataKey] = Private.deleteEmptyNested(metadataObject[baseMetadataKey], nestedKey.slice(1));
|
|
211
|
+
if (!Object.keys(metadataObject[baseMetadataKey])
|
|
212
|
+
.length)
|
|
213
|
+
metadataObject[baseMetadataKey] = undefined;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Set the cell metadata or delete it if value is undefined or empty object.
|
|
217
|
+
for (let [key, value] of Object.entries(cellMetadataObject)) {
|
|
218
|
+
if (value === undefined)
|
|
219
|
+
cell.model.deleteMetadata(key);
|
|
220
|
+
else
|
|
221
|
+
cell.model.setMetadata(key, value);
|
|
222
|
+
}
|
|
223
|
+
// Set the notebook metadata or delete it if value is undefined or empty object.
|
|
224
|
+
if (!this._notebookModelNull) {
|
|
225
|
+
for (let [key, value] of Object.entries(notebookMetadataObject)) {
|
|
226
|
+
if (value === undefined)
|
|
227
|
+
notebook.model.deleteMetadata(key);
|
|
228
|
+
else
|
|
229
|
+
notebook.model.setMetadata(key, value);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
this._updatingMetadata = false;
|
|
233
|
+
if (reload) {
|
|
234
|
+
this._update();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Set the content of the widget.
|
|
239
|
+
*/
|
|
240
|
+
setContent(content) {
|
|
241
|
+
const layout = this.layout;
|
|
242
|
+
if (layout.widget) {
|
|
243
|
+
layout.widget.removeClass('jp-MetadataForm-content');
|
|
244
|
+
layout.removeWidget(layout.widget);
|
|
245
|
+
}
|
|
246
|
+
if (!content) {
|
|
247
|
+
content = this._placeholder;
|
|
248
|
+
}
|
|
249
|
+
content.addClass('jp-MetadataForm-content');
|
|
250
|
+
layout.widget = content;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Build widget.
|
|
254
|
+
*/
|
|
255
|
+
buildWidget(props) {
|
|
256
|
+
this._form = new FormWidget(props);
|
|
257
|
+
this._form.addClass('jp-MetadataForm');
|
|
258
|
+
this.setContent(this._form);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Update the form when the widget is displayed.
|
|
262
|
+
*/
|
|
263
|
+
onAfterShow(msg) {
|
|
264
|
+
this._update();
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Handle a change to the active cell.
|
|
268
|
+
*/
|
|
269
|
+
onActiveCellChanged(msg) {
|
|
270
|
+
if (this.isVisible)
|
|
271
|
+
this._update();
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Handle a change to the active cell metadata.
|
|
275
|
+
*/
|
|
276
|
+
onActiveCellMetadataChanged(msg) {
|
|
277
|
+
if (!this._updatingMetadata && this.isVisible)
|
|
278
|
+
this._update();
|
|
279
|
+
}
|
|
280
|
+
onActiveNotebookPanelChanged(msg) {
|
|
281
|
+
// Do not use notebook metadata if model is null.
|
|
282
|
+
let notebook = this.notebookTools.activeNotebookPanel;
|
|
283
|
+
if (notebook === null || notebook.model === null) {
|
|
284
|
+
console.warn('Notebook model is null, its metadata cannot be updated.');
|
|
285
|
+
this._notebookModelNull = true;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
this._notebookModelNull = false;
|
|
289
|
+
}
|
|
290
|
+
if (!this._updatingMetadata && this.isVisible)
|
|
291
|
+
this._update();
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Handle a change to the active notebook metadata.
|
|
295
|
+
*/
|
|
296
|
+
onActiveNotebookPanelMetadataChanged(msg) {
|
|
297
|
+
if (!this._updatingMetadata && this.isVisible)
|
|
298
|
+
this._update();
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Update the form with current cell metadata, and remove inconsistent fields.
|
|
302
|
+
*/
|
|
303
|
+
_update() {
|
|
304
|
+
var _a, _b, _c, _d, _e;
|
|
305
|
+
const notebook = this.notebookTools.activeNotebookPanel;
|
|
306
|
+
const cell = this.notebookTools.activeCell;
|
|
307
|
+
if (cell == undefined)
|
|
308
|
+
return;
|
|
309
|
+
const formProperties = JSONExt.deepCopy(this._metadataSchema);
|
|
310
|
+
const formData = {};
|
|
311
|
+
for (let metadataKey of Object.keys(this._metadataSchema.properties)) {
|
|
312
|
+
// Do not display the field if it's Notebook metadata and the notebook model is null.
|
|
313
|
+
if (((_a = this._metaInformation[metadataKey]) === null || _a === void 0 ? void 0 : _a.level) === 'notebook' &&
|
|
314
|
+
this._notebookModelNull) {
|
|
315
|
+
delete formProperties.properties[metadataKey];
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
// Do not display the field if the active cell's type is not involved.
|
|
319
|
+
if (((_b = this._metaInformation[metadataKey]) === null || _b === void 0 ? void 0 : _b.cellTypes) &&
|
|
320
|
+
!((_d = (_c = this._metaInformation[metadataKey]) === null || _c === void 0 ? void 0 : _c.cellTypes) === null || _d === void 0 ? void 0 : _d.includes(cell.model.type))) {
|
|
321
|
+
delete formProperties.properties[metadataKey];
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
let workingObject;
|
|
325
|
+
// Remove the first and last '/' if exist, nad split the path.
|
|
326
|
+
let nestedKeys = metadataKey
|
|
327
|
+
.replace(/^\/+/, '')
|
|
328
|
+
.replace(/\/+$/, '')
|
|
329
|
+
.split('/');
|
|
330
|
+
// Associates the correct metadata object to the working object.
|
|
331
|
+
if (((_e = this._metaInformation[metadataKey]) === null || _e === void 0 ? void 0 : _e.level) === 'notebook') {
|
|
332
|
+
workingObject = notebook.model.metadata;
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
workingObject = cell.model.metadata;
|
|
336
|
+
}
|
|
337
|
+
let hasValue = true;
|
|
338
|
+
// Navigate to the value.
|
|
339
|
+
for (let nested of nestedKeys) {
|
|
340
|
+
if (nested in workingObject)
|
|
341
|
+
workingObject = workingObject[nested];
|
|
342
|
+
else {
|
|
343
|
+
hasValue = false;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// Fill the formData with the current metadata value.
|
|
348
|
+
if (hasValue)
|
|
349
|
+
formData[metadataKey] = workingObject;
|
|
350
|
+
}
|
|
351
|
+
this.buildWidget({
|
|
352
|
+
properties: formProperties,
|
|
353
|
+
settings: new Private.Settings(this._metaInformation),
|
|
354
|
+
uiSchema: this._uiSchema,
|
|
355
|
+
translator: this.translator || null,
|
|
356
|
+
formData: formData,
|
|
357
|
+
metadataFormWidget: this,
|
|
358
|
+
showModified: this._showModified,
|
|
359
|
+
pluginId: this._pluginId
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
var Private;
|
|
364
|
+
(function (Private) {
|
|
365
|
+
/**
|
|
366
|
+
* The settings to send to RJSF templates in formContext.
|
|
367
|
+
*/
|
|
368
|
+
class Settings {
|
|
369
|
+
constructor(metaInformation) {
|
|
370
|
+
this.metaInformation = metaInformation;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Returns the default value for a specific key.
|
|
374
|
+
* @param metadataKey - the key for which we expect default value.
|
|
375
|
+
*/
|
|
376
|
+
default(metadataKey) {
|
|
377
|
+
var _a;
|
|
378
|
+
return (_a = this.metaInformation[metadataKey]) === null || _a === void 0 ? void 0 : _a.default;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
Private.Settings = Settings;
|
|
382
|
+
/**
|
|
383
|
+
* Recursive function to clean the empty nested metadata before updating real metadata.
|
|
384
|
+
* this function is called when a nested metadata is undefined (or default), so maybe some
|
|
385
|
+
* object are now empty.
|
|
386
|
+
* @param metadataObject: PartialJSONObject representing the metadata to update.
|
|
387
|
+
* @param metadataKeysList: Array<string> of the undefined nested metadata.
|
|
388
|
+
* @returns PartialJSONObject without empty object.
|
|
389
|
+
*/
|
|
390
|
+
function deleteEmptyNested(metadataObject, metadataKeysList) {
|
|
391
|
+
let metadataKey = metadataKeysList.shift();
|
|
392
|
+
if (metadataKey !== undefined && metadataKey in metadataObject) {
|
|
393
|
+
if (Object.keys(metadataObject[metadataKey]).length)
|
|
394
|
+
metadataObject[metadataKey] = deleteEmptyNested(metadataObject[metadataKey], metadataKeysList);
|
|
395
|
+
if (!Object.keys(metadataObject[metadataKey]).length)
|
|
396
|
+
delete metadataObject[metadataKey];
|
|
397
|
+
}
|
|
398
|
+
return metadataObject;
|
|
399
|
+
}
|
|
400
|
+
Private.deleteEmptyNested = deleteEmptyNested;
|
|
401
|
+
})(Private || (Private = {}));
|
|
402
|
+
//# sourceMappingURL=metadataform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataform.js","sourceRoot":"","sources":["../src/metadataform.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EAKR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,kBACX,SAAQ,aAAa,CAAC,IAAI;IAG1B;;OAEG;IACH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CAAE,OAAO,CAAC;QACpD,CAAC;KAGF;IAdY,gBAAQ,WAcpB,CAAA;IACD;;;;;;;OAOG;IACH,SAAgB,iBAAiB,CAC/B,cAAiC,EACjC,gBAA+B;QAE/B,IAAI,WAAW,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC3C,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,IAAI,cAAc,EAAE;YAC9D,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAsB,CAAC,CAAC,MAAM;gBACtE,cAAc,CAAC,WAAW,CAAC,GAAG,iBAAiB,CAC7C,cAAc,CAAC,WAAW,CAAsB,EAChD,gBAAgB,CACjB,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAsB,CAAC,CAAC,MAAM;gBACvE,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC;SACtC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IAfe,yBAAiB,oBAehC,CAAA;AACH,CAAC,EAlDS,OAAO,KAAP,OAAO,QAkDhB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IMetadataFormProvider, MetadataForm } from './token';
|
|
2
|
+
export declare class MetadataFormProvider implements IMetadataFormProvider {
|
|
3
|
+
add(id: string, widget: MetadataForm.IMetadataForm): void;
|
|
4
|
+
get(id: string): MetadataForm.IMetadataForm | undefined;
|
|
5
|
+
_items: {
|
|
6
|
+
[id: string]: MetadataForm.IMetadataForm;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
export class MetadataFormProvider {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._items = {};
|
|
8
|
+
}
|
|
9
|
+
add(id, widget) {
|
|
10
|
+
if (!this._items[id]) {
|
|
11
|
+
this._items[id] = widget;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
console.warn(`A MetadataformWidget is already registered with id ${id}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
get(id) {
|
|
18
|
+
if (!this._items[id]) {
|
|
19
|
+
return this._items[id];
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.warn(`There is no MetadataformWidget registered with id ${id}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=metadataformProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataformProvider.js","sourceRoot":"","sources":["../src/metadataformProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,oBAAoB;IAAjC;QAiBE,WAAM,GAAiD,EAAE,CAAC;IAC5D,CAAC;IAjBC,GAAG,CAAC,EAAU,EAAE,MAAkC;QAChD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;YACpB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;SAC1B;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,sDAAsD,EAAE,EAAE,CAAC,CAAC;SAC1E;IACH,CAAC;IAED,GAAG,CAAC,EAAU;QACZ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;SACxB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,qDAAqD,EAAE,EAAE,CAAC,CAAC;SACzE;IACH,CAAC;CAGF"}
|
package/lib/token.d.ts
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module metadataform
|
|
4
|
+
*/
|
|
5
|
+
import { CellType } from '@jupyterlab/nbformat';
|
|
6
|
+
import { NotebookTools } from '@jupyterlab/notebook';
|
|
7
|
+
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
8
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
9
|
+
import { PartialJSONObject, PartialJSONValue, ReadonlyPartialJSONObject, Token } from '@lumino/coreutils';
|
|
10
|
+
import { MetadataFormWidget } from './metadataform';
|
|
11
|
+
export declare namespace MetadataForm {
|
|
12
|
+
/**
|
|
13
|
+
* The metadata schema as defined in JSON schema.
|
|
14
|
+
*/
|
|
15
|
+
type IMetadataSchema = ISettingRegistry.IMetadataSchema;
|
|
16
|
+
/**
|
|
17
|
+
* The settings to send to RJSF templates in formContext.
|
|
18
|
+
*/
|
|
19
|
+
interface ISettings {
|
|
20
|
+
/**
|
|
21
|
+
* Returns the default value for a specific key.
|
|
22
|
+
* @param metadataKey - the key for which we expect default value.
|
|
23
|
+
*/
|
|
24
|
+
default(metadataKey: string): PartialJSONValue | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The meta information associated to all properties.
|
|
27
|
+
*/
|
|
28
|
+
metaInformation: IMetaInformation;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The meta information associated to all properties.
|
|
32
|
+
*/
|
|
33
|
+
interface IMetaInformation {
|
|
34
|
+
[metadataKey: string]: ISingleMetaInformation;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The meta information associated to a property.
|
|
38
|
+
*/
|
|
39
|
+
interface ISingleMetaInformation {
|
|
40
|
+
/**
|
|
41
|
+
* The metadata level, 'cell' or 'notebook'.
|
|
42
|
+
*/
|
|
43
|
+
level?: 'cell' | 'notebook';
|
|
44
|
+
/**
|
|
45
|
+
* The cell types to display this metadata field.
|
|
46
|
+
*/
|
|
47
|
+
cellTypes?: CellType[];
|
|
48
|
+
/**
|
|
49
|
+
* The default value for this metadata.
|
|
50
|
+
*/
|
|
51
|
+
default?: any;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to avoid writing default value in metadata.
|
|
54
|
+
*/
|
|
55
|
+
writeDefault?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* RJSF ui:schema.
|
|
59
|
+
*/
|
|
60
|
+
interface IUiSchema {
|
|
61
|
+
[metadataKey: string]: IUiSchemaOption;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* RJSF ui:schema options.
|
|
65
|
+
*/
|
|
66
|
+
interface IUiSchemaOption {
|
|
67
|
+
[option: string]: any;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Options passed to MetadataFormWidget.
|
|
71
|
+
*/
|
|
72
|
+
interface IOptions {
|
|
73
|
+
/**
|
|
74
|
+
* MetadataSchema defined from the settings.
|
|
75
|
+
*/
|
|
76
|
+
metadataSchema: IMetadataSchema;
|
|
77
|
+
/**
|
|
78
|
+
* The meta information associated to all properties.
|
|
79
|
+
*/
|
|
80
|
+
metaInformation: IMetaInformation;
|
|
81
|
+
/**
|
|
82
|
+
* The uiSchema built when loading schemas.
|
|
83
|
+
*/
|
|
84
|
+
uiSchema?: IUiSchema;
|
|
85
|
+
/**
|
|
86
|
+
* The plugin ID.
|
|
87
|
+
*/
|
|
88
|
+
pluginId?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Translator object.
|
|
91
|
+
*/
|
|
92
|
+
translator?: ITranslator;
|
|
93
|
+
/**
|
|
94
|
+
* Whether to show the modified field from default value.
|
|
95
|
+
*/
|
|
96
|
+
showModified?: boolean;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Props passed to the FormWidget component.
|
|
100
|
+
*/
|
|
101
|
+
interface IProps {
|
|
102
|
+
/**
|
|
103
|
+
* Properties defined from the settings.
|
|
104
|
+
*/
|
|
105
|
+
properties: IMetadataSchema;
|
|
106
|
+
/**
|
|
107
|
+
* Meta information associated to properties.
|
|
108
|
+
*/
|
|
109
|
+
settings: ISettings;
|
|
110
|
+
/**
|
|
111
|
+
* Current data of the form.
|
|
112
|
+
*/
|
|
113
|
+
formData: ReadonlyPartialJSONObject | null;
|
|
114
|
+
/**
|
|
115
|
+
* Translator object.
|
|
116
|
+
*/
|
|
117
|
+
translator: ITranslator;
|
|
118
|
+
/**
|
|
119
|
+
* The parent object of the form.
|
|
120
|
+
*/
|
|
121
|
+
metadataFormWidget: MetadataFormWidget;
|
|
122
|
+
/**
|
|
123
|
+
* The uiSchema built when loading schemas.
|
|
124
|
+
*/
|
|
125
|
+
uiSchema: IUiSchema;
|
|
126
|
+
/**
|
|
127
|
+
* Whether to show the modified field from default value.
|
|
128
|
+
*/
|
|
129
|
+
showModified: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* The plugin ID.
|
|
132
|
+
*/
|
|
133
|
+
pluginId?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A metadata form interface provided when registering
|
|
137
|
+
* to a metadata form provider. Allows an owner widget
|
|
138
|
+
* to set the metadata form content for itself.
|
|
139
|
+
*/
|
|
140
|
+
interface IMetadataForm extends NotebookTools.Tool {
|
|
141
|
+
/**
|
|
142
|
+
* Get the list of existing metadataKey (array of string).
|
|
143
|
+
*
|
|
144
|
+
* ## NOTE:
|
|
145
|
+
* The list contains also the conditional fields, which are not necessary
|
|
146
|
+
* displayed and filled.
|
|
147
|
+
*/
|
|
148
|
+
get metadataKeys(): string[];
|
|
149
|
+
/**
|
|
150
|
+
* Get the properties of a MetadataKey.
|
|
151
|
+
* @param metadataKey - metadataKey (array of string).
|
|
152
|
+
*/
|
|
153
|
+
getProperties(metadataKey: string): PartialJSONObject | null;
|
|
154
|
+
/**
|
|
155
|
+
* Set properties to a metadataKey.
|
|
156
|
+
* @param metadataKey - metadataKey (array of string).
|
|
157
|
+
* @param properties - the properties to add or modify.
|
|
158
|
+
*/
|
|
159
|
+
setProperties(metadataKey: string, properties: PartialJSONObject): void;
|
|
160
|
+
/**
|
|
161
|
+
* Update the metadata of the current cell or notebook.
|
|
162
|
+
*
|
|
163
|
+
* @param formData: the cell metadata set in the form.
|
|
164
|
+
* @param reload: whether to update the form after updating the metadata.
|
|
165
|
+
*
|
|
166
|
+
* ## Notes
|
|
167
|
+
* Metadata are updated from root only. If some metadata is nested,
|
|
168
|
+
* the whole root object must be updated.
|
|
169
|
+
* This function build an object with all the root object to update
|
|
170
|
+
* in metadata before performing update.
|
|
171
|
+
*/
|
|
172
|
+
updateMetadata(formData: ReadonlyPartialJSONObject, reload?: boolean): void;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A provider for metadata form.
|
|
177
|
+
*/
|
|
178
|
+
export interface IMetadataFormProvider {
|
|
179
|
+
/**
|
|
180
|
+
* Add a MetadataFormWidget to the provider.
|
|
181
|
+
*/
|
|
182
|
+
add(id: string, widget: MetadataForm.IMetadataForm): void;
|
|
183
|
+
/**
|
|
184
|
+
* Get a MetadataFormWidget from id.
|
|
185
|
+
*/
|
|
186
|
+
get(id: string): MetadataForm.IMetadataForm | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* Each ID must be described in schema.
|
|
189
|
+
*/
|
|
190
|
+
_items: {
|
|
191
|
+
[id: string]: MetadataForm.IMetadataForm;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The property inspector provider token.
|
|
196
|
+
*/
|
|
197
|
+
export declare const IMetadataFormProvider: Token<IMetadataFormProvider>;
|
package/lib/token.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
/**
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @module metadataform
|
|
6
|
+
*/
|
|
7
|
+
import { Token } from '@lumino/coreutils';
|
|
8
|
+
/**
|
|
9
|
+
* The property inspector provider token.
|
|
10
|
+
*/
|
|
11
|
+
export const IMetadataFormProvider = new Token('@jupyterlab/metadataform:IMetadataFormProvider');
|
|
12
|
+
//# sourceMappingURL=token.js.map
|
package/lib/token.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAC3D;;;GAGG;AAMH,OAAO,EAIL,KAAK,EACN,MAAM,mBAAmB,CAAC;AAuN3B;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,KAAK,CAC5C,gDAAgD,CACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/metadataform",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.17",
|
|
4
4
|
"description": "A helper to build form for metadata",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"watch": "tsc -w --listEmittedFiles"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@jupyterlab/apputils": "^4.0.0-alpha.
|
|
48
|
-
"@jupyterlab/nbformat": "^4.0.0-alpha.
|
|
49
|
-
"@jupyterlab/notebook": "^4.0.0-alpha.
|
|
50
|
-
"@jupyterlab/settingregistry": "^4.0.0-alpha.
|
|
51
|
-
"@jupyterlab/translation": "^4.0.0-alpha.
|
|
52
|
-
"@jupyterlab/ui-components": "^4.0.0-alpha.
|
|
47
|
+
"@jupyterlab/apputils": "^4.0.0-alpha.17",
|
|
48
|
+
"@jupyterlab/nbformat": "^4.0.0-alpha.17",
|
|
49
|
+
"@jupyterlab/notebook": "^4.0.0-alpha.17",
|
|
50
|
+
"@jupyterlab/settingregistry": "^4.0.0-alpha.17",
|
|
51
|
+
"@jupyterlab/translation": "^4.0.0-alpha.17",
|
|
52
|
+
"@jupyterlab/ui-components": "^4.0.0-alpha.32",
|
|
53
53
|
"@lumino/coreutils": "^2.0.0-alpha.6",
|
|
54
54
|
"@lumino/messaging": "^2.0.0-alpha.6",
|
|
55
55
|
"@lumino/widgets": "^2.0.0-alpha.6",
|
|
@@ -58,12 +58,10 @@
|
|
|
58
58
|
"react": "^17.0.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@jupyterlab/
|
|
62
|
-
"@types/jest": "^
|
|
61
|
+
"@jupyterlab/testing": "^4.0.0-alpha.17",
|
|
62
|
+
"@types/jest": "^29.2.0",
|
|
63
63
|
"@types/react": "^17.0.0",
|
|
64
|
-
"jest": "^26.4.2",
|
|
65
64
|
"rimraf": "~3.0.0",
|
|
66
|
-
"ts-jest": "^26.3.0",
|
|
67
65
|
"typedoc": "~0.22.10",
|
|
68
66
|
"typescript": "~4.7.3"
|
|
69
67
|
},
|