npmapps 1.1.4 → 1.1.5
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/app/wujie-vue2-child/.eslintrc.js +19 -0
- package/app/wujie-vue2-child/README.md +24 -0
- package/app/wujie-vue2-child/babel.config.js +5 -0
- package/app/wujie-vue2-child/docs/superpowers/plans/2026-05-29-quill-editor.md +836 -0
- package/app/wujie-vue2-child/docs/superpowers/specs/2026-05-29-quill-editor-design.md +210 -0
- package/app/wujie-vue2-child/jsconfig.json +19 -0
- package/app/wujie-vue2-child/package-lock.json +21333 -0
- package/app/wujie-vue2-child/package.json +63 -0
- package/app/wujie-vue2-child/postcss.config.js +10 -0
- package/app/wujie-vue2-child/public/favicon.ico +0 -0
- package/app/wujie-vue2-child/public/index.html +17 -0
- package/app/wujie-vue2-child/public/rili.jpg +0 -0
- package/app/wujie-vue2-child/public//344/270/200/351/224/256/351/273/221/346/232/227.html +136 -0
- package/app/wujie-vue2-child/src/App.vue +110 -0
- package/app/wujie-vue2-child/src/assets/bpmn-camunda.jpg +0 -0
- package/app/wujie-vue2-child/src/assets/css/diagram.less +17 -0
- package/app/wujie-vue2-child/src/assets/icon/Icon.less +31 -0
- package/app/wujie-vue2-child/src/assets/icon/font/app-codes.css +26 -0
- package/app/wujie-vue2-child/src/assets/icon/font/app.eot +0 -0
- package/app/wujie-vue2-child/src/assets/icon/font/app.svg +60 -0
- package/app/wujie-vue2-child/src/assets/icon/font/app.ttf +0 -0
- package/app/wujie-vue2-child/src/assets/icon/font/app.woff +0 -0
- package/app/wujie-vue2-child/src/assets/icon/font/app.woff2 +0 -0
- package/app/wujie-vue2-child/src/assets/icon/font/config.json +248 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-bottom-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-horizontal-center-tool.svg +85 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-left-tool.svg +84 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-right-tool.svg +80 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-top-tool.svg +84 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/align-vertical-center-tool.svg +89 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/distribute-horizontally-tool.svg +95 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/distribute-vertically-tool.svg +99 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/raw/set-color-tool.svg +111 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-bottom-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-horizontal-center-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-left-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-right-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-top-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/align-vertical-center-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/distribute-horizontally-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/distribute-vertically-tool.svg +30 -0
- package/app/wujie-vue2-child/src/assets/icon/font/source/symbols/set-color-tool.svg +63 -0
- package/app/wujie-vue2-child/src/assets/logo.png +0 -0
- package/app/wujie-vue2-child/src/components/EllTable/README.md +70 -0
- package/app/wujie-vue2-child/src/components/EllTable/article.md +184 -0
- package/app/wujie-vue2-child/src/components/EllTable/index.js +213 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/CalendarSkeleton.vue +147 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/CodeBlock.vue +199 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/MonthSelect.vue +376 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/README.md +368 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/example.vue +1551 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/index.vue +1646 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/mockData.js +349 -0
- package/app/wujie-vue2-child/src/components/EventCalendar/utils.js +201 -0
- package/app/wujie-vue2-child/src/components/FormulaEditor/FunctionSelector.vue +123 -0
- package/app/wujie-vue2-child/src/components/FormulaEditor/OperatorSelector.vue +184 -0
- package/app/wujie-vue2-child/src/components/FormulaEditor/ParameterSelector.vue +123 -0
- package/app/wujie-vue2-child/src/components/FormulaEditor/api.js +69 -0
- package/app/wujie-vue2-child/src/components/FormulaEditor/index.vue +435 -0
- package/app/wujie-vue2-child/src/components/HelloWorld.vue +58 -0
- package/app/wujie-vue2-child/src/components/PageHeader/index.vue +158 -0
- package/app/wujie-vue2-child/src/components/Splitter/README.md +144 -0
- package/app/wujie-vue2-child/src/components/Splitter/example.vue +84 -0
- package/app/wujie-vue2-child/src/components/Splitter/index.vue +203 -0
- package/app/wujie-vue2-child/src/components/diagram/ToolBar.vue +357 -0
- package/app/wujie-vue2-child/src/components/diagram/customTranslate/customTranslate.js +12 -0
- package/app/wujie-vue2-child/src/components/diagram/customTranslate/translationsGerman.js +241 -0
- package/app/wujie-vue2-child/src/components/diagram/index.vue +261 -0
- package/app/wujie-vue2-child/src/components/diagram/xmlData.js +29 -0
- package/app/wujie-vue2-child/src/directives/filldown.js +155 -0
- package/app/wujie-vue2-child/src/directives/filldownTable.js +291 -0
- package/app/wujie-vue2-child/src/main.js +40 -0
- package/app/wujie-vue2-child/src/router/index.js +72 -0
- package/app/wujie-vue2-child/src/store/index.js +23 -0
- package/app/wujie-vue2-child/src/utils/winBox.js +23 -0
- package/app/wujie-vue2-child/src/views/Extend/A.vue +12 -0
- package/app/wujie-vue2-child/src/views/Extend/B.vue +10 -0
- package/app/wujie-vue2-child/src/views/Extend/MagicalComponentsForELFormItem.vue +78 -0
- package/app/wujie-vue2-child/src/views/Extend/index.vue +59 -0
- package/app/wujie-vue2-child/src/views/Extend/tableMouseHorizontalWheel.vue +184 -0
- package/app/wujie-vue2-child/src/views/Home.vue +27 -0
- package/app/wujie-vue2-child/src/views/RouterJump.vue +145 -0
- package/app/wujie-vue2-child/src/views/calendar/index.vue +19 -0
- package/app/wujie-vue2-child/src/views/css.vue +57 -0
- package/app/wujie-vue2-child/src/views/cssComponents/EllipsisText.vue +73 -0
- package/app/wujie-vue2-child/src/views/cssComponents/HoverCard.vue +69 -0
- package/app/wujie-vue2-child/src/views/cssComponents/TableHover.vue +130 -0
- package/app/wujie-vue2-child/src/views/cssComponents/inputSlo.vue +42 -0
- package/app/wujie-vue2-child/src/views/cssComponents/tableFixed.vue +148 -0
- package/app/wujie-vue2-child/src/views/echarts/echart-dome.vue +73 -0
- package/app/wujie-vue2-child/src/views/echarts/index.vue +118 -0
- package/app/wujie-vue2-child/src/views/echarts/pei3d.vue +658 -0
- package/app/wujie-vue2-child/src/views/element/bpmn/index.vue +15 -0
- package/app/wujie-vue2-child/src/views/element/components/attendanceCycle/index.vue +131 -0
- package/app/wujie-vue2-child/src/views/element/components/attendanceGroup/index.vue +147 -0
- package/app/wujie-vue2-child/src/views/element/components/attendancePersonnel/index.vue +158 -0
- package/app/wujie-vue2-child/src/views/element/components/companyCalendar/index.vue +147 -0
- package/app/wujie-vue2-child/src/views/element/components/shift/index.vue +147 -0
- package/app/wujie-vue2-child/src/views/element/components/shiftRotationSystem/index.vue +147 -0
- package/app/wujie-vue2-child/src/views/element/elTableJsx/columnManagement.vue +340 -0
- package/app/wujie-vue2-child/src/views/element/elTableJsx/dialogInput.vue +71 -0
- package/app/wujie-vue2-child/src/views/element/elTableJsx/elTableJsx.vue +1826 -0
- package/app/wujie-vue2-child/src/views/element/elTableJsx/formTable.vue +595 -0
- package/app/wujie-vue2-child/src/views/element/elTableJsx/index.vue +29 -0
- package/app/wujie-vue2-child/src/views/element/elTableJsx/simpleTable.vue +189 -0
- package/app/wujie-vue2-child/src/views/element/elTableJsx.zip +0 -0
- package/app/wujie-vue2-child/src/views/element/index.vue +39 -0
- package/app/wujie-vue2-child/src/views/element/quillEditor/README.md +163 -0
- package/app/wujie-vue2-child/src/views/element/quillEditor/example.vue +307 -0
- package/app/wujie-vue2-child/src/views/element/quillEditor/index.vue +409 -0
- package/app/wujie-vue2-child/src/views/element/quillEditor/toolbar.js +122 -0
- package/app/wujie-vue2-child/vue.config.js +15 -0
- package/package.json +1 -1
- package/app/check-import-case.js +0 -344
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
4
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
|
5
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
6
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
9
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
10
|
+
width="2048"
|
|
11
|
+
height="2048"
|
|
12
|
+
id="svg3891"
|
|
13
|
+
version="1.1"
|
|
14
|
+
inkscape:version="0.91 r13725"
|
|
15
|
+
sodipodi:docname="set-color-tool.svg"
|
|
16
|
+
inkscape:export-filename="C:\Users\Philipp\Desktop\align-bottom-tool.png"
|
|
17
|
+
inkscape:export-xdpi="0.69999999"
|
|
18
|
+
inkscape:export-ydpi="0.69999999">
|
|
19
|
+
<sodipodi:namedview
|
|
20
|
+
pagecolor="#ffffff"
|
|
21
|
+
bordercolor="#666666"
|
|
22
|
+
borderopacity="1"
|
|
23
|
+
objecttolerance="10"
|
|
24
|
+
gridtolerance="10"
|
|
25
|
+
guidetolerance="10"
|
|
26
|
+
inkscape:pageopacity="0"
|
|
27
|
+
inkscape:pageshadow="2"
|
|
28
|
+
inkscape:window-width="1920"
|
|
29
|
+
inkscape:window-height="1027"
|
|
30
|
+
id="namedview6"
|
|
31
|
+
showgrid="false"
|
|
32
|
+
inkscape:snap-bbox="true"
|
|
33
|
+
inkscape:bbox-paths="true"
|
|
34
|
+
inkscape:bbox-nodes="true"
|
|
35
|
+
inkscape:snap-bbox-edge-midpoints="true"
|
|
36
|
+
inkscape:snap-bbox-midpoints="true"
|
|
37
|
+
inkscape:snap-center="false"
|
|
38
|
+
inkscape:zoom="0.16"
|
|
39
|
+
inkscape:cx="1019.5806"
|
|
40
|
+
inkscape:cy="976.38444"
|
|
41
|
+
inkscape:window-x="1592"
|
|
42
|
+
inkscape:window-y="-8"
|
|
43
|
+
inkscape:window-maximized="1"
|
|
44
|
+
inkscape:current-layer="svg3891" />
|
|
45
|
+
<defs
|
|
46
|
+
id="defs3893" />
|
|
47
|
+
<metadata
|
|
48
|
+
id="metadata3896">
|
|
49
|
+
<rdf:RDF>
|
|
50
|
+
<cc:Work
|
|
51
|
+
rdf:about="">
|
|
52
|
+
<dc:format>image/svg+xml</dc:format>
|
|
53
|
+
<dc:type
|
|
54
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
55
|
+
<dc:title></dc:title>
|
|
56
|
+
</cc:Work>
|
|
57
|
+
</rdf:RDF>
|
|
58
|
+
</metadata>
|
|
59
|
+
<path
|
|
60
|
+
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:146;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
|
61
|
+
d="M 1715.7656 28.447266 L 1285.6504 458.5625 L 1168.6758 575.53711 L 954.72852 515.3457 L 732.81641 452.91406 L 729.46875 457.24414 L 728.97852 456.75391 L 549.81641 635.91406 L 977.91992 1064.0176 L 1406.0234 1492.123 L 1585.1855 1312.9609 L 1584.6934 1312.4688 L 1589.0254 1309.1211 L 1526.5938 1087.209 L 1471.0156 889.66602 L 1593.8848 766.79688 L 2024 336.68164 L 1715.7656 28.447266 z M 422.60938 764.73633 L 24 1163.3457 L 452.10352 1591.4492 L 880.20703 2019.5527 L 1278.8164 1620.9434 L 850.71289 1192.8398 L 422.60938 764.73633 z "
|
|
62
|
+
id="rect4136-7" />
|
|
63
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# EllTable 组件
|
|
2
|
+
|
|
3
|
+
基于 Element UI Table 组件扩展的表格组件,支持鼠标横向滚动和提示功能。
|
|
4
|
+
|
|
5
|
+
## 功能特点
|
|
6
|
+
|
|
7
|
+
- 支持鼠标横向滚动(按住 Alt 键)
|
|
8
|
+
- 自动检测表格是否需要横向滚动
|
|
9
|
+
- 可配置的提示信息和位置
|
|
10
|
+
- 继承 Element UI Table 的所有功能和属性
|
|
11
|
+
|
|
12
|
+
## 属性配置
|
|
13
|
+
|
|
14
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
15
|
+
|--------|------|---------|------|
|
|
16
|
+
| disableMouseHorizontalWheel | Boolean | false | 是否禁用鼠标横向滚动功能 |
|
|
17
|
+
| hiddenMouseWheel | Boolean | false | 是否隐藏鼠标滚动提示 |
|
|
18
|
+
| showTooltip | Boolean | false | 是否显示提示信息 |
|
|
19
|
+
| tooltipContent | String/Array | [] | 提示信息内容,可以是字符串或字符串数组 |
|
|
20
|
+
| tooltipPosition | Object | { top: "10px", left: "10px" } | 提示信息位置,支持 top、left、bottom、right |
|
|
21
|
+
|
|
22
|
+
## 使用示例
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
<template>
|
|
26
|
+
<ell-table
|
|
27
|
+
:data="tableData"
|
|
28
|
+
border
|
|
29
|
+
style="width: 100%"
|
|
30
|
+
height="300"
|
|
31
|
+
:tooltip-content="['按住Alt键可以横向滚动表格', '自定义提示信息']"
|
|
32
|
+
:show-tooltip="true"
|
|
33
|
+
:tooltip-position="{ top: '20px', right: '20px' }"
|
|
34
|
+
>
|
|
35
|
+
<el-table-column prop="date" label="日期" width="180" fixed="left"></el-table-column>
|
|
36
|
+
<el-table-column prop="name" label="姓名" width="180"></el-table-column>
|
|
37
|
+
<el-table-column prop="address" label="地址" width="300"></el-table-column>
|
|
38
|
+
<!-- 更多列... -->
|
|
39
|
+
</ell-table>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
export default {
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
tableData: [{
|
|
47
|
+
date: '2023-01-01',
|
|
48
|
+
name: '张三',
|
|
49
|
+
address: '北京市朝阳区'
|
|
50
|
+
}]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 注意事项
|
|
58
|
+
|
|
59
|
+
1. 组件会自动检测表格是否同时存在横向和纵向滚动条,如果存在则显示提示信息
|
|
60
|
+
2. 可以通过 `disableMouseHorizontalWheel` 属性禁用鼠标横向滚动功能
|
|
61
|
+
3. 提示信息位置可以通过 `tooltipPosition` 属性灵活配置
|
|
62
|
+
4. 组件完全兼容 Element UI Table 的所有功能,可以正常使用 Table 组件的所有属性和方法
|
|
63
|
+
|
|
64
|
+
## 建议功能扩展
|
|
65
|
+
|
|
66
|
+
1. 支持自定义滚动速度
|
|
67
|
+
2. 添加滚动方向锁定功能
|
|
68
|
+
3. 提供滚动事件回调
|
|
69
|
+
4. 支持 tooltip 主题定制
|
|
70
|
+
5. 添加更多交互效果(如双击切换滚动方向、滚动到边缘时的视觉反馈等)
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Element UI Table组件扩展:实现鼠标横向滚动和提示功能
|
|
2
|
+
|
|
3
|
+
## 前言
|
|
4
|
+
在使用Element UI的Table组件时,当表格列数较多时,需要通过水平滚动条来查看更多的列数据。为了提升用户体验,我们可以通过扩展Table组件,实现使用鼠标滚轮进行横向滚动的功能,并添加相应的提示信息。本文将详细介绍如何实现这一功能。
|
|
5
|
+
|
|
6
|
+
## 功能特点
|
|
7
|
+
|
|
8
|
+
- 支持使用鼠标滚轮进行横向滚动(按住Alt键)
|
|
9
|
+
- 自动检测表格是否需要横向滚动
|
|
10
|
+
- 提供可配置的提示信息和位置
|
|
11
|
+
- 支持双击切换滚动方向(垂直/水平)
|
|
12
|
+
- 完全兼容Element UI Table的所有功能和属性
|
|
13
|
+
|
|
14
|
+
## 实现原理
|
|
15
|
+
|
|
16
|
+
### 1. 组件结构
|
|
17
|
+
|
|
18
|
+
组件通过扩展Element UI的Table组件实现,主要包含以下核心功能:
|
|
19
|
+
|
|
20
|
+
- 监听鼠标滚轮事件,实现横向滚动
|
|
21
|
+
- 自动检测表格滚动条状态
|
|
22
|
+
- 提供可配置的提示信息
|
|
23
|
+
- 支持滚动方向切换
|
|
24
|
+
|
|
25
|
+
### 2. 核心代码实现
|
|
26
|
+
|
|
27
|
+
#### 2.1 组件定义
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
import { Table } from "element-ui";
|
|
31
|
+
|
|
32
|
+
export const tableMouseHorizontalWheel = {
|
|
33
|
+
extends: Table,
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
tooltipContentList: [],
|
|
37
|
+
tooltipVisible: this.showTooltip,
|
|
38
|
+
scrollDirection: 'vertical', // 默认为垂直滚动
|
|
39
|
+
isScrollingToEdge: false, // 是否滚动到边缘
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
props: {
|
|
43
|
+
/** @prop {Boolean} [disableMouseHorizontalWheel=false] - 是否禁用鼠标横向滚动功能 */
|
|
44
|
+
disableMouseHorizontalWheel: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
/** @prop {Boolean} [hiddenMouseWheel=false] - 是否隐藏鼠标滚动提示 */
|
|
49
|
+
hiddenMouseWheel: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
/** @prop {Boolean} [showTooltip=false] - 是否显示提示信息 */
|
|
54
|
+
showTooltip: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false,
|
|
57
|
+
},
|
|
58
|
+
/** @prop {String|Array} [tooltipContent=[]] - 提示信息内容 */
|
|
59
|
+
tooltipContent: {
|
|
60
|
+
type: [String, Array],
|
|
61
|
+
default: () => [],
|
|
62
|
+
},
|
|
63
|
+
/** @prop {Object} [tooltipPosition={ top: "10px", left: "10px" }] - 提示信息位置 */
|
|
64
|
+
tooltipPosition: {
|
|
65
|
+
type: Object,
|
|
66
|
+
default: () => ({
|
|
67
|
+
top: "10px",
|
|
68
|
+
left: "10px",
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
// ... 其他代码省略
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### 2.2 横向滚动实现
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
handleWheel(event) {
|
|
80
|
+
const tableBody = this.$el.querySelector(".el-table__body-wrapper");
|
|
81
|
+
// 当表格内容高度小于容器高度时,直接启用横向滚动
|
|
82
|
+
if(tableBody.scrollHeight <= tableBody.clientHeight) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
tableBody.scrollLeft += event.deltaY;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// 当处于水平滚动模式或按住Alt键时,启用横向滚动
|
|
88
|
+
if (this.scrollDirection === 'horizontal' || event.altKey) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
tableBody.scrollLeft += event.deltaY;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### 2.3 滚动条检测
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
hasScrollbarByMff() {
|
|
99
|
+
const tableBody = this.$el.querySelector(".el-table__body-wrapper");
|
|
100
|
+
// 检测竖向滚动条
|
|
101
|
+
const verticalScrollbarWidth = tableBody.scrollHeight - tableBody.clientHeight;
|
|
102
|
+
// 检测横向滚动条
|
|
103
|
+
const horizontalScrollbarHeight = tableBody.scrollWidth - tableBody.clientWidth;
|
|
104
|
+
|
|
105
|
+
// 当同时存在横向和纵向滚动条时,显示提示信息
|
|
106
|
+
if (verticalScrollbarWidth > 0 && horizontalScrollbarHeight > 0 && !this.hiddenMouseWheel) {
|
|
107
|
+
this.tooltipContentList.push("按住Alt键可以横向滚动表格");
|
|
108
|
+
this.tooltipVisible = true;
|
|
109
|
+
this.$el.addEventListener("dblclick", this.toggleScrollDirection);
|
|
110
|
+
this.tooltipContentList.push('双击表格任意位置可切换滚动方向');
|
|
111
|
+
} else {
|
|
112
|
+
// 清除提示信息
|
|
113
|
+
this.tooltipContentList = this.tooltipContentList.filter(item =>
|
|
114
|
+
!item.includes('按住Alt键可以横向滚动表格') &&
|
|
115
|
+
!item.includes('双击表格任意位置可切换滚动方向')
|
|
116
|
+
);
|
|
117
|
+
this.tooltipVisible = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 使用示例
|
|
123
|
+
|
|
124
|
+
### 1. 注册组件
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
import Vue from "vue";
|
|
128
|
+
import { tableMouseHorizontalWheel } from "@/components/EllTable/index";
|
|
129
|
+
Vue.component("ell-table", tableMouseHorizontalWheel);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 2. 基础用法
|
|
133
|
+
|
|
134
|
+
```vue
|
|
135
|
+
<template>
|
|
136
|
+
<div>
|
|
137
|
+
<ell-table :data="tableData" border style="width: 100%" height="400">
|
|
138
|
+
<el-table-column
|
|
139
|
+
prop="date"
|
|
140
|
+
label="日期"
|
|
141
|
+
width="180"
|
|
142
|
+
fixed="left"
|
|
143
|
+
></el-table-column>
|
|
144
|
+
<el-table-column label="合并列" width="660">
|
|
145
|
+
<el-table-column prop="name" label="姓名" width="180"></el-table-column>
|
|
146
|
+
<el-table-column
|
|
147
|
+
prop="nickname"
|
|
148
|
+
label="昵称"
|
|
149
|
+
width="180"
|
|
150
|
+
></el-table-column>
|
|
151
|
+
<el-table-column
|
|
152
|
+
prop="address"
|
|
153
|
+
label="地址"
|
|
154
|
+
width="300"
|
|
155
|
+
></el-table-column>
|
|
156
|
+
</el-table-column>
|
|
157
|
+
<!-- 更多列配置 -->
|
|
158
|
+
</ell-table>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 配置说明
|
|
164
|
+
|
|
165
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
166
|
+
|------|------|------|--------|
|
|
167
|
+
| disableMouseHorizontalWheel | 是否禁用鼠标横向滚动功能 | Boolean | false |
|
|
168
|
+
| hiddenMouseWheel | 是否隐藏鼠标滚动提示 | Boolean | false |
|
|
169
|
+
| showTooltip | 是否显示提示信息 | Boolean | false |
|
|
170
|
+
| tooltipContent | 提示信息内容 | String/Array | [] |
|
|
171
|
+
| tooltipPosition | 提示信息位置 | Object | { top: "10px", left: "10px" } |
|
|
172
|
+
|
|
173
|
+
## 注意事项
|
|
174
|
+
|
|
175
|
+
1. 组件会自动检测表格是否同时存在横向和纵向滚动条,如果存在则显示提示信息
|
|
176
|
+
2. 可以通过`disableMouseHorizontalWheel`属性禁用鼠标横向滚动功能
|
|
177
|
+
3. 提示信息位置可以通过`tooltipPosition`属性灵活配置
|
|
178
|
+
4. 双击表格可以切换滚动方向(垂直/水平)
|
|
179
|
+
5. 按住Alt键可以临时启用横向滚动
|
|
180
|
+
6. 组件完全兼容Element UI Table的所有功能,可以正常使用Table组件的所有属性和方法
|
|
181
|
+
|
|
182
|
+
## 总结
|
|
183
|
+
|
|
184
|
+
通过扩展Element UI的Table组件,我们实现了一个更加便捷的表格组件,支持鼠标横向滚动和智能提示功能。这个组件不仅提升了用户体验,还保持了与原有Table组件的完全兼容性。在实际项目中,这个组件可以有效提升表格数据的浏览效率,特别是在处理大量列数据时。
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Table } from "element-ui";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description 扩展Element UI Table组件,支持鼠标横向滚动和提示功能
|
|
5
|
+
* @extends {Table}
|
|
6
|
+
*/
|
|
7
|
+
export const tableMouseHorizontalWheel = {
|
|
8
|
+
extends: Table,
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
tooltipContentList: [],
|
|
12
|
+
tooltipVisible: this.showTooltip,
|
|
13
|
+
scrollDirection: 'vertical', // 默认为垂直滚动
|
|
14
|
+
isScrollingToEdge: false, // 是否滚动到边缘
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
/** @prop {Boolean} [disableMouseHorizontalWheel=false] - 是否禁用鼠标横向滚动功能 */
|
|
19
|
+
disableMouseHorizontalWheel: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
/** @prop {Boolean} [hiddenMouseWheel=false] - 是否隐藏鼠标滚动提示 */
|
|
24
|
+
hiddenMouseWheel: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
/** @prop {Boolean} [showTooltip=false] - 是否显示提示信息 */
|
|
29
|
+
showTooltip: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
/** @prop {String|Array} [tooltipContent=[]] - 提示信息内容 */
|
|
34
|
+
tooltipContent: {
|
|
35
|
+
type: [String, Array],
|
|
36
|
+
default: () => [],
|
|
37
|
+
},
|
|
38
|
+
/** @prop {Object} [tooltipPosition={ top: "10px", left: "10px" }] - 提示信息位置 */
|
|
39
|
+
tooltipPosition: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: () => ({
|
|
42
|
+
top: "10px",
|
|
43
|
+
left: "10px",
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
created() {
|
|
48
|
+
// 初始化提示信息列表
|
|
49
|
+
if (Array.isArray(this.tooltipContent)) {
|
|
50
|
+
this.tooltipContentList.push(...this.tooltipContent);
|
|
51
|
+
} else {
|
|
52
|
+
this.tooltipContentList.push(this.tooltipContent);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
mounted() {
|
|
57
|
+
const newHasScrollbarByMff = _.debounce(this.hasScrollbarByMff, 10);
|
|
58
|
+
// 监听this.$el元素变化
|
|
59
|
+
const observer = new MutationObserver((mutations) => {
|
|
60
|
+
mutations.forEach((mutation) => {
|
|
61
|
+
if (mutation.type === "childList") {
|
|
62
|
+
newHasScrollbarByMff();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
observer.observe(this.$el, {
|
|
67
|
+
childList: true,
|
|
68
|
+
subtree: true,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (!this.disableMouseHorizontalWheel) {
|
|
72
|
+
this.$el.addEventListener("wheel", this.handleWheel);
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
beforeDestroy() {
|
|
77
|
+
if (!this.disableMouseHorizontalWheel) {
|
|
78
|
+
this.$el.removeEventListener("wheel", this.handleWheel);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
/**
|
|
83
|
+
* @description 处理鼠标滚轮事件,实现横向滚动
|
|
84
|
+
* @param {WheelEvent} event - 鼠标滚轮事件对象
|
|
85
|
+
*/
|
|
86
|
+
handleWheel(event) {
|
|
87
|
+
const tableBody = this.$el.querySelector(".el-table__body-wrapper");
|
|
88
|
+
// tableBody.scrollHeight <= tableBody.clientHeight
|
|
89
|
+
if(tableBody.scrollHeight <= tableBody.clientHeight) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
tableBody.scrollLeft += event.deltaY;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (this.scrollDirection === 'horizontal' || event.altKey) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
tableBody.scrollLeft += event.deltaY;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* @description 检测表格是否同时存在横向和纵向滚动条,并显示提示信息
|
|
101
|
+
*/
|
|
102
|
+
/**
|
|
103
|
+
* @description 切换滚动方向
|
|
104
|
+
*/
|
|
105
|
+
toggleScrollDirection() {
|
|
106
|
+
this.scrollDirection = this.scrollDirection === 'vertical' ? 'horizontal' : 'vertical';
|
|
107
|
+
this.tooltipContentList = this.tooltipContentList.filter(item => !item.includes('当前滚动方向'));
|
|
108
|
+
this.tooltipContentList.push(`当前滚动方向: ${this.scrollDirection === 'vertical' ? '垂直' : '水平'}`);
|
|
109
|
+
// 消息提醒
|
|
110
|
+
this.$message({
|
|
111
|
+
message: `当前表格滚动方向已切换为: ${this.scrollDirection ==='vertical'? '垂直' : '水平'}`,
|
|
112
|
+
type: 'info',
|
|
113
|
+
duration: 1000,
|
|
114
|
+
})
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @description 显示边缘视觉反馈
|
|
119
|
+
* @param {HTMLElement} element - 需要添加视觉反馈的元素
|
|
120
|
+
*/
|
|
121
|
+
showEdgeFeedback(element) {
|
|
122
|
+
if (!this.isScrollingToEdge) {
|
|
123
|
+
this.isScrollingToEdge = true;
|
|
124
|
+
element.style.transition = 'background-color 0.3s';
|
|
125
|
+
element.style.backgroundColor = 'rgba(0, 0, 0, 0.1)';
|
|
126
|
+
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
element.style.backgroundColor = '';
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
element.style.transition = '';
|
|
131
|
+
this.isScrollingToEdge = false;
|
|
132
|
+
}, 300);
|
|
133
|
+
}, 300);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
hasScrollbarByMff() {
|
|
138
|
+
console.log(123);
|
|
139
|
+
|
|
140
|
+
const tableBody = this.$el.querySelector(".el-table__body-wrapper");
|
|
141
|
+
// 是否有竖向滚动条
|
|
142
|
+
const verticalScrollbarWidth =
|
|
143
|
+
tableBody.scrollHeight - tableBody.clientHeight;
|
|
144
|
+
console.log(tableBody.scrollHeight, tableBody.clientHeight,'1231321321',verticalScrollbarWidth);
|
|
145
|
+
|
|
146
|
+
// 是否有横向滚动条
|
|
147
|
+
const horizontalScrollbarHeight =
|
|
148
|
+
tableBody.scrollWidth - tableBody.clientWidth;
|
|
149
|
+
console.log(tableBody.scrollWidth, tableBody.clientWidth,'1231321321',horizontalScrollbarHeight);
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
// 如果有横向滚动条和竖向滚动条 hiddenMouseWheel 为false时 tooltipVisible 为true
|
|
154
|
+
if (
|
|
155
|
+
verticalScrollbarWidth > 0 &&
|
|
156
|
+
horizontalScrollbarHeight > 0 &&
|
|
157
|
+
!this.hiddenMouseWheel
|
|
158
|
+
) {
|
|
159
|
+
this.tooltipContentList.push("按住Alt键可以横向滚动表格");
|
|
160
|
+
this.tooltipVisible = true;
|
|
161
|
+
this.$el.addEventListener("dblclick", this.toggleScrollDirection);
|
|
162
|
+
this.tooltipContentList.push('双击表格任意位置可切换滚动方向')
|
|
163
|
+
}else{
|
|
164
|
+
this.tooltipContentList = this.tooltipContentList.filter(item =>!item.includes('按住Alt键可以横向滚动表格'));
|
|
165
|
+
this.tooltipContentList = this.tooltipContentList.filter(item =>!item.includes('双击表格任意位置可切换滚动方向'));
|
|
166
|
+
this.tooltipVisible = false;
|
|
167
|
+
console.log(1231321);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
render(h) {
|
|
173
|
+
const table = this.$options.extends.render.call(this, h);
|
|
174
|
+
return (
|
|
175
|
+
<div
|
|
176
|
+
style={{
|
|
177
|
+
position: "relative",
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
<el-tooltip
|
|
181
|
+
placement="top"
|
|
182
|
+
style={{
|
|
183
|
+
position: "absolute",
|
|
184
|
+
...(this.tooltipPosition.top && { top: this.tooltipPosition.top }),
|
|
185
|
+
...(this.tooltipPosition.left && { left: this.tooltipPosition.left }),
|
|
186
|
+
...(this.tooltipPosition.bottom && { bottom: this.tooltipPosition.bottom }),
|
|
187
|
+
...(this.tooltipPosition.right && { right: this.tooltipPosition.right }),
|
|
188
|
+
zIndex: 11,
|
|
189
|
+
display: this.tooltipVisible ? "block" : "none",
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<div slot="content">
|
|
193
|
+
{this.tooltipContentList.map((item, index) => {
|
|
194
|
+
return (
|
|
195
|
+
<div key={index} style={{ marginBottom: "4px" }}>
|
|
196
|
+
<span>{index + 1}.</span> {item}
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
})}
|
|
200
|
+
</div>
|
|
201
|
+
<i
|
|
202
|
+
class="el-icon-info"
|
|
203
|
+
style={{
|
|
204
|
+
cursor: "pointer",
|
|
205
|
+
display: this.tooltipVisible ? "block" : "none",
|
|
206
|
+
}}
|
|
207
|
+
></i>
|
|
208
|
+
</el-tooltip>
|
|
209
|
+
{table}
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
212
|
+
},
|
|
213
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ec-skeleton" aria-busy="true" aria-live="polite">
|
|
3
|
+
<div
|
|
4
|
+
v-for="row in rows"
|
|
5
|
+
:key="row"
|
|
6
|
+
class="ec-skeleton__row"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
v-for="col in 7"
|
|
10
|
+
:key="col"
|
|
11
|
+
class="ec-skeleton__cell"
|
|
12
|
+
:style="{ minHeight: minRowHeight + 'px' }"
|
|
13
|
+
>
|
|
14
|
+
<!-- 日期占位 -->
|
|
15
|
+
<span class="ec-skeleton__block ec-skeleton__date"></span>
|
|
16
|
+
<!-- 条目占位:每格数量做一点变化,视觉上更接近真实数据 -->
|
|
17
|
+
<span
|
|
18
|
+
v-for="n in itemCountOf(row, col)"
|
|
19
|
+
:key="n"
|
|
20
|
+
class="ec-skeleton__block ec-skeleton__item"
|
|
21
|
+
:style="{ height: itemHeight + 'px' }"
|
|
22
|
+
></span>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
/**
|
|
30
|
+
* CalendarSkeleton —— 日历骨架屏
|
|
31
|
+
* ------------------------------------------------------------------
|
|
32
|
+
* 数据返回前占位,避免布局跳动和白屏。
|
|
33
|
+
* 条目数量用「行列下标的确定性函数」生成,不用随机数,
|
|
34
|
+
* 保证每次渲染骨架形状一致(随机形状会让人误以为在闪烁)。
|
|
35
|
+
*/
|
|
36
|
+
export default {
|
|
37
|
+
name: 'CalendarSkeleton',
|
|
38
|
+
|
|
39
|
+
props: {
|
|
40
|
+
/** 骨架行数 */
|
|
41
|
+
rows: {
|
|
42
|
+
type: Number,
|
|
43
|
+
default: 5
|
|
44
|
+
},
|
|
45
|
+
/** 单元格最小高度,与日历主体保持一致 */
|
|
46
|
+
minRowHeight: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 118
|
|
49
|
+
},
|
|
50
|
+
/** 条目占位高度 */
|
|
51
|
+
itemHeight: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 28
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
methods: {
|
|
58
|
+
/**
|
|
59
|
+
* 依据行列位置推导条目数量(0~3)
|
|
60
|
+
* 周日(col=1) / 周六(col=7) 留空,模拟真实业务里周末排期少的形态
|
|
61
|
+
*/
|
|
62
|
+
itemCountOf(row, col) {
|
|
63
|
+
if (col === 1 || col === 7) return 0
|
|
64
|
+
return ((row + col) % 3) + 1
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style scoped>
|
|
71
|
+
.ec-skeleton {
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ec-skeleton__row {
|
|
76
|
+
display: grid;
|
|
77
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ec-skeleton__cell {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: 8px;
|
|
85
|
+
padding: 12px 10px;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
border-right: 1px solid var(--ec-border-light, #f0f2f5);
|
|
88
|
+
border-bottom: 1px solid var(--ec-border-light, #f0f2f5);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ec-skeleton__cell:nth-child(7n) {
|
|
92
|
+
border-right: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ec-skeleton__row:last-child .ec-skeleton__cell {
|
|
96
|
+
border-bottom: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* 占位块:底色 + 从左到右扫过的高光 */
|
|
100
|
+
.ec-skeleton__block {
|
|
101
|
+
display: block;
|
|
102
|
+
border-radius: 4px;
|
|
103
|
+
background: #f0f2f5;
|
|
104
|
+
background-image: linear-gradient(
|
|
105
|
+
90deg,
|
|
106
|
+
rgba(255, 255, 255, 0) 0%,
|
|
107
|
+
rgba(255, 255, 255, 0.85) 50%,
|
|
108
|
+
rgba(255, 255, 255, 0) 100%
|
|
109
|
+
);
|
|
110
|
+
background-size: 200% 100%;
|
|
111
|
+
background-repeat: no-repeat;
|
|
112
|
+
animation: ec-skeleton-shimmer 1.4s ease-in-out infinite;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ec-skeleton__date {
|
|
116
|
+
width: 56px;
|
|
117
|
+
height: 15px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.ec-skeleton__item {
|
|
121
|
+
width: 100%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* 让每一格的高光有轻微时间差,波浪感更自然 */
|
|
125
|
+
.ec-skeleton__cell:nth-child(2n) .ec-skeleton__block {
|
|
126
|
+
animation-delay: 0.12s;
|
|
127
|
+
}
|
|
128
|
+
.ec-skeleton__cell:nth-child(3n) .ec-skeleton__block {
|
|
129
|
+
animation-delay: 0.24s;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@keyframes ec-skeleton-shimmer {
|
|
133
|
+
0% {
|
|
134
|
+
background-position: 150% 0;
|
|
135
|
+
}
|
|
136
|
+
100% {
|
|
137
|
+
background-position: -50% 0;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* 尊重系统「减少动态效果」设置 */
|
|
142
|
+
@media (prefers-reduced-motion: reduce) {
|
|
143
|
+
.ec-skeleton__block {
|
|
144
|
+
animation: none;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
</style>
|