@longhongguo/form-create-ant-design-vue 3.3.38 → 3.3.39
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/form-create.esm.js +2 -2
- package/dist/form-create.esm.js.map +1 -1
- package/dist/form-create.js +2 -2
- package/dist/form-create.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FcEditorWrapper.vue +18 -8
- package/src/components/tableForm/TableForm.vue +23 -1
- package/src/parsers/checkbox.js +9 -9
- package/src/parsers/radio.js +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longhongguo/form-create-ant-design-vue",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.39",
|
|
4
4
|
"description": "AntDesignVue版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。",
|
|
5
5
|
"main": "./dist/form-create.min.js",
|
|
6
6
|
"module": "./dist/form-create.esm.js",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="fc-editor-wrapper"
|
|
4
|
+
:class="{ 'fc-editor-preview': isPreviewOrReadOnly }"
|
|
5
|
+
>
|
|
3
6
|
<!-- 只读/预览模式:直接用 v-html 渲染,并添加图片点击监听 -->
|
|
4
7
|
<div
|
|
5
8
|
v-if="readOnly"
|
|
@@ -8,14 +11,14 @@
|
|
|
8
11
|
v-html="modelValue"
|
|
9
12
|
></div>
|
|
10
13
|
<!-- 编辑模式:使用富文本编辑器 -->
|
|
11
|
-
|
|
14
|
+
<FcEditor
|
|
12
15
|
v-else
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
:model-value="modelValue"
|
|
17
|
+
:disabled="disabled"
|
|
18
|
+
:config="editorConfig"
|
|
19
|
+
:init="initEditor"
|
|
20
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
21
|
+
/>
|
|
19
22
|
</div>
|
|
20
23
|
</template>
|
|
21
24
|
|
|
@@ -87,6 +90,9 @@ export default defineComponent({
|
|
|
87
90
|
}
|
|
88
91
|
},
|
|
89
92
|
computed: {
|
|
93
|
+
isPreviewOrReadOnly() {
|
|
94
|
+
return this.readOnly || this.formCreateInject?.preview === true
|
|
95
|
+
},
|
|
90
96
|
editorConfig() {
|
|
91
97
|
const config = {}
|
|
92
98
|
|
|
@@ -1234,6 +1240,10 @@ export default defineComponent({
|
|
|
1234
1240
|
width: 100%;
|
|
1235
1241
|
}
|
|
1236
1242
|
|
|
1243
|
+
.fc-editor-wrapper.fc-editor-preview {
|
|
1244
|
+
height: auto !important;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1237
1247
|
.fc-editor-readonly {
|
|
1238
1248
|
padding: 0 10px;
|
|
1239
1249
|
border-radius: 4px;
|
|
@@ -314,6 +314,7 @@ export default {
|
|
|
314
314
|
},
|
|
315
315
|
updateRaw(tr) {
|
|
316
316
|
const idx = this.trs.indexOf(tr)
|
|
317
|
+
const rowData = this.modelValue[idx] || {}
|
|
317
318
|
let colOffset = 0
|
|
318
319
|
|
|
319
320
|
// 更新序号列
|
|
@@ -326,7 +327,6 @@ export default {
|
|
|
326
327
|
if (this.showSelectColumn && tr.children[colOffset]) {
|
|
327
328
|
const selectCell = tr.children[colOffset]
|
|
328
329
|
// 从数据对象中读取选中状态
|
|
329
|
-
const rowData = this.modelValue[idx]
|
|
330
330
|
const isSelected = rowData && rowData[this.selectField] === true
|
|
331
331
|
if (selectCell.children && selectCell.children[0]) {
|
|
332
332
|
const checkbox = selectCell.children[0]
|
|
@@ -352,6 +352,28 @@ export default {
|
|
|
352
352
|
colOffset++
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
+
// 更新数据列的动态 options(如 checkbox)
|
|
356
|
+
this.columns.forEach((column, colIdx) => {
|
|
357
|
+
const cellIdx = colOffset + colIdx
|
|
358
|
+
if (tr.children[cellIdx] && tr.children[cellIdx].children) {
|
|
359
|
+
const cellChildren = tr.children[cellIdx].children
|
|
360
|
+
// 查找 checkbox 类型的规则
|
|
361
|
+
const checkboxRule = cellChildren.find((rule) => rule.type === 'checkbox')
|
|
362
|
+
if (checkboxRule && column.optionsFn && typeof column.optionsFn === 'function') {
|
|
363
|
+
// 调用 optionsFn 获取该行的 options
|
|
364
|
+
const dynamicOptions = column.optionsFn(rowData, idx)
|
|
365
|
+
if (Array.isArray(dynamicOptions)) {
|
|
366
|
+
// 更新 checkbox 规则的 options
|
|
367
|
+
checkboxRule.options = dynamicOptions
|
|
368
|
+
// 如果 checkbox 的 props 中有 options,也更新它
|
|
369
|
+
if (checkboxRule.props) {
|
|
370
|
+
checkboxRule.props.options = dynamicOptions
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
|
|
355
377
|
// 更新操作列的删除按钮
|
|
356
378
|
if (this.showOperationColumn && tr.children[tr.children.length - 1]) {
|
|
357
379
|
const operationCell = tr.children[tr.children.length - 1]
|
package/src/parsers/checkbox.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {hasProperty} from '@form-create/utils/lib/type'
|
|
1
|
+
import { hasProperty } from '@form-create/utils/lib/type'
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
4
|
+
name: 'checkbox',
|
|
5
|
+
modelField: 'value',
|
|
6
|
+
mergeProp(ctx) {
|
|
7
|
+
const props = ctx.prop.props
|
|
8
|
+
if (!hasProperty(props, 'options')) props.options = ctx.prop.options || []
|
|
9
|
+
// Ant Design Vue 的 CheckboxGroup 支持在 options 数组中通过 disabled 属性禁用选项
|
|
10
|
+
// 例如: [{ label: '选项1', value: 1, disabled: true }, { label: '选项2', value: 2, disabled: false }]
|
|
11
|
+
}
|
|
12
12
|
}
|
package/src/parsers/radio.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import checkbox from './checkbox';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
...checkbox,
|
|
4
|
+
...checkbox,
|
|
5
|
+
name: 'radio'
|
|
6
|
+
// Ant Design Vue 的 RadioGroup 同样支持在 options 数组中通过 disabled 属性禁用选项
|
|
7
|
+
// 例如: [{ label: '选项A', value: 'A', disabled: true }, { label: '选项B', value: 'B', disabled: false }]
|
|
5
8
|
};
|