@conduction/nextcloud-vue 2.106.0 → 2.107.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 (135) hide show
  1. package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +9 -0
  2. package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js.map +1 -0
  3. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +338 -0
  4. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -0
  5. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +249 -0
  6. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -0
  7. package/dist/esm/components/CnAdvancedFormDialog/CnPropertiesTab.vue2.js +2 -2
  8. package/dist/esm/components/CnAdvancedFormDialog/CnPropertiesTab.vue2.js.map +1 -1
  9. package/dist/esm/components/CnAppNav/CnAppNav.vue2.js.map +1 -1
  10. package/dist/esm/components/CnAppNav/CnAppNav.vue3.js +145 -138
  11. package/dist/esm/components/CnAppNav/CnAppNav.vue3.js.map +1 -1
  12. package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js +102 -2
  13. package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js.map +1 -1
  14. package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js.map +1 -1
  15. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  16. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +83 -6
  17. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  18. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +4 -2
  19. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  20. package/dist/esm/components/CnIcon/semanticIcons.js +2 -2
  21. package/dist/esm/components/CnIcon/semanticIcons.js.map +1 -1
  22. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +389 -20
  23. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  24. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +68 -35
  25. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  26. package/dist/esm/components/CnIndexPage/useSelfFetchList.js +22 -2
  27. package/dist/esm/components/CnIndexPage/useSelfFetchList.js.map +1 -1
  28. package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js +69 -5
  29. package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js.map +1 -1
  30. package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js +38 -5
  31. package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js.map +1 -1
  32. package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
  33. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +7 -1
  34. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
  35. package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
  36. package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue.js +8 -0
  37. package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue.js.map +1 -0
  38. package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js +297 -0
  39. package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js.map +1 -0
  40. package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js +24 -0
  41. package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js.map +1 -0
  42. package/dist/esm/components/CnSavedViewEditDialog/CnSavedViewEditDialog.vue.js +9 -0
  43. package/dist/esm/components/CnSavedViewEditDialog/CnSavedViewEditDialog.vue.js.map +1 -0
  44. package/dist/esm/components/CnSavedViewEditDialog/CnSavedViewEditDialog.vue2.js +95 -0
  45. package/dist/esm/components/CnSavedViewEditDialog/CnSavedViewEditDialog.vue2.js.map +1 -0
  46. package/dist/esm/components/CnSavedViewEditDialog/CnSavedViewEditDialog.vue3.js +123 -0
  47. package/dist/esm/components/CnSavedViewEditDialog/CnSavedViewEditDialog.vue3.js.map +1 -0
  48. package/dist/esm/components/CnSavedViewShareDialog/CnSavedViewShareDialog.vue.js +1 -1
  49. package/dist/esm/components/CnSavedViewShareDialog/CnSavedViewShareDialog.vue2.js +13 -5
  50. package/dist/esm/components/CnSavedViewShareDialog/CnSavedViewShareDialog.vue2.js.map +1 -1
  51. package/dist/esm/components/CnSavedViewShareDialog/CnSavedViewShareDialog.vue3.js +3 -1
  52. package/dist/esm/components/CnSavedViewShareDialog/CnSavedViewShareDialog.vue3.js.map +1 -1
  53. package/dist/esm/components/CnSavedViewShareFields/CnSavedViewShareFields.vue.js +1 -1
  54. package/dist/esm/components/CnSavedViewShareFields/CnSavedViewShareFields.vue2.js +49 -23
  55. package/dist/esm/components/CnSavedViewShareFields/CnSavedViewShareFields.vue2.js.map +1 -1
  56. package/dist/esm/components/CnSavedViewShareFields/CnSavedViewShareFields.vue3.js +74 -27
  57. package/dist/esm/components/CnSavedViewShareFields/CnSavedViewShareFields.vue3.js.map +1 -1
  58. package/dist/esm/components/CnSavedViewsControl/CnSavedViewsControl.vue.js +0 -1
  59. package/dist/esm/components/CnSavedViewsControl/CnSavedViewsControl.vue.js.map +1 -1
  60. package/dist/esm/components/CnSavedViewsControl/CnSavedViewsControl.vue2.js +18 -413
  61. package/dist/esm/components/CnSavedViewsControl/CnSavedViewsControl.vue2.js.map +1 -1
  62. package/dist/esm/components/CnSavedViewsControl/CnSavedViewsControl.vue3.js +27 -214
  63. package/dist/esm/components/CnSavedViewsControl/CnSavedViewsControl.vue3.js.map +1 -1
  64. package/dist/esm/components/CnSavedViewsPanel/CnSavedViewsPanel.vue.js +9 -0
  65. package/dist/esm/components/CnSavedViewsPanel/CnSavedViewsPanel.vue.js.map +1 -0
  66. package/dist/esm/components/CnSavedViewsPanel/CnSavedViewsPanel.vue2.js +190 -0
  67. package/dist/esm/components/CnSavedViewsPanel/CnSavedViewsPanel.vue2.js.map +1 -0
  68. package/dist/esm/components/CnSavedViewsPanel/CnSavedViewsPanel.vue3.js +270 -0
  69. package/dist/esm/components/CnSavedViewsPanel/CnSavedViewsPanel.vue3.js.map +1 -0
  70. package/dist/esm/index.js +4 -0
  71. package/dist/esm/index.js.map +1 -1
  72. package/dist/esm/l10n/en.json.js +56 -1
  73. package/dist/esm/l10n/en.json.js.map +1 -1
  74. package/dist/esm/l10n/nl.json.js +56 -1
  75. package/dist/esm/l10n/nl.json.js.map +1 -1
  76. package/dist/esm/library-style.js +1 -1
  77. package/dist/esm/mixins/savedViewsList.js +235 -0
  78. package/dist/esm/mixins/savedViewsList.js.map +1 -0
  79. package/dist/esm/nextcloud-vue.css +348 -108
  80. package/dist/esm/utils/actionsDispatcher.js +2 -2
  81. package/dist/esm/utils/actionsDispatcher.js.map +1 -1
  82. package/dist/esm/utils/builtInModals.js +39 -0
  83. package/dist/esm/utils/builtInModals.js.map +1 -0
  84. package/dist/esm/utils/mapMarkerColor.js +121 -0
  85. package/dist/esm/utils/mapMarkerColor.js.map +1 -0
  86. package/dist/esm/utils/mergeManifestDelta.js +4 -0
  87. package/dist/esm/utils/mergeManifestDelta.js.map +1 -1
  88. package/dist/esm/utils/savedViewHelpers.js +59 -7
  89. package/dist/esm/utils/savedViewHelpers.js.map +1 -1
  90. package/dist/esm/utils/savedViewMenu.js +154 -0
  91. package/dist/esm/utils/savedViewMenu.js.map +1 -0
  92. package/dist/esm/utils/searchGroupSharees.js +50 -15
  93. package/dist/esm/utils/searchGroupSharees.js.map +1 -1
  94. package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
  95. package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
  96. package/dist/nextcloud-vue.cjs.js +13351 -10855
  97. package/dist/nextcloud-vue.cjs.js.map +2 -2
  98. package/dist/nextcloud-vue.css +348 -108
  99. package/l10n/en.json +56 -1
  100. package/l10n/nl.json +56 -1
  101. package/package.json +1 -1
  102. package/src/components/CnActionDialog/CnActionDialog.vue +545 -0
  103. package/src/components/CnActionDialog/index.js +12 -0
  104. package/src/components/CnAppNav/CnAppNav.vue +17 -0
  105. package/src/components/CnAppRoot/CnAppRoot.vue +102 -2
  106. package/src/components/CnDashboardPage/CnDashboardPage.vue +86 -7
  107. package/src/components/CnIndexPage/CnIndexPage.vue +409 -23
  108. package/src/components/CnIndexPage/useSelfFetchList.js +21 -1
  109. package/src/components/CnIndexSidebar/CnIndexSidebar.md +2 -0
  110. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +91 -1
  111. package/src/components/CnMapWidget/CnMapWidget.vue +16 -1
  112. package/src/components/CnPartyPicker/CnPartyPicker.vue +317 -0
  113. package/src/components/CnPartyPicker/index.js +11 -0
  114. package/src/components/CnSavedViewEditDialog/CnSavedViewEditDialog.vue +192 -0
  115. package/src/components/CnSavedViewEditDialog/index.js +11 -0
  116. package/src/components/CnSavedViewShareDialog/CnSavedViewShareDialog.vue +21 -6
  117. package/src/components/CnSavedViewShareFields/CnSavedViewShareFields.vue +130 -37
  118. package/src/components/CnSavedViewsControl/CnSavedViewsControl.vue +36 -599
  119. package/src/components/CnSavedViewsPanel/CnSavedViewsPanel.vue +459 -0
  120. package/src/components/CnSavedViewsPanel/index.js +11 -0
  121. package/src/components/index.js +4 -0
  122. package/src/css/index-page.css +16 -0
  123. package/src/css/look-board-index.css +5 -3
  124. package/src/css/look-board.css +18 -3
  125. package/src/index.js +4 -0
  126. package/src/mixins/savedViewsList.js +231 -0
  127. package/src/schemas/app-manifest-v2.schema.json +98 -3
  128. package/src/utils/actionsDispatcher.js +2 -2
  129. package/src/utils/builtInModals.js +35 -0
  130. package/src/utils/mapMarkerColor.js +117 -0
  131. package/src/utils/mergeManifestDelta.js +4 -0
  132. package/src/utils/savedViewHelpers.js +58 -6
  133. package/src/utils/savedViewMenu.js +150 -0
  134. package/src/utils/searchGroupSharees.js +49 -14
  135. package/src/utils/validateManifestV2.compiled.js +3 -3
