@douyinfe/semi-ui 2.17.1 → 2.19.0-alpha.1

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 (172) hide show
  1. package/anchor/index.tsx +1 -1
  2. package/anchor/link.tsx +3 -4
  3. package/autoComplete/__test__/autoComplete.test.js +6 -6
  4. package/autoComplete/index.tsx +1 -1
  5. package/autoComplete/option.tsx +164 -0
  6. package/calendar/__test__/calendar.test.js +21 -2
  7. package/calendar/_story/calendar.stories.js +31 -0
  8. package/calendar/index.tsx +3 -1
  9. package/calendar/interface.ts +2 -1
  10. package/carousel/index.tsx +5 -5
  11. package/checkbox/checkbox.tsx +10 -2
  12. package/checkbox/checkboxGroup.tsx +2 -0
  13. package/dist/css/semi.css +160 -22
  14. package/dist/css/semi.min.css +1 -1
  15. package/dist/umd/semi-ui.js +15144 -16407
  16. package/dist/umd/semi-ui.js.map +1 -1
  17. package/dist/umd/semi-ui.min.js +1 -1
  18. package/dist/umd/semi-ui.min.js.map +1 -1
  19. package/form/_story/FieldProps/labelOptional.jsx +30 -0
  20. package/form/_story/form.stories.js +7 -0
  21. package/form/hoc/withField.tsx +1 -0
  22. package/form/label.tsx +21 -7
  23. package/gulpfile.js +3 -1
  24. package/lib/cjs/_base/base.css +35 -0
  25. package/lib/cjs/anchor/index.js +2 -1
  26. package/lib/cjs/anchor/link.d.ts +1 -1
  27. package/lib/cjs/anchor/link.js +9 -5
  28. package/lib/cjs/autoComplete/index.d.ts +1 -1
  29. package/lib/cjs/autoComplete/index.js +1 -1
  30. package/lib/cjs/autoComplete/option.d.ts +50 -0
  31. package/lib/cjs/autoComplete/option.js +218 -0
  32. package/lib/cjs/calendar/index.d.ts +2 -0
  33. package/lib/cjs/calendar/index.js +3 -1
  34. package/lib/cjs/calendar/interface.d.ts +2 -1
  35. package/lib/cjs/carousel/index.js +2 -2
  36. package/lib/cjs/checkbox/checkbox.d.ts +4 -0
  37. package/lib/cjs/checkbox/checkbox.js +9 -3
  38. package/lib/cjs/checkbox/checkboxGroup.js +4 -2
  39. package/lib/cjs/form/baseForm.d.ts +1 -1
  40. package/lib/cjs/form/field.d.ts +1 -1
  41. package/lib/cjs/form/hoc/withField.js +2 -1
  42. package/lib/cjs/form/label.d.ts +8 -5
  43. package/lib/cjs/form/label.js +15 -4
  44. package/lib/cjs/locale/interface.d.ts +3 -0
  45. package/lib/cjs/locale/source/ar.js +3 -0
  46. package/lib/cjs/locale/source/de.js +3 -0
  47. package/lib/cjs/locale/source/en_GB.js +3 -0
  48. package/lib/cjs/locale/source/en_US.js +3 -0
  49. package/lib/cjs/locale/source/es.js +3 -0
  50. package/lib/cjs/locale/source/fr.js +3 -0
  51. package/lib/cjs/locale/source/id_ID.js +3 -0
  52. package/lib/cjs/locale/source/it.js +3 -0
  53. package/lib/cjs/locale/source/ja_JP.js +3 -0
  54. package/lib/cjs/locale/source/ko_KR.js +3 -0
  55. package/lib/cjs/locale/source/ms_MY.js +3 -0
  56. package/lib/cjs/locale/source/pt_BR.js +3 -0
  57. package/lib/cjs/locale/source/ru_RU.js +3 -0
  58. package/lib/cjs/locale/source/th_TH.js +3 -0
  59. package/lib/cjs/locale/source/tr_TR.js +3 -0
  60. package/lib/cjs/locale/source/vi_VN.js +3 -0
  61. package/lib/cjs/locale/source/zh_CN.js +3 -0
  62. package/lib/cjs/locale/source/zh_TW.js +3 -0
  63. package/lib/cjs/modal/Modal.js +0 -8
  64. package/lib/cjs/modal/ModalContent.js +4 -1
  65. package/lib/cjs/radio/radio.d.ts +2 -0
  66. package/lib/cjs/radio/radio.js +33 -8
  67. package/lib/cjs/radio/radioGroup.js +4 -2
  68. package/lib/cjs/tag/group.d.ts +3 -0
  69. package/lib/cjs/tag/group.js +24 -6
  70. package/lib/cjs/tag/index.d.ts +2 -1
  71. package/lib/cjs/tag/index.js +7 -5
  72. package/lib/cjs/tag/interface.d.ts +2 -1
  73. package/lib/cjs/tree/index.d.ts +3 -1
  74. package/lib/cjs/tree/index.js +23 -0
  75. package/lib/cjs/tree/interface.d.ts +4 -0
  76. package/lib/cjs/typography/title.d.ts +1 -1
  77. package/lib/es/_base/base.css +35 -0
  78. package/lib/es/anchor/index.js +2 -1
  79. package/lib/es/anchor/link.d.ts +1 -1
  80. package/lib/es/anchor/link.js +9 -5
  81. package/lib/es/autoComplete/index.d.ts +1 -1
  82. package/lib/es/autoComplete/index.js +1 -1
  83. package/lib/es/autoComplete/option.d.ts +50 -0
  84. package/lib/es/autoComplete/option.js +188 -0
  85. package/lib/es/calendar/index.d.ts +2 -0
  86. package/lib/es/calendar/index.js +3 -1
  87. package/lib/es/calendar/interface.d.ts +2 -1
  88. package/lib/es/carousel/index.js +2 -2
  89. package/lib/es/checkbox/checkbox.d.ts +4 -0
  90. package/lib/es/checkbox/checkbox.js +10 -4
  91. package/lib/es/checkbox/checkboxGroup.js +4 -2
  92. package/lib/es/form/baseForm.d.ts +1 -1
  93. package/lib/es/form/field.d.ts +1 -1
  94. package/lib/es/form/hoc/withField.js +2 -1
  95. package/lib/es/form/label.d.ts +8 -5
  96. package/lib/es/form/label.js +13 -4
  97. package/lib/es/locale/interface.d.ts +3 -0
  98. package/lib/es/locale/source/ar.js +3 -0
  99. package/lib/es/locale/source/de.js +3 -0
  100. package/lib/es/locale/source/en_GB.js +3 -0
  101. package/lib/es/locale/source/en_US.js +3 -0
  102. package/lib/es/locale/source/es.js +3 -0
  103. package/lib/es/locale/source/fr.js +3 -0
  104. package/lib/es/locale/source/id_ID.js +3 -0
  105. package/lib/es/locale/source/it.js +3 -0
  106. package/lib/es/locale/source/ja_JP.js +3 -0
  107. package/lib/es/locale/source/ko_KR.js +3 -0
  108. package/lib/es/locale/source/ms_MY.js +3 -0
  109. package/lib/es/locale/source/pt_BR.js +3 -0
  110. package/lib/es/locale/source/ru_RU.js +3 -0
  111. package/lib/es/locale/source/th_TH.js +3 -0
  112. package/lib/es/locale/source/tr_TR.js +3 -0
  113. package/lib/es/locale/source/vi_VN.js +3 -0
  114. package/lib/es/locale/source/zh_CN.js +3 -0
  115. package/lib/es/locale/source/zh_TW.js +3 -0
  116. package/lib/es/modal/Modal.js +0 -8
  117. package/lib/es/modal/ModalContent.js +4 -1
  118. package/lib/es/radio/radio.d.ts +2 -0
  119. package/lib/es/radio/radio.js +31 -8
  120. package/lib/es/radio/radioGroup.js +4 -2
  121. package/lib/es/tag/group.d.ts +3 -0
  122. package/lib/es/tag/group.js +24 -6
  123. package/lib/es/tag/index.d.ts +2 -1
  124. package/lib/es/tag/index.js +7 -5
  125. package/lib/es/tag/interface.d.ts +2 -1
  126. package/lib/es/tree/index.d.ts +3 -1
  127. package/lib/es/tree/index.js +22 -0
  128. package/lib/es/tree/interface.d.ts +4 -0
  129. package/lib/es/typography/title.d.ts +1 -1
  130. package/locale/interface.ts +3 -0
  131. package/locale/source/ar.ts +3 -0
  132. package/locale/source/de.ts +3 -0
  133. package/locale/source/en_GB.ts +3 -0
  134. package/locale/source/en_US.ts +3 -0
  135. package/locale/source/es.ts +3 -0
  136. package/locale/source/fr.ts +3 -0
  137. package/locale/source/id_ID.ts +3 -0
  138. package/locale/source/it.ts +3 -0
  139. package/locale/source/ja_JP.ts +3 -0
  140. package/locale/source/ko_KR.ts +3 -0
  141. package/locale/source/ms_MY.ts +3 -0
  142. package/locale/source/pt_BR.ts +3 -0
  143. package/locale/source/ru_RU.ts +3 -0
  144. package/locale/source/th_TH.ts +3 -0
  145. package/locale/source/tr_TR.ts +4 -1
  146. package/locale/source/vi_VN.ts +3 -0
  147. package/locale/source/zh_CN.ts +3 -0
  148. package/locale/source/zh_TW.ts +3 -0
  149. package/modal/Modal.tsx +0 -6
  150. package/modal/ModalContent.tsx +4 -1
  151. package/modal/__test__/modal.test.js +1 -1
  152. package/modal/_story/__snapshots__/modal.stories.tsx.snap +203 -0
  153. package/package.json +7 -7
  154. package/radio/_story/radio.stories.js +2 -2
  155. package/radio/radio.tsx +27 -5
  156. package/radio/radioGroup.tsx +2 -0
  157. package/rating/__test__/rating.test.js +1 -1
  158. package/select/__test__/select.test.js +11 -17
  159. package/select/_story/select.stories.js +6 -6
  160. package/steps/_story/steps.stories.js +3 -3
  161. package/switch/_story/switch.stories.js +4 -4
  162. package/switch/_story/switch.stories.tsx +4 -4
  163. package/tag/_story/tag.stories.js +57 -1
  164. package/tag/group.tsx +20 -3
  165. package/tag/index.tsx +6 -5
  166. package/tag/interface.ts +2 -1
  167. package/transfer/_story/transfer.stories.js +2 -2
  168. package/tree/_story/tree.stories.js +152 -3
  169. package/tree/index.tsx +16 -1
  170. package/tree/interface.ts +6 -0
  171. package/upload/_story/upload.stories.js +2 -2
  172. package/webpack.config.js +10 -2
