@conduction/nextcloud-vue 2.161.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/CnActionsMenu/CnActionsMenu.vue2.js +3 -2
- package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue2.js.map +1 -1
- package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue3.js.map +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue.js +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js +2 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js.map +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue3.js.map +1 -1
- 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/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +2 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js +8 -8
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js +23 -0
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +48 -5
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +2 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +4 -3
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +6 -5
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/openRegisterSource.js +2 -1
- package/dist/esm/components/CnFilesBrowser/openRegisterSource.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js +2 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue3.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/CnFlowRunsWidget/CnFlowRunsWidget.vue.js +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js +41 -39
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFolderSidebar/webdavFolders.js +2 -1
- package/dist/esm/components/CnFolderSidebar/webdavFolders.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 +87 -11
- 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/CnMenuWidget/menuActive.js +2 -1
- package/dist/esm/components/CnMenuWidget/menuActive.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/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +39 -2
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue.js +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.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/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +5 -5
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.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/email/CnEmailTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js +130 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js +27 -16
- package/dist/esm/integrations/builtin/email/CnEmailTab.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 +17 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +17 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +1038 -822
- package/dist/esm/utils/buildManifestRoutes.js +2 -1
- package/dist/esm/utils/buildManifestRoutes.js.map +1 -1
- package/dist/esm/utils/cnFetch.js +1 -15
- package/dist/esm/utils/cnFetch.js.map +1 -1
- package/dist/esm/utils/fillTemplate.js +32 -2
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/forge.js +4 -1
- package/dist/esm/utils/forge.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/myTeam.js +17 -3
- package/dist/esm/utils/myTeam.js.map +1 -1
- package/dist/esm/utils/prototypeKeys.js +20 -0
- package/dist/esm/utils/prototypeKeys.js.map +1 -0
- package/dist/esm/utils/rowAggregate.js +20 -1
- package/dist/esm/utils/rowAggregate.js.map +1 -1
- package/dist/esm/utils/toastUiRawHtmlGuard.js +166 -0
- package/dist/esm/utils/toastUiRawHtmlGuard.js.map +1 -0
- package/dist/esm/utils/trailingSlashes.js +24 -0
- package/dist/esm/utils/trailingSlashes.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +12490 -11295
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1038 -822
- package/l10n/en.json +17 -1
- package/l10n/nl.json +17 -1
- package/package.json +1 -1
- package/src/components/CnActionsMenu/CnActionsMenu.vue +3 -2
- package/src/components/CnAddressSearch/CnAddressSearch.vue +2 -1
- package/src/components/CnChipListManager/CnChipListManager.vue +504 -0
- package/src/components/CnChipListManager/index.js +4 -0
- package/src/components/CnDashboardPage/CnDashboardPage.vue +2 -1
- package/src/components/CnDataTable/CnDataTable.vue +8 -8
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +23 -0
- package/src/components/CnFactsWidget/CnFactsWidget.vue +49 -5
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +4 -3
- package/src/components/CnFilesBrowser/filesBrowser.js +6 -5
- package/src/components/CnFilesBrowser/openRegisterSource.js +2 -1
- package/src/components/CnFilesWidget/CnFilesWidget.vue +2 -1
- package/src/components/CnFilterRowsEditor/CnFilterRowsEditor.vue +4 -0
- package/src/components/CnFlowRunsWidget/CnFlowRunsWidget.vue +1 -1
- package/src/components/CnFolderSidebar/webdavFolders.js +2 -1
- 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 +89 -13
- package/src/components/CnLinksWidgetForm/CnLinksWidgetForm.vue +2 -1
- package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +6 -1
- package/src/components/CnMenuWidget/menuActive.js +2 -1
- package/src/components/CnObjectListWidget/CnObjectListWidget.vue +1 -1
- package/src/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue +4 -0
- package/src/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +40 -3
- package/src/components/CnPageTreeNode/CnPageTreeNode.vue +2 -1
- package/src/components/CnPageTreeNode/CnPageTreeRow.vue +10 -1
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +5 -5
- 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/dialog.css +7 -0
- package/src/css/look-board-detail.css +41 -4
- package/src/css/look-board.css +64 -2
- 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/email/CnEmailTab.vue +155 -4
- 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/buildManifestRoutes.js +2 -1
- package/src/utils/cnFetch.js +3 -15
- package/src/utils/fillTemplate.js +32 -2
- package/src/utils/forge.js +3 -1
- package/src/utils/htmlToText.js +33 -0
- package/src/utils/myTeam.js +17 -3
- package/src/utils/prototypeKeys.js +17 -0
- package/src/utils/rowAggregate.js +19 -0
- package/src/utils/toastUiRawHtmlGuard.js +162 -0
- package/src/utils/trailingSlashes.js +21 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { translate } from '@nextcloud/l10n';
|
|
2
|
+
import { NcButton, NcLoadingIcon } from '@nextcloud/vue';
|
|
3
|
+
import Close from 'vue-material-design-icons/Close.vue';
|
|
4
|
+
import Plus from 'vue-material-design-icons/Plus.vue';
|
|
5
|
+
import __sfc_main from '../../dialogs/CnConfirmDialog.vue.js';
|
|
6
|
+
import __sfc_main$1 from '../CnSettingsSection/CnSettingsSection.vue.js';
|
|
7
|
+
import { cnFetchJson } from '../../utils/cnFetch.js';
|
|
8
|
+
|
|
9
|
+
let uid = 0;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* CnChipListManager: an admin card that keeps a list of words, one
|
|
13
|
+
* OpenRegister object each, as chips. It lists them, adds one, renames one on
|
|
14
|
+
* double-click (or F2) and deletes one after a confirm.
|
|
15
|
+
*
|
|
16
|
+
* A rename goes to `renameUrl` when given (`{id}` is the object's id), so an
|
|
17
|
+
* app can rewrite the word where it is used; otherwise it updates the object.
|
|
18
|
+
* The server decides who may write: a refusal shows as a line in the card.
|
|
19
|
+
*
|
|
20
|
+
* ```vue
|
|
21
|
+
* <CnChipListManager
|
|
22
|
+
* register="pipelinq"
|
|
23
|
+
* schema="label"
|
|
24
|
+
* :title="t('pipelinq', 'Labels')"
|
|
25
|
+
* :description="t('pipelinq', 'The labels people can pick for articles, leads and clients.')"
|
|
26
|
+
* renameUrl="/apps/pipelinq/api/labels/{id}/rename"
|
|
27
|
+
* :note="t('pipelinq', 'Double-click a label to rename it. A deleted label stays on the items that already use it.')" />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
31
|
+
*/
|
|
32
|
+
var script = {
|
|
33
|
+
name: 'CnChipListManager',
|
|
34
|
+
|
|
35
|
+
components: { Close, CnConfirmDialog: __sfc_main, CnSettingsSection: __sfc_main$1, NcButton, NcLoadingIcon, Plus },
|
|
36
|
+
|
|
37
|
+
props: {
|
|
38
|
+
/** The OpenRegister register slug or id. */
|
|
39
|
+
register: { type: String, required: true },
|
|
40
|
+
/** The OpenRegister schema slug or id; one object per word. */
|
|
41
|
+
schema: { type: String, required: true },
|
|
42
|
+
/** The property that holds the word. */
|
|
43
|
+
field: { type: String, default: 'name' },
|
|
44
|
+
/** The card's title. */
|
|
45
|
+
title: { type: String, default: '' },
|
|
46
|
+
/** The line under the title. */
|
|
47
|
+
description: { type: String, default: '' },
|
|
48
|
+
/** A line under the form, such as how renaming works. */
|
|
49
|
+
note: { type: String, default: '' },
|
|
50
|
+
/** POST endpoint for a rename, `{id}` filled; body `{ name }`. */
|
|
51
|
+
renameUrl: { type: String, default: '' },
|
|
52
|
+
/** The label above the new-word field; default "New item". */
|
|
53
|
+
addLabel: { type: String, default: '' },
|
|
54
|
+
/** The placeholder of the new-word field; default "Enter a name". */
|
|
55
|
+
placeholder: { type: String, default: '' },
|
|
56
|
+
/** The add button's text; default "Add". */
|
|
57
|
+
submitLabel: { type: String, default: '' },
|
|
58
|
+
/** The confirm sentence, `{name}` filled; default says items keep the word. */
|
|
59
|
+
deleteMessage: { type: String, default: '' },
|
|
60
|
+
/** Only list the words. */
|
|
61
|
+
readOnly: { type: Boolean, default: false },
|
|
62
|
+
/** The OpenRegister API base. */
|
|
63
|
+
apiBase: { type: String, default: '/apps/openregister/api' },
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
emits: ['changed'],
|
|
67
|
+
|
|
68
|
+
data() {
|
|
69
|
+
uid += 1;
|
|
70
|
+
return {
|
|
71
|
+
inputId: `cn-chip-list-input-${uid}`,
|
|
72
|
+
items: [],
|
|
73
|
+
loading: true,
|
|
74
|
+
busy: false,
|
|
75
|
+
draft: '',
|
|
76
|
+
error: '',
|
|
77
|
+
renaming: null,
|
|
78
|
+
renameDraft: '',
|
|
79
|
+
confirming: null,
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
computed: {
|
|
84
|
+
/** The words in alphabetical order, case-insensitive. */
|
|
85
|
+
sorted() {
|
|
86
|
+
return [...this.items].sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }))
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
listUrl() {
|
|
90
|
+
return `${this.apiBase}/objects/${encodeURIComponent(this.register)}/${encodeURIComponent(this.schema)}`
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
resolvedAddLabel() {
|
|
94
|
+
return this.addLabel || translate('nextcloud-vue', 'New item')
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
resolvedPlaceholder() {
|
|
98
|
+
return this.placeholder || translate('nextcloud-vue', 'Enter a name')
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
resolvedSubmitLabel() {
|
|
102
|
+
return this.submitLabel || translate('nextcloud-vue', 'Add')
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
created() {
|
|
107
|
+
this.load();
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
methods: {
|
|
111
|
+
t: translate,
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Read the words.
|
|
115
|
+
*
|
|
116
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
117
|
+
*/
|
|
118
|
+
async load() {
|
|
119
|
+
this.loading = true;
|
|
120
|
+
try {
|
|
121
|
+
const data = await cnFetchJson(this.listUrl, { query: { _limit: 500 } });
|
|
122
|
+
const rows = Array.isArray(data?.results) ? data.results : [];
|
|
123
|
+
this.items = rows
|
|
124
|
+
.map((row) => ({ id: row.id ?? row['@self']?.id ?? row.uuid, name: String(row[this.field] ?? ''), row }))
|
|
125
|
+
.filter((item) => item.id && item.name !== '');
|
|
126
|
+
} catch {
|
|
127
|
+
this.items = [];
|
|
128
|
+
this.error = translate('nextcloud-vue', 'The list could not be loaded.');
|
|
129
|
+
} finally {
|
|
130
|
+
this.loading = false;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Whether another word already has this name, whatever the case.
|
|
136
|
+
*
|
|
137
|
+
* @param {string} name The name.
|
|
138
|
+
* @param {string|null} exceptId The word being renamed.
|
|
139
|
+
* @return {boolean}
|
|
140
|
+
*/
|
|
141
|
+
taken(name, exceptId = null) {
|
|
142
|
+
const wanted = name.toLocaleLowerCase();
|
|
143
|
+
return this.items.some((item) => item.id !== exceptId && item.name.toLocaleLowerCase() === wanted)
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The line for a refused or failed write.
|
|
148
|
+
*
|
|
149
|
+
* @param {Error} err The failure.
|
|
150
|
+
* @return {string}
|
|
151
|
+
*/
|
|
152
|
+
failure(err) {
|
|
153
|
+
if (err?.status === 403) {
|
|
154
|
+
return translate('nextcloud-vue', 'You are not allowed to change this list.')
|
|
155
|
+
}
|
|
156
|
+
if (err?.status === 409) {
|
|
157
|
+
return translate('nextcloud-vue', 'This name is already on the list.')
|
|
158
|
+
}
|
|
159
|
+
return translate('nextcloud-vue', 'The list could not be changed. Try again.')
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The confirm sentence for deleting a word.
|
|
164
|
+
*
|
|
165
|
+
* @param {string} name The word.
|
|
166
|
+
* @return {string}
|
|
167
|
+
*/
|
|
168
|
+
resolvedDeleteMessage(name) {
|
|
169
|
+
if (this.deleteMessage) {
|
|
170
|
+
return this.deleteMessage.replace('{name}', name)
|
|
171
|
+
}
|
|
172
|
+
return translate('nextcloud-vue', 'Delete {name} from the list? Items that already use it keep it.', { name })
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Add the typed word.
|
|
177
|
+
*
|
|
178
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
179
|
+
*/
|
|
180
|
+
async add() {
|
|
181
|
+
const name = this.draft.trim();
|
|
182
|
+
this.error = '';
|
|
183
|
+
if (name === '') {
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
if (this.taken(name)) {
|
|
187
|
+
this.error = translate('nextcloud-vue', 'This name is already on the list.');
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
this.busy = true;
|
|
191
|
+
try {
|
|
192
|
+
const saved = await cnFetchJson(this.listUrl, { method: 'POST', body: JSON.stringify({ [this.field]: name }) });
|
|
193
|
+
const id = saved?.id ?? saved?.['@self']?.id ?? saved?.uuid ?? name;
|
|
194
|
+
this.items.push({ id, name, row: saved || { [this.field]: name } });
|
|
195
|
+
this.draft = '';
|
|
196
|
+
/**
|
|
197
|
+
* @event changed The list changed on the server: a word was added, renamed or deleted. No payload.
|
|
198
|
+
*/
|
|
199
|
+
this.$emit('changed');
|
|
200
|
+
} catch (err) {
|
|
201
|
+
this.error = this.failure(err);
|
|
202
|
+
} finally {
|
|
203
|
+
this.busy = false;
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Turn a chip into a field holding its name.
|
|
209
|
+
*
|
|
210
|
+
* @param {object} item The word.
|
|
211
|
+
*/
|
|
212
|
+
startRename(item) {
|
|
213
|
+
if (this.readOnly || this.busy) {
|
|
214
|
+
return
|
|
215
|
+
}
|
|
216
|
+
this.error = '';
|
|
217
|
+
this.renaming = item.id;
|
|
218
|
+
this.renameDraft = item.name;
|
|
219
|
+
this.$nextTick(() => {
|
|
220
|
+
const input = Array.isArray(this.$refs.renameInput) ? this.$refs.renameInput[0] : this.$refs.renameInput;
|
|
221
|
+
input?.focus();
|
|
222
|
+
input?.select();
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Enter saves the rename, Escape drops it.
|
|
228
|
+
*
|
|
229
|
+
* @param {KeyboardEvent} event The key.
|
|
230
|
+
* @param {object} item The word.
|
|
231
|
+
*/
|
|
232
|
+
onRenameKey(event, item) {
|
|
233
|
+
if (event.key === 'Enter') {
|
|
234
|
+
event.preventDefault();
|
|
235
|
+
this.saveRename(item);
|
|
236
|
+
} else if (event.key === 'Escape') {
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
this.renaming = null;
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Save the rename, through `renameUrl` when given.
|
|
244
|
+
*
|
|
245
|
+
* @param {object} item The word.
|
|
246
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
247
|
+
*/
|
|
248
|
+
async saveRename(item) {
|
|
249
|
+
if (this.renaming !== item.id) {
|
|
250
|
+
return
|
|
251
|
+
}
|
|
252
|
+
const name = this.renameDraft.trim();
|
|
253
|
+
this.renaming = null;
|
|
254
|
+
if (name === '' || name === item.name) {
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
if (this.taken(name, item.id)) {
|
|
258
|
+
this.error = translate('nextcloud-vue', 'This name is already on the list.');
|
|
259
|
+
return
|
|
260
|
+
}
|
|
261
|
+
this.busy = true;
|
|
262
|
+
try {
|
|
263
|
+
if (this.renameUrl) {
|
|
264
|
+
await cnFetchJson(this.renameUrl.replace('{id}', encodeURIComponent(item.id)), { method: 'POST', body: JSON.stringify({ name }) });
|
|
265
|
+
} else {
|
|
266
|
+
const row = { ...(item.row || {}), [this.field]: name };
|
|
267
|
+
delete row['@self'];
|
|
268
|
+
await cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'PUT', body: JSON.stringify(row) });
|
|
269
|
+
}
|
|
270
|
+
item.name = name;
|
|
271
|
+
item.row = { ...item.row, [this.field]: name };
|
|
272
|
+
this.$emit('changed');
|
|
273
|
+
} catch (err) {
|
|
274
|
+
this.error = this.failure(err);
|
|
275
|
+
} finally {
|
|
276
|
+
this.busy = false;
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Delete a word after the confirm.
|
|
282
|
+
*
|
|
283
|
+
* @param {object} item The word.
|
|
284
|
+
* @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips
|
|
285
|
+
*/
|
|
286
|
+
async remove(item) {
|
|
287
|
+
this.confirming = null;
|
|
288
|
+
this.error = '';
|
|
289
|
+
this.busy = true;
|
|
290
|
+
try {
|
|
291
|
+
await cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'DELETE' });
|
|
292
|
+
this.items = this.items.filter((other) => other.id !== item.id);
|
|
293
|
+
this.$emit('changed');
|
|
294
|
+
} catch (err) {
|
|
295
|
+
this.error = this.failure(err);
|
|
296
|
+
} finally {
|
|
297
|
+
this.busy = false;
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export { script as default };
|
|
304
|
+
//# sourceMappingURL=CnChipListManager.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnChipListManager.vue2.js","sources":["../../../../src/components/CnChipListManager/CnChipListManager.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<CnSettingsSection\n\t\t:name=\"title\"\n\t\t:description=\"description\"\n\t\tclass=\"cn-chip-list\"\n\t\tdata-testid=\"cn-chip-list\">\n\t\t<NcLoadingIcon v-if=\"loading\" :size=\"24\" :name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t<ul v-else class=\"cn-chip-list__chips\" :aria-label=\"title\">\n\t\t\t<li v-for=\"item in sorted\"\n\t\t\t\t:key=\"item.id\"\n\t\t\t\tclass=\"cn-chip-list__chip\"\n\t\t\t\t:data-testid=\"`cn-chip-list-chip-${item.name}`\">\n\t\t\t\t<input v-if=\"renaming === item.id\"\n\t\t\t\t\tref=\"renameInput\"\n\t\t\t\t\tv-model=\"renameDraft\"\n\t\t\t\t\tclass=\"cn-chip-list__rename\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'New name for {name}', { name: item.name })\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-rename-input\"\n\t\t\t\t\t@keydown=\"onRenameKey($event, item)\"\n\t\t\t\t\t@blur=\"saveRename(item)\">\n\t\t\t\t<span v-else\n\t\t\t\t\tclass=\"cn-chip-list__name\"\n\t\t\t\t\t:tabindex=\"readOnly ? null : 0\"\n\t\t\t\t\t:title=\"readOnly ? null : t('nextcloud-vue', 'Double-click to rename')\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-name\"\n\t\t\t\t\t@dblclick=\"startRename(item)\"\n\t\t\t\t\t@keydown.f2.prevent=\"startRename(item)\">{{ item.name }}</span>\n\t\t\t\t<button v-if=\"!readOnly\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-chip-list__remove\"\n\t\t\t\t\t:disabled=\"busy\"\n\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Delete {name}', { name: item.name })\"\n\t\t\t\t\t:title=\"t('nextcloud-vue', 'Delete {name}', { name: item.name })\"\n\t\t\t\t\t:data-testid=\"`cn-chip-list-remove-${item.name}`\"\n\t\t\t\t\t@click=\"confirming = item\">\n\t\t\t\t\t<Close :size=\"14\" />\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<form v-if=\"!readOnly\" class=\"cn-chip-list__add\" @submit.prevent=\"add\">\n\t\t\t<div class=\"cn-chip-list__field\">\n\t\t\t\t<label :for=\"inputId\" class=\"cn-chip-list__label\">{{ resolvedAddLabel }}</label>\n\t\t\t\t<input :id=\"inputId\"\n\t\t\t\t\tv-model=\"draft\"\n\t\t\t\t\tclass=\"cn-chip-list__input\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t:placeholder=\"resolvedPlaceholder\"\n\t\t\t\t\t:aria-invalid=\"error ? 'true' : null\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-input\">\n\t\t\t</div>\n\t\t\t<div class=\"cn-chip-list__actions\">\n\t\t\t\t<NcButton type=\"submit\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t:disabled=\"busy\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-submit\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<Plus :size=\"16\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ resolvedSubmitLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</form>\n\n\t\t<p v-if=\"error\"\n\t\t\tclass=\"cn-chip-list__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-chip-list-error\">\n\t\t\t{{ error }}\n\t\t</p>\n\t\t<p v-if=\"note && !readOnly\" class=\"cn-chip-list__note\" data-testid=\"cn-chip-list-note\">\n\t\t\t{{ note }}\n\t\t</p>\n\n\t\t<CnConfirmDialog v-if=\"confirming\"\n\t\t\t:dialogTitle=\"t('nextcloud-vue', 'Delete {name}', { name: confirming.name })\"\n\t\t\t:message=\"resolvedDeleteMessage(confirming.name)\"\n\t\t\t:confirmLabel=\"t('nextcloud-vue', 'Delete')\"\n\t\t\tvariant=\"error\"\n\t\t\t@confirm=\"remove(confirming)\"\n\t\t\t@close=\"confirming = null\" />\n\t</CnSettingsSection>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon } from '@nextcloud/vue'\nimport Close from 'vue-material-design-icons/Close.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport CnConfirmDialog from '../../dialogs/CnConfirmDialog.vue'\nimport CnSettingsSection from '../CnSettingsSection/CnSettingsSection.vue'\nimport { cnFetchJson } from '../../utils/cnFetch.js'\n\nlet uid = 0\n\n/**\n * CnChipListManager: an admin card that keeps a list of words, one\n * OpenRegister object each, as chips. It lists them, adds one, renames one on\n * double-click (or F2) and deletes one after a confirm.\n *\n * A rename goes to `renameUrl` when given (`{id}` is the object's id), so an\n * app can rewrite the word where it is used; otherwise it updates the object.\n * The server decides who may write: a refusal shows as a line in the card.\n *\n * ```vue\n * <CnChipListManager\n * register=\"pipelinq\"\n * schema=\"label\"\n * :title=\"t('pipelinq', 'Labels')\"\n * :description=\"t('pipelinq', 'The labels people can pick for articles, leads and clients.')\"\n * renameUrl=\"/apps/pipelinq/api/labels/{id}/rename\"\n * :note=\"t('pipelinq', 'Double-click a label to rename it. A deleted label stays on the items that already use it.')\" />\n * ```\n *\n * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n */\nexport default {\n\tname: 'CnChipListManager',\n\n\tcomponents: { Close, CnConfirmDialog, CnSettingsSection, NcButton, NcLoadingIcon, Plus },\n\n\tprops: {\n\t\t/** The OpenRegister register slug or id. */\n\t\tregister: { type: String, required: true },\n\t\t/** The OpenRegister schema slug or id; one object per word. */\n\t\tschema: { type: String, required: true },\n\t\t/** The property that holds the word. */\n\t\tfield: { type: String, default: 'name' },\n\t\t/** The card's title. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** The line under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** A line under the form, such as how renaming works. */\n\t\tnote: { type: String, default: '' },\n\t\t/** POST endpoint for a rename, `{id}` filled; body `{ name }`. */\n\t\trenameUrl: { type: String, default: '' },\n\t\t/** The label above the new-word field; default \"New item\". */\n\t\taddLabel: { type: String, default: '' },\n\t\t/** The placeholder of the new-word field; default \"Enter a name\". */\n\t\tplaceholder: { type: String, default: '' },\n\t\t/** The add button's text; default \"Add\". */\n\t\tsubmitLabel: { type: String, default: '' },\n\t\t/** The confirm sentence, `{name}` filled; default says items keep the word. */\n\t\tdeleteMessage: { type: String, default: '' },\n\t\t/** Only list the words. */\n\t\treadOnly: { type: Boolean, default: false },\n\t\t/** The OpenRegister API base. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t},\n\n\temits: ['changed'],\n\n\tdata() {\n\t\tuid += 1\n\t\treturn {\n\t\t\tinputId: `cn-chip-list-input-${uid}`,\n\t\t\titems: [],\n\t\t\tloading: true,\n\t\t\tbusy: false,\n\t\t\tdraft: '',\n\t\t\terror: '',\n\t\t\trenaming: null,\n\t\t\trenameDraft: '',\n\t\t\tconfirming: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** The words in alphabetical order, case-insensitive. */\n\t\tsorted() {\n\t\t\treturn [...this.items].sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }))\n\t\t},\n\n\t\tlistUrl() {\n\t\t\treturn `${this.apiBase}/objects/${encodeURIComponent(this.register)}/${encodeURIComponent(this.schema)}`\n\t\t},\n\n\t\tresolvedAddLabel() {\n\t\t\treturn this.addLabel || t('nextcloud-vue', 'New item')\n\t\t},\n\n\t\tresolvedPlaceholder() {\n\t\t\treturn this.placeholder || t('nextcloud-vue', 'Enter a name')\n\t\t},\n\n\t\tresolvedSubmitLabel() {\n\t\t\treturn this.submitLabel || t('nextcloud-vue', 'Add')\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.load()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Read the words.\n\t\t *\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync load() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst data = await cnFetchJson(this.listUrl, { query: { _limit: 500 } })\n\t\t\t\tconst rows = Array.isArray(data?.results) ? data.results : []\n\t\t\t\tthis.items = rows\n\t\t\t\t\t.map((row) => ({ id: row.id ?? row['@self']?.id ?? row.uuid, name: String(row[this.field] ?? ''), row }))\n\t\t\t\t\t.filter((item) => item.id && item.name !== '')\n\t\t\t} catch {\n\t\t\t\tthis.items = []\n\t\t\t\tthis.error = t('nextcloud-vue', 'The list could not be loaded.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether another word already has this name, whatever the case.\n\t\t *\n\t\t * @param {string} name The name.\n\t\t * @param {string|null} exceptId The word being renamed.\n\t\t * @return {boolean}\n\t\t */\n\t\ttaken(name, exceptId = null) {\n\t\t\tconst wanted = name.toLocaleLowerCase()\n\t\t\treturn this.items.some((item) => item.id !== exceptId && item.name.toLocaleLowerCase() === wanted)\n\t\t},\n\n\t\t/**\n\t\t * The line for a refused or failed write.\n\t\t *\n\t\t * @param {Error} err The failure.\n\t\t * @return {string}\n\t\t */\n\t\tfailure(err) {\n\t\t\tif (err?.status === 403) {\n\t\t\t\treturn t('nextcloud-vue', 'You are not allowed to change this list.')\n\t\t\t}\n\t\t\tif (err?.status === 409) {\n\t\t\t\treturn t('nextcloud-vue', 'This name is already on the list.')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'The list could not be changed. Try again.')\n\t\t},\n\n\t\t/**\n\t\t * The confirm sentence for deleting a word.\n\t\t *\n\t\t * @param {string} name The word.\n\t\t * @return {string}\n\t\t */\n\t\tresolvedDeleteMessage(name) {\n\t\t\tif (this.deleteMessage) {\n\t\t\t\treturn this.deleteMessage.replace('{name}', name)\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Delete {name} from the list? Items that already use it keep it.', { name })\n\t\t},\n\n\t\t/**\n\t\t * Add the typed word.\n\t\t *\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync add() {\n\t\t\tconst name = this.draft.trim()\n\t\t\tthis.error = ''\n\t\t\tif (name === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.taken(name)) {\n\t\t\t\tthis.error = t('nextcloud-vue', 'This name is already on the list.')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tconst saved = await cnFetchJson(this.listUrl, { method: 'POST', body: JSON.stringify({ [this.field]: name }) })\n\t\t\t\tconst id = saved?.id ?? saved?.['@self']?.id ?? saved?.uuid ?? name\n\t\t\t\tthis.items.push({ id, name, row: saved || { [this.field]: name } })\n\t\t\t\tthis.draft = ''\n\t\t\t\t/**\n\t\t\t\t * @event changed The list changed on the server: a word was added, renamed or deleted. No payload.\n\t\t\t\t */\n\t\t\t\tthis.$emit('changed')\n\t\t\t} catch (err) {\n\t\t\t\tthis.error = this.failure(err)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Turn a chip into a field holding its name.\n\t\t *\n\t\t * @param {object} item The word.\n\t\t */\n\t\tstartRename(item) {\n\t\t\tif (this.readOnly || this.busy) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.error = ''\n\t\t\tthis.renaming = item.id\n\t\t\tthis.renameDraft = item.name\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst input = Array.isArray(this.$refs.renameInput) ? this.$refs.renameInput[0] : this.$refs.renameInput\n\t\t\t\tinput?.focus()\n\t\t\t\tinput?.select()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Enter saves the rename, Escape drops it.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key.\n\t\t * @param {object} item The word.\n\t\t */\n\t\tonRenameKey(event, item) {\n\t\t\tif (event.key === 'Enter') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.saveRename(item)\n\t\t\t} else if (event.key === 'Escape') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.renaming = null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Save the rename, through `renameUrl` when given.\n\t\t *\n\t\t * @param {object} item The word.\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync saveRename(item) {\n\t\t\tif (this.renaming !== item.id) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst name = this.renameDraft.trim()\n\t\t\tthis.renaming = null\n\t\t\tif (name === '' || name === item.name) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.taken(name, item.id)) {\n\t\t\t\tthis.error = t('nextcloud-vue', 'This name is already on the list.')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tif (this.renameUrl) {\n\t\t\t\t\tawait cnFetchJson(this.renameUrl.replace('{id}', encodeURIComponent(item.id)), { method: 'POST', body: JSON.stringify({ name }) })\n\t\t\t\t} else {\n\t\t\t\t\tconst row = { ...(item.row || {}), [this.field]: name }\n\t\t\t\t\tdelete row['@self']\n\t\t\t\t\tawait cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'PUT', body: JSON.stringify(row) })\n\t\t\t\t}\n\t\t\t\titem.name = name\n\t\t\t\titem.row = { ...item.row, [this.field]: name }\n\t\t\t\tthis.$emit('changed')\n\t\t\t} catch (err) {\n\t\t\t\tthis.error = this.failure(err)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Delete a word after the confirm.\n\t\t *\n\t\t * @param {object} item The word.\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync remove(item) {\n\t\t\tthis.confirming = null\n\t\t\tthis.error = ''\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tawait cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'DELETE' })\n\t\t\t\tthis.items = this.items.filter((other) => other.id !== item.id)\n\t\t\t\tthis.$emit('changed')\n\t\t\t} catch (err) {\n\t\t\t\tthis.error = this.failure(err)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-chip-list__chips {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin: 0 0 14px;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-chip-list__chip {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 4px;\n\theight: 30px;\n\tpadding: 0 4px 0 12px;\n\tborder-radius: 15px;\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n\tfont-size: 14px;\n\tfont-weight: 600;\n}\n\n.cn-chip-list__name {\n\tcursor: text;\n\tborder-radius: 4px;\n}\n\n.cn-chip-list__name:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n\n.cn-chip-list__rename {\n\theight: 24px;\n\tmin-height: 24px;\n\twidth: 14ch;\n\tmargin: 0;\n\tpadding: 0 6px;\n\tfont: inherit;\n}\n\n.cn-chip-list__remove {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex: none;\n\twidth: 36px;\n\theight: 36px;\n\tmin-height: 36px;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 18px;\n\tbackground: transparent;\n\tcolor: inherit;\n\tcursor: pointer;\n}\n\n.cn-chip-list__remove:hover,\n.cn-chip-list__remove:focus-visible {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-chip-list__add {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n}\n\n.cn-chip-list__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tmax-width: 420px;\n}\n\n.cn-chip-list__label {\n\tfont-size: 14px;\n\tfont-weight: 600;\n}\n\n.cn-chip-list__input {\n\twidth: 100%;\n\theight: 40px;\n\tmargin: 0;\n\tpadding: 0 12px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--color-border-maxcontrast);\n\tborder-radius: var(--border-radius-element, 8px);\n\tfont: inherit;\n}\n\n.cn-chip-list__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-chip-list__error {\n\tmargin: 10px 0 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-chip-list__note {\n\tmargin: 14px 0 0;\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["CnConfirmDialog","CnSettingsSection","t"],"mappings":";;;;;;;;AAmGA,IAAI,MAAM,EAAA;;AAEV;;AAEC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAED,aAAe;CACd,IAAI,EAAE,mBAAmB;;AAEzB,CAAA,UAAU,EAAE,EAAE,KAAK,mBAAEA,UAAe,qBAAEC,YAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM;;AAExF,CAAA,KAAK,EAAE;AACN;AACA,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;AAE1C,EAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;AACxC;AACA,EAAA,KAAK,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AAG,IAAK,GAAA;AAC7C,IAAA,IAAI,CAAC,KAAK,CAAC,SAAS,EAAA;IACnB,CAAA,OAAO,GAAG,EAAE;IACb,IAAI,CAAC,KAAM,GAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAA;AAC9B,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,IAAG,GAAI,MAAI;AACjB,IAAA;GACA;;AAED;;AAEC;;AAEA;;AAED,EAAA,MAAM,MAAM,CAAC,IAAI,EAAE;AAClB,GAAA,IAAI,CAAC,aAAa,KAAG;GACrB,IAAI,CAAC,KAAM,GAAE,GAAC;GACd,IAAI,CAAC,IAAK,GAAE,KAAG;AACf,GAAA,IAAI;AACH,IAAA,MAAM,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAA;IACxF,IAAI,CAAC,KAAM,GAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,EAAG,KAAI,IAAI,CAAC,EAAE,EAAA;AAC9D,IAAA,IAAI,CAAC,KAAK,CAAC,SAAS,EAAA;IACnB,CAAA,OAAO,GAAG,EAAE;IACb,IAAI,CAAC,KAAM,GAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAA;AAC9B,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,IAAG,GAAI,MAAI;AACjB,IAAA;GACA;EACD;AACF;;;;"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, withDirectives, vModelText, withKeys, withModifiers, toDisplayString, createVNode, createCommentVNode, createElementVNode, createTextVNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
const _hoisted_1 = ["aria-label"];
|
|
4
|
+
const _hoisted_2 = ["data-testid"];
|
|
5
|
+
const _hoisted_3 = ["aria-label", "onKeydown", "onBlur"];
|
|
6
|
+
const _hoisted_4 = ["tabindex", "title", "onDblclick", "onKeydown"];
|
|
7
|
+
const _hoisted_5 = ["disabled", "aria-label", "title", "data-testid", "onClick"];
|
|
8
|
+
const _hoisted_6 = { class: "cn-chip-list__field" };
|
|
9
|
+
const _hoisted_7 = ["for"];
|
|
10
|
+
const _hoisted_8 = ["id", "placeholder", "aria-invalid"];
|
|
11
|
+
const _hoisted_9 = { class: "cn-chip-list__actions" };
|
|
12
|
+
const _hoisted_10 = {
|
|
13
|
+
key: 3,
|
|
14
|
+
class: "cn-chip-list__error",
|
|
15
|
+
role: "alert",
|
|
16
|
+
"data-testid": "cn-chip-list-error"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_11 = {
|
|
19
|
+
key: 4,
|
|
20
|
+
class: "cn-chip-list__note",
|
|
21
|
+
"data-testid": "cn-chip-list-note"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
25
|
+
const _component_NcLoadingIcon = resolveComponent("NcLoadingIcon");
|
|
26
|
+
const _component_Close = resolveComponent("Close");
|
|
27
|
+
const _component_Plus = resolveComponent("Plus");
|
|
28
|
+
const _component_NcButton = resolveComponent("NcButton");
|
|
29
|
+
const _component_CnConfirmDialog = resolveComponent("CnConfirmDialog");
|
|
30
|
+
const _component_CnSettingsSection = resolveComponent("CnSettingsSection");
|
|
31
|
+
|
|
32
|
+
return (openBlock(), createBlock(_component_CnSettingsSection, {
|
|
33
|
+
name: $props.title,
|
|
34
|
+
description: $props.description,
|
|
35
|
+
class: "cn-chip-list",
|
|
36
|
+
"data-testid": "cn-chip-list"
|
|
37
|
+
}, {
|
|
38
|
+
default: withCtx(() => [
|
|
39
|
+
($data.loading)
|
|
40
|
+
? (openBlock(), createBlock(_component_NcLoadingIcon, {
|
|
41
|
+
key: 0,
|
|
42
|
+
size: 24,
|
|
43
|
+
name: $options.t('nextcloud-vue', 'Loading …')
|
|
44
|
+
}, null, 8 /* PROPS */, ["name"]))
|
|
45
|
+
: (openBlock(), createElementBlock("ul", {
|
|
46
|
+
key: 1,
|
|
47
|
+
class: "cn-chip-list__chips",
|
|
48
|
+
"aria-label": $props.title
|
|
49
|
+
}, [
|
|
50
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.sorted, (item) => {
|
|
51
|
+
return (openBlock(), createElementBlock("li", {
|
|
52
|
+
key: item.id,
|
|
53
|
+
class: "cn-chip-list__chip",
|
|
54
|
+
"data-testid": `cn-chip-list-chip-${item.name}`
|
|
55
|
+
}, [
|
|
56
|
+
($data.renaming === item.id)
|
|
57
|
+
? withDirectives((openBlock(), createElementBlock("input", {
|
|
58
|
+
key: 0,
|
|
59
|
+
ref_for: true,
|
|
60
|
+
ref: "renameInput",
|
|
61
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($data.renameDraft) = $event)),
|
|
62
|
+
class: "cn-chip-list__rename",
|
|
63
|
+
type: "text",
|
|
64
|
+
"aria-label": $options.t('nextcloud-vue', 'New name for {name}', { name: item.name }),
|
|
65
|
+
"data-testid": "cn-chip-list-rename-input",
|
|
66
|
+
onKeydown: $event => ($options.onRenameKey($event, item)),
|
|
67
|
+
onBlur: $event => ($options.saveRename(item))
|
|
68
|
+
}, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_3)), [
|
|
69
|
+
[vModelText, $data.renameDraft]
|
|
70
|
+
])
|
|
71
|
+
: (openBlock(), createElementBlock("span", {
|
|
72
|
+
key: 1,
|
|
73
|
+
class: "cn-chip-list__name",
|
|
74
|
+
tabindex: $props.readOnly ? null : 0,
|
|
75
|
+
title: $props.readOnly ? null : $options.t('nextcloud-vue', 'Double-click to rename'),
|
|
76
|
+
"data-testid": "cn-chip-list-name",
|
|
77
|
+
onDblclick: $event => ($options.startRename(item)),
|
|
78
|
+
onKeydown: withKeys(withModifiers($event => ($options.startRename(item)), ["prevent"]), ["f2"])
|
|
79
|
+
}, toDisplayString(item.name), 41 /* TEXT, PROPS, NEED_HYDRATION */, _hoisted_4)),
|
|
80
|
+
(!$props.readOnly)
|
|
81
|
+
? (openBlock(), createElementBlock("button", {
|
|
82
|
+
key: 2,
|
|
83
|
+
type: "button",
|
|
84
|
+
class: "cn-chip-list__remove",
|
|
85
|
+
disabled: $data.busy,
|
|
86
|
+
"aria-label": $options.t('nextcloud-vue', 'Delete {name}', { name: item.name }),
|
|
87
|
+
title: $options.t('nextcloud-vue', 'Delete {name}', { name: item.name }),
|
|
88
|
+
"data-testid": `cn-chip-list-remove-${item.name}`,
|
|
89
|
+
onClick: $event => ($data.confirming = item)
|
|
90
|
+
}, [
|
|
91
|
+
createVNode(_component_Close, { size: 14 })
|
|
92
|
+
], 8 /* PROPS */, _hoisted_5))
|
|
93
|
+
: createCommentVNode("v-if", true)
|
|
94
|
+
], 8 /* PROPS */, _hoisted_2))
|
|
95
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
96
|
+
], 8 /* PROPS */, _hoisted_1)),
|
|
97
|
+
(!$props.readOnly)
|
|
98
|
+
? (openBlock(), createElementBlock("form", {
|
|
99
|
+
key: 2,
|
|
100
|
+
class: "cn-chip-list__add",
|
|
101
|
+
onSubmit: _cache[2] || (_cache[2] = withModifiers((...args) => ($options.add && $options.add(...args)), ["prevent"]))
|
|
102
|
+
}, [
|
|
103
|
+
createElementVNode("div", _hoisted_6, [
|
|
104
|
+
createElementVNode("label", {
|
|
105
|
+
for: $data.inputId,
|
|
106
|
+
class: "cn-chip-list__label"
|
|
107
|
+
}, toDisplayString($options.resolvedAddLabel), 9 /* TEXT, PROPS */, _hoisted_7),
|
|
108
|
+
withDirectives(createElementVNode("input", {
|
|
109
|
+
id: $data.inputId,
|
|
110
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.draft) = $event)),
|
|
111
|
+
class: "cn-chip-list__input",
|
|
112
|
+
type: "text",
|
|
113
|
+
placeholder: $options.resolvedPlaceholder,
|
|
114
|
+
"aria-invalid": $data.error ? 'true' : null,
|
|
115
|
+
"data-testid": "cn-chip-list-input"
|
|
116
|
+
}, null, 8 /* PROPS */, _hoisted_8), [
|
|
117
|
+
[vModelText, $data.draft]
|
|
118
|
+
])
|
|
119
|
+
]),
|
|
120
|
+
createElementVNode("div", _hoisted_9, [
|
|
121
|
+
createVNode(_component_NcButton, {
|
|
122
|
+
type: "submit",
|
|
123
|
+
variant: "secondary",
|
|
124
|
+
disabled: $data.busy,
|
|
125
|
+
"data-testid": "cn-chip-list-submit"
|
|
126
|
+
}, {
|
|
127
|
+
icon: withCtx(() => [
|
|
128
|
+
createVNode(_component_Plus, { size: 16 })
|
|
129
|
+
]),
|
|
130
|
+
default: withCtx(() => [
|
|
131
|
+
createTextVNode(" " + toDisplayString($options.resolvedSubmitLabel), 1 /* TEXT */)
|
|
132
|
+
]),
|
|
133
|
+
_: 1 /* STABLE */
|
|
134
|
+
}, 8 /* PROPS */, ["disabled"])
|
|
135
|
+
])
|
|
136
|
+
], 32 /* NEED_HYDRATION */))
|
|
137
|
+
: createCommentVNode("v-if", true),
|
|
138
|
+
($data.error)
|
|
139
|
+
? (openBlock(), createElementBlock("p", _hoisted_10, toDisplayString($data.error), 1 /* TEXT */))
|
|
140
|
+
: createCommentVNode("v-if", true),
|
|
141
|
+
($props.note && !$props.readOnly)
|
|
142
|
+
? (openBlock(), createElementBlock("p", _hoisted_11, toDisplayString($props.note), 1 /* TEXT */))
|
|
143
|
+
: createCommentVNode("v-if", true),
|
|
144
|
+
($data.confirming)
|
|
145
|
+
? (openBlock(), createBlock(_component_CnConfirmDialog, {
|
|
146
|
+
key: 5,
|
|
147
|
+
dialogTitle: $options.t('nextcloud-vue', 'Delete {name}', { name: $data.confirming.name }),
|
|
148
|
+
message: $options.resolvedDeleteMessage($data.confirming.name),
|
|
149
|
+
confirmLabel: $options.t('nextcloud-vue', 'Delete'),
|
|
150
|
+
variant: "error",
|
|
151
|
+
onConfirm: _cache[3] || (_cache[3] = $event => ($options.remove($data.confirming))),
|
|
152
|
+
onClose: _cache[4] || (_cache[4] = $event => ($data.confirming = null))
|
|
153
|
+
}, null, 8 /* PROPS */, ["dialogTitle", "message", "confirmLabel"]))
|
|
154
|
+
: createCommentVNode("v-if", true)
|
|
155
|
+
]),
|
|
156
|
+
_: 1 /* STABLE */
|
|
157
|
+
}, 8 /* PROPS */, ["name", "description"]))
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export { render };
|
|
161
|
+
//# sourceMappingURL=CnChipListManager.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnChipListManager.vue3.js","sources":["../../../../src/components/CnChipListManager/CnChipListManager.vue?vue&type=template&id=7c502c17&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<CnSettingsSection\n\t\t:name=\"title\"\n\t\t:description=\"description\"\n\t\tclass=\"cn-chip-list\"\n\t\tdata-testid=\"cn-chip-list\">\n\t\t<NcLoadingIcon v-if=\"loading\" :size=\"24\" :name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t<ul v-else class=\"cn-chip-list__chips\" :aria-label=\"title\">\n\t\t\t<li v-for=\"item in sorted\"\n\t\t\t\t:key=\"item.id\"\n\t\t\t\tclass=\"cn-chip-list__chip\"\n\t\t\t\t:data-testid=\"`cn-chip-list-chip-${item.name}`\">\n\t\t\t\t<input v-if=\"renaming === item.id\"\n\t\t\t\t\tref=\"renameInput\"\n\t\t\t\t\tv-model=\"renameDraft\"\n\t\t\t\t\tclass=\"cn-chip-list__rename\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'New name for {name}', { name: item.name })\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-rename-input\"\n\t\t\t\t\t@keydown=\"onRenameKey($event, item)\"\n\t\t\t\t\t@blur=\"saveRename(item)\">\n\t\t\t\t<span v-else\n\t\t\t\t\tclass=\"cn-chip-list__name\"\n\t\t\t\t\t:tabindex=\"readOnly ? null : 0\"\n\t\t\t\t\t:title=\"readOnly ? null : t('nextcloud-vue', 'Double-click to rename')\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-name\"\n\t\t\t\t\t@dblclick=\"startRename(item)\"\n\t\t\t\t\t@keydown.f2.prevent=\"startRename(item)\">{{ item.name }}</span>\n\t\t\t\t<button v-if=\"!readOnly\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-chip-list__remove\"\n\t\t\t\t\t:disabled=\"busy\"\n\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Delete {name}', { name: item.name })\"\n\t\t\t\t\t:title=\"t('nextcloud-vue', 'Delete {name}', { name: item.name })\"\n\t\t\t\t\t:data-testid=\"`cn-chip-list-remove-${item.name}`\"\n\t\t\t\t\t@click=\"confirming = item\">\n\t\t\t\t\t<Close :size=\"14\" />\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<form v-if=\"!readOnly\" class=\"cn-chip-list__add\" @submit.prevent=\"add\">\n\t\t\t<div class=\"cn-chip-list__field\">\n\t\t\t\t<label :for=\"inputId\" class=\"cn-chip-list__label\">{{ resolvedAddLabel }}</label>\n\t\t\t\t<input :id=\"inputId\"\n\t\t\t\t\tv-model=\"draft\"\n\t\t\t\t\tclass=\"cn-chip-list__input\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t:placeholder=\"resolvedPlaceholder\"\n\t\t\t\t\t:aria-invalid=\"error ? 'true' : null\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-input\">\n\t\t\t</div>\n\t\t\t<div class=\"cn-chip-list__actions\">\n\t\t\t\t<NcButton type=\"submit\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t:disabled=\"busy\"\n\t\t\t\t\tdata-testid=\"cn-chip-list-submit\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<Plus :size=\"16\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ resolvedSubmitLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</form>\n\n\t\t<p v-if=\"error\"\n\t\t\tclass=\"cn-chip-list__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-chip-list-error\">\n\t\t\t{{ error }}\n\t\t</p>\n\t\t<p v-if=\"note && !readOnly\" class=\"cn-chip-list__note\" data-testid=\"cn-chip-list-note\">\n\t\t\t{{ note }}\n\t\t</p>\n\n\t\t<CnConfirmDialog v-if=\"confirming\"\n\t\t\t:dialogTitle=\"t('nextcloud-vue', 'Delete {name}', { name: confirming.name })\"\n\t\t\t:message=\"resolvedDeleteMessage(confirming.name)\"\n\t\t\t:confirmLabel=\"t('nextcloud-vue', 'Delete')\"\n\t\t\tvariant=\"error\"\n\t\t\t@confirm=\"remove(confirming)\"\n\t\t\t@close=\"confirming = null\" />\n\t</CnSettingsSection>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon } from '@nextcloud/vue'\nimport Close from 'vue-material-design-icons/Close.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport CnConfirmDialog from '../../dialogs/CnConfirmDialog.vue'\nimport CnSettingsSection from '../CnSettingsSection/CnSettingsSection.vue'\nimport { cnFetchJson } from '../../utils/cnFetch.js'\n\nlet uid = 0\n\n/**\n * CnChipListManager: an admin card that keeps a list of words, one\n * OpenRegister object each, as chips. It lists them, adds one, renames one on\n * double-click (or F2) and deletes one after a confirm.\n *\n * A rename goes to `renameUrl` when given (`{id}` is the object's id), so an\n * app can rewrite the word where it is used; otherwise it updates the object.\n * The server decides who may write: a refusal shows as a line in the card.\n *\n * ```vue\n * <CnChipListManager\n * register=\"pipelinq\"\n * schema=\"label\"\n * :title=\"t('pipelinq', 'Labels')\"\n * :description=\"t('pipelinq', 'The labels people can pick for articles, leads and clients.')\"\n * renameUrl=\"/apps/pipelinq/api/labels/{id}/rename\"\n * :note=\"t('pipelinq', 'Double-click a label to rename it. A deleted label stays on the items that already use it.')\" />\n * ```\n *\n * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n */\nexport default {\n\tname: 'CnChipListManager',\n\n\tcomponents: { Close, CnConfirmDialog, CnSettingsSection, NcButton, NcLoadingIcon, Plus },\n\n\tprops: {\n\t\t/** The OpenRegister register slug or id. */\n\t\tregister: { type: String, required: true },\n\t\t/** The OpenRegister schema slug or id; one object per word. */\n\t\tschema: { type: String, required: true },\n\t\t/** The property that holds the word. */\n\t\tfield: { type: String, default: 'name' },\n\t\t/** The card's title. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** The line under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** A line under the form, such as how renaming works. */\n\t\tnote: { type: String, default: '' },\n\t\t/** POST endpoint for a rename, `{id}` filled; body `{ name }`. */\n\t\trenameUrl: { type: String, default: '' },\n\t\t/** The label above the new-word field; default \"New item\". */\n\t\taddLabel: { type: String, default: '' },\n\t\t/** The placeholder of the new-word field; default \"Enter a name\". */\n\t\tplaceholder: { type: String, default: '' },\n\t\t/** The add button's text; default \"Add\". */\n\t\tsubmitLabel: { type: String, default: '' },\n\t\t/** The confirm sentence, `{name}` filled; default says items keep the word. */\n\t\tdeleteMessage: { type: String, default: '' },\n\t\t/** Only list the words. */\n\t\treadOnly: { type: Boolean, default: false },\n\t\t/** The OpenRegister API base. */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t},\n\n\temits: ['changed'],\n\n\tdata() {\n\t\tuid += 1\n\t\treturn {\n\t\t\tinputId: `cn-chip-list-input-${uid}`,\n\t\t\titems: [],\n\t\t\tloading: true,\n\t\t\tbusy: false,\n\t\t\tdraft: '',\n\t\t\terror: '',\n\t\t\trenaming: null,\n\t\t\trenameDraft: '',\n\t\t\tconfirming: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** The words in alphabetical order, case-insensitive. */\n\t\tsorted() {\n\t\t\treturn [...this.items].sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }))\n\t\t},\n\n\t\tlistUrl() {\n\t\t\treturn `${this.apiBase}/objects/${encodeURIComponent(this.register)}/${encodeURIComponent(this.schema)}`\n\t\t},\n\n\t\tresolvedAddLabel() {\n\t\t\treturn this.addLabel || t('nextcloud-vue', 'New item')\n\t\t},\n\n\t\tresolvedPlaceholder() {\n\t\t\treturn this.placeholder || t('nextcloud-vue', 'Enter a name')\n\t\t},\n\n\t\tresolvedSubmitLabel() {\n\t\t\treturn this.submitLabel || t('nextcloud-vue', 'Add')\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.load()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Read the words.\n\t\t *\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync load() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst data = await cnFetchJson(this.listUrl, { query: { _limit: 500 } })\n\t\t\t\tconst rows = Array.isArray(data?.results) ? data.results : []\n\t\t\t\tthis.items = rows\n\t\t\t\t\t.map((row) => ({ id: row.id ?? row['@self']?.id ?? row.uuid, name: String(row[this.field] ?? ''), row }))\n\t\t\t\t\t.filter((item) => item.id && item.name !== '')\n\t\t\t} catch {\n\t\t\t\tthis.items = []\n\t\t\t\tthis.error = t('nextcloud-vue', 'The list could not be loaded.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether another word already has this name, whatever the case.\n\t\t *\n\t\t * @param {string} name The name.\n\t\t * @param {string|null} exceptId The word being renamed.\n\t\t * @return {boolean}\n\t\t */\n\t\ttaken(name, exceptId = null) {\n\t\t\tconst wanted = name.toLocaleLowerCase()\n\t\t\treturn this.items.some((item) => item.id !== exceptId && item.name.toLocaleLowerCase() === wanted)\n\t\t},\n\n\t\t/**\n\t\t * The line for a refused or failed write.\n\t\t *\n\t\t * @param {Error} err The failure.\n\t\t * @return {string}\n\t\t */\n\t\tfailure(err) {\n\t\t\tif (err?.status === 403) {\n\t\t\t\treturn t('nextcloud-vue', 'You are not allowed to change this list.')\n\t\t\t}\n\t\t\tif (err?.status === 409) {\n\t\t\t\treturn t('nextcloud-vue', 'This name is already on the list.')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'The list could not be changed. Try again.')\n\t\t},\n\n\t\t/**\n\t\t * The confirm sentence for deleting a word.\n\t\t *\n\t\t * @param {string} name The word.\n\t\t * @return {string}\n\t\t */\n\t\tresolvedDeleteMessage(name) {\n\t\t\tif (this.deleteMessage) {\n\t\t\t\treturn this.deleteMessage.replace('{name}', name)\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Delete {name} from the list? Items that already use it keep it.', { name })\n\t\t},\n\n\t\t/**\n\t\t * Add the typed word.\n\t\t *\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync add() {\n\t\t\tconst name = this.draft.trim()\n\t\t\tthis.error = ''\n\t\t\tif (name === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.taken(name)) {\n\t\t\t\tthis.error = t('nextcloud-vue', 'This name is already on the list.')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tconst saved = await cnFetchJson(this.listUrl, { method: 'POST', body: JSON.stringify({ [this.field]: name }) })\n\t\t\t\tconst id = saved?.id ?? saved?.['@self']?.id ?? saved?.uuid ?? name\n\t\t\t\tthis.items.push({ id, name, row: saved || { [this.field]: name } })\n\t\t\t\tthis.draft = ''\n\t\t\t\t/**\n\t\t\t\t * @event changed The list changed on the server: a word was added, renamed or deleted. No payload.\n\t\t\t\t */\n\t\t\t\tthis.$emit('changed')\n\t\t\t} catch (err) {\n\t\t\t\tthis.error = this.failure(err)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Turn a chip into a field holding its name.\n\t\t *\n\t\t * @param {object} item The word.\n\t\t */\n\t\tstartRename(item) {\n\t\t\tif (this.readOnly || this.busy) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.error = ''\n\t\t\tthis.renaming = item.id\n\t\t\tthis.renameDraft = item.name\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst input = Array.isArray(this.$refs.renameInput) ? this.$refs.renameInput[0] : this.$refs.renameInput\n\t\t\t\tinput?.focus()\n\t\t\t\tinput?.select()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Enter saves the rename, Escape drops it.\n\t\t *\n\t\t * @param {KeyboardEvent} event The key.\n\t\t * @param {object} item The word.\n\t\t */\n\t\tonRenameKey(event, item) {\n\t\t\tif (event.key === 'Enter') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.saveRename(item)\n\t\t\t} else if (event.key === 'Escape') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.renaming = null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Save the rename, through `renameUrl` when given.\n\t\t *\n\t\t * @param {object} item The word.\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync saveRename(item) {\n\t\t\tif (this.renaming !== item.id) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst name = this.renameDraft.trim()\n\t\t\tthis.renaming = null\n\t\t\tif (name === '' || name === item.name) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.taken(name, item.id)) {\n\t\t\t\tthis.error = t('nextcloud-vue', 'This name is already on the list.')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tif (this.renameUrl) {\n\t\t\t\t\tawait cnFetchJson(this.renameUrl.replace('{id}', encodeURIComponent(item.id)), { method: 'POST', body: JSON.stringify({ name }) })\n\t\t\t\t} else {\n\t\t\t\t\tconst row = { ...(item.row || {}), [this.field]: name }\n\t\t\t\t\tdelete row['@self']\n\t\t\t\t\tawait cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'PUT', body: JSON.stringify(row) })\n\t\t\t\t}\n\t\t\t\titem.name = name\n\t\t\t\titem.row = { ...item.row, [this.field]: name }\n\t\t\t\tthis.$emit('changed')\n\t\t\t} catch (err) {\n\t\t\t\tthis.error = this.failure(err)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Delete a word after the confirm.\n\t\t *\n\t\t * @param {object} item The word.\n\t\t * @spec openspec/changes/chip-list-manager/specs/chip-list-manager/spec.md#requirement-an-administrator-keeps-a-word-list-as-chips\n\t\t */\n\t\tasync remove(item) {\n\t\t\tthis.confirming = null\n\t\t\tthis.error = ''\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tawait cnFetchJson(`${this.listUrl}/${encodeURIComponent(item.id)}`, { method: 'DELETE' })\n\t\t\t\tthis.items = this.items.filter((other) => other.id !== item.id)\n\t\t\t\tthis.$emit('changed')\n\t\t\t} catch (err) {\n\t\t\t\tthis.error = this.failure(err)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-chip-list__chips {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin: 0 0 14px;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-chip-list__chip {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 4px;\n\theight: 30px;\n\tpadding: 0 4px 0 12px;\n\tborder-radius: 15px;\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n\tfont-size: 14px;\n\tfont-weight: 600;\n}\n\n.cn-chip-list__name {\n\tcursor: text;\n\tborder-radius: 4px;\n}\n\n.cn-chip-list__name:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n\n.cn-chip-list__rename {\n\theight: 24px;\n\tmin-height: 24px;\n\twidth: 14ch;\n\tmargin: 0;\n\tpadding: 0 6px;\n\tfont: inherit;\n}\n\n.cn-chip-list__remove {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex: none;\n\twidth: 36px;\n\theight: 36px;\n\tmin-height: 36px;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 18px;\n\tbackground: transparent;\n\tcolor: inherit;\n\tcursor: pointer;\n}\n\n.cn-chip-list__remove:hover,\n.cn-chip-list__remove:focus-visible {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-chip-list__add {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 14px;\n}\n\n.cn-chip-list__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n\tmax-width: 420px;\n}\n\n.cn-chip-list__label {\n\tfont-size: 14px;\n\tfont-weight: 600;\n}\n\n.cn-chip-list__input {\n\twidth: 100%;\n\theight: 40px;\n\tmargin: 0;\n\tpadding: 0 12px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--color-border-maxcontrast);\n\tborder-radius: var(--border-radius-element, 8px);\n\tfont: inherit;\n}\n\n.cn-chip-list__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-chip-list__error {\n\tmargin: 10px 0 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-chip-list__note {\n\tmargin: 14px 0 0;\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_createBlock","_createElementBlock","_Fragment","_renderList","_withKeys","_withModifiers","_toDisplayString","_createVNode","_createElementVNode"],"mappings":";;;;;;;AAoDQ,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,q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E,CAAA,eAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;;uCAEH;qCAAA,mBAAG,QAAQ,CAAA,mBAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;OAKX,KAAA,CAAA,KAAA;wBAAHN,kBAKI,CAAA,GAAA,EALJ,WAKI,EAAAK,eAAA;;AACK,MAAA,CAAA,MAAA,CAAA,IAAI,KAAK,MAAQ,CAAA,QAAA;wBAAzBL,kBAEG,CAAA,GAAA,EAFH,WAEG,EAAAK,eAAA,CADA,MAAI,CAAA,IAAA,CAAA,EAAA,CAAA,YAAA;;OAGe,KAAM,CAAA,UAAA;;;AAC3B,YAAA,WAAW,EAAE,QAAA,CAAA,CAAC,CAAa,eAAA,EAAA,eAAA,EAAA,EAAA,IAAA,EAAA,KAAA,CAAA,UAAA,CAAA,IAAA,EAAA,CAAA;AAC3B,YAAA,OAAO,EAAE,QAAA,CAAA,qBAAO,CAAA,KAAA,CAAA,UAAA,CAAA,IAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnDashboardPage.vue2.js';
|
|
|
2
2
|
import { render } from './CnDashboardPage.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-6e71986b";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -3844,7 +3844,8 @@ var script = {
|
|
|
3844
3844
|
if (reported && Number.isFinite(reported.count)) {
|
|
3845
3845
|
return title.replace(/\{count\}/g, String(reported.count))
|
|
3846
3846
|
}
|
|
3847
|
-
|
|
3847
|
+
const parts = title.split('{count}');
|
|
3848
|
+
return parts.map((part, i) => (i < parts.length - 1 ? part.trimEnd() : part)).join('').trim()
|
|
3848
3849
|
},
|
|
3849
3850
|
|
|
3850
3851
|
/**
|