@jxyszb/jxy-form-designer 0.1.0 → 0.2.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ - 保存草稿和发布按钮支持独立名称与显示配置。
6
+ - `JXYFormDesigner` 新增 `save-draft`、`publish`、`publish-invalid` 事件,由宿主负责持久化和接口调用。
7
+ - Designer 默认不再读取固定 localStorage 草稿,旧持久化方法保留为废弃兼容 API。
8
+ - Playground 增加本地草稿和模拟后端发布参考实现。
9
+
3
10
  ## 0.1.0
4
11
 
5
12
  - 首次拆分 JXY Form Designer、Runtime、Schema、Store 和扩展字段。
package/README.md CHANGED
@@ -64,21 +64,47 @@ import {
64
64
  createDefaultSchema
65
65
  } from '@jxyszb/jxy-form-designer';
66
66
 
67
+ const designerRef = ref();
67
68
  const schema = ref(createDefaultSchema());
68
69
  const formData = ref({});
70
+
71
+ function handleSaveDraft({ schema: draftSchema }) {
72
+ localStorage.setItem('business-form-draft', JSON.stringify(draftSchema));
73
+ }
74
+
75
+ async function handlePublish({ schema: publishedSchema, warnings }) {
76
+ await publishFormSchema(publishedSchema);
77
+ console.log('publish warnings', warnings);
78
+ }
79
+
80
+ function handlePublishInvalid({ errors }) {
81
+ console.warn('schema cannot be published', errors);
82
+ }
69
83
  </script>
70
84
 
71
85
  <template>
72
- <JXYFormDesigner />
86
+ <JXYFormDesigner
87
+ ref="designerRef"
88
+ save-draft-button-label="保存草稿"
89
+ :show-save-draft-button="true"
90
+ publish-button-label="发布"
91
+ :show-publish-button="true"
92
+ @save-draft="handleSaveDraft"
93
+ @publish="handlePublish"
94
+ @publish-invalid="handlePublishInvalid"
95
+ />
73
96
  <JXYFormRuntime v-model="formData" :schema="schema" />
74
97
  </template>
75
98
  ```
76
99
 
100
+ 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.
101
+
77
102
  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
103
 
79
104
  ## Documentation
80
105
 
81
- - [Field suffix extension](docs/field-suffix-extension.md)
106
+ - [Field suffix extension](<docs/JXY 表单字段右侧扩展位使用说明.md>)
107
+ - [Designer developer guide](docs/designer-save-publish-events.md)
82
108
 
83
109
  ## License
84
110