@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.
Files changed (101) hide show
  1. package/dist/css/semi.css +50 -14
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +3833 -3561
  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/cascader/index.d.ts +1 -0
  8. package/lib/cjs/cascader/index.js +10 -1
  9. package/lib/cjs/datePicker/dateInput.d.ts +5 -1
  10. package/lib/cjs/datePicker/dateInput.js +16 -9
  11. package/lib/cjs/datePicker/datePicker.d.ts +32 -4
  12. package/lib/cjs/datePicker/datePicker.js +104 -23
  13. package/lib/cjs/datePicker/index.d.ts +1 -0
  14. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  15. package/lib/cjs/datePicker/monthsGrid.js +11 -3
  16. package/lib/cjs/datePicker/yearAndMonth.d.ts +10 -6
  17. package/lib/cjs/datePicker/yearAndMonth.js +84 -30
  18. package/lib/cjs/form/baseForm.d.ts +2 -2
  19. package/lib/cjs/form/field.d.ts +1 -1
  20. package/lib/cjs/locale/interface.d.ts +1 -0
  21. package/lib/cjs/locale/source/ar.js +2 -1
  22. package/lib/cjs/locale/source/de.js +2 -1
  23. package/lib/cjs/locale/source/en_GB.js +2 -1
  24. package/lib/cjs/locale/source/en_US.js +2 -1
  25. package/lib/cjs/locale/source/es.js +2 -1
  26. package/lib/cjs/locale/source/fr.js +2 -1
  27. package/lib/cjs/locale/source/id_ID.js +2 -1
  28. package/lib/cjs/locale/source/it.js +2 -1
  29. package/lib/cjs/locale/source/ja_JP.js +2 -1
  30. package/lib/cjs/locale/source/ko_KR.js +2 -1
  31. package/lib/cjs/locale/source/ms_MY.js +2 -1
  32. package/lib/cjs/locale/source/nl_NL.js +2 -1
  33. package/lib/cjs/locale/source/pl_PL.js +2 -1
  34. package/lib/cjs/locale/source/pt_BR.js +2 -1
  35. package/lib/cjs/locale/source/ro.d.ts +1 -0
  36. package/lib/cjs/locale/source/ro.js +2 -1
  37. package/lib/cjs/locale/source/ru_RU.js +2 -1
  38. package/lib/cjs/locale/source/sv_SE.js +2 -1
  39. package/lib/cjs/locale/source/th_TH.js +2 -1
  40. package/lib/cjs/locale/source/tr_TR.js +2 -1
  41. package/lib/cjs/locale/source/vi_VN.js +2 -1
  42. package/lib/cjs/locale/source/zh_CN.js +2 -1
  43. package/lib/cjs/locale/source/zh_TW.js +2 -1
  44. package/lib/cjs/modal/Modal.js +7 -7
  45. package/lib/cjs/select/index.d.ts +18 -1
  46. package/lib/cjs/select/index.js +4 -1
  47. package/lib/cjs/sideSheet/SideSheetContent.d.ts +3 -1
  48. package/lib/cjs/sideSheet/SideSheetContent.js +3 -2
  49. package/lib/cjs/sideSheet/index.js +6 -3
  50. package/lib/cjs/space/index.js +5 -2
  51. package/lib/cjs/table/Table.js +2 -2
  52. package/lib/cjs/treeSelect/index.d.ts +1 -0
  53. package/lib/cjs/treeSelect/index.js +7 -3
  54. package/lib/es/cascader/index.d.ts +1 -0
  55. package/lib/es/cascader/index.js +10 -1
  56. package/lib/es/datePicker/dateInput.d.ts +5 -1
  57. package/lib/es/datePicker/dateInput.js +16 -9
  58. package/lib/es/datePicker/datePicker.d.ts +32 -4
  59. package/lib/es/datePicker/datePicker.js +109 -23
  60. package/lib/es/datePicker/index.d.ts +1 -0
  61. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  62. package/lib/es/datePicker/monthsGrid.js +11 -3
  63. package/lib/es/datePicker/yearAndMonth.d.ts +10 -6
  64. package/lib/es/datePicker/yearAndMonth.js +83 -29
  65. package/lib/es/form/baseForm.d.ts +2 -2
  66. package/lib/es/form/field.d.ts +1 -1
  67. package/lib/es/locale/interface.d.ts +1 -0
  68. package/lib/es/locale/source/ar.js +2 -1
  69. package/lib/es/locale/source/de.js +2 -1
  70. package/lib/es/locale/source/en_GB.js +2 -1
  71. package/lib/es/locale/source/en_US.js +2 -1
  72. package/lib/es/locale/source/es.js +2 -1
  73. package/lib/es/locale/source/fr.js +2 -1
  74. package/lib/es/locale/source/id_ID.js +2 -1
  75. package/lib/es/locale/source/it.js +2 -1
  76. package/lib/es/locale/source/ja_JP.js +2 -1
  77. package/lib/es/locale/source/ko_KR.js +2 -1
  78. package/lib/es/locale/source/ms_MY.js +2 -1
  79. package/lib/es/locale/source/nl_NL.js +2 -1
  80. package/lib/es/locale/source/pl_PL.js +2 -1
  81. package/lib/es/locale/source/pt_BR.js +2 -1
  82. package/lib/es/locale/source/ro.d.ts +1 -0
  83. package/lib/es/locale/source/ro.js +2 -1
  84. package/lib/es/locale/source/ru_RU.js +2 -1
  85. package/lib/es/locale/source/sv_SE.js +2 -1
  86. package/lib/es/locale/source/th_TH.js +2 -1
  87. package/lib/es/locale/source/tr_TR.js +2 -1
  88. package/lib/es/locale/source/vi_VN.js +2 -1
  89. package/lib/es/locale/source/zh_CN.js +2 -1
  90. package/lib/es/locale/source/zh_TW.js +2 -1
  91. package/lib/es/modal/Modal.js +7 -7
  92. package/lib/es/select/index.d.ts +18 -1
  93. package/lib/es/select/index.js +4 -1
  94. package/lib/es/sideSheet/SideSheetContent.d.ts +3 -1
  95. package/lib/es/sideSheet/SideSheetContent.js +3 -2
  96. package/lib/es/sideSheet/index.js +6 -3
  97. package/lib/es/space/index.js +4 -2
  98. package/lib/es/table/Table.js +2 -2
  99. package/lib/es/treeSelect/index.d.ts +1 -0
  100. package/lib/es/treeSelect/index.js +7 -3
  101. package/package.json +8 -8
