@kyfe/ks-query-table 0.0.21 → 0.0.22
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/.bitmap +38 -0
- package/.editorconfig +5 -0
- package/.env.dev +2 -0
- package/.env.gray +2 -0
- package/.env.prod +2 -0
- package/.env.stg +3 -0
- package/.env.uat +2 -0
- package/.eslintignore +1 -0
- package/.eslintrc.js +25 -0
- package/.gitmodules +4 -0
- package/.prettierrc +11 -0
- package/README.md +15 -0
- package/babel.config.js +10 -0
- package/build-apm.sh +9 -0
- package/build.sh +16 -0
- package/config/index.js +20 -0
- package/jsconfig.json +7 -0
- package/kuasheng-sdk/index.js +80 -0
- package/kuasheng-sdk/lib/assets.js +304 -0
- package/kuasheng-sdk/lib/context.js +199 -0
- package/kuasheng-sdk/lib/layout.js +346 -0
- package/kuasheng-sdk/lib/location.js +46 -0
- package/kuasheng-sdk/lib/media.js +342 -0
- package/kuasheng-sdk/lib/navigation.js +30 -0
- package/kuasheng-sdk/lib/request.js +76 -0
- package/kuasheng-sdk/lib/system.js +190 -0
- package/kuasheng-sdk/lib/userinfo.js +98 -0
- package/kuasheng-sdk/util/check.js +102 -0
- package/kuasheng-sdk/util/config.js +47 -0
- package/kuasheng-sdk/util/device.js +25 -0
- package/kuasheng-sdk/util/error.js +19 -0
- package/kuasheng-sdk/util/funtional.js +153 -0
- package/kuasheng-sdk/util/mixin.js +36 -0
- package/kuasheng-sdk/util/requestUtil.js +41 -0
- package/kuasheng-sdk/util/response.js +33 -0
- package/kuasheng-sdk/util/warn.js +35 -0
- package/kuasheng-ui/CHANGELOG.md +9 -0
- package/kuasheng-ui/components/card.vue +57 -0
- package/kuasheng-ui/components/ks-area-select/README.md +43 -0
- package/kuasheng-ui/components/ks-area-select/area-picker.vue +554 -0
- package/kuasheng-ui/components/ks-area-select/area-search.vue +363 -0
- package/kuasheng-ui/components/ks-area-select/areas-pop.vue +56 -0
- package/kuasheng-ui/components/ks-area-select/common.js +183 -0
- package/kuasheng-ui/components/ks-area-select/index.vue +355 -0
- package/kuasheng-ui/components/ks-area-select/mixins.js +216 -0
- package/kuasheng-ui/components/ks-area-single-select/README.md +50 -0
- package/kuasheng-ui/components/ks-area-single-select/hot-city.js +45 -0
- package/kuasheng-ui/components/ks-area-single-select/index.vue +324 -0
- package/kuasheng-ui/components/ks-calendar/index.vue +269 -0
- package/kuasheng-ui/components/ks-call-phone/call-tips.vue +70 -0
- package/kuasheng-ui/components/ks-call-phone/call.vue +178 -0
- package/kuasheng-ui/components/ks-call-phone/index.js +48 -0
- package/kuasheng-ui/components/ks-call-phone/index.vue +131 -0
- package/kuasheng-ui/components/ks-call-phone//345/221/274/345/217/253/347/273/204/344/273/266.md +0 -0
- package/kuasheng-ui/components/ks-date-picker/README.md +23 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-bottom.vue +123 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-dropdown.vue +80 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-right.vue +87 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker-top.vue +88 -0
- package/kuasheng-ui/components/ks-date-picker/date-picker.js +15 -0
- package/kuasheng-ui/components/ks-date-picker/date-range-select.vue +92 -0
- package/kuasheng-ui/components/ks-date-picker/date-select.vue +65 -0
- package/kuasheng-ui/components/ks-date-picker/date-week-month.vue +131 -0
- package/kuasheng-ui/components/ks-date-picker/index.js +12 -0
- package/kuasheng-ui/components/ks-date-picker/mixin.js +92 -0
- package/kuasheng-ui/components/ks-date-picker/month-range-select.vue +129 -0
- package/kuasheng-ui/components/ks-date-picker/month-select.vue +85 -0
- package/kuasheng-ui/components/ks-date-picker/quarter-select.vue +94 -0
- package/kuasheng-ui/components/ks-date-picker/style.less +121 -0
- package/kuasheng-ui/components/ks-date-picker/utils.js +109 -0
- package/kuasheng-ui/components/ks-date-picker/week-select.vue +99 -0
- package/kuasheng-ui/components/ks-decrypt/index.vue +159 -0
- package/kuasheng-ui/components/ks-employee/README.md +78 -0
- package/kuasheng-ui/components/ks-employee/employee-input.vue +173 -0
- package/kuasheng-ui/components/ks-employee/employee-list.vue +662 -0
- package/kuasheng-ui/components/ks-employee/employee-popup.vue +197 -0
- package/kuasheng-ui/components/ks-employee/employee-search.vue +250 -0
- package/kuasheng-ui/components/ks-employee/employee-selected.vue +173 -0
- package/kuasheng-ui/components/ks-employee/index.js +17 -0
- package/kuasheng-ui/components/ks-employee/package-lock.json +5 -0
- package/kuasheng-ui/components/ks-employee/package.json +15 -0
- package/kuasheng-ui/components/ks-employee/yarn.lock +4 -0
- package/kuasheng-ui/components/ks-field-money/index.js +8 -0
- package/kuasheng-ui/components/ks-field-money/index.vue +212 -0
- package/kuasheng-ui/components/ks-field-money/package.json +11 -0
- package/kuasheng-ui/components/ks-field-money/utils.js +65 -0
- package/kuasheng-ui/components/ks-field-money//351/207/221/351/242/235/350/275/254/346/215/242/345/231/250.md +0 -0
- package/kuasheng-ui/components/ks-history-search/history-input.vue +131 -0
- package/kuasheng-ui/components/ks-history-search/history-list.vue +188 -0
- package/kuasheng-ui/components/ks-history-search/img/delete.png +0 -0
- package/kuasheng-ui/components/ks-history-search/index.js +9 -0
- package/kuasheng-ui/components/ks-history-search/index.vue +125 -0
- package/kuasheng-ui/components/ks-history-search/package-lock.json +5 -0
- package/kuasheng-ui/components/ks-history-search/package.json +15 -0
- package/kuasheng-ui/components/ks-history-search/utils.js +35 -0
- package/kuasheng-ui/components/ks-input-search/index.vue +106 -0
- package/kuasheng-ui/components/ks-list/index.vue +75 -0
- package/kuasheng-ui/components/ks-loading/index.js +16 -0
- package/kuasheng-ui/components/ks-month/index.vue +47 -0
- package/kuasheng-ui/components/ks-month/package.json +3 -0
- package/kuasheng-ui/components/ks-month/range.vue +172 -0
- package/kuasheng-ui/components/ks-month/single.vue +136 -0
- package/kuasheng-ui/components/ks-month/style.less +125 -0
- package/kuasheng-ui/components/ks-month/utils.js +35 -0
- package/kuasheng-ui/components/ks-nav/index.vue +264 -0
- package/kuasheng-ui/components/ks-nav-bar.js +35 -0
- package/kuasheng-ui/components/ks-org/ks-org-tree.vue +247 -0
- package/kuasheng-ui/components/ks-org/ks-popup-tree.vue +154 -0
- package/kuasheng-ui/components/ks-org/ks-tree-input.vue +240 -0
- package/kuasheng-ui/components/ks-org/ks-tree-node.vue +94 -0
- package/kuasheng-ui/components/ks-org/ks-tree.vue +229 -0
- package/kuasheng-ui/components/ks-org/utils.js +54 -0
- package/kuasheng-ui/components/ks-popover/index.vue +457 -0
- package/kuasheng-ui/components/ks-popover/mixin.js +28 -0
- package/kuasheng-ui/components/ks-popover/utils.js +60 -0
- package/kuasheng-ui/components/ks-pull-refresh/index.vue +43 -0
- package/kuasheng-ui/components/ks-quarter/index.vue +256 -0
- package/kuasheng-ui/components/ks-table/README.md +103 -0
- package/kuasheng-ui/components/ks-table/cell.vue +31 -0
- package/kuasheng-ui/components/ks-table/index.js +8 -0
- package/kuasheng-ui/components/ks-table/index.less +486 -0
- package/kuasheng-ui/components/ks-table/index.vue +1088 -0
- package/kuasheng-ui/components/ks-table/package.json +12 -0
- package/kuasheng-ui/components/ks-table/release.md +7 -0
- package/kuasheng-ui/components/ks-toast.js +35 -0
- package/kuasheng-ui/components/ks-upload/index.vue +174 -0
- package/kuasheng-ui/components/ks-user-access.vue +229 -0
- package/kuasheng-ui/components/no-data/README.md +45 -0
- package/kuasheng-ui/components/no-data/image.js +1 -0
- package/kuasheng-ui/components/no-data/index.vue +83 -0
- package/kuasheng-ui/components/notice-bar.vue +16 -0
- package/kuasheng-ui/components/steps.js +11 -0
- package/kuasheng-ui/components/tabs.vue +40 -0
- package/kuasheng-ui/index.js +239 -0
- package/kuasheng-ui/patch/datetime-picker/datetimePicker.md +0 -0
- package/kuasheng-ui/patch/datetime-picker/index.js +46 -0
- package/kuasheng-ui/patch/datetime-picker/utils.js +78 -0
- package/kuasheng-ui/patch/field/field.md +1 -0
- package/kuasheng-ui/patch/field/index.js +122 -0
- package/kuasheng-ui/patch/field/utils.js +36 -0
- package/kuasheng-ui/patch/form/form.md +7 -0
- package/kuasheng-ui/patch/form/index.js +106 -0
- package/kuasheng-ui/patch/index.js +12 -0
- package/kuasheng-ui/patch/pagination/index.js +78 -0
- package/kuasheng-ui/style/animation-ui.less +31 -0
- package/kuasheng-ui/style/font/number/font-number1.otf +0 -0
- package/kuasheng-ui/style/font/number/font-number2.ttf +0 -0
- package/kuasheng-ui/style/images/checked.svg +1 -0
- package/kuasheng-ui/style/images/success.svg +1 -0
- package/kuasheng-ui/style/index.less +6 -0
- package/kuasheng-ui/style/kuasheng-ui.less +207 -0
- package/kuasheng-ui/style/reset-vant.less +307 -0
- package/kuasheng-ui/style/vant-var.less +138 -0
- package/kuasheng-ui/utils/apis.js +17 -0
- package/kuasheng-ui/utils/axios-adapter.js +47 -0
- package/kuasheng-ui/utils/bem.js +39 -0
- package/kuasheng-ui/utils/bus.js +97 -0
- package/kuasheng-ui/utils/common.js +88 -0
- package/kuasheng-ui/utils/decrypt/config.js +12 -0
- package/kuasheng-ui/utils/decrypt/decrypt-api.js +139 -0
- package/kuasheng-ui/utils/decrypt/index.js +6 -0
- package/kuasheng-ui/utils/decrypt/mask.js +36 -0
- package/kuasheng-ui/utils/decrypt/virtual.js +44 -0
- package/kuasheng-ui/utils/directive.js +57 -0
- package/kuasheng-ui/utils/directive.md +23 -0
- package/kuasheng-ui/utils/drcheck-plugin.js +219 -0
- package/kuasheng-ui/utils/error-plugin.js +88 -0
- package/kuasheng-ui/utils/filter.js +149 -0
- package/kuasheng-ui/utils/http-interceptors.js +18 -0
- package/kuasheng-ui/utils/http.js +140 -0
- package/kuasheng-ui/utils/index.js +5 -0
- package/kuasheng-ui/utils/init-event.js +20 -0
- package/kuasheng-ui/utils/log.js +309 -0
- package/kuasheng-ui/utils/token.js +9 -0
- package/kuasheng-ui/utils/type.js +45 -0
- package/kuasheng-ui/utils/validate.js +20 -0
- package/kuasheng-ui/utils/watermark.js +67 -0
- package/kuasheng-ui/version.js +1 -0
- package/ky-apm/client.js +37 -0
- package/ky-apm/customHttp.js +38 -0
- package/ky-apm/index.js +68 -0
- package/ky-apm/plugins/performance.js +84 -0
- package/ky-apm/plugins/self-error.js +26 -0
- package/ky-apm/warn-log.js +3 -0
- package/package.json +81 -10
- package/plugin/ks-chii-webpack-html/index.js +53 -0
- package/plugin/ks-chii-webpack-html/package.json +16 -0
- package/postcss.config.js +15 -0
- package/public/capsule-positon.js +50 -0
- package/public/fonts/DingTalkJinBuTi.ttf +0 -0
- package/public/framework/axios@0.19.0.min.js +9 -0
- package/public/framework/fastclick@1.0.6.min.js +1 -0
- package/public/framework/iconfont/iconfont.css +91 -0
- package/public/framework/iconfont/iconfont.js +1 -0
- package/public/framework/iconfont/iconfont.json +142 -0
- package/public/framework/iconfont/iconfont.ttf +0 -0
- package/public/framework/iconfont/iconfont.woff +0 -0
- package/public/framework/iconfont/iconfont.woff2 +0 -0
- package/public/framework/vant@2.5.6.min.js +7 -0
- package/public/framework/vue-router@3.1.3.min.js +6 -0
- package/public/framework/vue@2.6.10.runtime.min.js +6 -0
- package/public/framework/vuex@3.1.1.min.js +6 -0
- package/public/index.html +260 -0
- package/public/ks@3.0.8.umd.min.js +1 -0
- package/public/ksui@4.0.27.umd.min.js +10 -0
- package/public/status-bar-preset.js +39 -0
- package/{index.js → qt-npm/index.js} +3 -3
- package/qt-npm/package.json +13 -0
- package/src/App.vue +204 -0
- package/src/README.md +15 -0
- package/src/common/README.md +94 -0
- package/src/common/http/axios-adapter.js +47 -0
- package/src/common/http/common.js +88 -0
- package/src/common/http/http-interceptors.js +18 -0
- package/src/common/http/http-lock.js +45 -0
- package/src/common/http/index.js +163 -0
- package/src/common/http/token.js +9 -0
- package/src/common/styles/font/AlibabaSans102Ver2-Md.ttf +0 -0
- package/src/common/styles/font.less +12 -0
- package/src/common/styles/variables.less +43 -0
- package/src/common/utils/index.js +1 -0
- package/src/common/utils/platform/README.md +1 -0
- package/src/common/utils/platform/android/.gitkeep +0 -0
- package/src/common/utils/platform/core/index.js +24 -0
- package/src/common/utils/platform/index.js +164 -0
- package/src/common/utils/platform/ios/.gitkeep +0 -0
- package/src/common/utils/platform/subscribe/helper.js +38 -0
- package/src/common/utils/platform/subscribe/index.js +204 -0
- package/src/common/utils/platform/subscribe/table-animation.js +75 -0
- package/src/config/index.js +31 -0
- package/src/config.js +1 -0
- package/src/main.js +73 -0
- package/src/router.js +52 -0
- package/src/view/home/config.js +101 -0
- package/src/view/home/demo1.vue +223 -0
- package/src/view/home/demo2.vue +124 -0
- package/src/view/home/demo3.vue +51 -0
- package/src/view/home/demo4.vue +140 -0
- package/src/view/home/index.vue +97 -0
- package/src/view/home/query-table/README.md +45 -0
- package/src/view/home/query-table/api/index.js +12 -0
- package/src/view/home/query-table/assets/horizontal-back.svg +1 -0
- package/src/view/home/query-table/components/pe-table/cell.js +181 -0
- package/src/view/home/query-table/components/pe-table/collapse.js +334 -0
- package/src/view/home/query-table/components/pe-table/empty.vue +48 -0
- package/src/view/home/query-table/components/pe-table/header.js +328 -0
- package/src/view/home/query-table/components/pe-table/images/abnormal.png +0 -0
- package/src/view/home/query-table/components/pe-table/images/empty.png +0 -0
- package/src/view/home/query-table/components/pe-table/images/fold.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/sort.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/sorting.svg +1 -0
- package/src/view/home/query-table/components/pe-table/images/unfold.svg +1 -0
- package/src/view/home/query-table/components/pe-table/index.vue +847 -0
- package/src/view/home/query-table/components/pe-table/load-more.js +46 -0
- package/src/view/home/query-table/components/pe-table/props/index.js +193 -0
- package/src/view/home/query-table/components/pe-table/row.vue +118 -0
- package/src/view/home/query-table/components/pe-table/scrollbar.js +424 -0
- package/src/view/home/query-table/components/pe-table/stretch-damping.js +112 -0
- package/src/view/home/query-table/components/pe-table/style/cell.less +89 -0
- package/src/view/home/query-table/components/pe-table/style/empty.less +48 -0
- package/src/view/home/query-table/components/pe-table/style/header.less +141 -0
- package/src/view/home/query-table/components/pe-table/style/index.less +88 -0
- package/src/view/home/query-table/components/pe-table/style/load-more.less +61 -0
- package/src/view/home/query-table/components/pe-table/style/row.less +6 -0
- package/src/view/home/query-table/components/pe-table/table-loading.vue +120 -0
- package/src/view/home/query-table/components/pe-table/table-total.vue +57 -0
- package/src/view/home/query-table/components/pe-table/utils/animate.js +80 -0
- package/src/view/home/query-table/components/pe-table/utils/columns.js +290 -0
- package/src/view/home/query-table/components/pe-table/utils/data.js +12 -0
- package/src/view/home/query-table/components/pe-table/utils/fixed.js +69 -0
- package/src/view/home/query-table/components/pe-table/utils/formatter.js +327 -0
- package/src/view/home/query-table/components/pe-table/utils/render-cells.js +424 -0
- package/src/view/home/query-table/components/pe-table/utils/slot.js +28 -0
- package/src/view/home/query-table/components/pe-table/utils/tools.js +84 -0
- package/src/view/home/query-table/components/pe-table/utils/touch-scroll.js +417 -0
- package/src/view/home/query-table/components/query-table/index.vue +497 -0
- package/src/view/home/query-table/components/query-table/mixins/column-mixin.js +102 -0
- package/src/view/home/query-table/components/query-table/mixins/column-setting.js +143 -0
- package/src/view/home/query-table/components/query-table/mixins/data-mixin.js +519 -0
- package/src/view/home/query-table/components/query-table/mixins/pagination-mixin.js +26 -0
- package/src/view/home/query-table/components/query-table/mixins/table-fixed.js +130 -0
- package/src/view/home/query-table/components/query-table/mixins/table-horizontal.js +119 -0
- package/src/view/home/query-table/components/table-horizontal.vue +99 -0
- package/src/view/home/query-table/components/table-pagination.vue +32 -0
- package/src/view/home/query-table/components/table-settings/assets/arrpw-up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/disabled-down.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/disabled-up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/down.svg +1 -0
- package/src/view/home/query-table/components/table-settings/assets/up.svg +1 -0
- package/src/view/home/query-table/components/table-settings/index.less +294 -0
- package/src/view/home/query-table/components/table-settings/index.vue +260 -0
- package/src/view/home/query-table/components/table-settings/settings.vue +479 -0
- package/src/view/home/query-table/components/table-settings/test.js +626 -0
- package/src/view/home/query-table/components/table-settings//344/270/252/346/200/247/350/256/276/347/275/256.md +0 -0
- package/src/view/home/query-table/components/tooltip.js +124 -0
- package/src/view/home/query-table/hooks/use-cache-promise.js +27 -0
- package/src/view/home/query-table/hooks/use-column-config.js +190 -0
- package/src/view/home/query-table/hooks/use-encryption.js +0 -0
- package/src/view/home/query-table/hooks/use-generic-search.js +95 -0
- package/src/view/home/query-table/index.js +7 -0
- package/src/view/home/query-table/store/column-store.js +0 -0
- package/src/view/home/query-table/styles/table.less +24 -0
- package/src/view/home/query-table/utils/column.js +36 -0
- package/src/view/home/query-table/utils/config.js +12 -0
- package/src/view/home/query-table/utils/encryption.js +32 -0
- package/src/view/home/query-table/utils/http.js +1 -0
- package/src/view/home/query-table/utils/localStorage.js +35 -0
- package/src/view/home//351/246/226/351/241/265.md +0 -0
- package/src/web.js +99 -0
- package/vue.config.js +131 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
import { animateScroll } from './utils/animate'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
data() {
|
|
6
|
+
return {
|
|
7
|
+
isScrolling: false,
|
|
8
|
+
transientScrollOffsetY: 0,
|
|
9
|
+
transientScrollOffsetX: 0,
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
mounted() {
|
|
13
|
+
// 添加滚动条到网格容器
|
|
14
|
+
this.refreshThumb()
|
|
15
|
+
|
|
16
|
+
// 绑定事件
|
|
17
|
+
// this.$refs.trackX.addEventListener('mousemove', this.onTrackMouseMoveX)
|
|
18
|
+
// this.$refs.trackX.addEventListener('mousedown', this.onTrackMouseDownX)
|
|
19
|
+
// this.$refs.trackY.addEventListener('mousemove', this.onTrackMouseMoveY)
|
|
20
|
+
// this.$refs.trackY.addEventListener('mousedown', this.onTrackMouseDownY)
|
|
21
|
+
// this.$refs.thumbX.addEventListener('mousedown', this.onThumbMouseDownX)
|
|
22
|
+
// this.$refs.thumbY.addEventListener('mousedown', this.onThumbMouseDownY)
|
|
23
|
+
this.$refs.container.addEventListener('wheel', this.onContainerWheel)
|
|
24
|
+
},
|
|
25
|
+
beforeDestroy() {
|
|
26
|
+
// 移除事件监听器
|
|
27
|
+
this.$refs.trackX.removeEventListener('mousemove', this.onTrackMouseMoveX)
|
|
28
|
+
this.$refs.trackX.removeEventListener('mousedown', this.onTrackMouseDownX)
|
|
29
|
+
this.$refs.trackY.removeEventListener('mousemove', this.onTrackMouseMoveY)
|
|
30
|
+
this.$refs.trackY.removeEventListener('mousedown', this.onTrackMouseDownY)
|
|
31
|
+
this.$refs.thumbX.removeEventListener('mousedown', this.onThumbMouseDownX)
|
|
32
|
+
this.$refs.thumbY.removeEventListener('mousedown', this.onThumbMouseDownY)
|
|
33
|
+
this.$refs.container.removeEventListener('wheel', this.onContainerWheel)
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
renderViewportCellsColumns() {
|
|
37
|
+
return [...this.renderCellsColumns.filter(col => col.fixed), ...this.renderCellsColumns.slice(this.state.startCell, this.state.endCell + 1)]
|
|
38
|
+
},
|
|
39
|
+
renderScollXTable(x) {
|
|
40
|
+
this.setScrollOffsetX(x);
|
|
41
|
+
this.createHeader();
|
|
42
|
+
this.renderViewportCells();
|
|
43
|
+
this.emitScroll()
|
|
44
|
+
},
|
|
45
|
+
renderScrollYTable(y) {
|
|
46
|
+
this.setScrollOffsetY(y)
|
|
47
|
+
this.renderViewportRows()
|
|
48
|
+
this.emitScroll()
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* 垂直滚动到指定行
|
|
52
|
+
* @param {Number} rowKey 数据源中的行Key(从0开始)
|
|
53
|
+
* @param {Number} [offset=0] 额外偏移量(像素)
|
|
54
|
+
* @param {Number} [duration] 动画持续时间(毫秒)
|
|
55
|
+
*/
|
|
56
|
+
scrollToColumn(key, offset = 0, duration) {
|
|
57
|
+
const state = this.getState();
|
|
58
|
+
const maxScrollLeft = state.scrollableWidth;
|
|
59
|
+
const column = this.mainColumns.find(col => col.key === key);
|
|
60
|
+
|
|
61
|
+
if (!column) return;
|
|
62
|
+
|
|
63
|
+
const fixedList = this.mainColumns.filter(col => col.fixed === 'left' || col.fixed);
|
|
64
|
+
|
|
65
|
+
const fixedWidth = fixedList.reduce((acc, col) => acc + col.width, 0);
|
|
66
|
+
|
|
67
|
+
const targetScrollLeft = Math.min(
|
|
68
|
+
Math.max(0, column.offsetX - fixedWidth - offset),
|
|
69
|
+
maxScrollLeft
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (duration) {
|
|
73
|
+
animateScroll({
|
|
74
|
+
from: this.offsetX,
|
|
75
|
+
to: targetScrollLeft,
|
|
76
|
+
duration,
|
|
77
|
+
onUpdate: (currentPos) => {
|
|
78
|
+
this.renderScollXTable(currentPos)
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
} else {
|
|
82
|
+
this.renderScollXTable(targetScrollLeft)
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* 垂直滚动到指定行
|
|
87
|
+
* @param {Number} rowIndex 数据源中的行索引(从0开始)
|
|
88
|
+
* @param {Number} [offset=0] 额外偏移量(像素)
|
|
89
|
+
* @param {Number} [duration] 动画持续时间(毫秒)
|
|
90
|
+
*/
|
|
91
|
+
scrollToRow(targetIndex, offset = 0, duration) {
|
|
92
|
+
const targetScrollTop = this.getTargetScrollTop(targetIndex, offset)
|
|
93
|
+
if (duration) {
|
|
94
|
+
animateScroll({
|
|
95
|
+
from: this.offsetY,
|
|
96
|
+
to: targetScrollTop,
|
|
97
|
+
duration,
|
|
98
|
+
onUpdate: (currentPos) => {
|
|
99
|
+
this.renderScrollYTable(currentPos)
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
} else {
|
|
103
|
+
this.renderScrollYTable(targetScrollTop)
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
// 获取Y轴滚动距离
|
|
107
|
+
getTargetScrollTop(targetIndex, offset = 0) {
|
|
108
|
+
// 边界处理(确保索引在有效范围内)
|
|
109
|
+
const maxIndex = this.tableData.length - 1
|
|
110
|
+
const safeIndex = Math.max(0, Math.min(targetIndex, maxIndex))
|
|
111
|
+
|
|
112
|
+
// 核心计算参数
|
|
113
|
+
const rowHeight = this.$props.rowHeight
|
|
114
|
+
const availableHeight = this.viewportHeight - this.headerTotalHeight // 实际可用高度
|
|
115
|
+
const totalRowHeight = this.tableData.length * rowHeight // 总行高(不含表头)
|
|
116
|
+
|
|
117
|
+
// 计算基础偏移量
|
|
118
|
+
let baseOffset = safeIndex * rowHeight
|
|
119
|
+
|
|
120
|
+
// 最终偏移量计算(包含边界限制)
|
|
121
|
+
const maxScrollTop = Math.max(0, totalRowHeight - availableHeight)
|
|
122
|
+
return Math.max(0, Math.min(baseOffset + offset, maxScrollTop))
|
|
123
|
+
|
|
124
|
+
},
|
|
125
|
+
resetStretch(timeout = 100) {
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
const maxScrollTop = this.getTargetScrollTop(this.tableData.length - 1, 0)
|
|
128
|
+
if (this.offsetY >= maxScrollTop) {
|
|
129
|
+
animateScroll({
|
|
130
|
+
from: this.offsetY,
|
|
131
|
+
to: maxScrollTop,
|
|
132
|
+
duration: 10,
|
|
133
|
+
onUpdate: (currentPos) => {
|
|
134
|
+
this.renderScrollYTable(currentPos)
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
}, timeout);
|
|
139
|
+
|
|
140
|
+
},
|
|
141
|
+
refreshThumb() {
|
|
142
|
+
const state = this.getState()
|
|
143
|
+
this.translateThumbY(state.thumbOffsetY)
|
|
144
|
+
this.setThumbSizeY(state.thumbSizeY - this.headerTotalHeight)
|
|
145
|
+
this.translateThumbX(state.thumbOffsetX)
|
|
146
|
+
this.setThumbSizeX(state.thumbSizeX)
|
|
147
|
+
},
|
|
148
|
+
clampThumbIfNeeded() {
|
|
149
|
+
const state = this.getState()
|
|
150
|
+
let shouldTranslateThumb = false
|
|
151
|
+
if (this.offsetY != null && (this.offsetY < 0 || this.offsetY > state.scrollableHeight)) {
|
|
152
|
+
const clampedOffsetY = Math.max(0, Math.min(this.offsetY, state.scrollableHeight))
|
|
153
|
+
this.offsetY = clampedOffsetY
|
|
154
|
+
shouldTranslateThumb = true
|
|
155
|
+
}
|
|
156
|
+
if (this.offsetX != null && (this.offsetX < 0 || this.offsetX > state.scrollableWidth)) {
|
|
157
|
+
const clampedOffsetX = Math.max(0, Math.min(this.offsetX, state.scrollableWidth))
|
|
158
|
+
this.offsetX = clampedOffsetX
|
|
159
|
+
shouldTranslateThumb = true
|
|
160
|
+
}
|
|
161
|
+
if (shouldTranslateThumb) {
|
|
162
|
+
const state2 = this.getState()
|
|
163
|
+
this.translateThumbX(state2.thumbOffsetX)
|
|
164
|
+
this.translateThumbY(state2.thumbOffsetY)
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
setScrollOffsetX(x) {
|
|
168
|
+
const state = this.getState()
|
|
169
|
+
const clampedOffsetX = Math.max(0, Math.min(x, state.scrollableWidth))
|
|
170
|
+
this.offsetX = clampedOffsetX
|
|
171
|
+
|
|
172
|
+
const state2 = this.getState()
|
|
173
|
+
this.translateThumbX(state2.thumbOffsetX)
|
|
174
|
+
},
|
|
175
|
+
ease(currentScroll, distance) {
|
|
176
|
+
// 最大距离
|
|
177
|
+
const maxScrollY = this.state.tableHeight - this.viewportHeight + this.loadMoreHeight
|
|
178
|
+
let damping = 1
|
|
179
|
+
// 剩余距离
|
|
180
|
+
const remainingDistance = maxScrollY - currentScroll
|
|
181
|
+
damping = remainingDistance / maxScrollY
|
|
182
|
+
|
|
183
|
+
let newDistance = distance * damping * 10
|
|
184
|
+
|
|
185
|
+
return newDistance
|
|
186
|
+
},
|
|
187
|
+
setScrollOffsetY(y) {
|
|
188
|
+
const state = this.getState()
|
|
189
|
+
let scrollableHeight = state.scrollableHeight
|
|
190
|
+
// 如果开启了上拉加载更多,这里最大滚动高度加上上拉加载更多的高度
|
|
191
|
+
if (this.enableLoadMore) {
|
|
192
|
+
const loadMoreHeight = this.loadMoreHeight || 0
|
|
193
|
+
// const dyc = (this.isHasOffsetY && this.isLoadFinished) ? 0 : loadMoreHeight
|
|
194
|
+
const dyc = loadMoreHeight
|
|
195
|
+
// 表格条数加上加载更多的距离够才需要加可滚动距离
|
|
196
|
+
if ((state.tableHeight + dyc) > this.viewportHeight) {
|
|
197
|
+
scrollableHeight += dyc
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const clampedOffsetY = Math.max(0, Math.min(y, scrollableHeight))
|
|
201
|
+
this.offsetY = clampedOffsetY
|
|
202
|
+
const state2 = this.getState()
|
|
203
|
+
this.translateThumbY(state2.thumbOffsetY)
|
|
204
|
+
},
|
|
205
|
+
emitScroll() {
|
|
206
|
+
// const renderViewportCellsColumns = [...this.renderCellsColumns.filter(col => col.fixed), ...this.renderCellsColumns.slice(this.state.startCell, this.state.endCell + 1)]
|
|
207
|
+
const params = {
|
|
208
|
+
direction: this.scrollDirection,
|
|
209
|
+
scrollLeft: this.offsetX,
|
|
210
|
+
scrollTop: this.offsetY,
|
|
211
|
+
startRow: this.state.startRow,
|
|
212
|
+
endRow: this.state.endRow,
|
|
213
|
+
startCell: this.state.startCell,
|
|
214
|
+
endCell: this.state.endCell,
|
|
215
|
+
rowsPerViewport: this.state.rowsPerViewport,
|
|
216
|
+
viewportEndRowIndex: this.getViewportEndRowIndex(),
|
|
217
|
+
// renderViewportCellsColumns
|
|
218
|
+
}
|
|
219
|
+
this.$emit('scroll', params)
|
|
220
|
+
if (this.isScrollShowTotal) {
|
|
221
|
+
this.showTotalView()
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
scrollBy(x, y) {
|
|
225
|
+
// console.log(x, y, 'scrollBy')
|
|
226
|
+
|
|
227
|
+
let renderRows = false
|
|
228
|
+
let renderCells = false
|
|
229
|
+
|
|
230
|
+
// 仅处理垂直滚动
|
|
231
|
+
if (y != null && y !== 0) {
|
|
232
|
+
if (!this.$props.scrollY && this.scrollDirection === 'Y' && !this.isShowHorizontal) {
|
|
233
|
+
return
|
|
234
|
+
}
|
|
235
|
+
if (this.offsetY + y > (this.state.tableHeight - this.viewportHeight + 100)) {
|
|
236
|
+
y = this.ease(this.offsetY + y, y)
|
|
237
|
+
}
|
|
238
|
+
this.setScrollOffsetY(this.offsetY + y)
|
|
239
|
+
renderRows = true
|
|
240
|
+
}
|
|
241
|
+
// 仅处理水平滚动
|
|
242
|
+
if (x != null && x !== 0) {
|
|
243
|
+
if (!this.$props.scrollX && this.scrollDirection === 'X') {
|
|
244
|
+
return
|
|
245
|
+
}
|
|
246
|
+
this.setScrollOffsetX(this.offsetX + x)
|
|
247
|
+
renderCells = true
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// 根据滚动方向渲染对应的部分
|
|
251
|
+
if (renderRows) {
|
|
252
|
+
this.renderViewportRows()
|
|
253
|
+
}
|
|
254
|
+
if (renderCells) {
|
|
255
|
+
this.renderViewportCells()
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
this.emitScroll()
|
|
259
|
+
},
|
|
260
|
+
getViewportEndRowIndex() {
|
|
261
|
+
if (this.state.endRow === this.tableData.length) {
|
|
262
|
+
return this.state.endRow
|
|
263
|
+
}
|
|
264
|
+
return this.state.endRow - Math.floor(this.headerTotalHeight / this.$props.rowHeight)
|
|
265
|
+
},
|
|
266
|
+
onContainerWheel(e) {
|
|
267
|
+
e.preventDefault()
|
|
268
|
+
e.stopPropagation()
|
|
269
|
+
|
|
270
|
+
let deltaY = e.deltaY
|
|
271
|
+
let deltaX = e.deltaX
|
|
272
|
+
if (Math.abs(deltaY) > 30 && Math.abs(deltaX) < 15) {
|
|
273
|
+
deltaX = 0
|
|
274
|
+
} else if (Math.abs(deltaX) > 30 && Math.abs(deltaY) < 15) {
|
|
275
|
+
deltaY = 0
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// 判断滚动方向
|
|
279
|
+
const isHorizontal = Math.abs(deltaX) > Math.abs(deltaY) // 水平滚动
|
|
280
|
+
const isVertical = Math.abs(deltaY) > Math.abs(deltaX) // 垂直滚动
|
|
281
|
+
|
|
282
|
+
// 如果是水平滚动,则忽略垂直滚动
|
|
283
|
+
if (isHorizontal) {
|
|
284
|
+
this.scrollDirection = 'X'
|
|
285
|
+
deltaY = 0
|
|
286
|
+
}
|
|
287
|
+
// 如果是垂直滚动,则忽略水平滚动
|
|
288
|
+
if (isVertical) {
|
|
289
|
+
this.scrollDirection = 'Y'
|
|
290
|
+
deltaX = 0
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.transientScrollOffsetX += deltaX
|
|
294
|
+
this.transientScrollOffsetY += deltaY
|
|
295
|
+
if (this.isScrolling) {
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
this.isScrolling = true
|
|
300
|
+
window.requestAnimationFrame(() => {
|
|
301
|
+
const scrollX = this.transientScrollOffsetX !== 0 ? this.transientScrollOffsetX : undefined
|
|
302
|
+
const scrollY = this.transientScrollOffsetY !== 0 ? this.transientScrollOffsetY : undefined
|
|
303
|
+
this.scrollBy(scrollX, scrollY)
|
|
304
|
+
this.isScrolling = false
|
|
305
|
+
this.transientScrollOffsetX = 0
|
|
306
|
+
this.transientScrollOffsetY = 0
|
|
307
|
+
})
|
|
308
|
+
},
|
|
309
|
+
onThumbMouseDownY(e) {
|
|
310
|
+
e.preventDefault()
|
|
311
|
+
e.stopPropagation()
|
|
312
|
+
document.body.style.setProperty('cursor', 'grabbing', 'important')
|
|
313
|
+
document.addEventListener('mousemove', this.onThumbDragY)
|
|
314
|
+
document.addEventListener('mouseup', this.onThumbMouseUpY)
|
|
315
|
+
},
|
|
316
|
+
onThumbDragY(e) {
|
|
317
|
+
e.preventDefault()
|
|
318
|
+
e.stopPropagation()
|
|
319
|
+
const state = this.getState()
|
|
320
|
+
|
|
321
|
+
// 仅处理垂直滚动
|
|
322
|
+
this.transientScrollOffsetY += (e.movementY / this.viewportHeight) * state.tableHeight
|
|
323
|
+
if (this.isScrolling) {
|
|
324
|
+
return
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
this.isScrolling = true
|
|
328
|
+
window.requestAnimationFrame(() => {
|
|
329
|
+
this.scrollBy(undefined, this.transientScrollOffsetY) // 仅滚动垂直方向
|
|
330
|
+
this.isScrolling = false
|
|
331
|
+
this.transientScrollOffsetY = 0
|
|
332
|
+
})
|
|
333
|
+
},
|
|
334
|
+
onThumbMouseUpY() {
|
|
335
|
+
document.body.style.removeProperty('cursor')
|
|
336
|
+
document.removeEventListener('mousemove', this.onThumbDragY)
|
|
337
|
+
document.removeEventListener('mouseup', this.onThumbMouseUpY)
|
|
338
|
+
this.isScrolling = false
|
|
339
|
+
if (this.transientScrollOffsetY > 0) {
|
|
340
|
+
this.scrollBy(undefined, this.transientScrollOffsetY)
|
|
341
|
+
}
|
|
342
|
+
this.transientScrollOffsetY = 0
|
|
343
|
+
},
|
|
344
|
+
onThumbMouseDownX(e) {
|
|
345
|
+
e.preventDefault()
|
|
346
|
+
e.stopPropagation()
|
|
347
|
+
document.body.style.setProperty('cursor', 'grabbing', 'important')
|
|
348
|
+
document.addEventListener('mousemove', this.onThumbDragX)
|
|
349
|
+
document.addEventListener('mouseup', this.onThumbMouseUpX)
|
|
350
|
+
},
|
|
351
|
+
onThumbDragX(e) {
|
|
352
|
+
e.stopPropagation()
|
|
353
|
+
e.preventDefault()
|
|
354
|
+
const state = this.getState()
|
|
355
|
+
// 仅处理垂直滚动
|
|
356
|
+
this.transientScrollOffsetX += (e.movementX / this.viewportWidth) * state.tableWidth
|
|
357
|
+
if (this.isScrolling) {
|
|
358
|
+
return
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
this.isScrolling = true
|
|
362
|
+
window.requestAnimationFrame(() => {
|
|
363
|
+
this.scrollBy(this.transientScrollOffsetX, undefined) // 仅滚动水平方向
|
|
364
|
+
this.isScrolling = false
|
|
365
|
+
this.transientScrollOffsetX = 0
|
|
366
|
+
})
|
|
367
|
+
},
|
|
368
|
+
onThumbMouseUpX() {
|
|
369
|
+
document.body.style.removeProperty('cursor')
|
|
370
|
+
document.removeEventListener('mousemove', this.onThumbDragX)
|
|
371
|
+
document.removeEventListener('mouseup', this.onThumbMouseUpX)
|
|
372
|
+
this.isScrolling = false
|
|
373
|
+
if (this.transientScrollOffsetX > 0) {
|
|
374
|
+
this.scrollBy(this.transientScrollOffsetX, undefined)
|
|
375
|
+
}
|
|
376
|
+
this.transientScrollOffsetX = 0
|
|
377
|
+
},
|
|
378
|
+
onTrackMouseMoveY(e) {
|
|
379
|
+
e.preventDefault()
|
|
380
|
+
},
|
|
381
|
+
onTrackMouseMoveX(e) {
|
|
382
|
+
e.preventDefault()
|
|
383
|
+
},
|
|
384
|
+
// 滚动到指定的top值
|
|
385
|
+
scrollToTop(scrollTop = 0) {
|
|
386
|
+
const state = this.getState()
|
|
387
|
+
const relativeOffset = (scrollTop / this.viewportHeight) * state.tableHeight
|
|
388
|
+
this.setScrollOffsetY(relativeOffset)
|
|
389
|
+
this.renderViewportRows()
|
|
390
|
+
},
|
|
391
|
+
onTrackMouseDownY(e) {
|
|
392
|
+
e.preventDefault()
|
|
393
|
+
this.scrollToTop(e.offsetY - this.headerTotalHeight) // 仅滚动垂直方向
|
|
394
|
+
},
|
|
395
|
+
onTrackMouseDownX(e) {
|
|
396
|
+
e.preventDefault()
|
|
397
|
+
this.scrollToLeft(e.offsetX, false) // 仅滚动水平方向
|
|
398
|
+
},
|
|
399
|
+
// 滚动到指定的left值
|
|
400
|
+
scrollToLeft(scrollLeft = 0, createHeader = true) {
|
|
401
|
+
const state = this.getState()
|
|
402
|
+
const relativeOffset = (scrollLeft / this.viewportWidth) * state.tableWidth
|
|
403
|
+
createHeader && this.createHeader()
|
|
404
|
+
this.setScrollOffsetX(relativeOffset)
|
|
405
|
+
this.renderViewportCells()
|
|
406
|
+
},
|
|
407
|
+
translateThumbY(offset) {
|
|
408
|
+
this.$refs.thumbY.style.transform = `translateY(${offset + this.headerTotalHeight}px)`
|
|
409
|
+
},
|
|
410
|
+
translateThumbX(offset) {
|
|
411
|
+
if (this.$refs.thumbX) {
|
|
412
|
+
this.$refs.thumbX.style.transform = `translateX(${offset}px)`
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
setThumbSizeY(height) {
|
|
416
|
+
// const _height = height < 0 ? 60 : height
|
|
417
|
+
// TODO 数据超出太多时,此时的滑块高度为负数,需要处理极致情况。
|
|
418
|
+
this.$refs.thumbY.style.height = `${height}px`
|
|
419
|
+
},
|
|
420
|
+
setThumbSizeX(width) {
|
|
421
|
+
this.$refs.thumbX.style.width = `${width}px`
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取元素的 transform 属性值
|
|
3
|
+
* @param {HTMLElement} element - 需要获取 transform 的元素
|
|
4
|
+
* @param {*} element
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
function getMatrixTransform (element) {
|
|
8
|
+
const computedStyle = window.getComputedStyle(element)
|
|
9
|
+
const transformValue = computedStyle.transform
|
|
10
|
+
|
|
11
|
+
if (transformValue && transformValue!== 'none') {
|
|
12
|
+
const matrix = new DOMMatrix(transformValue)
|
|
13
|
+
return matrix.m42
|
|
14
|
+
}
|
|
15
|
+
return 0
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
computed: {
|
|
20
|
+
useStretchFeature() {
|
|
21
|
+
return this.$props.stretchEnabled && !!this.$props.scrollY && this.isHasOffsetY
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
// 是否正在拖动
|
|
27
|
+
isDragging: false,
|
|
28
|
+
// 记录手指开始触摸时的Y坐标
|
|
29
|
+
startY: 0,
|
|
30
|
+
startTime: 0,
|
|
31
|
+
// 当前的translateY值
|
|
32
|
+
currentTranslateY: 0,
|
|
33
|
+
maxTranslateY: 120,
|
|
34
|
+
isMoving: false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
/**
|
|
39
|
+
* 触摸开始事件处理
|
|
40
|
+
* @param {*} event
|
|
41
|
+
*/
|
|
42
|
+
containerHandleTouchStart(event) {
|
|
43
|
+
if (!this.useStretchFeature) return
|
|
44
|
+
// const touch = event.changedTouches[0]
|
|
45
|
+
this.startY = event.touches[0].clientY
|
|
46
|
+
this.startTime = Date.now()
|
|
47
|
+
this.isMoving = true
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* 仅 y 轴滚动执行
|
|
51
|
+
* @param {*} event
|
|
52
|
+
*/
|
|
53
|
+
containerHandleTouchMove(event) {
|
|
54
|
+
if (!this.useStretchFeature || !this.isMoving) return
|
|
55
|
+
|
|
56
|
+
// const touch = event.changedTouches[0]
|
|
57
|
+
const currentY = event.touches[0].clientY
|
|
58
|
+
const distance = this.startY - currentY
|
|
59
|
+
|
|
60
|
+
// 滚动到底部执行(滚动偏移量 = 表格高度 - 可视口高度)
|
|
61
|
+
if (this.offsetY === (this.state.tableHeight - this.viewportHeight) && distance > 0) {
|
|
62
|
+
|
|
63
|
+
const currentTime = Date.now()
|
|
64
|
+
const duration = currentTime - this.startTime
|
|
65
|
+
|
|
66
|
+
// 计算速度(距离差/时间差)
|
|
67
|
+
const speed = distance / duration
|
|
68
|
+
|
|
69
|
+
// 计算阻尼系数,越接近最大偏移距离阻尼越大
|
|
70
|
+
let damping = 1
|
|
71
|
+
const container = this.$refs.container
|
|
72
|
+
const currentTranslateY = getMatrixTransform(container)
|
|
73
|
+
const remainingDistance = this.maxTranslateY - currentTranslateY
|
|
74
|
+
damping = remainingDistance / this.maxTranslateY
|
|
75
|
+
|
|
76
|
+
// 计算新的 translateY
|
|
77
|
+
let newTranslateY = currentTranslateY + (distance * speed * damping)
|
|
78
|
+
newTranslateY = Math.min(newTranslateY, this.maxTranslateY)
|
|
79
|
+
newTranslateY = Math.max(newTranslateY, 0)
|
|
80
|
+
|
|
81
|
+
container.style.transform = `translateY(${-newTranslateY}px)`
|
|
82
|
+
container.style.transition = 'transform 0.2s ease'
|
|
83
|
+
} else {
|
|
84
|
+
// 如果没有到达底部,重置 translateY
|
|
85
|
+
this.resetStretch()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* 松开手势时 清空动画数据
|
|
90
|
+
* @param {*} event
|
|
91
|
+
*/
|
|
92
|
+
containerHandleTouchEnd(event) {
|
|
93
|
+
|
|
94
|
+
if (!this.useStretchFeature) return
|
|
95
|
+
|
|
96
|
+
this.resetStretch()
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* 重置各种参数
|
|
100
|
+
*/
|
|
101
|
+
resetStretch () {
|
|
102
|
+
|
|
103
|
+
this.isMoving = false
|
|
104
|
+
this.startY = 0
|
|
105
|
+
this.startTime = 0
|
|
106
|
+
|
|
107
|
+
const container = this.$refs.container
|
|
108
|
+
container.style.transform = 'translateY(0px)'
|
|
109
|
+
container.style.transition = 'transform 0.3s ease'
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
.pe-table-cell {
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: 0;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
font-size: 13PX;
|
|
8
|
+
padding: 0 8PX;
|
|
9
|
+
height: 100%;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
background-color: transparent;
|
|
12
|
+
// transform: translateZ(0);
|
|
13
|
+
// will-change: transform; 单元格会发生偏移
|
|
14
|
+
}
|
|
15
|
+
.ks-multi-screen .pe-table-cell {
|
|
16
|
+
font-size: 14PX !important;
|
|
17
|
+
}
|
|
18
|
+
.pe-table-cell::after {
|
|
19
|
+
content: '';
|
|
20
|
+
position: absolute;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 1px;
|
|
25
|
+
background-color: #F1F1F1;
|
|
26
|
+
transform-origin: bottom;
|
|
27
|
+
transform: scaleY(0.5);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pe-table-cell.overflow span {
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
text-overflow: ellipsis;
|
|
34
|
+
}
|
|
35
|
+
.pe-table-cell_label {
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
.pe-table-cell.right .pe-table-cell_label {
|
|
39
|
+
text-align: right;
|
|
40
|
+
}
|
|
41
|
+
.pe-table-cell.left .pe-table-cell_label {
|
|
42
|
+
text-align: left;
|
|
43
|
+
}
|
|
44
|
+
.pe-table-cell.center .pe-table-cell_label {
|
|
45
|
+
text-align: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.pe-table-cell.collapse-bg {
|
|
49
|
+
// background: rgba(21, 88, 202, 0.04);
|
|
50
|
+
background-color: #F8FAFD;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.pe-table-scrolling__x {
|
|
54
|
+
.pe-table-cell__last-fixed {
|
|
55
|
+
// border-right: none;
|
|
56
|
+
box-shadow: 4px 0 6px -4px rgba(28, 32, 35, 0.1);
|
|
57
|
+
// background-color: #fff;
|
|
58
|
+
}
|
|
59
|
+
.pe-table-cell__fixed {
|
|
60
|
+
background-color: #fff;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.pe-table-header_cell[data-cellkey="$index"] {
|
|
65
|
+
padding-right: 4PX;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
}
|
|
68
|
+
.pe-table-cell[data-cellkey="$index"] {
|
|
69
|
+
padding-right: 4PX;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
font-size: 12PX;
|
|
72
|
+
}
|
|
73
|
+
.ks-multi-screen {
|
|
74
|
+
.pe-table-cell[data-cellkey="$index"] {
|
|
75
|
+
font-size: 13PX;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
.pe-table-show-index {
|
|
79
|
+
.pe-table-cell[data-cellkey="name"] {
|
|
80
|
+
padding-left: 0;
|
|
81
|
+
padding-right: 2PX;
|
|
82
|
+
.collect-icon-area {
|
|
83
|
+
margin-left: -12PX;
|
|
84
|
+
.collect-icon-wrap {
|
|
85
|
+
padding-left: 8PX;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.pe-table-empty {
|
|
2
|
+
display: flex;
|
|
3
|
+
width: 100PX;
|
|
4
|
+
// height: 118PX;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
align-items: center;
|
|
8
|
+
position: absolute;
|
|
9
|
+
// top: 40PX;
|
|
10
|
+
left: 50%;
|
|
11
|
+
transform: translateX(-50%)
|
|
12
|
+
}
|
|
13
|
+
.pe-table-empty_label {
|
|
14
|
+
margin-top: 12PX;
|
|
15
|
+
color: #888B92;
|
|
16
|
+
font-size: 13PX;
|
|
17
|
+
line-height: 1;
|
|
18
|
+
}
|
|
19
|
+
.pe-table-empty_bg {
|
|
20
|
+
width: 100PX;
|
|
21
|
+
height: 80PX;
|
|
22
|
+
background: url('../images/empty.png');
|
|
23
|
+
background-size: contain;
|
|
24
|
+
}
|
|
25
|
+
.abnormal {
|
|
26
|
+
width: 130PX;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: center;
|
|
30
|
+
.abnormal-img {
|
|
31
|
+
width: 108PX;
|
|
32
|
+
height: 69PX;
|
|
33
|
+
margin-bottom: 10PX;
|
|
34
|
+
font-size: 0;
|
|
35
|
+
background: url('../images/abnormal.png');
|
|
36
|
+
background-size: 108PX 69PX;
|
|
37
|
+
background-repeat: no-repeat;
|
|
38
|
+
}
|
|
39
|
+
.abnormal-desc {
|
|
40
|
+
margin-bottom: 8PX;
|
|
41
|
+
font-size: 12PX;
|
|
42
|
+
font-weight: normal;
|
|
43
|
+
line-height: 18PX;
|
|
44
|
+
text-align: center;
|
|
45
|
+
letter-spacing: 0em;
|
|
46
|
+
color: #888B92;
|
|
47
|
+
}
|
|
48
|
+
}
|