From ab39617e7baeb97afe095c129c572eaebb26d1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Mon, 30 Dec 2024 16:16:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E5=A4=9A=E4=B8=AA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=B7=BB=E5=8A=A0=E5=B8=AE=E5=8A=A9=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__fk-inputs__/inputs/p-cascade-select.tsx | 4 +++- src/__fk-inputs__/inputs/p-date-picker.tsx | 6 ++++-- src/__fk-inputs__/inputs/p-input-password.ts | 2 ++ src/__fk-inputs__/inputs/p-select.tsx | 6 ++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/__fk-inputs__/inputs/p-cascade-select.tsx b/src/__fk-inputs__/inputs/p-cascade-select.tsx index a9115eb..d84896f 100644 --- a/src/__fk-inputs__/inputs/p-cascade-select.tsx +++ b/src/__fk-inputs__/inputs/p-cascade-select.tsx @@ -6,6 +6,7 @@ import PrimevueCascadeselect from 'primevue/cascadeselect'; import { defineComponent, markRaw, ref } from 'vue'; import { floatLabel } from '../sections/floatLabel'; import { messages } from '../sections/messages'; +import { help } from '../sections/help'; // https://formkit.com/inputs/dropdown @@ -21,7 +22,7 @@ const SchemaComponent = defineComponent( 'onUpdate:modelValue': (value: unknown) => { formkitContext.node.input(value); }, - 'onBlur': async e => { + 'onBlur': async (e) => { setTimeout( () => formkitContext.handlers.blur.call(undefined, e as never), 166, // 因为会触发两次。所以让blur事件延迟一点,可以考虑优化。(Cascadeselect好像没有这个问题) @@ -92,6 +93,7 @@ export const PCascadeSelect: FormKitTypeDefinition = { input(), // label('$label'), ), + help('$help'), messages(), ), props: ['options', 'optionLabel', 'optionValue'], diff --git a/src/__fk-inputs__/inputs/p-date-picker.tsx b/src/__fk-inputs__/inputs/p-date-picker.tsx index f6b8504..c384f78 100644 --- a/src/__fk-inputs__/inputs/p-date-picker.tsx +++ b/src/__fk-inputs__/inputs/p-date-picker.tsx @@ -6,6 +6,7 @@ import PrimevueDatepicker from 'primevue/datepicker'; import { defineComponent, markRaw } from 'vue'; import { floatLabel } from '../sections/floatLabel'; import { messages } from '../sections/messages'; +import { help } from '../sections/help'; // :plugins="[castNumber]" type PickerValue = Date | Array | Array | undefined | null; @@ -22,7 +23,7 @@ const SchemaComponent = defineComponent( const formkitContext = vueProps.context; const { valueToDate, dateToValue } = formkitContext; const listeners: PrimevueDatepickerListeners = { - 'onUpdate:modelValue': value => { + 'onUpdate:modelValue': (value) => { let newValue = value as unknown; try { newValue = dateToValue(value); @@ -31,7 +32,7 @@ const SchemaComponent = defineComponent( } formkitContext.node.input(newValue); }, - 'onBlur': async e => { + 'onBlur': async (e) => { setTimeout( () => formkitContext.handlers.blur.call(undefined, e as never), 166, // 因为会触发两次。所以让blur事件延迟一点,可以考虑优化。 @@ -80,6 +81,7 @@ export const PDatePicker: FormKitTypeDefinition = { input(), // label('$label'), ), + help('$help'), messages(), ), props: ['valueToDate', 'dateToValue', 'dateFormat'], diff --git a/src/__fk-inputs__/inputs/p-input-password.ts b/src/__fk-inputs__/inputs/p-input-password.ts index 1b73b4e..2f3098a 100644 --- a/src/__fk-inputs__/inputs/p-input-password.ts +++ b/src/__fk-inputs__/inputs/p-input-password.ts @@ -5,6 +5,7 @@ import SchemaComponent from 'primevue/password'; import { markRaw } from 'vue'; import { messages } from '../sections/messages'; import { floatLabel } from '../sections/floatLabel'; +import { help } from '../sections/help'; const input = createSection('input', () => ({ $cmp: markRaw(SchemaComponent) as never, @@ -27,6 +28,7 @@ export const PInputPassword: FormKitTypeDefinition = { input(), // label('$label'), ), + help('$help'), messages(), ), features: [casts], diff --git a/src/__fk-inputs__/inputs/p-select.tsx b/src/__fk-inputs__/inputs/p-select.tsx index 5fb3534..c8e6446 100644 --- a/src/__fk-inputs__/inputs/p-select.tsx +++ b/src/__fk-inputs__/inputs/p-select.tsx @@ -5,6 +5,7 @@ import PrimevueSelect, { type SelectEmitsOptions, type SelectSlots } from 'prime import { computed, defineComponent, markRaw, ref } from 'vue'; import { floatLabel } from '../sections/floatLabel'; import { messages } from '../sections/messages'; +import { help } from '../sections/help'; // https://formkit.com/inputs/dropdown @@ -23,7 +24,7 @@ const SchemaComponent = defineComponent( 'onUpdate:modelValue': (value: unknown) => { formkitContext.node.input(value); }, - 'onBlur': async e => { + 'onBlur': async (e) => { setTimeout( () => formkitContext.handlers.blur.call(undefined, e as never), 166, // 因为会触发两次。所以让blur事件延迟一点,可以考虑优化。 @@ -59,7 +60,7 @@ const SchemaComponent = defineComponent( const valueSlot = computed(() => { if (primevueSelectInstance.value?.label === 'p-emptylabel' && !!formkitContext._value) { - return (slotProps => { + return ((slotProps) => { return slotProps.value as never; }) satisfies SelectSlots['value']; } else { @@ -116,6 +117,7 @@ export const PSelect: FormKitTypeDefinition = { input(), // label('$label'), ), + help('$help'), messages(), ), props: ['options', 'optionLabel', 'optionValue'],