Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wf 140 #3

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@googlemaps/js-api-loader": "^1.16.6",
"@monaco-editor/loader": "^1.3.3",
"@tato30/vue-pdf": "^1.9.6",
"ajv": "^8.17.1",
"arquero": "^5.2.0",
"chroma-js": "^2.4.2",
"fuse.js": "7.0.0",
Expand Down
16 changes: 11 additions & 5 deletions src/ui/src/builder/settings/BuilderFieldsAlign.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
v-if="mode == 'css'"
ref="freehandInputEl"
:value="component.content[fieldKey]"
:error="error"
@input="handleInputCss"
/>
</div>
Expand All @@ -38,6 +39,7 @@ import {
nextTick,
onBeforeUnmount,
onMounted,
PropType,
Ref,
ref,
toRefs,
Expand Down Expand Up @@ -135,11 +137,15 @@ const focusEls: Record<Mode, Ref<HTMLInputElement>> = {
default: null,
};

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
direction: "horizontal" | "vertical";
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
direction: {
type: String as PropType<"horizontal" | "vertical">,
required: true,
},
error: { type: String, required: false, default: undefined },
});

const { componentId, fieldKey, direction } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));
Expand Down
12 changes: 8 additions & 4 deletions src/ui/src/builder/settings/BuilderFieldsColor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
v-if="mode == 'css'"
ref="freehandInputEl"
:value="component.content[fieldKey]"
:error="error"
@input="handleInput"
/>
</div>
Expand All @@ -40,6 +41,7 @@ import {
Ref,
ref,
toRefs,
PropType,
} from "vue";
import { Component } from "@/writerTypes";
import { useComponentActions } from "../useComponentActions";
Expand All @@ -65,10 +67,12 @@ const focusEls: Record<Mode, Ref<HTMLInputElement>> = {
default: null,
};

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
error: { type: String, required: false, default: undefined },
});

const { componentId, fieldKey } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));

Expand Down
10 changes: 9 additions & 1 deletion src/ui/src/builder/settings/BuilderFieldsKeyValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
/>

<template v-if="mode == 'assisted'">
<div class="staticList">
<div
class="staticList"
:class="{ 'staticList--invalid': error !== undefined }"
>
<div
v-for="(entryValue, entryKey) in assistedEntries"
:key="entryKey"
Expand Down Expand Up @@ -54,6 +57,7 @@
<BuilderFieldsObject
:component-id="component.id"
:field-key="fieldKey"
:error="error"
></BuilderFieldsObject>
</template>
</div>
Expand Down Expand Up @@ -87,6 +91,7 @@ const props = defineProps({
componentId: { type: String, required: true },
fieldKey: { type: String, required: true },
instancePath: { type: Array as PropType<InstancePath>, required: true },
error: { type: String, required: false, default: undefined },
});

const { componentId, fieldKey } = toRefs(props);
Expand Down Expand Up @@ -192,6 +197,9 @@ onMounted(async () => {
border: 1px solid var(--builderSeparatorColor);
border-radius: 8px;
}
.staticList--invalid {
border-color: var(--wdsColorOrange5);
}

.staticList:empty::before {
content: "No entries yet.";
Expand Down
14 changes: 8 additions & 6 deletions src/ui/src/builder/settings/BuilderFieldsObject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
variant="code"
:value="component.content[fieldKey]"
:placeholder="templateField?.default"
:error="error"
@input="
(ev: Event) =>
formatAndSetContentValue((ev.target as HTMLInputElement).value)
Expand All @@ -14,20 +15,21 @@
</template>

<script setup lang="ts">
import { toRefs, inject, computed } from "vue";
import { Component } from "@/writerTypes";
import { toRefs, inject, computed, PropType } from "vue";
import { useComponentActions } from "../useComponentActions";
import injectionKeys from "@/injectionKeys";
import BuilderTemplateInput from "./BuilderTemplateInput.vue";
import { Component } from "@/writerTypes";

const wf = inject(injectionKeys.core);
const ssbm = inject(injectionKeys.builderManager);
const { setContentValue } = useComponentActions(wf, ssbm);

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
error: { type: String, required: false, default: undefined },
});
const { componentId, fieldKey } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));

Expand Down
11 changes: 7 additions & 4 deletions src/ui/src/builder/settings/BuilderFieldsPadding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
v-if="mode == 'css'"
ref="freehandInputEl"
:value="component.content[fieldKey]"
:error="error"
@input="handleInputCss"
/>
</div>
Expand All @@ -108,6 +109,7 @@ import {
nextTick,
onBeforeUnmount,
onMounted,
PropType,
Ref,
ref,
toRefs,
Expand Down Expand Up @@ -183,10 +185,11 @@ const focusEls: Record<Mode, Ref<HTMLInputElement>> = {
default: null,
};

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
error: { type: String, required: false, default: undefined },
});

