@lehnihon/bit-form 2.1.0 → 2.1.2
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/angular/index.cjs +1 -1
- package/dist/angular/index.cjs.map +1 -1
- package/dist/angular/index.d.cts +72 -46
- package/dist/angular/index.d.ts +72 -46
- package/dist/angular/index.js +1 -1
- package/dist/angular/index.js.map +1 -1
- package/dist/bus-vCbulIYH.d.cts +141 -0
- package/dist/bus-vCbulIYH.d.ts +141 -0
- package/dist/chunk-2QNUW6ZN.cjs +133 -0
- package/dist/chunk-2QNUW6ZN.cjs.map +1 -0
- package/dist/chunk-F6LJWWEW.js +2 -0
- package/dist/chunk-F6LJWWEW.js.map +1 -0
- package/dist/chunk-LPRLSFPT.cjs +2 -0
- package/dist/chunk-LPRLSFPT.cjs.map +1 -0
- package/dist/chunk-N6IA7HQL.js +133 -0
- package/dist/chunk-N6IA7HQL.js.map +1 -0
- package/dist/devtools/bridge.cjs +1 -1
- package/dist/devtools/bridge.js +1 -1
- package/dist/devtools/index.cjs +1 -1
- package/dist/devtools/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -24
- package/dist/index.d.ts +5 -24
- package/dist/index.js +1 -1
- package/dist/public-types-ChP5j3xc.d.ts +69 -0
- package/dist/public-types-Nv__uZTR.d.cts +69 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +7 -47
- package/dist/react/index.d.ts +7 -47
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-native/index.cjs +1 -1
- package/dist/react-native/index.cjs.map +1 -1
- package/dist/react-native/index.d.cts +16 -5
- package/dist/react-native/index.d.ts +16 -5
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/resolvers/joi.d.cts +1 -1
- package/dist/resolvers/joi.d.ts +1 -1
- package/dist/resolvers/yup.d.cts +1 -1
- package/dist/resolvers/yup.d.ts +1 -1
- package/dist/resolvers/zod.d.cts +1 -1
- package/dist/resolvers/zod.d.ts +1 -1
- package/dist/{use-bit-watch-iCGj-kYp.d.ts → use-bit-watch-BRekIj2W.d.cts} +92 -28
- package/dist/{use-bit-watch-BLCTa7d4.d.cts → use-bit-watch-hA0AqCkC.d.ts} +92 -28
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +66 -46
- package/dist/vue/index.d.ts +66 -46
- package/dist/vue/index.js +1 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +7 -2
- package/dist/bus-uG4EmM-Z.d.cts +0 -295
- package/dist/bus-uG4EmM-Z.d.ts +0 -295
- package/dist/chunk-ET36BANJ.js +0 -2
- package/dist/chunk-ET36BANJ.js.map +0 -1
- package/dist/chunk-NDFMZWBP.js +0 -133
- package/dist/chunk-NDFMZWBP.js.map +0 -1
- package/dist/chunk-PCVPCFPX.cjs +0 -2
- package/dist/chunk-PCVPCFPX.cjs.map +0 -1
- package/dist/chunk-VFLQH47Q.cjs +0 -133
- package/dist/chunk-VFLQH47Q.cjs.map +0 -1
- package/dist/index-1fP1eJH8.d.ts +0 -211
- package/dist/index-9vxGUNPP.d.cts +0 -211
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { u as BitStoreAdapter, B as BitResolvedConfig, v as BitLifecycleAdapter, a as BitState, w as BitDependencyManager, d as BitErrors, x as BitValidationAdapter, y as BitValidationManager, z as BitDirtyManager, A as BitHistoryManager, f as BitConfig, k as BitFieldDefinition, b as BitPath, c as BitPathValue, e as BitMask, h as BitArrayPath, g as BitArrayItem } from './bus-uG4EmM-Z.cjs';
|
|
2
|
-
|
|
3
|
-
declare class BitArrayManager<T extends object = any> {
|
|
4
|
-
private store;
|
|
5
|
-
constructor(store: BitStoreAdapter<T>);
|
|
6
|
-
pushItem(path: string, value: any): void;
|
|
7
|
-
prependItem(path: string, value: any): void;
|
|
8
|
-
insertItem(path: string, index: number, value: any): void;
|
|
9
|
-
removeItem(path: string, index: number): void;
|
|
10
|
-
swapItems(path: string, indexA: number, indexB: number): void;
|
|
11
|
-
moveItem(path: string, from: number, to: number): void;
|
|
12
|
-
private revalidate;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare class BitComputedManager<T extends object> {
|
|
16
|
-
private config;
|
|
17
|
-
constructor(config: BitResolvedConfig<T>);
|
|
18
|
-
apply(values: T): T;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare class BitLifecycleManager<T extends object> {
|
|
22
|
-
private store;
|
|
23
|
-
constructor(store: BitLifecycleAdapter<T>);
|
|
24
|
-
updateField(path: string, value: any): {
|
|
25
|
-
visibilitiesChanged: boolean;
|
|
26
|
-
};
|
|
27
|
-
updateAll(newValues: T): void;
|
|
28
|
-
submit(onSuccess: (values: T, dirtyValues?: Partial<T>) => void | Promise<void>): Promise<void>;
|
|
29
|
-
reset(): void;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare class BitDevtoolsManager<T extends object> {
|
|
33
|
-
private store;
|
|
34
|
-
private cleanupFn;
|
|
35
|
-
constructor(store: BitStore<T>);
|
|
36
|
-
private setup;
|
|
37
|
-
destroy(): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* BitScopeManager
|
|
42
|
-
*
|
|
43
|
-
* Manages multi-step forms and scope-based validation.
|
|
44
|
-
* Scopes are groups of fields that can be validated and tracked independently,
|
|
45
|
-
* useful for wizard-style forms or multi-section forms.
|
|
46
|
-
*/
|
|
47
|
-
declare class BitScopeManager<T extends object = any> {
|
|
48
|
-
private getState;
|
|
49
|
-
private getConfig;
|
|
50
|
-
constructor(getState: () => BitState<T>, getConfig: () => BitResolvedConfig<T>);
|
|
51
|
-
/**
|
|
52
|
-
* Get validation status of a scope (step).
|
|
53
|
-
* Returns whether the scope has errors, is dirty, and the error details.
|
|
54
|
-
*/
|
|
55
|
-
getStepStatus(scopeName: string): {
|
|
56
|
-
hasErrors: boolean;
|
|
57
|
-
isDirty: boolean;
|
|
58
|
-
errors: Record<string, string>;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Get all errors for fields in a specific scope.
|
|
62
|
-
*/
|
|
63
|
-
getStepErrors(scopeName: string): Record<string, string>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* BitFieldQueryManager
|
|
68
|
-
*
|
|
69
|
-
* Provides query methods for field state without mutating.
|
|
70
|
-
* All methods are read-only and delegate to appropriate managers.
|
|
71
|
-
*/
|
|
72
|
-
declare class BitFieldQueryManager<T extends object = any> {
|
|
73
|
-
private depsMg;
|
|
74
|
-
private getState;
|
|
75
|
-
private getConfig;
|
|
76
|
-
constructor(depsMg: BitDependencyManager<T>, getState: () => BitState<T>, getConfig: () => BitResolvedConfig<T>);
|
|
77
|
-
/**
|
|
78
|
-
* Check if a field is hidden based on conditional logic.
|
|
79
|
-
*/
|
|
80
|
-
isHidden<P extends string>(path: P): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Check if a field is required based on conditional logic.
|
|
83
|
-
*/
|
|
84
|
-
isRequired<P extends string>(path: P): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Check if a field has been modified from its initial value.
|
|
87
|
-
*/
|
|
88
|
-
isFieldDirty(path: string): boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Check if a field is currently validating (async validation in progress).
|
|
91
|
-
*/
|
|
92
|
-
isFieldValidating(path: string): boolean;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* BitErrorManager
|
|
97
|
-
*
|
|
98
|
-
* Manages error state for fields.
|
|
99
|
-
* Handles setting individual errors, batch errors, and server errors.
|
|
100
|
-
*/
|
|
101
|
-
declare class BitErrorManager<T extends object = any> {
|
|
102
|
-
private getState;
|
|
103
|
-
private internalUpdateState;
|
|
104
|
-
constructor(getState: () => BitState<T>, internalUpdateState: (partial: Partial<BitState<T>>) => void);
|
|
105
|
-
/**
|
|
106
|
-
* Set or clear error for a single field.
|
|
107
|
-
* Pass undefined to clear the error.
|
|
108
|
-
*/
|
|
109
|
-
setError(path: string, message: string | undefined): void;
|
|
110
|
-
/**
|
|
111
|
-
* Set multiple field errors at once (merge behavior).
|
|
112
|
-
*/
|
|
113
|
-
setErrors(errors: BitErrors<T>): void;
|
|
114
|
-
/**
|
|
115
|
-
* Set errors from server response (converts arrays to first element).
|
|
116
|
-
* Useful for handling 422 validation error responses.
|
|
117
|
-
*/
|
|
118
|
-
setServerErrors(serverErrors: Record<string, string[] | string>): void;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* BitStore
|
|
123
|
-
*
|
|
124
|
-
* The core orchestrator of form state management.
|
|
125
|
-
*
|
|
126
|
-
* This store coordinates multiple managers to provide comprehensive form handling:
|
|
127
|
-
* - Core managers handle essential state and validation
|
|
128
|
-
* - Feature managers provide optional enhancements (history, arrays, scopes)
|
|
129
|
-
* - Query/mutation managers organize domain-specific operations
|
|
130
|
-
*/
|
|
131
|
-
declare class BitStore<T extends object = any> implements BitStoreAdapter<T>, BitValidationAdapter<T>, BitLifecycleAdapter<T> {
|
|
132
|
-
private state;
|
|
133
|
-
private listeners;
|
|
134
|
-
config: BitResolvedConfig<T>;
|
|
135
|
-
storeId: string;
|
|
136
|
-
depsMg: BitDependencyManager<T>;
|
|
137
|
-
validatorMg: BitValidationManager<T>;
|
|
138
|
-
computedMg: BitComputedManager<T>;
|
|
139
|
-
dirtyMg: BitDirtyManager<T>;
|
|
140
|
-
lifecycleMg: BitLifecycleManager<T>;
|
|
141
|
-
historyMg: BitHistoryManager<T>;
|
|
142
|
-
arraysMg: BitArrayManager<T>;
|
|
143
|
-
scopeMg: BitScopeManager<T>;
|
|
144
|
-
devtoolsMg: BitDevtoolsManager<T>;
|
|
145
|
-
queryMg: BitFieldQueryManager<T>;
|
|
146
|
-
errorMg: BitErrorManager<T>;
|
|
147
|
-
constructor(config?: BitConfig<T>);
|
|
148
|
-
getConfig(): BitResolvedConfig<T>;
|
|
149
|
-
getState(): BitState<T>;
|
|
150
|
-
get isValid(): boolean;
|
|
151
|
-
get isSubmitting(): boolean;
|
|
152
|
-
get isDirty(): boolean;
|
|
153
|
-
registerField(path: string, config: BitFieldDefinition<T>): void;
|
|
154
|
-
unregisterField<P extends BitPath<T>>(path: P): void;
|
|
155
|
-
unregisterPrefix(prefix: string): void;
|
|
156
|
-
isHidden<P extends BitPath<T>>(path: P): boolean;
|
|
157
|
-
isRequired<P extends BitPath<T>>(path: P): boolean;
|
|
158
|
-
isFieldDirty(path: string): boolean;
|
|
159
|
-
isFieldValidating(path: string): boolean;
|
|
160
|
-
subscribe(listener: () => void): () => void;
|
|
161
|
-
watch<P extends BitPath<T>>(path: P, callback: (value: BitPathValue<T, P>) => void): () => void;
|
|
162
|
-
setField<P extends BitPath<T>>(path: P, value: BitPathValue<T, P>): void;
|
|
163
|
-
blurField<P extends BitPath<T>>(path: P): void;
|
|
164
|
-
markFieldsTouched(paths: string[]): void;
|
|
165
|
-
setValues(newValues: T): void;
|
|
166
|
-
setError(path: string, message: string | undefined): void;
|
|
167
|
-
setErrors(errors: BitErrors<T>): void;
|
|
168
|
-
setServerErrors(serverErrors: Record<string, string[] | string>): void;
|
|
169
|
-
reset(): void;
|
|
170
|
-
submit(onSuccess: (values: T, dirtyValues?: Partial<T>) => void | Promise<void>): Promise<void>;
|
|
171
|
-
registerMask(name: string, mask: BitMask): void;
|
|
172
|
-
getDirtyValues(): Partial<T>;
|
|
173
|
-
pushItem<P extends BitArrayPath<T>>(path: P, value: BitArrayItem<BitPathValue<T, P>>): void;
|
|
174
|
-
prependItem<P extends BitArrayPath<T>>(path: P, value: BitArrayItem<BitPathValue<T, P>>): void;
|
|
175
|
-
insertItem<P extends BitArrayPath<T>>(path: P, index: number, value: BitArrayItem<BitPathValue<T, P>>): void;
|
|
176
|
-
removeItem<P extends BitArrayPath<T>>(path: P, index: number): void;
|
|
177
|
-
swapItems<P extends BitArrayPath<T>>(path: P, indexA: number, indexB: number): void;
|
|
178
|
-
moveItem<P extends BitArrayPath<T>>(path: P, from: number, to: number): void;
|
|
179
|
-
get canUndo(): boolean;
|
|
180
|
-
get canRedo(): boolean;
|
|
181
|
-
undo(): void;
|
|
182
|
-
redo(): void;
|
|
183
|
-
getHistoryMetadata(): {
|
|
184
|
-
enabled: boolean;
|
|
185
|
-
canUndo: boolean;
|
|
186
|
-
canRedo: boolean;
|
|
187
|
-
historyIndex: number;
|
|
188
|
-
historySize: number;
|
|
189
|
-
};
|
|
190
|
-
validate(options?: {
|
|
191
|
-
scope?: string;
|
|
192
|
-
scopeFields?: string[];
|
|
193
|
-
}): Promise<boolean>;
|
|
194
|
-
hasValidationsInProgress(scopeFields?: string[]): boolean;
|
|
195
|
-
beginFieldValidation(path: string): void;
|
|
196
|
-
endFieldValidation(path: string): void;
|
|
197
|
-
setFieldAsyncError(path: string, message: string | undefined): Promise<void>;
|
|
198
|
-
clearFieldAsyncError(path: string): Promise<void>;
|
|
199
|
-
getStepStatus(scopeName: string): {
|
|
200
|
-
hasErrors: boolean;
|
|
201
|
-
isDirty: boolean;
|
|
202
|
-
errors: Record<string, string>;
|
|
203
|
-
};
|
|
204
|
-
getStepErrors(scopeName: string): Record<string, string>;
|
|
205
|
-
internalUpdateState(partialState: Partial<BitState<T>>): void;
|
|
206
|
-
internalSaveSnapshot(): void;
|
|
207
|
-
cleanup(): void;
|
|
208
|
-
private notify;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export { BitStore as B };
|