@douyinfe/semi-foundation 2.40.0-alpha.0 → 2.40.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 (225) hide show
  1. package/anchor/foundation.ts +0 -2
  2. package/anchor/linkFoundation.ts +0 -1
  3. package/autoComplete/foundation.ts +0 -1
  4. package/autoComplete/optionFoundation.ts +0 -2
  5. package/avatar/constants.ts +21 -4
  6. package/avatar/foundation.ts +3 -3
  7. package/base/foundation.ts +0 -1
  8. package/breadcrumb/foundation.ts +0 -1
  9. package/button/button.scss +0 -1
  10. package/calendar/eventUtil.ts +0 -2
  11. package/calendar/foundation.ts +0 -1
  12. package/cascader/foundation.ts +0 -5
  13. package/checkbox/checkbox.scss +0 -1
  14. package/checkbox/checkboxFoundation.ts +1 -2
  15. package/checkbox/checkboxGroupFoundation.ts +0 -1
  16. package/datePicker/foundation.ts +1 -4
  17. package/datePicker/inputFoundation.ts +0 -3
  18. package/datePicker/monthFoundation.ts +0 -1
  19. package/datePicker/monthsGridFoundation.ts +0 -2
  20. package/datePicker/yearAndMonthFoundation.ts +0 -2
  21. package/form/foundation.ts +12 -10
  22. package/form/interface.ts +4 -5
  23. package/form/utils.ts +0 -3
  24. package/image/image.scss +8 -4
  25. package/image/previewImageFoundation.ts +1 -1
  26. package/image/previewInnerFoundation.ts +11 -7
  27. package/image/variables.scss +1 -1
  28. package/input/foundation.ts +0 -2
  29. package/input/textareaFoundation.ts +0 -2
  30. package/inputNumber/foundation.ts +0 -5
  31. package/lib/cjs/anchor/foundation.js +0 -2
  32. package/lib/cjs/anchor/linkFoundation.js +0 -1
  33. package/lib/cjs/autoComplete/foundation.js +0 -2
  34. package/lib/cjs/autoComplete/optionFoundation.js +0 -2
  35. package/lib/cjs/avatar/constants.js +0 -1
  36. package/lib/cjs/avatar/foundation.js +2 -2
  37. package/lib/cjs/breadcrumb/foundation.js +0 -2
  38. package/lib/cjs/button/button.css +0 -1
  39. package/lib/cjs/button/button.scss +0 -1
  40. package/lib/cjs/calendar/eventUtil.js +0 -2
  41. package/lib/cjs/calendar/foundation.js +0 -1
  42. package/lib/cjs/cascader/foundation.js +0 -5
  43. package/lib/cjs/checkbox/checkbox.css +0 -1
  44. package/lib/cjs/checkbox/checkbox.scss +0 -1
  45. package/lib/cjs/checkbox/checkboxFoundation.js +0 -1
  46. package/lib/cjs/checkbox/checkboxGroupFoundation.js +0 -1
  47. package/lib/cjs/datePicker/foundation.js +0 -5
  48. package/lib/cjs/datePicker/inputFoundation.js +0 -4
  49. package/lib/cjs/datePicker/monthFoundation.js +0 -1
  50. package/lib/cjs/datePicker/monthsGridFoundation.js +0 -3
  51. package/lib/cjs/datePicker/yearAndMonthFoundation.js +0 -2
  52. package/lib/cjs/form/foundation.d.ts +4 -4
  53. package/lib/cjs/form/foundation.js +9 -8
  54. package/lib/cjs/form/interface.d.ts +4 -4
  55. package/lib/cjs/form/utils.js +0 -3
  56. package/lib/cjs/image/image.css +3 -1
  57. package/lib/cjs/image/image.scss +8 -4
  58. package/lib/cjs/image/previewInnerFoundation.d.ts +4 -2
  59. package/lib/cjs/image/previewInnerFoundation.js +2 -1
  60. package/lib/cjs/image/variables.scss +1 -1
  61. package/lib/cjs/input/foundation.js +0 -2
  62. package/lib/cjs/input/textareaFoundation.js +0 -2
  63. package/lib/cjs/inputNumber/foundation.js +0 -6
  64. package/lib/cjs/navigation/NavItem.js +0 -2
  65. package/lib/cjs/navigation/foundation.js +1 -4
  66. package/lib/cjs/navigation/itemFoundation.js +0 -1
  67. package/lib/cjs/navigation/subNavFoundation.js +1 -2
  68. package/lib/cjs/notification/notificationListFoundation.js +0 -2
  69. package/lib/cjs/pagination/foundation.d.ts +2 -0
  70. package/lib/cjs/pagination/foundation.js +16 -4
  71. package/lib/cjs/popconfirm/popconfirmFoundation.js +0 -2
  72. package/lib/cjs/radio/radio.css +1 -0
  73. package/lib/cjs/radio/radio.scss +1 -0
  74. package/lib/cjs/radio/radioGroupFoundation.js +0 -1
  75. package/lib/cjs/radio/radioInnerFoundation.js +0 -1
  76. package/lib/cjs/radio/variables.scss +1 -0
  77. package/lib/cjs/rating/foundation.js +0 -2
  78. package/lib/cjs/select/foundation.js +0 -5
  79. package/lib/cjs/select/optionFoundation.js +0 -2
  80. package/lib/cjs/select/select.css +0 -35
  81. package/lib/cjs/select/select.scss +11 -63
  82. package/lib/cjs/select/variables.scss +0 -10
  83. package/lib/cjs/skeleton/skeleton.css +2 -2
  84. package/lib/cjs/skeleton/variables.scss +2 -2
  85. package/lib/cjs/slider/foundation.js +0 -8
  86. package/lib/cjs/switch/foundation.js +0 -1
  87. package/lib/cjs/table/bodyFoundation.js +0 -1
  88. package/lib/cjs/table/constants.js +0 -2
  89. package/lib/cjs/table/foundation.js +0 -9
  90. package/lib/cjs/table/tableRowFoundation.js +0 -1
  91. package/lib/cjs/table/utils.js +0 -4
  92. package/lib/cjs/tag/constants.js +0 -2
  93. package/lib/cjs/tagInput/foundation.js +0 -2
  94. package/lib/cjs/timePicker/foundation.js +6 -8
  95. package/lib/cjs/timePicker/inputFoundation.js +0 -2
  96. package/lib/cjs/timePicker/utils/index.js +2 -2
  97. package/lib/cjs/tooltip/foundation.js +0 -11
  98. package/lib/cjs/transfer/foundation.js +0 -1
  99. package/lib/cjs/tree/foundation.js +0 -1
  100. package/lib/cjs/tree/treeUtil.js +0 -9
  101. package/lib/cjs/treeSelect/foundation.js +0 -1
  102. package/lib/cjs/upload/foundation.js +3 -1
  103. package/lib/cjs/utils/Event.js +0 -1
  104. package/lib/cjs/utils/date-fns-extra.js +0 -3
  105. package/lib/cjs/utils/function.js +0 -1
  106. package/lib/cjs/utils/object.js +0 -4
  107. package/lib/es/anchor/foundation.js +0 -2
  108. package/lib/es/anchor/linkFoundation.js +0 -1
  109. package/lib/es/autoComplete/foundation.js +0 -1
  110. package/lib/es/autoComplete/optionFoundation.js +0 -2
  111. package/lib/es/avatar/constants.js +0 -1
  112. package/lib/es/avatar/foundation.js +2 -2
  113. package/lib/es/breadcrumb/foundation.js +0 -1
  114. package/lib/es/button/button.css +0 -1
  115. package/lib/es/button/button.scss +0 -1
  116. package/lib/es/calendar/eventUtil.js +0 -2
  117. package/lib/es/calendar/foundation.js +0 -1
  118. package/lib/es/cascader/foundation.js +0 -5
  119. package/lib/es/checkbox/checkbox.css +0 -1
  120. package/lib/es/checkbox/checkbox.scss +0 -1
  121. package/lib/es/checkbox/checkboxFoundation.js +0 -1
  122. package/lib/es/checkbox/checkboxGroupFoundation.js +0 -1
  123. package/lib/es/datePicker/foundation.js +0 -4
  124. package/lib/es/datePicker/inputFoundation.js +0 -3
  125. package/lib/es/datePicker/monthFoundation.js +0 -1
  126. package/lib/es/datePicker/monthsGridFoundation.js +0 -2
  127. package/lib/es/datePicker/yearAndMonthFoundation.js +0 -2
  128. package/lib/es/form/foundation.d.ts +4 -4
  129. package/lib/es/form/foundation.js +9 -7
  130. package/lib/es/form/interface.d.ts +4 -4
  131. package/lib/es/form/utils.js +0 -3
  132. package/lib/es/image/image.css +3 -1
  133. package/lib/es/image/image.scss +8 -4
  134. package/lib/es/image/previewInnerFoundation.d.ts +4 -2
  135. package/lib/es/image/previewInnerFoundation.js +2 -1
  136. package/lib/es/image/variables.scss +1 -1
  137. package/lib/es/input/foundation.js +0 -2
  138. package/lib/es/input/textareaFoundation.js +0 -2
  139. package/lib/es/inputNumber/foundation.js +0 -5
  140. package/lib/es/navigation/NavItem.js +0 -2
  141. package/lib/es/navigation/foundation.js +1 -3
  142. package/lib/es/navigation/itemFoundation.js +0 -1
  143. package/lib/es/navigation/subNavFoundation.js +1 -2
  144. package/lib/es/notification/notificationListFoundation.js +0 -1
  145. package/lib/es/pagination/foundation.d.ts +2 -0
  146. package/lib/es/pagination/foundation.js +16 -3
  147. package/lib/es/popconfirm/popconfirmFoundation.js +0 -1
  148. package/lib/es/radio/radio.css +1 -0
  149. package/lib/es/radio/radio.scss +1 -0
  150. package/lib/es/radio/radioGroupFoundation.js +0 -1
  151. package/lib/es/radio/radioInnerFoundation.js +0 -1
  152. package/lib/es/radio/variables.scss +1 -0
  153. package/lib/es/rating/foundation.js +0 -1
  154. package/lib/es/select/foundation.js +0 -5
  155. package/lib/es/select/optionFoundation.js +0 -2
  156. package/lib/es/select/select.css +0 -35
  157. package/lib/es/select/select.scss +11 -63
  158. package/lib/es/select/variables.scss +0 -10
  159. package/lib/es/skeleton/skeleton.css +2 -2
  160. package/lib/es/skeleton/variables.scss +2 -2
  161. package/lib/es/slider/foundation.js +0 -7
  162. package/lib/es/switch/foundation.js +0 -1
  163. package/lib/es/table/bodyFoundation.js +0 -1
  164. package/lib/es/table/constants.js +0 -1
  165. package/lib/es/table/foundation.js +0 -8
  166. package/lib/es/table/tableRowFoundation.js +0 -1
  167. package/lib/es/table/utils.js +0 -3
  168. package/lib/es/tag/constants.js +0 -1
  169. package/lib/es/tagInput/foundation.js +0 -2
  170. package/lib/es/timePicker/foundation.js +6 -7
  171. package/lib/es/timePicker/inputFoundation.js +0 -2
  172. package/lib/es/timePicker/utils/index.js +2 -1
  173. package/lib/es/tooltip/foundation.js +0 -10
  174. package/lib/es/transfer/foundation.js +0 -1
  175. package/lib/es/tree/foundation.js +0 -1
  176. package/lib/es/tree/treeUtil.js +0 -9
  177. package/lib/es/treeSelect/foundation.js +0 -1
  178. package/lib/es/upload/foundation.js +3 -1
  179. package/lib/es/utils/Event.js +0 -1
  180. package/lib/es/utils/date-fns-extra.js +0 -2
  181. package/lib/es/utils/function.js +0 -1
  182. package/lib/es/utils/object.js +0 -3
  183. package/modal/modalFoundation.ts +3 -4
  184. package/navigation/NavItem.ts +0 -2
  185. package/navigation/foundation.ts +1 -3
  186. package/navigation/itemFoundation.ts +0 -1
  187. package/navigation/subNavFoundation.ts +1 -2
  188. package/notification/notificationListFoundation.ts +0 -2
  189. package/package.json +3 -3
  190. package/pagination/foundation.ts +13 -3
  191. package/popconfirm/popconfirmFoundation.ts +0 -1
  192. package/radio/radio.scss +1 -0
  193. package/radio/radioGroupFoundation.ts +0 -1
  194. package/radio/radioInnerFoundation.ts +0 -1
  195. package/radio/variables.scss +1 -0
  196. package/rating/foundation.ts +0 -1
  197. package/select/foundation.ts +0 -5
  198. package/select/optionFoundation.ts +0 -2
  199. package/select/select.scss +11 -63
  200. package/select/variables.scss +0 -10
  201. package/skeleton/variables.scss +2 -2
  202. package/slider/foundation.ts +0 -7
  203. package/switch/foundation.ts +0 -1
  204. package/table/bodyFoundation.ts +0 -1
  205. package/table/constants.ts +0 -1
  206. package/table/foundation.ts +0 -8
  207. package/table/tableRowFoundation.ts +0 -1
  208. package/table/utils.ts +0 -3
  209. package/tag/constants.ts +19 -2
  210. package/tagInput/foundation.ts +0 -2
  211. package/timePicker/foundation.ts +7 -8
  212. package/timePicker/inputFoundation.ts +0 -2
  213. package/timePicker/utils/index.ts +2 -1
  214. package/toast/toastFoundation.ts +1 -4
  215. package/toast/toastListFoundation.ts +0 -1
  216. package/tooltip/foundation.ts +0 -10
  217. package/transfer/foundation.ts +0 -1
  218. package/tree/foundation.ts +0 -1
  219. package/tree/treeUtil.ts +1 -10
  220. package/treeSelect/foundation.ts +0 -1
  221. package/upload/foundation.ts +3 -1
  222. package/utils/Event.ts +0 -1
  223. package/utils/date-fns-extra.ts +0 -2
  224. package/utils/function.ts +0 -1
  225. package/utils/object.ts +0 -3
