@conduction/nextcloud-vue 2.185.0 → 2.186.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.
Files changed (68) hide show
  1. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget.vue.js +1 -1
  2. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js +83 -2
  3. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js.map +1 -1
  4. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js +147 -104
  5. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js.map +1 -1
  6. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue.js +1 -1
  7. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js +41 -16
  8. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js.map +1 -1
  9. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid3.vue.js.map +1 -1
  10. package/dist/esm/components/CnDividerWidget/index.js +1 -0
  11. package/dist/esm/components/CnDividerWidget/index.js.map +1 -1
  12. package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
  13. package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js +158 -5
  14. package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js.map +1 -1
  15. package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js +109 -45
  16. package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js.map +1 -1
  17. package/dist/esm/components/CnHeaderWidget/index.js +0 -1
  18. package/dist/esm/components/CnHeaderWidget/index.js.map +1 -1
  19. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue.js +1 -1
  20. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js +17 -3
  21. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js.map +1 -1
  22. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js +3 -3
  23. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js.map +1 -1
  24. package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue.js +1 -1
  25. package/dist/esm/components/CnTabsWidget/CnTabsWidget2.vue.js +7 -0
  26. package/dist/esm/components/CnTabsWidget/CnTabsWidget2.vue.js.map +1 -1
  27. package/dist/esm/components/CnTabsWidget/CnTabsWidget3.vue.js.map +1 -1
  28. package/dist/esm/components/CnVideoWidget/CnVideoWidget.vue.js +1 -1
  29. package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js +63 -1
  30. package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js.map +1 -1
  31. package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js +20 -10
  32. package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js.map +1 -1
  33. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm.vue.js +1 -1
  34. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js +15 -0
  35. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js.map +1 -1
  36. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js +17 -10
  37. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js.map +1 -1
  38. package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
  39. package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js.map +1 -1
  40. package/dist/esm/dialogs/CnAddWidgetModal.vue.js +1 -1
  41. package/dist/esm/dialogs/CnAddWidgetModal2.vue.js +18 -4
  42. package/dist/esm/dialogs/CnAddWidgetModal2.vue.js.map +1 -1
  43. package/dist/esm/dialogs/CnAddWidgetModal3.vue.js +57 -39
  44. package/dist/esm/dialogs/CnAddWidgetModal3.vue.js.map +1 -1
  45. package/dist/esm/l10n/en.json.js +96 -1
  46. package/dist/esm/l10n/en.json.js.map +1 -1
  47. package/dist/esm/l10n/nl.json.js +96 -1
  48. package/dist/esm/l10n/nl.json.js.map +1 -1
  49. package/dist/esm/library-style.js +1 -1
  50. package/dist/esm/nextcloud-vue.css +257 -140
  51. package/dist/nextcloud-vue.cjs.js +2305 -1603
  52. package/dist/nextcloud-vue.cjs.js.map +2 -2
  53. package/dist/nextcloud-vue.css +257 -140
  54. package/l10n/en.json +96 -1
  55. package/l10n/nl.json +96 -1
  56. package/package.json +1 -1
  57. package/src/components/CnCalendarWidget/CnCalendarWidget.vue +217 -75
  58. package/src/components/CnDashboardGrid/CnDashboardGrid.md +1 -1
  59. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +41 -16
  60. package/src/components/CnDividerWidget/index.js +1 -0
  61. package/src/components/CnFilesWidget/CnFilesWidget.vue +278 -5
  62. package/src/components/CnHeaderWidget/index.js +0 -1
  63. package/src/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue +20 -6
  64. package/src/components/CnTabsWidget/CnTabsWidget.vue +7 -0
  65. package/src/components/CnVideoWidget/CnVideoWidget.vue +84 -1
  66. package/src/components/CnVideoWidgetForm/CnVideoWidgetForm.vue +19 -1
  67. package/src/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
  68. package/src/dialogs/CnAddWidgetModal.vue +53 -14
