@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.
Files changed (52) hide show
  1. package/.eslintrc.js +42 -0
  2. package/README.md +7 -0
  3. package/canvas.html +212 -0
  4. package/dist/index.js +48919 -0
  5. package/index.html +13 -0
  6. package/package.json +30 -0
  7. package/public/favicon.ico +0 -0
  8. package/src/Design.vue +53 -0
  9. package/src/assets/logo.png +0 -0
  10. package/src/canvas.js +34 -0
  11. package/src/components/builtin/CanvasBox.vue +22 -0
  12. package/src/components/builtin/CanvasCol.vue +89 -0
  13. package/src/components/builtin/CanvasCollection.js +278 -0
  14. package/src/components/builtin/CanvasCollection.vue +106 -0
  15. package/src/components/builtin/CanvasIcon.vue +30 -0
  16. package/src/components/builtin/CanvasImg.vue +18 -0
  17. package/src/components/builtin/CanvasPlaceholder.vue +26 -0
  18. package/src/components/builtin/CanvasRow.vue +67 -0
  19. package/src/components/builtin/CanvasRowColContainer.vue +42 -0
  20. package/src/components/builtin/CanvasSlot.vue +22 -0
  21. package/src/components/builtin/CanvasText.vue +18 -0
  22. package/src/components/builtin/builtin.json +955 -0
  23. package/src/components/builtin/helper.js +46 -0
  24. package/src/components/builtin/index.js +33 -0
  25. package/src/components/common/index.js +158 -0
  26. package/src/components/container/CanvasAction.vue +554 -0
  27. package/src/components/container/CanvasContainer.vue +244 -0
  28. package/src/components/container/CanvasDivider.vue +246 -0
  29. package/src/components/container/CanvasDragItem.vue +38 -0
  30. package/src/components/container/CanvasFooter.vue +86 -0
  31. package/src/components/container/CanvasMenu.vue +214 -0
  32. package/src/components/container/CanvasResize.vue +195 -0
  33. package/src/components/container/CanvasResizeBorder.vue +219 -0
  34. package/src/components/container/container.js +791 -0
  35. package/src/components/container/keyboard.js +147 -0
  36. package/src/components/container/shortCutPopover.vue +181 -0
  37. package/src/components/render/CanvasEmpty.vue +14 -0
  38. package/src/components/render/RenderMain.js +408 -0
  39. package/src/components/render/context.js +53 -0
  40. package/src/components/render/render.js +689 -0
  41. package/src/components/render/runner.js +140 -0
  42. package/src/i18n/en.json +5 -0
  43. package/src/i18n/zh.json +5 -0
  44. package/src/i18n.js +21 -0
  45. package/src/index.js +96 -0
  46. package/src/locale.js +19 -0
  47. package/src/lowcode.js +104 -0
  48. package/src/main.js +17 -0
  49. package/test/form.json +690 -0
  50. package/test/group.json +99 -0
  51. package/test/jsslot.json +427 -0
  52. package/vite.config.js +73 -0
