@aloudata/aloudata-design 2.10.6 → 2.12.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.
- package/dist/ColorPicker/index.js +8 -4
- package/dist/ConfigProvider/defaultRenderEmpty.js +4 -2
- package/dist/ConfigProvider/index.js +9 -1
- package/dist/DataPreviewTable/components/Body/Error.js +6 -2
- package/dist/DataPreviewTable/index.js +6 -2
- package/dist/DoubleCircleIcon/index.d.ts +1 -1
- package/dist/Dropdown/index.d.ts +2 -1
- package/dist/Dropdown/index.js +5 -2
- package/dist/Empty/index.js +5 -1
- package/dist/HighlightText/index.js +2 -1
- package/dist/InputSearch/index.js +6 -2
- package/dist/List/Item.d.ts +31 -0
- package/dist/List/Item.js +76 -0
- package/dist/List/index.d.ts +18 -0
- package/dist/List/index.js +135 -0
- package/dist/{locale-provider → List}/style/index.d.ts +1 -0
- package/dist/List/style/index.js +2 -0
- package/dist/List/style/index.less +120 -0
- package/dist/MemberPicker/components/MemberSelection.js +6 -2
- package/dist/MemberPicker/components/MultipleOption.js +6 -2
- package/dist/MemberPicker/components/Panel.js +8 -4
- package/dist/MemberPicker/components/PanelWrapper.d.ts +1 -1
- package/dist/MemberPicker/components/PanelWrapper.js +10 -6
- package/dist/MemberPicker/components/SelectedMemberTags.js +6 -2
- package/dist/MemberPicker/components/SelectorFooter.js +7 -3
- package/dist/MemberPicker/components/SingleOption.js +6 -2
- package/dist/MemberPicker/components/UserGroupSelection.js +7 -3
- package/dist/MemberPicker/index.js +35 -31
- package/dist/Modal/index.js +17 -23
- package/dist/OverflowCount/style/index.less +1 -0
- package/dist/Radio/components/Group/index.d.ts +1 -1
- package/dist/ScrollArea/index.js +3 -1
- package/dist/Select/index.js +6 -2
- package/dist/Spin/index.d.ts +1 -0
- package/dist/Spin/index.js +4 -3
- package/dist/Steps/matchMedia.mock.d.ts +1 -0
- package/dist/Steps/matchMedia.mock.js +7 -6
- package/dist/Table/components/ErrorBoundary.d.ts +1 -0
- package/dist/Table/components/ErrorBoundary.js +8 -3
- package/dist/Table/components/Footer/index.js +9 -5
- package/dist/Tree/Tree.js +9 -5
- package/dist/ald.min.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.less +1 -0
- package/dist/locale/default.d.ts +59 -2
- package/dist/locale/default.js +18 -2
- package/dist/locale/en_US.d.ts +49 -2
- package/dist/locale/en_US.js +41 -121
- package/dist/locale/zh_CN.d.ts +49 -2
- package/dist/locale/zh_CN.js +41 -120
- package/dist/message/index.js +3 -1
- package/dist/notification/index.js +10 -7
- package/package.json +7 -1
- package/dist/Modal/locale.d.ts +0 -7
- package/dist/Modal/locale.js +0 -18
- package/dist/locale-provider/LocaleReceiver.d.ts +0 -4
- package/dist/locale-provider/LocaleReceiver.js +0 -3
- package/dist/locale-provider/context.d.ts +0 -7
- package/dist/locale-provider/context.js +0 -3
- package/dist/locale-provider/default.d.ts +0 -2
- package/dist/locale-provider/default.js +0 -2
- package/dist/locale-provider/en_US.d.ts +0 -2
- package/dist/locale-provider/en_US.js +0 -2
- package/dist/locale-provider/index.d.ts +0 -65
- package/dist/locale-provider/index.js +0 -80
- package/dist/locale-provider/style/index.js +0 -1
- package/dist/locale-provider/style/index.less +0 -2
- package/dist/locale-provider/zh_CN.d.ts +0 -2
- package/dist/locale-provider/zh_CN.js +0 -2
|
@@ -9,9 +9,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { default as cls } from 'classnames';
|
|
12
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
12
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
13
13
|
import Dropdown from "../Dropdown";
|
|
14
14
|
import { FoldDownFill } from "../Icon";
|
|
15
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
15
16
|
import { colors as defaultColors, specialColors } from "./constant";
|
|
16
17
|
function getLocalRecentColors(localStorageKey) {
|
|
17
18
|
if (!window.localStorage) {
|
|
@@ -41,6 +42,9 @@ export default function ColorPicker(_ref) {
|
|
|
41
42
|
localStorageKey = _ref$localStorageKey === void 0 ? 'ald_recent_colors' : _ref$localStorageKey,
|
|
42
43
|
_ref$disabled = _ref.disabled,
|
|
43
44
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
45
|
+
var _useContext = useContext(LocaleContext),
|
|
46
|
+
locale = _useContext.locale;
|
|
47
|
+
var t = getTranslator(locale);
|
|
44
48
|
var _useState = useState(false),
|
|
45
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
46
50
|
open = _useState2[0],
|
|
@@ -98,9 +102,9 @@ export default function ColorPicker(_ref) {
|
|
|
98
102
|
style: {
|
|
99
103
|
backgroundColor: defaultColor
|
|
100
104
|
}
|
|
101
|
-
})),
|
|
105
|
+
})), t.ColorPicker.default), /*#__PURE__*/React.createElement("div", {
|
|
102
106
|
className: 'standard'
|
|
103
|
-
}, /*#__PURE__*/React.createElement("p", null,
|
|
107
|
+
}, /*#__PURE__*/React.createElement("p", null, t.ColorPicker.standardColor), /*#__PURE__*/React.createElement("div", {
|
|
104
108
|
className: 'items'
|
|
105
109
|
}, defaultColors.map(function (color) {
|
|
106
110
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -123,7 +127,7 @@ export default function ColorPicker(_ref) {
|
|
|
123
127
|
}));
|
|
124
128
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
125
129
|
className: 'recent'
|
|
126
|
-
}, /*#__PURE__*/React.createElement("p", null,
|
|
130
|
+
}, /*#__PURE__*/React.createElement("p", null, t.ColorPicker.recentlyUsed), /*#__PURE__*/React.createElement("div", {
|
|
127
131
|
className: 'items'
|
|
128
132
|
}, recentColors.map(function (color) {
|
|
129
133
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -17,8 +17,10 @@ var defaultRenderEmpty = function defaultRenderEmpty(componentName) {
|
|
|
17
17
|
case 'Transfer':
|
|
18
18
|
case 'Mentions':
|
|
19
19
|
return /*#__PURE__*/React.createElement(Empty, {
|
|
20
|
-
image: Empty.PRESENTED_IMAGE_SEARCH_SMALL
|
|
21
|
-
|
|
20
|
+
image: Empty.PRESENTED_IMAGE_SEARCH_SMALL
|
|
21
|
+
// 没有地方用到
|
|
22
|
+
// title="无数据"
|
|
23
|
+
,
|
|
22
24
|
className: "".concat(prefix, "-small")
|
|
23
25
|
});
|
|
24
26
|
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import { ConfigProvider } from 'antd';
|
|
3
|
+
import antdEnUS from 'antd/locale/en_US';
|
|
4
|
+
import antdZhCN from 'antd/locale/zh_CN';
|
|
3
5
|
import React from 'react';
|
|
6
|
+
import { LocaleContext, defaultLocale } from "../locale/default";
|
|
4
7
|
import getUserListContext from "./getUserList";
|
|
5
8
|
import useGetUserList from "./hooks/useGetUserList";
|
|
6
9
|
import SizeContext from "./sizeContext";
|
|
7
10
|
export { ConfigContext } from 'antd/lib/config-provider';
|
|
8
11
|
export { ConfigConsumer } from 'antd/lib/config-provider/';
|
|
9
12
|
var AldCustomConfigProvider = function AldCustomConfigProvider(props) {
|
|
13
|
+
var _props$locale;
|
|
10
14
|
var children = props.children,
|
|
11
15
|
getUsersByIds = props.getUsersByIds,
|
|
12
16
|
getUsersByKeywords = props.getUsersByKeywords;
|
|
@@ -26,7 +30,11 @@ var AldCustomConfigProvider = function AldCustomConfigProvider(props) {
|
|
|
26
30
|
fontFamily: "Inter,'PingFang SC', system-ui, -apple-system, blinkmacsystemfont,\n 'Helvetica Neue', 'Segoe UI', helvetica, arial, 'Microsoft YaHei',\n 'WenQuanYi Micro Hei', sans-serif;"
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
|
-
}, props
|
|
33
|
+
}, props, {
|
|
34
|
+
locale: ((_props$locale = props.locale) === null || _props$locale === void 0 ? void 0 : _props$locale.locale) === 'zh-cn' ? antdZhCN : antdEnUS
|
|
35
|
+
}), /*#__PURE__*/React.createElement(LocaleContext.Provider, {
|
|
36
|
+
value: props.locale || defaultLocale
|
|
37
|
+
}, childNode));
|
|
30
38
|
};
|
|
31
39
|
AldCustomConfigProvider.ConfigContext = ConfigProvider.ConfigContext;
|
|
32
40
|
AldCustomConfigProvider.SizeContext = SizeContext;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
1
|
+
import React, { memo, useContext } from 'react';
|
|
2
2
|
import Result from "../../../Result";
|
|
3
|
+
import { LocaleContext, getTranslator } from "../../../locale/default";
|
|
3
4
|
function ErrorBody(props) {
|
|
5
|
+
var _useContext = useContext(LocaleContext),
|
|
6
|
+
locale = _useContext.locale;
|
|
7
|
+
var t = getTranslator(locale);
|
|
4
8
|
var wrapWidth = props.wrapWidth,
|
|
5
9
|
_props$errorMsg = props.errorMsg,
|
|
6
|
-
errorMsg = _props$errorMsg === void 0 ?
|
|
10
|
+
errorMsg = _props$errorMsg === void 0 ? t.DataPreviewTable.loadFailed : _props$errorMsg;
|
|
7
11
|
return /*#__PURE__*/React.createElement("div", {
|
|
8
12
|
className: "ald-data-preview-table-error",
|
|
9
13
|
style: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
+
import React, { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
3
3
|
import Progress from "../Progress";
|
|
4
4
|
import ScrollArea from "../ScrollArea";
|
|
5
5
|
import Spin from "../Spin";
|
|
6
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
6
7
|
import Body from "./components/Body";
|
|
7
8
|
import Error from "./components/Body/Error";
|
|
8
9
|
import Header from "./components/Header";
|
|
@@ -10,6 +11,9 @@ import { CELL_HEIGHT, DEFAULT_HEADER_HEIGHT } from "./constant";
|
|
|
10
11
|
import useDirection from "./hooks/useDirection";
|
|
11
12
|
var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
12
13
|
var _wrapRef$current5;
|
|
14
|
+
var _useContext = useContext(LocaleContext),
|
|
15
|
+
locale = _useContext.locale;
|
|
16
|
+
var t = getTranslator(locale);
|
|
13
17
|
var _props$columns = props.columns,
|
|
14
18
|
columns = _props$columns === void 0 ? [] : _props$columns,
|
|
15
19
|
_props$datasource = props.datasource,
|
|
@@ -21,7 +25,7 @@ var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
25
|
loading = props.loading,
|
|
22
26
|
dataStatus = props.dataStatus,
|
|
23
27
|
_props$errorMsg = props.errorMsg,
|
|
24
|
-
errorMsg = _props$errorMsg === void 0 ?
|
|
28
|
+
errorMsg = _props$errorMsg === void 0 ? t.DataPreviewTable.dataLoadFailed : _props$errorMsg;
|
|
25
29
|
var realHeaderHeight = Math.max(headerHeight, DEFAULT_HEADER_HEIGHT);
|
|
26
30
|
var contentHeight = useMemo(function () {
|
|
27
31
|
return datasource.length * CELL_HEIGHT + realHeaderHeight;
|
|
@@ -5,6 +5,6 @@ declare const DoubleCircleIcon: (props: {
|
|
|
5
5
|
size?: number | undefined;
|
|
6
6
|
innerColor?: string | undefined;
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
type?: "warning" | "error" | "
|
|
8
|
+
type?: "warning" | "error" | "info" | "success" | undefined;
|
|
9
9
|
}) => React.JSX.Element;
|
|
10
10
|
export default DoubleCircleIcon;
|
package/dist/Dropdown/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OffsetOptions } from '@floating-ui/react';
|
|
1
|
+
import { OffsetOptions, UseHoverProps } from '@floating-ui/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MenuProps } from '../Menu';
|
|
4
4
|
import './style/index.less';
|
|
@@ -67,5 +67,6 @@ export interface IDropdownProps {
|
|
|
67
67
|
* @default false
|
|
68
68
|
*/
|
|
69
69
|
disabled?: boolean;
|
|
70
|
+
delay?: UseHoverProps['delay'];
|
|
70
71
|
}
|
|
71
72
|
export default function Dropdown(props: IDropdownProps): React.JSX.Element;
|
package/dist/Dropdown/index.js
CHANGED
|
@@ -37,7 +37,9 @@ export default function Dropdown(props) {
|
|
|
37
37
|
dropdownRender = props.dropdownRender,
|
|
38
38
|
disabled = props.disabled,
|
|
39
39
|
_props$offset = props.offset,
|
|
40
|
-
offsetProps = _props$offset === void 0 ? 4 : _props$offset
|
|
40
|
+
offsetProps = _props$offset === void 0 ? 4 : _props$offset,
|
|
41
|
+
_props$delay = props.delay,
|
|
42
|
+
delay = _props$delay === void 0 ? 0 : _props$delay;
|
|
41
43
|
var _useState = useState(open || false),
|
|
42
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
43
45
|
isOpen = _useState2[0],
|
|
@@ -69,7 +71,8 @@ export default function Dropdown(props) {
|
|
|
69
71
|
var click = useClick(context);
|
|
70
72
|
var hover = useHover(context, {
|
|
71
73
|
enabled: trigger === 'hover',
|
|
72
|
-
handleClose: safePolygon({})
|
|
74
|
+
handleClose: safePolygon({}),
|
|
75
|
+
delay: delay
|
|
73
76
|
});
|
|
74
77
|
var dismiss = useDismiss(context);
|
|
75
78
|
var role = useRole(context);
|
package/dist/Empty/index.js
CHANGED
|
@@ -9,6 +9,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import * as React from 'react';
|
|
12
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
12
13
|
import DataEmptyImg from "./image/Data";
|
|
13
14
|
import SearchEmptyImg from "./image/Search";
|
|
14
15
|
import SearchEmptySmallImage from "./image/SearchSmall";
|
|
@@ -20,12 +21,15 @@ var workbookEmptyImg = /*#__PURE__*/React.createElement(WorkbookEmptyImg, null);
|
|
|
20
21
|
var dataEmptyImg = /*#__PURE__*/React.createElement(DataEmptyImg, null);
|
|
21
22
|
var searchEmptySmallImage = /*#__PURE__*/React.createElement(SearchEmptySmallImage, null);
|
|
22
23
|
var Empty = function Empty(props) {
|
|
24
|
+
var _React$useContext = React.useContext(LocaleContext),
|
|
25
|
+
locale = _React$useContext.locale;
|
|
26
|
+
var t = getTranslator(locale);
|
|
23
27
|
var className = props.className,
|
|
24
28
|
_props$image = props.image,
|
|
25
29
|
image = _props$image === void 0 ? props.size === 'small' ? searchEmptySmallImage : searchEmptyImg : _props$image,
|
|
26
30
|
description = props.description,
|
|
27
31
|
_props$title = props.title,
|
|
28
|
-
title = _props$title === void 0 ?
|
|
32
|
+
title = _props$title === void 0 ? t.Empty.noContentFound : _props$title,
|
|
29
33
|
size = props.size,
|
|
30
34
|
children = props.children,
|
|
31
35
|
imageStyle = props.imageStyle,
|
|
@@ -17,7 +17,8 @@ export default function HighlightText(props) {
|
|
|
17
17
|
var regex = new RegExp("(".concat(trimKeyword, ")"), 'gi');
|
|
18
18
|
var parts = text.split(regex);
|
|
19
19
|
return /*#__PURE__*/React.createElement("span", {
|
|
20
|
-
className: className
|
|
20
|
+
className: className,
|
|
21
|
+
title: children
|
|
21
22
|
}, parts.map(function (part, index) {
|
|
22
23
|
return regex.test(part) ? /*#__PURE__*/React.createElement("span", {
|
|
23
24
|
key: index,
|
|
@@ -11,11 +11,15 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { useDebounceFn } from 'ahooks';
|
|
12
12
|
import classnames from 'classnames';
|
|
13
13
|
import _ from 'lodash';
|
|
14
|
-
import React, { useCallback, useState } from 'react';
|
|
14
|
+
import React, { useCallback, useContext, useState } from 'react';
|
|
15
15
|
import { SearchLine } from "../Icon";
|
|
16
16
|
import Input from "../Input";
|
|
17
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
17
18
|
var DEFAULT_WIDTH = 68;
|
|
18
19
|
export default function InputSearch(props) {
|
|
20
|
+
var _useContext = useContext(LocaleContext),
|
|
21
|
+
locale = _useContext.locale;
|
|
22
|
+
var t = getTranslator(locale);
|
|
19
23
|
var onSearch = props.onSearch,
|
|
20
24
|
className = props.className,
|
|
21
25
|
_props$debounce = props.debounce,
|
|
@@ -60,7 +64,7 @@ export default function InputSearch(props) {
|
|
|
60
64
|
prefix: /*#__PURE__*/React.createElement(SearchLine, {
|
|
61
65
|
size: 16
|
|
62
66
|
}),
|
|
63
|
-
placeholder: placeholder ||
|
|
67
|
+
placeholder: placeholder || t.InputSearch.search,
|
|
64
68
|
allowClear: true,
|
|
65
69
|
defaultValue: defaultValue
|
|
66
70
|
}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { CSSProperties, FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface ListItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'prefix'> {
|
|
3
|
+
className?: string;
|
|
4
|
+
classNames?: {
|
|
5
|
+
actions?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
};
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
styles?: {
|
|
11
|
+
actions?: CSSProperties;
|
|
12
|
+
prefix?: CSSProperties;
|
|
13
|
+
};
|
|
14
|
+
actions?: ReactNode[];
|
|
15
|
+
prefix?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface ListItemMetaProps {
|
|
18
|
+
avatar?: ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
description?: ReactNode;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
title?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare const Meta: FC<ListItemMetaProps>;
|
|
26
|
+
declare const InternalItem: React.ForwardRefExoticComponent<ListItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export type ListItemTypeProps = typeof InternalItem & {
|
|
28
|
+
Meta: typeof Meta;
|
|
29
|
+
};
|
|
30
|
+
declare const Item: ListItemTypeProps;
|
|
31
|
+
export default Item;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["className", "avatar", "title", "description"],
|
|
3
|
+
_excluded2 = ["children", "actions", "styles", "className", "prefix", "classNames"];
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
|
+
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; }
|
|
12
|
+
import classnames from 'classnames';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
export var Meta = function Meta(_ref) {
|
|
15
|
+
var className = _ref.className,
|
|
16
|
+
avatar = _ref.avatar,
|
|
17
|
+
title = _ref.title,
|
|
18
|
+
description = _ref.description,
|
|
19
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var prefixCls = 'ald-list';
|
|
21
|
+
var classString = classnames("".concat(prefixCls, "-item-meta"), className);
|
|
22
|
+
var content = /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: "".concat(prefixCls, "-item-meta-content")
|
|
24
|
+
}, title && /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: classnames("".concat(prefixCls, "-item-meta-content-title"), _defineProperty({}, "".concat(prefixCls, "-item-meta-content-title-no-description"), !description)),
|
|
26
|
+
title: typeof title === 'string' ? title : ''
|
|
27
|
+
}, title), description && /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "".concat(prefixCls, "-item-meta-content-description"),
|
|
29
|
+
title: typeof description === 'string' ? description : ''
|
|
30
|
+
}, description));
|
|
31
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, others, {
|
|
32
|
+
className: classString
|
|
33
|
+
}), avatar && /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "".concat(prefixCls, "-item-meta-avatar")
|
|
35
|
+
}, avatar), (title || description) && content);
|
|
36
|
+
};
|
|
37
|
+
var InternalItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
38
|
+
var children = props.children,
|
|
39
|
+
actions = props.actions,
|
|
40
|
+
styles = props.styles,
|
|
41
|
+
className = props.className,
|
|
42
|
+
prefix = props.prefix,
|
|
43
|
+
customizeClassNames = props.classNames,
|
|
44
|
+
others = _objectWithoutProperties(props, _excluded2);
|
|
45
|
+
var moduleClass = function moduleClass(moduleName) {
|
|
46
|
+
return classnames(customizeClassNames === null || customizeClassNames === void 0 ? void 0 : customizeClassNames[moduleName]);
|
|
47
|
+
};
|
|
48
|
+
var moduleStyle = function moduleStyle(moduleName) {
|
|
49
|
+
return _objectSpread({}, styles === null || styles === void 0 ? void 0 : styles[moduleName]);
|
|
50
|
+
};
|
|
51
|
+
var prefixCls = 'ald-list';
|
|
52
|
+
var actionsContent = actions && actions.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: classnames("".concat(prefixCls, "-item-action"), moduleClass('actions')),
|
|
54
|
+
key: "actions",
|
|
55
|
+
style: moduleStyle('actions')
|
|
56
|
+
}, actions.map(function (action, i) {
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
key: "".concat(prefixCls, "-item-action-").concat(i)
|
|
59
|
+
}, action, i !== actions.length - 1 && /*#__PURE__*/React.createElement("em", {
|
|
60
|
+
className: "".concat(prefixCls, "-item-action-split")
|
|
61
|
+
}));
|
|
62
|
+
}));
|
|
63
|
+
var prefixContent = prefix && /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: classnames("".concat(prefixCls, "-item-prefix"), moduleClass('prefix')),
|
|
65
|
+
style: moduleStyle('prefix'),
|
|
66
|
+
key: "prefix"
|
|
67
|
+
}, prefix);
|
|
68
|
+
var itemChildren = /*#__PURE__*/React.createElement("div", _extends({}, others, {
|
|
69
|
+
ref: ref,
|
|
70
|
+
className: classnames("".concat(prefixCls, "-item"), className)
|
|
71
|
+
}), [prefixContent, children, actionsContent]);
|
|
72
|
+
return itemChildren;
|
|
73
|
+
});
|
|
74
|
+
var Item = InternalItem;
|
|
75
|
+
Item.Meta = Meta;
|
|
76
|
+
export default Item;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function List<T>(props: ListProps<T>): React.JSX.Element;
|
|
3
|
+
declare namespace List {
|
|
4
|
+
var Item: import("./Item").ListItemTypeProps;
|
|
5
|
+
}
|
|
6
|
+
export default List;
|
|
7
|
+
export interface ListProps<T> {
|
|
8
|
+
size?: 'default' | 'small';
|
|
9
|
+
rowKey?: ((item: T) => React.Key) | keyof T;
|
|
10
|
+
renderItem?: (item: T, index: number) => React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
dataSource?: T[];
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
dividerGap?: number;
|
|
16
|
+
virtual?: boolean;
|
|
17
|
+
itemHeight?: number | ((item: T) => number);
|
|
18
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import ScrollArea from "../ScrollArea";
|
|
9
|
+
import Spin from "../Spin";
|
|
10
|
+
import Item from "./Item";
|
|
11
|
+
function List(props) {
|
|
12
|
+
var _props$dataSource = props.dataSource,
|
|
13
|
+
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
|
14
|
+
renderItem = props.renderItem,
|
|
15
|
+
bordered = props.bordered,
|
|
16
|
+
customizeSize = props.size,
|
|
17
|
+
rowKey = props.rowKey,
|
|
18
|
+
children = props.children,
|
|
19
|
+
className = props.className,
|
|
20
|
+
_props$dividerGap = props.dividerGap,
|
|
21
|
+
dividerGap = _props$dividerGap === void 0 ? 0 : _props$dividerGap,
|
|
22
|
+
_props$loading = props.loading,
|
|
23
|
+
loading = _props$loading === void 0 ? false : _props$loading,
|
|
24
|
+
virtual = props.virtual,
|
|
25
|
+
_props$itemHeight = props.itemHeight,
|
|
26
|
+
itemHeight = _props$itemHeight === void 0 ? 50 : _props$itemHeight;
|
|
27
|
+
var parentRef = React.useRef(null);
|
|
28
|
+
var measureElement = function measureElement(element) {
|
|
29
|
+
return element.offsetHeight;
|
|
30
|
+
};
|
|
31
|
+
var rowVirtualizer = useVirtualizer({
|
|
32
|
+
count: dividerGap === 0 ? dataSource.length : dataSource.length * 2 - 1,
|
|
33
|
+
getScrollElement: function getScrollElement() {
|
|
34
|
+
return parentRef.current;
|
|
35
|
+
},
|
|
36
|
+
estimateSize: function estimateSize(index) {
|
|
37
|
+
if (dividerGap === 0) {
|
|
38
|
+
return typeof itemHeight === 'function' ? itemHeight(dataSource[index]) : itemHeight;
|
|
39
|
+
}
|
|
40
|
+
if (index % 2 === 0) {
|
|
41
|
+
return typeof itemHeight === 'function' ? itemHeight(dataSource[Math.floor(index / 2)]) : itemHeight;
|
|
42
|
+
}
|
|
43
|
+
return 1;
|
|
44
|
+
},
|
|
45
|
+
measureElement: measureElement,
|
|
46
|
+
gap: dividerGap
|
|
47
|
+
});
|
|
48
|
+
function getKey(currentItem, currentIndex) {
|
|
49
|
+
var key;
|
|
50
|
+
if (typeof rowKey === 'function') {
|
|
51
|
+
key = rowKey(currentItem);
|
|
52
|
+
} else if (rowKey) {
|
|
53
|
+
key = currentItem[rowKey];
|
|
54
|
+
} else {
|
|
55
|
+
key = currentItem.key;
|
|
56
|
+
}
|
|
57
|
+
if (!key) {
|
|
58
|
+
key = "list-item-".concat(currentIndex);
|
|
59
|
+
}
|
|
60
|
+
return key;
|
|
61
|
+
}
|
|
62
|
+
var size = customizeSize || 'default';
|
|
63
|
+
var customizeClassNames = classNames('ald-list', _defineProperty({
|
|
64
|
+
'ald-list-bordered': bordered
|
|
65
|
+
}, "ald-list-".concat(size), size), className);
|
|
66
|
+
if (virtual) {
|
|
67
|
+
var renderInnerItem = function renderInnerItem(index) {
|
|
68
|
+
if (!renderItem) return null;
|
|
69
|
+
if (dividerGap === 0) {
|
|
70
|
+
var _item = dataSource[index];
|
|
71
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
72
|
+
key: getKey(_item, index)
|
|
73
|
+
}, renderItem(_item, index));
|
|
74
|
+
} else {
|
|
75
|
+
var isDivider = index % 2 === 1;
|
|
76
|
+
if (isDivider) {
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "ald-list-divider",
|
|
79
|
+
key: "divider-".concat(index)
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
var itemIndex = Math.floor(index / 2);
|
|
83
|
+
var _item2 = dataSource[itemIndex];
|
|
84
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
85
|
+
key: getKey(_item2, itemIndex)
|
|
86
|
+
}, renderItem(_item2, itemIndex));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return /*#__PURE__*/React.createElement(ScrollArea, {
|
|
91
|
+
ref: parentRef,
|
|
92
|
+
asChild: true,
|
|
93
|
+
className: "ald-list-virtual",
|
|
94
|
+
innerClassName: customizeClassNames
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
96
|
+
spinning: loading,
|
|
97
|
+
wrapperClassName: "ald-list-item-wrap",
|
|
98
|
+
style: {
|
|
99
|
+
rowGap: dividerGap,
|
|
100
|
+
height: "".concat(rowVirtualizer.getTotalSize(), "px")
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, rowVirtualizer.getVirtualItems().map(function (virtualItem) {
|
|
103
|
+
var index = virtualItem.index;
|
|
104
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
key: virtualItem.key,
|
|
106
|
+
style: {
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
top: 0,
|
|
109
|
+
left: 0,
|
|
110
|
+
width: '100%',
|
|
111
|
+
height: "".concat(virtualItem.size, "px"),
|
|
112
|
+
transform: "translateY(".concat(virtualItem.start, "px)")
|
|
113
|
+
}
|
|
114
|
+
}, renderInnerItem(index));
|
|
115
|
+
}), children)));
|
|
116
|
+
}
|
|
117
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
ref: parentRef,
|
|
119
|
+
className: customizeClassNames
|
|
120
|
+
}, /*#__PURE__*/React.createElement(Spin, {
|
|
121
|
+
spinning: loading,
|
|
122
|
+
wrapperClassName: "ald-list-item-wrap",
|
|
123
|
+
style: {
|
|
124
|
+
rowGap: dividerGap
|
|
125
|
+
}
|
|
126
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, dataSource.map(function (item, index) {
|
|
127
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
128
|
+
key: getKey(item, index)
|
|
129
|
+
}, renderItem ? renderItem(item, index) : null, index !== dataSource.length - 1 && dividerGap > 0 && /*#__PURE__*/React.createElement("div", {
|
|
130
|
+
className: "ald-list-divider"
|
|
131
|
+
}));
|
|
132
|
+
}), children)));
|
|
133
|
+
}
|
|
134
|
+
List.Item = Item;
|
|
135
|
+
export default List;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
2
|
+
@import '../../Spin/style/index.less';
|
|
3
|
+
@import '../../ScrollArea/style/index.less';
|
|
4
|
+
|
|
5
|
+
.ald-list-virtual {
|
|
6
|
+
.ald-list {
|
|
7
|
+
height: 100%;
|
|
8
|
+
display: block !important;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ald-list {
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
|
|
15
|
+
&-item {
|
|
16
|
+
display: flex;
|
|
17
|
+
padding: var(--alias-padding-75, 6px) var(--alias-padding-100, 8px);
|
|
18
|
+
align-items: center;
|
|
19
|
+
border-radius: var(--alias-radius-75, 6px);
|
|
20
|
+
gap: var(--alias-spacing-75, 6px);
|
|
21
|
+
|
|
22
|
+
&-prefix {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: flex-start;
|
|
25
|
+
align-self: stretch;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
padding: 2px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-meta {
|
|
31
|
+
flex: 1;
|
|
32
|
+
min-width: 0;
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: var(--alias-spacing-75, 6px);
|
|
35
|
+
align-items: center;
|
|
36
|
+
|
|
37
|
+
&-avatar {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-self: stretch;
|
|
40
|
+
align-items: flex-start;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
flex: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&-content {
|
|
47
|
+
min-width: 0;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: var(--alias-spacing-50, 4px);
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
justify-content: stretch;
|
|
53
|
+
|
|
54
|
+
&-title {
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
line-height: 20px;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
text-overflow: ellipsis;
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
|
|
63
|
+
&-no-description {
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&-description {
|
|
69
|
+
font-size: 12px;
|
|
70
|
+
font-weight: 400;
|
|
71
|
+
line-height: 16px;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
max-width: 100%;
|
|
76
|
+
color: var(--alias-colors-text-subtlest, #9ca3af);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&-action {
|
|
82
|
+
display: flex;
|
|
83
|
+
gap: var(--alias-spacing-100, 8px);
|
|
84
|
+
align-items: center;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&-divider {
|
|
89
|
+
height: 1px;
|
|
90
|
+
background-color: var(--alias-colors-border-subtle, #f3f4f6);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ald-list-item-wrap {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
align-items: stretch;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ald-list-small {
|
|
101
|
+
.ald-list-item {
|
|
102
|
+
gap: var(--alias-spacing-75, 6px);
|
|
103
|
+
|
|
104
|
+
&-meta {
|
|
105
|
+
gap: var(--alias-spacing-75, 6px);
|
|
106
|
+
|
|
107
|
+
&-avatar {
|
|
108
|
+
padding: 2px 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&-content {
|
|
112
|
+
gap: var(--alias-spacing-25, 2px);
|
|
113
|
+
|
|
114
|
+
&-title {
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|