@@ -30,10 +30,8 @@ export default class AnchorFoundation<P = Record<string, any>, S = Record<string
30
30
  super({ ...AnchorFoundation.defaultAdapter, ...adapter });
31
31
  }
32
32
 
33
- // eslint-disable-next-line @typescript-eslint/no-empty-function
34
33
  init = () => {};
35
34
 
36
- // eslint-disable-next-line @typescript-eslint/no-empty-function
37
35
  destroy = () => {};
38
36
 
39
37
  addLink = (link: string) => {
@@ -16,7 +16,6 @@ export default class LinkFoundation extends BaseFoundation<LinkAdapter> {
16
16
  // this.setInitValue();
17
17
  }
18
18
 
19
- // eslint-disable-next-line @typescript-eslint/no-empty-function
20
19
  destroy() {}
21
20
 
22
21
  handleAddLink() {
@@ -1,4 +1,3 @@
1
- /* eslint-disable prefer-const, max-len */
2
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
2
  import { isString, isNumber, isUndefined, isObject } from 'lodash';
4
3
  import warning from '../utils/warning';
@@ -22,10 +22,8 @@ export default class OptionFoundation extends BaseFoundation<OptionDefaultAdapte
22
22
  super({ ...adapter });
23
23
  }
24
24
 
25
- // eslint-disable-next-line @typescript-eslint/no-empty-function
26
25
  init() {}
27
26
 
28
- // eslint-disable-next-line @typescript-eslint/no-empty-function
29
27
  destroy() {}
30
28
 
31
29
  onOptionClick(option: BasicOptionProps) {
@@ -7,9 +7,26 @@ const cssClasses = {
7
7
  const strings = {
8
8
  SHAPE: ['circle', 'square'],
9
9
  SIZE: ['extra-extra-small', 'extra-small', 'small', 'default', 'medium', 'large', 'extra-large'],
10
- // eslint-disable-next-line max-len
11
- COLOR: ['grey', 'red', 'pink', 'purple', 'violet', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime', 'yellow', 'amber', 'orange', 'white'],
12
- OVERLAP_FROM: ['start', 'end']
10
+ COLOR: [
11
+ 'grey',
12
+ 'red',
13
+ 'pink',
14
+ 'purple',
15
+ 'violet',
16
+ 'indigo',
17
+ 'blue',
18
+ 'light-blue',
19
+ 'cyan',
20
+ 'teal',
21
+ 'green',
22
+ 'light-green',
23
+ 'lime',
24
+ 'yellow',
25
+ 'amber',
26
+ 'orange',
27
+ 'white',
28
+ ],
29
+ OVERLAP_FROM: ['start', 'end'],
13
30
  };
14
31
 
15
- export { cssClasses, strings };
32
+ export { cssClasses, strings };
@@ -14,9 +14,9 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
14
14
  super({ ...adapter });
15
15
  }
16
16
 
17
- init() { } // eslint-disable-line
17
+ init() { }
18
18
 
19
- destroy() { } // eslint-disable-line
19
+ destroy() { }
20
20
 
21
21
  handleImgLoadError() {
22
22
  const { onError } = this.getProps();
@@ -40,7 +40,7 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
40
40
  if (target.matches(':focus-visible')) {
41
41
  this._adapter.setFocusVisible(true);
42
42
  }
43
- } catch (error){
43
+ } catch (error) {
44
44
  warning(true, 'Warning: [Semi Avatar] The current browser does not support the focus-visible');
45
45
  }
46
46
  }
@@ -8,7 +8,6 @@ import log from '../utils/log';
8
8
  import { noop } from 'lodash';
9
9
 
10
10
  export type noopFunction = (...args: any) => any;
11
- // eslint-disable-next-line
12
11
  export interface DefaultAdapter<P = Record<string, any>, S = Record<string, any>> {
13
12
  getContext(key: string): any;
14
13
  getContexts(): any;
@@ -1,4 +1,3 @@
1
- /* eslint-disable prefer-const */
2
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
2
  import isEnterPress from '../utils/isEnterPress';
4
3
  import { BreadcrumbItemInfo, Route } from './itemFoundation';
@@ -11,7 +11,6 @@ $module: #{$prefix}-button;
11
11
  display: inline-flex;
12
12
  align-items: center;
13
13
  justify-content: center;
14
- margin: 0;
15
14
  cursor: pointer;
16
15
  user-select: none;
17
16
  border: $width-button-border $color-button_primary-border-default solid;
@@ -251,7 +251,6 @@ export const filterEvents = (events: Map<string, EventObject[]>, start: Date, en
251
251
  * @returns {arr}
252
252
  * filter out event that is not in the week range
253
253
  */
254
- // eslint-disable-next-line max-len
255
254
  export const filterWeeklyEvents = (events: Map<string, EventObject[]>, weekStart: Date, weekStartsOn: weekStartsOnEnum ) => filterEvents(events, weekStart, addDays(endOfWeek(weekStart, { weekStartsOn }), 1));
256
255
 
257
256
  /**
@@ -331,7 +330,6 @@ export const collectDailyEvents = (events: ParsedRangeEvent[][]) => {
331
330
  };
332
331
 
333
332
  export const renderDailyEvent = (event: EventObject) => {
334
- // eslint-disable-next-line prefer-const
335
333
  let { start, end, allDay, children } = event;
336
334
  let startPos,
337
335
  endPos;
@@ -114,7 +114,6 @@ export default class CalendarFoundation<P = Record<string, any>, S = Record<stri
114
114
  super({ ...adapter });
115
115
  }
116
116
 
117
- // eslint-disable-next-line @typescript-eslint/no-empty-function
118
117
  init() {
119
118
 
120
119
  }
@@ -226,7 +226,6 @@ export interface CascaderAdapter extends DefaultAdapter<BasicCascaderProps, Basi
226
226
  updateFocusState: (focus: boolean) => void
227
227
  }
228
228
 
229
- // eslint-disable-next-line max-len
230
229
  export default class CascaderFoundation extends BaseFoundation<CascaderAdapter, BasicCascaderProps, BasicCascaderInnerData> {
231
230
 
232
231
  constructor(adapter: CascaderAdapter) {
@@ -259,7 +258,6 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
259
258
  const valueProp: string | any[] = onChangeWithObject ? [] : 'value';
260
259
  if (multiple) {
261
260
  const valuePath: BasicValue = [];
262
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
263
261
  // @ts-ignore
264
262
  item.forEach((checkedKey: string) => {
265
263
  const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
@@ -337,9 +335,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
337
335
  if (isEmpty(keyEntities[selectedKey])) {
338
336
  if (includes(selectedKey, 'not-exist-')) {
339
337
  /* Get the value behind not-exist- */
340
- // eslint-disable-next-line prefer-destructuring
341
338
  const targetValue = selectedKey.match(/not-exist-(\S*)/)[1];
342
- // eslint-disable-next-line max-depth
343
339
  if (isEmpty(keyEntities[targetValue])) {
344
340
  cacheValue = targetValue;
345
341
  } else {
@@ -974,7 +970,6 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
974
970
  }
975
971
  return (Object.values(keyEntities) as BasicEntity[])
976
972
  .filter(item => item.parentKey === null && !item._notExist)
977
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
978
973
  // @ts-ignore
979
974
  .sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
980
975
  }
@@ -12,7 +12,6 @@ $module: #{$prefix}-checkbox;
12
12
  position: relative;
13
13
  display: flex;
14
14
  align-items: flex-start;
15
- flex-wrap: wrap;
16
15
  @include font-size-regular;
17
16
  cursor: pointer;
18
17
  transition: background-color $transition_duration-checkbox-bg $transition_function-checkbox-bg $transition_delay-checkbox-bg,
@@ -117,7 +117,7 @@ class CheckboxFoundation<P = Record<string, any>, S = Record<string, any>> exten
117
117
  if (target.matches(':focus-visible')) {
118
118
  this._adapter.setFocusVisible(true);
119
119
  }
120
- } catch (error){
120
+ } catch (error) {
121
121
  warning(true, 'Warning: [Semi Checkbox] The current browser does not support the focus-visible');
122
122
  }
123
123
  }
@@ -127,7 +127,6 @@ class CheckboxFoundation<P = Record<string, any>, S = Record<string, any>> exten
127
127
  this._adapter.setFocusVisible(false);
128
128
  }
