easybill-ui 1.0.23 → 1.0.25

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,13 +1,12 @@
1
1
  <template>
2
- <el-tag v-if="current" class="constant-status" :class="{ 'dot-status': current.dot }" v-bind="currentProps">
2
+ <div class="el-tag constant-status" :class="tagClass" v-bind="currentProps">
3
3
  <el-icon v-if="(current.icon || current.iconClass) && !current.dot" :class="current.iconClass" style="margin-right: 5px">
4
4
  <component :is="current.icon" v-if="current.icon" class="icon" :size="14" style="width: 12px; height: 12px" />
5
5
  </el-icon>
6
6
  <span v-if="current.dot" class="dot"></span>
7
7
  <span v-if="current.html" class="name" v-html="current.label"></span>
8
8
  <span v-else class="name">{{ current.label }}</span>
9
- </el-tag>
10
- <span v-else>{{ typeof value === "undefined" || value === "" ? "--" : value }}</span>
9
+ </div>
11
10
  </template>
12
11
  <script lang="ts">
13
12
  export default {
@@ -37,27 +36,33 @@ const current = computed(() => {
37
36
  label: curs.map((a) => a.label).join(","),
38
37
  }
39
38
  }
40
- if (value === "" || value === undefined) {
41
- return undefined
42
- }
43
- return result && result.find((a) => a.value == props.value)
39
+ return (result && result.find((a) => a.value == props.value)) || {}
44
40
  })
45
41
  const currentProps = computed(() => {
46
- const defaults = { type: "", label: "", value: "", class: [""], style: {} } as OptionItem
42
+ const defaults = { type: "", label: "", value: "", style: {} } as OptionItem
47
43
  const result = props.options || []
48
44
  const cur = result.find((a) => a.value == props.value)
49
45
  if (!cur) return {}
50
46
  const { label, value, border, type, ...args } = cur
51
47
  if (typeof border !== "undefined") {
52
- defaults.class = ["no-border"]
53
48
  defaults.style = args.color ? { color: args.color, backgroundColor: "transparent" } : {}
54
49
  }
55
- // 判断type在不在里面
56
- if (type && ["success", "info", "warning", "danger"].includes(String(type))) {
57
- defaults.type = type
58
- } else {
59
- defaults.class.push("el-tag--" + (type || "default"))
60
- }
61
50
  return { ...defaults, ...args }
62
51
  })
52
+ const tagClass = computed(() => {
53
+ const result = [current.value?.dot ? "dot-status" : "", "el-tag--" + (current.value?.type || "default"), "el-tag--" + (current.value?.effect || "light")]
54
+ if (current.value?.size) {
55
+ result.push("el-tag--" + current.value?.size)
56
+ }
57
+ if (current.value?.hit) {
58
+ result.push("is-hit")
59
+ }
60
+ if (current.value?.round) {
61
+ result.push("is-round")
62
+ }
63
+ if (typeof current.value?.border !== "undefined") {
64
+ result.push("no-border")
65
+ }
66
+ return result
67
+ })
63
68
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <CurdForm ref="formRef" v-model="query" inline class="filter-external" :form-schema="formSchema" v-bind="option?.formProps" @change="onChange">
2
+ <CurdForm ref="formRef" v-model="query" inline class="filter-external" :form-schema="formSchema" v-bind="option?.formProps" :extend-context="props.extendContext" @change="onChange">
3
3
  <template #defaultFilter>
4
4
  <slot></slot>
5
5
  </template>
@@ -27,6 +27,10 @@ const props = defineProps({
27
27
  type: Boolean,
28
28
  default: false,
29
29
  },
30
+ extendContext: {
31
+ type: Object,
32
+ default: () => ({}),
33
+ },
30
34
  })
31
35
  const option = inject<FilterOption>("option")
32
36
  const query = ref<any>({})
@@ -100,5 +104,6 @@ const formRef = ref()
100
104
  const loadOptions = (prop: string, option?: any) => {
101
105
  return formRef.value.loadOptions(prop, option)
102
106
  }
107
+
103
108
  defineExpose({ loadOptions })
104
109
  </script>
@@ -2,7 +2,7 @@
2
2
  <div class="table-filter">
3
3
  <slot name="top"></slot>
4
4
  <div>
5
- <FilterExternal ref="filterExternalRef" :select-params="selectParams" :list-query="listQuery" :has-slot="selectParams.some((a) => !a.external)" v-bind="$attrs" @change="onChange">
5
+ <FilterExternal ref="filterExternalRef" :select-params="selectParams" :list-query="listQuery" :has-slot="selectParams.some((a) => !a.external)" :extendContext="extendContext" v-bind="$attrs" @change="onChange">
6
6
  <template #default>
7
7
  <FilterSearchBox v-if="selectParams.some((a) => !a.external)" ref="searchRef" :select-params="selectParams.filter((a) => !a.external)" :select-list="selectList" :list-query="listQuery" @search="onChange" />
8
8
  </template>
@@ -177,6 +177,9 @@ const loadOptions = (prop: string, option?: any) => {
177
177
  }
178
178
  return searchRef.value.loadOptions(prop, option)
179
179
  }
180
+ const extendContext = {
181
+ loadOptions: loadOptions,
182
+ }
180
183
  const clear = () => {
181
184
  for (let i = 0; i < selectList.value.length; i++) {
182
185
  delete listQuery[selectList.value[i].prop]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easybill-ui",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
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": "cb0c6d1119a11d575bde91b87bbf44e7bbd92a80"
17
+ "gitHead": "028e472c4918af43e28512f928ff9823526afe90"
18
18
  }