acud 1.0.21 → 1.0.23
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 +148 -0
- package/dist/acud.css +543 -246
- package/dist/acud.css.map +1 -1
- package/dist/acud.js +18653 -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 +338 -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 +366 -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,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
+
|
|
18
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
+
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
|
|
22
|
+
var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
|
|
23
|
+
|
|
24
|
+
var _ref = require("rc-util/lib/ref");
|
|
25
|
+
|
|
26
|
+
var React = _interopRequireWildcard(require("react"));
|
|
27
|
+
|
|
28
|
+
var _configProvider = require("../config-provider");
|
|
29
|
+
|
|
30
|
+
var _useBreakpoint = _interopRequireDefault(require("../grid/hooks/useBreakpoint"));
|
|
31
|
+
|
|
32
|
+
var _responsiveObserve = require("../_util/responsiveObserve");
|
|
33
|
+
|
|
34
|
+
var _SizeContext = _interopRequireDefault(require("./SizeContext"));
|
|
35
|
+
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
+
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
+
|
|
40
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
41
|
+
var t = {};
|
|
42
|
+
|
|
43
|
+
for (var p in s) {
|
|
44
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
48
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
49
|
+
}
|
|
50
|
+
return t;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var InternalAvatar = function InternalAvatar(props, ref) {
|
|
54
|
+
var _classNames, _classNames2;
|
|
55
|
+
|
|
56
|
+
var groupSize = React.useContext(_SizeContext["default"]);
|
|
57
|
+
|
|
58
|
+
var _React$useState = React.useState(1),
|
|
59
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
60
|
+
scale = _React$useState2[0],
|
|
61
|
+
setScale = _React$useState2[1];
|
|
62
|
+
|
|
63
|
+
var _React$useState3 = React.useState(false),
|
|
64
|
+
_React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
|
|
65
|
+
mounted = _React$useState4[0],
|
|
66
|
+
setMounted = _React$useState4[1];
|
|
67
|
+
|
|
68
|
+
var _React$useState5 = React.useState(true),
|
|
69
|
+
_React$useState6 = (0, _slicedToArray2["default"])(_React$useState5, 2),
|
|
70
|
+
isImgExist = _React$useState6[0],
|
|
71
|
+
setIsImgExist = _React$useState6[1];
|
|
72
|
+
|
|
73
|
+
var avatarNodeRef = React.useRef();
|
|
74
|
+
var avatarChildrenRef = React.useRef();
|
|
75
|
+
var avatarNodeMergeRef = (0, _ref.composeRef)(ref, avatarNodeRef);
|
|
76
|
+
|
|
77
|
+
var _React$useContext = React.useContext(_configProvider.ConfigContext),
|
|
78
|
+
getPrefixCls = _React$useContext.getPrefixCls;
|
|
79
|
+
|
|
80
|
+
var setScaleParam = function setScaleParam() {
|
|
81
|
+
if (!avatarChildrenRef.current || !avatarNodeRef.current) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var childrenWidth = avatarChildrenRef.current.offsetWidth; // offsetWidth avoid affecting be transform scale
|
|
86
|
+
|
|
87
|
+
var nodeWidth = avatarNodeRef.current.offsetWidth; // denominator is 0 is no meaning
|
|
88
|
+
|
|
89
|
+
if (childrenWidth !== 0 && nodeWidth !== 0) {
|
|
90
|
+
var _props$gap = props.gap,
|
|
91
|
+
gap = _props$gap === void 0 ? 4 : _props$gap;
|
|
92
|
+
|
|
93
|
+
if (gap * 2 < nodeWidth) {
|
|
94
|
+
setScale(nodeWidth - gap * 2 < childrenWidth ? (nodeWidth - gap * 2) / childrenWidth : 1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
React.useEffect(function () {
|
|
100
|
+
setMounted(true);
|
|
101
|
+
}, []);
|
|
102
|
+
React.useEffect(function () {
|
|
103
|
+
setIsImgExist(true);
|
|
104
|
+
setScale(1);
|
|
105
|
+
}, [props.src]);
|
|
106
|
+
React.useEffect(function () {
|
|
107
|
+
setScaleParam();
|
|
108
|
+
}, [props.gap]);
|
|
109
|
+
|
|
110
|
+
var handleImgLoadError = function handleImgLoadError() {
|
|
111
|
+
var onError = props.onError;
|
|
112
|
+
var errorFlag = onError ? onError() : undefined;
|
|
113
|
+
|
|
114
|
+
if (errorFlag !== false) {
|
|
115
|
+
setIsImgExist(false);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
var customizePrefixCls = props.prefixCls,
|
|
120
|
+
shape = props.shape,
|
|
121
|
+
customSize = props.size,
|
|
122
|
+
src = props.src,
|
|
123
|
+
srcSet = props.srcSet,
|
|
124
|
+
icon = props.icon,
|
|
125
|
+
className = props.className,
|
|
126
|
+
alt = props.alt,
|
|
127
|
+
draggable = props.draggable,
|
|
128
|
+
children = props.children,
|
|
129
|
+
crossOrigin = props.crossOrigin,
|
|
130
|
+
others = __rest(props, ["prefixCls", "shape", "size", "src", "srcSet", "icon", "className", "alt", "draggable", "children", "crossOrigin"]);
|
|
131
|
+
|
|
132
|
+
var size = customSize === 'default' ? groupSize : customSize;
|
|
133
|
+
var needResponsive = Object.keys((0, _typeof2["default"])(size) === 'object' ? size || {} : {}).some(function (key) {
|
|
134
|
+
return ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].includes(key);
|
|
135
|
+
});
|
|
136
|
+
var screens = (0, _useBreakpoint["default"])(needResponsive);
|
|
137
|
+
var responsiveSizeStyle = React.useMemo(function () {
|
|
138
|
+
if ((0, _typeof2["default"])(size) !== 'object') {
|
|
139
|
+
return {};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var currentBreakpoint = _responsiveObserve.responsiveArray.find(function (screen) {
|
|
143
|
+
return screens[screen];
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
var currentSize = size[currentBreakpoint];
|
|
147
|
+
return currentSize ? {
|
|
148
|
+
width: currentSize,
|
|
149
|
+
height: currentSize,
|
|
150
|
+
lineHeight: "".concat(currentSize, "px"),
|
|
151
|
+
fontSize: icon ? currentSize / 2 : 18
|
|
152
|
+
} : {};
|
|
153
|
+
}, [screens, size]);
|
|
154
|
+
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"));
|
|
155
|
+
var prefixCls = getPrefixCls('avatar', customizePrefixCls);
|
|
156
|
+
var sizeCls = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, "".concat(prefixCls, "-lg"), size === 'large'), (0, _defineProperty2["default"])(_classNames, "".concat(prefixCls, "-sm"), size === 'small'), _classNames));
|
|
157
|
+
var hasImageElement = /*#__PURE__*/React.isValidElement(src);
|
|
158
|
+
var classString = (0, _classnames["default"])(prefixCls, sizeCls, (_classNames2 = {}, (0, _defineProperty2["default"])(_classNames2, "".concat(prefixCls, "-").concat(shape), !!shape), (0, _defineProperty2["default"])(_classNames2, "".concat(prefixCls, "-image"), hasImageElement || src && isImgExist), (0, _defineProperty2["default"])(_classNames2, "".concat(prefixCls, "-icon"), !!icon), _classNames2), className);
|
|
159
|
+
var sizeStyle = typeof size === 'number' ? {
|
|
160
|
+
width: size,
|
|
161
|
+
height: size,
|
|
162
|
+
lineHeight: "".concat(size, "px"),
|
|
163
|
+
fontSize: icon ? size / 2 : 18
|
|
164
|
+
} : {};
|
|
165
|
+
var childrenToRender;
|
|
166
|
+
|
|
167
|
+
if (typeof src === 'string' && isImgExist) {
|
|
168
|
+
childrenToRender = /*#__PURE__*/React.createElement("img", {
|
|
169
|
+
src: src,
|
|
170
|
+
draggable: draggable,
|
|
171
|
+
srcSet: srcSet,
|
|
172
|
+
onError: handleImgLoadError,
|
|
173
|
+
alt: alt,
|
|
174
|
+
crossOrigin: crossOrigin
|
|
175
|
+
});
|
|
176
|
+
} else if (hasImageElement) {
|
|
177
|
+
childrenToRender = src;
|
|
178
|
+
} else if (icon) {
|
|
179
|
+
childrenToRender = icon;
|
|
180
|
+
} else if (mounted || scale !== 1) {
|
|
181
|
+
var transformString = "scale(".concat(scale, ") translateX(-50%)");
|
|
182
|
+
var childrenStyle = {
|
|
183
|
+
msTransform: transformString,
|
|
184
|
+
WebkitTransform: transformString,
|
|
185
|
+
transform: transformString
|
|
186
|
+
};
|
|
187
|
+
var sizeChildrenStyle = typeof size === 'number' ? {
|
|
188
|
+
lineHeight: "".concat(size, "px")
|
|
189
|
+
} : {};
|
|
190
|
+
childrenToRender = /*#__PURE__*/React.createElement(_rcResizeObserver["default"], {
|
|
191
|
+
onResize: setScaleParam
|
|
192
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
193
|
+
className: "".concat(prefixCls, "-string"),
|
|
194
|
+
ref: function ref(node) {
|
|
195
|
+
avatarChildrenRef.current = node;
|
|
196
|
+
},
|
|
197
|
+
style: (0, _extends2["default"])((0, _extends2["default"])({}, sizeChildrenStyle), childrenStyle)
|
|
198
|
+
}, children));
|
|
199
|
+
} else {
|
|
200
|
+
childrenToRender = /*#__PURE__*/React.createElement("span", {
|
|
201
|
+
className: "".concat(prefixCls, "-string"),
|
|
202
|
+
style: {
|
|
203
|
+
opacity: 0
|
|
204
|
+
},
|
|
205
|
+
ref: function ref(node) {
|
|
206
|
+
avatarChildrenRef.current = node;
|
|
207
|
+
}
|
|
208
|
+
}, children);
|
|
209
|
+
} // The event is triggered twice from bubbling up the DOM tree.
|
|
210
|
+
// see https://codesandbox.io/s/kind-snow-9lidz
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
delete others.onError;
|
|
214
|
+
delete others.gap;
|
|
215
|
+
return /*#__PURE__*/React.createElement("span", (0, _extends2["default"])({}, others, {
|
|
216
|
+
style: (0, _extends2["default"])((0, _extends2["default"])((0, _extends2["default"])({}, sizeStyle), responsiveSizeStyle), others.style),
|
|
217
|
+
className: classString,
|
|
218
|
+
ref: avatarNodeMergeRef
|
|
219
|
+
}), childrenToRender);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
var Avatar = /*#__PURE__*/React.forwardRef(InternalAvatar);
|
|
223
|
+
|
|
224
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
225
|
+
Avatar.displayName = 'Avatar';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
Avatar.defaultProps = {
|
|
229
|
+
shape: 'circle',
|
|
230
|
+
size: 'default'
|
|
231
|
+
};
|
|
232
|
+
var _default = Avatar;
|
|
233
|
+
exports["default"] = _default;
|
|
@@ -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,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray"));
|
|
17
|
+
|
|
18
|
+
var React = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _configProvider = require("../config-provider");
|
|
21
|
+
|
|
22
|
+
var _popover = _interopRequireDefault(require("../popover"));
|
|
23
|
+
|
|
24
|
+
var _reactNode = require("../_util/reactNode");
|
|
25
|
+
|
|
26
|
+
var _avatar = _interopRequireDefault(require("./avatar"));
|
|
27
|
+
|
|
28
|
+
var _SizeContext = require("./SizeContext");
|
|
29
|
+
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
34
|
+
var Group = function Group(props) {
|
|
35
|
+
var _React$useContext = React.useContext(_configProvider.ConfigContext),
|
|
36
|
+
getPrefixCls = _React$useContext.getPrefixCls,
|
|
37
|
+
direction = _React$useContext.direction;
|
|
38
|
+
|
|
39
|
+
var customizePrefixCls = props.prefixCls,
|
|
40
|
+
_props$className = props.className,
|
|
41
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
42
|
+
maxCount = props.maxCount,
|
|
43
|
+
maxStyle = props.maxStyle,
|
|
44
|
+
size = props.size;
|
|
45
|
+
var prefixCls = getPrefixCls('avatar-group', customizePrefixCls);
|
|
46
|
+
var cls = (0, _classnames["default"])(prefixCls, (0, _defineProperty2["default"])({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), className);
|
|
47
|
+
var children = props.children,
|
|
48
|
+
_props$maxPopoverPlac = props.maxPopoverPlacement,
|
|
49
|
+
maxPopoverPlacement = _props$maxPopoverPlac === void 0 ? 'top' : _props$maxPopoverPlac,
|
|
50
|
+
_props$maxPopoverTrig = props.maxPopoverTrigger,
|
|
51
|
+
maxPopoverTrigger = _props$maxPopoverTrig === void 0 ? 'hover' : _props$maxPopoverTrig;
|
|
52
|
+
var childrenWithProps = (0, _toArray["default"])(children).map(function (child, index) {
|
|
53
|
+
return (0, _reactNode.cloneElement)(child, {
|
|
54
|
+
key: "avatar-key-".concat(index)
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var numOfChildren = childrenWithProps.length;
|
|
58
|
+
|
|
59
|
+
if (maxCount && maxCount < numOfChildren) {
|
|
60
|
+
var childrenShow = childrenWithProps.slice(0, maxCount);
|
|
61
|
+
var childrenHidden = childrenWithProps.slice(maxCount, numOfChildren);
|
|
62
|
+
childrenShow.push( /*#__PURE__*/React.createElement(_popover["default"], {
|
|
63
|
+
key: "avatar-popover-key",
|
|
64
|
+
content: childrenHidden,
|
|
65
|
+
trigger: maxPopoverTrigger,
|
|
66
|
+
placement: maxPopoverPlacement,
|
|
67
|
+
overlayClassName: "".concat(prefixCls, "-popover")
|
|
68
|
+
}, /*#__PURE__*/React.createElement(_avatar["default"], {
|
|
69
|
+
style: maxStyle
|
|
70
|
+
}, "+".concat(numOfChildren - maxCount))));
|
|
71
|
+
return /*#__PURE__*/React.createElement(_SizeContext.SizeContextProvider, {
|
|
72
|
+
size: size
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: cls,
|
|
75
|
+
style: props.style
|
|
76
|
+
}, childrenShow));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return /*#__PURE__*/React.createElement(_SizeContext.SizeContextProvider, {
|
|
80
|
+
size: size
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: cls,
|
|
83
|
+
style: props.style
|
|
84
|
+
}, childrenWithProps));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var _default = Group;
|
|
88
|
+
exports["default"] = _default;
|
|
@@ -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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "Group", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _group["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
exports["default"] = void 0;
|
|
15
|
+
|
|
16
|
+
var _avatar = _interopRequireDefault(require("./avatar"));
|
|
17
|
+
|
|
18
|
+
var _group = _interopRequireDefault(require("./group"));
|
|
19
|
+
|
|
20
|
+
var Avatar = _avatar["default"];
|
|
21
|
+
Avatar.Group = _group["default"];
|
|
22
|
+
var _default = Avatar;
|
|
23
|
+
exports["default"] = _default;
|
|
@@ -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;
|