@@ -1,456 +1,61 @@
1
- import { translate } from '@nextcloud/l10n';
2
- import { NcActions, NcActionButton, NcActionButtonGroup, NcActionCaption, NcActionSeparator } from '@nextcloud/vue';
3
- import BookmarkOutline from 'vue-material-design-icons/BookmarkOutline.vue';
4
- import ContentCopy from 'vue-material-design-icons/ContentCopy.vue';
1
+ import { NcButton } from '@nextcloud/vue';
5
2
  import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue';
6
- import EyeOutline from 'vue-material-design-icons/EyeOutline.vue';
7
- import ShareVariantOutline from 'vue-material-design-icons/ShareVariantOutline.vue';
8
- import TagOutline from 'vue-material-design-icons/TagOutline.vue';
9
- import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue';
10
- import ViewDashboardOutline from 'vue-material-design-icons/ViewDashboardOutline.vue';
11
3
  import { normalizeLook } from '../../composables/useLook.js';
12
- import { VIEW_GROUPS, buildViewTree, labelsInUse } from '../../utils/buildViewTree.js';
13
- import { viewAccess, isOwnView } from '../../utils/savedViewHelpers.js';
4
+ import { savedViewsList } from '../../mixins/savedViewsList.js';
14
5
 
15
6
  /**
16
- * CnSavedViewsControl — toolbar dropdown listing OpenRegister saved-search
17
- * views for the current index page (saved-views-ui).
7
+ * CnSavedViewsControl — the toolbar entry to saved views: a "Save view"
8
+ * button and, under the board look, the saved views as chips that apply
9
+ * them. Everything else (the list, edit, share, delete, add to menu) lives in
10
+ * the index sidebar's `CnSavedViewsPanel`.
18
11
  *
19
- * Purely presentational: the parent (CnIndexPage) owns fetching via
20
- * `useSavedViewsApi()` and all mutations; this control only lists the
21
- * given `views` and emits intents:
12
+ * Purely presentational: `CnIndexPage` owns fetching and every write.
22
13
  *
23
- * - `@apply(view)` — a view entry was clicked; parent writes the view's
24
- * stored filters/search/sort into the route query.
25
- * - `@save-request()` — "Save current view…" clicked; parent opens
26
- * CnSaveViewDialog.
27
- * - `@delete-request(view)` — a view's trailing delete icon clicked; parent
28
- * opens a confirm dialog. Only rendered for views the current user owns
29
- * (`@self.access: owner`, else `view.owner === currentUserId`) — OpenRegister
30
- * refuses foreign deletes server-side anyway (owner-scoped 404).
31
- * - `@share-request(view)` — Share on an own view; parent opens the share dialog.
32
- * - `@update-request(view)` — Save on a view shared with write access; parent
33
- * saves the current state to it (never sending `sharedWith` or `owner`).
34
- * - `@presentation-request(view)` — Presentation on a view the user may edit
35
- * (`owner` or `write`); parent opens the presentation dialog (table, board, calendar).
36
- * - `@copy-request(view)` — "Save as my view" on a view shared read-only.
37
- *
38
- * Views shared with the user (`@self.access` `write` or `read`) list under
39
- * "Shared with me", next to "My views", once any exist; with none the list
40
- * renders as before.
41
- *
42
- * @event {object} apply — Apply the clicked view. Payload: the View API object.
43
- * @event {void} save-request — Open the save-current-view dialog.
44
- * @event {object} delete-request — Confirm-delete the clicked view. Payload: the View API object.
45
- * @event {object} share-request — Share the clicked own view. Payload: the View API object.
46
- * @event {object} update-request — Save the current state to the clicked writable shared view. Payload: the View API object.
47
- * @event {object} presentation-request — Change how the clicked view shows. Payload: the View API object.
48
- * @event {object} copy-request — Copy the clicked read-only shared view into a personal one. Payload: the View API object.
14
+ * @event {object} apply — A chip was clicked; apply its view. Payload: the View API object.
15
+ * @event {void} save-request — "Save view" clicked; open the save dialog.
49
16
  */
