@douyinfe/semi-ui 2.55.4 → 2.56.0-beta.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/dist/css/semi.css +38 -9
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +90 -36
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_base/base.css +5 -7
- package/lib/cjs/autoComplete/index.js +2 -1
- package/lib/cjs/backtop/index.d.ts +1 -0
- package/lib/cjs/backtop/index.js +4 -1
- package/lib/cjs/calendar/monthCalendar.js +3 -1
- package/lib/cjs/cascader/index.js +9 -4
- package/lib/cjs/datePicker/datePicker.js +5 -9
- package/lib/cjs/select/index.js +3 -3
- package/lib/cjs/tagInput/index.js +2 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -0
- package/lib/cjs/timePicker/TimePicker.js +8 -8
- package/lib/cjs/tooltip/index.js +4 -1
- package/lib/cjs/tree/treeNode.js +2 -1
- package/lib/cjs/treeSelect/index.js +2 -1
- package/lib/es/_base/base.css +5 -7
- package/lib/es/autoComplete/index.js +2 -1
- package/lib/es/backtop/index.d.ts +1 -0
- package/lib/es/backtop/index.js +4 -1
- package/lib/es/calendar/monthCalendar.js +3 -1
- package/lib/es/cascader/index.js +9 -4
- package/lib/es/datePicker/datePicker.js +5 -9
- package/lib/es/select/index.js +3 -3
- package/lib/es/tagInput/index.js +2 -1
- package/lib/es/timePicker/TimePicker.d.ts +1 -0
- package/lib/es/timePicker/TimePicker.js +8 -8
- package/lib/es/tooltip/index.js +4 -1
- package/lib/es/tree/treeNode.js +2 -1
- package/lib/es/treeSelect/index.js +2 -1
- package/package.json +8 -8
package/lib/cjs/_base/base.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* shadow */
|
|
2
2
|
/* sizing */
|
|
3
3
|
/* spacing */
|
|
4
|
-
body {
|
|
4
|
+
body, :host {
|
|
5
5
|
--semi-transition_duration-slowest:0ms;
|
|
6
6
|
--semi-transition_duration-slower:0ms;
|
|
7
7
|
--semi-transition_duration-slow:0ms;
|
|
@@ -38,8 +38,7 @@ body {
|
|
|
38
38
|
--semi-transform_rotate-anticlockwise360deg:rotate(-360deg);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
body,
|
|
42
|
-
body .semi-always-light {
|
|
41
|
+
body, body .semi-always-light, :host, :host .semi-always-light {
|
|
43
42
|
--semi-amber-0: 254,251,235;
|
|
44
43
|
--semi-amber-1: 252,245,206;
|
|
45
44
|
--semi-amber-2: 249,232,158;
|
|
@@ -204,8 +203,7 @@ body .semi-always-light {
|
|
|
204
203
|
--semi-yellow-9: 83,72,0;
|
|
205
204
|
}
|
|
206
205
|
|
|
207
|
-
body[theme-mode=dark],
|
|
208
|
-
body .semi-always-dark {
|
|
206
|
+
body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
|
|
209
207
|
--semi-red-0: 108,9,11;
|
|
210
208
|
--semi-red-1: 144,17,16;
|
|
211
209
|
--semi-red-2: 180,32,25;
|
|
@@ -370,7 +368,7 @@ body .semi-always-dark {
|
|
|
370
368
|
--semi-black: 0, 0, 0;
|
|
371
369
|
}
|
|
372
370
|
|
|
373
|
-
body, body[theme-mode=dark] .semi-always-light {
|
|
371
|
+
body, body[theme-mode=dark] .semi-always-light, :host, :host .semi-always-light {
|
|
374
372
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
375
373
|
-webkit-font-smoothing: antialiased;
|
|
376
374
|
--semi-color-white: rgba(var(--semi-white), 1);
|
|
@@ -480,7 +478,7 @@ body, body[theme-mode=dark] .semi-always-light {
|
|
|
480
478
|
--semi-color-data-19: rgba(188, 198, 255, 1);
|
|
481
479
|
}
|
|
482
480
|
|
|
483
|
-
body[theme-mode=dark], body .semi-always-dark {
|
|
481
|
+
body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
|
|
484
482
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
485
483
|
-webkit-font-smoothing: antialiased;
|
|
486
484
|
--semi-color-white: rgba(228, 231, 245, 1);
|
|
@@ -154,7 +154,8 @@ class AutoComplete extends _baseComponent.default {
|
|
|
154
154
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
155
155
|
const optionsDom = _reactDom.default.findDOMNode(optionInstance);
|
|
156
156
|
const target = e.target;
|
|
157
|
-
|
|
157
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
158
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
158
159
|
cb(e);
|
|
159
160
|
}
|
|
160
161
|
};
|
|
@@ -26,6 +26,7 @@ export default class BackTop extends BaseComponent<BackTopProps, BackTopState> {
|
|
|
26
26
|
style: PropTypes.Requireable<object>;
|
|
27
27
|
className: PropTypes.Requireable<string>;
|
|
28
28
|
};
|
|
29
|
+
handler: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
29
30
|
constructor(props: BackTopProps);
|
|
30
31
|
componentDidMount(): void;
|
|
31
32
|
componentWillUnmount(): void;
|
package/lib/cjs/backtop/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
9
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -34,7 +35,9 @@ class BackTop extends _baseComponent.default {
|
|
|
34
35
|
this.foundation = new _foundation.default(this.adapter);
|
|
35
36
|
}
|
|
36
37
|
componentDidMount() {
|
|
38
|
+
var _a;
|
|
37
39
|
this.foundation.init();
|
|
40
|
+
this.handler = (0, _throttle2.default)(this.handleClick, (_a = this.props.duration) !== null && _a !== void 0 ? _a : BackTop.defaultProps.duration);
|
|
38
41
|
}
|
|
39
42
|
componentWillUnmount() {
|
|
40
43
|
this.foundation.destroy();
|
|
@@ -92,7 +95,7 @@ class BackTop extends _baseComponent.default {
|
|
|
92
95
|
_react.default.createElement("div", Object.assign({}, others, {
|
|
93
96
|
className: preCls,
|
|
94
97
|
style: style,
|
|
95
|
-
onClick: e => this.
|
|
98
|
+
onClick: e => this.handler(e),
|
|
96
99
|
"x-semi-prop": "children"
|
|
97
100
|
}), backtopBtn) : null;
|
|
98
101
|
return content;
|
|
@@ -287,7 +287,9 @@ class monthCalendar extends _baseComponent.default {
|
|
|
287
287
|
const clickOutsideHandler = e => {
|
|
288
288
|
const cardInstance = this.cardRef && this.cardRef.get(key);
|
|
289
289
|
const cardDom = _reactDom.default.findDOMNode(cardInstance);
|
|
290
|
-
|
|
290
|
+
const target = e.target;
|
|
291
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
292
|
+
if (cardDom && !cardDom.contains(target) && !path.includes(cardDom)) {
|
|
291
293
|
cb();
|
|
292
294
|
}
|
|
293
295
|
};
|
|
@@ -67,10 +67,10 @@ class Cascader extends _baseComponent.default {
|
|
|
67
67
|
displayRender,
|
|
68
68
|
disableStrictly
|
|
69
69
|
} = this.props;
|
|
70
|
-
const isDsiabled = disabled || keyEntities[nodeKey].data.disabled || disableStrictly && disabledKeys.has(nodeKey);
|
|
71
70
|
if (keyEntities[nodeKey]) {
|
|
71
|
+
const isDisabled = disabled || keyEntities[nodeKey].data.disabled || disableStrictly && disabledKeys.has(nodeKey);
|
|
72
72
|
const tagCls = (0, _classnames.default)(`${prefixcls}-selection-tag`, {
|
|
73
|
-
[`${prefixcls}-selection-tag-disabled`]:
|
|
73
|
+
[`${prefixcls}-selection-tag-disabled`]: isDisabled
|
|
74
74
|
});
|
|
75
75
|
// custom render tags
|
|
76
76
|
if ((0, _isFunction2.default)(displayRender)) {
|
|
@@ -570,7 +570,8 @@ class Cascader extends _baseComponent.default {
|
|
|
570
570
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
571
571
|
const optionsDom = _reactDom.default.findDOMNode(optionInstance);
|
|
572
572
|
const target = e.target;
|
|
573
|
-
|
|
573
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
574
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
574
575
|
cb(e);
|
|
575
576
|
}
|
|
576
577
|
};
|
|
@@ -733,7 +734,11 @@ class Cascader extends _baseComponent.default {
|
|
|
733
734
|
formatItem.length > 0 && formatValuePath.push(formatItem);
|
|
734
735
|
});
|
|
735
736
|
// formatKeys is used to save key of value
|
|
736
|
-
const formatKeys = formatValuePath.
|
|
737
|
+
const formatKeys = formatValuePath.reduce((acc, cur) => {
|
|
738
|
+
const key = (0, _util.getKeyByValuePath)(cur);
|
|
739
|
+
keyEntities[key] && acc.push(key);
|
|
740
|
+
return acc;
|
|
741
|
+
}, []);
|
|
737
742
|
return formatKeys;
|
|
738
743
|
};
|
|
739
744
|
const needUpdateTreeData = needUpdate('treeData') || needUpdateData();
|
|
@@ -274,15 +274,11 @@ class DatePicker extends _baseComponent.default {
|
|
|
274
274
|
this.clickOutSideHandler = e => {
|
|
275
275
|
const triggerEl = this.triggerElRef && this.triggerElRef.current;
|
|
276
276
|
const panelEl = this.panelRef && this.panelRef.current;
|
|
277
|
-
const
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return;
|
|
283
|
-
} else {
|
|
284
|
-
if (clickOutSide) {
|
|
285
|
-
this.props.onClickOutSide();
|
|
277
|
+
const target = e.target;
|
|
278
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
279
|
+
if (!(triggerEl && triggerEl.contains(target)) && !(panelEl && panelEl.contains(target)) && !(path.includes(triggerEl) || path.includes(panelEl))) {
|
|
280
|
+
this.props.onClickOutSide();
|
|
281
|
+
if (!this.adapter.needConfirm()) {
|
|
286
282
|
this.foundation.closePanel(e);
|
|
287
283
|
}
|
|
288
284
|
}
|
package/lib/cjs/select/index.js
CHANGED
|
@@ -196,9 +196,9 @@ class Select extends _baseComponent.default {
|
|
|
196
196
|
const optionInstance = this.optionsRef && this.optionsRef.current;
|
|
197
197
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
198
198
|
const optionsDom = _reactDom.default.findDOMNode(optionInstance);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (optionsDom &&
|
|
199
|
+
const target = e.target;
|
|
200
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
201
|
+
if (!(optionsDom && optionsDom.contains(target)) && !(triggerDom && triggerDom.contains(target)) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
202
202
|
cb(e);
|
|
203
203
|
}
|
|
204
204
|
};
|
|
@@ -270,7 +270,8 @@ class TagInput extends _baseComponent.default {
|
|
|
270
270
|
const clickOutsideHandler = e => {
|
|
271
271
|
const tagInputDom = this.tagInputRef && this.tagInputRef.current;
|
|
272
272
|
const target = e.target;
|
|
273
|
-
|
|
273
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
274
|
+
if (tagInputDom && !tagInputDom.contains(target) && !path.includes(tagInputDom)) {
|
|
274
275
|
cb(e);
|
|
275
276
|
}
|
|
276
277
|
};
|
|
@@ -193,6 +193,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
193
193
|
foundation: TimePickerFoundation;
|
|
194
194
|
timePickerRef: React.MutableRefObject<HTMLDivElement>;
|
|
195
195
|
savePanelRef: React.RefObject<HTMLDivElement>;
|
|
196
|
+
useCustomTrigger: boolean;
|
|
196
197
|
clickOutSideHandler: (e: MouseEvent) => void;
|
|
197
198
|
constructor(props: TimePickerProps);
|
|
198
199
|
get adapter(): TimePickerAdapter<TimePickerProps, TimePickerState>;
|
|
@@ -92,6 +92,7 @@ class TimePicker extends _baseComponent.default {
|
|
|
92
92
|
this.foundation = new _foundation.default(this.adapter);
|
|
93
93
|
this.timePickerRef = /*#__PURE__*/_react.default.createRef();
|
|
94
94
|
this.savePanelRef = /*#__PURE__*/_react.default.createRef();
|
|
95
|
+
this.useCustomTrigger = typeof this.props.triggerRender === 'function';
|
|
95
96
|
}
|
|
96
97
|
get adapter() {
|
|
97
98
|
var _this2 = this;
|
|
@@ -107,11 +108,11 @@ class TimePicker extends _baseComponent.default {
|
|
|
107
108
|
}
|
|
108
109
|
this.clickOutSideHandler = e => {
|
|
109
110
|
const panel = this.savePanelRef && this.savePanelRef.current;
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.foundation.handlePanelClose(
|
|
111
|
+
const trigger = this.timePickerRef && this.timePickerRef.current;
|
|
112
|
+
const target = e.target;
|
|
113
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
114
|
+
if (!(panel && panel.contains(target)) && !(trigger && trigger.contains(target)) && !(path.includes(trigger) || path.includes(panel))) {
|
|
115
|
+
this.foundation.handlePanelClose(true, e);
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
document.addEventListener('mousedown', this.clickOutSideHandler);
|
|
@@ -275,7 +276,6 @@ class TimePicker extends _baseComponent.default {
|
|
|
275
276
|
rest = __rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "dropdownMargin", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "onChangeWithDateFirst", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow", "stopPropagation"]);
|
|
276
277
|
const format = this.foundation.getDefaultFormatIfNeed();
|
|
277
278
|
const position = this.foundation.getPosition();
|
|
278
|
-
const useCustomTrigger = typeof triggerRender === 'function';
|
|
279
279
|
const {
|
|
280
280
|
open,
|
|
281
281
|
inputValue,
|
|
@@ -309,7 +309,7 @@ class TimePicker extends _baseComponent.default {
|
|
|
309
309
|
onBlur: this.handleBlur
|
|
310
310
|
});
|
|
311
311
|
const outerProps = {};
|
|
312
|
-
if (useCustomTrigger) {
|
|
312
|
+
if (this.useCustomTrigger) {
|
|
313
313
|
outerProps.onClick = this.openPanel;
|
|
314
314
|
}
|
|
315
315
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
@@ -332,7 +332,7 @@ class TimePicker extends _baseComponent.default {
|
|
|
332
332
|
margin: dropdownMargin,
|
|
333
333
|
autoAdjustOverflow: autoAdjustOverflow,
|
|
334
334
|
stopPropagation: stopPropagation
|
|
335
|
-
}, useCustomTrigger ? /*#__PURE__*/_react.default.createElement(_trigger.default, {
|
|
335
|
+
}, this.useCustomTrigger ? /*#__PURE__*/_react.default.createElement(_trigger.default, {
|
|
336
336
|
triggerRender: triggerRender,
|
|
337
337
|
disabled: disabled,
|
|
338
338
|
value: value,
|
package/lib/cjs/tooltip/index.js
CHANGED
|
@@ -432,7 +432,10 @@ class Tooltip extends _baseComponent.default {
|
|
|
432
432
|
let popupEl = this.containerEl && this.containerEl.current;
|
|
433
433
|
el = _reactDom.default.findDOMNode(el);
|
|
434
434
|
popupEl = _reactDom.default.findDOMNode(popupEl);
|
|
435
|
-
|
|
435
|
+
const target = e.target;
|
|
436
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
437
|
+
const isClickTriggerToHide = this.props.clickTriggerToHide ? el && el.contains(target) || path.includes(el) : false;
|
|
438
|
+
if (el && !el.contains(target) && popupEl && !popupEl.contains(target) && !(path.includes(popupEl) || path.includes(el)) || isClickTriggerToHide) {
|
|
436
439
|
this.props.onClickOutSide(e);
|
|
437
440
|
cb();
|
|
438
441
|
}
|
package/lib/cjs/tree/treeNode.js
CHANGED
|
@@ -50,6 +50,7 @@ class TreeNode extends _react.PureComponent {
|
|
|
50
50
|
onNodeExpand(e, this.props);
|
|
51
51
|
};
|
|
52
52
|
this.onCheck = e => {
|
|
53
|
+
var _a, _b;
|
|
53
54
|
if (this.isDisabled()) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
@@ -57,7 +58,7 @@ class TreeNode extends _react.PureComponent {
|
|
|
57
58
|
onNodeCheck
|
|
58
59
|
} = this.context;
|
|
59
60
|
e.stopPropagation();
|
|
60
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
61
|
+
(_b = (_a = e.nativeEvent) === null || _a === void 0 ? void 0 : _a.stopImmediatePropagation) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
61
62
|
onNodeCheck(e, this.props);
|
|
62
63
|
};
|
|
63
64
|
/**
|
|
@@ -1114,7 +1114,8 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1114
1114
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
1115
1115
|
const optionsDom = _reactDom.default.findDOMNode(optionInstance);
|
|
1116
1116
|
const target = e.target;
|
|
1117
|
-
|
|
1117
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
1118
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
1118
1119
|
cb(e);
|
|
1119
1120
|
}
|
|
1120
1121
|
};
|
package/lib/es/_base/base.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* shadow */
|
|
2
2
|
/* sizing */
|
|
3
3
|
/* spacing */
|
|
4
|
-
body {
|
|
4
|
+
body, :host {
|
|
5
5
|
--semi-transition_duration-slowest:0ms;
|
|
6
6
|
--semi-transition_duration-slower:0ms;
|
|
7
7
|
--semi-transition_duration-slow:0ms;
|
|
@@ -38,8 +38,7 @@ body {
|
|
|
38
38
|
--semi-transform_rotate-anticlockwise360deg:rotate(-360deg);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
body,
|
|
42
|
-
body .semi-always-light {
|
|
41
|
+
body, body .semi-always-light, :host, :host .semi-always-light {
|
|
43
42
|
--semi-amber-0: 254,251,235;
|
|
44
43
|
--semi-amber-1: 252,245,206;
|
|
45
44
|
--semi-amber-2: 249,232,158;
|
|
@@ -204,8 +203,7 @@ body .semi-always-light {
|
|
|
204
203
|
--semi-yellow-9: 83,72,0;
|
|
205
204
|
}
|
|
206
205
|
|
|
207
|
-
body[theme-mode=dark],
|
|
208
|
-
body .semi-always-dark {
|
|
206
|
+
body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
|
|
209
207
|
--semi-red-0: 108,9,11;
|
|
210
208
|
--semi-red-1: 144,17,16;
|
|
211
209
|
--semi-red-2: 180,32,25;
|
|
@@ -370,7 +368,7 @@ body .semi-always-dark {
|
|
|
370
368
|
--semi-black: 0, 0, 0;
|
|
371
369
|
}
|
|
372
370
|
|
|
373
|
-
body, body[theme-mode=dark] .semi-always-light {
|
|
371
|
+
body, body[theme-mode=dark] .semi-always-light, :host, :host .semi-always-light {
|
|
374
372
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
375
373
|
-webkit-font-smoothing: antialiased;
|
|
376
374
|
--semi-color-white: rgba(var(--semi-white), 1);
|
|
@@ -480,7 +478,7 @@ body, body[theme-mode=dark] .semi-always-light {
|
|
|
480
478
|
--semi-color-data-19: rgba(188, 198, 255, 1);
|
|
481
479
|
}
|
|
482
480
|
|
|
483
|
-
body[theme-mode=dark], body .semi-always-dark {
|
|
481
|
+
body[theme-mode=dark], body .semi-always-dark, :host-context(body[theme-mode=dark]), :host .semi-always-dark {
|
|
484
482
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
485
483
|
-webkit-font-smoothing: antialiased;
|
|
486
484
|
--semi-color-white: rgba(228, 231, 245, 1);
|
|
@@ -147,7 +147,8 @@ class AutoComplete extends BaseComponent {
|
|
|
147
147
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
148
148
|
const optionsDom = ReactDOM.findDOMNode(optionInstance);
|
|
149
149
|
const target = e.target;
|
|
150
|
-
|
|
150
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
151
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
151
152
|
cb(e);
|
|
152
153
|
}
|
|
153
154
|
};
|
|
@@ -26,6 +26,7 @@ export default class BackTop extends BaseComponent<BackTopProps, BackTopState> {
|
|
|
26
26
|
style: PropTypes.Requireable<object>;
|
|
27
27
|
className: PropTypes.Requireable<string>;
|
|
28
28
|
};
|
|
29
|
+
handler: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
29
30
|
constructor(props: BackTopProps);
|
|
30
31
|
componentDidMount(): void;
|
|
31
32
|
componentWillUnmount(): void;
|
package/lib/es/backtop/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _throttle from "lodash/throttle";
|
|
1
2
|
var __rest = this && this.__rest || function (s, e) {
|
|
2
3
|
var t = {};
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -27,7 +28,9 @@ export default class BackTop extends BaseComponent {
|
|
|
27
28
|
this.foundation = new BackTopFoundation(this.adapter);
|
|
28
29
|
}
|
|
29
30
|
componentDidMount() {
|
|
31
|
+
var _a;
|
|
30
32
|
this.foundation.init();
|
|
33
|
+
this.handler = _throttle(this.handleClick, (_a = this.props.duration) !== null && _a !== void 0 ? _a : BackTop.defaultProps.duration);
|
|
31
34
|
}
|
|
32
35
|
componentWillUnmount() {
|
|
33
36
|
this.foundation.destroy();
|
|
@@ -85,7 +88,7 @@ export default class BackTop extends BaseComponent {
|
|
|
85
88
|
React.createElement("div", Object.assign({}, others, {
|
|
86
89
|
className: preCls,
|
|
87
90
|
style: style,
|
|
88
|
-
onClick: e => this.
|
|
91
|
+
onClick: e => this.handler(e),
|
|
89
92
|
"x-semi-prop": "children"
|
|
90
93
|
}), backtopBtn) : null;
|
|
91
94
|
return content;
|
|
@@ -279,7 +279,9 @@ export default class monthCalendar extends BaseComponent {
|
|
|
279
279
|
const clickOutsideHandler = e => {
|
|
280
280
|
const cardInstance = this.cardRef && this.cardRef.get(key);
|
|
281
281
|
const cardDom = ReactDOM.findDOMNode(cardInstance);
|
|
282
|
-
|
|
282
|
+
const target = e.target;
|
|
283
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
284
|
+
if (cardDom && !cardDom.contains(target) && !path.includes(cardDom)) {
|
|
283
285
|
cb();
|
|
284
286
|
}
|
|
285
287
|
};
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -58,10 +58,10 @@ class Cascader extends BaseComponent {
|
|
|
58
58
|
displayRender,
|
|
59
59
|
disableStrictly
|
|
60
60
|
} = this.props;
|
|
61
|
-
const isDsiabled = disabled || keyEntities[nodeKey].data.disabled || disableStrictly && disabledKeys.has(nodeKey);
|
|
62
61
|
if (keyEntities[nodeKey]) {
|
|
62
|
+
const isDisabled = disabled || keyEntities[nodeKey].data.disabled || disableStrictly && disabledKeys.has(nodeKey);
|
|
63
63
|
const tagCls = cls(`${prefixcls}-selection-tag`, {
|
|
64
|
-
[`${prefixcls}-selection-tag-disabled`]:
|
|
64
|
+
[`${prefixcls}-selection-tag-disabled`]: isDisabled
|
|
65
65
|
});
|
|
66
66
|
// custom render tags
|
|
67
67
|
if (_isFunction(displayRender)) {
|
|
@@ -561,7 +561,8 @@ class Cascader extends BaseComponent {
|
|
|
561
561
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
562
562
|
const optionsDom = ReactDOM.findDOMNode(optionInstance);
|
|
563
563
|
const target = e.target;
|
|
564
|
-
|
|
564
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
565
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
565
566
|
cb(e);
|
|
566
567
|
}
|
|
567
568
|
};
|
|
@@ -724,7 +725,11 @@ class Cascader extends BaseComponent {
|
|
|
724
725
|
formatItem.length > 0 && formatValuePath.push(formatItem);
|
|
725
726
|
});
|
|
726
727
|
// formatKeys is used to save key of value
|
|
727
|
-
const formatKeys = formatValuePath.
|
|
728
|
+
const formatKeys = formatValuePath.reduce((acc, cur) => {
|
|
729
|
+
const key = getKeyByValuePath(cur);
|
|
730
|
+
keyEntities[key] && acc.push(key);
|
|
731
|
+
return acc;
|
|
732
|
+
}, []);
|
|
728
733
|
return formatKeys;
|
|
729
734
|
};
|
|
730
735
|
const needUpdateTreeData = needUpdate('treeData') || needUpdateData();
|
|
@@ -266,15 +266,11 @@ export default class DatePicker extends BaseComponent {
|
|
|
266
266
|
this.clickOutSideHandler = e => {
|
|
267
267
|
const triggerEl = this.triggerElRef && this.triggerElRef.current;
|
|
268
268
|
const panelEl = this.panelRef && this.panelRef.current;
|
|
269
|
-
const
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return;
|
|
275
|
-
} else {
|
|
276
|
-
if (clickOutSide) {
|
|
277
|
-
this.props.onClickOutSide();
|
|
269
|
+
const target = e.target;
|
|
270
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
271
|
+
if (!(triggerEl && triggerEl.contains(target)) && !(panelEl && panelEl.contains(target)) && !(path.includes(triggerEl) || path.includes(panelEl))) {
|
|
272
|
+
this.props.onClickOutSide();
|
|
273
|
+
if (!this.adapter.needConfirm()) {
|
|
278
274
|
this.foundation.closePanel(e);
|
|
279
275
|
}
|
|
280
276
|
}
|
package/lib/es/select/index.js
CHANGED
|
@@ -187,9 +187,9 @@ class Select extends BaseComponent {
|
|
|
187
187
|
const optionInstance = this.optionsRef && this.optionsRef.current;
|
|
188
188
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
189
189
|
const optionsDom = ReactDOM.findDOMNode(optionInstance);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (optionsDom &&
|
|
190
|
+
const target = e.target;
|
|
191
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
192
|
+
if (!(optionsDom && optionsDom.contains(target)) && !(triggerDom && triggerDom.contains(target)) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
193
193
|
cb(e);
|
|
194
194
|
}
|
|
195
195
|
};
|
package/lib/es/tagInput/index.js
CHANGED
|
@@ -263,7 +263,8 @@ class TagInput extends BaseComponent {
|
|
|
263
263
|
const clickOutsideHandler = e => {
|
|
264
264
|
const tagInputDom = this.tagInputRef && this.tagInputRef.current;
|
|
265
265
|
const target = e.target;
|
|
266
|
-
|
|
266
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
267
|
+
if (tagInputDom && !tagInputDom.contains(target) && !path.includes(tagInputDom)) {
|
|
267
268
|
cb(e);
|
|
268
269
|
}
|
|
269
270
|
};
|
|
@@ -193,6 +193,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
193
193
|
foundation: TimePickerFoundation;
|
|
194
194
|
timePickerRef: React.MutableRefObject<HTMLDivElement>;
|
|
195
195
|
savePanelRef: React.RefObject<HTMLDivElement>;
|
|
196
|
+
useCustomTrigger: boolean;
|
|
196
197
|
clickOutSideHandler: (e: MouseEvent) => void;
|
|
197
198
|
constructor(props: TimePickerProps);
|
|
198
199
|
get adapter(): TimePickerAdapter<TimePickerProps, TimePickerState>;
|
|
@@ -85,6 +85,7 @@ export default class TimePicker extends BaseComponent {
|
|
|
85
85
|
this.foundation = new TimePickerFoundation(this.adapter);
|
|
86
86
|
this.timePickerRef = /*#__PURE__*/React.createRef();
|
|
87
87
|
this.savePanelRef = /*#__PURE__*/React.createRef();
|
|
88
|
+
this.useCustomTrigger = typeof this.props.triggerRender === 'function';
|
|
88
89
|
}
|
|
89
90
|
get adapter() {
|
|
90
91
|
var _this2 = this;
|
|
@@ -100,11 +101,11 @@ export default class TimePicker extends BaseComponent {
|
|
|
100
101
|
}
|
|
101
102
|
this.clickOutSideHandler = e => {
|
|
102
103
|
const panel = this.savePanelRef && this.savePanelRef.current;
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.foundation.handlePanelClose(
|
|
104
|
+
const trigger = this.timePickerRef && this.timePickerRef.current;
|
|
105
|
+
const target = e.target;
|
|
106
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
107
|
+
if (!(panel && panel.contains(target)) && !(trigger && trigger.contains(target)) && !(path.includes(trigger) || path.includes(panel))) {
|
|
108
|
+
this.foundation.handlePanelClose(true, e);
|
|
108
109
|
}
|
|
109
110
|
};
|
|
110
111
|
document.addEventListener('mousedown', this.clickOutSideHandler);
|
|
@@ -268,7 +269,6 @@ export default class TimePicker extends BaseComponent {
|
|
|
268
269
|
rest = __rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "dropdownMargin", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "onChangeWithDateFirst", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow", "stopPropagation"]);
|
|
269
270
|
const format = this.foundation.getDefaultFormatIfNeed();
|
|
270
271
|
const position = this.foundation.getPosition();
|
|
271
|
-
const useCustomTrigger = typeof triggerRender === 'function';
|
|
272
272
|
const {
|
|
273
273
|
open,
|
|
274
274
|
inputValue,
|
|
@@ -302,7 +302,7 @@ export default class TimePicker extends BaseComponent {
|
|
|
302
302
|
onBlur: this.handleBlur
|
|
303
303
|
});
|
|
304
304
|
const outerProps = {};
|
|
305
|
-
if (useCustomTrigger) {
|
|
305
|
+
if (this.useCustomTrigger) {
|
|
306
306
|
outerProps.onClick = this.openPanel;
|
|
307
307
|
}
|
|
308
308
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
@@ -325,7 +325,7 @@ export default class TimePicker extends BaseComponent {
|
|
|
325
325
|
margin: dropdownMargin,
|
|
326
326
|
autoAdjustOverflow: autoAdjustOverflow,
|
|
327
327
|
stopPropagation: stopPropagation
|
|
328
|
-
}, useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
|
|
328
|
+
}, this.useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
|
|
329
329
|
triggerRender: triggerRender,
|
|
330
330
|
disabled: disabled,
|
|
331
331
|
value: value,
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -423,7 +423,10 @@ export default class Tooltip extends BaseComponent {
|
|
|
423
423
|
let popupEl = this.containerEl && this.containerEl.current;
|
|
424
424
|
el = ReactDOM.findDOMNode(el);
|
|
425
425
|
popupEl = ReactDOM.findDOMNode(popupEl);
|
|
426
|
-
|
|
426
|
+
const target = e.target;
|
|
427
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
428
|
+
const isClickTriggerToHide = this.props.clickTriggerToHide ? el && el.contains(target) || path.includes(el) : false;
|
|
429
|
+
if (el && !el.contains(target) && popupEl && !popupEl.contains(target) && !(path.includes(popupEl) || path.includes(el)) || isClickTriggerToHide) {
|
|
427
430
|
this.props.onClickOutSide(e);
|
|
428
431
|
cb();
|
|
429
432
|
}
|
package/lib/es/tree/treeNode.js
CHANGED
|
@@ -41,6 +41,7 @@ export default class TreeNode extends PureComponent {
|
|
|
41
41
|
onNodeExpand(e, this.props);
|
|
42
42
|
};
|
|
43
43
|
this.onCheck = e => {
|
|
44
|
+
var _a, _b;
|
|
44
45
|
if (this.isDisabled()) {
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
@@ -48,7 +49,7 @@ export default class TreeNode extends PureComponent {
|
|
|
48
49
|
onNodeCheck
|
|
49
50
|
} = this.context;
|
|
50
51
|
e.stopPropagation();
|
|
51
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
52
|
+
(_b = (_a = e.nativeEvent) === null || _a === void 0 ? void 0 : _a.stopImmediatePropagation) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52
53
|
onNodeCheck(e, this.props);
|
|
53
54
|
};
|
|
54
55
|
/**
|
|
@@ -1105,7 +1105,8 @@ class TreeSelect extends BaseComponent {
|
|
|
1105
1105
|
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
1106
1106
|
const optionsDom = ReactDOM.findDOMNode(optionInstance);
|
|
1107
1107
|
const target = e.target;
|
|
1108
|
-
|
|
1108
|
+
const path = e.composedPath && e.composedPath() || [target];
|
|
1109
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target) && !(path.includes(triggerDom) || path.includes(optionsDom))) {
|
|
1109
1110
|
cb(e);
|
|
1110
1111
|
}
|
|
1111
1112
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.56.0-beta.0",
|
|
4
4
|
"description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"@dnd-kit/core": "^6.0.8",
|
|
21
21
|
"@dnd-kit/sortable": "^7.0.2",
|
|
22
22
|
"@dnd-kit/utilities": "^3.2.1",
|
|
23
|
-
"@douyinfe/semi-animation": "2.
|
|
24
|
-
"@douyinfe/semi-animation-react": "2.
|
|
25
|
-
"@douyinfe/semi-foundation": "2.
|
|
26
|
-
"@douyinfe/semi-icons": "2.
|
|
27
|
-
"@douyinfe/semi-illustrations": "2.
|
|
28
|
-
"@douyinfe/semi-theme-default": "2.
|
|
23
|
+
"@douyinfe/semi-animation": "2.56.0-beta.0",
|
|
24
|
+
"@douyinfe/semi-animation-react": "2.56.0-beta.0",
|
|
25
|
+
"@douyinfe/semi-foundation": "2.56.0-beta.0",
|
|
26
|
+
"@douyinfe/semi-icons": "2.56.0-beta.0",
|
|
27
|
+
"@douyinfe/semi-illustrations": "2.56.0-beta.0",
|
|
28
|
+
"@douyinfe/semi-theme-default": "2.56.0-beta.0",
|
|
29
29
|
"async-validator": "^3.5.0",
|
|
30
30
|
"classnames": "^2.2.6",
|
|
31
31
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
],
|
|
76
76
|
"author": "",
|
|
77
77
|
"license": "MIT",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "ae4502e3075a19370e9f4ed32fbfb1292acd06c2",
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
81
|
"@babel/plugin-transform-runtime": "^7.15.8",
|