stellar-ui-plus 1.23.2 → 1.23.3
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,6 +1,18 @@
|
|
|
1
1
|
#### Props
|
|
2
2
|
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
3
|
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
-
| `
|
|
4
|
+
| `title` | 提示的标题 | `String` | `` | - | - |
|
|
5
|
+
| `content` | 提示的内容 | `String` | `` | - | - |
|
|
6
|
+
| `icon` | 提示区域显示图标,此时content会失效 | `String` | `` | - | - |
|
|
7
|
+
| `showCancel` | 是否显示取消按钮 | `Boolean` | `true` | - | - |
|
|
8
|
+
| `cancelText` | 提示的内容 | `String` | `取消` | - | - |
|
|
9
|
+
| `cancelColor` | 取消按钮的文字颜色 | `String` | `#333333` | - | - |
|
|
10
|
+
| `confirmText` | 确认按钮的文字,最多4个字符 | `String` | `确认` | - | - |
|
|
11
|
+
| `confirmColor` | 确认按钮的文字颜色 | `String` | `#0090FF` | - | - |
|
|
12
|
+
| `editable` | 是否显示输入框 | `Boolean` | `false` | - | - |
|
|
13
|
+
| `placeholderText` | 显示输入框时的提示文本 | `String` | `` | - | - |
|
|
14
|
+
| `confirm` | 点击确认的回调函数 | `Function` | `null` | - | - |
|
|
15
|
+
| `cancel` | 点击取消的回调函数 | `Function` | `null` | - | - |
|
|
16
|
+
| `complete` | 弹框关闭的回调函数(无论是确认关闭还是取消关闭) | `Function` | `null` | - | - |
|
|
5
17
|
|
|
6
18
|
|
|
@@ -11,6 +11,10 @@ const tableColumnProps = {
|
|
|
11
11
|
minWidth: { type: [String, Number], default: '' },
|
|
12
12
|
align: { type: String as PropType<AlignType>, default: 'left' },
|
|
13
13
|
headerAlign: { type: String as PropType<AlignType>, default: 'left' },
|
|
14
|
+
/** 是否显示 popover(列级别配置,优先级高于表格级别的 isPopover) */
|
|
15
|
+
showPopover: { type: Boolean, default: undefined },
|
|
16
|
+
/** popover 显示行数(列级别配置,优先级高于表格级别的 popoverLine) */
|
|
17
|
+
popoverLine: { type: Number, default: undefined },
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
export type TableColumnProps = ExtractPropTypes<typeof tableColumnProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref, watch, type CSSProperties, type Ref } from 'vue';
|
|
2
|
+
import { computed, ref, watch, h, type CSSProperties, type Ref } from 'vue';
|
|
3
3
|
import type { Obj } from '../../types';
|
|
4
4
|
import propsData from './props';
|
|
5
5
|
import utils from '../../utils/utils';
|
|
@@ -153,6 +153,16 @@ function cellClick(event: any) {
|
|
|
153
153
|
changeCheck();
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
// 计算最终是否使用 popover(列级别优先于表格级别)
|
|
158
|
+
const finalShowPopover = computed(() => {
|
|
159
|
+
return props.showPopover !== undefined ? props.showPopover : parentProps.isPopover;
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// 计算最终 popover 行数
|
|
163
|
+
const finalPopoverLine = computed(() => {
|
|
164
|
+
return props.popoverLine !== undefined ? props.popoverLine : parentProps.popoverLine;
|
|
165
|
+
});
|
|
156
166
|
</script>
|
|
157
167
|
|
|
158
168
|
<template>
|
|
@@ -169,15 +179,31 @@ function cellClick(event: any) {
|
|
|
169
179
|
</view>
|
|
170
180
|
</template>
|
|
171
181
|
<template v-else>
|
|
172
|
-
|
|
182
|
+
<!-- 优先级1:text 插槽 - 纯文本内容,自动应用 popover -->
|
|
183
|
+
<template v-if="$slots.text">
|
|
184
|
+
<view class="cell-box">
|
|
185
|
+
<template v-if="!finalShowPopover">
|
|
186
|
+
<slot name="text" :row="row.row" :column="props"></slot>
|
|
187
|
+
</template>
|
|
188
|
+
<table-popover v-else :line="finalPopoverLine">
|
|
189
|
+
<slot name="text" :row="row.row" :column="props"></slot>
|
|
190
|
+
</table-popover>
|
|
191
|
+
</view>
|
|
192
|
+
</template>
|
|
193
|
+
|
|
194
|
+
<!-- 优先级2:default 插槽 - 完全自定义,不应用 popover -->
|
|
195
|
+
<slot v-else-if="row[prop] || !$slots.empty" :row="row.row" :column="props">
|
|
196
|
+
<!-- 优先级3:默认渲染 -->
|
|
173
197
|
<sub-table :rows="row[prop]" v-if="rowSpan" :border="cmpBorder" />
|
|
174
198
|
<view class="cell-box" v-else>
|
|
175
|
-
<template v-if="!
|
|
199
|
+
<template v-if="!finalShowPopover">
|
|
176
200
|
{{ cellText() }}
|
|
177
201
|
</template>
|
|
178
|
-
<table-popover v-else :text="cellText()" :line="
|
|
202
|
+
<table-popover v-else :text="cellText()" :line="finalPopoverLine"></table-popover>
|
|
179
203
|
</view>
|
|
180
204
|
</slot>
|
|
205
|
+
|
|
206
|
+
<!-- 空状态 -->
|
|
181
207
|
<view class="cell-box" v-else>
|
|
182
208
|
<slot name="empty"><text>暂无数据</text></slot>
|
|
183
209
|
</view>
|
|
@@ -42,7 +42,7 @@ const checkTextOverflow = async () => {
|
|
|
42
42
|
let textData = await utils.querySelector<false>('.measure-text', instance);
|
|
43
43
|
|
|
44
44
|
if (containerData && textData && textData.width && containerData.width) {
|
|
45
|
-
isTextOverflow.value = textData.width > containerData.width * Number(props.line);
|
|
45
|
+
isTextOverflow.value = textData.width > containerData.width * Number(props.line) - 4;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -125,14 +125,16 @@ const doHide = () => {
|
|
|
125
125
|
<template>
|
|
126
126
|
<view class="wrapper">
|
|
127
127
|
<view class="ellipsis-box" @touchstart="handleTouchStart" @touchend="handleTouchEnd" @mousedown="handleTouchStart">
|
|
128
|
-
{{ text }}
|
|
128
|
+
<slot>{{ text }}</slot>
|
|
129
129
|
</view>
|
|
130
130
|
<!-- 不做展示,正常显示文字长度,用于判断是否超过长度 -->
|
|
131
|
-
<text class="measure-text">
|
|
131
|
+
<text class="measure-text">
|
|
132
|
+
<slot>{{ text }}</slot>
|
|
133
|
+
</text>
|
|
132
134
|
|
|
133
135
|
<view class="popover" :class="showPopover ? 'show' : 'hidden'" :style="{ left: popoverLeft + 'px', top: popoverTop + 'px' }" :animation="animationData">
|
|
134
136
|
<view class="popover-content">
|
|
135
|
-
{{ text }}
|
|
137
|
+
<slot>{{ text }}</slot>
|
|
136
138
|
</view>
|
|
137
139
|
<view class="popover-arrow" :style="{ left: arrowLeft + '%' }"></view>
|
|
138
140
|
</view>
|