const { componentId, fieldKey } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));
Expand Down
12 changes: 8 additions & 4 deletions src/ui/src/builder/settings/BuilderFieldsShadow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
v-if="mode == 'css'"
ref="freehandInputEl"
:value="component.content[fieldKey]"
:error="error"
@input="handleCSSInput"
/>
</div>
Expand All @@ -106,6 +107,7 @@ import {
nextTick,
onBeforeUnmount,
onMounted,
PropType,
Ref,
ref,
toRefs,
Expand Down Expand Up @@ -138,10 +140,12 @@ const focusEls: Record<Mode, Ref<HTMLInputElement>> = {
default: null,
};

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
error: { type: String, required: false, default: undefined },
});

const { componentId, fieldKey } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));

Expand Down
13 changes: 8 additions & 5 deletions src/ui/src/builder/settings/BuilderFieldsText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:value="component.content[fieldKey]"
:placeholder="templateField?.default"
:options="options"
:error="error"
@input="handleInput"
/>
</template>
Expand All @@ -23,14 +24,15 @@
:input-id="inputId"
:value="component.content[fieldKey]"
:placeholder="templateField?.default"
:error="error"
@input="handleInput"
/>
</template>
</div>
</template>

<script setup lang="ts">
import { toRefs, inject, computed } from "vue";
import { toRefs, inject, computed, PropType } from "vue";
import { Component, FieldControl } from "@/writerTypes";
import { useComponentActions } from "../useComponentActions";
import injectionKeys from "../../injectionKeys";
Expand All @@ -40,10 +42,11 @@ const wf = inject(injectionKeys.core);
const ssbm = inject(injectionKeys.builderManager);
const { setContentValue } = useComponentActions(wf, ssbm);

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
error: { type: String, required: false, default: undefined },
});
const { componentId, fieldKey } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));
const templateField = computed(() => {
Expand Down
20 changes: 15 additions & 5 deletions src/ui/src/builder/settings/BuilderFieldsTools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@
</template>

<script setup lang="ts">
import { toRefs, inject, computed, ref, defineAsyncComponent } from "vue";
import {
toRefs,
inject,
computed,
ref,
defineAsyncComponent,
PropType,
} from "vue";
import { Component } from "@/writerTypes";
import { useComponentActions } from "../useComponentActions";
import injectionKeys from "@/injectionKeys";
Expand Down Expand Up @@ -137,10 +144,13 @@ const toolFormInitValue = {

const toolForm = ref<ToolForm>(toolFormInitValue);

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
// TODO: not used for now
error: { type: String, required: false, default: undefined },
});

const { componentId, fieldKey } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));

Expand Down
11 changes: 7 additions & 4 deletions src/ui/src/builder/settings/BuilderFieldsWidth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ref="fixedEl"
type="number"
:model-value="valuePickFixed"
:invalid="error !== undefined"
@update:model-value="handleInputFixed"
/>
<div>px</div>
Expand All @@ -47,6 +48,7 @@ import {
nextTick,
onBeforeUnmount,
onMounted,
PropType,
Ref,
ref,
toRefs,
Expand Down Expand Up @@ -111,10 +113,11 @@ const focusEls: Record<Mode, Ref<HTMLInputElement>> = {
default: null,
};

const props = defineProps<{
componentId: Component["id"];
fieldKey: string;
}>();
const props = defineProps({
componentId: { type: String as PropType<Component["id"]>, required: true },
fieldKey: { type: String, required: true },
error: { type: String, required: false, default: undefined },
});

const { componentId, fieldKey } = toRefs(props);
const component = computed(() => wf.getComponentById(componentId.value));
Expand Down
1 change: 1 addition & 0 deletions src/ui/src/builder/settings/BuilderSettingsBinding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { useComponentActions } from "../useComponentActions";
import injectionKeys from "../../injectionKeys";
import BuilderTemplateInput from "./BuilderTemplateInput.vue";
import WdsFieldWrapper from "@/wds/WdsFieldWrapper.vue";
import BuilderSectionTitle from "./BuilderSectionTitle.vue";

const hint =
'Links this component to a state element, in a two-way fashion. Reference the state element directly, i.e. use "my_var" instead of "@{my_var}".';
Expand Down
Loading