@aloudata/aloudata-design 2.15.13 → 2.17.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/AMenu/index.d.ts +3 -0
- package/dist/AMenu/index.js +2 -0
- package/dist/AMenu/style/index.d.ts +2 -0
- package/dist/AMenu/style/index.js +2 -0
- package/dist/AMenu/style/index.less +1 -0
- package/dist/Avatar/component/Avatar/helper.d.ts +11 -0
- package/dist/Avatar/component/Avatar/helper.js +83 -0
- package/dist/Avatar/component/Avatar/index.d.ts +7 -8
- package/dist/Avatar/component/Avatar/index.js +55 -27
- package/dist/Avatar/component/Avatar/type.d.ts +22 -0
- package/dist/Avatar/component/Avatar/type.js +16 -0
- package/dist/Avatar/style/index.less +4 -33
- package/dist/MemberPicker/index.js +16 -5
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +4 -2
- package/dist/Modal/style/modal.less +28 -0
- package/dist/User/index.js +1 -1
- package/dist/ald.min.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/index.less +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TAvatarSize } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* 根据头像大小获取合适的字体大小和缩放样式
|
|
4
|
+
* @param size 头像大小,可以是预设值或数字
|
|
5
|
+
* @returns 包含fontSize和可能的transform样式的对象
|
|
6
|
+
*/
|
|
7
|
+
export declare const getFontSize: (size: TAvatarSize | number) => {
|
|
8
|
+
fontSize: number;
|
|
9
|
+
transform?: string | undefined;
|
|
10
|
+
fontWeight?: number | undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AVATAR_SIZE_MAP, AVATAR_SIZE_TO_FONT_SIZE } from "./type";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 根据头像大小获取合适的字体大小和缩放样式
|
|
5
|
+
* @param size 头像大小,可以是预设值或数字
|
|
6
|
+
* @returns 包含fontSize和可能的transform样式的对象
|
|
7
|
+
*/
|
|
8
|
+
export var getFontSize = function getFontSize(size) {
|
|
9
|
+
// 1. 将TAvatarSize转换为像素值
|
|
10
|
+
var pixelSize = typeof size === 'number' ? size : AVATAR_SIZE_MAP[size] || 32;
|
|
11
|
+
|
|
12
|
+
// 2. 计算合适的字体大小
|
|
13
|
+
var fontSize;
|
|
14
|
+
|
|
15
|
+
// 2.1 先检查映射表中是否有对应值
|
|
16
|
+
if (pixelSize in AVATAR_SIZE_TO_FONT_SIZE) {
|
|
17
|
+
fontSize = AVATAR_SIZE_TO_FONT_SIZE[pixelSize];
|
|
18
|
+
} else {
|
|
19
|
+
// 2.2 如果没有对应值,根据区间确定合适的字体大小
|
|
20
|
+
|
|
21
|
+
// 定义关键区间点
|
|
22
|
+
var sizeBenchmarks = Object.keys(AVATAR_SIZE_TO_FONT_SIZE).map(Number).sort(function (a, b) {
|
|
23
|
+
return a - b;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// 如果小于最小基准点
|
|
27
|
+
if (pixelSize < sizeBenchmarks[0]) {
|
|
28
|
+
// 对于非常小的尺寸,使用比例计算,但不小于6px
|
|
29
|
+
fontSize = Math.max(6, Math.floor(pixelSize / 2));
|
|
30
|
+
// 确保为偶数
|
|
31
|
+
fontSize = fontSize % 2 === 0 ? fontSize : fontSize - 1;
|
|
32
|
+
}
|
|
33
|
+
// 如果大于最大基准点
|
|
34
|
+
else if (pixelSize > sizeBenchmarks[sizeBenchmarks.length - 1]) {
|
|
35
|
+
// 对于特大尺寸,使用简单的比例计算,确保单调增长
|
|
36
|
+
var largestSize = sizeBenchmarks[sizeBenchmarks.length - 1];
|
|
37
|
+
var largestFontSize = AVATAR_SIZE_TO_FONT_SIZE[largestSize];
|
|
38
|
+
var ratio = largestFontSize / largestSize;
|
|
39
|
+
fontSize = Math.floor(pixelSize * ratio);
|
|
40
|
+
|
|
41
|
+
// 确保为偶数
|
|
42
|
+
fontSize = fontSize % 2 === 0 ? fontSize : fontSize - 1;
|
|
43
|
+
}
|
|
44
|
+
// 在两个基准点之间
|
|
45
|
+
else {
|
|
46
|
+
// 找到最近的两个基准点
|
|
47
|
+
var lowerIndex = 0;
|
|
48
|
+
for (var i = 0; i < sizeBenchmarks.length - 1; i++) {
|
|
49
|
+
if (pixelSize >= sizeBenchmarks[i] && pixelSize < sizeBenchmarks[i + 1]) {
|
|
50
|
+
lowerIndex = i;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
var lowerSize = sizeBenchmarks[lowerIndex];
|
|
55
|
+
var upperSize = sizeBenchmarks[lowerIndex + 1];
|
|
56
|
+
var lowerFontSize = AVATAR_SIZE_TO_FONT_SIZE[lowerSize];
|
|
57
|
+
var upperFontSize = AVATAR_SIZE_TO_FONT_SIZE[upperSize];
|
|
58
|
+
|
|
59
|
+
// 线性插值计算
|
|
60
|
+
var _ratio = (pixelSize - lowerSize) / (upperSize - lowerSize);
|
|
61
|
+
fontSize = Math.floor(lowerFontSize + _ratio * (upperFontSize - lowerFontSize));
|
|
62
|
+
|
|
63
|
+
// 确保为偶数
|
|
64
|
+
fontSize = fontSize % 2 === 0 ? fontSize : fontSize - 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 3. 处理小于12px的字体
|
|
69
|
+
if (fontSize < 12) {
|
|
70
|
+
var scale = fontSize / 12;
|
|
71
|
+
return {
|
|
72
|
+
fontSize: 12,
|
|
73
|
+
transform: "scale(".concat(scale, ")"),
|
|
74
|
+
fontWeight: 600
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 4. 返回结果
|
|
79
|
+
return {
|
|
80
|
+
fontSize: fontSize,
|
|
81
|
+
fontWeight: 500
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AvatarProps as antdAvatarProps } from 'antd/lib/avatar/avatar';
|
|
2
2
|
import Group from 'antd/lib/avatar/group';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
|
|
5
|
-
type TSize = 'large' | 'middle' | 'small' | number;
|
|
4
|
+
import { TAvatarSize } from './type';
|
|
6
5
|
export interface IAvatarProps extends Omit<antdAvatarProps, 'size'> {
|
|
7
6
|
/**
|
|
8
7
|
* @description 指定头像的形状
|
|
@@ -65,17 +64,17 @@ export interface IAvatarProps extends Omit<antdAvatarProps, 'size'> {
|
|
|
65
64
|
*/
|
|
66
65
|
onError?: () => boolean;
|
|
67
66
|
/**
|
|
68
|
-
* @description 头像的大小,可以显示的设置数字或者预设的大小值
|
|
67
|
+
* @description 头像的大小,可以显示的设置数字或者预设的大小值 40 32 28
|
|
69
68
|
* @type 'large' | 'middle' | 'small' | number
|
|
70
69
|
* @default middle
|
|
71
70
|
*/
|
|
72
|
-
size?:
|
|
71
|
+
size?: TAvatarSize;
|
|
73
72
|
/**
|
|
74
|
-
* @description
|
|
75
|
-
* @type
|
|
76
|
-
* @default
|
|
73
|
+
* @description 头像的类型
|
|
74
|
+
* @type 'default' | 'user' | 'userGroup'
|
|
75
|
+
* @default default
|
|
77
76
|
*/
|
|
78
|
-
|
|
77
|
+
type?: 'user' | 'userGroup' | 'count';
|
|
79
78
|
}
|
|
80
79
|
interface ICompoundedComponent extends React.ForwardRefExoticComponent<IAvatarProps & React.RefAttributes<HTMLElement>> {
|
|
81
80
|
Group: typeof Group;
|
|
@@ -1,48 +1,76 @@
|
|
|
1
|
-
var _excluded = ["size", "
|
|
1
|
+
var _excluded = ["size", "children", "src", "icon", "type"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
import InternalAvatar from 'antd/lib/avatar/avatar';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
6
|
import * as React from 'react';
|
|
8
7
|
import { User } from "../../../Icon";
|
|
8
|
+
import _ from 'lodash';
|
|
9
|
+
import { useCallback, useMemo } from 'react';
|
|
10
|
+
import { AVATAR_SIZE_MAP, AVATAR_TYPE_TO_BG_COLOR } from "./type";
|
|
11
|
+
import { getFontSize } from "./helper";
|
|
12
|
+
import classNames from 'classnames';
|
|
9
13
|
var ZERO = 0;
|
|
10
14
|
var Avatar = function Avatar(props) {
|
|
11
15
|
var _props$size = props.size,
|
|
12
16
|
size = _props$size === void 0 ? 'middle' : _props$size,
|
|
13
|
-
_props$showFullValue = props.showFullValue,
|
|
14
|
-
showFullValue = _props$showFullValue === void 0 ? false : _props$showFullValue,
|
|
15
17
|
children = props.children,
|
|
16
18
|
src = props.src,
|
|
19
|
+
icon = props.icon,
|
|
20
|
+
type = props.type,
|
|
17
21
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
defaultAvatarClassName = 'ald-avatar-default';
|
|
22
|
-
}
|
|
23
|
-
if (['large', 'small', 'mini'].includes("".concat(avatarSize))) {
|
|
24
|
-
return classNames('ald-avatar', defaultAvatarClassName, "ald-avatar-".concat(avatarSize));
|
|
22
|
+
var getSize = useCallback(function () {
|
|
23
|
+
if (typeof size === 'number') {
|
|
24
|
+
return size;
|
|
25
25
|
}
|
|
26
|
-
return
|
|
27
|
-
};
|
|
28
|
-
var getChildren = function
|
|
29
|
-
if (
|
|
26
|
+
return AVATAR_SIZE_MAP[size] || 32;
|
|
27
|
+
}, [size]);
|
|
28
|
+
var getChildren = useCallback(function () {
|
|
29
|
+
if (typeof children === 'string') {
|
|
30
30
|
return children[ZERO].toLocaleUpperCase();
|
|
31
31
|
}
|
|
32
32
|
return children;
|
|
33
|
-
};
|
|
34
|
-
var
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
}, [children]);
|
|
34
|
+
var bgColor = useMemo(function () {
|
|
35
|
+
if (type) {
|
|
36
|
+
return AVATAR_TYPE_TO_BG_COLOR[type];
|
|
37
|
+
}
|
|
38
|
+
return AVATAR_TYPE_TO_BG_COLOR.user;
|
|
39
|
+
}, [type]);
|
|
40
|
+
var fontColor = useMemo(function () {
|
|
41
|
+
if (type === 'count') {
|
|
42
|
+
return '#1F2937';
|
|
43
|
+
}
|
|
44
|
+
return '#fff';
|
|
45
|
+
}, [type]);
|
|
46
|
+
var innerIcon = useMemo(function () {
|
|
47
|
+
if (icon) {
|
|
48
|
+
return icon;
|
|
49
|
+
}
|
|
50
|
+
if (!_.isNil(children)) {
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
style: {
|
|
53
|
+
backgroundColor: bgColor,
|
|
54
|
+
color: fontColor,
|
|
55
|
+
height: '100%',
|
|
56
|
+
width: '100%',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'center'
|
|
60
|
+
}
|
|
61
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
62
|
+
style: getFontSize(getSize())
|
|
63
|
+
}, getChildren()));
|
|
39
64
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
65
|
+
return /*#__PURE__*/React.createElement(User, {
|
|
66
|
+
size: getSize()
|
|
67
|
+
});
|
|
68
|
+
}, [icon, getSize, children, getChildren, bgColor, fontColor]);
|
|
42
69
|
return /*#__PURE__*/React.createElement(InternalAvatar, _extends({}, restProps, {
|
|
43
|
-
size:
|
|
44
|
-
className: classNames(
|
|
45
|
-
|
|
46
|
-
|
|
70
|
+
size: getSize(),
|
|
71
|
+
className: classNames(restProps.className, 'ald-avatar'),
|
|
72
|
+
icon: innerIcon,
|
|
73
|
+
src: src
|
|
74
|
+
}));
|
|
47
75
|
};
|
|
48
76
|
export default Avatar;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type TAvatarSize = 'large' | 'middle' | 'small' | number;
|
|
2
|
+
export type { GroupProps } from 'antd/lib/avatar/group';
|
|
3
|
+
export declare const AVATAR_SIZE_MAP: {
|
|
4
|
+
large: number;
|
|
5
|
+
middle: number;
|
|
6
|
+
small: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const AVATAR_SIZE_TO_FONT_SIZE: {
|
|
9
|
+
16: number;
|
|
10
|
+
20: number;
|
|
11
|
+
24: number;
|
|
12
|
+
28: number;
|
|
13
|
+
32: number;
|
|
14
|
+
40: number;
|
|
15
|
+
48: number;
|
|
16
|
+
64: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const AVATAR_TYPE_TO_BG_COLOR: {
|
|
19
|
+
user: string;
|
|
20
|
+
userGroup: string;
|
|
21
|
+
count: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var _AVATAR_SIZE_TO_FONT_;
|
|
2
|
+
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); }
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
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); }
|
|
6
|
+
export var AVATAR_SIZE_MAP = {
|
|
7
|
+
large: 40,
|
|
8
|
+
middle: 32,
|
|
9
|
+
small: 28
|
|
10
|
+
};
|
|
11
|
+
export var AVATAR_SIZE_TO_FONT_SIZE = (_AVATAR_SIZE_TO_FONT_ = {}, _defineProperty(_AVATAR_SIZE_TO_FONT_, 16, 8), _defineProperty(_AVATAR_SIZE_TO_FONT_, 20, 10), _defineProperty(_AVATAR_SIZE_TO_FONT_, 24, 10), _defineProperty(_AVATAR_SIZE_TO_FONT_, 28, 12), _defineProperty(_AVATAR_SIZE_TO_FONT_, 32, 12), _defineProperty(_AVATAR_SIZE_TO_FONT_, 40, 14), _defineProperty(_AVATAR_SIZE_TO_FONT_, 48, 16), _defineProperty(_AVATAR_SIZE_TO_FONT_, 64, 24), _AVATAR_SIZE_TO_FONT_);
|
|
12
|
+
export var AVATAR_TYPE_TO_BG_COLOR = {
|
|
13
|
+
user: '#1D4ED8',
|
|
14
|
+
userGroup: '#15803D',
|
|
15
|
+
count: '#E5E7EB'
|
|
16
|
+
};
|
|
@@ -1,41 +1,12 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
|
|
3
3
|
.ald-avatar.ald-avatar {
|
|
4
|
-
color: @ND0;
|
|
5
4
|
background-color: #fff;
|
|
5
|
+
color: #1f2937;
|
|
6
6
|
border: 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&-large {
|
|
13
|
-
width: 40px;
|
|
14
|
-
height: 40px;
|
|
15
|
-
font-size: 20px;
|
|
16
|
-
line-height: 40px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&-middle {
|
|
20
|
-
width: 32px;
|
|
21
|
-
height: 32px;
|
|
22
|
-
font-size: 16px;
|
|
23
|
-
line-height: 32px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&-small {
|
|
27
|
-
width: 28px;
|
|
28
|
-
height: 28px;
|
|
29
|
-
font-size: 14px;
|
|
30
|
-
line-height: 28px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&-mini {
|
|
34
|
-
width: 24px;
|
|
35
|
-
height: 24px;
|
|
36
|
-
font-size: 12px;
|
|
37
|
-
line-height: 24px;
|
|
38
|
-
}
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
39
10
|
}
|
|
40
11
|
|
|
41
12
|
.ant-avatar-group {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
var _excluded = ["value", "type", "onChange", "multiple", "dropdownWidth", "open", "onOpenChange", "placeholder", "className", "allowClear", "disabled", "onClear", "size", "prefix", "lockedIds", "footer", "onCancel", "filterItem"];
|
|
1
|
+
var _excluded = ["value", "type", "onChange", "multiple", "dropdownWidth", "open", "onOpenChange", "placeholder", "className", "allowClear", "disabled", "onClear", "size", "prefix", "lockedIds", "footer", "onCancel", "filterItem", "mode"];
|
|
2
2
|
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); }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
8
|
+
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); }
|
|
3
9
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
11
|
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."); }
|
|
@@ -54,6 +60,7 @@ var Component = function Component(props) {
|
|
|
54
60
|
footer = props.footer,
|
|
55
61
|
_onCancel = props.onCancel,
|
|
56
62
|
filterItem = props.filterItem,
|
|
63
|
+
propsMode = props.mode,
|
|
57
64
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
58
65
|
var _ConfigProvider$useGe = ConfigProvider.useGetUserList(),
|
|
59
66
|
getUsersByIds = _ConfigProvider$useGe.getUsersByIds,
|
|
@@ -136,7 +143,7 @@ var Component = function Component(props) {
|
|
|
136
143
|
}
|
|
137
144
|
return true;
|
|
138
145
|
});
|
|
139
|
-
}, [searchString, searchUserList, selectedUserList]);
|
|
146
|
+
}, [filterItem, searchString, searchUserList, selectedUserList]);
|
|
140
147
|
useEffect(function () {
|
|
141
148
|
if (!dropdownOpen) return;
|
|
142
149
|
run();
|
|
@@ -187,7 +194,7 @@ var Component = function Component(props) {
|
|
|
187
194
|
setSelectedUserList([].concat(_toConsumableArray(result), _toConsumableArray(valueNotInResult)));
|
|
188
195
|
});
|
|
189
196
|
}
|
|
190
|
-
}, [value, queryByIds]);
|
|
197
|
+
}, [value, queryByIds, prevValue]);
|
|
191
198
|
var onSelectedChange = useCallback(function (users) {
|
|
192
199
|
if (multiple) {
|
|
193
200
|
setSelectedUserList(users);
|
|
@@ -240,13 +247,17 @@ var Component = function Component(props) {
|
|
|
240
247
|
}, [dropdownOpen]);
|
|
241
248
|
var mode = useMemo(function () {
|
|
242
249
|
if (multiple === true) {
|
|
250
|
+
if (_typeof(propsMode) === 'object') return _objectSpread(_objectSpread({}, propsMode || {}), {}, {
|
|
251
|
+
type: 'multiple',
|
|
252
|
+
responsive: _.isNil(propsMode.responsive) ? true : propsMode.responsive
|
|
253
|
+
});
|
|
243
254
|
return {
|
|
244
255
|
type: 'multiple',
|
|
245
256
|
responsive: true
|
|
246
257
|
};
|
|
247
258
|
}
|
|
248
|
-
return multiple ? multiple :
|
|
249
|
-
}, [multiple]);
|
|
259
|
+
return multiple ? multiple : propsMode;
|
|
260
|
+
}, [multiple, propsMode]);
|
|
250
261
|
var selectOpen = typeof open === 'boolean' ? open : dropdownOpen;
|
|
251
262
|
return /*#__PURE__*/React.createElement(AldSelect, _extends({
|
|
252
263
|
prefix: propPrefix
|
package/dist/Modal/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface ModalProps extends Omit<AntdModalProps, 'okButtonProps' | 'canc
|
|
|
19
19
|
okButtonProps?: IButtonProps;
|
|
20
20
|
okType?: ButtonType;
|
|
21
21
|
responsiveBounds?: boolean;
|
|
22
|
+
fullscreen?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export interface ModalFuncProps extends Omit<AntdModalFuncProps, 'okButtonProps' | 'cancelButtonProps' | 'okType' | 'icon'> {
|
|
24
25
|
cancelButtonProps?: IButtonProps;
|
package/dist/Modal/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
var _excluded = ["className", "type", "loading", "size", "disabled", "shape"],
|
|
3
|
-
_excluded2 = ["className", "children", "okType", "width", "closeIcon", "subTitle", "okButtonProps", "cancelButtonProps", "okText", "cancelText", "icon", "title", "paddingLess", "responsiveBounds", "hideHeaderBottomBorder", "virtualScrollBar", "style", "maskClosable"],
|
|
3
|
+
_excluded2 = ["className", "children", "okType", "width", "closeIcon", "subTitle", "okButtonProps", "cancelButtonProps", "okText", "cancelText", "icon", "title", "paddingLess", "responsiveBounds", "hideHeaderBottomBorder", "virtualScrollBar", "style", "maskClosable", "fullscreen"],
|
|
4
4
|
_excluded3 = ["okButtonProps", "cancelButtonProps", "okType", "width", "title", "subTitle", "okText", "cancelText", "className"],
|
|
5
5
|
_excluded4 = ["okButtonProps", "cancelButtonProps", "okType", "width", "title", "subTitle", "okText", "cancelText", "className"],
|
|
6
6
|
_excluded5 = ["okButtonProps", "cancelButtonProps", "okType", "width", "title", "subTitle", "okText", "cancelText", "className"],
|
|
@@ -116,6 +116,7 @@ var OriginModal = function OriginModal(props) {
|
|
|
116
116
|
style = props.style,
|
|
117
117
|
_props$maskClosable = props.maskClosable,
|
|
118
118
|
maskClosable = _props$maskClosable === void 0 ? false : _props$maskClosable,
|
|
119
|
+
fullscreen = props.fullscreen,
|
|
119
120
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
120
121
|
var responsiveBoundsStyle = useMemo(function () {
|
|
121
122
|
if (!responsiveBounds) {
|
|
@@ -155,7 +156,8 @@ var OriginModal = function OriginModal(props) {
|
|
|
155
156
|
'ald-modal-padding-less': paddingLess,
|
|
156
157
|
'ald-modal-virtual-scroll-bar': virtualScrollBar,
|
|
157
158
|
'ald-modal-hide-header-bottom-border': hideHeaderBottomBorder,
|
|
158
|
-
'ald-modal-responsive-bounds': responsiveBounds
|
|
159
|
+
'ald-modal-responsive-bounds': responsiveBounds,
|
|
160
|
+
'ald-modal-fullscreen': fullscreen
|
|
159
161
|
}),
|
|
160
162
|
okButtonProps: getButtonProps(mergedOkButtonProps, 'primary', okType),
|
|
161
163
|
wrapClassName: classNames(props.wrapClassName, {
|
|
@@ -159,3 +159,31 @@
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
|
|
163
|
+
.ald-modal-fullscreen {
|
|
164
|
+
width: 100vw !important;
|
|
165
|
+
margin: 0 !important;
|
|
166
|
+
padding: 0 !important;
|
|
167
|
+
height: 100vh !important;
|
|
168
|
+
max-width: 100vw !important;
|
|
169
|
+
top: 0 !important;
|
|
170
|
+
left: 0 !important;
|
|
171
|
+
|
|
172
|
+
.ant-modal-content {
|
|
173
|
+
border-radius: 0 !important;
|
|
174
|
+
height: 100% !important;
|
|
175
|
+
|
|
176
|
+
.ant-modal-body {
|
|
177
|
+
height: 100% !important;
|
|
178
|
+
max-height: 100% !important;
|
|
179
|
+
padding: 0 !important;
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.ant-modal-header,
|
|
185
|
+
.ant-modal-footer,
|
|
186
|
+
.ant-modal-close {
|
|
187
|
+
display: none;
|
|
188
|
+
}
|
|
189
|
+
}
|
package/dist/User/index.js
CHANGED
|
@@ -21,7 +21,7 @@ function User(_ref) {
|
|
|
21
21
|
className: 'ald-user-avatar',
|
|
22
22
|
src: src,
|
|
23
23
|
size: getAvatarSize(size || 'middle')
|
|
24
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
}, nickname), /*#__PURE__*/React.createElement("div", {
|
|
25
25
|
className: classNames('ald-user-text', nicknameClassName)
|
|
26
26
|
}, nickname));
|
|
27
27
|
}
|