foorm 0.0.2-alpha.7 → 0.0.2-alpha.9
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/index.cjs +3 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.mjs +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -85,6 +85,9 @@ class Foorm {
|
|
|
85
85
|
validators.unshift(this.fns.getFn('entry.optional || !!v || "Required"'));
|
|
86
86
|
return validators;
|
|
87
87
|
}
|
|
88
|
+
supportsAltAction(altAction) {
|
|
89
|
+
return !!this.entries.find(e => e.altAction === altAction);
|
|
90
|
+
}
|
|
88
91
|
getFormValidator() {
|
|
89
92
|
if (!this.fns)
|
|
90
93
|
this.fns = new ftring$1.FtringsPool();
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,15 @@ type TFoormEntryExecutable<T = unknown, O = string> = TFoormEntry<T, O, TFoormFn
|
|
|
46
46
|
label: string | TFoormFn<T, string>;
|
|
47
47
|
type: string;
|
|
48
48
|
};
|
|
49
|
+
type TFoormMetaExecutable = {
|
|
50
|
+
title: string | TFoormFn<undefined, string>;
|
|
51
|
+
submit: {
|
|
52
|
+
text: string | TFoormFn<undefined, string>;
|
|
53
|
+
disabled: boolean | TFoormFn<undefined, boolean>;
|
|
54
|
+
};
|
|
55
|
+
context: Record<string, unknown>;
|
|
56
|
+
entries: TFoormEntryExecutable[];
|
|
57
|
+
};
|
|
49
58
|
|
|
50
59
|
interface TFoormSubmit<S = TFtring, B = TFtring> {
|
|
51
60
|
text: string | S;
|
|
@@ -88,23 +97,14 @@ declare class Foorm {
|
|
|
88
97
|
*
|
|
89
98
|
* @returns form metadata with functions
|
|
90
99
|
*/
|
|
91
|
-
executable():
|
|
92
|
-
title: string | TFoormFn<undefined, string>;
|
|
93
|
-
submit: {
|
|
94
|
-
text: string | TFoormFn<undefined, string>;
|
|
95
|
-
disabled: boolean | TFoormFn<undefined, boolean>;
|
|
96
|
-
};
|
|
97
|
-
context: Record<string, unknown>;
|
|
98
|
-
entries: TFoormEntryExecutable[];
|
|
99
|
-
};
|
|
100
|
+
executable(): TFoormMetaExecutable;
|
|
100
101
|
prepareValidators(_validators: TFoormEntry['validators']): TFoormValidatorFn<string>[];
|
|
102
|
+
supportsAltAction(altAction: string): boolean;
|
|
101
103
|
getFormValidator(): (inputs: Record<string, unknown>) => {
|
|
102
104
|
passed: boolean;
|
|
103
105
|
errors: Record<string, string>;
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
|
-
type TFoormExecutableMeta = ReturnType<Foorm['executable']>;
|
|
107
|
-
type TFoormExecutableEntry = TFoormExecutableMeta['entries'][number];
|
|
108
108
|
declare function validate<T = string>(opts: TFoormFnScope<T> & {
|
|
109
109
|
validators: TFoormValidatorFn<T>[];
|
|
110
110
|
}): {
|
|
@@ -118,4 +118,4 @@ declare function validate<T = string>(opts: TFoormFnScope<T> & {
|
|
|
118
118
|
declare function isFtring(input: unknown): input is TFtring;
|
|
119
119
|
declare function ftring(strings: TemplateStringsArray, __type__?: TFtring['__type__']): TFtring;
|
|
120
120
|
|
|
121
|
-
export { Foorm, type ObjSOF, type StringOrFtring, type TFoormEntry, type TFoormEntryExecutable, type
|
|
121
|
+
export { Foorm, type ObjSOF, type StringOrFtring, type TFoormEntry, type TFoormEntryExecutable, type TFoormFn, type TFoormFnScope, type TFoormMetaExecutable, type TFoormOptions, type TFoormSubmit, type TFoormValidatorFn, type TFtring, ftring, isFtring, validate };
|
package/dist/index.mjs
CHANGED
|
@@ -83,6 +83,9 @@ class Foorm {
|
|
|
83
83
|
validators.unshift(this.fns.getFn('entry.optional || !!v || "Required"'));
|
|
84
84
|
return validators;
|
|
85
85
|
}
|
|
86
|
+
supportsAltAction(altAction) {
|
|
87
|
+
return !!this.entries.find(e => e.altAction === altAction);
|
|
88
|
+
}
|
|
86
89
|
getFormValidator() {
|
|
87
90
|
if (!this.fns)
|
|
88
91
|
this.fns = new FtringsPool();
|