@longhongguo/form-create-ant-design-vue 3.3.15 → 3.3.16
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/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.16",
|
|
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",
|
|
@@ -61,7 +61,19 @@ export default {
|
|
|
61
61
|
},
|
|
62
62
|
min: Number,
|
|
63
63
|
max: Number,
|
|
64
|
-
disabled: Boolean
|
|
64
|
+
disabled: Boolean,
|
|
65
|
+
showIndexColumn: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: true
|
|
68
|
+
},
|
|
69
|
+
showOperationColumn: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: true
|
|
72
|
+
},
|
|
73
|
+
headerBackgroundColor: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: ''
|
|
76
|
+
}
|
|
65
77
|
},
|
|
66
78
|
watch: {
|
|
67
79
|
modelValue: {
|
|
@@ -71,8 +83,18 @@ export default {
|
|
|
71
83
|
deep: true
|
|
72
84
|
},
|
|
73
85
|
'formCreateInject.preview': function (n) {
|
|
74
|
-
this.emptyRule.children[0].props.colspan =
|
|
75
|
-
|
|
86
|
+
this.emptyRule.children[0].props.colspan = this.getEmptyColspan()
|
|
87
|
+
},
|
|
88
|
+
showIndexColumn() {
|
|
89
|
+
this.loadRule()
|
|
90
|
+
this.updateTable()
|
|
91
|
+
},
|
|
92
|
+
showOperationColumn() {
|
|
93
|
+
this.loadRule()
|
|
94
|
+
this.updateTable()
|
|
95
|
+
},
|
|
96
|
+
headerBackgroundColor() {
|
|
97
|
+
this.loadRule()
|
|
76
98
|
}
|
|
77
99
|
},
|
|
78
100
|
data() {
|
|
@@ -97,8 +119,7 @@ export default {
|
|
|
97
119
|
native: true,
|
|
98
120
|
subRule: true,
|
|
99
121
|
props: {
|
|
100
|
-
colspan:
|
|
101
|
-
this.columns.length + (this.formCreateInject.preview ? 1 : 2)
|
|
122
|
+
colspan: this.getEmptyColspan()
|
|
102
123
|
},
|
|
103
124
|
children: [this.formCreateInject.t('dataEmpty') || '暂无数据']
|
|
104
125
|
}
|
|
@@ -107,6 +128,11 @@ export default {
|
|
|
107
128
|
}
|
|
108
129
|
},
|
|
109
130
|
methods: {
|
|
131
|
+
getEmptyColspan() {
|
|
132
|
+
return this.columns.length +
|
|
133
|
+
(this.showIndexColumn ? 1 : 0) +
|
|
134
|
+
(this.showOperationColumn ? (this.formCreateInject.preview ? 0 : 1) : 0)
|
|
135
|
+
},
|
|
110
136
|
formChange() {
|
|
111
137
|
this.updateValue()
|
|
112
138
|
},
|
|
@@ -207,39 +233,58 @@ export default {
|
|
|
207
233
|
},
|
|
208
234
|
updateRaw(tr) {
|
|
209
235
|
const idx = this.trs.indexOf(tr)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
236
|
+
// 更新序号列
|
|
237
|
+
if (this.showIndexColumn && tr.children[0]) {
|
|
238
|
+
tr.children[0].props.innerText = idx + 1
|
|
239
|
+
}
|
|
240
|
+
// 更新操作列的删除按钮
|
|
241
|
+
if (this.showOperationColumn && tr.children[tr.children.length - 1]) {
|
|
242
|
+
const operationCell = tr.children[tr.children.length - 1]
|
|
243
|
+
if (operationCell.children && operationCell.children[0]) {
|
|
244
|
+
operationCell.children[0].props.onClick = () => {
|
|
245
|
+
this.delRaw(idx)
|
|
246
|
+
}
|
|
247
|
+
}
|
|
213
248
|
}
|
|
214
249
|
},
|
|
215
250
|
loadRule() {
|
|
216
|
-
const header = [
|
|
217
|
-
|
|
251
|
+
const header = []
|
|
252
|
+
let body = []
|
|
253
|
+
|
|
254
|
+
// 序号列
|
|
255
|
+
if (this.showIndexColumn) {
|
|
256
|
+
header.push({
|
|
218
257
|
type: 'th',
|
|
219
258
|
native: true,
|
|
220
259
|
class: '_fc-tf-head-idx',
|
|
260
|
+
style: this.headerBackgroundColor ? {
|
|
261
|
+
backgroundColor: this.headerBackgroundColor
|
|
262
|
+
} : {},
|
|
221
263
|
props: {
|
|
222
264
|
innerText: '#'
|
|
223
265
|
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
let body = [
|
|
227
|
-
{
|
|
266
|
+
})
|
|
267
|
+
body.push({
|
|
228
268
|
type: 'td',
|
|
229
269
|
class: '_fc-tf-idx',
|
|
230
270
|
native: true,
|
|
231
271
|
props: {
|
|
232
272
|
innerText: '0'
|
|
233
273
|
}
|
|
234
|
-
}
|
|
235
|
-
|
|
274
|
+
})
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// 数据列
|
|
236
278
|
this.columns.forEach((column) => {
|
|
237
279
|
header.push({
|
|
238
280
|
type: 'th',
|
|
239
281
|
native: true,
|
|
240
282
|
style: {
|
|
241
283
|
...(column.style || {}),
|
|
242
|
-
textAlign: column.align || 'center'
|
|
284
|
+
textAlign: column.align || 'center',
|
|
285
|
+
...(this.headerBackgroundColor ? {
|
|
286
|
+
backgroundColor: this.headerBackgroundColor
|
|
287
|
+
} : {})
|
|
243
288
|
},
|
|
244
289
|
class: column.required ? '_fc-tf-head-required' : '',
|
|
245
290
|
props: {
|
|
@@ -252,27 +297,34 @@ export default {
|
|
|
252
297
|
children: [...(column.rule || [])]
|
|
253
298
|
})
|
|
254
299
|
})
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
children: [
|
|
268
|
-
{
|
|
269
|
-
type: 'i',
|
|
270
|
-
native: true,
|
|
271
|
-
class: 'fc-icon icon-delete',
|
|
272
|
-
props: {}
|
|
300
|
+
|
|
301
|
+
// 操作列
|
|
302
|
+
if (this.showOperationColumn) {
|
|
303
|
+
header.push({
|
|
304
|
+
type: 'th',
|
|
305
|
+
native: true,
|
|
306
|
+
class: '_fc-tf-edit fc-clock',
|
|
307
|
+
style: this.headerBackgroundColor ? {
|
|
308
|
+
backgroundColor: this.headerBackgroundColor
|
|
309
|
+
} : {},
|
|
310
|
+
props: {
|
|
311
|
+
innerText: this.formCreateInject.t('operation') || '操作'
|
|
273
312
|
}
|
|
274
|
-
|
|
275
|
-
|
|
313
|
+
})
|
|
314
|
+
body.push({
|
|
315
|
+
type: 'td',
|
|
316
|
+
native: true,
|
|
317
|
+
class: '_fc-tf-btn fc-clock',
|
|
318
|
+
children: [
|
|
319
|
+
{
|
|
320
|
+
type: 'i',
|
|
321
|
+
native: true,
|
|
322
|
+
class: 'fc-icon icon-delete',
|
|
323
|
+
props: {}
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
})
|
|
327
|
+
}
|
|
276
328
|
this.copyTrs = this.formCreateInject.form.toJson([
|
|
277
329
|
{
|
|
278
330
|
type: 'tr',
|