@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.
Files changed (175) hide show
  1. package/dist/css/semi.css +39 -1
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +850 -503
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/_base/baseComponent.d.ts +1 -0
  8. package/lib/cjs/_base/baseComponent.js +4 -0
  9. package/lib/cjs/anchor/index.js +2 -2
  10. package/lib/cjs/autoComplete/index.js +2 -2
  11. package/lib/cjs/banner/index.js +2 -2
  12. package/lib/cjs/breadcrumb/index.js +2 -2
  13. package/lib/cjs/breadcrumb/item.js +1 -1
  14. package/lib/cjs/calendar/dayCalendar.js +2 -2
  15. package/lib/cjs/calendar/monthCalendar.js +2 -2
  16. package/lib/cjs/calendar/rangeCalendar.js +2 -2
  17. package/lib/cjs/calendar/weekCalendar.d.ts +1 -1
  18. package/lib/cjs/calendar/weekCalendar.js +2 -2
  19. package/lib/cjs/carousel/index.js +2 -2
  20. package/lib/cjs/cascader/index.js +1 -1
  21. package/lib/cjs/checkbox/checkbox.js +2 -2
  22. package/lib/cjs/checkbox/checkboxGroup.js +2 -2
  23. package/lib/cjs/collapse/index.js +2 -2
  24. package/lib/cjs/collapsible/index.js +2 -2
  25. package/lib/cjs/datePicker/dateInput.d.ts +1 -0
  26. package/lib/cjs/datePicker/dateInput.js +10 -6
  27. package/lib/cjs/datePicker/datePicker.js +23 -11
  28. package/lib/cjs/datePicker/quickControl.d.ts +2 -0
  29. package/lib/cjs/datePicker/quickControl.js +5 -3
  30. package/lib/cjs/descriptions/index.js +22 -11
  31. package/lib/cjs/descriptions/item.js +22 -11
  32. package/lib/cjs/empty/index.js +23 -13
  33. package/lib/cjs/input/index.d.ts +3 -1
  34. package/lib/cjs/input/index.js +19 -16
  35. package/lib/cjs/list/index.js +30 -20
  36. package/lib/cjs/list/item.js +18 -15
  37. package/lib/cjs/locale/interface.d.ts +1 -0
  38. package/lib/cjs/locale/source/ar.js +1 -0
  39. package/lib/cjs/locale/source/de.js +1 -0
  40. package/lib/cjs/locale/source/en_GB.js +1 -0
  41. package/lib/cjs/locale/source/en_US.js +1 -0
  42. package/lib/cjs/locale/source/es.js +1 -0
  43. package/lib/cjs/locale/source/fr.js +1 -0
  44. package/lib/cjs/locale/source/id_ID.js +1 -0
  45. package/lib/cjs/locale/source/it.js +1 -0
  46. package/lib/cjs/locale/source/ja_JP.js +1 -0
  47. package/lib/cjs/locale/source/ko_KR.js +1 -0
  48. package/lib/cjs/locale/source/ms_MY.js +1 -0
  49. package/lib/cjs/locale/source/nl_NL.js +1 -0
  50. package/lib/cjs/locale/source/pl_PL.js +1 -0
  51. package/lib/cjs/locale/source/pt_BR.js +1 -0
  52. package/lib/cjs/locale/source/ro.d.ts +1 -0
  53. package/lib/cjs/locale/source/ro.js +1 -0
  54. package/lib/cjs/locale/source/ru_RU.js +1 -0
  55. package/lib/cjs/locale/source/sv_SE.js +1 -0
  56. package/lib/cjs/locale/source/th_TH.js +1 -0
  57. package/lib/cjs/locale/source/tr_TR.js +1 -0
  58. package/lib/cjs/locale/source/vi_VN.js +1 -0
  59. package/lib/cjs/locale/source/zh_CN.js +1 -0
  60. package/lib/cjs/locale/source/zh_TW.js +1 -0
  61. package/lib/cjs/modal/ModalContent.js +12 -9
  62. package/lib/cjs/navigation/index.js +34 -24
  63. package/lib/cjs/pagination/index.d.ts +3 -0
  64. package/lib/cjs/pagination/index.js +73 -39
  65. package/lib/cjs/progress/index.js +44 -31
  66. package/lib/cjs/radio/radio.js +27 -17
  67. package/lib/cjs/radio/radioGroup.js +24 -14
  68. package/lib/cjs/rating/index.js +21 -11
  69. package/lib/cjs/scrollList/index.js +21 -11
  70. package/lib/cjs/select/index.js +30 -21
  71. package/lib/cjs/sideSheet/SideSheetContent.js +27 -7
  72. package/lib/cjs/slider/index.js +20 -11
  73. package/lib/cjs/spin/index.js +19 -9
  74. package/lib/cjs/steps/basicSteps.js +24 -14
  75. package/lib/cjs/steps/fillSteps.js +22 -12
  76. package/lib/cjs/steps/navSteps.js +21 -11
  77. package/lib/cjs/switch/index.js +23 -13
  78. package/lib/cjs/table/Table.d.ts +1 -0
  79. package/lib/cjs/table/Table.js +3 -2
  80. package/lib/cjs/tabs/index.js +1 -2
  81. package/lib/cjs/tagInput/index.js +20 -10
  82. package/lib/cjs/timeline/index.js +20 -9
  83. package/lib/cjs/timeline/item.js +24 -13
  84. package/lib/cjs/toast/index.d.ts +4 -0
  85. package/lib/cjs/tooltip/index.js +3 -1
  86. package/lib/cjs/transfer/index.js +19 -9
  87. package/lib/cjs/tree/index.js +32 -22
  88. package/lib/cjs/treeSelect/index.js +32 -20
  89. package/lib/cjs/typography/title.d.ts +1 -1
  90. package/lib/cjs/upload/index.js +28 -18
  91. package/lib/es/_base/baseComponent.d.ts +1 -0
  92. package/lib/es/_base/baseComponent.js +4 -0
  93. package/lib/es/anchor/index.js +2 -2
  94. package/lib/es/autoComplete/index.js +2 -2
  95. package/lib/es/banner/index.js +2 -2
  96. package/lib/es/breadcrumb/index.js +2 -2
  97. package/lib/es/breadcrumb/item.js +1 -1
  98. package/lib/es/calendar/dayCalendar.js +2 -2
  99. package/lib/es/calendar/monthCalendar.js +2 -2
  100. package/lib/es/calendar/rangeCalendar.js +2 -2
  101. package/lib/es/calendar/weekCalendar.d.ts +1 -1
  102. package/lib/es/calendar/weekCalendar.js +2 -2
  103. package/lib/es/carousel/index.js +2 -2
  104. package/lib/es/cascader/index.js +1 -1
  105. package/lib/es/checkbox/checkbox.js +2 -2
  106. package/lib/es/checkbox/checkboxGroup.js +2 -2
  107. package/lib/es/collapse/index.js +2 -2
  108. package/lib/es/collapsible/index.js +2 -2
  109. package/lib/es/datePicker/dateInput.d.ts +1 -0
  110. package/lib/es/datePicker/dateInput.js +10 -6
  111. package/lib/es/datePicker/datePicker.js +23 -10
  112. package/lib/es/datePicker/quickControl.d.ts +2 -0
  113. package/lib/es/datePicker/quickControl.js +5 -3
  114. package/lib/es/descriptions/index.js +22 -11
  115. package/lib/es/descriptions/item.js +22 -11
  116. package/lib/es/empty/index.js +23 -13
  117. package/lib/es/input/index.d.ts +3 -1
  118. package/lib/es/input/index.js +19 -16
  119. package/lib/es/list/index.js +30 -20
  120. package/lib/es/list/item.js +18 -15
  121. package/lib/es/locale/interface.d.ts +1 -0
  122. package/lib/es/locale/source/ar.js +1 -0
  123. package/lib/es/locale/source/de.js +1 -0
  124. package/lib/es/locale/source/en_GB.js +1 -0
  125. package/lib/es/locale/source/en_US.js +1 -0
  126. package/lib/es/locale/source/es.js +1 -0
  127. package/lib/es/locale/source/fr.js +1 -0
  128. package/lib/es/locale/source/id_ID.js +1 -0
  129. package/lib/es/locale/source/it.js +1 -0
  130. package/lib/es/locale/source/ja_JP.js +1 -0
  131. package/lib/es/locale/source/ko_KR.js +1 -0
  132. package/lib/es/locale/source/ms_MY.js +1 -0
  133. package/lib/es/locale/source/nl_NL.js +1 -0
  134. package/lib/es/locale/source/pl_PL.js +1 -0
  135. package/lib/es/locale/source/pt_BR.js +1 -0
  136. package/lib/es/locale/source/ro.d.ts +1 -0
  137. package/lib/es/locale/source/ro.js +1 -0
  138. package/lib/es/locale/source/ru_RU.js +1 -0
  139. package/lib/es/locale/source/sv_SE.js +1 -0
  140. package/lib/es/locale/source/th_TH.js +1 -0
  141. package/lib/es/locale/source/tr_TR.js +1 -0
  142. package/lib/es/locale/source/vi_VN.js +1 -0
  143. package/lib/es/locale/source/zh_CN.js +1 -0
  144. package/lib/es/locale/source/zh_TW.js +1 -0
  145. package/lib/es/modal/ModalContent.js +12 -9
  146. package/lib/es/navigation/index.js +34 -24
  147. package/lib/es/pagination/index.d.ts +3 -0
  148. package/lib/es/pagination/index.js +73 -38
  149. package/lib/es/progress/index.js +44 -31
  150. package/lib/es/radio/radio.js +27 -17
  151. package/lib/es/radio/radioGroup.js +24 -14
  152. package/lib/es/rating/index.js +21 -11
  153. package/lib/es/scrollList/index.js +21 -11
  154. package/lib/es/select/index.js +30 -20
  155. package/lib/es/sideSheet/SideSheetContent.js +27 -7
  156. package/lib/es/slider/index.js +20 -10
  157. package/lib/es/spin/index.js +19 -9
  158. package/lib/es/steps/basicSteps.js +24 -14
  159. package/lib/es/steps/fillSteps.js +22 -12
  160. package/lib/es/steps/navSteps.js +21 -11
  161. package/lib/es/switch/index.js +23 -13
  162. package/lib/es/table/Table.d.ts +1 -0
  163. package/lib/es/table/Table.js +3 -2
  164. package/lib/es/tabs/index.js +1 -2
  165. package/lib/es/tagInput/index.js +20 -10
  166. package/lib/es/timeline/index.js +20 -9
  167. package/lib/es/timeline/item.js +24 -13
  168. package/lib/es/toast/index.d.ts +4 -0
  169. package/lib/es/tooltip/index.js +3 -1
  170. package/lib/es/transfer/index.js +19 -9
  171. package/lib/es/tree/index.js +32 -22
  172. package/lib/es/treeSelect/index.js +32 -20
  173. package/lib/es/typography/title.d.ts +1 -1
  174. package/lib/es/upload/index.js +28 -18
  175. package/package.json +8 -8
