easybill-ui 1.0.13 → 1.0.15
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Instance from "./src/index"
|
|
2
|
+
import FormItem from "./src/CurdFormItem.vue"
|
|
2
3
|
import { withInstall } from "../../utils"
|
|
3
4
|
export const CurdForm = withInstall(Instance)
|
|
5
|
+
export const CurdFormItem = withInstall(FormItem)
|
|
4
6
|
export default CurdForm
|
|
5
7
|
export * from "./src/types"
|
|
6
8
|
export * from "./src/directive"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormItemVue :form-model="model" :form-item="props.formItem" @change="onChange"></FormItemVue>
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts">
|
|
5
|
+
export default {
|
|
6
|
+
name: "CurdFormItem",
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import { PropType, ref, watch, getCurrentInstance, reactive } from "vue"
|
|
11
|
+
import FormItemVue from "./FormItem.vue"
|
|
12
|
+
import { FormItem, Fields } from "./types"
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
formItem: {
|
|
15
|
+
required: true,
|
|
16
|
+
type: Object as PropType<FormItem>,
|
|
17
|
+
},
|
|
18
|
+
formModel: {
|
|
19
|
+
type: Object as PropType<Fields>,
|
|
20
|
+
default: () => ({}),
|
|
21
|
+
},
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: [String, Array, Object],
|
|
24
|
+
default: "",
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
const emit = defineEmits(["update:modelValue"])
|
|
28
|
+
const model = ref(props.formModel || {})
|
|
29
|
+
const onChange = () => {
|
|
30
|
+
emit("update:modelValue", model.value[props.formItem.prop])
|
|
31
|
+
}
|
|
32
|
+
watch(
|
|
33
|
+
() => props.modelValue,
|
|
34
|
+
(val) => {
|
|
35
|
+
model.value[props.formItem.prop] = val
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
const instance = getCurrentInstance()
|
|
39
|
+
const curdFormContext = reactive({})
|
|
40
|
+
// 调用某个表单项的异步数据接口
|
|
41
|
+
const loadOptions = async (cur) => {
|
|
42
|
+
if (cur && cur.asyncOptions && !instance?.isUnmounted) {
|
|
43
|
+
cur.loading = true
|
|
44
|
+
cur.options =
|
|
45
|
+
(await cur
|
|
46
|
+
.asyncOptions(model.value, cur, curdFormContext)
|
|
47
|
+
.catch((err) => console.error("loadOptionError", err))
|
|
48
|
+
.finally(() => (cur.loading = false))) || []
|
|
49
|
+
!instance?.isUnmounted && cur.eventObject?.optionLoaded && cur.eventObject?.optionLoaded(model.value, cur, curdFormContext)
|
|
50
|
+
}
|
|
51
|
+
return cur?.options || []
|
|
52
|
+
}
|
|
53
|
+
const init = () => {
|
|
54
|
+
if (props.formItem.asyncOptions) {
|
|
55
|
+
loadOptions(props.formItem)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
curdFormContext.loadOptions = loadOptions
|
|
59
|
+
init()
|
|
60
|
+
watch(
|
|
61
|
+
() => props.formItem,
|
|
62
|
+
() => {
|
|
63
|
+
init()
|
|
64
|
+
},
|
|
65
|
+
)
|
|
66
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-input v-model="model" v-trim :disabled="formItem.disabled || false" v-bind="props" :placeholder="(props.placeholder && String(props.placeholder)) || '请输入' + (props.label || formItem.label)" autocomplete="new-password" v-on="eventObject" />
|
|
2
|
+
<el-input v-model="model" v-trim :disabled="formItem.disabled || false" v-bind="props" :placeholder="(props.placeholder && String(props.placeholder)) || '请输入' + (props.label || formItem.label || '')" autocomplete="new-password" v-on="eventObject" />
|
|
3
3
|
</template>
|
|
4
4
|
<script lang="ts">
|
|
5
5
|
import { defineComponent, computed } from "vue"
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
<script lang="ts">
|
|
16
16
|
import { defineComponent, computed, PropType, toRaw } from "vue"
|
|
17
17
|
import { Loading, Warning } from "@element-plus/icons-vue"
|
|
18
|
-
import {
|
|
18
|
+
import { ElTreeSelect, ElIcon } from "element-plus"
|
|
19
19
|
import { FormItemProps } from "../types"
|
|
20
20
|
export default defineComponent({
|
|
21
21
|
name: "SchemaFormTreeSelect",
|
|
22
|
-
components: { Loading,
|
|
22
|
+
components: { Loading, ElTreeSelect, ElIcon, Warning },
|
|
23
23
|
props: {
|
|
24
24
|
...FormItemProps,
|
|
25
25
|
modelValue: {
|
package/index.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Plugin } from "vue"
|
|
2
2
|
import ConstantStatus from "./components/ConstantStatus"
|
|
3
3
|
import FormDialog from "./components/FormDialog"
|
|
4
|
-
import CurdForm from "./components/CurdForm"
|
|
4
|
+
import CurdForm, { CurdFormItem } from "./components/CurdForm"
|
|
5
5
|
import CurdTable from "./components/CurdTable"
|
|
6
6
|
import TableFilter from "./components/TableFilter"
|
|
7
7
|
import DetailInfo from "./components/DetailInfo"
|
|
8
8
|
import { makeInstaller } from "./utils/vue/make-installer"
|
|
9
9
|
|
|
10
|
-
const Components = [ConstantStatus, FormDialog, CurdForm, CurdTable, TableFilter, DetailInfo] as Plugin[]
|
|
11
|
-
export { ConstantStatus, FormDialog, CurdForm, CurdTable, TableFilter, DetailInfo }
|
|
10
|
+
const Components = [ConstantStatus, FormDialog, CurdForm, CurdTable, TableFilter, DetailInfo, CurdFormItem] as Plugin[]
|
|
11
|
+
export { ConstantStatus, FormDialog, CurdForm, CurdFormItem, CurdTable, TableFilter, DetailInfo }
|
|
12
12
|
export * from "./components/ConstantStatus/src/types"
|
|
13
13
|
export * from "./components/FormDialog/src/types"
|
|
14
14
|
export * from "./components/CurdForm"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easybill-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "A component library for easybill",
|
|
5
5
|
"author": "tuchongyang <779311998@qq.com>",
|
|
6
6
|
"private": false,
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "89c3817a8770757734e0496bb5de89ddb9544f59"
|
|
18
18
|
}
|