package/test/form.json ADDED
@@ -0,0 +1,690 @@
1
+ {
2
+ "componentName": "Block",
3
+ "fileName": "CrmQuoteInfo",
4
+ "css": ".crm-quote-info .form-title {\r\n color: #252b3a;\r\n font-size: 14px;\r\n font-weight: bold;\r\n margin-bottom: 20px;\r\n padding-left: 12px;\r\n}\r\n.crm-quote-info .form-fixed-layout {\r\n display: grid;\r\n grid-template-columns: repeat(3, 1fr);\r\n grid-column-gap: 12px;\r\n}\r\n.crm-quote-info {\r\n background: #fff;\r\n padding: 12px;\r\n min-height: 500px;\r\n}\r\n.crm-quote-info .form-auto-layout {\r\n display: flex;\r\n flex-wrap: wrap;\r\n}\r\n.search-form {\r\n display: flex;\r\n align-items: center;\r\n justify-content: flex-end;\r\n width: 70%;\r\n}\r\n.icon-wrap {\r\n border: 1px solid #adb0b8;\r\n margin-left: 10px;\r\n border-radius: 3px;\r\n vertical-align: middle;\r\n cursor: pointer;\r\n height: 30px;\r\n display: flex;\r\n align-items: center;\r\n width: 24px;\r\n padding: 0 12px;\r\n justify-content: center;\r\n}\r\n.out-search-box {\r\n display: flex;\r\n justify-content: flex-end;\r\n}\r\n.tag-nomal {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.tag-nomal span {\r\n display: block;\r\n background-color: #adb0b8;\r\n border: 1px solid #adb0b8;\r\n border-radius: 4px;\r\n padding: 2px;\r\n color: #fff;\r\n height: 16px;\r\n line-height: 16px;\r\n}\r\n.tag-success span {\r\n background-color: #50d4a8;\r\n border: 1px solid #50d4a8;\r\n}",
5
+ "schema": {
6
+ "properties": [
7
+ {
8
+ "label": {
9
+ "zh_CN": "基础信息"
10
+ },
11
+ "description": {
12
+ "zh_CN": "基础信息"
13
+ },
14
+ "collapse": {
15
+ "number": 6,
16
+ "text": {
17
+ "zh_CN": "显示更多"
18
+ }
19
+ },
20
+ "content": [
21
+ {
22
+ "property": "isFixed",
23
+ "type": "Boolean",
24
+ "defaultValue": true,
25
+ "label": {
26
+ "text": {
27
+ "zh_CN": "是否固定列布局"
28
+ }
29
+ },
30
+ "description": {
31
+ "zh_CN": "配置固定列布局"
32
+ },
33
+ "widget": {
34
+ "component": "MetaSwitch",
35
+ "props": {}
36
+ },
37
+ "cols": 12,
38
+ "rules": [],
39
+ "required": true,
40
+ "handle": {}
41
+ },
42
+ {
43
+ "property": "isAuto",
44
+ "type": "Boolean",
45
+ "defaultValue": false,
46
+ "label": {
47
+ "text": {
48
+ "zh_CN": "是否弹性布局"
49
+ }
50
+ },
51
+ "description": {
52
+ "zh_CN": "配置弹性布局"
53
+ },
54
+ "widget": {
55
+ "component": "MetaSwitch",
56
+ "props": {}
57
+ },
58
+ "cols": 12,
59
+ "rules": [],
60
+ "required": true,
61
+ "handle": {}
62
+ },
63
+ {
64
+ "property": "cpqId",
65
+ "type": "String",
66
+ "defaultValue": "",
67
+ "label": {
68
+ "text": {
69
+ "zh_CN": "报价ID"
70
+ }
71
+ },
72
+ "description": {
73
+ "zh_CN": "报价ID"
74
+ },
75
+ "widget": {
76
+ "component": "MetaInput",
77
+ "props": {}
78
+ },
79
+ "cols": 12,
80
+ "rules": [],
81
+ "required": true,
82
+ "handle": {}
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ },
88
+ "children": [
89
+ {
90
+ "componentName": "div",
91
+ "id": "ffab54ff",
92
+ "props": {
93
+ "className": "crm-quote-info"
94
+ },
95
+ "children": [
96
+ {
97
+ "componentName": "TinyForm",
98
+ "id": "85d5eae4",
99
+ "props": {
100
+ "ref": "quotaForm",
101
+ "disabled": {
102
+ "type": "JSExpression",
103
+ "value": "this.state.formDisabled"
104
+ },
105
+ "model": {
106
+ "type": "JSExpression",
107
+ "value": "this.state.quotationInfo"
108
+ },
109
+ "label-position": "left",
110
+ "label-width": "99px",
111
+ "label-align": true,
112
+ "rules": {
113
+ "type": "JSExpression",
114
+ "value": "this.state.rules"
115
+ }
116
+ },
117
+ "children": [
118
+ {
119
+ "componentName": "div",
120
+ "id": "51852926",
121
+ "props": {
122
+ "className": "form-title"
123
+ },
124
+ "children": [
125
+ {
126
+ "componentName": "span",
127
+ "id": "99ea0dcf",
128
+ "children": {
129
+ "type": "i18n",
130
+ "key": "quotes.basic_info.basic_info"
131
+ }
132
+ }
133
+ ]
134
+ },
135
+ {
136
+ "componentName": "div",
137
+ "id": "d9e174ae",
138
+ "props": {
139
+ "className": {
140
+ "type": "JSExpression",
141
+ "value": "['basic-info', {'form-fixed-layout': this.props.isFixed}, {'form-auto-layout': this.props.isAuto}]"
142
+ }
143
+ },
144
+ "children": [
145
+ {
146
+ "componentName": "TinyFormItem",
147
+ "id": "eab52926",
148
+ "props": {
149
+ "label": {
150
+ "type": "i18n",
151
+ "key": "quotes.quote_list.project_name"
152
+ },
153
+ "prop": "cpqName"
154
+ },
155
+ "children": [
156
+ {
157
+ "componentName": "TinyTooltip",
158
+ "props": {
159
+ "value": {
160
+ "type": "JSExpression",
161
+ "value": "this.state.showTooltip",
162
+ "model": {
163
+ "prop": ""
164
+ }
165
+ },
166
+ "placement": "right",
167
+ "content": {
168
+ "type": "i18n",
169
+ "key": "tips.valid_err_msg_project_name"
170
+ },
171
+ "manual": true
172
+ },
173
+ "children": [
174
+ {
175
+ "componentName": "TinyInput",
176
+ "id": "eab11113",
177
+ "props": {
178
+ "value": {
179
+ "type": "JSExpression",
180
+ "value": "this.state.quotationInfo.cpqName",
181
+ "model": {
182
+ "prop": ""
183
+ }
184
+ },
185
+ "placeholder": {
186
+ "type": "JSExpression",
187
+ "value": "`xxx客户-${new Date().toLocaleDateString()}`"
188
+ },
189
+ "onFocus": {
190
+ "type": "JSExpression",
191
+ "value": "this.state.showTooltip = true"
192
+ },
193
+ "onBlur": {
194
+ "type": "JSExpression",
195
+ "value": "this.state.showTooltip = false"
196
+ }
197
+ }
198
+ }
199
+ ],
200
+ "id": "9dec979c"
201
+ }
202
+ ]
203
+ },
204
+ {
205
+ "componentName": "TinyFormItem",
206
+ "id": "eab174ae",
207
+ "props": {
208
+ "label": {
209
+ "type": "i18n",
210
+ "key": "quotes.basic_info.sales_method"
211
+ },
212
+ "prop": "salesMode"
213
+ },
214
+ "children": [
215
+ {
216
+ "componentName": "TinySelect",
217
+ "id": "eab11114",
218
+ "props": {
219
+ "value": {
220
+ "type": "JSExpression",
221
+ "value": "this.state.quotationInfo.salesMode",
222
+ "model": {
223
+ "prop": ""
224
+ }
225
+ },
226
+ "placeholder": {
227
+ "type": "i18n",
228
+ "key": "quotes.productlist.pleaseenterkeywords"
229
+ }
230
+ },
231
+ "children": [
232
+ {
233
+ "componentName": "TinyOption",
234
+ "props": {
235
+ "key": {
236
+ "type": "JSExpression",
237
+ "value": "item.key"
238
+ },
239
+ "label": {
240
+ "type": "JSExpression",
241
+ "value": "item.label"
242
+ },
243
+ "value": {
244
+ "type": "JSExpression",
245
+ "value": "item.value"
246
+ }
247
+ },
248
+ "id": "02944972"
249
+ }
250
+ ]
251
+ }
252
+ ]
253
+ },
254
+ {
255
+ "componentName": "TinyFormItem",
256
+ "id": "eab11111",
257
+ "props": {
258
+ "label": {
259
+ "type": "i18n",
260
+ "key": "quotes.basic_info.agreement_type_create"
261
+ },
262
+ "prop": "bizType"
263
+ },
264
+ "children": [
265
+ {
266
+ "componentName": "TinySelect",
267
+ "id": "eab11116",
268
+ "props": {
269
+ "value": {
270
+ "type": "JSExpression",
271
+ "value": "this.state.quotationInfo.bizType",
272
+ "model": {
273
+ "prop": ""
274
+ }
275
+ },
276
+ "placeholder": {
277
+ "type": "i18n",
278
+ "key": "crm.common.pleaseselect"
279
+ }
280
+ },
281
+ "children": [
282
+ {
283
+ "componentName": "TinyOption",
284
+ "id": "eab11117",
285
+ "props": {
286
+ "key": {
287
+ "type": "JSExpression",
288
+ "value": "item.value"
289
+ },
290
+ "label": {
291
+ "type": "JSExpression",
292
+ "value": "item.text"
293
+ },
294
+ "value": {
295
+ "type": "JSExpression",
296
+ "value": "item.value"
297
+ }
298
+ }
299
+ }
300
+ ]
301
+ }
302
+ ]
303
+ },
304
+ {
305
+ "componentName": "TinyFormItem",
306
+ "id": "eab11112",
307
+ "props": {
308
+ "label": {
309
+ "type": "i18n",
310
+ "key": "quotes.basic_info.opportunity_name_create"
311
+ }
312
+ },
313
+ "children": [
314
+ {
315
+ "componentName": "TinyPopeditor",
316
+ "props": {
317
+ "value": {
318
+ "type": "JSExpression",
319
+ "value": "this.state.quotationInfo.opptyName",
320
+ "model": {
321
+ "prop": ""
322
+ }
323
+ },
324
+ "placeholder": {
325
+ "type": "i18n",
326
+ "key": "quotes.basic_info.oppty_error"
327
+ },
328
+ "title": {
329
+ "type": "i18n",
330
+ "key": "business.basic_info.choose_opportunity"
331
+ },
332
+ "width": "700",
333
+ "grid-op": {
334
+ "type": "JSExpression",
335
+ "value": "this.state.gridOp"
336
+ },
337
+ "text-field": "opportunity_name",
338
+ "value-field": "opportunity_id",
339
+ "show-pager": true,
340
+ "remote-search": {
341
+ "type": "JSExpression",
342
+ "value": "this.remoteSearch"
343
+ },
344
+ "pager-op": {
345
+ "type": "JSExpression",
346
+ "value": "this.state.gridOp.pagerOp"
347
+ },
348
+ "conditions": {
349
+ "type": "JSExpression",
350
+ "value": "this.state.conditions"
351
+ },
352
+ "onChange": {
353
+ "type": "JSExpression",
354
+ "value": "this.opportunityChange"
355
+ }
356
+ },
357
+ "children": [
358
+ {
359
+ "componentName": "Template",
360
+ "props": {
361
+ "slot": {
362
+ "name": "search",
363
+ "params": "slotScope"
364
+ }
365
+ },
366
+ "children": [
367
+ {
368
+ "componentName": "div",
369
+ "props": {
370
+ "className": "out-search-box"
371
+ },
372
+ "children": [
373
+ {
374
+ "componentName": "div",
375
+ "props": {
376
+ "className": "search-form"
377
+ },
378
+ "children": [
379
+ {
380
+ "componentName": "TinySelect",
381
+ "props": {
382
+ "value": {
383
+ "type": "JSExpression",
384
+ "value": "this.state.conditionForm.oppSourceSelected",
385
+ "model": {
386
+ "prop": ""
387
+ }
388
+ },
389
+ "placeholder": {
390
+ "type": "i18n",
391
+ "key": "crm.common.pleaseselect"
392
+ },
393
+ "onChange": {
394
+ "type": "JSExpression",
395
+ "value": "slotScope.searchOp.doSearch(this.state.conditionForm)"
396
+ }
397
+ },
398
+ "children": [
399
+ {
400
+ "componentName": "TinyOption",
401
+ "props": {
402
+ "key": {
403
+ "type": "JSExpression",
404
+ "value": "item.value"
405
+ },
406
+ "label": {
407
+ "type": "JSExpression",
408
+ "value": "item.label"
409
+ },
410
+ "value": {
411
+ "type": "JSExpression",
412
+ "value": "item.value"
413
+ }
414
+ }
415
+ }
416
+ ]
417
+ },
418
+ {
419
+ "componentName": "TinySelect",
420
+ "props": {
421
+ "value": {
422
+ "type": "JSExpression",
423
+ "value": "this.state.conditionForm.searchTypeSelected",
424
+ "model": {
425
+ "prop": ""
426
+ }
427
+ },
428
+ "placeholder": {
429
+ "type": "i18n",
430
+ "key": "crm.common.pleaseselect"
431
+ }
432
+ },
433
+ "children": [
434
+ {
435
+ "componentName": "TinyOption",
436
+ "props": {
437
+ "key": {
438
+ "type": "JSExpression",
439
+ "value": "item.value"
440
+ },
441
+ "label": {
442
+ "type": "JSExpression",
443
+ "value": "item.label"
444
+ },
445
+ "value": {
446
+ "type": "JSExpression",
447
+ "value": "item.value"
448
+ }
449
+ }
450
+ }
451
+ ]
452
+ },
453
+ {
454
+ "componentName": "TinySearch",
455
+ "props": {
456
+ "value": {
457
+ "type": "JSExpression",
458
+ "value": "this.state.conditionForm.searchOpportunityValue",
459
+ "model": {
460
+ "prop": ""
461
+ }
462
+ },
463
+ "placeholder": {
464
+ "type": "i18n",
465
+ "key": "crm.common.pleaseselect"
466
+ },
467
+ "size": "mini",
468
+ "onSearch": {
469
+ "type": "JSExpression",
470
+ "value": "slotScope.searchOp.doSearch(this.state.conditionForm)"
471
+ }
472
+ }
473
+ },
474
+ {
475
+ "componentName": "div",
476
+ "props": {
477
+ "className": "icon-wrap",
478
+ "onClick": {
479
+ "type": "JSExpression",
480
+ "value": "slotScope.searchOp.doSearch(this.state.conditionForm)"
481
+ }
482
+ },
483
+ "children": [
484
+ {
485
+ "componentName": "Icon",
486
+ "props": {
487
+ "name": "IconRefres"
488
+ }
489
+ }
490
+ ]
491
+ }
492
+ ]
493
+ }
494
+ ]
495
+ }
496
+ ]
497
+ }
498
+ ],
499
+ "id": "17ced631"
500
+ }
501
+ ]
502
+ }
503
+ ]
504
+ },
505
+ {
506
+ "componentName": "div",
507
+ "id": "eab11119",
508
+ "props": {
509
+ "className": "form-title"
510
+ },
511
+ "children": {
512
+ "type": "i18n",
513
+ "key": "quotes.basic_info.customer_info"
514
+ }
515
+ },
516
+ {
517
+ "componentName": "div",
518
+ "id": "eab11121",
519
+ "props": {
520
+ "className": {
521
+ "type": "JSExpression",
522
+ "value": "['customer-info', {'form-fixed-layout': this.props.isFixed}, {'form-auto-layout': this.props.isAuto}]"
523
+ }
524
+ },
525
+ "children": [
526
+ {
527
+ "componentName": "TinyFormItem",
528
+ "id": "eab11122",
529
+ "props": {
530
+ "label": {
531
+ "type": "i18n",
532
+ "key": "quotes.quotelistmodal.customername"
533
+ }
534
+ },
535
+ "children": [
536
+ {
537
+ "componentName": "TinyInput",
538
+ "id": "eab11124",
539
+ "props": {
540
+ "value": {
541
+ "type": "JSExpression",
542
+ "value": "this.state.quotationInfo.customerName",
543
+ "model": {
544
+ "prop": ""
545
+ }
546
+ },
547
+ "disabled": {
548
+ "type": "JSExpression",
549
+ "value": "this.state.customDisabled"
550
+ }
551
+ },
552
+ "children": [
553
+ {
554
+ "componentName": "Template",
555
+ "props": {
556
+ "slot": {
557
+ "name": "suffix"
558
+ }
559
+ },
560
+ "children": [
561
+ {
562
+ "componentName": "div",
563
+ "condition": {
564
+ "type": "JSExpression",
565
+ "value": "this.state.customerNameTrack?.customer_track_name"
566
+ },
567
+ "props": {
568
+ "className": "tag-nomal"
569
+ },
570
+ "children": [
571
+ {
572
+ "componentName": "span",
573
+ "children": {
574
+ "type": "JSExpression",
575
+ "value": "this.state.customerNameTrack?.customer_track_name"
576
+ }
577
+ }
578
+ ],
579
+ "id": "ffadf00e"
580
+ }
581
+ ]
582
+ }
583
+ ]
584
+ }
585
+ ]
586
+ },
587
+ {
588
+ "componentName": "TinyFormItem",
589
+ "id": "eab11123",
590
+ "props": {
591
+ "label": {
592
+ "type": "i18n",
593
+ "key": "quotes.quotelistmodal.amountnumber"
594
+ }
595
+ },
596
+ "children": [
597
+ {
598
+ "componentName": "TinyInput",
599
+ "id": "eab11125",
600
+ "props": {
601
+ "value": {
602
+ "type": "JSExpression",
603
+ "value": "this.state.quotationInfo.customAccount",
604
+ "model": {
605
+ "prop": ""
606
+ }
607
+ },
608
+ "onBlur": {
609
+ "type": "JSExpression",
610
+ "value": "this.customAccountChange"
611
+ }
612
+ },
613
+ "children": [
614
+ {
615
+ "componentName": "Template",
616
+ "props": {
617
+ "slot": {
618
+ "name": "suffix"
619
+ }
620
+ },
621
+ "children": [
622
+ {
623
+ "componentName": "div",
624
+ "condition": {
625
+ "type": "JSExpression",
626
+ "value": "this.state.customerAcctNoTrack?.customer_track_name"
627
+ },
628
+ "props": {
629
+ "className": "tag-nomal tag-success"
630
+ },
631
+ "children": [
632
+ {
633
+ "componentName": "span",
634
+ "children": {
635
+ "type": "JSExpression",
636
+ "value": "this.state.customerAcctNoTrack?.customer_track_name"
637
+ },
638
+ "id": "264153c5"
639
+ }
640
+ ],
641
+ "id": "84b2f9c0"
642
+ }
643
+ ]
644
+ }
645
+ ]
646
+ },
647
+ {
648
+ "componentName": "TinyAlert",
649
+ "condition": {
650
+ "type": "JSExpression",
651
+ "value": "this.state.validateInfo.acctNoInvalidError"
652
+ },
653
+ "props": {
654
+ "type": "warning",
655
+ "description": {
656
+ "type": "JSExpression",
657
+ "value": "this.state.validateInfo.acctNoInvalidError"
658
+ }
659
+ },
660
+ "id": "c7263fd2"
661
+ },
662
+ {
663
+ "componentName": "TinyAlert",
664
+ "condition": {
665
+ "type": "JSExpression",
666
+ "value": "this.state.validateInfo.acctountNoResigteredTip"
667
+ },
668
+ "props": {
669
+ "type": "warning",
670
+ "description": {
671
+ "type": "JSExpression",
672
+ "value": "state.validateInfo.acctountNoResigteredTip"
673
+ }
674
+ },
675
+ "id": "fe165547"
676
+ }
677
+ ]
678
+ }
679
+ ]
680
+ }
681
+ ]
682
+ }
683
+ ]
684
+ }
685
+ ],
686
+ "type": "block",
687
+ "component": "CrmQuoteInfo",
688
+ "label": "CrmQuoteInfo",
689
+ "methods": {}
690
+ }