@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.
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget.vue.js +1 -1
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js +83 -2
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js +147 -104
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue.js +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js +41 -16
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid3.vue.js.map +1 -1
- package/dist/esm/components/CnDividerWidget/index.js +1 -0
- package/dist/esm/components/CnDividerWidget/index.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js +158 -5
- package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js +109 -45
- package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnHeaderWidget/index.js +0 -1
- package/dist/esm/components/CnHeaderWidget/index.js.map +1 -1
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js +17 -3
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js.map +1 -1
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js +3 -3
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js.map +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue.js +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget2.vue.js +7 -0
- package/dist/esm/components/CnTabsWidget/CnTabsWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget.vue.js +1 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js +63 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js +20 -10
- package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js +15 -0
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js +17 -10
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js.map +1 -1
- package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
- package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js.map +1 -1
- package/dist/esm/dialogs/CnAddWidgetModal.vue.js +1 -1
- package/dist/esm/dialogs/CnAddWidgetModal2.vue.js +18 -4
- package/dist/esm/dialogs/CnAddWidgetModal2.vue.js.map +1 -1
- package/dist/esm/dialogs/CnAddWidgetModal3.vue.js +57 -39
- package/dist/esm/dialogs/CnAddWidgetModal3.vue.js.map +1 -1
- package/dist/esm/l10n/en.json.js +96 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +96 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +257 -140
- package/dist/nextcloud-vue.cjs.js +2305 -1603
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +257 -140
- package/l10n/en.json +96 -1
- package/l10n/nl.json +96 -1
- package/package.json +1 -1
- package/src/components/CnCalendarWidget/CnCalendarWidget.vue +217 -75
- package/src/components/CnDashboardGrid/CnDashboardGrid.md +1 -1
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +41 -16
- package/src/components/CnDividerWidget/index.js +1 -0
- package/src/components/CnFilesWidget/CnFilesWidget.vue +278 -5
- package/src/components/CnHeaderWidget/index.js +0 -1
- package/src/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue +20 -6
- package/src/components/CnTabsWidget/CnTabsWidget.vue +7 -0
- package/src/components/CnVideoWidget/CnVideoWidget.vue +84 -1
- package/src/components/CnVideoWidgetForm/CnVideoWidgetForm.vue +19 -1
- package/src/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
- package/src/dialogs/CnAddWidgetModal.vue +53 -14
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
<div v-if="!hasSource" class="cn-video-widget__placeholder">
|
|
11
11
|
<VideoIcon :size="48" :fillColor="placeholderColor" />
|
|
12
12
|
<span class="cn-video-widget__placeholder-label">{{ t('nextcloud-vue', 'No video URL configured') }}</span>
|
|
13
|
+
<span class="cn-video-widget__placeholder-help">{{ t('nextcloud-vue', 'Edit the widget to add a video') }}</span>
|
|
14
|
+
<button
|
|
15
|
+
v-if="canEdit"
|
|
16
|
+
type="button"
|
|
17
|
+
class="cn-video-widget__configure"
|
|
18
|
+
@click="$emit('edit')">
|
|
19
|
+
{{ t('nextcloud-vue', 'Configure now') }}
|
|
20
|
+
</button>
|
|
13
21
|
</div>
|
|
14
22
|
<div v-else-if="hasError" class="cn-video-widget__placeholder">
|
|
15
23
|
<VideoIcon :size="48" :fillColor="placeholderColor" />
|
|
@@ -92,6 +100,17 @@ export default {
|
|
|
92
100
|
default: () => ({}),
|
|
93
101
|
},
|
|
94
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Whether the viewer may edit this placement (the host's edit mode).
|
|
105
|
+
* The empty state then offers "Configure now", which emits `edit`.
|
|
106
|
+
*
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
*/
|
|
109
|
+
canEdit: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false,
|
|
112
|
+
},
|
|
113
|
+
|
|
95
114
|
/* eslint-disable vue/no-unused-properties -- part of the widget contract: CnContainerChild and the dashboard pages bind :placement on every widget, so declaring it keeps it out of $attrs */
|
|
96
115
|
/** The placement record (reserved — kept to match the renderer contract). */
|
|
97
116
|
placement: {
|
|
@@ -101,11 +120,24 @@ export default {
|
|
|
101
120
|
/* eslint-enable vue/no-unused-properties */
|
|
102
121
|
},
|
|
103
122
|
|
|
123
|
+
emits: [
|
|
124
|
+
/**
|
|
125
|
+
* "Configure now" was chosen in the empty state, so the host can open
|
|
126
|
+
* the widget settings.
|
|
127
|
+
*
|
|
128
|
+
* @event edit
|
|
129
|
+
*/
|
|
130
|
+
'edit',
|
|
131
|
+
],
|
|
132
|
+
|
|
104
133
|
data() {
|
|
105
134
|
return {
|
|
106
135
|
// Set when the HTML5 <video> fires an error so subsequent renders
|
|
107
136
|
// show the error placeholder rather than a broken element.
|
|
108
137
|
videoLoadFailed: false,
|
|
138
|
+
// The widget's own size, so a portrait ratio in a landscape cell
|
|
139
|
+
// is fitted by its height instead of overflowing it.
|
|
140
|
+
box: { width: 0, height: 0 },
|
|
109
141
|
}
|
|
110
142
|
},
|
|
111
143
|
|
|
@@ -319,6 +351,11 @@ export default {
|
|
|
319
351
|
}
|
|
320
352
|
if (this.loop) {
|
|
321
353
|
params.push('loop=1')
|
|
354
|
+
// YouTube loops a single video only as a one-item playlist.
|
|
355
|
+
const id = this.sourceType === 'youtube' ? this.youtubeVideoId : ''
|
|
356
|
+
if (id) {
|
|
357
|
+
params.push(`playlist=${encodeURIComponent(id)}`)
|
|
358
|
+
}
|
|
322
359
|
}
|
|
323
360
|
if (params.length === 0) {
|
|
324
361
|
return this.videoUrl
|
|
@@ -327,6 +364,16 @@ export default {
|
|
|
327
364
|
return this.videoUrl + separator + params.join('&')
|
|
328
365
|
},
|
|
329
366
|
|
|
367
|
+
/**
|
|
368
|
+
* The video id in a canonical YouTube embed URL (`/embed/<id>`).
|
|
369
|
+
*
|
|
370
|
+
* @return {string} the id, or `''`.
|
|
371
|
+
*/
|
|
372
|
+
youtubeVideoId() {
|
|
373
|
+
const match = this.videoUrl.match(/\/embed\/([^/?#&]+)/)
|
|
374
|
+
return match ? decodeURIComponent(match[1]) : ''
|
|
375
|
+
},
|
|
376
|
+
|
|
330
377
|
/**
|
|
331
378
|
* The placeholder icon colour (a theme variable).
|
|
332
379
|
*
|
|
@@ -360,8 +407,12 @@ export default {
|
|
|
360
407
|
*/
|
|
361
408
|
mediaStyle() {
|
|
362
409
|
const [w, h] = this.aspectRatio.split(':')
|
|
410
|
+
const ratio = Number(w) / Number(h)
|
|
411
|
+
// A cell wider than the ratio fits the video by its height.
|
|
412
|
+
const { width, height } = this.box
|
|
413
|
+
const fitsByHeight = height > 0 && width / height > ratio
|
|
363
414
|
return {
|
|
364
|
-
width: '100%',
|
|
415
|
+
width: fitsByHeight ? `${Math.floor(height * ratio)}px` : '100%',
|
|
365
416
|
'max-width': '100%',
|
|
366
417
|
'aspect-ratio': `${w} / ${h}`,
|
|
367
418
|
display: 'flex',
|
|
@@ -384,6 +435,25 @@ export default {
|
|
|
384
435
|
},
|
|
385
436
|
},
|
|
386
437
|
|
|
438
|
+
mounted() {
|
|
439
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
440
|
+
return
|
|
441
|
+
}
|
|
442
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
443
|
+
const rect = entries[0] && entries[0].contentRect
|
|
444
|
+
if (rect) {
|
|
445
|
+
this.box = { width: rect.width, height: rect.height }
|
|
446
|
+
}
|
|
447
|
+
})
|
|
448
|
+
this.resizeObserver.observe(this.$el)
|
|
449
|
+
},
|
|
450
|
+
|
|
451
|
+
beforeUnmount() {
|
|
452
|
+
if (this.resizeObserver) {
|
|
453
|
+
this.resizeObserver.disconnect()
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
|
|
387
457
|
methods: {
|
|
388
458
|
/**
|
|
389
459
|
* HTML5 `<video>` error handler — swaps to the error placeholder. The
|
|
@@ -434,4 +504,17 @@ export default {
|
|
|
434
504
|
.cn-video-widget__placeholder-label {
|
|
435
505
|
font-size: 13px;
|
|
436
506
|
}
|
|
507
|
+
|
|
508
|
+
.cn-video-widget__placeholder-help {
|
|
509
|
+
font-size: 12px;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.cn-video-widget__configure {
|
|
513
|
+
padding: 4px 12px;
|
|
514
|
+
border: 1px solid var(--color-border);
|
|
515
|
+
border-radius: var(--border-radius);
|
|
516
|
+
background: transparent;
|
|
517
|
+
color: var(--color-main-text);
|
|
518
|
+
cursor: pointer;
|
|
519
|
+
}
|
|
437
520
|
</style>
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
required
|
|
13
13
|
@update:modelValue="onUrlInput" />
|
|
14
14
|
|
|
15
|
-
<div v-if="
|
|
15
|
+
<div v-if="urlError && hasUrl" class="cn-video-form__error" role="alert">
|
|
16
|
+
{{ urlError }}
|
|
17
|
+
</div>
|
|
18
|
+
<div v-else-if="detectedSource" class="cn-video-form__hint">
|
|
16
19
|
{{ detectedSourceLabel }}
|
|
17
20
|
</div>
|
|
18
21
|
<div v-else-if="hasUrl" class="cn-video-form__error" role="alert">
|
|
@@ -121,6 +124,17 @@ export default {
|
|
|
121
124
|
type: Object,
|
|
122
125
|
default: () => ({ ...DEFAULT_CONTENT }),
|
|
123
126
|
},
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* An error the host found for the current URL (its server-side parse,
|
|
130
|
+
* say). Shown under the URL field in place of the form's own message,
|
|
131
|
+
* and returned by `validate()`, so the dialog cannot save. Empty when
|
|
132
|
+
* the host has no objection.
|
|
133
|
+
*/
|
|
134
|
+
urlError: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: '',
|
|
137
|
+
},
|
|
124
138
|
},
|
|
125
139
|
|
|
126
140
|
emits: [
|
|
@@ -302,6 +316,10 @@ export default {
|
|
|
302
316
|
errors.push(t('nextcloud-vue', 'Video URL is required'))
|
|
303
317
|
return errors
|
|
304
318
|
}
|
|
319
|
+
if (this.urlError) {
|
|
320
|
+
errors.push(this.urlError)
|
|
321
|
+
return errors
|
|
322
|
+
}
|
|
305
323
|
if (this.detectedSource === null) {
|
|
306
324
|
errors.push(t('nextcloud-vue', 'Invalid video URL or domain not allowed.'))
|
|
307
325
|
return errors
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
* @property {object} defaultContent Initial `content` payload seeded into new placements.
|
|
38
38
|
* @property {string} displayName Human-readable type name shown in the type picker.
|
|
39
39
|
* @property {string} icon Material Design icon name used in the type picker.
|
|
40
|
+
* @property {number} [minHeight] The fewest grid rows a placement of this type may take, below the grid's own minimum (a divider: 1). A host copies it onto the layout item as `minHeight`.
|
|
40
41
|
* @property {string[]} [surfaces] Surfaces this type may be added on (e.g. `['app-dashboard']`, `['detail-page']`). Omitted means the default dashboard surfaces. A detail-only widget (like `data`) sets `['detail-page']` so it never appears in the dashboard Add-widget picker.
|
|
41
42
|
* @property {boolean} [public] Whether a PUBLIC host (an anonymous visitor at a public origin, such as the portal) may mount this widget. Default `false`, and `registerDashboardWidget()` records it: a widget author opts in deliberately. A non-boolean value is refused.
|
|
42
43
|
* @property {{graphql?: string[]}} [requires] Soft runtime-source hint for cross-app widgets — names the sibling-app schemas the widget reads. NEVER a `manifest.dependencies` entry.
|
|
@@ -15,20 +15,31 @@
|
|
|
15
15
|
<label class="cn-add-widget-modal__type-label" :for="typeSelectId">
|
|
16
16
|
{{ t('nextcloud-vue', 'Widget type') }}
|
|
17
17
|
</label>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
<!-- A native option cannot draw an icon, so the chosen type's
|
|
19
|
+
icon stands in front of the select. -->
|
|
20
|
+
<div class="cn-add-widget-modal__type-row">
|
|
21
|
+
<span
|
|
22
|
+
v-if="state.type"
|
|
23
|
+
class="cn-add-widget-modal__type-icon"
|
|
24
|
+
data-testid="widget-type-icon"
|
|
25
|
+
aria-hidden="true">
|
|
26
|
+
<CnWidgetIcon :name="typeIcon(state.type)" :size="20" />
|
|
27
|
+
</span>
|
|
28
|
+
<select
|
|
29
|
+
:id="typeSelectId"
|
|
30
|
+
v-model="state.type"
|
|
31
|
+
class="cn-add-widget-modal__type-select"
|
|
32
|
+
data-testid="widget-type-select"
|
|
33
|
+
@change="onTypeSwitch">
|
|
34
|
+
<option
|
|
35
|
+
v-for="type in availableTypes"
|
|
36
|
+
:key="type"
|
|
37
|
+
:value="type"
|
|
38
|
+
:data-testid="`widget-type-option-${type}`">
|
|
39
|
+
{{ typeDisplayName(type) }}
|
|
40
|
+
</option>
|
|
41
|
+
</select>
|
|
42
|
+
</div>
|
|
32
43
|
</div>
|
|
33
44
|
|
|
34
45
|
<!-- Notices about the widget being edited, from the host: a finding
|
|
@@ -131,6 +142,7 @@ import { NcButton, NcCheckboxRadioSwitch, NcDialog, NcNoteCard, NcTextField } fr
|
|
|
131
142
|
import { computed, provide } from 'vue'
|
|
132
143
|
import CnColorPicker from '../components/CnColorPicker/CnColorPicker.vue'
|
|
133
144
|
import CnIconBrowser from '../components/CnIconBrowser/CnIconBrowser.vue'
|
|
145
|
+
import CnWidgetIcon from '../components/CnWidgetGrid/CnWidgetIcon.vue'
|
|
134
146
|
import {
|
|
135
147
|
getWidgetTypeEntry,
|
|
136
148
|
listUserAddableWidgetTypes,
|
|
@@ -162,6 +174,7 @@ export default {
|
|
|
162
174
|
NcNoteCard,
|
|
163
175
|
CnIconBrowser,
|
|
164
176
|
CnColorPicker,
|
|
177
|
+
CnWidgetIcon,
|
|
165
178
|
},
|
|
166
179
|
|
|
167
180
|
props: {
|
|
@@ -787,6 +800,18 @@ export default {
|
|
|
787
800
|
const entry = getWidgetTypeEntry(type)
|
|
788
801
|
return entry?.displayName || type
|
|
789
802
|
},
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* The icon a registry type declares (an MDI name, SVG path or URL), or
|
|
806
|
+
* `null` for the default widget icon.
|
|
807
|
+
*
|
|
808
|
+
* @param {string} type the registry type key.
|
|
809
|
+
* @return {string|null} the icon.
|
|
810
|
+
*/
|
|
811
|
+
typeIcon(type) {
|
|
812
|
+
const icon = getWidgetTypeEntry(type)?.icon
|
|
813
|
+
return typeof icon === 'string' && icon !== '' ? icon : null
|
|
814
|
+
},
|
|
790
815
|
},
|
|
791
816
|
}
|
|
792
817
|
</script>
|
|
@@ -803,7 +828,21 @@ export default {
|
|
|
803
828
|
font-weight: 500;
|
|
804
829
|
}
|
|
805
830
|
|
|
831
|
+
.cn-add-widget-modal__type-row {
|
|
832
|
+
display: flex;
|
|
833
|
+
align-items: center;
|
|
834
|
+
gap: 8px;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
.cn-add-widget-modal__type-icon {
|
|
838
|
+
display: inline-flex;
|
|
839
|
+
flex: none;
|
|
840
|
+
color: var(--color-main-text);
|
|
841
|
+
}
|
|
842
|
+
|
|
806
843
|
.cn-add-widget-modal__type-select {
|
|
844
|
+
flex: 1;
|
|
845
|
+
min-width: 0;
|
|
807
846
|
padding: 8px 12px;
|
|
808
847
|
border: 1px solid var(--color-border);
|
|
809
848
|
border-radius: var(--border-radius);
|