@apdesign/web-react 1.0.3 → 1.1.0

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.
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import Group from './group';
3
3
  import { ButtonProps } from './interface';
4
4
  declare const ButtonComponent: React.ForwardRefExoticComponent<Partial<{
5
- htmlType?: "button" | "submit" | "reset";
5
+ htmlType?: "button" | "reset" | "submit";
6
6
  } & import("./interface").BaseButtonProps & Omit<React.ButtonHTMLAttributes<any>, "className" | "type" | "onClick"> & {
7
7
  href: string;
8
8
  target?: string;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { RangePickerHandle } from './interface';
3
- declare const PickerComponent: React.ForwardRefExoticComponent<import("./interface").BaseRangePickerProps & import("../_util/type").Omit<import("./interface").PickerProps, "onChange" | "onSelect" | "inputProps" | "onOk" | "defaultPickerValue" | "pickerValue" | "onPickerValueChange"> & React.RefAttributes<RangePickerHandle>>;
3
+ declare const PickerComponent: React.ForwardRefExoticComponent<import("./interface").BaseRangePickerProps & import("../_util/type").Omit<import("./interface").PickerProps, "onChange" | "onSelect" | "onOk" | "defaultPickerValue" | "pickerValue" | "onPickerValueChange" | "inputProps"> & React.RefAttributes<RangePickerHandle>>;
4
4
  export default PickerComponent;
@@ -1,6 +1,6 @@
1
1
  import { Dayjs } from 'dayjs';
2
2
  export declare function isTimeArrayChange(prevTime: Dayjs[], nextTime: Dayjs[]): boolean;
3
- export declare function getAvailableDayjsLength(value: any): 1 | 0 | 2;
3
+ export declare function getAvailableDayjsLength(value: any): 0 | 1 | 2;
4
4
  export declare function isDisabledDate(cellDate: any, disabledDate: any, mode: any): boolean;
5
5
  declare type WeekStartType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
6
6
  export declare function getDefaultWeekStart(dayjsLocale: string): WeekStartType;
@@ -6,7 +6,7 @@ export declare type HotkeyInfo = {
6
6
  type: 'sibling' | 'generation' | 'enter';
7
7
  };
8
8
  export declare type ResetHotkeyInfo = (activeKey?: string) => void;
9
- declare const MenuContext: import("react").Context<Pick<MenuProps, "mode" | "triggerProps" | "collapse" | "inDropdown" | "theme" | "levelIndent" | "icons" | "autoScrollIntoView" | "selectedKeys" | "openKeys" | "scrollConfig" | "tooltipProps"> & {
9
+ declare const MenuContext: import("react").Context<Pick<MenuProps, "collapse" | "inDropdown" | "theme" | "mode" | "levelIndent" | "icons" | "autoScrollIntoView" | "selectedKeys" | "openKeys" | "scrollConfig" | "triggerProps" | "tooltipProps"> & {
10
10
  id?: string;
11
11
  prefixCls?: string;
12
12
  onClickMenuItem?: (key: string, event: any) => void;
@@ -48,6 +48,7 @@ import useIsFirstRender from '../../_util/hooks/useIsFirstRender';
48
48
  import useForceUpdate from '../../_util/hooks/useForceUpdate';
49
49
  import ResizeObserver from '../../_util/resizeObserver';
50
50
  import useIsomorphicLayoutEffect from '../../_util/hooks/useIsomorphicLayoutEffect';
51
+ var __TABLE_PADDING__ = window.__TABLE_PADDING__;
51
52
  // height of the virtual element, used to calculate total height of the virtual list
52
53
  var DEFAULT_VIRTUAL_ITEM_HEIGHT = 32;
53
54
  var KEY_VIRTUAL_ITEM_HEIGHT = "__virtual_item_height_" + Math.random().toFixed(5).slice(2);
@@ -100,7 +101,7 @@ var VirtualList = React.forwardRef(function (props, ref) {
100
101
  DEFAULT_VIRTUAL_ITEM_HEIGHT;
101
102
  var viewportHeight = isNumber(styleListMaxHeight) ? styleListMaxHeight : stateHeight;
102
103
  var itemCountVisible = Math.ceil(viewportHeight / itemHeight);
103
- var itemTotalHeight = itemHeight * itemCount;
104
+ var itemTotalHeight = itemHeight * itemCount + __TABLE_PADDING__;
104
105
  var isVirtual = threshold !== null && itemCount >= threshold && itemTotalHeight > viewportHeight;
105
106
  var refList = useRef(null);
106
107
  var refRafId = useRef(null);
@@ -279,7 +280,7 @@ var VirtualList = React.forwardRef(function (props, ref) {
279
280
  itemOffsetPtg: state.itemOffsetPtg,
280
281
  scrollPtg: getScrollPercentage({
281
282
  scrollTop: state.scrollTop,
282
- scrollHeight: prevData.length * itemHeight,
283
+ scrollHeight: prevData.length * itemHeight + __TABLE_PADDING__,
283
284
  clientHeight: clientHeight,
284
285
  }),
285
286
  clientHeight: clientHeight,
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { findDOMNode } from '../../../_util/react-dom';
13
13
  import getStringLength from '../../../_util/getStringLength';
14
+ var __TABLE_PADDING__ = window.__TABLE_PADDING__;
14
15
  /**
15
16
  * 为了计算方便,定位元素的下标可能返回数组长度,代表最后一个元素
16
17
  */
@@ -55,8 +56,10 @@ export function getValidScrollTop(scrollTop, scrollRange) {
55
56
  */
56
57
  export function getScrollPercentage(_a) {
57
58
  var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
58
- var scrollRange = scrollHeight - clientHeight;
59
- return scrollRange <= 0 ? 0 : getValidScrollTop(scrollTop, scrollRange) / scrollRange;
59
+ var scrollRange = scrollHeight - clientHeight - __TABLE_PADDING__;
60
+ return scrollRange <= 0
61
+ ? 0
62
+ : getValidScrollTop(Math.max(scrollTop - __TABLE_PADDING__, 0), scrollRange) / scrollRange;
60
63
  }
61
64
  /**
62
65
  * 计算需要渲染的元素的开始下标、结束下标和用于定位的元素下标
@@ -77,14 +80,14 @@ export function getRangeIndex(scrollPtg, itemCount, visibleCount) {
77
80
  */
78
81
  export function getItemRelativeTop(_a) {
79
82
  var itemHeight = _a.itemHeight, itemOffsetPtg = _a.itemOffsetPtg, scrollPtg = _a.scrollPtg, clientHeight = _a.clientHeight;
80
- return Math.floor(clientHeight * scrollPtg - itemHeight * itemOffsetPtg);
83
+ return Math.floor((clientHeight + __TABLE_PADDING__) * scrollPtg - itemHeight * itemOffsetPtg);
81
84
  }
82
85
  /**
83
86
  * 计算元素相对于整个滚动区域顶部的偏移量
84
87
  */
85
88
  export function getItemAbsoluteTop(_a) {
86
89
  var scrollTop = _a.scrollTop, rest = __rest(_a, ["scrollTop"]);
87
- return scrollTop + getItemRelativeTop(rest);
90
+ return Math.max(scrollTop - __TABLE_PADDING__, 0) + getItemRelativeTop(rest);
88
91
  }
89
92
  /**
90
93
  * 计算某一指定下标的元素相对于视口顶部的偏移量
@@ -1,3 +1,3 @@
1
1
  export declare const NOOP: () => void;
2
2
  export declare function newArray(length: number): any;
3
- export declare function pickTriggerPropsFromRest(rest: any): Pick<any, "onClick" | "onFocus" | "onBlur" | "tabIndex" | "onContextMenu" | "onMouseEnter" | "onMouseLeave" | "onMouseMove">;
3
+ export declare function pickTriggerPropsFromRest(rest: any): Pick<any, "onClick" | "tabIndex" | "onFocus" | "onBlur" | "onContextMenu" | "onMouseEnter" | "onMouseLeave" | "onMouseMove">;
package/es/index.d.ts CHANGED
@@ -139,4 +139,4 @@ export type { WatermarkProps } from './Watermark/interface';
139
139
  export { default as Watermark } from './Watermark';
140
140
  export type { ImageProps, ImagePreviewProps, ImagePreviewActionProps, ImagePreviewGroupProps } from './Image/interface';
141
141
  export { default as Image } from './Image';
142
- export declare const version = "1.0.3";
142
+ export declare const version = "1.1.0";
package/es/index.js CHANGED
@@ -69,4 +69,4 @@ export { default as Upload } from './Upload';
69
69
  export { default as Mentions } from './Mentions';
70
70
  export { default as Watermark } from './Watermark';
71
71
  export { default as Image } from './Image';
72
- export var version = '1.0.3';
72
+ export var version = '1.1.0';
@@ -72,6 +72,7 @@ var useIsFirstRender_1 = __importDefault(require("../../_util/hooks/useIsFirstRe
72
72
  var useForceUpdate_1 = __importDefault(require("../../_util/hooks/useForceUpdate"));
73
73
  var resizeObserver_1 = __importDefault(require("../../_util/resizeObserver"));
74
74
  var useIsomorphicLayoutEffect_1 = __importDefault(require("../../_util/hooks/useIsomorphicLayoutEffect"));
75
+ var __TABLE_PADDING__ = window.__TABLE_PADDING__;
75
76
  // height of the virtual element, used to calculate total height of the virtual list
76
77
  var DEFAULT_VIRTUAL_ITEM_HEIGHT = 32;
77
78
  var KEY_VIRTUAL_ITEM_HEIGHT = "__virtual_item_height_" + Math.random().toFixed(5).slice(2);
@@ -124,7 +125,7 @@ var VirtualList = react_1.default.forwardRef(function (props, ref) {
124
125
  DEFAULT_VIRTUAL_ITEM_HEIGHT;
125
126
  var viewportHeight = (0, is_1.isNumber)(styleListMaxHeight) ? styleListMaxHeight : stateHeight;
126
127
  var itemCountVisible = Math.ceil(viewportHeight / itemHeight);
127
- var itemTotalHeight = itemHeight * itemCount;
128
+ var itemTotalHeight = itemHeight * itemCount + __TABLE_PADDING__;
128
129
  var isVirtual = threshold !== null && itemCount >= threshold && itemTotalHeight > viewportHeight;
129
130
  var refList = (0, react_1.useRef)(null);
130
131
  var refRafId = (0, react_1.useRef)(null);
@@ -303,7 +304,7 @@ var VirtualList = react_1.default.forwardRef(function (props, ref) {
303
304
  itemOffsetPtg: state.itemOffsetPtg,
304
305
  scrollPtg: (0, itemUtil_1.getScrollPercentage)({
305
306
  scrollTop: state.scrollTop,
306
- scrollHeight: prevData.length * itemHeight,
307
+ scrollHeight: prevData.length * itemHeight + __TABLE_PADDING__,
307
308
  clientHeight: clientHeight,
308
309
  }),
309
310
  clientHeight: clientHeight,
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.getLongestItemIndex = exports.getCompareItemRelativeTop = exports.getItemAbsoluteTop = exports.getItemRelativeTop = exports.getRangeIndex = exports.getScrollPercentage = exports.getValidScrollTop = exports.getNodeHeight = exports.getLocationItem = exports.GHOST_ITEM_KEY = void 0;
18
18
  var react_dom_1 = require("../../../_util/react-dom");
19
19
  var getStringLength_1 = __importDefault(require("../../../_util/getStringLength"));
20
+ var __TABLE_PADDING__ = window.__TABLE_PADDING__;
20
21
  /**
21
22
  * 为了计算方便,定位元素的下标可能返回数组长度,代表最后一个元素
22
23
  */
@@ -64,8 +65,10 @@ exports.getValidScrollTop = getValidScrollTop;
64
65
  */
65
66
  function getScrollPercentage(_a) {
66
67
  var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
67
- var scrollRange = scrollHeight - clientHeight;
68
- return scrollRange <= 0 ? 0 : getValidScrollTop(scrollTop, scrollRange) / scrollRange;
68
+ var scrollRange = scrollHeight - clientHeight - __TABLE_PADDING__;
69
+ return scrollRange <= 0
70
+ ? 0
71
+ : getValidScrollTop(Math.max(scrollTop - __TABLE_PADDING__, 0), scrollRange) / scrollRange;
69
72
  }
70
73
  exports.getScrollPercentage = getScrollPercentage;
71
74
  /**
@@ -88,7 +91,7 @@ exports.getRangeIndex = getRangeIndex;
88
91
  */
89
92
  function getItemRelativeTop(_a) {
90
93
  var itemHeight = _a.itemHeight, itemOffsetPtg = _a.itemOffsetPtg, scrollPtg = _a.scrollPtg, clientHeight = _a.clientHeight;
91
- return Math.floor(clientHeight * scrollPtg - itemHeight * itemOffsetPtg);
94
+ return Math.floor((clientHeight + __TABLE_PADDING__) * scrollPtg - itemHeight * itemOffsetPtg);
92
95
  }
93
96
  exports.getItemRelativeTop = getItemRelativeTop;
94
97
  /**
@@ -96,7 +99,7 @@ exports.getItemRelativeTop = getItemRelativeTop;
96
99
  */
97
100
  function getItemAbsoluteTop(_a) {
98
101
  var scrollTop = _a.scrollTop, rest = __rest(_a, ["scrollTop"]);
99
- return scrollTop + getItemRelativeTop(rest);
102
+ return Math.max(scrollTop - __TABLE_PADDING__, 0) + getItemRelativeTop(rest);
100
103
  }
101
104
  exports.getItemAbsoluteTop = getItemAbsoluteTop;
102
105
  /**
package/lib/index.d.ts CHANGED
@@ -139,4 +139,4 @@ export type { WatermarkProps } from './Watermark/interface';
139
139
  export { default as Watermark } from './Watermark';
140
140
  export type { ImageProps, ImagePreviewProps, ImagePreviewActionProps, ImagePreviewGroupProps } from './Image/interface';
141
141
  export { default as Image } from './Image';
142
- export declare const version = "1.0.3";
142
+ export declare const version = "1.1.0";
package/lib/index.js CHANGED
@@ -147,4 +147,4 @@ var Watermark_1 = require("./Watermark");
147
147
  Object.defineProperty(exports, "Watermark", { enumerable: true, get: function () { return __importDefault(Watermark_1).default; } });
148
148
  var Image_1 = require("./Image");
149
149
  Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return __importDefault(Image_1).default; } });
150
- exports.version = '1.0.3';
150
+ exports.version = '1.1.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apdesign/web-react",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "AP Design React UI Library.",
5
5
  "module": "./es/index.js",
6
6
  "main": "./lib/index.js",