@douyinfe/semi-ui 2.2.0-beta.0 → 2.2.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/_utils/index.ts +7 -3
- package/datePicker/__test__/datePicker.test.js +126 -0
- package/datePicker/_story/datePicker.stories.js +171 -1
- package/datePicker/datePicker.tsx +5 -0
- package/datePicker/monthsGrid.tsx +2 -1
- package/dist/css/semi.css +34 -8
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +423 -324
- 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/empty/index.tsx +2 -2
- package/gulpfile.js +2 -1
- package/inputNumber/_story/inputNumber.stories.js +12 -0
- package/inputNumber/index.tsx +5 -1
- package/lib/cjs/_utils/index.js +9 -3
- package/lib/cjs/datePicker/datePicker.js +8 -2
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.js +2 -1
- package/lib/cjs/empty/index.d.ts +2 -2
- package/lib/cjs/empty/index.js +19 -18
- package/lib/cjs/inputNumber/index.d.ts +13 -12
- package/lib/cjs/inputNumber/index.js +5 -1
- package/lib/cjs/tabs/index.js +3 -7
- package/lib/cjs/transfer/index.d.ts +1 -1
- package/lib/cjs/transfer/index.js +3 -3
- package/lib/es/_utils/index.js +9 -3
- package/lib/es/datePicker/datePicker.js +8 -2
- package/lib/es/datePicker/monthsGrid.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.js +2 -1
- package/lib/es/empty/index.d.ts +2 -2
- package/lib/es/empty/index.js +19 -18
- package/lib/es/inputNumber/index.d.ts +13 -12
- package/lib/es/inputNumber/index.js +5 -1
- package/lib/es/tabs/index.js +1 -5
- package/lib/es/transfer/index.d.ts +1 -1
- package/lib/es/transfer/index.js +3 -3
- package/package.json +9 -9
- package/tabs/index.tsx +1 -1
- package/transfer/index.tsx +3 -3
package/empty/index.tsx
CHANGED
|
@@ -60,7 +60,7 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
|
|
|
60
60
|
this.observer && this.observer.disconnect();
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
observe(mutationsList: any): void {
|
|
63
|
+
observe = (mutationsList: any): void => {
|
|
64
64
|
for (const mutation of mutationsList) {
|
|
65
65
|
if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
|
|
66
66
|
this.updateMode();
|
|
@@ -68,7 +68,7 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
updateMode(): void {
|
|
71
|
+
updateMode = (): void => {
|
|
72
72
|
const val = this.body.getAttribute('theme-mode');
|
|
73
73
|
if (val !== this.state.mode) {
|
|
74
74
|
this.setState({ mode: val });
|
package/gulpfile.js
CHANGED
|
@@ -81,7 +81,8 @@ gulp.task('compileScss', function compileScss() {
|
|
|
81
81
|
realUrl = url.replace(/~@douyinfe\/semi-foundation/, semiUIPath);
|
|
82
82
|
}
|
|
83
83
|
return { url: realUrl };
|
|
84
|
-
}
|
|
84
|
+
},
|
|
85
|
+
charset: false
|
|
85
86
|
}).on('error', sass.logError))
|
|
86
87
|
.pipe(gulp.dest('lib/es'))
|
|
87
88
|
.pipe(gulp.dest('lib/cjs'));
|
|
@@ -641,3 +641,15 @@ export const FormCustomInput = () => {
|
|
|
641
641
|
FormCustomInput.story = {
|
|
642
642
|
name: 'Form.CustomInput',
|
|
643
643
|
};
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
export const FixPrecision = () => {
|
|
647
|
+
const [value, setValue] = useState(5.12);
|
|
648
|
+
const [value2, setValue2] = useState(5.12);
|
|
649
|
+
return (
|
|
650
|
+
<div>
|
|
651
|
+
<InputNumber onChange={v => setValue(v)} value={value} style={{ width: 190 }} precision={2} />
|
|
652
|
+
<InputNumber keepFocus onBlur={() => console.log('blur')} onChange={v => setValue2(v)} value={value2} style={{ width: 190 }} precision={2} />
|
|
653
|
+
</div>
|
|
654
|
+
);
|
|
655
|
+
}
|
package/inputNumber/index.tsx
CHANGED
|
@@ -225,6 +225,7 @@ class InputNumber extends BaseComponent<InputNumberProps, InputNumberState> {
|
|
|
225
225
|
currentValue!: number | string;
|
|
226
226
|
cursorBefore!: string;
|
|
227
227
|
cursorAfter!: string;
|
|
228
|
+
foundation: InputNumberFoundation;
|
|
228
229
|
constructor(props: InputNumberProps) {
|
|
229
230
|
super(props);
|
|
230
231
|
this.state = {
|
|
@@ -291,7 +292,10 @@ class InputNumber extends BaseComponent<InputNumberProps, InputNumberState> {
|
|
|
291
292
|
if (focusing) {
|
|
292
293
|
if (this.foundation.isValidNumber(parsedNum) && parsedNum !== this.state.number) {
|
|
293
294
|
const obj: { number?: number; value?: string } = { number: parsedNum };
|
|
294
|
-
|
|
295
|
+
/**
|
|
296
|
+
* If you are clicking the button, it will automatically format once
|
|
297
|
+
* We need to set the status to false after trigger focus event
|
|
298
|
+
*/
|
|
295
299
|
if (this.clickUpOrDown) {
|
|
296
300
|
obj.value = this.foundation.doFormat(valueStr, true);
|
|
297
301
|
}
|
package/lib/cjs/_utils/index.js
CHANGED
|
@@ -174,11 +174,17 @@ const registerMediaQuery = (media, _ref2) => {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
callInInit && handlerMediaChange(mediaQueryList);
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
|
|
178
|
+
if (Object.prototype.hasOwnProperty.call(mediaQueryList, 'addEventListener')) {
|
|
179
|
+
mediaQueryList.addEventListener('change', handlerMediaChange);
|
|
180
|
+
return () => mediaQueryList.removeEventListener('change', handlerMediaChange);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
mediaQueryList.addListener(handlerMediaChange);
|
|
184
|
+
return () => mediaQueryList.removeListener(handlerMediaChange);
|
|
179
185
|
}
|
|
180
186
|
|
|
181
|
-
return
|
|
187
|
+
return () => undefined;
|
|
182
188
|
};
|
|
183
189
|
/**
|
|
184
190
|
* Determine whether the incoming element is a built-in icon
|
|
@@ -278,6 +278,10 @@ class DatePicker extends _baseComponent.default {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
this.clickOutSideHandler = e => {
|
|
281
|
+
if (this.adapter.needConfirm()) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
281
285
|
const triggerEl = this.triggerElRef && this.triggerElRef.current;
|
|
282
286
|
const panelEl = this.panelRef && this.panelRef.current;
|
|
283
287
|
const isInTrigger = triggerEl && triggerEl.contains(e.target);
|
|
@@ -462,7 +466,8 @@ class DatePicker extends _baseComponent.default {
|
|
|
462
466
|
density,
|
|
463
467
|
syncSwitchMonth,
|
|
464
468
|
onPanelChange,
|
|
465
|
-
timeZone
|
|
469
|
+
timeZone,
|
|
470
|
+
triggerRender
|
|
466
471
|
} = this.props;
|
|
467
472
|
const {
|
|
468
473
|
value,
|
|
@@ -509,7 +514,8 @@ class DatePicker extends _baseComponent.default {
|
|
|
509
514
|
syncSwitchMonth: syncSwitchMonth,
|
|
510
515
|
onPanelChange: onPanelChange,
|
|
511
516
|
timeZone: timeZone,
|
|
512
|
-
focusRecordsRef: this.focusRecordsRef
|
|
517
|
+
focusRecordsRef: this.focusRecordsRef,
|
|
518
|
+
triggerRender: triggerRender
|
|
513
519
|
});
|
|
514
520
|
}
|
|
515
521
|
|
|
@@ -49,6 +49,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
49
49
|
syncSwitchMonth: PropTypes.Requireable<boolean>;
|
|
50
50
|
onPanelChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
51
|
focusRecordsRef: PropTypes.Requireable<object>;
|
|
52
|
+
triggerRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
53
|
};
|
|
53
54
|
static defaultProps: {
|
|
54
55
|
type: string;
|
|
@@ -695,7 +695,8 @@ MonthsGrid.propTypes = {
|
|
|
695
695
|
syncSwitchMonth: _propTypes.default.bool,
|
|
696
696
|
// Callback function for panel date switching
|
|
697
697
|
onPanelChange: _propTypes.default.func,
|
|
698
|
-
focusRecordsRef: _propTypes.default.object
|
|
698
|
+
focusRecordsRef: _propTypes.default.object,
|
|
699
|
+
triggerRender: _propTypes.default.func
|
|
699
700
|
};
|
|
700
701
|
MonthsGrid.defaultProps = {
|
|
701
702
|
type: 'date',
|
package/lib/cjs/empty/index.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
|
|
|
31
31
|
constructor(props: EmptyProps);
|
|
32
32
|
componentDidMount(): void;
|
|
33
33
|
componentWillUnmount(): void;
|
|
34
|
-
observe(mutationsList: any)
|
|
35
|
-
updateMode()
|
|
34
|
+
observe: (mutationsList: any) => void;
|
|
35
|
+
updateMode: () => void;
|
|
36
36
|
render(): JSX.Element;
|
|
37
37
|
}
|
|
38
38
|
export {};
|
package/lib/cjs/empty/index.js
CHANGED
|
@@ -31,6 +31,25 @@ const prefixCls = _constants.cssClasses.PREFIX;
|
|
|
31
31
|
class Empty extends _baseComponent.default {
|
|
32
32
|
constructor(props) {
|
|
33
33
|
super(props);
|
|
34
|
+
|
|
35
|
+
this.observe = mutationsList => {
|
|
36
|
+
for (const mutation of mutationsList) {
|
|
37
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
|
|
38
|
+
this.updateMode();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
this.updateMode = () => {
|
|
44
|
+
const val = this.body.getAttribute('theme-mode');
|
|
45
|
+
|
|
46
|
+
if (val !== this.state.mode) {
|
|
47
|
+
this.setState({
|
|
48
|
+
mode: val
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
34
53
|
this.state = {
|
|
35
54
|
mode: null
|
|
36
55
|
};
|
|
@@ -54,24 +73,6 @@ class Empty extends _baseComponent.default {
|
|
|
54
73
|
this.observer && this.observer.disconnect();
|
|
55
74
|
}
|
|
56
75
|
|
|
57
|
-
observe(mutationsList) {
|
|
58
|
-
for (const mutation of mutationsList) {
|
|
59
|
-
if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
|
|
60
|
-
this.updateMode();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
updateMode() {
|
|
66
|
-
const val = this.body.getAttribute('theme-mode');
|
|
67
|
-
|
|
68
|
-
if (val !== this.state.mode) {
|
|
69
|
-
this.setState({
|
|
70
|
-
mode: val
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
76
|
render() {
|
|
76
77
|
var _context;
|
|
77
78
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { InputProps } from '../input';
|
|
4
|
-
import { InputNumberAdapter } from '@douyinfe/semi-foundation/lib/cjs/inputNumber/foundation';
|
|
4
|
+
import InputNumberFoundation, { InputNumberAdapter } from '@douyinfe/semi-foundation/lib/cjs/inputNumber/foundation';
|
|
5
5
|
import BaseComponent from '../_base/baseComponent';
|
|
6
6
|
import { strings } from '@douyinfe/semi-foundation/lib/cjs/inputNumber/constants';
|
|
7
7
|
import '@douyinfe/semi-foundation/lib/cjs/inputNumber/inputNumber.css';
|
|
@@ -85,20 +85,21 @@ declare class InputNumber extends BaseComponent<InputNumberProps, InputNumberSta
|
|
|
85
85
|
currentValue: number | string;
|
|
86
86
|
cursorBefore: string;
|
|
87
87
|
cursorAfter: string;
|
|
88
|
+
foundation: InputNumberFoundation;
|
|
88
89
|
constructor(props: InputNumberProps);
|
|
89
90
|
componentDidUpdate(prevProps: InputNumberProps): void;
|
|
90
91
|
setInputRef: (node: HTMLInputElement) => void;
|
|
91
|
-
handleInputFocus: (e: React.FocusEvent<HTMLInputElement>) =>
|
|
92
|
-
handleInputChange: (value: string, event: React.ChangeEvent<HTMLInputElement>) =>
|
|
93
|
-
handleInputBlur: (e: React.FocusEvent<HTMLInputElement>) =>
|
|
94
|
-
handleInputKeyDown: (e: React.KeyboardEvent) =>
|
|
95
|
-
handleInputMouseEnter: (e: React.MouseEvent) =>
|
|
96
|
-
handleInputMouseLeave: (e: React.MouseEvent) =>
|
|
97
|
-
handleInputMouseMove: (e: React.MouseEvent) =>
|
|
98
|
-
handleUpClick: (e: React.KeyboardEvent) =>
|
|
99
|
-
handleDownClick: (e: React.KeyboardEvent) =>
|
|
100
|
-
handleMouseUp: (e: React.MouseEvent) =>
|
|
101
|
-
handleMouseLeave: (e: React.MouseEvent) =>
|
|
92
|
+
handleInputFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
93
|
+
handleInputChange: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
94
|
+
handleInputBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
95
|
+
handleInputKeyDown: (e: React.KeyboardEvent) => void;
|
|
96
|
+
handleInputMouseEnter: (e: React.MouseEvent) => void;
|
|
97
|
+
handleInputMouseLeave: (e: React.MouseEvent) => void;
|
|
98
|
+
handleInputMouseMove: (e: React.MouseEvent) => void;
|
|
99
|
+
handleUpClick: (e: React.KeyboardEvent) => void;
|
|
100
|
+
handleDownClick: (e: React.KeyboardEvent) => void;
|
|
101
|
+
handleMouseUp: (e: React.MouseEvent) => void;
|
|
102
|
+
handleMouseLeave: (e: React.MouseEvent) => void;
|
|
102
103
|
renderButtons: () => JSX.Element;
|
|
103
104
|
renderSuffix: () => React.ReactNode;
|
|
104
105
|
render(): JSX.Element;
|
|
@@ -363,7 +363,11 @@ class InputNumber extends _baseComponent.default {
|
|
|
363
363
|
if (this.foundation.isValidNumber(parsedNum) && parsedNum !== this.state.number) {
|
|
364
364
|
const obj = {
|
|
365
365
|
number: parsedNum
|
|
366
|
-
};
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* If you are clicking the button, it will automatically format once
|
|
369
|
+
* We need to set the status to false after trigger focus event
|
|
370
|
+
*/
|
|
367
371
|
|
|
368
372
|
if (this.clickUpOrDown) {
|
|
369
373
|
obj.value = this.foundation.doFormat(valueStr, true);
|
package/lib/cjs/tabs/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-s
|
|
|
10
10
|
|
|
11
11
|
var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
12
12
|
|
|
13
|
-
var _Object$
|
|
13
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
14
14
|
|
|
15
15
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
16
16
|
|
|
@@ -25,8 +25,6 @@ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
25
25
|
|
|
26
26
|
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
27
27
|
|
|
28
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
29
|
-
|
|
30
28
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
31
29
|
|
|
32
30
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
@@ -41,8 +39,6 @@ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
41
39
|
|
|
42
40
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
43
41
|
|
|
44
|
-
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
45
|
-
|
|
46
42
|
var _pick2 = _interopRequireDefault(require("lodash/pick"));
|
|
47
43
|
|
|
48
44
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
@@ -73,7 +69,7 @@ var _tabsContext = _interopRequireDefault(require("./tabs-context"));
|
|
|
73
69
|
|
|
74
70
|
var _interface = require("./interface");
|
|
75
71
|
|
|
76
|
-
_forEachInstanceProperty2(_context9 = _Object$
|
|
72
|
+
_forEachInstanceProperty2(_context9 = _Object$keys(_interface)).call(_context9, function (key) {
|
|
77
73
|
if (key === "default" || key === "__esModule") return;
|
|
78
74
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
79
75
|
if (key in exports && exports[key] === _interface[key]) return;
|
|
@@ -101,7 +97,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
101
97
|
return t;
|
|
102
98
|
};
|
|
103
99
|
|
|
104
|
-
const panePickKeys =
|
|
100
|
+
const panePickKeys = ['className', 'style', 'disabled', 'itemKey', 'tab', 'icon'];
|
|
105
101
|
|
|
106
102
|
class Tabs extends _baseComponent.default {
|
|
107
103
|
constructor(props) {
|
|
@@ -152,7 +152,7 @@ declare class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
152
152
|
renderHeader(headerConfig: HeaderConfig): JSX.Element;
|
|
153
153
|
renderLeftItem(item: ResolvedDataItem, index: number): React.ReactNode;
|
|
154
154
|
renderLeft(locale: Locale['Transfer']): React.ReactNode;
|
|
155
|
-
renderGroupTitle(group: GroupItem): JSX.Element;
|
|
155
|
+
renderGroupTitle(group: GroupItem, index: number): JSX.Element;
|
|
156
156
|
renderLeftTree(): JSX.Element;
|
|
157
157
|
renderLeftList(visibileItems: Array<ResolvedDataItem>): JSX.Element;
|
|
158
158
|
renderRightItem(item: ResolvedDataItem): React.ReactNode;
|
|
@@ -373,11 +373,11 @@ class Transfer extends _baseComponent.default {
|
|
|
373
373
|
}, inputCom, content);
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
renderGroupTitle(group) {
|
|
376
|
+
renderGroupTitle(group, index) {
|
|
377
377
|
const groupCls = (0, _classnames.default)("".concat(prefixcls, "-group-title"));
|
|
378
378
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
379
379
|
className: groupCls,
|
|
380
|
-
key:
|
|
380
|
+
key: "title-".concat(index)
|
|
381
381
|
}, group.title);
|
|
382
382
|
}
|
|
383
383
|
|
|
@@ -432,7 +432,7 @@ class Transfer extends _baseComponent.default {
|
|
|
432
432
|
// group content already insert
|
|
433
433
|
content.push(optionContent);
|
|
434
434
|
} else if (parentGroup) {
|
|
435
|
-
const groupContent = this.renderGroupTitle(parentGroup);
|
|
435
|
+
const groupContent = this.renderGroupTitle(parentGroup, index);
|
|
436
436
|
groupStatus.set(parentGroup.title, true);
|
|
437
437
|
content.push(groupContent);
|
|
438
438
|
content.push(optionContent);
|
package/lib/es/_utils/index.js
CHANGED
|
@@ -147,11 +147,17 @@ export const registerMediaQuery = (media, _ref2) => {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
callInInit && handlerMediaChange(mediaQueryList);
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
|
|
151
|
+
if (Object.prototype.hasOwnProperty.call(mediaQueryList, 'addEventListener')) {
|
|
152
|
+
mediaQueryList.addEventListener('change', handlerMediaChange);
|
|
153
|
+
return () => mediaQueryList.removeEventListener('change', handlerMediaChange);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
mediaQueryList.addListener(handlerMediaChange);
|
|
157
|
+
return () => mediaQueryList.removeListener(handlerMediaChange);
|
|
152
158
|
}
|
|
153
159
|
|
|
154
|
-
return
|
|
160
|
+
return () => undefined;
|
|
155
161
|
};
|
|
156
162
|
/**
|
|
157
163
|
* Determine whether the incoming element is a built-in icon
|
|
@@ -241,6 +241,10 @@ export default class DatePicker extends BaseComponent {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
this.clickOutSideHandler = e => {
|
|
244
|
+
if (this.adapter.needConfirm()) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
244
248
|
const triggerEl = this.triggerElRef && this.triggerElRef.current;
|
|
245
249
|
const panelEl = this.panelRef && this.panelRef.current;
|
|
246
250
|
const isInTrigger = triggerEl && triggerEl.contains(e.target);
|
|
@@ -429,7 +433,8 @@ export default class DatePicker extends BaseComponent {
|
|
|
429
433
|
density,
|
|
430
434
|
syncSwitchMonth,
|
|
431
435
|
onPanelChange,
|
|
432
|
-
timeZone
|
|
436
|
+
timeZone,
|
|
437
|
+
triggerRender
|
|
433
438
|
} = this.props;
|
|
434
439
|
const {
|
|
435
440
|
value,
|
|
@@ -476,7 +481,8 @@ export default class DatePicker extends BaseComponent {
|
|
|
476
481
|
syncSwitchMonth: syncSwitchMonth,
|
|
477
482
|
onPanelChange: onPanelChange,
|
|
478
483
|
timeZone: timeZone,
|
|
479
|
-
focusRecordsRef: this.focusRecordsRef
|
|
484
|
+
focusRecordsRef: this.focusRecordsRef,
|
|
485
|
+
triggerRender: triggerRender
|
|
480
486
|
});
|
|
481
487
|
}
|
|
482
488
|
|
|
@@ -49,6 +49,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
49
49
|
syncSwitchMonth: PropTypes.Requireable<boolean>;
|
|
50
50
|
onPanelChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
51
|
focusRecordsRef: PropTypes.Requireable<object>;
|
|
52
|
+
triggerRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
53
|
};
|
|
53
54
|
static defaultProps: {
|
|
54
55
|
type: string;
|
|
@@ -664,7 +664,8 @@ MonthsGrid.propTypes = {
|
|
|
664
664
|
syncSwitchMonth: PropTypes.bool,
|
|
665
665
|
// Callback function for panel date switching
|
|
666
666
|
onPanelChange: PropTypes.func,
|
|
667
|
-
focusRecordsRef: PropTypes.object
|
|
667
|
+
focusRecordsRef: PropTypes.object,
|
|
668
|
+
triggerRender: PropTypes.func
|
|
668
669
|
};
|
|
669
670
|
MonthsGrid.defaultProps = {
|
|
670
671
|
type: 'date',
|
package/lib/es/empty/index.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
|
|
|
31
31
|
constructor(props: EmptyProps);
|
|
32
32
|
componentDidMount(): void;
|
|
33
33
|
componentWillUnmount(): void;
|
|
34
|
-
observe(mutationsList: any)
|
|
35
|
-
updateMode()
|
|
34
|
+
observe: (mutationsList: any) => void;
|
|
35
|
+
updateMode: () => void;
|
|
36
36
|
render(): JSX.Element;
|
|
37
37
|
}
|
|
38
38
|
export {};
|
package/lib/es/empty/index.js
CHANGED
|
@@ -10,6 +10,25 @@ const prefixCls = cssClasses.PREFIX;
|
|
|
10
10
|
export default class Empty extends BaseComponent {
|
|
11
11
|
constructor(props) {
|
|
12
12
|
super(props);
|
|
13
|
+
|
|
14
|
+
this.observe = mutationsList => {
|
|
15
|
+
for (const mutation of mutationsList) {
|
|
16
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
|
|
17
|
+
this.updateMode();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
this.updateMode = () => {
|
|
23
|
+
const val = this.body.getAttribute('theme-mode');
|
|
24
|
+
|
|
25
|
+
if (val !== this.state.mode) {
|
|
26
|
+
this.setState({
|
|
27
|
+
mode: val
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
13
32
|
this.state = {
|
|
14
33
|
mode: null
|
|
15
34
|
};
|
|
@@ -33,24 +52,6 @@ export default class Empty extends BaseComponent {
|
|
|
33
52
|
this.observer && this.observer.disconnect();
|
|
34
53
|
}
|
|
35
54
|
|
|
36
|
-
observe(mutationsList) {
|
|
37
|
-
for (const mutation of mutationsList) {
|
|
38
|
-
if (mutation.type === 'attributes' && mutation.attributeName === 'theme-mode') {
|
|
39
|
-
this.updateMode();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
updateMode() {
|
|
45
|
-
const val = this.body.getAttribute('theme-mode');
|
|
46
|
-
|
|
47
|
-
if (val !== this.state.mode) {
|
|
48
|
-
this.setState({
|
|
49
|
-
mode: val
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
55
|
render() {
|
|
55
56
|
var _context;
|
|
56
57
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { InputProps } from '../input';
|
|
4
|
-
import { InputNumberAdapter } from '@douyinfe/semi-foundation/lib/es/inputNumber/foundation';
|
|
4
|
+
import InputNumberFoundation, { InputNumberAdapter } from '@douyinfe/semi-foundation/lib/es/inputNumber/foundation';
|
|
5
5
|
import BaseComponent from '../_base/baseComponent';
|
|
6
6
|
import { strings } from '@douyinfe/semi-foundation/lib/es/inputNumber/constants';
|
|
7
7
|
import '@douyinfe/semi-foundation/lib/es/inputNumber/inputNumber.css';
|
|
@@ -85,20 +85,21 @@ declare class InputNumber extends BaseComponent<InputNumberProps, InputNumberSta
|
|
|
85
85
|
currentValue: number | string;
|
|
86
86
|
cursorBefore: string;
|
|
87
87
|
cursorAfter: string;
|
|
88
|
+
foundation: InputNumberFoundation;
|
|
88
89
|
constructor(props: InputNumberProps);
|
|
89
90
|
componentDidUpdate(prevProps: InputNumberProps): void;
|
|
90
91
|
setInputRef: (node: HTMLInputElement) => void;
|
|
91
|
-
handleInputFocus: (e: React.FocusEvent<HTMLInputElement>) =>
|
|
92
|
-
handleInputChange: (value: string, event: React.ChangeEvent<HTMLInputElement>) =>
|
|
93
|
-
handleInputBlur: (e: React.FocusEvent<HTMLInputElement>) =>
|
|
94
|
-
handleInputKeyDown: (e: React.KeyboardEvent) =>
|
|
95
|
-
handleInputMouseEnter: (e: React.MouseEvent) =>
|
|
96
|
-
handleInputMouseLeave: (e: React.MouseEvent) =>
|
|
97
|
-
handleInputMouseMove: (e: React.MouseEvent) =>
|
|
98
|
-
handleUpClick: (e: React.KeyboardEvent) =>
|
|
99
|
-
handleDownClick: (e: React.KeyboardEvent) =>
|
|
100
|
-
handleMouseUp: (e: React.MouseEvent) =>
|
|
101
|
-
handleMouseLeave: (e: React.MouseEvent) =>
|
|
92
|
+
handleInputFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
93
|
+
handleInputChange: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
94
|
+
handleInputBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
95
|
+
handleInputKeyDown: (e: React.KeyboardEvent) => void;
|
|
96
|
+
handleInputMouseEnter: (e: React.MouseEvent) => void;
|
|
97
|
+
handleInputMouseLeave: (e: React.MouseEvent) => void;
|
|
98
|
+
handleInputMouseMove: (e: React.MouseEvent) => void;
|
|
99
|
+
handleUpClick: (e: React.KeyboardEvent) => void;
|
|
100
|
+
handleDownClick: (e: React.KeyboardEvent) => void;
|
|
101
|
+
handleMouseUp: (e: React.MouseEvent) => void;
|
|
102
|
+
handleMouseLeave: (e: React.MouseEvent) => void;
|
|
102
103
|
renderButtons: () => JSX.Element;
|
|
103
104
|
renderSuffix: () => React.ReactNode;
|
|
104
105
|
render(): JSX.Element;
|
|
@@ -334,7 +334,11 @@ class InputNumber extends BaseComponent {
|
|
|
334
334
|
if (this.foundation.isValidNumber(parsedNum) && parsedNum !== this.state.number) {
|
|
335
335
|
const obj = {
|
|
336
336
|
number: parsedNum
|
|
337
|
-
};
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* If you are clicking the button, it will automatically format once
|
|
340
|
+
* We need to set the status to false after trigger focus event
|
|
341
|
+
*/
|
|
338
342
|
|
|
339
343
|
if (this.clickUpOrDown) {
|
|
340
344
|
obj.value = this.foundation.doFormat(valueStr, true);
|
package/lib/es/tabs/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import _omit from "lodash/omit";
|
|
2
1
|
import _pick from "lodash/pick";
|
|
3
2
|
import _isEqual from "lodash/isEqual";
|
|
4
3
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
5
4
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
6
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
7
5
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
8
6
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
9
7
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
@@ -35,9 +33,7 @@ import '@douyinfe/semi-foundation/lib/es/tabs/tabs.css';
|
|
|
35
33
|
import TabBar from './TabBar';
|
|
36
34
|
import TabPane from './TabPane';
|
|
37
35
|
import TabsContext from './tabs-context';
|
|
38
|
-
|
|
39
|
-
const panePickKeys = _Object$keys(_omit(TabPane.propTypes, ['children']));
|
|
40
|
-
|
|
36
|
+
const panePickKeys = ['className', 'style', 'disabled', 'itemKey', 'tab', 'icon'];
|
|
41
37
|
export * from './interface';
|
|
42
38
|
|
|
43
39
|
class Tabs extends BaseComponent {
|
|
@@ -152,7 +152,7 @@ declare class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
152
152
|
renderHeader(headerConfig: HeaderConfig): JSX.Element;
|
|
153
153
|
renderLeftItem(item: ResolvedDataItem, index: number): React.ReactNode;
|
|
154
154
|
renderLeft(locale: Locale['Transfer']): React.ReactNode;
|
|
155
|
-
renderGroupTitle(group: GroupItem): JSX.Element;
|
|
155
|
+
renderGroupTitle(group: GroupItem, index: number): JSX.Element;
|
|
156
156
|
renderLeftTree(): JSX.Element;
|
|
157
157
|
renderLeftList(visibileItems: Array<ResolvedDataItem>): JSX.Element;
|
|
158
158
|
renderRightItem(item: ResolvedDataItem): React.ReactNode;
|
package/lib/es/transfer/index.js
CHANGED
|
@@ -329,11 +329,11 @@ class Transfer extends BaseComponent {
|
|
|
329
329
|
}, inputCom, content);
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
renderGroupTitle(group) {
|
|
332
|
+
renderGroupTitle(group, index) {
|
|
333
333
|
const groupCls = cls("".concat(prefixcls, "-group-title"));
|
|
334
334
|
return /*#__PURE__*/React.createElement("div", {
|
|
335
335
|
className: groupCls,
|
|
336
|
-
key:
|
|
336
|
+
key: "title-".concat(index)
|
|
337
337
|
}, group.title);
|
|
338
338
|
}
|
|
339
339
|
|
|
@@ -390,7 +390,7 @@ class Transfer extends BaseComponent {
|
|
|
390
390
|
// group content already insert
|
|
391
391
|
content.push(optionContent);
|
|
392
392
|
} else if (parentGroup) {
|
|
393
|
-
const groupContent = this.renderGroupTitle(parentGroup);
|
|
393
|
+
const groupContent = this.renderGroupTitle(parentGroup, index);
|
|
394
394
|
groupStatus.set(parentGroup.title, true);
|
|
395
395
|
content.push(groupContent);
|
|
396
396
|
content.push(optionContent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation-react": "2.2.
|
|
18
|
-
"@douyinfe/semi-foundation": "2.2.
|
|
19
|
-
"@douyinfe/semi-icons": "2.2.
|
|
20
|
-
"@douyinfe/semi-illustrations": "2.2.
|
|
21
|
-
"@douyinfe/semi-theme-default": "2.2.
|
|
17
|
+
"@douyinfe/semi-animation-react": "2.2.2",
|
|
18
|
+
"@douyinfe/semi-foundation": "2.2.2",
|
|
19
|
+
"@douyinfe/semi-icons": "2.2.2",
|
|
20
|
+
"@douyinfe/semi-illustrations": "2.2.2",
|
|
21
|
+
"@douyinfe/semi-theme-default": "2.2.2",
|
|
22
22
|
"@types/react-window": "^1.8.2",
|
|
23
23
|
"async-validator": "^3.5.0",
|
|
24
24
|
"classnames": "^2.2.6",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
],
|
|
69
69
|
"author": "",
|
|
70
70
|
"license": "MIT",
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "de84e4f81bb443c457c075e808c4bd1fcf9441d7",
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
74
74
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
75
75
|
"@babel/preset-env": "^7.15.8",
|
|
76
76
|
"@babel/preset-react": "^7.14.5",
|
|
77
|
-
"@douyinfe/semi-scss-compile": "2.2.
|
|
77
|
+
"@douyinfe/semi-scss-compile": "2.2.2",
|
|
78
78
|
"@storybook/addon-knobs": "^6.3.1",
|
|
79
79
|
"@types/lodash": "^4.14.176",
|
|
80
80
|
"babel-loader": "^8.2.2",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"react-storybook-addon-props-combinations": "^1.1.0",
|
|
100
100
|
"react-virtualized": "^9.22.3",
|
|
101
101
|
"rimraf": "^3.0.2",
|
|
102
|
-
"sass": "1.
|
|
102
|
+
"sass": "1.45.0",
|
|
103
103
|
"sinon": "^6.3.5",
|
|
104
104
|
"terser-webpack-plugin": "^4.2.3",
|
|
105
105
|
"through2": "^4.0.2",
|
package/tabs/index.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import TabPane from './TabPane';
|
|
|
15
15
|
import TabsContext from './tabs-context';
|
|
16
16
|
import { TabsProps, PlainTab, TabBarProps } from './interface';
|
|
17
17
|
|
|
18
|
-
const panePickKeys =
|
|
18
|
+
const panePickKeys = ['className', 'style', 'disabled', 'itemKey', 'tab', 'icon'];
|
|
19
19
|
|
|
20
20
|
export * from './interface';
|
|
21
21
|
|