From 8d3ebdc19ac9fc4766e12535b2fd4ec203592f94 Mon Sep 17 00:00:00 2001 From: dmitrykurmanov Date: Thu, 6 Jul 2023 19:59:49 +0400 Subject: [PATCH] work for the https://github.com/surveyjs/survey-library/issues/6402 (panel-dynamic) --- packages/survey-vue-ui/src/PanelDynamic.vue | 64 +++++++++++++++++++ .../src/PanelDynamicProgress.vue | 41 ++++++++++++ .../src/PanelDynamicProgressV2.vue | 30 +++++++++ .../PaneldynamicAddBtn.vue | 30 +++++++++ .../PaneldynamicNextBtn.vue | 23 +++++++ .../PaneldynamicPrevBtn.vue | 23 +++++++ .../PaneldynamicProgressText.vue | 14 ++++ .../PaneldynamicRemoveBtn.vue | 38 +++++++++++ .../components/paneldynamic-actions/action.ts | 15 +++++ packages/survey-vue-ui/src/index.ts | 19 ++++++ packages/survey-vue-ui/tests/test.spec.ts | 2 +- 11 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 packages/survey-vue-ui/src/PanelDynamic.vue create mode 100644 packages/survey-vue-ui/src/PanelDynamicProgress.vue create mode 100644 packages/survey-vue-ui/src/PanelDynamicProgressV2.vue create mode 100644 packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicAddBtn.vue create mode 100644 packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicNextBtn.vue create mode 100644 packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicPrevBtn.vue create mode 100644 packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicProgressText.vue create mode 100644 packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicRemoveBtn.vue create mode 100644 packages/survey-vue-ui/src/components/paneldynamic-actions/action.ts diff --git a/packages/survey-vue-ui/src/PanelDynamic.vue b/packages/survey-vue-ui/src/PanelDynamic.vue new file mode 100644 index 0000000000..e71388d3a9 --- /dev/null +++ b/packages/survey-vue-ui/src/PanelDynamic.vue @@ -0,0 +1,64 @@ + + + diff --git a/packages/survey-vue-ui/src/PanelDynamicProgress.vue b/packages/survey-vue-ui/src/PanelDynamicProgress.vue new file mode 100644 index 0000000000..d783da2993 --- /dev/null +++ b/packages/survey-vue-ui/src/PanelDynamicProgress.vue @@ -0,0 +1,41 @@ + + + diff --git a/packages/survey-vue-ui/src/PanelDynamicProgressV2.vue b/packages/survey-vue-ui/src/PanelDynamicProgressV2.vue new file mode 100644 index 0000000000..25ede494f1 --- /dev/null +++ b/packages/survey-vue-ui/src/PanelDynamicProgressV2.vue @@ -0,0 +1,30 @@ + + + diff --git a/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicAddBtn.vue b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicAddBtn.vue new file mode 100644 index 0000000000..cd3b810a41 --- /dev/null +++ b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicAddBtn.vue @@ -0,0 +1,30 @@ + + + diff --git a/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicNextBtn.vue b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicNextBtn.vue new file mode 100644 index 0000000000..9c114b605e --- /dev/null +++ b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicNextBtn.vue @@ -0,0 +1,23 @@ + + + diff --git a/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicPrevBtn.vue b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicPrevBtn.vue new file mode 100644 index 0000000000..e95afb7e98 --- /dev/null +++ b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicPrevBtn.vue @@ -0,0 +1,23 @@ + + + diff --git a/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicProgressText.vue b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicProgressText.vue new file mode 100644 index 0000000000..c707dde82e --- /dev/null +++ b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicProgressText.vue @@ -0,0 +1,14 @@ + + + diff --git a/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicRemoveBtn.vue b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicRemoveBtn.vue new file mode 100644 index 0000000000..b47b697224 --- /dev/null +++ b/packages/survey-vue-ui/src/components/paneldynamic-actions/PaneldynamicRemoveBtn.vue @@ -0,0 +1,38 @@ + + + diff --git a/packages/survey-vue-ui/src/components/paneldynamic-actions/action.ts b/packages/survey-vue-ui/src/components/paneldynamic-actions/action.ts new file mode 100644 index 0000000000..326a28d978 --- /dev/null +++ b/packages/survey-vue-ui/src/components/paneldynamic-actions/action.ts @@ -0,0 +1,15 @@ +import type { ComponentOptions } from "vue"; +import { Action, QuestionPanelDynamicModel } from "survey-core"; + +export const PaneldynamicActionMixin: ComponentOptions = { + props: { + data: Object, + item: Action, + }, + computed: { + // readonly + question(vm: any): QuestionPanelDynamicModel { + return (vm.item && vm.item.data.question) || vm.data.question; + }, + }, +}; diff --git a/packages/survey-vue-ui/src/index.ts b/packages/survey-vue-ui/src/index.ts index 1fa37f5525..edcb5ba1e8 100644 --- a/packages/survey-vue-ui/src/index.ts +++ b/packages/survey-vue-ui/src/index.ts @@ -55,6 +55,15 @@ import MatrixHeaderRequired from "./MatrixHeaderRequired.vue"; import MatrixCell from "./MatrixCell.vue"; import MatrixDynamic from "./MatrixDynamic.vue"; +import PanelDynamic from "./PanelDynamic.vue"; +import PanelDynamicProgress from "./PanelDynamicProgress.vue"; +import PanelDynamicProgressV2 from "./PanelDynamicProgressV2.vue"; +import PaneldynamicAddBtn from "./components/paneldynamic-actions/PaneldynamicAddBtn.vue"; +import PaneldynamicNextBtn from "./components/paneldynamic-actions/PaneldynamicNextBtn.vue"; +import PaneldynamicPrevBtn from "./components/paneldynamic-actions/PaneldynamicPrevBtn.vue"; +import PaneldynamicRemoveBtn from "./components/paneldynamic-actions/PaneldynamicRemoveBtn.vue"; +import PaneldynamicProgressText from "./components/paneldynamic-actions/PaneldynamicProgressText.vue"; + import Errors from "./Errors.vue"; import QuestionComment from "./QuestionComment.vue"; import TitleElement from "./components/title/TitleElement.vue"; @@ -124,6 +133,7 @@ export function registerComponents(app: any) { app.component("sv-boolean-checkbox", BooleanCheckbox); app.component("survey-multipletext", MultipleText); app.component("survey-multipletext-item", MultipletextItem); + app.component("survey-matrix", Matrix); app.component("survey-matrixdropdown", MatrixDropdown); app.component("survey-matrixtable", MatrixTable); @@ -131,6 +141,15 @@ export function registerComponents(app: any) { app.component("survey-matrixcell", MatrixCell); app.component("survey-matrixdynamic", MatrixDynamic); + app.component("survey-paneldynamic", PanelDynamic); + app.component("survey-paneldynamicprogress", PanelDynamicProgress); + app.component("survey-paneldynamicprogress-v2", PanelDynamicProgressV2); + app.component("sv-paneldynamic-add-btn", PaneldynamicAddBtn); + app.component("sv-paneldynamic-next-btn", PaneldynamicNextBtn); + app.component("sv-paneldynamic-prev-btn", PaneldynamicPrevBtn); + app.component("sv-paneldynamic-remove-btn", PaneldynamicRemoveBtn); + app.component("sv-paneldynamic-progress-text", PaneldynamicProgressText); + app.component("sv-components-container", Container); app.component("sv-progress-pages", Progress); app.component("sv-progress-questions", Progress); diff --git a/packages/survey-vue-ui/tests/test.spec.ts b/packages/survey-vue-ui/tests/test.spec.ts index 29022f9023..bda069233b 100644 --- a/packages/survey-vue-ui/tests/test.spec.ts +++ b/packages/survey-vue-ui/tests/test.spec.ts @@ -51,7 +51,7 @@ class ExpectAssertAdapter { } } -const whiteList = ["matrix"]; +const whiteList = ["paneldynamic"]; describe("etalon tests", () => { markupTests.forEach((markupTest) => {