@douyinfe/semi-ui 2.36.0 → 2.37.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 +39 -1
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +850 -503
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_base/baseComponent.d.ts +1 -0
- package/lib/cjs/_base/baseComponent.js +4 -0
- package/lib/cjs/anchor/index.js +2 -2
- package/lib/cjs/autoComplete/index.js +2 -2
- package/lib/cjs/banner/index.js +2 -2
- package/lib/cjs/breadcrumb/index.js +2 -2
- package/lib/cjs/breadcrumb/item.js +1 -1
- package/lib/cjs/calendar/dayCalendar.js +2 -2
- package/lib/cjs/calendar/monthCalendar.js +2 -2
- package/lib/cjs/calendar/rangeCalendar.js +2 -2
- package/lib/cjs/calendar/weekCalendar.d.ts +1 -1
- package/lib/cjs/calendar/weekCalendar.js +2 -2
- package/lib/cjs/carousel/index.js +2 -2
- package/lib/cjs/cascader/index.js +1 -1
- package/lib/cjs/checkbox/checkbox.js +2 -2
- package/lib/cjs/checkbox/checkboxGroup.js +2 -2
- package/lib/cjs/collapse/index.js +2 -2
- package/lib/cjs/collapsible/index.js +2 -2
- package/lib/cjs/datePicker/dateInput.d.ts +1 -0
- package/lib/cjs/datePicker/dateInput.js +10 -6
- package/lib/cjs/datePicker/datePicker.js +23 -11
- package/lib/cjs/datePicker/quickControl.d.ts +2 -0
- package/lib/cjs/datePicker/quickControl.js +5 -3
- package/lib/cjs/descriptions/index.js +22 -11
- package/lib/cjs/descriptions/item.js +22 -11
- package/lib/cjs/empty/index.js +23 -13
- package/lib/cjs/input/index.d.ts +3 -1
- package/lib/cjs/input/index.js +19 -16
- package/lib/cjs/list/index.js +30 -20
- package/lib/cjs/list/item.js +18 -15
- package/lib/cjs/locale/interface.d.ts +1 -0
- package/lib/cjs/locale/source/ar.js +1 -0
- package/lib/cjs/locale/source/de.js +1 -0
- package/lib/cjs/locale/source/en_GB.js +1 -0
- package/lib/cjs/locale/source/en_US.js +1 -0
- package/lib/cjs/locale/source/es.js +1 -0
- package/lib/cjs/locale/source/fr.js +1 -0
- package/lib/cjs/locale/source/id_ID.js +1 -0
- package/lib/cjs/locale/source/it.js +1 -0
- package/lib/cjs/locale/source/ja_JP.js +1 -0
- package/lib/cjs/locale/source/ko_KR.js +1 -0
- package/lib/cjs/locale/source/ms_MY.js +1 -0
- package/lib/cjs/locale/source/nl_NL.js +1 -0
- package/lib/cjs/locale/source/pl_PL.js +1 -0
- package/lib/cjs/locale/source/pt_BR.js +1 -0
- package/lib/cjs/locale/source/ro.d.ts +1 -0
- package/lib/cjs/locale/source/ro.js +1 -0
- package/lib/cjs/locale/source/ru_RU.js +1 -0
- package/lib/cjs/locale/source/sv_SE.js +1 -0
- package/lib/cjs/locale/source/th_TH.js +1 -0
- package/lib/cjs/locale/source/tr_TR.js +1 -0
- package/lib/cjs/locale/source/vi_VN.js +1 -0
- package/lib/cjs/locale/source/zh_CN.js +1 -0
- package/lib/cjs/locale/source/zh_TW.js +1 -0
- package/lib/cjs/modal/ModalContent.js +12 -9
- package/lib/cjs/navigation/index.js +34 -24
- package/lib/cjs/pagination/index.d.ts +3 -0
- package/lib/cjs/pagination/index.js +73 -39
- package/lib/cjs/progress/index.js +44 -31
- package/lib/cjs/radio/radio.js +27 -17
- package/lib/cjs/radio/radioGroup.js +24 -14
- package/lib/cjs/rating/index.js +21 -11
- package/lib/cjs/scrollList/index.js +21 -11
- package/lib/cjs/select/index.js +30 -21
- package/lib/cjs/sideSheet/SideSheetContent.js +27 -7
- package/lib/cjs/slider/index.js +20 -11
- package/lib/cjs/spin/index.js +19 -9
- package/lib/cjs/steps/basicSteps.js +24 -14
- package/lib/cjs/steps/fillSteps.js +22 -12
- package/lib/cjs/steps/navSteps.js +21 -11
- package/lib/cjs/switch/index.js +23 -13
- package/lib/cjs/table/Table.d.ts +1 -0
- package/lib/cjs/table/Table.js +3 -2
- package/lib/cjs/tabs/index.js +1 -2
- package/lib/cjs/tagInput/index.js +20 -10
- package/lib/cjs/timeline/index.js +20 -9
- package/lib/cjs/timeline/item.js +24 -13
- package/lib/cjs/toast/index.d.ts +4 -0
- package/lib/cjs/tooltip/index.js +3 -1
- package/lib/cjs/transfer/index.js +19 -9
- package/lib/cjs/tree/index.js +32 -22
- package/lib/cjs/treeSelect/index.js +32 -20
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/index.js +28 -18
- package/lib/es/_base/baseComponent.d.ts +1 -0
- package/lib/es/_base/baseComponent.js +4 -0
- package/lib/es/anchor/index.js +2 -2
- package/lib/es/autoComplete/index.js +2 -2
- package/lib/es/banner/index.js +2 -2
- package/lib/es/breadcrumb/index.js +2 -2
- package/lib/es/breadcrumb/item.js +1 -1
- package/lib/es/calendar/dayCalendar.js +2 -2
- package/lib/es/calendar/monthCalendar.js +2 -2
- package/lib/es/calendar/rangeCalendar.js +2 -2
- package/lib/es/calendar/weekCalendar.d.ts +1 -1
- package/lib/es/calendar/weekCalendar.js +2 -2
- package/lib/es/carousel/index.js +2 -2
- package/lib/es/cascader/index.js +1 -1
- package/lib/es/checkbox/checkbox.js +2 -2
- package/lib/es/checkbox/checkboxGroup.js +2 -2
- package/lib/es/collapse/index.js +2 -2
- package/lib/es/collapsible/index.js +2 -2
- package/lib/es/datePicker/dateInput.d.ts +1 -0
- package/lib/es/datePicker/dateInput.js +10 -6
- package/lib/es/datePicker/datePicker.js +23 -10
- package/lib/es/datePicker/quickControl.d.ts +2 -0
- package/lib/es/datePicker/quickControl.js +5 -3
- package/lib/es/descriptions/index.js +22 -11
- package/lib/es/descriptions/item.js +22 -11
- package/lib/es/empty/index.js +23 -13
- package/lib/es/input/index.d.ts +3 -1
- package/lib/es/input/index.js +19 -16
- package/lib/es/list/index.js +30 -20
- package/lib/es/list/item.js +18 -15
- package/lib/es/locale/interface.d.ts +1 -0
- package/lib/es/locale/source/ar.js +1 -0
- package/lib/es/locale/source/de.js +1 -0
- package/lib/es/locale/source/en_GB.js +1 -0
- package/lib/es/locale/source/en_US.js +1 -0
- package/lib/es/locale/source/es.js +1 -0
- package/lib/es/locale/source/fr.js +1 -0
- package/lib/es/locale/source/id_ID.js +1 -0
- package/lib/es/locale/source/it.js +1 -0
- package/lib/es/locale/source/ja_JP.js +1 -0
- package/lib/es/locale/source/ko_KR.js +1 -0
- package/lib/es/locale/source/ms_MY.js +1 -0
- package/lib/es/locale/source/nl_NL.js +1 -0
- package/lib/es/locale/source/pl_PL.js +1 -0
- package/lib/es/locale/source/pt_BR.js +1 -0
- package/lib/es/locale/source/ro.d.ts +1 -0
- package/lib/es/locale/source/ro.js +1 -0
- package/lib/es/locale/source/ru_RU.js +1 -0
- package/lib/es/locale/source/sv_SE.js +1 -0
- package/lib/es/locale/source/th_TH.js +1 -0
- package/lib/es/locale/source/tr_TR.js +1 -0
- package/lib/es/locale/source/vi_VN.js +1 -0
- package/lib/es/locale/source/zh_CN.js +1 -0
- package/lib/es/locale/source/zh_TW.js +1 -0
- package/lib/es/modal/ModalContent.js +12 -9
- package/lib/es/navigation/index.js +34 -24
- package/lib/es/pagination/index.d.ts +3 -0
- package/lib/es/pagination/index.js +73 -38
- package/lib/es/progress/index.js +44 -31
- package/lib/es/radio/radio.js +27 -17
- package/lib/es/radio/radioGroup.js +24 -14
- package/lib/es/rating/index.js +21 -11
- package/lib/es/scrollList/index.js +21 -11
- package/lib/es/select/index.js +30 -20
- package/lib/es/sideSheet/SideSheetContent.js +27 -7
- package/lib/es/slider/index.js +20 -10
- package/lib/es/spin/index.js +19 -9
- package/lib/es/steps/basicSteps.js +24 -14
- package/lib/es/steps/fillSteps.js +22 -12
- package/lib/es/steps/navSteps.js +21 -11
- package/lib/es/switch/index.js +23 -13
- package/lib/es/table/Table.d.ts +1 -0
- package/lib/es/table/Table.js +3 -2
- package/lib/es/tabs/index.js +1 -2
- package/lib/es/tagInput/index.js +20 -10
- package/lib/es/timeline/index.js +20 -9
- package/lib/es/timeline/item.js +24 -13
- package/lib/es/toast/index.d.ts +4 -0
- package/lib/es/tooltip/index.js +3 -1
- package/lib/es/transfer/index.js +19 -9
- package/lib/es/tree/index.js +32 -22
- package/lib/es/treeSelect/index.js +32 -20
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/index.js +28 -18
- package/package.json +8 -8
package/lib/es/collapse/index.js
CHANGED
|
@@ -75,10 +75,10 @@ class Collapse extends BaseComponent {
|
|
|
75
75
|
const {
|
|
76
76
|
activeSet
|
|
77
77
|
} = this.state;
|
|
78
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
79
79
|
className: clsPrefix,
|
|
80
80
|
style: style
|
|
81
|
-
}, /*#__PURE__*/React.createElement(CollapseContext.Provider, {
|
|
81
|
+
}, this.getDataAttr(this.props)), /*#__PURE__*/React.createElement(CollapseContext.Provider, {
|
|
82
82
|
value: {
|
|
83
83
|
activeSet,
|
|
84
84
|
expandIcon,
|
|
@@ -107,7 +107,7 @@ class Collapsible extends BaseComponent {
|
|
|
107
107
|
const wrapperCls = cls(`${cssClasses.PREFIX}-wrapper`, {
|
|
108
108
|
[`${cssClasses.PREFIX}-transition`]: this.props.motion && this.state.isTransitioning
|
|
109
109
|
}, this.props.className);
|
|
110
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
111
111
|
className: wrapperCls,
|
|
112
112
|
style: wrapperStyle,
|
|
113
113
|
onTransitionEnd: () => {
|
|
@@ -118,7 +118,7 @@ class Collapsible extends BaseComponent {
|
|
|
118
118
|
this.foundation.updateIsTransitioning(false);
|
|
119
119
|
(_b = (_a = this.props).onMotionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
120
120
|
}
|
|
121
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
}, this.getDataAttr(this.props)), /*#__PURE__*/React.createElement("div", {
|
|
122
122
|
"x-semi-prop": "children",
|
|
123
123
|
ref: this.domRef,
|
|
124
124
|
style: {
|
|
@@ -18,6 +18,7 @@ export interface DateInputProps extends DateInputFoundationProps, BaseProps {
|
|
|
18
18
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
19
19
|
rangeInputStartRef?: React.RefObject<HTMLInputElement>;
|
|
20
20
|
rangeInputEndRef?: React.RefObject<HTMLInputElement>;
|
|
21
|
+
showClearIgnoreDisabled?: boolean;
|
|
21
22
|
}
|
|
22
23
|
export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
23
24
|
static propTypes: {
|
|
@@ -141,15 +141,17 @@ export default class DateInput extends BaseComponent {
|
|
|
141
141
|
showClear,
|
|
142
142
|
prefixCls,
|
|
143
143
|
disabled,
|
|
144
|
-
clearIcon
|
|
144
|
+
clearIcon,
|
|
145
|
+
showClearIgnoreDisabled
|
|
145
146
|
} = this.props;
|
|
146
|
-
const
|
|
147
|
-
|
|
147
|
+
const isRealDisabled = disabled && !showClearIgnoreDisabled;
|
|
148
|
+
const allowClear = (rangeStart || rangeEnd) && showClear && !isRealDisabled;
|
|
149
|
+
return allowClear ? /*#__PURE__*/React.createElement("div", {
|
|
148
150
|
role: "button",
|
|
149
151
|
tabIndex: 0,
|
|
150
152
|
"aria-label": "Clear range input value",
|
|
151
153
|
className: `${prefixCls}-range-input-clearbtn`,
|
|
152
|
-
onMouseDown: e =>
|
|
154
|
+
onMouseDown: e => this.handleRangeInputClear(e)
|
|
153
155
|
}, clearIcon ? clearIcon : /*#__PURE__*/React.createElement(IconClear, {
|
|
154
156
|
"aria-hidden": true
|
|
155
157
|
})) : null;
|
|
@@ -347,9 +349,10 @@ export default class DateInput extends BaseComponent {
|
|
|
347
349
|
rangeSeparator,
|
|
348
350
|
insetInput,
|
|
349
351
|
insetInputValue,
|
|
350
|
-
defaultPickerValue
|
|
352
|
+
defaultPickerValue,
|
|
353
|
+
showClearIgnoreDisabled
|
|
351
354
|
} = _a,
|
|
352
|
-
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"]);
|
|
355
|
+
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", "showClearIgnoreDisabled"]);
|
|
353
356
|
const dateIcon = /*#__PURE__*/React.createElement(IconCalendar, {
|
|
354
357
|
"aria-hidden": true
|
|
355
358
|
});
|
|
@@ -376,6 +379,7 @@ export default class DateInput extends BaseComponent {
|
|
|
376
379
|
ref: inputRef,
|
|
377
380
|
insetLabel: insetLabel,
|
|
378
381
|
disabled: disabled,
|
|
382
|
+
showClearIgnoreDisabled: showClearIgnoreDisabled,
|
|
379
383
|
readonly: inputReadOnly,
|
|
380
384
|
className: inputCls,
|
|
381
385
|
style: inputStyle,
|
|
@@ -5,6 +5,14 @@ import _get from "lodash/get";
|
|
|
5
5
|
import _isDate from "lodash/isDate";
|
|
6
6
|
import _stubFalse from "lodash/stubFalse";
|
|
7
7
|
import _noop from "lodash/noop";
|
|
8
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
9
|
+
var t = {};
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
11
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
12
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
8
16
|
/* eslint-disable jsx-a11y/click-events-have-key-events,jsx-a11y/interactive-supports-focus */
|
|
9
17
|
/* eslint-disable max-len */
|
|
10
18
|
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
@@ -583,14 +591,16 @@ export default class DatePicker extends BaseComponent {
|
|
|
583
591
|
presets,
|
|
584
592
|
type,
|
|
585
593
|
presetPosition,
|
|
586
|
-
insetInput
|
|
594
|
+
insetInput,
|
|
595
|
+
locale
|
|
587
596
|
} = this.props;
|
|
588
597
|
return /*#__PURE__*/React.createElement(QuickControl, {
|
|
589
598
|
type: type,
|
|
590
599
|
presets: presets,
|
|
591
600
|
insetInput: insetInput,
|
|
592
601
|
presetPosition: presetPosition,
|
|
593
|
-
onPresetClick: (item, e) => this.foundation.handlePresetClick(item, e)
|
|
602
|
+
onPresetClick: (item, e) => this.foundation.handlePresetClick(item, e),
|
|
603
|
+
locale: locale
|
|
594
604
|
});
|
|
595
605
|
}
|
|
596
606
|
renderDateInput() {
|
|
@@ -670,6 +680,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
670
680
|
const phText = placeholder || locale.placeholder[type]; // i18n
|
|
671
681
|
// These values should be passed to triggerRender, do not delete any key if it is not necessary
|
|
672
682
|
const props = Object.assign(Object.assign({}, extraProps), {
|
|
683
|
+
showClearIgnoreDisabled: Boolean(insetInput),
|
|
673
684
|
placeholder: phText,
|
|
674
685
|
clearIcon,
|
|
675
686
|
disabled: inputDisabled,
|
|
@@ -721,13 +732,15 @@ export default class DatePicker extends BaseComponent {
|
|
|
721
732
|
})) : /*#__PURE__*/React.createElement(DateInput, Object.assign({}, props)));
|
|
722
733
|
}
|
|
723
734
|
render() {
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
735
|
+
const _a = this.props,
|
|
736
|
+
{
|
|
737
|
+
style,
|
|
738
|
+
className,
|
|
739
|
+
prefixCls,
|
|
740
|
+
type
|
|
741
|
+
} = _a,
|
|
742
|
+
rest = __rest(_a, ["style", "className", "prefixCls", "type"]);
|
|
743
|
+
const outerProps = Object.assign({
|
|
731
744
|
style,
|
|
732
745
|
className: classnames(className, {
|
|
733
746
|
[prefixCls]: true
|
|
@@ -738,7 +751,7 @@ export default class DatePicker extends BaseComponent {
|
|
|
738
751
|
'aria-labelledby': this.props['aria-labelledby'],
|
|
739
752
|
'aria-describedby': this.props['aria-describedby'],
|
|
740
753
|
'aria-required': this.props['aria-required']
|
|
741
|
-
};
|
|
754
|
+
}, this.getDataAttr(rest));
|
|
742
755
|
const innerPropKeys = [];
|
|
743
756
|
if (!type.toLowerCase().includes("range")) {
|
|
744
757
|
innerPropKeys.push("borderless");
|
|
@@ -10,6 +10,7 @@ export interface QuickControlProps {
|
|
|
10
10
|
onPresetClick: (preset: PresetType, e: React.MouseEvent) => void;
|
|
11
11
|
type: string;
|
|
12
12
|
insetInput: DateInputFoundationProps['insetInput'];
|
|
13
|
+
locale: any;
|
|
13
14
|
}
|
|
14
15
|
declare class QuickControl extends PureComponent<QuickControlProps> {
|
|
15
16
|
static propTypes: {
|
|
@@ -18,6 +19,7 @@ declare class QuickControl extends PureComponent<QuickControlProps> {
|
|
|
18
19
|
onPresetClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
20
|
type: PropTypes.Requireable<string>;
|
|
20
21
|
insetInput: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
22
|
+
locale: PropTypes.Requireable<object>;
|
|
21
23
|
};
|
|
22
24
|
static defaultProps: {
|
|
23
25
|
presets: PresetsType;
|
|
@@ -17,7 +17,8 @@ class QuickControl extends PureComponent {
|
|
|
17
17
|
onPresetClick,
|
|
18
18
|
type,
|
|
19
19
|
presetPosition,
|
|
20
|
-
insetInput
|
|
20
|
+
insetInput,
|
|
21
|
+
locale
|
|
21
22
|
} = this.props;
|
|
22
23
|
const isTypeRange = type === 'dateRange' || type === 'dateTimeRange';
|
|
23
24
|
const isPanelTopAndBottom = presetPosition === 'top' || presetPosition === 'bottom';
|
|
@@ -57,7 +58,7 @@ class QuickControl extends PureComponent {
|
|
|
57
58
|
"x-insetinput": insetInput ? "true" : "false"
|
|
58
59
|
}, !isPanelTopAndBottom && /*#__PURE__*/React.createElement("div", {
|
|
59
60
|
className: headerCls
|
|
60
|
-
},
|
|
61
|
+
}, locale.presets), /*#__PURE__*/React.createElement("div", {
|
|
61
62
|
className: contentWrapperCls
|
|
62
63
|
}, /*#__PURE__*/React.createElement("div", {
|
|
63
64
|
className: contentCls
|
|
@@ -84,7 +85,8 @@ QuickControl.propTypes = {
|
|
|
84
85
|
presetPosition: PropTypes.oneOf(strings.PRESET_POSITION_SET),
|
|
85
86
|
onPresetClick: PropTypes.func,
|
|
86
87
|
type: PropTypes.string,
|
|
87
|
-
insetInput: PropTypes.oneOfType([PropTypes.bool, PropTypes.object])
|
|
88
|
+
insetInput: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
89
|
+
locale: PropTypes.object
|
|
88
90
|
};
|
|
89
91
|
QuickControl.defaultProps = {
|
|
90
92
|
presets: [],
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
import _isPlainObject from "lodash/isPlainObject";
|
|
2
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
6
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
2
10
|
import React, { PureComponent } from 'react';
|
|
3
11
|
import cls from 'classnames';
|
|
4
12
|
import PropTypes from 'prop-types';
|
|
5
13
|
import { strings, cssClasses } from '@douyinfe/semi-foundation/lib/es/descriptions/constants';
|
|
6
14
|
import '@douyinfe/semi-foundation/lib/es/descriptions/descriptions.css';
|
|
15
|
+
import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
|
|
7
16
|
import DescriptionsContext from './descriptions-context';
|
|
8
17
|
import Item from './item';
|
|
9
18
|
const prefixCls = cssClasses.PREFIX;
|
|
10
19
|
class Descriptions extends PureComponent {
|
|
11
20
|
render() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const _a = this.props,
|
|
22
|
+
{
|
|
23
|
+
align,
|
|
24
|
+
row,
|
|
25
|
+
size,
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
28
|
+
children,
|
|
29
|
+
data
|
|
30
|
+
} = _a,
|
|
31
|
+
rest = __rest(_a, ["align", "row", "size", "className", "style", "children", "data"]);
|
|
21
32
|
const classNames = cls(prefixCls, className, {
|
|
22
33
|
[`${prefixCls}-${align}`]: !row,
|
|
23
34
|
[`${prefixCls}-double`]: row,
|
|
@@ -28,10 +39,10 @@ class Descriptions extends PureComponent {
|
|
|
28
39
|
}, item, {
|
|
29
40
|
key: index
|
|
30
41
|
}), item.value) : null) : children;
|
|
31
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
32
43
|
className: classNames,
|
|
33
44
|
style: style
|
|
34
|
-
}, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(DescriptionsContext.Provider, {
|
|
45
|
+
}, getDataAttr(rest)), /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(DescriptionsContext.Provider, {
|
|
35
46
|
value: {
|
|
36
47
|
align
|
|
37
48
|
}
|
|
@@ -1,39 +1,50 @@
|
|
|
1
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
1
9
|
import React, { PureComponent } from 'react';
|
|
2
10
|
import PropTypes from 'prop-types';
|
|
3
11
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/descriptions/constants';
|
|
4
12
|
import '@douyinfe/semi-foundation/lib/es/descriptions/descriptions.css';
|
|
13
|
+
import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
|
|
5
14
|
import DescriptionsContext from './descriptions-context';
|
|
6
15
|
const prefixCls = cssClasses.PREFIX;
|
|
7
16
|
const keyCls = `${prefixCls}-key`;
|
|
8
17
|
const valCls = `${prefixCls}-value`;
|
|
9
18
|
export default class Item extends PureComponent {
|
|
10
19
|
render() {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const _a = this.props,
|
|
21
|
+
{
|
|
22
|
+
itemKey,
|
|
23
|
+
hidden,
|
|
24
|
+
className,
|
|
25
|
+
style,
|
|
26
|
+
children
|
|
27
|
+
} = _a,
|
|
28
|
+
rest = __rest(_a, ["itemKey", "hidden", "className", "style", "children"]);
|
|
18
29
|
const {
|
|
19
30
|
align
|
|
20
31
|
} = this.context;
|
|
21
32
|
if (hidden) {
|
|
22
33
|
return null;
|
|
23
34
|
}
|
|
24
|
-
const item = align === 'plain' ? /*#__PURE__*/React.createElement("tr", {
|
|
35
|
+
const item = align === 'plain' ? /*#__PURE__*/React.createElement("tr", Object.assign({
|
|
25
36
|
className: className,
|
|
26
37
|
style: style
|
|
27
|
-
}, /*#__PURE__*/React.createElement("td", {
|
|
38
|
+
}, getDataAttr(rest)), /*#__PURE__*/React.createElement("td", {
|
|
28
39
|
className: `${prefixCls}-item`
|
|
29
40
|
}, /*#__PURE__*/React.createElement("span", {
|
|
30
41
|
className: keyCls
|
|
31
42
|
}, itemKey, ":"), /*#__PURE__*/React.createElement("span", {
|
|
32
43
|
className: valCls
|
|
33
|
-
}, typeof children === 'function' ? children() : children))) : /*#__PURE__*/React.createElement("tr", {
|
|
44
|
+
}, typeof children === 'function' ? children() : children))) : /*#__PURE__*/React.createElement("tr", Object.assign({
|
|
34
45
|
className: className,
|
|
35
46
|
style: style
|
|
36
|
-
}, /*#__PURE__*/React.createElement("th", {
|
|
47
|
+
}, getDataAttr(rest)), /*#__PURE__*/React.createElement("th", {
|
|
37
48
|
className: `${prefixCls}-item ${prefixCls}-item-th`
|
|
38
49
|
}, /*#__PURE__*/React.createElement("span", {
|
|
39
50
|
className: keyCls
|
package/lib/es/empty/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
1
9
|
import React from 'react';
|
|
2
10
|
import cls from 'classnames';
|
|
3
11
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/empty/constants';
|
|
@@ -44,17 +52,19 @@ export default class Empty extends BaseComponent {
|
|
|
44
52
|
this.observer && this.observer.disconnect();
|
|
45
53
|
}
|
|
46
54
|
render() {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const _a = this.props,
|
|
56
|
+
{
|
|
57
|
+
className,
|
|
58
|
+
image,
|
|
59
|
+
description,
|
|
60
|
+
style,
|
|
61
|
+
title,
|
|
62
|
+
imageStyle,
|
|
63
|
+
children,
|
|
64
|
+
layout,
|
|
65
|
+
darkModeImage
|
|
66
|
+
} = _a,
|
|
67
|
+
rest = __rest(_a, ["className", "image", "description", "style", "title", "imageStyle", "children", "layout", "darkModeImage"]);
|
|
58
68
|
const alt = typeof description === 'string' ? description : 'empty';
|
|
59
69
|
const imgSrc = this.state.mode === 'dark' && darkModeImage ? darkModeImage : image;
|
|
60
70
|
let imageNode = null;
|
|
@@ -83,10 +93,10 @@ export default class Empty extends BaseComponent {
|
|
|
83
93
|
fontWeight: 400
|
|
84
94
|
}
|
|
85
95
|
};
|
|
86
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
87
97
|
className: wrapperCls,
|
|
88
98
|
style: style
|
|
89
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
}, this.getDataAttr(rest)), /*#__PURE__*/React.createElement("div", {
|
|
90
100
|
className: `${prefixCls}-image`,
|
|
91
101
|
style: imageStyle,
|
|
92
102
|
"x-semi-prop": "image,darkModeImage"
|
package/lib/es/input/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
50
50
|
getValueLength?: (value: string) => number;
|
|
51
51
|
forwardRef?: ((instance: any) => void) | React.MutableRefObject<any> | null;
|
|
52
52
|
preventScroll?: boolean;
|
|
53
|
+
/** internal prop, DatePicker use it */
|
|
54
|
+
showClearIgnoreDisabled?: boolean;
|
|
53
55
|
}
|
|
54
56
|
export interface InputState {
|
|
55
57
|
value: React.ReactText;
|
|
@@ -166,6 +168,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
166
168
|
};
|
|
167
169
|
static getDerivedStateFromProps(props: InputProps, state: InputState): Partial<InputState>;
|
|
168
170
|
componentDidUpdate(prevProps: InputProps): void;
|
|
171
|
+
componentDidMount(): void;
|
|
169
172
|
handleClear: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
170
173
|
handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
171
174
|
handleMouseOver: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
@@ -182,7 +185,6 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
182
185
|
renderClearBtn(): JSX.Element;
|
|
183
186
|
renderModeBtn(): JSX.Element;
|
|
184
187
|
renderPrefix(): JSX.Element;
|
|
185
|
-
showClearBtn(): boolean;
|
|
186
188
|
renderSuffix(suffixAllowClear: boolean): JSX.Element;
|
|
187
189
|
getInputRef(): React.RefObject<HTMLInputElement> | React.MutableRefObject<any> | ((node: HTMLInputElement) => void);
|
|
188
190
|
render(): JSX.Element;
|
package/lib/es/input/index.js
CHANGED
|
@@ -136,6 +136,21 @@ class Input extends BaseComponent {
|
|
|
136
136
|
this.handleModeChange(mode);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
componentDidMount() {
|
|
140
|
+
// autofocus is changed from the original support of input to the support of manually calling the focus method,
|
|
141
|
+
// so that preventScroll can still take effect under the setting of autofocus
|
|
142
|
+
this.foundation.init();
|
|
143
|
+
const {
|
|
144
|
+
disabled,
|
|
145
|
+
autofocus,
|
|
146
|
+
preventScroll
|
|
147
|
+
} = this.props;
|
|
148
|
+
if (!disabled && autofocus) {
|
|
149
|
+
this.inputRef.current.focus({
|
|
150
|
+
preventScroll
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
139
154
|
renderPrepend() {
|
|
140
155
|
const {
|
|
141
156
|
addonBefore
|
|
@@ -244,18 +259,6 @@ class Input extends BaseComponent {
|
|
|
244
259
|
}, labelNode)
|
|
245
260
|
);
|
|
246
261
|
}
|
|
247
|
-
showClearBtn() {
|
|
248
|
-
const {
|
|
249
|
-
value,
|
|
250
|
-
isFocus,
|
|
251
|
-
isHovering
|
|
252
|
-
} = this.state;
|
|
253
|
-
const {
|
|
254
|
-
disabled,
|
|
255
|
-
showClear
|
|
256
|
-
} = this.props;
|
|
257
|
-
return Boolean(value) && showClear && !disabled && (isFocus || isHovering);
|
|
258
|
-
}
|
|
259
262
|
renderSuffix(suffixAllowClear) {
|
|
260
263
|
const {
|
|
261
264
|
suffix,
|
|
@@ -330,15 +333,16 @@ class Input extends BaseComponent {
|
|
|
330
333
|
maxLength,
|
|
331
334
|
getValueLength,
|
|
332
335
|
preventScroll,
|
|
333
|
-
borderless
|
|
336
|
+
borderless,
|
|
337
|
+
showClearIgnoreDisabled
|
|
334
338
|
} = _a,
|
|
335
|
-
rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "clearIcon", "className", "disabled", "defaultValue", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength", "preventScroll", "borderless"]);
|
|
339
|
+
rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "clearIcon", "className", "disabled", "defaultValue", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength", "preventScroll", "borderless", "showClearIgnoreDisabled"]);
|
|
336
340
|
const {
|
|
337
341
|
value,
|
|
338
342
|
isFocus,
|
|
339
343
|
minLength: stateMinLength
|
|
340
344
|
} = this.state;
|
|
341
|
-
const suffixAllowClear = this.
|
|
345
|
+
const suffixAllowClear = this.foundation.isAllowClear();
|
|
342
346
|
const suffixIsIcon = isSemiIcon(suffix);
|
|
343
347
|
const ref = this.getInputRef();
|
|
344
348
|
const wrapperPrefix = `${prefixCls}-wrapper`;
|
|
@@ -371,7 +375,6 @@ class Input extends BaseComponent {
|
|
|
371
375
|
const inputValue = value === null || value === undefined ? '' : value;
|
|
372
376
|
const inputProps = Object.assign(Object.assign({}, rest), {
|
|
373
377
|
style: inputStyle,
|
|
374
|
-
autoFocus: autofocus,
|
|
375
378
|
className: inputCls,
|
|
376
379
|
disabled,
|
|
377
380
|
readOnly: readonly,
|
package/lib/es/list/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import _noop from "lodash/noop";
|
|
2
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
6
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
2
10
|
import React from 'react';
|
|
3
11
|
import cls from 'classnames';
|
|
4
12
|
import PropTypes from 'prop-types';
|
|
@@ -52,24 +60,26 @@ class List extends BaseComponent {
|
|
|
52
60
|
}, childrenList ? childrenList : null, children);
|
|
53
61
|
}
|
|
54
62
|
render() {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
const _a = this.props,
|
|
64
|
+
{
|
|
65
|
+
style,
|
|
66
|
+
className,
|
|
67
|
+
header,
|
|
68
|
+
loading,
|
|
69
|
+
onRightClick,
|
|
70
|
+
onClick,
|
|
71
|
+
footer,
|
|
72
|
+
layout,
|
|
73
|
+
grid,
|
|
74
|
+
size,
|
|
75
|
+
split,
|
|
76
|
+
loadMore,
|
|
77
|
+
bordered,
|
|
78
|
+
dataSource,
|
|
79
|
+
renderItem,
|
|
80
|
+
children
|
|
81
|
+
} = _a,
|
|
82
|
+
rest = __rest(_a, ["style", "className", "header", "loading", "onRightClick", "onClick", "footer", "layout", "grid", "size", "split", "loadMore", "bordered", "dataSource", "renderItem", "children"]);
|
|
73
83
|
const wrapperCls = cls(prefixCls, className, {
|
|
74
84
|
[`${prefixCls}-flex`]: layout === 'horizontal',
|
|
75
85
|
[`${prefixCls}-${size}`]: size,
|
|
@@ -90,10 +100,10 @@ class List extends BaseComponent {
|
|
|
90
100
|
} else if (!children && !loading) {
|
|
91
101
|
childrenList = this.renderEmpty();
|
|
92
102
|
}
|
|
93
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
94
104
|
className: wrapperCls,
|
|
95
105
|
style: style
|
|
96
|
-
}, header ? /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
}, this.getDataAttr(rest)), header ? /*#__PURE__*/React.createElement("div", {
|
|
97
107
|
className: `${cssClasses.PREFIX}-header`,
|
|
98
108
|
"x-semi-prop": "header"
|
|
99
109
|
}, header) : null, /*#__PURE__*/React.createElement(ListContext.Provider, {
|
package/lib/es/list/item.js
CHANGED
|
@@ -11,6 +11,7 @@ import React, { PureComponent } from 'react';
|
|
|
11
11
|
import cls from 'classnames';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/list/constants';
|
|
14
|
+
import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
|
|
14
15
|
import { Col } from '../grid';
|
|
15
16
|
import ListContext from './list-context';
|
|
16
17
|
const prefixCls = cssClasses.PREFIX;
|
|
@@ -29,19 +30,21 @@ export default class ListItem extends PureComponent {
|
|
|
29
30
|
return /*#__PURE__*/React.createElement(Col, Object.assign({}, rest), content);
|
|
30
31
|
}
|
|
31
32
|
render() {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const _a = this.props,
|
|
34
|
+
{
|
|
35
|
+
header,
|
|
36
|
+
main,
|
|
37
|
+
className,
|
|
38
|
+
style,
|
|
39
|
+
extra,
|
|
40
|
+
children,
|
|
41
|
+
align,
|
|
42
|
+
onClick,
|
|
43
|
+
onRightClick,
|
|
44
|
+
onMouseEnter,
|
|
45
|
+
onMouseLeave
|
|
46
|
+
} = _a,
|
|
47
|
+
rest = __rest(_a, ["header", "main", "className", "style", "extra", "children", "align", "onClick", "onRightClick", "onMouseEnter", "onMouseLeave"]);
|
|
45
48
|
const {
|
|
46
49
|
onRightClick: contextOnRightClick,
|
|
47
50
|
onClick: contextOnClick,
|
|
@@ -66,14 +69,14 @@ export default class ListItem extends PureComponent {
|
|
|
66
69
|
let content =
|
|
67
70
|
/*#__PURE__*/
|
|
68
71
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
69
|
-
React.createElement("li", {
|
|
72
|
+
React.createElement("li", Object.assign({
|
|
70
73
|
className: itemCls,
|
|
71
74
|
style: style,
|
|
72
75
|
onClick: handleClick,
|
|
73
76
|
onContextMenu: handleContextMenu,
|
|
74
77
|
onMouseEnter: onMouseEnter,
|
|
75
78
|
onMouseLeave: onMouseLeave
|
|
76
|
-
}, body ? body : null, children, extra ? /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
}, getDataAttr(rest)), body ? body : null, children, extra ? /*#__PURE__*/React.createElement("div", {
|
|
77
80
|
className: `${prefixCls}-item-extra`
|
|
78
81
|
}, extra) : null);
|
|
79
82
|
if (this.context && contextGrid) {
|