@nutui/nutui-react-taro 2.0.0-alpha.11 → 2.0.0-alpha.12
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/CHANGELOG.md +14 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +1 -3
- package/dist/esm/CountDown/style/style.css +1 -1
- package/dist/esm/CountDown.js +2 -3
- package/dist/esm/Ellipsis/style/style.css +1 -1
- package/dist/esm/Ellipsis.js +1 -1
- package/dist/esm/SearchBar/style/style.css +1 -1
- package/dist/esm/SearchBar.js +1 -4
- package/dist/esm/ShortPassword/style/style.css +1 -1
- package/dist/esm/ShortPassword.js +3 -4
- package/dist/esm/Toast/style/style.css +1 -1
- package/dist/esm/Toast.js +2 -3
- package/dist/esm/VirtualList/style/style.css +1 -1
- package/dist/esm/VirtualList.js +2 -2
- package/dist/esm/actionsheet.taro-697a594b.js +54 -0
- package/dist/esm/{countdown.taro-22200811.js → countdown.taro-c399cc08.js} +17 -10
- package/dist/esm/{ellipsis.taro-02765890.js → ellipsis.taro-f423affa.js} +13 -6
- package/dist/esm/nutui-react.es.js +7 -7
- package/dist/esm/searchbar.taro-09468fff.js +122 -0
- package/dist/esm/shortpassword.taro-eabbde1b.js +90 -0
- package/dist/esm/toast.taro-b2937e7c.js +171 -0
- package/dist/esm/types/src/packages/actionsheet/actionsheet.d.ts +11 -15
- package/dist/esm/types/src/packages/actionsheet/actionsheet.taro.d.ts +11 -15
- package/dist/esm/types/src/packages/actionsheet/index.d.ts +1 -0
- package/dist/esm/types/src/packages/actionsheet/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/configprovider.d.ts +2 -1
- package/dist/esm/types/src/packages/configprovider/configprovider.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/configprovider/index.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -0
- package/dist/esm/types/src/packages/countdown/countdown.d.ts +5 -4
- package/dist/esm/types/src/packages/countdown/countdown.taro.d.ts +5 -4
- package/dist/esm/types/src/packages/countdown/index.d.ts +1 -0
- package/dist/esm/types/src/packages/countdown/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/ellipsis/ellipsis.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/index.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +4 -31
- package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +4 -31
- package/dist/esm/types/src/packages/shortpassword/index.d.ts +1 -0
- package/dist/esm/types/src/packages/shortpassword/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +17 -20
- package/dist/esm/types/src/packages/shortpassword/shortpassword.taro.d.ts +17 -20
- package/dist/esm/types/src/packages/toast/Notification.d.ts +9 -13
- package/dist/esm/types/src/packages/toast/index.d.ts +1 -0
- package/dist/esm/types/src/packages/toast/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/toast/toast.d.ts +19 -26
- package/dist/esm/types/src/packages/toast/toast.taro.d.ts +9 -11
- package/dist/esm/types/src/packages/virtuallist/index.d.ts +1 -0
- package/dist/esm/types/src/packages/virtuallist/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/virtuallist/type.d.ts +0 -18
- package/dist/esm/types/src/packages/virtuallist/utils.d.ts +3 -3
- package/dist/esm/types/src/packages/virtuallist/virtuallist.d.ts +15 -4
- package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +13 -14
- package/dist/esm/{virtuallist.taro-99f03769.js → virtuallist.taro-97d3403a.js} +27 -30
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +10 -2
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +393 -422
- package/dist/nutui.react.umd.js +393 -422
- package/dist/packages/actionsheet/actionsheet.scss +26 -73
- package/dist/packages/countdown/countdown.scss +2 -0
- package/dist/packages/ellipsis/ellipsis.scss +4 -0
- package/dist/packages/searchbar/searchbar.scss +13 -71
- package/dist/packages/shortpassword/shortpassword.scss +1 -88
- package/dist/packages/toast/toast.scss +20 -7
- package/dist/packages/virtuallist/virtuallist.scss +0 -12
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +56 -60
- package/dist/styles/variables.scss +30 -53
- package/dist/types/packages/actionsheet/actionsheet.taro.d.ts +11 -15
- package/dist/types/packages/actionsheet/index.taro.d.ts +1 -0
- package/dist/types/packages/configprovider/configprovider.d.ts +2 -1
- package/dist/types/packages/configprovider/configprovider.taro.d.ts +2 -1
- package/dist/types/packages/configprovider/index.d.ts +1 -0
- package/dist/types/packages/configprovider/index.taro.d.ts +1 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -0
- package/dist/types/packages/countdown/countdown.taro.d.ts +5 -4
- package/dist/types/packages/countdown/index.taro.d.ts +1 -0
- package/dist/types/packages/ellipsis/ellipsis.taro.d.ts +1 -0
- package/dist/types/packages/overlay/index.d.ts +3 -0
- package/dist/types/packages/overlay/overlay.d.ts +14 -0
- package/dist/types/packages/searchbar/index.taro.d.ts +1 -0
- package/dist/types/packages/searchbar/searchbar.taro.d.ts +4 -31
- package/dist/types/packages/shortpassword/index.taro.d.ts +1 -0
- package/dist/types/packages/shortpassword/shortpassword.taro.d.ts +17 -20
- package/dist/types/packages/toast/index.taro.d.ts +1 -0
- package/dist/types/packages/toast/toast.taro.d.ts +9 -11
- package/dist/types/packages/virtuallist/index.taro.d.ts +1 -0
- package/dist/types/packages/virtuallist/type.d.ts +0 -17
- package/dist/types/packages/virtuallist/utils.d.ts +3 -3
- package/dist/types/packages/virtuallist/virtuallist.taro.d.ts +13 -14
- package/package.json +1 -1
- package/dist/esm/actionsheet.taro-d2217152.js +0 -61
- package/dist/esm/searchbar.taro-37ade36e.js +0 -159
- package/dist/esm/shortpassword.taro-f7292032.js +0 -146
- package/dist/esm/toast.taro-92c10e1d.js +0 -114
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
export interface ShortPasswordProps extends
|
|
4
|
-
|
|
5
|
-
description: string;
|
|
6
|
-
tips: string;
|
|
7
|
-
tipsIcon: React.ReactNode;
|
|
8
|
-
iconSize: string | number;
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { PopupProps } from '../popup/popup';
|
|
3
|
+
export interface ShortPasswordProps extends PopupProps {
|
|
4
|
+
value: string;
|
|
9
5
|
visible: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
autoFocus
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
plain: boolean;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description: ReactNode;
|
|
9
|
+
tips: ReactNode;
|
|
10
|
+
hideFooter: boolean;
|
|
11
|
+
length: number;
|
|
12
|
+
error: ReactNode;
|
|
13
|
+
autoFocus: boolean;
|
|
14
|
+
onFocus: () => void;
|
|
15
|
+
onChange: (value: string) => void;
|
|
16
|
+
onConfirm: (value: string) => void;
|
|
20
17
|
onCancel: () => void;
|
|
21
18
|
onClose: () => void;
|
|
22
19
|
onTips: () => void;
|
|
23
|
-
onComplete: (value: string
|
|
20
|
+
onComplete: (value: string) => void;
|
|
24
21
|
}
|
|
25
|
-
export declare const ShortPassword: FunctionComponent<Partial<ShortPasswordProps
|
|
22
|
+
export declare const ShortPassword: FunctionComponent<Partial<ShortPasswordProps>>;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
export interface ShortPasswordProps extends
|
|
4
|
-
|
|
5
|
-
description: string;
|
|
6
|
-
tips: string;
|
|
7
|
-
tipsIcon: React.ReactNode;
|
|
8
|
-
iconSize: string | number;
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { PopupProps } from '@/packages/popup/popup.taro';
|
|
3
|
+
export interface ShortPasswordProps extends PopupProps {
|
|
4
|
+
value: string;
|
|
9
5
|
visible: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
autoFocus
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
plain: boolean;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
description: ReactNode;
|
|
9
|
+
tips: ReactNode;
|
|
10
|
+
hideFooter: boolean;
|
|
11
|
+
length: number;
|
|
12
|
+
error: ReactNode;
|
|
13
|
+
autoFocus: boolean;
|
|
14
|
+
onFocus: () => void;
|
|
15
|
+
onChange: (value: string) => void;
|
|
16
|
+
onConfirm: (value: string) => void;
|
|
20
17
|
onCancel: () => void;
|
|
21
18
|
onClose: () => void;
|
|
22
19
|
onTips: () => void;
|
|
23
|
-
onComplete: (value: string
|
|
20
|
+
onComplete: (value: string) => void;
|
|
24
21
|
}
|
|
25
|
-
export declare const ShortPassword: FunctionComponent<Partial<ShortPasswordProps
|
|
22
|
+
export declare const ShortPassword: FunctionComponent<Partial<ShortPasswordProps>>;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { BasicComponent } from '@/utils/typings';
|
|
3
|
+
export interface NotificationProps extends BasicComponent {
|
|
3
4
|
id?: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
msg: string | React.ReactNode;
|
|
7
|
-
bottom: string;
|
|
5
|
+
icon: 'success' | 'fail' | 'loading' | 'warn' | React.ReactNode;
|
|
6
|
+
content: string | React.ReactNode;
|
|
8
7
|
duration: number;
|
|
9
|
-
center
|
|
10
|
-
type: string;
|
|
8
|
+
position?: 'top' | 'center' | 'bottom';
|
|
11
9
|
title: string;
|
|
12
|
-
customClass: string;
|
|
13
10
|
size: string | number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
coverColor: string;
|
|
18
|
-
closeOnClickOverlay: boolean;
|
|
11
|
+
closeOnOverlayClick: boolean;
|
|
12
|
+
contentClassName?: string;
|
|
13
|
+
contentStyle?: React.CSSProperties;
|
|
19
14
|
onClose: () => void;
|
|
20
15
|
}
|
|
21
16
|
export default class Notification extends React.PureComponent<NotificationProps> {
|
|
@@ -26,6 +21,7 @@ export default class Notification extends React.PureComponent<NotificationProps>
|
|
|
26
21
|
startCloseTimer(): void;
|
|
27
22
|
clearCloseTimer(): void;
|
|
28
23
|
clickCover(): void;
|
|
24
|
+
renderIcon(): number | boolean | React.ReactFragment | JSX.Element | null | undefined;
|
|
29
25
|
componentDidMount(): void;
|
|
30
26
|
componentWillUnmount(): void;
|
|
31
27
|
render(): JSX.Element;
|
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { BasicComponent } from '@/utils/typings';
|
|
3
|
+
export type ToastPositionType = 'top' | 'bottom' | 'center';
|
|
4
|
+
export type ToastIconType = 'success' | 'fail' | 'loading' | 'warn' | React.ReactNode;
|
|
5
|
+
export interface ToastProps extends BasicComponent {
|
|
3
6
|
id?: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
iconSize: string;
|
|
15
|
-
textAlignCenter: boolean;
|
|
16
|
-
loadingRotate: boolean;
|
|
17
|
-
bgColor: string;
|
|
18
|
-
onClose: () => void;
|
|
19
|
-
cover: boolean;
|
|
20
|
-
coverColor: string;
|
|
21
|
-
closeOnClickOverlay: boolean;
|
|
7
|
+
duration?: number;
|
|
8
|
+
position?: ToastPositionType;
|
|
9
|
+
title?: string;
|
|
10
|
+
closeOnOverlayClick?: boolean;
|
|
11
|
+
size?: string | number;
|
|
12
|
+
icon?: ToastIconType;
|
|
13
|
+
content?: React.ReactNode;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
contentClassName?: string;
|
|
16
|
+
contentStyle?: React.CSSProperties;
|
|
22
17
|
}
|
|
18
|
+
declare function show(option: ToastProps | string): void;
|
|
19
|
+
declare function config(config: Pick<ToastProps, 'duration' | 'position' | 'closeOnOverlayClick'>): void;
|
|
23
20
|
declare const _default: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
loading(msg: string | React.ReactNode, option?: {}): void;
|
|
28
|
-
warn(msg: string | React.ReactNode, option?: {}): void;
|
|
29
|
-
customIcon(msg: string | React.ReactNode, option?: {}): void;
|
|
30
|
-
hide(): void;
|
|
21
|
+
show: typeof show;
|
|
22
|
+
config: typeof config;
|
|
23
|
+
clear(): void;
|
|
31
24
|
};
|
|
32
25
|
export default _default;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
|
|
2
|
+
import { BasicComponent } from '@/utils/typings';
|
|
3
|
+
export type ToastPositionType = 'top' | 'bottom' | 'center';
|
|
4
|
+
export interface ToastProps extends BasicComponent {
|
|
3
5
|
id?: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
maskClassName?: string;
|
|
7
|
+
contentClassName?: string;
|
|
8
|
+
contentStyle?: React.CSSProperties;
|
|
9
|
+
icon: string | React.ReactNode;
|
|
6
10
|
iconSize: string;
|
|
7
11
|
msg: string | React.ReactNode;
|
|
8
|
-
bottom: number | string;
|
|
9
12
|
duration: number;
|
|
10
|
-
|
|
13
|
+
position?: ToastPositionType;
|
|
11
14
|
type: string;
|
|
12
15
|
title: string;
|
|
13
|
-
|
|
16
|
+
closeOnOverlayClick: boolean;
|
|
14
17
|
size: string | number;
|
|
15
|
-
textAlignCenter: boolean;
|
|
16
|
-
bgColor: string;
|
|
17
|
-
cover: boolean;
|
|
18
|
-
coverColor: string;
|
|
19
|
-
closeOnClickOverlay: boolean;
|
|
20
18
|
visible: boolean;
|
|
21
19
|
onClose: () => void;
|
|
22
20
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export type Data = any;
|
|
3
2
|
export interface VirtualListState {
|
|
4
3
|
startOffset: number;
|
|
@@ -15,20 +14,3 @@ export interface PositionType {
|
|
|
15
14
|
left?: number;
|
|
16
15
|
right: number;
|
|
17
16
|
}
|
|
18
|
-
export interface BasicVirtualListProps {
|
|
19
|
-
className?: string;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
|
-
sourceData: Array<Data>;
|
|
22
|
-
containerSize?: number;
|
|
23
|
-
ItemRender?: React.FC<any>;
|
|
24
|
-
itemSize?: number;
|
|
25
|
-
itemEqualSize?: boolean;
|
|
26
|
-
horizontal?: boolean;
|
|
27
|
-
overscan?: number;
|
|
28
|
-
handleScroll?: (...args: any[]) => any;
|
|
29
|
-
onScroll?: (...args: any[]) => any;
|
|
30
|
-
key?: string;
|
|
31
|
-
locale?: {
|
|
32
|
-
[key in string]: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -2,11 +2,11 @@ import { PositionType, Data } from './type';
|
|
|
2
2
|
declare const initPositinoCache: (reaItemSize: number, length?: number) => PositionType[];
|
|
3
3
|
declare const getListTotalSize: (positions: Array<PositionType>, horizontal: true | false) => number;
|
|
4
4
|
declare const binarySearch: (positionsList: Array<PositionType>, value: number | undefined, horizontal: true | false) => number;
|
|
5
|
-
declare const getEndIndex: ({
|
|
6
|
-
|
|
5
|
+
declare const getEndIndex: ({ list, startIndex, visibleCount, itemEqual, positions, offSetSize, overscan, sizeKey, }: {
|
|
6
|
+
list: Array<Data>;
|
|
7
7
|
startIndex: number;
|
|
8
8
|
visibleCount: number;
|
|
9
|
-
|
|
9
|
+
itemEqual?: boolean | undefined;
|
|
10
10
|
positions: PositionType[];
|
|
11
11
|
offSetSize: number;
|
|
12
12
|
overscan: number;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { Data } from './type';
|
|
3
|
+
import { BasicComponent } from '@/utils/typings';
|
|
4
|
+
export interface VirtualListProps extends BasicComponent {
|
|
5
|
+
list: Array<Data>;
|
|
6
|
+
containerHeight: number;
|
|
7
|
+
ItemRender: React.FC<any>;
|
|
8
|
+
itemHeight: number;
|
|
9
|
+
itemEqual: boolean;
|
|
10
|
+
direction: 'vertical' | 'horizontal';
|
|
11
|
+
overscan: number;
|
|
12
|
+
onScroll: () => void;
|
|
13
|
+
key: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const VirtualList: FunctionComponent<Partial<VirtualListProps>>;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ItemRender
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
overscan
|
|
11
|
-
onScroll
|
|
12
|
-
key
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare const VirtualList: FunctionComponent<VirtualListProps & React.HTMLAttributes<HTMLDivElement>>;
|
|
2
|
+
import { Data } from './type';
|
|
3
|
+
import { BasicComponent } from '@/utils/typings';
|
|
4
|
+
export interface VirtualListProps extends BasicComponent {
|
|
5
|
+
list: Array<Data>;
|
|
6
|
+
containerHeight: number;
|
|
7
|
+
ItemRender: React.FC<any>;
|
|
8
|
+
itemHeight: number;
|
|
9
|
+
itemEqual: boolean;
|
|
10
|
+
overscan: number;
|
|
11
|
+
onScroll: () => void;
|
|
12
|
+
key: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const VirtualList: FunctionComponent<Partial<VirtualListProps>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useCallback } from "react";
|
|
2
2
|
import { ScrollView } from "@tarojs/components";
|
|
3
3
|
import { getSystemInfoSync } from "@tarojs/taro";
|
|
4
|
-
import {
|
|
4
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
5
5
|
const initPositinoCache = (reaItemSize, length = 0) => {
|
|
6
6
|
let index = 0;
|
|
7
7
|
const positions = Array(length);
|
|
@@ -71,20 +71,22 @@ const updateItemSize = (positions, items, sizeKey) => {
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
|
+
const clientHeight = getSystemInfoSync().windowHeight - 5 || 667;
|
|
74
75
|
const defaultProps = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
...ComponentDefaults,
|
|
77
|
+
list: [],
|
|
78
|
+
containerHeight: clientHeight,
|
|
79
|
+
itemHeight: 66,
|
|
80
|
+
itemEqual: true,
|
|
78
81
|
overscan: 2
|
|
79
82
|
};
|
|
80
|
-
const clientHeight = getSystemInfoSync().windowHeight - 5 || 667;
|
|
81
|
-
getSystemInfoSync().windowWidth || 375;
|
|
82
83
|
const VirtualList = (props) => {
|
|
83
|
-
const {
|
|
84
|
+
const { list, ItemRender, itemHeight, itemEqual, overscan, key, onScroll, className, containerHeight, ...rest } = {
|
|
85
|
+
...defaultProps,
|
|
86
|
+
...props
|
|
87
|
+
};
|
|
84
88
|
const [startOffset, setStartOffset] = useState(0);
|
|
85
89
|
const [start, setStart] = useState(0);
|
|
86
|
-
const [list, setList] = useState(sourceData.slice());
|
|
87
|
-
useConfig();
|
|
88
90
|
const scrollRef = useRef(null);
|
|
89
91
|
const itemsRef = useRef(null);
|
|
90
92
|
const firstItemRef = useRef(null);
|
|
@@ -99,7 +101,7 @@ const VirtualList = (props) => {
|
|
|
99
101
|
right: 0
|
|
100
102
|
}
|
|
101
103
|
]);
|
|
102
|
-
const [offSetSize, setOffSetSize] = useState(
|
|
104
|
+
const [offSetSize, setOffSetSize] = useState(containerHeight || 0);
|
|
103
105
|
const [options, setOptions] = useState({
|
|
104
106
|
startOffset: 0,
|
|
105
107
|
startIndex: 0,
|
|
@@ -107,37 +109,32 @@ const VirtualList = (props) => {
|
|
|
107
109
|
endIndex: 10
|
|
108
110
|
// 可视区域结束索引
|
|
109
111
|
});
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (sourceData.length) {
|
|
112
|
-
setList(sourceData.slice());
|
|
113
|
-
}
|
|
114
|
-
}, [sourceData]);
|
|
115
112
|
useEffect(() => {
|
|
116
113
|
setPositions((options2) => {
|
|
117
114
|
return { ...options2, endIndex: visibleCount() };
|
|
118
115
|
});
|
|
119
|
-
}, [
|
|
116
|
+
}, [itemHeight, overscan, offSetSize]);
|
|
120
117
|
useEffect(() => {
|
|
121
|
-
if (
|
|
118
|
+
if (containerHeight)
|
|
122
119
|
return;
|
|
123
120
|
setOffSetSize(getContainerHeight());
|
|
124
|
-
}, [
|
|
121
|
+
}, [containerHeight]);
|
|
125
122
|
useEffect(() => {
|
|
126
|
-
const pos = initPositinoCache(
|
|
123
|
+
const pos = initPositinoCache(itemHeight, list.length);
|
|
127
124
|
setPositions(pos);
|
|
128
|
-
}, [
|
|
125
|
+
}, [itemHeight, list]);
|
|
129
126
|
const getContainerHeight = () => {
|
|
130
|
-
const initH =
|
|
131
|
-
return initH < clientHeight ? initH + overscan *
|
|
127
|
+
const initH = itemHeight * list.length;
|
|
128
|
+
return initH < clientHeight ? initH + overscan * itemHeight - 5 : Math.min(containerHeight, clientHeight);
|
|
132
129
|
};
|
|
133
130
|
const visibleCount = () => {
|
|
134
|
-
return Math.ceil(getContainerHeight() /
|
|
131
|
+
return Math.ceil(getContainerHeight() / itemHeight) + overscan;
|
|
135
132
|
};
|
|
136
133
|
const end = () => {
|
|
137
134
|
return start + visibleCount();
|
|
138
135
|
};
|
|
139
136
|
const listHeight = () => {
|
|
140
|
-
return list.length *
|
|
137
|
+
return list.length * itemHeight;
|
|
141
138
|
};
|
|
142
139
|
const visibleData = () => {
|
|
143
140
|
return list.slice(start, Math.min(end(), list.length));
|
|
@@ -156,24 +153,24 @@ const VirtualList = (props) => {
|
|
|
156
153
|
const startIndex = binarySearch(positions, scrollSize, false);
|
|
157
154
|
const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
|
|
158
155
|
const endIndex = end();
|
|
159
|
-
if (!
|
|
156
|
+
if (!itemEqual) {
|
|
160
157
|
updateTotalSize();
|
|
161
158
|
}
|
|
162
|
-
setStart(Math.floor(scrollTop /
|
|
159
|
+
setStart(Math.floor(scrollTop / itemHeight));
|
|
163
160
|
setOptions({ startOffset, startIndex, overStart, endIndex });
|
|
164
161
|
if (end() > list.length - 1) {
|
|
165
162
|
onScroll && onScroll();
|
|
166
163
|
}
|
|
167
|
-
setStartOffset(scrollTop - scrollTop %
|
|
164
|
+
setStartOffset(scrollTop - scrollTop % itemHeight);
|
|
168
165
|
};
|
|
169
166
|
return React.createElement(
|
|
170
167
|
"div",
|
|
171
168
|
{ className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box", ...rest, style: {
|
|
172
|
-
height:
|
|
169
|
+
height: containerHeight ? `${offSetSize}px` : ""
|
|
173
170
|
} },
|
|
174
171
|
React.createElement(
|
|
175
172
|
ScrollView,
|
|
176
|
-
{
|
|
173
|
+
{ scrollY: true, type: "list", ref: scrollRef, className: "nut-virtuallist", style: {
|
|
177
174
|
height: `${getContainerHeight()}px`
|
|
178
175
|
}, onScroll: listScroll },
|
|
179
176
|
React.createElement("div", { className: "nut-virtuallist-phantom", style: { height: `${listHeight()}px` } }),
|
|
@@ -182,7 +179,7 @@ const VirtualList = (props) => {
|
|
|
182
179
|
const dataIndex = overStart + index;
|
|
183
180
|
key && data[key] ? data[key] : dataIndex;
|
|
184
181
|
return React.createElement("div", { ref: dataIndex === 0 ? firstItemRef : null, "data-index": `${dataIndex}`, className: "nut-virtuallist-item", key: `${data}`, style: {
|
|
185
|
-
height: `${
|
|
182
|
+
height: `${itemEqual ? `${itemHeight}px` : "auto"}`
|
|
186
183
|
} }, ItemRender ? React.createElement(ItemRender, { data, index: `${index}` }) : data);
|
|
187
184
|
}))
|
|
188
185
|
)
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v2.0.0-alpha.
|
|
2
|
+
* @nutui/nutui-react-taro v2.0.0-alpha.12 Fri May 26 2023 15:29:31 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -30,7 +30,15 @@ const i = {
|
|
|
30
30
|
},
|
|
31
31
|
range: { rangeText: "Aralıkta görünmüyor" },
|
|
32
32
|
calendaritem: {
|
|
33
|
-
weekdays: [
|
|
33
|
+
weekdays: [
|
|
34
|
+
"Pazar",
|
|
35
|
+
"Pazartesi",
|
|
36
|
+
"Salı",
|
|
37
|
+
"Çarşamba",
|
|
38
|
+
"Perşembe",
|
|
39
|
+
"Cuma",
|
|
40
|
+
"Cumartesi"
|
|
41
|
+
],
|
|
34
42
|
end: "Son",
|
|
35
43
|
start: "Başlangıç",
|
|
36
44
|
confirm: "Onayla",
|
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED