@mosaicoo/form-angular 0.7.0 → 0.9.0
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/README.md +18 -2
- package/fesm2022/mosaicoo-form-angular-designer.mjs +471 -106
- package/fesm2022/mosaicoo-form-angular-designer.mjs.map +1 -1
- package/fesm2022/mosaicoo-form-angular.mjs +4 -4
- package/fesm2022/mosaicoo-form-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/types/mosaicoo-form-angular-designer.d.ts +146 -10
|
@@ -98,6 +98,64 @@ interface FormBlock {
|
|
|
98
98
|
node: FieldNode;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Every visible string of the designer, so hosts can localize the authoring
|
|
103
|
+
* experience the same way they already localize the runtime. Override
|
|
104
|
+
* partially — unset entries fall back to English.
|
|
105
|
+
*
|
|
106
|
+
* The palette itself is DATA: translate `DEFAULT_CATALOG` (or supply your own
|
|
107
|
+
* groups) and pass it through the `[catalog]` input.
|
|
108
|
+
*/
|
|
109
|
+
interface DesignerLabels {
|
|
110
|
+
undo: string;
|
|
111
|
+
redo: string;
|
|
112
|
+
moveUp: string;
|
|
113
|
+
moveDown: string;
|
|
114
|
+
nest: string;
|
|
115
|
+
unnest: string;
|
|
116
|
+
duplicate: string;
|
|
117
|
+
delete: string;
|
|
118
|
+
saveBlock: string;
|
|
119
|
+
viewport: string;
|
|
120
|
+
workspace: string;
|
|
121
|
+
panels: string;
|
|
122
|
+
presets: string;
|
|
123
|
+
resetLayout: string;
|
|
124
|
+
moveLeft: string;
|
|
125
|
+
moveRight: string;
|
|
126
|
+
hidePanel: string;
|
|
127
|
+
import: string;
|
|
128
|
+
export: string;
|
|
129
|
+
preview: string;
|
|
130
|
+
design: string;
|
|
131
|
+
cancel: string;
|
|
132
|
+
close: string;
|
|
133
|
+
importTitle: string;
|
|
134
|
+
importPlaceholder: string;
|
|
135
|
+
importError: string;
|
|
136
|
+
exportTitle: string;
|
|
137
|
+
canvasEmpty: string;
|
|
138
|
+
selectField: string;
|
|
139
|
+
testData: string;
|
|
140
|
+
panelFields: string;
|
|
141
|
+
panelStructure: string;
|
|
142
|
+
panelProperties: string;
|
|
143
|
+
noFields: string;
|
|
144
|
+
}
|
|
145
|
+
declare const DESIGNER_LABELS_EN: DesignerLabels;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Drop-target identity shared by the canvas and the node components.
|
|
149
|
+
* A target is a position in a parent's children list, optionally bound to a
|
|
150
|
+
* column of a `columns` container.
|
|
151
|
+
*/
|
|
152
|
+
interface DropTarget {
|
|
153
|
+
path: NodePath;
|
|
154
|
+
/** Column index when the parent lays children out in columns. */
|
|
155
|
+
column?: number;
|
|
156
|
+
}
|
|
157
|
+
declare function dropId(target: DropTarget): string;
|
|
158
|
+
|
|
101
159
|
/**
|
|
102
160
|
* Designer workspace layout.
|
|
103
161
|
*
|
|
@@ -141,6 +199,45 @@ declare class FormDesignerComponent {
|
|
|
141
199
|
readonly source: _angular_core.InputSignal<unknown>;
|
|
142
200
|
/** Extra palette groups contributed by the host. */
|
|
143
201
|
readonly extraCatalog: _angular_core.InputSignal<CatalogGroup[]>;
|
|
202
|
+
/** Replaces the built-in palette (e.g. a translated DEFAULT_CATALOG). */
|
|
203
|
+
readonly catalogOverride: _angular_core.InputSignal<CatalogGroup[] | null>;
|
|
204
|
+
/** Designer texts; partial overrides fall back to English. */
|
|
205
|
+
readonly labels: _angular_core.InputSignalWithTransform<{
|
|
206
|
+
undo: string;
|
|
207
|
+
redo: string;
|
|
208
|
+
moveUp: string;
|
|
209
|
+
moveDown: string;
|
|
210
|
+
nest: string;
|
|
211
|
+
unnest: string;
|
|
212
|
+
duplicate: string;
|
|
213
|
+
delete: string;
|
|
214
|
+
saveBlock: string;
|
|
215
|
+
viewport: string;
|
|
216
|
+
workspace: string;
|
|
217
|
+
panels: string;
|
|
218
|
+
presets: string;
|
|
219
|
+
resetLayout: string;
|
|
220
|
+
moveLeft: string;
|
|
221
|
+
moveRight: string;
|
|
222
|
+
hidePanel: string;
|
|
223
|
+
import: string;
|
|
224
|
+
export: string;
|
|
225
|
+
preview: string;
|
|
226
|
+
design: string;
|
|
227
|
+
cancel: string;
|
|
228
|
+
close: string;
|
|
229
|
+
importTitle: string;
|
|
230
|
+
importPlaceholder: string;
|
|
231
|
+
importError: string;
|
|
232
|
+
exportTitle: string;
|
|
233
|
+
canvasEmpty: string;
|
|
234
|
+
selectField: string;
|
|
235
|
+
testData: string;
|
|
236
|
+
panelFields: string;
|
|
237
|
+
panelStructure: string;
|
|
238
|
+
panelProperties: string;
|
|
239
|
+
noFields: string;
|
|
240
|
+
}, Partial<DesignerLabels>>;
|
|
144
241
|
/** Emitted after every committed edit (undo/redo included). */
|
|
145
242
|
readonly schemaChanged: _angular_core.OutputEmitterRef<FormSchema>;
|
|
146
243
|
readonly draft: _angular_core.WritableSignal<FormSchema>;
|
|
@@ -149,6 +246,15 @@ declare class FormDesignerComponent {
|
|
|
149
246
|
readonly selected: _angular_core.WritableSignal<NodePath | null>;
|
|
150
247
|
readonly preview: _angular_core.WritableSignal<boolean>;
|
|
151
248
|
readonly previewData: _angular_core.WritableSignal<Record<string, unknown>>;
|
|
249
|
+
/** Preview viewport: the frame drives the form's container queries. */
|
|
250
|
+
readonly viewport: _angular_core.WritableSignal<"desktop" | "tablet" | "mobile">;
|
|
251
|
+
readonly viewports: Array<{
|
|
252
|
+
id: 'desktop' | 'tablet' | 'mobile';
|
|
253
|
+
label: string;
|
|
254
|
+
icon: string;
|
|
255
|
+
width: number | null;
|
|
256
|
+
}>;
|
|
257
|
+
viewportWidth(): number | null;
|
|
152
258
|
readonly dialog: _angular_core.WritableSignal<"import" | "export" | null>;
|
|
153
259
|
readonly importError: _angular_core.WritableSignal<string>;
|
|
154
260
|
readonly showDiagnostics: _angular_core.WritableSignal<boolean>;
|
|
@@ -170,6 +276,11 @@ declare class FormDesignerComponent {
|
|
|
170
276
|
dock(panel: PanelId, side: DockSide): void;
|
|
171
277
|
applyPreset(id: string): void;
|
|
172
278
|
resetLayout(): void;
|
|
279
|
+
/** Live drag state of a dock splitter. */
|
|
280
|
+
private resizing;
|
|
281
|
+
startResize(side: 'left' | 'right', event: PointerEvent): void;
|
|
282
|
+
onResizeMove(event: PointerEvent): void;
|
|
283
|
+
endResize(): void;
|
|
173
284
|
isGroupOpen(label: string): boolean;
|
|
174
285
|
toggleGroup(label: string): void;
|
|
175
286
|
/** Saved blocks (host-controlled when `[blocks]` is bound). */
|
|
@@ -202,6 +313,16 @@ declare class FormDesignerComponent {
|
|
|
202
313
|
duplicateSelected(): void;
|
|
203
314
|
moveSelected(delta: -1 | 1): void;
|
|
204
315
|
applyPatch(event: InspectorPatch): void;
|
|
316
|
+
/** Whether the selection can be nested into the container above it. */
|
|
317
|
+
canNest(): boolean;
|
|
318
|
+
canUnnest(): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Nests the selection into the container right above it (Alt+→) — the
|
|
321
|
+
* keyboard equivalent of dragging a field into a panel.
|
|
322
|
+
*/
|
|
323
|
+
nestSelected(): void;
|
|
324
|
+
/** Moves the selection out of its container, right after it (Alt+←). */
|
|
325
|
+
unnestSelected(): void;
|
|
205
326
|
/** Saves the selected node (with its subtree) as a reusable block. */
|
|
206
327
|
saveAsBlock(): void;
|
|
207
328
|
removeBlock(id: string): void;
|
|
@@ -209,15 +330,15 @@ declare class FormDesignerComponent {
|
|
|
209
330
|
blockIdOf(entry: CatalogEntry): string;
|
|
210
331
|
/** What is being dragged: a palette entry or an existing node. */
|
|
211
332
|
private readonly dragging;
|
|
212
|
-
/** Drop
|
|
333
|
+
/** Drop zone highlighted while hovering (see `dropId`). */
|
|
213
334
|
readonly dropTarget: _angular_core.WritableSignal<string | null>;
|
|
214
335
|
startEntryDrag(entry: CatalogEntry, event: DragEvent): void;
|
|
215
|
-
startNodeDrag(path: NodePath, event
|
|
336
|
+
startNodeDrag(path: NodePath, event?: DragEvent): void;
|
|
216
337
|
endDrag(): void;
|
|
217
|
-
allowDrop(target:
|
|
218
|
-
/** Drops onto `target
|
|
219
|
-
drop(target:
|
|
220
|
-
isDropTarget(
|
|
338
|
+
allowDrop(target: DropTarget, event?: DragEvent): void;
|
|
339
|
+
/** Drops onto `target` — the position (and column) the node should occupy. */
|
|
340
|
+
drop(target: DropTarget, event?: DragEvent): void;
|
|
341
|
+
isDropTarget(target: DropTarget): boolean;
|
|
221
342
|
isDragging(): boolean;
|
|
222
343
|
select(path: NodePath | null): void;
|
|
223
344
|
isSelectedPath(path: NodePath): boolean;
|
|
@@ -225,7 +346,7 @@ declare class FormDesignerComponent {
|
|
|
225
346
|
doImport(raw: string): void;
|
|
226
347
|
onKeydown(event: KeyboardEvent): void;
|
|
227
348
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormDesignerComponent, never>;
|
|
228
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormDesignerComponent, "mform-designer", never, { "schema": { "alias": "schema"; "required": false; "isSignal": true; }; "source": { "alias": "source"; "required": false; "isSignal": true; }; "extraCatalog": { "alias": "extraCatalog"; "required": false; "isSignal": true; }; "blocks": { "alias": "blocks"; "required": false; "isSignal": true; }; }, { "schemaChanged": "schemaChanged"; "blocksChanged": "blocksChanged"; }, never, never, true, never>;
|
|
349
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormDesignerComponent, "mform-designer", never, { "schema": { "alias": "schema"; "required": false; "isSignal": true; }; "source": { "alias": "source"; "required": false; "isSignal": true; }; "extraCatalog": { "alias": "extraCatalog"; "required": false; "isSignal": true; }; "catalogOverride": { "alias": "catalog"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "blocks": { "alias": "blocks"; "required": false; "isSignal": true; }; }, { "schemaChanged": "schemaChanged"; "blocksChanged": "blocksChanged"; }, never, never, true, never>;
|
|
229
350
|
}
|
|
230
351
|
|
|
231
352
|
/**
|
|
@@ -233,13 +354,24 @@ declare class FormDesignerComponent {
|
|
|
233
354
|
* leaf rendering to the RUNTIME `<mform-node>` so what you see is what the
|
|
234
355
|
* renderer will produce. Canvas controls are non-interactive — testing
|
|
235
356
|
* happens in Preview mode.
|
|
357
|
+
*
|
|
358
|
+
* Drop zones sit between children (and inside each column), so fields can be
|
|
359
|
+
* dragged INTO containers, not just reordered at the root.
|
|
236
360
|
*/
|
|
237
361
|
declare class DesignerNodeComponent {
|
|
238
362
|
readonly node: _angular_core.InputSignal<FieldNode>;
|
|
239
363
|
readonly path: _angular_core.InputSignal<NodePath>;
|
|
240
364
|
readonly engine: _angular_core.InputSignal<FormEngine>;
|
|
241
365
|
readonly selected: _angular_core.InputSignal<NodePath | null>;
|
|
366
|
+
/** True while something is being dragged (reveals the drop zones). */
|
|
367
|
+
readonly dragging: _angular_core.InputSignal<boolean>;
|
|
368
|
+
/** Id of the drop zone currently hovered. */
|
|
369
|
+
readonly activeDrop: _angular_core.InputSignal<string | null>;
|
|
242
370
|
readonly selectNode: _angular_core.OutputEmitterRef<NodePath>;
|
|
371
|
+
readonly nodeDragStart: _angular_core.OutputEmitterRef<NodePath>;
|
|
372
|
+
readonly dragOverTarget: _angular_core.OutputEmitterRef<DropTarget>;
|
|
373
|
+
readonly dropOnTarget: _angular_core.OutputEmitterRef<DropTarget>;
|
|
374
|
+
readonly dragFinished: _angular_core.OutputEmitterRef<void>;
|
|
243
375
|
readonly activeTab: _angular_core.WritableSignal<number>;
|
|
244
376
|
container(): ContainerField;
|
|
245
377
|
chip(): string;
|
|
@@ -248,9 +380,13 @@ declare class DesignerNodeComponent {
|
|
|
248
380
|
columnsTemplate(): string;
|
|
249
381
|
onSelect(event: Event): void;
|
|
250
382
|
setTab(index: number, event: Event): void;
|
|
383
|
+
isOver(path: NodePath, column?: number): boolean;
|
|
384
|
+
onDragStart(path: NodePath, event: Event): void;
|
|
385
|
+
onDragOver(path: NodePath, column: number | undefined, event: DragEvent): void;
|
|
386
|
+
onDrop(path: NodePath, column: number | undefined, event: DragEvent): void;
|
|
251
387
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DesignerNodeComponent, never>;
|
|
252
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DesignerNodeComponent, "mform-designer-node", never, { "node": { "alias": "node"; "required": true; "isSignal": true; }; "path": { "alias": "path"; "required": true; "isSignal": true; }; "engine": { "alias": "engine"; "required": true; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; }, { "selectNode": "selectNode"; }, never, never, true, never>;
|
|
388
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DesignerNodeComponent, "mform-designer-node", never, { "node": { "alias": "node"; "required": true; "isSignal": true; }; "path": { "alias": "path"; "required": true; "isSignal": true; }; "engine": { "alias": "engine"; "required": true; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "dragging": { "alias": "dragging"; "required": false; "isSignal": true; }; "activeDrop": { "alias": "activeDrop"; "required": false; "isSignal": true; }; }, { "selectNode": "selectNode"; "nodeDragStart": "nodeDragStart"; "dragOverTarget": "dragOverTarget"; "dropOnTarget": "dropOnTarget"; "dragFinished": "dragFinished"; }, never, never, true, never>;
|
|
253
389
|
}
|
|
254
390
|
|
|
255
|
-
export { DEFAULT_CATALOG, DEFAULT_LAYOUT, DesignerNodeComponent, FormDesignerComponent, InspectorComponent, PANEL_LABELS, WORKSPACE_PRESETS };
|
|
256
|
-
export type { CatalogEntry, CatalogGroup, DockSide, FormBlock, InspectorPatch, PanelId, WorkspaceLayout, WorkspacePreset };
|
|
391
|
+
export { DEFAULT_CATALOG, DEFAULT_LAYOUT, DESIGNER_LABELS_EN, DesignerNodeComponent, FormDesignerComponent, InspectorComponent, PANEL_LABELS, WORKSPACE_PRESETS, dropId };
|
|
392
|
+
export type { CatalogEntry, CatalogGroup, DesignerLabels, DockSide, DropTarget, FormBlock, InspectorPatch, PanelId, WorkspaceLayout, WorkspacePreset };
|