@jupyterlab/filebrowser 4.3.0-alpha.2 → 4.3.0-beta.1

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
@@ -102,14 +102,6 @@
102
102
  margin-top: 12px;
103
103
  }
104
104
 
105
- .jp-LastModified-hidden {
106
- display: none;
107
- }
108
-
109
- .jp-FileSize-hidden {
110
- display: none;
111
- }
112
-
113
105
  .jp-FileBrowser .lm-AccordionPanel > h3:first-child {
114
106
  display: none;
115
107
  }
@@ -151,24 +143,48 @@
151
143
  border-bottom: var(--jp-border-width) solid var(--jp-border-color1);
152
144
  box-shadow: var(--jp-toolbar-box-shadow);
153
145
  z-index: 2;
146
+ user-select: none;
154
147
  }
155
148
 
156
149
  .jp-DirListing-headerItem {
157
150
  padding: 4px 12px 2px;
158
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;
159
166
  }
160
167
 
161
168
  .jp-DirListing-headerItem:hover {
162
169
  background: var(--jp-layout-color2);
163
170
  }
164
171
 
165
- .jp-DirListing-headerItem.jp-id-name {
172
+ .jp-DirListing-headerItem.jp-id-name:not([style*='width']) {
173
+ /* default width before user resizes this column */
166
174
  flex: 1 1 126px;
167
175
  }
168
176
 
169
- .jp-DirListing-headerItem.jp-id-modified {
177
+ .jp-DirListing-headerItem.jp-id-modified:not([style*='width']) {
178
+ /* default width before user resizes this column */
170
179
  flex: 1 0 70px;
171
- 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 {
172
188
  text-align: right;
173
189
  /* stylelint-disable */
174
190
  container-type: inline-size;
@@ -208,27 +224,7 @@
208
224
  }
209
225
 
210
226
  .jp-DirListing-headerItem.jp-id-filesize {
211
- flex: 0 0 75px;
212
- border-left: var(--jp-border-width) solid var(--jp-border-color2);
213
- text-align: right;
214
- }
215
-
216
- .jp-id-narrow {
217
- display: none;
218
- flex: 0 0 5px;
219
- padding: 4px;
220
- border-left: var(--jp-border-width) solid var(--jp-border-color2);
221
227
  text-align: right;
222
- color: var(--jp-border-color2);
223
- }
224
-
225
- .jp-DirListing-narrow .jp-id-narrow {
226
- display: block;
227
- }
228
-
229
- .jp-DirListing-narrow .jp-id-modified,
230
- .jp-DirListing-narrow .jp-DirListing-itemModified {
231
- display: none;
232
228
  }
233
229
 
234
230
  .jp-DirListing-headerItem.jp-mod-selected {
@@ -264,7 +260,6 @@
264
260
 
265
261
  .jp-DirListing-item {
266
262
  display: flex;
267
- flex-direction: row;
268
263
  align-items: center;
269
264
  padding: 4px 12px;
270
265
  -webkit-user-select: none;
@@ -273,6 +268,11 @@
273
268
  user-select: none;
274
269
  }
275
270
 
271
+ .jp-DirListing-item > :last-child {
272
+ flex-grow: 1;
273
+ margin-right: 2px;
274
+ }
275
+
276
276
  .jp-DirListing-checkboxWrapper {
277
277
  /* Increases hit area of checkbox. */
278
278
  padding: 4px;
@@ -307,6 +307,33 @@
307
307
  }
308
308
  }
309
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
+
310
337
  .jp-DirListing-item[data-is-dot] {
311
338
  opacity: 75%;
312
339
  }
@@ -329,12 +356,16 @@
329
356
  margin-right: 4px;
330
357
  }
331
358
 
332
- .jp-DirListing-itemText {
333
- flex: 1 1 106px;
334
- white-space: nowrap;
359
+ .jp-DirListing-itemText,
360
+ .jp-DirListing-itemModified,
361
+ .jp-DirListing-itemFileSize {
335
362
  overflow: hidden;
336
363
  text-overflow: ellipsis;
337
- user-select: none;
364
+ white-space: nowrap;
365
+ }
366
+
367
+ .jp-DirListing-itemName:not([style*='width']) > .jp-DirListing-itemText {
368
+ flex: 1 1 106px;
338
369
  }
339
370
 
340
371
  .jp-DirListing-item:has(.jp-DirListing-itemText:focus-visible) {
@@ -350,17 +381,15 @@
350
381
  outline-color: var(--jp-layout-color1);
351
382
  }
352
383
 
353
- .jp-DirListing-item > .jp-DirListing-itemText:focus {
384
+ .jp-DirListing-item > .jp-DirListing-itemName > .jp-DirListing-itemText:focus {
354
385
  outline: 0;
355
386
  }
356
387
 
357
388
  .jp-DirListing-itemModified {
358
- flex: 1 0 83px;
359
389
  text-align: right;
360
390
  }
361
391
 
362
392
  .jp-DirListing-itemFileSize {
363
- flex: 0 0 90px;
364
393
  text-align: right;
365
394
  }
366
395