@longhongguo/form-create-ant-design-vue 3.3.16 → 3.3.18
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/tableForm/TableForm.vue +56 -15
- package/src/parsers/index.js +3 -1
- package/src/parsers/tableForm.js +4 -0
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.18",
|
|
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",
|
|
@@ -73,6 +73,10 @@ export default {
|
|
|
73
73
|
headerBackgroundColor: {
|
|
74
74
|
type: String,
|
|
75
75
|
default: ''
|
|
76
|
+
},
|
|
77
|
+
emptyText: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ''
|
|
76
80
|
}
|
|
77
81
|
},
|
|
78
82
|
watch: {
|
|
@@ -95,6 +99,9 @@ export default {
|
|
|
95
99
|
},
|
|
96
100
|
headerBackgroundColor() {
|
|
97
101
|
this.loadRule()
|
|
102
|
+
},
|
|
103
|
+
emptyText() {
|
|
104
|
+
this.updateEmptyRule()
|
|
98
105
|
}
|
|
99
106
|
},
|
|
100
107
|
data() {
|
|
@@ -121,7 +128,11 @@ export default {
|
|
|
121
128
|
props: {
|
|
122
129
|
colspan: this.getEmptyColspan()
|
|
123
130
|
},
|
|
124
|
-
children: [
|
|
131
|
+
children: [
|
|
132
|
+
this.emptyText ||
|
|
133
|
+
this.formCreateInject.t('dataEmpty') ||
|
|
134
|
+
'暂无数据'
|
|
135
|
+
]
|
|
125
136
|
}
|
|
126
137
|
]
|
|
127
138
|
}
|
|
@@ -129,9 +140,11 @@ export default {
|
|
|
129
140
|
},
|
|
130
141
|
methods: {
|
|
131
142
|
getEmptyColspan() {
|
|
132
|
-
return
|
|
133
|
-
|
|
143
|
+
return (
|
|
144
|
+
this.columns.length +
|
|
145
|
+
(this.showIndexColumn ? 1 : 0) +
|
|
134
146
|
(this.showOperationColumn ? (this.formCreateInject.preview ? 0 : 1) : 0)
|
|
147
|
+
)
|
|
135
148
|
},
|
|
136
149
|
formChange() {
|
|
137
150
|
this.updateValue()
|
|
@@ -188,10 +201,32 @@ export default {
|
|
|
188
201
|
})
|
|
189
202
|
this.rule[0].children[1].children = this.trs
|
|
190
203
|
},
|
|
204
|
+
updateEmptyRule() {
|
|
205
|
+
const emptyTextValue =
|
|
206
|
+
this.emptyText || this.formCreateInject.t('dataEmpty') || '暂无数据'
|
|
207
|
+
if (
|
|
208
|
+
this.emptyRule &&
|
|
209
|
+
this.emptyRule.children &&
|
|
210
|
+
this.emptyRule.children[0]
|
|
211
|
+
) {
|
|
212
|
+
this.emptyRule.children[0].children = [emptyTextValue]
|
|
213
|
+
}
|
|
214
|
+
// 更新已经显示的空数据行
|
|
215
|
+
this.trs.forEach((tr) => {
|
|
216
|
+
if (tr._isEmpty && tr.children && tr.children[0]) {
|
|
217
|
+
tr.children[0].children = [emptyTextValue]
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
// 更新规则中的空数据行
|
|
221
|
+
if (this.rule[0] && this.rule[0].children && this.rule[0].children[1]) {
|
|
222
|
+
this.rule[0].children[1].children = this.trs
|
|
223
|
+
}
|
|
224
|
+
},
|
|
191
225
|
addEmpty() {
|
|
192
226
|
if (this.trs.length) {
|
|
193
227
|
this.trs.splice(0, this.trs.length)
|
|
194
228
|
}
|
|
229
|
+
this.updateEmptyRule()
|
|
195
230
|
this.trs.push(this.emptyRule)
|
|
196
231
|
},
|
|
197
232
|
clearEmpty() {
|
|
@@ -250,16 +285,18 @@ export default {
|
|
|
250
285
|
loadRule() {
|
|
251
286
|
const header = []
|
|
252
287
|
let body = []
|
|
253
|
-
|
|
288
|
+
|
|
254
289
|
// 序号列
|
|
255
290
|
if (this.showIndexColumn) {
|
|
256
291
|
header.push({
|
|
257
292
|
type: 'th',
|
|
258
293
|
native: true,
|
|
259
294
|
class: '_fc-tf-head-idx',
|
|
260
|
-
style: this.headerBackgroundColor
|
|
261
|
-
|
|
262
|
-
|
|
295
|
+
style: this.headerBackgroundColor
|
|
296
|
+
? {
|
|
297
|
+
backgroundColor: this.headerBackgroundColor
|
|
298
|
+
}
|
|
299
|
+
: {},
|
|
263
300
|
props: {
|
|
264
301
|
innerText: '#'
|
|
265
302
|
}
|
|
@@ -273,7 +310,7 @@ export default {
|
|
|
273
310
|
}
|
|
274
311
|
})
|
|
275
312
|
}
|
|
276
|
-
|
|
313
|
+
|
|
277
314
|
// 数据列
|
|
278
315
|
this.columns.forEach((column) => {
|
|
279
316
|
header.push({
|
|
@@ -282,9 +319,11 @@ export default {
|
|
|
282
319
|
style: {
|
|
283
320
|
...(column.style || {}),
|
|
284
321
|
textAlign: column.align || 'center',
|
|
285
|
-
...(this.headerBackgroundColor
|
|
286
|
-
|
|
287
|
-
|
|
322
|
+
...(this.headerBackgroundColor
|
|
323
|
+
? {
|
|
324
|
+
backgroundColor: this.headerBackgroundColor
|
|
325
|
+
}
|
|
326
|
+
: {})
|
|
288
327
|
},
|
|
289
328
|
class: column.required ? '_fc-tf-head-required' : '',
|
|
290
329
|
props: {
|
|
@@ -297,16 +336,18 @@ export default {
|
|
|
297
336
|
children: [...(column.rule || [])]
|
|
298
337
|
})
|
|
299
338
|
})
|
|
300
|
-
|
|
339
|
+
|
|
301
340
|
// 操作列
|
|
302
341
|
if (this.showOperationColumn) {
|
|
303
342
|
header.push({
|
|
304
343
|
type: 'th',
|
|
305
344
|
native: true,
|
|
306
345
|
class: '_fc-tf-edit fc-clock',
|
|
307
|
-
style: this.headerBackgroundColor
|
|
308
|
-
|
|
309
|
-
|
|
346
|
+
style: this.headerBackgroundColor
|
|
347
|
+
? {
|
|
348
|
+
backgroundColor: this.headerBackgroundColor
|
|
349
|
+
}
|
|
350
|
+
: {},
|
|
310
351
|
props: {
|
|
311
352
|
innerText: this.formCreateInject.t('operation') || '操作'
|
|
312
353
|
}
|
package/src/parsers/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import div from './div'
|
|
|
20
20
|
import alert from './alert'
|
|
21
21
|
import card from './card'
|
|
22
22
|
import accTable from './accTable'
|
|
23
|
+
import tableForm from './tableForm'
|
|
23
24
|
|
|
24
25
|
export default [
|
|
25
26
|
checkbox,
|
|
@@ -43,5 +44,6 @@ export default [
|
|
|
43
44
|
div,
|
|
44
45
|
alert,
|
|
45
46
|
card,
|
|
46
|
-
accTable
|
|
47
|
+
accTable,
|
|
48
|
+
tableForm
|
|
47
49
|
]
|