sun-form-v3 1.0.123 → 1.0.125
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +122 -15
- package/dist/{index-vN8Pef9j.js → index-BTVP3Lpa.js} +16 -7
- package/dist/{index-NHAHXyUC.js → index-C-yx7X4z.js} +1 -1
- package/dist/{index-BZ_UYXm-.js → index-C5cxJjmq.js} +1 -1
- package/dist/{index-DVv_8Ocd.js → index-CUfTg3I4.js} +19574 -19410
- package/dist/{index-J7zi6VqP.js → index-CgMGjP5o.js} +1 -1
- package/dist/{index-CDr2Tvxf.js → index-CrH8jZYG.js} +1 -1
- package/dist/{index-xK35fKa2.js → index-Vf7yIUi-.js} +1 -1
- package/dist/{index-KXesCHn0.js → index-q_kEEHXZ.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/sun-form-v3.es.js +1 -1
- package/dist/sun-form-v3.umd.js +119 -119
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,29 +1,136 @@
|
|
1
|
-
# sun-form-v3
|
1
|
+
# 关于 sun-form-v3
|
2
2
|
|
3
|
-
|
3
|
+
## 0.简介
|
4
4
|
|
5
|
-
|
5
|
+
`sun-form-v3` 是基于 `vue3`+`tailwindcss` 所编写的低代码框架引擎,其中 UI 基于 `element-plus`,表格基于 `vxe-table`。定位为前端开发人员提供快速搭建页面、实现不仅仅是表单的数据交互。
|
6
6
|
|
7
|
-
|
7
|
+
`sun-form-v3` 由设计器`designer`和渲染器`sunForm`两个组件构成。
|
8
8
|
|
9
|
-
|
9
|
+
`sun-form-v3` 提供了非常丰富的组件属性、表单交互和 api 方法等,可通过拖转或单击生成你想要的页面。
|
10
10
|
|
11
|
-
|
11
|
+
## 1.安装
|
12
12
|
|
13
|
-
|
13
|
+
```shell
|
14
|
+
npm i sun-form-v3@latest
|
15
|
+
npm i element-plus@2.7.3
|
16
|
+
npm i @element-plus/icons-vue@2.3.1
|
17
|
+
npm i vxe-table@4.6.17
|
18
|
+
```
|
19
|
+
|
20
|
+
## 2.引入并全局注册`sun-form-v3`组件
|
21
|
+
|
22
|
+
```javascript
|
23
|
+
import { createApp } from "vue";
|
24
|
+
|
25
|
+
import App from "./App.vue";
|
26
|
+
import ElementPlus from "element-plus";
|
27
|
+
import "sun-form-v3/dist/style.css";
|
28
|
+
import "element-plus/dist/index.css";
|
29
|
+
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
|
30
|
+
import sunFormV3 from "sun-form-v3";
|
31
|
+
import VxeUITable from "vxe-table";
|
14
32
|
|
15
|
-
|
16
|
-
|
33
|
+
import "vxe-table/lib/style.css";
|
34
|
+
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
|
35
|
+
const app = createApp(App);
|
36
|
+
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
37
|
+
app.component(key, component);
|
38
|
+
}
|
39
|
+
app
|
40
|
+
.use(sunFormV3)
|
41
|
+
.use(ElementPlus, {
|
42
|
+
locale: zhCn,
|
43
|
+
})
|
44
|
+
.use(VxeUITable)
|
45
|
+
.mount("#app");
|
17
46
|
```
|
18
47
|
|
19
|
-
|
48
|
+
## 3.在 Vue3 模版中使用设计器组件
|
20
49
|
|
21
|
-
```
|
22
|
-
|
50
|
+
```vue
|
51
|
+
<script setup>
|
52
|
+
import { ref, watch, onMounted } from "vue";
|
53
|
+
//请求成功回调
|
54
|
+
const httpSuccessHandle = (res) => {
|
55
|
+
console.log(res);
|
56
|
+
};
|
57
|
+
//请求失败回调
|
58
|
+
const httpErrorHandle = (err) => {
|
59
|
+
console.log(err);
|
60
|
+
};
|
61
|
+
//请求之前发送参数
|
62
|
+
const httpBeforeSendHandle = () => {
|
63
|
+
return {};
|
64
|
+
};
|
65
|
+
//每个请求所带的前缀
|
66
|
+
const baseUrl = "/api";
|
67
|
+
//请求头
|
68
|
+
const headers = {
|
69
|
+
//比如store中的token放在请求头中
|
70
|
+
token: "***",
|
71
|
+
};
|
72
|
+
//低代码组件传递的事件,如:低代码中按钮点击事件传递到项目中可以再此接收
|
73
|
+
const componentEvent = (params) => {
|
74
|
+
console.log(params);
|
75
|
+
};
|
76
|
+
</script>
|
77
|
+
|
78
|
+
<template>
|
79
|
+
<div class="h-screen">
|
80
|
+
<designer
|
81
|
+
ref="des"
|
82
|
+
:httpSuccessHandle="httpSuccessHandle"
|
83
|
+
:httpErrorHandle="httpErrorHandle"
|
84
|
+
:httpBeforeSendHandle="httpBeforeSendHandle"
|
85
|
+
:baseUrl="baseUrl"
|
86
|
+
:headers="headers"
|
87
|
+
@componentEvent="componentEvent"
|
88
|
+
>
|
89
|
+
<div>我是弹窗插槽内容</div>
|
90
|
+
</designer>
|
91
|
+
</div>
|
92
|
+
</template>
|
93
|
+
|
94
|
+
<style scoped></style>
|
23
95
|
```
|
24
96
|
|
25
|
-
|
97
|
+
## 4.在 Vue3 模版中使用渲染器组件
|
98
|
+
|
99
|
+
```vue
|
100
|
+
<template>
|
101
|
+
<sunForm
|
102
|
+
:widgetConfig="widgetConfig"
|
103
|
+
:httpSuccessHandle="httpSuccessHandle"
|
104
|
+
:httpErrorHandle="httpErrorHandle"
|
105
|
+
:httpBeforeSendHandle="httpBeforeSendHandle"
|
106
|
+
:baseUrl="baseUrl"
|
107
|
+
:headers="headers"
|
108
|
+
@componentEvent="componentEvent"
|
109
|
+
ref="formRef"
|
110
|
+
>
|
111
|
+
</sunForm>
|
112
|
+
</template>
|
113
|
+
|
114
|
+
<script setup>
|
115
|
+
import { ref, reactive, nextTick } from "vue";
|
116
|
+
const widgetConfig = ref(null);
|
117
|
+
const httpSuccessHandle = (res) => {};
|
118
|
+
const httpErrorHandle = (err) => {};
|
119
|
+
const httpBeforeSendHandle = () => {
|
120
|
+
return {};
|
121
|
+
};
|
122
|
+
const baseUrl = "/api";
|
123
|
+
const headers = {};
|
124
|
+
const formRef = ref(null);
|
125
|
+
//获取低代码所有的方法
|
126
|
+
const getDesigner = () => {
|
127
|
+
return formRef.value.designer;
|
128
|
+
};
|
129
|
+
defineExpose({
|
130
|
+
getDesigner: getDesigner,
|
131
|
+
});
|
132
|
+
getConfig();
|
133
|
+
</script>
|
26
134
|
|
27
|
-
|
28
|
-
npm run build
|
135
|
+
<style scoped lang="scss"></style>
|
29
136
|
```
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { resolveComponent as
|
1
|
+
import { resolveComponent as n, openBlock as V, createElementBlock as g, Fragment as w, createVNode as e, withCtx as p, unref as t } from "vue";
|
2
2
|
const _ = /* @__PURE__ */ Object.assign({ name: "config-cascader" }, {
|
3
3
|
__name: "index",
|
4
4
|
props: {
|
@@ -14,7 +14,7 @@ const _ = /* @__PURE__ */ Object.assign({ name: "config-cascader" }, {
|
|
14
14
|
setup(m) {
|
15
15
|
let l = m;
|
16
16
|
return (b, o) => {
|
17
|
-
const s =
|
17
|
+
const s = n("el-option"), i = n("el-select"), a = n("common-label-container"), r = n("el-input"), u = n("el-switch");
|
18
18
|
return V(), g(w, null, [
|
19
19
|
e(a, { label: "组件尺寸" }, {
|
20
20
|
default: p(() => [
|
@@ -73,7 +73,7 @@ const _ = /* @__PURE__ */ Object.assign({ name: "config-cascader" }, {
|
|
73
73
|
}),
|
74
74
|
e(a, { label: "是否必填" }, {
|
75
75
|
default: p(() => [
|
76
|
-
e(
|
76
|
+
e(u, {
|
77
77
|
modelValue: t(l).widget.props.required,
|
78
78
|
"onUpdate:modelValue": o[4] || (o[4] = (d) => t(l).widget.props.required = d)
|
79
79
|
}, null, 8, ["modelValue"])
|
@@ -82,7 +82,7 @@ const _ = /* @__PURE__ */ Object.assign({ name: "config-cascader" }, {
|
|
82
82
|
}),
|
83
83
|
e(a, { label: "是否禁用" }, {
|
84
84
|
default: p(() => [
|
85
|
-
e(
|
85
|
+
e(u, {
|
86
86
|
modelValue: t(l).widget.props.disabled,
|
87
87
|
"onUpdate:modelValue": o[5] || (o[5] = (d) => t(l).widget.props.disabled = d)
|
88
88
|
}, null, 8, ["modelValue"])
|
@@ -91,7 +91,7 @@ const _ = /* @__PURE__ */ Object.assign({ name: "config-cascader" }, {
|
|
91
91
|
}),
|
92
92
|
e(a, { label: "显示全部级" }, {
|
93
93
|
default: p(() => [
|
94
|
-
e(
|
94
|
+
e(u, {
|
95
95
|
modelValue: t(l).widget.props.showAllLevels,
|
96
96
|
"onUpdate:modelValue": o[6] || (o[6] = (d) => t(l).widget.props.showAllLevels = d)
|
97
97
|
}, null, 8, ["modelValue"])
|
@@ -100,7 +100,7 @@ const _ = /* @__PURE__ */ Object.assign({ name: "config-cascader" }, {
|
|
100
100
|
}),
|
101
101
|
e(a, { label: "是否可清除" }, {
|
102
102
|
default: p(() => [
|
103
|
-
e(
|
103
|
+
e(u, {
|
104
104
|
modelValue: t(l).widget.props.clearable,
|
105
105
|
"onUpdate:modelValue": o[7] || (o[7] = (d) => t(l).widget.props.clearable = d)
|
106
106
|
}, null, 8, ["modelValue"])
|
@@ -109,12 +109,21 @@ const _ = /* @__PURE__ */ Object.assign({ name: "config-cascader" }, {
|
|
109
109
|
}),
|
110
110
|
e(a, { label: "是否只传末级" }, {
|
111
111
|
default: p(() => [
|
112
|
-
e(
|
112
|
+
e(u, {
|
113
113
|
modelValue: t(l).widget.props.postLastLevel,
|
114
114
|
"onUpdate:modelValue": o[8] || (o[8] = (d) => t(l).widget.props.postLastLevel = d)
|
115
115
|
}, null, 8, ["modelValue"])
|
116
116
|
]),
|
117
117
|
_: 1
|
118
|
+
}),
|
119
|
+
e(a, { label: "是否可选任一级" }, {
|
120
|
+
default: p(() => [
|
121
|
+
e(u, {
|
122
|
+
modelValue: t(l).widget.props.checkStrictly,
|
123
|
+
"onUpdate:modelValue": o[9] || (o[9] = (d) => t(l).widget.props.checkStrictly = d)
|
124
|
+
}, null, 8, ["modelValue"])
|
125
|
+
]),
|
126
|
+
_: 1
|
118
127
|
})
|
119
128
|
], 64);
|
120
129
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { computed as j, ref as g, onMounted as $, resolveComponent as f, openBlock as v, createElementBlock as h, Fragment as x, createVNode as u, withCtx as o, createTextVNode as C, createElementVNode as a, renderList as B, unref as V, toDisplayString as N, nextTick as U, createBlock as D } from "vue";
|
2
|
-
import { e as E, i as M } from "./index-
|
2
|
+
import { e as E, i as M } from "./index-CUfTg3I4.js";
|
3
3
|
const R = { class: "flex-wrap flex" }, S = ["onClick"], T = { class: "inner cursor-pointer hover:shadow-md hover:shadow-blue-200 border w-full h-full p-1 flex flex-col overflow-hidden items-center rounded-md shadow-sm" }, z = { class: "lab border-t w-full text-center mt-1 font-bold" }, F = /* @__PURE__ */ Object.assign({ name: "chatChoose" }, {
|
4
4
|
__name: "chartChoose",
|
5
5
|
props: {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { computed as S, ref as C, resolveComponent as u, openBlock as k, createElementBlock as O, Fragment as U, createVNode as e, withCtx as l, createTextVNode as f, unref as i, isRef as J, createElementVNode as c } from "vue";
|
2
|
-
import { _ as E } from "./index-
|
2
|
+
import { _ as E } from "./index-CUfTg3I4.js";
|
3
3
|
const H = { class: "h-full flex flex-col" }, B = { class: "flex-1 overflow-hidden" }, T = {
|
4
4
|
__name: "dataConfig",
|
5
5
|
props: {
|