@dmitryvim/form-builder 0.2.20 → 0.2.22

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.
@@ -1,4 +1,4 @@
1
1
  import type { TableElement, RenderContext, ComponentContext, ValidationResult } from "../types/index.js";
2
2
  export declare function renderTableElement(element: TableElement, ctx: RenderContext, wrapper: HTMLElement, pathKey: string): void;
3
3
  export declare function validateTableElement(element: TableElement, key: string, context: ComponentContext): ValidationResult;
4
- export declare function updateTableField(_element: TableElement, fieldPath: string, value: unknown, context: ComponentContext): void;
4
+ export declare function updateTableField(element: TableElement, fieldPath: string, value: unknown, context: ComponentContext): void;
@@ -1,4 +1,5 @@
1
1
  import type { Theme } from "../styles/theme.js";
2
+ import type { TableMerge } from "./schema.js";
2
3
  export interface Translations {
3
4
  removeElement: string;
4
5
  clickDragText: string;
@@ -47,6 +48,9 @@ export interface Translations {
47
48
  tableRemoveColumn: string;
48
49
  tableMergeCells: string;
49
50
  tableSplitCell: string;
51
+ tableImportFile: string;
52
+ tableImporting: string;
53
+ tableImportError: string;
50
54
  richinputPlaceholder: string;
51
55
  richinputAttachFile: string;
52
56
  richinputMention: string;
@@ -79,6 +83,10 @@ export interface Config {
79
83
  readonly: boolean;
80
84
  locale: Locale;
81
85
  translations: Record<string, Partial<Translations>>;
86
+ parseTableFile: ((file: File) => Promise<{
87
+ cells: string[][];
88
+ merges?: TableMerge[];
89
+ }>) | null;
82
90
  theme: Partial<Theme>;
83
91
  }
84
92
  export interface ResourceMetadata {
@@ -139,14 +139,14 @@ export interface GroupElement extends BaseElement {
139
139
  * A single cell merge region in the table
140
140
  */
141
141
  export interface TableMerge {
142
- /** Row index of the top-left cell (0-based) */
143
- row: number;
144
- /** Column index of the top-left cell (0-based) */
145
- col: number;
146
- /** Number of rows spanned (>= 1) */
147
- rowspan: number;
148
- /** Number of columns spanned (>= 1) */
149
- colspan: number;
142
+ /** Row index of the top-left cell, inclusive (0-based) */
143
+ top: number;
144
+ /** Column index of the top-left cell, inclusive (0-based) */
145
+ left: number;
146
+ /** Row index of the bottom-right cell, inclusive (0-based) */
147
+ bottom: number;
148
+ /** Column index of the bottom-right cell, inclusive (0-based) */
149
+ right: number;
150
150
  }
151
151
  /**
152
152
  * Table data structure stored as form data
@@ -161,6 +161,15 @@ export interface TableElement extends BaseElement {
161
161
  columns?: number;
162
162
  /** Initial row count (default: 3) */
163
163
  rows?: number;
164
+ /** Whether merge/split operations are allowed (default: true) */
165
+ mergeAllowed?: boolean;
166
+ /** Custom output field names for cells and merges */
167
+ fieldNames?: {
168
+ cells?: string;
169
+ merges?: string;
170
+ };
171
+ /** File extensions accepted for import (e.g. ["csv", "xlsx"]) */
172
+ importAccept?: string[];
164
173
  }
165
174
  export interface RichInputElement extends BaseElement {
166
175
  type: "richinput";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.20",
6
+ "version": "0.2.22",
7
7
  "description": "A reusable JSON schema form builder library",
8
8
  "main": "./dist/cjs/index.cjs",
9
9
  "module": "./dist/esm/index.js",