package/anchor/index.tsx CHANGED
@@ -290,7 +290,7 @@ class Anchor extends BaseComponent<AnchorProps, AnchorState> {
290
290
  <div aria-hidden className={slideCls} style={{ height: scrollHeight }}>
291
291
  <span className={slideBarCls} style={{ top: slideBarTop }} />
292
292
  </div>
293
- <div className={anchorWrapper}>{children}</div>
293
+ <div className={anchorWrapper} role="list">{children}</div>
294
294
  </div>
295
295
  </AnchorContext.Provider>
296
296
  );
package/anchor/link.tsx CHANGED
@@ -118,9 +118,9 @@ export default class Link extends BaseComponent<LinkProps, {}> {
118
118
  const { activeLink, childMap } = this.context;
119
119
  const { href, children } = this.props;
120
120
  if (!this.context.autoCollapse) {
121
- return this.props.children;
121
+ return <div role="list">{children}</div>;
122
122
  }
123
- return activeLink === href || (childMap[href] && childMap[href].has(activeLink)) ? children : null;
123
+ return activeLink === href || (childMap[href] && childMap[href].has(activeLink)) ? <div role="list">{children}</div> : null;
124
124
  };
125
125
 
126
126
  render() {
@@ -134,7 +134,6 @@ export default class Link extends BaseComponent<LinkProps, {}> {
134
134
  });
