easybill-ui 1.0.15 → 1.0.17

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.
@@ -17,7 +17,8 @@ import { FormItem, Fields } from "./types"
17
17
  import { getComponent } from "./components"
18
18
  import FormTooltip from "./FormTooltip.vue"
19
19
  import { useForm } from "./hooks"
20
-
20
+ import { useGlobalConfig } from "../../../utils/hooks/useGlobalConfig"
21
+ const config = useGlobalConfig()
21
22
  const props = defineProps({
22
23
  // 动态验证表单
23
24
  formItem: {
@@ -31,7 +32,7 @@ const props = defineProps({
31
32
  })
32
33
  const emit = defineEmits(["change"])
33
34
  const modelRef: Ref<Fields> = ref(props.formModel || {})
34
- const comp = computed(() => getComponent(props.formItem.type))
35
+ const comp = computed(() => getComponent(props.formItem.type) || (config.value.form && config.value.form.components && config.value.form.components[props.formItem.type]))
35
36
  // 重新组装props
36
37
  const formItemProps = computed(() => {
37
38
  if (!props.formItem.props) {
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  </template>
15
15
  <script lang="ts">
16
- import { defineComponent, computed, PropType, toRaw } from "vue"
16
+ import { defineComponent, computed, toRaw } from "vue"
17
17
  import { Loading, Warning } from "@element-plus/icons-vue"
18
18
  import { ElTreeSelect, ElIcon } from "element-plus"
19
19
  import { FormItemProps } from "../types"
@@ -23,8 +23,8 @@ export default defineComponent({
23
23
  props: {
24
24
  ...FormItemProps,
25
25
  modelValue: {
26
- type: Array as PropType<(string | number)[]>,
27
- default: () => [],
26
+ type: [String, Number, Boolean],
27
+ default: "",
28
28
  }, // 表单项值
29
29
  },
30
30
  emits: ["update:modelValue"],
@@ -33,9 +33,6 @@ export default defineComponent({
33
33
  get: () => props.modelValue,
34
34
  set: (val) => emit("update:modelValue", val),
35
35
  })
36
- if (!(model.value instanceof Array)) {
37
- model.value = []
38
- }
39
36
 
40
37
  return {
41
38
  model,
package/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { Plugin } from "vue"
2
2
  import ConstantStatus from "./components/ConstantStatus"
3
3
  import FormDialog from "./components/FormDialog"
4
- import CurdForm, { CurdFormItem } from "./components/CurdForm"
4
+ import CurdForm from "./components/CurdForm"
5
+ import CurdFormItem from "./components/CurdForm/src/CurdFormItem.vue"
5
6
  import CurdTable from "./components/CurdTable"
6
7
  import TableFilter from "./components/TableFilter"
7
8
  import DetailInfo from "./components/DetailInfo"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easybill-ui",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
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": "89c3817a8770757734e0496bb5de89ddb9544f59"
17
+ "gitHead": "fe7feba742765b8f0348ad4c39cbb97c51699de4"
18
18
  }
@@ -23,4 +23,8 @@ const mergeConfig = (a: any, b: any): any => {
23
23
 
24
24
  export interface GlobalConfig {
25
25
  size: "default" | "small" | "medium"
26
+ form?: FormConfig
27
+ }
28
+ interface FormConfig {
29
+ components?: any[]
26
30
  }