easybill-ui 1.2.9 → 1.2.11

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.
@@ -3,9 +3,19 @@
3
3
  <div v-if="props.formItem.prefix && isString(props.formItem.prefix)" class="form-item-prefix" v-html="props.formItem.prefix"></div>
4
4
  <component :is="item" v-for="(item, i) in prefixList" :key="i" v-model="modelRef[props.formItem.prop || '']" :form-item="props.formItem" :form-model="modelRef" :props="formItemProps" :event-object="eventObject" />
5
5
  <slot name="prefix"></slot>
6
- <!-- <component :is="comp" v-if="comp" v-model="modelRef[props.formItem.prop || '']" :form-item="props.formItem" :form-model="modelRef" :props="formItemProps" :event-object="eventObject" />-->
7
- <!-- <component :is="props.formItem.type" v-else v-model="modelRef[props.formItem.prop || '']" v-bind="formItemProps" v-on="eventObject" />-->
8
- <FormCompose v-model="modelRef[props.formItem.prop || '']" :props="formItemProps" :form-item="props.formItem" :form-model="modelRef" :event-object="eventObject" />
6
+ <component :is="comp" v-if="comp" v-model="modelRef[props.formItem.prop || '']" :form-item="props.formItem" :form-model="modelRef" :props="formItemProps" :event-object="eventObject">
7
+ <template v-for="(item, key) in formItemProps.slots" :key="key" #[key]="slotScope">
8
+ <component :is="item" v-model="modelRef[props.formItem.prop || '']" :form-item="props.formItem" :form-model="modelRef" :props="formItemProps" :event-object="eventObject" />
9
+ </template>
10
+ </component>
11
+ <component :is="props.formItem.type" v-else v-model="modelRef[props.formItem.prop || '']" v-bind="formItemProps" v-on="eventObject">
12
+ <template v-for="(item, key) in formItemProps.slots" :key="key" #[key]="slotScope">
13
+ <component :is="item" v-model="modelRef[props.formItem.prop || '']" :form-item="props.formItem" :form-model="modelRef" :props="formItemProps" :event-object="eventObject" />
14
+ </template>
15
+ </component>
16
+
17
+ <!-- <FormCompose v-model="modelRef[props.formItem.prop || '']" :props="formItemProps" :form-item="props.formItem" :form-model="modelRef" :event-object="eventObject" /> -->
18
+
9
19
  <FormTooltip v-if="props.formItem.tooltip" :tooltip="props.formItem.tooltip" :form-item="props.formItem" :form-model="props.formModel" />
10
20
  <slot name="suffix"></slot>
11
21
  <div v-if="props.formItem.suffix && isString(props.formItem.suffix)" class="form-item-suffix" v-html="props.formItem.suffix"></div>
@@ -14,6 +24,7 @@
14
24
  </template>
15
25
  <script lang="ts" setup>
16
26
  import { computed, type PropType, ref, type Ref } from "vue"
27
+ import { getComponent } from "./components"
17
28
  import FormCompose from "./FormCompose.vue"
18
29
  import FormTooltip from "./FormTooltip.vue"
19
30
  import { useForm } from "./hooks"
@@ -42,6 +53,7 @@ const formItemProps = computed(() => {
42
53
  }
43
54
  return props.formItem.props
44
55
  })
56
+ const comp = computed(() => (formContext.components && formContext.components[props.formItem.type || "input"]) || getComponent(props.formItem.type))
45
57
  // 重新组装eventObject
