vue2-client 1.15.13 → 1.15.14

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.
@@ -1,325 +0,0 @@
1
- <template>
2
- <amis-renderer :schema="schema" :locals="locals" />
3
- </template>
4
- <script>
5
- import AMISRenderer from '@vue2-client/base-client/components/common/AMisRender'
6
- import Vue from 'vue'
7
- import Index from '@vue2-client/base-client/components/index.js'
8
-
9
- const vms = {}
10
- const store = Vue.$store
11
- const router = Vue.$router
12
- const i18n = Vue.$i18n
13
-
14
- // const schema = {
15
- // // 原生与自定义组件混用
16
- // type: 'page',
17
- // css: {
18
- // },
19
- // body: [
20
- // // {
21
- // // type: 'grid',
22
- // // columns: [
23
- // // {
24
- // // mode: 'horizontal',
25
- // // body: {
26
- // // name: 'queryParams',
27
- // // type: 'input-text',
28
- // // label: '查询值'
29
- // // },
30
- // // md: 4
31
- // // }
32
- // // ]
33
- // // },
34
- // {
35
- // type: 'grid',
36
- // columns: [
37
- // {
38
- // body: [
39
- // {
40
- // type: 'input-tree',
41
- // name: 'test_tree',
42
- // label: '树选择框',
43
- // options: [
44
- // {
45
- // label: '查询配置',
46
- // children: [
47
- // {
48
- // label: '字典管理',
49
- // value: 'crud_dictionary_manage'
50
- // },
51
- // {
52
- // label: '操作日志',
53
- // value: 'crud_oper_log_manage'
54
- // }
55
- // ]
56
- // }
57
- // ]
58
- // // source: {
59
- // // method: 'post',
60
- // // url: '/api/af-system/logic/get_root_nodes'
61
- // // },
62
- // }
63
- // ],
64
- // id: 'u:b1d2075dc231',
65
- // md: 1.5
66
- // },
67
- // {
68
- // body: [
69
- // // {
70
- // // type: 'table-view',
71
- // // name: 'table-view1',
72
- // // api: '',
73
- // // trs: [
74
- // // {
75
- // // background: '#F7F7F7',
76
- // // tds: [
77
- // // {
78
- // // align: 'center',
79
- // // body: {
80
- // // type: 'tpl',
81
- // // tpl: '地区'
82
- // // }
83
- // // },
84
- // // {
85
- // // align: 'center',
86
- // // body: {
87
- // // type: 'tpl',
88
- // // tpl: '城市'
89
- // // }
90
- // // },
91
- // // {
92
- // // align: 'center',
93
- // // body: {
94
- // // type: 'tpl',
95
- // // tpl: '销量'
96
- // // }
97
- // // }
98
- // // ]
99
- // // },
100
- // // {
101
- // // tds: [
102
- // // {
103
- // // align: 'center',
104
- // // colspan: 2,
105
- // // rowspan: 2,
106
- // // body: {
107
- // // type: 'tpl',
108
- // // tpl: '${queryParams}'
109
- // // }
110
- // // },
111
- // // {
112
- // // body: {
113
- // // type: 'tpl',
114
- // // tpl: '北京'
115
- // // },
116
- // // }
117
- // // ]
118
- // // },
119
- // // {
120
- // // tds: [
121
- // // {
122
- // // body: {
123
- // // type: 'tpl',
124
- // // tpl: '上京'
125
- // // },
126
- // // }
127
- // // ]
128
- // // }
129
- // // ]
130
- // // },
131
- // // {
132
- // //
133
- // // },
134
- // // {
135
- // // type: 'table-view',
136
- // // trs: [
137
- // // {
138
- // // background: '#F7F7F7',
139
- // // tds: [
140
- // // {
141
- // // align: 'center',
142
- // // body: {
143
- // // type: 'tpl',
144
- // // tpl: '地区'
145
- // // }
146
- // // },
147
- // // {
148
- // // align: 'center',
149
- // // body: {
150
- // // type: 'tpl',
151
- // // tpl: '城市'
152
- // // }
153
- // // },
154
- // // {
155
- // // align: 'center',
156
- // // body: {
157
- // // type: 'tpl',
158
- // // tpl: '销量'
159
- // // }
160
- // // }
161
- // // ]
162
- // // },
163
- // // {
164
- // // tds: [
165
- // // {
166
- // // align: 'center',
167
- // // colspan: 3,
168
- // // body: {
169
- // // type: 'tpl',
170
- // // tpl: '北京'
171
- // // }
172
- // // },
173
- // //
174
- // // ]
175
- // // }
176
- // // ]
177
- // // },
178
- // {
179
- // name: 'xTable', // 如果要放在 form 中,需要设置 name,onChange 将会设置这个值
180
- // type: 'custom',
181
- // // onMount 将会在组件创建时执行,默认会创建一个空 div 标签,也可以设置 inline: true 来创建 span 标签
182
- // // dom 是 dom 节点,value 是初始数据,比如表单 name 初始拿到的数据,onChange 只有在表单下才会有
183
- // onMount: (dom, value, onChange) => {
184
- // const vm = new Vue({
185
- // router,
186
- // store,
187
- // i18n,
188
- // render: h => h(Index.XFormTable, {
189
- // props: {
190
- // queryParamsName: `crud_dictionary_manage`
191
- // }
192
- // })
193
- // })
194
- // vms.XFormTable = vm
195
- // dom.appendChild(vm.$mount().$el)
196
- // },
197
- // // onUpdate 将会在数据更新时被调用
198
- // // dom 是 dom 节点、data 将包含表单所有数据,prevData 是之前表单的所有数据
199
- // onUpdate: (dom, data, prevData) => {
200
- // console.log('数据有变化', data)
201
- // const vm = vms.XFormTable
202
- // vm.$children[0].active(data)
203
- // },
204
- // // onUnmount 将会在组件被销毁的时候调用,用于清理资源
205
- // onUnmount: () => {
206
- // console.log('组件被销毁')
207
- // },
208
- // },
209
- // ],
210
- // id: 'u:e4e49c147c06'
211
- // }
212
- // ],
213
- // }
214
- // ]
215
- // }
216
-
217
- const schema2 = {
218
- // 原生与自定义组件混用
219
- type: 'page',
220
- css: {
221
- },
222
- body: [
223
- {
224
- type: 'grid',
225
- columns: [
226
- {
227
- md: 3,
228
- body: [
229
- {
230
- type: 'input-tree',
231
- name: 'test_tree2',
232
- label: '树选择框',
233
- options: [
234
- {
235
- label: '查询配置',
236
- icon: 'fa fa-cogs',
237
- children: [
238
- {
239
- label: '字典管理',
240
- value: 'crud_dictionary_manage',
241
- icon: 'fa fa-cog'
242
- },
243
- {
244
- label: '字典值管理',
245
- value: 'crud_dictionary_value_manage',
246
- icon: 'fa fa-cog'
247
- }
248
- ]
249
- }
250
- ],
251
- value: 'crud_dictionary_manage'
252
- }
253
- ]
254
- },
255
- {
256
- md: 9,
257
- body: [
258
- {
259
- name: 'xTable',
260
- type: 'custom',
261
- onMount: (dom, value, onChange, props) => {
262
- console.warn('value', value)
263
- console.warn('props', props)
264
- const vm = new Vue({
265
- router,
266
- store,
267
- i18n,
268
- data: {
269
- queryParamsNameFather: 'crud_dictionary_manage'
270
- },
271
- render: function (createElement) {
272
- return createElement(
273
- 'div',
274
- [
275
- createElement(Index.XFormTable, {
276
- props: {
277
- queryParamsName: this.queryParamsNameFather
278
- },
279
- on: {
280
- action: function (record, id, actionType) {
281
- console.warn('action触发', record, id, actionType)
282
- }
283
- }
284
- })
285
- ]
286
- )
287
- }
288
- })
289
- vms.XFormTable = vm
290
- dom.appendChild(vm.$mount().$el)
291
- },
292
- onUpdate: (dom, data, prevData, props) => {
293
- console.warn('AAA', vms)
294
- Vue.set(vms.XFormTable, 'queryParamsNameFather', data.test_tree2)
295
- },
296
- onUnmount: () => {
297
- console.log('组件被销毁')
298
- },
299
- },
300
- ]
301
- }
302
- ],
303
- }
304
- ]
305
- }
306
-
307
- export default {
308
- name: 'AMisDemo',
309
- components: {
310
- 'amis-renderer': AMISRenderer,
311
- },
312
- computed: {
313
- },
314
- mounted () {
315
-
316
- },
317
- data: () => ({
318
- outerVue: this,
319
- schema: schema2,
320
- locals: { fixedQueryForm: {} },
321
- vms: {},
322
- queryParamsName: 'crud_dictionary_manage'
323
- }),
324
- }
325
- </script>
@@ -1,74 +0,0 @@
1
- <template>
2
- <amis-renderer :schema="schemaJson" :locals="locals" />
3
- </template>
4
- <script>
5
- import AMISRenderer from '@vue2-client/base-client/components/common/AMisRender'
6
-
7
- const schema = {
8
- // 原生与自定义组件混用
9
- type: 'page',
10
- data: {
11
- queryParamsName: 'crud_dictionary_manage',
12
- fixedQueryForm: '{}'
13
- },
14
- body: [
15
- {
16
- type: 'tabs',
17
- tabsMode: 'chrome',
18
- name: 'fixedQueryForm',
19
- id: 'username',
20
- tabs: [
21
- {
22
- title: '测试1',
23
- value: '{"d_f_name":"设备异常处理方式"}',
24
- body: {
25
- name: 'username',
26
- id: 'XFormTable1',
27
- type: 'XFormTable',
28
- }
29
- },
30
- {
31
- title: '选项卡3',
32
- value: '{"d_f_name":"二级用气性质"}',
33
- body: {
34
- name: 'username2',
35
- id: 'XFormTable2',
36
- type: 'XFormTable',
37
- }
38
- },
39
- ],
40
- },
41
- ]
42
- }
43
-
44
- export default {
45
- name: 'AMisDemo',
46
- components: {
47
- 'amis-renderer': AMISRenderer,
48
- },
49
- computed: {
50
- },
51
- props: {
52
- queryParamsName: {
53
- type: String,
54
- default: () => {
55
- return 'crud_dictionary_manage'
56
- }
57
- },
58
- schemaJson: {
59
- type: Object,
60
- default: () => {
61
- return schema
62
- }
63
- }
64
- },
65
- mounted () {
66
- },
67
- data: () => ({
68
- locals: {},
69
- vms: {},
70
- }),
71
- methods: {
72
- }
73
- }
74
- </script>
package/test/Amis.spec.js DELETED
@@ -1,164 +0,0 @@
1
- import { mount } from '@vue/test-utils'
2
- import AMisRender from '@vue2-client/base-client/components/common/AMisRender/index.vue'
3
- import { it, describe, expect } from '@jest/globals'
4
-
5
- describe('AmisRender', () => {
6
- // 测试用例:正确渲染组件
7
- it('renders correctly', () => {
8
- const wrapper = mount(AMisRender, {
9
- // 组件必要的传参
10
- propsData: {
11
- schema: {
12
- title: '${siteName}:这是 AMIS 表格页面示例',
13
- remark: '嘿,不保证数据准确性',
14
- type: 'page',
15
- body: {
16
- type: 'crud',
17
- draggable: true,
18
- api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample',
19
- keepItemSelectionOnPageChange: true,
20
- autoGenerateFilter: true,
21
- bulkActions: [
22
- {
23
- type: 'button',
24
- label: '批量删除',
25
- actionType: 'ajax',
26
- api: 'delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/${ids|raw}',
27
- confirmText: '确定要批量删除?',
28
- },
29
- {
30
- type: 'button',
31
- label: '批量修改',
32
- actionType: 'dialog',
33
- dialog: {
34
- title: '批量编辑',
35
- name: 'sample-bulk-edit',
36
- body: {
37
- type: 'form',
38
- api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/bulkUpdate2',
39
- body: [
40
- {
41
- type: 'hidden',
42
- name: 'ids',
43
- },
44
- {
45
- type: 'input-text',
46
- name: 'engine',
47
- label: 'Engine',
48
- },
49
- ],
50
- },
51
- },
52
- },
53
- ],
54
- quickSaveApi:
55
- 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/bulkUpdate',
56
- quickSaveItemApi:
57
- 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/$id',
58
- headerToolbar: [
59
- 'bulkActions',
60
- {
61
- type: 'button',
62
- label: '重置测试数据',
63
- actionType: 'ajax',
64
- size: 'sm',
65
- api: 'https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/reset',
66
- },
67
- 'export-excel',
68
- {
69
- type: 'tpl',
70
- tpl: '一共有 ${count} 行数据。',
71
- className: 'v-middle',
72
- },
73
- {
74
- type: 'columns-toggler',
75
- align: 'right',
76
- draggable: true,
77
- },
78
- {
79
- type: 'drag-toggler',
80
- align: 'right',
81
- },
82
- ],
83
- footerToolbar: ['statistics', 'switch-per-page', 'pagination'],
84
- columns: [
85
- {
86
- name: 'id',
87
- label: 'ID',
88
- width: 20,
89
- sortable: true,
90
- type: 'text',
91
- searchable: {
92
- type: 'input-text',
93
- name: 'id',
94
- label: '主键',
95
- placeholder: '输入id',
96
- },
97
- },
98
- {
99
- name: 'browser',
100
- label: 'Browser',
101
- searchable: {
102
- type: 'select',
103
- name: 'browser',
104
- label: '浏览器',
105
- placeholder: '选择浏览器',
106
- options: [
107
- {
108
- label: 'Internet Explorer ',
109
- value: 'ie',
110
- },
111
- {
112
- label: 'AOL browser',
113
- value: 'aol',
114
- },
115
- {
116
- label: 'Firefox',
117
- value: 'firefox',
118
- },
119
- ],
120
- },
121
- },
122
- {
123
- name: 'platform',
124
- label: '平台',
125
- popOver: {
126
- trigger: 'hover',
127
- body: {
128
- type: 'tpl',
129
- tpl: '就是为了演示有个叫 popOver 的功能',
130
- },
131
- },
132
- sortable: true,
133
- type: 'text',
134
- },
135
- {
136
- name: 'grade',
137
- label: 'CSS 等级',
138
- type: 'select',
139
- options: ['A', 'B', 'C', 'D', 'X'],
140
- },
141
- {
142
- type: 'operation',
143
- label: '操作',
144
- width: 100,
145
- buttons: [
146
- {
147
- type: 'button',
148
- actionType: 'ajax',
149
- label: '删除',
150
- confirmText: '您确认要删除?',
151
- api: 'delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample/$id',
152
- },
153
- ],
154
- },
155
- ],
156
- },
157
- },
158
- locals: {}
159
- }
160
- })
161
- console.debug('返回的组件html:' + wrapper.html())
162
- expect(wrapper.exists()).toBe(true)
163
- })
164
- })