@dmitryvim/form-builder 0.2.22 → 0.2.23

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.
@@ -4,7 +4,10 @@ export declare function renderSingleContainerElement(element: ContainerElement,
4
4
  export declare function renderMultipleContainerElement(element: ContainerElement, ctx: RenderContext, wrapper: HTMLElement, _pathKey: string): void;
5
5
  export declare function setValidateElement(fn: (element: Element, ctx: {
6
6
  path: string;
7
- }, customScopeRoot?: HTMLElement | null) => any): void;
7
+ }, customScopeRoot?: HTMLElement | null) => {
8
+ value: any;
9
+ spread: boolean;
10
+ }): void;
8
11
  /**
9
12
  * Validate container field and return extracted value with errors
10
13
  */
@@ -5,6 +5,11 @@ interface FileDeps {
5
5
  fileUploadHandler: () => void;
6
6
  dragHandler: (files: FileList) => void;
7
7
  }
8
+ export declare function getAllowedExtensions(accept: string | {
9
+ extensions: string[];
10
+ } | undefined): string[];
11
+ export declare function isFileExtensionAllowed(fileName: string, allowedExtensions: string[]): boolean;
12
+ export declare function isFileSizeAllowed(file: File, maxSizeMB: number): boolean;
8
13
  export declare function renderFilePreview(container: HTMLElement, resourceId: string, state: State, options?: {
9
14
  fileName?: string;
10
15
  isReadonly?: boolean;
@@ -120,6 +120,11 @@ export declare class FormBuilderInstance {
120
120
  * Builds nested objects instead of flattened dotted keys
121
121
  */
122
122
  private buildHiddenFieldsData;
123
+ /**
124
+ * Build a map from flat output keys (textKey/filesKey) to the richinput schema element info.
125
+ * Used by setFormData to detect flat richinput keys and remap them to their composite values.
126
+ */
127
+ private buildFlatKeyMap;
123
128
  /**
124
129
  * Set form data - update multiple fields without full re-render
125
130
  * @param data - Object with field paths and their values
@@ -24,6 +24,8 @@ export interface ValidationResult {
24
24
  value: any;
25
25
  /** Validation errors encountered */
26
26
  errors: string[];
27
+ /** When true, value is spread into parent data instead of nested under element.key */
28
+ spread?: boolean;
27
29
  }
28
30
  /**
29
31
  * Component validator function type
@@ -40,6 +40,9 @@ export interface Translations {
40
40
  invalidHexColour: string;
41
41
  minFiles: string;
42
42
  maxFiles: string;
43
+ invalidFileExtension: string;
44
+ fileTooLarge: string;
45
+ filesLimitExceeded: string;
43
46
  unsupportedFieldType: string;
44
47
  invalidOption: string;
45
48
  tableAddRow: string;
@@ -183,6 +183,7 @@ export interface RichInputElement extends BaseElement {
183
183
  maxFiles?: number;
184
184
  textKey?: string;
185
185
  filesKey?: string;
186
+ flatOutput?: boolean;
186
187
  }
187
188
  export type Element = TextElement | TextareaElement | NumberElement | SelectElement | SwitcherElement | FileElement | FilesElement | ColourElement | SliderElement | ContainerElement | GroupElement | TableElement | RichInputElement;
188
189
  export interface Schema {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.22",
6
+ "version": "0.2.23",
7
7
  "description": "A reusable JSON schema form builder library",
8
8
  "main": "./dist/cjs/index.cjs",
9
9
  "module": "./dist/esm/index.js",