npmapps 1.0.25 → 1.0.26
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/.codegraph/daemon.pid +6 -0
- package/app/.eslintrc.js +19 -0
- package/app/README.md +24 -0
- package/app/babel.config.js +5 -0
- package/app/devtool-windows-amd64.zip +0 -0
- package/app/docs/superpowers/plans/2026-05-29-quill-editor.md +836 -0
- package/app/docs/superpowers/specs/2026-05-29-quill-editor-design.md +210 -0
- package/app/docs/superpowers/specs/2026-06-06-lazy-cascader-design.md +400 -0
- package/app/jsconfig.json +19 -0
- package/app/package-lock.json +21347 -0
- package/app/package.json +63 -0
- package/app/postcss.config.js +10 -0
- package/app/public/favicon.ico +0 -0
- package/app/public/index.html +17 -0
- package/app/public//344/270/200/351/224/256/351/273/221/346/232/227.html +136 -0
- package/app/src/App.vue +110 -0
- package/app/src/assets/bpmn-camunda.jpg +0 -0
- package/app/src/assets/css/diagram.less +17 -0
- package/app/src/assets/icon/Icon.less +31 -0
- package/app/src/assets/icon/font/app-codes.css +26 -0
- package/app/src/assets/icon/font/app.eot +0 -0
- package/app/src/assets/icon/font/app.svg +60 -0
- package/app/src/assets/icon/font/app.ttf +0 -0
- package/app/src/assets/icon/font/app.woff +0 -0
- package/app/src/assets/icon/font/app.woff2 +0 -0
- package/app/src/assets/icon/font/config.json +248 -0
- package/app/src/assets/icon/font/source/raw/align-bottom-tool.svg +30 -0
- package/app/src/assets/icon/font/source/raw/align-horizontal-center-tool.svg +85 -0
- package/app/src/assets/icon/font/source/raw/align-left-tool.svg +84 -0
- package/app/src/assets/icon/font/source/raw/align-right-tool.svg +80 -0
- package/app/src/assets/icon/font/source/raw/align-top-tool.svg +84 -0
- package/app/src/assets/icon/font/source/raw/align-vertical-center-tool.svg +89 -0
- package/app/src/assets/icon/font/source/raw/distribute-horizontally-tool.svg +95 -0
- package/app/src/assets/icon/font/source/raw/distribute-vertically-tool.svg +99 -0
- package/app/src/assets/icon/font/source/raw/set-color-tool.svg +111 -0
- package/app/src/assets/icon/font/source/symbols/align-bottom-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-horizontal-center-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-left-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-right-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-top-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/align-vertical-center-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/distribute-horizontally-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/distribute-vertically-tool.svg +30 -0
- package/app/src/assets/icon/font/source/symbols/set-color-tool.svg +63 -0
- package/app/src/assets/logo.png +0 -0
- package/app/src/components/EllTable/README.md +70 -0
- package/app/src/components/EllTable/article.md +184 -0
- package/app/src/components/EllTable/index.js +213 -0
- package/app/src/components/FormulaEditor/FunctionSelector.vue +123 -0
- package/app/src/components/FormulaEditor/OperatorSelector.vue +184 -0
- package/app/src/components/FormulaEditor/ParameterSelector.vue +123 -0
- package/app/src/components/FormulaEditor/api.js +69 -0
- package/app/src/components/FormulaEditor/index.vue +435 -0
- package/app/src/components/HelloWorld.vue +58 -0
- package/app/src/components/PageHeader/index.vue +158 -0
- package/app/src/components/Splitter/README.md +144 -0
- package/app/src/components/Splitter/example.vue +88 -0
- package/app/src/components/Splitter/index.vue +203 -0
- package/app/src/components/diagram/ToolBar.vue +357 -0
- package/app/src/components/diagram/customTranslate/customTranslate.js +12 -0
- package/app/src/components/diagram/customTranslate/translationsGerman.js +241 -0
- package/app/src/components/diagram/index.vue +261 -0
- package/app/src/components/diagram/xmlData.js +29 -0
- package/app/src/directives/filldown.js +155 -0
- package/app/src/directives/filldownTable.js +291 -0
- package/app/src/main.js +40 -0
- package/app/src/router/index.js +63 -0
- package/app/src/store/index.js +23 -0
- package/app/src/utils/winBox.js +23 -0
- package/app/src/views/Extend/A.vue +12 -0
- package/app/src/views/Extend/B.vue +10 -0
- package/app/src/views/Extend/MagicalComponentsForELFormItem.vue +87 -0
- package/app/src/views/Extend/index.vue +59 -0
- package/app/src/views/Extend/tableMouseHorizontalWheel.vue +193 -0
- package/app/src/views/Home.vue +37 -0
- package/app/src/views/RouterJump.vue +155 -0
- package/app/src/views/css.vue +57 -0
- package/app/src/views/cssComponents/EllipsisText.vue +83 -0
- package/app/src/views/cssComponents/HoverCard.vue +79 -0
- package/app/src/views/cssComponents/TableHover.vue +140 -0
- package/app/src/views/cssComponents/inputSlo.vue +52 -0
- package/app/src/views/cssComponents/tableFixed.vue +158 -0
- package/app/src/views/echarts/echart-dome.vue +82 -0
- package/app/src/views/echarts/index.vue +118 -0
- package/app/src/views/echarts/pei3d.vue +667 -0
- package/app/src/views/element/bpmn/index.vue +18 -0
- package/app/src/views/element/components/attendanceCycle/index.vue +131 -0
- package/app/src/views/element/components/attendanceGroup/index.vue +147 -0
- package/app/src/views/element/components/attendancePersonnel/index.vue +158 -0
- package/app/src/views/element/components/companyCalendar/index.vue +147 -0
- package/app/src/views/element/components/shift/index.vue +147 -0
- package/app/src/views/element/components/shiftRotationSystem/index.vue +147 -0
- package/app/src/views/element/elTableJsx/columnManagement.vue +340 -0
- package/app/src/views/element/elTableJsx/dialogInput.vue +71 -0
- package/app/src/views/element/elTableJsx/elTableJsx.vue +1826 -0
- package/app/src/views/element/elTableJsx/formTable.vue +598 -0
- package/app/src/views/element/elTableJsx/index.vue +29 -0
- package/app/src/views/element/elTableJsx/simpleTable.vue +192 -0
- package/app/src/views/element/elTableJsx.zip +0 -0
- package/app/src/views/element/index.vue +44 -0
- package/app/src/views/element/lazyCascader/LazyCascader.vue +302 -0
- package/app/src/views/element/lazyCascader/data.js +205 -0
- package/app/src/views/element/lazyCascader/index.vue +315 -0
- package/app/src/views/element/quillEditor/README.md +163 -0
- package/app/src/views/element/quillEditor/example.vue +314 -0
- package/app/src/views/element/quillEditor/index.vue +409 -0
- package/app/src/views/element/quillEditor/toolbar.js +122 -0
- package/app/vue.config.js +15 -0
- package/package.json +1 -1
- package/app/wujie-vue3-child/.claude/settings.local.json +0 -8
- package/app/wujie-vue3-child/.vscode/extensions.json +0 -3
- package/app/wujie-vue3-child/PROJECT_MEMORY.md +0 -427
- package/app/wujie-vue3-child/README.md +0 -5
- package/app/wujie-vue3-child/index.html +0 -13
- package/app/wujie-vue3-child/package-lock.json +0 -5744
- package/app/wujie-vue3-child/package.json +0 -28
- package/app/wujie-vue3-child/public/vite.svg +0 -1
- package/app/wujie-vue3-child/src/App.vue +0 -130
- package/app/wujie-vue3-child/src/assets/vue.svg +0 -1
- package/app/wujie-vue3-child/src/components/HelloWorld.vue +0 -43
- package/app/wujie-vue3-child/src/components/SmartAnchorTabs/index.jsx +0 -224
- package/app/wujie-vue3-child/src/components/SmartAnchorTabs/style.css +0 -154
- package/app/wujie-vue3-child/src/components/tags-view.vue +0 -193
- package/app/wujie-vue3-child/src/components/tags-view1.vue +0 -131
- package/app/wujie-vue3-child/src/directives/aiLoading.js +0 -182
- package/app/wujie-vue3-child/src/hooks/useClickOutside.js +0 -11
- package/app/wujie-vue3-child/src/hooks/useTableDragSort.js +0 -28
- package/app/wujie-vue3-child/src/main.js +0 -18
- package/app/wujie-vue3-child/src/router/index.js +0 -104
- package/app/wujie-vue3-child/src/store/tagsViewStroe.js +0 -34
- package/app/wujie-vue3-child/src/style.css +0 -171
- package/app/wujie-vue3-child/src/views/aiCoach/collapseExpand/index.jsx +0 -108
- package/app/wujie-vue3-child/src/views/aiCoach/collapseExpand/index.module.scss +0 -97
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/README.md +0 -836
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/REFLEX_EXAMPLES.md +0 -728
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.jsx +0 -687
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.module.scss +0 -560
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.jsx +0 -570
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.module.scss +0 -330
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.jsx +0 -378
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.module.scss +0 -228
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.jsx +0 -399
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.module.scss +0 -252
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.jsx +0 -585
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.module.scss +0 -331
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.jsx +0 -392
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.module.scss +0 -39
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/README.md +0 -248
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/SelectorTrigger.jsx +0 -194
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/index.jsx +0 -1459
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/mockData.js +0 -301
- package/app/wujie-vue3-child/src/views/aiCoach/dialogueSegment/index.jsx +0 -182
- package/app/wujie-vue3-child/src/views/aiCoach/dialogueSegment/index.module.scss +0 -28
- package/app/wujie-vue3-child/src/views/aiCoach/index.jsx +0 -375
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.jsx +0 -121
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.module.scss +0 -76
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/DonutChart/index.jsx +0 -104
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.jsx +0 -75
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.module.scss +0 -12
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.jsx +0 -62
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.module.scss +0 -43
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.jsx +0 -29
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.module.scss +0 -5
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.jsx +0 -58
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.module.scss +0 -85
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.jsx +0 -92
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.module.scss +0 -56
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.jsx +0 -40
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.module.scss +0 -53
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsDonut.jsx +0 -106
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsRankBar.jsx +0 -132
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.jsx +0 -176
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.module.scss +0 -96
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.jsx +0 -162
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.module.scss +0 -16
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.jsx +0 -29
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.module.scss +0 -25
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.jsx +0 -106
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.module.scss +0 -164
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.jsx +0 -182
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.module.scss +0 -203
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.jsx +0 -145
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.module.scss +0 -126
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.jsx +0 -67
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.module.scss +0 -105
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.jsx +0 -81
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.module.scss +0 -47
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.jsx +0 -64
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.module.scss +0 -85
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.jsx +0 -39
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.module.scss +0 -44
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.jsx +0 -83
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.module.scss +0 -101
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/index.jsx +0 -50
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/index.module.scss +0 -25
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/index.jsx +0 -196
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/index.module.scss +0 -41
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/inputColumn/index.jsx +0 -183
- package/app/wujie-vue3-child/src/views/aiCoach/scriptTable/inputColumn/index.module.scss +0 -115
- package/app/wujie-vue3-child/src/views/child-to-parent.vue +0 -117
- package/app/wujie-vue3-child/src/views/home.vue +0 -53
- package/app/wujie-vue3-child/src/views/jsx/btnSelect/btnSelect.vue +0 -169
- package/app/wujie-vue3-child/src/views/jsx/btnSelect/index.vue +0 -69
- package/app/wujie-vue3-child/src/views/jsx/com.vue +0 -44
- package/app/wujie-vue3-child/src/views/jsx/dialog.jsx +0 -66
- package/app/wujie-vue3-child/src/views/jsx/index.vue +0 -72
- package/app/wujie-vue3-child/src/views/jsx/props.vue +0 -33
- package/app/wujie-vue3-child/src/views/parent-to-child.vue +0 -225
- package/app/wujie-vue3-child/src/views/phone-code.vue +0 -318
- package/app/wujie-vue3-child/src/views/router-jump.vue +0 -123
- package/app/wujie-vue3-child/src/views/test.vue +0 -192
- package/app/wujie-vue3-child/vite.config.js +0 -15
|
@@ -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,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="selector-container">
|
|
3
|
+
<div class="header">函数</div>
|
|
4
|
+
<div class="tree-wrapper">
|
|
5
|
+
<el-tree
|
|
6
|
+
:data="treeData"
|
|
7
|
+
:props="defaultProps"
|
|
8
|
+
@node-click="handleNodeClick"
|
|
9
|
+
default-expand-all
|
|
10
|
+
highlight-current
|
|
11
|
+
>
|
|
12
|
+
<span
|
|
13
|
+
class="custom-tree-node"
|
|
14
|
+
slot-scope="{ node, data }"
|
|
15
|
+
:draggable="!onlyLeafClickable || node.isLeaf"
|
|
16
|
+
@dragstart="handleDragStart(node, data, $event)"
|
|
17
|
+
>
|
|
18
|
+
{{ node.label }}
|
|
19
|
+
</span>
|
|
20
|
+
</el-tree>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import { getFunctions } from "./api";
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: "FunctionSelector",
|
|
30
|
+
props: {
|
|
31
|
+
onlyLeafClickable: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
prefix: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "F_",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
treeData: [],
|
|
43
|
+
defaultProps: {
|
|
44
|
+
children: "children",
|
|
45
|
+
label: "label",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
mounted() {
|
|
50
|
+
this.fetchData();
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
async fetchData() {
|
|
54
|
+
this.treeData = await getFunctions();
|
|
55
|
+
},
|
|
56
|
+
handleNodeClick(data, node) {
|
|
57
|
+
if (this.onlyLeafClickable && !node.isLeaf) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.$emit("select", { ...data, value: `${this.prefix}${data.name}()` });
|
|
61
|
+
},
|
|
62
|
+
handleDragStart(node, data, e) {
|
|
63
|
+
if (this.onlyLeafClickable && !node.isLeaf) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const value = `${this.prefix}${data.name}()`;
|
|
68
|
+
e.dataTransfer.setData("text/plain", value);
|
|
69
|
+
e.dataTransfer.effectAllowed = "copy";
|
|
70
|
+
|
|
71
|
+
// 设置自定义拖拽镜像
|
|
72
|
+
const div = document.createElement('div');
|
|
73
|
+
div.innerText = value;
|
|
74
|
+
div.style.position = 'absolute';
|
|
75
|
+
div.style.top = '-9999px';
|
|
76
|
+
div.style.padding = '5px 10px';
|
|
77
|
+
div.style.background = '#fff';
|
|
78
|
+
div.style.border = '1px solid #409eff';
|
|
79
|
+
div.style.borderRadius = '4px';
|
|
80
|
+
div.style.fontSize = '14px';
|
|
81
|
+
div.style.color = '#303133';
|
|
82
|
+
div.style.boxShadow = '0 2px 12px 0 rgba(0,0,0,0.1)';
|
|
83
|
+
div.style.zIndex = '9999';
|
|
84
|
+
document.body.appendChild(div);
|
|
85
|
+
|
|
86
|
+
e.dataTransfer.setDragImage(div, 0, 0);
|
|
87
|
+
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
document.body.removeChild(div);
|
|
90
|
+
}, 0);
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<style scoped>
|
|
97
|
+
.custom-tree-node {
|
|
98
|
+
flex: 1;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
font-size: 14px;
|
|
102
|
+
}
|
|
103
|
+
.selector-container {
|
|
104
|
+
width: 100%;
|
|
105
|
+
height: 100%;
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.header {
|
|
111
|
+
padding: 10px;
|
|
112
|
+
background-color: #f5f7fa;
|
|
113
|
+
border-bottom: 1px solid #ebeef5;
|
|
114
|
+
font-weight: bold;
|
|
115
|
+
text-align: center;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.tree-wrapper {
|
|
119
|
+
flex: 1;
|
|
120
|
+
overflow-y: auto;
|
|
121
|
+
padding: 10px;
|
|
122
|
+
}
|
|
123
|
+
</style>
|