assui 3.0.79 → 3.1.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/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 +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@import '~antd/lib/style/index.less';
|
|
2
|
+
|
|
3
|
+
.as-flex-wrap-wrap {
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.as-flex-wrap-nowrap {
|
|
8
|
+
flex-wrap: nowrap;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.as-flex-wrap-wrap-reverse {
|
|
12
|
+
flex-wrap: wrap-reverse;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.as-flex-align-center {
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.as-flex-align-start {
|
|
20
|
+
align-items: start;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.as-flex-align-end {
|
|
24
|
+
align-items: end;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.as-flex-align-flex-start {
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.as-flex-align-flex-end {
|
|
32
|
+
align-items: flex-end;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.as-flex-align-self-start {
|
|
36
|
+
align-items: self-start;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.as-flex-align-self-end {
|
|
40
|
+
align-items: self-end;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.as-flex-align-baseline {
|
|
44
|
+
align-items: baseline;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.as-flex-align-normal {
|
|
48
|
+
align-items: normal;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.as-flex-align-stretch {
|
|
52
|
+
align-items: stretch;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.as-flex-justify-flex-start {
|
|
56
|
+
justify-content: flex-start;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.as-flex-justify-flex-end {
|
|
60
|
+
justify-content: flex-end;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.as-flex-justify-start {
|
|
64
|
+
justify-content: start;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.as-flex-justify-end {
|
|
68
|
+
justify-content: end;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.as-flex-justify-center {
|
|
72
|
+
justify-content: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.as-flex-justify-space-between {
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.as-flex-justify-space-around {
|
|
80
|
+
justify-content: space-around;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.as-flex-justify-space-evenly {
|
|
84
|
+
justify-content: space-evenly;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.as-flex-justify-stretch {
|
|
88
|
+
justify-content: stretch;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.as-flex-justify-normal {
|
|
92
|
+
justify-content: normal;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.as-flex-justify-left {
|
|
96
|
+
justify-content: left;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.as-flex-justify-right {
|
|
100
|
+
justify-content: right;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.as-flex {
|
|
104
|
+
display: flex;
|
|
105
|
+
|
|
106
|
+
&-vertical {
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:empty {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&-gap-small {
|
|
115
|
+
gap: 8px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&-gap-middle {
|
|
119
|
+
gap: 16px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&-gap-large {
|
|
123
|
+
gap: 24px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FlexProps } from '../index';
|
|
2
|
+
export declare const flexWrapValues: readonly ["wrap", "nowrap", "wrap-reverse"];
|
|
3
|
+
export declare const justifyContentValues: readonly ["flex-start", "flex-end", "start", "end", "center", "space-between", "space-around", "space-evenly", "stretch", "normal", "left", "right"];
|
|
4
|
+
export declare const alignItemsValues: readonly ["center", "start", "end", "flex-start", "flex-end", "self-start", "self-end", "baseline", "normal", "stretch"];
|
|
5
|
+
declare function createFlexClassNames(prefixCls: string, props: FlexProps): string;
|
|
6
|
+
export default createFlexClassNames;
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
import classNames from 'classnames';
|
|
14
|
+
export var flexWrapValues = ['wrap', 'nowrap', 'wrap-reverse'];
|
|
15
|
+
export var justifyContentValues = ['flex-start', 'flex-end', 'start', 'end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch', 'normal', 'left', 'right'];
|
|
16
|
+
export var alignItemsValues = ['center', 'start', 'end', 'flex-start', 'flex-end', 'self-start', 'self-end', 'baseline', 'normal', 'stretch'];
|
|
17
|
+
var genClsWrap = function genClsWrap(prefixCls, props) {
|
|
18
|
+
var wrapCls = {};
|
|
19
|
+
flexWrapValues.forEach(function (cssKey) {
|
|
20
|
+
wrapCls["".concat(prefixCls, "-wrap-").concat(cssKey)] = props.wrap === cssKey;
|
|
21
|
+
});
|
|
22
|
+
return wrapCls;
|
|
23
|
+
};
|
|
24
|
+
var genClsAlign = function genClsAlign(prefixCls, props) {
|
|
25
|
+
var alignCls = {};
|
|
26
|
+
alignItemsValues.forEach(function (cssKey) {
|
|
27
|
+
alignCls["".concat(prefixCls, "-align-").concat(cssKey)] = props.align === cssKey;
|
|
28
|
+
});
|
|
29
|
+
alignCls["".concat(prefixCls, "-align-stretch")] = !props.align && !!props.vertical;
|
|
30
|
+
return alignCls;
|
|
31
|
+
};
|
|
32
|
+
var genClsJustify = function genClsJustify(prefixCls, props) {
|
|
33
|
+
var justifyCls = {};
|
|
34
|
+
justifyContentValues.forEach(function (cssKey) {
|
|
35
|
+
justifyCls["".concat(prefixCls, "-justify-").concat(cssKey)] = props.justify === cssKey;
|
|
36
|
+
});
|
|
37
|
+
return justifyCls;
|
|
38
|
+
};
|
|
39
|
+
function createFlexClassNames(prefixCls, props) {
|
|
40
|
+
return classNames(__assign(__assign(__assign({}, genClsWrap(prefixCls, props)), genClsAlign(prefixCls, props)), genClsJustify(prefixCls, props)));
|
|
41
|
+
}
|
|
42
|
+
export default createFlexClassNames;
|
package/es/index.d.ts
CHANGED
|
@@ -76,3 +76,5 @@ export type { RichTextEditorProps } from './rich-text-editor';
|
|
|
76
76
|
export { default as RichTextEditor } from './rich-text-editor';
|
|
77
77
|
export { default as BeautifulDnd } from './beautiful-dnd';
|
|
78
78
|
export { default as Resizable } from './resizable';
|
|
79
|
+
export type { FlexProps } from './flex';
|
|
80
|
+
export { default as Flex } from './flex';
|
package/es/index.js
CHANGED
|
@@ -38,4 +38,5 @@ export { default as TableCol } from './table-col';
|
|
|
38
38
|
export { default as LabelCustomizeRangePicker } from './label-customize-range-picker';
|
|
39
39
|
export { default as RichTextEditor } from './rich-text-editor';
|
|
40
40
|
export { default as BeautifulDnd } from './beautiful-dnd';
|
|
41
|
-
export { default as Resizable } from './resizable';
|
|
41
|
+
export { default as Resizable } from './resizable';
|
|
42
|
+
export { default as Flex } from './flex';
|
|
@@ -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;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
return __assign.apply(this, arguments);
|
|
14
|
+
};
|
|
15
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
16
|
+
var t = {};
|
|
17
|
+
for (var p in s) {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
19
|
+
}
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
21
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
26
|
+
return mod && mod.__esModule ? mod : {
|
|
27
|
+
"default": mod
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", {
|
|
31
|
+
value: true
|
|
32
|
+
});
|
|
33
|
+
var react_1 = __importDefault(require("react"));
|
|
34
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
35
|
+
var omit_1 = __importDefault(require("rc-util/lib/omit"));
|
|
36
|
+
var gapSize_1 = require("./utils/gapSize");
|
|
37
|
+
var utils_1 = __importDefault(require("./utils"));
|
|
38
|
+
var Flex = react_1["default"].forwardRef(function (props, ref) {
|
|
39
|
+
var _a;
|
|
40
|
+
var className = props.className,
|
|
41
|
+
style = props.style,
|
|
42
|
+
flex = props.flex,
|
|
43
|
+
gap = props.gap,
|
|
44
|
+
children = props.children,
|
|
45
|
+
_b = props.vertical,
|
|
46
|
+
vertical = _b === void 0 ? false : _b,
|
|
47
|
+
_c = props.component,
|
|
48
|
+
Component = _c === void 0 ? 'div' : _c,
|
|
49
|
+
othersProps = __rest(props, ["className", "style", "flex", "gap", "children", "vertical", "component"]);
|
|
50
|
+
var prefixCls = 'as-flex';
|
|
51
|
+
var flexClassNames = (0, utils_1["default"])(prefixCls, props);
|
|
52
|
+
var mergedCls = (0, classnames_1["default"])(className, prefixCls, flexClassNames, (_a = {}, _a["".concat(prefixCls, "-gap-").concat(gap)] = (0, gapSize_1.isPresetSize)(gap), _a["".concat(prefixCls, "-vertical")] = vertical, _a));
|
|
53
|
+
var mergedStyle = __assign({}, style);
|
|
54
|
+
if (flex) {
|
|
55
|
+
mergedStyle.flex = flex;
|
|
56
|
+
}
|
|
57
|
+
if (gap && !(0, gapSize_1.isPresetSize)(gap)) {
|
|
58
|
+
mergedStyle.gap = gap;
|
|
59
|
+
}
|
|
60
|
+
return react_1["default"].createElement(Component, __assign({
|
|
61
|
+
ref: ref,
|
|
62
|
+
className: mergedCls
|
|
63
|
+
}, (0, omit_1["default"])(othersProps, ['justify', 'wrap', 'align']), {
|
|
64
|
+
style: mergedStyle
|
|
65
|
+
}), children);
|
|
66
|
+
});
|
|
67
|
+
exports["default"] = Flex;
|