@houaoran/designer 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 (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/dist/components.es.js +11424 -0
  4. package/dist/components.umd.js +878 -0
  5. package/dist/index.es.js +39113 -0
  6. package/dist/index.umd.js +1187 -0
  7. package/package.json +96 -0
  8. package/src/components/DragBox.vue +49 -0
  9. package/src/components/DragTool.vue +235 -0
  10. package/src/components/EventConfig.vue +557 -0
  11. package/src/components/FcDesigner.vue +2569 -0
  12. package/src/components/FcTitle.vue +69 -0
  13. package/src/components/FetchConfig.vue +415 -0
  14. package/src/components/FieldInput.vue +371 -0
  15. package/src/components/FnConfig.vue +315 -0
  16. package/src/components/FnEditor.vue +327 -0
  17. package/src/components/FnInput.vue +103 -0
  18. package/src/components/FormLabel.vue +47 -0
  19. package/src/components/HtmlEditor.vue +125 -0
  20. package/src/components/JsonPreview.vue +146 -0
  21. package/src/components/OptionsTextInput.vue +151 -0
  22. package/src/components/PropsInput.vue +72 -0
  23. package/src/components/Required.vue +75 -0
  24. package/src/components/Row.vue +26 -0
  25. package/src/components/SignaturePad.vue +176 -0
  26. package/src/components/Struct.vue +153 -0
  27. package/src/components/StructEditor.vue +121 -0
  28. package/src/components/StructTree.vue +209 -0
  29. package/src/components/TableOptions.vue +164 -0
  30. package/src/components/TreeOptions.vue +167 -0
  31. package/src/components/TypeSelect.vue +144 -0
  32. package/src/components/Validate.vue +302 -0
  33. package/src/components/ValueInput.vue +89 -0
  34. package/src/components/Warning.vue +46 -0
  35. package/src/components/ai/AiPanel.vue +1122 -0
  36. package/src/components/ai/MarkdownRenderer.vue +548 -0
  37. package/src/components/language/LanguageConfig.vue +174 -0
  38. package/src/components/language/LanguageInput.vue +191 -0
  39. package/src/components/style/BackgroundInput.vue +315 -0
  40. package/src/components/style/BorderInput.vue +242 -0
  41. package/src/components/style/BoxSizeInput.vue +166 -0
  42. package/src/components/style/BoxSpaceInput.vue +269 -0
  43. package/src/components/style/ColorInput.vue +90 -0
  44. package/src/components/style/ConfigItem.vue +118 -0
  45. package/src/components/style/FontInput.vue +197 -0
  46. package/src/components/style/PositionInput.vue +146 -0
  47. package/src/components/style/RadiusInput.vue +164 -0
  48. package/src/components/style/ShadowContent.vue +335 -0
  49. package/src/components/style/ShadowInput.vue +91 -0
  50. package/src/components/style/SizeInput.vue +118 -0
  51. package/src/components/style/StyleConfig.vue +307 -0
  52. package/src/components/table/Table.vue +252 -0
  53. package/src/components/table/TableView.vue +1058 -0
  54. package/src/components/tableForm/TableForm.vue +471 -0
  55. package/src/components/tableForm/TableFormColumnView.vue +103 -0
  56. package/src/components/tableForm/TableFormView.vue +46 -0
  57. package/src/components/tree/FcTree.vue +713 -0
  58. package/src/components/tree/FcTreeNode.vue +216 -0
  59. package/src/config/base/field.js +43 -0
  60. package/src/config/base/form.js +132 -0
  61. package/src/config/base/style.js +26 -0
  62. package/src/config/base/validate.js +15 -0
  63. package/src/config/index.js +70 -0
  64. package/src/config/menu.js +24 -0
  65. package/src/config/rule/alert.js +45 -0
  66. package/src/config/rule/button.js +49 -0
  67. package/src/config/rule/card.js +40 -0
  68. package/src/config/rule/cascader.js +121 -0
  69. package/src/config/rule/checkbox.js +68 -0
  70. package/src/config/rule/col.js +86 -0
  71. package/src/config/rule/collapse.js +30 -0
  72. package/src/config/rule/collapseItem.js +36 -0
  73. package/src/config/rule/color.js +53 -0
  74. package/src/config/rule/date.js +66 -0
  75. package/src/config/rule/dateRange.js +60 -0
  76. package/src/config/rule/divider.js +31 -0
  77. package/src/config/rule/editor.js +31 -0
  78. package/src/config/rule/group.js +86 -0
  79. package/src/config/rule/html.js +43 -0
  80. package/src/config/rule/image.js +32 -0
  81. package/src/config/rule/input.js +62 -0
  82. package/src/config/rule/number.js +49 -0
  83. package/src/config/rule/password.js +52 -0
  84. package/src/config/rule/radio.js +43 -0
  85. package/src/config/rule/rate.js +44 -0
  86. package/src/config/rule/row.js +46 -0
  87. package/src/config/rule/select.js +70 -0
  88. package/src/config/rule/signaturePad.js +59 -0
  89. package/src/config/rule/slider.js +53 -0
  90. package/src/config/rule/space.js +44 -0
  91. package/src/config/rule/subForm.js +47 -0
  92. package/src/config/rule/switch.js +46 -0
  93. package/src/config/rule/tabPane.js +29 -0
  94. package/src/config/rule/table.js +37 -0
  95. package/src/config/rule/tableForm.js +115 -0
  96. package/src/config/rule/tableFormColumn.js +55 -0
  97. package/src/config/rule/tabs.js +38 -0
  98. package/src/config/rule/tag.js +69 -0
  99. package/src/config/rule/text.js +41 -0
  100. package/src/config/rule/textarea.js +63 -0
  101. package/src/config/rule/time.js +58 -0
  102. package/src/config/rule/timeRange.js +49 -0
  103. package/src/config/rule/title.js +37 -0
  104. package/src/config/rule/transfer.js +59 -0
  105. package/src/config/rule/tree.js +70 -0
  106. package/src/config/rule/treeSelect.js +77 -0
  107. package/src/config/rule/upload.js +107 -0
  108. package/src/form/index.js +19 -0
  109. package/src/index.js +173 -0
  110. package/src/locale/en.js +981 -0
  111. package/src/locale/zh-cn.js +983 -0
  112. package/src/style/fonts/fc-icons.woff +0 -0
  113. package/src/style/icon.css +1052 -0
  114. package/src/style/index.css +836 -0
  115. package/src/utils/form.js +9 -0
  116. package/src/utils/highlight/highlight.min.js +307 -0
  117. package/src/utils/highlight/javascript.min.js +80 -0
  118. package/src/utils/highlight/style.css +1 -0
  119. package/src/utils/highlight/xml.min.js +29 -0
  120. package/src/utils/hintStubs.js +120 -0
  121. package/src/utils/index.js +544 -0
  122. package/src/utils/jsonDiff.js +173 -0
  123. package/src/utils/locale.js +23 -0
  124. package/src/utils/message.js +19 -0
  125. package/src/utils/template.js +105 -0
  126. package/types/index.d.ts +575 -0
@@ -0,0 +1,23 @@
1
+ import {useLocale} from './index';
2
+ import {ref} from 'vue';
3
+ import ZhCn from '../locale/zh-cn';
4
+
5
+ let _t = null;
6
+ let locale = ref(null);
7
+
8
+ function t(...args) {
9
+ return _t(...args);
10
+ }
11
+
12
+ const globalUseLocale = (_locale) => {
13
+ locale.value = _locale || ZhCn;
14
+ const data = useLocale(locale);
15
+ _t = data.t;
16
+ return data;
17
+ };
18
+
19
+ globalUseLocale();
20
+
21
+ export default globalUseLocale;
22
+
23
+ export {t, locale};
@@ -0,0 +1,19 @@
1
+ import {ElMessage} from 'element-plus';
2
+
3
+
4
+ const message = (msg, type) => {
5
+ return ElMessage({
6
+ message: msg,
7
+ type: type || 'info',
8
+ customClass: '_fc-message-tip',
9
+ });
10
+ };
11
+
12
+ const errorMessage = (msg) => {
13
+ return message(msg, 'error');
14
+
15
+ };
16
+
17
+ export default errorMessage;
18
+
19
+ export {message}
@@ -0,0 +1,105 @@
1
+
2
+ export function formTemplate(json, options) {
3
+ return `<template>
4
+ <form-create
5
+ v-model="formData"
6
+ v-model:api="fapi"
7
+ :rule="rule"
8
+ :option="option"
9
+ @submit="onSubmit"
10
+ ></form-create>
11
+ </template>
12
+
13
+ <script>
14
+ import formCreate from "@form-create/element-ui";
15
+
16
+ export default {
17
+ components: {
18
+ formCreate: formCreate.$form()
19
+ },
20
+ data () {
21
+ const option = formCreate.parseJson('${options.replaceAll('\\', '\\\\').replaceAll('\'', '\\\'')}');
22
+ return {
23
+ formData: {},
24
+ fapi: null,
25
+ rule: formCreate.parseJson('${json.replaceAll('\\', '\\\\').replaceAll('\'', '\\\'')}'),
26
+ option: option
27
+ }
28
+ },
29
+ methods: {
30
+ onSubmit (formData) {
31
+ //todo 提交表单
32
+ }
33
+ }
34
+ }
35
+ <\/script>`
36
+ }
37
+
38
+ export function formTemplateV3(json, options) {
39
+ return `<template>
40
+ <form-create
41
+ v-model="formData"
42
+ v-model:api="fapi"
43
+ :rule="rule"
44
+ :option="option"
45
+ @submit="onSubmit"
46
+ ></form-create>
47
+ </template>
48
+
49
+ <script setup>
50
+ import {ref} from "vue";
51
+ import formCreate from "@form-create/element-ui";
52
+
53
+ const option = ref(formCreate.parseJson('${options.replaceAll('\\', '\\\\').replaceAll('\'', '\\\'')}'));
54
+ const rule = ref(formCreate.parseJson('${json.replaceAll('\\', '\\\\').replaceAll('\'', '\\\'')}'));
55
+ const fapi = ref(null);
56
+ const formData = ref({});
57
+
58
+ const onSubmit = (formData) => {
59
+ //todo 提交表单
60
+ }
61
+ <\/script>`
62
+ }
63
+
64
+
65
+ export function htmlTemplate(json, options) {
66
+ return `<html lang="zh">
67
+ <head>
68
+ <meta charset="UTF-8">
69
+ <!-- Import style -->
70
+ <link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css"/>
71
+ <!-- Import Vue 3 -->
72
+ <script src="https://unpkg.com/vue@3"></script>
73
+ <!-- Import element-plus -->
74
+ <script src="https://unpkg.com/element-plus"></script>
75
+ <!-- Import formCreate -->
76
+ <script src="https://unpkg.com/@form-create/element-ui@3"></script>
77
+ <script src="https://unpkg.com/@form-create/designer@3"></script>
78
+ </head>
79
+ <body>
80
+ <div id="app">
81
+ <form-create :rule="rule" :option="options" v-model="formData" v-model:api="api" @submit="onSubmit"></form-create>
82
+ </div>
83
+ <script>
84
+ const App = {
85
+ data() {
86
+ return {
87
+ rule: formCreate.parseJson('${json.replaceAll('\\', '\\\\').replaceAll('\'', '\\\'')}'),
88
+ options: formCreate.parseJson('${options.replaceAll('\\', '\\\\').replaceAll('\'', '\\\'')}'),
89
+ formData: {},
90
+ api: null,
91
+ };
92
+ },
93
+ methods: {
94
+ onSubmit(formData){
95
+ console.log('submit', formData);
96
+ }
97
+ }
98
+ };
99
+ const app = Vue.createApp(App);
100
+ app.use(ElementPlus).use(formCreate);
101
+ app.mount("#app");
102
+ </script>
103
+ </body>
104
+ </html>`
105
+ }