@@ -195,7 +195,7 @@ export default {
195
195
  name: 'CnDashboardGrid',
196
196
 
197
197
  props: {
198
- /** Array of layout items: { id, gridX, gridY, gridWidth, gridHeight, ...extra } */
198
+ /** Array of layout items: { id, gridX, gridY, gridWidth, gridHeight, minHeight?, ...extra }. An item's `minHeight` (layout rows) replaces the grid's own for that item. */
199
199
  layout: {
200
200
  type: Array,
201
201
  required: true,
@@ -750,8 +750,20 @@ export default {
750
750
  },
751
751
 
752
752
  /**
753
- * The smallest height an item may take, in grid rows: `minHeight`
754
- * layout rows, except for a size-to-content cell on split rows, which
753
+ * The smallest height an item may take, in layout rows: the item's own
754
+ * `minHeight` (a divider may be one row), else the grid's.
755
+ *
756
+ * @param {object} item The layout item.
757
+ * @return {number} The minimum height in layout rows.
758
+ */
759
+ itemMinHeight(item) {
760
+ const own = item && item.minHeight
761
+ return Number.isFinite(own) && own >= 1 ? Math.floor(own) : this.minHeight
762
+ },
763
+
764
+ /**
765
+ * The smallest height an item may take, in grid rows: its minimum
766
+ * height in layout rows, except for a size-to-content cell on split rows, which
755
767
  * may shrink to its content down to one grid row. The minimum is for
756
768
  * resizing by hand, and that only happens on whole rows in edit mode.
757
769
  *
@@ -763,7 +775,7 @@ export default {
763
775
  if (this.rowSplit !== 1 && this.sizeToContentAttr(item) !== undefined) {
764
776
  return 1
765
777
  }
766
- return this.minHeight * this.rowSplit
778
+ return this.itemMinHeight(item) * this.rowSplit
767
779
  },
768
780
 
769
781
  /**
@@ -1227,10 +1239,14 @@ export default {
1227
1239
  if (!this.grid || typeof this.grid.enable !== 'function') {
1228
1240
  return
1229
1241
  }
1242
+ // On the raw grid: enabled through Vue's proxy, GridStack binds its
1243
+ // drag handlers to the proxy and a drop never ends, so the move is
1244
+ // shown but no `change` follows.
1245
+ const grid = toRaw(this.grid)
1230
1246
  if (this.editable && !this.reflowed) {
1231
- this.grid.enable()
1247
+ grid.enable()
1232
1248
  } else {
1233
- this.grid.disable()
1249
+ grid.disable()
1234
1250
  }
1235
1251
  },
1236
1252
 
@@ -1415,12 +1431,13 @@ export default {
1415
1431
  * edge instead of pushing it into negative coordinates.
1416
1432
  *
1417
1433
  * @param {{x: number, y: number, w: number, h: number}} rect the candidate.
1434
+ * @param {object} [item] the layout item, whose own `minHeight` applies.
1418
1435
  * @return {{x: number, y: number, w: number, h: number}} the clamped rectangle.
1419
1436
  */
1420
- clampRect(rect) {
1437
+ clampRect(rect, item) {
1421
1438
  const cols = this.effectiveColumns
1422
1439
  const w = Math.min(Math.max(rect.w, this.minWidth), cols)
1423
- const h = Math.max(rect.h, this.minHeight)
1440
+ const h = Math.max(rect.h, item ? this.itemMinHeight(item) : this.minHeight)
1424
1441
  return {
1425
1442
  x: Math.min(Math.max(rect.x, 0), Math.max(cols - w, 0)),
1426
1443
  y: Math.max(rect.y, 0),
@@ -1453,7 +1470,7 @@ export default {
1453
1470
  }
1454
1471
 
1455
1472
  const current = this.currentRect(item)
1456
- const next = this.clampRect({ ...current, ...patch })
1473
+ const next = this.clampRect({ ...current, ...patch }, item)
1457
1474
 
1458
1475
  if (next.x === current.x && next.y === current.y
1459
1476
  && next.w === current.w && next.h === current.h) {
@@ -1463,7 +1480,7 @@ export default {
1463
1480
  return true
1464
1481
  }
1465
1482
 
1466
- this.grid.update(el, next)
1483
+ toRaw(this.grid).update(el, next)
1467
1484
 
1468
1485
  this.announce(kind === 'resize'
1469
1486
  ? t('nextcloud-vue', '{label} resized to {width} columns by {height} rows', {
@@ -1695,13 +1712,14 @@ export default {
1695
1712
  if (!this.grid || !this.$refs.gridContainer) {
1696
1713
  return
1697
1714
  }
1715
+ const grid = toRaw(this.grid)
1698
1716
  const added = []
1699
1717
  for (const item of this.itemsInRowOrder) {
1700
1718
  const el = this.$refs.gridContainer.querySelector(`[gs-id="${item.id}"]`)
1701
1719
  if (!el) {
1702
1720
  continue
1703
1721
  }
1704
- const node = this.grid.engine.nodes.find((n) => String(n.id) === String(item.id))
1722
+ const node = grid.engine.nodes.find((n) => String(n.id) === String(item.id))
1705
1723
  if (!node) {
1706
1724
  added.push(el)
1707
1725
  } else if (node.el === el) {
@@ -1712,16 +1730,23 @@ export default {
1712
1730
  // where the hidden widget had been. A drag reports the
1713
1731
  // grid's own position back, which matches and does
1714
1732
  // nothing here.
1733
+ // A width or height the layout changed (a form, an
1734
+ // undo) is synced the same way. A size-to-content cell
1735
+ // keeps the height its content gave it.
1715
1736
  const x = item.gridX ?? node.x
1716
1737
  const y = Number.isFinite(item.gridY) ? item.gridY * this.rowSplit : node.y
1717
- if (x !== node.x || y !== node.y) {
1738
+ const w = Number.isFinite(item.gridWidth) ? item.gridWidth : node.w
1739
+ const h = Number.isFinite(item.gridHeight) && this.sizeToContentAttr(item) === undefined
1740
+ ? item.gridHeight * this.rowSplit
1741
+ : node.h
1742
+ if (x !== node.x || y !== node.y || w !== node.w || h !== node.h) {
1718
1743
  // The layout said where it goes; GridStack's `change`
1719
1744
  // for it is not a user's arrangement and is not
1720
1745
  // reported back (it would write the display-only
1721
1746
  // compaction into the authored layout).
1722
1747
  this.applyingLayout = true
1723
1748
  try {
1724
- this.grid.update(el, { x, y })
1749
+ grid.update(el, { x, y, w, h })
1725
1750
  } finally {
1726
1751
  this.applyingLayout = false
1727
1752
  }
@@ -1729,8 +1754,8 @@ export default {
1729
1754
  } else {
1730
1755
  // Drop the stale node without touching its detached DOM,
1731
1756
  // then adopt the new element so GridStack sizes/places it.
1732
- this.grid.removeWidget(node.el, false, false)
1733
- this.grid.makeWidget(el)
1757
+ grid.removeWidget(node.el, false, false)
1758
+ grid.makeWidget(el)
1734
1759
  }
1735
1760
  }
1736
1761
  this.addWidgetsInOrder(added)
@@ -1742,7 +1767,7 @@ export default {
1742
1767
  for (const node of toRemove) {
1743
1768
  const el = this.$refs.gridContainer.querySelector(`[gs-id="${node.id}"]`)
1744
1769
  if (el) {
1745
- this.grid.removeWidget(el, false)
1770
+ toRaw(this.grid).removeWidget(el, false)
1746
1771
  }
1747
1772
  }
1748
1773
 
@@ -15,6 +15,7 @@ registerDashboardWidget('divider', {
15
15
  },
16
16
  displayName: 'Divider',
17
17
  icon: 'Minus',
18
+ minHeight: 1,
18
19
  })
19
20
 
20
21
  export { CnDividerWidget }
@@ -83,6 +83,48 @@
83
83
  {{ t('nextcloud-vue', 'Drop files to upload') }}
84
84
  </div>
85
85
 
86
+ <div v-if="uploads.length > 0" class="cn-files-widget__uploads" role="status">
87
+ <p class="cn-files-widget__uploads-total">
88
+ {{ uploadTotalLabel }}
89
+ <button
90
+ v-if="!uploading"
91
+ type="button"
92
+ class="cn-files-widget__notice-dismiss"
93
+ @click="dismissUploads">
94
+ {{ t('nextcloud-vue', 'Dismiss') }}
95
+ </button>
96
+ </p>
97
+ <ul class="cn-files-widget__uploads-list">
98
+ <li
99
+ v-for="(upload, index) in uploads"
100
+ :key="index"
101
+ class="cn-files-widget__progress-item"
102
+ :class="'cn-files-widget__progress-item--' + upload.status">
103
+ <span class="cn-files-widget__upload-name">{{ upload.name }}</span>
104
+ <span
105
+ class="cn-files-widget__upload-progress"
106
+ role="progressbar"
107
+ :aria-label="upload.name"
108
+ aria-valuemin="0"
109
+ aria-valuemax="100"
110
+ :aria-valuenow="uploadPercent(upload)">
111
+ <span class="cn-files-widget__upload-bar" :style="{ width: uploadPercent(upload) + '%' }" />
112
+ </span>
113
+ <span class="cn-files-widget__upload-status">{{ uploadStatusLabel(upload) }}</span>
114
+ </li>
115
+ </ul>
116
+ </div>
117
+
118
+ <div v-if="deleteNotice" class="cn-files-widget__notice" role="alert">
119
+ <span>{{ deleteNotice }}</span>
120
+ <button
121
+ type="button"
122
+ class="cn-files-widget__notice-dismiss"
123
+ @click="deleteNotice = null">
124
+ {{ t('nextcloud-vue', 'Dismiss') }}
125
+ </button>
126
+ </div>
127
+
86
128
  <div v-if="loading" class="cn-files-widget__state">
87
129
  {{ t('nextcloud-vue', 'Loading folder…') }}
88
130
  </div>
@@ -192,7 +234,7 @@
192
234
  </template>
193
235
 
194
236
  <script>
195
- import { translate as t } from '@nextcloud/l10n'
237
+ import { translatePlural as n, translate as t } from '@nextcloud/l10n'
196
238
  import { generateUrl } from '@nextcloud/router'
197
239
  import CnFilesWidgetDeleteDialog from '../../dialogs/CnFilesWidgetDeleteDialog.vue'
198
240
  import CnFilePreview from '../CnFilePreview/CnFilePreview.vue'
@@ -349,6 +391,13 @@ export default {
349
391
  isDragging: false,
350
392
  // Depth counter so nested dragenter/dragleave don't flicker the overlay.
351
393
  dragDepth: 0,
394
+ // The files of the current or last upload batch, each
395
+ // `{ name, size, loaded, status, error }` with status `queued`,
396
+ // `uploading`, `done` or `failed`.
397
+ uploads: [],
398
+ uploading: false,
399
+ // Why the last delete was refused, shown until dismissed.
400
+ deleteNotice: null,
352
401
  }
353
402
  },
354
403
 
@@ -448,9 +497,35 @@ export default {
448
497
  * @return {boolean} `true` unless `content.showThumbnails` is explicitly false.
449
498
  */
450
499
  showThumbnails() {
500
+ // Tree mode lists names only, whatever `showThumbnails` says.
501
+ if (this.content?.viewMode === 'tree') {
502
+ return false
503
+ }
451
504
  return this.content?.showThumbnails !== false
452
505
  },
453
506
 
507
+ /**
508
+ * The batch line above the upload list: bytes sent of the total while
509
+ * uploading, then how many files arrived.
510
+ *
511
+ * @return {string} the label.
512
+ */
513
+ uploadTotalLabel() {
514
+ const total = this.uploads.reduce((sum, upload) => sum + upload.size, 0)
515
+ if (this.uploading) {
516
+ const loaded = this.uploads.reduce((sum, upload) => sum + upload.loaded, 0)
517
+ return t('nextcloud-vue', 'Uploading {loaded} / {total}', {
518
+ loaded: this.formatSize(loaded),
519
+ total: this.formatSize(total),
520
+ })
521
+ }
522
+ const failed = this.uploads.filter((upload) => upload.status === 'failed').length
523
+ if (failed > 0) {
524
+ return n('nextcloud-vue', '{count} file could not be uploaded', '{count} files could not be uploaded', failed, { count: failed })
525
+ }
526
+ return t('nextcloud-vue', 'Upload complete')
527
+ },
528
+
454
529
  /**
455
530
  * Heuristic write-permission check: an empty folder optimistically
456
531
  * surfaces the upload button (the backend re-validates), otherwise at
@@ -895,6 +970,7 @@ export default {
895
970
  if (!target) {
896
971
  return
897
972
  }
973
+ this.deleteNotice = null
898
974
  try {
899
975
  const { default: axios } = await import('@nextcloud/axios')
900
976
 
@@ -909,7 +985,10 @@ export default {
909
985
  )
910
986
  await axios.delete(url)
911
987
  this.items = this.items.filter((item) => item.fileId !== target.fileId)
912
- } catch {
988
+ } catch (err) {
989
+ this.deleteNotice = err?.response?.status === 403
990
+ ? t('nextcloud-vue', 'You no longer have permission to delete {name}.', { name: target.name })
991
+ : t('nextcloud-vue', 'Could not delete {name}.', { name: target.name })
913
992
  this.fetchContents()
914
993
  } finally {
915
994
  this.confirmTarget = null
@@ -955,32 +1034,148 @@ export default {
955
1034
  }
956
1035
 
957
1036
  const formData = new FormData()
1037
+ const files = []
958
1038
  for (let i = 0; i < fileList.length; i++) {
959
1039
  formData.append('files[]', fileList[i])
1040
+ files.push(fileList[i])
960
1041
  }
1042
+ this.uploads = files.map((file) => ({ name: file.name, size: Number(file.size) || 0, loaded: 0, status: 'queued', error: '' }))
1043
+ this.uploading = true
1044
+ const onUploadProgress = (event) => this.trackUploadProgress(event)
961
1045
 
962
1046
  try {
963
1047
  const { default: axios } = await import('@nextcloud/axios')
964
1048
 
1049
+ let response
965
1050
  if (this.objectBound) {
966
1051
  const objectUrl = generateUrl(
967
1052
  `${this.objectApiBase}/objects/{register}/{schema}/{objectId}/filesMultipart`,
968
1053
  { register: this.register, schema: this.schemaSlug, objectId: this.objectId },
969
1054
  )
970
- await axios.post(objectUrl, formData)
1055
+ response = await axios.post(objectUrl, formData, { onUploadProgress })
971
1056
  } else {
972
1057
  const url = generateUrl(
973
1058
  `${this.apiBase}/api/widgets/files/{placementId}/upload`,
974
1059
  { placementId: this.placementId },
975
1060
  )
976
- await axios.post(url, formData, {
1061
+ response = await axios.post(url, formData, {
977
1062
  params: { currentPath: this.currentSubPath },
1063
+ onUploadProgress,
978
1064
  })
979
1065
  }
1066
+ this.settleUploads(Array.isArray(response?.data?.errors) ? response.data.errors : [])
980
1067
  this.fetchContents()
981
- } catch {
1068
+ } catch (err) {
1069
+ const reason = this.uploadErrorLabel(err?.response?.data?.error)
1070
+ this.uploads = this.uploads.map((upload) => ({ ...upload, status: 'failed', error: reason }))
982
1071
  this.fetchContents()
1072
+ } finally {
1073
+ this.uploading = false
1074
+ }
1075
+ },
1076
+
1077
+ /**
1078
+ * Spread the batch's sent bytes over its files in upload order: the
1079
+ * files before the byte count are done sending, the one it falls in is
1080
+ * uploading, the rest are queued.
1081
+ *
1082
+ * @param {{loaded: number, total?: number}} event axios' upload progress.
1083
+ * @return {void}
1084
+ */
1085
+ trackUploadProgress(event) {
1086
+ const size = this.uploads.reduce((sum, upload) => sum + upload.size, 0)
1087
+ const total = Number(event?.total) || size
1088
+ const scale = total > 0 ? size / total : 0
1089
+ let remaining = Number(event?.loaded || 0) * scale
1090
+ this.uploads = this.uploads.map((upload) => {
1091
+ const loaded = Math.max(0, Math.min(upload.size, remaining))
1092
+ remaining -= upload.size
1093
+ let status = 'queued'
1094
+ if (loaded >= upload.size && upload.size > 0) {
1095
+ status = 'done'
1096
+ } else if (loaded > 0) {
1097
+ status = 'uploading'
1098
+ }
1099
+ return { ...upload, loaded, status }
1100
+ })
1101
+ },
1102
+
1103
+ /**
1104
+ * Mark the batch finished: a file the host names in `errors`
1105
+ * (`{ name, error }`) failed with that reason, every other one arrived.
1106
+ *
1107
+ * @param {Array<{name: string, error?: string}>} errors the host's per-file errors.
1108
+ * @return {void}
1109
+ */
1110
+ settleUploads(errors) {
1111
+ const byName = new Map(errors.map((entry) => [String(entry?.name ?? ''), entry]))
1112
+ this.uploads = this.uploads.map((upload) => {
1113
+ const entry = byName.get(upload.name)
1114
+ if (entry) {
1115
+ return { ...upload, status: 'failed', error: this.uploadErrorLabel(entry.error) }
1116
+ }
1117
+ return { ...upload, loaded: upload.size, status: 'done', error: '' }
1118
+ })
1119
+ },
1120
+
1121
+ /**
1122
+ * The reason shown for a file that did not upload, from the host's code.
1123
+ *
1124
+ * @param {string|undefined} code the error code (`insufficient_storage`, …).
1125
+ * @return {string} the localised reason.
1126
+ */
1127
+ uploadErrorLabel(code) {
1128
+ if (code === 'insufficient_storage') {
1129
+ return t('nextcloud-vue', 'Not enough storage space')
1130
+ }
1131
+ if (code === 'no_access' || code === 'forbidden') {
1132
+ return t('nextcloud-vue', 'You may not upload to this folder')
1133
+ }
1134
+ if (code === 'mime_type_not_allowed' || code === 'mime_not_allowed') {
1135
+ return t('nextcloud-vue', 'This file type is not allowed here')
983
1136
  }
1137
+ return t('nextcloud-vue', 'Upload failed')
1138
+ },
1139
+
1140
+ /**
1141
+ * The percentage of one file sent, for its progress bar.
1142
+ *
1143
+ * @param {object} upload an entry of `uploads`.
1144
+ * @return {number} 0 to 100.
1145
+ */
1146
+ uploadPercent(upload) {
1147
+ if (upload.status === 'done') {
1148
+ return 100
1149
+ }
1150
+ return upload.size > 0 ? Math.round((upload.loaded / upload.size) * 100) : 0
1151
+ },
1152
+
1153
+ /**
1154
+ * The status text of one file in the upload list.
1155
+ *
1156
+ * @param {object} upload an entry of `uploads`.
1157
+ * @return {string} the label.
1158
+ */
1159
+ uploadStatusLabel(upload) {
1160
+ if (upload.status === 'failed') {
1161
+ return upload.error
1162
+ }
1163
+ if (upload.status === 'done') {
1164
+ return this.uploading ? t('nextcloud-vue', 'Sent') : t('nextcloud-vue', 'Uploaded')
1165
+ }
1166
+ if (upload.status === 'uploading') {
1167
+ return t('nextcloud-vue', 'Uploading {percent}%', { percent: this.uploadPercent(upload) })
1168
+ }
1169
+ return t('nextcloud-vue', 'Queued')
1170
+ },
1171
+
1172
+ /**
1173
+ * Clear a finished upload list.
1174
+ *
1175
+ * @return {void}
1176
+ */
1177
+ dismissUploads() {
1178
+ this.uploads = []
984
1179
  },
985
1180
 
986
1181
  /**
@@ -1307,6 +1502,84 @@ export default {
1307
1502
  display: none;
1308
1503
  }
1309
1504
 
1505
+ .cn-files-widget__uploads,
1506
+ .cn-files-widget__notice {
1507
+ margin: 4px 0 8px;
1508
+ padding: 8px 12px;
1509
+ border: 1px solid var(--color-border);
1510
+ border-radius: var(--border-radius);
1511
+ font-size: 13px;
1512
+ }
1513
+
1514
+ .cn-files-widget__notice {
1515
+ display: flex;
1516
+ align-items: center;
1517
+ justify-content: space-between;
1518
+ gap: 8px;
1519
+ border-color: var(--color-error);
1520
+ }
1521
+
1522
+ .cn-files-widget__uploads-total {
1523
+ display: flex;
1524
+ justify-content: space-between;
1525
+ gap: 8px;
1526
+ margin: 0 0 4px;
1527
+ font-weight: 600;
1528
+ }
1529
+
1530
+ .cn-files-widget__uploads-list {
1531
+ margin: 0;
1532
+ padding: 0;
1533
+ list-style: none;
1534
+ }
1535
+
1536
+ .cn-files-widget__progress-item {
1537
+ display: grid;
1538
+ grid-template-columns: minmax(0, 1fr) 80px auto;
1539
+ align-items: center;
1540
+ gap: 8px;
1541
+ padding: 2px 0;
1542
+ }
1543
+
1544
+ .cn-files-widget__upload-name {
1545
+ overflow: hidden;
1546
+ text-overflow: ellipsis;
1547
+ white-space: nowrap;
1548
+ }
1549
+
1550
+ .cn-files-widget__upload-progress {
1551
+ display: block;
1552
+ height: 6px;
1553
+ overflow: hidden;
1554
+ border-radius: 3px;
1555
+ background: var(--color-background-dark);
1556
+ }
1557
+
1558
+ .cn-files-widget__upload-bar {
1559
+ display: block;
1560
+ height: 100%;
1561
+ background: var(--color-primary-element);
1562
+ }
1563
+
1564
+ .cn-files-widget__progress-item--failed .cn-files-widget__upload-status {
1565
+ color: var(--color-error-text, var(--color-error));
1566
+ }
1567
+
1568
+ .cn-files-widget__upload-status {
1569
+ color: var(--color-text-maxcontrast);
1570
+ }
1571
+
1572
+ .cn-files-widget__notice-dismiss {
1573
+ padding: 0;
1574
+ border: none;
1575
+ background: transparent;
1576
+ color: inherit;
1577
+ font: inherit;
1578
+ font-weight: normal;
1579
+ text-decoration: underline;
1580
+ cursor: pointer;
1581
+ }
1582
+
1310
1583
  .cn-files-widget__pagination {
1311
1584
  text-align: center;
1312
1585
  padding: 8px 0;
@@ -19,7 +19,6 @@ registerDashboardWidget('header', {
19
19
  backgroundImageUrl: '',
20
20
  backgroundImageFileId: null,
21
21
  backgroundColor: '',
22
- overlayMode: 'none',
23
22
  overlayColor: '',
24
23
  overlayOpacity: 0.4,
25
24
  textColor: '',
@@ -84,7 +84,7 @@
84
84
  </label>
85
85
 
86
86
  <NcSelect
87
- :modelValue="overlayMode"
87
+ :modelValue="effectiveOverlayMode"
88
88
  :options="overlayModeOptions"
89
89
  :inputLabel="t('nextcloud-vue', 'Overlay mode')"
90
90
  :reduce="(option) => option.value"
@@ -92,7 +92,7 @@
92
92
  :clearable="false"
93
93
  @update:modelValue="updateField('overlayMode', $event)" />
94
94
 
95
- <label v-if="overlayMode !== 'none'" class="cn-header-widget-form__color-label">
95
+ <label v-if="effectiveOverlayMode !== 'none'" class="cn-header-widget-form__color-label">
96
96
  {{ t('nextcloud-vue', 'Overlay color') }}
97
97
  <CnColorPicker
98
98
  :value="overlayColor"
@@ -101,7 +101,7 @@
101
101
  @clear="updateField('overlayColor', '')" />
102
102
  </label>
103
103
 
104
- <label v-if="overlayMode === 'tint'" class="cn-header-widget-form__field">
104
+ <label v-if="effectiveOverlayMode === 'tint'" class="cn-header-widget-form__field">
105
105
  <span class="cn-header-widget-form__label">
106
106
  {{ t('nextcloud-vue', 'Overlay opacity') }} ({{ overlayOpacity.toFixed(2) }})
107
107
  </span>
@@ -194,7 +194,6 @@ const DEFAULT_CONTENT = Object.freeze({
194
194
  backgroundImageUrl: '',
195
195
  backgroundImageFileId: null,
196
196
  backgroundColor: '',
197
- overlayMode: 'none',
198
197
  overlayColor: '',
199
198
  overlayOpacity: 0.4,
200
199
  textColor: '',
@@ -316,9 +315,11 @@ export default {
316
315
  ? initial.backgroundColor
317
316
  : DEFAULT_CONTENT.backgroundColor,
318
317
 
318
+ // Empty until chosen: an unset mode is stored as no value, so the
319
+ // renderer keeps its default (`tint` over an image, else `none`).
319
320
  overlayMode: ALLOWED_OVERLAY_MODES.includes(initial.overlayMode)
320
321
  ? initial.overlayMode
321
- : DEFAULT_CONTENT.overlayMode,
322
+ : '',
322
323
 
323
324
  overlayColor: typeof initial.overlayColor === 'string'
324
325
  ? initial.overlayColor
@@ -356,6 +357,19 @@ export default {
356
357
  },
357
358
 
358
359
  computed: {
360
+ /**
361
+ * The overlay mode the select shows and the overlay fields follow: the
362
+ * chosen one, else the renderer's default (`tint` over an image).
363
+ *
364
+ * @return {string} `none`, `tint` or `gradient-bottom`.
365
+ */
366
+ effectiveOverlayMode() {
367
+ if (this.overlayMode) {
368
+ return this.overlayMode
369
+ }
370
+ return this.backgroundImageUrl || this.backgroundImageFileId !== null || this.pendingFile ? 'tint' : 'none'
371
+ },
372
+
359
373
  /** Overlay-mode select options. */
360
374
  overlayModeOptions() {
361
375
  return [
@@ -450,7 +464,7 @@ export default {
450
464
  backgroundImageUrl: this.backgroundImageUrl,
451
465
  backgroundImageFileId: this.backgroundImageFileId,
452
466
  backgroundColor: this.backgroundColor,
453
- overlayMode: this.overlayMode,
467
+ ...(this.overlayMode ? { overlayMode: this.overlayMode } : {}),
454
468
  overlayColor: this.overlayColor,
455
469
  overlayOpacity: this.overlayOpacity,
456
470
  textColor: this.textColor,
@@ -231,6 +231,7 @@ import CnTabs from '../CnTabs/CnTabs.vue'
231
231
  import CnWidgetHeaderActionButtons from '../CnWidgetWrapper/CnWidgetHeaderActionButtons.vue'
232
232
  import { normalizeLook } from '../../composables/useLook.js'
233
233
  import { dispatchAction } from '../../utils/actionsDispatcher.js'
234
+ import { isAppInstalled } from '../../utils/appInstalled.js'
234
235
  import { auditExclusionParams, keepAuditEntries } from '../../utils/auditEntries.js'
235
236
  import { headerLinkTarget, resolveHeaderLink, widgetHeaderLink } from '../../utils/contentHeaderLink.js'
236
237
  import { resolveTabCount } from '../../utils/detailActionModel.js'
@@ -1512,6 +1513,12 @@ export default {
1512
1513
  * @spec openspec/changes/screens-tab-counts-parity/specs/tab-counts/spec.md#requirement-a-tab-can-count-its-list
1513
1514
  */
1514
1515
  countSourceOf(tab) {
1516
+ // A tab shown only with another app installed counts nothing without it:
1517
+ // its list lives in that app, and asking would answer 404.
1518
+ const needs = tab && typeof tab === 'object' && tab.visibleWhen ? tab.visibleWhen.appInstalled : null
1519
+ if (typeof needs === 'string' && needs !== '' && !isAppInstalled(needs)) {
1520
+ return null
1521
+ }
1515
1522
  const from = tab && typeof tab === 'object' ? tab.countFrom : null
1516
1523
  let source = null
1517
1524
  if (from === 'widget') {