@tmagic/editor 1.3.0-alpha.2 → 1.3.0-alpha.21

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 (167) hide show
  1. package/dist/style.css +91 -120
  2. package/dist/tmagic-editor.js +4609 -3257
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +5708 -4337
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +21 -22
  7. package/src/Editor.vue +29 -7
  8. package/src/components/CodeBlockEditor.vue +170 -0
  9. package/src/components/CodeParams.vue +60 -0
  10. package/src/components/ContentMenu.vue +30 -11
  11. package/src/components/Icon.vue +5 -1
  12. package/src/components/Resizer.vue +45 -0
  13. package/src/components/ScrollBar.vue +5 -1
  14. package/src/components/ScrollViewer.vue +5 -1
  15. package/src/components/SearchInput.vue +4 -0
  16. package/src/components/{Layout.vue → SplitView.vue} +8 -4
  17. package/src/components/ToolButton.vue +5 -1
  18. package/src/editorProps.ts +35 -4
  19. package/src/fields/Code.vue +28 -20
  20. package/src/fields/CodeLink.vue +15 -10
  21. package/src/fields/CodeSelect.vue +19 -10
  22. package/src/fields/CodeSelectCol.vue +67 -83
  23. package/src/fields/DataSourceFieldSelect.vue +47 -0
  24. package/src/fields/DataSourceFields.vue +24 -21
  25. package/src/fields/DataSourceInput.vue +318 -0
  26. package/src/fields/DataSourceMethodSelect.vue +136 -0
  27. package/src/fields/DataSourceMethods.vue +103 -0
  28. package/src/fields/DataSourceSelect.vue +68 -0
  29. package/src/fields/EventSelect.vue +62 -22
  30. package/src/fields/KeyValue.vue +13 -11
  31. package/src/fields/UISelect.vue +59 -15
  32. package/src/hooks/index.ts +21 -0
  33. package/src/hooks/use-code-block-edit.ts +84 -0
  34. package/src/hooks/use-data-source-method.ts +100 -0
  35. package/src/{utils/stage.ts → hooks/use-stage.ts} +4 -7
  36. package/src/icons/AppManageIcon.vue +5 -1
  37. package/src/icons/CenterIcon.vue +13 -0
  38. package/src/icons/CodeIcon.vue +5 -3
  39. package/src/index.ts +24 -3
  40. package/src/initService.ts +75 -16
  41. package/src/layouts/AddPageBox.vue +5 -1
  42. package/src/layouts/CodeEditor.vue +66 -11
  43. package/src/layouts/Framework.vue +32 -28
  44. package/src/layouts/NavMenu.vue +5 -1
  45. package/src/layouts/PropsPanel.vue +14 -4
  46. package/src/layouts/sidebar/ComponentListPanel.vue +11 -10
  47. package/src/layouts/sidebar/LayerMenu.vue +13 -25
  48. package/src/layouts/sidebar/LayerNode.vue +40 -0
  49. package/src/layouts/sidebar/LayerPanel.vue +71 -28
  50. package/src/layouts/sidebar/Sidebar.vue +13 -17
  51. package/src/layouts/sidebar/code-block/CodeBlockList.vue +84 -118
  52. package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +63 -0
  53. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +39 -34
  54. package/src/layouts/sidebar/data-source/DataSourceList.vue +145 -0
  55. package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +17 -65
  56. package/src/layouts/workspace/Breadcrumb.vue +5 -1
  57. package/src/layouts/workspace/PageBar.vue +5 -1
  58. package/src/layouts/workspace/PageBarScrollContainer.vue +5 -1
  59. package/src/layouts/workspace/Stage.vue +30 -8
  60. package/src/layouts/workspace/ViewerMenu.vue +15 -36
  61. package/src/layouts/workspace/Workspace.vue +9 -134
  62. package/src/services/codeBlock.ts +20 -72
  63. package/src/services/dataSource.ts +17 -2
  64. package/src/services/dep.ts +23 -20
  65. package/src/services/editor.ts +3 -3
  66. package/src/services/keybinding.ts +185 -0
  67. package/src/services/props.ts +2 -2
  68. package/src/services/storage.ts +3 -2
  69. package/src/theme/code-block.scss +5 -117
  70. package/src/theme/code-editor.scss +27 -2
  71. package/src/theme/content-menu.scss +1 -1
  72. package/src/theme/data-source-input.scss +18 -0
  73. package/src/theme/data-source-methods.scss +13 -0
  74. package/src/theme/event.scss +15 -12
  75. package/src/theme/framework.scss +0 -3
  76. package/src/theme/layer-panel.scss +6 -0
  77. package/src/theme/layout.scss +4 -0
  78. package/src/theme/resizer.scss +25 -10
  79. package/src/theme/stage.scss +4 -0
  80. package/src/theme/theme.scss +2 -0
  81. package/src/type.ts +105 -7
  82. package/src/utils/config.ts +1 -1
  83. package/src/utils/content-menu.ts +92 -0
  84. package/src/utils/data-source/formConfigs/base.ts +35 -30
  85. package/src/utils/data-source/index.ts +75 -6
  86. package/src/utils/dep.ts +39 -7
  87. package/src/utils/index.ts +1 -1
  88. package/src/utils/keybinding-config.ts +120 -0
  89. package/src/utils/props.ts +298 -155
  90. package/src/utils/undo-redo.ts +1 -1
  91. package/types/Editor.vue.d.ts +37 -4
  92. package/types/components/CodeBlockEditor.vue.d.ts +23 -0
  93. package/types/components/CodeParams.vue.d.ts +26 -0
  94. package/types/components/ContentMenu.vue.d.ts +8 -3
  95. package/types/components/Icon.vue.d.ts +2 -2
  96. package/types/{layouts → components}/Resizer.vue.d.ts +2 -2
  97. package/types/components/ScrollBar.vue.d.ts +1 -1
  98. package/types/components/ScrollViewer.vue.d.ts +8 -5
  99. package/types/components/SearchInput.vue.d.ts +1 -1
  100. package/types/components/{Layout.vue.d.ts → SplitView.vue.d.ts} +9 -6
  101. package/types/components/ToolButton.vue.d.ts +10 -7
  102. package/types/editorProps.d.ts +23 -4
  103. package/types/fields/Code.vue.d.ts +23 -18
  104. package/types/fields/CodeLink.vue.d.ts +13 -22
  105. package/types/fields/CodeSelect.vue.d.ts +12 -20
  106. package/types/fields/CodeSelectCol.vue.d.ts +14 -15
  107. package/types/fields/DataSourceFieldSelect.vue.d.ts +29 -0
  108. package/types/fields/DataSourceFields.vue.d.ts +13 -21
  109. package/types/fields/DataSourceInput.vue.d.ts +34 -0
  110. package/types/fields/DataSourceMethodSelect.vue.d.ts +29 -0
  111. package/types/fields/DataSourceMethods.vue.d.ts +32 -0
  112. package/types/fields/DataSourceSelect.vue.d.ts +40 -0
  113. package/types/fields/EventSelect.vue.d.ts +3 -14
  114. package/types/fields/KeyValue.vue.d.ts +15 -27
  115. package/types/fields/UISelect.vue.d.ts +3 -12
  116. package/types/hooks/index.d.ts +3 -0
  117. package/types/hooks/use-code-block-edit.d.ts +125 -0
  118. package/types/hooks/use-data-source-method.d.ts +123 -0
  119. package/types/icons/AppManageIcon.vue.d.ts +1 -1
  120. package/types/icons/CenterIcon.vue.d.ts +2 -0
  121. package/types/icons/CodeIcon.vue.d.ts +1 -1
  122. package/types/index.d.ts +12 -2
  123. package/types/initService.d.ts +2 -2
  124. package/types/layouts/AddPageBox.vue.d.ts +1 -1
  125. package/types/layouts/CodeEditor.vue.d.ts +18 -10
  126. package/types/layouts/Framework.vue.d.ts +11 -32
  127. package/types/layouts/NavMenu.vue.d.ts +7 -4
  128. package/types/layouts/PropsPanel.vue.d.ts +276 -4
  129. package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +4 -4
  130. package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
  131. package/types/layouts/sidebar/LayerNode.vue.d.ts +16 -0
  132. package/types/layouts/sidebar/LayerPanel.vue.d.ts +5 -5
  133. package/types/layouts/sidebar/Sidebar.vue.d.ts +16 -16
  134. package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +7 -12
  135. package/types/layouts/sidebar/code-block/CodeBlockListPanel.vue.d.ts +28 -0
  136. package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +4 -2
  137. package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +14 -0
  138. package/types/layouts/sidebar/data-source/DataSourceListPanel.vue.d.ts +1 -11
  139. package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -1
  140. package/types/layouts/workspace/PageBar.vue.d.ts +5 -5
  141. package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +2 -2
  142. package/types/layouts/workspace/Stage.vue.d.ts +2 -2
  143. package/types/layouts/workspace/ViewerMenu.vue.d.ts +7 -4
  144. package/types/layouts/workspace/Workspace.vue.d.ts +9 -9
  145. package/types/services/codeBlock.d.ts +6 -37
  146. package/types/services/dataSource.d.ts +7 -1
  147. package/types/services/dep.d.ts +12 -21
  148. package/types/services/editor.d.ts +1 -1
  149. package/types/services/keybinding.d.ts +20 -0
  150. package/types/services/props.d.ts +10 -115
  151. package/types/type.d.ts +97 -7
  152. package/types/utils/config.d.ts +1 -1
  153. package/types/utils/content-menu.d.ts +7 -0
  154. package/types/utils/data-source/formConfigs/base.d.ts +2 -2
  155. package/types/utils/data-source/index.d.ts +7 -1
  156. package/types/utils/dep.d.ts +4 -2
  157. package/types/utils/index.d.ts +1 -1
  158. package/types/utils/keybinding-config.d.ts +3 -0
  159. package/types/utils/props.d.ts +13 -102
  160. package/src/components/CodeDraftEditor.vue +0 -144
  161. package/src/components/FunctionEditor.vue +0 -190
  162. package/src/layouts/Resizer.vue +0 -32
  163. package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +0 -96
  164. package/types/components/CodeDraftEditor.vue.d.ts +0 -58
  165. package/types/components/FunctionEditor.vue.d.ts +0 -192
  166. package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +0 -25
  167. /package/types/{utils/stage.d.ts → hooks/use-stage.d.ts} +0 -0
