@jxyszb/jxy-form-designer 0.1.0 → 0.3.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/CHANGELOG.md +17 -0
- package/README.md +43 -3
- package/dist/chunks/RuntimePreviewPanel-6605e01d.js +2062 -0
- package/dist/chunks/{compositeField-98c1b192.js → compositeField-8dbe7d66.js} +180 -165
- package/dist/designer.js +1653 -1521
- package/dist/index.js +36 -28
- package/dist/runtime.js +2 -2
- package/dist/schema.js +196 -161
- package/dist/style.css +1 -1
- package/dist/testing.js +61 -38
- package/docs/JXY Form Designer /345/274/200/345/217/221/350/200/205/350/257/264/346/230/216.md" +276 -0
- package/package.json +7 -2
- package/types/designer.d.ts +4 -0
- package/types/index.d.ts +55 -3
- package/types/schema.d.ts +4 -0
- package/dist/chunks/RuntimePreviewPanel-3704c8f8.js +0 -1991
- /package/docs/{field-suffix-extension.md → JXY /350/241/250/345/215/225/345/255/227/346/256/265/345/217/263/344/276/247/346/211/251/345/261/225/344/275/215/344/275/277/347/224/250/350/257/264/346/230/216.md"} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.3.0 - 2026-10-16
|
|
6
|
+
|
|
7
|
+
- Schema 升级为 1.4.0,兼容迁移 1.0.0 至 1.3.0。
|
|
8
|
+
- 普通上传增加按需模板下载,支持独立模板数据源、实时参数和宿主下载适配。
|
|
9
|
+
- provider 增加可选 downloadTemplate,预览通过 mock 展示下载信息。
|
|
10
|
+
- 数据源和字段选择支持搜索;字段选项同时展示中文标题与 prop。
|
|
11
|
+
- 模板引用纳入类型校验、删除清理、导入 ID 重映射和 Undo/Redo。
|
|
12
|
+
|
|
13
|
+
## 0.2.0
|
|
14
|
+
|
|
15
|
+
- 保存草稿和发布按钮支持独立名称与显示配置。
|
|
16
|
+
- `JXYFormDesigner` 新增 `save-draft`、`publish`、`publish-invalid` 事件,由宿主负责持久化和接口调用。
|
|
17
|
+
- Designer 默认不再读取固定 localStorage 草稿,旧持久化方法保留为废弃兼容 API。
|
|
18
|
+
- Playground 增加本地草稿和模拟后端发布参考实现。
|
|
19
|
+
|
|
3
20
|
## 0.1.0
|
|
4
21
|
|
|
5
22
|
- 首次拆分 JXY Form Designer、Runtime、Schema、Store 和扩展字段。
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A schema-driven form designer and runtime for Vue 3, Pinia, and Element Plus.
|
|
|
6
6
|
|
|
7
7
|
- Drag-and-drop form design with fields, titles, and grid layouts.
|
|
8
8
|
- Runtime rendering from JSON Schema.
|
|
9
|
-
- Static, dictionary, and
|
|
9
|
+
- Static, dictionary, API, and on-demand template-download data sources.
|
|
10
10
|
- Validation, field reactions, import/export, and preview.
|
|
11
11
|
- Host adapters for request clients, file upload, rich-text editors, and custom fields.
|
|
12
12
|
|
|
@@ -46,6 +46,9 @@ Dynamic data sources, uploads, and rich-text fields can use host adapters:
|
|
|
46
46
|
```js
|
|
47
47
|
app.use(createJxyFormPlugin({
|
|
48
48
|
request: requestClient,
|
|
49
|
+
// JXY framework example: keep the method receiver so its internal this remains valid.
|
|
50
|
+
downloadFile: (url, params, fileName) =>
|
|
51
|
+
app.config.globalProperties.$custom.downFile(params, fileName, url),
|
|
49
52
|
components: {
|
|
50
53
|
fileUpload: FileUpload,
|
|
51
54
|
editor: RichTextEditor
|
|
@@ -64,21 +67,58 @@ import {
|
|
|
64
67
|
createDefaultSchema
|
|
65
68
|
} from '@jxyszb/jxy-form-designer';
|
|
66
69
|
|
|
70
|
+
const designerRef = ref();
|
|
67
71
|
const schema = ref(createDefaultSchema());
|
|
68
72
|
const formData = ref({});
|
|
73
|
+
|
|
74
|
+
function handleSaveDraft({ schema: draftSchema }) {
|
|
75
|
+
localStorage.setItem('business-form-draft', JSON.stringify(draftSchema));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function handlePublish({ schema: publishedSchema, warnings }) {
|
|
79
|
+
await publishFormSchema(publishedSchema);
|
|
80
|
+
console.log('publish warnings', warnings);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function handlePublishInvalid({ errors }) {
|
|
84
|
+
console.warn('schema cannot be published', errors);
|
|
85
|
+
}
|
|
69
86
|
</script>
|
|
70
87
|
|
|
71
88
|
<template>
|
|
72
|
-
<JXYFormDesigner
|
|
89
|
+
<JXYFormDesigner
|
|
90
|
+
ref="designerRef"
|
|
91
|
+
save-draft-button-label="保存草稿"
|
|
92
|
+
:show-save-draft-button="true"
|
|
93
|
+
publish-button-label="发布"
|
|
94
|
+
:show-publish-button="true"
|
|
95
|
+
@save-draft="handleSaveDraft"
|
|
96
|
+
@publish="handlePublish"
|
|
97
|
+
@publish-invalid="handlePublishInvalid"
|
|
98
|
+
/>
|
|
73
99
|
<JXYFormRuntime v-model="formData" :schema="schema" />
|
|
74
100
|
</template>
|
|
75
101
|
```
|
|
76
102
|
|
|
103
|
+
Designer emits independent, normalized Schema snapshots. It does not persist drafts or published schemas by default. Publish validation remains inside the package; the host owns storage, API calls, loading, and result messages.
|
|
104
|
+
|
|
77
105
|
Schema utilities are also available from `@jxyszb/jxy-form-designer/schema`. The `testing` subpath contains demo and mock helpers and should not be used by production code.
|
|
78
106
|
|
|
79
107
|
## Documentation
|
|
80
108
|
|
|
81
|
-
|
|
109
|
+
Normal upload fields (`file`) support a template download button:
|
|
110
|
+
|
|
111
|
+
1. Add a `templateDownload` data source with a relative `url`, `params`, and optional `fileName`.
|
|
112
|
+
2. Enable template download in the field properties and select that source.
|
|
113
|
+
3. Provide `downloadFile` through the plugin, or `downloadTemplate(url, params, fileName)` through a custom provider.
|
|
114
|
+
|
|
115
|
+
The button appears after the upload component and only requests on click. Required parameters use current form values. A configured file name overrides the backend name; leave it empty to use the host downloader's response-header handling. Global form disabled/view mode hides the button; individual field disabled states do not. Existing synchronous JXY download utilities are supported without download loading or duplicate-click protection.
|
|
116
|
+
|
|
117
|
+
An explicit Runtime provider overrides the plugin provider entirely. Preview providers must implement `downloadTemplate`; the included mock displays request details and never downloads a real file. Upgrade Runtime before publishing Schema `jxy-form-schema@1.4.0`.
|
|
118
|
+
|
|
119
|
+
- [Field suffix extension](<docs/JXY 表单字段右侧扩展位使用说明.md>)
|
|
120
|
+
- [Designer configuration and template downloads](<docs/JXY Form Designer 开发者说明.md>)
|
|
121
|
+
- [Designer developer guide](docs/designer-save-publish-events.md)
|
|
82
122
|
|
|
83
123
|
## License
|
|
84
124
|
|