tianheng-ui 0.0.37 → 0.0.40

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.
Files changed (36) hide show
  1. package/lib/iconfont.eot +0 -0
  2. package/lib/iconfont.svg +155 -0
  3. package/lib/iconfont.ttf +0 -0
  4. package/lib/iconfont.woff +0 -0
  5. package/lib/index.js +5 -2
  6. package/lib/tianheng-ui.js +34 -1
  7. package/lib/tianheng-ui.js.map +1 -1
  8. package/package.json +8 -2
  9. package/packages/formMaking/Container.vue +592 -0
  10. package/packages/formMaking/CusDialog.vue +134 -0
  11. package/packages/formMaking/FormConfig.vue +31 -0
  12. package/packages/formMaking/GenerateForm.vue +184 -0
  13. package/packages/formMaking/GenerateFormItem.vue +266 -0
  14. package/packages/formMaking/Upload/index.vue +451 -0
  15. package/packages/formMaking/WidgetConfig.vue +498 -0
  16. package/packages/formMaking/WidgetForm.vue +217 -0
  17. package/packages/formMaking/WidgetFormItem.vue +284 -0
  18. package/packages/formMaking/componentsConfig.js +313 -0
  19. package/packages/formMaking/generateCode.js +155 -0
  20. package/packages/formMaking/iconfont/demo.css +539 -0
  21. package/packages/formMaking/iconfont/demo_index.html +1159 -0
  22. package/packages/formMaking/iconfont/iconfont.css +189 -0
  23. package/packages/formMaking/iconfont/iconfont.eot +0 -0
  24. package/packages/formMaking/iconfont/iconfont.js +1 -0
  25. package/packages/formMaking/iconfont/iconfont.svg +155 -0
  26. package/packages/formMaking/iconfont/iconfont.ttf +0 -0
  27. package/packages/formMaking/iconfont/iconfont.woff +0 -0
  28. package/packages/formMaking/iconfont/iconfont.woff2 +0 -0
  29. package/packages/formMaking/index.js +79 -0
  30. package/packages/formMaking/lang/en-US.js +187 -0
  31. package/packages/formMaking/lang/zh-CN.js +187 -0
  32. package/packages/formMaking/styles/cover.scss +41 -0
  33. package/packages/formMaking/styles/index.scss +746 -0
  34. package/packages/formMaking/util/index.js +33 -0
  35. package/packages/formMaking/util/request.js +28 -0
  36. package/packages/table/action.vue +3 -3
