easybill-ui 0.1.16 → 0.1.18
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.
- package/components/CurdForm/src/FormTooltip.vue +11 -17
- package/components/CurdForm/src/components/schema-form-checkbox.vue +10 -8
- package/components/CurdForm/src/types.ts +1 -1
- package/components/CurdTable/src/CurdTable.vue +4 -1
- package/components/CurdTable/src/types.ts +1 -1
- package/components/DetailInfo/src/DetailInfo.vue +15 -4
- package/components/DetailInfo/src/DetailInfoContent.vue +0 -3
- package/components/DetailInfo/src/types.ts +3 -1
- package/package.json +2 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-tooltip :content="
|
|
2
|
+
<el-tooltip :content="tooltipModel.content" v-bind="tooltipModel || {}">
|
|
3
3
|
<el-button class="tooltip" type="primary" link>
|
|
4
4
|
<el-icon><Warning /></el-icon>
|
|
5
5
|
</el-button>
|
|
6
6
|
<template #content>
|
|
7
|
-
<div v-html="
|
|
7
|
+
<div v-html="tooltipModel.content"></div>
|
|
8
8
|
</template>
|
|
9
9
|
</el-tooltip>
|
|
10
10
|
</template>
|
|
11
11
|
<script lang="ts" setup>
|
|
12
12
|
import { PropType, computed } from "vue"
|
|
13
13
|
import { Warning } from "@element-plus/icons-vue"
|
|
14
|
-
import { ElButton, ElIcon, ElTooltip } from "element-plus"
|
|
14
|
+
import { ElButton, ElIcon, ElTooltip, ElTooltipProps } from "element-plus"
|
|
15
15
|
import { FormItem, Fields } from "./types"
|
|
16
16
|
const props = defineProps({
|
|
17
17
|
tooltip: {
|
|
@@ -31,31 +31,25 @@ const props = defineProps({
|
|
|
31
31
|
const is = (val: any, type: string) => {
|
|
32
32
|
return Object.prototype.toString.call(val) === `[object ${type}]`
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const tooltipModel = computed(() => {
|
|
35
|
+
let tooltip: any = props.tooltip
|
|
36
36
|
if (!tooltip) {
|
|
37
37
|
return {}
|
|
38
38
|
}
|
|
39
39
|
if (is(tooltip, "Function")) {
|
|
40
|
-
|
|
40
|
+
tooltip = tooltip(props.formModel, props.formItem)
|
|
41
|
+
return getTooltip(tooltip)
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
return { content: tooltip }
|
|
44
|
-
}
|
|
45
|
-
return tooltip
|
|
43
|
+
return getTooltip(tooltip)
|
|
46
44
|
})
|
|
47
45
|
// 获取组件tooltip内容
|
|
48
|
-
const
|
|
49
|
-
const tooltip: any = props.tooltip
|
|
46
|
+
const getTooltip = (tooltip: ElTooltipProps | String) => {
|
|
50
47
|
if (!tooltip) {
|
|
51
48
|
return ""
|
|
52
49
|
}
|
|
53
|
-
if (is(tooltip, "Function")) {
|
|
54
|
-
return tooltip(props.formModel, props.formItem)
|
|
55
|
-
}
|
|
56
50
|
if (is(tooltip, "String")) {
|
|
57
|
-
return tooltip
|
|
51
|
+
return { content: tooltip }
|
|
58
52
|
}
|
|
59
|
-
return
|
|
53
|
+
return tooltip
|
|
60
54
|
}
|
|
61
55
|
</script>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
2
|
+
<div class="schema-form-radio">
|
|
3
|
+
<div v-if="formItem.loading" class="loading" style="color: #999; font-size: 12px">
|
|
4
|
+
<el-icon class="is-loading"><Loading /></el-icon> 加载中...
|
|
5
|
+
</div>
|
|
6
|
+
<el-checkbox-group v-else v-model="model" :class="[props?.showType]" style="width: 100%" v-bind="props" v-on="eventObject">
|
|
7
|
+
<template v-for="option in formItem.options" :key="option.value">
|
|
8
|
+
<el-checkbox-button v-if="props?.componentName == 'button'" :label="option.value" :disabled="option.disabled"> {{ option.label }} </el-checkbox-button>
|
|
9
|
+
<el-checkbox v-else :label="option.value" :disabled="option.disabled"> {{ option.label }} </el-checkbox>
|
|
10
|
+
</template>
|
|
11
|
+
</el-checkbox-group>
|
|
4
12
|
</div>
|
|
5
|
-
<el-checkbox-group v-else v-model="model" :class="[props?.showType]" style="width: 100%" v-bind="props" v-on="eventObject">
|
|
6
|
-
<template v-for="option in formItem.options" :key="option.value">
|
|
7
|
-
<el-checkbox-button v-if="props?.componentName == 'button'" :label="option.value" :disabled="option.disabled"> {{ option.label }} </el-checkbox-button>
|
|
8
|
-
<el-checkbox v-else :label="option.value" :disabled="option.disabled"> {{ option.label }} </el-checkbox>
|
|
9
|
-
</template>
|
|
10
|
-
</el-checkbox-group>
|
|
11
13
|
</template>
|
|
12
14
|
<script lang="ts">
|
|
13
15
|
import { defineComponent, computed, PropType } from "vue"
|
|
@@ -25,7 +25,7 @@ export interface FormItem {
|
|
|
25
25
|
labelWidth?: string
|
|
26
26
|
span?: number
|
|
27
27
|
disabled?: boolean
|
|
28
|
-
tooltip?: string | ((formModel: Fields, formItem: FormItem) => Partial<ElTooltipProps>) | Partial<ElTooltipProps>
|
|
28
|
+
tooltip?: string | ((formModel: Fields, formItem: FormItem) => Partial<ElTooltipProps> | String) | Partial<ElTooltipProps>
|
|
29
29
|
autoload?: boolean
|
|
30
30
|
prefix?: string | any
|
|
31
31
|
suffix?: string | any
|
|
@@ -368,7 +368,7 @@ const create = (row?: any) => {
|
|
|
368
368
|
if (!a.form) return
|
|
369
369
|
let formValue: FormItem
|
|
370
370
|
if (a.form instanceof Function) {
|
|
371
|
-
formValue = a.form(a, row)
|
|
371
|
+
formValue = a.form(a, row, search)
|
|
372
372
|
} else {
|
|
373
373
|
formValue = a.form
|
|
374
374
|
}
|
|
@@ -462,6 +462,9 @@ defineExpose({
|
|
|
462
462
|
setTotal,
|
|
463
463
|
search,
|
|
464
464
|
listQuery,
|
|
465
|
+
fetchCreate: create,
|
|
466
|
+
fetchEdit: create,
|
|
467
|
+
fetchRemove: startremove,
|
|
465
468
|
getEl() {
|
|
466
469
|
return instance?.proxy?.$el
|
|
467
470
|
},
|
|
@@ -25,7 +25,7 @@ export interface ColumnItemCtx<T> {
|
|
|
25
25
|
children?: Array<ColumnItem> // 暂时不支持
|
|
26
26
|
options?: Array<OptionItem> //数据字典
|
|
27
27
|
asyncOptions?: () => Promise<OptionItem[]>
|
|
28
|
-
form?: Partial<FormItemType> | ((formItem: FormItemType, row: T) => Partial<FormItemType>)
|
|
28
|
+
form?: Partial<FormItemType> | ((formItem: FormItemType, row: T, query: Fields) => Partial<FormItemType>)
|
|
29
29
|
filter?: ColumnItemFilter
|
|
30
30
|
detail?: ColumnItemDetail
|
|
31
31
|
//继承自el-table-column属性
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<div v-if="!$slots.default" class="detail-info-body" :class="[props.showType]">
|
|
18
18
|
<div class="table-detail-col" v-for="(item, i) in list" :key="i" :span="item.span" :style="getItemStyle(item)">
|
|
19
19
|
<div class="item-col">
|
|
20
|
-
<div v-if="item.label" class="label" :style="
|
|
20
|
+
<div v-if="item.label" class="label" :style="getLabelStyle(item)">
|
|
21
21
|
<span>{{ item.label }}</span>
|
|
22
22
|
<DetailInfoTooltip :tooltip="item.tooltip" />{{ props.showType == "table" ? "" : ":" }}
|
|
23
23
|
</div>
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
<template v-else-if="item.type == 'image'">
|
|
31
31
|
<el-image :src="item.value" :preview-src-list="[item.value]" style="width: 40px; height: 40px; vertical-align: top" :fit="'cover'" v-bind="item.props"></el-image>
|
|
32
32
|
</template>
|
|
33
|
+
<component v-else-if="item.type" :is="item.type" v-model="item.value" v-bind="item.props"></component>
|
|
33
34
|
<template v-else><DetailInfoContent :data="item" /></template>
|
|
34
35
|
</template>
|
|
35
36
|
</div>
|
|
@@ -52,8 +53,8 @@ import DetailInfoContent from "./DetailInfoContent.vue"
|
|
|
52
53
|
|
|
53
54
|
const props = defineProps({
|
|
54
55
|
data: {
|
|
55
|
-
type:
|
|
56
|
-
default: () =>
|
|
56
|
+
type: Array as PropType<Array<DetailDataItem>>,
|
|
57
|
+
default: () => [],
|
|
57
58
|
},
|
|
58
59
|
title: {
|
|
59
60
|
type: String,
|
|
@@ -74,7 +75,8 @@ const props = defineProps({
|
|
|
74
75
|
},
|
|
75
76
|
})
|
|
76
77
|
const list = computed(() => {
|
|
77
|
-
|
|
78
|
+
const d = props.data || []
|
|
79
|
+
return d.filter((item) => {
|
|
78
80
|
if (typeof item.hidden == "function") return !item.hidden(props.data)
|
|
79
81
|
if (typeof item.hidden != "undefined") return !item.hidden
|
|
80
82
|
return true
|
|
@@ -85,6 +87,15 @@ const getLabelWidth = (dataItem: DetailDataItem): string => {
|
|
|
85
87
|
const isNum = typeof labelWidth == "number" || (typeof labelWidth == "string" && /^\d+$/.test(labelWidth))
|
|
86
88
|
return !isNum ? labelWidth + "" : labelWidth + "px"
|
|
87
89
|
}
|
|
90
|
+
const getLabelStyle = (item: DetailDataItem) => {
|
|
91
|
+
let s = item.labelStyle
|
|
92
|
+
if (typeof s == "object") {
|
|
93
|
+
s = Object.keys(item.labelStyle)
|
|
94
|
+
.map((a) => a + ":" + item.labelStyle[a])
|
|
95
|
+
.join(";")
|
|
96
|
+
}
|
|
97
|
+
return `width: ${getLabelWidth(item)}; justifyContent: ${item.labelPosition || props.labelPosition};` + s
|
|
98
|
+
}
|
|
88
99
|
const getItemStyle = (dataItem: DetailDataItem) => {
|
|
89
100
|
const width = (100 * (dataItem.span || 24)) / 24 + "%"
|
|
90
101
|
return { width: width, flex: "0 0 " + width }
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
<el-tooltip v-if="props.data.showOverflowTooltip" v-bind="getTooltipProps">
|
|
3
3
|
<div v-if="props.data.rawContent" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden" v-html="props.data.value"></div>
|
|
4
4
|
<div v-else style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden">{{ props.data.value }}</div>
|
|
5
|
-
<!-- <template #content>
|
|
6
|
-
<div v-html="props.data.value"></div>
|
|
7
|
-
</template> -->
|
|
8
5
|
</el-tooltip>
|
|
9
6
|
<template v-else>
|
|
10
7
|
<div v-if="props.data.rawContent" v-html="props.data.value"></div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ElTooltipProps } from "element-plus"
|
|
2
2
|
import { OptionItem } from "../../ConstantStatus/src/types"
|
|
3
|
+
import { defineComponent } from "vue"
|
|
3
4
|
|
|
4
5
|
export interface DetailDataItem extends Record<string, any> {
|
|
5
6
|
label?: string
|
|
@@ -9,12 +10,13 @@ export interface DetailDataItem extends Record<string, any> {
|
|
|
9
10
|
/** 当前数据的选项,里面包含的图标、颜色信息会自动显示 */
|
|
10
11
|
options?: Array<OptionItem>
|
|
11
12
|
/** type为image时,会把value当做image的url来显示图片 */
|
|
12
|
-
type?: string
|
|
13
|
+
type?: string | ReturnType<typeof defineComponent>
|
|
13
14
|
labelWidth?: number
|
|
14
15
|
props?: Record<string, string>
|
|
15
16
|
slot?: string
|
|
16
17
|
tooltip?: string | import("element-plus/es/components/tooltip").ElTooltipProps
|
|
17
18
|
labelPosition?: "left" | "right" | "center"
|
|
19
|
+
labelStyle?: string | Record<string, any>
|
|
18
20
|
showOverflowTooltip?: boolean | ElTooltipProps
|
|
19
21
|
rawContent?: boolean
|
|
20
22
|
hidden?: boolean | ((data: DetailDataItem[]) => boolean)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easybill-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
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": "981dfbf919a069d2a103af0cb9b6618db2fdd3c5"
|
|
18
18
|
}
|