stellar-ui-plus 1.17.10 → 1.17.12
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/ste-animate/ste-animate.vue +1 -1
- package/components/ste-badge/ste-badge.vue +1 -1
- package/components/ste-barcode/ste-barcode.vue +1 -1
- package/components/ste-button/ste-button.vue +1 -1
- package/components/ste-code-input/ste-code-input.vue +1 -1
- package/components/ste-date-picker/ste-date-picker.vue +1 -1
- package/components/ste-drag/ste-drag.vue +1 -1
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +1 -1
- package/components/ste-icon/ste-icon.vue +1 -1
- package/components/ste-index-item/ste-index-item.vue +1 -1
- package/components/ste-index-list/ste-index-list.vue +1 -1
- package/components/ste-input/ste-input.vue +1 -1
- package/components/ste-loading/ste-loading.vue +1 -1
- package/components/ste-message-box/ste-message-box.vue +1 -1
- package/components/ste-notice-bar/ste-notice-bar.vue +1 -1
- package/components/ste-number-keyboard/KeyboardVue.vue +1 -1
- package/components/ste-picker/ste-picker.vue +1 -1
- package/components/ste-popup/ste-popup.vue +1 -1
- package/components/ste-price/ste-price.vue +1 -1
- package/components/ste-qrcode/ste-qrcode.vue +1 -1
- package/components/ste-rate/ste-rate.vue +1 -1
- package/components/ste-read-more/ste-read-more.vue +1 -1
- package/components/ste-scroll-to/ste-scroll-to.vue +1 -1
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +0 -1
- package/components/ste-search/ste-search.vue +1 -1
- package/components/ste-select/datapager.vue +1 -1
- package/components/ste-select/ste-select.vue +1 -1
- package/components/ste-signature/ste-signature.vue +1 -1
- package/components/ste-slider/ste-slider.vue +1 -1
- package/components/ste-step/ste-step.vue +1 -1
- package/components/ste-stepper/ste-stepper.vue +1 -1
- package/components/ste-steps/ste-steps.vue +0 -1
- package/components/ste-sticky/ste-sticky.vue +1 -1
- package/components/ste-swiper/ste-swiper.vue +1 -1
- package/components/ste-swiper-item/ste-swiper-item.vue +1 -1
- package/components/ste-switch/ste-switch.vue +1 -1
- package/components/ste-tab/ste-tab.vue +0 -1
- package/components/ste-table/ATTRIBUTES.md +1 -0
- package/components/ste-table/README.md +35 -6
- package/components/ste-table/props.ts +1 -0
- package/components/ste-table/ste-table.easycom.json +5 -0
- package/components/ste-table/ste-table.vue +3 -3
- package/components/ste-table-column/common.scss +19 -4
- package/components/ste-table-column/ste-table-column.vue +9 -3
- package/components/ste-table-column/table-popover.vue +197 -0
- package/components/ste-tabs/ste-tabs.vue +1 -1
- package/components/ste-text/ste-text.vue +1 -1
- package/components/ste-toast/ste-toast.vue +1 -1
- package/components/ste-touch-swipe/ste-touch-swipe.vue +1 -1
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +0 -1
- package/components/ste-upload/ste-upload.vue +1 -1
- package/components/ste-video/ste-video.vue +1 -1
- package/package.json +1 -1
- package/store/color.ts +0 -33
- package/store/index.ts +0 -2
- package/store/message-box.ts +0 -54
- package/store/toast.ts +0 -50
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import utils from '../../utils/utils';
|
|
3
|
-
import { ref, onMounted, watch,
|
|
3
|
+
import { ref, onMounted, watch, getCurrentInstance, type ComponentPublicInstance } from 'vue';
|
|
4
4
|
import propsData from './props';
|
|
5
5
|
import { PATTERNS, stringToCode128 } from './encode';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, type CSSProperties } from 'vue';
|
|
3
3
|
import { useColorStore } from '../../store/color';
|
|
4
4
|
let { getColor } = useColorStore();
|
|
5
5
|
import propsData from './props';
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script lang="ts" setup>
|
|
24
|
-
import { ref, onMounted, nextTick,
|
|
24
|
+
import { ref, onMounted, nextTick, computed } from 'vue';
|
|
25
25
|
import { useColorStore } from '../../store/color';
|
|
26
26
|
let { getColor } = useColorStore();
|
|
27
27
|
import propsData from './props';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { watch, onMounted, reactive,
|
|
2
|
+
import { watch, onMounted, reactive, onBeforeUnmount, getCurrentInstance, type ComponentPublicInstance } from 'vue';
|
|
3
3
|
import utils from '../../utils/utils';
|
|
4
4
|
import propsData, { DEFAULT_BOUNDARY } from './props';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { watch, computed, ref, type CSSProperties, getCurrentInstance,
|
|
2
|
+
import { watch, computed, ref, type CSSProperties, getCurrentInstance, type ComponentPublicInstance } from 'vue';
|
|
3
3
|
import { useProvide } from '../../utils/mixin';
|
|
4
4
|
import { DEFAULT_DURATION, MAX_DURATION, MIN_DURATION, DEFAULT_ROOT_QUERY } from './constans';
|
|
5
5
|
import propsData, { DEOP_DOWN_MENU_KEY, dropDownMenuEmits } from './props';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { ref, nextTick, onMounted } from 'vue';
|
|
3
3
|
import propsData from './props';
|
|
4
4
|
import { useInject } from '../../utils/mixin';
|
|
5
5
|
import { INDEX_LIST_KEY } from '../ste-index-list/props';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, computed, watch, nextTick, getCurrentInstance,
|
|
2
|
+
import { ref, computed, watch, nextTick, getCurrentInstance, onMounted } from 'vue';
|
|
3
3
|
import propsData, { INDEX_LIST_KEY } from './props';
|
|
4
4
|
import useData from '../ste-scroll-to/useData';
|
|
5
5
|
import { useProvide } from '../../utils/mixin';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref, watch, nextTick, type CSSProperties
|
|
2
|
+
import { computed, ref, watch, nextTick, type CSSProperties } from 'vue';
|
|
3
3
|
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
import propsData, { type InputEmits } from './props';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import utils from '../../utils/utils.js';
|
|
3
3
|
import propsData from './props';
|
|
4
|
-
import { ref, computed,
|
|
4
|
+
import { ref, computed, type CSSProperties } from 'vue';
|
|
5
5
|
|
|
6
6
|
defineOptions({
|
|
7
7
|
name: 'ste-loading',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { inject, watch, ref, computed, useSlots
|
|
2
|
+
import { inject, watch, ref, computed, useSlots } from 'vue';
|
|
3
3
|
import { messageBoxDefaultOptionsKey } from './ste-message-box';
|
|
4
4
|
import useData from './useData';
|
|
5
5
|
import type { BaseEvent } from '../../types/event';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import utils from '../../utils/utils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { ref, computed, type CSSProperties, watch, nextTick, getCurrentInstance, type ComponentPublicInstance, type Ref } from 'vue';
|
|
4
4
|
import propsData from './props';
|
|
5
5
|
|
|
6
6
|
defineOptions({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, computed, watch,
|
|
2
|
+
import { ref, computed, watch, type CSSProperties } from 'vue';
|
|
3
3
|
import propsData from './props';
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
const DEFAULT_BORDER_RADIUS = 32;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import utils from '../../utils/utils';
|
|
3
|
-
import { nextTick, onMounted, watch,
|
|
3
|
+
import { nextTick, onMounted, watch, getCurrentInstance, ref, computed, type ComponentPublicInstance } from 'vue';
|
|
4
4
|
import propsData from './props';
|
|
5
5
|
|
|
6
6
|
import UQRCode, { type URCodeCanvasContext } from './uqrcode';
|
|
@@ -3,7 +3,7 @@ import utils from '../../utils/utils.js';
|
|
|
3
3
|
import { useColorStore } from '../../store/color';
|
|
4
4
|
let { getColor } = useColorStore();
|
|
5
5
|
import propsData from './props';
|
|
6
|
-
import { computed,
|
|
6
|
+
import { computed, type CSSProperties } from 'vue';
|
|
7
7
|
|
|
8
8
|
defineOptions({
|
|
9
9
|
name: 'ste-rate',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, onMounted, getCurrentInstance, type CSSProperties,
|
|
2
|
+
import { computed, ref, onMounted, getCurrentInstance, type CSSProperties, type ComponentPublicInstance } from 'vue';
|
|
3
3
|
import propsData from './props';
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, computed, getCurrentInstance,
|
|
2
|
+
import { ref, computed, getCurrentInstance, onMounted } from 'vue';
|
|
3
3
|
import propsData, { SCROLL_TO_KEY } from './props';
|
|
4
4
|
import useData from './useData';
|
|
5
5
|
import { useProvide } from '../../utils/mixin';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, watch,
|
|
2
|
+
import { computed, watch, nextTick } from 'vue';
|
|
3
3
|
import type { SwiperOnChangeEvent } from '@uni-helper/uni-app-types';
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
import type { SearchSuggestion, Obj } from '../../types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { getCurrentInstance,
|
|
2
|
+
import { getCurrentInstance, onMounted, ref } from 'vue';
|
|
3
3
|
import propsData, { type SelectOption, type SelectValue } from './props';
|
|
4
4
|
import useData from './useData';
|
|
5
5
|
import DateTime from './datetime.vue';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, onMounted, getCurrentInstance,
|
|
2
|
+
import { computed, onMounted, getCurrentInstance, ref } from 'vue';
|
|
3
3
|
import utils from '../../utils/utils';
|
|
4
4
|
import type { Stroke } from './types';
|
|
5
5
|
import type { HTMLMouseEvent, UniTouchEvent } from '../../types/event.d';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, getCurrentInstance, type CSSProperties, type ComponentPublicInstance, onMounted, watch, onBeforeUnmount } from 'vue';
|
|
3
3
|
import { useColorStore } from '../../store/color';
|
|
4
4
|
let { getColor } = useColorStore();
|
|
5
5
|
import type { UniTouchEvent, BaseEvent } from '../../types/event';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, nextTick, ref, watch
|
|
2
|
+
import { computed, nextTick, ref, watch } from 'vue';
|
|
3
3
|
import { useInject } from '../../utils/mixin';
|
|
4
4
|
import { type StepsProps, STEPS_KEY } from '../ste-steps/props';
|
|
5
5
|
import propsData from './props';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { BaseEvent } from '@uni-helper/uni-app-types';
|
|
3
|
-
import { computed, type CSSProperties, nextTick
|
|
3
|
+
import { computed, type CSSProperties, nextTick } from 'vue';
|
|
4
4
|
import { useColorStore } from '../../store/color';
|
|
5
5
|
let { getColor } = useColorStore();
|
|
6
6
|
import propsData, { type StepperEmits } from './props';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, computed, onMounted, onBeforeUnmount, getCurrentInstance
|
|
2
|
+
import { ref, computed, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue';
|
|
3
3
|
import type { Obj } from '../../types';
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
import propsData from './props';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { getCurrentInstance, ref } from 'vue';
|
|
3
3
|
import propsData, { SWIPER_KEY } from './props';
|
|
4
4
|
import { useProvide } from '../../utils/mixin';
|
|
5
5
|
import useData from './useData';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import utils from '../../utils/utils.js';
|
|
3
3
|
import propsData from './props';
|
|
4
|
-
import { ref, computed,
|
|
4
|
+
import { ref, computed, type CSSProperties } from 'vue';
|
|
5
5
|
import { useColorStore } from '../../store/color';
|
|
6
6
|
let { getColor } = useColorStore();
|
|
7
7
|
defineOptions({
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
|
|
49
49
|
#### 空数据显示
|
|
50
50
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
51
|
+
- 通过`table`中的`emptyText`属性来指定单元格中数据为空时显示的值,否则显示`-`
|
|
52
|
+
- 也可以通过插槽来自定义空数据时显示
|
|
53
53
|
|
|
54
54
|
```html
|
|
55
55
|
<script lang="ts" setup>
|
|
@@ -149,8 +149,8 @@
|
|
|
149
149
|
|
|
150
150
|
#### 显示合计
|
|
151
151
|
|
|
152
|
-
-
|
|
153
|
-
-
|
|
152
|
+
- 通过`showSummary`控制是否显示合计,`sumText`控制合计行第一列的文本
|
|
153
|
+
- `summaryMethod`来指定合计的方法,需要返回一个数组来确定每一列合计显示的内容
|
|
154
154
|
|
|
155
155
|
```html
|
|
156
156
|
<script lang="ts" setup>
|
|
@@ -185,8 +185,8 @@
|
|
|
185
185
|
|
|
186
186
|
#### 对齐方式
|
|
187
187
|
|
|
188
|
-
-
|
|
189
|
-
-
|
|
188
|
+
- 通过`align`指定某列的单元格的对齐方式
|
|
189
|
+
- `headerAlign`指定表头的单元格对齐方式, 没设置时跟随`align`值
|
|
190
190
|
|
|
191
191
|
```html
|
|
192
192
|
<ste-table :data="rows">
|
|
@@ -566,6 +566,35 @@
|
|
|
566
566
|
}
|
|
567
567
|
```
|
|
568
568
|
|
|
569
|
+
#### 单元格超出长按显示气泡
|
|
570
|
+
|
|
571
|
+
```html
|
|
572
|
+
<script lang="ts" setup>
|
|
573
|
+
import { ref } from 'vue';
|
|
574
|
+
const rows5 = ref([
|
|
575
|
+
{ t1: '张三', t2: '我是张三我是张三我是张三我是张三', t3: '男男男男男男男男男' },
|
|
576
|
+
{ t1: '李四', t2: '你是李四你是李四你是李四你是李四你是李四', t3: '女' },
|
|
577
|
+
{ t1: '王五王五王五', t2: '王五描述', t3: '女' },
|
|
578
|
+
{ t1: '赵六赵六赵六赵六', t2: '赵六', t3: '女' },
|
|
579
|
+
{ t1: '王七', t2: '他是王七他是王七他是王七他是王七他是王七', t3: '女女女女女女女' },
|
|
580
|
+
]);
|
|
581
|
+
</script>
|
|
582
|
+
<template>
|
|
583
|
+
<view class="title">单元格文字超出时气泡显示内容</view>
|
|
584
|
+
<view class="item-block">
|
|
585
|
+
<view style="width: 100%">
|
|
586
|
+
<ste-table :data="rows5" isPopover>
|
|
587
|
+
<template v-slot="{ row }">
|
|
588
|
+
<ste-table-column label="文字1" prop="t1"></ste-table-column>
|
|
589
|
+
<ste-table-column label="文字2" prop="t2"></ste-table-column>
|
|
590
|
+
<ste-table-column label="文字3" prop="t3"></ste-table-column>
|
|
591
|
+
</template>
|
|
592
|
+
</ste-table>
|
|
593
|
+
</view>
|
|
594
|
+
</view>
|
|
595
|
+
</template>
|
|
596
|
+
```
|
|
597
|
+
|
|
569
598
|
---$
|
|
570
599
|
|
|
571
600
|
### API
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, watch, ref,
|
|
2
|
+
import { computed, watch, ref, type CSSProperties } from 'vue';
|
|
3
3
|
import propsData, { TABLE_KEY, tableEmits, CHECK_ICON_SIZE, SELECTION_COLOR_CONFIG, type TableProps } from './props';
|
|
4
4
|
import utils from '../../utils/utils';
|
|
5
5
|
import { useProvide } from '../../utils/mixin';
|
|
@@ -65,7 +65,7 @@ const cmpRootStyle = computed(() => {
|
|
|
65
65
|
'--offset-top': props.offsetTop,
|
|
66
66
|
'--table-height': utils.addUnit(props.height as string),
|
|
67
67
|
'--table-max-height': utils.addUnit(props.maxHeight as string),
|
|
68
|
-
'--ste-theme-color': utils.Color.hex2rgba(getColor().steThemeColor
|
|
68
|
+
'--ste-theme-color': utils.Color.hex2rgba(getColor().steThemeColor),
|
|
69
69
|
};
|
|
70
70
|
return style;
|
|
71
71
|
});
|
|
@@ -343,7 +343,7 @@ $default-border: 2rpx solid #ebebeb;
|
|
|
343
343
|
padding: 0 32rpx;
|
|
344
344
|
height: 80rpx;
|
|
345
345
|
font-size: var(--font-size-24, 24rpx);
|
|
346
|
-
|
|
346
|
+
overflow-x: hidden;
|
|
347
347
|
.cell-box {
|
|
348
348
|
height: 100%;
|
|
349
349
|
display: flex;
|
|
@@ -10,9 +10,22 @@
|
|
|
10
10
|
align-items: center;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
&.popover {
|
|
14
|
+
overflow-x: hidden;
|
|
15
|
+
.cell-box {
|
|
16
|
+
// overflow: hidden;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
// white-space: nowrap;
|
|
19
|
+
// text-overflow: ellipsis;
|
|
20
|
+
// /* 防止文本被选中,提升移动端体验 */
|
|
21
|
+
// user-select: none;
|
|
22
|
+
// -webkit-user-select: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
.cell-box {
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
27
|
+
// display: flex;
|
|
28
|
+
// align-items: center;
|
|
16
29
|
padding: 24rpx 32rpx;
|
|
17
30
|
}
|
|
18
31
|
|
|
@@ -40,13 +53,15 @@
|
|
|
40
53
|
&.align-center {
|
|
41
54
|
justify-content: center;
|
|
42
55
|
.cell-box {
|
|
43
|
-
justify-content: center;
|
|
56
|
+
// justify-content: center;
|
|
57
|
+
text-align: center;
|
|
44
58
|
}
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
&.align-right {
|
|
48
62
|
justify-content: flex-end;
|
|
49
63
|
.cell-box {
|
|
50
|
-
justify-content: flex-end;
|
|
64
|
+
// justify-content: flex-end;
|
|
65
|
+
text-align: right;
|
|
51
66
|
}
|
|
52
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref, type CSSProperties,
|
|
2
|
+
import { computed, ref, 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';
|
|
@@ -8,6 +8,7 @@ import { useInject } from '../../utils/mixin';
|
|
|
8
8
|
import { TABLE_KEY, SELECTION_COLOR_CONFIG, type TableProps } from '../ste-table/props';
|
|
9
9
|
import CheckBoxIcon from './checkbox-icon.vue';
|
|
10
10
|
import RadioIcon from './radio-icon.vue';
|
|
11
|
+
import TablePopover from './table-popover.vue';
|
|
11
12
|
|
|
12
13
|
const componentName = `ste-table-column`;
|
|
13
14
|
defineOptions({
|
|
@@ -19,7 +20,7 @@ defineOptions({
|
|
|
19
20
|
|
|
20
21
|
const props = defineProps(propsData);
|
|
21
22
|
|
|
22
|
-
const Parent = useInject<{ props: Required<TableProps>; checkStates:
|
|
23
|
+
const Parent = useInject<{ props: Required<TableProps>; checkStates: Ref<number[]>; handleCheck: (...args: any[]) => void; cellClick: (...args: any[]) => void }>(TABLE_KEY);
|
|
23
24
|
const parent = Parent.parent;
|
|
24
25
|
const parentProps = Parent.parent?.props as TableProps;
|
|
25
26
|
|
|
@@ -64,6 +65,10 @@ const cmpRootClass = computed(() => {
|
|
|
64
65
|
classArr.push('border');
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
if (parentProps.isPopover) {
|
|
69
|
+
classArr.push('popover');
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
const cellClassParam = {
|
|
68
73
|
column: props,
|
|
69
74
|
columnIndex: row.value.colIndex,
|
|
@@ -145,7 +150,8 @@ function cellClick(this: any, event: any) {
|
|
|
145
150
|
<template v-else>
|
|
146
151
|
<slot v-if="row[prop] || !$slots.empty">
|
|
147
152
|
<view class="cell-box">
|
|
148
|
-
{{ cellText() }}
|
|
153
|
+
<!-- {{ cellText() }} -->
|
|
154
|
+
<table-popover :text="cellText()"></table-popover>
|
|
149
155
|
</view>
|
|
150
156
|
</slot>
|
|
151
157
|
<view class="cell-box" v-else>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, onMounted, watch, getCurrentInstance, type ComponentPublicInstance, nextTick } from 'vue';
|
|
3
|
+
import utils from '../../utils/utils.js';
|
|
4
|
+
const DURATION = 200;
|
|
5
|
+
const ANIMATION_PROP: UniApp.CreateAnimationOptions = { duration: DURATION, timingFunction: 'ease-out' };
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
text: {
|
|
9
|
+
type: [String, null],
|
|
10
|
+
default: '',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const instance = getCurrentInstance() as unknown as ComponentPublicInstance;
|
|
15
|
+
|
|
16
|
+
const pressTimer = ref();
|
|
17
|
+
const showPopover = ref(false);
|
|
18
|
+
const popoverLeft = ref(0);
|
|
19
|
+
const popoverTop = ref(0);
|
|
20
|
+
const arrowLeft = ref(50); // 箭头的左边距百分比
|
|
21
|
+
const isTextOverflow = ref(false);
|
|
22
|
+
const animationData = ref<UniApp.Animation>();
|
|
23
|
+
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
nextTick(() => {
|
|
26
|
+
checkTextOverflow();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
watch(
|
|
31
|
+
() => props.text,
|
|
32
|
+
() => {
|
|
33
|
+
checkTextOverflow();
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
const checkTextOverflow = async () => {
|
|
37
|
+
const containerData = await utils.querySelector<false>('.ellipsis-box', instance);
|
|
38
|
+
let textData = await utils.querySelector<false>('.measure-text', instance);
|
|
39
|
+
|
|
40
|
+
if (containerData && textData && textData.width && containerData.width) {
|
|
41
|
+
isTextOverflow.value = textData.width > containerData.width;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleTouchStart = (e: TouchEvent | MouseEvent) => {
|
|
46
|
+
if (!isTextOverflow.value) return;
|
|
47
|
+
|
|
48
|
+
pressTimer.value = setTimeout(() => {
|
|
49
|
+
showPopover.value = true;
|
|
50
|
+
nextTick(() => {
|
|
51
|
+
updatePopoverPosition();
|
|
52
|
+
});
|
|
53
|
+
}, 100);
|
|
54
|
+
// #ifdef WEB
|
|
55
|
+
window.addEventListener('mouseup', doHide);
|
|
56
|
+
// #endif
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const updatePopoverPosition = async () => {
|
|
60
|
+
const containerData = await utils.querySelector<false>('.ellipsis-box', instance);
|
|
61
|
+
const popoverData = await utils.querySelector<false>('.popover', instance);
|
|
62
|
+
if (!containerData || !popoverData || !containerData.left || !containerData.width || !popoverData.width || !containerData.top || !popoverData.height) return;
|
|
63
|
+
|
|
64
|
+
const systemInfo = utils.System;
|
|
65
|
+
const MARGIN = 10; // 间隔像素,避免贴边或者贴着弹出元素
|
|
66
|
+
|
|
67
|
+
// 计算文本框中心点
|
|
68
|
+
const boxCenter = containerData.left + containerData.width / 2;
|
|
69
|
+
|
|
70
|
+
// 计算 popover 的位置
|
|
71
|
+
let left = boxCenter - popoverData.width / 2;
|
|
72
|
+
|
|
73
|
+
// 确保 popover 不超出屏幕左边
|
|
74
|
+
if (left < MARGIN) {
|
|
75
|
+
left = MARGIN;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 确保 popover 不超出屏幕右边
|
|
79
|
+
if (left + popoverData.width > systemInfo.getWindowWidth() - MARGIN) {
|
|
80
|
+
left = systemInfo.getWindowWidth() - popoverData.width - MARGIN;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 计算箭头位置(相对于 popover 的百分比)
|
|
84
|
+
const tempArrowLeft = ((boxCenter - left) / popoverData.width) * 100;
|
|
85
|
+
popoverLeft.value = left;
|
|
86
|
+
popoverTop.value = containerData.top - popoverData.height - (MARGIN + 5);
|
|
87
|
+
|
|
88
|
+
arrowLeft.value = Math.max(10, Math.min(90, tempArrowLeft)); // 限制箭头在 10% 到 90% 之间
|
|
89
|
+
doShow();
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleTouchEnd = () => {
|
|
93
|
+
doHide();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const doShow = () => {
|
|
97
|
+
nextTick(() => {
|
|
98
|
+
let animation = uni.createAnimation(ANIMATION_PROP);
|
|
99
|
+
animation.opacity(1).step();
|
|
100
|
+
animationData.value = animation.export();
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const doHide = () => {
|
|
105
|
+
if (pressTimer.value) {
|
|
106
|
+
clearTimeout(pressTimer.value);
|
|
107
|
+
pressTimer.value = null;
|
|
108
|
+
}
|
|
109
|
+
let animation = uni.createAnimation(ANIMATION_PROP);
|
|
110
|
+
animation.opacity(0).step();
|
|
111
|
+
animationData.value = animation.export();
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
showPopover.value = false;
|
|
114
|
+
}, DURATION);
|
|
115
|
+
// #ifdef WEB
|
|
116
|
+
window.removeEventListener('mouseup', doHide);
|
|
117
|
+
// #endif
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<view class="wrapper">
|
|
123
|
+
<view class="ellipsis-box" @touchstart="handleTouchStart" @touchend="handleTouchEnd" @mousedown="handleTouchStart">
|
|
124
|
+
{{ text }}
|
|
125
|
+
</view>
|
|
126
|
+
<!-- 不做展示,正常显示文字长度,用于判断是否超过长度 -->
|
|
127
|
+
<text class="measure-text">{{ text }}</text>
|
|
128
|
+
|
|
129
|
+
<view class="popover" :class="showPopover ? 'show' : 'hidden'" :style="{ left: popoverLeft + 'px', top: popoverTop + 'px' }" :animation="animationData">
|
|
130
|
+
<view class="popover-content">
|
|
131
|
+
{{ text }}
|
|
132
|
+
</view>
|
|
133
|
+
<view class="popover-arrow" :style="{ left: arrowLeft + '%' }"></view>
|
|
134
|
+
</view>
|
|
135
|
+
</view>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<style lang="scss" scoped>
|
|
139
|
+
.wrapper {
|
|
140
|
+
position: relative;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ellipsis-box {
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
text-overflow: ellipsis;
|
|
147
|
+
// #ifdef H5
|
|
148
|
+
user-select: none;
|
|
149
|
+
// #endif
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.measure-text {
|
|
153
|
+
position: fixed;
|
|
154
|
+
left: -9999px;
|
|
155
|
+
top: -9999px;
|
|
156
|
+
white-space: nowrap;
|
|
157
|
+
visibility: hidden;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.popover {
|
|
161
|
+
position: fixed;
|
|
162
|
+
z-index: 999;
|
|
163
|
+
pointer-events: none;
|
|
164
|
+
opacity: 0;
|
|
165
|
+
&.show {
|
|
166
|
+
display: block;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&.hidden {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.popover-content {
|
|
175
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
176
|
+
color: white;
|
|
177
|
+
padding: 8px 12px;
|
|
178
|
+
border-radius: 4px;
|
|
179
|
+
font-size: 14px;
|
|
180
|
+
line-height: 1.4;
|
|
181
|
+
word-break: break-word;
|
|
182
|
+
white-space: normal;
|
|
183
|
+
max-width: 60vw;
|
|
184
|
+
text-align: left;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.popover-arrow {
|
|
188
|
+
position: absolute;
|
|
189
|
+
bottom: -6px;
|
|
190
|
+
transform: translateX(-50%);
|
|
191
|
+
width: 0;
|
|
192
|
+
height: 0;
|
|
193
|
+
border-left: 6px solid transparent;
|
|
194
|
+
border-right: 6px solid transparent;
|
|
195
|
+
border-top: 6px solid rgba(0, 0, 0, 0.8);
|
|
196
|
+
}
|
|
197
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref,
|
|
2
|
+
import { ref, computed, onMounted, getCurrentInstance } from 'vue';
|
|
3
3
|
import { useProvide } from '../../utils/mixin';
|
|
4
4
|
import { type TabProps } from '../ste-tab/props';
|
|
5
5
|
import propsData, { TAB_KEY } from './props';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onMounted,
|
|
2
|
+
import { onMounted, getCurrentInstance, computed, nextTick, watch, ref } from 'vue';
|
|
3
3
|
import utils from '../../utils/utils';
|
|
4
4
|
import propsData, { TOUCH_SWIPE_KEY } from './props';
|
|
5
5
|
import { useProvide } from '../../utils/mixin';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, watch
|
|
2
|
+
import { computed, watch } from 'vue';
|
|
3
3
|
import type { UploadFileType, WxInputAccept } from '../../types';
|
|
4
4
|
import { readMediaFile, readFile } from './ReadFile';
|
|
5
5
|
import utils from '../../utils/utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, type CSSProperties, onMounted, nextTick, watch, getCurrentInstance, type ComponentPublicInstance } from 'vue';
|
|
3
3
|
import type { BaseEvent } from '../../types/event';
|
|
4
4
|
import useData from './useData';
|
|
5
5
|
import utils from '../../utils/utils';
|
package/package.json
CHANGED
package/store/color.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ref } from 'vue';
|
|
2
1
|
const colorValue = {
|
|
3
2
|
steThemeColor: '#0090FF',
|
|
4
3
|
defaultColor: '#0090FF',
|
|
@@ -17,35 +16,3 @@ export function useColorStore() {
|
|
|
17
16
|
setColor,
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
// Object.assign(color, value);
|
|
22
|
-
// console.log('color', color);
|
|
23
|
-
|
|
24
|
-
// return {
|
|
25
|
-
// color,
|
|
26
|
-
// getColor,
|
|
27
|
-
// setColor,
|
|
28
|
-
// };
|
|
29
|
-
// }
|
|
30
|
-
|
|
31
|
-
// import { reactive } from 'vue';
|
|
32
|
-
// const color = reactive({
|
|
33
|
-
// steThemeColor: '#0090FF',
|
|
34
|
-
// defaultColor: '#0090FF',
|
|
35
|
-
// });
|
|
36
|
-
// // 主题色内容
|
|
37
|
-
// export function useColorStore() {
|
|
38
|
-
// const getColor = () => {
|
|
39
|
-
// return color;
|
|
40
|
-
// };
|
|
41
|
-
// const setColor = (value: any) => {
|
|
42
|
-
// Object.assign(color, value);
|
|
43
|
-
// console.log('color', color);
|
|
44
|
-
// };
|
|
45
|
-
|
|
46
|
-
// return {
|
|
47
|
-
// color,
|
|
48
|
-
// getColor,
|
|
49
|
-
// setColor,
|
|
50
|
-
// };
|
|
51
|
-
// }
|
package/store/index.ts
CHANGED
package/store/message-box.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// import { defineStore } from 'pinia'
|
|
2
|
-
// import { reactive } from 'vue'
|
|
3
|
-
// import type { MessageBoxOptions } from '../types'
|
|
4
|
-
// import { DEFAULT_CONFIG } from '../components/ste-message-box/constants'
|
|
5
|
-
|
|
6
|
-
// // 定义消息框状态接口
|
|
7
|
-
// interface MessageBoxState extends MessageBoxOptions {
|
|
8
|
-
// show: boolean
|
|
9
|
-
// }
|
|
10
|
-
|
|
11
|
-
// // 定义消息框存储接口
|
|
12
|
-
// interface MessageBoxStore {
|
|
13
|
-
// [key: string]: MessageBoxState
|
|
14
|
-
// }
|
|
15
|
-
|
|
16
|
-
// export const useMsgBoxStore = defineStore('msgBox', () => {
|
|
17
|
-
// const messageBox = reactive<MessageBoxStore>({})
|
|
18
|
-
|
|
19
|
-
// const initializeState = (key: string): void => {
|
|
20
|
-
// if (!messageBox[key]) {
|
|
21
|
-
// messageBox[key] = {
|
|
22
|
-
// show: false,
|
|
23
|
-
// }
|
|
24
|
-
// }
|
|
25
|
-
// }
|
|
26
|
-
|
|
27
|
-
// const setMessageBox = ({ key, params }: { key: string, params: Partial<MessageBoxState> }): void => {
|
|
28
|
-
// if (messageBox[key])
|
|
29
|
-
// Object.assign(messageBox[key], { ...DEFAULT_CONFIG, ...params })
|
|
30
|
-
// }
|
|
31
|
-
|
|
32
|
-
// const resetMessageBox = (key: string): void => {
|
|
33
|
-
// if (messageBox[key]) {
|
|
34
|
-
// Object.assign(messageBox[key], {
|
|
35
|
-
// show: false,
|
|
36
|
-
// })
|
|
37
|
-
// }
|
|
38
|
-
// }
|
|
39
|
-
|
|
40
|
-
// const getMessageBox = (key: string): MessageBoxState => {
|
|
41
|
-
// if (messageBox[key])
|
|
42
|
-
// return messageBox[key]
|
|
43
|
-
|
|
44
|
-
// return {} as MessageBoxState
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
// return {
|
|
48
|
-
// messageBox,
|
|
49
|
-
// initializeState,
|
|
50
|
-
// setMessageBox,
|
|
51
|
-
// resetMessageBox,
|
|
52
|
-
// getMessageBox,
|
|
53
|
-
// }
|
|
54
|
-
// })
|
package/store/toast.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import { defineStore } from 'pinia'
|
|
2
|
-
// import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
// // 轻提示内容
|
|
5
|
-
// export const useToastStore = defineStore('toast', () => {
|
|
6
|
-
// const toast = ref({
|
|
7
|
-
// show: false,
|
|
8
|
-
// title: '',
|
|
9
|
-
// icon: '',
|
|
10
|
-
// image: '',
|
|
11
|
-
// duration: 1500,
|
|
12
|
-
// mask: false,
|
|
13
|
-
// success: null,
|
|
14
|
-
// fail: null,
|
|
15
|
-
// complete: null,
|
|
16
|
-
// close: null,
|
|
17
|
-
// timer: [],
|
|
18
|
-
// })
|
|
19
|
-
// const setToast = (val: any) => {
|
|
20
|
-
// toast.value = val
|
|
21
|
-
// }
|
|
22
|
-
// const getToast = () => {
|
|
23
|
-
// return toast.value
|
|
24
|
-
// }
|
|
25
|
-
|
|
26
|
-
// return {
|
|
27
|
-
// toast,
|
|
28
|
-
// setToast,
|
|
29
|
-
// getToast,
|
|
30
|
-
// }
|
|
31
|
-
// })
|
|
32
|
-
|
|
33
|
-
// // 轻提示队列
|
|
34
|
-
// export const useToastLastParams = defineStore('toastLastParams', () => {
|
|
35
|
-
// const toastLastParams = ref({
|
|
36
|
-
// time: 0,
|
|
37
|
-
// })
|
|
38
|
-
// const setToastLastParams = (val: any) => {
|
|
39
|
-
// toastLastParams.value = val
|
|
40
|
-
// }
|
|
41
|
-
// const getToastLastParams = () => {
|
|
42
|
-
// return toastLastParams.value
|
|
43
|
-
// }
|
|
44
|
-
|
|
45
|
-
// return {
|
|
46
|
-
// toastLastParams,
|
|
47
|
-
// setToastLastParams,
|
|
48
|
-
// getToastLastParams,
|
|
49
|
-
// }
|
|
50
|
-
// })
|