From 2cbb74495aee31a634572809ec8000007fb13035 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Mon, 24 Mar 2025 19:41:04 +0500 Subject: [PATCH] Change card type (#8331) Signed-off-by: Denis Bykhov --- models/card/src/index.ts | 19 +++ plugins/card-assets/lang/cs.json | 3 +- plugins/card-assets/lang/de.json | 3 +- plugins/card-assets/lang/en.json | 3 +- plugins/card-assets/lang/es.json | 3 +- plugins/card-assets/lang/fr.json | 3 +- plugins/card-assets/lang/it.json | 3 +- plugins/card-assets/lang/pt.json | 3 +- plugins/card-assets/lang/ru.json | 3 +- plugins/card-assets/lang/zh.json | 3 +- .../src/components/ChangeType.svelte | 111 ++++++++++++++++++ plugins/card-resources/src/index.ts | 4 +- plugins/card-resources/src/plugin.ts | 6 +- plugins/card/src/analytics.ts | 3 +- 14 files changed, 157 insertions(+), 13 deletions(-) create mode 100644 plugins/card-resources/src/components/ChangeType.svelte diff --git a/models/card/src/index.ts b/models/card/src/index.ts index 4e563768cd..c4b065e424 100644 --- a/models/card/src/index.ts +++ b/models/card/src/index.ts @@ -435,6 +435,25 @@ export function createModel (builder: Builder): void { } }) + createAction(builder, { + action: view.actionImpl.ShowPopup, + actionProps: { + component: card.component.ChangeType, + fillProps: { + _object: 'value' + } + }, + label: card.string.ChangeType, + input: 'focus', + icon: card.icon.MasterTag, + category: setting.category.Settings, + target: card.class.Card, + context: { + mode: ['context', 'browser'], + group: 'edit' + } + }) + createAction(builder, { action: view.actionImpl.ShowPopup, actionProps: { diff --git a/plugins/card-assets/lang/cs.json b/plugins/card-assets/lang/cs.json index 626ffddf19..8728cdd86b 100644 --- a/plugins/card-assets/lang/cs.json +++ b/plugins/card-assets/lang/cs.json @@ -28,6 +28,7 @@ "CreateView": "Vytvořit zobrazení", "EditView": "Upravit zobrazení", "SelectViewType": "Vybrat typ zobrazení", - "Document": "Dokument" + "Document": "Dokument", + "ChangeType": "Změnit typ" } } \ No newline at end of file diff --git a/plugins/card-assets/lang/de.json b/plugins/card-assets/lang/de.json index 60fbfada4b..50016342c6 100644 --- a/plugins/card-assets/lang/de.json +++ b/plugins/card-assets/lang/de.json @@ -28,6 +28,7 @@ "CreateView": "Ansicht erstellen", "EditView": "Ansicht bearbeiten", "SelectViewType": "Ansichtstyp auswählen", - "Document": "Dokument" + "Document": "Dokument", + "ChangeType": "Typ ändern" } } diff --git a/plugins/card-assets/lang/en.json b/plugins/card-assets/lang/en.json index 8c0f960f45..e5fc6566cb 100644 --- a/plugins/card-assets/lang/en.json +++ b/plugins/card-assets/lang/en.json @@ -28,6 +28,7 @@ "CreateView": "Create View", "EditView": "Edit View", "SelectViewType": "Select View Type", - "Document": "Document" + "Document": "Document", + "ChangeType": "Change type" } } \ No newline at end of file diff --git a/plugins/card-assets/lang/es.json b/plugins/card-assets/lang/es.json index 5b9e0a45c7..7cb5c961be 100644 --- a/plugins/card-assets/lang/es.json +++ b/plugins/card-assets/lang/es.json @@ -28,6 +28,7 @@ "CreateView": "Crear vista", "EditView": "Editar vista", "SelectViewType": "Seleccionar tipo de vista", - "Document": "Documento" + "Document": "Documento", + "ChangeType": "Cambiar tipo" } } \ No newline at end of file diff --git a/plugins/card-assets/lang/fr.json b/plugins/card-assets/lang/fr.json index 86edd2689c..1996c820c4 100644 --- a/plugins/card-assets/lang/fr.json +++ b/plugins/card-assets/lang/fr.json @@ -28,6 +28,7 @@ "CreateView": "Créer une vue", "EditView": "Modifier la vue", "SelectViewType": "Sélectionner le type de vue", - "Document": "Document" + "Document": "Document", + "ChangeType": "Changer de type" } } \ No newline at end of file diff --git a/plugins/card-assets/lang/it.json b/plugins/card-assets/lang/it.json index 48acc665f7..4d0b2dc152 100644 --- a/plugins/card-assets/lang/it.json +++ b/plugins/card-assets/lang/it.json @@ -28,6 +28,7 @@ "CreateView": "Crea vista", "EditView": "Modifica vista", "SelectViewType": "Seleziona il tipo di vista", - "Document": "Documento" + "Document": "Documento", + "ChangeType": "Cambia tipo" } } \ No newline at end of file diff --git a/plugins/card-assets/lang/pt.json b/plugins/card-assets/lang/pt.json index a40411314b..e31e63047b 100644 --- a/plugins/card-assets/lang/pt.json +++ b/plugins/card-assets/lang/pt.json @@ -28,6 +28,7 @@ "CreateView": "Criar visualização", "EditView": "Editar visualização", "SelectViewType": "Selecionar tipo de visualização", - "Document": "Documento" + "Document": "Documento", + "ChangeType": "Alterar tipo" } } \ No newline at end of file diff --git a/plugins/card-assets/lang/ru.json b/plugins/card-assets/lang/ru.json index 2a463c31d4..948b6296b7 100644 --- a/plugins/card-assets/lang/ru.json +++ b/plugins/card-assets/lang/ru.json @@ -28,6 +28,7 @@ "CreateView": "Создать представление", "EditView": "Редактировать представление", "SelectViewType": "Выбрать тип представления", - "Document": "Документ" + "Document": "Документ", + "ChangeType": "Изменить тип" } } \ No newline at end of file diff --git a/plugins/card-assets/lang/zh.json b/plugins/card-assets/lang/zh.json index 59ed5c24e6..4877214848 100644 --- a/plugins/card-assets/lang/zh.json +++ b/plugins/card-assets/lang/zh.json @@ -28,6 +28,7 @@ "CreateView": "创建视图", "EditView": "编辑视图", "SelectViewType": "选择视图类型", - "Document": "文档" + "Document": "文档", + "ChangeType": "更改类型" } } \ No newline at end of file diff --git a/plugins/card-resources/src/components/ChangeType.svelte b/plugins/card-resources/src/components/ChangeType.svelte new file mode 100644 index 0000000000..394dc912c3 --- /dev/null +++ b/plugins/card-resources/src/components/ChangeType.svelte @@ -0,0 +1,111 @@ + + + + + + { + dispatch('close') + }} + on:changeContent +> + + diff --git a/plugins/card-resources/src/index.ts b/plugins/card-resources/src/index.ts index c48ba4db4a..deed0e6ae6 100644 --- a/plugins/card-resources/src/index.ts +++ b/plugins/card-resources/src/index.ts @@ -40,6 +40,7 @@ import ViewsSection from './components/settings/view/ViewsSection.svelte' import EditView from './components/settings/view/EditView.svelte' import CardEditor from './components/CardEditor.svelte' import CardRefPresenter from './components/CardRefPresenter.svelte' +import ChangeType from './components/ChangeType.svelte' export default async (): Promise => ({ component: { @@ -61,7 +62,8 @@ export default async (): Promise => ({ ViewsSection, EditView, CardEditor, - CardRefPresenter + CardRefPresenter, + ChangeType }, completion: { CardQuery: queryCard diff --git a/plugins/card-resources/src/plugin.ts b/plugins/card-resources/src/plugin.ts index 4177d2b16a..a7e5181609 100644 --- a/plugins/card-resources/src/plugin.ts +++ b/plugins/card-resources/src/plugin.ts @@ -40,7 +40,8 @@ export default mergeIds(cardId, card, { ViewsSection: '' as AnyComponent, EditView: '' as AnyComponent, CardEditor: '' as AnyComponent, - CardRefPresenter: '' as AnyComponent + CardRefPresenter: '' as AnyComponent, + ChangeType: '' as AnyComponent }, completion: { CardQuery: '' as Resource, @@ -74,6 +75,7 @@ export default mergeIds(cardId, card, { CreateView: '' as IntlString, EditView: '' as IntlString, SelectViewType: '' as IntlString, - Document: '' as IntlString + Document: '' as IntlString, + ChangeType: '' as IntlString } }) diff --git a/plugins/card/src/analytics.ts b/plugins/card/src/analytics.ts index 3cb1270e7b..a65a7b0ea6 100644 --- a/plugins/card/src/analytics.ts +++ b/plugins/card/src/analytics.ts @@ -3,5 +3,6 @@ export enum CardEvents { TagCreated = 'card.card.TagCreated', RelationCreated = 'card.card.RelationCreated', CardCreated = 'card.card.Created', - CardOpened = 'card.card.Opened' + CardOpened = 'card.card.Opened', + TypeChanged = 'card.card.TypeChanged' }