135
135
  const ariaProps = {
136
136
  'aria-disabled': disabled,
137
- 'aria-label': href,
138
137
  };
139
138
  if (active) {
140
139
  ariaProps['aria-details'] = 'active';
@@ -144,7 +143,7 @@ export default class Link extends BaseComponent<LinkProps, {}> {
144
143
  }
145
144
 
146
145
  return (
147
- <div className={linkCls} style={style}>
146
+ <div className={linkCls} style={style} role="listitem">
148
147
  <div
149
148
  role="link"
150
149
  tabIndex={0}
@@ -191,7 +191,7 @@ describe('AutoComplete', () => {
191
191
  };
192
192
  let ac = getAc(props);
193
193
  expect(ac.exists(`.${BASE_CLASS_PREFIX}-autocomplete-loading-wrapper`)).toEqual(true);
194
- expect(ac.exists(`.${BASE_CLASS_PREFIX}-select-option`)).toEqual(false);
194
+ expect(ac.exists(`.${BASE_CLASS_PREFIX}-autoComplete-option`)).toEqual(false);
195
195
  });
196
196
 
197
197
  it('【onSelect】trigger onSelect when click candidate option', () => {
@@ -204,7 +204,7 @@ describe('AutoComplete', () => {
204
204
  ...commonProps,
205
205
  };
206
206
  let ac = getAc(props);
207
- let options = ac.find(`.${BASE_CLASS_PREFIX}-select-option`);
207
+ let options = ac.find(`.${BASE_CLASS_PREFIX}-autoComplete-option`);
208
208
  let firstOption = options.at(0);
209
209
  const nativeEvent = { nativeEvent: { stopImmediatePropagation: noop } };
210
210
  firstOption.simulate('click', nativeEvent);
@@ -223,7 +223,7 @@ describe('AutoComplete', () => {
223
223
  ...commonProps,
224
224
  };
225
225
  let ac = getAc(props);
226
- let options = ac.find(`.${BASE_CLASS_PREFIX}-select-option`);
226
+ let options = ac.find(`.${BASE_CLASS_PREFIX}-autoComplete-option`);
227
227
  let firstOption = options.at(0);
228
228
  const nativeEvent = { nativeEvent: { stopImmediatePropagation: noop } };
229
229
  firstOption.simulate('click', nativeEvent);
@@ -269,7 +269,7 @@ describe('AutoComplete', () => {
269
269
  renderSelectedItem: option => option.email,
270
270
  };
271
271
  let ac = getAc(props);
272
- let options = ac.find(`.${BASE_CLASS_PREFIX}-select-option`);
272
+ let options = ac.find(`.${BASE_CLASS_PREFIX}-autoComplete-option`);
273
273
  let firstOption = options.at(0);
274
274
  const nativeEvent = { nativeEvent: { stopImmediatePropagation: noop } };
275
275
  firstOption.simulate('click', nativeEvent);
@@ -306,7 +306,7 @@ describe('AutoComplete', () => {
306
306
  value: '',
307
307
  };
308
308
  const ac = getAc(props);
309
- ac.find(`.${BASE_CLASS_PREFIX}-select-option`)
309
+ ac.find(`.${BASE_CLASS_PREFIX}-autoComplete-option`)
310
310
  .at(0)
311
311
  .simulate('click');
312
312
  expect(fakeOnChange.calledWith('XK')).toEqual(true);
@@ -374,7 +374,7 @@ describe('AutoComplete', () => {
374
374
  let event = { target: { value: 'abc' } };
375
375
  component.find('input').simulate('change', event);
376
376
  expect(spyOnChange.calledWith('abc')).toEqual(true);
377
- let options = component.find(`.${BASE_CLASS_PREFIX}-select-option`);
377
+ let options = component.find(`.${BASE_CLASS_PREFIX}-autoComplete-option`);
378
378
  let firstOption = options.at(0);
379
379
  const nativeEvent = { nativeEvent: { stopImmediatePropagation: noop } };
380
380
  firstOption.simulate('click', nativeEvent);
@@ -14,7 +14,7 @@ import Popover from '../popover';
14
14
  import Input from '../input';
15
15
  import Trigger from '../trigger';
16
16
 
17
- import Option from '../select/option';
17
+ import Option from './option';
18
18
  import warning from '@douyinfe/semi-foundation/utils/warning';
19
19
  import '@douyinfe/semi-foundation/autoComplete/autoComplete.scss';
20
20
  import { Motion } from '../_base/base';
@@ -0,0 +1,164 @@
1
+ /* eslint-disable max-len */
2
+ import React, { PureComponent } from 'react';
3
+ import classNames from 'classnames';
4
+ import PropTypes from 'prop-types';
5
+ import { isString } from 'lodash';
6
+ import { cssClasses } from '@douyinfe/semi-foundation/autoComplete/constants';
7
+ import LocaleConsumer from '../locale/localeConsumer';
8
+ import { IconTick } from '@douyinfe/semi-icons';
9
+ import { getHighLightTextHTML } from '../_utils/index';
10
+ import { Locale } from '../locale/interface';
11
+ import { BasicOptionProps } from '@douyinfe/semi-foundation/autoComplete/optionFoundation';
12
+
13
+ export interface OptionProps extends BasicOptionProps {
14
+ [x: string]: any;
15
+ value?: string | number;
16
+ label?: string | number | React.ReactNode;
17
+ children?: React.ReactNode;
18
+ disabled?: boolean;
19
+ showTick?: boolean;
20
+ className?: string;
21
+ style?: React.CSSProperties;
22
+ }
23
+ interface renderOptionContentArgument {
24
+ config: {
25
+ searchWords: any;
26
+ sourceString: React.ReactNode;
27
+ };
28
+ children: React.ReactNode;
29
+ inputValue: string;
30
+ prefixCls: string;
31
+ }
32
+ class Option extends PureComponent<OptionProps> {
33
+ static isSelectOption = true;
34
+
35
+ static propTypes = {
36
+ children: PropTypes.node,
37
+ disabled: PropTypes.bool,
38
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
39
+ selected: PropTypes.bool,
40
+ label: PropTypes.node,
41
+ empty: PropTypes.bool,
42
+ emptyContent: PropTypes.node,
43
+ onSelect: PropTypes.func,
44
+ focused: PropTypes.bool,
45
+ showTick: PropTypes.bool,
46
+ className: PropTypes.string,
47
+ style: PropTypes.object,
48
+ onMouseEnter: PropTypes.func,
49
+ prefixCls: PropTypes.string,
50
+ renderOptionItem: PropTypes.func,
51
+ inputValue: PropTypes.string,
52
+ };
53
+
54
+ static defaultProps = {
55
+ prefixCls: cssClasses.PREFIX_OPTION
56
+ };
57
+
58
+ onClick({ value, label, children, ...rest }: Partial<OptionProps>, event: React.MouseEvent) {
59
+ const { props } = this;
60
+ const isDisabled = props.disabled;
61
+ if (!isDisabled) {
62
+ props.onSelect({ ...rest, value, label: label || children }, event);
63
+ }
64
+ }
65
+
66
+ renderOptionContent({ config, children, inputValue, prefixCls }: renderOptionContentArgument) {
67
+ if (isString(children) && inputValue) {
68
+ return getHighLightTextHTML(config as any);
69
+ }
70
+ return children;
71
+ }
72
+
73
+ render() {
74
+ const {
75
+ children,
76
+ disabled,
77
+ value,
78
+ selected,
79
+ label,
80
+ empty,
81
+ emptyContent,
82
+ onSelect,
83
+ focused,
84
+ showTick,
85
+ className,
86
+ style,
87
+ onMouseEnter,
88
+ prefixCls,
89
+ renderOptionItem,
90
+ inputValue,
91
+ ...rest
92
+ } = this.props;
93
+ const optionClassName = classNames(prefixCls, {
94
+ [`${prefixCls}-disabled`]: disabled,
95
+ [`${prefixCls}-selected`]: selected,
96
+ [`${prefixCls}-focused`]: focused,
97
+ [`${prefixCls}-empty`]: empty,
98
+ [className]: className,
99
+ });
100
+ const selectedIconClassName = classNames([`${prefixCls}-icon`]);
101
+
102
+ if (empty) {
103
+ if (emptyContent === null) {
104
+ return null;
105
+ }
106
+ return (
107
+ <LocaleConsumer<Locale['Select']> componentName="Select">
108
+ {(locale: Locale['Select']) => (
109
+ <div className={optionClassName} x-semi-prop="emptyContent">
110
+ {emptyContent || locale.emptyText}
111
+ </div>
112
+ )}
113
+ </LocaleConsumer>
114
+ );
115
+ }
116
+
117
+ // Since there are empty, locale and other logic, the custom renderOptionItem is directly converged to the internal option instead of being placed in Select/index
118
+ if (typeof renderOptionItem === 'function') {
119
+ return renderOptionItem({
120
+ disabled,
121
+ focused,
122
+ selected,
123
+ style,
124
+ label,
125
+ value,
126
+ inputValue,
127
+ onMouseEnter: (e: React.MouseEvent) => onMouseEnter(e),
128
+ onClick: (e: React.MouseEvent) => this.onClick({ value, label, children, ...rest }, e),
129
+ ...rest
130
+ });
131
+ }
132
+
133
+ const config = {
134
+ searchWords: inputValue,
135
+ sourceString: children,
136
+ option: {
137
+ highlightClassName: `${prefixCls}-keyword`
138
+ }
139
+ };
140
+ return (
141
+ // eslint-disable-next-line jsx-a11y/interactive-supports-focus,jsx-a11y/click-events-have-key-events
142
+ <div
143
+ className={optionClassName}
144
+ onClick={e => {
145
+ this.onClick({ value, label, children, ...rest }, e);
146
+ }}
147
+ onMouseEnter={e => onMouseEnter && onMouseEnter(e)}
148
+ role="option"
149
+ aria-selected={selected ? "true" : "false"}
150
+ aria-disabled={disabled ? "true" : "false"}
151
+ style={style}
152
+ >
153
+ {showTick ? (
154
+ <div className={selectedIconClassName}>
155
+ <IconTick />
156
+ </div>
157
+ ) : null}
158
+ {isString(children) ? <div className={`${prefixCls}-text`}>{this.renderOptionContent({ children, config, inputValue, prefixCls })}</div> : children}
159
+ </div>
160
+ );
161
+ }
162
+ }
163
+
164
+ export default Option;
@@ -50,8 +50,6 @@ describe('Calendar', () => {
50
50
  expect(clickHandler2).toHaveBeenCalledTimes(0)
51
51
  monthWrapper.find('.semi-calendar-month-skeleton li').at(0).simulate('click')
52
52
  expect(clickHandler2).toHaveBeenCalledTimes(1)
53
-
54
-
55
53
  })
56
54
 
57
55
  it('test dateGridRender', ()=>{
@@ -160,4 +158,25 @@ describe('Calendar', () => {
160
158
  expect(dailyCalendar.find(`.eventDay`).length).toBe(eventOnJuly23.length)
161
159
 
162
160
  })
161
+
162
+ it('test weekStartsOn', () => {
163
+ const displayValue = new Date(2022, 7, 1, 8, 32, 0);
164
+
165
+ let calendar = mount(<Calendar
166
+ height={400}
167
+ mode={'month'}
168
+ weekStartsOn={3}
169
+ displayValue={displayValue}
170
+ ></Calendar>);
171
+ let firstHead = calendar.find('.semi-calendar-month-header li').at(0).text();
172
+ expect(firstHead).toEqual('周三');
173
+
174
+ let defaultCalendar = mount(<Calendar
175
+ height={400}
176
+ mode={'month'}
177
+ displayValue={displayValue}
178
+ ></Calendar>);
179
+ let defaultFirstHead = defaultCalendar.find('.semi-calendar-month-header li').at(0).text();
180
+ expect(defaultFirstHead).toEqual('周日');
181
+ });
163
182
  })
@@ -527,3 +527,34 @@ class EventRenderDemo extends React.Component {
527
527
  }
528
528
 
529
529
  export const EventRender = () => <EventRenderDemo />;
530
+
531
+
532
+ export const WeekStartsOnDemo = () => {
533
+ const [v, setV] = useState(0);
534
+ return (
535
+ <div>
536
+ <RadioGroup defaultValue={v} aria-label="周起始日" name="demo-radio-group-vertical" onChange={e => setV(e.target.value)}>
537
+ <Radio value={1}>周一</Radio>
538
+ <Radio value={2}>周二</Radio>
539
+ <Radio value={3}>周三</Radio>
540
+ <Radio value={4}>周四</Radio>
541
+ <Radio value={5}>周五</Radio>
542
+ <Radio value={6}>周六</Radio>
543
+ <Radio value={0}>周日</Radio>
544
+ </RadioGroup>
545
+ <Calendar
546
+ mode="month"
547
+ weekStartsOn={v}
548
+ dateGridRender={(dateString, date) => {
549
+ console.log(dateString);
550
+ if (dateString === new Date(2019, 6, 16).toString()) {
551
+ return (
552
+ <div style={{ backgroundColor: 'red', height: '100%', width: '100%' }}>123test</div>
553
+ );
554
+ }
555
+ return null;
556
+ }}
557
+ ></Calendar>
558
+ </div>
559
+ )
560
+ }
@@ -25,6 +25,7 @@ class Calendar extends BaseComponent<CalendarProps, {}> {
25
25
  })),
26
26
  mode: PropTypes.string,
27
27
  showCurrTime: PropTypes.bool,
28
+ weekStartsOn: PropTypes.number,
28
29
  scrollTop: PropTypes.number,
29
30
  onClick: PropTypes.func,
30
31
  renderTimeDisplay: PropTypes.func,
@@ -42,7 +43,8 @@ class Calendar extends BaseComponent<CalendarProps, {}> {
42
43
  mode: 'week',
43
44
  markWeekend: false,
44
45
  height: 600,
45
- scrollTop: 400
46
+ scrollTop: 400,
47
+ weekStartsOn: 0,
46
48
  };
47
49
 
48
50
  render() {
@@ -1,4 +1,4 @@
1
- import { EventObject } from '@douyinfe/semi-foundation/calendar/foundation';
1
+ import { EventObject, weeekStartsOnEnum } from '@douyinfe/semi-foundation/calendar/foundation';
2
2
  import { strings } from '@douyinfe/semi-foundation/calendar/constants';
3
3
  import { ArrayElement } from '../_base/base';
4
4
  import { BaseProps } from '../_base/baseComponent';
@@ -10,6 +10,7 @@ export interface CalendarProps extends BaseProps {
10
10
  events?: EventObject[];
11
11
  mode?: ArrayElement<typeof strings.MODE>;
12
12
  showCurrTime?: boolean;
13
+ weekStartsOn?: weeekStartsOnEnum;
13
14
  scrollTop?: number;
14
15
  onClick?: (e: React.MouseEvent, value: Date) => void;
15
16
  onClose?: (e: React.MouseEvent) => void;
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable jsx-a11y/no-static-element-interactions */
2
- import React, { ReactNode, Children, ReactChild, ReactFragment, ReactPortal } from 'react';
2
+ import React, { ReactNode, Children, ReactChild, ReactFragment, ReactPortal } from 'react';
3
3
  import cls from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import BaseComponent from "../_base/baseComponent";
@@ -135,7 +135,7 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
135
135
  };
136
136
 
137
137
  handleAutoPlay = (): void => {
138
- if (!this.foundation.getIsControledComponent()){
138
+ if (!this.foundation.getIsControlledComponent()){
139
139
  this.foundation.handleAutoPlay();
140
140
  }
141
141
  }
@@ -149,7 +149,7 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
149
149
 
150
150
  handleMouseLeave = (): void => {
151
151
  const { autoPlay } = this.props;
152
- if ((typeof autoPlay !== 'object' || autoPlay.hoverToPause) && !this.foundation.getIsControledComponent()){
152
+ if ((typeof autoPlay !== 'object' || autoPlay.hoverToPause) && !this.foundation.getIsControlledComponent()){
153
153
  this.foundation.handleAutoPlay();
154
154
  }
155
155
  }
@@ -158,7 +158,7 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
158
158
  return this.foundation.onIndicatorChange(activeIndex);
159
159
  };
160
160
 
161
- getChildren = (): (ReactChild | ReactFragment | ReactPortal)[] => {
161
+ getChildren = (): (ReactChild | ReactFragment | ReactPortal)[] => {
162
162
  const { children: originChildren } = this.props;
163
163
  return Children.toArray(originChildren).filter(child=>{
164
164
  return React.isValidElement(child);
@@ -200,7 +200,7 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
200
200
  [`${cssClasses.CAROUSEL_CONTENT}-item`]: true,
201
201
  [`${cssClasses.CAROUSEL_CONTENT}-item-active`]: isCurrent,
202
202
  [`${cssClasses.CAROUSEL_CONTENT}-item-slide-in`]:animation === 'slide' && !isInit && isCurrent,
203
- [`${cssClasses.CAROUSEL_CONTENT}-item-slide-out`]:animation === 'slide' && !isInit && index === preIndex,
203
+ [`${cssClasses.CAROUSEL_CONTENT}-item-slide-out`]:animation === 'slide' && !isInit && index === preIndex,
204
204
  })
205
205
  });
206
206
  })}
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classnames from 'classnames';
5
- import { checkboxClasses as css } from '@douyinfe/semi-foundation/checkbox/constants';
5
+ import { checkboxClasses as css, strings } from '@douyinfe/semi-foundation/checkbox/constants';
6
6
  import CheckboxFoundation, { CheckboxAdapter, BasicCheckboxEvent, BasicTargetObject, BaseCheckboxProps } from '@douyinfe/semi-foundation/checkbox/checkboxFoundation';
7
7
  import CheckboxInner from './checkboxInner';
8
8
  import BaseComponent from '../_base/baseComponent';
@@ -10,6 +10,7 @@ import '@douyinfe/semi-foundation/checkbox/checkbox.scss';
10
10
  import { Context, CheckboxContextType } from './context';
11
11
  import { isUndefined, isBoolean, noop } from 'lodash';
12
12
  import { getUuidShort } from '@douyinfe/semi-foundation/utils/uuid';
13
+ import { CheckboxType } from './checkboxGroup';
13
14
  export type CheckboxEvent = BasicCheckboxEvent;
14
15
  export type TargetObject = BasicTargetObject;
15
16
 
@@ -31,6 +32,7 @@ export interface CheckboxProps extends BaseCheckboxProps {
31
32
  tabIndex?: number; // a11y: wrapper tabIndex
32
33
  addonId?: string;
33
34
  extraId?: string;
35
+ type?: CheckboxType;
34
36
  }
35
37
  interface CheckboxState {
36
38
  checked: boolean;
@@ -68,6 +70,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
68
70
  'aria-label': PropTypes.string,
69
71
  tabIndex: PropTypes.number,
70
72
  preventScroll: PropTypes.bool,
73
+ type: PropTypes.string,
71
74
  };
72
75
 
73
76
  static defaultProps = {
@@ -76,6 +79,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
76
79
  onChange: noop,
77
80
  onMouseEnter: noop,
78
81
  onMouseLeave: noop,
82
+ type: 'default',
79
83
  };
80
84
  checkboxEntity: CheckboxInner;
81
85
  context: CheckboxContextType;
@@ -179,7 +183,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
179
183
  value,
180
184
  role,
181
185
  tabIndex,
182
- id
186
+ id,
187
+ type,
183
188
  } = this.props;
184
189
  const { checked, addonId, extraId, focusVisible } = this.state;
185
190
  const props: Record<string, any> = {
@@ -200,6 +205,9 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
200
205
  props.isCardType = isCardType;
201
206
  props.isPureCardType = isPureCardType;
202
207
  props['name'] = this.context.checkboxGroup.name;
208
+ } else {
209
+ props.isPureCardType = type === strings.TYPE_PURECARD;
210
+ props.isCardType = type === strings.TYPE_CARD || props.isPureCardType;
203
211
  }
204
212
 
205
213
  const prefix = prefixCls || css.PREFIX;
@@ -136,6 +136,7 @@ class CheckboxGroup extends BaseComponent<CheckboxGroupProps, CheckboxGroupState
136
136
  disabled={this.props.disabled}
137
137
  value={option}
138
138
  prefixCls={prefixCls}
139
+ type={type}
139
140
  >
140
141
  {option}
141
142
  </Checkbox>
@@ -152,6 +153,7 @@ class CheckboxGroup extends BaseComponent<CheckboxGroupProps, CheckboxGroupState
152
153
  className={option.className}
153
154
  style={option.style}
154
155
  onChange={option.onChange}
156
+ type={type}
155
157
  >
156
158
  {option.label}
157
159
  </Checkbox>