@pixui-dev/pixui-react-virtualwaterfall
Advanced tools
+1
-1
| { | ||
| "name": "@pixui-dev/pixui-react-virtualwaterfall", | ||
| "version": "1.0.7", | ||
| "version": "1.0.8", | ||
| "description": "pixui 高性能React虚拟瀑布流组件", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
+4
-0
@@ -134,2 +134,3 @@ # VirtualWaterfallList 虚拟瀑布流组件 | ||
| | getScrollTop | - | number | 获取当前滚动位置 | | ||
| | scrollTo | (scrollLeft: number, scrollTop: number) | void | 设定滚动距离 | | ||
| | updateItemByIndex | (index: number, item: any) | void | 更新指定索引的项目数据 | | ||
@@ -1000,2 +1001,5 @@ | removeItemByIndex | (index: number) | void | 删除指定索引的项目 | | ||
| ### 1.0.8 | ||
| 1. 添加 scrollTo 方法 | ||
| ### 1.0.7 | ||
@@ -1002,0 +1006,0 @@ 1. 添加可选参数 contentStyle,用于自定义内容容器样式。可用于适配 em、rem 或 用户定制的样式方式。 |
@@ -447,2 +447,8 @@ import { h, Component, JSX } from 'preact'; | ||
| /** | ||
| * 滚动到指定位置 | ||
| * @param {number} scrollLeft - 滚动到距离左侧的位置 | ||
| * @param {number} scrollTop - 滚动到距离上方的位置 | ||
| */ | ||
| scrollTo(scrollLeft: number, scrollTop: number): void; | ||
| /** | ||
| * 更新指定索引的项目 | ||
@@ -449,0 +455,0 @@ * @param {number} index - 要更新的项目索引 |
@@ -522,2 +522,16 @@ var __extends = (this && this.__extends) || (function () { | ||
| /** | ||
| * 滚动到指定位置 | ||
| * @param {number} scrollLeft - 滚动到距离左侧的位置 | ||
| * @param {number} scrollTop - 滚动到距离上方的位置 | ||
| */ | ||
| VirtualWaterfall.prototype.scrollTo = function (scrollLeft, scrollTop) { | ||
| var _a, _b, _c, _d; | ||
| if (((_a = this.containerRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) !== undefined && ((_b = this.containerRef.current) === null || _b === void 0 ? void 0 : _b.scrollLeft) !== scrollLeft) { | ||
| this.containerRef.current.scrollLeft = scrollLeft; | ||
| } | ||
| if (((_c = this.containerRef.current) === null || _c === void 0 ? void 0 : _c.scrollTop) !== undefined && ((_d = this.containerRef.current) === null || _d === void 0 ? void 0 : _d.scrollTop) !== scrollTop) { | ||
| this.containerRef.current.scrollTop = scrollTop; | ||
| } | ||
| }; | ||
| /** | ||
| * 更新指定索引的项目 | ||
@@ -1051,5 +1065,3 @@ * @param {number} index - 要更新的项目索引 | ||
| return (h("div", { ref: this.containerRef, id: this.props.rootId || 'VirtualWaterfallRoot', className: this.props.rootClassName || 'VirtualWaterfallRoot', style: __assign({ height: "".concat(containerHeight, "px"), overflow: 'scroll', position: 'relative' }, this.props.rootStyle), "movement-type": scrollProps.movementType, "scroll-sensitivity": scrollProps.scrollSensitivity, "inertia-version": scrollProps.inertiaVersion, "deceleration-rate": scrollProps.decelerationRate, "static-velocity-drag": scrollProps.staticVelocityDrag, "friction-coefficient": scrollProps.frictionCoefficient, onScroll: this.handleScroll }, | ||
| h("div", { ref: this.contentRef, id: 'VirtualWaterfallContent', className: 'VirtualWaterfallContent', style: __assign({ display: 'flex', flexShrink: 0, position: 'relative', width: "".concat(containerWidth, "px"), height: "".concat(totalContentHeight, "px") }, this.props.contentStyle), onTouchMove: function (e) { | ||
| console.log('onTouchMove', e.touches[0].clientY); | ||
| } }, | ||
| h("div", { ref: this.contentRef, id: 'VirtualWaterfallContent', className: 'VirtualWaterfallContent', style: __assign({ display: 'flex', flexShrink: 0, position: 'relative', width: "".concat(containerWidth, "px"), height: "".concat(totalContentHeight, "px") }, this.props.contentStyle) }, | ||
| this.props.renderPullDownArea && (h("div", { style: { position: 'absolute', bottom: '100%', left: '0', width: '100%', } }, this.props.renderPullDownArea())), | ||
@@ -1056,0 +1068,0 @@ this.waterfallItems.map(function (item) { return item.vNode; }), |
108134
1.04%1732
1.05%1014
0.4%