assui 3.0.79 → 3.1.1
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/es/flex/index.d.ts +21 -0
- package/es/flex/index.js +57 -0
- package/es/flex/style/index.css +1329 -0
- package/es/flex/style/index.d.ts +1 -0
- package/es/flex/style/index.js +1 -0
- package/es/flex/style/index.less +125 -0
- package/es/flex/utils/gapSize.d.ts +2 -0
- package/es/flex/utils/gapSize.js +3 -0
- package/es/flex/utils/index.d.ts +6 -0
- package/es/flex/utils/index.js +42 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/lib/flex/index.d.ts +21 -0
- package/lib/flex/index.js +67 -0
- package/lib/flex/style/index.css +1329 -0
- package/lib/flex/style/index.d.ts +1 -0
- package/lib/flex/style/index.js +6 -0
- package/lib/flex/style/index.less +125 -0
- package/lib/flex/utils/gapSize.d.ts +2 -0
- package/lib/flex/utils/gapSize.js +10 -0
- package/lib/flex/utils/index.d.ts +6 -0
- package/lib/flex/utils/index.js +53 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -1
- package/package.json +3 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SizeType } from 'antd/lib/config-provider/SizeContext';
|
|
3
|
+
export interface FlexProps<P = Record<PropertyKey, any>> extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** flex 主轴的方向是否垂直 */
|
|
5
|
+
vertical?: boolean;
|
|
6
|
+
/** 设置元素单行显示还是多行显示 */
|
|
7
|
+
wrap?: React.CSSProperties['flexWrap'];
|
|
8
|
+
/** 设置元素在主轴方向上的对齐方式 */
|
|
9
|
+
justify?: React.CSSProperties['justifyContent'];
|
|
10
|
+
/** 设置元素在交叉轴方向上的对齐方式 */
|
|
11
|
+
align?: React.CSSProperties['alignItems'];
|
|
12
|
+
/** flex CSS 简写属性 */
|
|
13
|
+
flex?: React.CSSProperties['flex'];
|
|
14
|
+
/** 设置网格之间的间隙 */
|
|
15
|
+
gap?: React.CSSProperties['gap'] | SizeType;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/** 自定义元素类型 */
|
|
18
|
+
component?: React.ComponentType<P> | string;
|
|
19
|
+
}
|
|
20
|
+
declare const Flex: React.ForwardRefExoticComponent<FlexProps<Record<PropertyKey, any>> & React.RefAttributes<HTMLElement>>;
|
|
21
|
+
export default Flex;
|
package/es/flex/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) {
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
17
|
+
}
|
|
18
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import classNames from 'classnames';
|
|
25
|
+
import omit from "rc-util/es/omit";
|
|
26
|
+
import { isPresetSize } from './utils/gapSize';
|
|
27
|
+
import createFlexClassNames from './utils';
|
|
28
|
+
var Flex = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
29
|
+
var _a;
|
|
30
|
+
var className = props.className,
|
|
31
|
+
style = props.style,
|
|
32
|
+
flex = props.flex,
|
|
33
|
+
gap = props.gap,
|
|
34
|
+
children = props.children,
|
|
35
|
+
_b = props.vertical,
|
|
36
|
+
vertical = _b === void 0 ? false : _b,
|
|
37
|
+
_c = props.component,
|
|
38
|
+
Component = _c === void 0 ? 'div' : _c,
|
|
39
|
+
othersProps = __rest(props, ["className", "style", "flex", "gap", "children", "vertical", "component"]);
|
|
40
|
+
var prefixCls = 'as-flex';
|
|
41
|
+
var flexClassNames = createFlexClassNames(prefixCls, props);
|
|
42
|
+
var mergedCls = classNames(className, prefixCls, flexClassNames, (_a = {}, _a["".concat(prefixCls, "-gap-").concat(gap)] = isPresetSize(gap), _a["".concat(prefixCls, "-vertical")] = vertical, _a));
|
|
43
|
+
var mergedStyle = __assign({}, style);
|
|
44
|
+
if (flex) {
|
|
45
|
+
mergedStyle.flex = flex;
|
|
46
|
+
}
|
|
47
|
+
if (gap && !isPresetSize(gap)) {
|
|
48
|
+
mergedStyle.gap = gap;
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/React.createElement(Component, __assign({
|
|
51
|
+
ref: ref,
|
|
52
|
+
className: mergedCls
|
|
53
|
+
}, omit(othersProps, ['justify', 'wrap', 'align']), {
|
|
54
|
+
style: mergedStyle
|
|
55
|
+
}), children);
|
|
56
|
+
});
|
|
57
|
+
export default Flex;
|