50
17
  var script = {
51
18
  name: 'CnSavedViewsControl',
52
19
 
53
- components: {
54
- NcActions,
55
- NcActionButton,
56
- NcActionButtonGroup,
57
- NcActionCaption,
58
- NcActionSeparator,
59
- BookmarkOutline,
60
- ContentCopy,
61
- ContentSaveOutline,
62
- EyeOutline,
63
- ShareVariantOutline,
64
- TagOutline,
65
- TrashCanOutline,
66
- ViewDashboardOutline,
67
- },
20
+ components: { NcButton, ContentSaveOutline },
21
+
22
+ mixins: [savedViewsList],
68
23
 
69
24
  inject: {
70
25
  /** The look CnAppRoot provides; `board` draws the views as chips. */
71
26
  cnLook: { default: 'nextcloud' },
72
27
  },
73
28
 
74
- // The chips and the menu are two roots under the board look.
29
+ // The chips and the button are two roots under the board look.
75
30
  inheritAttrs: false,
76
31
 
77
- props: {
78
- /** Views to list (View API objects from `GET /apps/openregister/api/views`). */
79
- views: {
80
- type: Array,
81
- default: () => [],
82
- },
83
-
84
- /** True while the parent is fetching the view list. */
85
- loading: {
86
- type: Boolean,
87
- default: false,
88
- },
89
-
90
- /** The signed-in NC user id — gates the per-view delete affordance. */
91
- currentUserId: {
92
- type: String,
93
- default: '',
94
- },
95
-
96
- /**
97
- * How deep the tree indents before it flattens. Mirrors
98
- * `savedViewTree.maxDepth` in the manifest. Flattening is about
99
- * indentation only: a view past the bound still renders.
100
- */
101
- maxDepth: {
102
- type: Number,
103
- default: 3,
104
- },
105
-
106
- /**
107
- * How many records each view matches, keyed by view id (or slug). A
108
- * view with a number here shows it after its name; a view can also
109
- * carry its own `count`. `null` (the default) shows no counts.
110
- *
111
- * @type {{[viewId: string]: number}|null}
112
- */
113
- counts: {
114
- type: Object,
115
- default: null,
116
- },
117
-
118
- /**
119
- * The id (or slug) of the applied view; its chip renders selected under
120
- * the board look.
121
- */
122
- selectedViewId: {
123
- type: String,
124
- default: '',
125
- },
126
- },
127
-
128
- emits: ['apply', 'copy-request', 'delete-request', 'presentation-request', 'save-request', 'share-request', 'update-request'],
129
-
130
- data() {
131
- return {
132
- /** The label currently filtering the list, or '' for all of them. */
133
- labelFilter: '',
134
- }
135
- },
32
+ emits: ['apply', 'save-request'],
136
33
 
137
34
  computed: {
138
- /**
139
- * Whether the saved views draw as chips (the board look).
140
- *
141
- * @return {boolean}
142
- */
35
+ /** @return {boolean} Whether the saved views draw as chips. */
143
36
  isBoardLook() {
144
37
  return normalizeLook(this.cnLook) === 'board'
145
38
  },
146
39
 
147
- /**
148
- * The views that get a chip: the top level of the tree, in tree order.
149
- *
150
- * @return {Array<object>}
151
- */
40
+ /** @return {Array<object>} The top level of the tree, in tree order. */
152
41
  chipRows() {
153
42
  return this.rows.filter((row) => row.depth === 0)
154
43
  },
155
-
156
- /** @return {string} The dropdown trigger label. */
157
- menuLabel() {
158
- return translate('nextcloud-vue', 'Views')
159
- },
160
-
161
- /** @return {string} The seeded group name, for the template. */
162
- SEEDED_GROUP() {
163
- return VIEW_GROUPS.SEEDED
164
- },
165
-
166
- /**
167
- * The views in tree order, seeded first, filtered by the active label.
168
- *
169
- * @return {Array<object>} Rows of `{ view, depth, group, orphaned }`.
170
- */
171
- rows() {
172
- return buildViewTree({
173
- views: this.views,
174
- labelFilter: this.labelFilter,
175
- maxDepth: this.maxDepth,
176
- })
177
- },
178
-
179
- /**
180
- * The rows in their sections. With no view shared with this user there
181
- * is one section without a caption, as the list always was. With
182
- * shared views: seeded views (no caption), "My views", "Shared with me".
183
- *
184
- * @return {Array<{key: string, label: string, rows: Array<object>}>} The sections.
185
- * @spec openspec/changes/saved-views-shared-by-role/tasks.md#task-1
186
- */
187
- sections() {
188
- const shared = this.rows.filter((r) => r.group !== VIEW_GROUPS.SEEDED && this.accessOf(r) !== 'owner');
189
- if (shared.length === 0) {
190
- return [{ key: 'all', label: '', rows: this.rows }]
191
- }
192
- const seeded = this.rows.filter((r) => r.group === VIEW_GROUPS.SEEDED);
193
- const mine = this.rows.filter((r) => r.group !== VIEW_GROUPS.SEEDED && this.accessOf(r) === 'owner');
194
- return [
195
- { key: 'seeded', label: '', rows: seeded },
196
- { key: 'mine', label: translate('nextcloud-vue', 'My views'), rows: mine },
197
- { key: 'shared', label: translate('nextcloud-vue', 'Shared with me'), rows: shared },
198
- ].filter((section) => section.rows.length > 0)
199
- },
200
-
201
- /**
202
- * The labels already in use.
203
- *
204
- * Read from the UNFILTERED list on purpose: reading it from `rows`
205
- * would remove every other label from the menu the moment one was
206
- * chosen, and a filter you cannot change without clearing it first is
207
- * a filter people stop using.
208
- *
209
- * @return {Array<string>} The labels.
210
- */
211
- offeredLabels() {
212
- return labelsInUse(this.views)
213
- },
214
44
  },
215
45
 
216
46
  methods: {
217
- t: translate,
218
-
219
- /**
220
- * Whether a view's chip is the selected one.
221
- *
222
- * @param {object} view The view.
223
- * @return {boolean}
224
- */
225
- isChipSelected(view) {
226
- return this.selectedViewId !== '' && (this.selectedViewId === String(view.id) || this.selectedViewId === String(view.slug))
227
- },
228
-
229
- /**
230
- * The name a row shows, indented to its depth.
231
- *
232
- * Indented with figure spaces rather than CSS padding because the row
233
- * is an `NcActionButton` whose label is read out as text: a screen
234
- * reader gets the same shape a sighted reader does, and no stylesheet
235
- * has to know about the tree.
236
- *
237
- * @param {object} row The row from buildViewTree().
238
- * @param {boolean} [withGroups] Append the groups the view is shared with.
239
- * @return {string} The name.
240
- * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views
241
- */
242
- rowName(row, withGroups = false) {
243
- const groups = withGroups ? this.groupsOf(row.view) : '';
244
- return `${'\u2007'.repeat(row.depth * 2)}${this.nameWithCount(row.view)}${groups !== '' ? ` · ${groups}` : ''}`
245
- },
246
-
247
- /**
248
- * What the current user may do with a row's view.
249
- *
250
- * @param {object} row The row from buildViewTree().
251
- * @return {'owner'|'write'|'read'} The access.
252
- * @spec openspec/changes/saved-views-shared-by-role/tasks.md#task-1
253
- */
254
- accessOf(row) {
255
- return viewAccess(row.view, this.currentUserId)
256
- },
257
-
258
- /**
259
- * The groups a view is shared with, as text for the row.
260
- *
261
- * @param {object} view The View API object.
262
- * @return {string} The group ids, comma-separated; empty when none.
263
- */
264
- groupsOf(view) {
265
- return (Array.isArray(view.sharedWith) ? view.sharedWith : [])
266
- .map((e) => e && e.group)
267
- .filter((g) => typeof g === 'string' && g !== '')
268
- .join(', ')
269
- },
270
-
271
- shareLabel(view) {
272
- return translate('nextcloud-vue', 'Share "{name}"', { name: view.name })
273
- },
274
-
275
- updateLabel(view) {
276
- return translate('nextcloud-vue', 'Save the current view to "{name}"', { name: view.name })
277
- },
278
-
279
- copyLabel(view) {
280
- return translate('nextcloud-vue', 'Save "{name}" as my view', { name: view.name })
281
- },
282
-
283
- presentationLabel(view) {
284
- return translate('nextcloud-vue', 'Change how "{name}" shows', { name: view.name })
285
- },
286
-
287
- onPresentationRequest(view) {
288
- /**
289
- * @event presentation-request Presentation on an editable view; open the presentation dialog.
290
- * @type {object}
291
- */
292
- this.$emit('presentation-request', view);
293
- },
294
-
295
- onShareRequest(view) {
296
- /**
297
- * @event share-request Share on an own view; open the share dialog.
298
- * @type {object}
299
- */
300
- this.$emit('share-request', view);
301
- },
302
-
303
- onUpdateRequest(view) {
304
- /**
305
- * @event update-request Save on a writable shared view; save the current state to it.
306
- * @type {object}
307
- */
308
- this.$emit('update-request', view);
309
- },
310
-
311
- onCopyRequest(view) {
312
- /**
313
- * @event copy-request "Save as my view" on a read-only shared view; store a personal copy.
314
- * @type {object}
315
- */
316
- this.$emit('copy-request', view);
317
- },
318
-
319
- /**
320
- * The number of records a view matches, or null when none is known:
321
- * `counts[id]` (or `counts[slug]`) first, else the view's own `count`.
322
- *
323
- * @param {object} view The saved view.
324
- * @return {number|null}
325
- * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views
326
- */
327
- countOf(view) {
328
- const counts = this.counts || {};
329
- let value = counts[view.id];
330
- if (value === undefined || value === null) {
331
- value = counts[view.slug];
332
- }
333
- if (value === undefined || value === null) {
334
- value = view.count;
335
- }
336
- return (typeof value === 'number' && Number.isFinite(value)) ? value : null
337
- },
338
-
339
- /**
340
- * A view's name, followed by its count when one is known.
341
- *
342
- * @param {object} view The saved view.
343
- * @return {string}
344
- * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views
345
- */
346
- nameWithCount(view) {
347
- const count = this.countOf(view);
348
- return count === null ? view.name : `${view.name} (${count})`
349
- },
350
-
351
- /**
352
- * What a row is called to somebody who cannot see the indentation.
353
- *
354
- * Says the level in words, and says when a view's parent is one this
355
- * reader cannot see. A child that silently sits at the root looks
356
- * exactly like a view that never had a parent.
357
- *
358
- * @param {object} row The row from buildViewTree().
359
- * @return {string} The accessible label.
360
- * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views
361
- */
362
- rowLabel(row) {
363
- const viewName = this.nameWithCount(row.view);
364
- const name = row.depth === 0
365
- ? viewName
366
- : translate('nextcloud-vue', '{name}, level {level}', { name: viewName, level: row.depth + 1 });
367
-
368
- if (row.orphaned !== true) {
369
- return name
370
- }
371
-
372
- return translate('nextcloud-vue', '{name}. Parts of this view come from one you cannot see.', { name })
373
- },
374
-
375
- /**
376
- * The accessible label of a label filter entry.
377
- *
378
- * @param {string} label The label.
379
- * @return {string} The label.
380
- */
381
- labelFilterLabel(label) {
382
- return this.labelFilter === label
383
- ? translate('nextcloud-vue', 'Stop filtering on "{label}"', { label })
384
- : translate('nextcloud-vue', 'Show only views labelled "{label}"', { label })
385
- },
386
-
387
- /**
388
- * Turn a label filter on, or off when it is already on.
389
- *
390
- * Clicking the active label clears it, so the way out is the way in
391
- * rather than a second control somebody has to find.
392
- *
393
- * @param {string} label The label.
394
- */
395
- onLabelFilter(label) {
396
- this.labelFilter = this.labelFilter === label ? '' : label;
397
- },
398
-
399
- /**
400
- * Whether the delete entry renders for a view.
401
- *
402
- * @param {object} view The View API object.
403
- * @return {boolean} True when the current user owns the view.
404
- */
405
- isOwn(view) {
406
- return isOwnView(view, this.currentUserId)
407
- },
408
-
409
- /**
410
- * Accessible label for a view's delete entry.
411
- *
412
- * @param {object} view The View API object.
413
- * @return {string} The label.
414
- */
415
- deleteLabel(view) {
416
- return translate('nextcloud-vue', 'Delete "{name}"', { name: view.name })
417
- },
418
-
419
- /**
420
- * View-entry click: hand the view to the parent to apply.
421
- *
422
- * @param {object} view The clicked View API object.
423
- */
424
47
  onApply(view) {
425
48
  /**
426
- * @event apply A view entry was clicked; apply its stored state.
49
+ * @event apply A chip was clicked; apply its stored state.
427
50
  * @type {object}
428
51
  */
429
52
  this.$emit('apply', view);
430
53
  },
431
54
 
432
- /**
433
- * "Save current view…" click: ask the parent to open the save dialog.
434
- */
435
55
  onSaveRequest() {
436
- /**
437
- * @event save-request "Save current view…" clicked; open the save dialog.
438
- */
56
+ /** @event save-request "Save view" clicked; open the save dialog. */
439
57
  this.$emit('save-request');
440
58
  },
441
-
442
- /**
443
- * Delete-entry click: hand the view to the parent to confirm-delete.
444
- *
445
- * @param {object} view The View API object to delete.
446
- */
447
- onDeleteRequest(view) {
448
- /**
449
- * @event delete-request A view's delete entry was clicked; confirm and delete.
450
- * @type {object}
451
- */
452
- this.$emit('delete-request', view);
453
- },
454
59
  },
455
60
  };
