@kdcloudjs/kdesign 1.2.0 → 1.2.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/CHANGELOG.md +24 -0
- package/dist/kdesign-complete.less +476 -464
- package/dist/kdesign.css +135 -209
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +234 -215
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +8 -8
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/usePopper.js +33 -11
- package/es/collapse/panel.d.ts +1 -0
- package/es/collapse/panel.js +17 -5
- package/es/collapse/style/index.css +32 -6
- package/es/collapse/style/index.less +24 -1
- package/es/collapse/style/token.less +12 -10
- package/es/drawer/drawer.d.ts +1 -0
- package/es/drawer/drawer.js +56 -21
- package/es/radio/radio.js +3 -1
- package/es/radio/style/index.css +46 -18
- package/es/radio/style/index.less +27 -1
- package/es/radio/style/token.less +4 -4
- package/es/select/option.js +1 -1
- package/es/select/style/index.css +14 -5
- package/es/select/style/index.less +374 -368
- package/es/select/style/token.less +2 -2
- package/es/steps/style/index.css +40 -32
- package/es/steps/style/index.less +23 -33
- package/es/steps/style/token.less +6 -9
- package/es/tag/style/index.css +2 -147
- package/es/tag/style/index.less +4 -24
- package/es/tag/style/mixin.less +0 -13
- package/es/tag/style/token.less +1 -1
- package/lib/_utils/usePopper.js +34 -11
- package/lib/collapse/panel.d.ts +1 -0
- package/lib/collapse/panel.js +17 -5
- package/lib/collapse/style/index.css +32 -6
- package/lib/collapse/style/index.less +24 -1
- package/lib/collapse/style/token.less +12 -10
- package/lib/drawer/drawer.d.ts +1 -0
- package/lib/drawer/drawer.js +61 -27
- package/lib/radio/radio.js +3 -1
- package/lib/radio/style/index.css +46 -18
- package/lib/radio/style/index.less +27 -1
- package/lib/radio/style/token.less +4 -4
- package/lib/select/option.js +1 -1
- package/lib/select/style/index.css +14 -5
- package/lib/select/style/index.less +374 -368
- package/lib/select/style/token.less +2 -2
- package/lib/steps/style/index.css +40 -32
- package/lib/steps/style/index.less +23 -33
- package/lib/steps/style/token.less +6 -9
- package/lib/tag/style/index.css +2 -147
- package/lib/tag/style/index.less +4 -24
- package/lib/tag/style/mixin.less +0 -13
- package/lib/tag/style/token.less +1 -1
- package/package.json +1 -1
package/es/tag/style/index.less
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
&-size-large {
|
|
19
19
|
.tag-size(@tag-large-font-size, @tag-large-height, @tag-large-padding-horizontal);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
transition: all @tag-g-motion-duration;
|
|
23
23
|
// 状态标签
|
|
24
24
|
&-shape-status {
|
|
@@ -42,16 +42,6 @@
|
|
|
42
42
|
// 文本标签
|
|
43
43
|
&-shape-text {
|
|
44
44
|
.tag-text-color(@tag-process-color);
|
|
45
|
-
.tag-text-padding(@tag-small-padding-horizontal)
|
|
46
|
-
}
|
|
47
|
-
&-shape-text.@{tag-prefix-cls}-size-small {
|
|
48
|
-
.tag-text-padding(@tag-small-padding-horizontal)
|
|
49
|
-
}
|
|
50
|
-
&-shape-text.@{tag-prefix-cls}-size-middle {
|
|
51
|
-
.tag-text-padding(@tag-middle-padding-horizontal)
|
|
52
|
-
}
|
|
53
|
-
&-shape-text.@{tag-prefix-cls}-size-large {
|
|
54
|
-
.tag-text-padding(@tag-large-padding-horizontal)
|
|
55
45
|
}
|
|
56
46
|
each(@types, {
|
|
57
47
|
&-shape-text.@{tag-prefix-cls}-@{value} {
|
|
@@ -76,13 +66,13 @@
|
|
|
76
66
|
&:not(.@{tag-prefix-cls}-closable-disabled):hover {
|
|
77
67
|
border-color: @tag-edit-g-color-border-hover;
|
|
78
68
|
.@{tag-prefix-cls}-closeWrapper {
|
|
79
|
-
background-color: @tag-edit-cloesWrapper-g-color-background-hover;
|
|
69
|
+
// background-color: @tag-edit-cloesWrapper-g-color-background-hover;
|
|
80
70
|
color: @tag-edit-cloesWrapper-g-text-color-hover;
|
|
81
71
|
}
|
|
82
72
|
}
|
|
83
73
|
|
|
84
74
|
&.@{tag-prefix-cls}-closable {
|
|
85
|
-
padding-right:
|
|
75
|
+
padding-right: 8px;
|
|
86
76
|
}
|
|
87
77
|
}
|
|
88
78
|
|
|
@@ -109,28 +99,18 @@
|
|
|
109
99
|
}
|
|
110
100
|
&-closable.@{tag-prefix-cls}-size-middle {
|
|
111
101
|
line-height: @tag-middle-height;
|
|
112
|
-
|
|
113
|
-
.@{tag-prefix-cls}-closeWrapper {
|
|
114
|
-
width: calc(@tag-middle-height - 2px);
|
|
115
|
-
height: calc(@tag-middle-height - 2px);
|
|
116
|
-
}
|
|
117
102
|
}
|
|
118
103
|
&-closable.@{tag-prefix-cls}-size-large {
|
|
119
104
|
line-height: @tag-large-height;
|
|
120
105
|
padding-left: @tag-large-padding-horizontal;
|
|
121
106
|
|
|
122
107
|
.@{tag-prefix-cls}-closeWrapper {
|
|
123
|
-
width: calc(@tag-large-height - 2px);
|
|
124
|
-
height: calc(@tag-large-height - 2px);
|
|
125
|
-
|
|
126
108
|
.@{tag-prefix-cls}-close-icon {
|
|
127
109
|
font-size: 14px;
|
|
128
110
|
}
|
|
129
111
|
}
|
|
130
112
|
}
|
|
131
113
|
&-closeWrapper {
|
|
132
|
-
width: calc(@tag-middle-height - 2px);
|
|
133
|
-
height: calc(@tag-middle-height - 2px);
|
|
134
114
|
margin-left: 4px;
|
|
135
115
|
display: inline-flex;
|
|
136
116
|
justify-content: center;
|
|
@@ -141,4 +121,4 @@
|
|
|
141
121
|
cursor: pointer;
|
|
142
122
|
font-size: 12px;
|
|
143
123
|
}
|
|
144
|
-
}
|
|
124
|
+
}
|
package/es/tag/style/mixin.less
CHANGED
|
@@ -29,17 +29,4 @@
|
|
|
29
29
|
align-items: center;
|
|
30
30
|
padding: 0;
|
|
31
31
|
border-radius: 0;
|
|
32
|
-
&::before{
|
|
33
|
-
content: '';
|
|
34
|
-
display: block;
|
|
35
|
-
background-color: @color;
|
|
36
|
-
border-radius: 50%;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
.tag-text-padding(@padding) {
|
|
40
|
-
&::before{
|
|
41
|
-
width: @padding;
|
|
42
|
-
height: @padding;
|
|
43
|
-
margin-right: @padding;
|
|
44
|
-
}
|
|
45
32
|
}
|
package/es/tag/style/token.less
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
@tag-edit-g-text-color: var(~'@{tag-custom-prefix}-edit-color-text', @color-text-primary);
|
|
16
16
|
@tag-edit-g-color-border-hover: var(~'@{tag-custom-prefix}-edit-color-border-hover', @color-theme);
|
|
17
17
|
@tag-edit-cloesWrapper-g-color-background-hover: var(~'@{tag-custom-prefix}-edit-cloesWrapper-color-background-hover', @color-theme);
|
|
18
|
-
@tag-edit-cloesWrapper-g-text-color-hover: var(~'@{tag-custom-prefix}-edit-cloesWrapper-color-text-hover', @color-
|
|
18
|
+
@tag-edit-cloesWrapper-g-text-color-hover: var(~'@{tag-custom-prefix}-edit-cloesWrapper-color-text-hover', @color-theme);
|
|
19
19
|
@tag-edit-g-color-background-disabled: var(~'@{tag-custom-prefix}-edit-color-background-disabled', @color-background-contain-disabled);
|
|
20
20
|
@tag-edit-g-color-border-disabled: var(~'@{tag-custom-prefix}-edit-color-background-disabled', @color-border-strong);
|
|
21
21
|
@tag-edit-g-text-color-disabled: var(~'@{tag-custom-prefix}-edit-color-text-disabled', @color-border-strong);
|
package/lib/_utils/usePopper.js
CHANGED
|
@@ -21,6 +21,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/hel
|
|
|
21
21
|
|
|
22
22
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
23
23
|
|
|
24
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
25
|
+
|
|
24
26
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
25
27
|
|
|
26
28
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
@@ -118,6 +120,23 @@ var getOffsetPos = function getOffsetPos(el) {
|
|
|
118
120
|
return elPos;
|
|
119
121
|
};
|
|
120
122
|
|
|
123
|
+
var getBorderWidth = function getBorderWidth(el) {
|
|
124
|
+
var border = {
|
|
125
|
+
top: 0,
|
|
126
|
+
left: 0
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
if (el.offsetParent) {
|
|
130
|
+
var _context, _context2;
|
|
131
|
+
|
|
132
|
+
var parentBorder = getBorderWidth(el.offsetParent);
|
|
133
|
+
border.top += parentBorder.top + parseInt((0, _slice.default)(_context = getComputedStyle(el.offsetParent, null).borderTopWidth).call(_context, 0, -2));
|
|
134
|
+
border.left += parentBorder.left + parseInt((0, _slice.default)(_context2 = getComputedStyle(el.offsetParent, null).borderTopWidth).call(_context2, 0, -2));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return border;
|
|
138
|
+
};
|
|
139
|
+
|
|
121
140
|
var getScrollDist = function getScrollDist(el, container) {
|
|
122
141
|
var elScroll = {
|
|
123
142
|
top: el.scrollTop,
|
|
@@ -138,7 +157,7 @@ var getScrollDist = function getScrollDist(el, container) {
|
|
|
138
157
|
};
|
|
139
158
|
|
|
140
159
|
function usePopper(locatorElement, popperElement, props) {
|
|
141
|
-
var
|
|
160
|
+
var _context3, _context4, _arrowStyle;
|
|
142
161
|
|
|
143
162
|
var prefixCls = props.prefixCls,
|
|
144
163
|
onTrigger = props.onTrigger,
|
|
@@ -177,11 +196,11 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
177
196
|
} : _props$getPopupContai;
|
|
178
197
|
var arrowWidth = Math.sqrt(2 * Math.pow(arrowSize, 2));
|
|
179
198
|
var componentName = (prefixCls === null || prefixCls === void 0 ? void 0 : prefixCls.split('-')[1]) || '';
|
|
180
|
-
(0, _devwarning.default)(Placements.indexOf(placement) === -1, componentName, (0, _concat.default)(
|
|
199
|
+
(0, _devwarning.default)(Placements.indexOf(placement) === -1, componentName, (0, _concat.default)(_context3 = "cannot found ".concat(componentName, " placement '")).call(_context3, placement, "'"));
|
|
181
200
|
var isWrongTrigger = Array.isArray(trigger) ? trigger.some(function (v) {
|
|
182
201
|
return !(0, _includes.default)(Triggers).call(Triggers, v);
|
|
183
202
|
}) : Triggers.indexOf(trigger) === -1;
|
|
184
|
-
(0, _devwarning.default)(isWrongTrigger, componentName, (0, _concat.default)(
|
|
203
|
+
(0, _devwarning.default)(isWrongTrigger, componentName, (0, _concat.default)(_context4 = "cannot found ".concat(componentName, " trigger '")).call(_context4, trigger, "'"));
|
|
185
204
|
var locatorEl = (0, _react.useRef)();
|
|
186
205
|
var popperEl = (0, _react.useRef)();
|
|
187
206
|
var locatorRef = locatorElement.ref || locatorEl;
|
|
@@ -281,21 +300,25 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
281
300
|
locatorTop = _getOffsetPos2.top,
|
|
282
301
|
locatorLeft = _getOffsetPos2.left;
|
|
283
302
|
|
|
284
|
-
var _getScrollDist = getScrollDist(locatorRef.current.parentElement, container),
|
|
285
|
-
scrollTop = _getScrollDist.top,
|
|
286
|
-
scrollLeft = _getScrollDist.left;
|
|
287
|
-
|
|
288
303
|
var _getTranslatePos = getTranslatePos(locatorRef.current),
|
|
289
304
|
translateTop = _getTranslatePos.top,
|
|
290
305
|
translateLeft = _getTranslatePos.left;
|
|
291
306
|
|
|
307
|
+
var _getBorderWidth = getBorderWidth(locatorRef.current),
|
|
308
|
+
borderTop = _getBorderWidth.top,
|
|
309
|
+
borderLeft = _getBorderWidth.left;
|
|
310
|
+
|
|
311
|
+
var _getScrollDist = getScrollDist(locatorRef.current.parentElement, container),
|
|
312
|
+
scrollTop = _getScrollDist.top,
|
|
313
|
+
scrollLeft = _getScrollDist.left;
|
|
314
|
+
|
|
292
315
|
var locatorPos = {
|
|
293
316
|
width: width,
|
|
294
317
|
height: height,
|
|
295
|
-
top: locatorTop + translateTop - containerTop - scrollTop,
|
|
296
|
-
left: locatorLeft + translateLeft - containerLeft - scrollLeft,
|
|
297
|
-
right: locatorLeft + translateLeft + width - containerLeft - scrollLeft,
|
|
298
|
-
bottom: locatorTop + translateTop + height - containerTop - scrollTop
|
|
318
|
+
top: locatorTop + borderTop + translateTop - containerTop - scrollTop,
|
|
319
|
+
left: locatorLeft + borderLeft + translateLeft - containerLeft - scrollLeft,
|
|
320
|
+
right: locatorLeft + borderLeft + translateLeft + width - containerLeft - scrollLeft,
|
|
321
|
+
bottom: locatorTop + borderTop + translateTop + height - containerTop - scrollTop
|
|
299
322
|
};
|
|
300
323
|
var currentPos = trigger === 'contextMenu' ? mousePos : locatorPos;
|
|
301
324
|
var _currentPlacement = placement;
|
package/lib/collapse/panel.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface PanelProps {
|
|
|
8
8
|
expandIconPosition?: IconPositionType;
|
|
9
9
|
onChange?: (key: keyType) => void;
|
|
10
10
|
extra?: React.ReactNode | ((props: PanelProps) => React.ReactNode);
|
|
11
|
+
assist?: React.ReactNode | ((props: PanelProps) => React.ReactNode);
|
|
11
12
|
expand?: boolean;
|
|
12
13
|
defaultExpand?: boolean;
|
|
13
14
|
children?: React.ReactNode;
|
package/lib/collapse/panel.js
CHANGED
|
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
|
|
|
34
34
|
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; }
|
|
35
35
|
|
|
36
36
|
var Panel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
37
|
-
var
|
|
37
|
+
var _classNames6, _classNames7, _classNames8;
|
|
38
38
|
|
|
39
39
|
var _React$useContext = _react.default.useContext(_ConfigContext.default),
|
|
40
40
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
@@ -44,6 +44,7 @@ var Panel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
44
44
|
var _getCompProps = (0, _utils.getCompProps)('CollapsePanel', userDefaultProps, props),
|
|
45
45
|
disabled = _getCompProps.disabled,
|
|
46
46
|
extra = _getCompProps.extra,
|
|
47
|
+
assist = _getCompProps.assist,
|
|
47
48
|
header = _getCompProps.header,
|
|
48
49
|
onChange = _getCompProps.onChange,
|
|
49
50
|
panelKey = _getCompProps.panelKey,
|
|
@@ -114,6 +115,17 @@ var Panel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
114
115
|
}, renderReactNode(extra)), expandIconPosition === 'right' ? renderIcon() : null);
|
|
115
116
|
};
|
|
116
117
|
|
|
118
|
+
var renderMiddle = function renderMiddle() {
|
|
119
|
+
var _classNames5;
|
|
120
|
+
|
|
121
|
+
var className = (0, _classnames.default)((_classNames5 = {}, (0, _defineProperty2.default)(_classNames5, "".concat(panelPrefixCls, "-middle"), true), (0, _defineProperty2.default)(_classNames5, "".concat(panelPrefixCls, "-disabled"), disabled), _classNames5));
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
123
|
+
className: className
|
|
124
|
+
}, assist && /*#__PURE__*/_react.default.createElement("span", {
|
|
125
|
+
className: "".concat(panelPrefixCls, "-assist")
|
|
126
|
+
}, renderReactNode(assist)), expandIconPosition === 'right' ? renderIcon() : null);
|
|
127
|
+
};
|
|
128
|
+
|
|
117
129
|
var renderReactNode = function renderReactNode(reactNode) {
|
|
118
130
|
if (typeof reactNode === 'function') {
|
|
119
131
|
return reactNode();
|
|
@@ -122,9 +134,9 @@ var Panel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
122
134
|
return reactNode;
|
|
123
135
|
};
|
|
124
136
|
|
|
125
|
-
var rootClassName = (0, _classnames.default)(className, (
|
|
126
|
-
var topClassName = (0, _classnames.default)((
|
|
127
|
-
var childrenClassName = (0, _classnames.default)((
|
|
137
|
+
var rootClassName = (0, _classnames.default)(className, (_classNames6 = {}, (0, _defineProperty2.default)(_classNames6, "".concat(panelPrefixCls), true), (0, _defineProperty2.default)(_classNames6, "".concat(panelPrefixCls, "-border"), bordered), (0, _defineProperty2.default)(_classNames6, "".concat(panelPrefixCls, "-opened"), expand), _classNames6));
|
|
138
|
+
var topClassName = (0, _classnames.default)((_classNames7 = {}, (0, _defineProperty2.default)(_classNames7, "".concat(panelPrefixCls, "-top"), true), (0, _defineProperty2.default)(_classNames7, "".concat(panelPrefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_classNames7, "".concat(panelPrefixCls, "-top-border"), bordered && expand), _classNames7));
|
|
139
|
+
var childrenClassName = (0, _classnames.default)((_classNames8 = {}, (0, _defineProperty2.default)(_classNames8, "".concat(panelPrefixCls, "-children"), expand), (0, _defineProperty2.default)(_classNames8, "".concat(panelPrefixCls, "-children-hide"), !expand), _classNames8));
|
|
128
140
|
var childrenBorderedClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(panelPrefixCls, "-children-bordered"), bordered));
|
|
129
141
|
|
|
130
142
|
var runExpandAnimation = function runExpandAnimation(element) {
|
|
@@ -175,7 +187,7 @@ var Panel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
175
187
|
ref: panelPrefixClsRef
|
|
176
188
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
177
189
|
className: topClassName
|
|
178
|
-
}, renderLeft(), renderRight()), /*#__PURE__*/_react.default.createElement("div", {
|
|
190
|
+
}, renderLeft(), renderMiddle(), renderRight()), /*#__PURE__*/_react.default.createElement("div", {
|
|
179
191
|
className: childrenClassName,
|
|
180
192
|
ref: childrenRef
|
|
181
193
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -130,13 +130,22 @@
|
|
|
130
130
|
display: -webkit-inline-box;
|
|
131
131
|
display: -ms-inline-flexbox;
|
|
132
132
|
display: inline-flex;
|
|
133
|
-
padding: var(--kd-c-collapse-header-spacing-padding,
|
|
133
|
+
padding: var(--kd-c-collapse-header-spacing-padding, 8px 50px 8px 28px);
|
|
134
134
|
background: var(--kd-c-collapse-header-color-background, rgba(0, 0, 0, 0));
|
|
135
135
|
}
|
|
136
136
|
.kd-collapse-panel-top-border {
|
|
137
137
|
border-bottom: var(--kd-c-collapse-border-width, 1px) solid var(--kd-c-collapse-color-border-strong-2, var(--kd-g-color-border-strong-2, #d9d9d9));
|
|
138
138
|
}
|
|
139
139
|
.kd-collapse-panel-left {
|
|
140
|
+
display: -webkit-inline-box;
|
|
141
|
+
display: -ms-inline-flexbox;
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
-webkit-box-align: center;
|
|
144
|
+
-ms-flex-align: center;
|
|
145
|
+
align-items: center;
|
|
146
|
+
line-height: 1.5;
|
|
147
|
+
}
|
|
148
|
+
.kd-collapse-panel-middle {
|
|
140
149
|
display: -webkit-inline-box;
|
|
141
150
|
display: -ms-inline-flexbox;
|
|
142
151
|
display: inline-flex;
|
|
@@ -144,16 +153,23 @@
|
|
|
144
153
|
-ms-flex-align: center;
|
|
145
154
|
align-items: center;
|
|
146
155
|
-webkit-box-flex: 1;
|
|
147
|
-
-ms-flex
|
|
148
|
-
flex
|
|
156
|
+
-ms-flex: 1;
|
|
157
|
+
flex: 1;
|
|
158
|
+
margin-left: 22px;
|
|
159
|
+
color: var(--kd-c-collapse-header-color-text-secondary, var(--kd-g-color-text-secondary, #666));
|
|
160
|
+
white-space: nowrap;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
text-overflow: ellipsis;
|
|
149
163
|
}
|
|
150
164
|
.kd-collapse-panel-right {
|
|
165
|
+
margin-left: 40px;
|
|
151
166
|
display: -webkit-inline-box;
|
|
152
167
|
display: -ms-inline-flexbox;
|
|
153
168
|
display: inline-flex;
|
|
154
169
|
-webkit-box-align: center;
|
|
155
170
|
-ms-flex-align: center;
|
|
156
171
|
align-items: center;
|
|
172
|
+
white-space: nowrap;
|
|
157
173
|
}
|
|
158
174
|
.kd-collapse-panel-extra,
|
|
159
175
|
.kd-collapse-panel-header {
|
|
@@ -164,7 +180,16 @@
|
|
|
164
180
|
-ms-flex-align: center;
|
|
165
181
|
align-items: center;
|
|
166
182
|
color: var(--kd-c-collapse-header-color-text-primary, var(--kd-g-color-text-primary, #212121));
|
|
167
|
-
font-size: var(--kd-c-collapse-header-font-size,
|
|
183
|
+
font-size: var(--kd-c-collapse-header-font-size, 16px);
|
|
184
|
+
}
|
|
185
|
+
.kd-collapse-panel-header {
|
|
186
|
+
display: inline-block;
|
|
187
|
+
white-space: nowrap;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
text-overflow: ellipsis;
|
|
190
|
+
}
|
|
191
|
+
.kd-collapse-panel-header:hover {
|
|
192
|
+
color: var(--kd-c-collapse-header-color-text-hover, #666666);
|
|
168
193
|
}
|
|
169
194
|
.kd-collapse-panel-icon {
|
|
170
195
|
-webkit-box-align: center;
|
|
@@ -174,6 +199,7 @@
|
|
|
174
199
|
display: -ms-inline-flexbox;
|
|
175
200
|
display: inline-flex;
|
|
176
201
|
margin-right: var(--kd-c-collapse-spacing-margin-right, 6px);
|
|
202
|
+
font-size: var(--kd-c-collapse-icon-font-size, 16px);
|
|
177
203
|
}
|
|
178
204
|
.kd-collapse-panel-icon:hover,
|
|
179
205
|
.kd-collapse-panel-left:hover {
|
|
@@ -198,7 +224,7 @@
|
|
|
198
224
|
.kd-collapse-panel-children {
|
|
199
225
|
overflow: hidden;
|
|
200
226
|
opacity: 0;
|
|
201
|
-
padding: var(--kd-c-collapse-content-spacing-padding, 0
|
|
227
|
+
padding: var(--kd-c-collapse-content-spacing-padding, 0 50px);
|
|
202
228
|
color: var(--kd-c-collapse-content-color-text-primary, var(--kd-g-color-text-primary, #212121));
|
|
203
229
|
font-size: var(--kd-c-collapse-content-font-size, var(--kd-g-font-size-middle, 14px));
|
|
204
230
|
-webkit-transition: height var(--kd-c-collapse-motion-duration, var(--kd-g-duration, 0.3s)), opacity var(--kd-c-collapse-motion-duration, var(--kd-g-duration, 0.3s));
|
|
@@ -209,7 +235,7 @@
|
|
|
209
235
|
overflow: hidden;
|
|
210
236
|
opacity: 0;
|
|
211
237
|
height: 0;
|
|
212
|
-
padding: var(--kd-c-collapse-content-spacing-padding, 0
|
|
238
|
+
padding: var(--kd-c-collapse-content-spacing-padding, 0 50px);
|
|
213
239
|
color: var(--kd-c-collapse-content-color-text-primary, var(--kd-g-color-text-primary, #212121));
|
|
214
240
|
font-size: var(--kd-c-collapse-content-font-size, var(--kd-g-font-size-middle, 14px));
|
|
215
241
|
-webkit-transition: height var(--kd-c-collapse-motion-duration, var(--kd-g-duration, 0.3s)), opacity calc(var(--kd-c-collapse-motion-duration, var(--kd-g-duration, 0.3s)) / 2);
|
|
@@ -27,11 +27,23 @@
|
|
|
27
27
|
&-left {
|
|
28
28
|
display: inline-flex;
|
|
29
29
|
align-items: center;
|
|
30
|
-
|
|
30
|
+
line-height: 1.5;
|
|
31
|
+
}
|
|
32
|
+
&-middle {
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
flex: 1;
|
|
36
|
+
margin-left: 22px;
|
|
37
|
+
color: @collapse-header-font-color-secondary;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
31
41
|
}
|
|
32
42
|
&-right {
|
|
43
|
+
margin-left: 40px;
|
|
33
44
|
display: inline-flex;
|
|
34
45
|
align-items: center;
|
|
46
|
+
white-space: nowrap;
|
|
35
47
|
}
|
|
36
48
|
&-extra,
|
|
37
49
|
&-header {
|
|
@@ -40,10 +52,21 @@
|
|
|
40
52
|
color: @collapse-header-font-color;
|
|
41
53
|
font-size: @collapse-header-font-size;
|
|
42
54
|
}
|
|
55
|
+
|
|
56
|
+
&-header {
|
|
57
|
+
display: inline-block;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
text-overflow: ellipsis;
|
|
61
|
+
&:hover {
|
|
62
|
+
color: @collapse-header-color-text-hover;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
43
65
|
&-icon {
|
|
44
66
|
align-items: center;
|
|
45
67
|
display: inline-flex;
|
|
46
68
|
margin-right: @collapse-icon-margin-right;
|
|
69
|
+
font-size: @collapse-icon-font-size;
|
|
47
70
|
}
|
|
48
71
|
&-icon:hover,
|
|
49
72
|
&-left:hover {
|
|
@@ -2,25 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
@collapse-prefix: '--@{kd-prefix}-c-collapse';
|
|
4
4
|
|
|
5
|
-
// sizing
|
|
6
|
-
@collapse-border-width: var(~'@{collapse-prefix}-border-width', 1px);
|
|
7
|
-
@collapse-icon-margin-right: var(~'@{collapse-prefix}-spacing-margin-right', 6px);
|
|
8
|
-
@collapse-header-padding: var(~'@{collapse-prefix}-header-spacing-padding', 12px);
|
|
9
|
-
@collapse-content-bordered-padding: var(~'@{collapse-prefix}-content-bordered-spacing-padding', 12px);
|
|
10
|
-
@collapse-content-padding: var(~'@{collapse-prefix}-content-spacing-padding', 0 16px);
|
|
11
|
-
|
|
12
5
|
// color
|
|
13
6
|
@collapse-border-color: var(~'@{collapse-prefix}-color-border-strong-2', @color-border-strong-2);
|
|
14
7
|
@collapse-header-font-color: var(~'@{collapse-prefix}-header-color-text-primary', @color-text-primary);
|
|
8
|
+
@collapse-header-font-color-secondary: var(~'@{collapse-prefix}-header-color-text-secondary', @color-text-secondary);
|
|
15
9
|
@collapse-content-font-color: var(~'@{collapse-prefix}-content-color-text-primary', @color-text-primary);
|
|
16
10
|
@collapse-disabled-color: var(~'@{collapse-prefix}-color-disabled', raba(178, 178, 178, 1));
|
|
17
11
|
@collapse-header-color-background: var(~'@{collapse-prefix}-header-color-background', rgba(0, 0, 0, 0));
|
|
18
12
|
@collapse-content-color-background: var(~'@{collapse-prefix}-content-color-background', rgba(0, 0, 0, 0));
|
|
19
|
-
|
|
13
|
+
@collapse-header-color-text-hover: var(~'@{collapse-prefix}-header-color-text-hover', #666666);
|
|
20
14
|
|
|
21
15
|
// font
|
|
22
|
-
@collapse-header-font-size: var(~'@{collapse-prefix}-header-font-size',
|
|
16
|
+
@collapse-header-font-size: var(~'@{collapse-prefix}-header-font-size', 16px);
|
|
23
17
|
@collapse-content-font-size: var(~'@{collapse-prefix}-content-font-size', @font-size-middle);
|
|
18
|
+
@collapse-icon-font-size: var(~'@{collapse-prefix}-icon-font-size', 16px);
|
|
24
19
|
|
|
25
20
|
// motion
|
|
26
|
-
@collapse-transition-duration: var(~'@{collapse-prefix}-motion-duration', @duration-promptly);
|
|
21
|
+
@collapse-transition-duration: var(~'@{collapse-prefix}-motion-duration', @duration-promptly);
|
|
22
|
+
|
|
23
|
+
// sizing
|
|
24
|
+
@collapse-border-width: var(~'@{collapse-prefix}-border-width', 1px);
|
|
25
|
+
@collapse-icon-margin-right: var(~'@{collapse-prefix}-spacing-margin-right', 6px);
|
|
26
|
+
@collapse-header-padding: var(~'@{collapse-prefix}-header-spacing-padding', 8px 50px 8px 28px);
|
|
27
|
+
@collapse-content-bordered-padding: var(~'@{collapse-prefix}-content-bordered-spacing-padding', 12px);
|
|
28
|
+
@collapse-content-padding: var(~'@{collapse-prefix}-content-spacing-padding', 0 50px);
|
package/lib/drawer/drawer.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface IDrawerProps {
|
|
|
34
34
|
titleStyle?: CSSProperties;
|
|
35
35
|
visible?: boolean;
|
|
36
36
|
width?: string | number;
|
|
37
|
+
height?: string | number;
|
|
37
38
|
zIndex?: string | number;
|
|
38
39
|
}
|
|
39
40
|
declare const Drawer: React.ForwardRefExoticComponent<IDrawerProps & React.RefAttributes<unknown>>;
|
package/lib/drawer/drawer.js
CHANGED
|
@@ -13,20 +13,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
13
|
});
|
|
14
14
|
exports.default = exports.PlacementTypes = void 0;
|
|
15
15
|
|
|
16
|
-
var _extends3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
17
|
-
|
|
18
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
19
|
-
|
|
20
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
21
|
-
|
|
22
|
-
var _endsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/ends-with"));
|
|
23
|
-
|
|
24
16
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
25
17
|
|
|
26
18
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
27
19
|
|
|
28
20
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
29
21
|
|
|
22
|
+
var _extends3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
27
|
+
|
|
30
28
|
var _react = _interopRequireWildcard(require("react"));
|
|
31
29
|
|
|
32
30
|
var _index = require("../index");
|
|
@@ -57,22 +55,23 @@ exports.PlacementTypes = PlacementTypes;
|
|
|
57
55
|
var relativePostionTypes = ['relative', 'absolute', 'fixed'];
|
|
58
56
|
var horizontalPlacements = ['left', 'right'];
|
|
59
57
|
var verticalPlacements = ['top', 'bottom'];
|
|
60
|
-
var documentBody = document.body;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
var documentBody = document.body; // function transformSize(size: string | number, placement: string) {
|
|
59
|
+
// if (typeof size === 'string') {
|
|
60
|
+
// // 只考虑px 或者 %
|
|
61
|
+
// devWarning(
|
|
62
|
+
// !(size.endsWith('px') && size.endsWith('%')),
|
|
63
|
+
// 'drawer',
|
|
64
|
+
// `cannot calculate drawer size: width | height for '${size}' besides px or %`,
|
|
65
|
+
// )
|
|
66
|
+
// if (placement === 'right' || placement === 'bottom') return size || 0
|
|
67
|
+
// return size ? '-' + size : 0
|
|
68
|
+
// }
|
|
69
|
+
// if (placement === 'right' || placement === 'bottom') return (size || 0) + 'px'
|
|
70
|
+
// return ('-' + size || 0) + 'px'
|
|
71
|
+
// }
|
|
73
72
|
|
|
74
73
|
var InternalDrawer = function InternalDrawer(props, ref) {
|
|
75
|
-
var _classNames, _context2, _classNames2;
|
|
74
|
+
var _classNames, _context2, _context3, _classNames2;
|
|
76
75
|
|
|
77
76
|
var _useContext = (0, _react.useContext)(_ConfigContext.default),
|
|
78
77
|
getPrefixCls = _useContext.getPrefixCls,
|
|
@@ -100,6 +99,7 @@ var InternalDrawer = function InternalDrawer(props, ref) {
|
|
|
100
99
|
footerClassName = drawerProps.footerClassName,
|
|
101
100
|
visible = drawerProps.visible,
|
|
102
101
|
width = drawerProps.width,
|
|
102
|
+
height = drawerProps.height,
|
|
103
103
|
headerStyle = drawerProps.headerStyle,
|
|
104
104
|
headerClassName = drawerProps.headerClassName,
|
|
105
105
|
zindex = drawerProps.zIndex,
|
|
@@ -122,6 +122,7 @@ var InternalDrawer = function InternalDrawer(props, ref) {
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
var containerRef = ref || /*#__PURE__*/(0, _react.createRef)();
|
|
125
|
+
var contentRef = (0, _react.useRef)(null);
|
|
125
126
|
(0, _devwarning.default)(PlacementTypes.indexOf(placement) === -1, 'drawer', "cannot found drawer type '".concat(placement, "'"));
|
|
126
127
|
var drawerContainer = typeof getContainer === 'function' ? getContainer() : getContainer;
|
|
127
128
|
var isAtOriginalPlace = drawerContainer === false;
|
|
@@ -204,16 +205,49 @@ var InternalDrawer = function InternalDrawer(props, ref) {
|
|
|
204
205
|
closeDrawer();
|
|
205
206
|
}
|
|
206
207
|
}, [maskClosable, closeDrawer]);
|
|
208
|
+
var getHorizontalBoolAndPlacementName = (0, _react.useCallback)(function () {
|
|
209
|
+
var isHorizontal = placement === 'left' || placement === 'right';
|
|
210
|
+
var placementName = "translate".concat(isHorizontal ? 'X' : 'Y');
|
|
211
|
+
return {
|
|
212
|
+
isHorizontal: isHorizontal,
|
|
213
|
+
placementName: placementName
|
|
214
|
+
};
|
|
215
|
+
}, [placement]);
|
|
216
|
+
var setDraerTransform = (0, _react.useCallback)(function (_isOpen, _placementName, _value) {
|
|
217
|
+
if (!contentRef.current) return;
|
|
218
|
+
contentRef.current.style.transform = '';
|
|
219
|
+
}, [contentRef]);
|
|
220
|
+
(0, _react.useEffect)(function () {
|
|
221
|
+
var _getHorizontalBoolAnd = getHorizontalBoolAndPlacementName(),
|
|
222
|
+
isHorizontal = _getHorizontalBoolAnd.isHorizontal,
|
|
223
|
+
placementName = _getHorizontalBoolAnd.placementName;
|
|
224
|
+
|
|
225
|
+
var contentValue = contentRef.current ? contentRef.current.getBoundingClientRect()[isHorizontal ? 'width' : 'height'] : 0;
|
|
226
|
+
var value = (isHorizontal ? width : height) || contentValue;
|
|
227
|
+
|
|
228
|
+
if (visible) {
|
|
229
|
+
setDraerTransform(visible, placementName, value);
|
|
230
|
+
}
|
|
231
|
+
}, [contentRef, getHorizontalBoolAndPlacementName, height, setDraerTransform, visible, width]);
|
|
207
232
|
var drawerClasses = (0, _classnames.default)(drawerPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(drawerPrefixCls, "-hide"), !visible), (0, _defineProperty2.default)(_classNames, "".concat(drawerPrefixCls, "-active"), visible), (0, _defineProperty2.default)(_classNames, "".concat(drawerPrefixCls, "-not-at-body"), !isBody), _classNames));
|
|
208
233
|
var headerClass = "".concat(drawerPrefixCls, "-header");
|
|
234
|
+
|
|
235
|
+
var _getHorizontalBoolAnd2 = getHorizontalBoolAndPlacementName(),
|
|
236
|
+
placementName = _getHorizontalBoolAnd2.placementName;
|
|
237
|
+
|
|
238
|
+
var placementPos = placement === 'left' || placement === 'top' ? '-100%' : '100%';
|
|
239
|
+
var transform = visible ? '' : (0, _concat.default)(_context2 = "".concat(placementName, "(")).call(_context2, placementPos, ")");
|
|
209
240
|
var containerStyle = (0, _extends3.default)((0, _defineProperty2.default)({}, placement, 0), (0, _includes.default)(horizontalPlacements).call(horizontalPlacements, placement) ? {
|
|
210
|
-
width:
|
|
211
|
-
transform:
|
|
212
|
-
} : {
|
|
241
|
+
width: width,
|
|
242
|
+
transform: transform
|
|
243
|
+
} : {
|
|
244
|
+
transform: transform
|
|
245
|
+
});
|
|
213
246
|
|
|
214
247
|
var container = /*#__PURE__*/_react.default.createElement("div", {
|
|
215
|
-
className: (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(drawerPrefixCls, "-container-box"), true), (0, _defineProperty2.default)(_classNames2, "".concat(drawerPrefixCls, "-has-container-box"), drawerContainer), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(
|
|
216
|
-
style: containerStyle
|
|
248
|
+
className: (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(drawerPrefixCls, "-container-box"), true), (0, _defineProperty2.default)(_classNames2, "".concat(drawerPrefixCls, "-has-container-box"), drawerContainer), (0, _defineProperty2.default)(_classNames2, (0, _concat.default)(_context3 = "".concat(drawerPrefixCls, "-container-")).call(_context3, placement), true), _classNames2)),
|
|
249
|
+
style: containerStyle,
|
|
250
|
+
ref: contentRef
|
|
217
251
|
}, (title || closable) && /*#__PURE__*/_react.default.createElement("div", {
|
|
218
252
|
className: (0, _classnames.default)(headerClass, headerClassName),
|
|
219
253
|
style: headerStyle
|
package/lib/radio/radio.js
CHANGED
|
@@ -129,7 +129,9 @@ var InternalRadio = function InternalRadio(props, ref) {
|
|
|
129
129
|
}, /*#__PURE__*/React.createElement("input", (0, _extends2.default)({
|
|
130
130
|
type: "radio",
|
|
131
131
|
className: "".concat(radioPrefixCls, "-input")
|
|
132
|
-
}, radioProps)), children !== undefined ? /*#__PURE__*/React.createElement("span",
|
|
132
|
+
}, radioProps)), children !== undefined ? /*#__PURE__*/React.createElement("span", {
|
|
133
|
+
className: "".concat(radioPrefixCls, "-text")
|
|
134
|
+
}, children) : null)
|
|
133
135
|
);
|
|
134
136
|
};
|
|
135
137
|
|