@opentiny/tiny-engine-canvas 1.0.0
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/.eslintrc.js +42 -0
- package/README.md +7 -0
- package/canvas.html +212 -0
- package/dist/index.js +48919 -0
- package/index.html +13 -0
- package/package.json +30 -0
- package/public/favicon.ico +0 -0
- package/src/Design.vue +53 -0
- package/src/assets/logo.png +0 -0
- package/src/canvas.js +34 -0
- package/src/components/builtin/CanvasBox.vue +22 -0
- package/src/components/builtin/CanvasCol.vue +89 -0
- package/src/components/builtin/CanvasCollection.js +278 -0
- package/src/components/builtin/CanvasCollection.vue +106 -0
- package/src/components/builtin/CanvasIcon.vue +30 -0
- package/src/components/builtin/CanvasImg.vue +18 -0
- package/src/components/builtin/CanvasPlaceholder.vue +26 -0
- package/src/components/builtin/CanvasRow.vue +67 -0
- package/src/components/builtin/CanvasRowColContainer.vue +42 -0
- package/src/components/builtin/CanvasSlot.vue +22 -0
- package/src/components/builtin/CanvasText.vue +18 -0
- package/src/components/builtin/builtin.json +955 -0
- package/src/components/builtin/helper.js +46 -0
- package/src/components/builtin/index.js +33 -0
- package/src/components/common/index.js +158 -0
- package/src/components/container/CanvasAction.vue +554 -0
- package/src/components/container/CanvasContainer.vue +244 -0
- package/src/components/container/CanvasDivider.vue +246 -0
- package/src/components/container/CanvasDragItem.vue +38 -0
- package/src/components/container/CanvasFooter.vue +86 -0
- package/src/components/container/CanvasMenu.vue +214 -0
- package/src/components/container/CanvasResize.vue +195 -0
- package/src/components/container/CanvasResizeBorder.vue +219 -0
- package/src/components/container/container.js +791 -0
- package/src/components/container/keyboard.js +147 -0
- package/src/components/container/shortCutPopover.vue +181 -0
- package/src/components/render/CanvasEmpty.vue +14 -0
- package/src/components/render/RenderMain.js +408 -0
- package/src/components/render/context.js +53 -0
- package/src/components/render/render.js +689 -0
- package/src/components/render/runner.js +140 -0
- package/src/i18n/en.json +5 -0
- package/src/i18n/zh.json +5 -0
- package/src/i18n.js +21 -0
- package/src/index.js +96 -0
- package/src/locale.js +19 -0
- package/src/lowcode.js +104 -0
- package/src/main.js +17 -0
- package/test/form.json +690 -0
- package/test/group.json +99 -0
- package/test/jsslot.json +427 -0
- package/vite.config.js +73 -0
package/test/group.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"componentName": "div",
|
|
3
|
+
"children": [
|
|
4
|
+
{
|
|
5
|
+
"componentName": "TinyForm",
|
|
6
|
+
"props": { "labelWidth": 80, "labelPosition": "disabled" },
|
|
7
|
+
"children": [
|
|
8
|
+
{
|
|
9
|
+
"componentName": "TinyFormItem",
|
|
10
|
+
"props": { "label": "人员" },
|
|
11
|
+
"children": [
|
|
12
|
+
{
|
|
13
|
+
"componentName": "TinyInput",
|
|
14
|
+
"props": { "placeholder": "请输入", "modelValue": "" },
|
|
15
|
+
"id": "c3ec1fff"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"id": "62717bc1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"componentName": "TinyFormItem",
|
|
22
|
+
"props": { "label": "密码" },
|
|
23
|
+
"children": [
|
|
24
|
+
{
|
|
25
|
+
"componentName": "TinyInput",
|
|
26
|
+
"props": {
|
|
27
|
+
"placeholder": "请输入",
|
|
28
|
+
"modelValue": "",
|
|
29
|
+
"type": "password"
|
|
30
|
+
},
|
|
31
|
+
"id": "e1331c84"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"id": "808159c9"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"componentName": "TinyFormItem",
|
|
38
|
+
"props": { "label": "" },
|
|
39
|
+
"children": [
|
|
40
|
+
{
|
|
41
|
+
"componentName": "TinyButton",
|
|
42
|
+
"props": {
|
|
43
|
+
"text": "提交",
|
|
44
|
+
"type": "primary",
|
|
45
|
+
"style": { "marginRight": "10px" }
|
|
46
|
+
},
|
|
47
|
+
"id": "01e8a1f3"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"componentName": "TinyButton",
|
|
51
|
+
"props": { "text": "重置", "type": "primary" },
|
|
52
|
+
"id": "7aecc5f4"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"id": "41ecdb3d"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"id": "b2341d0e"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"componentName": "TinyTabs",
|
|
62
|
+
"props": {
|
|
63
|
+
"modelValue": "first"
|
|
64
|
+
},
|
|
65
|
+
"children": [
|
|
66
|
+
{
|
|
67
|
+
"componentName": "TinyTabItem",
|
|
68
|
+
"props": {
|
|
69
|
+
"title": "标签页1",
|
|
70
|
+
"name": "first"
|
|
71
|
+
},
|
|
72
|
+
"children": [
|
|
73
|
+
{
|
|
74
|
+
"componentName": "div",
|
|
75
|
+
"id": "2e2bfde3"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"id": "813aae66"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"componentName": "TinyTabItem",
|
|
82
|
+
"props": {
|
|
83
|
+
"title": "标签页2",
|
|
84
|
+
"name": "second"
|
|
85
|
+
},
|
|
86
|
+
"children": [
|
|
87
|
+
{
|
|
88
|
+
"componentName": "div",
|
|
89
|
+
"id": "295578a9"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"id": "21873fc9"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"id": "1f6e781f"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"id": "root"
|
|
99
|
+
}
|
package/test/jsslot.json
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
{
|
|
2
|
+
"componentName": "Block",
|
|
3
|
+
"fileName": "CrmConsumeVoucherGrid",
|
|
4
|
+
"schema": {
|
|
5
|
+
"properties": [
|
|
6
|
+
{
|
|
7
|
+
"label": {
|
|
8
|
+
"zh_CN": "基础信息"
|
|
9
|
+
},
|
|
10
|
+
"description": {
|
|
11
|
+
"zh_CN": "基础信息"
|
|
12
|
+
},
|
|
13
|
+
"collapse": {
|
|
14
|
+
"number": 6,
|
|
15
|
+
"text": {
|
|
16
|
+
"zh_CN": "显示更多"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"content": [
|
|
20
|
+
{
|
|
21
|
+
"property": "isEdit",
|
|
22
|
+
"type": "Boolean",
|
|
23
|
+
"defaultValue": true,
|
|
24
|
+
"label": {
|
|
25
|
+
"text": {
|
|
26
|
+
"zh_CN": "是否编辑"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"description": {
|
|
30
|
+
"zh_CN": "是否编辑配置项"
|
|
31
|
+
},
|
|
32
|
+
"widget": {
|
|
33
|
+
"component": "MetaCodeEditor"
|
|
34
|
+
},
|
|
35
|
+
"cols": 12,
|
|
36
|
+
"rules": [],
|
|
37
|
+
"required": true,
|
|
38
|
+
"handle": {}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"property": "tableData",
|
|
42
|
+
"type": "Array",
|
|
43
|
+
"defaultValue": [
|
|
44
|
+
{
|
|
45
|
+
"way": "test",
|
|
46
|
+
"_RID": "row_1"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"label": {
|
|
50
|
+
"text": {
|
|
51
|
+
"zh_CN": "表格数据"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"description": {
|
|
55
|
+
"zh_CN": "表格数据配置项"
|
|
56
|
+
},
|
|
57
|
+
"widget": {
|
|
58
|
+
"component": "MetaCodeEditor"
|
|
59
|
+
},
|
|
60
|
+
"cols": 12,
|
|
61
|
+
"rules": [],
|
|
62
|
+
"required": true,
|
|
63
|
+
"handle": {}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"property": "options",
|
|
67
|
+
"type": "Array",
|
|
68
|
+
"defaultValue": [
|
|
69
|
+
{
|
|
70
|
+
"value": "test"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"label": {
|
|
74
|
+
"text": {
|
|
75
|
+
"zh_CN": "下拉框数据"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"description": {
|
|
79
|
+
"zh_CN": "下拉框数据配置项"
|
|
80
|
+
},
|
|
81
|
+
"widget": {
|
|
82
|
+
"component": "MetaCodeEditor"
|
|
83
|
+
},
|
|
84
|
+
"cols": 12,
|
|
85
|
+
"rules": [],
|
|
86
|
+
"required": true,
|
|
87
|
+
"handle": {}
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"lifeCycles": {
|
|
93
|
+
"setup": {
|
|
94
|
+
"type": "JSFunction",
|
|
95
|
+
"value": "function( props, context, vue, state ) {\r\n watch(()=>props.tableData, (value) => {state.tableData = value })\r\n}"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"methods": {
|
|
100
|
+
"deleteData": {
|
|
101
|
+
"type": "JSFunction",
|
|
102
|
+
"value": "function deleteData(row) {\n this.utils.Modal.confirm({\n title: '提示',\n message: '您确定要删除吗?'\n }).then(res => {\n if (res === 'confirm') {\n this.$('gridRef').remove(row);\n }\n });\n}"
|
|
103
|
+
},
|
|
104
|
+
"activeMethod": {
|
|
105
|
+
"type": "JSFunction",
|
|
106
|
+
"value": "function activeMethod() {\n return this.props.isEdit;\n}"
|
|
107
|
+
},
|
|
108
|
+
"stepsChange": {
|
|
109
|
+
"type": "JSFunction",
|
|
110
|
+
"value": "function stepsChange(data) {\n console.log(data);\n this.emit('change', data);\n}"
|
|
111
|
+
},
|
|
112
|
+
"strategySubTypeChange": {
|
|
113
|
+
"type": "JSFunction",
|
|
114
|
+
"value": "function strategySubTypeChange(row) {\n console.log(row);\n}"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"children": [
|
|
118
|
+
{
|
|
119
|
+
"componentName": "TinyGrid",
|
|
120
|
+
"props": {
|
|
121
|
+
"ref": "gridRef",
|
|
122
|
+
"className": "crm-consume-voucher-grid",
|
|
123
|
+
"edit-config": {
|
|
124
|
+
"type": "JSExpression",
|
|
125
|
+
"value": "this.{ trigger: 'click', mode: 'cell', showStatus: false, activeMethod }"
|
|
126
|
+
},
|
|
127
|
+
"edit-rules": {
|
|
128
|
+
"type": "JSExpression",
|
|
129
|
+
"value": "this.state.validRules"
|
|
130
|
+
},
|
|
131
|
+
"data": {
|
|
132
|
+
"type": "JSExpression",
|
|
133
|
+
"value": "this.state.tableData"
|
|
134
|
+
},
|
|
135
|
+
"columns": {
|
|
136
|
+
"type": "JSExpression",
|
|
137
|
+
"value": "this.state.columns"
|
|
138
|
+
},
|
|
139
|
+
"auto-resize": true
|
|
140
|
+
},
|
|
141
|
+
"id": "ab110672"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"blockName": "CrmConsumeVoucherGrid",
|
|
145
|
+
"state": {
|
|
146
|
+
"validRules": {
|
|
147
|
+
"interval": {
|
|
148
|
+
"required": true
|
|
149
|
+
},
|
|
150
|
+
"way": {
|
|
151
|
+
"required": true
|
|
152
|
+
},
|
|
153
|
+
"percent": {
|
|
154
|
+
"required": true
|
|
155
|
+
},
|
|
156
|
+
"deadline": {
|
|
157
|
+
"required": true
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"tableData": {
|
|
161
|
+
"type": "JSExpression",
|
|
162
|
+
"value": "this.props.tableData"
|
|
163
|
+
},
|
|
164
|
+
"columns": [
|
|
165
|
+
{
|
|
166
|
+
"type": "index",
|
|
167
|
+
"title": {
|
|
168
|
+
"type": "i18n",
|
|
169
|
+
"key": "quotes.voucher.tier"
|
|
170
|
+
},
|
|
171
|
+
"width": 80
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"title": {
|
|
175
|
+
"type": "i18n",
|
|
176
|
+
"key": "quotes.voucher.consumption_interval"
|
|
177
|
+
},
|
|
178
|
+
"field": "interval",
|
|
179
|
+
"slots": {
|
|
180
|
+
"default": {
|
|
181
|
+
"type": "JSSlot",
|
|
182
|
+
"params": ["row", "data", "seq", "rowIndex"],
|
|
183
|
+
"value": [
|
|
184
|
+
{
|
|
185
|
+
"componentName": "ConsumptionRangeGrid",
|
|
186
|
+
"fileName": "ConsumptionRangeGrid",
|
|
187
|
+
"props": {
|
|
188
|
+
"isEdit": {
|
|
189
|
+
"type": "JSExpression",
|
|
190
|
+
"value": "this.props.isEdit"
|
|
191
|
+
},
|
|
192
|
+
"tableData": {
|
|
193
|
+
"type": "JSExpression",
|
|
194
|
+
"value": "data"
|
|
195
|
+
},
|
|
196
|
+
"seq": {
|
|
197
|
+
"type": "JSExpression",
|
|
198
|
+
"value": "seq"
|
|
199
|
+
},
|
|
200
|
+
"rowIndex": {
|
|
201
|
+
"type": "JSExpression",
|
|
202
|
+
"value": "rowIndex"
|
|
203
|
+
},
|
|
204
|
+
"rowData": {
|
|
205
|
+
"type": "JSExpression",
|
|
206
|
+
"value": "row"
|
|
207
|
+
},
|
|
208
|
+
"onChange": {
|
|
209
|
+
"type": "JSExpression",
|
|
210
|
+
"value": "this.stepsChange"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"id": "da20dae5"
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"field": "strategySubType",
|
|
221
|
+
"title": {
|
|
222
|
+
"type": "i18n",
|
|
223
|
+
"key": "quotes.voucher.vouchertype"
|
|
224
|
+
},
|
|
225
|
+
"showIcon": false,
|
|
226
|
+
"editor": {
|
|
227
|
+
"component": {
|
|
228
|
+
"type": "JSResource",
|
|
229
|
+
"value": "this.utils.Select"
|
|
230
|
+
},
|
|
231
|
+
"type": {
|
|
232
|
+
"type": "JSExpression",
|
|
233
|
+
"value": "this.props.isEdit ? 'visible' : ''"
|
|
234
|
+
},
|
|
235
|
+
"events": {
|
|
236
|
+
"change": {
|
|
237
|
+
"type": "JSExpression",
|
|
238
|
+
"value": "this.strategySubTypeChange"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"attrs": {
|
|
242
|
+
"type": "JSExpression",
|
|
243
|
+
"value": "{ options: props.options, textField: 'name', valueField: 'valueId' }"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"formatConfig": {
|
|
247
|
+
"data": {
|
|
248
|
+
"type": "JSExpression",
|
|
249
|
+
"value": "this.props.options"
|
|
250
|
+
},
|
|
251
|
+
"label": "name",
|
|
252
|
+
"value": "valueId"
|
|
253
|
+
},
|
|
254
|
+
"formatText": "enum"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"title": {
|
|
258
|
+
"type": "i18n",
|
|
259
|
+
"key": "quotes.voucher.giveamount"
|
|
260
|
+
},
|
|
261
|
+
"slots": {
|
|
262
|
+
"default": {
|
|
263
|
+
"type": "JSSlot",
|
|
264
|
+
"params": ["row"],
|
|
265
|
+
"value": [
|
|
266
|
+
{
|
|
267
|
+
"componentName": "div",
|
|
268
|
+
"children": [
|
|
269
|
+
{
|
|
270
|
+
"componentName": "TinyInput",
|
|
271
|
+
"props": {
|
|
272
|
+
"style": {
|
|
273
|
+
"type": "JSExpression",
|
|
274
|
+
"value": "props.isEdit ? 'display:inline-block' : 'display:none'"
|
|
275
|
+
},
|
|
276
|
+
"value": {
|
|
277
|
+
"type": "JSExpression",
|
|
278
|
+
"value": "row.voucherSpec.amount",
|
|
279
|
+
"model": {
|
|
280
|
+
"prop": ""
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"disabled": {
|
|
284
|
+
"type": "JSExpression",
|
|
285
|
+
"value": "row.strategySubType === 1"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"id": "d1c37157"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"componentName": "span",
|
|
292
|
+
"props": {
|
|
293
|
+
"style": {
|
|
294
|
+
"type": "JSExpression",
|
|
295
|
+
"value": "props.isEdit ? 'display:none' : 'display:inline-block'"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"children": {
|
|
299
|
+
"type": "JSExpression",
|
|
300
|
+
"value": "row.voucherSpec.amount"
|
|
301
|
+
},
|
|
302
|
+
"id": "f4686ebb"
|
|
303
|
+
}
|
|
304
|
+
],
|
|
305
|
+
"id": "7b588b12"
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
"field": "voucherSpec.amount",
|
|
311
|
+
"width": 120
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"field": "percvoucherSpec.ratioent",
|
|
315
|
+
"title": {
|
|
316
|
+
"type": "i18n",
|
|
317
|
+
"key": "quotes.voucher.ratio"
|
|
318
|
+
},
|
|
319
|
+
"showIcon": false,
|
|
320
|
+
"slots": {
|
|
321
|
+
"default": {
|
|
322
|
+
"type": "JSSlot",
|
|
323
|
+
"params": ["row"],
|
|
324
|
+
"value": [
|
|
325
|
+
{
|
|
326
|
+
"componentName": "div",
|
|
327
|
+
"children": [
|
|
328
|
+
{
|
|
329
|
+
"componentName": "TinyInput",
|
|
330
|
+
"props": {
|
|
331
|
+
"style": {
|
|
332
|
+
"type": "JSExpression",
|
|
333
|
+
"value": "props.isEdit ? 'display:inline-block' : 'display:none'"
|
|
334
|
+
},
|
|
335
|
+
"value": {
|
|
336
|
+
"type": "JSExpression",
|
|
337
|
+
"value": "row.voucherSpec.ratio",
|
|
338
|
+
"model": {
|
|
339
|
+
"prop": ""
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"disabled": {
|
|
343
|
+
"type": "JSExpression",
|
|
344
|
+
"value": "row.strategySubType === 2"
|
|
345
|
+
},
|
|
346
|
+
"size": "medium"
|
|
347
|
+
},
|
|
348
|
+
"id": "d1c37157"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"componentName": "span",
|
|
352
|
+
"props": {
|
|
353
|
+
"style": {
|
|
354
|
+
"type": "JSExpression",
|
|
355
|
+
"value": "props.isEdit ? 'display:none' : 'display:inline-block'"
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
"children": {
|
|
359
|
+
"type": "JSExpression",
|
|
360
|
+
"value": "row.voucherSpec.ratio"
|
|
361
|
+
},
|
|
362
|
+
"id": "f4686ebb"
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
"id": "7b588b12"
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"title": {
|
|
373
|
+
"type": "i18n",
|
|
374
|
+
"key": "quotes.voucher.validity_period_month"
|
|
375
|
+
},
|
|
376
|
+
"field": "voucherSpec.validationPeriod",
|
|
377
|
+
"showIcon": false,
|
|
378
|
+
"editor": {
|
|
379
|
+
"component": "input",
|
|
380
|
+
"attrs": {
|
|
381
|
+
"disabled": true
|
|
382
|
+
},
|
|
383
|
+
"type": {
|
|
384
|
+
"type": "JSExpression",
|
|
385
|
+
"value": "this.props.isEdit ? 'visible' : ''"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"title": {
|
|
391
|
+
"type": "i18n",
|
|
392
|
+
"key": "quotes.quoteconfig.operate"
|
|
393
|
+
},
|
|
394
|
+
"width": 100,
|
|
395
|
+
"slots": {
|
|
396
|
+
"default": {
|
|
397
|
+
"type": "JSSlot",
|
|
398
|
+
"params": ["row"],
|
|
399
|
+
"value": [
|
|
400
|
+
{
|
|
401
|
+
"componentName": "span",
|
|
402
|
+
"props": {
|
|
403
|
+
"style": "color: #5285db,cursor: pointer",
|
|
404
|
+
"onClick": {
|
|
405
|
+
"type": "JSFunction",
|
|
406
|
+
"value": " ()=>{this.deleteData(row)}"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"children": {
|
|
410
|
+
"type": "i18n",
|
|
411
|
+
"key": "quotes.voucher.voucher_modal_tip4"
|
|
412
|
+
},
|
|
413
|
+
"id": "6d81ff9d"
|
|
414
|
+
}
|
|
415
|
+
]
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
"lifeCycles": {
|
|
422
|
+
"setup": {
|
|
423
|
+
"type": "JSFunction",
|
|
424
|
+
"value": "function setup({ props, state, watchEffect }) {\r\n \r\n watchEffect(\r\n () => {\r\n this.state.tableData = props.tableData\r\n this.state.columns[2].editor.attrs.options = props.options;\r\n }\r\n )\r\n}"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023 - present TinyEngine Authors.
|
|
3
|
+
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license.
|
|
6
|
+
*
|
|
7
|
+
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
|
|
8
|
+
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
|
|
9
|
+
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { defineConfig } from 'vite'
|
|
14
|
+
import path from 'path'
|
|
15
|
+
import vue from '@vitejs/plugin-vue'
|
|
16
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
17
|
+
import { terser } from 'rollup-plugin-terser'
|
|
18
|
+
|
|
19
|
+
// https://vitejs.dev/config/
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
resolve: {
|
|
22
|
+
alias: {
|
|
23
|
+
'@': path.resolve(__dirname, 'src')
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
define: {
|
|
27
|
+
'process.env': process.env
|
|
28
|
+
},
|
|
29
|
+
plugins: [
|
|
30
|
+
vue({
|
|
31
|
+
template: {
|
|
32
|
+
compilerOptions: {
|
|
33
|
+
isCustomElement: (tag) => tag.startsWith('tiny-i18n-host')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
vueJsx(),
|
|
38
|
+
{ ...terser({ module: true }), enforce: 'post' },
|
|
39
|
+
{
|
|
40
|
+
apply: 'build',
|
|
41
|
+
enforce: 'post',
|
|
42
|
+
generateBundle(_, bundle) {
|
|
43
|
+
const cssFileName = 'style.css'
|
|
44
|
+
const jsFileName = 'index.js'
|
|
45
|
+
const { [cssFileName]: cssBundle } = bundle
|
|
46
|
+
let IIFEcss = ''
|
|
47
|
+
|
|
48
|
+
if (cssBundle) {
|
|
49
|
+
IIFEcss = `(function() {try {var elementStyle = document.createElement('style');elementStyle.innerText = ${JSON.stringify(
|
|
50
|
+
cssBundle.source
|
|
51
|
+
)};document.head.appendChild(elementStyle);} catch(error) {console.error(error, 'unable to concat style inside the bundled file')}})()`
|
|
52
|
+
delete bundle[cssFileName]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
bundle[jsFileName].code += IIFEcss
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
publicDir: false,
|
|
60
|
+
build: {
|
|
61
|
+
cssCodeSplit: false,
|
|
62
|
+
lib: {
|
|
63
|
+
entry: path.resolve(__dirname, './src/index.js'),
|
|
64
|
+
name: 'canvas',
|
|
65
|
+
fileName: () => 'index.js',
|
|
66
|
+
formats: ['es']
|
|
67
|
+
},
|
|
68
|
+
rollupOptions: {
|
|
69
|
+
external: ['vue', 'vue-i18n', /@opentiny\/tiny-engine.*/, /@opentiny\/vue.*/]
|
|
70
|
+
},
|
|
71
|
+
minify: true
|
|
72
|
+
}
|
|
73
|
+
})
|