@aloudata/aloudata-design 1.3.1 → 1.4.1
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/dist/Avatar/component/Avatar/index.d.ts +3 -3
- package/dist/Avatar/component/Avatar/index.js +2 -2
- package/dist/Avatar/index.js +1 -1
- package/dist/Checkbox/index.d.ts +3 -3
- package/dist/Checkbox/index.js +1 -1
- package/dist/DataPreviewTable/components/Body/Error.d.ts +9 -0
- package/dist/DataPreviewTable/components/Body/Error.js +17 -0
- package/dist/DataPreviewTable/components/Body/SkeletonBody.d.ts +12 -0
- package/dist/DataPreviewTable/components/Body/SkeletonBody.js +63 -0
- package/dist/DataPreviewTable/components/Body/index.d.ts +12 -0
- package/dist/DataPreviewTable/components/Body/index.js +52 -0
- package/dist/DataPreviewTable/components/DragBar/index.d.ts +8 -0
- package/dist/DataPreviewTable/components/DragBar/index.js +93 -0
- package/dist/DataPreviewTable/components/Header/index.d.ts +10 -0
- package/dist/DataPreviewTable/components/Header/index.js +68 -0
- package/dist/DataPreviewTable/constant.d.ts +6 -0
- package/dist/DataPreviewTable/constant.js +7 -0
- package/dist/DataPreviewTable/hooks/useDirection.d.ts +28 -0
- package/dist/DataPreviewTable/hooks/useDirection.js +281 -0
- package/dist/DataPreviewTable/index.d.ts +4 -0
- package/dist/DataPreviewTable/index.js +105 -0
- package/dist/DataPreviewTable/interface.d.ts +26 -0
- package/dist/DataPreviewTable/interface.js +1 -0
- package/dist/DataPreviewTable/style/index.d.ts +2 -0
- package/dist/DataPreviewTable/style/index.js +2 -0
- package/dist/DataPreviewTable/style/index.less +138 -0
- package/dist/DataPreviewTable/utils/findRange.d.ts +13 -0
- package/dist/DataPreviewTable/utils/findRange.js +86 -0
- package/dist/DoubleCircleIcon/index.d.ts +1 -1
- package/dist/Dropdown/index.js +1 -1
- package/dist/Form/index.d.ts +27 -7
- package/dist/Form/index.js +46 -7
- package/dist/Input/components/Input/index.d.ts +3 -2
- package/dist/Input/components/Input/index.js +6 -4
- package/dist/Menu/SubMenu.d.ts +1 -1
- package/dist/Menu/SubMenu.js +1 -1
- package/dist/Progress/index.d.ts +13 -3
- package/dist/Progress/index.js +88 -3
- package/dist/Progress/style/index.less +56 -0
- package/dist/Radio/components/Group/index.d.ts +1 -1
- package/dist/ScrollArea/index.d.ts +11 -0
- package/dist/ScrollArea/index.js +49 -0
- package/dist/ScrollArea/style/index.d.ts +2 -0
- package/dist/ScrollArea/style/index.js +2 -0
- package/dist/ScrollArea/style/index.less +48 -0
- package/dist/Select/components/MultipleOption.d.ts +1 -1
- package/dist/Select/components/SingleOption.d.ts +1 -1
- package/dist/Select/index.d.ts +1 -0
- package/dist/Select/index.js +64 -26
- package/dist/Skeleton/index.d.ts +2 -2
- package/dist/Skeleton/index.js +1 -1
- package/dist/Space/index.d.ts +2 -2
- package/dist/Space/index.js +1 -1
- package/dist/Switch/index.d.ts +2 -2
- package/dist/Switch/index.js +1 -1
- package/dist/Tree/index.d.ts +5 -5
- package/dist/Upload/index.d.ts +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/locale/en_US.js +3 -3
- package/dist/locale/zh_CN.js +3 -3
- package/dist/locale-provider/LocaleReceiver.d.ts +2 -2
- package/dist/locale-provider/LocaleReceiver.js +1 -1
- package/dist/locale-provider/index.d.ts +7 -7
- package/dist/locale-provider/index.js +2 -2
- package/dist/notification/index.d.ts +1 -1
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AvatarProps as antdAvatarProps } from 'antd/lib/avatar/avatar';
|
|
2
|
+
import Group from 'antd/lib/avatar/group';
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import Group from 'antd/es/avatar/group';
|
|
4
|
-
export type { GroupProps } from 'antd/es/avatar/group';
|
|
4
|
+
export type { GroupProps } from 'antd/lib/avatar/group';
|
|
5
5
|
declare type TSize = 'large' | 'middle' | 'small' | number;
|
|
6
6
|
export interface IAvatarProps extends Omit<antdAvatarProps, 'size'> {
|
|
7
7
|
/**
|
|
@@ -6,9 +6,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
6
6
|
|
|
7
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import InternalAvatar from 'antd/es/avatar/avatar';
|
|
9
|
+
import InternalAvatar from 'antd/lib/avatar/avatar';
|
|
11
10
|
import classNames from 'classnames';
|
|
11
|
+
import * as React from 'react';
|
|
12
12
|
var ZERO = 0;
|
|
13
13
|
|
|
14
14
|
var Avatar = function Avatar(props) {
|
package/dist/Avatar/index.js
CHANGED
package/dist/Checkbox/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ICheckboxGroupProps, ICheckboxProps } from './type';
|
|
3
|
-
export type {
|
|
4
|
-
export type {
|
|
3
|
+
export type { CheckboxChangeEvent } from 'antd/lib/checkbox/Checkbox';
|
|
4
|
+
export type { CheckboxOptionType, CheckboxValueType, } from 'antd/lib/checkbox/Group';
|
|
5
|
+
export type { ICheckboxProps, ICheckboxGroupProps };
|
|
5
6
|
declare function Checkbox(props: ICheckboxProps): JSX.Element;
|
|
6
7
|
declare namespace Checkbox {
|
|
7
8
|
var Group: (props: ICheckboxGroupProps) => JSX.Element;
|
|
8
9
|
}
|
|
9
|
-
export type { ICheckboxProps, ICheckboxGroupProps };
|
|
10
10
|
export default Checkbox;
|
package/dist/Checkbox/index.js
CHANGED
|
@@ -6,9 +6,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
6
6
|
|
|
7
7
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
10
9
|
import { Checkbox as AntdCheckbox } from 'antd';
|
|
11
10
|
import classNames from 'classnames';
|
|
11
|
+
import React from 'react';
|
|
12
12
|
import CheckboxGroup from "./component/CheckboxGroup";
|
|
13
13
|
|
|
14
14
|
function Checkbox(props) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IErrorProps {
|
|
3
|
+
contentWidth: number;
|
|
4
|
+
wrapWidth: number;
|
|
5
|
+
errorMsg?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function ErrorBody(props: IErrorProps): JSX.Element;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof ErrorBody>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
function ErrorBody(props) {
|
|
4
|
+
var contentWidth = props.contentWidth,
|
|
5
|
+
wrapWidth = props.wrapWidth,
|
|
6
|
+
_props$errorMsg = props.errorMsg,
|
|
7
|
+
errorMsg = _props$errorMsg === void 0 ? '加载失败' : _props$errorMsg;
|
|
8
|
+
var width = contentWidth > wrapWidth ? wrapWidth : contentWidth;
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
className: "ald-data-preview-table-error",
|
|
11
|
+
style: {
|
|
12
|
+
width: width
|
|
13
|
+
}
|
|
14
|
+
}, errorMsg);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default /*#__PURE__*/memo(ErrorBody);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IColumnLayout, PreviewColumn } from '../../interface';
|
|
3
|
+
interface IHeader {
|
|
4
|
+
columns: PreviewColumn[];
|
|
5
|
+
columnLayout: IColumnLayout;
|
|
6
|
+
columnRange: [number, number];
|
|
7
|
+
rowRange: [number, number];
|
|
8
|
+
rows: number;
|
|
9
|
+
}
|
|
10
|
+
declare function SkeletonBody(props: IHeader): JSX.Element;
|
|
11
|
+
declare const _default: React.MemoExoticComponent<typeof SkeletonBody>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { memo, useMemo } from 'react';
|
|
14
|
+
import Skeleton from "../../../Skeleton";
|
|
15
|
+
import { CELL_HEIGHT, HEADER_HEIGHT } from "../../constant";
|
|
16
|
+
|
|
17
|
+
function SkeletonBody(props) {
|
|
18
|
+
var columns = props.columns,
|
|
19
|
+
columnLayout = props.columnLayout,
|
|
20
|
+
_props$columnRange = _slicedToArray(props.columnRange, 2),
|
|
21
|
+
startIndex = _props$columnRange[0],
|
|
22
|
+
endIndex = _props$columnRange[1],
|
|
23
|
+
_props$rowRange = _slicedToArray(props.rowRange, 2),
|
|
24
|
+
startRowIndex = _props$rowRange[0],
|
|
25
|
+
endRowIndex = _props$rowRange[1],
|
|
26
|
+
rows = props.rows;
|
|
27
|
+
|
|
28
|
+
var row = useMemo(function () {
|
|
29
|
+
var newArray = new Array(columns.length).fill(0);
|
|
30
|
+
return newArray;
|
|
31
|
+
}, [columns]);
|
|
32
|
+
var datasource = useMemo(function () {
|
|
33
|
+
var newArray = new Array(rows).fill(row);
|
|
34
|
+
return newArray;
|
|
35
|
+
}, [rows, row]);
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "ald-data-preview-table-body"
|
|
38
|
+
}, datasource.slice(startRowIndex, endRowIndex).map(function (x, rowIndex) {
|
|
39
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
40
|
+
key: rowIndex
|
|
41
|
+
}, row.slice(startIndex, endIndex).map(function (cell, index) {
|
|
42
|
+
var columnIndex = startIndex + index;
|
|
43
|
+
var style = {
|
|
44
|
+
height: CELL_HEIGHT,
|
|
45
|
+
width: columnLayout[columns[columnIndex].id].width,
|
|
46
|
+
top: rowIndex * CELL_HEIGHT + HEADER_HEIGHT,
|
|
47
|
+
left: columnLayout[columns[columnIndex].id].left,
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
textAlign: columns[columnIndex].align || 'left'
|
|
50
|
+
};
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
key: columnIndex,
|
|
53
|
+
style: style,
|
|
54
|
+
className: "ald-data-preview-body-skeleton-cell"
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
56
|
+
active: true,
|
|
57
|
+
paragraph: false
|
|
58
|
+
}));
|
|
59
|
+
}));
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default /*#__PURE__*/memo(SkeletonBody);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IColumnLayout, PreviewColumn, TValue } from '../../interface';
|
|
3
|
+
interface IHeader {
|
|
4
|
+
columns: PreviewColumn[];
|
|
5
|
+
columnLayout: IColumnLayout;
|
|
6
|
+
columnRange: [number, number];
|
|
7
|
+
datasource: TValue[][];
|
|
8
|
+
rowRange: [number, number];
|
|
9
|
+
}
|
|
10
|
+
declare function Body(props: IHeader): JSX.Element;
|
|
11
|
+
declare const _default: React.MemoExoticComponent<typeof Body>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { memo } from 'react';
|
|
14
|
+
import { CELL_HEIGHT, HEADER_HEIGHT } from "../../constant";
|
|
15
|
+
|
|
16
|
+
function Body(props) {
|
|
17
|
+
var columns = props.columns,
|
|
18
|
+
columnLayout = props.columnLayout,
|
|
19
|
+
datasource = props.datasource,
|
|
20
|
+
_props$columnRange = _slicedToArray(props.columnRange, 2),
|
|
21
|
+
startIndex = _props$columnRange[0],
|
|
22
|
+
endIndex = _props$columnRange[1],
|
|
23
|
+
_props$rowRange = _slicedToArray(props.rowRange, 2),
|
|
24
|
+
startRowIndex = _props$rowRange[0],
|
|
25
|
+
endRowIndex = _props$rowRange[1];
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "ald-data-preview-table-body"
|
|
29
|
+
}, datasource.slice(startRowIndex, endRowIndex).map(function (row, rowIndex) {
|
|
30
|
+
var currentRowIndex = startRowIndex + rowIndex;
|
|
31
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
32
|
+
key: currentRowIndex
|
|
33
|
+
}, row.slice(startIndex, endIndex).map(function (cell, index) {
|
|
34
|
+
var columnIndex = startIndex + index;
|
|
35
|
+
var style = {
|
|
36
|
+
height: CELL_HEIGHT,
|
|
37
|
+
width: columnLayout[columns[columnIndex].id].width,
|
|
38
|
+
top: currentRowIndex * CELL_HEIGHT + HEADER_HEIGHT,
|
|
39
|
+
left: columnLayout[columns[columnIndex].id].left,
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
textAlign: columns[columnIndex].align || 'left'
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
key: columnIndex,
|
|
45
|
+
style: style,
|
|
46
|
+
className: "ald-data-preview-body-cell"
|
|
47
|
+
}, cell);
|
|
48
|
+
}));
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default /*#__PURE__*/memo(Body);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function DragBar(props: {
|
|
3
|
+
wrapWidth: number;
|
|
4
|
+
columnId: string;
|
|
5
|
+
onChange: (columnId: string, width: number) => void;
|
|
6
|
+
}): JSX.Element;
|
|
7
|
+
declare const _default: React.MemoExoticComponent<typeof DragBar>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import React, { memo, useCallback, useRef, useState } from 'react';
|
|
17
|
+
import { createPortal, flushSync } from 'react-dom';
|
|
18
|
+
import { COLUMN_MIN_WIDTH } from "../../constant";
|
|
19
|
+
|
|
20
|
+
function DragBar(props) {
|
|
21
|
+
var wrapWidth = props.wrapWidth,
|
|
22
|
+
columnId = props.columnId,
|
|
23
|
+
onChange = props.onChange;
|
|
24
|
+
|
|
25
|
+
var _useState = useState(false),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
show = _useState2[0],
|
|
28
|
+
setShow = _useState2[1];
|
|
29
|
+
|
|
30
|
+
var _useState3 = useState(0),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
dragBarLeft = _useState4[0],
|
|
33
|
+
setDragBarLeft = _useState4[1];
|
|
34
|
+
|
|
35
|
+
var dragElRef = useRef(null);
|
|
36
|
+
var mouseDownRef = useRef({
|
|
37
|
+
down: false,
|
|
38
|
+
clientX: 0
|
|
39
|
+
});
|
|
40
|
+
var getBarLeft = useCallback(function (currentClientX) {
|
|
41
|
+
var startClientX = mouseDownRef.current.clientX;
|
|
42
|
+
var offset = startClientX - currentClientX;
|
|
43
|
+
|
|
44
|
+
if (offset >= wrapWidth - COLUMN_MIN_WIDTH) {
|
|
45
|
+
return wrapWidth - COLUMN_MIN_WIDTH;
|
|
46
|
+
} else {
|
|
47
|
+
return offset;
|
|
48
|
+
}
|
|
49
|
+
}, [wrapWidth]);
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
ref: dragElRef,
|
|
52
|
+
onMouseDown: function onMouseDown(event) {
|
|
53
|
+
mouseDownRef.current = {
|
|
54
|
+
clientX: event.clientX,
|
|
55
|
+
down: true
|
|
56
|
+
};
|
|
57
|
+
setShow(true);
|
|
58
|
+
},
|
|
59
|
+
onClick: function onClick(e) {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
},
|
|
62
|
+
style: {
|
|
63
|
+
right: dragBarLeft
|
|
64
|
+
},
|
|
65
|
+
className: classNames('ald-data-preview-header-drag-bar', _defineProperty({}, 'ald-data-preview-header-drag-bar-active', show))
|
|
66
|
+
}, show ? /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
onMouseMove: function onMouseMove(event) {
|
|
68
|
+
var mouseDownState = mouseDownRef.current;
|
|
69
|
+
if (mouseDownState.down === false) return;
|
|
70
|
+
var currentClientX = event.clientX;
|
|
71
|
+
flushSync(function () {
|
|
72
|
+
setDragBarLeft(getBarLeft(currentClientX));
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
onMouseUp: function onMouseUp(event) {
|
|
76
|
+
mouseDownRef.current.down = false;
|
|
77
|
+
setShow(false);
|
|
78
|
+
var currentClientX = event.clientX;
|
|
79
|
+
onChange(columnId, wrapWidth - getBarLeft(currentClientX));
|
|
80
|
+
setDragBarLeft(0);
|
|
81
|
+
},
|
|
82
|
+
style: {
|
|
83
|
+
position: 'fixed',
|
|
84
|
+
left: 0,
|
|
85
|
+
top: 0,
|
|
86
|
+
zIndex: 1000,
|
|
87
|
+
width: '100vw',
|
|
88
|
+
height: '100vh'
|
|
89
|
+
}
|
|
90
|
+
}), document.body) : null);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default /*#__PURE__*/memo(DragBar);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IColumnLayout, PreviewColumn } from '../../interface';
|
|
3
|
+
interface IHeader {
|
|
4
|
+
columns: PreviewColumn[];
|
|
5
|
+
columnLayout: IColumnLayout;
|
|
6
|
+
setWidth: React.Dispatch<React.SetStateAction<number[]>>;
|
|
7
|
+
columnRange: [number, number];
|
|
8
|
+
}
|
|
9
|
+
export default function Header(props: IHeader): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
+
|
|
13
|
+
import React, { useCallback } from 'react';
|
|
14
|
+
import { HEADER_HEIGHT } from "../../constant";
|
|
15
|
+
import DragBar from "../DragBar";
|
|
16
|
+
export default function Header(props) {
|
|
17
|
+
var columns = props.columns,
|
|
18
|
+
columnLayout = props.columnLayout,
|
|
19
|
+
setWidth = props.setWidth,
|
|
20
|
+
columnRange = props.columnRange;
|
|
21
|
+
var dragBarOnChange = useCallback(function (columnId, width) {
|
|
22
|
+
var index = columns.findIndex(function (item) {
|
|
23
|
+
return item.id === columnId;
|
|
24
|
+
});
|
|
25
|
+
setWidth(function (prev) {
|
|
26
|
+
var next = _toConsumableArray(prev);
|
|
27
|
+
|
|
28
|
+
next[index] = width;
|
|
29
|
+
return next;
|
|
30
|
+
});
|
|
31
|
+
}, [columns, setWidth]);
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "ald-data-preview-header",
|
|
34
|
+
style: {
|
|
35
|
+
position: 'sticky',
|
|
36
|
+
top: 0,
|
|
37
|
+
left: 0
|
|
38
|
+
}
|
|
39
|
+
}, columns.slice(columnRange[0], columnRange[1]).map(function (column) {
|
|
40
|
+
var _column$renderHeader;
|
|
41
|
+
|
|
42
|
+
var innerCell = (_column$renderHeader = column.renderHeader) === null || _column$renderHeader === void 0 ? void 0 : _column$renderHeader.call(column, column);
|
|
43
|
+
var style = {
|
|
44
|
+
height: HEADER_HEIGHT,
|
|
45
|
+
width: columnLayout[column.id].width,
|
|
46
|
+
top: 0,
|
|
47
|
+
left: columnLayout[column.id].left,
|
|
48
|
+
position: 'absolute'
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "ald-data-preview-header-cell",
|
|
52
|
+
key: column.id,
|
|
53
|
+
style: style
|
|
54
|
+
}, innerCell ? innerCell : /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "ald-data-preview-header-default"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: "ald-data-preview-header-left"
|
|
58
|
+
}, column.icon !== undefined ? column.icon : /*#__PURE__*/React.createElement("span", null)), /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "ald-data-preview-header-name"
|
|
60
|
+
}, column.name), /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "ald-data-preview-header-right"
|
|
62
|
+
})), /*#__PURE__*/React.createElement(DragBar, {
|
|
63
|
+
columnId: column.id,
|
|
64
|
+
wrapWidth: columnLayout[column.id].width,
|
|
65
|
+
onChange: dragBarOnChange
|
|
66
|
+
}));
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CELL_HEIGHT = 20;
|
|
2
|
+
export declare const HEADER_HEIGHT = 28;
|
|
3
|
+
export declare const DEFAULT_COLUMN_WIDTH = 100;
|
|
4
|
+
export declare const PRE_RENDER_RANGE = 100;
|
|
5
|
+
export declare const UNDEFINED_INDEX = -1;
|
|
6
|
+
export declare const COLUMN_MIN_WIDTH = 50;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { IColumnLayout, PreviewColumn } from '../interface';
|
|
3
|
+
export interface IScrollData {
|
|
4
|
+
scrollLeft: number;
|
|
5
|
+
scrollTop: number;
|
|
6
|
+
direction: IScrollDirection;
|
|
7
|
+
}
|
|
8
|
+
export interface IScrollDirection {
|
|
9
|
+
horizontal: EScrollHorizontalDirection;
|
|
10
|
+
vertical: EScrollVerticalDirection;
|
|
11
|
+
current: EScrollHorizontalDirection | EScrollVerticalDirection | 'init';
|
|
12
|
+
}
|
|
13
|
+
export declare enum EScrollHorizontalDirection {
|
|
14
|
+
SCROLL_TO_LEFT = "toLeft",
|
|
15
|
+
SCROLL_TO_RIGHT = "toRight"
|
|
16
|
+
}
|
|
17
|
+
export declare enum EScrollVerticalDirection {
|
|
18
|
+
SCROLL_TO_TOP = "toTop",
|
|
19
|
+
SCROLL_TO_BOTTOM = "toBottom"
|
|
20
|
+
}
|
|
21
|
+
export default function useDirection(columns: PreviewColumn[], wrapRef: RefObject<HTMLDivElement>): {
|
|
22
|
+
setRange: (scrollTop: number, scrollLeft: number) => void;
|
|
23
|
+
columnRange: [number, number];
|
|
24
|
+
rowRange: [number, number];
|
|
25
|
+
setColumnsWidth: import("react").Dispatch<import("react").SetStateAction<number[]>>;
|
|
26
|
+
columnLayout: IColumnLayout;
|
|
27
|
+
columnsWidth: number[];
|
|
28
|
+
};
|