@jupyterlab/filebrowser 4.3.0-alpha.1 → 4.3.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/src/model.ts CHANGED
@@ -383,6 +383,7 @@ export class FileBrowserModel implements IDisposable {
383
383
  * Upload a `File` object.
384
384
  *
385
385
  * @param file - The `File` object to upload.
386
+ * @param path - The directory into which the file should be uploaded; defaults to current directory.
386
387
  *
387
388
  * @returns A promise containing the new file contents model.
388
389
  *
@@ -392,7 +393,7 @@ export class FileBrowserModel implements IDisposable {
392
393
  * Jupyter Server, it will ask for confirmation then upload the file in 1 MB
393
394
  * chunks.
394
395
  */
395
- async upload(file: File): Promise<Contents.IModel> {
396
+ async upload(file: File, path?: string): Promise<Contents.IModel> {
396
397
  // We do not support Jupyter Notebook version less than 4, and Jupyter
397
398
  // Server advertises itself as version 1 and supports chunked
398
399
  // uploading. We assume any version less than 4.0.0 to be Jupyter Server
@@ -428,7 +429,7 @@ export class FileBrowserModel implements IDisposable {
428
429
  }
429
430
  await this._uploadCheckDisposed();
430
431
  const chunkedUpload = supportsChunked && file.size > CHUNK_SIZE;
431
- return await this._upload(file, chunkedUpload);
432
+ return await this._upload(file, chunkedUpload, path);
432
433
  }
433
434
 
434
435
  private async _shouldUploadLarge(file: File): Promise<boolean> {
@@ -451,10 +452,12 @@ export class FileBrowserModel implements IDisposable {
451
452
  */
452
453
  private async _upload(
453
454
  file: File,
454
- chunked: boolean
455
+ chunked: boolean,
456
+ uploadPath?: string
455
457
  ): Promise<Contents.IModel> {
456
458
  // Gather the file model parameters.
457
- let path = this._model.path;
459
+ let path =
460
+ typeof uploadPath === 'undefined' ? this._model.path : uploadPath;
458
461
  path = path ? path + '/' + file.name : file.name;
459
462
  const name = file.name;
460
463
  const type: Contents.ContentType = 'file';
package/style/base.css CHANGED
@@ -29,6 +29,20 @@
29
29
  row-gap: 12px;
30
30
  }
31
31
 
32
+ .jp-FileBrowser-filterToolbar {
33
+ display: flex;
34
+ flex: 0 0 auto;
35
+ flex-direction: column;
36
+ }
37
+
38
+ .jp-FileBrowser-filterToolbar.jp-Toolbar {
39
+ border-bottom: none;
40
+ height: auto;
41
+ margin: 0 12px 6px;
42
+ box-shadow: none;
43
+ padding: 0;
44
+ }
45
+
32
46
  .jp-FileBrowser-Panel {
33
47
  flex: 1 1 auto;
34
48
  display: flex;
@@ -64,7 +78,8 @@
64
78
  | Buttons
65
79
  |----------------------------------------------------------------------------*/
66
80
 
67
- .jp-FileBrowser-toolbar > .jp-Toolbar-item {
81
+ .jp-FileBrowser-toolbar > .jp-Toolbar-item,
82
+ .jp-FileBrowser-filterToolbar > .jp-Toolbar-item {
68
83
  flex: 0 0 auto;
69
84
  padding-left: 0;
70
85
  align-items: center;
@@ -72,7 +87,7 @@
72
87
  }
73
88
 
74
89
  .jp-FileBrowser-toolbar > .jp-Toolbar-item .jp-ToolbarButtonComponent {
75
- width: 40px;
90
+ width: 28px;
76
91
  }
77
92
 
78
93
  /*-----------------------------------------------------------------------------
@@ -87,19 +102,15 @@
87
102
  margin-top: 12px;
88
103
  }
89
104
 
90
- .jp-LastModified-hidden {
91
- display: none;
92
- }
93
-
94
- .jp-FileSize-hidden {
105
+ .jp-FileBrowser .lm-AccordionPanel > h3:first-child {
95
106
  display: none;
96
107
  }
97
108
 
98
- .jp-FileBrowser .lm-AccordionPanel > h3:first-child {
99
- display: none;
109
+ .jp-FileBrowser-filterToolbar > .jp-FileBrowser-filterBox {
110
+ width: 100%;
100
111
  }
101
112
 
102
- .jp-FileBrowser-toolbar > .jp-FileBrowser-filterBox {
113
+ .jp-FileBrowser-filterBox > .jp-FilterBox {
103
114
  width: 100%;
104
115
  }
105
116
 
@@ -132,24 +143,48 @@
132
143
  border-bottom: var(--jp-border-width) solid var(--jp-border-color1);
133
144
  box-shadow: var(--jp-toolbar-box-shadow);
134
145
  z-index: 2;
146
+ user-select: none;
135
147
  }
136
148
 
137
149
  .jp-DirListing-headerItem {
138
150
  padding: 4px 12px 2px;
139
151
  font-weight: 500;
152
+ overflow: hidden;
153
+ white-space: nowrap;
154
+ box-sizing: border-box;
155
+ display: flex;
156
+ }
157
+
158
+ .jp-DirListing-headerItemText {
159
+ flex-grow: 1;
160
+ text-overflow: ellipsis;
161
+ overflow: hidden;
162
+ }
163
+
164
+ .jp-DirListing-header > .jp-DirListing-headerItem:last-child {
165
+ flex-grow: 1;
140
166
  }
141
167
 
142
168
  .jp-DirListing-headerItem:hover {
143
169
  background: var(--jp-layout-color2);
144
170
  }
145
171
 
146
- .jp-DirListing-headerItem.jp-id-name {
172
+ .jp-DirListing-headerItem.jp-id-name:not([style*='width']) {
173
+ /* default width before user resizes this column */
147
174
  flex: 1 1 126px;
148
175
  }
149
176
 
150
- .jp-DirListing-headerItem.jp-id-modified {
177
+ .jp-DirListing-headerItem.jp-id-modified:not([style*='width']) {
178
+ /* default width before user resizes this column */
151
179
  flex: 1 0 70px;
152
- border-left: var(--jp-border-width) solid var(--jp-border-color2);
180
+ }
181
+
182
+ .jp-DirListing-headerItem.jp-id-filesize:not([style*='width']) {
183
+ /* default width before user resizes this column */
184
+ flex: 0 0 75px;
185
+ }
186
+
187
+ .jp-DirListing-headerItem.jp-id-modified {
153
188
  text-align: right;
154
189
  /* stylelint-disable */
155
190
  container-type: inline-size;
@@ -189,29 +224,9 @@
189
224
  }
190
225
 
191
226
  .jp-DirListing-headerItem.jp-id-filesize {
192
- flex: 0 0 75px;
193
- border-left: var(--jp-border-width) solid var(--jp-border-color2);
194
227
  text-align: right;
195
228
  }
196
229
 
197
- .jp-id-narrow {
198
- display: none;
199
- flex: 0 0 5px;
200
- padding: 4px;
201
- border-left: var(--jp-border-width) solid var(--jp-border-color2);
202
- text-align: right;
203
- color: var(--jp-border-color2);
204
- }
205
-
206
- .jp-DirListing-narrow .jp-id-narrow {
207
- display: block;
208
- }
209
-
210
- .jp-DirListing-narrow .jp-id-modified,
211
- .jp-DirListing-narrow .jp-DirListing-itemModified {
212
- display: none;
213
- }
214
-
215
230
  .jp-DirListing-headerItem.jp-mod-selected {
216
231
  font-weight: 600;
217
232
  }
@@ -245,7 +260,6 @@
245
260
 
246
261
  .jp-DirListing-item {
247
262
  display: flex;
248
- flex-direction: row;
249
263
  align-items: center;
250
264
  padding: 4px 12px;
251
265
  -webkit-user-select: none;
@@ -254,6 +268,11 @@
254
268
  user-select: none;
255
269
  }
256
270
 
271
+ .jp-DirListing-item > :last-child {
272
+ flex-grow: 1;
273
+ margin-right: 2px;
274
+ }
275
+
257
276
  .jp-DirListing-checkboxWrapper {
258
277
  /* Increases hit area of checkbox. */
259
278
  padding: 4px;
@@ -288,6 +307,33 @@
288
307
  }
289
308
  }
290
309
 
310
+ .jp-DirListing-resizeHandle {
311
+ min-width: var(--jp-border-width);
312
+ background: var(--jp-border-color2);
313
+ height: calc(100% - 4px);
314
+
315
+ /* border increases the area where handle can be grabbed */
316
+ border: 2px solid var(--jp-layout-color1);
317
+ }
318
+
319
+ .jp-DirListing-resizeHandle.jp-mod-active {
320
+ background: var(--jp-brand-color1);
321
+ border-color: var(--jp-brand-color1);
322
+ }
323
+
324
+ .jp-DirListing-resizeHandle.jp-mod-active:hover {
325
+ border-color: var(--jp-brand-color1);
326
+ }
327
+
328
+ .jp-DirListing-resizeHandle:hover {
329
+ cursor: col-resize;
330
+ border-color: var(--jp-border-color2);
331
+ }
332
+
333
+ .jp-DirListing-itemName {
334
+ display: flex;
335
+ }
336
+
291
337
  .jp-DirListing-item[data-is-dot] {
292
338
  opacity: 75%;
293
339
  }
@@ -310,12 +356,16 @@
310
356
  margin-right: 4px;
311
357
  }
312
358
 
313
- .jp-DirListing-itemText {
314
- flex: 1 1 106px;
315
- white-space: nowrap;
359
+ .jp-DirListing-itemText,
360
+ .jp-DirListing-itemModified,
361
+ .jp-DirListing-itemFileSize {
316
362
  overflow: hidden;
317
363
  text-overflow: ellipsis;
318
- user-select: none;
364
+ white-space: nowrap;
365
+ }
366
+
367
+ .jp-DirListing-itemName:not([style*='width']) > .jp-DirListing-itemText {
368
+ flex: 1 1 106px;
319
369
  }
320
370
 
321
371
  .jp-DirListing-item:has(.jp-DirListing-itemText:focus-visible) {
@@ -331,17 +381,15 @@
331
381
  outline-color: var(--jp-layout-color1);
332
382
  }
333
383
 
334
- .jp-DirListing-item > .jp-DirListing-itemText:focus {
384
+ .jp-DirListing-item > .jp-DirListing-itemName > .jp-DirListing-itemText:focus {
335
385
  outline: 0;
336
386
  }
337
387
 
338
388
  .jp-DirListing-itemModified {
339
- flex: 1 0 83px;
340
389
  text-align: right;
341
390
  }
342
391
 
343
392
  .jp-DirListing-itemFileSize {
344
- flex: 0 0 90px;
345
393
  text-align: right;
346
394
  }
347
395