From 14a67b252defd77beac030c380e41558cc88356f Mon Sep 17 00:00:00 2001 From: Alexandre Rousseau Date: Fri, 13 Dec 2024 09:21:36 +0100 Subject: [PATCH] feat(ui): introduce `WdsTabs` and use in builder - WF-127 --- .../builder/settings/BuilderFieldsAlign.vue | 61 +++++++--------- .../builder/settings/BuilderFieldsColor.vue | 66 +++++++---------- .../settings/BuilderFieldsKeyValue.vue | 34 ++++----- .../builder/settings/BuilderFieldsPadding.vue | 62 +++++++--------- .../builder/settings/BuilderFieldsShadow.vue | 62 +++++++--------- .../builder/settings/BuilderFieldsWidth.vue | 61 +++++++--------- .../settings/BuilderSettingsVisibility.vue | 73 +++++++++---------- src/ui/src/builder/sharedStyles.css | 28 ------- src/ui/src/wds/WdsTab.vue | 48 ++++++++++++ src/ui/src/wds/WdsTabs.vue | 39 ++++++++++ tests/e2e/tests/stateAutocompletion.spec.ts | 6 +- 11 files changed, 266 insertions(+), 274 deletions(-) create mode 100644 src/ui/src/wds/WdsTab.vue create mode 100644 src/ui/src/wds/WdsTabs.vue diff --git a/src/ui/src/builder/settings/BuilderFieldsAlign.vue b/src/ui/src/builder/settings/BuilderFieldsAlign.vue index e9aa7a53b..b95c1e42d 100644 --- a/src/ui/src/builder/settings/BuilderFieldsAlign.vue +++ b/src/ui/src/builder/settings/BuilderFieldsAlign.vue @@ -5,39 +5,11 @@ tabindex="-1" :data-automation-key="props.fieldKey" > -
-
- - - -
-
+
@@ -75,6 +47,7 @@ import { useComponentActions } from "../useComponentActions"; import injectionKeys from "@/injectionKeys"; import BuilderSelect from "../BuilderSelect.vue"; import BuilderTemplateInput from "./BuilderTemplateInput.vue"; +import WdsTabs, { WdsTabOptions } from "@/wds/WdsTabs.vue"; const wf = inject(injectionKeys.core); const ssbm = inject(injectionKeys.builderManager); @@ -86,6 +59,21 @@ const freehandInputEl: Ref = ref(null); type Mode = "pick" | "css" | "default"; +const tabs: WdsTabOptions[] = [ + { + label: "Default", + value: "default", + }, + { + label: "CSS", + value: "css", + }, + { + label: "Pick", + value: "pick", + }, +]; + enum SubMode { hleft = "start", hcenter = "center", @@ -231,6 +219,10 @@ const setMode = async (newMode: Mode) => { mode.value = newMode; await nextTick(); autofocus(); + + if (newMode === "default") { + setContentValue(component.value.id, fieldKey.value, undefined); + } }; const handleInputSelect = (select: string) => { @@ -263,9 +255,6 @@ onBeforeUnmount(() => { diff --git a/src/ui/src/wds/WdsTabs.vue b/src/ui/src/wds/WdsTabs.vue new file mode 100644 index 000000000..8d4d3894e --- /dev/null +++ b/src/ui/src/wds/WdsTabs.vue @@ -0,0 +1,39 @@ + + + + + + + diff --git a/tests/e2e/tests/stateAutocompletion.spec.ts b/tests/e2e/tests/stateAutocompletion.spec.ts index f51e140c4..5deab244e 100644 --- a/tests/e2e/tests/stateAutocompletion.spec.ts +++ b/tests/e2e/tests/stateAutocompletion.spec.ts @@ -71,7 +71,7 @@ test.describe("state autocompletion", () => { await page.locator('div.CoreRadioInput.component > label').click(); await page - .locator(`${FIELD} button.chip:text-matches("Static List")`) + .locator(`${FIELD} button.WdsTab:text-matches("Static List")`) .click(); await page .locator(`${FIELD} .inputKey input`) @@ -102,7 +102,7 @@ test.describe("state autocompletion", () => { await page.locator('div.CoreRadioInput.component > label').click(); await page - .locator(`${FIELD} button.chip:text-matches("JSON")`) + .locator(`${FIELD} button.WdsTab:text-matches("JSON")`) .click(); await page .locator(`${FIELD} textarea`) @@ -122,7 +122,7 @@ test.describe("state autocompletion", () => { const FIELD = `.${type}[data-automation-key="${key}"]`; await page.locator(componentSelector).click(); await page - .locator(`${FIELD} button.chip:text-matches("CSS")`) + .locator(`${FIELD} button.WdsTab:text-matches("CSS")`) .click(); await page .locator(`${FIELD} .BuilderTemplateInput input`)