@@ -33,6 +33,23 @@ export interface optionRenderProps {
33
33
  onClick?: (e: React.MouseEvent) => any;
34
34
  [x: string]: any;
35
35
  }
36
+ export interface SelectedItemProps {
37
+ value: OptionProps['value'];
38
+ label: OptionProps['label'];
39
+ _show?: boolean;
40
+ _selected: boolean;
41
+ _scrollIndex?: number;
42
+ }
43
+ export interface TriggerRenderProps {
44
+ value: SelectedItemProps[];
45
+ inputValue: string;
46
+ onSearch: (inputValue: string) => void;
47
+ onClear: () => void;
48
+ onRemove: (option: OptionProps) => void;
49
+ disabled: boolean;
50
+ placeholder: string;
51
+ componentProps: Record<string, any>;
52
+ }
36
53
  export interface selectMethod {
37
54
  clearInput?: () => void;
38
55
  selectAll?: () => void;
@@ -121,7 +138,7 @@ export declare type SelectProps = {
121
138
  onDeselect?: (value: SelectProps['value'], option: Record<string, any>) => void;
122
139
  onSelect?: (value: SelectProps['value'], option: Record<string, any>) => void;
123
140
  allowCreate?: boolean;
124
- triggerRender?: (props?: any) => React.ReactNode;
141
+ triggerRender?: (props?: TriggerRenderProps) => React.ReactNode;
125
142
  onClear?: () => void;
126
143
  virtualize?: virtualListProps;
127
144
  onFocus?: (e: React.FocusEvent) => void;
@@ -1162,11 +1162,14 @@ class Select extends BaseComponent {
1162
1162
  }, arrowIcon) : /*#__PURE__*/React.createElement("div", {
1163
1163
  className: `${prefixcls}-arrow-empty`
1164
1164
  });
1165
- const clear = clearIcon ? clearIcon : /*#__PURE__*/React.createElement(IconClear, null);
1165
+ const clear = clearIcon ? clearIcon : /*#__PURE__*/React.createElement(IconClear, null); // semantics of onSearch are more in line with behavior, onChange is alias of onSearch, will be deprecate next major version
1166
+
1166
1167
  const inner = useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
1167
1168
  value: Array.from(selections.values()),
1168
1169
  inputValue: inputValue,
1169
1170
  onChange: this.handleInputChange,
1171
+ onSearch: this.handleInputChange,
1172
+ onRemove: item => this.foundation.removeTag(item),
1170
1173
  onClear: this.onClear,
1171
1174
  disabled: disabled,
1172
1175
  triggerRender: triggerRender,
@@ -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/es/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: CSSProperties['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;
@@ -126,7 +126,7 @@ export default class SideSheetContent extends React.PureComponent {
126
126
  key: "dialog-element",
127
127
  role: "dialog",
128
128
  tabIndex: -1,
129
- className: cls(`${prefixCls}-inner`, `${prefixCls}-inner-wrap`, (_a = this.props.dialogClassName) !== null && _a !== void 0 ? _a : ""),
129
+ className: cls(`${prefixCls}-inner`, `${prefixCls}-inner-wrap`, (_a = this.props.dialogClassName) !== null && _a !== void 0 ? _a : "", `${prefixCls}-size-${props.size}`),
130
130
  // onMouseDown={this.onDialogMouseDown}
131
131
  style: Object.assign(Object.assign({}, props.style), style)
132
132
  }, this.props.wrapperExtraProps), /*#__PURE__*/React.createElement("div", {
@@ -149,7 +149,8 @@ export default class SideSheetContent extends React.PureComponent {
149
149
  width
150
150
  } = this.props;
151
151
  const wrapperCls = cls(className, {
152
- [`${prefixCls}-fixed`]: !mask
152
+ [`${prefixCls}-fixed`]: !mask,
153
+ [`${prefixCls}-size-${this.props.size}`]: !mask
153
154
  });
154
155
  const wrapperStyle = {};
155
156
 
@@ -161,7 +161,6 @@ export default class SideSheet extends BaseComponent {
161
161
  } = this.context;
162
162
  const isVertical = placement === 'left' || placement === 'right';
163
163
  const isHorizontal = placement === 'top' || placement === 'bottom';
164
- const sheetWidth = isVertical ? width ? width : defaultWidthList[size] : '100%';
165
164
  const sheetHeight = isHorizontal ? height ? height : defaultHeight : '100%';
166
165
  const classList = cls(prefixCls, className, {
167
166
  [`${prefixCls}-${placement}`]: placement,
@@ -170,11 +169,15 @@ export default class SideSheet extends BaseComponent {
170
169
  [`${prefixCls}-rtl`]: direction === 'rtl',
171
170
  [`${prefixCls}-hidden`]: keepDOM && this.state.displayNone
172
171
  });
173
- const contentProps = Object.assign(Object.assign({}, props), {
172
+ const contentProps = Object.assign(Object.assign(Object.assign({}, isVertical ? width ? {
173
+ width
174
+ } : {} : {
175
+ width: "100%"
176
+ }), props), {
174
177
  visible,
175
178
  motion: false,
179
+ size,
176
180
  className: classList,
177
- width: sheetWidth,
178
181
  height: sheetHeight,
179
182
  onClose: this.handleCancel
180
183
  });
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
7
7
  import { strings, cssClasses } from '@douyinfe/semi-foundation/lib/es/space/constants';
8
8
  import '@douyinfe/semi-foundation/lib/es/space/space.css';
9
9
  import { flatten } from './utils';
10
+ import getDataAttr from '@douyinfe/semi-foundation/lib/es/utils/getDataAttr';
10
11
  const prefixCls = cssClasses.PREFIX;
11
12
 
12
13
  class Space extends PureComponent {
@@ -58,11 +59,12 @@ class Space extends PureComponent {
58
59
  [`${prefixCls}-loose-vertical`]: spacingVerticalType === strings.SPACING_LOOSE
59
60
  });
60
61
  const childrenNodes = flatten(children);
61
- return /*#__PURE__*/React.createElement("div", {
62
+ const dataAttributes = getDataAttr(this.props);
63
+ return /*#__PURE__*/React.createElement("div", Object.assign({}, dataAttributes, {
62
64
  className: classNames,
63
65
  style: realStyle,
64
66
  "x-semi-prop": "children"
65
- }, childrenNodes);
67
+ }), childrenNodes);
66
68
  }
67
69
 
68
70
  }
@@ -45,7 +45,7 @@ var __rest = this && this.__rest || function (s, e) {
45
45
  import React, { createRef, isValidElement } from 'react';
46
46
  import PropTypes from 'prop-types';
47
47
  import classnames from 'classnames';
48
- import { mergeQueries, equalWith, mergeColumns, assignColumnKeys, flattenColumns, getAllDisabledRowKeys } from '@douyinfe/semi-foundation/lib/es/table/utils';
48
+ import { mergeQueries, equalWith, assignColumnKeys, flattenColumns, getAllDisabledRowKeys } from '@douyinfe/semi-foundation/lib/es/table/utils';
49
49
  import Store from '@douyinfe/semi-foundation/lib/es/utils/Store';
50
50
  import TableFoundation from '@douyinfe/semi-foundation/lib/es/table/foundation';
51
51
  import { strings, cssClasses, numbers } from '@douyinfe/semi-foundation/lib/es/table/constants';
@@ -64,7 +64,7 @@ import ColumnSorter from './ColumnSorter';
64
64
  import ExpandedIcon from './CustomExpandIcon';
65
65
  import HeadTable from './HeadTable';
66
66
  import BodyTable from './Body';
67
- import { logger, cloneDeep, mergeComponents } from './utils';
67
+ import { logger, cloneDeep, mergeComponents, mergeColumns } from './utils';
68
68
 
69
69
  class Table extends BaseComponent {
70
70
  constructor(props, context) {
@@ -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>;
@@ -437,7 +437,9 @@ class TreeSelect extends BaseComponent {
437
437
  onClear: this.handleClear,
438
438
  componentName: 'TreeSelect',
439
439
  triggerRender: triggerRender,
440
- componentProps: Object.assign({}, this.props)
440
+ componentProps: Object.assign({}, this.props),
441
+ onSearch: this.search,
442
+ onRemove: this.removeTag
441
443
  }) : [/*#__PURE__*/React.createElement(Fragment, {
442
444
  key: 'prefix'
443
445
  }, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/React.createElement(Fragment, {
@@ -1371,7 +1373,8 @@ TreeSelect.propTypes = {
1371
1373
  'aria-label': PropTypes.string,
1372
1374
  showRestTagsPopover: PropTypes.bool,
1373
1375
  restTagsPopoverProps: PropTypes.object,
1374
- preventScroll: PropTypes.bool
1376
+ preventScroll: PropTypes.bool,
1377
+ clickTriggerToHide: PropTypes.bool
1375
1378
  };
1376
1379
  TreeSelect.defaultProps = {
1377
1380
  searchPosition: strings.SEARCH_POSITION_DROPDOWN,
@@ -1401,6 +1404,7 @@ TreeSelect.defaultProps = {
1401
1404
  checkRelation: 'related',
1402
1405
  'aria-label': 'TreeSelect',
1403
1406
  showRestTagsPopover: false,
1404
- restTagsPopoverProps: {}
1407
+ restTagsPopoverProps: {},
1408
+ clickTriggerToHide: true
1405
1409
  };
1406
1410
  export default TreeSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.31.4",
3
+ "version": "2.32.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,12 +17,12 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.31.4",
21
- "@douyinfe/semi-animation-react": "2.31.4",
22
- "@douyinfe/semi-foundation": "2.31.4",
23
- "@douyinfe/semi-icons": "2.31.4",
24
- "@douyinfe/semi-illustrations": "2.31.4",
25
- "@douyinfe/semi-theme-default": "2.31.4",
20
+ "@douyinfe/semi-animation": "2.32.0",
21
+ "@douyinfe/semi-animation-react": "2.32.0",
22
+ "@douyinfe/semi-foundation": "2.32.0",
23
+ "@douyinfe/semi-icons": "2.32.0",
24
+ "@douyinfe/semi-illustrations": "2.32.0",
25
+ "@douyinfe/semi-theme-default": "2.32.0",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "4db0a16b9639b0dc03799969f94d36d37d41c297",
72
+ "gitHead": "6cf04209adcb1c3ab8d24ba7aec0025394d82d49",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",