22
22
<ul >
23
23
<li v-for =" (value, key, index) in attributes" :key =" index" class =" content" >
24
24
<div class =" left ellipsis" :title =" key" :style =" formatStyle.keyStyle" >{{ key }}</div >
25
- <div class =" right ellipsis" :title =" value.value || value " :style =" formatStyle.valueStyle" >
25
+ <div class =" right ellipsis" :title =" value" :style =" formatStyle.valueStyle" >
26
26
<slot v-if =" fieldsMap[key]" :name =" fieldsMap[key]" :value =" value" ></slot >
27
27
<span v-else >{{ value }}</span >
28
28
</div >
29
29
</li >
30
30
</ul >
31
31
</div >
32
- <sm-table-popup
33
- v-if =" !$slots.default && !($scopedSlots && Object.keys($scopedSlots).length) && Object.keys(attributes).length"
34
- v-bind =" tablePopupProps"
35
- class =" sm-component-attribute-panel__self-content"
36
- />
37
32
<sm-empty v-if =" !$slots.default && !Object.keys(attributes).length" />
38
33
</div >
39
34
</div >
42
37
<script lang="ts">
43
38
import { Component , Prop , Watch , Mixins } from ' vue-property-decorator' ;
44
39
import Theme from ' vue-iclient/src/common/_mixin/Theme' ;
45
- import SmTablePopup from ' vue-iclient/src/common/table-popup/TablePopup.vue' ;
46
40
import SmEmpty from ' vue-iclient/src/common/empty/Empty.vue' ;
47
41
48
42
@Component ({
49
43
name: ' SmAttributePanel' ,
50
- components: { SmTablePopup , SmEmpty }
44
+ components: { SmEmpty }
51
45
})
52
46
class SmAttributePanel extends Mixins (Theme ) {
53
47
attrIndex = 0 ;
@@ -88,13 +82,6 @@ class SmAttributePanel extends Mixins(Theme) {
88
82
})
89
83
attributes: Object ;
90
84
91
- @Prop ({
92
- default : () => {
93
- return [];
94
- }
95
- })
96
- columns: Array <Object >;
97
-
98
85
@Watch (' currentIndex' )
99
86
currentIndexChanged() {
100
87
this .attrIndex = this .currentIndex ;
@@ -116,22 +103,32 @@ class SmAttributePanel extends Mixins(Theme) {
116
103
return ` ${this .attrIndex + 1 }/${this .total } ` ;
117
104
}
118
105
119
- get tablePopupProps() {
120
- return { data: [this .attributes ], columns: this .columns };
121
- }
122
-
123
106
get formatStyle() {
124
107
let style = Object .assign ({}, this .attributeStyle );
125
108
Object .keys (style ).forEach (item => {
126
109
// @ts-ignore
127
110
if (Object .prototype .hasOwnProperty .call (style [item ], ' width' )) {
128
111
// @ts-ignore
129
- style [item ].width += ' px' ;
112
+ if (style [item ].width === 0 ) {
113
+ style [item ].width = ' unset' ;
114
+ style [item ].flex = 1 ;
115
+ } else {
116
+ if (style [item ].width !== ' unset' ) {
117
+ style [item ].width += ' px' ;
118
+ }
119
+ style [item ].flex = ' unset' ;
120
+ }
130
121
}
131
122
// @ts-ignore
132
123
if (Object .prototype .hasOwnProperty .call (style [item ], ' height' )) {
133
124
// @ts-ignore
134
- style [item ].height += ' px' ;
125
+ if (style [item ].height === 0 ) {
126
+ style [item ].height = ' unset' ;
127
+ } else {
128
+ if (style [item ].height !== ' unset' ) {
129
+ style [item ].height += ' px' ;
130
+ }
131
+ }
135
132
}
136
133
});
137
134
return style ;
0 commit comments