- | alignPoint |
- bool |
- false |
- Popup will align with mouse position (support action of 'click', 'hover' and 'contextMenu') |
-
-
- | popupClassName |
- string |
- |
- additional className added to popup |
-
-
- | forceRender |
- boolean |
- false |
- whether render popup before first show |
-
-
- | destroyPopupOnHide |
- boolean |
- false |
- whether destroy popup when hide |
+ items |
+ T[] |
+ [] |
+ 列表数据源,虚拟滚动会基于此计算高度。 |
- | getPopupClassNameFromAlign |
- getPopupClassNameFromAlign(align: Object):String |
- |
- additional className added to popup according to align |
+ rowKey |
+ React.Key | (item: T) => React.Key |
+ required |
+ 返回每一项的唯一标识,用于缓存高度与滚动定位。 |
- | action |
- string[] |
- ['hover'] |
- which actions cause popup shown. enum of 'hover','click','focus','contextMenu' |
+ itemRender |
+ (item: T, index: number) => React.ReactNode |
+ required |
+ 渲染单行内容的函数。 |
- | mouseEnterDelay |
+ height |
number |
- 0 |
- delay time to show when mouse enter. unit: s. |
+ required |
+ 列表可视区域高度。 |
- | mouseLeaveDelay |
+ itemHeight |
number |
- 0.1 |
- delay time to hide when mouse leave. unit: s. |
+ required |
+ 每行的基础高度,虚拟滚动会以此做初始估算。 |
- | popupStyle |
- Object |
+ group |
+ Group<T> |
|
- additional style of popup |
+ 提供分组 key 与标题渲染,开启后会生成组头。 |
- | prefixCls |
- String |
- rc-trigger-popup |
- prefix class name |
-
-
- | popupTransitionName |
- String|Object |
- |
- https://github.com/react-component/animate |
-
-
- | maskTransitionName |
- String|Object |
- |
- https://github.com/react-component/animate |
-
-
- | onPopupVisibleChange |
- Function |
- |
- call when popup visible is changed |
-
-
- | mask |
+ sticky |
boolean |
false |
- whether to support mask |
+ 为分组头启用粘性悬停效果。 |
- | maskClosable |
+ virtual |
boolean |
true |
- whether to support click mask to hide |
+ 是否启用虚拟列表模式,可根据需要关闭。 |
- | popupVisible |
- boolean |
+ onEndReached |
+ () => void |
|
- whether popup is visible |
+ 滚动触达底部时触发,常用于触发下一页加载。 |
- | zIndex |
- number |
- |
- popup's zIndex |
-
-
- | defaultPopupVisible |
- boolean |
- |
- whether popup is visible initially |
-
-
- | popupAlign |
- Object: alignConfig of [dom-align](https://github.com/yiminghe/dom-align) |
- |
- popup 's align config |
-
-
- | onPopupAlign |
- function(popupDomNode, align) |
- |
- callback when popup node is aligned |
-
-
- | popup |
- React.Element | function() => React.Element |
- |
- popup content |
-
-
- | getPopupContainer |
- getPopupContainer(): HTMLElement |
- |
- function returning html node which will act as popup container |
-
-
- | getDocument |
- getDocument(): HTMLElement |
- |
- function returning document node which will be attached click event to close trigger |
-
-
- | popupPlacement |
- string |
- |
- use preset popup align config from builtinPlacements, can be merged by popupAlign prop |
-
-
- | builtinPlacements |
- object |
- |
- builtin placement align map. used by placement prop |
-
-
- | stretch |
+ prefixCls |
string |
- |
- Let popup div stretch with trigger element. enums of 'width', 'minWidth', 'height', 'minHeight'. (You can also mixed with 'height minWidth') |
+ rc-listy |
+ 组件样式前缀,方便自定义样式隔离。 |
+### ListyRef
+
+- `scrollTo(config: number | { key?: React.Key; index?: number; align?: 'top' | 'bottom' | 'auto'; offset?: number; } | { groupKey: React.Key; align?: 'top' | 'bottom' | 'auto'; offset?: number; })`
+ - 传入 `groupKey` 时会直接滚动到对应组头(需启用 `group`)
+
## Test Case
```
@@ -255,4 +167,4 @@ open coverage/ dir
## License
-rc-trigger is released under the MIT license.
+@rc-component/listy is released under the MIT license.
diff --git a/assets/index.less b/assets/index.less
new file mode 100644
index 0000000..e13a1ce
--- /dev/null
+++ b/assets/index.less
@@ -0,0 +1,25 @@
+@listy-prefix-cls: ~'rc-listy';
+
+.@{listy-prefix-cls} {
+ position: relative;
+
+ &-group-header {
+ background-color: #fff;
+
+ &-sticky {
+ position: sticky;
+ top: 0;
+ left: 0;
+ right: 0;
+ }
+ }
+
+ &-sticky-header {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ transform: translateY(0);
+ background-color: #fff;
+ }
+}
diff --git a/docs/demos/basic.md b/docs/demos/basic.md
new file mode 100644
index 0000000..824c331
--- /dev/null
+++ b/docs/demos/basic.md
@@ -0,0 +1,8 @@
+---
+title: Basic
+nav:
+ title: Demo
+ path: /demo
+---
+
+