129
129
 
130
- // eslint-disable-next-line @typescript-eslint/no-empty-function
131
130
  destroy() {}
132
131
  }
133
132
 
@@ -74,7 +74,6 @@ class CheckboxGroupFoundation extends BaseFoundation<CheckboxGroupAdapter> {
74
74
  }
75
75
  }
76
76
 
77
- // eslint-disable-next-line @typescript-eslint/no-empty-function
78
77
  destroy() {}
79
78
  }
80
79
 
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-nested-ternary */
2
- /* eslint-disable max-len, max-depth, */
3
1
  import { format, isValid, isSameSecond, isEqual as isDateEqual, isDate } from 'date-fns';
4
2
  import { get, isObject, isString, isEqual, isFunction } from 'lodash';
5
3
 
@@ -568,7 +566,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
568
566
  * @param {String} input
569
567
  * @param {Event} e
570
568
  */
571
- // eslint-disable-next-line @typescript-eslint/no-empty-function
572
569
  handleInputBlur(input = '', e?: any) {
573
570
  }
574
571
 
@@ -624,7 +621,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
624
621
  this._adapter.setRangeInputFocus(false);
625
622
  this._adapter.notifyClear(e);
626
623
  }
627
- // eslint-disable-next-line @typescript-eslint/no-empty-function
624
+
628
625
  handleRangeInputBlur(value: any, e: any) {
629
626
  }
