@finema/core 1.4.170 → 1.4.171
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
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FieldWrapper v-bind="wrapperProps">
|
|
3
|
-
<UToggle
|
|
3
|
+
<UToggle
|
|
4
|
+
:model-value="value"
|
|
5
|
+
:disabled="wrapperProps.isDisabled"
|
|
6
|
+
:name="name"
|
|
7
|
+
:ui="ui"
|
|
8
|
+
@input="onChange"
|
|
9
|
+
/>
|
|
4
10
|
</FieldWrapper>
|
|
5
11
|
</template>
|
|
6
12
|
|
|
@@ -9,6 +15,13 @@ import { useFieldHOC } from '#core/composables/useForm'
|
|
|
9
15
|
import { type IToggleFieldProps } from '#core/components/Form/InputToggle/types'
|
|
10
16
|
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
11
17
|
|
|
18
|
+
const emit = defineEmits(['change'])
|
|
19
|
+
|
|
12
20
|
const props = withDefaults(defineProps<IToggleFieldProps>(), {})
|
|
13
21
|
const { value, wrapperProps } = useFieldHOC<boolean>(props)
|
|
22
|
+
|
|
23
|
+
const onChange = (bool: boolean) => {
|
|
24
|
+
emit('change', bool)
|
|
25
|
+
value.value = bool
|
|
26
|
+
}
|
|
14
27
|
</script>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type IFieldProps, type IFormFieldBase, type INPUT_TYPES } from '#core/components/Form/types';
|
|
2
2
|
export interface IToggleFieldProps extends IFieldProps {
|
|
3
3
|
}
|
|
4
|
-
export type IToggleField = IFormFieldBase<INPUT_TYPES.TOGGLE, IToggleFieldProps,
|
|
4
|
+
export type IToggleField = IFormFieldBase<INPUT_TYPES.TOGGLE, IToggleFieldProps, {
|
|
5
|
+
change?: (value: boolean) => void;
|
|
6
|
+
}>;
|
|
@@ -5,5 +5,5 @@ interface IFieldContext<TValue> extends FieldContext<TValue> {
|
|
|
5
5
|
wrapperProps: ComputedRef<IFieldProps>;
|
|
6
6
|
}
|
|
7
7
|
export declare const useFieldHOC: <TValue = unknown>(newFormProps: IFieldProps, opts?: Partial<FieldOptions<TValue>>) => IFieldContext<TValue>;
|
|
8
|
-
export declare const createFormFields: (fields: () => IFormField[]) =>
|
|
8
|
+
export declare const createFormFields: (fields: () => IFormField[]) => ComputedRef<IFormField[]>;
|
|
9
9
|
export {};
|