@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
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <div class="canvas-container">
3
+ <div class="container-box">
4
+ <div class="container-tip">
5
+ <slot>{{ placeholder }}</slot>
6
+ </div>
7
+ </div>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ props: {
14
+ placeholder: {
15
+ type: String,
16
+ default: '请将元素拖放到这里'
17
+ }
18
+ }
19
+ }
20
+ </script>
21
+
22
+ <style lang="less" scoped>
23
+ .canvas-container {
24
+ min-height: 48px;
25
+ }
26
+ </style>
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div class="canvas-row">
3
+ <slot>
4
+ <canvas-placeholder :placeholder="$attrs.placeholder"></canvas-placeholder>
5
+ </slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import { computed } from 'vue'
11
+ import CanvasPlaceholder from './CanvasPlaceholder.vue'
12
+ import { getStyleValue, alignMap, justAlignMap } from './helper'
13
+
14
+ export default {
15
+ components: {
16
+ CanvasPlaceholder
17
+ },
18
+ props: {
19
+ minHeight: {
20
+ type: [String, Number],
21
+ default: ''
22
+ },
23
+ rowGap: {
24
+ type: [String, Number],
25
+ default: ''
26
+ },
27
+ colGap: {
28
+ type: [String, Number],
29
+ default: ''
30
+ },
31
+ align: {
32
+ type: [String, Number],
33
+ default: ''
34
+ },
35
+ justAlign: {
36
+ type: [String, Number],
37
+ default: ''
38
+ }
39
+ },
40
+ setup(props) {
41
+ const styles = computed(() => ({
42
+ minHeight: getStyleValue(props.minHeight),
43
+ rowGap: getStyleValue(props.rowGap),
44
+ colGap: getStyleValue(props.colGap),
45
+ align: alignMap[props.align] || 'stretch',
46
+ justAlign: justAlignMap[props.justAlign] || 'flex-start'
47
+ }))
48
+
49
+ return {
50
+ styles
51
+ }
52
+ }
53
+ }
54
+ </script>
55
+
56
+ <style lang="less" scoped>
57
+ .canvas-row {
58
+ display: flex;
59
+ flex-direction: row;
60
+ flex-wrap: nowrap;
61
+ justify-content: v-bind('styles.justAlign');
62
+ align-items: v-bind('styles.align');
63
+ column-gap: v-bind('styles.rowGap');
64
+ row-gap: v-bind('styles.colGap');
65
+ min-height: v-bind('styles.minHeight');
66
+ }
67
+ </style>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div class="row-col-container">
3
+ <slot>
4
+ <canvas-placeholder :placeholder="$attrs.placeholder"></canvas-placeholder>
5
+ </slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import { computed } from 'vue'
11
+ import CanvasPlaceholder from './CanvasPlaceholder.vue'
12
+ import { getStyleValue } from './helper'
13
+
14
+ export default {
15
+ components: {
16
+ CanvasPlaceholder
17
+ },
18
+ props: {
19
+ rowGap: {
20
+ type: [String, Number],
21
+ default: ''
22
+ }
23
+ },
24
+ setup(props) {
25
+ const styles = computed(() => ({
26
+ rowGap: getStyleValue(props.rowGap)
27
+ }))
28
+
29
+ return {
30
+ styles
31
+ }
32
+ }
33
+ }
34
+ </script>
35
+
36
+ <style lang="less" scoped>
37
+ .row-col-container {
38
+ display: flex;
39
+ flex-direction: column;
40
+ row-gap: v-bind('styles.rowGap');
41
+ }
42
+ </style>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <slot>
3
+ <canvas-placeholder v-bind="$attrs"></canvas-placeholder>
4
+ </slot>
5
+ </template>
6
+
7
+ <script>
8
+ import CanvasPlaceholder from './CanvasPlaceholder.vue'
9
+ export default {
10
+ components: {
11
+ CanvasPlaceholder
12
+ },
13
+ props: {
14
+ name: {
15
+ type: String
16
+ },
17
+ params: {
18
+ type: String
19
+ }
20
+ }
21
+ }
22
+ </script>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <span :class="['canvas-text', className]">{{ text }}</span>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ props: {
8
+ text: {
9
+ type: String,
10
+ default: ''
11
+ },
12
+ className: {
13
+ type: String,
14
+ default: ''
15
+ }
16
+ }
17
+ }
18
+ </script>