@dragonmastery/zinia-forms-core 0.3.6 → 0.3.8

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 CHANGED
@@ -108,6 +108,10 @@ interface ArrayFieldProps<FormType, ItemType> {
108
108
  itemsSource?: () => ItemType[];
109
109
  itemRenderer?: (item: ItemType, index: number) => any;
110
110
  availableItemRenderer?: (item: ItemType, index: number) => any;
111
+ itemPreview?: (item: ItemType, index: number) => string;
112
+ showItemNumber?: boolean;
113
+ itemPreviewMaxLength?: number;
114
+ fieldSummary?: (items: ItemType[]) => string;
111
115
  createItem?: () => ItemType;
112
116
  onAddItem?: (item: ItemType) => void;
113
117
  onRemoveItem?: (index: number) => void;
@@ -123,6 +127,12 @@ interface ArrayFieldProps<FormType, ItemType> {
123
127
  moveDownButton?: string;
124
128
  item?: string;
125
129
  };
130
+ collapseAllButton?: boolean;
131
+ defaultCollapsed?: boolean;
132
+ enableUndo?: boolean;
133
+ maxUndoHistory?: number;
134
+ inlineUndo?: boolean;
135
+ inlineUndoTimeout?: number;
126
136
  }
127
137
 
128
138
  interface CheckboxFieldProps<FormType> {
@@ -402,6 +412,11 @@ type ArrayFieldComponent<T, P extends Path<T>> = vue.FunctionalComponent<Omit<Ar
402
412
  item: ArrayItemType<T, P>;
403
413
  index: number;
404
414
  }) => any;
415
+ itemActions: (props: {
416
+ item: ArrayItemType<T, P>;
417
+ index: number;
418
+ fields: FieldNames<ArrayItemType<T, P>>;
419
+ }) => any;
405
420
  default: () => any;
406
421
  }, {}>;
407
422
  /**
@@ -1130,6 +1145,11 @@ interface StyleCreators {
1130
1145
  item: ItemType;
1131
1146
  index: number;
1132
1147
  }) => any;
1148
+ itemActions: (props: {
1149
+ item: ItemType;
1150
+ index: number;
1151
+ fields: FieldNames<ItemType>;
1152
+ }) => any;
1133
1153
  default: () => any;
1134
1154
  }, {}>;
1135
1155
  createTransferListField: <FormType, ItemType = any>() => FunctionalComponent<TransferListFieldProps<FormType, ItemType>, {}, {
@@ -1275,6 +1295,34 @@ declare function useForm<T extends z.ZodObject<any>, CalcType = (values: z.infer
1275
1295
  readonly errors: Record<string, string>;
1276
1296
  readonly touched: Record<string, boolean>;
1277
1297
  readonly dirty: Record<string, boolean>;
1298
+ readonly collapsedFields: Record<string, {
1299
+ isFieldCollapsed: boolean;
1300
+ collapsedItems: number[];
1301
+ defaultCollapsedInitialized: boolean;
1302
+ }>;
1303
+ readonly undoHistory: Record<string, {
1304
+ type: "add" | "remove" | "swap";
1305
+ previousState: any;
1306
+ currentState: any;
1307
+ timestamp: number;
1308
+ }[]>;
1309
+ readonly redoHistory: Record<string, {
1310
+ type: "add" | "remove" | "swap";
1311
+ previousState: any;
1312
+ currentState: any;
1313
+ timestamp: number;
1314
+ }[]>;
1315
+ readonly pendingOperations: Record<string, {
1316
+ type: "add" | "remove" | "swap";
1317
+ index?: number;
1318
+ indexA?: number;
1319
+ indexB?: number;
1320
+ item?: any;
1321
+ previousState: any;
1322
+ currentState: any;
1323
+ timestamp: number;
1324
+ timeoutId?: number;
1325
+ }[]>;
1278
1326
  fieldsMetadata: Record<string, FieldMetadata>;
1279
1327
  validate: (options?: {
1280
1328
  markErrorsAsTouched: boolean;
@@ -1340,6 +1388,13 @@ declare function useForm<T extends z.ZodObject<any>, CalcType = (values: z.infer
1340
1388
  item: any;
1341
1389
  index: number;
1342
1390
  }) => any;
1391
+ itemActions: (props: {
1392
+ item: any;
1393
+ index: number;
1394
+ fields: Record<string, string> | {
1395
+ [x: string]: string;
1396
+ };
1397
+ }) => any;
1343
1398
  default: () => any;
1344
1399
  }, {}>;
1345
1400
  TransferListField: vue.FunctionalComponent<TransferListFieldProps<z.TypeOf<T>, any>, {}, {
@@ -1436,6 +1491,24 @@ interface TypedSelectFieldComponent<T> {
1436
1491
  }): ReturnType<FunctionalComponent>;
1437
1492
  }
1438
1493
 
1494
+ interface ArrayFieldSlots<ItemType> {
1495
+ itemRenderer: (props: {
1496
+ item: ItemType;
1497
+ index: number;
1498
+ fields: FieldNames<ItemType>;
1499
+ }) => any;
1500
+ availableItemRenderer: (props: {
1501
+ item: ItemType;
1502
+ index: number;
1503
+ }) => any;
1504
+ itemActions: (props: {
1505
+ item: ItemType;
1506
+ index: number;
1507
+ fields: FieldNames<ItemType>;
1508
+ }) => any;
1509
+ default: () => any;
1510
+ }
1511
+
1439
1512
  /**
1440
1513
  * Functions for creating type-safe array fields
1441
1514
  */