456
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"CnSavedViewsControl.vue2.js","sources":["../../../../src/components/CnSavedViewsControl/CnSavedViewsControl.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<!--\n\t\tBoard look: the saved views are a row of chips on the ground, each with\n\t\tits count, the selected one filled. The menu stays for managing views\n\t\t(apply, rename, share, delete) and is reached from the \"Save view\"\n\t\tbutton. Without the look the control is the menu alone, as before.\n\t-->\n\t<div\n\t\tv-if=\"isBoardLook && chipRows.length > 0\"\n\t\tclass=\"cn-saved-views__chips\"\n\t\trole=\"group\"\n\t\t:aria-label=\"t('nextcloud-vue', 'Saved views')\"\n\t\tdata-testid=\"cn-saved-views-chips\">\n\t\t<button\n\t\t\tv-for=\"row in chipRows\"\n\t\t\t:key=\"`chip-${row.view.id || row.view.slug}`\"\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cn-saved-views__chip\"\n\t\t\t:class=\"{ 'cn-saved-views__chip--selected': isChipSelected(row.view) }\"\n\t\t\t:aria-pressed=\"isChipSelected(row.view)\"\n\t\t\tdata-testid=\"cn-saved-views-chip\"\n\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t@click=\"onApply(row.view)\">\n\t\t\t<span class=\"cn-saved-views__chip-name\">{{ row.view.name }}</span>\n\t\t\t<span\n\t\t\t\tv-if=\"countOf(row.view) !== null\"\n\t\t\t\tclass=\"cn-saved-views__chip-count\"\n\t\t\t\tdata-testid=\"cn-saved-views-chip-count\">{{ countOf(row.view) }}</span>\n\t\t</button>\n\t</div>\n\t<NcActions\n\t\tv-bind=\"$attrs\"\n\t\t:class=\"{ 'cn-saved-views__save': isBoardLook }\"\n\t\t:forceMenu=\"true\"\n\t\t:forceName=\"true\"\n\t\t:menuName=\"isBoardLook ? t('nextcloud-vue', 'Save view') : menuLabel\"\n\t\tdata-testid=\"cn-saved-views-control\"\n\t\t:aria-label=\"isBoardLook ? t('nextcloud-vue', 'Save view') : menuLabel\">\n\t\t<template #icon>\n\t\t\t<ContentSaveOutline v-if=\"isBoardLook\" :size=\"14\" />\n\t\t\t<BookmarkOutline v-else :size=\"20\" />\n\t\t</template>\n\n\t\t<NcActionCaption :name=\"t('nextcloud-vue', 'Saved views')\" />\n\n\t\t<!-- Loading state -->\n\t\t<NcActionCaption\n\t\t\tv-if=\"loading\"\n\t\t\tdata-testid=\"cn-saved-views-loading\"\n\t\t\t:name=\"t('nextcloud-vue', 'Loading…')\" />\n\n\t\t<!-- Empty state -->\n\t\t<NcActionCaption\n\t\t\tv-else-if=\"views.length === 0\"\n\t\t\tdata-testid=\"cn-saved-views-empty\"\n\t\t\t:name=\"t('nextcloud-vue', 'No saved views yet')\" />\n\n\t\t<!-- The labels already in use, offered before anybody types a new one. -->\n\t\t<template v-if=\"!loading && offeredLabels.length > 0\">\n\t\t\t<NcActionButton\n\t\t\t\tv-for=\"label in offeredLabels\"\n\t\t\t\t:key=\"`label-${label}`\"\n\t\t\t\tdata-testid=\"cn-saved-views-label\"\n\t\t\t\t:data-label=\"label\"\n\t\t\t\t:modelValue=\"labelFilter === label\"\n\t\t\t\ttype=\"checkbox\"\n\t\t\t\t:aria-label=\"labelFilterLabel(label)\"\n\t\t\t\t@click=\"onLabelFilter(label)\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<TagOutline :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ label }}\n\t\t\t</NcActionButton>\n\t\t\t<NcActionSeparator />\n\t\t</template>\n\n\t\t<!--\n\t\t\tA label that matches nothing says so. Chained to the ROWS rather\n\t\t\tthan to the label list: written as an else-if of the labels block\n\t\t\tit only ever rendered on a page with no labels at all, which is\n\t\t\tthe one case it cannot be about.\n\t\t-->\n\t\t<NcActionCaption\n\t\t\tv-if=\"!loading && views.length > 0 && rows.length === 0\"\n\t\t\tdata-testid=\"cn-saved-views-none-for-label\"\n\t\t\t:name=\"t('nextcloud-vue', 'No views with this label')\" />\n\n\t\t<!-- One row per view, in tree order: the name applies it, a trailing\n\t\t icon button deletes it. NcActions only recognises NcAction* vnodes\n\t\t as menu items and silently drops anything else, so a row with more\n\t\t than one control has to be an NcActionButtonGroup. -->\n\t\t<template v-if=\"!loading\">\n\t\t\t<template v-for=\"section in sections\" :key=\"section.key\">\n\t\t\t\t<NcActionCaption\n\t\t\t\t\tv-if=\"section.label\"\n\t\t\t\t\t:data-testid=\"`cn-saved-views-section-${section.key}`\"\n\t\t\t\t\t:name=\"section.label\" />\n\t\t\t\t<NcActionButtonGroup\n\t\t\t\t\tv-for=\"row in section.rows\"\n\t\t\t\t\t:key=\"`view-${row.view.id || row.view.slug}`\"\n\t\t\t\t\tclass=\"cn-saved-view-row\">\n\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\tdata-testid=\"cn-saved-views-item\"\n\t\t\t\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t\t\t\t:data-depth=\"row.depth\"\n\t\t\t\t\t\t:data-group=\"row.group\"\n\t\t\t\t\t\t:data-access=\"accessOf(row)\"\n\t\t\t\t\t\t:aria-label=\"rowLabel(row)\"\n\t\t\t\t\t\t@click=\"onApply(row.view)\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<EyeOutline :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ rowName(row, section.key === 'shared') }}\n\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\tv-if=\"accessOf(row) === 'owner' && row.group !== SEEDED_GROUP\"\n\t\t\t\t\t\t:key=\"`share-${row.view.id || row.view.slug}`\"\n\t\t\t\t\t\tdata-testid=\"cn-saved-views-share\"\n\t\t\t\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t\t\t\t:aria-label=\"shareLabel(row.view)\"\n\t\t\t\t\t\t@click=\"onShareRequest(row.view)\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<ShareVariantOutline :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\tv-if=\"(accessOf(row) === 'owner' || accessOf(row) === 'write') && row.group !== SEEDED_GROUP\"\n\t\t\t\t\t\t:key=\"`presentation-${row.view.id || row.view.slug}`\"\n\t\t\t\t\t\tdata-testid=\"cn-saved-views-presentation\"\n\t\t\t\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t\t\t\t:aria-label=\"presentationLabel(row.view)\"\n\t\t\t\t\t\t@click=\"onPresentationRequest(row.view)\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<ViewDashboardOutline :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\tv-if=\"accessOf(row) === 'write'\"\n\t\t\t\t\t\t:key=\"`update-${row.view.id || row.view.slug}`\"\n\t\t\t\t\t\tdata-testid=\"cn-saved-views-update\"\n\t\t\t\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t\t\t\t:aria-label=\"updateLabel(row.view)\"\n\t\t\t\t\t\t@click=\"onUpdateRequest(row.view)\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<ContentSaveOutline :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\tv-if=\"accessOf(row) === 'read' && row.group !== SEEDED_GROUP\"\n\t\t\t\t\t\t:key=\"`copy-${row.view.id || row.view.slug}`\"\n\t\t\t\t\t\tdata-testid=\"cn-saved-views-copy\"\n\t\t\t\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t\t\t\t:aria-label=\"copyLabel(row.view)\"\n\t\t\t\t\t\t@click=\"onCopyRequest(row.view)\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<ContentCopy :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\tv-if=\"accessOf(row) === 'owner' && row.group !== SEEDED_GROUP\"\n\t\t\t\t\t\t:key=\"`delete-${row.view.id || row.view.slug}`\"\n\t\t\t\t\t\tdata-testid=\"cn-saved-views-delete\"\n\t\t\t\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t\t\t\t:aria-label=\"deleteLabel(row.view)\"\n\t\t\t\t\t\t@click=\"onDeleteRequest(row.view)\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<TrashCanOutline :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcActionButton>\n\t\t\t\t</NcActionButtonGroup>\n\t\t\t</template>\n\t\t</template>\n\n\t\t<NcActionSeparator />\n\n\t\t<NcActionButton\n\t\t\tdata-testid=\"cn-saved-views-save\"\n\t\t\t:aria-label=\"t('nextcloud-vue', 'Save current view…')\"\n\t\t\t@click=\"onSaveRequest\">\n\t\t\t<template #icon>\n\t\t\t\t<ContentSaveOutline :size=\"20\" />\n\t\t\t</template>\n\t\t\t{{ t('nextcloud-vue', 'Save current view…') }}\n\t\t</NcActionButton>\n\t</NcActions>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcActionButton, NcActionButtonGroup, NcActionCaption, NcActions, NcActionSeparator } from '@nextcloud/vue'\nimport BookmarkOutline from 'vue-material-design-icons/BookmarkOutline.vue'\nimport ContentCopy from 'vue-material-design-icons/ContentCopy.vue'\nimport ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'\nimport EyeOutline from 'vue-material-design-icons/EyeOutline.vue'\nimport ShareVariantOutline from 'vue-material-design-icons/ShareVariantOutline.vue'\nimport TagOutline from 'vue-material-design-icons/TagOutline.vue'\nimport TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'\nimport ViewDashboardOutline from 'vue-material-design-icons/ViewDashboardOutline.vue'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { buildViewTree, labelsInUse, VIEW_GROUPS } from '../../utils/buildViewTree.js'\nimport { isOwnView, viewAccess } from '../../utils/savedViewHelpers.js'\n\n/**\n * CnSavedViewsControl — toolbar dropdown listing OpenRegister saved-search\n * views for the current index page (saved-views-ui).\n *\n * Purely presentational: the parent (CnIndexPage) owns fetching via\n * `useSavedViewsApi()` and all mutations; this control only lists the\n * given `views` and emits intents:\n *\n * - `@apply(view)` — a view entry was clicked; parent writes the view's\n * stored filters/search/sort into the route query.\n * - `@save-request()` — \"Save current view…\" clicked; parent opens\n * CnSaveViewDialog.\n * - `@delete-request(view)` — a view's trailing delete icon clicked; parent\n * opens a confirm dialog. Only rendered for views the current user owns\n * (`@self.access: owner`, else `view.owner === currentUserId`) — OpenRegister\n * refuses foreign deletes server-side anyway (owner-scoped 404).\n * - `@share-request(view)` — Share on an own view; parent opens the share dialog.\n * - `@update-request(view)` — Save on a view shared with write access; parent\n * saves the current state to it (never sending `sharedWith` or `owner`).\n * - `@presentation-request(view)` — Presentation on a view the user may edit\n * (`owner` or `write`); parent opens the presentation dialog (table, board, calendar).\n * - `@copy-request(view)` — \"Save as my view\" on a view shared read-only.\n *\n * Views shared with the user (`@self.access` `write` or `read`) list under\n * \"Shared with me\", next to \"My views\", once any exist; with none the list\n * renders as before.\n *\n * @event {object} apply — Apply the clicked view. Payload: the View API object.\n * @event {void} save-request — Open the save-current-view dialog.\n * @event {object} delete-request — Confirm-delete the clicked view. Payload: the View API object.\n * @event {object} share-request — Share the clicked own view. Payload: the View API object.\n * @event {object} update-request — Save the current state to the clicked writable shared view. Payload: the View API object.\n * @event {object} presentation-request — Change how the clicked view shows. Payload: the View API object.\n * @event {object} copy-request — Copy the clicked read-only shared view into a personal one. Payload: the View API object.\n */\nexport default {\n\tname: 'CnSavedViewsControl',\n\n\tcomponents: {\n\t\tNcActions,\n\t\tNcActionButton,\n\t\tNcActionButtonGroup,\n\t\tNcActionCaption,\n\t\tNcActionSeparator,\n\t\tBookmarkOutline,\n\t\tContentCopy,\n\t\tContentSaveOutline,\n\t\tEyeOutline,\n\t\tShareVariantOutline,\n\t\tTagOutline,\n\t\tTrashCanOutline,\n\t\tViewDashboardOutline,\n\t},\n\n\tinject: {\n\t\t/** The look CnAppRoot provides; `board` draws the views as chips. */\n\t\tcnLook: { default: 'nextcloud' },\n\t},\n\n\t// The chips and the menu are two roots under the board look.\n\tinheritAttrs: false,\n\n\tprops: {\n\t\t/** Views to list (View API objects from `GET /apps/openregister/api/views`). */\n\t\tviews: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** True while the parent is fetching the view list. */\n\t\tloading: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** The signed-in NC user id — gates the per-view delete affordance. */\n\t\tcurrentUserId: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * How deep the tree indents before it flattens. Mirrors\n\t\t * `savedViewTree.maxDepth` in the manifest. Flattening is about\n\t\t * indentation only: a view past the bound still renders.\n\t\t */\n\t\tmaxDepth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 3,\n\t\t},\n\n\t\t/**\n\t\t * How many records each view matches, keyed by view id (or slug). A\n\t\t * view with a number here shows it after its name; a view can also\n\t\t * carry its own `count`. `null` (the default) shows no counts.\n\t\t *\n\t\t * @type {{[viewId: string]: number}|null}\n\t\t */\n\t\tcounts: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * The id (or slug) of the applied view; its chip renders selected under\n\t\t * the board look.\n\t\t */\n\t\tselectedViewId: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['apply', 'copy-request', 'delete-request', 'presentation-request', 'save-request', 'share-request', 'update-request'],\n\n\tdata() {\n\t\treturn {\n\t\t\t/** The label currently filtering the list, or '' for all of them. */\n\t\t\tlabelFilter: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether the saved views draw as chips (the board look).\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\t/**\n\t\t * The views that get a chip: the top level of the tree, in tree order.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tchipRows() {\n\t\t\treturn this.rows.filter((row) => row.depth === 0)\n\t\t},\n\n\t\t/** @return {string} The dropdown trigger label. */\n\t\tmenuLabel() {\n\t\t\treturn t('nextcloud-vue', 'Views')\n\t\t},\n\n\t\t/** @return {string} The seeded group name, for the template. */\n\t\tSEEDED_GROUP() {\n\t\t\treturn VIEW_GROUPS.SEEDED\n\t\t},\n\n\t\t/**\n\t\t * The views in tree order, seeded first, filtered by the active label.\n\t\t *\n\t\t * @return {Array<object>} Rows of `{ view, depth, group, orphaned }`.\n\t\t */\n\t\trows() {\n\t\t\treturn buildViewTree({\n\t\t\t\tviews: this.views,\n\t\t\t\tlabelFilter: this.labelFilter,\n\t\t\t\tmaxDepth: this.maxDepth,\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The rows in their sections. With no view shared with this user there\n\t\t * is one section without a caption, as the list always was. With\n\t\t * shared views: seeded views (no caption), \"My views\", \"Shared with me\".\n\t\t *\n\t\t * @return {Array<{key: string, label: string, rows: Array<object>}>} The sections.\n\t\t * @spec openspec/changes/saved-views-shared-by-role/tasks.md#task-1\n\t\t */\n\t\tsections() {\n\t\t\tconst shared = this.rows.filter((r) => r.group !== VIEW_GROUPS.SEEDED && this.accessOf(r) !== 'owner')\n\t\t\tif (shared.length === 0) {\n\t\t\t\treturn [{ key: 'all', label: '', rows: this.rows }]\n\t\t\t}\n\t\t\tconst seeded = this.rows.filter((r) => r.group === VIEW_GROUPS.SEEDED)\n\t\t\tconst mine = this.rows.filter((r) => r.group !== VIEW_GROUPS.SEEDED && this.accessOf(r) === 'owner')\n\t\t\treturn [\n\t\t\t\t{ key: 'seeded', label: '', rows: seeded },\n\t\t\t\t{ key: 'mine', label: t('nextcloud-vue', 'My views'), rows: mine },\n\t\t\t\t{ key: 'shared', label: t('nextcloud-vue', 'Shared with me'), rows: shared },\n\t\t\t].filter((section) => section.rows.length > 0)\n\t\t},\n\n\t\t/**\n\t\t * The labels already in use.\n\t\t *\n\t\t * Read from the UNFILTERED list on purpose: reading it from `rows`\n\t\t * would remove every other label from the menu the moment one was\n\t\t * chosen, and a filter you cannot change without clearing it first is\n\t\t * a filter people stop using.\n\t\t *\n\t\t * @return {Array<string>} The labels.\n\t\t */\n\t\tofferedLabels() {\n\t\t\treturn labelsInUse(this.views)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Whether a view's chip is the selected one.\n\t\t *\n\t\t * @param {object} view The view.\n\t\t * @return {boolean}\n\t\t */\n\t\tisChipSelected(view) {\n\t\t\treturn this.selectedViewId !== '' && (this.selectedViewId === String(view.id) || this.selectedViewId === String(view.slug))\n\t\t},\n\n\t\t/**\n\t\t * The name a row shows, indented to its depth.\n\t\t *\n\t\t * Indented with figure spaces rather than CSS padding because the row\n\t\t * is an `NcActionButton` whose label is read out as text: a screen\n\t\t * reader gets the same shape a sighted reader does, and no stylesheet\n\t\t * has to know about the tree.\n\t\t *\n\t\t * @param {object} row The row from buildViewTree().\n\t\t * @param {boolean} [withGroups] Append the groups the view is shared with.\n\t\t * @return {string} The name.\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views\n\t\t */\n\t\trowName(row, withGroups = false) {\n\t\t\tconst groups = withGroups ? this.groupsOf(row.view) : ''\n\t\t\treturn `${'\\u2007'.repeat(row.depth * 2)}${this.nameWithCount(row.view)}${groups !== '' ? ` · ${groups}` : ''}`\n\t\t},\n\n\t\t/**\n\t\t * What the current user may do with a row's view.\n\t\t *\n\t\t * @param {object} row The row from buildViewTree().\n\t\t * @return {'owner'|'write'|'read'} The access.\n\t\t * @spec openspec/changes/saved-views-shared-by-role/tasks.md#task-1\n\t\t */\n\t\taccessOf(row) {\n\t\t\treturn viewAccess(row.view, this.currentUserId)\n\t\t},\n\n\t\t/**\n\t\t * The groups a view is shared with, as text for the row.\n\t\t *\n\t\t * @param {object} view The View API object.\n\t\t * @return {string} The group ids, comma-separated; empty when none.\n\t\t */\n\t\tgroupsOf(view) {\n\t\t\treturn (Array.isArray(view.sharedWith) ? view.sharedWith : [])\n\t\t\t\t.map((e) => e && e.group)\n\t\t\t\t.filter((g) => typeof g === 'string' && g !== '')\n\t\t\t\t.join(', ')\n\t\t},\n\n\t\tshareLabel(view) {\n\t\t\treturn t('nextcloud-vue', 'Share \"{name}\"', { name: view.name })\n\t\t},\n\n\t\tupdateLabel(view) {\n\t\t\treturn t('nextcloud-vue', 'Save the current view to \"{name}\"', { name: view.name })\n\t\t},\n\n\t\tcopyLabel(view) {\n\t\t\treturn t('nextcloud-vue', 'Save \"{name}\" as my view', { name: view.name })\n\t\t},\n\n\t\tpresentationLabel(view) {\n\t\t\treturn t('nextcloud-vue', 'Change how \"{name}\" shows', { name: view.name })\n\t\t},\n\n\t\tonPresentationRequest(view) {\n\t\t\t/**\n\t\t\t * @event presentation-request Presentation on an editable view; open the presentation dialog.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('presentation-request', view)\n\t\t},\n\n\t\tonShareRequest(view) {\n\t\t\t/**\n\t\t\t * @event share-request Share on an own view; open the share dialog.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('share-request', view)\n\t\t},\n\n\t\tonUpdateRequest(view) {\n\t\t\t/**\n\t\t\t * @event update-request Save on a writable shared view; save the current state to it.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('update-request', view)\n\t\t},\n\n\t\tonCopyRequest(view) {\n\t\t\t/**\n\t\t\t * @event copy-request \"Save as my view\" on a read-only shared view; store a personal copy.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('copy-request', view)\n\t\t},\n\n\t\t/**\n\t\t * The number of records a view matches, or null when none is known:\n\t\t * `counts[id]` (or `counts[slug]`) first, else the view's own `count`.\n\t\t *\n\t\t * @param {object} view The saved view.\n\t\t * @return {number|null}\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views\n\t\t */\n\t\tcountOf(view) {\n\t\t\tconst counts = this.counts || {}\n\t\t\tlet value = counts[view.id]\n\t\t\tif (value === undefined || value === null) {\n\t\t\t\tvalue = counts[view.slug]\n\t\t\t}\n\t\t\tif (value === undefined || value === null) {\n\t\t\t\tvalue = view.count\n\t\t\t}\n\t\t\treturn (typeof value === 'number' && Number.isFinite(value)) ? value : null\n\t\t},\n\n\t\t/**\n\t\t * A view's name, followed by its count when one is known.\n\t\t *\n\t\t * @param {object} view The saved view.\n\t\t * @return {string}\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views\n\t\t */\n\t\tnameWithCount(view) {\n\t\t\tconst count = this.countOf(view)\n\t\t\treturn count === null ? view.name : `${view.name} (${count})`\n\t\t},\n\n\t\t/**\n\t\t * What a row is called to somebody who cannot see the indentation.\n\t\t *\n\t\t * Says the level in words, and says when a view's parent is one this\n\t\t * reader cannot see. A child that silently sits at the root looks\n\t\t * exactly like a view that never had a parent.\n\t\t *\n\t\t * @param {object} row The row from buildViewTree().\n\t\t * @return {string} The accessible label.\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-counts-on-filters-and-views\n\t\t */\n\t\trowLabel(row) {\n\t\t\tconst viewName = this.nameWithCount(row.view)\n\t\t\tconst name = row.depth === 0\n\t\t\t\t? viewName\n\t\t\t\t: t('nextcloud-vue', '{name}, level {level}', { name: viewName, level: row.depth + 1 })\n\n\t\t\tif (row.orphaned !== true) {\n\t\t\t\treturn name\n\t\t\t}\n\n\t\t\treturn t('nextcloud-vue', '{name}. Parts of this view come from one you cannot see.', { name })\n\t\t},\n\n\t\t/**\n\t\t * The accessible label of a label filter entry.\n\t\t *\n\t\t * @param {string} label The label.\n\t\t * @return {string} The label.\n\t\t */\n\t\tlabelFilterLabel(label) {\n\t\t\treturn this.labelFilter === label\n\t\t\t\t? t('nextcloud-vue', 'Stop filtering on \"{label}\"', { label })\n\t\t\t\t: t('nextcloud-vue', 'Show only views labelled \"{label}\"', { label })\n\t\t},\n\n\t\t/**\n\t\t * Turn a label filter on, or off when it is already on.\n\t\t *\n\t\t * Clicking the active label clears it, so the way out is the way in\n\t\t * rather than a second control somebody has to find.\n\t\t *\n\t\t * @param {string} label The label.\n\t\t */\n\t\tonLabelFilter(label) {\n\t\t\tthis.labelFilter = this.labelFilter === label ? '' : label\n\t\t},\n\n\t\t/**\n\t\t * Whether the delete entry renders for a view.\n\t\t *\n\t\t * @param {object} view The View API object.\n\t\t * @return {boolean} True when the current user owns the view.\n\t\t */\n\t\tisOwn(view) {\n\t\t\treturn isOwnView(view, this.currentUserId)\n\t\t},\n\n\t\t/**\n\t\t * Accessible label for a view's delete entry.\n\t\t *\n\t\t * @param {object} view The View API object.\n\t\t * @return {string} The label.\n\t\t */\n\t\tdeleteLabel(view) {\n\t\t\treturn t('nextcloud-vue', 'Delete \"{name}\"', { name: view.name })\n\t\t},\n\n\t\t/**\n\t\t * View-entry click: hand the view to the parent to apply.\n\t\t *\n\t\t * @param {object} view The clicked View API object.\n\t\t */\n\t\tonApply(view) {\n\t\t\t/**\n\t\t\t * @event apply A view entry was clicked; apply its stored state.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('apply', view)\n\t\t},\n\n\t\t/**\n\t\t * \"Save current view…\" click: ask the parent to open the save dialog.\n\t\t */\n\t\tonSaveRequest() {\n\t\t\t/**\n\t\t\t * @event save-request \"Save current view…\" clicked; open the save dialog.\n\t\t\t */\n\t\t\tthis.$emit('save-request')\n\t\t},\n\n\t\t/**\n\t\t * Delete-entry click: hand the view to the parent to confirm-delete.\n\t\t *\n\t\t * @param {object} view The View API object to delete.\n\t\t */\n\t\tonDeleteRequest(view) {\n\t\t\t/**\n\t\t\t * @event delete-request A view's delete entry was clicked; confirm and delete.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('delete-request', view)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n/* NcActionButtonGroup gives every child `flex: 1 1` (equal width) by\n default; override so the name button grows and the delete icon stays\n compact. :deep() is required — these li's belong to NcActionButtonGroup's\n own scope, not this component's. */\n.cn-saved-view-row :deep(.nc-button-group-content) {\n\tgap: 0;\n}\n\n/* Anchored on the FIRST child, not the last: a row carries one or two buttons\n depending on ownership, so \"the last one\" is the name button on a row that\n has only that. */\n.cn-saved-view-row :deep(.nc-button-group-content > li) {\n\tflex: 0 0 auto;\n}\n\n.cn-saved-view-row :deep(.nc-button-group-content > li:first-child) {\n\tflex: 1 1 auto;\n}\n\n/* NcActionButtonGroup also centers .action-button content (fine for an\n icon-only toolbar button, wrong for a row with a name) — restore the\n normal left-aligned NcActionButton look for the name button. */\n.cn-saved-view-row :deep(.nc-button-group-content > li:first-child .action-button) {\n\tjustify-content: flex-start;\n}\n</style>\n"],"names":["t"],"mappings":";;;;;;;;;;;;;;AA8MA;AACC;AACA;AACA;;;;AAIA;;AAEA;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,CAAA;GAChE;;AAED;;AAEC;AACA;;EAED,OAAO,CAAC,IAAI,EAAE;AACb;;;;GAIA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAA;GACxB;;AAED;;;AAGA,EAAA,aAAa,GAAG;AACf;AACC;;GAED,IAAI,CAAC,KAAK,CAAC,cAAc,EAAA;GACzB;;AAED;;AAEC;AACA;;AAED,EAAA,eAAe,CAAC,IAAI,EAAE;AACrB;AACC;;;AAGD,GAAA,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,EAAA;GACjC;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnSavedViewsControl.vue2.js","sources":["../../../../src/components/CnSavedViewsControl/CnSavedViewsControl.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<!--\n\t\tThe toolbar half of saved views. Under the board look the views are\n\t\ta row of chips that apply them; everywhere a \"Save view\" button saves\n\t\tthe current filters. Listing, editing, sharing and deleting live in the\n\t\tsidebar's Filters tab (CnSavedViewsPanel).\n\t-->\n\t<div\n\t\tv-if=\"isBoardLook && chipRows.length > 0\"\n\t\tclass=\"cn-saved-views__chips\"\n\t\trole=\"group\"\n\t\t:aria-label=\"t('nextcloud-vue', 'Saved views')\"\n\t\tdata-testid=\"cn-saved-views-chips\">\n\t\t<button\n\t\t\tv-for=\"row in chipRows\"\n\t\t\t:key=\"`chip-${row.view.id || row.view.slug}`\"\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cn-saved-views__chip\"\n\t\t\t:class=\"{ 'cn-saved-views__chip--selected': isSelected(row.view) }\"\n\t\t\t:aria-pressed=\"isSelected(row.view)\"\n\t\t\tdata-testid=\"cn-saved-views-chip\"\n\t\t\t:data-view-id=\"row.view.id || row.view.slug\"\n\t\t\t@click=\"onApply(row.view)\">\n\t\t\t<span class=\"cn-saved-views__chip-name\">{{ row.view.name }}</span>\n\t\t\t<span\n\t\t\t\tv-if=\"countOf(row.view) !== null\"\n\t\t\t\tclass=\"cn-saved-views__chip-count\"\n\t\t\t\tdata-testid=\"cn-saved-views-chip-count\">{{ countOf(row.view) }}</span>\n\t\t</button>\n\t</div>\n\t<!-- The wrapper carries the board look's class, so the bar's row rules\n\t and the ghost-button rules reach the button the way they did when it\n\t was an NcActions trigger. -->\n\t<div v-bind=\"$attrs\" :class=\"{ 'cn-saved-views__save': isBoardLook }\">\n\t\t<NcButton\n\t\t\t:variant=\"isBoardLook ? 'tertiary' : 'secondary'\"\n\t\t\t:aria-label=\"t('nextcloud-vue', 'Save view')\"\n\t\t\tdata-testid=\"cn-saved-views-control\"\n\t\t\t@click=\"onSaveRequest\">\n\t\t\t<template #icon>\n\t\t\t\t<ContentSaveOutline :size=\"isBoardLook ? 14 : 20\" />\n\t\t\t</template>\n\t\t\t{{ t('nextcloud-vue', 'Save view') }}\n\t\t</NcButton>\n\t</div>\n</template>\n\n<script>\nimport { NcButton } from '@nextcloud/vue'\nimport ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { savedViewsList } from '../../mixins/savedViewsList.js'\n\n/**\n * CnSavedViewsControl — the toolbar entry to saved views: a \"Save view\"\n * button and, under the board look, the saved views as chips that apply\n * them. Everything else (the list, edit, share, delete, add to menu) lives in\n * the index sidebar's `CnSavedViewsPanel`.\n *\n * Purely presentational: `CnIndexPage` owns fetching and every write.\n *\n * @event {object} apply — A chip was clicked; apply its view. Payload: the View API object.\n * @event {void} save-request — \"Save view\" clicked; open the save dialog.\n */\nexport default {\n\tname: 'CnSavedViewsControl',\n\n\tcomponents: { NcButton, ContentSaveOutline },\n\n\tmixins: [savedViewsList],\n\n\tinject: {\n\t\t/** The look CnAppRoot provides; `board` draws the views as chips. */\n\t\tcnLook: { default: 'nextcloud' },\n\t},\n\n\t// The chips and the button are two roots under the board look.\n\tinheritAttrs: false,\n\n\temits: ['apply', 'save-request'],\n\n\tcomputed: {\n\t\t/** @return {boolean} Whether the saved views draw as chips. */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\t/** @return {Array<object>} The top level of the tree, in tree order. */\n\t\tchipRows() {\n\t\t\treturn this.rows.filter((row) => row.depth === 0)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tonApply(view) {\n\t\t\t/**\n\t\t\t * @event apply A chip was clicked; apply its stored state.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('apply', view)\n\t\t},\n\n\t\tonSaveRequest() {\n\t\t\t/** @event save-request \"Save view\" clicked; open the save dialog. */\n\t\t\tthis.$emit('save-request')\n\t\t},\n\t},\n}\n</script>\n"],"names":[],"mappings":";;;;;AAyDA;;;AAGC;AACA;AACA;;AAEA;AACA;;;AAGD,aAAe;CACd,IAAI,EAAE,qBAAqB;;AAE3B,CAAA,UAAU,EAAE,EAAE,QAAQ,EAAE,oBAAoB;;CAE5C,MAAM,EAAE,CAAC,cAAc,CAAC;;AAExB,CAAA,MAAM,EAAE;;EAEP,MAAM,EAAE,EAAE,OAAO,EAAE,WAAU,EAAG;EAChC;;;AAGD,CAAA,YAAY,EAAE,KAAK;;AAEnB,CAAA,KAAK,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC;;AAEhC,CAAA,QAAQ,EAAE;;EAET,WAAW,GAAG;AACb,GAAA,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,CAAE,KAAI,OAAM;GAC5C;;;EAGD,QAAQ,GAAG;AACV,GAAA,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,UAAU,CAAC,CAAA;GAChD;EACD;;AAED,CAAA,OAAO,EAAE;EACR,OAAO,CAAC,IAAI,EAAE;AACb;;;;GAIA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAA;GACxB;;AAED,EAAA,aAAa,GAAG;;GAEf,IAAI,CAAC,KAAK,CAAC,cAAc,EAAA;GACzB;EACD;AACF;;;;"}