Skip to content

Dev #54

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

Merged
merged 4 commits into from
May 12, 2025
Merged

Dev #54

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
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class="px-7"
style="max-width: 1368px;"
>
<DocsPage :codeBlockOptions="codeBlockSettings" />
<DocsPage />
</v-container>
</v-main>
</v-app>
Expand Down
1 change: 1 addition & 0 deletions src/documentation/components/ExampleContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
</template>

<script setup lang="ts">
defineOptions({ inheritAttrs: false });
const emit = defineEmits(['closePicker']);

export interface ExampleCode {
Expand Down
5 changes: 5 additions & 0 deletions src/documentation/components/examples/ButtonsFieldExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ import {
} from 'yup';
import AnswersDialog from '../AnswersDialog.vue';

interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const emit = defineEmits(['codeUpdated']);

Expand Down
5 changes: 5 additions & 0 deletions src/documentation/components/examples/ColumnsExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<script setup lang="ts">
import AnswersDialog from '../AnswersDialog.vue';

interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const links = inject<Docs.Links>('links')!;
const dialog = ref(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import { ref } from 'vue';
import AnswersDialog from '../AnswersDialog.vue';

interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);
const formAnswers = ref({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import { ref } from 'vue';
import AnswersDialog from '../AnswersDialog.vue';

interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);
const answers = ref({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import type { MaybeRef } from 'vue';
import AnswersDialog from '../AnswersDialog.vue';


interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);
const answers = ref<{
foobar: string | null;
Expand Down
5 changes: 5 additions & 0 deletions src/documentation/components/examples/FieldSlotExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
import { ref } from 'vue';
import AnswersDialog from '../AnswersDialog.vue';

interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);

Expand Down
5 changes: 5 additions & 0 deletions src/documentation/components/examples/SimpleExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import { ref } from 'vue';
import AnswersDialog from '../AnswersDialog.vue';

interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);
const answers = ref({
Expand Down
5 changes: 5 additions & 0 deletions src/documentation/components/examples/SummaryPageExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
import { ref } from 'vue';
import AnswersDialog from '../AnswersDialog.vue';

interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);
const answers = ref({
Expand Down
7 changes: 7 additions & 0 deletions src/documentation/components/examples/TemplateExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import {
string as yupString,
} from 'yup';


interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const answers = ref({
bar: null,
foo: null,
Expand Down
6 changes: 6 additions & 0 deletions src/documentation/components/examples/TooltipExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ import { ref } from 'vue';
import AnswersDialog from '../AnswersDialog.vue';


interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);
const answers = ref({
address: '123 Street',
Expand Down
7 changes: 7 additions & 0 deletions src/documentation/components/examples/ValidationExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ import {
} from 'yup';
import AnswersDialog from '../AnswersDialog.vue';


interface Props {
open?: HTMLPreElement | null;
}

defineProps<Props>();

const dialog = ref(false);

const answers = ref({
Expand Down
12 changes: 0 additions & 12 deletions src/documentation/sections/ExampleSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<ExampleContainer
:code="getTemplateCode('SimpleExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('SimpleExampleRef');"
>
<Example.SimpleExample
Expand All @@ -26,7 +25,6 @@

<ExampleContainer
:code="getTemplateCode('ColumnsExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('ColumnsExampleRef');"
>
<Example.ColumnsExample
Expand All @@ -37,7 +35,6 @@

<ExampleContainer
:code="getTemplateCode('FieldSlotExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('FieldSlotExampleRef');"
>
<Example.FieldSlotExample
Expand All @@ -49,7 +46,6 @@
<ExampleContainer
id="validation-example"
:code="getTemplateCode('ValidationExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('ValidationExampleRef');"
>
<Example.ValidationExample
Expand All @@ -60,7 +56,6 @@

<ExampleContainer
:code="getTemplateCode('ButtonsFieldExampleRef')"
:codeBlockSettings="codeBlockSettings"
:codeUpdatedAt="ButtonsFieldExampleCode?.updatedAt"
:updatedCode="ButtonsFieldExampleCode?.updatedCode"
@closePicker="closePicker('ButtonsFieldExampleRef');"
Expand All @@ -74,7 +69,6 @@

<ExampleContainer
:code="getTemplateCode('SummaryPageExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('SummaryPageExampleRef');"
>
<Example.SummaryPageExample
Expand All @@ -85,7 +79,6 @@

<ExampleContainer
:code="getTemplateCode('TooltipExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('TooltipExampleRef');"
>
<Example.TooltipExample
Expand All @@ -96,7 +89,6 @@

<ExampleContainer
:code="getTemplateCode('ConditionalPageExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('ConditionalPageExampleRef');"
>
<Example.ConditionalPageExample
Expand All @@ -107,7 +99,6 @@

<ExampleContainer
:code="getTemplateCode('ConditionalFieldExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('ConditionalFieldExampleRef');"
>
<Example.ConditionalFieldExample
Expand All @@ -118,7 +109,6 @@

<ExampleContainer
:code="getTemplateCode('DynamicAnswersQuestionsExampleRef')"
:codeBlockSettings="codeBlockSettings"
@closePicker="closePicker('DynamicAnswersQuestionsExampleRef');"
>
<Example.DynamicAnswersQuestionsExample
Expand All @@ -134,8 +124,6 @@ import type { ExampleCode } from '../components/ExampleContainer.vue';
import ExampleContainer from '../components/ExampleContainer.vue';
import * as Example from '../components/examples';


const codeBlockSettings = inject<Docs.CodeBlockSettings>('codeBlockSettings')!;
const classes = inject<Docs.GlobalClasses>('classes')!;

const SimpleExampleRef = ref(null);
Expand Down
14 changes: 12 additions & 2 deletions src/plugin/components/fields/VSFButtonField/VSFButtonField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const getIcon = (option: Option, prop: string): string => {
};


function getId(option: { id?: string; }, key: string | number) {
function getId(option: { id?: string | number; }, key: string | number) {
if (option.id != null) {
return option.id;
}
Expand Down Expand Up @@ -317,7 +317,17 @@ const isActive = (val: string | number): boolean | undefined => {
return undefined;
}

return value.value === val || (value.value as string[]).includes(val as string);
// If value.value is a number, compare directly.
if (typeof value.value === 'number') {
return value.value === val;
}

// If value.value is a string or an array of strings, handle both cases.
if (typeof value.value === 'string' || Array.isArray(value.value)) {
return (value.value as string[]).includes(val as string);
}

return undefined;
};

// ------------------------- Variants //
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/components/shared/FieldLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script lang="ts" setup>
export interface FieldLabelProps {
label: string | undefined;
required: boolean | undefined;
required?: boolean | undefined;
}

const { label, required = false } = defineProps<FieldLabelProps>();
Expand Down