package/dist/style.css CHANGED
@@ -134,10 +134,7 @@
134
134
  width: 100%;
135
135
  }
136
136
  .m-editor-content {
137
- width: 100%;
138
137
  height: calc(100% - 35px);
139
- display: flex;
140
- justify-self: space-between;
141
138
  }
142
139
  .m-editor-framework-center {
143
140
  position: relative;
@@ -371,6 +368,11 @@
371
368
  .magic-editor-layer-panel .cus-tree-node {
372
369
  width: 100%;
373
370
  overflow: hidden;
371
+ display: flex;
372
+ justify-content: space-between;
373
+ }
374
+ .magic-editor-layer-panel .cus-tree-node .layer-node-tool {
375
+ margin-right: 15px;
374
376
  }
375
377
  .magic-editor-layer-panel .cus-tree-node-hover {
376
378
  background-color: #f3f5f9;
@@ -482,15 +484,34 @@
482
484
  width: 8px;
483
485
  margin: 0 -5px;
484
486
  height: 100%;
485
- opacity: 0.9;
487
+ opacity: 0.8;
486
488
  background: padding-box #d8dee8;
487
489
  box-sizing: border-box;
488
490
  cursor: col-resize;
489
491
  z-index: 1;
492
+ position: relative;
490
493
  }
491
494
  .m-editor-resizer:hover {
492
495
  border-color: #d8dee8;
493
496
  }
497
+ .m-editor-resizer:hover .icon-container {
498
+ visibility: visible;
499
+ opacity: 1;
500
+ }
501
+ .m-editor-resizer.m-editor-resizer-draging::after {
502
+ content: "";
503
+ position: absolute;
504
+ width: 600px;
505
+ height: 100%;
506
+ left: 0;
507
+ }
508
+ .m-editor-resizer.m-editor-resizer-draging::before {
509
+ content: "";
510
+ position: absolute;
511
+ width: 600px;
512
+ height: 100%;
513
+ right: 0;
514
+ }
494
515
  .m-editor-resizer .icon-container {
495
516
  visibility: hidden;
496
517
  opacity: 0;
@@ -516,10 +537,6 @@
516
537
  color: #fff;
517
538
  font-size: 18px;
518
539
  }
519
- .magic-editor-resizer:hover .icon-container {
520
- visibility: visible;
521
- opacity: 1;
522
- }
523
540
  .m-editor-workspace {
524
541
  height: 100%;
525
542
  width: 100%;
@@ -618,7 +635,7 @@
618
635
  font-weight: 600;
619
636
  padding: 4px 0px;
620
637
  overflow: auto;
621
- max-height: 100%;
638
+ max-height: 80%;
622
639
  }
623
640
  .magic-editor-content-menu .menu-item {
624
641
  color: #333;
@@ -660,6 +677,9 @@
660
677
  justify-content: center;
661
678
  align-items: center;
662
679
  }
680
+ .m-editor-stage:focus-visible {
681
+ outline: none;
682
+ }
663
683
  .m-editor-stage-container {
664
684
  width: 100%;
665
685
  height: 100%;
@@ -675,9 +695,30 @@
675
695
  .magic-code-editor {
676
696
  width: 100%;
677
697
  }
678
- .magic-code-editor .margin {
698
+ .magic-code-editor-wrapper {
699
+ width: 100%;
700
+ height: 100%;
701
+ position: relative;
702
+ }
703
+ .magic-code-editor-wrapper.full-screen {
704
+ position: fixed;
705
+ z-index: 10000;
706
+ top: 0;
707
+ left: 0;
708
+ }
709
+ .magic-code-editor-wrapper .magic-code-editor-content {
710
+ width: 100%;
711
+ height: 100%;
712
+ }
713
+ .magic-code-editor-wrapper .magic-code-editor-content .margin {
679
714
  margin: 0;
680
715
  }
716
+ .magic-code-editor-wrapper .magic-code-editor-full-screen-icon {
717
+ position: absolute;
718
+ top: 5px;
719
+ right: 0;
720
+ z-index: 11;
721
+ }
681
722
  .magic-editor-icon img {
682
723
  max-width: 100%;
683
724
  max-height: 100%;
@@ -701,113 +742,11 @@
701
742
  .m-fields-code-select .el-card__header {
702
743
  display: none;
703
744
  }
704
- .el-dialog.is-fullscreen.code-editor-dialog {
705
- overflow: hidden;
706
- }
707
- .code-editor-dialog .tmagic-design-card .t-card__header {
708
- display: block;
709
- }
710
- .code-editor-dialog .el-dialog__body,
711
- .code-editor-dialog .t-dialog__body {
712
- height: 90%;
713
- padding-top: 10px;
714
- }
715
- .code-editor-dialog .tmagic-design-card {
716
- height: 100%;
717
- background: #fff;
718
- }
719
- .code-editor-dialog .tmagic-design-card .el-card__body,
720
- .code-editor-dialog .tmagic-design-card .t-card__body {
721
- height: 100%;
722
- background: #fff;
723
- }
724
- .code-editor-dialog .code-editor-layout {
725
- height: 100%;
726
- border: 1px solid #e4e7ed;
727
- }
728
- .code-editor-dialog .code-editor-layout .side-tree {
729
- height: 100%;
730
- overflow: auto;
731
- }
732
- .code-editor-dialog .code-editor-layout .side-tree .el-tree-node__label {
733
- width: 100%;
734
- }
735
- .code-editor-dialog .code-editor-layout .side-tree .list-container {
736
- width: 100%;
737
- overflow: hidden;
738
- margin-left: -10px;
739
- }
740
- .code-editor-dialog .code-editor-layout .side-tree .list-container .list-item {
741
- width: 100%;
742
- margin: 10px 0;
743
- line-height: 30px;
744
- }
745
- .code-editor-dialog .code-editor-layout .side-tree .list-container .list-item .code-name {
746
- width: 100%;
747
- font-size: 14px;
748
- overflow: hidden;
749
- white-space: nowrap;
750
- text-overflow: ellipsis;
751
- }
752
- .code-editor-dialog .code-name-wrapper {
753
- display: flex;
754
- align-items: center;
755
- font-size: 16px;
756
- margin-bottom: 10px;
757
- }
758
- .code-editor-dialog .code-name-wrapper .code-name-label {
759
- margin-right: 10px;
760
- }
761
- .code-editor-dialog .code-name-wrapper .code-name-input {
762
- width: 300px;
763
- }
764
- .code-editor-dialog .m-editor-code-block-editor-panel-list-mode {
765
- height: 100%;
766
- z-index: 10;
767
- background: #fff;
768
- }
769
- .code-editor-dialog .m-editor-code-block-editor-panel-list-mode .el-card {
770
- border: 0;
771
- }
772
- .code-editor-dialog .m-editor-code-block-editor-panel {
773
- position: absolute;
774
- top: 0;
775
- left: 4px;
776
- width: calc(100% - 9px);
777
- height: 100%;
778
- z-index: 10;
779
- background: #fff;
780
- }
781
- .code-editor-dialog .m-editor-code-block-editor-panel .el-card {
782
- border: 0;
783
- }
784
- .code-editor-dialog .m-editor-wrapper {
785
- height: 100%;
786
- }
787
- .code-editor-dialog .m-editor-wrapper.fullScreen {
788
- height: 100%;
789
- width: 100%;
790
- position: fixed;
791
- top: 0;
792
- left: 0;
793
- z-index: 100;
794
- }
795
- .code-editor-dialog .m-editor-wrapper .m-editor-container {
796
- height: calc(100% - 45px);
797
- }
798
- .code-editor-dialog .m-editor-wrapper .m-editor-content-bottom {
799
- height: 45px;
800
- width: 100%;
801
- display: flex;
802
- justify-content: end;
803
- background: #fff;
804
- position: absolute;
805
- right: 20px;
806
- bottom: 0;
745
+ .m-editor-code-block-editor .tmagic-design-table {
746
+ height: 180px;
807
747
  }
808
- .code-editor-dialog .m-editor-wrapper .m-editor-content-bottom > button {
809
- height: 30px;
810
- margin-top: 5px;
748
+ .m-editor-code-block-editor .el-drawer__body {
749
+ padding: 10px 20px;
811
750
  }
812
751
  .m-fields-event-select {
813
752
  width: 100%;
@@ -828,17 +767,21 @@
828
767
  .m-fields-event-select .el-card.is-always-shadow {
829
768
  box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.12);
830
769
  }
831
- .m-fields-code-select-col {
770
+ .m-fields-code-select-col,
771
+ .m-fields-data-source-method-select {
832
772
  width: 100%;
833
773
  }
834
- .m-fields-code-select-col .code-select-container {
774
+ .code-select-container,
775
+ .data-source-method-select-container {
835
776
  display: flex;
836
777
  align-items: center;
837
778
  }
838
- .m-fields-code-select-col .code-select-container .select {
779
+ .code-select-container .select,
780
+ .data-source-method-select-container .select {
839
781
  flex: 10 0 100px;
840
782
  }
841
- .m-fields-code-select-col .code-select-container .icon {
783
+ .code-select-container .icon,
784
+ .data-source-method-select-container .icon {
842
785
  flex: 1 0 20px;
843
786
  cursor: pointer;
844
787
  margin-right: 5px;
@@ -848,6 +791,9 @@
848
791
  display: flex;
849
792
  justify-self: space-between;
850
793
  }
794
+ .m-editor-layout:has(.m-editor-resizer-draging) {
795
+ overflow: hidden;
796
+ }
851
797
  .m-editor-breadcrumb {
852
798
  position: absolute;
853
799
  left: 5px;
@@ -925,6 +871,31 @@
925
871
  justify-content: flex-end;
926
872
  margin-top: 15px;
927
873
  }
874
+ .m-editor-data-source-methods {
875
+ width: 100%;
876
+ }
877
+ .m-editor-data-source-methods .tmagic-design-table {
878
+ width: 100%;
879
+ }
880
+ .m-editor-data-source-methods .m-editor-data-source-methods-footer {
881
+ display: flex;
882
+ justify-content: flex-end;
883
+ margin-top: 15px;
884
+ }
885
+ .tmagic-data-source-input-text .el-input__wrapper.tmagic-data-source-input-text-wrapper {
886
+ overflow: hidden;
887
+ padding-right: 30px;
888
+ }
889
+ .tmagic-data-source-input-text .el-input__inner {
890
+ display: flex;
891
+ align-items: center;
892
+ overflow: hidden;
893
+ white-space: nowrap;
894
+ }
895
+ .tmagic-data-source-input-text .tmagic-data-source-input-icon {
896
+ position: absolute;
897
+ right: 7px;
898
+ }
928
899
  .m-fields-key-value-item {
929
900
  display: flex;
930
901
  margin-bottom: 10px;