@@ -0,0 +1,313 @@
1
+ export const basicComponents = [
2
+ {
3
+ type: 'input',
4
+ icon: 'icon-input',
5
+ options: {
6
+ width: '100%',
7
+ defaultValue: '',
8
+ required: false,
9
+ dataType: 'string',
10
+ pattern: '',
11
+ placeholder: '',
12
+ disabled: false,
13
+ maxlength: -1,
14
+ showWordLimit: false,
15
+ }
16
+ },
17
+ {
18
+ type: 'textarea',
19
+ icon: 'icon-diy-com-textarea',
20
+ options: {
21
+ width: '100%',
22
+ defaultValue: '',
23
+ required: false,
24
+ disabled: false,
25
+ pattern: '',
26
+ placeholder: '',
27
+ maxlength: -1,
28
+ showWordLimit: false,
29
+ }
30
+ },
31
+ {
32
+ type: 'number',
33
+ icon: 'icon-number',
34
+ options: {
35
+ width: '',
36
+ required: false,
37
+ defaultValue: 0,
38
+ min: '',
39
+ max: '',
40
+ step: 1,
41
+ disabled: false,
42
+ controlsPosition: ''
43
+ }
44
+ },
45
+ {
46
+ type: 'radio',
47
+ icon: 'icon-radio-active',
48
+ options: {
49
+ inline: false,
50
+ defaultValue: '',
51
+ showLabel: false,
52
+ options: [
53
+ {
54
+ value: 'Option 1',
55
+ label: 'Option 1'
56
+ },
57
+ {
58
+ value: 'Option 2',
59
+ label: 'Option 2'
60
+ },
61
+ {
62
+ value: 'Option 3',
63
+ label: 'Option 3'
64
+ }
65
+ ],
66
+ required: false,
67
+ width: '',
68
+ remote: false,
69
+ remoteOptions: [],
70
+ props: {
71
+ value: 'value',
72
+ label: 'label'
73
+ },
74
+ remoteFunc: '',
75
+ disabled: false,
76
+ }
77
+ },
78
+ {
79
+ type: 'checkbox',
80
+ icon: 'icon-check-box',
81
+ options: {
82
+ inline: false,
83
+ defaultValue: [],
84
+ showLabel: false,
85
+ options: [
86
+ {
87
+ value: 'Option 1'
88
+ },
89
+ {
90
+ value: 'Option 2'
91
+ },
92
+ {
93
+ value: 'Option 3'
94
+ }
95
+ ],
96
+ required: false,
97
+ width: '',
98
+ remote: false,
99
+ remoteOptions: [],
100
+ props: {
101
+ value: 'value',
102
+ label: 'label'
103
+ },
104
+ remoteFunc: '',
105
+ disabled: false,
106
+ }
107
+ },
108
+ {
109
+ type: 'time',
110
+ icon: 'icon-time',
111
+ options: {
112
+ defaultValue: '21:19:56',
113
+ readonly: false,
114
+ disabled: false,
115
+ editable: true,
116
+ clearable: true,
117
+ placeholder: '',
118
+ startPlaceholder: '',
119
+ endPlaceholder: '',
120
+ isRange: false,
121
+ arrowControl: true,
122
+ format: 'HH:mm:ss',
123
+ required: false,
124
+ width: '',
125
+ }
126
+ },
127
+ {
128
+ type: 'date',
129
+ icon: 'icon-date',
130
+ options: {
131
+ defaultValue: '',
132
+ readonly: false,
133
+ disabled: false,
134
+ editable: true,
135
+ clearable: true,
136
+ placeholder: '',
137
+ startPlaceholder: '',
138
+ endPlaceholder: '',
139
+ type: 'date',
140
+ format: 'yyyy-MM-dd',
141
+ timestamp: false,
142
+ required: false,
143
+ width: '',
144
+ }
145
+ },
146
+ {
147
+ type: 'rate',
148
+ icon: 'icon-pingfen1',
149
+ options: {
150
+ defaultValue: null,
151
+ max: 5,
152
+ disabled: false,
153
+ allowHalf: false,
154
+ required: false
155
+ }
156
+ },
157
+ {
158
+ type: 'color',
159
+ icon: 'icon-color',
160
+ options: {
161
+ defaultValue: '',
162
+ disabled: false,
163
+ showAlpha: false,
164
+ required: false
165
+ }
166
+ },
167
+ {
168
+ type: 'select',
169
+ icon: 'icon-select',
170
+ options: {
171
+ defaultValue: '',
172
+ multiple: false,
173
+ disabled: false,
174
+ clearable: false,
175
+ placeholder: '',
176
+ required: false,
177
+ showLabel: false,
178
+ width: '',
179
+ options: [
180
+ {
181
+ value: 'Option 1'
182
+ },
183
+ {
184
+ value: 'Option 2'
185
+ },{
186
+ value: 'Option 3'
187
+ }
188
+ ],
189
+ remote: false,
190
+ filterable: false,
191
+ remoteOptions: [],
192
+ props: {
193
+ value: 'value',
194
+ label: 'label'
195
+ },
196
+ remoteFunc: ''
197
+ }
198
+ },
199
+ {
200
+ type: 'switch',
201
+ icon: 'icon-switch',
202
+ options: {
203
+ defaultValue: false,
204
+ required: false,
205
+ disabled: false,
206
+ }
207
+ },
208
+ {
209
+ type: 'slider',
210
+ icon: 'icon-slider',
211
+ options: {
212
+ defaultValue: 0,
213
+ disabled: false,
214
+ required: false,
215
+ min: 0,
216
+ max: 100,
217
+ step: 1,
218
+ showInput: false,
219
+ range: false,
220
+ width: ''
221
+ }
222
+ },
223
+ {
224
+ type: 'text',
225
+ icon: 'icon-wenzishezhi-',
226
+ options: {
227
+ defaultValue: 'This is a text',
228
+ customClass: '',
229
+ }
230
+ }
231
+ ]
232
+
233
+ export const advanceComponents = [
234
+ {
235
+ type: 'blank',
236
+ icon: 'icon-zidingyishuju',
237
+ options: {
238
+ defaultType: 'String'
239
+ }
240
+ },
241
+ {
242
+ type: 'imgupload',
243
+ icon: 'icon-tupian',
244
+ options: {
245
+ defaultValue: [],
246
+ size: {
247
+ width: 100,
248
+ height: 100,
249
+ },
250
+ width: '',
251
+ tokenFunc: 'funcGetToken',
252
+ token: '',
253
+ domain: 'https://tcdn.form.making.link/',
254
+ disabled: false,
255
+ length: 8,
256
+ multiple: false,
257
+ isQiniu: false,
258
+ isDelete: false,
259
+ min: 0,
260
+ isEdit: false,
261
+ action: 'https://tools-server.making.link/api/transfer'
262
+ }
263
+ },
264
+ {
265
+ type: 'editor',
266
+ icon: 'icon-fuwenbenkuang',
267
+ options: {
268
+ defaultValue: '',
269
+ width: ''
270
+ }
271
+ },
272
+ {
273
+ type: 'cascader',
274
+ icon: 'icon-jilianxuanze',
275
+ options: {
276
+ defaultValue: [],
277
+ width: '',
278
+ placeholder: '',
279
+ disabled: false,
280
+ clearable: false,
281
+ remote: true,
282
+ remoteOptions: [],
283
+ props: {
284
+ value: 'value',
285
+ label: 'label',
286
+ children: 'children'
287
+ },
288
+ remoteFunc: ''
289
+ }
290
+ }
291
+ ]
292
+
293
+ export const layoutComponents = [
294
+ {
295
+ type: 'grid',
296
+ icon: 'icon-grid-',
297
+ columns: [
298
+ {
299
+ span: 12,
300
+ list: []
301
+ },
302
+ {
303
+ span: 12,
304
+ list: []
305
+ }
306
+ ],
307
+ options: {
308
+ gutter: 0,
309
+ justify: 'start',
310
+ align: 'top'
311
+ }
312
+ }
313
+ ]
@@ -0,0 +1,155 @@
1
+ function findRemoteFunc (list, funcList, tokenFuncList, blankList) {
2
+ for (let i = 0; i < list.length; i++) {
3
+ if (list[i].type == 'grid') {
4
+ list[i].columns.forEach(item => {
5
+ findRemoteFunc(item.list, funcList, tokenFuncList, blankList)
6
+ })
7
+ } else {
8
+ if (list[i].type == 'blank') {
9
+ if (list[i].model) {
10
+ blankList.push({
11
+ name: list[i].model,
12
+ label: list[i].name
13
+ })
14
+ }
15
+ } else if (list[i].type == 'imgupload') {
16
+ if (list[i].options.tokenFunc) {
17
+ tokenFuncList.push({
18
+ func: list[i].options.tokenFunc,
19
+ label: list[i].name,
20
+ model: list[i].model
21
+ })
22
+ }
23
+ } else {
24
+ if (list[i].options.remote && list[i].options.remoteFunc) {
25
+ funcList.push({
26
+ func: list[i].options.remoteFunc,
27
+ label: list[i].name,
28
+ model: list[i].model
29
+ })
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+
36
+ export default function (data, type = 'vue') {
37
+
38
+ const funcList = []
39
+
40
+ const tokenFuncList = []
41
+
42
+ const blankList = []
43
+
44
+ findRemoteFunc(JSON.parse(data).list, funcList, tokenFuncList, blankList)
45
+
46
+ let funcTemplate = ''
47
+
48
+ let blankTemplate = ''
49
+
50
+ for(let i = 0; i < funcList.length; i++) {
51
+ funcTemplate += `
52
+ ${funcList[i].func} (resolve) {
53
+ // ${funcList[i].label} ${funcList[i].model}
54
+ // Call callback function once get the data from remote server
55
+ // resolve(data)
56
+ },
57
+ `
58
+ }
59
+
60
+ for(let i = 0; i < tokenFuncList.length; i++) {
61
+ funcTemplate += `
62
+ ${tokenFuncList[i].func} (resolve) {
63
+ // ${tokenFuncList[i].label} ${tokenFuncList[i].model}
64
+ // Call callback function once get the token
65
+ // resolve(token)
66
+ },
67
+ `
68
+ }
69
+
70
+ for (let i = 0; i < blankList.length; i++) {
71
+ blankTemplate += `
72
+ <template slot="${blankList[i].name}" slot-scope="scope">
73
+ <!-- ${blankList[i].label} -->
74
+ <!-- use v-model="scope.model.${blankList[i].name}" to bind data -->
75
+ </template>
76
+ `
77
+ }
78
+
79
+ if (type == 'vue') {
80
+ return `<template>
81
+ <div>
82
+ <fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
83
+ ${blankTemplate}
84
+ </fm-generate-form>
85
+ <el-button type="primary" @click="handleSubmit">提交</el-button>
86
+ </div>
87
+ </template>
88
+
89
+ <script>
90
+ export default {
91
+ data () {
92
+ return {
93
+ jsonData: ${data},
94
+ editData: {},
95
+ remoteFuncs: {
96
+ ${funcTemplate}
97
+ }
98
+ }
99
+ },
100
+ methods: {
101
+ handleSubmit () {
102
+ this.$refs.generateForm.getData().then(data => {
103
+ // data check success
104
+ // data - form data
105
+ }).catch(e => {
106
+ // data check failed
107
+ })
108
+ }
109
+ }
110
+ }
111
+ </script>`
112
+ } else {
113
+ return `<!DOCTYPE html>
114
+ <html>
115
+ <head>
116
+ <meta charset="UTF-8">
117
+ <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
118
+ <link rel="stylesheet" href="https://unpkg.com/form-making/dist/FormMaking.css">
119
+ </head>
120
+ <body>
121
+ <div id="app">
122
+ <fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
123
+ ${blankTemplate}
124
+ </fm-generate-form>
125
+ <el-button type="primary" @click="handleSubmit">提交</el-button>
126
+ </div>
127
+ <script src="https://unpkg.com/vue/dist/vue.js"></script>
128
+ <script src="https://unpkg.com/element-ui/lib/index.js"></script>
129
+ <script src="https://unpkg.com/form-making/dist/FormMaking.umd.js"></script>
130
+ <script>
131
+ new Vue({
132
+ el: '#app',
133
+ data: {
134
+ jsonData: ${data},
135
+ editData: {},
136
+ remoteFuncs: {
137
+ ${funcTemplate}
138
+ }
139
+ },
140
+ methods: {
141
+ handleSubmit () {
142
+ this.$refs.generateForm.getData().then(data => {
143
+ // data check success
144
+ // data - form data
145
+ }).catch(e => {
146
+ // data check failed
147
+ })
148
+ }
149
+ }
150
+ })
151
+ </script>
152
+ </body>
153
+ </html>`
154
+ }
155
+ }