@dragonmastery/zinia-forms-core 0.3.4 → 0.3.6
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.d.ts +471 -357
- package/dist/index.js +159 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -116,7 +116,6 @@ interface ArrayFieldProps<FormType, ItemType> {
|
|
|
116
116
|
minItems?: number;
|
|
117
117
|
maxItems?: number;
|
|
118
118
|
allowReordering?: boolean;
|
|
119
|
-
autoPrefixFields?: boolean;
|
|
120
119
|
ariaLabels?: {
|
|
121
120
|
addButton?: string;
|
|
122
121
|
removeButton?: string;
|
|
@@ -139,6 +138,430 @@ interface CheckboxFieldProps<FormType> {
|
|
|
139
138
|
variant?: string;
|
|
140
139
|
}
|
|
141
140
|
|
|
141
|
+
interface DateFieldProps<FormType> {
|
|
142
|
+
name: FlexiblePath<FormType>;
|
|
143
|
+
label?: string;
|
|
144
|
+
hideLabel?: boolean;
|
|
145
|
+
description?: string;
|
|
146
|
+
required?: boolean;
|
|
147
|
+
placeholder?: string;
|
|
148
|
+
disabled?: boolean;
|
|
149
|
+
readonly?: boolean;
|
|
150
|
+
class?: string | string[];
|
|
151
|
+
size?: string;
|
|
152
|
+
variant?: string;
|
|
153
|
+
min?: string;
|
|
154
|
+
max?: string;
|
|
155
|
+
formatter?: (date: string) => unknown;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface NumberFieldProps<FormType> {
|
|
159
|
+
name: FlexiblePath<FormType>;
|
|
160
|
+
label?: string;
|
|
161
|
+
hideLabel?: boolean;
|
|
162
|
+
description?: string;
|
|
163
|
+
required?: boolean;
|
|
164
|
+
placeholder?: string;
|
|
165
|
+
disabled?: boolean;
|
|
166
|
+
readonly?: boolean;
|
|
167
|
+
class?: string | string[];
|
|
168
|
+
size?: string;
|
|
169
|
+
variant?: string;
|
|
170
|
+
min?: number;
|
|
171
|
+
max?: number;
|
|
172
|
+
step?: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Option item for select fields
|
|
177
|
+
* @template TData - Type of the optional data object for storing additional metadata
|
|
178
|
+
* Useful for cascading dropdowns where options need to be filtered by parent field values
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* // With typed data
|
|
182
|
+
* interface CityData {
|
|
183
|
+
* country: string;
|
|
184
|
+
* population: number;
|
|
185
|
+
* }
|
|
186
|
+
* const options: SelectOption<CityData>[] = [
|
|
187
|
+
* { value: 'nyc', label: 'New York', data: { country: 'usa', population: 8000000 } }
|
|
188
|
+
* ];
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* // Without data (backward compatible)
|
|
192
|
+
* const options: SelectOption[] = [
|
|
193
|
+
* { value: 'option1', label: 'Option 1' }
|
|
194
|
+
* ];
|
|
195
|
+
*/
|
|
196
|
+
interface SelectOption<TData = Record<string, any>> {
|
|
197
|
+
value: string;
|
|
198
|
+
label: string;
|
|
199
|
+
/**
|
|
200
|
+
* Optional data object for storing additional metadata
|
|
201
|
+
* Useful for cascading dropdowns where options need to be filtered by parent field values
|
|
202
|
+
*/
|
|
203
|
+
data?: TData;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Extract enum values from a Zod enum schema
|
|
207
|
+
*/
|
|
208
|
+
type ZodEnumValues<T extends z.ZodEnum<[string, ...string[]]>> = T['_def']['values'][number];
|
|
209
|
+
/**
|
|
210
|
+
* Type for a mapping of enum values to labels
|
|
211
|
+
*/
|
|
212
|
+
type EnumValueToLabelMap<T extends string> = Record<T, string>;
|
|
213
|
+
/**
|
|
214
|
+
* Type for a value-to-label mapping that can be either a function or an object map
|
|
215
|
+
*/
|
|
216
|
+
type ValueToLabelMapping<T extends string = string> = ((value: string) => string) | EnumValueToLabelMap<T>;
|
|
217
|
+
/**
|
|
218
|
+
* Helper type to extract the type of a field at a given path
|
|
219
|
+
*/
|
|
220
|
+
type FieldType<T, P extends string> = P extends keyof T ? T[P] : P extends `${infer A}.${infer B}` ? A extends keyof T ? FieldType<T[A], B> : never : never;
|
|
221
|
+
/**
|
|
222
|
+
* Helper type to extract enum values from a field type
|
|
223
|
+
*/
|
|
224
|
+
type EnumValuesFromField<T> = T extends string ? T : never;
|
|
225
|
+
/**
|
|
226
|
+
* Type that maps field paths to their corresponding enum types
|
|
227
|
+
*/
|
|
228
|
+
type FieldPathToEnum$1<T, P extends Path<T>> = EnumValuesFromField<FieldType<T, P & string>>;
|
|
229
|
+
/**
|
|
230
|
+
* Props for the SelectField component
|
|
231
|
+
* @template FormType - The form type
|
|
232
|
+
* @template P - The field path in the form
|
|
233
|
+
* @template TData - The type of the data property in SelectOption (for cascading dropdowns)
|
|
234
|
+
*/
|
|
235
|
+
interface SelectFieldProps<FormType, P extends Path<FormType> = Path<FormType>, TData = any> {
|
|
236
|
+
/**
|
|
237
|
+
* Field name (path in the form state)
|
|
238
|
+
* Accepts both static paths and dynamic paths for use in array fields
|
|
239
|
+
*/
|
|
240
|
+
name: FlexiblePath<FormType>;
|
|
241
|
+
/**
|
|
242
|
+
* Field label
|
|
243
|
+
*/
|
|
244
|
+
label?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Whether to hide the label
|
|
247
|
+
*/
|
|
248
|
+
hideLabel?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Field description
|
|
251
|
+
*/
|
|
252
|
+
description?: string;
|
|
253
|
+
/**
|
|
254
|
+
* Whether the field is required
|
|
255
|
+
*/
|
|
256
|
+
required?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Placeholder text
|
|
259
|
+
*/
|
|
260
|
+
placeholder?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Whether the field is disabled
|
|
263
|
+
*/
|
|
264
|
+
disabled?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Whether the field is readonly
|
|
267
|
+
*/
|
|
268
|
+
readonly?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* CSS classes to apply to the field
|
|
271
|
+
*/
|
|
272
|
+
class?: string | string[];
|
|
273
|
+
/**
|
|
274
|
+
* Field size
|
|
275
|
+
*/
|
|
276
|
+
size?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Field variant
|
|
279
|
+
*/
|
|
280
|
+
variant?: string;
|
|
281
|
+
/**
|
|
282
|
+
* Select options (overrides options from schema)
|
|
283
|
+
* Using selectOptions instead of options to avoid conflicts with HTML select element
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* // With typed data
|
|
287
|
+
* interface CityData { country: string; }
|
|
288
|
+
* const options: SelectOption<CityData>[] = [
|
|
289
|
+
* { value: 'nyc', label: 'New York', data: { country: 'usa' } }
|
|
290
|
+
* ];
|
|
291
|
+
*/
|
|
292
|
+
selectOptions?: SelectOption<TData>[];
|
|
293
|
+
/**
|
|
294
|
+
* Custom mapping function to convert values to labels
|
|
295
|
+
* This is useful when you want to customize how labels are displayed
|
|
296
|
+
* without providing a full options array
|
|
297
|
+
*
|
|
298
|
+
* Can be provided as either:
|
|
299
|
+
* 1. A function that takes a value and returns a label
|
|
300
|
+
* 2. An object map where keys are enum values and values are labels
|
|
301
|
+
*/
|
|
302
|
+
valueToLabel?: ValueToLabelMapping<FieldPathToEnum$1<FormType, P>>;
|
|
303
|
+
/**
|
|
304
|
+
* Whether to use options from the schema (default: true)
|
|
305
|
+
* Set to false to ignore schema options even when no options prop is provided
|
|
306
|
+
*/
|
|
307
|
+
useSchemaOptions?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Field path that this field depends on for cascading dropdowns
|
|
310
|
+
* When the parent field changes, this field's options will be filtered
|
|
311
|
+
* and the field will be reset (unless autoReset is false)
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* // City field depends on country field
|
|
315
|
+
* <SelectField name="city" dependsOn="country" :optionFilterFn="filterCitiesByCountry" />
|
|
316
|
+
*/
|
|
317
|
+
dependsOn?: FlexiblePath<FormType>;
|
|
318
|
+
/**
|
|
319
|
+
* Function to filter options based on the parent field's value
|
|
320
|
+
* Receives the parent field value and all available options
|
|
321
|
+
* Should return the filtered options array
|
|
322
|
+
*
|
|
323
|
+
* The function signature is tied to the TData type parameter, ensuring type safety
|
|
324
|
+
* between selectOptions and optionFilterFn
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* // With typed data - both props must use the same data type
|
|
328
|
+
* interface CityData { country: string; }
|
|
329
|
+
* const filterCitiesByCountry = (
|
|
330
|
+
* countryValue: string,
|
|
331
|
+
* allOptions: SelectOption<CityData>[]
|
|
332
|
+
* ): SelectOption<CityData>[] => {
|
|
333
|
+
* return allOptions.filter(opt => opt.data?.country === countryValue);
|
|
334
|
+
* };
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* // Without typed data (backward compatible)
|
|
338
|
+
* const filterCitiesByCountry = (
|
|
339
|
+
* countryValue: string,
|
|
340
|
+
* allOptions: SelectOption[]
|
|
341
|
+
* ): SelectOption[] => {
|
|
342
|
+
* return allOptions.filter(opt => opt.value.startsWith(countryValue));
|
|
343
|
+
* };
|
|
344
|
+
*/
|
|
345
|
+
optionFilterFn?: (parentValue: any, allOptions: SelectOption<TData>[]) => SelectOption<TData>[];
|
|
346
|
+
/**
|
|
347
|
+
* Whether to automatically reset this field when the parent field changes (default: true)
|
|
348
|
+
* Set to false if you want to preserve the value when parent changes
|
|
349
|
+
*/
|
|
350
|
+
autoReset?: boolean;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Array of prop names for SelectField component.
|
|
354
|
+
* This is derived from SelectFieldProps interface and ensures type safety.
|
|
355
|
+
* Used for prop normalization and filtering in component implementations.
|
|
356
|
+
*
|
|
357
|
+
* TypeScript ensures all entries are valid keys of SelectFieldProps.
|
|
358
|
+
*/
|
|
359
|
+
declare const SELECT_FIELD_PROP_NAMES: readonly ["name", "selectOptions", "placeholder", "disabled", "readonly", "class", "label", "hideLabel", "description", "required", "size", "variant", "valueToLabel", "useSchemaOptions", "dependsOn", "optionFilterFn", "autoReset"];
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Type to convert underscores to PascalCase
|
|
363
|
+
* This helper type processes a single segment by capitalizing after underscores
|
|
364
|
+
*/
|
|
365
|
+
type SegmentToPascalCase<S extends string> = S extends `${infer First}_${infer Rest}` ? `${Capitalize<First>}${SegmentToPascalCase<Rest>}` : Capitalize<S>;
|
|
366
|
+
/**
|
|
367
|
+
* Type to convert a dot-separated path to PascalCase
|
|
368
|
+
* This uses recursion to handle any level of nesting
|
|
369
|
+
* Also handles underscores by removing them and capitalizing each segment
|
|
370
|
+
*/
|
|
371
|
+
type PathToPascalCase<P extends string> = P extends `${infer A}.${infer B}` ? `${SegmentToPascalCase<A>}${PathToPascalCase<B>}` : `${SegmentToPascalCase<P>}Field`;
|
|
372
|
+
/**
|
|
373
|
+
* Type that maps field paths to their corresponding enum types
|
|
374
|
+
*/
|
|
375
|
+
type FieldPathToEnum<T, P extends Path<T>> = P extends keyof T ? T[P] extends string ? T[P] : string : string;
|
|
376
|
+
/**
|
|
377
|
+
* Type that extracts the array element type from a field path
|
|
378
|
+
* If the path points to an array, it extracts the element type
|
|
379
|
+
* @example
|
|
380
|
+
* ArrayItemType<{users: User[]}, 'users'> = User
|
|
381
|
+
* ArrayItemType<{tasks: Task[]}, 'tasks'> = Task
|
|
382
|
+
*/
|
|
383
|
+
type ArrayItemType<T, P extends Path<T>> = P extends keyof T ? T[P] extends ReadonlyArray<infer Item> ? Item : T[P] extends Array<infer Item> ? Item : never : never;
|
|
384
|
+
/**
|
|
385
|
+
* Type-safe fields object that provides autocomplete for field names
|
|
386
|
+
* Maps each key of T to a string (the prefixed field name)
|
|
387
|
+
* All fields return strings regardless of whether the actual field is optional
|
|
388
|
+
*/
|
|
389
|
+
type FieldNames<T> = T extends Record<string, any> ? {
|
|
390
|
+
[K in keyof T]-?: string;
|
|
391
|
+
} : Record<string, string>;
|
|
392
|
+
/**
|
|
393
|
+
* Type for array field components with properly typed slots
|
|
394
|
+
*/
|
|
395
|
+
type ArrayFieldComponent<T, P extends Path<T>> = vue.FunctionalComponent<Omit<ArrayFieldProps<T, ArrayItemType<T, P>>, 'name'>, {}, {
|
|
396
|
+
itemRenderer: (props: {
|
|
397
|
+
item: ArrayItemType<T, P>;
|
|
398
|
+
index: number;
|
|
399
|
+
fields: FieldNames<ArrayItemType<T, P>>;
|
|
400
|
+
}) => any;
|
|
401
|
+
availableItemRenderer: (props: {
|
|
402
|
+
item: ArrayItemType<T, P>;
|
|
403
|
+
index: number;
|
|
404
|
+
}) => any;
|
|
405
|
+
default: () => any;
|
|
406
|
+
}, {}>;
|
|
407
|
+
/**
|
|
408
|
+
* Type for enum field components that require valueToLabel
|
|
409
|
+
*/
|
|
410
|
+
type EnumFieldComponent<T, P extends Path<T>> = (props: Omit<SelectFieldProps<T>, 'name' | 'valueToLabel'> & {
|
|
411
|
+
valueToLabel: Record<FieldPathToEnum<T, P>, string>;
|
|
412
|
+
}, context?: any) => any;
|
|
413
|
+
/**
|
|
414
|
+
* Type for select field components (can work with string or enum fields)
|
|
415
|
+
* Uses SelectFieldProps<T, P, TData> to preserve path-specific typing for props like dependsOn
|
|
416
|
+
* and ensure type safety between selectOptions and optionFilterFn
|
|
417
|
+
*/
|
|
418
|
+
type SelectFieldComponent<T, P extends Path<T>> = <TData = any>(props: Omit<SelectFieldProps<T, P, TData>, 'name'>, context?: any) => any;
|
|
419
|
+
/**
|
|
420
|
+
* Type for number field components
|
|
421
|
+
*/
|
|
422
|
+
type NumberFieldComponent<T> = (props: Omit<NumberFieldProps<T>, 'name'>, context?: any) => any;
|
|
423
|
+
/**
|
|
424
|
+
* Type for checkbox field components
|
|
425
|
+
*/
|
|
426
|
+
type CheckboxFieldComponent<T> = (props: Omit<CheckboxFieldProps<T>, 'name'>, context?: any) => any;
|
|
427
|
+
/**
|
|
428
|
+
* Type for date field components
|
|
429
|
+
*/
|
|
430
|
+
type DateFieldComponent<T> = (props: Omit<DateFieldProps<T>, 'name'>, context?: any) => any;
|
|
431
|
+
/**
|
|
432
|
+
* Generic field component type - fallback for any other field types
|
|
433
|
+
*/
|
|
434
|
+
type GenericFieldComponent = (props: any, context?: any) => any;
|
|
435
|
+
/**
|
|
436
|
+
* Helper to unwrap optional/nullable types
|
|
437
|
+
* Removes undefined and null from union types
|
|
438
|
+
* Examples:
|
|
439
|
+
* string | undefined → string
|
|
440
|
+
* string | null → string
|
|
441
|
+
* string | undefined | null → string
|
|
442
|
+
*/
|
|
443
|
+
type UnwrapOptional<T> = Exclude<T, undefined | null>;
|
|
444
|
+
/**
|
|
445
|
+
* Maps a field path to its component type based on the field's actual type
|
|
446
|
+
* Enums are explicitly passed as FieldType = 'enum' since they can't be auto-detected
|
|
447
|
+
* Everything else is inferred from the actual TypeScript type at the path
|
|
448
|
+
*
|
|
449
|
+
* For string fields, we use SelectFieldComponent<T, P> which is a superset that includes
|
|
450
|
+
* all TextField functionality plus additional props like dependsOn for cascading dropdowns.
|
|
451
|
+
* This provides better type safety and autocomplete.
|
|
452
|
+
*/
|
|
453
|
+
type FieldComponentType<T, P extends Path<T>, FieldType extends string = 'string'> = FieldType extends 'enum' ? EnumFieldComponent<T, P> : P extends keyof T ? UnwrapOptional<T[P]> extends Array<any> | ReadonlyArray<any> ? ArrayFieldComponent<T, P> : UnwrapOptional<T[P]> extends number ? NumberFieldComponent<T> : UnwrapOptional<T[P]> extends boolean ? CheckboxFieldComponent<T> : UnwrapOptional<T[P]> extends Date ? DateFieldComponent<T> : UnwrapOptional<T[P]> extends string ? SelectFieldComponent<T, P> : GenericFieldComponent : GenericFieldComponent;
|
|
454
|
+
/**
|
|
455
|
+
* Type for the components object with PascalCase keys derived from field paths
|
|
456
|
+
* Each component gets the right type based on what the field actually is
|
|
457
|
+
*/
|
|
458
|
+
type ComponentsType<T> = {
|
|
459
|
+
[K in Path<T> as PathToPascalCase<K & string>]: FieldComponentType<T, K>;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Types for field metadata in the form system
|
|
464
|
+
*/
|
|
465
|
+
/**
|
|
466
|
+
* Metadata about a form field
|
|
467
|
+
* This interface defines all the properties that describe a field's behavior and appearance
|
|
468
|
+
*/
|
|
469
|
+
interface FieldMetadata {
|
|
470
|
+
/** The full path to the field (e.g., 'user.firstName') */
|
|
471
|
+
path: string;
|
|
472
|
+
/** Whether the field is required (false if optional) */
|
|
473
|
+
isRequired: boolean;
|
|
474
|
+
/** The data type of the field */
|
|
475
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'enum' | 'date' | 'union';
|
|
476
|
+
/** The input type for rendering the field */
|
|
477
|
+
inputType?: 'text' | 'email' | 'url' | 'tel' | 'number' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'password' | 'array' | 'currency' | 'date' | 'time' | 'datetime-local' | 'file' | 'range' | 'search' | 'combobox';
|
|
478
|
+
/** The display label for the field */
|
|
479
|
+
label?: string;
|
|
480
|
+
/** Placeholder text for the field */
|
|
481
|
+
placeholder?: string;
|
|
482
|
+
/** Minimum value (for number fields) or length (for string/array fields) */
|
|
483
|
+
min?: number;
|
|
484
|
+
/** Maximum value (for number fields) or length (for string/array fields) */
|
|
485
|
+
max?: number;
|
|
486
|
+
/** Regular expression pattern for validation */
|
|
487
|
+
pattern?: RegExp;
|
|
488
|
+
/** Options for enum fields */
|
|
489
|
+
options?: Array<{
|
|
490
|
+
value: string;
|
|
491
|
+
label: string;
|
|
492
|
+
}>;
|
|
493
|
+
/** Default value for the field */
|
|
494
|
+
defaultValue?: any;
|
|
495
|
+
/** Whether the field is an array */
|
|
496
|
+
isArray?: boolean;
|
|
497
|
+
/** Metadata for array element type */
|
|
498
|
+
arrayOf?: FieldMetadata;
|
|
499
|
+
/** Child field metadata for object types */
|
|
500
|
+
children?: Record<string, FieldMetadata>;
|
|
501
|
+
/** Available items for array fields */
|
|
502
|
+
availableItems?: any[];
|
|
503
|
+
/** Help text to display with the field */
|
|
504
|
+
helpText?: string;
|
|
505
|
+
/** For textarea fields, number of rows to display */
|
|
506
|
+
rows?: number;
|
|
507
|
+
/** For textarea fields, number of columns to display */
|
|
508
|
+
cols?: number;
|
|
509
|
+
/** For enum fields, map values to display labels */
|
|
510
|
+
valueToLabel?: Record<string, string>;
|
|
511
|
+
/** Whether the field should be disabled */
|
|
512
|
+
disabled?: boolean;
|
|
513
|
+
/** Whether the field should be hidden */
|
|
514
|
+
hidden?: boolean;
|
|
515
|
+
/** CSS class to apply to the field */
|
|
516
|
+
className?: string;
|
|
517
|
+
/** Whether the field should be focused on load */
|
|
518
|
+
autofocus?: boolean;
|
|
519
|
+
/** For number fields, the step value */
|
|
520
|
+
step?: number;
|
|
521
|
+
/** Autocomplete attribute for the field */
|
|
522
|
+
autocomplete?: string;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Types for schema metadata in the form system
|
|
527
|
+
*/
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Additional metadata that can be associated with schema fields
|
|
531
|
+
* This interface defines properties that can be attached to schema fields
|
|
532
|
+
* to customize their behavior and appearance
|
|
533
|
+
*/
|
|
534
|
+
interface SchemaFieldMetadata {
|
|
535
|
+
/** The input type for rendering the field */
|
|
536
|
+
inputType?: 'text' | 'email' | 'tel' | 'number' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'password' | 'currency' | 'date' | 'time' | 'datetime-local' | 'combobox' | 'array';
|
|
537
|
+
/** Placeholder text for the field */
|
|
538
|
+
placeholder?: string;
|
|
539
|
+
/** The display label for the field */
|
|
540
|
+
label?: string;
|
|
541
|
+
/** Help text to display with the field */
|
|
542
|
+
helpText?: string;
|
|
543
|
+
/** For textarea fields, number of rows to display */
|
|
544
|
+
rows?: number;
|
|
545
|
+
/** For textarea fields, number of columns to display */
|
|
546
|
+
cols?: number;
|
|
547
|
+
/** For enum fields, map values to display labels */
|
|
548
|
+
valueToLabel?: Record<string, string>;
|
|
549
|
+
/** Whether to hide validation errors */
|
|
550
|
+
hideError?: boolean;
|
|
551
|
+
/** Step value for numeric fields */
|
|
552
|
+
step?: number;
|
|
553
|
+
/** Any other custom properties */
|
|
554
|
+
[key: string]: any;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Type for the registry mapping field paths to their metadata
|
|
558
|
+
*/
|
|
559
|
+
type MetadataRegistry = Record<string, SchemaFieldMetadata>;
|
|
560
|
+
/**
|
|
561
|
+
* Type helper to extract all possible paths from a Zod schema
|
|
562
|
+
*/
|
|
563
|
+
type PathsOf<T extends z.ZodTypeAny> = Path<z.infer<T>>;
|
|
564
|
+
|
|
142
565
|
/**
|
|
143
566
|
* Option item for combobox fields - can be a string or label/value object
|
|
144
567
|
*/
|
|
@@ -219,6 +642,14 @@ interface ComboboxFieldProps<FormType, P extends Path<FormType> = Path<FormType>
|
|
|
219
642
|
*/
|
|
220
643
|
filterFn?: (query: string, option: ComboboxOption) => boolean;
|
|
221
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* Array of prop names for ComboboxField component.
|
|
647
|
+
* This is derived from ComboboxFieldProps interface and ensures type safety.
|
|
648
|
+
* Used for prop normalization and filtering in component implementations.
|
|
649
|
+
*
|
|
650
|
+
* TypeScript ensures all entries are valid keys of ComboboxFieldProps.
|
|
651
|
+
*/
|
|
652
|
+
declare const COMBOBOX_FIELD_PROP_NAMES: readonly ["name", "options", "placeholder", "disabled", "readonly", "class", "label", "hideLabel", "description", "required", "size", "variant", "allowCreate", "filterFn"];
|
|
222
653
|
|
|
223
654
|
interface CurrencyFieldProps<FormType> {
|
|
224
655
|
name: FlexiblePath<FormType>;
|
|
@@ -237,23 +668,6 @@ interface CurrencyFieldProps<FormType> {
|
|
|
237
668
|
step?: number;
|
|
238
669
|
}
|
|
239
670
|
|
|
240
|
-
interface DateFieldProps<FormType> {
|
|
241
|
-
name: FlexiblePath<FormType>;
|
|
242
|
-
label?: string;
|
|
243
|
-
hideLabel?: boolean;
|
|
244
|
-
description?: string;
|
|
245
|
-
required?: boolean;
|
|
246
|
-
placeholder?: string;
|
|
247
|
-
disabled?: boolean;
|
|
248
|
-
readonly?: boolean;
|
|
249
|
-
class?: string | string[];
|
|
250
|
-
size?: string;
|
|
251
|
-
variant?: string;
|
|
252
|
-
min?: string;
|
|
253
|
-
max?: string;
|
|
254
|
-
formatter?: (date: string) => unknown;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
671
|
interface DateTimeLocalFieldProps<FormType> {
|
|
258
672
|
name: FlexiblePath<FormType>;
|
|
259
673
|
label?: string;
|
|
@@ -342,23 +756,6 @@ interface FormProps<FormType> {
|
|
|
342
756
|
children?: any;
|
|
343
757
|
}
|
|
344
758
|
|
|
345
|
-
interface NumberFieldProps<FormType> {
|
|
346
|
-
name: FlexiblePath<FormType>;
|
|
347
|
-
label?: string;
|
|
348
|
-
hideLabel?: boolean;
|
|
349
|
-
description?: string;
|
|
350
|
-
required?: boolean;
|
|
351
|
-
placeholder?: string;
|
|
352
|
-
disabled?: boolean;
|
|
353
|
-
readonly?: boolean;
|
|
354
|
-
class?: string | string[];
|
|
355
|
-
size?: string;
|
|
356
|
-
variant?: string;
|
|
357
|
-
min?: number;
|
|
358
|
-
max?: number;
|
|
359
|
-
step?: number;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
759
|
interface PasswordFieldProps<FormType> {
|
|
363
760
|
name: FlexiblePath<FormType>;
|
|
364
761
|
label?: string;
|
|
@@ -394,139 +791,41 @@ interface RadioFieldProps<FormType> {
|
|
|
394
791
|
|
|
395
792
|
interface RangeFieldProps<FormType> {
|
|
396
793
|
name: FlexiblePath<FormType>;
|
|
397
|
-
label?: string;
|
|
398
|
-
hideLabel?: boolean;
|
|
399
|
-
description?: string;
|
|
400
|
-
required?: boolean;
|
|
401
|
-
disabled?: boolean;
|
|
402
|
-
readonly?: boolean;
|
|
403
|
-
class?: string | string[];
|
|
404
|
-
size?: string;
|
|
405
|
-
variant?: string;
|
|
406
|
-
min?: number;
|
|
407
|
-
max?: number;
|
|
408
|
-
step?: number;
|
|
409
|
-
showValue?: boolean;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
interface ResetButtonProps<FormType> {
|
|
413
|
-
resetText?: string;
|
|
414
|
-
className?: string;
|
|
415
|
-
disabled?: boolean;
|
|
416
|
-
onReset?: () => void;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
interface SearchFieldProps<FormType> {
|
|
420
|
-
name: FlexiblePath<FormType>;
|
|
421
|
-
label?: string;
|
|
422
|
-
hideLabel?: boolean;
|
|
423
|
-
description?: string;
|
|
424
|
-
required?: boolean;
|
|
425
|
-
placeholder?: string;
|
|
426
|
-
disabled?: boolean;
|
|
427
|
-
readonly?: boolean;
|
|
428
|
-
autocomplete?: string;
|
|
429
|
-
class?: string | string[];
|
|
430
|
-
size?: string;
|
|
431
|
-
variant?: string;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Option item for select fields
|
|
436
|
-
*/
|
|
437
|
-
interface SelectOption {
|
|
438
|
-
value: string;
|
|
439
|
-
label: string;
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Type for a mapping of enum values to labels
|
|
443
|
-
*/
|
|
444
|
-
type EnumValueToLabelMap<T extends string> = Record<T, string>;
|
|
445
|
-
/**
|
|
446
|
-
* Type for a value-to-label mapping that can be either a function or an object map
|
|
447
|
-
*/
|
|
448
|
-
type ValueToLabelMapping<T extends string = string> = ((value: string) => string) | EnumValueToLabelMap<T>;
|
|
449
|
-
/**
|
|
450
|
-
* Helper type to extract the type of a field at a given path
|
|
451
|
-
*/
|
|
452
|
-
type FieldType<T, P extends string> = P extends keyof T ? T[P] : P extends `${infer A}.${infer B}` ? A extends keyof T ? FieldType<T[A], B> : never : never;
|
|
453
|
-
/**
|
|
454
|
-
* Helper type to extract enum values from a field type
|
|
455
|
-
*/
|
|
456
|
-
type EnumValuesFromField<T> = T extends string ? T : never;
|
|
457
|
-
/**
|
|
458
|
-
* Type that maps field paths to their corresponding enum types
|
|
459
|
-
*/
|
|
460
|
-
type FieldPathToEnum$1<T, P extends Path<T>> = EnumValuesFromField<FieldType<T, P & string>>;
|
|
461
|
-
/**
|
|
462
|
-
* Props for the SelectField component
|
|
463
|
-
*/
|
|
464
|
-
interface SelectFieldProps<FormType, P extends Path<FormType> = Path<FormType>> {
|
|
465
|
-
/**
|
|
466
|
-
* Field name (path in the form state)
|
|
467
|
-
* Accepts both static paths and dynamic paths for use in array fields
|
|
468
|
-
*/
|
|
794
|
+
label?: string;
|
|
795
|
+
hideLabel?: boolean;
|
|
796
|
+
description?: string;
|
|
797
|
+
required?: boolean;
|
|
798
|
+
disabled?: boolean;
|
|
799
|
+
readonly?: boolean;
|
|
800
|
+
class?: string | string[];
|
|
801
|
+
size?: string;
|
|
802
|
+
variant?: string;
|
|
803
|
+
min?: number;
|
|
804
|
+
max?: number;
|
|
805
|
+
step?: number;
|
|
806
|
+
showValue?: boolean;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
interface ResetButtonProps<FormType> {
|
|
810
|
+
resetText?: string;
|
|
811
|
+
className?: string;
|
|
812
|
+
disabled?: boolean;
|
|
813
|
+
onReset?: () => void;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
interface SearchFieldProps<FormType> {
|
|
469
817
|
name: FlexiblePath<FormType>;
|
|
470
|
-
/**
|
|
471
|
-
* Field label
|
|
472
|
-
*/
|
|
473
818
|
label?: string;
|
|
474
|
-
/**
|
|
475
|
-
* Whether to hide the label
|
|
476
|
-
*/
|
|
477
819
|
hideLabel?: boolean;
|
|
478
|
-
/**
|
|
479
|
-
* Field description
|
|
480
|
-
*/
|
|
481
820
|
description?: string;
|
|
482
|
-
/**
|
|
483
|
-
* Whether the field is required
|
|
484
|
-
*/
|
|
485
821
|
required?: boolean;
|
|
486
|
-
/**
|
|
487
|
-
* Placeholder text
|
|
488
|
-
*/
|
|
489
822
|
placeholder?: string;
|
|
490
|
-
/**
|
|
491
|
-
* Whether the field is disabled
|
|
492
|
-
*/
|
|
493
823
|
disabled?: boolean;
|
|
494
|
-
/**
|
|
495
|
-
* Whether the field is readonly
|
|
496
|
-
*/
|
|
497
824
|
readonly?: boolean;
|
|
498
|
-
|
|
499
|
-
* CSS classes to apply to the field
|
|
500
|
-
*/
|
|
825
|
+
autocomplete?: string;
|
|
501
826
|
class?: string | string[];
|
|
502
|
-
/**
|
|
503
|
-
* Field size
|
|
504
|
-
*/
|
|
505
827
|
size?: string;
|
|
506
|
-
/**
|
|
507
|
-
* Field variant
|
|
508
|
-
*/
|
|
509
828
|
variant?: string;
|
|
510
|
-
/**
|
|
511
|
-
* Select options (overrides options from schema)
|
|
512
|
-
* Using selectOptions instead of options to avoid conflicts with HTML select element
|
|
513
|
-
*/
|
|
514
|
-
selectOptions?: SelectOption[];
|
|
515
|
-
/**
|
|
516
|
-
* Custom mapping function to convert values to labels
|
|
517
|
-
* This is useful when you want to customize how labels are displayed
|
|
518
|
-
* without providing a full options array
|
|
519
|
-
*
|
|
520
|
-
* Can be provided as either:
|
|
521
|
-
* 1. A function that takes a value and returns a label
|
|
522
|
-
* 2. An object map where keys are enum values and values are labels
|
|
523
|
-
*/
|
|
524
|
-
valueToLabel?: ValueToLabelMapping<FieldPathToEnum$1<FormType, P>>;
|
|
525
|
-
/**
|
|
526
|
-
* Whether to use options from the schema (default: true)
|
|
527
|
-
* Set to false to ignore schema options even when no options prop is provided
|
|
528
|
-
*/
|
|
529
|
-
useSchemaOptions?: boolean;
|
|
530
829
|
}
|
|
531
830
|
|
|
532
831
|
interface SubmitButtonProps<FormType> {
|
|
@@ -791,195 +1090,6 @@ interface DataTableProps<FormType> {
|
|
|
791
1090
|
name?: string;
|
|
792
1091
|
}
|
|
793
1092
|
|
|
794
|
-
/**
|
|
795
|
-
* Type to convert underscores to PascalCase
|
|
796
|
-
* This helper type processes a single segment by capitalizing after underscores
|
|
797
|
-
*/
|
|
798
|
-
type SegmentToPascalCase<S extends string> = S extends `${infer First}_${infer Rest}` ? `${Capitalize<First>}${SegmentToPascalCase<Rest>}` : Capitalize<S>;
|
|
799
|
-
/**
|
|
800
|
-
* Type to convert a dot-separated path to PascalCase
|
|
801
|
-
* This uses recursion to handle any level of nesting
|
|
802
|
-
* Also handles underscores by removing them and capitalizing each segment
|
|
803
|
-
*/
|
|
804
|
-
type PathToPascalCase<P extends string> = P extends `${infer A}.${infer B}` ? `${SegmentToPascalCase<A>}${PathToPascalCase<B>}` : `${SegmentToPascalCase<P>}Field`;
|
|
805
|
-
/**
|
|
806
|
-
* Type that maps field paths to their corresponding enum types
|
|
807
|
-
*/
|
|
808
|
-
type FieldPathToEnum<T, P extends Path<T>> = P extends keyof T ? T[P] extends string ? T[P] : string : string;
|
|
809
|
-
/**
|
|
810
|
-
* Type that extracts the array element type from a field path
|
|
811
|
-
* If the path points to an array, it extracts the element type
|
|
812
|
-
* @example
|
|
813
|
-
* ArrayItemType<{users: User[]}, 'users'> = User
|
|
814
|
-
* ArrayItemType<{tasks: Task[]}, 'tasks'> = Task
|
|
815
|
-
*/
|
|
816
|
-
type ArrayItemType<T, P extends Path<T>> = P extends keyof T ? T[P] extends ReadonlyArray<infer Item> ? Item : T[P] extends Array<infer Item> ? Item : never : never;
|
|
817
|
-
/**
|
|
818
|
-
* Type for array field components with properly typed slots
|
|
819
|
-
*/
|
|
820
|
-
type ArrayFieldComponent<T, P extends Path<T>> = vue.FunctionalComponent<Omit<ArrayFieldProps<T, ArrayItemType<T, P>>, 'name'>, {}, {
|
|
821
|
-
itemRenderer: (props: {
|
|
822
|
-
item: ArrayItemType<T, P>;
|
|
823
|
-
index: number;
|
|
824
|
-
getFieldName: (fieldPath: string) => string;
|
|
825
|
-
}) => any;
|
|
826
|
-
availableItemRenderer: (props: {
|
|
827
|
-
item: ArrayItemType<T, P>;
|
|
828
|
-
index: number;
|
|
829
|
-
}) => any;
|
|
830
|
-
default: () => any;
|
|
831
|
-
}, {}>;
|
|
832
|
-
/**
|
|
833
|
-
* Type for enum field components that require valueToLabel
|
|
834
|
-
*/
|
|
835
|
-
type EnumFieldComponent<T, P extends Path<T>> = (props: Omit<SelectFieldProps<T>, 'name' | 'valueToLabel'> & {
|
|
836
|
-
valueToLabel: Record<FieldPathToEnum<T, P>, string>;
|
|
837
|
-
}, context?: any) => any;
|
|
838
|
-
/**
|
|
839
|
-
* Type for text field components
|
|
840
|
-
*/
|
|
841
|
-
type TextFieldComponent<T> = (props: Omit<TextFieldProps<T>, 'name'>, context?: any) => any;
|
|
842
|
-
/**
|
|
843
|
-
* Type for select field components (can work with string or enum fields)
|
|
844
|
-
*/
|
|
845
|
-
type SelectFieldComponent<T, P extends Path<T>> = (props: Omit<SelectFieldProps<T>, 'name'>, context?: any) => any;
|
|
846
|
-
/**
|
|
847
|
-
* Type for number field components
|
|
848
|
-
*/
|
|
849
|
-
type NumberFieldComponent<T> = (props: Omit<NumberFieldProps<T>, 'name'>, context?: any) => any;
|
|
850
|
-
/**
|
|
851
|
-
* Type for checkbox field components
|
|
852
|
-
*/
|
|
853
|
-
type CheckboxFieldComponent<T> = (props: Omit<CheckboxFieldProps<T>, 'name'>, context?: any) => any;
|
|
854
|
-
/**
|
|
855
|
-
* Type for date field components
|
|
856
|
-
*/
|
|
857
|
-
type DateFieldComponent<T> = (props: Omit<DateFieldProps<T>, 'name'>, context?: any) => any;
|
|
858
|
-
/**
|
|
859
|
-
* Generic field component type - fallback for any other field types
|
|
860
|
-
*/
|
|
861
|
-
type GenericFieldComponent = (props: any, context?: any) => any;
|
|
862
|
-
/**
|
|
863
|
-
* Maps a field path to its component type based on the field's actual type
|
|
864
|
-
* Enums are explicitly passed as FieldType = 'enum' since they can't be auto-detected
|
|
865
|
-
* Everything else is inferred from the actual TypeScript type at the path
|
|
866
|
-
*
|
|
867
|
-
* For string fields, we allow both TextFieldComponent and SelectFieldComponent
|
|
868
|
-
* because string fields can use inputType: 'select' in metadata to become SelectFields
|
|
869
|
-
*/
|
|
870
|
-
type FieldComponentType<T, P extends Path<T>, FieldType extends string = 'string'> = FieldType extends 'enum' ? EnumFieldComponent<T, P> : P extends keyof T ? T[P] extends Array<any> | ReadonlyArray<any> ? ArrayFieldComponent<T, P> : T[P] extends number ? NumberFieldComponent<T> : T[P] extends boolean ? CheckboxFieldComponent<T> : T[P] extends Date ? DateFieldComponent<T> : T[P] extends string ? // String fields can be either TextField or SelectField depending on inputType metadata
|
|
871
|
-
TextFieldComponent<T> | SelectFieldComponent<T, P> : GenericFieldComponent : GenericFieldComponent;
|
|
872
|
-
/**
|
|
873
|
-
* Type for the components object with PascalCase keys derived from field paths
|
|
874
|
-
* Each component gets the right type based on what the field actually is
|
|
875
|
-
*/
|
|
876
|
-
type ComponentsType<T> = {
|
|
877
|
-
[K in Path<T> as PathToPascalCase<K & string>]: FieldComponentType<T, K>;
|
|
878
|
-
};
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* Types for field metadata in the form system
|
|
882
|
-
*/
|
|
883
|
-
/**
|
|
884
|
-
* Metadata about a form field
|
|
885
|
-
* This interface defines all the properties that describe a field's behavior and appearance
|
|
886
|
-
*/
|
|
887
|
-
interface FieldMetadata {
|
|
888
|
-
/** The full path to the field (e.g., 'user.firstName') */
|
|
889
|
-
path: string;
|
|
890
|
-
/** Whether the field is required (false if optional) */
|
|
891
|
-
isRequired: boolean;
|
|
892
|
-
/** The data type of the field */
|
|
893
|
-
type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'enum' | 'date' | 'union';
|
|
894
|
-
/** The input type for rendering the field */
|
|
895
|
-
inputType?: 'text' | 'email' | 'url' | 'tel' | 'number' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'password' | 'array' | 'currency' | 'date' | 'time' | 'datetime-local' | 'file' | 'range' | 'search' | 'combobox';
|
|
896
|
-
/** The display label for the field */
|
|
897
|
-
label?: string;
|
|
898
|
-
/** Placeholder text for the field */
|
|
899
|
-
placeholder?: string;
|
|
900
|
-
/** Minimum value (for number fields) or length (for string/array fields) */
|
|
901
|
-
min?: number;
|
|
902
|
-
/** Maximum value (for number fields) or length (for string/array fields) */
|
|
903
|
-
max?: number;
|
|
904
|
-
/** Regular expression pattern for validation */
|
|
905
|
-
pattern?: RegExp;
|
|
906
|
-
/** Options for enum fields */
|
|
907
|
-
options?: Array<{
|
|
908
|
-
value: string;
|
|
909
|
-
label: string;
|
|
910
|
-
}>;
|
|
911
|
-
/** Default value for the field */
|
|
912
|
-
defaultValue?: any;
|
|
913
|
-
/** Whether the field is an array */
|
|
914
|
-
isArray?: boolean;
|
|
915
|
-
/** Metadata for array element type */
|
|
916
|
-
arrayOf?: FieldMetadata;
|
|
917
|
-
/** Child field metadata for object types */
|
|
918
|
-
children?: Record<string, FieldMetadata>;
|
|
919
|
-
/** Available items for array fields */
|
|
920
|
-
availableItems?: any[];
|
|
921
|
-
/** Help text to display with the field */
|
|
922
|
-
helpText?: string;
|
|
923
|
-
/** For textarea fields, number of rows to display */
|
|
924
|
-
rows?: number;
|
|
925
|
-
/** For textarea fields, number of columns to display */
|
|
926
|
-
cols?: number;
|
|
927
|
-
/** For enum fields, map values to display labels */
|
|
928
|
-
valueToLabel?: Record<string, string>;
|
|
929
|
-
/** Whether the field should be disabled */
|
|
930
|
-
disabled?: boolean;
|
|
931
|
-
/** Whether the field should be hidden */
|
|
932
|
-
hidden?: boolean;
|
|
933
|
-
/** CSS class to apply to the field */
|
|
934
|
-
className?: string;
|
|
935
|
-
/** Whether the field should be focused on load */
|
|
936
|
-
autofocus?: boolean;
|
|
937
|
-
/** For number fields, the step value */
|
|
938
|
-
step?: number;
|
|
939
|
-
/** Autocomplete attribute for the field */
|
|
940
|
-
autocomplete?: string;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
/**
|
|
944
|
-
* Types for schema metadata in the form system
|
|
945
|
-
*/
|
|
946
|
-
|
|
947
|
-
/**
|
|
948
|
-
* Additional metadata that can be associated with schema fields
|
|
949
|
-
* This interface defines properties that can be attached to schema fields
|
|
950
|
-
* to customize their behavior and appearance
|
|
951
|
-
*/
|
|
952
|
-
interface SchemaFieldMetadata {
|
|
953
|
-
/** The input type for rendering the field */
|
|
954
|
-
inputType?: 'text' | 'email' | 'tel' | 'number' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'password' | 'currency' | 'date' | 'time' | 'datetime-local' | 'combobox';
|
|
955
|
-
/** Placeholder text for the field */
|
|
956
|
-
placeholder?: string;
|
|
957
|
-
/** The display label for the field */
|
|
958
|
-
label?: string;
|
|
959
|
-
/** Help text to display with the field */
|
|
960
|
-
helpText?: string;
|
|
961
|
-
/** For textarea fields, number of rows to display */
|
|
962
|
-
rows?: number;
|
|
963
|
-
/** For textarea fields, number of columns to display */
|
|
964
|
-
cols?: number;
|
|
965
|
-
/** For enum fields, map values to display labels */
|
|
966
|
-
valueToLabel?: Record<string, string>;
|
|
967
|
-
/** Whether to hide validation errors */
|
|
968
|
-
hideError?: boolean;
|
|
969
|
-
/** Step value for numeric fields */
|
|
970
|
-
step?: number;
|
|
971
|
-
/** Any other custom properties */
|
|
972
|
-
[key: string]: any;
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* Type for the registry mapping field paths to their metadata
|
|
976
|
-
*/
|
|
977
|
-
type MetadataRegistry = Record<string, SchemaFieldMetadata>;
|
|
978
|
-
/**
|
|
979
|
-
* Type helper to extract all possible paths from a Zod schema
|
|
980
|
-
*/
|
|
981
|
-
type PathsOf<T extends z.ZodTypeAny> = Path<z.infer<T>>;
|
|
982
|
-
|
|
983
1093
|
/**
|
|
984
1094
|
* Types for style creators in the form system
|
|
985
1095
|
*/
|
|
@@ -1014,7 +1124,7 @@ interface StyleCreators {
|
|
|
1014
1124
|
itemRenderer: (props: {
|
|
1015
1125
|
item: ItemType;
|
|
1016
1126
|
index: number;
|
|
1017
|
-
|
|
1127
|
+
fields: FieldNames<ItemType>;
|
|
1018
1128
|
}) => any;
|
|
1019
1129
|
availableItemRenderer: (props: {
|
|
1020
1130
|
item: ItemType;
|
|
@@ -1204,7 +1314,7 @@ declare function useForm<T extends z.ZodObject<any>, CalcType = (values: z.infer
|
|
|
1204
1314
|
ziniaGeneric: {
|
|
1205
1315
|
TextField: vue.FunctionalComponent<TextFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1206
1316
|
NumberField: vue.FunctionalComponent<NumberFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1207
|
-
SelectField: vue.FunctionalComponent<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T
|
|
1317
|
+
SelectField: vue.FunctionalComponent<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T>>, any>, {}, any, {}>;
|
|
1208
1318
|
CheckboxField: vue.FunctionalComponent<CheckboxFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1209
1319
|
TextareaField: vue.FunctionalComponent<TextareaFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1210
1320
|
RadioField: vue.FunctionalComponent<RadioFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
@@ -1222,7 +1332,9 @@ declare function useForm<T extends z.ZodObject<any>, CalcType = (values: z.infer
|
|
|
1222
1332
|
itemRenderer: (props: {
|
|
1223
1333
|
item: any;
|
|
1224
1334
|
index: number;
|
|
1225
|
-
|
|
1335
|
+
fields: Record<string, string> | {
|
|
1336
|
+
[x: string]: string;
|
|
1337
|
+
};
|
|
1226
1338
|
}) => any;
|
|
1227
1339
|
availableItemRenderer: (props: {
|
|
1228
1340
|
item: any;
|
|
@@ -1265,10 +1377,10 @@ declare function useForm<T extends z.ZodObject<any>, CalcType = (values: z.infer
|
|
|
1265
1377
|
}) => any;
|
|
1266
1378
|
default: () => any;
|
|
1267
1379
|
}, {}>;
|
|
1268
|
-
createTypedSelectField: <P extends Path<z.TypeOf<T>>>(fieldPath: P) => <E extends FieldPathToEnum<z.TypeOf<T>, P> = FieldPathToEnum<z.TypeOf<T>, P>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T
|
|
1380
|
+
createTypedSelectField: <P extends Path<z.TypeOf<T>>>(fieldPath: P) => <E extends FieldPathToEnum<z.TypeOf<T>, P> = FieldPathToEnum<z.TypeOf<T>, P>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T>>, any>, "name" | "valueToLabel"> & {
|
|
1269
1381
|
valueToLabel: Record<E, string>;
|
|
1270
1382
|
}, context?: any) => any;
|
|
1271
|
-
typedSelectFields: { [K in Path<z.TypeOf<T>>]?: (<E extends FieldPathToEnum<z.TypeOf<T>, K> = FieldPathToEnum<z.TypeOf<T>, K>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T
|
|
1383
|
+
typedSelectFields: { [K in Path<z.TypeOf<T>>]?: (<E extends FieldPathToEnum<z.TypeOf<T>, K> = FieldPathToEnum<z.TypeOf<T>, K>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T>>, any>, "name" | "valueToLabel"> & {
|
|
1272
1384
|
valueToLabel: Record<E, string>;
|
|
1273
1385
|
}, context?: any) => any) | undefined; };
|
|
1274
1386
|
fields: Record<Path<z.TypeOf<T>>, any>;
|
|
@@ -1341,7 +1453,7 @@ declare function createTypedArrayField<T, P extends Path<T>>(baseArrayField: Fun
|
|
|
1341
1453
|
itemRenderer: (props: {
|
|
1342
1454
|
item: ArrayItemType<T, P>;
|
|
1343
1455
|
index: number;
|
|
1344
|
-
|
|
1456
|
+
fields: FieldNames<ArrayItemType<T, P>>;
|
|
1345
1457
|
}) => any;
|
|
1346
1458
|
availableItemRenderer: (props: {
|
|
1347
1459
|
item: ArrayItemType<T, P>;
|
|
@@ -1362,7 +1474,7 @@ declare function generateFieldComponents<T extends z.ZodObject<any>>(schema: T,
|
|
|
1362
1474
|
generic: {
|
|
1363
1475
|
TextField: vue.FunctionalComponent<TextFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1364
1476
|
NumberField: vue.FunctionalComponent<NumberFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1365
|
-
SelectField: vue.FunctionalComponent<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T
|
|
1477
|
+
SelectField: vue.FunctionalComponent<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T>>, any>, {}, any, {}>;
|
|
1366
1478
|
CheckboxField: vue.FunctionalComponent<CheckboxFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1367
1479
|
TextareaField: vue.FunctionalComponent<TextareaFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
1368
1480
|
RadioField: vue.FunctionalComponent<RadioFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
@@ -1380,7 +1492,9 @@ declare function generateFieldComponents<T extends z.ZodObject<any>>(schema: T,
|
|
|
1380
1492
|
itemRenderer: (props: {
|
|
1381
1493
|
item: any;
|
|
1382
1494
|
index: number;
|
|
1383
|
-
|
|
1495
|
+
fields: Record<string, string> | {
|
|
1496
|
+
[x: string]: string;
|
|
1497
|
+
};
|
|
1384
1498
|
}) => any;
|
|
1385
1499
|
availableItemRenderer: (props: {
|
|
1386
1500
|
item: any;
|
|
@@ -1423,10 +1537,10 @@ declare function generateFieldComponents<T extends z.ZodObject<any>>(schema: T,
|
|
|
1423
1537
|
}) => any;
|
|
1424
1538
|
default: () => any;
|
|
1425
1539
|
}, {}>;
|
|
1426
|
-
createTypedSelectField: <P extends Path<z.TypeOf<T>>>(fieldPath: P) => <E extends FieldPathToEnum<z.TypeOf<T>, P> = FieldPathToEnum<z.TypeOf<T>, P>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T
|
|
1540
|
+
createTypedSelectField: <P extends Path<z.TypeOf<T>>>(fieldPath: P) => <E extends FieldPathToEnum<z.TypeOf<T>, P> = FieldPathToEnum<z.TypeOf<T>, P>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T>>, any>, "name" | "valueToLabel"> & {
|
|
1427
1541
|
valueToLabel: Record<E, string>;
|
|
1428
1542
|
}, context?: any) => any;
|
|
1429
|
-
typedSelectFields: { [K in Path<z.TypeOf<T>>]?: (<E extends FieldPathToEnum<z.TypeOf<T>, K> = FieldPathToEnum<z.TypeOf<T>, K>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T
|
|
1543
|
+
typedSelectFields: { [K in Path<z.TypeOf<T>>]?: (<E extends FieldPathToEnum<z.TypeOf<T>, K> = FieldPathToEnum<z.TypeOf<T>, K>>(props: Omit<SelectFieldProps<z.TypeOf<T>, Path<z.TypeOf<T>>, any>, "name" | "valueToLabel"> & {
|
|
1430
1544
|
valueToLabel: Record<E, string>;
|
|
1431
1545
|
}, context?: any) => any) | undefined; };
|
|
1432
1546
|
fields: Record<Path<z.TypeOf<T>>, any>;
|
|
@@ -2252,4 +2366,4 @@ declare const ActionIcons: {
|
|
|
2252
2366
|
readonly dotsHorizontal: "<svg fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z\" /></svg>";
|
|
2253
2367
|
};
|
|
2254
2368
|
|
|
2255
|
-
export { ActionIcons, type ActionItem, type ActionsConfig, type ButtonActionItem, type ColumnDefinition, type CursorDataTableOptions, type CursorFetchParams, type CursorFetchResult, type DataTableColumns, type DataTableOptions, type DisplayComponentsType, type DisplayFieldComponent, ErrorDisplay, type FetchDataParams, type FetchDataResult, type FilterOptionItem, type FilterValue, type LinkActionItem, LoadingDisplay, NoDataDisplay, SCHEMA_ID_SYMBOL, type TypedSelectFieldComponent, type UseCursorDataTableType, type UseDataTableType, type UseDeleteModalType, type UseDisplayType, type UseFormType, type UseFormTyped, ZINIA_DATA_TABLE_ACTIONS_KEY, ZINIA_DATA_TABLE_COLUMNS_KEY, ZINIA_DATA_TABLE_FILTER_INPUTS_KEY, ZINIA_DATA_TABLE_FILTER_OPERATORS_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_LOADING_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_STATE_KEY, ZINIA_DATA_TABLE_KEY, ZINIA_DATA_TABLE_NAME_KEY, ZINIA_DATA_TABLE_OPTIONS_KEY, ZINIA_DATA_TABLE_SEARCH_INPUT_KEY, ZINIA_DELETE_MODAL_FIELDS_GENERIC_KEY, ZINIA_DELETE_MODAL_FIELDS_KEY, ZINIA_DELETE_MODAL_KEY, ZINIA_DELETE_MODAL_SCHEMA_KEY, ZINIA_DISPLAY_FIELDS_GENERIC_KEY, ZINIA_DISPLAY_FIELDS_KEY, ZINIA_DISPLAY_KEY, ZINIA_DISPLAY_SCHEMA_KEY, ZINIA_FIELDS_GENERIC_KEY, ZINIA_FIELDS_KEY, ZINIA_FORM_KEY, ZINIA_FORM_SCHEMA_KEY, type ZiniaDataTable, type ZiniaDeleteModal, type ZiniaDeleteModalFields, type ZiniaDeleteModalGenericFields, type ZiniaDisplay, type ZiniaDisplayFields, type ZiniaDisplayGenericFields, type ZiniaForm, type ZiniaFormFields, type ZiniaFormGenericFields, ZiniaPlugin, type ZiniaPluginOptions, clearAllMetadata, clearSchemaMetadata, createBaseComponents, createBaseDisplayComponents, createPartialStyle, createStyleTemplate, createTypedArrayField, createTypedSelectField, daisyUIStyle, extendStyle, generateDisplayComponents, generateFieldComponents, getAllSchemaMetadata, getDefaultStyle, getFieldMetadata, getRegisteredStyle, getRegisteredStyleNames, getSchemaId, hasRegisteredStyle, hasSchemaMetadata, mergeStyles, plainStyle, registerSchemaMetadata, registerStyle, setSchemaMetadata, useCursorDataTable, useDataTable, useDeleteModal, useDisplay, useForm, withMetadata };
|
|
2369
|
+
export { ActionIcons, type ActionItem, type ActionsConfig, type ArrayFieldProps, type ButtonActionItem, COMBOBOX_FIELD_PROP_NAMES, type CheckboxFieldProps, type ColumnDefinition, type ComboboxFieldProps, type ComboboxOption, type CurrencyFieldProps, type CursorDataTableOptions, type CursorFetchParams, type CursorFetchResult, type DataTableColumns, type DataTableOptions, type DataTableProps, type DateFieldProps, type DateTimeLocalFieldProps, type DeleteModalProps, type DisplayComponentsType, type DisplayFieldComponent, type DisplayFieldProps, type DisplayProps, type EmailFieldProps, type EnumValueToLabelMap, type EnumValuesFromField, ErrorDisplay, type FetchDataParams, type FetchDataResult, type FieldPathToEnum$1 as FieldPathToEnum, type FieldType, type FileFieldProps, type FilterOptionItem, type FilterValue, type FormErrorsSummaryProps, type FormProps, type LinkActionItem, LoadingDisplay, NoDataDisplay, type NumberFieldProps, type PasswordFieldProps, type RadioFieldProps, type RangeFieldProps, type ResetButtonProps, SCHEMA_ID_SYMBOL, SELECT_FIELD_PROP_NAMES, type SearchFieldProps, type SelectFieldProps, type SelectOption, type SubmitButtonProps, type TelFieldProps, type TextFieldProps, type TextareaFieldProps, type TimeFieldProps, type ToppingsFieldProps, type TransferListFieldProps, type TypedSelectFieldComponent, type UrlFieldProps, type UseCursorDataTableType, type UseDataTableType, type UseDeleteModalType, type UseDisplayType, type UseFormType, type UseFormTyped, type ValueToLabelMapping, ZINIA_DATA_TABLE_ACTIONS_KEY, ZINIA_DATA_TABLE_COLUMNS_KEY, ZINIA_DATA_TABLE_FILTER_INPUTS_KEY, ZINIA_DATA_TABLE_FILTER_OPERATORS_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_LOADING_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_STATE_KEY, ZINIA_DATA_TABLE_KEY, ZINIA_DATA_TABLE_NAME_KEY, ZINIA_DATA_TABLE_OPTIONS_KEY, ZINIA_DATA_TABLE_SEARCH_INPUT_KEY, ZINIA_DELETE_MODAL_FIELDS_GENERIC_KEY, ZINIA_DELETE_MODAL_FIELDS_KEY, ZINIA_DELETE_MODAL_KEY, ZINIA_DELETE_MODAL_SCHEMA_KEY, ZINIA_DISPLAY_FIELDS_GENERIC_KEY, ZINIA_DISPLAY_FIELDS_KEY, ZINIA_DISPLAY_KEY, ZINIA_DISPLAY_SCHEMA_KEY, ZINIA_FIELDS_GENERIC_KEY, ZINIA_FIELDS_KEY, ZINIA_FORM_KEY, ZINIA_FORM_SCHEMA_KEY, type ZiniaDataTable, type ZiniaDeleteModal, type ZiniaDeleteModalFields, type ZiniaDeleteModalGenericFields, type ZiniaDisplay, type ZiniaDisplayFields, type ZiniaDisplayGenericFields, type ZiniaForm, type ZiniaFormFields, type ZiniaFormGenericFields, ZiniaPlugin, type ZiniaPluginOptions, type ZodEnumValues, clearAllMetadata, clearSchemaMetadata, createBaseComponents, createBaseDisplayComponents, createPartialStyle, createStyleTemplate, createTypedArrayField, createTypedSelectField, daisyUIStyle, extendStyle, generateDisplayComponents, generateFieldComponents, getAllSchemaMetadata, getDefaultStyle, getFieldMetadata, getRegisteredStyle, getRegisteredStyleNames, getSchemaId, hasRegisteredStyle, hasSchemaMetadata, mergeStyles, plainStyle, registerSchemaMetadata, registerStyle, setSchemaMetadata, useCursorDataTable, useDataTable, useDeleteModal, useDisplay, useForm, withMetadata };
|