@douyinfe/semi-ui 2.16.1 → 2.17.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/collapse/__test__/collapse.test.js +22 -2
- package/collapse/_story/accordion.stories.js +2 -2
- package/collapse/item.tsx +20 -6
- package/datePicker/__test__/datePicker.test.js +5 -5
- package/datePicker/_story/datePicker.stories.js +138 -22
- package/datePicker/datePicker.tsx +42 -7
- package/datePicker/monthsGrid.tsx +22 -10
- package/datePicker/quickControl.tsx +62 -16
- package/datePicker/yearAndMonth.tsx +31 -5
- package/dist/css/semi.css +289 -32
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +45706 -45192
- 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/collapse/item.d.ts +8 -0
- package/lib/cjs/collapse/item.js +19 -8
- package/lib/cjs/datePicker/datePicker.d.ts +3 -0
- package/lib/cjs/datePicker/datePicker.js +56 -9
- package/lib/cjs/datePicker/monthsGrid.d.ts +3 -0
- package/lib/cjs/datePicker/monthsGrid.js +14 -3
- package/lib/cjs/datePicker/quickControl.d.ts +6 -0
- package/lib/cjs/datePicker/quickControl.js +61 -14
- package/lib/cjs/datePicker/yearAndMonth.d.ts +3 -0
- package/lib/cjs/datePicker/yearAndMonth.js +15 -3
- package/lib/cjs/popover/index.d.ts +3 -0
- package/lib/cjs/popover/index.js +4 -2
- package/lib/cjs/select/index.d.ts +6 -1
- package/lib/cjs/select/index.js +130 -72
- package/lib/cjs/select/option.js +4 -2
- package/lib/cjs/tag/index.js +6 -4
- package/lib/cjs/tag/interface.d.ts +1 -0
- package/lib/cjs/tagInput/index.d.ts +13 -1
- package/lib/cjs/tagInput/index.js +217 -91
- package/lib/cjs/tooltip/index.d.ts +4 -0
- package/lib/cjs/tooltip/index.js +5 -3
- package/lib/es/collapse/item.d.ts +8 -0
- package/lib/es/collapse/item.js +19 -8
- package/lib/es/datePicker/datePicker.d.ts +3 -0
- package/lib/es/datePicker/datePicker.js +56 -9
- package/lib/es/datePicker/monthsGrid.d.ts +3 -0
- package/lib/es/datePicker/monthsGrid.js +14 -3
- package/lib/es/datePicker/quickControl.d.ts +6 -0
- package/lib/es/datePicker/quickControl.js +61 -15
- package/lib/es/datePicker/yearAndMonth.d.ts +3 -0
- package/lib/es/datePicker/yearAndMonth.js +14 -3
- package/lib/es/popover/index.d.ts +3 -0
- package/lib/es/popover/index.js +4 -2
- package/lib/es/select/index.d.ts +6 -1
- package/lib/es/select/index.js +129 -71
- package/lib/es/select/option.js +4 -2
- package/lib/es/tag/index.js +6 -4
- package/lib/es/tag/interface.d.ts +1 -0
- package/lib/es/tagInput/index.d.ts +13 -1
- package/lib/es/tagInput/index.js +217 -93
- package/lib/es/tooltip/index.d.ts +4 -0
- package/lib/es/tooltip/index.js +5 -3
- package/package.json +7 -7
- package/popover/index.tsx +4 -1
- package/select/__test__/select.test.js +5 -3
- package/select/index.tsx +65 -30
- package/select/option.tsx +2 -0
- package/tag/index.tsx +3 -2
- package/tag/interface.ts +1 -0
- package/tagInput/_story/tagInput.stories.js +18 -0
- package/tagInput/index.tsx +126 -26
- package/tooltip/index.tsx +5 -2
|
@@ -152,7 +152,8 @@ export default class DatePicker extends BaseComponent {
|
|
|
152
152
|
type,
|
|
153
153
|
format,
|
|
154
154
|
rangeSeparator,
|
|
155
|
-
defaultPickerValue
|
|
155
|
+
defaultPickerValue,
|
|
156
|
+
presetPosition
|
|
156
157
|
} = this.props;
|
|
157
158
|
const {
|
|
158
159
|
insetInputValue,
|
|
@@ -184,9 +185,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
184
185
|
}, topSlot && /*#__PURE__*/React.createElement("div", {
|
|
185
186
|
className: "".concat(cssClasses.PREFIX, "-topSlot"),
|
|
186
187
|
"x-semi-prop": "topSlot"
|
|
187
|
-
}, topSlot),
|
|
188
|
-
insetInput: true
|
|
189
|
-
})), this.adapter.typeIsYearOrMonth() ? this.renderYearMonthPanel(locale, localeCode) : this.renderMonthGrid(locale, localeCode, dateFnsLocale), this.renderQuickControls(), bottomSlot && /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
}, topSlot), presetPosition === "top" && this.renderQuickControls(), this.adapter.typeIsYearOrMonth() ? this.renderYearMonthPanel(locale, localeCode) : this.renderMonthGrid(locale, localeCode, dateFnsLocale), presetPosition === "bottom" && this.renderQuickControls(), bottomSlot && /*#__PURE__*/React.createElement("div", {
|
|
190
189
|
className: "".concat(cssClasses.PREFIX, "-bottomSlot"),
|
|
191
190
|
"x-semi-prop": "bottomSlot"
|
|
192
191
|
}, bottomSlot), this.renderFooter(locale, localeCode));
|
|
@@ -194,7 +193,8 @@ export default class DatePicker extends BaseComponent {
|
|
|
194
193
|
|
|
195
194
|
this.renderYearMonthPanel = (locale, localeCode) => {
|
|
196
195
|
const {
|
|
197
|
-
density
|
|
196
|
+
density,
|
|
197
|
+
presetPosition
|
|
198
198
|
} = this.props;
|
|
199
199
|
const date = this.state.value[0];
|
|
200
200
|
let year = 0;
|
|
@@ -214,7 +214,10 @@ export default class DatePicker extends BaseComponent {
|
|
|
214
214
|
onSelect: this.handleYMSelectedChange,
|
|
215
215
|
currentYear: year,
|
|
216
216
|
currentMonth: month,
|
|
217
|
-
density: density
|
|
217
|
+
density: density,
|
|
218
|
+
presetPosition: presetPosition,
|
|
219
|
+
renderQuickControls: this.renderQuickControls(),
|
|
220
|
+
renderDateInput: this.renderDateInput()
|
|
218
221
|
});
|
|
219
222
|
};
|
|
220
223
|
|
|
@@ -560,7 +563,8 @@ export default class DatePicker extends BaseComponent {
|
|
|
560
563
|
onPanelChange,
|
|
561
564
|
timeZone,
|
|
562
565
|
triggerRender,
|
|
563
|
-
insetInput
|
|
566
|
+
insetInput,
|
|
567
|
+
presetPosition
|
|
564
568
|
} = this.props;
|
|
565
569
|
const {
|
|
566
570
|
cachedSelectedValue,
|
|
@@ -602,22 +606,63 @@ export default class DatePicker extends BaseComponent {
|
|
|
602
606
|
timeZone: timeZone,
|
|
603
607
|
focusRecordsRef: this.focusRecordsRef,
|
|
604
608
|
triggerRender: triggerRender,
|
|
605
|
-
insetInput: insetInput
|
|
609
|
+
insetInput: insetInput,
|
|
610
|
+
presetPosition: presetPosition,
|
|
611
|
+
renderQuickControls: this.renderQuickControls(),
|
|
612
|
+
renderDateInput: this.renderDateInput()
|
|
606
613
|
});
|
|
607
614
|
}
|
|
608
615
|
|
|
609
616
|
renderQuickControls() {
|
|
610
617
|
const {
|
|
611
618
|
presets,
|
|
612
|
-
type
|
|
619
|
+
type,
|
|
620
|
+
presetPosition,
|
|
621
|
+
insetInput
|
|
613
622
|
} = this.props;
|
|
614
623
|
return /*#__PURE__*/React.createElement(QuickControl, {
|
|
615
624
|
type: type,
|
|
616
625
|
presets: presets,
|
|
626
|
+
insetInput: insetInput,
|
|
627
|
+
presetPosition: presetPosition,
|
|
617
628
|
onPresetClick: (item, e) => this.foundation.handlePresetClick(item, e)
|
|
618
629
|
});
|
|
619
630
|
}
|
|
620
631
|
|
|
632
|
+
renderDateInput() {
|
|
633
|
+
const {
|
|
634
|
+
insetInput,
|
|
635
|
+
dateFnsLocale,
|
|
636
|
+
density,
|
|
637
|
+
type,
|
|
638
|
+
format,
|
|
639
|
+
rangeSeparator,
|
|
640
|
+
defaultPickerValue
|
|
641
|
+
} = this.props;
|
|
642
|
+
const {
|
|
643
|
+
insetInputValue,
|
|
644
|
+
value
|
|
645
|
+
} = this.state;
|
|
646
|
+
const insetInputProps = {
|
|
647
|
+
dateFnsLocale,
|
|
648
|
+
format,
|
|
649
|
+
insetInputValue,
|
|
650
|
+
rangeSeparator,
|
|
651
|
+
type,
|
|
652
|
+
value: value,
|
|
653
|
+
handleInsetDateFocus: this.handleInsetDateFocus,
|
|
654
|
+
handleInsetTimeFocus: this.handleInsetTimeFocus,
|
|
655
|
+
onInsetInputChange: this.handleInsetInputChange,
|
|
656
|
+
rangeInputStartRef: this.rangeInputStartRef,
|
|
657
|
+
rangeInputEndRef: this.rangeInputEndRef,
|
|
658
|
+
density,
|
|
659
|
+
defaultPickerValue
|
|
660
|
+
};
|
|
661
|
+
return insetInput ? /*#__PURE__*/React.createElement(DateInput, _Object$assign({}, insetInputProps, {
|
|
662
|
+
insetInput: true
|
|
663
|
+
})) : null;
|
|
664
|
+
}
|
|
665
|
+
|
|
621
666
|
renderInner(extraProps) {
|
|
622
667
|
var _context3, _context4;
|
|
623
668
|
|
|
@@ -758,6 +803,7 @@ DatePicker.propTypes = {
|
|
|
758
803
|
max: PropTypes.number,
|
|
759
804
|
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
760
805
|
presets: PropTypes.array,
|
|
806
|
+
presetPosition: PropTypes.oneOf(strings.PRESET_POSITION_SET),
|
|
761
807
|
onChange: PropTypes.func,
|
|
762
808
|
onChangeWithDateFirst: PropTypes.bool,
|
|
763
809
|
weekStartsOn: PropTypes.number,
|
|
@@ -815,6 +861,7 @@ DatePicker.defaultProps = {
|
|
|
815
861
|
stopPropagation: true,
|
|
816
862
|
motion: true,
|
|
817
863
|
prefixCls: cssClasses.PREFIX,
|
|
864
|
+
presetPosition: 'bottom',
|
|
818
865
|
// position: 'bottomLeft',
|
|
819
866
|
zIndex: popoverNumbers.DEFAULT_Z_INDEX,
|
|
820
867
|
type: 'date',
|
|
@@ -50,6 +50,9 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
50
50
|
onPanelChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
51
|
focusRecordsRef: PropTypes.Requireable<object>;
|
|
52
52
|
triggerRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
+
presetPosition: PropTypes.Requireable<"top" | "left" | "right" | "bottom">;
|
|
54
|
+
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
55
|
+
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
53
56
|
};
|
|
54
57
|
static defaultProps: {
|
|
55
58
|
type: string;
|
|
@@ -618,7 +618,10 @@ export default class MonthsGrid extends BaseComponent {
|
|
|
618
618
|
} = this.state;
|
|
619
619
|
const {
|
|
620
620
|
type,
|
|
621
|
-
insetInput
|
|
621
|
+
insetInput,
|
|
622
|
+
presetPosition,
|
|
623
|
+
renderQuickControls,
|
|
624
|
+
renderDateInput
|
|
622
625
|
} = this.props;
|
|
623
626
|
const monthGridCls = classnames({
|
|
624
627
|
["".concat(prefixCls, "-month-grid")]: true
|
|
@@ -637,12 +640,17 @@ export default class MonthsGrid extends BaseComponent {
|
|
|
637
640
|
|
|
638
641
|
const yearOpenType = this.getYAMOpenType();
|
|
639
642
|
return /*#__PURE__*/React.createElement("div", {
|
|
643
|
+
style: {
|
|
644
|
+
display: 'flex'
|
|
645
|
+
}
|
|
646
|
+
}, presetPosition === "left" && renderQuickControls, /*#__PURE__*/React.createElement("div", null, renderDateInput, /*#__PURE__*/React.createElement("div", {
|
|
640
647
|
className: monthGridCls,
|
|
641
648
|
"x-type": type,
|
|
642
649
|
"x-panel-yearandmonth-open-type": yearOpenType,
|
|
643
650
|
"x-insetinput": insetInput ? "true" : "false",
|
|
651
|
+
"x-preset-position": renderQuickControls === null ? 'null' : presetPosition,
|
|
644
652
|
ref: current => this.cacheRefCurrent('monthGrid', current)
|
|
645
|
-
}, content);
|
|
653
|
+
}, content)), presetPosition === "right" && renderQuickControls);
|
|
646
654
|
}
|
|
647
655
|
|
|
648
656
|
}
|
|
@@ -682,7 +690,10 @@ MonthsGrid.propTypes = {
|
|
|
682
690
|
// Callback function for panel date switching
|
|
683
691
|
onPanelChange: PropTypes.func,
|
|
684
692
|
focusRecordsRef: PropTypes.object,
|
|
685
|
-
triggerRender: PropTypes.func
|
|
693
|
+
triggerRender: PropTypes.func,
|
|
694
|
+
presetPosition: PropTypes.oneOf(strings.PRESET_POSITION_SET),
|
|
695
|
+
renderQuickControls: PropTypes.node,
|
|
696
|
+
renderDateInput: PropTypes.node
|
|
686
697
|
};
|
|
687
698
|
MonthsGrid.defaultProps = {
|
|
688
699
|
type: 'date',
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { strings } from '@douyinfe/semi-foundation/lib/es/datePicker/constants';
|
|
3
4
|
import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
|
|
4
5
|
import { PresetsType, PresetType } from '@douyinfe/semi-foundation/lib/es/datePicker/foundation';
|
|
5
6
|
export interface QuickControlProps {
|
|
6
7
|
presets: PresetsType;
|
|
8
|
+
presetPosition: typeof strings.PRESET_POSITION_SET[number];
|
|
7
9
|
onPresetClick: (preset: PresetType, e: React.MouseEvent) => void;
|
|
8
10
|
type: string;
|
|
11
|
+
insetInput: boolean;
|
|
9
12
|
}
|
|
10
13
|
declare class QuickControl extends PureComponent<QuickControlProps> {
|
|
11
14
|
static propTypes: {
|
|
12
15
|
presets: PropTypes.Requireable<any[]>;
|
|
16
|
+
presetPosition: PropTypes.Requireable<"top" | "left" | "right" | "bottom">;
|
|
13
17
|
onPresetClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
18
|
type: PropTypes.Requireable<string>;
|
|
19
|
+
insetInput: PropTypes.Requireable<boolean>;
|
|
15
20
|
};
|
|
16
21
|
static defaultProps: {
|
|
17
22
|
presets: PresetsType;
|
|
23
|
+
presetPosition: string;
|
|
18
24
|
onPresetClick: typeof noop;
|
|
19
25
|
};
|
|
20
26
|
render(): JSX.Element;
|
|
@@ -5,55 +5,101 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
5
5
|
import React, { PureComponent } from 'react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/datePicker/constants';
|
|
8
|
+
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/datePicker/constants';
|
|
9
9
|
import Button from '../button/index';
|
|
10
|
+
import Typography from '../typography/index';
|
|
10
11
|
import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
|
|
11
12
|
const prefixCls = cssClasses.PREFIX;
|
|
13
|
+
const {
|
|
14
|
+
Text
|
|
15
|
+
} = Typography;
|
|
12
16
|
|
|
13
17
|
class QuickControl extends PureComponent {
|
|
14
18
|
render() {
|
|
15
|
-
var _context;
|
|
19
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12;
|
|
16
20
|
|
|
17
21
|
const {
|
|
18
22
|
presets,
|
|
19
23
|
onPresetClick,
|
|
20
|
-
type
|
|
24
|
+
type,
|
|
25
|
+
presetPosition,
|
|
26
|
+
insetInput
|
|
21
27
|
} = this.props;
|
|
28
|
+
const isTypeRange = type === 'dateRange' || type === 'dateTimeRange';
|
|
29
|
+
const isPanelTopAndBottom = presetPosition === 'top' || presetPosition === 'bottom';
|
|
30
|
+
const isMonth = type === 'month';
|
|
31
|
+
const isTopAndBottomRange = isPanelTopAndBottom && isTypeRange;
|
|
32
|
+
const isTopAndBottomMonth = isPanelTopAndBottom && isMonth;
|
|
22
33
|
const wrapperCls = classNames("".concat(prefixCls, "-quick-control"), {
|
|
23
|
-
[_concatInstanceProperty(_context = "".concat(prefixCls, "-quick-control-")).call(_context, type)]: type
|
|
34
|
+
[_concatInstanceProperty(_context = "".concat(prefixCls, "-quick-control-")).call(_context, type)]: type,
|
|
35
|
+
[_concatInstanceProperty(_context2 = "".concat(prefixCls, "-quick-control-")).call(_context2, presetPosition)]: true
|
|
36
|
+
});
|
|
37
|
+
const headerCls = classNames({
|
|
38
|
+
["".concat(prefixCls, "-quick-control-header")]: true
|
|
39
|
+
});
|
|
40
|
+
const contentWrapperCls = classNames({
|
|
41
|
+
[_concatInstanceProperty(_context3 = "".concat(prefixCls, "-quick-control-")).call(_context3, presetPosition, "-content-wrapper")]: true
|
|
42
|
+
});
|
|
43
|
+
const contentCls = classNames({
|
|
44
|
+
[_concatInstanceProperty(_context4 = "".concat(prefixCls, "-quick-control-")).call(_context4, presetPosition, "-content")]: !isTopAndBottomRange && !isTopAndBottomMonth,
|
|
45
|
+
[_concatInstanceProperty(_context5 = "".concat(prefixCls, "-quick-control-")).call(_context5, presetPosition, "-range-content")]: isTopAndBottomRange,
|
|
46
|
+
[_concatInstanceProperty(_context6 = "".concat(prefixCls, "-quick-control-")).call(_context6, presetPosition, "-month-content")]: isTopAndBottomMonth
|
|
47
|
+
});
|
|
48
|
+
const itemCls = classNames({
|
|
49
|
+
[_concatInstanceProperty(_context7 = "".concat(prefixCls, "-quick-control-")).call(_context7, presetPosition, "-content-item")]: !isTopAndBottomRange && !isTopAndBottomMonth,
|
|
50
|
+
[_concatInstanceProperty(_context8 = "".concat(prefixCls, "-quick-control-")).call(_context8, presetPosition, "-range-content-item")]: isTopAndBottomRange,
|
|
51
|
+
[_concatInstanceProperty(_context9 = "".concat(prefixCls, "-quick-control-")).call(_context9, presetPosition, "-month-content-item")]: isTopAndBottomMonth
|
|
52
|
+
});
|
|
53
|
+
const ellipsisCls = classNames({
|
|
54
|
+
[_concatInstanceProperty(_context10 = "".concat(prefixCls, "-quick-control-")).call(_context10, presetPosition, "-content-item-ellipsis")]: !isTopAndBottomRange && !isTopAndBottomMonth,
|
|
55
|
+
[_concatInstanceProperty(_context11 = "".concat(prefixCls, "-quick-control-")).call(_context11, presetPosition, "-range-content-item-ellipsis")]: isTopAndBottomRange,
|
|
56
|
+
[_concatInstanceProperty(_context12 = "".concat(prefixCls, "-quick-control-")).call(_context12, presetPosition, "-month-content-item-ellipsis")]: isTopAndBottomMonth
|
|
24
57
|
});
|
|
25
|
-
const itemCls = classNames("".concat(prefixCls, "-quick-control-item"));
|
|
26
58
|
|
|
27
59
|
if (!presets.length) {
|
|
28
60
|
return null;
|
|
29
61
|
}
|
|
30
62
|
|
|
31
63
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
className: wrapperCls
|
|
64
|
+
className: wrapperCls,
|
|
65
|
+
"x-insetinput": insetInput ? "true" : "false"
|
|
66
|
+
}, !isPanelTopAndBottom && /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: headerCls
|
|
68
|
+
}, "\u5FEB\u6377\u9009\u62E9"), /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: contentWrapperCls
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: contentCls
|
|
33
72
|
}, _mapInstanceProperty(presets).call(presets, (item, index) => {
|
|
34
73
|
const _item = typeof item === 'function' ? item() : item;
|
|
35
74
|
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
|
37
|
-
|
|
75
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
76
|
+
size: "small",
|
|
77
|
+
type: "primary",
|
|
38
78
|
onClick: e => onPresetClick(_item, e),
|
|
39
79
|
key: index
|
|
40
|
-
}, /*#__PURE__*/React.createElement(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
80
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: itemCls
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
83
|
+
ellipsis: {
|
|
84
|
+
showTooltip: true
|
|
85
|
+
},
|
|
86
|
+
className: ellipsisCls
|
|
87
|
+
}, _item.text)));
|
|
88
|
+
}))));
|
|
46
89
|
}
|
|
47
90
|
|
|
48
91
|
}
|
|
49
92
|
|
|
50
93
|
QuickControl.propTypes = {
|
|
51
94
|
presets: PropTypes.array,
|
|
95
|
+
presetPosition: PropTypes.oneOf(strings.PRESET_POSITION_SET),
|
|
52
96
|
onPresetClick: PropTypes.func,
|
|
53
|
-
type: PropTypes.string
|
|
97
|
+
type: PropTypes.string,
|
|
98
|
+
insetInput: PropTypes.bool
|
|
54
99
|
};
|
|
55
100
|
QuickControl.defaultProps = {
|
|
56
101
|
presets: [],
|
|
102
|
+
presetPosition: 'bottom',
|
|
57
103
|
onPresetClick: noop
|
|
58
104
|
};
|
|
59
105
|
export default QuickControl;
|
|
@@ -20,6 +20,9 @@ declare class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonth
|
|
|
20
20
|
noBackBtn: PropTypes.Requireable<boolean>;
|
|
21
21
|
disabledDate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
22
|
density: PropTypes.Requireable<string>;
|
|
23
|
+
presetPosition: PropTypes.Requireable<"top" | "left" | "right" | "bottom">;
|
|
24
|
+
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
25
|
+
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
23
26
|
};
|
|
24
27
|
static defaultProps: {
|
|
25
28
|
disabledDate: {
|
|
@@ -20,6 +20,7 @@ import IconButton from '../iconButton';
|
|
|
20
20
|
import { IconChevronLeft } from '@douyinfe/semi-icons';
|
|
21
21
|
import { BASE_CLASS_PREFIX } from '@douyinfe/semi-foundation/lib/es/base/constants';
|
|
22
22
|
import { setYear, setMonth } from 'date-fns';
|
|
23
|
+
import { strings } from '@douyinfe/semi-foundation/lib/es/datePicker/constants';
|
|
23
24
|
const prefixCls = "".concat(BASE_CLASS_PREFIX, "-datepicker");
|
|
24
25
|
|
|
25
26
|
class YearAndMonth extends BaseComponent {
|
|
@@ -210,7 +211,10 @@ class YearAndMonth extends BaseComponent {
|
|
|
210
211
|
const {
|
|
211
212
|
locale,
|
|
212
213
|
noBackBtn,
|
|
213
|
-
density
|
|
214
|
+
density,
|
|
215
|
+
presetPosition,
|
|
216
|
+
renderQuickControls,
|
|
217
|
+
renderDateInput
|
|
214
218
|
} = this.props;
|
|
215
219
|
const prefix = "".concat(prefixCls, "-yearmonth-header"); // i18n
|
|
216
220
|
|
|
@@ -227,7 +231,11 @@ class YearAndMonth extends BaseComponent {
|
|
|
227
231
|
}),
|
|
228
232
|
size: buttonSize,
|
|
229
233
|
onClick: this.backToMain
|
|
230
|
-
}, /*#__PURE__*/React.createElement("span", null, selectDateText))), /*#__PURE__*/React.createElement(
|
|
234
|
+
}, /*#__PURE__*/React.createElement("span", null, selectDateText))), presetPosition ? /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
style: {
|
|
236
|
+
display: 'flex'
|
|
237
|
+
}
|
|
238
|
+
}, presetPosition === "left" && renderQuickControls, /*#__PURE__*/React.createElement("div", null, renderDateInput, /*#__PURE__*/React.createElement(ScrollList, null, this.renderColYear(), this.renderColMonth())), presetPosition === "right" && renderQuickControls) : /*#__PURE__*/React.createElement(React.Fragment, null, renderDateInput, /*#__PURE__*/React.createElement(ScrollList, null, this.renderColYear(), this.renderColMonth())));
|
|
231
239
|
}
|
|
232
240
|
|
|
233
241
|
}
|
|
@@ -242,7 +250,10 @@ YearAndMonth.propTypes = {
|
|
|
242
250
|
yearCycled: PropTypes.bool,
|
|
243
251
|
noBackBtn: PropTypes.bool,
|
|
244
252
|
disabledDate: PropTypes.func,
|
|
245
|
-
density: PropTypes.string
|
|
253
|
+
density: PropTypes.string,
|
|
254
|
+
presetPosition: PropTypes.oneOf(strings.PRESET_POSITION_SET),
|
|
255
|
+
renderQuickControls: PropTypes.node,
|
|
256
|
+
renderDateInput: PropTypes.node
|
|
246
257
|
};
|
|
247
258
|
YearAndMonth.defaultProps = {
|
|
248
259
|
disabledDate: _stubFalse,
|
|
@@ -39,6 +39,7 @@ export interface PopoverProps extends BaseProps {
|
|
|
39
39
|
returnFocusOnClose?: TooltipProps['returnFocusOnClose'];
|
|
40
40
|
onEscKeyDown?: TooltipProps['onEscKeyDown'];
|
|
41
41
|
clickToHide?: TooltipProps['clickToHide'];
|
|
42
|
+
disableFocusListener?: boolean;
|
|
42
43
|
}
|
|
43
44
|
export interface PopoverState {
|
|
44
45
|
popConfirmVisible: boolean;
|
|
@@ -71,6 +72,7 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
71
72
|
arrowBounding: PropTypes.Requireable<object>;
|
|
72
73
|
prefixCls: PropTypes.Requireable<string>;
|
|
73
74
|
guardFocus: PropTypes.Requireable<boolean>;
|
|
75
|
+
disableArrowKeyDown: PropTypes.Requireable<boolean>;
|
|
74
76
|
};
|
|
75
77
|
static defaultProps: {
|
|
76
78
|
arrowBounding: {
|
|
@@ -93,6 +95,7 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
93
95
|
closeOnEsc: boolean;
|
|
94
96
|
returnFocusOnClose: boolean;
|
|
95
97
|
guardFocus: boolean;
|
|
98
|
+
disableFocusListener: boolean;
|
|
96
99
|
};
|
|
97
100
|
context: ContextValue;
|
|
98
101
|
renderPopCard: ({ initialFocusRef }: {
|
package/lib/es/popover/index.js
CHANGED
|
@@ -142,7 +142,8 @@ Popover.propTypes = {
|
|
|
142
142
|
arrowPointAtCenter: PropTypes.bool,
|
|
143
143
|
arrowBounding: PropTypes.object,
|
|
144
144
|
prefixCls: PropTypes.string,
|
|
145
|
-
guardFocus: PropTypes.bool
|
|
145
|
+
guardFocus: PropTypes.bool,
|
|
146
|
+
disableArrowKeyDown: PropTypes.bool
|
|
146
147
|
};
|
|
147
148
|
Popover.defaultProps = {
|
|
148
149
|
arrowBounding: numbers.ARROW_BOUNDING,
|
|
@@ -159,6 +160,7 @@ Popover.defaultProps = {
|
|
|
159
160
|
onEscKeyDown: _noop,
|
|
160
161
|
closeOnEsc: true,
|
|
161
162
|
returnFocusOnClose: true,
|
|
162
|
-
guardFocus: true
|
|
163
|
+
guardFocus: true,
|
|
164
|
+
disableFocusListener: true
|
|
163
165
|
};
|
|
164
166
|
export default Popover;
|
package/lib/es/select/index.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ export interface SelectState {
|
|
|
137
137
|
keyboardEventSet: any;
|
|
138
138
|
optionGroups: Array<any>;
|
|
139
139
|
isHovering: boolean;
|
|
140
|
+
isFocusInContainer: boolean;
|
|
140
141
|
}
|
|
141
142
|
declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
142
143
|
static contextType: React.Context<ContextValue>;
|
|
@@ -220,13 +221,18 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
220
221
|
static defaultProps: Partial<SelectProps>;
|
|
221
222
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
222
223
|
triggerRef: React.RefObject<HTMLDivElement>;
|
|
224
|
+
optionContainerEl: React.RefObject<HTMLDivElement>;
|
|
223
225
|
optionsRef: React.RefObject<any>;
|
|
224
226
|
virtualizeListRef: React.RefObject<any>;
|
|
225
227
|
selectOptionListID: string;
|
|
228
|
+
selectID: string;
|
|
226
229
|
clickOutsideHandler: (e: MouseEvent) => void;
|
|
227
230
|
foundation: SelectFoundation;
|
|
228
231
|
context: ContextValue;
|
|
229
232
|
constructor(props: SelectProps);
|
|
233
|
+
setOptionContainerEl: (node: HTMLDivElement) => {
|
|
234
|
+
current: HTMLDivElement;
|
|
235
|
+
};
|
|
230
236
|
get adapter(): SelectAdapter<SelectProps, SelectState>;
|
|
231
237
|
componentDidMount(): void;
|
|
232
238
|
componentWillUnmount(): void;
|
|
@@ -241,7 +247,6 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
241
247
|
focus(): void;
|
|
242
248
|
onSelect(option: OptionProps, optionIndex: number, e: any): void;
|
|
243
249
|
onClear(e: React.MouseEvent): void;
|
|
244
|
-
onClearBtnEnterPress(e: React.KeyboardEvent): void;
|
|
245
250
|
renderEmpty(): JSX.Element;
|
|
246
251
|
renderLoading(): JSX.Element;
|
|
247
252
|
renderOption(option: OptionProps, optionIndex: number, style?: React.CSSProperties): any;
|