@douyinfe/semi-ui 2.31.4 → 2.32.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 +50 -14
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +3833 -3561
- 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/cascader/index.d.ts +1 -0
- package/lib/cjs/cascader/index.js +10 -1
- package/lib/cjs/datePicker/dateInput.d.ts +5 -1
- package/lib/cjs/datePicker/dateInput.js +16 -9
- package/lib/cjs/datePicker/datePicker.d.ts +32 -4
- package/lib/cjs/datePicker/datePicker.js +104 -23
- package/lib/cjs/datePicker/index.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.js +11 -3
- package/lib/cjs/datePicker/yearAndMonth.d.ts +10 -6
- package/lib/cjs/datePicker/yearAndMonth.js +84 -30
- package/lib/cjs/form/baseForm.d.ts +2 -2
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/locale/interface.d.ts +1 -0
- package/lib/cjs/locale/source/ar.js +2 -1
- package/lib/cjs/locale/source/de.js +2 -1
- package/lib/cjs/locale/source/en_GB.js +2 -1
- package/lib/cjs/locale/source/en_US.js +2 -1
- package/lib/cjs/locale/source/es.js +2 -1
- package/lib/cjs/locale/source/fr.js +2 -1
- package/lib/cjs/locale/source/id_ID.js +2 -1
- package/lib/cjs/locale/source/it.js +2 -1
- package/lib/cjs/locale/source/ja_JP.js +2 -1
- package/lib/cjs/locale/source/ko_KR.js +2 -1
- package/lib/cjs/locale/source/ms_MY.js +2 -1
- package/lib/cjs/locale/source/nl_NL.js +2 -1
- package/lib/cjs/locale/source/pl_PL.js +2 -1
- package/lib/cjs/locale/source/pt_BR.js +2 -1
- package/lib/cjs/locale/source/ro.d.ts +1 -0
- package/lib/cjs/locale/source/ro.js +2 -1
- package/lib/cjs/locale/source/ru_RU.js +2 -1
- package/lib/cjs/locale/source/sv_SE.js +2 -1
- package/lib/cjs/locale/source/th_TH.js +2 -1
- package/lib/cjs/locale/source/tr_TR.js +2 -1
- package/lib/cjs/locale/source/vi_VN.js +2 -1
- package/lib/cjs/locale/source/zh_CN.js +2 -1
- package/lib/cjs/locale/source/zh_TW.js +2 -1
- package/lib/cjs/modal/Modal.js +7 -7
- package/lib/cjs/select/index.d.ts +18 -1
- package/lib/cjs/select/index.js +4 -1
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +3 -1
- package/lib/cjs/sideSheet/SideSheetContent.js +3 -2
- package/lib/cjs/sideSheet/index.js +6 -3
- package/lib/cjs/space/index.js +5 -2
- package/lib/cjs/table/Table.js +2 -2
- package/lib/cjs/treeSelect/index.d.ts +1 -0
- package/lib/cjs/treeSelect/index.js +7 -3
- package/lib/es/cascader/index.d.ts +1 -0
- package/lib/es/cascader/index.js +10 -1
- package/lib/es/datePicker/dateInput.d.ts +5 -1
- package/lib/es/datePicker/dateInput.js +16 -9
- package/lib/es/datePicker/datePicker.d.ts +32 -4
- package/lib/es/datePicker/datePicker.js +109 -23
- package/lib/es/datePicker/index.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.js +11 -3
- package/lib/es/datePicker/yearAndMonth.d.ts +10 -6
- package/lib/es/datePicker/yearAndMonth.js +83 -29
- package/lib/es/form/baseForm.d.ts +2 -2
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/locale/interface.d.ts +1 -0
- package/lib/es/locale/source/ar.js +2 -1
- package/lib/es/locale/source/de.js +2 -1
- package/lib/es/locale/source/en_GB.js +2 -1
- package/lib/es/locale/source/en_US.js +2 -1
- package/lib/es/locale/source/es.js +2 -1
- package/lib/es/locale/source/fr.js +2 -1
- package/lib/es/locale/source/id_ID.js +2 -1
- package/lib/es/locale/source/it.js +2 -1
- package/lib/es/locale/source/ja_JP.js +2 -1
- package/lib/es/locale/source/ko_KR.js +2 -1
- package/lib/es/locale/source/ms_MY.js +2 -1
- package/lib/es/locale/source/nl_NL.js +2 -1
- package/lib/es/locale/source/pl_PL.js +2 -1
- package/lib/es/locale/source/pt_BR.js +2 -1
- package/lib/es/locale/source/ro.d.ts +1 -0
- package/lib/es/locale/source/ro.js +2 -1
- package/lib/es/locale/source/ru_RU.js +2 -1
- package/lib/es/locale/source/sv_SE.js +2 -1
- package/lib/es/locale/source/th_TH.js +2 -1
- package/lib/es/locale/source/tr_TR.js +2 -1
- package/lib/es/locale/source/vi_VN.js +2 -1
- package/lib/es/locale/source/zh_CN.js +2 -1
- package/lib/es/locale/source/zh_TW.js +2 -1
- package/lib/es/modal/Modal.js +7 -7
- package/lib/es/select/index.d.ts +18 -1
- package/lib/es/select/index.js +4 -1
- package/lib/es/sideSheet/SideSheetContent.d.ts +3 -1
- package/lib/es/sideSheet/SideSheetContent.js +3 -2
- package/lib/es/sideSheet/index.js +6 -3
- package/lib/es/space/index.js +4 -2
- package/lib/es/table/Table.js +2 -2
- package/lib/es/treeSelect/index.d.ts +1 -0
- package/lib/es/treeSelect/index.js +7 -3
- package/package.json +8 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { SideSheetProps } from '@douyinfe/semi-foundation/lib/cjs/sideSheet/sideSheetFoundation';
|
|
3
4
|
export interface SideSheetContentProps {
|
|
4
5
|
onClose?: (e: React.MouseEvent) => void;
|
|
5
6
|
mask?: boolean;
|
|
@@ -9,9 +10,10 @@ export interface SideSheetContentProps {
|
|
|
9
10
|
title?: React.ReactNode;
|
|
10
11
|
closable?: boolean;
|
|
11
12
|
headerStyle?: CSSProperties;
|
|
12
|
-
width
|
|
13
|
+
width?: CSSProperties['width'];
|
|
13
14
|
height: CSSProperties['height'];
|
|
14
15
|
style: CSSProperties;
|
|
16
|
+
size: SideSheetProps['size'];
|
|
15
17
|
bodyStyle?: CSSProperties;
|
|
16
18
|
className: string;
|
|
17
19
|
dialogClassName?: string;
|
|
@@ -143,7 +143,7 @@ class SideSheetContent extends _react.default.PureComponent {
|
|
|
143
143
|
key: "dialog-element",
|
|
144
144
|
role: "dialog",
|
|
145
145
|
tabIndex: -1,
|
|
146
|
-
className: (0, _classnames.default)(`${prefixCls}-inner`, `${prefixCls}-inner-wrap`, (_a = this.props.dialogClassName) !== null && _a !== void 0 ? _a : ""),
|
|
146
|
+
className: (0, _classnames.default)(`${prefixCls}-inner`, `${prefixCls}-inner-wrap`, (_a = this.props.dialogClassName) !== null && _a !== void 0 ? _a : "", `${prefixCls}-size-${props.size}`),
|
|
147
147
|
// onMouseDown={this.onDialogMouseDown}
|
|
148
148
|
style: Object.assign(Object.assign({}, props.style), style)
|
|
149
149
|
}, this.props.wrapperExtraProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -167,7 +167,8 @@ class SideSheetContent extends _react.default.PureComponent {
|
|
|
167
167
|
width
|
|
168
168
|
} = this.props;
|
|
169
169
|
const wrapperCls = (0, _classnames.default)(className, {
|
|
170
|
-
[`${prefixCls}-fixed`]: !mask
|
|
170
|
+
[`${prefixCls}-fixed`]: !mask,
|
|
171
|
+
[`${prefixCls}-size-${this.props.size}`]: !mask
|
|
171
172
|
});
|
|
172
173
|
const wrapperStyle = {};
|
|
173
174
|
|
|
@@ -182,7 +182,6 @@ class SideSheet extends _baseComponent.default {
|
|
|
182
182
|
} = this.context;
|
|
183
183
|
const isVertical = placement === 'left' || placement === 'right';
|
|
184
184
|
const isHorizontal = placement === 'top' || placement === 'bottom';
|
|
185
|
-
const sheetWidth = isVertical ? width ? width : defaultWidthList[size] : '100%';
|
|
186
185
|
const sheetHeight = isHorizontal ? height ? height : defaultHeight : '100%';
|
|
187
186
|
const classList = (0, _classnames.default)(prefixCls, className, {
|
|
188
187
|
[`${prefixCls}-${placement}`]: placement,
|
|
@@ -191,11 +190,15 @@ class SideSheet extends _baseComponent.default {
|
|
|
191
190
|
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
192
191
|
[`${prefixCls}-hidden`]: keepDOM && this.state.displayNone
|
|
193
192
|
});
|
|
194
|
-
const contentProps = Object.assign(Object.assign({},
|
|
193
|
+
const contentProps = Object.assign(Object.assign(Object.assign({}, isVertical ? width ? {
|
|
194
|
+
width
|
|
195
|
+
} : {} : {
|
|
196
|
+
width: "100%"
|
|
197
|
+
}), props), {
|
|
195
198
|
visible,
|
|
196
199
|
motion: false,
|
|
200
|
+
size,
|
|
197
201
|
className: classList,
|
|
198
|
-
width: sheetWidth,
|
|
199
202
|
height: sheetHeight,
|
|
200
203
|
onClose: this.handleCancel
|
|
201
204
|
});
|
package/lib/cjs/space/index.js
CHANGED
|
@@ -23,6 +23,8 @@ require("@douyinfe/semi-foundation/lib/cjs/space/space.css");
|
|
|
23
23
|
|
|
24
24
|
var _utils = require("./utils");
|
|
25
25
|
|
|
26
|
+
var _getDataAttr = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/getDataAttr"));
|
|
27
|
+
|
|
26
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
29
|
|
|
28
30
|
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; }
|
|
@@ -80,11 +82,12 @@ class Space extends _react.PureComponent {
|
|
|
80
82
|
[`${prefixCls}-loose-vertical`]: spacingVerticalType === _constants.strings.SPACING_LOOSE
|
|
81
83
|
});
|
|
82
84
|
const childrenNodes = (0, _utils.flatten)(children);
|
|
83
|
-
|
|
85
|
+
const dataAttributes = (0, _getDataAttr.default)(this.props);
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement("div", Object.assign({}, dataAttributes, {
|
|
84
87
|
className: classNames,
|
|
85
88
|
style: realStyle,
|
|
86
89
|
"x-semi-prop": "children"
|
|
87
|
-
}, childrenNodes);
|
|
90
|
+
}), childrenNodes);
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
}
|
package/lib/cjs/table/Table.js
CHANGED
|
@@ -1174,13 +1174,13 @@ class Table extends _baseComponent.default {
|
|
|
1174
1174
|
if (props.columns && props.columns !== state.cachedColumns) {
|
|
1175
1175
|
const newFlattenColumns = (0, _utils.flattenColumns)(props.columns);
|
|
1176
1176
|
willUpdateStates.flattenColumns = newFlattenColumns;
|
|
1177
|
-
willUpdateStates.queries = (0,
|
|
1177
|
+
willUpdateStates.queries = (0, _utils2.mergeColumns)(state.queries, newFlattenColumns, null, false);
|
|
1178
1178
|
willUpdateStates.cachedColumns = props.columns;
|
|
1179
1179
|
willUpdateStates.cachedChildren = null;
|
|
1180
1180
|
} else if (props.children && props.children !== state.cachedChildren) {
|
|
1181
1181
|
const newNestedColumns = (0, _getColumns.default)(props.children);
|
|
1182
1182
|
const newFlattenColumns = (0, _utils.flattenColumns)(newNestedColumns);
|
|
1183
|
-
const columns = (0,
|
|
1183
|
+
const columns = (0, _utils2.mergeColumns)(state.queries, newFlattenColumns, null, false);
|
|
1184
1184
|
willUpdateStates.flattenColumns = newFlattenColumns;
|
|
1185
1185
|
willUpdateStates.queries = [...columns];
|
|
1186
1186
|
willUpdateStates.cachedColumns = [...newNestedColumns];
|
|
@@ -180,6 +180,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
180
180
|
showRestTagsPopover: PropTypes.Requireable<boolean>;
|
|
181
181
|
restTagsPopoverProps: PropTypes.Requireable<object>;
|
|
182
182
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
183
|
+
clickTriggerToHide: PropTypes.Requireable<boolean>;
|
|
183
184
|
};
|
|
184
185
|
static defaultProps: Partial<TreeSelectProps>;
|
|
185
186
|
inputRef: React.RefObject<typeof Input>;
|
|
@@ -485,7 +485,9 @@ class TreeSelect extends _baseComponent.default {
|
|
|
485
485
|
onClear: this.handleClear,
|
|
486
486
|
componentName: 'TreeSelect',
|
|
487
487
|
triggerRender: triggerRender,
|
|
488
|
-
componentProps: Object.assign({}, this.props)
|
|
488
|
+
componentProps: Object.assign({}, this.props),
|
|
489
|
+
onSearch: this.search,
|
|
490
|
+
onRemove: this.removeTag
|
|
489
491
|
}) : [/*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
490
492
|
key: 'prefix'
|
|
491
493
|
}, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
@@ -1420,7 +1422,8 @@ TreeSelect.propTypes = {
|
|
|
1420
1422
|
'aria-label': _propTypes.default.string,
|
|
1421
1423
|
showRestTagsPopover: _propTypes.default.bool,
|
|
1422
1424
|
restTagsPopoverProps: _propTypes.default.object,
|
|
1423
|
-
preventScroll: _propTypes.default.bool
|
|
1425
|
+
preventScroll: _propTypes.default.bool,
|
|
1426
|
+
clickTriggerToHide: _propTypes.default.bool
|
|
1424
1427
|
};
|
|
1425
1428
|
TreeSelect.defaultProps = {
|
|
1426
1429
|
searchPosition: _constants.strings.SEARCH_POSITION_DROPDOWN,
|
|
@@ -1450,7 +1453,8 @@ TreeSelect.defaultProps = {
|
|
|
1450
1453
|
checkRelation: 'related',
|
|
1451
1454
|
'aria-label': 'TreeSelect',
|
|
1452
1455
|
showRestTagsPopover: false,
|
|
1453
|
-
restTagsPopoverProps: {}
|
|
1456
|
+
restTagsPopoverProps: {},
|
|
1457
|
+
clickTriggerToHide: true
|
|
1454
1458
|
};
|
|
1455
1459
|
var _default = TreeSelect;
|
|
1456
1460
|
exports.default = _default;
|
|
@@ -188,6 +188,7 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
188
188
|
componentDidUpdate(prevProps: CascaderProps): void;
|
|
189
189
|
handleInputChange: (value: string) => void;
|
|
190
190
|
handleTagRemove: (e: any, tagValuePath: Array<string | number>) => void;
|
|
191
|
+
handleRemoveByKey: (key: any) => void;
|
|
191
192
|
renderTagItem: (value: string | Array<string>, idx: number, type: string) => string | number | boolean | React.ReactFragment | JSX.Element;
|
|
192
193
|
renderTagInput(): JSX.Element;
|
|
193
194
|
renderInput(): JSX.Element;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -41,6 +41,13 @@ class Cascader extends BaseComponent {
|
|
|
41
41
|
this.foundation.handleTagRemove(e, tagValuePath);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
this.handleRemoveByKey = key => {
|
|
45
|
+
const {
|
|
46
|
+
keyEntities
|
|
47
|
+
} = this.state;
|
|
48
|
+
this.handleTagRemove(null, keyEntities[key].valuePath);
|
|
49
|
+
};
|
|
50
|
+
|
|
44
51
|
this.renderTagItem = (value, idx, type) => {
|
|
45
52
|
const {
|
|
46
53
|
keyEntities,
|
|
@@ -330,7 +337,9 @@ class Cascader extends BaseComponent {
|
|
|
330
337
|
disabled: disabled,
|
|
331
338
|
triggerRender: triggerRender,
|
|
332
339
|
componentName: 'Cascader',
|
|
333
|
-
componentProps: Object.assign({}, this.props)
|
|
340
|
+
componentProps: Object.assign({}, this.props),
|
|
341
|
+
onSearch: this.handleInputChange,
|
|
342
|
+
onRemove: this.handleRemoveByKey
|
|
334
343
|
});
|
|
335
344
|
};
|
|
336
345
|
|
|
@@ -15,6 +15,9 @@ export interface DateInputProps extends DateInputFoundationProps, BaseProps {
|
|
|
15
15
|
onClear?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
16
16
|
onInsetInputChange?: (options: InsetInputChangeProps) => void;
|
|
17
17
|
value?: Date[];
|
|
18
|
+
inputRef?: React.RefObject<HTMLInputElement>;
|
|
19
|
+
rangeInputStartRef?: React.RefObject<HTMLInputElement>;
|
|
20
|
+
rangeInputEndRef?: React.RefObject<HTMLInputElement>;
|
|
18
21
|
}
|
|
19
22
|
export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
20
23
|
static propTypes: {
|
|
@@ -26,7 +29,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
26
29
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
30
|
value: PropTypes.Requireable<any[]>;
|
|
28
31
|
disabled: PropTypes.Requireable<boolean>;
|
|
29
|
-
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "dateTimeRange">;
|
|
32
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
30
33
|
showClear: PropTypes.Requireable<boolean>;
|
|
31
34
|
format: PropTypes.Requireable<string>;
|
|
32
35
|
inputStyle: PropTypes.Requireable<object>;
|
|
@@ -81,6 +84,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
81
84
|
renderRangeClearBtn(rangeStart: string, rangeEnd: string): JSX.Element;
|
|
82
85
|
renderRangeSuffix(suffix: React.ReactNode): JSX.Element;
|
|
83
86
|
renderRangeInput(rangeProps: DateInputProps): JSX.Element;
|
|
87
|
+
isRenderMultipleInputs(): boolean;
|
|
84
88
|
renderInputInset(): JSX.Element;
|
|
85
89
|
renderTriggerInput(): JSX.Element;
|
|
86
90
|
render(): JSX.Element;
|
|
@@ -264,6 +264,14 @@ export default class DateInput extends BaseComponent {
|
|
|
264
264
|
})), this.renderRangeClearBtn(rangeStart, rangeEnd), this.renderRangeSuffix(suffix));
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
isRenderMultipleInputs() {
|
|
268
|
+
const {
|
|
269
|
+
type
|
|
270
|
+
} = this.props; // isRange and not monthRange render multiple inputs
|
|
271
|
+
|
|
272
|
+
return type.includes('Range') && type !== 'monthRange';
|
|
273
|
+
}
|
|
274
|
+
|
|
267
275
|
renderInputInset() {
|
|
268
276
|
const {
|
|
269
277
|
type,
|
|
@@ -277,9 +285,6 @@ export default class DateInput extends BaseComponent {
|
|
|
277
285
|
density,
|
|
278
286
|
insetInput
|
|
279
287
|
} = this.props;
|
|
280
|
-
|
|
281
|
-
const _isRangeType = type.includes('Range');
|
|
282
|
-
|
|
283
288
|
const newInsetInputValue = this.foundation.getInsetInputValue({
|
|
284
289
|
value,
|
|
285
290
|
insetInputValue
|
|
@@ -316,7 +321,7 @@ export default class DateInput extends BaseComponent {
|
|
|
316
321
|
valuePath: 'monthLeft.timeInput',
|
|
317
322
|
onChange: this.handleInsetInputChange,
|
|
318
323
|
onFocus: handleInsetTimeFocus
|
|
319
|
-
}),
|
|
324
|
+
}), this.isRenderMultipleInputs() && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
320
325
|
className: separatorCls
|
|
321
326
|
}, density === 'compact' ? null : '-'), /*#__PURE__*/React.createElement(InsetDateInput, {
|
|
322
327
|
forwardRef: rangeInputEndRef,
|
|
@@ -361,6 +366,7 @@ export default class DateInput extends BaseComponent {
|
|
|
361
366
|
prefix,
|
|
362
367
|
autofocus,
|
|
363
368
|
size,
|
|
369
|
+
inputRef,
|
|
364
370
|
// range input support props, no need passing to not range type
|
|
365
371
|
rangeInputStartRef,
|
|
366
372
|
rangeInputEndRef,
|
|
@@ -373,7 +379,7 @@ export default class DateInput extends BaseComponent {
|
|
|
373
379
|
insetInputValue,
|
|
374
380
|
defaultPickerValue
|
|
375
381
|
} = _a,
|
|
376
|
-
rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator", "insetInput", "insetInputValue", "defaultPickerValue"]);
|
|
382
|
+
rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "inputRef", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator", "insetInput", "insetInputValue", "defaultPickerValue"]);
|
|
377
383
|
|
|
378
384
|
const dateIcon = /*#__PURE__*/React.createElement(IconCalendar, {
|
|
379
385
|
"aria-hidden": true
|
|
@@ -391,22 +397,23 @@ export default class DateInput extends BaseComponent {
|
|
|
391
397
|
}
|
|
392
398
|
|
|
393
399
|
const inputCls = cls({
|
|
394
|
-
[`${prefixCls}-input-readonly`]: inputReadOnly
|
|
400
|
+
[`${prefixCls}-input-readonly`]: inputReadOnly,
|
|
401
|
+
[`${prefixCls}-monthRange-input`]: type === 'monthRange'
|
|
395
402
|
});
|
|
396
|
-
const isRangeType = /range/i.test(type);
|
|
397
403
|
const rangeProps = Object.assign(Object.assign({}, this.props), {
|
|
398
404
|
text,
|
|
399
405
|
suffix,
|
|
400
406
|
inputCls
|
|
401
407
|
});
|
|
402
|
-
return
|
|
408
|
+
return this.isRenderMultipleInputs() ? this.renderRangeInput(rangeProps) : /*#__PURE__*/React.createElement(Input, Object.assign({}, rest, {
|
|
409
|
+
ref: inputRef,
|
|
403
410
|
insetLabel: insetLabel,
|
|
404
411
|
disabled: disabled,
|
|
405
412
|
readonly: inputReadOnly,
|
|
406
413
|
className: inputCls,
|
|
407
414
|
style: inputStyle,
|
|
408
415
|
hideSuffix: showClear,
|
|
409
|
-
placeholder: placeholder,
|
|
416
|
+
placeholder: type === 'monthRange' && Array.isArray(placeholder) ? placeholder[0] + rangeSeparator + placeholder[1] : placeholder,
|
|
410
417
|
onEnterPress: this.handleEnterPress,
|
|
411
418
|
onChange: this.handleChange,
|
|
412
419
|
onClear: this.handleInputClear,
|
|
@@ -28,10 +28,21 @@ export interface DatePickerProps extends DatePickerFoundationProps {
|
|
|
28
28
|
renderDate?: (dayNumber?: number, fullDate?: string) => React.ReactNode;
|
|
29
29
|
renderFullDate?: (dayNumber?: number, fullDate?: string, dayStatus?: DayStatusType) => React.ReactNode;
|
|
30
30
|
triggerRender?: (props: DatePickerProps) => React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* There are multiple input boxes when selecting a range, and the input boxes will be out of focus multiple times.
|
|
33
|
+
*
|
|
34
|
+
* Use `onOpenChange` or `onClickOutSide` instead
|
|
35
|
+
*/
|
|
31
36
|
onBlur?: React.MouseEventHandler<HTMLInputElement>;
|
|
32
37
|
onClear?: React.MouseEventHandler<HTMLDivElement>;
|
|
38
|
+
/**
|
|
39
|
+
* There are multiple input boxes when selecting a range, and the input boxes will be focused multiple times.
|
|
40
|
+
*
|
|
41
|
+
* Use `onOpenChange` or `triggerRender` instead
|
|
42
|
+
*/
|
|
33
43
|
onFocus?: (e: React.MouseEvent, rangeType: RangeType) => void;
|
|
34
44
|
onPresetClick?: (item: PresetType, e: React.MouseEvent<HTMLDivElement>) => void;
|
|
45
|
+
onClickOutSide?: () => void;
|
|
35
46
|
locale?: Locale['DatePicker'];
|
|
36
47
|
dateFnsLocale?: Locale['dateFnsLocale'];
|
|
37
48
|
yearAndMonthOpts?: ScrollItemProps<any>;
|
|
@@ -46,7 +57,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
46
57
|
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
47
58
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
48
59
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
49
|
-
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "dateTimeRange">;
|
|
60
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
50
61
|
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
51
62
|
clearIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
52
63
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
@@ -113,6 +124,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
113
124
|
rangeSeparator: PropTypes.Requireable<string>;
|
|
114
125
|
preventScroll: PropTypes.Requireable<boolean>;
|
|
115
126
|
yearAndMonthOpts: PropTypes.Requireable<object>;
|
|
127
|
+
onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
128
|
};
|
|
117
129
|
static defaultProps: {
|
|
118
130
|
onChangeWithDateFirst: boolean;
|
|
@@ -155,12 +167,14 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
155
167
|
syncSwitchMonth: boolean;
|
|
156
168
|
rangeSeparator: " ~ ";
|
|
157
169
|
insetInput: boolean;
|
|
170
|
+
onClickOutSide: (...args: any[]) => void;
|
|
158
171
|
};
|
|
159
172
|
triggerElRef: React.MutableRefObject<HTMLElement>;
|
|
160
173
|
panelRef: React.RefObject<HTMLDivElement>;
|
|
161
174
|
monthGrid: React.RefObject<MonthsGrid>;
|
|
162
|
-
|
|
163
|
-
|
|
175
|
+
inputRef: DateInputProps['inputRef'];
|
|
176
|
+
rangeInputStartRef: DateInputProps['rangeInputStartRef'];
|
|
177
|
+
rangeInputEndRef: DateInputProps['rangeInputEndRef'];
|
|
164
178
|
focusRecordsRef: React.RefObject<{
|
|
165
179
|
rangeStart: boolean;
|
|
166
180
|
rangeEnd: boolean;
|
|
@@ -175,6 +189,20 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
175
189
|
componentDidUpdate(prevProps: DatePickerProps): void;
|
|
176
190
|
componentDidMount(): void;
|
|
177
191
|
componentWillUnmount(): void;
|
|
192
|
+
open(): void;
|
|
193
|
+
close(): void;
|
|
194
|
+
/**
|
|
195
|
+
*
|
|
196
|
+
* When selecting a range, the default focus is on the start input box, passing in `rangeEnd` can focus on the end input box
|
|
197
|
+
*
|
|
198
|
+
* When `insetInput` is `true`, due to trigger disabled, the cursor will focus on the input box of the popup layer panel
|
|
199
|
+
*
|
|
200
|
+
* 范围选择时,默认聚焦在开始输入框,传入 `rangeEnd` 可以聚焦在结束输入框
|
|
201
|
+
*
|
|
202
|
+
* `insetInput` 打开时,由于 trigger 禁用,会把焦点放在弹出面板的输入框上
|
|
203
|
+
*/
|
|
204
|
+
focus(focusType?: Exclude<RangeType, false>): void;
|
|
205
|
+
blur(): void;
|
|
178
206
|
setTriggerRef: (node: HTMLDivElement) => HTMLDivElement;
|
|
179
207
|
handleSelectedChange: MonthsGridProps['onChange'];
|
|
180
208
|
handleYMSelectedChange: YearAndMonthProps['onSelect'];
|
|
@@ -199,7 +227,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
199
227
|
handleInsetDateFocus: (e: React.FocusEvent, rangeType: 'rangeStart' | 'rangeEnd') => void;
|
|
200
228
|
handleInsetTimeFocus: () => void;
|
|
201
229
|
handlePanelVisibleChange: (visible: boolean) => void;
|
|
202
|
-
renderInner(
|
|
230
|
+
renderInner(): JSX.Element;
|
|
203
231
|
handleConfirm: (e: React.MouseEvent) => void;
|
|
204
232
|
handleCancel: (e: React.MouseEvent) => void;
|
|
205
233
|
renderFooter: (locale: Locale['DatePicker'], localeCode: string) => JSX.Element;
|
|
@@ -143,7 +143,8 @@ export default class DatePicker extends BaseComponent {
|
|
|
143
143
|
density,
|
|
144
144
|
topSlot,
|
|
145
145
|
bottomSlot,
|
|
146
|
-
presetPosition
|
|
146
|
+
presetPosition,
|
|
147
|
+
type
|
|
147
148
|
} = this.props;
|
|
148
149
|
const wrapCls = classnames(cssClasses.PREFIX, {
|
|
149
150
|
[cssClasses.PANEL_YAM]: this.adapter.typeIsYearOrMonth(),
|
|
@@ -152,11 +153,12 @@ export default class DatePicker extends BaseComponent {
|
|
|
152
153
|
return /*#__PURE__*/React.createElement("div", {
|
|
153
154
|
ref: this.panelRef,
|
|
154
155
|
className: wrapCls,
|
|
155
|
-
style: dropdownStyle
|
|
156
|
+
style: dropdownStyle,
|
|
157
|
+
"x-type": type
|
|
156
158
|
}, topSlot && /*#__PURE__*/React.createElement("div", {
|
|
157
159
|
className: `${cssClasses.PREFIX}-topSlot`,
|
|
158
160
|
"x-semi-prop": "topSlot"
|
|
159
|
-
}, 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", {
|
|
161
|
+
}, topSlot), presetPosition === "top" && type !== 'monthRange' && this.renderQuickControls(), this.adapter.typeIsYearOrMonth() ? this.renderYearMonthPanel(locale, localeCode) : this.renderMonthGrid(locale, localeCode, dateFnsLocale), presetPosition === "bottom" && type !== 'monthRange' && this.renderQuickControls(), bottomSlot && /*#__PURE__*/React.createElement("div", {
|
|
160
162
|
className: `${cssClasses.PREFIX}-bottomSlot`,
|
|
161
163
|
"x-semi-prop": "bottomSlot"
|
|
162
164
|
}, bottomSlot), this.renderFooter(locale, localeCode));
|
|
@@ -166,15 +168,31 @@ export default class DatePicker extends BaseComponent {
|
|
|
166
168
|
const {
|
|
167
169
|
density,
|
|
168
170
|
presetPosition,
|
|
169
|
-
yearAndMonthOpts
|
|
171
|
+
yearAndMonthOpts,
|
|
172
|
+
type
|
|
170
173
|
} = this.props;
|
|
171
174
|
const date = this.state.value[0];
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
const year = {
|
|
176
|
+
left: 0,
|
|
177
|
+
right: 0
|
|
178
|
+
};
|
|
179
|
+
const month = {
|
|
180
|
+
left: 0,
|
|
181
|
+
right: 0
|
|
182
|
+
};
|
|
174
183
|
|
|
175
184
|
if (_isDate(date)) {
|
|
176
|
-
year = date.getFullYear();
|
|
177
|
-
month = date.getMonth() + 1;
|
|
185
|
+
year.left = date.getFullYear();
|
|
186
|
+
month.left = date.getMonth() + 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (type === 'monthRange') {
|
|
190
|
+
const dateRight = this.state.value[1];
|
|
191
|
+
|
|
192
|
+
if (_isDate(dateRight)) {
|
|
193
|
+
year.right = dateRight.getFullYear();
|
|
194
|
+
month.right = dateRight.getMonth() + 1;
|
|
195
|
+
}
|
|
178
196
|
}
|
|
179
197
|
|
|
180
198
|
return /*#__PURE__*/React.createElement(YearAndMonth, {
|
|
@@ -190,6 +208,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
190
208
|
presetPosition: presetPosition,
|
|
191
209
|
renderQuickControls: this.renderQuickControls(),
|
|
192
210
|
renderDateInput: this.renderDateInput(),
|
|
211
|
+
type: type,
|
|
193
212
|
yearAndMonthOpts: yearAndMonthOpts
|
|
194
213
|
});
|
|
195
214
|
};
|
|
@@ -249,6 +268,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
249
268
|
this.triggerElRef = /*#__PURE__*/React.createRef();
|
|
250
269
|
this.panelRef = /*#__PURE__*/React.createRef();
|
|
251
270
|
this.monthGrid = /*#__PURE__*/React.createRef();
|
|
271
|
+
this.inputRef = /*#__PURE__*/React.createRef();
|
|
252
272
|
this.rangeInputStartRef = /*#__PURE__*/React.createRef();
|
|
253
273
|
this.rangeInputEndRef = /*#__PURE__*/React.createRef();
|
|
254
274
|
this.focusRecordsRef = /*#__PURE__*/React.createRef(); // @ts-ignore ignore readonly
|
|
@@ -264,10 +284,10 @@ export default class DatePicker extends BaseComponent {
|
|
|
264
284
|
var _this2 = this;
|
|
265
285
|
|
|
266
286
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
267
|
-
togglePanel: panelShow => {
|
|
287
|
+
togglePanel: (panelShow, cb) => {
|
|
268
288
|
this.setState({
|
|
269
289
|
panelShow
|
|
270
|
-
});
|
|
290
|
+
}, cb);
|
|
271
291
|
|
|
272
292
|
if (!panelShow) {
|
|
273
293
|
this.focusRecordsRef.current.rangeEnd = false;
|
|
@@ -281,17 +301,20 @@ export default class DatePicker extends BaseComponent {
|
|
|
281
301
|
}
|
|
282
302
|
|
|
283
303
|
this.clickOutSideHandler = e => {
|
|
284
|
-
if (this.adapter.needConfirm()) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
304
|
const triggerEl = this.triggerElRef && this.triggerElRef.current;
|
|
289
305
|
const panelEl = this.panelRef && this.panelRef.current;
|
|
290
306
|
const isInTrigger = triggerEl && triggerEl.contains(e.target);
|
|
291
307
|
const isInPanel = panelEl && panelEl.contains(e.target);
|
|
308
|
+
const clickOutSide = !isInTrigger && !isInPanel && this._mounted;
|
|
292
309
|
|
|
293
|
-
if (
|
|
294
|
-
this.
|
|
310
|
+
if (this.adapter.needConfirm()) {
|
|
311
|
+
clickOutSide && this.props.onClickOutSide();
|
|
312
|
+
return;
|
|
313
|
+
} else {
|
|
314
|
+
if (clickOutSide) {
|
|
315
|
+
this.props.onClickOutSide();
|
|
316
|
+
this.foundation.closePanel(e);
|
|
317
|
+
}
|
|
295
318
|
}
|
|
296
319
|
};
|
|
297
320
|
|
|
@@ -358,7 +381,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
358
381
|
}
|
|
359
382
|
},
|
|
360
383
|
needConfirm: () => ['dateTime', 'dateTimeRange'].includes(this.props.type) && this.props.needConfirm === true,
|
|
361
|
-
typeIsYearOrMonth: () => ['month', 'year'].includes(this.props.type),
|
|
384
|
+
typeIsYearOrMonth: () => ['month', 'year', 'monthRange'].includes(this.props.type),
|
|
362
385
|
setRangeInputFocus: rangeInputFocus => {
|
|
363
386
|
const {
|
|
364
387
|
preventScroll
|
|
@@ -460,6 +483,39 @@ export default class DatePicker extends BaseComponent {
|
|
|
460
483
|
break;
|
|
461
484
|
}
|
|
462
485
|
},
|
|
486
|
+
setInputFocus: () => {
|
|
487
|
+
const {
|
|
488
|
+
preventScroll
|
|
489
|
+
} = this.props;
|
|
490
|
+
|
|
491
|
+
const inputNode = _get(this, 'inputRef.current');
|
|
492
|
+
|
|
493
|
+
inputNode && inputNode.focus({
|
|
494
|
+
preventScroll
|
|
495
|
+
});
|
|
496
|
+
},
|
|
497
|
+
setInputBlur: () => {
|
|
498
|
+
const inputNode = _get(this, 'inputRef.current');
|
|
499
|
+
|
|
500
|
+
inputNode && inputNode.blur();
|
|
501
|
+
},
|
|
502
|
+
setRangeInputBlur: () => {
|
|
503
|
+
const {
|
|
504
|
+
rangeInputFocus
|
|
505
|
+
} = this.state;
|
|
506
|
+
|
|
507
|
+
if (rangeInputFocus === 'rangeStart') {
|
|
508
|
+
const inputStartNode = _get(this, 'rangeInputStartRef.current');
|
|
509
|
+
|
|
510
|
+
inputStartNode && inputStartNode.blur();
|
|
511
|
+
} else if (rangeInputFocus === 'rangeEnd') {
|
|
512
|
+
const inputEndNode = _get(this, 'rangeInputEndRef.current');
|
|
513
|
+
|
|
514
|
+
inputEndNode && inputEndNode.blur();
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
this.adapter.setRangeInputFocus(false);
|
|
518
|
+
},
|
|
463
519
|
setTriggerDisabled: disabled => {
|
|
464
520
|
this.setState({
|
|
465
521
|
triggerDisabled: disabled
|
|
@@ -502,6 +558,33 @@ export default class DatePicker extends BaseComponent {
|
|
|
502
558
|
super.componentWillUnmount();
|
|
503
559
|
}
|
|
504
560
|
|
|
561
|
+
open() {
|
|
562
|
+
this.foundation.open();
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
close() {
|
|
566
|
+
this.foundation.close();
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
*
|
|
570
|
+
* When selecting a range, the default focus is on the start input box, passing in `rangeEnd` can focus on the end input box
|
|
571
|
+
*
|
|
572
|
+
* When `insetInput` is `true`, due to trigger disabled, the cursor will focus on the input box of the popup layer panel
|
|
573
|
+
*
|
|
574
|
+
* 范围选择时,默认聚焦在开始输入框,传入 `rangeEnd` 可以聚焦在结束输入框
|
|
575
|
+
*
|
|
576
|
+
* `insetInput` 打开时,由于 trigger 禁用,会把焦点放在弹出面板的输入框上
|
|
577
|
+
*/
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
focus(focusType) {
|
|
581
|
+
this.foundation.focus(focusType);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
blur() {
|
|
585
|
+
this.foundation.blur();
|
|
586
|
+
}
|
|
587
|
+
|
|
505
588
|
renderMonthGrid(locale, localeCode, dateFnsLocale) {
|
|
506
589
|
const {
|
|
507
590
|
type,
|
|
@@ -623,7 +706,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
623
706
|
})) : null;
|
|
624
707
|
}
|
|
625
708
|
|
|
626
|
-
renderInner(
|
|
709
|
+
renderInner() {
|
|
627
710
|
const {
|
|
628
711
|
clearIcon,
|
|
629
712
|
type,
|
|
@@ -665,7 +748,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
665
748
|
const phText = placeholder || locale.placeholder[type]; // i18n
|
|
666
749
|
// These values should be passed to triggerRender, do not delete any key if it is not necessary
|
|
667
750
|
|
|
668
|
-
const props =
|
|
751
|
+
const props = {
|
|
669
752
|
placeholder: phText,
|
|
670
753
|
clearIcon,
|
|
671
754
|
disabled: inputDisabled,
|
|
@@ -699,8 +782,9 @@ export default class DatePicker extends BaseComponent {
|
|
|
699
782
|
onRangeClear: this.handleRangeInputClear,
|
|
700
783
|
onRangeEndTabPress: this.handleRangeEndTabPress,
|
|
701
784
|
rangeInputStartRef: insetInput ? null : this.rangeInputStartRef,
|
|
702
|
-
rangeInputEndRef: insetInput ? null : this.rangeInputEndRef
|
|
703
|
-
|
|
785
|
+
rangeInputEndRef: insetInput ? null : this.rangeInputEndRef,
|
|
786
|
+
inputRef: this.inputRef
|
|
787
|
+
};
|
|
704
788
|
return /*#__PURE__*/React.createElement("div", {
|
|
705
789
|
// tooltip will mount a11y props to children
|
|
706
790
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
@@ -815,7 +899,8 @@ DatePicker.propTypes = {
|
|
|
815
899
|
onPanelChange: PropTypes.func,
|
|
816
900
|
rangeSeparator: PropTypes.string,
|
|
817
901
|
preventScroll: PropTypes.bool,
|
|
818
|
-
yearAndMonthOpts: PropTypes.object
|
|
902
|
+
yearAndMonthOpts: PropTypes.object,
|
|
903
|
+
onClickOutSide: PropTypes.func
|
|
819
904
|
};
|
|
820
905
|
DatePicker.defaultProps = {
|
|
821
906
|
onChangeWithDateFirst: true,
|
|
@@ -852,5 +937,6 @@ DatePicker.defaultProps = {
|
|
|
852
937
|
autoSwitchDate: true,
|
|
853
938
|
syncSwitchMonth: false,
|
|
854
939
|
rangeSeparator: strings.DEFAULT_SEPARATOR_RANGE,
|
|
855
|
-
insetInput: false
|
|
940
|
+
insetInput: false,
|
|
941
|
+
onClickOutSide: _noop
|
|
856
942
|
};
|
|
@@ -8,5 +8,6 @@ export type { MonthsGridProps } from './monthsGrid';
|
|
|
8
8
|
export type { QuickControlProps } from './quickControl';
|
|
9
9
|
export type { YearAndMonthProps } from './yearAndMonth';
|
|
10
10
|
export type { InsetInputProps } from '@douyinfe/semi-foundation/lib/es/datePicker/inputFoundation';
|
|
11
|
+
export type { DatePicker as BaseDatePicker };
|
|
11
12
|
declare const _default: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<DatePicker>>;
|
|
12
13
|
export default _default;
|
|
@@ -19,7 +19,7 @@ export interface MonthsGridProps extends MonthsGridFoundationProps, BaseProps {
|
|
|
19
19
|
export declare type MonthsGridState = MonthsGridFoundationState;
|
|
20
20
|
export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGridState> {
|
|
21
21
|
static propTypes: {
|
|
22
|
-
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "dateTimeRange">;
|
|
22
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
23
23
|
defaultValue: PropTypes.Requireable<any[]>;
|
|
24
24
|
defaultPickerValue: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
25
25
|
multiple: PropTypes.Requireable<boolean>;
|
|
@@ -482,9 +482,17 @@ export default class MonthsGrid extends BaseComponent {
|
|
|
482
482
|
ref: current => this.cacheRefCurrent(`yam-${panelType}`, current),
|
|
483
483
|
locale: locale,
|
|
484
484
|
localeCode: localeCode,
|
|
485
|
-
currentYear
|
|
486
|
-
currentMonth
|
|
487
|
-
|
|
485
|
+
// currentYear={y}
|
|
486
|
+
// currentMonth={m}
|
|
487
|
+
currentYear: {
|
|
488
|
+
left: y,
|
|
489
|
+
right: 0
|
|
490
|
+
},
|
|
491
|
+
currentMonth: {
|
|
492
|
+
left: m,
|
|
493
|
+
right: 0
|
|
494
|
+
},
|
|
495
|
+
onSelect: item => this.foundation.toYearMonth(panelType, new Date(item.currentYear.left, item.currentMonth.left - 1)),
|
|
488
496
|
onBackToMain: () => {
|
|
489
497
|
this.foundation.showDatePanel(panelType);
|
|
490
498
|
const wrapCurrent = this.adapter.getCache(`wrap-${panelType}`);
|