stellar-ui-plus 1.23.2 → 1.23.4
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, useSlots, 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';
|
|
@@ -31,10 +31,12 @@ const rowSpan = ref(false);
|
|
|
31
31
|
|
|
32
32
|
defineExpose({ row });
|
|
33
33
|
|
|
34
|
+
const slots = useSlots();
|
|
34
35
|
// 监听 row 数据变化,判断是否需要合并单元格
|
|
35
36
|
watch(
|
|
36
37
|
() => row.value[props.prop],
|
|
37
38
|
val => {
|
|
39
|
+
console.log('$slots is ', slots);
|
|
38
40
|
if (Array.isArray(val)) {
|
|
39
41
|
rowSpan.value = true;
|
|
40
42
|
}
|
|
@@ -153,6 +155,16 @@ function cellClick(event: any) {
|
|
|
153
155
|
changeCheck();
|
|
154
156
|
}
|
|
155
157
|
}
|
|
158
|
+
|
|
159
|
+
// 计算最终是否使用 popover(列级别优先于表格级别)
|
|
160
|
+
const finalShowPopover = computed(() => {
|
|
161
|
+
return props.showPopover !== undefined ? props.showPopover : parentProps.isPopover;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// 计算最终 popover 行数
|
|
165
|
+
const finalPopoverLine = computed(() => {
|
|
166
|
+
return props.popoverLine !== undefined ? props.popoverLine : parentProps.popoverLine;
|
|
167
|
+
});
|
|
156
168
|
</script>
|
|
157
169
|
|
|
158
170
|
<template>
|
|
@@ -170,6 +182,7 @@ function cellClick(event: any) {
|
|
|
170
182
|
</template>
|
|
171
183
|
<template v-else>
|
|
172
184
|
<slot v-if="row[prop] || !$slots.empty">
|
|
185
|
+
123
|
|
173
186
|
<sub-table :rows="row[prop]" v-if="rowSpan" :border="cmpBorder" />
|
|
174
187
|
<view class="cell-box" v-else>
|
|
175
188
|
<template v-if="!parentProps.isPopover">
|
|
@@ -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
|
|