@jupyterlab/ui-components 4.4.0-alpha.2 → 4.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/FormRendererRegistry.js.map +1 -1
- package/lib/components/accordiontoolbar.js.map +1 -1
- package/lib/components/collapser.js.map +1 -1
- package/lib/components/form.js.map +1 -1
- package/lib/components/iframe.js.map +1 -1
- package/lib/components/menu.js.map +1 -1
- package/lib/components/search.d.ts +10 -3
- package/lib/components/search.js +42 -8
- package/lib/components/search.js.map +1 -1
- package/lib/components/sidepanel.js.map +1 -1
- package/lib/components/styling.js.map +1 -1
- package/lib/components/switch.js.map +1 -1
- package/lib/components/table.js.map +1 -1
- package/lib/components/toolbar.js.map +1 -1
- package/lib/components/vdom.js.map +1 -1
- package/lib/components/windowedlist.js +4 -2
- package/lib/components/windowedlist.js.map +1 -1
- package/lib/hoverbox.js.map +1 -1
- package/lib/icon/iconimports.d.ts +5 -0
- package/lib/icon/iconimports.js +10 -0
- package/lib/icon/iconimports.js.map +1 -1
- package/lib/icon/labicon.js.map +1 -1
- package/lib/icon/widgets/commandpalettesvg.js.map +1 -1
- package/lib/icon/widgets/menusvg.js.map +1 -1
- package/lib/style/icon.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +8 -8
- package/src/components/search.tsx +68 -15
- package/src/components/windowedlist.ts +4 -2
- package/src/icon/iconimports.ts +10 -0
- package/style/deprecated.css +25 -0
- package/style/icons/filetype/r-kernel.svg +3 -2
- package/style/icons/toolbar/dock-bottom.svg +3 -0
- package/style/icons/toolbar/dock-left.svg +3 -0
- package/style/icons/toolbar/dock-right.svg +3 -0
- package/style/icons/toolbar/dock-top.svg +3 -0
- package/style/icons/toolbar/dots.svg +8 -0
- package/style/windowedlist.css +1 -0
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
import { ReactWidget } from './vdom';
|
|
4
4
|
import { StringExt } from '@lumino/algorithm';
|
|
5
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { Search } from '@jupyter/react-components';
|
|
7
7
|
import { searchIcon } from '../icon';
|
|
8
|
+
import { ISignal } from '@lumino/signaling';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* The class name added to the filebrowser crumbs node.
|
|
@@ -56,7 +57,15 @@ export interface IFilterBoxProps {
|
|
|
56
57
|
/**
|
|
57
58
|
* Whether to use the fuzzy filter.
|
|
58
59
|
*/
|
|
59
|
-
useFuzzyFilter
|
|
60
|
+
useFuzzyFilter?: boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Signal emitted when filter settings change
|
|
64
|
+
*/
|
|
65
|
+
filterSettingsChanged?: ISignal<
|
|
66
|
+
unknown,
|
|
67
|
+
{ [P in keyof IFilterBoxProps]?: IFilterBoxProps[P] }
|
|
68
|
+
>;
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
/**
|
|
@@ -125,7 +134,7 @@ export function fuzzySearch(source: string, query: string): IScore | null {
|
|
|
125
134
|
|
|
126
135
|
export const updateFilterFunction = (
|
|
127
136
|
value: string,
|
|
128
|
-
useFuzzyFilter
|
|
137
|
+
useFuzzyFilter?: boolean,
|
|
129
138
|
caseSensitive?: boolean
|
|
130
139
|
) => {
|
|
131
140
|
return (item: string): Partial<IScore> | null => {
|
|
@@ -144,7 +153,7 @@ export const updateFilterFunction = (
|
|
|
144
153
|
return null;
|
|
145
154
|
}
|
|
146
155
|
return {
|
|
147
|
-
indices: [...Array(
|
|
156
|
+
indices: [...Array(value.length).keys()].map(x => x + i)
|
|
148
157
|
};
|
|
149
158
|
};
|
|
150
159
|
};
|
|
@@ -159,20 +168,37 @@ export const FilterBox = (props: IFilterBoxProps): JSX.Element => {
|
|
|
159
168
|
});
|
|
160
169
|
}, []);
|
|
161
170
|
}
|
|
171
|
+
const firstRender = useRef(true);
|
|
172
|
+
const inputRef = props.inputRef ?? useRef<HTMLInputElement>();
|
|
162
173
|
|
|
163
174
|
useEffect(() => {
|
|
164
175
|
// If there is an initial search value, pass the parent the initial filter function for that value.
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
if (firstRender.current) {
|
|
177
|
+
firstRender.current = false;
|
|
178
|
+
if (props.initialQuery !== undefined) {
|
|
179
|
+
props.updateFilter(
|
|
180
|
+
updateFilterFunction(
|
|
181
|
+
props.initialQuery,
|
|
182
|
+
props.useFuzzyFilter,
|
|
183
|
+
props.caseSensitive
|
|
184
|
+
),
|
|
185
|
+
props.initialQuery
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
if (inputRef.current) {
|
|
190
|
+
// If filter settings changed, update the filter
|
|
191
|
+
props.updateFilter(
|
|
192
|
+
updateFilterFunction(
|
|
193
|
+
inputRef.current.value,
|
|
194
|
+
props.useFuzzyFilter,
|
|
195
|
+
props.caseSensitive
|
|
196
|
+
),
|
|
197
|
+
inputRef.current.value
|
|
198
|
+
);
|
|
199
|
+
}
|
|
174
200
|
}
|
|
175
|
-
}, []);
|
|
201
|
+
}, [props.updateFilter, props.useFuzzyFilter, props.caseSensitive]);
|
|
176
202
|
|
|
177
203
|
/**
|
|
178
204
|
* Handler for search input changes.
|
|
@@ -215,6 +241,33 @@ export const FilterBox = (props: IFilterBoxProps): JSX.Element => {
|
|
|
215
241
|
/**
|
|
216
242
|
* A widget which hosts a input textbox to filter on file names.
|
|
217
243
|
*/
|
|
244
|
+
class FilenameSearcherWidget extends ReactWidget {
|
|
245
|
+
constructor(props: IFilterBoxProps) {
|
|
246
|
+
super();
|
|
247
|
+
this._filterBoxProps = { ...props };
|
|
248
|
+
props?.filterSettingsChanged?.connect((_, args) => {
|
|
249
|
+
this._updateProps(args);
|
|
250
|
+
}, this);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
render(): JSX.Element {
|
|
254
|
+
return <FilterBox {...this._filterBoxProps} />;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Update a specific prop.
|
|
259
|
+
*/
|
|
260
|
+
private _updateProps(props: Partial<IFilterBoxProps>): void {
|
|
261
|
+
Object.assign(this._filterBoxProps, props);
|
|
262
|
+
this.update();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private _filterBoxProps: IFilterBoxProps;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Function which returns a widget that hosts an input textbox to filter on file names.
|
|
270
|
+
*/
|
|
218
271
|
export const FilenameSearcher = (props: IFilterBoxProps): ReactWidget => {
|
|
219
|
-
return
|
|
272
|
+
return new FilenameSearcherWidget(props);
|
|
220
273
|
};
|
|
@@ -989,9 +989,11 @@ export class WindowedList<
|
|
|
989
989
|
handleEvent(event: Event): void {
|
|
990
990
|
switch (event.type) {
|
|
991
991
|
case 'pointerdown':
|
|
992
|
-
event.preventDefault();
|
|
993
|
-
event.stopPropagation();
|
|
994
992
|
this._evtPointerDown(event as PointerEvent);
|
|
993
|
+
// Stop propagation of this event; a `mousedown` event will still
|
|
994
|
+
// be automatically dispatched and handled by the parent notebook
|
|
995
|
+
// (which will close any open context menu, etc.)
|
|
996
|
+
event.stopPropagation();
|
|
995
997
|
break;
|
|
996
998
|
case 'scroll':
|
|
997
999
|
this.onScroll(event);
|
package/src/icon/iconimports.ts
CHANGED
|
@@ -39,6 +39,11 @@ import copySvgstr from '../../style/icons/toolbar/copy.svg';
|
|
|
39
39
|
import copyrightSvgstr from '../../style/icons/licenses/copyright.svg';
|
|
40
40
|
import cutSvgstr from '../../style/icons/toolbar/cut.svg';
|
|
41
41
|
import deleteSvgstr from '../../style/icons/toolbar/delete.svg';
|
|
42
|
+
import dockBottomSvgstr from '../../style/icons/toolbar/dock-bottom.svg';
|
|
43
|
+
import dockLeftSvgstr from '../../style/icons/toolbar/dock-left.svg';
|
|
44
|
+
import dockRightSvgstr from '../../style/icons/toolbar/dock-right.svg';
|
|
45
|
+
import dockTopSvgstr from '../../style/icons/toolbar/dock-top.svg';
|
|
46
|
+
import dotsSvgstr from '../../style/icons/toolbar/dots.svg';
|
|
42
47
|
import downloadSvgstr from '../../style/icons/toolbar/download.svg';
|
|
43
48
|
import duplicateSvgstr from '../../style/icons/toolbar/duplicate.svg';
|
|
44
49
|
import editSvgstr from '../../style/icons/toolbar/edit.svg';
|
|
@@ -155,6 +160,11 @@ export const copyIcon = new LabIcon({ name: 'ui-components:copy', svgstr: copySv
|
|
|
155
160
|
export const copyrightIcon = new LabIcon({ name: 'ui-components:copyright', svgstr: copyrightSvgstr });
|
|
156
161
|
export const cutIcon = new LabIcon({ name: 'ui-components:cut', svgstr: cutSvgstr });
|
|
157
162
|
export const deleteIcon = new LabIcon({ name: 'ui-components:delete', svgstr: deleteSvgstr });
|
|
163
|
+
export const dockBottomIcon = new LabIcon({ name: 'ui-components:dock-bottom', svgstr: dockBottomSvgstr });
|
|
164
|
+
export const dockLeftIcon = new LabIcon({ name: 'ui-components:dock-left', svgstr: dockLeftSvgstr });
|
|
165
|
+
export const dockRightIcon = new LabIcon({ name: 'ui-components:dock-right', svgstr: dockRightSvgstr });
|
|
166
|
+
export const dockTopIcon = new LabIcon({ name: 'ui-components:dock-top', svgstr: dockTopSvgstr });
|
|
167
|
+
export const dotsIcon = new LabIcon({ name: 'ui-components:dots', svgstr: dotsSvgstr });
|
|
158
168
|
export const downloadIcon = new LabIcon({ name: 'ui-components:download', svgstr: downloadSvgstr });
|
|
159
169
|
export const duplicateIcon = new LabIcon({ name: 'ui-components:duplicate', svgstr: duplicateSvgstr });
|
|
160
170
|
export const editIcon = new LabIcon({ name: 'ui-components:edit', svgstr: editSvgstr });
|
package/style/deprecated.css
CHANGED
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
--jp-icon-copyright: url('icons/licenses/copyright.svg');
|
|
44
44
|
--jp-icon-cut: url('icons/toolbar/cut.svg');
|
|
45
45
|
--jp-icon-delete: url('icons/toolbar/delete.svg');
|
|
46
|
+
--jp-icon-dock-bottom: url('icons/toolbar/dock-bottom.svg');
|
|
47
|
+
--jp-icon-dock-left: url('icons/toolbar/dock-left.svg');
|
|
48
|
+
--jp-icon-dock-right: url('icons/toolbar/dock-right.svg');
|
|
49
|
+
--jp-icon-dock-top: url('icons/toolbar/dock-top.svg');
|
|
50
|
+
--jp-icon-dots: url('icons/toolbar/dots.svg');
|
|
46
51
|
--jp-icon-download: url('icons/toolbar/download.svg');
|
|
47
52
|
--jp-icon-duplicate: url('icons/toolbar/duplicate.svg');
|
|
48
53
|
--jp-icon-edit: url('icons/toolbar/edit.svg');
|
|
@@ -254,6 +259,26 @@
|
|
|
254
259
|
background-image: var(--jp-icon-delete);
|
|
255
260
|
}
|
|
256
261
|
|
|
262
|
+
.jp-DockBottomIcon {
|
|
263
|
+
background-image: var(--jp-icon-dock-bottom);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.jp-DockLeftIcon {
|
|
267
|
+
background-image: var(--jp-icon-dock-left);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.jp-DockRightIcon {
|
|
271
|
+
background-image: var(--jp-icon-dock-right);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.jp-DockTopIcon {
|
|
275
|
+
background-image: var(--jp-icon-dock-top);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.jp-DotsIcon {
|
|
279
|
+
background-image: var(--jp-icon-dots);
|
|
280
|
+
}
|
|
281
|
+
|
|
257
282
|
.jp-DownloadIcon {
|
|
258
283
|
background-image: var(--jp-icon-download);
|
|
259
284
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0
|
|
2
|
-
<path
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="16" height="16" viewBox="0 0 724 561">
|
|
2
|
+
<path class="jp-icon-selectable" d="M361.453,485.937 C162.329,485.937 0.906,377.828 0.906,244.469 C0.906,111.109 162.329,3.000 361.453,3.000 C560.578,3.000 722.000,111.109 722.000,244.469 C722.000,377.828 560.578,485.937 361.453,485.937 ZM416.641,97.406 C265.289,97.406 142.594,171.314 142.594,262.484 C142.594,353.654 265.289,427.562 416.641,427.562 C567.992,427.562 679.687,377.033 679.687,262.484 C679.687,147.971 567.992,97.406 416.641,97.406 Z" fill="rgb(179,179,179)" fill-rule="evenodd"/>
|
|
3
|
+
<path class="jp-icon-selectable" d="M550.000,377.000 C550.000,377.000 571.822,383.585 584.500,390.000 C588.899,392.226 596.510,396.668 602.000,402.500 C607.378,408.212 610.000,414.000 610.000,414.000 L696.000,559.000 L557.000,559.062 L492.000,437.000 C492.000,437.000 478.690,414.131 470.500,407.500 C463.668,401.969 460.755,400.000 454.000,400.000 C449.298,400.000 420.974,400.000 420.974,400.000 L421.000,558.974 L298.000,559.026 L298.000,152.938 L545.000,152.938 C545.000,152.938 657.500,154.967 657.500,262.000 C657.500,369.033 550.000,377.000 550.000,377.000 ZM496.500,241.024 L422.037,240.976 L422.000,310.026 L496.500,310.002 C496.500,310.002 531.000,309.895 531.000,274.877 C531.000,239.155 496.500,241.024 496.500,241.024 Z" fill="rgb(52,101,176)" fill-rule="evenodd"/>
|
|
3
4
|
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="16" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<g class="jp-icon3" transform="rotate(90,12,12)" fill="#616161">
|
|
4
|
+
<circle cx="5" cy="12" r="2"/>
|
|
5
|
+
<circle cx="12" cy="12" r="2"/>
|
|
6
|
+
<circle cx="19" cy="12" r="2"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|