@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.
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/components.es.js +11424 -0
- package/dist/components.umd.js +878 -0
- package/dist/index.es.js +39113 -0
- package/dist/index.umd.js +1187 -0
- package/package.json +96 -0
- package/src/components/DragBox.vue +49 -0
- package/src/components/DragTool.vue +235 -0
- package/src/components/EventConfig.vue +557 -0
- package/src/components/FcDesigner.vue +2569 -0
- package/src/components/FcTitle.vue +69 -0
- package/src/components/FetchConfig.vue +415 -0
- package/src/components/FieldInput.vue +371 -0
- package/src/components/FnConfig.vue +315 -0
- package/src/components/FnEditor.vue +327 -0
- package/src/components/FnInput.vue +103 -0
- package/src/components/FormLabel.vue +47 -0
- package/src/components/HtmlEditor.vue +125 -0
- package/src/components/JsonPreview.vue +146 -0
- package/src/components/OptionsTextInput.vue +151 -0
- package/src/components/PropsInput.vue +72 -0
- package/src/components/Required.vue +75 -0
- package/src/components/Row.vue +26 -0
- package/src/components/SignaturePad.vue +176 -0
- package/src/components/Struct.vue +153 -0
- package/src/components/StructEditor.vue +121 -0
- package/src/components/StructTree.vue +209 -0
- package/src/components/TableOptions.vue +164 -0
- package/src/components/TreeOptions.vue +167 -0
- package/src/components/TypeSelect.vue +144 -0
- package/src/components/Validate.vue +302 -0
- package/src/components/ValueInput.vue +89 -0
- package/src/components/Warning.vue +46 -0
- package/src/components/ai/AiPanel.vue +1122 -0
- package/src/components/ai/MarkdownRenderer.vue +548 -0
- package/src/components/language/LanguageConfig.vue +174 -0
- package/src/components/language/LanguageInput.vue +191 -0
- package/src/components/style/BackgroundInput.vue +315 -0
- package/src/components/style/BorderInput.vue +242 -0
- package/src/components/style/BoxSizeInput.vue +166 -0
- package/src/components/style/BoxSpaceInput.vue +269 -0
- package/src/components/style/ColorInput.vue +90 -0
- package/src/components/style/ConfigItem.vue +118 -0
- package/src/components/style/FontInput.vue +197 -0
- package/src/components/style/PositionInput.vue +146 -0
- package/src/components/style/RadiusInput.vue +164 -0
- package/src/components/style/ShadowContent.vue +335 -0
- package/src/components/style/ShadowInput.vue +91 -0
- package/src/components/style/SizeInput.vue +118 -0
- package/src/components/style/StyleConfig.vue +307 -0
- package/src/components/table/Table.vue +252 -0
- package/src/components/table/TableView.vue +1058 -0
- package/src/components/tableForm/TableForm.vue +471 -0
- package/src/components/tableForm/TableFormColumnView.vue +103 -0
- package/src/components/tableForm/TableFormView.vue +46 -0
- package/src/components/tree/FcTree.vue +713 -0
- package/src/components/tree/FcTreeNode.vue +216 -0
- package/src/config/base/field.js +43 -0
- package/src/config/base/form.js +132 -0
- package/src/config/base/style.js +26 -0
- package/src/config/base/validate.js +15 -0
- package/src/config/index.js +70 -0
- package/src/config/menu.js +24 -0
- package/src/config/rule/alert.js +45 -0
- package/src/config/rule/button.js +49 -0
- package/src/config/rule/card.js +40 -0
- package/src/config/rule/cascader.js +121 -0
- package/src/config/rule/checkbox.js +68 -0
- package/src/config/rule/col.js +86 -0
- package/src/config/rule/collapse.js +30 -0
- package/src/config/rule/collapseItem.js +36 -0
- package/src/config/rule/color.js +53 -0
- package/src/config/rule/date.js +66 -0
- package/src/config/rule/dateRange.js +60 -0
- package/src/config/rule/divider.js +31 -0
- package/src/config/rule/editor.js +31 -0
- package/src/config/rule/group.js +86 -0
- package/src/config/rule/html.js +43 -0
- package/src/config/rule/image.js +32 -0
- package/src/config/rule/input.js +62 -0
- package/src/config/rule/number.js +49 -0
- package/src/config/rule/password.js +52 -0
- package/src/config/rule/radio.js +43 -0
- package/src/config/rule/rate.js +44 -0
- package/src/config/rule/row.js +46 -0
- package/src/config/rule/select.js +70 -0
- package/src/config/rule/signaturePad.js +59 -0
- package/src/config/rule/slider.js +53 -0
- package/src/config/rule/space.js +44 -0
- package/src/config/rule/subForm.js +47 -0
- package/src/config/rule/switch.js +46 -0
- package/src/config/rule/tabPane.js +29 -0
- package/src/config/rule/table.js +37 -0
- package/src/config/rule/tableForm.js +115 -0
- package/src/config/rule/tableFormColumn.js +55 -0
- package/src/config/rule/tabs.js +38 -0
- package/src/config/rule/tag.js +69 -0
- package/src/config/rule/text.js +41 -0
- package/src/config/rule/textarea.js +63 -0
- package/src/config/rule/time.js +58 -0
- package/src/config/rule/timeRange.js +49 -0
- package/src/config/rule/title.js +37 -0
- package/src/config/rule/transfer.js +59 -0
- package/src/config/rule/tree.js +70 -0
- package/src/config/rule/treeSelect.js +77 -0
- package/src/config/rule/upload.js +107 -0
- package/src/form/index.js +19 -0
- package/src/index.js +173 -0
- package/src/locale/en.js +981 -0
- package/src/locale/zh-cn.js +983 -0
- package/src/style/fonts/fc-icons.woff +0 -0
- package/src/style/icon.css +1052 -0
- package/src/style/index.css +836 -0
- package/src/utils/form.js +9 -0
- package/src/utils/highlight/highlight.min.js +307 -0
- package/src/utils/highlight/javascript.min.js +80 -0
- package/src/utils/highlight/style.css +1 -0
- package/src/utils/highlight/xml.min.js +29 -0
- package/src/utils/hintStubs.js +120 -0
- package/src/utils/index.js +544 -0
- package/src/utils/jsonDiff.js +173 -0
- package/src/utils/locale.js +23 -0
- package/src/utils/message.js +19 -0
- package/src/utils/template.js +105 -0
- 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
|
+
}
|