@metronlabs/rx-form-data
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -6,3 +6,3 @@ import { HTML_FORM_FIELD_TAG, HTML_FORM_NATIVE_EVENT_TYPE, FORM_FIELD_STORAGE_ACTION_TYPE, HTML_FORM_CUSTOM_EVENT_TYPE, FORM_FIELDS_SUBSCRIBERS_ACTION_TYPE, PROGRAM_INTERFACE_ACTION_TYPE } from "../constants"; | ||
export declare type Predicate<T> = (x: T) => boolean; | ||
export declare type SubmissionHandlerConfigOption = <T = never, U = never>(formvalues: Readonly<Record<string, SerializedFormField<U>>>, formvalidation: Error | Readonly<Record<string, Readonly<DecoderResult>>>, formdata: FormData) => T; | ||
export declare type SubmissionHandlerConfigOption = <U = never>(formvalues: Readonly<Record<string, SerializedFormField<U>>>, formvalidation: Error | Readonly<Record<string, Readonly<DecoderResult>>>, formdata: FormData) => unknown; | ||
export declare type FormFieldStorageActionFn = (type: FormFieldStorageActionType, payload?: FormFieldSelectorExpression | FormField | Array<string | FormField> | FormFieldSelectorExpression[] | { | ||
@@ -9,0 +9,0 @@ use: FormFieldSelectorExpression[]; |
@@ -6,5 +6,5 @@ import { FormFieldStorage, FormDecoders } from "./repository"; | ||
import { DecoderResult } from "./datatypes/Decoder"; | ||
export declare function onsubmit<T>($form: HTMLFormElement, storage: FormFieldStorage, decoders: FormDecoders, handler: <K extends T, U>(formvalues: Readonly<Record<string, SerializedFormField<U>>>, formvalidation: Error | Readonly<Record<string, Readonly<DecoderResult>>>, formdata: FormData) => K): Promise<T>; | ||
export declare function onsubmit($form: HTMLFormElement, storage: FormFieldStorage, decoders: FormDecoders, handler: <U>(formvalues: Readonly<Record<string, SerializedFormField<U>>>, formvalidation: Error | Readonly<Record<string, Readonly<DecoderResult>>>, formdata: FormData) => unknown): Promise<unknown>; | ||
export declare function onfieldevent(evt: Event, action: FormFieldStorageActionFn): void; | ||
export declare function getFormEventListener($target: HTMLFormElement, submissionHanlder: SubmissionHandlerConfigOption, storageinterface: FormFieldStorageInterface, subscribersinterface: FormEventsInterface): (evt: Event | CustomEvent<Readonly<Map<string, FormField>>>) => void; | ||
export declare function initialize($formElement: Option<HTMLFormElement>, submissionHanlder: SubmissionHandlerConfigOption, storageinterface: FormFieldStorageInterface): FormEventsInterface | void; |
{ | ||
"name": "@metronlabs/rx-form-data", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Framework agnostic reactive form data streaming", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -14,7 +14,7 @@ import { | ||
export type Predicate<T> = (x: T) => boolean; | ||
export type SubmissionHandlerConfigOption = <T = never, U = never>( | ||
export type SubmissionHandlerConfigOption = <U = never>( | ||
formvalues: Readonly<Record<string, SerializedFormField<U>>>, | ||
formvalidation: Error | Readonly<Record<string, Readonly<DecoderResult>>>, | ||
formdata: FormData | ||
) => T; | ||
) => unknown; | ||
export type FormFieldStorageActionFn = ( | ||
@@ -21,0 +21,0 @@ type: FormFieldStorageActionType, |
@@ -28,12 +28,12 @@ import { FormFieldStorage, FormDecoders } from "@/repository"; | ||
export async function onsubmit<T>( | ||
export async function onsubmit( | ||
$form: HTMLFormElement, | ||
storage: FormFieldStorage, | ||
decoders: FormDecoders, | ||
handler: <K extends T, U>( | ||
handler: <U>( | ||
formvalues: Readonly<Record<string, SerializedFormField<U>>>, | ||
formvalidation: Error | Readonly<Record<string, Readonly<DecoderResult>>>, | ||
formdata: FormData | ||
) => K | ||
): Promise<T> { | ||
) => unknown | ||
): Promise<unknown> { | ||
const formdata = new FormData($form); | ||
@@ -75,3 +75,3 @@ | ||
return Promise.resolve( | ||
handler<T, typeof nil>( | ||
handler<typeof nil>( | ||
Object.freeze(formvalues), | ||
@@ -176,3 +176,3 @@ Object.freeze(validation), | ||
); | ||
onsubmit<ReturnType<typeof submissionHanlder>>( | ||
onsubmit( | ||
$target, | ||
@@ -179,0 +179,0 @@ storageinterface.storage(), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116529