@jupyterlab/ui-components 4.0.0-alpha.31 → 4.0.0-alpha.33
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/README.md +4 -4
- package/lib/FormRendererRegistry.d.ts +29 -0
- package/lib/FormRendererRegistry.js +51 -0
- package/lib/FormRendererRegistry.js.map +1 -0
- package/lib/components/form.d.ts +107 -0
- package/lib/components/form.js +238 -0
- package/lib/components/form.js.map +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/menu.js +1 -1
- package/lib/components/menu.js.map +1 -1
- package/lib/components/styling.d.ts +1 -1
- package/lib/components/styling.js +18 -11
- package/lib/components/styling.js.map +1 -1
- package/lib/components/toolbar.d.ts +3 -3
- package/lib/components/toolbar.js +6 -3
- package/lib/components/toolbar.js.map +1 -1
- package/lib/components/vdom.d.ts +6 -4
- package/lib/components/vdom.js +27 -10
- package/lib/components/vdom.js.map +1 -1
- package/lib/hoverbox.d.ts +8 -0
- package/lib/hoverbox.js +39 -22
- package/lib/hoverbox.js.map +1 -1
- package/lib/icon/iconimports.d.ts +2 -0
- package/lib/icon/iconimports.js +4 -0
- package/lib/icon/iconimports.js.map +1 -1
- package/lib/icon/labicon.js +14 -3
- package/lib/icon/labicon.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/style/icon.js +0 -29
- package/lib/style/icon.js.map +1 -1
- package/lib/tokens.d.ts +45 -0
- package/lib/tokens.js +4 -0
- package/lib/tokens.js.map +1 -1
- package/package.json +12 -17
- package/style/base.css +3 -8
- package/style/deprecated.css +10 -0
- package/style/hoverbox.css +0 -4
- package/style/icons/error.svg +4 -0
- package/style/icons/search/word.svg +10 -0
- package/style/icons.css +12 -9
- package/style/rjsfTemplates.css +230 -0
- package/style/sidepanel.css +2 -1
- package/style/styling.css +13 -2
- package/style/switch.css +3 -2
- package/style/tabbar.css +1 -0
- package/style/toolbar.css +1 -0
- package/lib/FormComponentRegistry.d.ts +0 -56
- package/lib/FormComponentRegistry.js +0 -44
- package/lib/FormComponentRegistry.js.map +0 -1
package/README.md
CHANGED
|
@@ -85,20 +85,20 @@ Alternatively, you can just render the icon directly into any existing
|
|
|
85
85
|
DOM node `elem` by using the `ReactDOM` module:
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
|
-
|
|
88
|
+
const root = createRoot(elem);
|
|
89
|
+
root.render(jupyterIcon.react);
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
If do you use `ReactDOM` to render, and if the `elem` node is ever
|
|
92
93
|
removed from the DOM, you’ll first need to clean it up:
|
|
93
94
|
|
|
94
95
|
```typescript
|
|
95
|
-
|
|
96
|
+
root.unmount();
|
|
96
97
|
```
|
|
97
98
|
|
|
98
99
|
This cleanup step is not a special property of `LabIcon`, but is instead
|
|
99
100
|
needed for any React component that is rendered directly at the top
|
|
100
|
-
level by `ReactDOM
|
|
101
|
-
in a [memory leak](https://stackoverflow.com/a/48198011/425458).
|
|
101
|
+
level by `ReactDOM`.
|
|
102
102
|
|
|
103
103
|
## How to create your own custom `LabIcon`
|
|
104
104
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IFormRenderer, IFormRendererRegistry } from './tokens';
|
|
2
|
+
/**
|
|
3
|
+
* A registry for property renderers used in the FormEditor component.
|
|
4
|
+
*/
|
|
5
|
+
export declare class FormRendererRegistry implements IFormRendererRegistry {
|
|
6
|
+
/**
|
|
7
|
+
* Adds a renderer for a given property of a given settings plugin.
|
|
8
|
+
*
|
|
9
|
+
* The id must follow that structure `<ISettingRegistry.IPlugin.id>.<propertyName>`
|
|
10
|
+
*
|
|
11
|
+
* @param id - Unique ID for the given renderer.
|
|
12
|
+
* @param renderer - A renderer interfacing IFormRenderer.
|
|
13
|
+
*/
|
|
14
|
+
addRenderer(id: string, renderer: IFormRenderer): void;
|
|
15
|
+
/**
|
|
16
|
+
* Returns all registered renderers in dictionary form.
|
|
17
|
+
* @returns - A dictionary that maps an id to a renderer.
|
|
18
|
+
*/
|
|
19
|
+
get renderers(): {
|
|
20
|
+
[id: string]: IFormRenderer;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Returns the renderer for the given id
|
|
24
|
+
* @param id - The unique id for the renderer.
|
|
25
|
+
* @returns - A renderer interfacing IFormRenderer.
|
|
26
|
+
*/
|
|
27
|
+
getRenderer(id: string): IFormRenderer;
|
|
28
|
+
private _renderers;
|
|
29
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* A registry for property renderers used in the FormEditor component.
|
|
7
|
+
*/
|
|
8
|
+
export class FormRendererRegistry {
|
|
9
|
+
constructor() {
|
|
10
|
+
this._renderers = {};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Adds a renderer for a given property of a given settings plugin.
|
|
14
|
+
*
|
|
15
|
+
* The id must follow that structure `<ISettingRegistry.IPlugin.id>.<propertyName>`
|
|
16
|
+
*
|
|
17
|
+
* @param id - Unique ID for the given renderer.
|
|
18
|
+
* @param renderer - A renderer interfacing IFormRenderer.
|
|
19
|
+
*/
|
|
20
|
+
addRenderer(id, renderer) {
|
|
21
|
+
if (this._renderers[id]) {
|
|
22
|
+
throw new Error(`A renderer with id '${id}' is already registered.`);
|
|
23
|
+
}
|
|
24
|
+
if (!renderer.fieldRenderer && !renderer.widgetRenderer) {
|
|
25
|
+
throw new Error(`The component for '${id}' cannot be registered as it does not define 'fieldRenderer' nor 'widgetRenderer'.`);
|
|
26
|
+
}
|
|
27
|
+
const splitPosition = id.lastIndexOf('.');
|
|
28
|
+
const pluginId = id.substring(0, splitPosition);
|
|
29
|
+
const propertyName = id.substring(splitPosition + 1);
|
|
30
|
+
if (pluginId.length == 0 || propertyName.length == 0) {
|
|
31
|
+
throw new Error(`Form renderer id must follows the structure '<ISettingRegistry.IPlugin.id>.<propertyName>'; got ${id}.`);
|
|
32
|
+
}
|
|
33
|
+
this._renderers[id] = renderer;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns all registered renderers in dictionary form.
|
|
37
|
+
* @returns - A dictionary that maps an id to a renderer.
|
|
38
|
+
*/
|
|
39
|
+
get renderers() {
|
|
40
|
+
return this._renderers;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns the renderer for the given id
|
|
44
|
+
* @param id - The unique id for the renderer.
|
|
45
|
+
* @returns - A renderer interfacing IFormRenderer.
|
|
46
|
+
*/
|
|
47
|
+
getRenderer(id) {
|
|
48
|
+
return this._renderers[id];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=FormRendererRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRendererRegistry.js","sourceRoot":"","sources":["../src/FormRendererRegistry.tsx"],"names":[],"mappings":"AAAA;;;+EAG+E;AAI/E;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAAjC;QAgDU,eAAU,GAAoC,EAAE,CAAC;IAC3D,CAAC;IAhDC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAU,EAAE,QAAuB;QAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAC;SACtE;QACD,IAAI,CAAC,QAAQ,CAAC,aAAa,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;YACvD,MAAM,IAAI,KAAK,CACb,sBAAsB,EAAE,oFAAoF,CAC7G,CAAC;SACH;QAED,MAAM,aAAa,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;QACrD,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,YAAY,CAAC,MAAM,IAAI,CAAC,EAAE;YACpD,MAAM,IAAI,KAAK,CACb,mGAAmG,EAAE,GAAG,CACzG,CAAC;SACH;QAED,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,EAAU;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CAGF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
2
|
+
import { ReadonlyJSONObject } from '@lumino/coreutils';
|
|
3
|
+
import { ArrayFieldTemplateProps, ErrorSchema, FormProps, IChangeEvent } from '@rjsf/core';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Form component namespace.
|
|
7
|
+
*/
|
|
8
|
+
export declare namespace FormComponent {
|
|
9
|
+
interface IButtonProps {
|
|
10
|
+
/**
|
|
11
|
+
* Button style.
|
|
12
|
+
*/
|
|
13
|
+
buttonStyle?: 'icons' | 'text';
|
|
14
|
+
/**
|
|
15
|
+
* Translator for button text.
|
|
16
|
+
*/
|
|
17
|
+
translator?: ITranslator;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Properties for React JSON schema form's container template (array and object).
|
|
21
|
+
*/
|
|
22
|
+
interface ILabCustomizerProps extends IButtonProps {
|
|
23
|
+
/**
|
|
24
|
+
* Whether the container is in compact mode or not.
|
|
25
|
+
* In compact mode the title and description are displayed more compactness.
|
|
26
|
+
*/
|
|
27
|
+
compact?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to display if the current value is not the default one.
|
|
30
|
+
*/
|
|
31
|
+
showModifiedFromDefault?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Properties of the button to move an item.
|
|
35
|
+
*/
|
|
36
|
+
interface IMoveButtonProps extends IButtonProps {
|
|
37
|
+
/**
|
|
38
|
+
* Item index to move with this button.
|
|
39
|
+
*/
|
|
40
|
+
item: ArrayFieldTemplateProps['items'][number];
|
|
41
|
+
/**
|
|
42
|
+
* Direction in which to move the item.
|
|
43
|
+
*/
|
|
44
|
+
direction: 'up' | 'down';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Properties of the button to drop an item.
|
|
48
|
+
*/
|
|
49
|
+
interface IDropButtonProps extends IButtonProps {
|
|
50
|
+
/**
|
|
51
|
+
* Item index to drop with this button.
|
|
52
|
+
*/
|
|
53
|
+
item: ArrayFieldTemplateProps['items'][number];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Properties of the button to add an item.
|
|
57
|
+
*/
|
|
58
|
+
interface IAddButtonProps extends IButtonProps {
|
|
59
|
+
/**
|
|
60
|
+
* Function to call to add an item.
|
|
61
|
+
*/
|
|
62
|
+
onAddClick: ArrayFieldTemplateProps['onAddClick'];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Button to move an item.
|
|
67
|
+
*
|
|
68
|
+
* @returns - the button as a react element.
|
|
69
|
+
*/
|
|
70
|
+
export declare const MoveButton: (props: FormComponent.IMoveButtonProps) => JSX.Element;
|
|
71
|
+
/**
|
|
72
|
+
* Button to drop an item.
|
|
73
|
+
*
|
|
74
|
+
* @returns - the button as a react element.
|
|
75
|
+
*/
|
|
76
|
+
export declare const DropButton: (props: FormComponent.IDropButtonProps) => JSX.Element;
|
|
77
|
+
/**
|
|
78
|
+
* Button to add an item.
|
|
79
|
+
*
|
|
80
|
+
* @returns - the button as a react element.
|
|
81
|
+
*/
|
|
82
|
+
export declare const AddButton: (props: FormComponent.IAddButtonProps) => JSX.Element;
|
|
83
|
+
export interface ILabCustomizerOptions<P> extends FormComponent.ILabCustomizerProps {
|
|
84
|
+
name?: string;
|
|
85
|
+
component: React.FunctionComponent<P & Required<FormComponent.ILabCustomizerProps>>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* FormComponent properties
|
|
89
|
+
*/
|
|
90
|
+
export interface IFormComponentProps<T = ReadonlyJSONObject> extends FormProps<T>, FormComponent.ILabCustomizerProps {
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
formData: T;
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
onChange: (e: IChangeEvent<T>, es?: ErrorSchema) => any;
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
formContext?: unknown;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Generic rjsf form component for JupyterLab UI.
|
|
106
|
+
*/
|
|
107
|
+
export declare function FormComponent(props: IFormComponentProps): JSX.Element;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Jupyter Development Team.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
6
|
+
import { JSONExt } from '@lumino/coreutils';
|
|
7
|
+
import Form, { utils } from '@rjsf/core';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { addIcon, caretDownIcon, caretUpIcon, closeIcon } from '../icon';
|
|
10
|
+
/**
|
|
11
|
+
* Button to move an item.
|
|
12
|
+
*
|
|
13
|
+
* @returns - the button as a react element.
|
|
14
|
+
*/
|
|
15
|
+
export const MoveButton = (props) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const trans = ((_a = props.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');
|
|
18
|
+
let buttonContent;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the button is disabled or not.
|
|
21
|
+
*/
|
|
22
|
+
const disabled = () => {
|
|
23
|
+
if (props.direction === 'up') {
|
|
24
|
+
return !props.item.hasMoveUp;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return !props.item.hasMoveDown;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if (props.buttonStyle === 'icons') {
|
|
31
|
+
const iconProps = {
|
|
32
|
+
tag: 'span',
|
|
33
|
+
elementSize: 'xlarge',
|
|
34
|
+
elementPosition: 'center'
|
|
35
|
+
};
|
|
36
|
+
buttonContent =
|
|
37
|
+
props.direction === 'up' ? (React.createElement(caretUpIcon.react, { ...iconProps })) : (React.createElement(caretDownIcon.react, { ...iconProps }));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
buttonContent =
|
|
41
|
+
props.direction === 'up' ? trans.__('Move up') : trans.__('Move down');
|
|
42
|
+
}
|
|
43
|
+
const moveTo = props.direction === 'up' ? props.item.index - 1 : props.item.index + 1;
|
|
44
|
+
return (React.createElement("button", { className: "jp-mod-styled jp-mod-reject jp-ArrayOperationsButton", onClick: props.item.onReorderClick(props.item.index, moveTo), disabled: disabled() }, buttonContent));
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Button to drop an item.
|
|
48
|
+
*
|
|
49
|
+
* @returns - the button as a react element.
|
|
50
|
+
*/
|
|
51
|
+
export const DropButton = (props) => {
|
|
52
|
+
var _a;
|
|
53
|
+
const trans = ((_a = props.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');
|
|
54
|
+
let buttonContent;
|
|
55
|
+
if (props.buttonStyle === 'icons') {
|
|
56
|
+
buttonContent = (React.createElement(closeIcon.react, { tag: "span", elementSize: "xlarge", elementPosition: "center" }));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
buttonContent = trans.__('Remove');
|
|
60
|
+
}
|
|
61
|
+
return (React.createElement("button", { className: "jp-mod-styled jp-mod-warn jp-ArrayOperationsButton", onClick: props.item.onDropIndexClick(props.item.index) }, buttonContent));
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Button to add an item.
|
|
65
|
+
*
|
|
66
|
+
* @returns - the button as a react element.
|
|
67
|
+
*/
|
|
68
|
+
export const AddButton = (props) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const trans = ((_a = props.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');
|
|
71
|
+
let buttonContent;
|
|
72
|
+
if (props.buttonStyle === 'icons') {
|
|
73
|
+
buttonContent = (React.createElement(addIcon.react, { tag: "span", elementSize: "xlarge", elementPosition: "center" }));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
buttonContent = trans.__('Add');
|
|
77
|
+
}
|
|
78
|
+
return (React.createElement("button", { className: "jp-mod-styled jp-mod-reject jp-ArrayOperationsButton", onClick: props.onAddClick }, buttonContent));
|
|
79
|
+
};
|
|
80
|
+
function customizeForLab(options) {
|
|
81
|
+
const { component, name, buttonStyle, compact, showModifiedFromDefault, translator } = options;
|
|
82
|
+
const isCompact = compact !== null && compact !== void 0 ? compact : false;
|
|
83
|
+
const button = buttonStyle !== null && buttonStyle !== void 0 ? buttonStyle : (isCompact ? 'icons' : 'text');
|
|
84
|
+
const factory = (props) => component({
|
|
85
|
+
...props,
|
|
86
|
+
buttonStyle: button,
|
|
87
|
+
compact: isCompact,
|
|
88
|
+
showModifiedFromDefault: showModifiedFromDefault !== null && showModifiedFromDefault !== void 0 ? showModifiedFromDefault : true,
|
|
89
|
+
translator: translator !== null && translator !== void 0 ? translator : nullTranslator
|
|
90
|
+
});
|
|
91
|
+
if (name) {
|
|
92
|
+
factory.displayName = name;
|
|
93
|
+
}
|
|
94
|
+
return factory;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Template to allow for custom buttons to re-order/remove entries in an array.
|
|
98
|
+
* Necessary to create accessible buttons.
|
|
99
|
+
*/
|
|
100
|
+
const CustomArrayTemplateFactory = (options) => customizeForLab({
|
|
101
|
+
...options,
|
|
102
|
+
name: 'JupyterLabArrayTemplate',
|
|
103
|
+
component: props => {
|
|
104
|
+
var _a;
|
|
105
|
+
return (React.createElement("div", { className: props.className },
|
|
106
|
+
props.compact ? (React.createElement("div", { className: "jp-FormGroup-compactTitle" },
|
|
107
|
+
React.createElement("div", { className: "jp-FormGroup-fieldLabel jp-FormGroup-contentItem", id: `${props.idSchema.$id}__title` }, props.title || ''),
|
|
108
|
+
React.createElement("div", { className: "jp-FormGroup-description", id: `${props.idSchema.$id}-description` }, props.schema.description || ''))) : (React.createElement(React.Fragment, null,
|
|
109
|
+
props.title && (React.createElement(props.TitleField, { title: props.title, required: props.required, id: `${props.idSchema.$id}-title` })),
|
|
110
|
+
React.createElement(props.DescriptionField, { id: `${props.idSchema.$id}-description`, description: (_a = props.schema.description) !== null && _a !== void 0 ? _a : '' }))),
|
|
111
|
+
props.items.map(item => {
|
|
112
|
+
return (React.createElement("div", { key: item.key, className: item.className },
|
|
113
|
+
item.children,
|
|
114
|
+
React.createElement("div", { className: "jp-ArrayOperations" },
|
|
115
|
+
React.createElement(MoveButton, { buttonStyle: props.buttonStyle, translator: props.translator, item: item, direction: "up" }),
|
|
116
|
+
React.createElement(MoveButton, { buttonStyle: props.buttonStyle, translator: props.translator, item: item, direction: "down" }),
|
|
117
|
+
React.createElement(DropButton, { buttonStyle: props.buttonStyle, translator: props.translator, item: item }))));
|
|
118
|
+
}),
|
|
119
|
+
props.canAdd && (React.createElement(AddButton, { onAddClick: props.onAddClick, buttonStyle: props.buttonStyle, translator: props.translator }))));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* Template with custom add button, necessary for accessibility and internationalization.
|
|
124
|
+
*/
|
|
125
|
+
const CustomObjectTemplateFactory = (options) => customizeForLab({
|
|
126
|
+
...options,
|
|
127
|
+
name: 'JupyterLabObjectTemplate',
|
|
128
|
+
component: props => {
|
|
129
|
+
var _a;
|
|
130
|
+
return (React.createElement("fieldset", { id: props.idSchema.$id },
|
|
131
|
+
props.compact ? (React.createElement("div", { className: "jp-FormGroup-compactTitle" },
|
|
132
|
+
React.createElement("div", { className: "jp-FormGroup-fieldLabel jp-FormGroup-contentItem", id: `${props.idSchema.$id}__title` }, props.title || ''),
|
|
133
|
+
React.createElement("div", { className: "jp-FormGroup-description", id: `${props.idSchema.$id}__description` }, props.schema.description || ''))) : (React.createElement(React.Fragment, null,
|
|
134
|
+
(props.title || props.uiSchema['ui:title']) && (React.createElement(props.TitleField, { id: `${props.idSchema.$id}__title`, title: props.title || props.uiSchema['ui:title'] || '', required: props.required })),
|
|
135
|
+
React.createElement(props.DescriptionField, { id: `${props.idSchema.$id}__description`, description: (_a = props.schema.description) !== null && _a !== void 0 ? _a : '' }))),
|
|
136
|
+
props.properties.map(property => property.content),
|
|
137
|
+
utils.canExpand(props.schema, props.uiSchema, props.formData) && (React.createElement(AddButton, { onAddClick: props.onAddClick(props.schema), buttonStyle: props.buttonStyle, translator: props.translator }))));
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Renders the modified indicator and errors
|
|
142
|
+
*/
|
|
143
|
+
const CustomTemplateFactory = (options) => customizeForLab({
|
|
144
|
+
...options,
|
|
145
|
+
name: 'JupyterLabFieldTemplate',
|
|
146
|
+
component: props => {
|
|
147
|
+
var _a;
|
|
148
|
+
const trans = ((_a = props.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');
|
|
149
|
+
let isModified = false;
|
|
150
|
+
let defaultValue;
|
|
151
|
+
const { formData, schema, label, displayLabel, id, formContext, errors, rawErrors, children, onKeyChange, onDropPropertyClick } = props;
|
|
152
|
+
const { defaultFormData } = formContext;
|
|
153
|
+
const schemaIds = id.split('_');
|
|
154
|
+
schemaIds.shift();
|
|
155
|
+
const schemaId = schemaIds.join('.');
|
|
156
|
+
const isRoot = schemaId === '';
|
|
157
|
+
const hasCustomField = schemaId === props.uiSchema['ui:field'];
|
|
158
|
+
if (props.showModifiedFromDefault) {
|
|
159
|
+
/**
|
|
160
|
+
* Determine if the field has been modified.
|
|
161
|
+
* Schema Id is formatted as 'root_<field name>.<nested field name>'
|
|
162
|
+
* This logic parses out the field name to find the default value
|
|
163
|
+
* before determining if the field has been modified.
|
|
164
|
+
*/
|
|
165
|
+
defaultValue = schemaIds.reduce((acc, key) => acc === null || acc === void 0 ? void 0 : acc[key], defaultFormData);
|
|
166
|
+
isModified =
|
|
167
|
+
!isRoot &&
|
|
168
|
+
formData !== undefined &&
|
|
169
|
+
defaultValue !== undefined &&
|
|
170
|
+
!schema.properties &&
|
|
171
|
+
schema.type !== 'array' &&
|
|
172
|
+
!JSONExt.deepEqual(formData, defaultValue);
|
|
173
|
+
}
|
|
174
|
+
const needsDescription = !isRoot &&
|
|
175
|
+
schema.type != 'object' &&
|
|
176
|
+
id !=
|
|
177
|
+
'jp-SettingsEditor-@jupyterlab/shortcuts-extension:shortcuts_shortcuts';
|
|
178
|
+
// While we can implement "remove" button for array items in array template,
|
|
179
|
+
// object templates do not provide a way to do this instead we need to add
|
|
180
|
+
// buttons here (and first check if the field can be removed = is additional).
|
|
181
|
+
const isAdditional = schema.hasOwnProperty(utils.ADDITIONAL_PROPERTY_FLAG);
|
|
182
|
+
const isItem = !(schema.type === 'object' || schema.type === 'array');
|
|
183
|
+
return (React.createElement("div", { className: `form-group ${displayLabel || schema.type === 'boolean' ? 'small-field' : ''}` },
|
|
184
|
+
!hasCustomField &&
|
|
185
|
+
(rawErrors ? (
|
|
186
|
+
// Shows a red indicator for fields that have validation errors
|
|
187
|
+
React.createElement("div", { className: "jp-modifiedIndicator jp-errorIndicator" })) : (
|
|
188
|
+
// Only show the modified indicator if there are no errors
|
|
189
|
+
isModified && React.createElement("div", { className: "jp-modifiedIndicator" }))),
|
|
190
|
+
React.createElement("div", { className: `jp-FormGroup-content ${props.compact
|
|
191
|
+
? 'jp-FormGroup-contentCompact'
|
|
192
|
+
: 'jp-FormGroup-contentNormal'}` },
|
|
193
|
+
isItem && displayLabel && !isRoot && label && !isAdditional ? (props.compact ? (React.createElement("div", { className: "jp-FormGroup-compactTitle" },
|
|
194
|
+
React.createElement("div", { className: "jp-FormGroup-fieldLabel jp-FormGroup-contentItem" }, label),
|
|
195
|
+
isItem && schema.description && needsDescription && (React.createElement("div", { className: "jp-FormGroup-description" }, schema.description)))) : (React.createElement("h3", { className: "jp-FormGroup-fieldLabel jp-FormGroup-contentItem" }, label))) : (React.createElement(React.Fragment, null)),
|
|
196
|
+
isAdditional && (React.createElement("input", { className: "jp-FormGroup-contentItem jp-mod-styled", type: "text", onBlur: event => onKeyChange(event.target.value), defaultValue: label })),
|
|
197
|
+
React.createElement("div", { className: `${isRoot
|
|
198
|
+
? 'jp-root'
|
|
199
|
+
: schema.type === 'object'
|
|
200
|
+
? 'jp-objectFieldWrapper'
|
|
201
|
+
: schema.type === 'array'
|
|
202
|
+
? 'jp-arrayFieldWrapper'
|
|
203
|
+
: 'jp-inputFieldWrapper jp-FormGroup-contentItem'}` }, children),
|
|
204
|
+
isAdditional && (React.createElement("button", { className: "jp-FormGroup-contentItem jp-mod-styled jp-mod-warn jp-FormGroup-removeButton", onClick: onDropPropertyClick(label) }, trans.__('Remove'))),
|
|
205
|
+
!props.compact && schema.description && needsDescription && (React.createElement("div", { className: "jp-FormGroup-description" }, schema.description)),
|
|
206
|
+
isModified && defaultValue !== undefined && (React.createElement("div", { className: "jp-FormGroup-default" }, trans.__('Default: %1', defaultValue.toLocaleString()))),
|
|
207
|
+
React.createElement("div", { className: "validationErrors" }, errors))));
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
/**
|
|
211
|
+
* Generic rjsf form component for JupyterLab UI.
|
|
212
|
+
*/
|
|
213
|
+
export function FormComponent(props) {
|
|
214
|
+
const { FieldTemplate, ArrayFieldTemplate, ObjectFieldTemplate, buttonStyle, compact, showModifiedFromDefault, translator, ...others } = props;
|
|
215
|
+
const customization = {
|
|
216
|
+
buttonStyle,
|
|
217
|
+
compact,
|
|
218
|
+
showModifiedFromDefault,
|
|
219
|
+
translator
|
|
220
|
+
};
|
|
221
|
+
const fieldTemplate = React.useMemo(() => FieldTemplate !== null && FieldTemplate !== void 0 ? FieldTemplate : CustomTemplateFactory(customization), [FieldTemplate, buttonStyle, compact, showModifiedFromDefault, translator]);
|
|
222
|
+
const arrayTemplate = React.useMemo(() => ArrayFieldTemplate !== null && ArrayFieldTemplate !== void 0 ? ArrayFieldTemplate : CustomArrayTemplateFactory(customization), [
|
|
223
|
+
ArrayFieldTemplate,
|
|
224
|
+
buttonStyle,
|
|
225
|
+
compact,
|
|
226
|
+
showModifiedFromDefault,
|
|
227
|
+
translator
|
|
228
|
+
]);
|
|
229
|
+
const objectTemplate = React.useMemo(() => ObjectFieldTemplate !== null && ObjectFieldTemplate !== void 0 ? ObjectFieldTemplate : CustomObjectTemplateFactory(customization), [
|
|
230
|
+
ObjectFieldTemplate,
|
|
231
|
+
buttonStyle,
|
|
232
|
+
compact,
|
|
233
|
+
showModifiedFromDefault,
|
|
234
|
+
translator
|
|
235
|
+
]);
|
|
236
|
+
return (React.createElement(Form, { FieldTemplate: fieldTemplate, ArrayFieldTemplate: arrayTemplate, ObjectFieldTemplate: objectTemplate, ...others }));
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/components/form.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAsB,MAAM,mBAAmB,CAAC;AAChE,OAAO,IAAI,EAAE,EAOX,KAAK,EACN,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,MAAM,OA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BAA0B,CAAC,aAAa,CAAC,EACrE;QACE,kBAAkB;QAClB,WAAW;QACX,OAAO;QACP,uBAAuB;QACvB,UAAU;KACX,CACF,CAAC;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAClC,GAAG,EAAE,CAAC,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,2BAA2B,CAAC,aAAa,CAAC,EACvE;QACE,mBAAmB;QACnB,WAAW;QACX,OAAO;QACP,uBAAuB;QACvB,UAAU;KACX,CACF,CAAC;IACF,OAAO,CACL,oBAAC,IAAI,IACH,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,cAAc,KAC/B,MAAM,GACV,CACH,CAAC;AACJ,CAAC"}
|
package/lib/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC"}
|
package/lib/components/menu.js
CHANGED
|
@@ -76,7 +76,7 @@ export class RankedMenu extends Menu {
|
|
|
76
76
|
// Keep an array of the menu items that have been created.
|
|
77
77
|
const added = [];
|
|
78
78
|
// Insert a separator before the group.
|
|
79
|
-
//
|
|
79
|
+
// Lumino takes care of superfluous leading,
|
|
80
80
|
// trailing, and duplicate separators.
|
|
81
81
|
if (this._includeSeparators) {
|
|
82
82
|
added.push(this.insertItem(insertIndex++, { type: 'separator', rank: defaultRank }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/components/menu.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,oBAAoB;AAEpB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAe,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAiDvC;;GAEG;AACH,MAAM,KAAW,WAAW,CAgC3B;AAhCD,WAAiB,WAAW;IAC1B;;OAEG;IACU,wBAAY,GAAG,GAAG,CAAC;AA4BlC,CAAC,EAhCgB,WAAW,KAAX,WAAW,QAgC3B;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IAClC;;;;OAIG;IACH,YAAY,OAA6B;;QACv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S,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAG,CAAC,SAAS,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAG,CAAC,SAAS,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAG,CAAC,UAAU,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,OAAO;SACR;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YAClC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC7B;QACD,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CAKF"}
|
|
@@ -34,7 +34,8 @@ export var Styling;
|
|
|
34
34
|
node.classList.add('jp-mod-styled');
|
|
35
35
|
}
|
|
36
36
|
if (node.localName === 'select') {
|
|
37
|
-
|
|
37
|
+
const multiple = node.hasAttribute('multiple');
|
|
38
|
+
wrapSelect(node, multiple);
|
|
38
39
|
}
|
|
39
40
|
const nodes = node.getElementsByTagName(tagName);
|
|
40
41
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -44,7 +45,8 @@ export var Styling;
|
|
|
44
45
|
child.classList.add(className);
|
|
45
46
|
}
|
|
46
47
|
if (tagName === 'select') {
|
|
47
|
-
|
|
48
|
+
const multiple = child.hasAttribute('multiple');
|
|
49
|
+
wrapSelect(child, multiple);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -52,7 +54,7 @@ export var Styling;
|
|
|
52
54
|
/**
|
|
53
55
|
* Wrap a select node.
|
|
54
56
|
*/
|
|
55
|
-
function wrapSelect(node) {
|
|
57
|
+
function wrapSelect(node, multiple) {
|
|
56
58
|
const wrapper = document.createElement('div');
|
|
57
59
|
wrapper.classList.add('jp-select-wrapper');
|
|
58
60
|
node.addEventListener('focus', Private.onFocus);
|
|
@@ -62,14 +64,19 @@ export var Styling;
|
|
|
62
64
|
node.parentElement.replaceChild(wrapper, node);
|
|
63
65
|
}
|
|
64
66
|
wrapper.appendChild(node);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
if (multiple) {
|
|
68
|
+
wrapper.classList.add('multiple');
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// add the icon node
|
|
72
|
+
wrapper.appendChild(caretDownEmptyIcon.element({
|
|
73
|
+
tag: 'span',
|
|
74
|
+
stylesheet: 'select',
|
|
75
|
+
right: '8px',
|
|
76
|
+
top: '5px',
|
|
77
|
+
width: '18px'
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
73
80
|
return wrapper;
|
|
74
81
|
}
|
|
75
82
|
Styling.wrapSelect = wrapSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styling.js","sourceRoot":"","sources":["../../src/components/styling.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;GAEG;AACH,MAAM,KAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"styling.js","sourceRoot":"","sources":["../../src/components/styling.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;GAEG;AACH,MAAM,KAAW,OAAO,CAoFvB;AApFD,WAAiB,OA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MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;QACpC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;YAC1B,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;SACxC;aAAM;YACL,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;SAC3C;IACH,CAAC;IAXe,eAAO,UAWtB,CAAA;AACH,CAAC,EAhBS,OAAO,KAAP,OAAO,QAgBhB"}
|
|
@@ -250,9 +250,9 @@ export declare function ToolbarButtonComponent(props: ToolbarButtonComponent.IPr
|
|
|
250
250
|
* Adds the toolbar button class to the toolbar widget.
|
|
251
251
|
* @param w Toolbar button widget.
|
|
252
252
|
*/
|
|
253
|
-
export declare function addToolbarButtonClass(w:
|
|
253
|
+
export declare function addToolbarButtonClass<T extends Widget = Widget>(w: T): T;
|
|
254
254
|
/**
|
|
255
|
-
*
|
|
255
|
+
* Lumino Widget version of static ToolbarButtonComponent.
|
|
256
256
|
*/
|
|
257
257
|
export declare class ToolbarButton extends ReactWidget {
|
|
258
258
|
private props;
|
|
@@ -394,7 +394,7 @@ declare class ToolbarPopupOpener extends ToolbarButton {
|
|
|
394
394
|
/**
|
|
395
395
|
* Create a new popup opener
|
|
396
396
|
*/
|
|
397
|
-
constructor();
|
|
397
|
+
constructor(props?: ToolbarButtonComponent.IProps);
|
|
398
398
|
/**
|
|
399
399
|
* Add widget to the popup, prepends widgets
|
|
400
400
|
* @param widget the widget to add
|