acud 1.0.21 → 1.0.22
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/CHANGELOG.md +141 -0
- package/dist/acud.css +543 -246
- package/dist/acud.css.map +1 -1
- package/dist/acud.js +18655 -17994
- package/dist/acud.js.map +1 -1
- package/dist/acud.min.css +1 -1
- package/dist/acud.min.css.map +1 -1
- package/dist/acud.min.js +11 -11
- package/dist/acud.min.js.map +1 -1
- package/es/avatar/SizeContext.d.ts +10 -0
- package/es/avatar/SizeContext.js +12 -0
- package/es/avatar/avatar.d.ts +25 -0
- package/es/avatar/avatar.js +206 -0
- package/es/avatar/group.d.ts +15 -0
- package/es/avatar/group.js +64 -0
- package/es/avatar/index.d.ts +11 -0
- package/es/avatar/index.js +6 -0
- package/es/avatar/style/css.js +5 -0
- package/es/avatar/style/group.less +17 -0
- package/es/avatar/style/index.css +108 -0
- package/es/avatar/style/index.d.ts +3 -0
- package/es/avatar/style/index.js +5 -0
- package/es/avatar/style/index.less +68 -0
- package/es/avatar/style/rtl.less +15 -0
- package/es/divider/index.d.ts +14 -0
- package/es/divider/index.js +63 -0
- package/es/divider/style/css.js +2 -0
- package/es/divider/style/index.css +126 -0
- package/es/divider/style/index.d.ts +2 -0
- package/es/divider/style/index.js +2 -0
- package/es/divider/style/index.less +137 -0
- package/es/divider/style/rtl.less +38 -0
- package/es/dropdown/style/index.css +4 -4
- package/es/dropdown/style/index.less +5 -5
- package/es/grid/hooks/useBreakpoint.d.ts +1 -1
- package/es/grid/hooks/useBreakpoint.js +11 -9
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/menu/style/index.css +16 -12
- package/es/menu/style/index.less +5 -3
- package/es/menu/style/sider.less +2 -0
- package/es/modal/DialogBox.d.ts +2 -2
- package/es/modal/DialogBox.js +3 -2
- package/es/pagination/rc-pagination/Pagination.js +0 -1
- package/es/style/themes/default/components/avatar.less +13 -0
- package/es/style/themes/default/components/divider.less +6 -0
- package/es/style/themes/default/components/index.less +2 -0
- package/es/table/style/index.css +4 -3
- package/es/table/style/index.less +4 -0
- package/es/tag/style/index.css +46 -0
- package/es/tag/style/index.less +37 -0
- package/es/tree-select/index.d.ts +4 -4
- package/es/tree-select/index.js +1 -1
- package/es/tree-select/src/LegacyContext.d.ts +24 -0
- package/es/tree-select/src/LegacyContext.js +3 -0
- package/es/tree-select/src/OptionList.d.ts +8 -0
- package/es/tree-select/src/OptionList.js +340 -0
- package/es/tree-select/src/TreeNode.d.ts +9 -0
- package/es/tree-select/src/TreeNode.js +6 -0
- package/es/tree-select/src/TreeSelect.d.ts +122 -0
- package/es/tree-select/src/TreeSelect.js +534 -0
- package/es/tree-select/src/TreeSelectContext.d.ts +16 -0
- package/es/tree-select/src/TreeSelectContext.js +3 -0
- package/es/tree-select/src/hooks/useCache.d.ts +7 -0
- package/es/tree-select/src/hooks/useCache.js +29 -0
- package/es/tree-select/src/hooks/useCheckedKeys.d.ts +5 -0
- package/es/tree-select/src/hooks/useCheckedKeys.js +29 -0
- package/es/tree-select/src/hooks/useDataEntities.d.ts +7 -0
- package/es/tree-select/src/hooks/useDataEntities.js +30 -0
- package/es/tree-select/src/hooks/useFilterTreeData.d.ts +7 -0
- package/es/tree-select/src/hooks/useFilterTreeData.js +49 -0
- package/es/tree-select/src/hooks/useRefFunc.d.ts +5 -0
- package/es/tree-select/src/hooks/useRefFunc.js +14 -0
- package/es/tree-select/src/hooks/useTreeData.d.ts +8 -0
- package/es/tree-select/src/hooks/useTreeData.js +55 -0
- package/es/tree-select/src/index.d.ts +7 -0
- package/es/tree-select/src/index.js +9 -0
- package/es/tree-select/src/interface.d.ts +77 -0
- package/es/tree-select/src/interface.js +1 -0
- package/es/tree-select/src/utils/legacyUtil.d.ts +6 -0
- package/es/tree-select/src/utils/legacyUtil.js +144 -0
- package/es/tree-select/src/utils/strategyUtil.d.ts +9 -0
- package/es/tree-select/src/utils/strategyUtil.js +40 -0
- package/es/tree-select/src/utils/valueUtil.d.ts +14 -0
- package/es/tree-select/src/utils/valueUtil.js +46 -0
- package/es/tree-select/src/utils/warningPropsUtil.d.ts +5 -0
- package/es/tree-select/src/utils/warningPropsUtil.js +31 -0
- package/es/tree-select/style/index.css +10 -0
- package/es/tree-select/style/index.less +11 -0
- package/lib/avatar/SizeContext.d.ts +10 -0
- package/lib/avatar/SizeContext.js +26 -0
- package/lib/avatar/avatar.d.ts +25 -0
- package/lib/avatar/avatar.js +233 -0
- package/lib/avatar/group.d.ts +15 -0
- package/lib/avatar/group.js +88 -0
- package/lib/avatar/index.d.ts +11 -0
- package/lib/avatar/index.js +23 -0
- package/lib/avatar/style/css.js +7 -0
- package/lib/avatar/style/group.less +17 -0
- package/lib/avatar/style/index.css +108 -0
- package/lib/avatar/style/index.d.ts +3 -0
- package/lib/avatar/style/index.js +7 -0
- package/lib/avatar/style/index.less +68 -0
- package/lib/avatar/style/rtl.less +15 -0
- package/lib/divider/index.d.ts +14 -0
- package/lib/divider/index.js +74 -0
- package/lib/divider/style/css.js +5 -0
- package/lib/divider/style/index.css +126 -0
- package/lib/divider/style/index.d.ts +2 -0
- package/lib/divider/style/index.js +5 -0
- package/lib/divider/style/index.less +137 -0
- package/lib/divider/style/rtl.less +38 -0
- package/lib/dropdown/style/index.css +4 -4
- package/lib/dropdown/style/index.less +5 -5
- package/lib/grid/hooks/useBreakpoint.d.ts +1 -1
- package/lib/grid/hooks/useBreakpoint.js +11 -9
- package/lib/index.d.ts +2 -0
- package/lib/index.js +16 -0
- package/lib/menu/style/index.css +16 -12
- package/lib/menu/style/index.less +5 -3
- package/lib/menu/style/sider.less +2 -0
- package/lib/modal/DialogBox.d.ts +2 -2
- package/lib/modal/DialogBox.js +3 -2
- package/lib/pagination/rc-pagination/Pagination.js +0 -1
- package/lib/style/components.less +2 -0
- package/lib/style/themes/default/components/avatar.less +13 -0
- package/lib/style/themes/default/components/divider.less +6 -0
- package/lib/style/themes/default/components/index.less +2 -0
- package/lib/table/style/index.css +4 -3
- package/lib/table/style/index.less +4 -0
- package/lib/tag/style/index.css +46 -0
- package/lib/tag/style/index.less +37 -0
- package/lib/tree-select/index.d.ts +4 -4
- package/lib/tree-select/index.js +7 -7
- package/lib/tree-select/src/LegacyContext.d.ts +24 -0
- package/lib/tree-select/src/LegacyContext.js +18 -0
- package/lib/tree-select/src/OptionList.d.ts +8 -0
- package/lib/tree-select/src/OptionList.js +368 -0
- package/lib/tree-select/src/TreeNode.d.ts +9 -0
- package/lib/tree-select/src/TreeNode.js +14 -0
- package/lib/tree-select/src/TreeSelect.d.ts +122 -0
- package/lib/tree-select/src/TreeSelect.js +572 -0
- package/lib/tree-select/src/TreeSelectContext.d.ts +16 -0
- package/lib/tree-select/src/TreeSelectContext.js +18 -0
- package/lib/tree-select/src/hooks/useCache.d.ts +7 -0
- package/lib/tree-select/src/hooks/useCache.js +47 -0
- package/lib/tree-select/src/hooks/useCheckedKeys.d.ts +5 -0
- package/lib/tree-select/src/hooks/useCheckedKeys.js +49 -0
- package/lib/tree-select/src/hooks/useDataEntities.d.ts +7 -0
- package/lib/tree-select/src/hooks/useDataEntities.js +52 -0
- package/lib/tree-select/src/hooks/useFilterTreeData.d.ts +7 -0
- package/lib/tree-select/src/hooks/useFilterTreeData.js +70 -0
- package/lib/tree-select/src/hooks/useRefFunc.d.ts +5 -0
- package/lib/tree-select/src/hooks/useRefFunc.js +27 -0
- package/lib/tree-select/src/hooks/useTreeData.d.ts +8 -0
- package/lib/tree-select/src/hooks/useTreeData.js +71 -0
- package/lib/tree-select/src/index.d.ts +7 -0
- package/lib/tree-select/src/index.js +45 -0
- package/lib/tree-select/src/interface.d.ts +77 -0
- package/lib/tree-select/src/interface.js +5 -0
- package/lib/tree-select/src/utils/legacyUtil.d.ts +6 -0
- package/lib/tree-select/src/utils/legacyUtil.js +166 -0
- package/lib/tree-select/src/utils/strategyUtil.d.ts +9 -0
- package/lib/tree-select/src/utils/strategyUtil.js +53 -0
- package/lib/tree-select/src/utils/valueUtil.d.ts +14 -0
- package/lib/tree-select/src/utils/valueUtil.js +61 -0
- package/lib/tree-select/src/utils/warningPropsUtil.d.ts +5 -0
- package/lib/tree-select/src/utils/warningPropsUtil.js +43 -0
- package/lib/tree-select/style/index.css +10 -0
- package/lib/tree-select/style/index.less +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScreenSizeMap } from '../_util/responsiveObserve';
|
|
3
|
+
export declare type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
|
|
4
|
+
declare const SizeContext: React.Context<AvatarSize>;
|
|
5
|
+
export interface SizeContextProps {
|
|
6
|
+
size?: AvatarSize;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const SizeContextProvider: React.FC<SizeContextProps>;
|
|
10
|
+
export default SizeContext;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var SizeContext = /*#__PURE__*/React.createContext('default');
|
|
3
|
+
export var SizeContextProvider = function SizeContextProvider(_ref) {
|
|
4
|
+
var children = _ref.children,
|
|
5
|
+
size = _ref.size;
|
|
6
|
+
return /*#__PURE__*/React.createElement(SizeContext.Consumer, null, function (originSize) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(SizeContext.Provider, {
|
|
8
|
+
value: size || originSize
|
|
9
|
+
}, children);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export default SizeContext;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AvatarSize } from './SizeContext';
|
|
3
|
+
export interface AvatarProps {
|
|
4
|
+
/** Shape of avatar, options: `circle`, `square` */
|
|
5
|
+
shape?: 'circle' | 'square';
|
|
6
|
+
size?: AvatarSize;
|
|
7
|
+
gap?: number;
|
|
8
|
+
/** Src of image avatar */
|
|
9
|
+
src?: React.ReactNode;
|
|
10
|
+
/** Srcset of image avatar */
|
|
11
|
+
srcSet?: string;
|
|
12
|
+
draggable?: boolean;
|
|
13
|
+
/** Icon to be used in avatar */
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
prefixCls?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
alt?: string;
|
|
20
|
+
crossOrigin?: '' | 'anonymous' | 'use-credentials';
|
|
21
|
+
onClick?: (e?: React.MouseEvent<HTMLElement>) => void;
|
|
22
|
+
onError?: () => boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<unknown>>;
|
|
25
|
+
export default Avatar;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
|
|
6
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
7
|
+
var t = {};
|
|
8
|
+
|
|
9
|
+
for (var p in s) {
|
|
10
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
14
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
import classNames from 'classnames';
|
|
20
|
+
import ResizeObserver from 'rc-resize-observer';
|
|
21
|
+
import { composeRef } from "rc-util/es/ref";
|
|
22
|
+
import * as React from 'react';
|
|
23
|
+
import { ConfigContext } from '../config-provider';
|
|
24
|
+
import useBreakpoint from '../grid/hooks/useBreakpoint';
|
|
25
|
+
import { responsiveArray } from '../_util/responsiveObserve';
|
|
26
|
+
import SizeContext from './SizeContext';
|
|
27
|
+
|
|
28
|
+
var InternalAvatar = function InternalAvatar(props, ref) {
|
|
29
|
+
var _classNames, _classNames2;
|
|
30
|
+
|
|
31
|
+
var groupSize = React.useContext(SizeContext);
|
|
32
|
+
|
|
33
|
+
var _React$useState = React.useState(1),
|
|
34
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
35
|
+
scale = _React$useState2[0],
|
|
36
|
+
setScale = _React$useState2[1];
|
|
37
|
+
|
|
38
|
+
var _React$useState3 = React.useState(false),
|
|
39
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
40
|
+
mounted = _React$useState4[0],
|
|
41
|
+
setMounted = _React$useState4[1];
|
|
42
|
+
|
|
43
|
+
var _React$useState5 = React.useState(true),
|
|
44
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
45
|
+
isImgExist = _React$useState6[0],
|
|
46
|
+
setIsImgExist = _React$useState6[1];
|
|
47
|
+
|
|
48
|
+
var avatarNodeRef = React.useRef();
|
|
49
|
+
var avatarChildrenRef = React.useRef();
|
|
50
|
+
var avatarNodeMergeRef = composeRef(ref, avatarNodeRef);
|
|
51
|
+
|
|
52
|
+
var _React$useContext = React.useContext(ConfigContext),
|
|
53
|
+
getPrefixCls = _React$useContext.getPrefixCls;
|
|
54
|
+
|
|
55
|
+
var setScaleParam = function setScaleParam() {
|
|
56
|
+
if (!avatarChildrenRef.current || !avatarNodeRef.current) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var childrenWidth = avatarChildrenRef.current.offsetWidth; // offsetWidth avoid affecting be transform scale
|
|
61
|
+
|
|
62
|
+
var nodeWidth = avatarNodeRef.current.offsetWidth; // denominator is 0 is no meaning
|
|
63
|
+
|
|
64
|
+
if (childrenWidth !== 0 && nodeWidth !== 0) {
|
|
65
|
+
var _props$gap = props.gap,
|
|
66
|
+
gap = _props$gap === void 0 ? 4 : _props$gap;
|
|
67
|
+
|
|
68
|
+
if (gap * 2 < nodeWidth) {
|
|
69
|
+
setScale(nodeWidth - gap * 2 < childrenWidth ? (nodeWidth - gap * 2) / childrenWidth : 1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
React.useEffect(function () {
|
|
75
|
+
setMounted(true);
|
|
76
|
+
}, []);
|
|
77
|
+
React.useEffect(function () {
|
|
78
|
+
setIsImgExist(true);
|
|
79
|
+
setScale(1);
|
|
80
|
+
}, [props.src]);
|
|
81
|
+
React.useEffect(function () {
|
|
82
|
+
setScaleParam();
|
|
83
|
+
}, [props.gap]);
|
|
84
|
+
|
|
85
|
+
var handleImgLoadError = function handleImgLoadError() {
|
|
86
|
+
var onError = props.onError;
|
|
87
|
+
var errorFlag = onError ? onError() : undefined;
|
|
88
|
+
|
|
89
|
+
if (errorFlag !== false) {
|
|
90
|
+
setIsImgExist(false);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var customizePrefixCls = props.prefixCls,
|
|
95
|
+
shape = props.shape,
|
|
96
|
+
customSize = props.size,
|
|
97
|
+
src = props.src,
|
|
98
|
+
srcSet = props.srcSet,
|
|
99
|
+
icon = props.icon,
|
|
100
|
+
className = props.className,
|
|
101
|
+
alt = props.alt,
|
|
102
|
+
draggable = props.draggable,
|
|
103
|
+
children = props.children,
|
|
104
|
+
crossOrigin = props.crossOrigin,
|
|
105
|
+
others = __rest(props, ["prefixCls", "shape", "size", "src", "srcSet", "icon", "className", "alt", "draggable", "children", "crossOrigin"]);
|
|
106
|
+
|
|
107
|
+
var size = customSize === 'default' ? groupSize : customSize;
|
|
108
|
+
var needResponsive = Object.keys(_typeof(size) === 'object' ? size || {} : {}).some(function (key) {
|
|
109
|
+
return ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].includes(key);
|
|
110
|
+
});
|
|
111
|
+
var screens = useBreakpoint(needResponsive);
|
|
112
|
+
var responsiveSizeStyle = React.useMemo(function () {
|
|
113
|
+
if (_typeof(size) !== 'object') {
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var currentBreakpoint = responsiveArray.find(function (screen) {
|
|
118
|
+
return screens[screen];
|
|
119
|
+
});
|
|
120
|
+
var currentSize = size[currentBreakpoint];
|
|
121
|
+
return currentSize ? {
|
|
122
|
+
width: currentSize,
|
|
123
|
+
height: currentSize,
|
|
124
|
+
lineHeight: "".concat(currentSize, "px"),
|
|
125
|
+
fontSize: icon ? currentSize / 2 : 18
|
|
126
|
+
} : {};
|
|
127
|
+
}, [screens, size]);
|
|
128
|
+
console.warn(!(typeof icon === 'string' && icon.length > 2), 'Avatar', "`icon` is using ReactNode instead of string naming in v4. Please check `".concat(icon, "` at https://ant.design/components/icon"));
|
|
129
|
+
var prefixCls = getPrefixCls('avatar', customizePrefixCls);
|
|
130
|
+
var sizeCls = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-sm"), size === 'small'), _classNames));
|
|
131
|
+
var hasImageElement = /*#__PURE__*/React.isValidElement(src);
|
|
132
|
+
var classString = classNames(prefixCls, sizeCls, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-").concat(shape), !!shape), _defineProperty(_classNames2, "".concat(prefixCls, "-image"), hasImageElement || src && isImgExist), _defineProperty(_classNames2, "".concat(prefixCls, "-icon"), !!icon), _classNames2), className);
|
|
133
|
+
var sizeStyle = typeof size === 'number' ? {
|
|
134
|
+
width: size,
|
|
135
|
+
height: size,
|
|
136
|
+
lineHeight: "".concat(size, "px"),
|
|
137
|
+
fontSize: icon ? size / 2 : 18
|
|
138
|
+
} : {};
|
|
139
|
+
var childrenToRender;
|
|
140
|
+
|
|
141
|
+
if (typeof src === 'string' && isImgExist) {
|
|
142
|
+
childrenToRender = /*#__PURE__*/React.createElement("img", {
|
|
143
|
+
src: src,
|
|
144
|
+
draggable: draggable,
|
|
145
|
+
srcSet: srcSet,
|
|
146
|
+
onError: handleImgLoadError,
|
|
147
|
+
alt: alt,
|
|
148
|
+
crossOrigin: crossOrigin
|
|
149
|
+
});
|
|
150
|
+
} else if (hasImageElement) {
|
|
151
|
+
childrenToRender = src;
|
|
152
|
+
} else if (icon) {
|
|
153
|
+
childrenToRender = icon;
|
|
154
|
+
} else if (mounted || scale !== 1) {
|
|
155
|
+
var transformString = "scale(".concat(scale, ") translateX(-50%)");
|
|
156
|
+
var childrenStyle = {
|
|
157
|
+
msTransform: transformString,
|
|
158
|
+
WebkitTransform: transformString,
|
|
159
|
+
transform: transformString
|
|
160
|
+
};
|
|
161
|
+
var sizeChildrenStyle = typeof size === 'number' ? {
|
|
162
|
+
lineHeight: "".concat(size, "px")
|
|
163
|
+
} : {};
|
|
164
|
+
childrenToRender = /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
165
|
+
onResize: setScaleParam
|
|
166
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
167
|
+
className: "".concat(prefixCls, "-string"),
|
|
168
|
+
ref: function ref(node) {
|
|
169
|
+
avatarChildrenRef.current = node;
|
|
170
|
+
},
|
|
171
|
+
style: _extends(_extends({}, sizeChildrenStyle), childrenStyle)
|
|
172
|
+
}, children));
|
|
173
|
+
} else {
|
|
174
|
+
childrenToRender = /*#__PURE__*/React.createElement("span", {
|
|
175
|
+
className: "".concat(prefixCls, "-string"),
|
|
176
|
+
style: {
|
|
177
|
+
opacity: 0
|
|
178
|
+
},
|
|
179
|
+
ref: function ref(node) {
|
|
180
|
+
avatarChildrenRef.current = node;
|
|
181
|
+
}
|
|
182
|
+
}, children);
|
|
183
|
+
} // The event is triggered twice from bubbling up the DOM tree.
|
|
184
|
+
// see https://codesandbox.io/s/kind-snow-9lidz
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
delete others.onError;
|
|
188
|
+
delete others.gap;
|
|
189
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, others, {
|
|
190
|
+
style: _extends(_extends(_extends({}, sizeStyle), responsiveSizeStyle), others.style),
|
|
191
|
+
className: classString,
|
|
192
|
+
ref: avatarNodeMergeRef
|
|
193
|
+
}), childrenToRender);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
var Avatar = /*#__PURE__*/React.forwardRef(InternalAvatar);
|
|
197
|
+
|
|
198
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
199
|
+
Avatar.displayName = 'Avatar';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
Avatar.defaultProps = {
|
|
203
|
+
shape: 'circle',
|
|
204
|
+
size: 'default'
|
|
205
|
+
};
|
|
206
|
+
export default Avatar;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AvatarSize } from './SizeContext';
|
|
3
|
+
export interface GroupProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
prefixCls?: string;
|
|
8
|
+
maxCount?: number;
|
|
9
|
+
maxStyle?: React.CSSProperties;
|
|
10
|
+
maxPopoverPlacement?: 'top' | 'bottom';
|
|
11
|
+
maxPopoverTrigger?: 'hover' | 'focus' | 'click';
|
|
12
|
+
size?: AvatarSize;
|
|
13
|
+
}
|
|
14
|
+
declare const Group: React.FC<GroupProps>;
|
|
15
|
+
export default Group;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import toArray from "rc-util/es/Children/toArray";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ConfigContext } from '../config-provider';
|
|
6
|
+
import Popover from '../popover';
|
|
7
|
+
import { cloneElement } from '../_util/reactNode';
|
|
8
|
+
import Avatar from './avatar';
|
|
9
|
+
import { SizeContextProvider } from './SizeContext';
|
|
10
|
+
|
|
11
|
+
var Group = function Group(props) {
|
|
12
|
+
var _React$useContext = React.useContext(ConfigContext),
|
|
13
|
+
getPrefixCls = _React$useContext.getPrefixCls,
|
|
14
|
+
direction = _React$useContext.direction;
|
|
15
|
+
|
|
16
|
+
var customizePrefixCls = props.prefixCls,
|
|
17
|
+
_props$className = props.className,
|
|
18
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
19
|
+
maxCount = props.maxCount,
|
|
20
|
+
maxStyle = props.maxStyle,
|
|
21
|
+
size = props.size;
|
|
22
|
+
var prefixCls = getPrefixCls('avatar-group', customizePrefixCls);
|
|
23
|
+
var cls = classNames(prefixCls, _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className);
|
|
24
|
+
var children = props.children,
|
|
25
|
+
_props$maxPopoverPlac = props.maxPopoverPlacement,
|
|
26
|
+
maxPopoverPlacement = _props$maxPopoverPlac === void 0 ? 'top' : _props$maxPopoverPlac,
|
|
27
|
+
_props$maxPopoverTrig = props.maxPopoverTrigger,
|
|
28
|
+
maxPopoverTrigger = _props$maxPopoverTrig === void 0 ? 'hover' : _props$maxPopoverTrig;
|
|
29
|
+
var childrenWithProps = toArray(children).map(function (child, index) {
|
|
30
|
+
return cloneElement(child, {
|
|
31
|
+
key: "avatar-key-".concat(index)
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var numOfChildren = childrenWithProps.length;
|
|
35
|
+
|
|
36
|
+
if (maxCount && maxCount < numOfChildren) {
|
|
37
|
+
var childrenShow = childrenWithProps.slice(0, maxCount);
|
|
38
|
+
var childrenHidden = childrenWithProps.slice(maxCount, numOfChildren);
|
|
39
|
+
childrenShow.push( /*#__PURE__*/React.createElement(Popover, {
|
|
40
|
+
key: "avatar-popover-key",
|
|
41
|
+
content: childrenHidden,
|
|
42
|
+
trigger: maxPopoverTrigger,
|
|
43
|
+
placement: maxPopoverPlacement,
|
|
44
|
+
overlayClassName: "".concat(prefixCls, "-popover")
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
46
|
+
style: maxStyle
|
|
47
|
+
}, "+".concat(numOfChildren - maxCount))));
|
|
48
|
+
return /*#__PURE__*/React.createElement(SizeContextProvider, {
|
|
49
|
+
size: size
|
|
50
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: cls,
|
|
52
|
+
style: props.style
|
|
53
|
+
}, childrenShow));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return /*#__PURE__*/React.createElement(SizeContextProvider, {
|
|
57
|
+
size: size
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: cls,
|
|
60
|
+
style: props.style
|
|
61
|
+
}, childrenWithProps));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default Group;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { AvatarProps } from './avatar';
|
|
3
|
+
import Group from './group';
|
|
4
|
+
export { AvatarProps } from './avatar';
|
|
5
|
+
export { GroupProps } from './group';
|
|
6
|
+
export { Group };
|
|
7
|
+
interface CompoundedComponent extends ForwardRefExoticComponent<AvatarProps & RefAttributes<HTMLElement>> {
|
|
8
|
+
Group: typeof Group;
|
|
9
|
+
}
|
|
10
|
+
declare const Avatar: CompoundedComponent;
|
|
11
|
+
export default Avatar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.@{avatar-prefix-cls}-group {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
|
|
4
|
+
.@{avatar-prefix-cls} {
|
|
5
|
+
border: 1px solid @avatar-group-border-color;
|
|
6
|
+
|
|
7
|
+
&:not(:first-child) {
|
|
8
|
+
margin-left: @avatar-group-overlapping;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-popover {
|
|
13
|
+
.@{acud-prefix}-avatar + .@{acud-prefix}-avatar {
|
|
14
|
+
margin-left: @avatar-group-space;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* color */
|
|
2
|
+
/* 默认颜色 */
|
|
3
|
+
/* 通用-icon */
|
|
4
|
+
/* 标签 */
|
|
5
|
+
/* 默认颜色 */
|
|
6
|
+
/* 其他颜色 */
|
|
7
|
+
/* 通用 */
|
|
8
|
+
/* 水平 */
|
|
9
|
+
/* 垂直 */
|
|
10
|
+
/* 序号水平 */
|
|
11
|
+
/* 序号垂直 */
|
|
12
|
+
.acud-avatar {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
position: relative;
|
|
16
|
+
display: inline-block;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
color: #fff;
|
|
19
|
+
white-space: nowrap;
|
|
20
|
+
text-align: center;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
background: #ccc;
|
|
23
|
+
width: 32px;
|
|
24
|
+
height: 32px;
|
|
25
|
+
line-height: 32px;
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
}
|
|
28
|
+
.acud-avatar-image {
|
|
29
|
+
background: transparent;
|
|
30
|
+
}
|
|
31
|
+
.acud-avatar .acud-image-img {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
.acud-avatar-string {
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: 50%;
|
|
37
|
+
transform-origin: 0 center;
|
|
38
|
+
}
|
|
39
|
+
.acud-avatar.acud-avatar-icon {
|
|
40
|
+
font-size: 18px;
|
|
41
|
+
}
|
|
42
|
+
.acud-avatar.acud-avatar-icon > .acudicon {
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
.acud-avatar-lg {
|
|
46
|
+
width: 40px;
|
|
47
|
+
height: 40px;
|
|
48
|
+
line-height: 40px;
|
|
49
|
+
border-radius: 50%;
|
|
50
|
+
}
|
|
51
|
+
.acud-avatar-lg-string {
|
|
52
|
+
position: absolute;
|
|
53
|
+
left: 50%;
|
|
54
|
+
transform-origin: 0 center;
|
|
55
|
+
}
|
|
56
|
+
.acud-avatar-lg.acud-avatar-icon {
|
|
57
|
+
font-size: 24px;
|
|
58
|
+
}
|
|
59
|
+
.acud-avatar-lg.acud-avatar-icon > .acudicon {
|
|
60
|
+
margin: 0;
|
|
61
|
+
}
|
|
62
|
+
.acud-avatar-sm {
|
|
63
|
+
width: 24px;
|
|
64
|
+
height: 24px;
|
|
65
|
+
line-height: 24px;
|
|
66
|
+
border-radius: 50%;
|
|
67
|
+
}
|
|
68
|
+
.acud-avatar-sm-string {
|
|
69
|
+
position: absolute;
|
|
70
|
+
left: 50%;
|
|
71
|
+
transform-origin: 0 center;
|
|
72
|
+
}
|
|
73
|
+
.acud-avatar-sm.acud-avatar-icon {
|
|
74
|
+
font-size: 14px;
|
|
75
|
+
}
|
|
76
|
+
.acud-avatar-sm.acud-avatar-icon > .acudicon {
|
|
77
|
+
margin: 0;
|
|
78
|
+
}
|
|
79
|
+
.acud-avatar-square {
|
|
80
|
+
border-radius: 0px;
|
|
81
|
+
}
|
|
82
|
+
.acud-avatar > img {
|
|
83
|
+
display: block;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
-o-object-fit: cover;
|
|
87
|
+
object-fit: cover;
|
|
88
|
+
}
|
|
89
|
+
.acud-avatar-group {
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
}
|
|
92
|
+
.acud-avatar-group .acud-avatar {
|
|
93
|
+
border: 1px solid #fff;
|
|
94
|
+
}
|
|
95
|
+
.acud-avatar-group .acud-avatar:not(:first-child) {
|
|
96
|
+
margin-left: -8px;
|
|
97
|
+
}
|
|
98
|
+
.acud-avatar-group-popover .acud-avatar + .acud-avatar {
|
|
99
|
+
margin-left: 3px;
|
|
100
|
+
}
|
|
101
|
+
.acud-avatar-group-rtl .acud-avatar:not(:first-child) {
|
|
102
|
+
margin-right: -8px;
|
|
103
|
+
margin-left: 0;
|
|
104
|
+
}
|
|
105
|
+
.acud-avatar-group-popover.acud-popover-rtl .acud-avatar + .acud-avatar {
|
|
106
|
+
margin-right: 3px;
|
|
107
|
+
margin-left: 0;
|
|
108
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@import '../../style/themes/index';
|
|
2
|
+
@import '../../style/mixins/index';
|
|
3
|
+
|
|
4
|
+
@avatar-prefix-cls: ~'@{acud-prefix}-avatar';
|
|
5
|
+
.@{avatar-prefix-cls} {
|
|
6
|
+
.reset-component();
|
|
7
|
+
position: relative;
|
|
8
|
+
display: inline-block;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
color: @avatar-color;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
text-align: center;
|
|
13
|
+
vertical-align: middle;
|
|
14
|
+
background: @avatar-bg;
|
|
15
|
+
|
|
16
|
+
&-image {
|
|
17
|
+
background: transparent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.@{acud-prefix}-image-img {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.avatar-size(@avatar-size-base, @avatar-font-size-base);
|
|
25
|
+
|
|
26
|
+
&-lg {
|
|
27
|
+
.avatar-size(@avatar-size-lg, @avatar-font-size-lg);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-sm {
|
|
31
|
+
.avatar-size(@avatar-size-sm, @avatar-font-size-sm);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-square {
|
|
35
|
+
border-radius: @avatar-border-radius;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
& > img {
|
|
39
|
+
display: block;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
object-fit: cover;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.avatar-size(@size, @font-size) {
|
|
47
|
+
width: @size;
|
|
48
|
+
height: @size;
|
|
49
|
+
line-height: @size;
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
|
|
52
|
+
&-string {
|
|
53
|
+
position: absolute;
|
|
54
|
+
left: 50%;
|
|
55
|
+
transform-origin: 0 center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.@{avatar-prefix-cls}-icon {
|
|
59
|
+
font-size: @font-size;
|
|
60
|
+
|
|
61
|
+
> .@{iconfont-css-prefix} {
|
|
62
|
+
margin: 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@import './group';
|
|
68
|
+
@import './rtl';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.@{avatar-prefix-cls}-group {
|
|
2
|
+
&-rtl {
|
|
3
|
+
.@{avatar-prefix-cls}:not(:first-child) {
|
|
4
|
+
margin-right: @avatar-group-overlapping;
|
|
5
|
+
margin-left: 0;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&-popover.@{acud-prefix}-popover-rtl {
|
|
10
|
+
.@{acud-prefix}-avatar + .@{acud-prefix}-avatar {
|
|
11
|
+
margin-right: @avatar-group-space;
|
|
12
|
+
margin-left: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DividerProps {
|
|
3
|
+
prefixCls?: string;
|
|
4
|
+
type?: 'horizontal' | 'vertical';
|
|
5
|
+
orientation?: 'left' | 'right' | 'center';
|
|
6
|
+
orientationMargin?: string | number;
|
|
7
|
+
className?: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
dashed?: boolean;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
plain?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Divider: React.FC<DividerProps>;
|
|
14
|
+
export default Divider;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
|
|
4
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
|
|
7
|
+
for (var p in s) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
12
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { ConfigContext } from '../config-provider';
|
|
20
|
+
|
|
21
|
+
var Divider = function Divider(props) {
|
|
22
|
+
var _classNames;
|
|
23
|
+
|
|
24
|
+
var _React$useContext = React.useContext(ConfigContext),
|
|
25
|
+
getPrefixCls = _React$useContext.getPrefixCls,
|
|
26
|
+
direction = _React$useContext.direction;
|
|
27
|
+
|
|
28
|
+
var customizePrefixCls = props.prefixCls,
|
|
29
|
+
_props$type = props.type,
|
|
30
|
+
type = _props$type === void 0 ? 'horizontal' : _props$type,
|
|
31
|
+
_props$orientation = props.orientation,
|
|
32
|
+
orientation = _props$orientation === void 0 ? 'center' : _props$orientation,
|
|
33
|
+
orientationMargin = props.orientationMargin,
|
|
34
|
+
className = props.className,
|
|
35
|
+
children = props.children,
|
|
36
|
+
dashed = props.dashed,
|
|
37
|
+
plain = props.plain,
|
|
38
|
+
restProps = __rest(props, ["prefixCls", "type", "orientation", "orientationMargin", "className", "children", "dashed", "plain"]);
|
|
39
|
+
|
|
40
|
+
var prefixCls = getPrefixCls('divider', customizePrefixCls);
|
|
41
|
+
var orientationPrefix = orientation.length > 0 ? "-".concat(orientation) : orientation;
|
|
42
|
+
var hasChildren = !!children;
|
|
43
|
+
var hasCustomMarginLeft = orientation === 'left' && orientationMargin != null;
|
|
44
|
+
var hasCustomMarginRight = orientation === 'right' && orientationMargin != null;
|
|
45
|
+
var classString = classNames(prefixCls, "".concat(prefixCls, "-").concat(type), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-with-text"), hasChildren), _defineProperty(_classNames, "".concat(prefixCls, "-with-text").concat(orientationPrefix), hasChildren), _defineProperty(_classNames, "".concat(prefixCls, "-dashed"), !!dashed), _defineProperty(_classNames, "".concat(prefixCls, "-plain"), !!plain), _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _defineProperty(_classNames, "".concat(prefixCls, "-no-default-orientation-margin-left"), hasCustomMarginLeft), _defineProperty(_classNames, "".concat(prefixCls, "-no-default-orientation-margin-right"), hasCustomMarginRight), _classNames), className);
|
|
46
|
+
|
|
47
|
+
var innerStyle = _extends(_extends({}, hasCustomMarginLeft && {
|
|
48
|
+
marginLeft: orientationMargin
|
|
49
|
+
}), hasCustomMarginRight && {
|
|
50
|
+
marginRight: orientationMargin
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
54
|
+
className: classString
|
|
55
|
+
}, restProps, {
|
|
56
|
+
role: "separator"
|
|
57
|
+
}), children && /*#__PURE__*/React.createElement("span", {
|
|
58
|
+
className: "".concat(prefixCls, "-inner-text"),
|
|
59
|
+
style: innerStyle
|
|
60
|
+
}, children));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default Divider;
|