@aloudata/aloudata-design 1.3.1 → 1.4.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/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/Progress/index.d.ts +13 -3
- package/dist/Progress/index.js +88 -3
- package/dist/Progress/style/index.less +56 -0
- 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/index.d.ts +1 -0
- package/dist/Select/index.js +64 -26
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/package.json +2 -1
package/dist/Progress/index.js
CHANGED
|
@@ -1,3 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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, { forwardRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';
|
|
17
|
+
var ELoadingState;
|
|
18
|
+
/**
|
|
19
|
+
* 条状进度条组件
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
(function (ELoadingState) {
|
|
23
|
+
ELoadingState["IDLE"] = "IDLE";
|
|
24
|
+
ELoadingState["LOADING"] = "LOADING";
|
|
25
|
+
ELoadingState["LOADED"] = "LOADED";
|
|
26
|
+
})(ELoadingState || (ELoadingState = {}));
|
|
27
|
+
|
|
28
|
+
export default /*#__PURE__*/forwardRef(function Progress(props, ref) {
|
|
29
|
+
var _classNames2;
|
|
30
|
+
|
|
31
|
+
var loading = props.loading,
|
|
32
|
+
className = props.className;
|
|
33
|
+
|
|
34
|
+
var _useState = useState(ELoadingState.IDLE),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
loadingState = _useState2[0],
|
|
37
|
+
setLoadingState = _useState2[1];
|
|
38
|
+
|
|
39
|
+
var _useState3 = useState(0),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
key = _useState4[0],
|
|
42
|
+
setKey = _useState4[1];
|
|
43
|
+
|
|
44
|
+
useImperativeHandle(ref, function () {
|
|
45
|
+
return {
|
|
46
|
+
restart: function restart() {
|
|
47
|
+
setKey(function (prev) {
|
|
48
|
+
return prev + 1;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
if (loadingState !== ELoadingState.IDLE) {
|
|
55
|
+
if (loadingState === ELoadingState.LOADING && !loading) {
|
|
56
|
+
// loading 变为 false 时,进度条开始消失
|
|
57
|
+
setLoadingState(ELoadingState.LOADED);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return;
|
|
61
|
+
} // 防止 loading 快速变化导致的闪烁
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
var DELAY_TIME = 200;
|
|
65
|
+
var timer = setTimeout(function () {
|
|
66
|
+
if (loading) {
|
|
67
|
+
setLoadingState(ELoadingState.LOADING);
|
|
68
|
+
}
|
|
69
|
+
}, DELAY_TIME);
|
|
70
|
+
return function () {
|
|
71
|
+
if (timer) {
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}, [loading, loadingState]);
|
|
76
|
+
var onAnimationEnd = useCallback(function () {
|
|
77
|
+
if (loadingState === ELoadingState.LOADED) {
|
|
78
|
+
setLoadingState(ELoadingState.IDLE);
|
|
79
|
+
}
|
|
80
|
+
}, [loadingState]);
|
|
81
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
key: key,
|
|
83
|
+
className: classNames('ald-progress-bar', className, _defineProperty({}, 'ald-progress-bar-show-bg', loadingState !== ELoadingState.IDLE))
|
|
84
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: classNames('ald-progress-bar-inner', (_classNames2 = {}, _defineProperty(_classNames2, 'ald-progress-bar-show-loading', loadingState === ELoadingState.LOADING), _defineProperty(_classNames2, 'ald-progress-bar-hide-loading', loadingState === ELoadingState.LOADED), _classNames2)),
|
|
86
|
+
onAnimationEnd: onAnimationEnd
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
@@ -1 +1,57 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
|
+
|
|
3
|
+
.ald-progress-bar {
|
|
4
|
+
border-radius: 2px 0 0;
|
|
5
|
+
height: 3px;
|
|
6
|
+
width: 100%;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
|
|
9
|
+
&-show-bg {
|
|
10
|
+
background-color: #d6e3f4;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&-inner {
|
|
14
|
+
background-color: #3271c9;
|
|
15
|
+
border-radius: 2px 0 0;
|
|
16
|
+
height: 100%;
|
|
17
|
+
width: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-show-loading {
|
|
21
|
+
animation: loading 2s ease-in-out forwards;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-hide-loading {
|
|
25
|
+
animation: disappear 0.5s forwards;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes loading {
|
|
30
|
+
0% {
|
|
31
|
+
width: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
90% {
|
|
35
|
+
width: 90%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
100% {
|
|
39
|
+
width: 90%;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes disappear {
|
|
44
|
+
0% {
|
|
45
|
+
width: 90%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
99% {
|
|
49
|
+
width: 99%;
|
|
50
|
+
opacity: 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
100% {
|
|
54
|
+
width: 100%;
|
|
55
|
+
opacity: 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ScrollAreaProps } from '@radix-ui/react-scroll-area';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
interface Props extends ScrollAreaProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
horizontalScrollBarClassName?: string;
|
|
7
|
+
verticalScrollBarClassName?: string;
|
|
8
|
+
onViewportScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var _excluded = ["children", "className", "horizontalScrollBarClassName", "verticalScrollBarClassName", "onViewportScroll"];
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
import * as ScrollAreaComponent from '@radix-ui/react-scroll-area';
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import React, { forwardRef, memo } from 'react';
|
|
12
|
+
|
|
13
|
+
var ScrollArea = function ScrollArea(props, ref) {
|
|
14
|
+
var children = props.children,
|
|
15
|
+
className = props.className,
|
|
16
|
+
horizontalScrollBarClassName = props.horizontalScrollBarClassName,
|
|
17
|
+
verticalScrollBarClassName = props.verticalScrollBarClassName,
|
|
18
|
+
onViewportScroll = props.onViewportScroll,
|
|
19
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
20
|
+
|
|
21
|
+
return /*#__PURE__*/React.createElement(ScrollAreaComponent.Root, _extends({}, rest, {
|
|
22
|
+
scrollHideDelay: 50,
|
|
23
|
+
className: classNames('ald-scroll-area', className)
|
|
24
|
+
}), /*#__PURE__*/React.createElement(ScrollAreaComponent.Viewport, {
|
|
25
|
+
className: "ald-scroll-area-inner",
|
|
26
|
+
onScroll: function onScroll(event) {
|
|
27
|
+
onViewportScroll === null || onViewportScroll === void 0 ? void 0 : onViewportScroll(event);
|
|
28
|
+
},
|
|
29
|
+
ref: ref
|
|
30
|
+
}, children), /*#__PURE__*/React.createElement(ScrollAreaComponent.Scrollbar, {
|
|
31
|
+
style: {
|
|
32
|
+
right: 3
|
|
33
|
+
},
|
|
34
|
+
className: classNames('ald-scroll-area-bar', verticalScrollBarClassName),
|
|
35
|
+
orientation: "vertical"
|
|
36
|
+
}, /*#__PURE__*/React.createElement(ScrollAreaComponent.Thumb, {
|
|
37
|
+
className: 'ald-scroll-area-thumb'
|
|
38
|
+
})), /*#__PURE__*/React.createElement(ScrollAreaComponent.Scrollbar, {
|
|
39
|
+
className: classNames('ald-scroll-area-bar', horizontalScrollBarClassName),
|
|
40
|
+
style: {
|
|
41
|
+
bottom: 3
|
|
42
|
+
},
|
|
43
|
+
orientation: "horizontal"
|
|
44
|
+
}, /*#__PURE__*/React.createElement(ScrollAreaComponent.Thumb, {
|
|
45
|
+
className: 'ald-scroll-area-thumb'
|
|
46
|
+
})));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default /*#__PURE__*/memo( /*#__PURE__*/forwardRef(ScrollArea));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
2
|
+
|
|
3
|
+
.ald-scroll-area {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
|
|
9
|
+
--scrollbar-size: 6px;
|
|
10
|
+
// 滚动条轨道
|
|
11
|
+
.ald-scroll-area-bar {
|
|
12
|
+
z-index: 6;
|
|
13
|
+
display: flex;
|
|
14
|
+
user-select: none;
|
|
15
|
+
touch-action: none;
|
|
16
|
+
background: transparent;
|
|
17
|
+
transition: background 160ms ease-out;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ald-scroll-area-bar[data-orientation='vertical'] {
|
|
21
|
+
width: var(--scrollbar-size);
|
|
22
|
+
padding: 2px 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ald-scroll-area-bar[data-orientation='horizontal'] {
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
padding: 0 2px;
|
|
28
|
+
height: var(--scrollbar-size);
|
|
29
|
+
}
|
|
30
|
+
// 滚动条可拖动条
|
|
31
|
+
.ald-scroll-area-thumb {
|
|
32
|
+
flex: 1;
|
|
33
|
+
background: #575757;
|
|
34
|
+
border-radius: var(--scrollbar-size);
|
|
35
|
+
position: relative;
|
|
36
|
+
opacity: 0.2;
|
|
37
|
+
|
|
38
|
+
&:hover {
|
|
39
|
+
opacity: 0.6;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ald-scroll-area-inner {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
export interface ISelectProps extends Omit<SelectProps, 'mode'> {
|
|
4
4
|
prefix?: React.ReactNode;
|
|
5
5
|
mode?: 'multiple';
|
|
6
|
+
showAllOption?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare type IRefSelectProps = RefSelectProps;
|
|
8
9
|
export declare type IAldRefSelectProps = IRefSelectProps & {
|
package/dist/Select/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var _excluded = ["mode", "options", "dropdownRender", "onDropdownVisibleChange", "defaultValue", "onChange", "open", "defaultOpen", "prefix", "className", "popupClassName", "listHeight", "listItemHeight", "notFoundContent", "value", "tagRender", "style", "autoFocus"];
|
|
1
|
+
var _excluded = ["mode", "options", "dropdownRender", "onDropdownVisibleChange", "defaultValue", "onChange", "open", "defaultOpen", "prefix", "className", "popupClassName", "listHeight", "listItemHeight", "notFoundContent", "value", "tagRender", "style", "autoFocus", "showSearch", "showAllOption"];
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
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."); }
|
|
10
10
|
|
|
11
|
-
function
|
|
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
12
|
|
|
13
|
-
function
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
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."); }
|
|
18
18
|
|
|
19
19
|
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); }
|
|
20
20
|
|
|
21
|
-
function
|
|
21
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
24
|
|
|
25
|
-
function
|
|
25
|
+
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; }
|
|
26
26
|
|
|
27
27
|
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; }
|
|
28
28
|
|
|
@@ -37,6 +37,7 @@ import Empty from "../Empty";
|
|
|
37
37
|
import theme from "../style/themes/default/themeColor.module.less";
|
|
38
38
|
import MultipleOption from "./components/MultipleOption";
|
|
39
39
|
import SingleOption from "./components/SingleOption";
|
|
40
|
+
var DEFAULT_ALL_OPTION_VALUE = 'default_all_option_value';
|
|
40
41
|
var suffixIconSizeMap = {
|
|
41
42
|
large: 20,
|
|
42
43
|
middle: 16,
|
|
@@ -112,11 +113,25 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
112
113
|
_props$style = props.style,
|
|
113
114
|
style = _props$style === void 0 ? {} : _props$style,
|
|
114
115
|
autoFocus = props.autoFocus,
|
|
116
|
+
_props$showSearch = props.showSearch,
|
|
117
|
+
showSearch = _props$showSearch === void 0 ? false : _props$showSearch,
|
|
118
|
+
showAllOption = props.showAllOption,
|
|
115
119
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
116
120
|
|
|
117
121
|
var isMultiple = mode === 'multiple';
|
|
122
|
+
var innerOptions = useMemo(function () {
|
|
123
|
+
if (showAllOption && isMultiple && options) {
|
|
124
|
+
return [{
|
|
125
|
+
label: '全部',
|
|
126
|
+
value: DEFAULT_ALL_OPTION_VALUE,
|
|
127
|
+
__IS_INNER_ALL_OPTION: true
|
|
128
|
+
}].concat(_toConsumableArray(options || []));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return options;
|
|
132
|
+
}, [options, showAllOption, isMultiple]);
|
|
118
133
|
|
|
119
|
-
var _React$useState = React.useState(getSelectedOptionsFromValue(isMultiple,
|
|
134
|
+
var _React$useState = React.useState(getSelectedOptionsFromValue(isMultiple, innerOptions, value, defaultValue)),
|
|
120
135
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
121
136
|
selectedOptions = _React$useState2[0],
|
|
122
137
|
setSelectedOptions = _React$useState2[1];
|
|
@@ -183,18 +198,31 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
183
198
|
if (selected) {
|
|
184
199
|
var _props$onSelect;
|
|
185
200
|
|
|
186
|
-
|
|
201
|
+
if (option.__IS_INNER_ALL_OPTION) {
|
|
202
|
+
newOptions = (innerOptions === null || innerOptions === void 0 ? void 0 : innerOptions.filter(function (item) {
|
|
203
|
+
return !item.__IS_INNER_ALL_OPTION && !item.disabled;
|
|
204
|
+
})) || [];
|
|
205
|
+
} else {
|
|
206
|
+
newOptions = [].concat(_toConsumableArray(selectedOptions), [option]);
|
|
207
|
+
}
|
|
208
|
+
|
|
187
209
|
(_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, option.value, option);
|
|
188
210
|
} else {
|
|
189
211
|
var _props$onDeselect;
|
|
190
212
|
|
|
191
213
|
(_props$onDeselect = props.onDeselect) === null || _props$onDeselect === void 0 ? void 0 : _props$onDeselect.call(props, option.value, option);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
214
|
+
|
|
215
|
+
if (option.__IS_INNER_ALL_OPTION) {
|
|
216
|
+
newOptions = [];
|
|
217
|
+
} else {
|
|
218
|
+
newOptions = selectedOptions.filter(function (item) {
|
|
219
|
+
return item.value !== option.value;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
195
222
|
}
|
|
196
223
|
|
|
197
224
|
if (typeof value === 'undefined') {
|
|
225
|
+
console.log(newOptions, 'newOptions');
|
|
198
226
|
setSelectedOptions(newOptions);
|
|
199
227
|
}
|
|
200
228
|
|
|
@@ -204,8 +232,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
204
232
|
};
|
|
205
233
|
|
|
206
234
|
var getListHeight = function getListHeight() {
|
|
207
|
-
if (typeof listHeight === 'number' &&
|
|
208
|
-
if (listHeight <=
|
|
235
|
+
if (typeof listHeight === 'number' && innerOptions !== null && innerOptions !== void 0 && innerOptions.length) {
|
|
236
|
+
if (listHeight <= innerOptions.length * listItemHeight) {
|
|
209
237
|
return listHeight;
|
|
210
238
|
}
|
|
211
239
|
}
|
|
@@ -217,15 +245,24 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
217
245
|
return /*#__PURE__*/React.createElement("div", {
|
|
218
246
|
className: "ald-multiple-option-list"
|
|
219
247
|
}, /*#__PURE__*/React.createElement(List, {
|
|
220
|
-
data:
|
|
248
|
+
data: innerOptions || [],
|
|
221
249
|
"data-id": "list",
|
|
222
250
|
height: getListHeight(),
|
|
223
251
|
itemHeight: listItemHeight,
|
|
224
252
|
itemKey: "value"
|
|
225
253
|
}, function (option) {
|
|
226
|
-
var isSelected =
|
|
227
|
-
|
|
228
|
-
|
|
254
|
+
var isSelected = false;
|
|
255
|
+
|
|
256
|
+
if (option.__IS_INNER_ALL_OPTION) {
|
|
257
|
+
isSelected = selectedOptions.length === (innerOptions === null || innerOptions === void 0 ? void 0 : innerOptions.filter(function (option) {
|
|
258
|
+
return !option.__IS_INNER_ALL_OPTION && !option.disabled;
|
|
259
|
+
}).length);
|
|
260
|
+
} else {
|
|
261
|
+
isSelected = selectedOptions.some(function (selectedOption) {
|
|
262
|
+
return selectedOption.value === option.value;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
229
266
|
return /*#__PURE__*/React.createElement(MultipleOption, {
|
|
230
267
|
key: option.value,
|
|
231
268
|
selected: isSelected,
|
|
@@ -255,7 +292,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
255
292
|
return /*#__PURE__*/React.createElement("div", {
|
|
256
293
|
className: "ald-single-option-list"
|
|
257
294
|
}, /*#__PURE__*/React.createElement(List, {
|
|
258
|
-
data:
|
|
295
|
+
data: innerOptions || [],
|
|
259
296
|
"data-id": "list",
|
|
260
297
|
height: getListHeight(),
|
|
261
298
|
itemHeight: listItemHeight,
|
|
@@ -291,7 +328,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
291
328
|
return dropdownRender(_menu);
|
|
292
329
|
};
|
|
293
330
|
}
|
|
294
|
-
} else if (Array.isArray(
|
|
331
|
+
} else if (Array.isArray(innerOptions) && innerOptions.length > 0) {
|
|
295
332
|
if (!isMultiple) {
|
|
296
333
|
return singleRender;
|
|
297
334
|
} else {
|
|
@@ -341,11 +378,11 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
341
378
|
|
|
342
379
|
useEffect(function () {
|
|
343
380
|
if (updatedRef.current) {
|
|
344
|
-
setSelectedOptions(getSelectedOptionsFromValue(isMultiple,
|
|
381
|
+
setSelectedOptions(getSelectedOptionsFromValue(isMultiple, innerOptions, value));
|
|
345
382
|
} else {
|
|
346
383
|
updatedRef.current = true;
|
|
347
384
|
}
|
|
348
|
-
}, [value]);
|
|
385
|
+
}, [value, innerOptions, isMultiple]);
|
|
349
386
|
return /*#__PURE__*/React.createElement("div", {
|
|
350
387
|
className: classNames('ald-select', className, {
|
|
351
388
|
'ald-select-multiple': isMultiple,
|
|
@@ -368,7 +405,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
368
405
|
}
|
|
369
406
|
}
|
|
370
407
|
}, prefix), /*#__PURE__*/React.createElement(AntdSelect, _extends({}, restProps, {
|
|
371
|
-
|
|
408
|
+
showSearch: showSearch,
|
|
409
|
+
options: innerOptions,
|
|
372
410
|
mode: isMultiple ? 'multiple' : undefined,
|
|
373
411
|
bordered: false,
|
|
374
412
|
open: typeof _open === 'boolean' ? _open : isOpen,
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export type { CollapsePanelProps, CollapseProps } from './Collapse';
|
|
|
19
19
|
export { default as ColorPicker } from './ColorPicker';
|
|
20
20
|
export type { IColorPickerProps } from './ColorPicker';
|
|
21
21
|
export { default as ConfigProvider } from './ConfigProvider';
|
|
22
|
+
export { default as DataPreviewTable } from './DataPreviewTable';
|
|
22
23
|
export { default as DatePicker } from './DatePicker';
|
|
23
24
|
export type { DatePickerProps } from './DatePicker';
|
|
24
25
|
export { default as Divider } from './Divider';
|
|
@@ -53,11 +54,12 @@ export type { PopconfirmProps } from './Popconfirm';
|
|
|
53
54
|
export { default as Popover } from './Popover';
|
|
54
55
|
export type { PopoverProps } from './Popover';
|
|
55
56
|
export { default as Progress } from './Progress';
|
|
56
|
-
export type { ProgressProps } from './Progress';
|
|
57
|
+
export type { IProgressRef, IProps as ProgressProps } from './Progress';
|
|
57
58
|
export { default as Radio } from './Radio';
|
|
58
59
|
export type { RadioGroupProps, RadioProps } from './Radio';
|
|
59
60
|
export { default as Row } from './Row';
|
|
60
61
|
export type { RowProps } from './Row';
|
|
62
|
+
export { default as ScrollArea } from './ScrollArea';
|
|
61
63
|
export { default as Select } from './Select';
|
|
62
64
|
export type { IRefSelectProps as RefSelectProps, ISelectProps as SelectProps, } from './Select';
|
|
63
65
|
export { default as Skeleton } from './Skeleton';
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { default as Col } from "./Col";
|
|
|
11
11
|
export { default as Collapse } from "./Collapse";
|
|
12
12
|
export { default as ColorPicker } from "./ColorPicker";
|
|
13
13
|
export { default as ConfigProvider } from "./ConfigProvider";
|
|
14
|
+
export { default as DataPreviewTable } from "./DataPreviewTable";
|
|
14
15
|
export { default as DatePicker } from "./DatePicker";
|
|
15
16
|
export { default as Divider } from "./Divider";
|
|
16
17
|
export { default as Drawer } from "./Drawer";
|
|
@@ -33,6 +34,7 @@ export { default as Popover } from "./Popover";
|
|
|
33
34
|
export { default as Progress } from "./Progress";
|
|
34
35
|
export { default as Radio } from "./Radio";
|
|
35
36
|
export { default as Row } from "./Row";
|
|
37
|
+
export { default as ScrollArea } from "./ScrollArea";
|
|
36
38
|
export { default as Select } from "./Select";
|
|
37
39
|
export { default as Skeleton } from "./Skeleton";
|
|
38
40
|
export { default as Space } from "./Space";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aloudata/aloudata-design",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"@babel/preset-react": "^7.18.6",
|
|
70
70
|
"@commitlint/cli": "^17.5.1",
|
|
71
71
|
"@commitlint/config-conventional": "^17.4.4",
|
|
72
|
+
"@radix-ui/react-scroll-area": "^1.0.4",
|
|
72
73
|
"@testing-library/jest-dom": "^5.16.5",
|
|
73
74
|
"@testing-library/react": "^13.4.0",
|
|
74
75
|
"@types/jest": "^29.4.0",
|