@conduction/nextcloud-vue 2.162.0 → 2.163.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/CnChipListManager/CnChipListManager.vue.js +9 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue.js.map +1 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue2.js +304 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue2.js.map +1 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue3.js +161 -0
- package/dist/esm/components/CnChipListManager/CnChipListManager.vue3.js.map +1 -0
- package/dist/esm/components/CnFilesBrowser/openRegisterSource.js +2 -1
- package/dist/esm/components/CnFilesBrowser/openRegisterSource.js.map +1 -1
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue.js +1 -1
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue2.js +4 -0
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js +2 -2
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue.js +1 -1
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue2.js +4 -3
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue2.js.map +1 -1
- package/dist/esm/components/CnIconPicker/CnIconPicker.vue3.js.map +1 -1
- package/dist/esm/components/CnIconPicker/iconCatalogues.js +16 -3
- package/dist/esm/components/CnIconPicker/iconCatalogues.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +76 -8
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +2 -2
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue2.js +2 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue2.js.map +1 -1
- package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue3.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +6 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue2.js +4 -0
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue3.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue.js +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue2.js +10 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue2.js +22 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue3.js.map +1 -1
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue2.js +4 -0
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue2.js.map +1 -1
- package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue3.js.map +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue.js +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue2.js +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue2.js.map +1 -1
- package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue3.js.map +1 -1
- package/dist/esm/composables/indexSources.js +30 -2
- package/dist/esm/composables/indexSources.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue.js +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue2.js +2 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue2.js +3 -2
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue.js +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue2.js +2 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue2.js +2 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue.js +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue2.js +2 -6
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue2.js +2 -6
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue3.js.map +1 -1
- package/dist/esm/integrations/utils/marker.js +35 -6
- package/dist/esm/integrations/utils/marker.js.map +1 -1
- package/dist/esm/l10n/en.json.js +8 -0
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +8 -0
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +478 -334
- package/dist/esm/utils/fillTemplate.js +3 -0
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/htmlToText.js +36 -0
- package/dist/esm/utils/htmlToText.js.map +1 -0
- package/dist/esm/utils/prototypeKeys.js +20 -0
- package/dist/esm/utils/prototypeKeys.js.map +1 -0
- package/dist/esm/utils/toastUiRawHtmlGuard.js +166 -0
- package/dist/esm/utils/toastUiRawHtmlGuard.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +11501 -10640
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +478 -334
- package/l10n/en.json +8 -0
- package/l10n/nl.json +8 -0
- package/package.json +1 -1
- package/src/components/CnChipListManager/CnChipListManager.vue +504 -0
- package/src/components/CnChipListManager/index.js +4 -0
- package/src/components/CnFilesBrowser/openRegisterSource.js +2 -1
- package/src/components/CnFilterRowsEditor/CnFilterRowsEditor.vue +4 -0
- package/src/components/CnFormDialog/CnFormDialog.vue +2 -2
- package/src/components/CnIconPicker/CnIconPicker.vue +4 -3
- package/src/components/CnIconPicker/iconCatalogues.js +16 -3
- package/src/components/CnIndexPage/CnIndexPage.vue +78 -10
- package/src/components/CnLinksWidgetForm/CnLinksWidgetForm.vue +2 -1
- package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +6 -1
- package/src/components/CnObjectListWidget/CnObjectListWidget.vue +1 -1
- package/src/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue +4 -0
- package/src/components/CnPageTreeNode/CnPageTreeRow.vue +10 -1
- package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +22 -0
- package/src/components/CnStagesWidgetForm/CnStagesWidgetForm.vue +4 -0
- package/src/components/CnWalkthrough/CnWalkthrough.vue +1 -1
- package/src/components/index.js +1 -0
- package/src/composables/indexSources.js +30 -2
- package/src/css/look-board-detail.css +6 -4
- package/src/css/look-board.css +46 -1
- package/src/index.js +1 -0
- package/src/integrations/builtin/analytics/CnAnalyticsCard.vue +2 -1
- package/src/integrations/builtin/analytics/CnAnalyticsTab.vue +3 -2
- package/src/integrations/builtin/photos/CnPhotosCard.vue +2 -1
- package/src/integrations/builtin/photos/CnPhotosTab.vue +2 -1
- package/src/integrations/builtin/xwiki/CnXwikiCard.vue +2 -6
- package/src/integrations/builtin/xwiki/CnXwikiTab.vue +2 -6
- package/src/integrations/utils/marker.js +35 -6
- package/src/utils/fillTemplate.js +3 -0
- package/src/utils/htmlToText.js +33 -0
- package/src/utils/prototypeKeys.js +17 -0
- package/src/utils/toastUiRawHtmlGuard.js +162 -0
package/l10n/en.json
CHANGED
|
@@ -271,6 +271,14 @@
|
|
|
271
271
|
"Actions": "Actions",
|
|
272
272
|
"optional": "optional",
|
|
273
273
|
"Add": "Add",
|
|
274
|
+
"New name for {name}": "New name for {name}",
|
|
275
|
+
"Double-click to rename": "Double-click to rename",
|
|
276
|
+
"New item": "New item",
|
|
277
|
+
"Enter a name": "Enter a name",
|
|
278
|
+
"You are not allowed to change this list.": "You are not allowed to change this list.",
|
|
279
|
+
"This name is already on the list.": "This name is already on the list.",
|
|
280
|
+
"The list could not be changed. Try again.": "The list could not be changed. Try again.",
|
|
281
|
+
"Delete {name} from the list? Items that already use it keep it.": "Delete {name} from the list? Items that already use it keep it.",
|
|
274
282
|
"Add condition": "Add condition",
|
|
275
283
|
"Add enum value": "Add enum value",
|
|
276
284
|
"Add group permission": "Add group permission",
|
package/l10n/nl.json
CHANGED
|
@@ -292,6 +292,14 @@
|
|
|
292
292
|
"Actions": "Acties",
|
|
293
293
|
"optional": "niet verplicht",
|
|
294
294
|
"Add": "Toevoegen",
|
|
295
|
+
"New name for {name}": "Nieuwe naam voor {name}",
|
|
296
|
+
"Double-click to rename": "Dubbelklik om te hernoemen",
|
|
297
|
+
"New item": "Nieuw item",
|
|
298
|
+
"Enter a name": "Naam invullen",
|
|
299
|
+
"You are not allowed to change this list.": "Je mag deze lijst niet wijzigen.",
|
|
300
|
+
"This name is already on the list.": "Deze naam staat al in de lijst.",
|
|
301
|
+
"The list could not be changed. Try again.": "De lijst kon niet worden gewijzigd. Probeer het opnieuw.",
|
|
302
|
+
"Delete {name} from the list? Items that already use it keep it.": "{name} uit de lijst verwijderen? Items die het al gebruiken, houden het.",
|
|
295
303
|
"Add condition": "Voorwaarde toevoegen",
|
|
296
304
|
"Add enum value": "Opsommingswaarde toevoegen",
|
|
297
305
|
"Add group permission": "Groepsrecht toevoegen",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduction/nextcloud-vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.163.0",
|
|
4
4
|
"description": "Shared Vue component library for Conduction Nextcloud apps — complements @nextcloud/vue with higher-level components, OpenRegister integration, and NL Design System support",
|
|
5
5
|
"homepage": "https://github.com/ConductionNL/nextcloud-vue#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
- SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<CnSettingsSection
|
|
8
|
+
:name="title"
|
|
9
|
+
:description="description"
|
|
10
|
+
class="cn-chip-list"
|
|
11
|
+
data-testid="cn-chip-list">
|
|
12
|
+
<NcLoadingIcon v-if="loading" :size="24" :name="t('nextcloud-vue', 'Loading …')" />
|
|
13
|
+
<ul v-else class="cn-chip-list__chips" :aria-label="title">
|
|
14
|
+
<li v-for="item in sorted"
|
|
15
|
+
:key="item.id"
|
|
16
|
+
class="cn-chip-list__chip"
|
|
17
|
+
:data-testid="`cn-chip-list-chip-${item.name}`">
|
|
18
|
+
<input v-if="renaming === item.id"
|
|
19
|
+
ref="renameInput"
|
|
20
|
+
v-model="renameDraft"
|
|
21
|
+
class="cn-chip-list__rename"
|
|
22
|
+
type="text"
|
|
23
|
+
:aria-label="t('nextcloud-vue', 'New name for {name}', { name: item.name })"
|
|
24
|
+
data-testid="cn-chip-list-rename-input"
|
|
25
|
+
@keydown="onRenameKey($event, item)"
|
|
26
|
+
@blur="saveRename(item)">
|
|
27
|
+
<span v-else
|
|
28
|
+
class="cn-chip-list__name"
|
|
29
|
+
:tabindex="readOnly ? null : 0"
|
|
30
|
+
:title="readOnly ? null : t('nextcloud-vue', 'Double-click to rename')"
|
|
31
|
+
data-testid="cn-chip-list-name"
|
|
32
|
+
@dblclick="startRename(item)"
|
|
33
|
+
@keydown.f2.prevent="startRename(item)">{{ item.name }}</span>
|
|
34
|
+
<button v-if="!readOnly"
|
|
35
|
+
type="button"
|
|
36
|
+
class="cn-chip-list__remove"
|
|
37
|
+
:disabled="busy"
|
|
38
|
+
:aria-label="t('nextcloud-vue', 'Delete {name}', { name: item.name })"
|
|
39
|
+
:title="t('nextcloud-vue', 'Delete {name}', { name: item.name })"
|
|
40
|
+
:data-testid="`cn-chip-list-remove-${item.name}`"
|
|
41
|
+
@click="confirming = item">
|
|
42
|
+
<Close :size="14" />
|
|
43
|
+
</button>
|
|
44
|
+
</li>
|
|
45
|
+
</ul>
|
|
46
|
+
|
|
47
|
+
<form v-if="!readOnly" class="cn-chip-list__add" @submit.prevent="add">
|
|
48
|
+
<div class="cn-chip-list__field">
|
|
49
|
+
<label :for="inputId" class="cn-chip-list__label">{{ resolvedAddLabel }}</label>
|
|
50
|
+
<input :id="inputId"
|
|
51
|
+
v-model="draft"
|
|
52
|
+
class="cn-chip-list__input"
|
|
53
|
+
type="text"
|
|
54
|
+
:placeholder="resolvedPlaceholder"
|
|
55
|
+
:aria-invalid="error ? 'true' : null"
|
|
56
|
+
data-testid="cn-chip-list-input">
|
|
57
|
+
</div>
|
|
58
|
+
<div class="cn-chip-list__actions">
|
|
59
|
+
<NcButton type="submit"
|
|
60
|
+
variant="secondary"
|
|
61
|
+
:disabled="busy"
|
|
62
|
+
data-testid="cn-chip-list-submit">
|
|
63
|
+
<template #icon>
|
|
64
|
+
<Plus :size="16" />
|
|
65
|
+
</template>
|
|
66
|
+
{{ resolvedSubmitLabel }}
|
|
67
|
+
</NcButton>
|
|
68
|
+
</div>
|
|
69
|
+
</form>
|
|
70
|
+
|
|
71
|
+
<p v-if="error"
|
|
72
|
+
class="cn-chip-list__error"
|
|
73
|
+
role="alert"
|
|
74
|
+
data-testid="cn-chip-list-error">
|
|
75
|
+
{{ error }}
|
|
76
|
+
</p>
|
|
77
|
+
<p v-if="note && !readOnly" class="cn-chip-list__note" data-testid="cn-chip-list-note">
|
|
78
|
+
{{ note }}
|
|
79
|
+
</p>
|
|
80
|
+
|
|
81
|
+
<CnConfirmDialog v-if="confirming"
|
|
82
|
+
:dialogTitle="t('nextcloud-vue', 'Delete {name}', { name: confirming.name })"
|
|
83
|
+
:message="resolvedDeleteMessage(confirming.name)"
|
|
84
|
+
:confirmLabel="t('nextcloud-vue', 'Delete')"
|
|
85
|
+
variant="error"
|
|
86
|
+
@confirm="remove(confirming)"
|
|
87
|
+
@close="confirming = null" />
|
|
88
|
+
</CnSettingsSection>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<script>
|
|
92
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
93
|
+
import { NcButton, NcLoadingIcon } from '@nextcloud/vue'
|
|
94
|
+
import Close from 'vue-material-design-icons/Close.vue'
|
|
95
|
+
import Plus from 'vue-material-design-icons/Plus.vue'
|
|
96
|
+
import CnConfirmDialog from '../../dialogs/CnConfirmDialog.vue'
|
|
97
|
+
import CnSettingsSection from '../CnSettingsSection/CnSettingsSection.vue'
|
|
98
|
+
import { cnFetchJson } from '../../utils/cnFetch.js'
|
|
99
|
+
|
|
100
|
+
let uid = 0
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* CnChipListManager: an admin card that keeps a list of words, one
|
|
104
|
+
* OpenRegister object each, as chips. It lists them, adds one, renames one on
|
|
105
|
+
* double-click (or F2) and deletes one after a confirm.
|
|
106
|
+
*
|
|
107
|
+
* A rename goes to `renameUrl` when given (`{id}` is the object's id), so an
|
|
108
|
+
* app can rewrite the word where it is used; otherwise it updates the object.
|
|
109
|
+
* The server decides who may write: a refusal shows as a line in the card.
|
|
110
|
+
*
|
|
111
|
+
* ```vue
|
|
112
|
+
* <CnChipListManager
|
|
113
|
+
* register="pipelinq"
|
|
114
|
+
* schema="label"
|
|
115
|
+
* :title="t('pipelinq', 'Labels')"
|
|
116
|
+
* :description="t('pipelinq', 'The labels people can pick for articles, leads and clients.')"
|
|
117
|
+
* renameUrl="/apps/pipelinq/api/labels/{id}/rename"
|
|
118
|
+
* :note="t('pipelinq', 'Double-click a label to rename it. A deleted label stays on the items that already use it.')" />
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
122
|
+
*/
|
|
123
|
+
export default {
|
|
124
|
+
name: 'CnChipListManager',
|
|
125
|
+
|
|
126
|
+
components: { Close, CnConfirmDialog, CnSettingsSection, NcButton, NcLoadingIcon, Plus },
|
|
127
|
+
|
|
128
|
+
props: {
|
|
129
|
+
/** The OpenRegister register slug or id. */
|
|
130
|
+
register: { type: String, required: true },
|
|
131
|
+
/** The OpenRegister schema slug or id; one object per word. */
|
|
132
|
+
schema: { type: String, required: true },
|
|
133
|
+
/** The property that holds the word. */
|
|
134
|
+
field: { type: String, default: 'name' },
|
|
135
|
+
/** The card's title. */
|
|
136
|
+
title: { type: String, default: '' },
|
|
137
|
+
/** The line under the title. */
|
|
138
|
+
description: { type: String, default: '' },
|
|
139
|
+
/** A line under the form, such as how renaming works. */
|
|
140
|
+
note: { type: String, default: '' },
|
|
141
|
+
/** POST endpoint for a rename, `{id}` filled; body `{ name }`. */
|
|
142
|
+
renameUrl: { type: String, default: '' },
|
|
143
|
+
/** The label above the new-word field; default "New item". */
|
|
144
|
+
addLabel: { type: String, default: '' },
|
|
145
|
+
/** The placeholder of the new-word field; default "Enter a name". */
|
|
146
|
+
placeholder: { type: String, default: '' },
|
|
147
|
+
/** The add button's text; default "Add". */
|
|
148
|
+
submitLabel: { type: String, default: '' },
|
|
149
|
+
/** The confirm sentence, `{name}` filled; default says items keep the word. */
|
|
150
|
+
deleteMessage: { type: String, default: '' },
|
|
151
|
+
/** Only list the words. */
|
|
152
|
+
readOnly: { type: Boolean, default: false },
|
|
153
|
+
/** The OpenRegister API base. */
|
|
154
|
+
apiBase: { type: String, default: '/apps/openregister/api' },
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
emits: ['changed'],
|
|
158
|
+
|
|
159
|
+
data() {
|
|
160
|
+
uid += 1
|
|
161
|
+
return {
|
|
162
|
+
inputId: `cn-chip-list-input-${uid}`,
|
|
163
|
+
items: [],
|
|
164
|
+
loading: true,
|
|
165
|
+
busy: false,
|
|
166
|
+
draft: '',
|
|
167
|
+
error: '',
|
|
168
|
+
renaming: null,
|
|
169
|
+
renameDraft: '',
|
|
170
|
+
confirming: null,
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
computed: {
|
|
175
|
+
/** The words in alphabetical order, case-insensitive. */
|
|
176
|
+
sorted() {
|
|
177
|
+
return [...this.items].sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }))
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
listUrl() {
|
|
181
|
+
return `${this.apiBase}/objects/${encodeURIComponent(this.register)}/${encodeURIComponent(this.schema)}`
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
resolvedAddLabel() {
|
|
185
|
+
return this.addLabel || t('nextcloud-vue', 'New item')
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
resolvedPlaceholder() {
|
|
189
|
+
return this.placeholder || t('nextcloud-vue', 'Enter a name')
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
resolvedSubmitLabel() {
|
|
193
|
+
return this.submitLabel || t('nextcloud-vue', 'Add')
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
created() {
|
|
198
|
+
this.load()
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
methods: {
|
|
202
|
+
t,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Read the words.
|
|
206
|
+
*
|
|
207
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
208
|
+
*/
|
|
209
|
+
async load() {
|
|
210
|
+
this.loading = true
|
|
211
|
+
try {
|
|
212
|
+
const data = await cnFetchJson(this.listUrl, { query: { _limit: 500 } })
|
|
213
|
+
const rows = Array.isArray(data?.results) ? data.results : []
|
|
214
|
+
this.items = rows
|
|
215
|
+
.map((row) => ({ id: row.id ?? row['@self']?.id ?? row.uuid, name: String(row[this.field] ?? ''), row }))
|
|
216
|
+
.filter((item) => item.id && item.name !== '')
|
|
217
|
+
} catch {
|
|
218
|
+
this.items = []
|
|
219
|
+
this.error = t('nextcloud-vue', 'The list could not be loaded.')
|
|
220
|
+
} finally {
|
|
221
|
+
this.loading = false
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Whether another word already has this name, whatever the case.
|
|
227
|
+
*
|
|
228
|
+
* @param {string} name The name.
|
|
229
|
+
* @param {string|null} exceptId The word being renamed.
|
|
230
|
+
* @return {boolean}
|
|
231
|
+
*/
|
|
232
|
+
taken(name, exceptId = null) {
|
|
233
|
+
const wanted = name.toLocaleLowerCase()
|
|
234
|
+
return this.items.some((item) => item.id !== exceptId && item.name.toLocaleLowerCase() === wanted)
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The line for a refused or failed write.
|
|
239
|
+
*
|
|
240
|
+
* @param {Error} err The failure.
|
|
241
|
+
* @return {string}
|
|
242
|
+
*/
|
|
243
|
+
failure(err) {
|
|
244
|
+
if (err?.status === 403) {
|
|
245
|
+
return t('nextcloud-vue', 'You are not allowed to change this list.')
|
|
246
|
+
}
|
|
247
|
+
if (err?.status === 409) {
|
|
248
|
+
return t('nextcloud-vue', 'This name is already on the list.')
|
|
249
|
+
}
|
|
250
|
+
return t('nextcloud-vue', 'The list could not be changed. Try again.')
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* The confirm sentence for deleting a word.
|
|
255
|
+
*
|
|
256
|
+
* @param {string} name The word.
|
|
257
|
+
* @return {string}
|
|
258
|
+
*/
|
|
259
|
+
resolvedDeleteMessage(name) {
|
|
260
|
+
if (this.deleteMessage) {
|
|
261
|
+
return this.deleteMessage.replace('{name}', name)
|
|
262
|
+
}
|
|
263
|
+
return t('nextcloud-vue', 'Delete {name} from the list? Items that already use it keep it.', { name })
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Add the typed word.
|
|
268
|
+
*
|
|
269
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
270
|
+
*/
|
|
271
|
+
async add() {
|
|
272
|
+
const name = this.draft.trim()
|
|
273
|
+
this.error = ''
|
|
274
|
+
if (name === '') {
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
if (this.taken(name)) {
|
|
278
|
+
this.error = t('nextcloud-vue', 'This name is already on the list.')
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
this.busy = true
|
|
282
|
+
try {
|
|
283
|
+
const saved = await cnFetchJson(this.listUrl, { method: 'POST', body: JSON.stringify({ [this.field]: name }) })
|
|
284
|
+
const id = saved?.id ?? saved?.['@self']?.id ?? saved?.uuid ?? name
|
|
285
|
+
this.items.push({ id, name, row: saved || { [this.field]: name } })
|
|
286
|
+
this.draft = ''
|
|
287
|
+
/**
|
|
288
|
+
* @event changed The list changed on the server: a word was added, renamed or deleted. No payload.
|
|
289
|
+
*/
|
|
290
|
+
this.$emit('changed')
|
|
291
|
+
} catch (err) {
|
|
292
|
+
this.error = this.failure(err)
|
|
293
|
+
} finally {
|
|
294
|
+
this.busy = false
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Turn a chip into a field holding its name.
|
|
300
|
+
*
|
|
301
|
+
* @param {object} item The word.
|
|
302
|
+
*/
|
|
303
|
+
startRename(item) {
|
|
304
|
+
if (this.readOnly || this.busy) {
|
|
305
|
+
return
|
|
306
|
+
}
|
|
307
|
+
this.error = ''
|
|
308
|
+
this.renaming = item.id
|
|
309
|
+
this.renameDraft = item.name
|
|
310
|
+
this.$nextTick(() => {
|
|
311
|
+
const input = Array.isArray(this.$refs.renameInput) ? this.$refs.renameInput[0] : this.$refs.renameInput
|
|
312
|
+
input?.focus()
|
|
313
|
+
input?.select()
|
|
314
|
+
})
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Enter saves the rename, Escape drops it.
|
|
319
|
+
*
|
|
320
|
+
* @param {KeyboardEvent} event The key.
|
|
321
|
+
* @param {object} item The word.
|
|
322
|
+
*/
|
|
323
|
+
onRenameKey(event, item) {
|
|
324
|
+
if (event.key === 'Enter') {
|
|
325
|
+
event.preventDefault()
|
|
326
|
+
this.saveRename(item)
|
|
327
|
+
} else if (event.key === 'Escape') {
|
|
328
|
+
event.preventDefault()
|
|
329
|
+
this.renaming = null
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Save the rename, through `renameUrl` when given.
|
|
335
|
+
*
|
|
336
|
+
* @param {object} item The word.
|
|
337
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
338
|
+
*/
|
|
339
|
+
async saveRename(item) {
|
|
340
|
+
if (this.renaming !== item.id) {
|
|
341
|
+
return
|
|
342
|
+
}
|
|
343
|
+
const name = this.renameDraft.trim()
|
|
344
|
+
this.renaming = null
|
|
345
|
+
if (name === '' || name === item.name) {
|
|
346
|
+
return
|
|
347
|
+
}
|
|
348
|
+
if (this.taken(name, item.id)) {
|
|
349
|
+
this.error = t('nextcloud-vue', 'This name is already on the list.')
|
|
350
|
+
return
|
|
351
|
+
}
|
|
352
|
+
this.busy = true
|
|
353
|
+
try {
|
|
354
|
+
if (this.renameUrl) {
|
|
355
|
+
await cnFetchJson(this.renameUrl.replace('{id}', encodeURIComponent(item.id)), { method: 'POST', body: JSON.stringify({ name }) })
|
|
356
|
+
} else {
|
|
357
|
+
const row = { ...(item.row || {}), [this.field]: name }
|
|
358
|
+
delete row['@self']
|
|
359
|
+
await cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'PUT', body: JSON.stringify(row) })
|
|
360
|
+
}
|
|
361
|
+
item.name = name
|
|
362
|
+
item.row = { ...item.row, [this.field]: name }
|
|
363
|
+
this.$emit('changed')
|
|
364
|
+
} catch (err) {
|
|
365
|
+
this.error = this.failure(err)
|
|
366
|
+
} finally {
|
|
367
|
+
this.busy = false
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Delete a word after the confirm.
|
|
373
|
+
*
|
|
374
|
+
* @param {object} item The word.
|
|
375
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
376
|
+
*/
|
|
377
|
+
async remove(item) {
|
|
378
|
+
this.confirming = null
|
|
379
|
+
this.error = ''
|
|
380
|
+
this.busy = true
|
|
381
|
+
try {
|
|
382
|
+
await cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'DELETE' })
|
|
383
|
+
this.items = this.items.filter((other) => other.id !== item.id)
|
|
384
|
+
this.$emit('changed')
|
|
385
|
+
} catch (err) {
|
|
386
|
+
this.error = this.failure(err)
|
|
387
|
+
} finally {
|
|
388
|
+
this.busy = false
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
}
|
|
393
|
+
</script>
|
|
394
|
+
|
|
395
|
+
<style scoped>
|
|
396
|
+
.cn-chip-list__chips {
|
|
397
|
+
display: flex;
|
|
398
|
+
flex-wrap: wrap;
|
|
399
|
+
gap: 8px;
|
|
400
|
+
margin: 0 0 14px;
|
|
401
|
+
padding: 0;
|
|
402
|
+
list-style: none;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.cn-chip-list__chip {
|
|
406
|
+
display: inline-flex;
|
|
407
|
+
align-items: center;
|
|
408
|
+
gap: 4px;
|
|
409
|
+
height: 30px;
|
|
410
|
+
padding: 0 4px 0 12px;
|
|
411
|
+
border-radius: 15px;
|
|
412
|
+
background: var(--color-background-dark);
|
|
413
|
+
color: var(--color-main-text);
|
|
414
|
+
font-size: 14px;
|
|
415
|
+
font-weight: 600;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.cn-chip-list__name {
|
|
419
|
+
cursor: text;
|
|
420
|
+
border-radius: 4px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.cn-chip-list__name:focus-visible {
|
|
424
|
+
outline: 2px solid var(--color-primary-element);
|
|
425
|
+
outline-offset: 2px;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.cn-chip-list__rename {
|
|
429
|
+
height: 24px;
|
|
430
|
+
min-height: 24px;
|
|
431
|
+
width: 14ch;
|
|
432
|
+
margin: 0;
|
|
433
|
+
padding: 0 6px;
|
|
434
|
+
font: inherit;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.cn-chip-list__remove {
|
|
438
|
+
display: inline-flex;
|
|
439
|
+
align-items: center;
|
|
440
|
+
justify-content: center;
|
|
441
|
+
flex: none;
|
|
442
|
+
width: 36px;
|
|
443
|
+
height: 36px;
|
|
444
|
+
min-height: 36px;
|
|
445
|
+
margin: 0;
|
|
446
|
+
padding: 0;
|
|
447
|
+
border: 0;
|
|
448
|
+
border-radius: 18px;
|
|
449
|
+
background: transparent;
|
|
450
|
+
color: inherit;
|
|
451
|
+
cursor: pointer;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.cn-chip-list__remove:hover,
|
|
455
|
+
.cn-chip-list__remove:focus-visible {
|
|
456
|
+
background: var(--color-background-hover);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.cn-chip-list__add {
|
|
460
|
+
display: flex;
|
|
461
|
+
flex-direction: column;
|
|
462
|
+
gap: 14px;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.cn-chip-list__field {
|
|
466
|
+
display: flex;
|
|
467
|
+
flex-direction: column;
|
|
468
|
+
gap: 6px;
|
|
469
|
+
max-width: 420px;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.cn-chip-list__label {
|
|
473
|
+
font-size: 14px;
|
|
474
|
+
font-weight: 600;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.cn-chip-list__input {
|
|
478
|
+
width: 100%;
|
|
479
|
+
height: 40px;
|
|
480
|
+
margin: 0;
|
|
481
|
+
padding: 0 12px;
|
|
482
|
+
box-sizing: border-box;
|
|
483
|
+
border: 1px solid var(--color-border-maxcontrast);
|
|
484
|
+
border-radius: var(--border-radius-element, 8px);
|
|
485
|
+
font: inherit;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.cn-chip-list__actions {
|
|
489
|
+
display: flex;
|
|
490
|
+
flex-wrap: wrap;
|
|
491
|
+
gap: 8px;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.cn-chip-list__error {
|
|
495
|
+
margin: 10px 0 0;
|
|
496
|
+
color: var(--color-error-text, var(--color-error));
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.cn-chip-list__note {
|
|
500
|
+
margin: 14px 0 0;
|
|
501
|
+
font-size: 13px;
|
|
502
|
+
color: var(--color-text-maxcontrast);
|
|
503
|
+
}
|
|
504
|
+
</style>
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import axios from '@nextcloud/axios'
|
|
21
21
|
import { FileType } from '@nextcloud/files'
|
|
22
22
|
import { generateUrl } from '@nextcloud/router'
|
|
23
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* A browser path (`/a/b`) as the API's relative path (`a/b`).
|
|
@@ -28,7 +29,7 @@ import { generateUrl } from '@nextcloud/router'
|
|
|
28
29
|
* @return {string} The relative path, empty for the root.
|
|
29
30
|
*/
|
|
30
31
|
export function toApiPath(path) {
|
|
31
|
-
return String(path || '').replace(
|
|
32
|
+
return stripTrailingSlashes(String(path || '')).replace(/^\/+/, '')
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -58,6 +58,7 @@ import { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'
|
|
|
58
58
|
import Close from 'vue-material-design-icons/Close.vue'
|
|
59
59
|
import Plus from 'vue-material-design-icons/Plus.vue'
|
|
60
60
|
import CnFieldPicker from '../CnFieldPicker/CnFieldPicker.vue'
|
|
61
|
+
import { isPrototypeKey } from '../../utils/prototypeKeys.js'
|
|
61
62
|
import { FILTER_OPERATORS } from './filterRows.js'
|
|
62
63
|
|
|
63
64
|
/**
|
|
@@ -211,6 +212,9 @@ export default {
|
|
|
211
212
|
* @return {void}
|
|
212
213
|
*/
|
|
213
214
|
update(i, cell, value) {
|
|
215
|
+
if (isPrototypeKey(cell)) {
|
|
216
|
+
return
|
|
217
|
+
}
|
|
214
218
|
this.rows[i][cell] = value
|
|
215
219
|
this.emit()
|
|
216
220
|
},
|
|
@@ -1054,6 +1054,7 @@ import { objectDisplayName } from '../../utils/objectName.js'
|
|
|
1054
1054
|
import { fieldWithOptionsFrom, filterOptions, formTokenKeys, isOptionsFrom, loadOptionsFrom, resolveFormTokens } from '../../utils/optionsFrom.js'
|
|
1055
1055
|
import { languageOptions, resolveDefaultToken, timezoneOptions } from '../../utils/pickerOptions.js'
|
|
1056
1056
|
import { getDotted, planPropertySourceFill } from '../../utils/propertySourceFill.js'
|
|
1057
|
+
import { isPrototypeKey } from '../../utils/prototypeKeys.js'
|
|
1057
1058
|
import { pruneRows } from '../../utils/pruneRows.js'
|
|
1058
1059
|
import { readPath } from '../../utils/readPath.js'
|
|
1059
1060
|
import { resolveFilterValue } from '../../utils/resolveFilterTokens.js'
|
|
@@ -4281,8 +4282,7 @@ export default {
|
|
|
4281
4282
|
return
|
|
4282
4283
|
}
|
|
4283
4284
|
const [head, ...rest] = key.split('.')
|
|
4284
|
-
|
|
4285
|
-
if (unsafe.includes(head) || rest.some((k) => unsafe.includes(k))) {
|
|
4285
|
+
if (isPrototypeKey(head) || rest.some(isPrototypeKey)) {
|
|
4286
4286
|
return
|
|
4287
4287
|
}
|
|
4288
4288
|
const clone = JSON.parse(JSON.stringify(this.formData[head] ?? {}))
|
|
@@ -694,12 +694,13 @@ export default {
|
|
|
694
694
|
formatSVG() {
|
|
695
695
|
try {
|
|
696
696
|
const input = String(this.customSvg || '').trim()
|
|
697
|
-
const
|
|
698
|
-
|
|
697
|
+
const start = input.search(/<svg/i)
|
|
698
|
+
const length = start === -1 ? -1 : input.slice(start).search(/<\/svg>/i)
|
|
699
|
+
if (length === -1) {
|
|
699
700
|
return
|
|
700
701
|
}
|
|
701
702
|
const parser = new DOMParser()
|
|
702
|
-
const doc = parser.parseFromString(
|
|
703
|
+
const doc = parser.parseFromString(input.slice(start, start + length + 6), 'image/svg+xml')
|
|
703
704
|
if (doc.getElementsByTagName('parsererror').length > 0) {
|
|
704
705
|
return
|
|
705
706
|
}
|
|
@@ -166,10 +166,23 @@ export function fromOpenGemeenten(list = []) {
|
|
|
166
166
|
* @param {string|undefined} svg the SVG markup.
|
|
167
167
|
* @return {string|undefined} the first path's `d` attribute, or undefined.
|
|
168
168
|
*/
|
|
169
|
-
function extractSvgPath(svg) {
|
|
169
|
+
export function extractSvgPath(svg) {
|
|
170
170
|
if (typeof svg !== 'string') {
|
|
171
171
|
return undefined
|
|
172
172
|
}
|
|
173
|
-
const
|
|
174
|
-
|
|
173
|
+
const open = /<path/gi
|
|
174
|
+
let tag
|
|
175
|
+
while ((tag = open.exec(svg)) !== null) {
|
|
176
|
+
const end = svg.indexOf('>', tag.index)
|
|
177
|
+
const attrs = svg.slice(tag.index + 5, end === -1 ? svg.length : end)
|
|
178
|
+
const d = /\sd="([^"]+)"/i.exec(attrs)
|
|
179
|
+
if (d) {
|
|
180
|
+
return d[1]
|
|
181
|
+
}
|
|
182
|
+
if (end === -1) {
|
|
183
|
+
return undefined
|
|
184
|
+
}
|
|
185
|
+
open.lastIndex = end
|
|
186
|
+
}
|
|
187
|
+
return undefined
|
|
175
188
|
}
|