fix(@vben-core/form-ui): restore lock screen form submission (#8195)

* fix(@vben-core/form-ui): avoid stale form context access

* fix(@vben/playground): constrain date range codec fields

* test(@vben-core/form-ui): harden benchmark fixtures

* docs(@vben/docs): document form runtime and benchmarks

* fix(@vben/docs): 明确 getValues/submit 返回值及 submit 参数类型
This commit is contained in:
dream-weave
2026-07-24 10:05:27 +08:00
committed by GitHub
parent 0542b509ca
commit dcdbfe5dfc
13 changed files with 195 additions and 86 deletions

View File

@@ -17,6 +17,37 @@ const codec = createDateRangeCodec<SearchFormValues>()({
});
describe('date range codec', () => {
it('only accepts optional date range fields', () => {
interface RangeFieldCandidates extends Record<string, unknown> {
optionalRange?: [Dayjs, Dayjs];
optionalText?: string;
requiredRange: [Dayjs, Dayjs];
}
const createCodec = createDateRangeCodec<RangeFieldCandidates>();
const optionalRangeCodec = createCodec({
endField: 'end',
rangeField: 'optionalRange',
startField: 'start',
});
expect(optionalRangeCodec).toEqual({
decode: expect.any(Function),
encode: expect.any(Function),
});
createCodec({
endField: 'end',
// @ts-expect-error A required range cannot be omitted by decode.
rangeField: 'requiredRange',
startField: 'start',
});
createCodec({
endField: 'end',
// @ts-expect-error The range field must contain a DateRange.
rangeField: 'optionalText',
startField: 'start',
});
});
it('encodes and decodes configurable date range fields', () => {
const submitValues = codec.encode({
createdAt: [dayjs('2026-07-01'), dayjs('2026-07-23')],