46
58
  const eventObject = ref(
47
59
  (() => {
@@ -43,6 +43,6 @@ export const getComponent = (type: string | VNode = "input") => {
43
43
  return type
44
44
  } else {
45
45
  // 'el-原生组件'
46
- return type
46
+ return null
47
47
  }
48
48
  }
@@ -2,7 +2,7 @@
2
2
  <el-cascader v-model="model" :options="options" v-bind="props" v-on="eventObject"></el-cascader>
3
3
  </template>
4
4
  <script lang="ts" setup>
5
- import { type CascaderOption, type CascaderValue, ElCascader } from "element-plus"
5
+ import { type CascaderOption, type CascaderValue } from "element-plus"
6
6
  import { computed, type PropType } from "vue"
7
7
  import { FormItemProps } from "../types"
8
8
  const props = defineProps({
@@ -5,8 +5,8 @@
5
5
  </div>
6
6
  <el-checkbox-group v-if="!formItem.loading && formItem.options && formItem.options.length" v-model="model" :class="[props?.showType]" style="width: 100%" v-bind="props" v-on="eventObject">
7
7
  <template v-for="option in formItem.options" :key="option.value">
8
- <el-checkbox-button v-if="props?.componentName == 'button'" :value="option.value" :disabled="option.disabled"> {{ option.label }} </el-checkbox-button>
9
- <el-checkbox v-else :value="option.value" :disabled="option.disabled"> {{ option.label }} </el-checkbox>
8
+ <el-checkbox-button v-if="props?.componentName == 'button'" :value="option.value" :disabled="option.disabled" v-bind="option"> {{ option.label }} </el-checkbox-button>
9
+ <el-checkbox v-else :value="option.value" :disabled="option.disabled" v-bind="option"> {{ option.label }} </el-checkbox>
10
10
  </template>
11
11
  </el-checkbox-group>
12
12
  <div v-if="!formItem.loading && !formItem.options?.length" class="empty">
@@ -19,13 +19,12 @@
19
19
  </template>
20
20
  <script lang="ts">
21
21
  import { Loading, Warning } from "@element-plus/icons-vue"
22
- import { ElCheckbox, ElCheckboxButton, ElCheckboxGroup, ElIcon } from "element-plus"
23
- import { computed, defineComponent, type PropType, toRaw } from "vue"
24
22
  import { useLocale } from "easybill-ui"
23
+ import { computed, defineComponent, type PropType, toRaw } from "vue"
25
24
  import { FormItemProps } from "../types"
26
25
  export default defineComponent({
27
26
  name: "SchemaFormCheckbox",
28
- components: { Loading, ElCheckbox, ElCheckboxButton, ElCheckboxGroup, ElIcon, Warning },
27
+ components: { Loading, Warning },
29
28
  props: {
30
29
  ...FormItemProps,
31
30
  modelValue: {
@@ -2,12 +2,11 @@
2
2
  <el-color-picker v-model="model" show-alpha v-bind="props" v-on="eventObject"> </el-color-picker>
3
3
  </template>
4
4
  <script lang="ts">
5
- import { ElColorPicker } from "element-plus"
6
5
  import { computed, defineComponent } from "vue"
7
6
  import { FormItemProps } from "../types"
8
7
  export default defineComponent({
9
8
  name: "SchemaFormColorPicker",
10
- components: { ElColorPicker },
9
+ components: {},
11
10
  props: FormItemProps,
12
11
  emits: ["update:modelValue"],
13
12
  setup(props, { emit }) {
@@ -1,14 +1,13 @@
1
1
  <template>
2
- <el-date-picker v-model="model" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :placeholder="t('el.form.pleaseSelect', [formItem.label || ''])" v-bind="props" v-on="eventObject"> </el-date-picker>
2
+ <el-date-picker v-model="model" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" v-bind="props" v-on="eventObject"> </el-date-picker>
3
3
  </template>
4
4
  <script lang="ts">
5
- import { ElDatePicker, type ModelValueType } from "element-plus"
5
+ import { type ModelValueType } from "element-plus"
6
6
  import { computed, defineComponent, type PropType } from "vue"
7
- import { useLocale } from "easybill-ui"
8
7
  import { FormItemProps } from "../types"
9
8
  export default defineComponent({
10
9
  name: "SchemaFormDatePicker",
11
- components: { ElDatePicker },
10
+ components: {},
12
11
  props: {
13
12
  ...FormItemProps,
14
13
  modelValue: {
@@ -22,11 +21,9 @@ export default defineComponent({
22
21
  get: () => props.modelValue,
23
22
  set: (val) => emit("update:modelValue", val),
24
23
  })
25
- const { t } = useLocale()
26
24
 
27
25
  return {
28
26
  model,
29
- t,
30
27
  }
31
28
  },
32
29
  })
@@ -1,18 +1,12 @@
1
1
  <template>
2
- <component style="width: 100%" v-model="model" :is="h(ElInputNumber, { ...props.props, ref: changeRef }, props.formItem?.slots)" :placeholder="t('el.form.pleaseInput', [formItem.label || ''])" v-on="eventObject"></component>
2
+ <el-input-number v-model="model" v-bind="props.props" v-on="eventObject">
3
+ <template v-for="(item, key) in props.formItem?.slots" :key="key" #[key]="slotScope">
4
+ <component :is="item" v-model="modelRef[props.formItem.prop || '']" :form-item="props.formItem" :form-model="modelRef" :props="formItemProps" :event-object="eventObject" />
5
+ </template>
6
+ </el-input-number>
3
7
  </template>
4
8
  <script lang="ts" setup>
5
- import { useLocale } from "easybill-ui/utils/hooks/useLocal.ts"
6
- import { ElInputNumber } from "element-plus"
7
- import { getCurrentInstance, h } from "vue"
8
9
  import { FormItemProps } from "../types"
9
10
  const props = defineProps(FormItemProps)
10
11
  const model = defineModel()
11
- const { t } = useLocale()
12
-
13
- const vm = getCurrentInstance()
14
- function changeRef(el: ElInputNumber) {
15
- vm.exposed = el || {}
16
- vm.exposedProxy = el || {}
17
- }
18
12
  </script>
@@ -1,19 +1,21 @@
1
1
  <template>
2
- <component v-model="model" :is="withDirectives(h(ElInput, { ...props.props, ref: changeRef }, props.formItem?.slots), [[trim, true]])" v-on="eventObject"></component>
2
+ <el-input v-model="model" v-trim v-bind="props.props" v-on="eventObject">
3
+ <template v-for="(item, key) in props.formItem?.slots" :key="key" #[key]>
4
+ <component :is="item" :form-item="props.formItem" :form-model="props.formModel" :props="props.props" :event-object="props.eventObject" />
5
+ </template>
6
+ </el-input>
3
7
  </template>
4
- <script lang="ts" setup>
5
- import { useLocale } from "easybill-ui"
6
- import { ElInput } from "element-plus"
7
- import { getCurrentInstance, h, withDirectives } from "vue"
8
+ <script lang="ts">
8
9
  import { directives } from "../directive"
9
10
  import { FormItemProps } from "../types"
11
+
12
+ export default {
13
+ directives: {
14
+ trim: directives.trim,
15
+ },
16
+ }
17
+ </script>
18
+ <script lang="ts" setup>
10
19
  const props = defineProps(FormItemProps)
11
- const { trim } = directives
12
20
  const model = defineModel()
13
- const { t } = useLocale()
14
- const vm = getCurrentInstance()
15
- function changeRef(el: ElInput) {
16
- vm.exposed = el || {}
17
- vm.exposedProxy = el || {}
18
- }
19
21
  </script>
@@ -27,14 +27,13 @@
27
27
  </template>
28
28
  <script lang="ts">
29
29
  import { Loading, Warning } from "@element-plus/icons-vue"
30
- import { ElIcon, ElRadio, ElRadioButton, ElRadioGroup } from "element-plus"
31
- import { computed, defineComponent, toRaw } from "vue"
32
30
  import { useLocale } from "easybill-ui"
31
+ import { computed, defineComponent, toRaw } from "vue"
33
32
  import FormTooltip from "../FormTooltip.vue"
34
33
  import { FormItemProps } from "../types"
35
34
  export default defineComponent({
36
35
  name: "SchemaFormRadio",
37
- components: { Loading, ElIcon, ElRadioGroup, ElRadio, ElRadioButton, Warning, FormTooltip },
36
+ components: { Loading, Warning, FormTooltip },
38
37
  props: {
39
38
  ...FormItemProps,
40
39
  modelValue: {
@@ -12,13 +12,12 @@
12
12
  </template>
13
13
  <script lang="ts">
14
14
  import { useLocale } from "easybill-ui"
15
- import { ElCheckbox, ElOption, ElSelect } from "element-plus"
16
15
  import { computed, defineComponent, onMounted, ref, watch } from "vue"
17
16
  import type { CurdFormOptionItem } from "../types"
18
17
  import { FormItemProps } from "../types"
19
18
  export default defineComponent({
20
19
  name: "SchemaFormSelect",
21
- components: { ElSelect, ElOption, ElCheckbox },
20
+ components: {},
22
21
  props: {
23
22
  ...FormItemProps,
24
23
  modelValue: {
@@ -2,12 +2,11 @@
2
2
  <el-switch v-model="model" v-bind="props" v-on="eventObject" />
3
3
  </template>
4
4
  <script lang="ts">
5
- import { ElSwitch } from "element-plus"
6
5
  import { computed, defineComponent } from "vue"
7
6
  import { FormItemProps } from "../types"
8
7
  export default defineComponent({
9
- name: "SchemaFormTextarea",
10
- components: { ElSwitch },
8
+ name: "SchemaFormSwitch",
9
+ components: {},
11
10
  props: {
12
11
  ...FormItemProps,
13
12
  modelValue: {
@@ -1,14 +1,14 @@
1
1
  <template>
2
- <el-time-picker v-model="model" :placeholder="t('el.form.pleaseSelect', [formItem.label || ''])" v-bind="props" v-on="eventObject"> </el-time-picker>
2
+ <el-time-picker v-model="model" v-bind="props" v-on="eventObject"> </el-time-picker>
3
3
  </template>
4
4
  <script lang="ts">
5
- import { ElTimePicker, type ModelValueType } from "element-plus"
6
- import { computed, defineComponent, type PropType } from "vue"
7
5
  import { useLocale } from "easybill-ui"
6
+ import { type ModelValueType } from "element-plus"
7
+ import { computed, defineComponent, type PropType } from "vue"
8
8
  import { FormItemProps } from "../types"
9
9
  export default defineComponent({
10
10
  name: "SchemaFormTimePicker",
11
- components: { ElTimePicker },
11
+ components: {},
12
12
  props: {
13
13
  ...FormItemProps,
14
14
  modelValue: {
@@ -14,13 +14,12 @@
14
14
  </template>
15
15
  <script lang="ts">
16
16
  import { Loading, Warning } from "@element-plus/icons-vue"
17
- import { ElIcon, ElTreeSelect } from "element-plus"
18
- import { computed, defineComponent, toRaw } from "vue"
19
17
  import { useLocale } from "easybill-ui"
18
+ import { computed, defineComponent, toRaw } from "vue"
20
19
  import { FormItemProps } from "../types"
21
20
  export default defineComponent({
22
21
  name: "SchemaFormTreeSelect",
23
- components: { Loading, ElTreeSelect, ElIcon, Warning },
22
+ components: { Loading, Warning },
24
23
  props: {
25
24
  ...FormItemProps,
26
25
  modelValue: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easybill-ui",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
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": "4b64ea1c8da7f78a0fdf4d49e73607cc4895f2c5"
17
+ "gitHead": "eec41d3b46dce7506465095e9b35f61e4b44b0cc"
18
18
  }