@dtjoy/dt-design 1.0.0 → 1.0.2
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/esm/_util/gapSize.d.ts +3 -0
- package/esm/_util/gapSize.js +10 -0
- package/esm/_util/hooks/index.d.ts +1 -0
- package/esm/_util/hooks/index.js +1 -0
- package/esm/_util/hooks/useOrientation.d.ts +2 -0
- package/esm/_util/hooks/useOrientation.js +19 -0
- package/esm/_util/isNonNullable.d.ts +2 -0
- package/esm/_util/isNonNullable.js +4 -0
- package/esm/_util/type.d.ts +2 -1
- package/esm/blockHeader/index.d.ts +1 -1
- package/esm/blockHeader/index.js +13 -10
- package/esm/blockHeader/style/index.d.ts +2 -0
- package/esm/blockHeader/style/index.js +2 -0
- package/esm/blockHeader/{style.less → style/index.less} +143 -141
- package/esm/button/index.d.ts +10 -0
- package/esm/button/index.js +29 -0
- package/esm/button/style/index.d.ts +2 -0
- package/esm/button/style/index.js +2 -0
- package/esm/button/style/index.less +134 -0
- package/esm/button/style/mixin.less +47 -0
- package/esm/collapsible/index.d.ts +97 -0
- package/esm/collapsible/index.js +234 -0
- package/esm/collapsible/style/index.d.ts +1 -0
- package/esm/collapsible/style/index.js +1 -0
- package/esm/collapsible/style/index.less +24 -0
- package/esm/collapsibleActionItems/index.d.ts +24 -0
- package/esm/collapsibleActionItems/index.js +74 -0
- package/esm/collapsibleActionItems/style/index.d.ts +2 -0
- package/esm/collapsibleActionItems/style/index.js +2 -0
- package/esm/collapsibleActionItems/style/index.less +7 -0
- package/esm/flex/index.d.ts +7 -0
- package/esm/flex/index.js +62 -0
- package/esm/flex/interface.d.ts +16 -0
- package/esm/flex/interface.js +1 -0
- package/esm/flex/style/index.d.ts +2 -0
- package/esm/flex/style/index.js +2 -0
- package/esm/flex/style/index.less +77 -0
- package/esm/flex/utils.d.ts +7 -0
- package/esm/flex/utils.js +33 -0
- package/esm/index.d.ts +10 -1
- package/esm/index.js +8 -7
- package/esm/resize/index.d.ts +8 -0
- package/esm/resize/index.js +29 -0
- package/esm/splitter/Panel.d.ts +7 -0
- package/esm/splitter/Panel.js +38 -0
- package/esm/splitter/SplitBar.d.ts +24 -0
- package/esm/splitter/SplitBar.js +185 -0
- package/esm/splitter/Splitter.d.ts +5 -0
- package/esm/splitter/Splitter.js +215 -0
- package/esm/splitter/hooks/sizeUtil.d.ts +3 -0
- package/esm/splitter/hooks/sizeUtil.js +63 -0
- package/esm/splitter/hooks/useItems.d.ts +14 -0
- package/esm/splitter/hooks/useItems.js +44 -0
- package/esm/splitter/hooks/useResizable.d.ts +10 -0
- package/esm/splitter/hooks/useResizable.js +73 -0
- package/esm/splitter/hooks/useResize.d.ts +6 -0
- package/esm/splitter/hooks/useResize.js +158 -0
- package/esm/splitter/hooks/useSizes.d.ts +4 -0
- package/esm/splitter/hooks/useSizes.js +80 -0
- package/esm/splitter/index.d.ts +8 -0
- package/esm/splitter/index.js +5 -0
- package/esm/splitter/interface.d.ts +68 -0
- package/esm/splitter/interface.js +1 -0
- package/esm/splitter/style/index.d.ts +2 -0
- package/esm/splitter/style/index.js +2 -0
- package/esm/splitter/style/index.less +312 -0
- package/esm/statusTag/index.d.ts +28 -0
- package/esm/statusTag/index.js +122 -0
- package/esm/statusTag/style/index.d.ts +2 -0
- package/esm/statusTag/style/index.js +2 -0
- package/esm/statusTag/style/index.less +70 -0
- package/esm/statusTag/style/mixin.less +39 -0
- package/esm/style/index.d.ts +1 -0
- package/esm/style/index.js +1 -0
- package/esm/style/index.less +1 -0
- package/esm/style/mixins/index.less +0 -0
- package/esm/style/themes/index.less +2 -0
- package/esm/style/themes/variable.less +1 -0
- package/lib/_util/gapSize.d.ts +3 -0
- package/lib/_util/gapSize.js +17 -0
- package/lib/_util/hooks/index.d.ts +1 -0
- package/lib/_util/hooks/index.js +16 -0
- package/lib/_util/hooks/useOrientation.d.ts +2 -0
- package/lib/_util/hooks/useOrientation.js +26 -0
- package/lib/_util/isNonNullable.d.ts +2 -0
- package/lib/_util/isNonNullable.js +10 -0
- package/lib/_util/type.d.ts +2 -1
- package/lib/blockHeader/index.d.ts +1 -1
- package/lib/blockHeader/index.js +13 -11
- package/lib/blockHeader/style/index.d.ts +2 -0
- package/lib/blockHeader/style/index.js +4 -0
- package/lib/blockHeader/{style.less → style/index.less} +143 -141
- package/lib/button/index.d.ts +10 -0
- package/lib/button/index.js +33 -0
- package/lib/button/style/index.d.ts +2 -0
- package/lib/button/style/index.js +4 -0
- package/lib/button/style/index.less +134 -0
- package/lib/button/style/mixin.less +47 -0
- package/lib/collapsible/index.d.ts +97 -0
- package/lib/collapsible/index.js +199 -0
- package/lib/collapsible/style/index.d.ts +1 -0
- package/lib/collapsible/style/index.js +3 -0
- package/lib/collapsible/style/index.less +24 -0
- package/lib/collapsibleActionItems/index.d.ts +24 -0
- package/lib/collapsibleActionItems/index.js +68 -0
- package/lib/collapsibleActionItems/style/index.d.ts +2 -0
- package/lib/collapsibleActionItems/style/index.js +4 -0
- package/lib/collapsibleActionItems/style/index.less +7 -0
- package/lib/flex/index.d.ts +7 -0
- package/lib/flex/index.js +60 -0
- package/lib/flex/interface.d.ts +16 -0
- package/lib/flex/interface.js +5 -0
- package/lib/flex/style/index.d.ts +2 -0
- package/lib/flex/style/index.js +4 -0
- package/lib/flex/style/index.less +77 -0
- package/lib/flex/utils.d.ts +7 -0
- package/lib/flex/utils.js +39 -0
- package/lib/index.d.ts +10 -1
- package/lib/index.js +72 -1
- package/lib/resize/index.d.ts +8 -0
- package/lib/resize/index.js +38 -0
- package/lib/splitter/Panel.d.ts +7 -0
- package/lib/splitter/Panel.js +44 -0
- package/lib/splitter/SplitBar.d.ts +24 -0
- package/lib/splitter/SplitBar.js +179 -0
- package/lib/splitter/Splitter.d.ts +5 -0
- package/lib/splitter/Splitter.js +202 -0
- package/lib/splitter/hooks/sizeUtil.d.ts +3 -0
- package/lib/splitter/hooks/sizeUtil.js +56 -0
- package/lib/splitter/hooks/useItems.d.ts +14 -0
- package/lib/splitter/hooks/useItems.js +46 -0
- package/lib/splitter/hooks/useResizable.d.ts +10 -0
- package/lib/splitter/hooks/useResizable.js +83 -0
- package/lib/splitter/hooks/useResize.d.ts +6 -0
- package/lib/splitter/hooks/useResize.js +142 -0
- package/lib/splitter/hooks/useSizes.d.ts +4 -0
- package/lib/splitter/hooks/useSizes.js +62 -0
- package/lib/splitter/index.d.ts +8 -0
- package/lib/splitter/index.js +12 -0
- package/lib/splitter/interface.d.ts +68 -0
- package/lib/splitter/interface.js +5 -0
- package/lib/splitter/style/index.d.ts +2 -0
- package/lib/splitter/style/index.js +4 -0
- package/lib/splitter/style/index.less +312 -0
- package/lib/statusTag/index.d.ts +28 -0
- package/lib/statusTag/index.js +125 -0
- package/lib/statusTag/style/index.d.ts +2 -0
- package/lib/statusTag/style/index.js +4 -0
- package/lib/statusTag/style/index.less +70 -0
- package/lib/statusTag/style/mixin.less +39 -0
- package/lib/style/index.d.ts +1 -0
- package/lib/style/index.js +3 -0
- package/lib/style/index.less +1 -0
- package/lib/style/mixins/index.less +0 -0
- package/lib/style/themes/index.less +2 -0
- package/lib/style/themes/variable.less +1 -0
- package/package.json +142 -141
- package/esm/styles/entry.less +0 -6
- package/esm/styles/variables.less +0 -1
- package/lib/styles/entry.less +0 -6
- package/lib/styles/variables.less +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function isPresetSize(size) {
|
|
2
|
+
return ['small', 'middle', 'large'].includes(size);
|
|
3
|
+
}
|
|
4
|
+
export function isValidGapNumber(size) {
|
|
5
|
+
if (!size) {
|
|
6
|
+
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return typeof size === 'number' && !Number.isNaN(size);
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useOrientation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useOrientation";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
var isValidOrientation = function isValidOrientation(orientation) {
|
|
3
|
+
return orientation === 'horizontal' || orientation === 'vertical';
|
|
4
|
+
};
|
|
5
|
+
export var useOrientation = function useOrientation(orientation, vertical, legacyDirection) {
|
|
6
|
+
return useMemo(function () {
|
|
7
|
+
var validOrientation = isValidOrientation(orientation);
|
|
8
|
+
var mergedOrientation;
|
|
9
|
+
if (validOrientation) {
|
|
10
|
+
mergedOrientation = orientation || 'horizontal';
|
|
11
|
+
} else if (typeof vertical === 'boolean') {
|
|
12
|
+
mergedOrientation = vertical ? 'vertical' : 'horizontal';
|
|
13
|
+
} else {
|
|
14
|
+
var validLegacyDirection = isValidOrientation(legacyDirection);
|
|
15
|
+
mergedOrientation = validLegacyDirection ? legacyDirection || 'horizontal' : 'horizontal';
|
|
16
|
+
}
|
|
17
|
+
return [mergedOrientation, mergedOrientation === 'vertical'];
|
|
18
|
+
}, [legacyDirection, orientation, vertical]);
|
|
19
|
+
};
|
package/esm/_util/type.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
export declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
2
3
|
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
|
3
|
-
export declare type LiteralUnion<T extends string> = T | (
|
|
4
|
+
export declare type LiteralUnion<T, U extends Primitive = string> = T | (U & Record<never, never>);
|
|
4
5
|
export declare type AnyObject = Record<string, any>;
|
|
5
6
|
export declare type CustomComponent<P = AnyObject> = React.ComponentType<P> | string;
|
|
6
7
|
/**
|
package/esm/blockHeader/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
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); }
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
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; }
|
|
@@ -15,9 +16,9 @@ import { QuestionOutlined, UpOutlined } from '@dtinsight/react-icons';
|
|
|
15
16
|
import { Tooltip } from 'antd';
|
|
16
17
|
import { globalConfig } from 'antd/es/config-provider';
|
|
17
18
|
import classNames from 'classnames';
|
|
19
|
+
import "./style";
|
|
18
20
|
import { toTooltipProps } from "../_util";
|
|
19
|
-
|
|
20
|
-
import "./style.less";
|
|
21
|
+
import Collapsible from "../collapsible";
|
|
21
22
|
function isControlled(props) {
|
|
22
23
|
return props.expand !== undefined;
|
|
23
24
|
}
|
|
@@ -57,15 +58,13 @@ var BlockHeader = function BlockHeader(props) {
|
|
|
57
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
58
59
|
internalExpand = _useState2[0],
|
|
59
60
|
setInternalExpand = _useState2[1];
|
|
60
|
-
// const locale = useLocale('BlockHeader');
|
|
61
|
-
|
|
62
61
|
var currentExpand = isControlled(props) ? expand : internalExpand;
|
|
63
62
|
|
|
64
63
|
// 只有在有了 children 并且设置了 expand/defaultExpand 的时候才能够展开收起
|
|
65
64
|
var showCollapse = (typeof expand === 'boolean' || typeof defaultExpand === 'boolean') && children;
|
|
66
65
|
var tooltipProps = toTooltipProps(tooltip);
|
|
67
66
|
var bottomStyle;
|
|
68
|
-
if (spaceBottom) bottomStyle = showCollapse && currentExpand ? {
|
|
67
|
+
if (spaceBottom) bottomStyle = showCollapse && !currentExpand ? {
|
|
69
68
|
marginBottom: 0
|
|
70
69
|
} : {
|
|
71
70
|
marginBottom: spaceBottom
|
|
@@ -92,7 +91,9 @@ var BlockHeader = function BlockHeader(props) {
|
|
|
92
91
|
className: "title__text"
|
|
93
92
|
}, title), tooltipProps !== null && tooltipProps !== void 0 && tooltipProps.title ? /*#__PURE__*/React.createElement("div", {
|
|
94
93
|
className: "title__tooltip"
|
|
95
|
-
}, /*#__PURE__*/React.createElement(Tooltip,
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Tooltip, _extends({}, tooltipProps, {
|
|
95
|
+
className: classNames(tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className, 'anticon')
|
|
96
|
+
}), /*#__PURE__*/React.createElement(QuestionOutlined, null))) : null, description ? /*#__PURE__*/React.createElement("div", {
|
|
96
97
|
className: "title__description"
|
|
97
98
|
}, description) : null), addonAfter && /*#__PURE__*/React.createElement("div", {
|
|
98
99
|
className: "title__addon-after"
|
|
@@ -100,14 +101,16 @@ var BlockHeader = function BlockHeader(props) {
|
|
|
100
101
|
className: "title__collapse"
|
|
101
102
|
}, /*#__PURE__*/React.createElement("div", {
|
|
102
103
|
className: "collapse__text"
|
|
103
|
-
}), /*#__PURE__*/React.createElement(UpOutlined, {
|
|
104
|
-
className: classNames('collapse__icon', {
|
|
104
|
+
}, currentExpand ? '收起' : '展开'), /*#__PURE__*/React.createElement(UpOutlined, {
|
|
105
|
+
className: classNames('collapse__icon', 'anticon', {
|
|
105
106
|
'collapse__icon--up': currentExpand,
|
|
106
107
|
'collapse__icon--down': !currentExpand
|
|
107
108
|
})
|
|
108
|
-
}))),
|
|
109
|
+
}))), /*#__PURE__*/React.createElement(Collapsible, {
|
|
110
|
+
isOpen: !currentExpand
|
|
111
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
109
112
|
className: classNames("".concat(prefixCls, "__content"), contentClassName, _defineProperty({}, "".concat(prefixCls, "__content--active"), currentExpand || !showCollapse)),
|
|
110
113
|
style: contentStyle
|
|
111
|
-
}, children));
|
|
114
|
+
}, children)));
|
|
112
115
|
};
|
|
113
116
|
export default BlockHeader;
|
|
@@ -1,141 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
&--
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
1
|
+
@import '../../style/themes/index.less';
|
|
2
|
+
|
|
3
|
+
@card_prefix: ~'@{ant-prefix}-block-header';
|
|
4
|
+
|
|
5
|
+
.@{card_prefix} {
|
|
6
|
+
&__title {
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
&--large {
|
|
12
|
+
.title__box {
|
|
13
|
+
line-height: 24px;
|
|
14
|
+
.title__text {
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
&--middle {
|
|
20
|
+
.title__box {
|
|
21
|
+
line-height: 22px;
|
|
22
|
+
.title__text {
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
&--small {
|
|
28
|
+
.title__box {
|
|
29
|
+
line-height: 20px;
|
|
30
|
+
.title__text {
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&--background {
|
|
36
|
+
padding: 0 12px;
|
|
37
|
+
background-color: #f9f9fa;
|
|
38
|
+
&.@{card_prefix}__title {
|
|
39
|
+
&--middle,
|
|
40
|
+
&--large {
|
|
41
|
+
height: 40px;
|
|
42
|
+
}
|
|
43
|
+
&--small {
|
|
44
|
+
height: 32px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
&--pointer {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
.title {
|
|
52
|
+
&__box {
|
|
53
|
+
flex: 1;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
}
|
|
57
|
+
&__addon-before {
|
|
58
|
+
margin-right: 8px;
|
|
59
|
+
color: @primary-color;
|
|
60
|
+
&--middle {
|
|
61
|
+
.addon-before--default {
|
|
62
|
+
width: 4px;
|
|
63
|
+
height: 16px;
|
|
64
|
+
background-color: @primary-color;
|
|
65
|
+
}
|
|
66
|
+
font-size: 20px;
|
|
67
|
+
}
|
|
68
|
+
&--small {
|
|
69
|
+
.addon-before--default {
|
|
70
|
+
width: 4px;
|
|
71
|
+
height: 16px;
|
|
72
|
+
background-color: @primary-color;
|
|
73
|
+
}
|
|
74
|
+
font-size: 16px;
|
|
75
|
+
}
|
|
76
|
+
&--large {
|
|
77
|
+
.addon-before--default {
|
|
78
|
+
width: 4px;
|
|
79
|
+
height: 20px;
|
|
80
|
+
background-color: @primary-color;
|
|
81
|
+
}
|
|
82
|
+
font-size: 24px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
&__tooltip {
|
|
86
|
+
display: flex;
|
|
87
|
+
margin-right: 4px;
|
|
88
|
+
font-size: 16px;
|
|
89
|
+
color: #b1b4c5;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
&__text {
|
|
93
|
+
color: @text-color;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
margin-right: 4px;
|
|
96
|
+
}
|
|
97
|
+
&__description {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
color: @label-color;
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
}
|
|
103
|
+
&__addon-after {
|
|
104
|
+
color: @label-color;
|
|
105
|
+
}
|
|
106
|
+
&__collapse {
|
|
107
|
+
color: @label-color;
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
user-select: none;
|
|
112
|
+
.collapse {
|
|
113
|
+
&__text {
|
|
114
|
+
font-size: 12px;
|
|
115
|
+
margin: 0 4px;
|
|
116
|
+
}
|
|
117
|
+
&__icon {
|
|
118
|
+
font-size: 16px;
|
|
119
|
+
transition: transform 0.4s;
|
|
120
|
+
&--down {
|
|
121
|
+
transform: rotate(-180deg);
|
|
122
|
+
}
|
|
123
|
+
&--up {
|
|
124
|
+
transform: rotate(0deg);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
&__content {
|
|
132
|
+
padding: 16px 24px;
|
|
133
|
+
|
|
134
|
+
// opacity: 0;
|
|
135
|
+
// height: 0;
|
|
136
|
+
// overflow: hidden;
|
|
137
|
+
// transition: opacity 0.5s ease, height 0.5s ease;
|
|
138
|
+
&--active {
|
|
139
|
+
// opacity: 1;
|
|
140
|
+
// height: auto;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonProps as AntdButtonProps } from 'antd';
|
|
3
|
+
import { ButtonType as AntdButtonType } from 'antd/es/button';
|
|
4
|
+
import './style';
|
|
5
|
+
declare type ButtonType = AntdButtonType | 'secondary' | 'tertiary';
|
|
6
|
+
export interface ButtonProps extends Omit<AntdButtonProps, 'type'> {
|
|
7
|
+
type?: ButtonType;
|
|
8
|
+
}
|
|
9
|
+
export default function Button({ className, icon, children, size, type, ...rest }: ButtonProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var _excluded = ["className", "icon", "children", "size", "type"];
|
|
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 _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
|
+
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
|
+
import React from 'react';
|
|
6
|
+
import { Button as AntdButton } from 'antd';
|
|
7
|
+
import { globalConfig } from 'antd/es/config-provider';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import "./style";
|
|
10
|
+
export default function Button(_ref) {
|
|
11
|
+
var className = _ref.className,
|
|
12
|
+
icon = _ref.icon,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
_ref$size = _ref.size,
|
|
15
|
+
size = _ref$size === void 0 ? 'middle' : _ref$size,
|
|
16
|
+
type = _ref.type,
|
|
17
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
+
var prefixCls = globalConfig().getPrefixCls('btn');
|
|
19
|
+
var typeClassName = type ? "".concat(prefixCls, "--").concat(type) : '';
|
|
20
|
+
return /*#__PURE__*/React.createElement(AntdButton, _extends({
|
|
21
|
+
className: classNames(prefixCls, className, typeClassName),
|
|
22
|
+
size: size,
|
|
23
|
+
type: type
|
|
24
|
+
}, rest), icon && /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: "".concat(prefixCls, "__icon ").concat(prefixCls, "__icon--").concat(size)
|
|
26
|
+
}, icon), children && /*#__PURE__*/React.createElement("span", {
|
|
27
|
+
className: "".concat(prefixCls, "__text ").concat(prefixCls, "__text--").concat(size)
|
|
28
|
+
}, children));
|
|
29
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@import '../../style/themes/index.less';
|
|
2
|
+
@import './mixin.less';
|
|
3
|
+
|
|
4
|
+
@btn-prefix-cls: ~'@{ant-prefix}-btn';
|
|
5
|
+
|
|
6
|
+
.@{btn-prefix-cls} {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
|
|
11
|
+
// 引用中尺寸配置(核心:先调用混入,再取值)
|
|
12
|
+
.btn-size-middle();
|
|
13
|
+
padding: @padding;
|
|
14
|
+
|
|
15
|
+
// 图标样式
|
|
16
|
+
&__icon {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
font-size: inherit;
|
|
21
|
+
line-height: 0;
|
|
22
|
+
|
|
23
|
+
.dtstack-icon {
|
|
24
|
+
font-size: inherit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 小尺寸图标
|
|
28
|
+
&--small {
|
|
29
|
+
.btn-size-small();
|
|
30
|
+
font-size: @icon-font-size;
|
|
31
|
+
}
|
|
32
|
+
// 中尺寸图标
|
|
33
|
+
&--middle {
|
|
34
|
+
.btn-size-middle();
|
|
35
|
+
font-size: @icon-font-size;
|
|
36
|
+
}
|
|
37
|
+
// 大尺寸图标
|
|
38
|
+
&--large {
|
|
39
|
+
.btn-size-large();
|
|
40
|
+
font-size: @icon-font-size;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 图标与文字间距
|
|
44
|
+
& + .@{btn-prefix-cls}__text {
|
|
45
|
+
&--small {
|
|
46
|
+
.btn-size-small();
|
|
47
|
+
margin-left: @icon-text-margin;
|
|
48
|
+
}
|
|
49
|
+
&--middle {
|
|
50
|
+
.btn-size-middle();
|
|
51
|
+
margin-left: @icon-text-margin;
|
|
52
|
+
}
|
|
53
|
+
&--large {
|
|
54
|
+
.btn-size-large();
|
|
55
|
+
margin-left: @icon-text-margin;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 文字样式
|
|
61
|
+
&__text {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
|
|
64
|
+
&--small {
|
|
65
|
+
.btn-size-small();
|
|
66
|
+
font-size: @text-font-size;
|
|
67
|
+
}
|
|
68
|
+
&--middle {
|
|
69
|
+
.btn-size-middle();
|
|
70
|
+
font-size: @text-font-size;
|
|
71
|
+
}
|
|
72
|
+
&--large {
|
|
73
|
+
.btn-size-large();
|
|
74
|
+
font-size: @text-font-size;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 尺寸变体
|
|
79
|
+
&-sm {
|
|
80
|
+
.btn-size-small();
|
|
81
|
+
padding: @padding;
|
|
82
|
+
}
|
|
83
|
+
&-lg {
|
|
84
|
+
.btn-size-large();
|
|
85
|
+
padding: @padding;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 主要按钮
|
|
89
|
+
&-primary {
|
|
90
|
+
.btn-disabled-primary();
|
|
91
|
+
.generate-btn-disabled(@bg, @color, @border);
|
|
92
|
+
|
|
93
|
+
&:hover,
|
|
94
|
+
&:focus {
|
|
95
|
+
background-color: #225fdb;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 次要按钮
|
|
100
|
+
&-secondary {
|
|
101
|
+
border-color: @primary-color;
|
|
102
|
+
color: @primary-color;
|
|
103
|
+
|
|
104
|
+
&:hover,
|
|
105
|
+
&:focus {
|
|
106
|
+
background-color: fade(@primary-color, 10%);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.btn-disabled-secondary-tertiary();
|
|
110
|
+
.generate-btn-disabled(@bg, @color, @border);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 三级按钮
|
|
114
|
+
&-tertiary {
|
|
115
|
+
background-color: #f3f3f3;
|
|
116
|
+
border-color: @border-color-base;
|
|
117
|
+
|
|
118
|
+
&:hover,
|
|
119
|
+
&:focus {
|
|
120
|
+
background-color: fade(@primary-color, 10%);
|
|
121
|
+
border-color: @primary-color;
|
|
122
|
+
color: @primary-color;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.btn-disabled-secondary-tertiary();
|
|
126
|
+
.generate-btn-disabled(@bg, @color, @border);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 默认按钮
|
|
130
|
+
&-default {
|
|
131
|
+
.btn-disabled-default();
|
|
132
|
+
.generate-btn-disabled(@bg, @color, @border);
|
|
133
|
+
}
|
|
134
|
+
}
|