@@ -1449,18 +1522,7 @@ interface TypedSelectFieldComponent<T> {
1449
1522
  * @param metadata Optional metadata to apply to the field
1450
1523
  * @returns A properly typed array field component with slot types preserved
1451
1524
  */
1452
- declare function createTypedArrayField<T, P extends Path<T>>(baseArrayField: FunctionalComponent<ArrayFieldProps<T, any>, {}, any, {}>, fieldPath: P, metadata?: FieldMetadata): FunctionalComponent<Omit<ArrayFieldProps<T, ArrayItemType<T, P>>, "name">, {}, {
1453
- itemRenderer: (props: {
1454
- item: ArrayItemType<T, P>;
1455
- index: number;
1456
- fields: FieldNames<ArrayItemType<T, P>>;
1457
- }) => any;
1458
- availableItemRenderer: (props: {
1459
- item: ArrayItemType<T, P>;
1460
- index: number;
1461
- }) => any;
1462
- default: () => any;
1463
- }, {}>;
1525
+ declare function createTypedArrayField<T, P extends Path<T>>(baseArrayField: FunctionalComponent<ArrayFieldProps<T, any>, {}, any, {}>, fieldPath: P, metadata?: FieldMetadata): FunctionalComponent<Omit<ArrayFieldProps<T, ArrayItemType<T, P>>, "name">, {}, ArrayFieldSlots<ArrayItemType<T, P>>, {}>;
1464
1526
 
1465
1527
  /**
1466
1528
  * Generate field components for a schema based on metadata
@@ -1500,6 +1562,13 @@ declare function generateFieldComponents<T extends z.ZodObject<any>>(schema: T,
1500
1562
  item: any;
1501
1563
  index: number;
1502
1564
  }) => any;
1565
+ itemActions: (props: {
1566
+ item: any;
1567
+ index: number;
1568
+ fields: Record<string, string> | {
1569
+ [x: string]: string;
1570
+ };
1571
+ }) => any;
1503
1572
  default: () => any;
1504
1573
  }, {}>;
1505
1574
  TransferListField: vue.FunctionalComponent<TransferListFieldProps<z.TypeOf<T>, any>, {}, {
@@ -2366,4 +2435,23 @@ declare const ActionIcons: {
2366
2435
  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>";
2367
2436
  };
2368
2437
 
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 };
2438
+ /**
2439
+ * Debug configuration for Zinia Forms
2440
+ * Set these flags to true to enable debug logging for specific areas
2441
+ */
2442
+ declare const DEBUG_CONFIG: {
2443
+ /** Enable debug logging for schema cache operations */
2444
+ schemaCache: boolean;
2445
+ /** Enable debug logging for field validation */
2446
+ fieldValidation: boolean;
2447
+ /** Enable debug logging for array field operations */
2448
+ arrayField: boolean;
2449
+ /** Enable all debug logging */
2450
+ all: boolean;
2451
+ };
2452
+ /**
2453
+ * Helper function to check if debug logging is enabled for a specific area
2454
+ */
2455
+ declare function isDebugEnabled(area: keyof Omit<typeof DEBUG_CONFIG, 'all'>): boolean;
2456
+
2457
+ export { ActionIcons, type ActionItem, type ActionsConfig, type ArrayFieldProps, type ArrayFieldSlots, type ButtonActionItem, COMBOBOX_FIELD_PROP_NAMES, type CheckboxFieldProps, type ColumnDefinition, type ComboboxFieldProps, type ComboboxOption, type CurrencyFieldProps, type CursorDataTableOptions, type CursorFetchParams, type CursorFetchResult, DEBUG_CONFIG, 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, isDebugEnabled, mergeStyles, plainStyle, registerSchemaMetadata, registerStyle, setSchemaMetadata, useCursorDataTable, useDataTable, useDeleteModal, useDisplay, useForm, withMetadata };