feat: PSelect 暂存

This commit is contained in:
严浩
2024-12-05 19:09:26 +08:00
parent c2772dcf3a
commit ba4d361700
6 changed files with 105 additions and 12 deletions

View File

@@ -12,11 +12,9 @@ const input = createSection('input', () => ({
props: {
invalid: '$state.invalid',
disabled: '$disabled',
// name: '$node.name',
// inputProps: {}
modelValue: '$_value',
onInput: '$handlers.DOMInput',
onBlur: '$handlers.blur',
modelValue: '$_value',
inputId: '$id',
fluid: true,
},

View File

@@ -14,9 +14,9 @@ const input = createSection('input', () => ({
type: '$type',
disabled: '$disabled',
name: '$node.name',
modelValue: '$_value',
onInput: '$handlers.DOMInput',
onBlur: '$handlers.blur',
modelValue: '$_value',
id: '$id',
fluid: true,
},

View File

@@ -0,0 +1,45 @@
import type { FormKitTypeDefinition } from '@formkit/core';
import type { FormKitInputs } from '@formkit/inputs';
import { createSection, label, outer } from '@formkit/inputs';
import SchemaComponent from 'primevue/select';
import { markRaw } from 'vue';
import { floatLabel } from '../sections/floatLabel';
import { messages } from '../sections/messages';
const input = createSection('input', () => ({
$cmp: markRaw(SchemaComponent) as never,
bind: '$attrs',
props: {
invalid: '$state.invalid',
disabled: '$disabled',
modelValue: '$_value',
// onValueChange: '$handlers.DOMInput',
onBlur: '$handlers.blur',
id: '$id',
fluid: true,
options: '$options',
},
}));
export const PSelect: FormKitTypeDefinition = {
type: 'input',
schema: outer(
floatLabel(
input(), //
label('$label'),
),
messages(),
),
props: ['options'],
// schemaMemoKey: 'nnvujvlf2xr', // Math.random().toString(36).substring(2, 15)
};
declare module '@formkit/inputs' {
// https://formkit.com/essentials/custom-inputs#typescript-support
interface FormKitInputProps<Props extends FormKitInputs<Props>> {
PSelect: {
type: 'PSelect';
options: Array<any>;
};
}
}