@zeng-alt/formkit-form-builder 1.0.0 → 1.1.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 +47 -0
- package/dist/builder.css +1 -1
- package/dist/builder.es.js +33941 -27233
- package/dist/builder.umd.js +81 -41
- package/dist/index.d.ts +82 -18
- package/package.json +32 -19
package/README.md
CHANGED
|
@@ -141,6 +141,7 @@ import {
|
|
|
141
141
|
FormBuilderProvider, // BuilderProvider alias
|
|
142
142
|
BuilderProvider, // Global config provider
|
|
143
143
|
BuilderPreview, // Reusable preview modal component
|
|
144
|
+
FormDefinitionPreview, // Standalone split preview: form left, live data right
|
|
144
145
|
FormRenderer, // Form rendering component (renamed from FormSchemaRenderer)
|
|
145
146
|
FormSchemaRenderer, // @deprecated use FormRenderer
|
|
146
147
|
FormBuilderPlugin, // One-step plugin
|
|
@@ -240,6 +241,52 @@ import {
|
|
|
240
241
|
|
|
241
242
|
---
|
|
242
243
|
|
|
244
|
+
### Preview Components
|
|
245
|
+
|
|
246
|
+
Two ready-made preview components reuse `FormRenderer` internally to fill and test a form in a modal dialog (naive-ui `n-modal` + `n-scrollbar`). Both render the produced FormKit schema into a truly interactive, submittable form.
|
|
247
|
+
|
|
248
|
+
| Component | Internal renderer | Layout |
|
|
249
|
+
|-----------|-------------------|--------|
|
|
250
|
+
| `BuilderPreview` | `FormSchemaRenderer` | Single form; optional data panel below |
|
|
251
|
+
| `FormDefinitionPreview` | `FormSchemaRenderer` | Split view: form on the left, live form data on the right |
|
|
252
|
+
|
|
253
|
+
Both expose `open` / `close` methods via `defineExpose`, and emit `update:show` + `submit` (`formData, id?, version?`).
|
|
254
|
+
|
|
255
|
+
#### BuilderPreview Props
|
|
256
|
+
|
|
257
|
+
| Prop | Type | Default | Description |
|
|
258
|
+
|------|------|---------|-------------|
|
|
259
|
+
| `show` | `boolean` | - | Modal visibility; a `v-model:show` two-way binding |
|
|
260
|
+
| `schema` | `FormKitSchemaFormKit[]` | - | Raw schema to preview; if omitted, built from the current `FormDefinition` via `dslToSchema` |
|
|
261
|
+
| `title` | `string` | i18n: 表单预览 | Modal title |
|
|
262
|
+
| `description` | `string` | i18n: 预览表单并测试其功能 | Header subtitle |
|
|
263
|
+
| `showDataPanel` | `boolean` | `true` | Show the live form-data panel below the form |
|
|
264
|
+
| `initialData` | `Record<string, unknown>` | `{}` | Initial form data |
|
|
265
|
+
| `view` | `CanvasView` | Canvas state | Desktop / tablet / mobile preview container width |
|
|
266
|
+
| `actions` | `boolean` | `false` | Render default action bar (submit/reset) |
|
|
267
|
+
| `formClass` | `string` | `'w-full !grid !grid-cols-12 gap-x-4 gap-y-2'` | Form root element class |
|
|
268
|
+
| `interactiveContainers` | `boolean` | `true` | Enable list/card/group/tabs interactive add/remove rows |
|
|
269
|
+
| `resetOnSubmit` | `boolean` | `true` | Reset form data after submit |
|
|
270
|
+
|
|
271
|
+
#### FormDefinitionPreview Props
|
|
272
|
+
|
|
273
|
+
| Prop | Type | Default | Description |
|
|
274
|
+
|------|------|---------|-------------|
|
|
275
|
+
| `show` | `boolean` | - | Modal visibility; a `v-model` two-way binding |
|
|
276
|
+
| `formDefinition` | `FormDefinition` | required | Versioned DSL form definition (result of the designer export), converted via `dslToSchema` internally |
|
|
277
|
+
| `title` | `string` | `''` | Modal title |
|
|
278
|
+
| `initialData` | `Record<string, unknown>` | `{}` | Initial form data |
|
|
279
|
+
| `actions` | `boolean` | `false` | Render the default action bar (submit/reset) |
|
|
280
|
+
| `formClass` | `string` | `'w-full !grid !grid-cols-12 gap-x-4 gap-y-2'` | Form root element class |
|
|
281
|
+
| `interactiveContainers` | `boolean` | `true` | Enable interactive containers |
|
|
282
|
+
| `showDataPanel` | `boolean` | `true` | Show the right-side live data panel |
|
|
283
|
+
| `dataPanelWidth` | `string` | `'320px'` | Right data panel width |
|
|
284
|
+
| `resetOnSubmit` | `boolean` | `true` | Reset form data after submit |
|
|
285
|
+
|
|
286
|
+
`FormDefinitionPreview` additionally exposes a `reset` method. Both read the running locale / theme from the enclosing `BuilderProvider` / `FormBuilder`.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
243
290
|
### FormBuilderConfig
|
|
244
291
|
|
|
245
292
|
```ts
|