@dmitryvim/form-builder 0.2.30 → 0.2.32
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/browser/formbuilder.min.js +502 -387
- package/dist/browser/formbuilder.v0.2.32.min.js +1148 -0
- package/dist/cjs/index.cjs +1085 -703
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +1050 -677
- package/dist/esm/index.js.map +1 -1
- package/dist/form-builder.js +502 -387
- package/dist/types/components/file/dom.d.ts +4 -5
- package/dist/types/components/file/preview.d.ts +5 -0
- package/dist/types/components/file/render-edit.d.ts +8 -1
- package/dist/types/components/file/render-readonly.d.ts +4 -7
- package/dist/types/components/file/upload.d.ts +6 -0
- package/dist/types/types/config.d.ts +4 -0
- package/dist/types/types/schema.d.ts +8 -0
- package/package.json +1 -1
- package/dist/browser/formbuilder.v0.2.30.min.js +0 -1033
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { State } from "../../types/state.js";
|
|
2
|
-
export declare const TILE_SIZE = "160px";
|
|
3
2
|
/**
|
|
4
|
-
* Create a base square tile element
|
|
5
|
-
*
|
|
3
|
+
* Create a base square tile element. Sizing comes from CSS — `.fb-tile` and
|
|
4
|
+
* its descendants resolve aspect-ratio/dimensions via the theme variables.
|
|
6
5
|
*/
|
|
7
6
|
export declare function createFileTile(): HTMLElement;
|
|
8
7
|
/**
|
|
9
|
-
* Show an inline error message below the nearest
|
|
8
|
+
* Show an inline error message below the nearest [data-files-wrapper] ancestor.
|
|
10
9
|
*/
|
|
11
10
|
export declare function showFileError(container: HTMLElement, message: string): void;
|
|
12
11
|
/**
|
|
13
|
-
* Remove any inline file error message below the nearest
|
|
12
|
+
* Remove any inline file error message below the nearest [data-files-wrapper] ancestor.
|
|
14
13
|
*/
|
|
15
14
|
export declare function clearFileError(container: HTMLElement): void;
|
|
16
15
|
/**
|
|
@@ -14,6 +14,10 @@ export interface TileActionOptions {
|
|
|
14
14
|
* just-uploaded file.
|
|
15
15
|
*/
|
|
16
16
|
meta?: ResourceMetadata;
|
|
17
|
+
/** Single-only: replace current file by triggering the upload picker. */
|
|
18
|
+
replaceHandler?: (() => void) | null;
|
|
19
|
+
/** Single-only: open the host-owned library picker to pick a replacement. */
|
|
20
|
+
libraryHandler?: (() => void) | null;
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
23
|
* Build a horizontal row of icon-only action buttons for a file tile.
|
|
@@ -22,6 +26,7 @@ export interface TileActionOptions {
|
|
|
22
26
|
* Remove is rendered only in edit mode.
|
|
23
27
|
*/
|
|
24
28
|
export declare function createTileActions(options: TileActionOptions): HTMLElement;
|
|
29
|
+
export declare function getLocalFileUrl(file: File): string;
|
|
25
30
|
export declare function releaseLocalFileUrl(file: File | undefined | null): void;
|
|
26
31
|
/**
|
|
27
32
|
* Populate a single-file edit-mode container with a file preview.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { State } from "../../types/state.js";
|
|
2
2
|
import type { FileElement, FilesElement, RenderContext } from "../../types/index.js";
|
|
3
|
-
export { TILE_SIZE } from "./dom.js";
|
|
4
3
|
export interface RenderPillsOptions {
|
|
5
4
|
container: HTMLElement;
|
|
6
5
|
rids: string[] | null;
|
|
@@ -11,8 +10,16 @@ export interface RenderPillsOptions {
|
|
|
11
10
|
maxCount?: number;
|
|
12
11
|
isReadonly?: boolean;
|
|
13
12
|
onLibraryPick?: (() => void) | null;
|
|
13
|
+
element?: {
|
|
14
|
+
maxSize?: number;
|
|
15
|
+
accept?: unknown;
|
|
16
|
+
};
|
|
17
|
+
onClearAll?: () => void;
|
|
18
|
+
openPicker?: () => void;
|
|
14
19
|
}
|
|
15
20
|
export declare function renderResourcePills(opts: RenderPillsOptions): void;
|
|
16
21
|
export declare function renderFileElementEdit(element: FileElement, ctx: RenderContext, wrapper: HTMLElement, pathKey: string): void;
|
|
22
|
+
/** Legacy `files` element — multi-file with no upper bound. */
|
|
17
23
|
export declare function renderFilesElementEdit(element: FilesElement, ctx: RenderContext, wrapper: HTMLElement, pathKey: string): void;
|
|
24
|
+
/** `file` element with `multiple: true` — multi-file honouring maxCount. */
|
|
18
25
|
export declare function renderMultipleFileElementEdit(element: FileElement, ctx: RenderContext, wrapper: HTMLElement, pathKey: string): void;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import type { State } from "../../types/state.js";
|
|
2
2
|
import type { FileElement, FilesElement, RenderContext } from "../../types/index.js";
|
|
3
3
|
/**
|
|
4
|
-
* Render a
|
|
4
|
+
* Render a 220px readonly single-file container (object-contain preview + filename pill).
|
|
5
5
|
* If no prefill: shows a styled empty placeholder.
|
|
6
6
|
*/
|
|
7
7
|
export declare function renderFileElementReadonly(element: FileElement, ctx: RenderContext, wrapper: HTMLElement, pathKey: string): void;
|
|
8
8
|
/**
|
|
9
|
-
* Render a
|
|
10
|
-
*
|
|
11
|
-
* Issue 2 fix: exactly N tile elements for N files — no hidden pill stubs.
|
|
12
|
-
* The [data-files-wrapper] element carries data-resource-ids so validation
|
|
13
|
-
* can read IDs without touching the tile DOM.
|
|
9
|
+
* Render a CSS grid of readonly preview tiles.
|
|
10
|
+
* No add tile, no remove buttons, no drag handles.
|
|
14
11
|
*/
|
|
15
|
-
export declare function renderMultiFileReadonly(rids: string[], state: State, wrapper: HTMLElement, pathKey: string,
|
|
12
|
+
export declare function renderMultiFileReadonly(rids: string[], state: State, wrapper: HTMLElement, pathKey: string, _marginTop?: string): void;
|
|
16
13
|
/**
|
|
17
14
|
* Render legacy `files` element in readonly mode.
|
|
18
15
|
*/
|
|
@@ -8,6 +8,12 @@ export interface FileDeps {
|
|
|
8
8
|
setupDrop?: (container: HTMLElement) => void;
|
|
9
9
|
/** Called by the tile's remove button in single-file edit mode */
|
|
10
10
|
onRemove?: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Optional override for post-upload rendering of a single-file field.
|
|
13
|
+
* When provided, called instead of renderSingleFileEditTile so the
|
|
14
|
+
* render-edit layer can use the new 220px filled-state container.
|
|
15
|
+
*/
|
|
16
|
+
onAfterUpload?: (container: HTMLElement, rid: string) => void;
|
|
11
17
|
}
|
|
12
18
|
export interface HandleFileSelectOptions {
|
|
13
19
|
file: File;
|
|
@@ -38,6 +38,7 @@ export interface Translations {
|
|
|
38
38
|
hintPattern: string;
|
|
39
39
|
fileCountSingle: string;
|
|
40
40
|
fileCountPlural: string;
|
|
41
|
+
fileCountWithMax: string;
|
|
41
42
|
fileCountRange: string;
|
|
42
43
|
uploadingFile: string;
|
|
43
44
|
filesCounter: string;
|
|
@@ -45,6 +46,9 @@ export interface Translations {
|
|
|
45
46
|
libraryEmpty: string;
|
|
46
47
|
libraryHint: string;
|
|
47
48
|
pickerError: string;
|
|
49
|
+
dropToUpload: string;
|
|
50
|
+
replaceFile: string;
|
|
51
|
+
clearAll: string;
|
|
48
52
|
required: string;
|
|
49
53
|
minItems: string;
|
|
50
54
|
maxItems: string;
|
|
@@ -110,6 +110,14 @@ export interface ContainerElement extends BaseElement {
|
|
|
110
110
|
maxCount?: number;
|
|
111
111
|
columns?: 1 | 2 | 3 | 4;
|
|
112
112
|
prefillHints?: PrefillHint[];
|
|
113
|
+
/**
|
|
114
|
+
* How items are arranged when `multiple: true`.
|
|
115
|
+
* - "stack" (default): vertical list, one item per row (current behavior).
|
|
116
|
+
* - "slides": horizontal grid, multiple items per row, auto-wrap.
|
|
117
|
+
* Each item card has min-width 280px and grows to fill available width.
|
|
118
|
+
* Ignored when `multiple: false`.
|
|
119
|
+
*/
|
|
120
|
+
displayMode?: "stack" | "slides";
|
|
113
121
|
}
|
|
114
122
|
export interface ColourElement extends BaseElement {
|
|
115
123
|
type: "colour";
|