630
627
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-len */
2
1
  import { cloneDeep, isObject, set, get } from 'lodash';
3
2
  import { format as formatFn } from 'date-fns';
4
3
 
@@ -111,10 +110,8 @@ export default class InputFoundation extends BaseFoundation<DateInputAdapter> {
111
110
  super({ ...adapter });
112
111
  }
113
112
 
114
- // eslint-disable-next-line @typescript-eslint/no-empty-function
115
113
  init() {}
116
114
 
117
- // eslint-disable-next-line @typescript-eslint/no-empty-function
118
115
  destroy() {}
119
116
 
120
117
  handleClick(e: any) {
@@ -114,7 +114,6 @@ export default class CalendarMonthFoundation extends BaseFoundation<MonthAdapter
114
114
  this._adapter.setWeekDays(weekdays);
115
115
  }
116
116
 
117
- // eslint-disable-next-line @typescript-eslint/no-empty-function
118
117
  destroy() {}
119
118
 
120
119
  handleClick(day: MonthDayInfo) {
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-len */
2
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
2
  import { strings } from './constants';
4
3
  import {
@@ -305,7 +304,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
305
304
  this._initDateRangePickerFromValue(values, true);
306
305
  }
307
306
 
308
- // eslint-disable-next-line @typescript-eslint/no-empty-function
309
307
  destroy() { }
310
308
 
311
309
  /**
@@ -65,10 +65,8 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
65
65
  super({ ...adapter });
66
66
  }
67
67
 
68
- // eslint-disable-next-line @typescript-eslint/no-empty-function
69
68
  init() {}
70
69
 
71
- // eslint-disable-next-line @typescript-eslint/no-empty-function
72
70
  destroy() {}
73
71
 
74
72
  selectYear(item: YearScrollItem, panelType?: PanelType) {
@@ -1,10 +1,9 @@
1
- /* eslint-disable prefer-const, max-len */
2
1
  import BaseFoundation from '../base/foundation';
3
2
  import * as ObjectUtil from '../utils/object';
4
3
  import isPromise from '../utils/isPromise';
5
4
  import { isValid } from './utils';
6
5
  import { isUndefined, isFunction, toPath } from 'lodash';
7
- import scrollIntoView, { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
6
+ import scrollIntoView, { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
8
7
 
9
8
  import { BaseFormAdapter, FormState, CallOpts, FieldState, FieldStaff, ComponentProps, setValuesConfig, ArrayFieldStaff } from './interface';
10
9
 
@@ -175,14 +174,16 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
175
174
  maybePromisedErrors = errors;
176
175
  }
177
176
  if (!maybePromisedErrors) {
178
- resolve(values);
177
+ const _values = this._adapter.cloneDeep(values);
178
+ resolve(_values);
179
179
  this.injectErrorToField({});
180
180
  } else if (isPromise(maybePromisedErrors)) {
181
181
  maybePromisedErrors.then(
182
182
  (result: any) => {
183
183
  // validate success,clear error
184
184
  if (!result) {
185
- resolve(values);
185
+ const _values = this._adapter.cloneDeep(values);
186
+ resolve(_values);
186
187
  this.injectErrorToField({});
187
188
  } else {
188
189
  this.data.errors = result;
@@ -237,7 +238,8 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
237
238
  this._adapter.forceUpdate();
238
239
  const errors = this.getError();
239
240
  if (this._isValid(targetFields)) {
240
- resolve(values);
241
+ const _values = this._adapter.cloneDeep(values);
242
+ resolve(_values);
241
243
  } else {
242
244
  this._autoScroll();
243
245
  reject(errors);
@@ -246,19 +248,19 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
246
248
  });
247
249
  }
248
250
 
249
- submit(): void {
251
+ submit(e?: any): void {
250
252
  const { values } = this.data;
251
253
  // validate form
252
254
  this.validate()
253
255
  .then((resolveValues: any) => {
254
256
  // if valid do submit
255
257
  const _values = this._adapter.cloneDeep(resolveValues);
256
- this._adapter.notifySubmit(_values);
258
+ this._adapter.notifySubmit(_values, e);
257
259
  })
258
260
  .catch(errors => {
259
261
  const _errors = this._adapter.cloneDeep(errors);
260
262
  const _values = this._adapter.cloneDeep(values);
261
- this._adapter.notifySubmitFail(_errors, _values);
263
+ this._adapter.notifySubmitFail(_errors, _values, e);
262
264
  });
263
265
  }
264
266
 
@@ -694,7 +696,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
694
696
  }
695
697
  }
696
698
 
697
- _getErrorFieldAndScroll(scrollOpts?: scrollIntoViewOptions | boolean): void {
699
+ _getErrorFieldAndScroll(scrollOpts?: ScrollIntoViewOptions | boolean): void {
698
700
  const errorDOM = this._adapter.getAllErrorDOM();
699
701
  if (errorDOM && errorDOM.length) {
700
702
  try {
@@ -704,7 +706,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
704
706
  }
705
707
  }
706
708
 
707
- scrollToField(field: string, scrollOpts = { behavior: 'smooth', block: 'start' } as scrollIntoViewOptions): void {
709
+ scrollToField(field: string, scrollOpts = { behavior: 'smooth', block: 'start' } as ScrollIntoViewOptions): void {
708
710
  if (this.getFieldExist(field)) {
709
711
  const fieldDOM = this._adapter.getFieldDOM(field);
710
712
  scrollIntoView(fieldDOM as Element, scrollOpts);
package/form/interface.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/ban-types */
2
- /* eslint-disable max-len */
3
2
  import { DefaultAdapter } from '../base/foundation';
4
- import { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
3
+ import { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
5
4
 
6
5
  export type BasicTriggerType = 'blur' | 'change' | 'custom' | 'mount';
7
6
 
@@ -13,8 +12,8 @@ export type BasicFieldError = Array<any>;
13
12
 
14
13
  export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any>, Values extends object = any> extends DefaultAdapter<P, S> {
15
14
  cloneDeep: (val: any, ...rest: any[]) => any;
16
- notifySubmit: (values: any) => void;
17
- notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values>) => void;
15
+ notifySubmit: (values: any, e?: any) => void;
16
+ notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values>, e?: any) => void;
18
17
  forceUpdate: (callback?: () => void) => void;
19
18
  notifyChange: (formState: FormState) => void;
20
19
  notifyValueChange: (values: any, changedValues: any) => void;
@@ -66,7 +65,7 @@ export interface BaseFormApi<T extends object = any> {
66
65
  getValues: () => T;
67
66
  /** set value of multiple fields */
68
67
  setValues: (fieldsValue: Partial<T>, config?: setValuesConfig) => void;
69
- scrollToField: <K extends keyof T>(field: K, scrollConfig?: scrollIntoViewOptions) => void
68
+ scrollToField: <K extends keyof T>(field: K, scrollConfig?: ScrollIntoViewOptions) => void
70
69
  }
71
70
 
72
71
  export interface CallOpts {
package/form/utils.ts CHANGED
@@ -1,6 +1,3 @@
1
- /* eslint-disable prefer-destructuring */
2
- /* eslint-disable prefer-const */
3
- /* eslint-disable @typescript-eslint/no-unused-vars */
4
1
  import AsyncValidator from 'async-validator';
5
2
  import { cloneDeep, toPath } from 'lodash';
6
3
  import { FieldValidateTriggerType, BasicTriggerType, ComponentProps, WithFieldOption } from './interface';
package/image/image.scss CHANGED
@@ -123,10 +123,14 @@ $module: #{$prefix}-image;
123
123
  &-footer {
124
124
  display: flex;
125
125
  align-items: center;
126
- padding: $spacing-image_preview_footer-paddingY $spacing-image_preview_footer-paddingX;
127
- background: $color-image_preview_footer-bg;
128
- border-radius: $radius-image_preview_footer;
129
- height: $height-image_preview_footer;
126
+
127
+ &-content {
128
+ padding: $spacing-image_preview_footer-paddingY $spacing-image_preview_footer-paddingX;
129
+ background: $color-image_preview_footer-bg;
130
+ border-radius: $radius-image_preview_footer;
131
+ height: $height-image_preview_footer;
132
+ }
133
+
130
134
 
131
135
  &-wrapper {
132
136
  position: absolute;
@@ -148,7 +148,7 @@ export default class PreviewImageFoundation<P = Record<string, any>, S = Record<
148
148
  onWheel = throttle((e: any): void => {
149
149
  const { onZoom, zoomStep, maxZoom, minZoom } = this.getProps();
150
150
  const { currZoom } = this.getStates();
151
- let _zoom:number;
151
+ let _zoom: number;
152
152
  if (e.deltaY < 0) {
153
153
  /* zoom in */
154
154
  if (currZoom + zoomStep <= maxZoom) {
@@ -2,13 +2,14 @@ import BaseFoundation, { DefaultAdapter } from "../base/foundation";
2
2
  import KeyCode from "../utils/keyCode";
3
3
  import { getPreloadImagArr, downloadImage, isTargetEmit } from "./utils";
4
4
 
5
+ export type RatioType = "adaptation" | "realSize";
5
6
  export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
6
7
  getIsInGroup: () => boolean;
7
8
  notifyChange: (index: number, direction: string) => void;
8
9
  notifyZoom: (zoom: number, increase: boolean) => void;
9
10
  notifyClose: () => void;
10
11
  notifyVisibleChange: (visible: boolean) => void;
11
- notifyRatioChange: (type: string) => void;
12
+ notifyRatioChange: (type: RatioType) => void;
12
13
  notifyRotateChange: (angle: number) => void;
13
14
  notifyDownload: (src: string, index: number) => void;
14
15
  registerKeyDownListener: () => void;
@@ -20,9 +21,11 @@ export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string,
20
21
  setStartMouseDown: (x: number, y: number) => void;
21
22
  setMouseActiveTime: (time: number) => void;
22
23
  disabledBodyScroll: () => void;
23
- enabledBodyScroll: () => void
24
+ enabledBodyScroll: () => void;
25
+ getSetDownloadFunc: () => (src: string) => string
24
26
  }
25
27
 
28
+
26
29
  const NOT_CLOSE_TARGETS = ["icon", "footer"];
27
30
  const STOP_CLOSE_TARGET = ["icon", "footer", "header"];
28
31
 
@@ -127,8 +130,9 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
127
130
 
128
131
  handleDownload = () => {
129
132
  const { currentIndex, imgSrc } = this.getStates();
133
+ const setDownloadName = this._adapter.getSetDownloadFunc();
130
134
  const downloadSrc = imgSrc[currentIndex];
131
- const downloadName = downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1);
135
+ const downloadName = setDownloadName ? setDownloadName(downloadSrc) : downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1);
132
136
  downloadImage(downloadSrc, downloadName);
133
137
  this._adapter.notifyDownload(downloadSrc, currentIndex);
134
138
  }
@@ -138,7 +142,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
138
142
  this._adapter.notifyClose();
139
143
  }
140
144
 
141
- handleAdjustRatio = (type: string) => {
145
+ handleAdjustRatio = (type: RatioType) => {
142
146
  this.setState({
143
147
  ratio: type,
144
148
  } as any);
@@ -174,14 +178,14 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
174
178
  const { preLoad, preLoadGap, infinite, currentIndex } = this.getProps();
175
179
 
176
180
  const { imgSrc }= this.getStates();
177
- if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1){
181
+ if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
178
182
  return;
179
183
  }
180
184
 
181
185
  const preloadImages = getPreloadImagArr(imgSrc, currentIndex, preLoadGap, infinite);
182
186
  const Img = new Image();
183
187
  let index = 0;
184
- function callback(e: any){
188
+ function callback(e: any) {
185
189
  index++;
186
190
  if (index < preloadImages.length) {
187
191
  Img.src = preloadImages[index];
@@ -208,7 +212,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
208
212
  preloadSingleImage = () => {
209
213
  const { preLoad, preLoadGap, infinite } = this.getProps();
210
214
  const { imgSrc, currentIndex, direction, imgLoadStatus } = this.getStates();
211
- if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1){
215
+ if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
212
216
  return;
213
217
  }
214
218
  // 根据方向决定preload那个index
@@ -27,7 +27,7 @@ $height-image_preview_icon: 40px; // 图像预览footer操作区icon高度
27
27
  $height-image_preview_header_close: 30px; // 图像预览header部分的关闭热区高度
28
28
 
29
29
  $radius-image: var(--semi-border-radius-small); // 图像圆角
30
- $radius-image_preview_footer: 6px; // 图像预览footer操作区圆角
30
+ $radius-image_preview_footer: var(--semi-border-radius-medium); // 图像预览footer操作区圆角
31
31
 
32
32
  $color-image_mask-bg: var(--semi-color-overlay-bg); // 图像蒙层背景色
33
33
  $color-image_mask_info_text: var(--semi-color-white); // 图像蒙层文字颜色
@@ -51,7 +51,6 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
51
51
  }
52
52
  }
53
53
 
54
- // eslint-disable-next-line
55
54
  setDisable() {}
56
55
 
57
56
  _setInitValue() {
@@ -120,7 +119,6 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
120
119
  if (isNumber(maxLength) && maxLength >= 0 && isFunction(getValueLength) && isString(value)) {
121
120
  const valueLength = getValueLength(value);
122
121
  if (valueLength > maxLength) {
123
- // eslint-disable-next-line max-len
124
122
  console.warn('[Semi Input] The input character is truncated because the input length exceeds the maximum length limit');
125
123
  const truncatedValue = this.handleTruncateValue(value, maxLength);
126
124
  return truncatedValue;
@@ -52,7 +52,6 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
52
52
  this.setInitValue();
53
53
  }
54
54
 
55
- // eslint-disable-next-line
56
55
  destroy() { }
57
56
 
58
57
  setInitValue() {
@@ -117,7 +116,6 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
117
116
  if (isNumber(maxLength) && maxLength >= 0 && isFunction(getValueLength) && isString(value)) {
118
117
  const valueLength = getValueLength(value);
119
118
  if (valueLength > maxLength) {
120
- // eslint-disable-next-line max-len
121
119
  console.warn('[Semi TextArea] The input character is truncated because the input length exceeds the maximum length limit');
122
120
  const truncatedValue = this.handleTruncateValue(value, maxLength);
123
121
  return truncatedValue;
@@ -1,6 +1,3 @@
1
- /* eslint-disable max-len */
2
- /* eslint-disable no-param-reassign */
3
- /* eslint-disable eqeqeq */
4
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
5
2
  import keyCode from '../utils/keyCode';
6
3
  import { numbers } from './constants';
@@ -177,7 +174,6 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
177
174
  const dotBeginStr = dotIndex > -1 ? valueAfterParser.slice(dotIndex) : '';
178
175
  formattedNum += dotBeginStr;
179
176
  } else if (precLength < lengthAfterDot) {
180
- // eslint-disable-next-line max-depth
181
177
  for (let i = 0; i < lengthAfterDot - precLength; i++) {
182
178
  formattedNum += '0';
183
179
  }
@@ -261,7 +257,6 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
261
257
  }
262
258
 
263
259
  if (willSetNum != null) {
264
- // eslint-disable-next-line max-depth
265
260
  if (!this._isControlledComponent('value')) {
266
261
  this._adapter.setNumber(willSetNum);
267
262
  }
@@ -14,11 +14,9 @@ const prefixCls = _constants.cssClasses.PREFIX;
14
14
  class AnchorFoundation extends _foundation.default {
15
15
  constructor(adapter) {
16
16
  var _this;
17
- // eslint-disable-next-line @typescript-eslint/no-empty-function
18
17
  super(Object.assign(Object.assign({}, AnchorFoundation.defaultAdapter), adapter));
19
18
  _this = this;
20
19
  this.init = () => {};
21
- // eslint-disable-next-line @typescript-eslint/no-empty-function
22
20
  this.destroy = () => {};
23
21
  this.addLink = link => {
24
22
  this._adapter.addLink(link);
@@ -13,7 +13,6 @@ class LinkFoundation extends _foundation.default {
13
13
  init() {
14
14
  // this.setInitValue();
15
15
  }
16
- // eslint-disable-next-line @typescript-eslint/no-empty-function
17
16
  destroy() {}
18
17
  handleAddLink() {
19
18
  const href = this._adapter.getProp('href');
@@ -12,8 +12,6 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
12
12
  var _warning = _interopRequireDefault(require("../utils/warning"));
13
13
  var _keyCode = _interopRequireDefault(require("../utils/keyCode"));
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
- /* eslint-disable prefer-const, max-len */
16
-
17
15
  class AutoCompleteFoundation extends _foundation.default {
18
16
  constructor(adapter) {
19
17
  super(Object.assign({}, adapter));
@@ -10,9 +10,7 @@ class OptionFoundation extends _foundation.default {
10
10
  constructor(adapter) {
11
11
  super(Object.assign({}, adapter));
12
12
  }
13
- // eslint-disable-next-line @typescript-eslint/no-empty-function
14
13
  init() {}
15
- // eslint-disable-next-line @typescript-eslint/no-empty-function
16
14
  destroy() {}
17
15
  onOptionClick(option) {
18
16
  const isDisabled = this._isDisabled();
@@ -12,7 +12,6 @@ exports.cssClasses = cssClasses;
12
12
  const strings = {
13
13
  SHAPE: ['circle', 'square'],
14
14
  SIZE: ['extra-extra-small', 'extra-small', 'small', 'default', 'medium', 'large', 'extra-large'],
15
- // eslint-disable-next-line max-len
16
15
  COLOR: ['grey', 'red', 'pink', 'purple', 'violet', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime', 'yellow', 'amber', 'orange', 'white'],
17
16
  OVERLAP_FROM: ['start', 'end']
18
17
  };
@@ -26,8 +26,8 @@ class AvatarFoundation extends _foundation.default {
26
26
  this._adapter.setFocusVisible(false);
27
27
  };
28
28
  }
29
- init() {} // eslint-disable-line
30
- destroy() {} // eslint-disable-line
29
+ init() {}
30
+ destroy() {}
31
31
  handleImgLoadError() {
32
32
  const {
33
33
  onError