@@ -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 allowClear = (rangeStart || rangeEnd) && showClear;
147
- return allowClear && !disabled ? /*#__PURE__*/React.createElement("div", {
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 => !disabled && this.handleRangeInputClear(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
- style,
726
- className,
727
- prefixCls,
728
- type
729
- } = this.props;
730
- const outerProps = {
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
- }, "\u5FEB\u6377\u9009\u62E9"), /*#__PURE__*/React.createElement("div", {
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
- align,
14
- row,
15
- size,
16
- className,
17
- style,
18
- children,
19
- data
20
- } = this.props;
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
- itemKey,
13
- hidden,
14
- className,
15
- style,
16
- children
17
- } = this.props;
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
@@ -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
- className,
49
- image,
50
- description,
51
- style,
52
- title,
53
- imageStyle,
54
- children,
55
- layout,
56
- darkModeImage
57
- } = this.props;
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"
@@ -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;
@@ -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.showClearBtn();
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,
@@ -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
- style,
57
- className,
58
- header,
59
- loading,
60
- onRightClick,
61
- onClick,
62
- footer,
63
- layout,
64
- grid,
65
- size,
66
- split,
67
- loadMore,
68
- bordered,
69
- dataSource,
70
- renderItem,
71
- children
72
- } = this.props;
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, {
@@ -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
- header,
34
- main,
35
- className,
36
- style,
37
- extra,
38
- children,
39
- align,
40
- onClick,
41
- onRightClick,
42
- onMouseEnter,
43
- onMouseLeave
44
- } = this.props;
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) {
@@ -33,6 +33,7 @@ export interface Locale {
33
33
  dateTimeRange: [string, string];
34
34
  monthRange: [string, string];
35
35
  };
36
+ presets: string;
36
37
  footer: {
37
38
  confirm: string;
38
39
  cancel: string;
@@ -33,6 +33,7 @@ const local = {
33
33
  dateTimeRange: ['تاريخ البدء', 'تاريخ النهاية'],
34
34
  monthRange: ['الشهر الأول', 'الشهر الأخير']
35
35
  },
36
+ presets: 'اختيار سريع',
36
37
  footer: {
37
38
  confirm: 'تؤكد',
38
39
  cancel: 'إلغاء'
@@ -33,6 +33,7 @@ const local = {
33
33
  dateTimeRange: ['Startdatum', 'Enddatum'],
34
34
  monthRange: ['Startmonat', 'Endmonat']
35
35
  },
36
+ presets: 'Schnellauswahl',
36
37
  footer: {
37
38
  confirm: 'Bestätigen',
38
39
  cancel: 'Abbrechen'
@@ -33,6 +33,7 @@ const local = {
33
33
  dateTimeRange: ['Start date', 'End date'],
34
34
  monthRange: ['Start month', 'End month']
35
35
  },
36
+ presets: 'Presets',
36
37
  footer: {
37
38
  confirm: 'Confirm',
38
39
  cancel: 'Cancel'
@@ -33,6 +33,7 @@ const local = {
33
33
  dateTimeRange: ['Start date', 'End date'],
34
34
  monthRange: ['Start month', 'End month']
35
35
  },
36
+ presets: 'Presets',
36
37
  footer: {
37
38
  confirm: 'Confirm',
38
39
  cancel: 'Cancel'