@resee-movies/nuxt-ux 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +20 -3
- package/dist/runtime/components/Button.vue +15 -9
- package/dist/runtime/components/Button.vue.d.ts +2 -12
- package/dist/runtime/components/Card.vue.d.ts +1 -4
- package/dist/runtime/components/Dialog.vue.d.ts +1 -13
- package/dist/runtime/components/Drawer.vue.d.ts +1 -4
- package/dist/runtime/components/Heading.vue.d.ts +1 -4
- package/dist/runtime/components/Icon.vue +27 -15
- package/dist/runtime/components/Icon.vue.d.ts +4 -6
- package/dist/runtime/components/IconTextPair.vue +22 -19
- package/dist/runtime/components/IconTextPair.vue.d.ts +5 -12
- package/dist/runtime/components/Image.vue +1 -1
- package/dist/runtime/components/Image.vue.d.ts +1 -17
- package/dist/runtime/components/LayoutPageColumn.vue.d.ts +1 -4
- package/dist/runtime/components/LayoutPageContainer.vue +12 -2
- package/dist/runtime/components/LayoutPageContainer.vue.d.ts +4 -5
- package/dist/runtime/components/Lorem.vue.d.ts +1 -11
- package/dist/runtime/components/Menu.vue +28 -20
- package/dist/runtime/components/Menu.vue.d.ts +4 -7
- package/dist/runtime/components/Message.vue.d.ts +2 -2
- package/dist/runtime/components/NotificationContainer.vue +10 -3
- package/dist/runtime/components/ProgressBar.vue.d.ts +1 -5
- package/dist/runtime/components/ProgressSpinner.vue.d.ts +1 -3
- package/dist/runtime/components/Tag.vue.d.ts +1 -7
- package/dist/runtime/components/form/Form.vue +52 -0
- package/dist/runtime/components/form/Form.vue.d.ts +27 -0
- package/dist/runtime/components/form/FormField.vue +91 -0
- package/dist/runtime/components/form/FormField.vue.d.ts +37 -0
- package/dist/runtime/components/form/FormFieldCheckbox.vue +51 -0
- package/dist/runtime/components/form/FormFieldCheckbox.vue.d.ts +17 -0
- package/dist/runtime/components/form/FormFieldSelect.vue +76 -0
- package/dist/runtime/components/form/FormFieldSelect.vue.d.ts +26 -0
- package/dist/runtime/components/form/FormFieldText.vue +56 -0
- package/dist/runtime/components/form/FormFieldText.vue.d.ts +16 -0
- package/dist/runtime/components/form/FormFieldToggleSwitch.vue +47 -0
- package/dist/runtime/components/form/FormFieldToggleSwitch.vue.d.ts +15 -0
- package/dist/runtime/components/form/FormLabelInputPair.vue +42 -0
- package/dist/runtime/components/form/FormLabelInputPair.vue.d.ts +22 -0
- package/dist/runtime/components/form/FormSubmitButton.vue +39 -0
- package/dist/runtime/components/form/FormSubmitButton.vue.d.ts +6 -0
- package/dist/runtime/components/form/FormValidationMessage.vue +24 -0
- package/dist/runtime/components/form/FormValidationMessage.vue.d.ts +15 -0
- package/dist/runtime/components/form/element/FormElementSelectOptions.vue +250 -0
- package/dist/runtime/components/form/element/FormElementSelectOptions.vue.d.ts +13 -0
- package/dist/runtime/composables/use-load-image.js +1 -0
- package/dist/runtime/composables/use-notification.d.ts +18 -11
- package/dist/runtime/composables/use-notification.js +27 -27
- package/dist/runtime/composables/use-resee-ux.d.ts +24 -0
- package/dist/runtime/composables/use-resee-ux.js +22 -0
- package/dist/runtime/constants.d.ts +3 -0
- package/dist/runtime/constants.js +3 -0
- package/dist/runtime/server/plugins/teleport-targets.d.ts +3 -0
- package/dist/runtime/server/plugins/teleport-targets.js +6 -0
- package/dist/runtime/theme/css/brand/form.css +1 -0
- package/dist/runtime/theme/css/brand/menu.css +1 -0
- package/dist/runtime/theme/css/brand/mobile.css +1 -0
- package/dist/runtime/theme/css/brand/transition.css +1 -1
- package/dist/runtime/theme/css/brand/utilities.css +1 -1
- package/dist/runtime/theme/css/styles.css +1 -1
- package/dist/runtime/types/form.d.ts +23 -0
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/utils/dom.d.ts +9 -0
- package/dist/runtime/utils/dom.js +25 -0
- package/dist/runtime/utils/form.d.ts +34 -0
- package/dist/runtime/utils/form.js +34 -0
- package/dist/runtime/utils/string.d.ts +6 -0
- package/dist/runtime/utils/string.js +3 -0
- package/dist/runtime/utils/validation.d.ts +21 -0
- package/dist/runtime/utils/validation.js +56 -0
- package/package.json +26 -24
|
@@ -3,10 +3,6 @@ export interface ProgressBarProps {
|
|
|
3
3
|
showValue?: boolean;
|
|
4
4
|
indeterminate?: boolean;
|
|
5
5
|
}
|
|
6
|
-
declare const __VLS_export: import("vue").DefineComponent<ProgressBarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProgressBarProps> & Readonly<{}>, {
|
|
7
|
-
value: number;
|
|
8
|
-
showValue: boolean;
|
|
9
|
-
indeterminate: boolean;
|
|
10
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<ProgressBarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProgressBarProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
7
|
declare const _default: typeof __VLS_export;
|
|
12
8
|
export default _default;
|
|
@@ -2,8 +2,6 @@ import type { IconProps } from './Icon.vue.js';
|
|
|
2
2
|
export interface ProgressSpinnerProps {
|
|
3
3
|
size?: IconProps['size'];
|
|
4
4
|
}
|
|
5
|
-
declare const __VLS_export: import("vue").DefineComponent<ProgressSpinnerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProgressSpinnerProps> & Readonly<{}>, {
|
|
6
|
-
size: "sm" | "md" | "lg" | "xl";
|
|
7
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<ProgressSpinnerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProgressSpinnerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
6
|
declare const _default: typeof __VLS_export;
|
|
9
7
|
export default _default;
|
|
@@ -6,12 +6,6 @@ export interface TagProps {
|
|
|
6
6
|
size?: 'sm' | 'md' | 'lg';
|
|
7
7
|
tooltip?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const __VLS_export: import("vue").DefineComponent<TagProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TagProps> & Readonly<{}>, {
|
|
10
|
-
size: "sm" | "md" | "lg";
|
|
11
|
-
icon: string;
|
|
12
|
-
text: string;
|
|
13
|
-
severity: StatusLevel;
|
|
14
|
-
tooltip: string;
|
|
15
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<TagProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TagProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
10
|
declare const _default: typeof __VLS_export;
|
|
17
11
|
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PrimeForm
|
|
3
|
+
v-slot = "$form"
|
|
4
|
+
novalidate = "true"
|
|
5
|
+
:validate-on-mount = "true"
|
|
6
|
+
:validate-on-submit = "true"
|
|
7
|
+
:validate-on-value-update = "true"
|
|
8
|
+
:validate-on-blur = "false"
|
|
9
|
+
:initial-values = "props.initialValues"
|
|
10
|
+
:aria-disabled = "props.disabled"
|
|
11
|
+
@submit = "handleFormSubmit"
|
|
12
|
+
>
|
|
13
|
+
<slot :state="$form" />
|
|
14
|
+
</PrimeForm>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export * from "../../types/form";
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import PrimeForm from "@primevue/forms/form";
|
|
23
|
+
import { toNonNullableArray } from "@resee-movies/utilities/arrays/to-non-nullable-array";
|
|
24
|
+
import { isPromiseLike } from "@resee-movies/utilities/objects/is-promise-like";
|
|
25
|
+
import { syncRefs } from "@vueuse/core";
|
|
26
|
+
import { provideFormInstance, getValuesFromFormState } from "../../utils/form";
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
disabled: { type: Boolean, required: false },
|
|
29
|
+
initialValues: { type: Object, required: false },
|
|
30
|
+
onSubmit: { type: [Function, Array], required: false }
|
|
31
|
+
});
|
|
32
|
+
defineEmits(["submit"]);
|
|
33
|
+
const formInstance = provideFormInstance();
|
|
34
|
+
syncRefs(() => props.disabled, formInstance.isDisabled);
|
|
35
|
+
async function handleFormSubmit(event) {
|
|
36
|
+
formInstance.hasSubmitted.value = true;
|
|
37
|
+
if (!event.valid) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (props.onSubmit) {
|
|
41
|
+
const handlers = toNonNullableArray(props.onSubmit);
|
|
42
|
+
const values = getValuesFromFormState(event.states);
|
|
43
|
+
const newEvent = { ...event, values };
|
|
44
|
+
const results = handlers.map((handler) => handler(newEvent));
|
|
45
|
+
if (!!results.find((result) => isPromiseLike(result))) {
|
|
46
|
+
formInstance.isSubmitting.value = true;
|
|
47
|
+
await Promise.allSettled(results);
|
|
48
|
+
formInstance.isSubmitting.value = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FormValues, FormSubmitHandler, FormSubmitEvent } from '../../types/form.js';
|
|
2
|
+
export * from '../../types/form.js';
|
|
3
|
+
export interface FormProps<T extends FormValues = FormValues> {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
initialValues?: Record<string, unknown>;
|
|
6
|
+
onSubmit?: FormSubmitHandler<T> | FormSubmitHandler<T>[];
|
|
7
|
+
}
|
|
8
|
+
declare const __VLS_export: <T extends FormValues>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
9
|
+
props: __VLS_PrettifyLocal<FormProps<T> & __VLS_EmitsToProps<__VLS_NormalizeEmits<(e: "submit", evt: FormSubmitEvent<T>) => (void | Promise<void>)>>> & import("vue").PublicProps & (typeof globalThis extends {
|
|
10
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
11
|
+
} ? P : {});
|
|
12
|
+
expose: (exposed: {}) => void;
|
|
13
|
+
attrs: any;
|
|
14
|
+
slots: {
|
|
15
|
+
default?: (props: {
|
|
16
|
+
state: any;
|
|
17
|
+
}) => any;
|
|
18
|
+
};
|
|
19
|
+
emit: (e: "submit", evt: FormSubmitEvent<T>) => (void | Promise<void>);
|
|
20
|
+
}>) => import("vue").VNode & {
|
|
21
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
22
|
+
};
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_PrettifyLocal<T> = {
|
|
26
|
+
[K in keyof T as K]: T[K];
|
|
27
|
+
} & {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PrimeFormField
|
|
3
|
+
v-slot = "$field"
|
|
4
|
+
:as = "props.is"
|
|
5
|
+
:name = "props.name"
|
|
6
|
+
:resolver = "validatorFunction"
|
|
7
|
+
:initial-value = "props.initialValue"
|
|
8
|
+
:class = "['input-field', props.class, { disabled: isDisabled, readonly: isReadonly, required: props.required }]"
|
|
9
|
+
>
|
|
10
|
+
<FormLabelInputPair
|
|
11
|
+
:input-id = "inputId"
|
|
12
|
+
:label-id = "labelId"
|
|
13
|
+
:label-text = "labelText"
|
|
14
|
+
:label-position = "props.labelPosition"
|
|
15
|
+
:label-sr-only = "props.labelSrOnly"
|
|
16
|
+
:disabled = "props.disabled"
|
|
17
|
+
:required = "props.required"
|
|
18
|
+
:faux-label = "props.fauxLabel"
|
|
19
|
+
>
|
|
20
|
+
<template #label>
|
|
21
|
+
<slot name="label" />
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<template #input>
|
|
25
|
+
<slot
|
|
26
|
+
name = "default"
|
|
27
|
+
:input-name = "props.name"
|
|
28
|
+
:input-id = "inputId"
|
|
29
|
+
:label-id = "labelId"
|
|
30
|
+
:label-text = "labelText"
|
|
31
|
+
:message-id = "$field.error ? messageId : void 0"
|
|
32
|
+
:disabled = "isDisabled"
|
|
33
|
+
:readonly = "isReadonly"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
</FormLabelInputPair>
|
|
37
|
+
|
|
38
|
+
<FormValidationMessage
|
|
39
|
+
v-if = "$field.error"
|
|
40
|
+
:id = "messageId"
|
|
41
|
+
:visible = "$field.touched || formState.hasSubmitted.value"
|
|
42
|
+
:message = "$field.error.message"
|
|
43
|
+
/>
|
|
44
|
+
</PrimeFormField>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { computed } from "vue";
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<script setup>
|
|
52
|
+
import PrimeFormField, {} from "@primevue/forms/formfield";
|
|
53
|
+
import { humanize } from "@resee-movies/utilities/strings/humanize";
|
|
54
|
+
import { useId } from "vue";
|
|
55
|
+
import { injectFormInstance } from "../../utils/form";
|
|
56
|
+
import FormLabelInputPair from "./FormLabelInputPair.vue";
|
|
57
|
+
import FormValidationMessage from "./FormValidationMessage.vue";
|
|
58
|
+
defineOptions({
|
|
59
|
+
inheritAttrs: false
|
|
60
|
+
});
|
|
61
|
+
const props = defineProps({
|
|
62
|
+
name: { type: String, required: true },
|
|
63
|
+
label: { type: String, required: false, default: void 0 },
|
|
64
|
+
is: { type: String, required: false, default: "div" },
|
|
65
|
+
initialValue: { type: null, required: false, default: void 0 },
|
|
66
|
+
required: { type: Boolean, required: false, default: false },
|
|
67
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
68
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
69
|
+
fauxLabel: { type: Boolean, required: false },
|
|
70
|
+
labelSrOnly: { type: Boolean, required: false },
|
|
71
|
+
labelPosition: { type: String, required: false },
|
|
72
|
+
validator: { type: Function, required: false, default: void 0 },
|
|
73
|
+
class: { type: null, required: false }
|
|
74
|
+
});
|
|
75
|
+
const formState = injectFormInstance();
|
|
76
|
+
const inputId = useId();
|
|
77
|
+
const labelId = `${inputId}_label`;
|
|
78
|
+
const messageId = `${inputId}_message`;
|
|
79
|
+
const labelText = computed(() => props.label ?? humanize(props.name));
|
|
80
|
+
const isDisabled = computed(() => props.disabled || formState.isDisabled.value);
|
|
81
|
+
const isReadonly = computed(() => props.readonly || formState.isSubmitting.value);
|
|
82
|
+
const validatorFunction = computed(() => {
|
|
83
|
+
return ({ value }) => {
|
|
84
|
+
const result = props?.validator?.(value, labelText.value)?.safeParse(value);
|
|
85
|
+
if (result?.error?.issues.length) {
|
|
86
|
+
return { errors: result.error.issues };
|
|
87
|
+
}
|
|
88
|
+
return void 0;
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ZodMiniType } from 'zod/mini';
|
|
2
|
+
import type { HintedString, HTMLElementClassNames } from '../../types/index.js';
|
|
3
|
+
import type { FormLabelInputPairProps } from './FormLabelInputPair.vue.js';
|
|
4
|
+
export interface FormFieldProps {
|
|
5
|
+
name: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
is?: HintedString<'div'>;
|
|
8
|
+
initialValue?: unknown;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
readonly?: boolean;
|
|
12
|
+
fauxLabel?: boolean;
|
|
13
|
+
labelSrOnly?: boolean;
|
|
14
|
+
labelPosition?: FormLabelInputPairProps['labelPosition'];
|
|
15
|
+
validator?: (value: unknown, label: string) => undefined | ZodMiniType;
|
|
16
|
+
class?: HTMLElementClassNames;
|
|
17
|
+
}
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
19
|
+
label?: (props: {}) => any;
|
|
20
|
+
} & {
|
|
21
|
+
default?: (props: {
|
|
22
|
+
inputName: string;
|
|
23
|
+
inputId: any;
|
|
24
|
+
labelId: any;
|
|
25
|
+
labelText: any;
|
|
26
|
+
messageId: any;
|
|
27
|
+
disabled: any;
|
|
28
|
+
readonly: any;
|
|
29
|
+
}) => any;
|
|
30
|
+
}>;
|
|
31
|
+
declare const _default: typeof __VLS_export;
|
|
32
|
+
export default _default;
|
|
33
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
34
|
+
new (): {
|
|
35
|
+
$slots: S;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormField v-bind="props" :validator="validatorFunction">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #default="{ inputId, messageId, disabled, readonly }">
|
|
8
|
+
<PrimeCheckbox
|
|
9
|
+
:input-id = "inputId"
|
|
10
|
+
:value = "props.value"
|
|
11
|
+
:true-value = "props.trueValue"
|
|
12
|
+
:false-value = "props.falseValue"
|
|
13
|
+
:binary = "props.binary"
|
|
14
|
+
:aria-describedby = "messageId"
|
|
15
|
+
:disabled = "disabled || readonly"
|
|
16
|
+
:readonly = "readonly"
|
|
17
|
+
class = "input-group"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
</FormField>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { computed } from "vue";
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script setup>
|
|
28
|
+
import PrimeCheckbox from "primevue/checkbox";
|
|
29
|
+
import { createBooleanValidator } from "../../utils/validation";
|
|
30
|
+
import FormField from "./FormField.vue";
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
value: { type: null, required: false, default: void 0 },
|
|
33
|
+
trueValue: { type: null, required: false, default: () => true },
|
|
34
|
+
falseValue: { type: null, required: false, default: () => false },
|
|
35
|
+
binary: { type: Boolean, required: false, default: () => true },
|
|
36
|
+
name: { type: String, required: true },
|
|
37
|
+
label: { type: String, required: false },
|
|
38
|
+
is: { type: String, required: false },
|
|
39
|
+
initialValue: { type: null, required: false, default: () => false },
|
|
40
|
+
required: { type: Boolean, required: false },
|
|
41
|
+
disabled: { type: Boolean, required: false },
|
|
42
|
+
readonly: { type: Boolean, required: false },
|
|
43
|
+
fauxLabel: { type: Boolean, required: false },
|
|
44
|
+
labelSrOnly: { type: Boolean, required: false },
|
|
45
|
+
labelPosition: { type: String, required: false, default: "after" },
|
|
46
|
+
class: { type: null, required: false }
|
|
47
|
+
});
|
|
48
|
+
const validatorFunction = computed(() => {
|
|
49
|
+
return () => createBooleanValidator({ required: props.required });
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FormFieldProps } from './FormField.vue.js';
|
|
2
|
+
export interface FormFieldCheckboxProps extends Omit<FormFieldProps, 'validator'> {
|
|
3
|
+
value?: unknown;
|
|
4
|
+
trueValue?: unknown;
|
|
5
|
+
falseValue?: unknown;
|
|
6
|
+
binary?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormFieldCheckboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldCheckboxProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
9
|
+
label?: (props: {}) => any;
|
|
10
|
+
}>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormField v-bind="props" :validator="validatorFunction">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #default="{ inputName, inputId, labelId, messageId, disabled, readonly }">
|
|
8
|
+
<FormElementSelectOptions
|
|
9
|
+
:name = "inputName"
|
|
10
|
+
:input-id = "inputId"
|
|
11
|
+
:label-id = "labelId"
|
|
12
|
+
:disabled = "disabled"
|
|
13
|
+
:readonly = "readonly"
|
|
14
|
+
:aria-describedby = "messageId"
|
|
15
|
+
:multiple = "props.multiple"
|
|
16
|
+
:options = "props.options"
|
|
17
|
+
:option-label = "props.optionLabel"
|
|
18
|
+
:option-value = "props.optionValue"
|
|
19
|
+
:option-disabled = "props.optionDisabled"
|
|
20
|
+
:data-key = "props.dataKey"
|
|
21
|
+
:placeholder = "props.placeholder"
|
|
22
|
+
:show-clear = "props.showClear"
|
|
23
|
+
:show-option-footer = "props.showOptionFilter"
|
|
24
|
+
:filter-placeholder = "props.filterPlaceholder"
|
|
25
|
+
:loading = "props.loading"
|
|
26
|
+
:selection-limit = "props.maxRequired"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
</FormField>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import {} from "./FormField.vue";
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<script setup>
|
|
37
|
+
import { computed } from "vue";
|
|
38
|
+
import { createBooleanValidator, createListValidator } from "../../utils/validation";
|
|
39
|
+
import FormField from "./FormField.vue";
|
|
40
|
+
import FormElementSelectOptions from "./element/FormElementSelectOptions.vue";
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
options: { type: Array, required: false },
|
|
43
|
+
optionLabel: { type: String, required: false },
|
|
44
|
+
optionValue: { type: String, required: false },
|
|
45
|
+
optionDisabled: { type: String, required: false },
|
|
46
|
+
dataKey: { type: String, required: false },
|
|
47
|
+
placeholder: { type: String, required: false },
|
|
48
|
+
showClear: { type: Boolean, required: false, default: true },
|
|
49
|
+
showOptionFilter: { type: Boolean, required: false, default: void 0 },
|
|
50
|
+
filterPlaceholder: { type: String, required: false },
|
|
51
|
+
loading: { type: Boolean, required: false },
|
|
52
|
+
multiple: { type: Boolean, required: false, default: false },
|
|
53
|
+
minRequired: { type: [String, Number], required: false },
|
|
54
|
+
maxRequired: { type: [String, Number], required: false },
|
|
55
|
+
name: { type: String, required: true },
|
|
56
|
+
label: { type: String, required: false },
|
|
57
|
+
is: { type: String, required: false },
|
|
58
|
+
initialValue: { type: null, required: false },
|
|
59
|
+
required: { type: Boolean, required: false },
|
|
60
|
+
disabled: { type: Boolean, required: false },
|
|
61
|
+
readonly: { type: Boolean, required: false },
|
|
62
|
+
fauxLabel: { type: Boolean, required: false, default: true },
|
|
63
|
+
labelSrOnly: { type: Boolean, required: false },
|
|
64
|
+
labelPosition: { type: String, required: false },
|
|
65
|
+
class: { type: null, required: false }
|
|
66
|
+
});
|
|
67
|
+
const validatorFunction = computed(() => {
|
|
68
|
+
return props.multiple ? () => createListValidator({
|
|
69
|
+
required: props.required,
|
|
70
|
+
minRequired: props.minRequired,
|
|
71
|
+
maxRequired: props.maxRequired
|
|
72
|
+
}) : () => createBooleanValidator({
|
|
73
|
+
required: props.required
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type FormFieldProps } from './FormField.vue.js';
|
|
2
|
+
export interface FormFieldSelectProps extends Omit<FormFieldProps, 'validator'> {
|
|
3
|
+
options?: unknown[];
|
|
4
|
+
optionLabel?: string;
|
|
5
|
+
optionValue?: string;
|
|
6
|
+
optionDisabled?: string;
|
|
7
|
+
dataKey?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
showClear?: boolean;
|
|
10
|
+
showOptionFilter?: boolean;
|
|
11
|
+
filterPlaceholder?: string;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
minRequired?: string | number;
|
|
15
|
+
maxRequired?: string | number;
|
|
16
|
+
}
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormFieldSelectProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldSelectProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
18
|
+
label?: (props: {}) => any;
|
|
19
|
+
}>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormField v-bind="props" :validator="validatorFunction">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #default="{ inputId, messageId, disabled, readonly }">
|
|
8
|
+
<PrimeInputText
|
|
9
|
+
:id = "inputId"
|
|
10
|
+
:aria-describedby = "messageId"
|
|
11
|
+
:disabled = "disabled"
|
|
12
|
+
:readonly = "readonly"
|
|
13
|
+
:type = "props.type"
|
|
14
|
+
:required = "props.required"
|
|
15
|
+
:minlength = "props.minLength"
|
|
16
|
+
:maxlength = "props.maxLength"
|
|
17
|
+
class = "input-control"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
</FormField>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import {} from "./FormField.vue";
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script setup>
|
|
28
|
+
import PrimeInputText from "primevue/inputtext";
|
|
29
|
+
import { computed } from "vue";
|
|
30
|
+
import FormField from "./FormField.vue";
|
|
31
|
+
import { createTextValidator } from "../../utils/validation";
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
type: { type: String, required: false, default: "text" },
|
|
34
|
+
minLength: { type: [String, Number], required: false, default: void 0 },
|
|
35
|
+
maxLength: { type: [String, Number], required: false, default: void 0 },
|
|
36
|
+
name: { type: String, required: true },
|
|
37
|
+
label: { type: String, required: false },
|
|
38
|
+
is: { type: String, required: false },
|
|
39
|
+
initialValue: { type: null, required: false },
|
|
40
|
+
required: { type: Boolean, required: false },
|
|
41
|
+
disabled: { type: Boolean, required: false },
|
|
42
|
+
readonly: { type: Boolean, required: false },
|
|
43
|
+
fauxLabel: { type: Boolean, required: false },
|
|
44
|
+
labelSrOnly: { type: Boolean, required: false },
|
|
45
|
+
labelPosition: { type: String, required: false },
|
|
46
|
+
class: { type: null, required: false }
|
|
47
|
+
});
|
|
48
|
+
const validatorFunction = computed(() => {
|
|
49
|
+
return () => createTextValidator({
|
|
50
|
+
required: props.required,
|
|
51
|
+
type: props.type,
|
|
52
|
+
minLength: props.minLength,
|
|
53
|
+
maxLength: props.maxLength
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type FormFieldProps } from './FormField.vue.js';
|
|
2
|
+
export interface FormFieldTextProps extends Omit<FormFieldProps, 'validator'> {
|
|
3
|
+
type?: 'text' | 'url' | 'email';
|
|
4
|
+
minLength?: string | number;
|
|
5
|
+
maxLength?: string | number;
|
|
6
|
+
}
|
|
7
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormFieldTextProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldTextProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
8
|
+
label?: (props: {}) => any;
|
|
9
|
+
}>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormField v-bind="props" :validator="validatorFunction">
|
|
3
|
+
<template #label>
|
|
4
|
+
<slot name="label" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #default="{ inputId, messageId, disabled, readonly }">
|
|
8
|
+
<PrimeToggleSwitch
|
|
9
|
+
:input-id = "inputId"
|
|
10
|
+
:aria-describedby = "messageId"
|
|
11
|
+
:disabled = "disabled || readonly"
|
|
12
|
+
:readonly = "readonly"
|
|
13
|
+
class = "input-group toggle-switch"
|
|
14
|
+
pt:slider:class = "slider"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
</FormField>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script setup>
|
|
25
|
+
import PrimeToggleSwitch from "primevue/toggleswitch";
|
|
26
|
+
import { computed } from "vue";
|
|
27
|
+
import FormField from "./FormField.vue";
|
|
28
|
+
import { createBooleanValidator } from "../../utils/validation";
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
trueValue: { type: null, required: false, default: () => true },
|
|
31
|
+
falseValue: { type: null, required: false, default: () => false },
|
|
32
|
+
name: { type: String, required: true },
|
|
33
|
+
label: { type: String, required: false },
|
|
34
|
+
is: { type: String, required: false },
|
|
35
|
+
initialValue: { type: null, required: false, default: () => false },
|
|
36
|
+
required: { type: Boolean, required: false },
|
|
37
|
+
disabled: { type: Boolean, required: false },
|
|
38
|
+
readonly: { type: Boolean, required: false },
|
|
39
|
+
fauxLabel: { type: Boolean, required: false },
|
|
40
|
+
labelSrOnly: { type: Boolean, required: false },
|
|
41
|
+
labelPosition: { type: String, required: false, default: "after" },
|
|
42
|
+
class: { type: null, required: false }
|
|
43
|
+
});
|
|
44
|
+
const validatorFunction = computed(() => {
|
|
45
|
+
return () => createBooleanValidator({ required: props.required });
|
|
46
|
+
});
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FormFieldProps } from './FormField.vue.js';
|
|
2
|
+
export interface FormFieldToggleSwitchProps extends Omit<FormFieldProps, 'validator'> {
|
|
3
|
+
trueValue?: unknown;
|
|
4
|
+
falseValue?: unknown;
|
|
5
|
+
}
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormFieldToggleSwitchProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormFieldToggleSwitchProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
7
|
+
label?: (props: {}) => any;
|
|
8
|
+
}>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['input-label-pair', `label-${props.labelPosition}`]">
|
|
3
|
+
<Component
|
|
4
|
+
:is = "props.fauxLabel ? 'span' : 'label'"
|
|
5
|
+
:id = "props.labelId"
|
|
6
|
+
:for = "props.fauxLabel ? void 0 : props.inputId"
|
|
7
|
+
:class = "[
|
|
8
|
+
'input-label',
|
|
9
|
+
{
|
|
10
|
+
'sr-only': props.labelSrOnly,
|
|
11
|
+
disabled: props.disabled,
|
|
12
|
+
required: props.required
|
|
13
|
+
}
|
|
14
|
+
]"
|
|
15
|
+
>
|
|
16
|
+
<slot name="label">
|
|
17
|
+
{{ props.labelText }}
|
|
18
|
+
</slot>
|
|
19
|
+
</Component>
|
|
20
|
+
|
|
21
|
+
<div>
|
|
22
|
+
<slot name="input" />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script setup>
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
inputId: { type: String, required: false },
|
|
34
|
+
labelId: { type: String, required: false },
|
|
35
|
+
labelText: { type: String, required: false },
|
|
36
|
+
labelPosition: { type: String, required: false, default: "above" },
|
|
37
|
+
labelSrOnly: { type: Boolean, required: false, default: false },
|
|
38
|
+
required: { type: Boolean, required: false, default: false },
|
|
39
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
40
|
+
fauxLabel: { type: Boolean, required: false, default: false }
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface FormLabelInputPairProps {
|
|
2
|
+
inputId?: string;
|
|
3
|
+
labelId?: string;
|
|
4
|
+
labelText?: string;
|
|
5
|
+
labelPosition?: 'above' | 'below' | 'before' | 'after';
|
|
6
|
+
labelSrOnly?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
fauxLabel?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<FormLabelInputPairProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormLabelInputPairProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
12
|
+
label?: (props: {}) => any;
|
|
13
|
+
} & {
|
|
14
|
+
input?: (props: {}) => any;
|
|
15
|
+
}>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|