@douyinfe/semi-foundation 2.13.0 → 2.14.0-beta.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 (155) hide show
  1. package/anchor/foundation.ts +1 -2
  2. package/autoComplete/foundation.ts +29 -18
  3. package/avatar/avatar.scss +14 -0
  4. package/avatar/foundation.ts +17 -0
  5. package/avatar/variables.scss +3 -0
  6. package/base/foundation.ts +6 -0
  7. package/calendar/foundation.ts +2 -1
  8. package/cascader/cascader.scss +3 -0
  9. package/cascader/foundation.ts +3 -0
  10. package/checkbox/checkboxFoundation.ts +2 -1
  11. package/datePicker/foundation.ts +3 -3
  12. package/datePicker/inputFoundation.ts +1 -1
  13. package/datePicker/monthsGridFoundation.ts +8 -4
  14. package/form/utils.ts +5 -1
  15. package/input/foundation.ts +3 -11
  16. package/input/input.scss +6 -0
  17. package/input/textareaFoundation.ts +0 -9
  18. package/input/variables.scss +3 -0
  19. package/lib/cjs/anchor/foundation.d.ts +1 -2
  20. package/lib/cjs/autoComplete/foundation.d.ts +0 -1
  21. package/lib/cjs/autoComplete/foundation.js +35 -23
  22. package/lib/cjs/avatar/avatar.css +9 -0
  23. package/lib/cjs/avatar/avatar.scss +14 -0
  24. package/lib/cjs/avatar/foundation.d.ts +3 -0
  25. package/lib/cjs/avatar/foundation.js +20 -0
  26. package/lib/cjs/avatar/variables.scss +3 -0
  27. package/lib/cjs/base/foundation.js +12 -0
  28. package/lib/cjs/calendar/eventUtil.d.ts +1 -1
  29. package/lib/cjs/calendar/foundation.d.ts +1 -2
  30. package/lib/cjs/cascader/cascader.css +5 -0
  31. package/lib/cjs/cascader/cascader.scss +3 -0
  32. package/lib/cjs/cascader/foundation.d.ts +0 -11
  33. package/lib/cjs/cascader/foundation.js +5 -0
  34. package/lib/cjs/checkbox/checkboxFoundation.js +3 -1
  35. package/lib/cjs/datePicker/foundation.d.ts +3 -4
  36. package/lib/cjs/datePicker/inputFoundation.d.ts +1 -2
  37. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +4 -5
  38. package/lib/cjs/form/utils.d.ts +5 -2
  39. package/lib/cjs/form/utils.js +4 -0
  40. package/lib/cjs/input/foundation.d.ts +0 -4
  41. package/lib/cjs/input/foundation.js +7 -13
  42. package/lib/cjs/input/input.css +6 -0
  43. package/lib/cjs/input/input.scss +6 -0
  44. package/lib/cjs/input/textareaFoundation.d.ts +0 -4
  45. package/lib/cjs/input/textareaFoundation.js +0 -12
  46. package/lib/cjs/input/variables.scss +3 -0
  47. package/lib/cjs/overflowList/foundation.d.ts +1 -0
  48. package/lib/cjs/overflowList/foundation.js +25 -0
  49. package/lib/cjs/radio/radio.css +6 -0
  50. package/lib/cjs/radio/radio.scss +8 -0
  51. package/lib/cjs/radio/radioFoundation.d.ts +3 -0
  52. package/lib/cjs/radio/radioFoundation.js +24 -0
  53. package/lib/cjs/radio/variables.scss +4 -0
  54. package/lib/cjs/select/foundation.js +2 -0
  55. package/lib/cjs/select/select.css +5 -0
  56. package/lib/cjs/select/select.scss +3 -0
  57. package/lib/cjs/switch/foundation.js +3 -1
  58. package/lib/cjs/tagInput/foundation.js +2 -0
  59. package/lib/cjs/tagInput/tagInput.css +1 -1
  60. package/lib/cjs/tagInput/variables.scss +1 -1
  61. package/lib/cjs/timePicker/foundation.js +4 -0
  62. package/lib/cjs/timePicker/utils/localeDate.js +5 -0
  63. package/lib/cjs/tree/tree.css +0 -20
  64. package/lib/cjs/tree/tree.scss +0 -20
  65. package/lib/cjs/tree/treeUtil.js +2 -0
  66. package/lib/cjs/tree/variables.scss +0 -18
  67. package/lib/cjs/treeSelect/foundation.js +10 -1
  68. package/lib/cjs/treeSelect/treeSelect.css +5 -0
  69. package/lib/cjs/treeSelect/treeSelect.scss +3 -0
  70. package/lib/cjs/utils/Logger.js +8 -0
  71. package/lib/cjs/utils/Store.js +1 -0
  72. package/lib/cjs/utils/date-fns-extra.js +4 -0
  73. package/lib/cjs/utils/isElement.js +1 -0
  74. package/lib/cjs/utils/isEscPress.js +1 -0
  75. package/lib/cjs/utils/set.js +1 -0
  76. package/lib/es/anchor/foundation.d.ts +1 -2
  77. package/lib/es/autoComplete/foundation.d.ts +0 -1
  78. package/lib/es/autoComplete/foundation.js +35 -23
  79. package/lib/es/avatar/avatar.css +9 -0
  80. package/lib/es/avatar/avatar.scss +14 -0
  81. package/lib/es/avatar/foundation.d.ts +3 -0
  82. package/lib/es/avatar/foundation.js +19 -0
  83. package/lib/es/avatar/variables.scss +3 -0
  84. package/lib/es/base/foundation.js +12 -0
  85. package/lib/es/calendar/eventUtil.d.ts +1 -1
  86. package/lib/es/calendar/foundation.d.ts +1 -2
  87. package/lib/es/cascader/cascader.css +5 -0
  88. package/lib/es/cascader/cascader.scss +3 -0
  89. package/lib/es/cascader/foundation.d.ts +0 -11
  90. package/lib/es/cascader/foundation.js +5 -0
  91. package/lib/es/checkbox/checkboxFoundation.js +2 -1
  92. package/lib/es/datePicker/foundation.d.ts +3 -4
  93. package/lib/es/datePicker/inputFoundation.d.ts +1 -2
  94. package/lib/es/datePicker/monthsGridFoundation.d.ts +4 -5
  95. package/lib/es/form/utils.d.ts +5 -2
  96. package/lib/es/form/utils.js +5 -0
  97. package/lib/es/input/foundation.d.ts +0 -4
  98. package/lib/es/input/foundation.js +6 -12
  99. package/lib/es/input/input.css +6 -0
  100. package/lib/es/input/input.scss +6 -0
  101. package/lib/es/input/textareaFoundation.d.ts +0 -4
  102. package/lib/es/input/textareaFoundation.js +0 -11
  103. package/lib/es/input/variables.scss +3 -0
  104. package/lib/es/overflowList/foundation.d.ts +1 -0
  105. package/lib/es/overflowList/foundation.js +25 -0
  106. package/lib/es/radio/radio.css +6 -0
  107. package/lib/es/radio/radio.scss +8 -0
  108. package/lib/es/radio/radioFoundation.d.ts +3 -0
  109. package/lib/es/radio/radioFoundation.js +23 -0
  110. package/lib/es/radio/variables.scss +4 -0
  111. package/lib/es/select/foundation.js +2 -0
  112. package/lib/es/select/select.css +5 -0
  113. package/lib/es/select/select.scss +3 -0
  114. package/lib/es/switch/foundation.js +2 -1
  115. package/lib/es/tagInput/foundation.js +2 -0
  116. package/lib/es/tagInput/tagInput.css +1 -1
  117. package/lib/es/tagInput/variables.scss +1 -1
  118. package/lib/es/timePicker/foundation.js +4 -0
  119. package/lib/es/timePicker/utils/localeDate.js +5 -0
  120. package/lib/es/tree/tree.css +0 -20
  121. package/lib/es/tree/tree.scss +0 -20
  122. package/lib/es/tree/treeUtil.js +2 -0
  123. package/lib/es/tree/variables.scss +0 -18
  124. package/lib/es/treeSelect/foundation.js +10 -1
  125. package/lib/es/treeSelect/treeSelect.css +5 -0
  126. package/lib/es/treeSelect/treeSelect.scss +3 -0
  127. package/lib/es/utils/Logger.js +8 -0
  128. package/lib/es/utils/Store.js +1 -0
  129. package/lib/es/utils/date-fns-extra.js +4 -0
  130. package/lib/es/utils/isElement.js +1 -0
  131. package/lib/es/utils/isEscPress.js +1 -0
  132. package/lib/es/utils/set.js +2 -0
  133. package/overflowList/foundation.ts +20 -0
  134. package/package.json +2 -2
  135. package/radio/radio.scss +8 -0
  136. package/radio/radioFoundation.ts +17 -0
  137. package/radio/variables.scss +4 -0
  138. package/select/foundation.ts +1 -0
  139. package/select/select.scss +3 -0
  140. package/switch/foundation.ts +2 -1
  141. package/tagInput/foundation.ts +1 -0
  142. package/tagInput/variables.scss +1 -1
  143. package/timePicker/foundation.ts +2 -1
  144. package/timePicker/utils/localeDate.ts +3 -0
  145. package/tree/tree.scss +0 -20
  146. package/tree/treeUtil.ts +1 -0
  147. package/tree/variables.scss +0 -18
  148. package/treeSelect/foundation.ts +7 -0
  149. package/treeSelect/treeSelect.scss +3 -0
  150. package/utils/Logger.ts +4 -0
  151. package/utils/Store.ts +1 -0
  152. package/utils/date-fns-extra.ts +2 -0
  153. package/utils/isElement.ts +1 -0
  154. package/utils/isEscPress.ts +1 -0
  155. package/utils/set.ts +1 -0
@@ -1,10 +1,3 @@
1
- $color-tree_default-bg-default: var(--semi-color-fill-0); // 树背景颜色 - 默认
2
- $color-tree_default-border-default: transparent; // 树描边颜色 - 默认
3
- $color-tree_default-icon-default: var(--semi-color-text-2); // 树图标颜色 - 默认
4
- $color-tree_default-bg-hover: var(--semi-color-fill-1); // 树背景颜色 - 悬停
5
-
6
- $color-tree_default-border-focus: var(--semi-color-focus-border); // 树描边颜色 - 按下
7
-
8
1
  $color-tree_option-text-default: var(--semi-color-text-0); // 树选项文字颜色
9
2
  $color-tree_option-icon-default: var(--semi-color-text-2); // 树选项图标颜色
10
3
 
@@ -19,13 +12,9 @@ $color-tree_option_loading-icon-default: var(--semi-color-primary); // 树选项
19
12
 
20
13
  $color-tree_option_draggable_insert-border-default: var(--semi-color-primary); // 树选项加载 spin 颜色
21
14
 
22
- $height-tree_default: $height-control-default; // 树选项高度 - 默认
23
-
24
- $font-tree_default-fontWeight: $font-weight-regular; // 树选项文本字重 - 默认
25
15
  $font-tree_option_hightlight-fontWeight: $font-weight-bold; // 树选项高亮文本字重
26
16
  $color-tree_option_hightlight-text: var(--semi-color-primary); // 树选项高亮文本颜色
27
17
 
28
- $radius-tree: var(--semi-border-radius-small); // 树整体圆角
29
18
  $radius-tree_checkbox_addon: var(--semi-border-radius-small); // 多选树 checkbox 圆角
30
19
 
31
20
  $spacing-tree_search_wrapper-paddingX: 12px; // 树搜索框水平内边距
@@ -41,14 +30,7 @@ $spacing-tree_icon-marginRight: 8px; // 树选项图标右侧外边距
41
30
  $spacing-tree_label_withIcon-marginRight: 8px; // 树选项图标右侧外边距
42
31
  $spacing-tree_option_draggable-paddingY: 3px; // 可拖拽的树选项垂直内边距
43
32
  $spacing-tree_option_draggable-paddingX: 0; // 可拖拽的树选项水平内边距
44
- $spacing-tree_spinIcon-paddingY: 4px; // 树选项加载 spin 垂直内边距 (已废弃)
45
- $spacing-tree_spinIcon-paddingX: 0; // 树选项加载 spin 水平内边距 (已废弃)
46
33
 
47
- $width-tree-border: 1px; // 树选项描边宽度
48
- $width-tree_arrow: 32px; // 树选项箭头宽度
49
34
  $width-tree_emptyIcon: $width-icon-small; // 树选项空图标宽度
50
35
  $width-tree_spinIcon: $width-icon-small; // 树选项加载 spin 宽度
51
- $width-tree_focus-border: $border-thickness-control-focus; // 树选中态描边宽度
52
- $width-tree_option: 230px; // 树选项宽度
53
- $width-tree_search_wrapper-border: 1px; // 树搜索框容器描边宽度
54
36
  $width-tree_option_draggable-border: 2px; // 可拖拽的树标示线宽度
@@ -219,6 +219,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
219
219
  loadingKeys: loadingKeys.add(key)
220
220
  };
221
221
  }
222
+ /* istanbul ignore next */
223
+
222
224
 
223
225
  focusInput(bool) {
224
226
  this._adapter.updateInputFocus(bool);
@@ -333,6 +335,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
333
335
  * A11y: simulate selection click
334
336
  */
335
337
 
338
+ /* istanbul ignore next */
339
+
336
340
 
337
341
  handleSelectionEnterPress(e) {
338
342
  if (isEnterPress(e)) {
@@ -385,6 +389,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
385
389
  * A11y: simulate clear button click
386
390
  */
387
391
 
392
+ /* istanbul ignore next */
393
+
388
394
 
389
395
  handleClearEnterPress(e) {
390
396
  if (isEnterPress(e)) {
@@ -725,7 +731,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
725
731
  eventKey,
726
732
  expanded,
727
733
  data
728
- } = treeNode;
734
+ } = treeNode; // debugger;
729
735
 
730
736
  if (!expanded) {
731
737
  filteredExpandedKeys.add(eventKey);
@@ -738,6 +744,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
738
744
  this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
739
745
 
740
746
  if (!this._isExpandControlled()) {
747
+ // debugger;
741
748
  const flattenNodes = flattenTreeData(treeData, filteredExpandedKeys, showFilteredOnly && filteredShownKeys);
742
749
  const motionKeys = this._isAnimated() ? getMotionKeys(eventKey, filteredExpandedKeys, keyEntities) : [];
743
750
  const newState = {
@@ -757,6 +764,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
757
764
  }
758
765
 
759
766
  handleNodeExpand(e, treeNode) {
767
+ // debugger;
760
768
  const {
761
769
  loadData
762
770
  } = this.getProps();
@@ -801,6 +809,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
801
809
  this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
802
810
 
803
811
  if (!isExpandControlled) {
812
+ // debugger;
804
813
  const flattenNodes = flattenTreeData(treeData, expandedKeys);
805
814
  const motionKeys = this._isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
806
815
  const newState = {
@@ -180,6 +180,11 @@
180
180
  min-height: 40px;
181
181
  line-height: 40px;
182
182
  }
183
+ .semi-tree-select-large .semi-tree-select-selection {
184
+ font-size: 16px;
185
+ line-height: 22px;
186
+ font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
187
+ }
183
188
  .semi-tree-select-arrow {
184
189
  display: inline-flex;
185
190
  align-items: center;
@@ -228,6 +228,9 @@ $module: #{$prefix}-tree-select;
228
228
  &-large {
229
229
  min-height: $height-treeSelect_large;
230
230
  line-height: $font-treeSelect_large-lineHeight;
231
+ .#{$module}-selection {
232
+ @include font-size-header-6;
233
+ }
231
234
  }
232
235
 
233
236
  &-arrow {
@@ -28,6 +28,8 @@ class Logger {
28
28
  console[method](...messages);
29
29
  }
30
30
  }
31
+ /* istanbul ignore next */
32
+
31
33
 
32
34
  log() {
33
35
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -36,6 +38,8 @@ class Logger {
36
38
 
37
39
  this._baseLog('log', ...args);
38
40
  }
41
+ /* istanbul ignore next */
42
+
39
43
 
40
44
  warn() {
41
45
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
@@ -44,6 +48,8 @@ class Logger {
44
48
 
45
49
  this._baseLog('warn', ...args);
46
50
  }
51
+ /* istanbul ignore next */
52
+
47
53
 
48
54
  error() {
49
55
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
@@ -52,6 +58,8 @@ class Logger {
52
58
 
53
59
  this._baseLog('error', ...args);
54
60
  }
61
+ /* istanbul ignore next */
62
+
55
63
 
56
64
  info() {
57
65
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
@@ -2,6 +2,7 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
2
2
  import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
3
3
  import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
4
4
 
5
+ /* istanbul ignore next */
5
6
  class Store {
6
7
  constructor(initialState) {
7
8
  this._state = _Object$assign({}, initialState);
@@ -54,6 +54,8 @@ export const toIANA = tz => {
54
54
  * @returns {Date}
55
55
  */
56
56
 
57
+ /* istanbul ignore next */
58
+
57
59
  const parse = (date, formatToken, options) => {
58
60
  if (typeof date === 'string') {
59
61
  date = dateFnsParse(date, formatToken, new Date(), options);
@@ -76,6 +78,8 @@ const parse = (date, formatToken, options) => {
76
78
  * @param {string} [options.timeZone]
77
79
  */
78
80
 
81
+ /* istanbul ignore next */
82
+
79
83
 
80
84
  const format = (date, formatToken, options) => {
81
85
  if (options && options.timeZone != null && options.timeZone !== '') {
@@ -1,3 +1,4 @@
1
+ /* istanbul ignore next */
1
2
  export default function isElement(obj) {
2
3
  try {
3
4
  // Using W3 DOM2 (works for FF, Opera and Chrome)
@@ -1,5 +1,6 @@
1
1
  import _get from "lodash/get";
2
2
  import { ESC_KEY } from './keyCode';
3
+ /* istanbul ignore next */
3
4
 
4
5
  function isEscPress(e) {
5
6
  return _get(e, 'key') === ESC_KEY ? true : false;
@@ -1,5 +1,7 @@
1
1
  import _isSet from "lodash/isSet";
2
2
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
3
+
4
+ /* istanbul ignore next */
3
5
  export function copySet(setA) {
4
6
  return new _Set(setA);
5
7
  }
@@ -16,6 +16,8 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
16
16
  super({ ...adapter });
17
17
  }
18
18
 
19
+ previousY = undefined;
20
+
19
21
  isScrollMode = (): boolean => {
20
22
  const { renderMode } = this.getProps();
21
23
  return renderMode === 'scroll';
@@ -47,6 +49,24 @@ class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
47
49
  res[itemKey] = entry;
48
50
  visibleState.set(itemKey, visible);
49
51
  });
52
+ let someItemVisible = false;
53
+ for (const value of visibleState.values()) {
54
+ if (value) {
55
+ someItemVisible = true;
56
+ break;
57
+ }
58
+ }
59
+ // Any item is visible, indicating that the List is visible
60
+ const wholeListVisible = someItemVisible;
61
+ // If scrolling in the vertical direction makes the List invisible, no processing is required.
62
+ // If this.previousY is undefined, it means that the List is mounted for the first time and will not be processed.
63
+ const [entry1] = entries;
64
+ const currentY = entry1.boundingClientRect.y;
65
+ if (!wholeListVisible && this.previousY !== undefined && currentY !== this.previousY) {
66
+ this.previousY = currentY;
67
+ return;
68
+ }
69
+ this.previousY = currentY;
50
70
  this._adapter.updateVisibleState(visibleState);
51
71
  this._adapter.notifyIntersect(res);
52
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.13.0",
3
+ "version": "2.14.0-beta.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "27671f7d0a04e5569c6bf16c0c6ea6c547a77016",
27
+ "gitHead": "7c7bcfeba01bbe507ab38f4b0354e2e7d79868a0",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
package/radio/radio.scss CHANGED
@@ -379,6 +379,14 @@ $inner-width: $width-icon-medium;
379
379
  padding-left: $spacing-radio_extra-paddingLeft;
380
380
  box-sizing: border-box;
381
381
  }
382
+
383
+ &-focus {
384
+ outline: $width-radio-outline solid $color-radio_primary-outline-focus;
385
+
386
+ &-border {
387
+ border: solid $width-radio_hover-border $color-radio_default-border-hover;
388
+ }
389
+ }
382
390
  }
383
391
 
384
392
  .#{$module}Group {
@@ -1,9 +1,11 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
+ import warning from '../utils/warning';
2
3
 
3
4
  export interface RadioAdapter extends DefaultAdapter {
4
5
  setHover: (hover: boolean) => void;
5
6
  setAddonId: () => void;
6
7
  setExtraId: () => void;
8
+ setFocusVisible: (focusVisible: boolean) => void;
7
9
  }
8
10
  export default class RadioFoundation extends BaseFoundation<RadioAdapter> {
9
11
  init() {
@@ -18,4 +20,19 @@ export default class RadioFoundation extends BaseFoundation<RadioAdapter> {
18
20
  setHover(hover: boolean) {
19
21
  this._adapter.setHover(hover);
20
22
  }
23
+
24
+ handleFocusVisible = (event: any) => {
25
+ const { target } = event;
26
+ try {
27
+ if (target.matches(':focus-visible')) {
28
+ this._adapter.setFocusVisible(true);
29
+ }
30
+ } catch (error){
31
+ warning(true, 'Warning: [Semi Radio] The current browser does not support the focus-visible');
32
+ }
33
+ }
34
+
35
+ handleBlur = () => {
36
+ this._adapter.setFocusVisible(false);
37
+ }
21
38
  }
@@ -48,6 +48,8 @@ $color-radio_card-bg-hover: var(--semi-color-white); // 单选圆点颜色
48
48
  $color-radio_card-bg-active: var(--semi-color-white); // 单选圆点颜色 - 按下态
49
49
  $color-radio_card-bg-default: var(--semi-color-white); // 单选圆点颜色 - 悬浮态
50
50
 
51
+ $color-radio_primary-outline-focus: var(--semi-color-primary-light-active); // 轮廓颜色 - 按键聚焦
52
+
51
53
  $radius-radio_cardRadioGroup: var(--semi-border-radius-small); // 卡片式单选圆角大小
52
54
  $radius-radio_addon_buttonRadio: var(--semi-border-radius-small); // 按钮式单选圆点圆角大小
53
55
  $radius-radio_buttonRadio: var(--semi-border-radius-small); // 按钮式单选圆角大小
@@ -58,6 +60,8 @@ $width-radio_hover-border: $border-thickness-control; // 描边宽度 - 悬浮
58
60
  $width-radio_disabled-border: $border-thickness-control; // 描边宽度 - 禁用态
59
61
  $width-radio_innder-border: $border-thickness-control; // 描边宽度 - 禁用态
60
62
 
63
+ $width-radio-outline: 2px; // 单选框轮廓宽度
64
+
61
65
  $height-radio_inner_min: 20px; // 单选按钮高度
62
66
  $width-radio_inner: $width-icon-medium; // 单选按钮宽度
63
67
  $spacing-radio_addon-paddingLeft: $spacing-tight; //单选标题到单选按钮左侧边距
@@ -895,6 +895,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
895
895
  }
896
896
  }
897
897
 
898
+ /* istanbul ignore next */
898
899
  handleClearBtnEnterPress(e: KeyboardEvent) {
899
900
  if (isEnterPress(e)) {
900
901
  this.handleClearClick(e as any);
@@ -45,6 +45,9 @@ $multiple: #{$module}-multiple;
45
45
  &-large {
46
46
  min-height: $height-select_large;
47
47
  line-height: $height-select_large;
48
+ .#{$module}-selection {
49
+ @include font-size-header-6;
50
+ }
48
51
  }
49
52
 
50
53
  &-open,
@@ -1,4 +1,5 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
+ import warning from '../utils/warning';
2
3
 
3
4
  export interface SwitchAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
4
5
  setNativeControlChecked: (nativeControlChecked: boolean | undefined) => void;
@@ -45,7 +46,7 @@ export default class SwitchFoundation<P = Record<string, any>, S = Record<string
45
46
  this._adapter.setFocusVisible(true);
46
47
  }
47
48
  } catch (error){
48
- console.warn('The current browser does not support the focus-visible');
49
+ warning(true, 'Warning: [Semi Switch] The current browser does not support the focus-visible');
49
50
  }
50
51
  }
51
52
 
@@ -151,6 +151,7 @@ class TagInputFoundation extends BaseFoundation<TagInputAdapter> {
151
151
  /**
152
152
  * A11y: simulate clear button click
153
153
  */
154
+ /* istanbul ignore next */
154
155
  handleClearEnterPress(e: TagInputKeyboardEvent) {
155
156
  if (isEnterPress(e)) {
156
157
  this.handleClearBtn(e);
@@ -8,7 +8,7 @@ $color-tagInput-border-default: transparent; // 标签输入框描边颜色 -
8
8
  $color-tagInput-border-hover: transparent ; // 标签输入框描边颜色 - 悬浮
9
9
  $color-tagInput-border-focus: var(--semi-color-focus-border); // 标签输入框描边颜色 - 选中态
10
10
  $color-tagInput_prefix-default: var(--semi-color-text-2); // 标签输入框 prefix 颜色
11
- $color-tagInput_suffix-default: var(--semi-color-text-1); // 标签输入框 suffix 颜色
11
+ $color-tagInput_suffix-default: var(--semi-color-text-2); // 标签输入框 suffix 颜色
12
12
 
13
13
  $color-tagInput_default-bg-default: var(--semi-color-fill-0); // 标签输入框背景颜色 - 默认
14
14
  $color-tagInput_default-bg-hover: var(--semi-color-fill-1); // 标签输入框背景颜色 - 悬浮
@@ -259,6 +259,7 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
259
259
  this._adapter.notifyBlur(e);
260
260
  }
261
261
 
262
+ /* istanbul ignore next */
262
263
  handleVisibleChange(visible: boolean) {
263
264
  if (!this._isControlledComponent('open')) {
264
265
  this._adapter.togglePanel(visible);
@@ -305,6 +306,7 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
305
306
  }
306
307
  }
307
308
 
309
+ /* istanbul ignore next */
308
310
  doValidate(args: string | Array<Date>) {
309
311
  if (typeof args === 'string') {
310
312
  return this.validateStr(args);
@@ -414,7 +416,6 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
414
416
 
415
417
  if (this.isValidTimeZone() && _value) {
416
418
  const formatToken = this.getValidFormat();
417
-
418
419
  if (Array.isArray(_value)) {
419
420
  _value = _value.map(v => zonedTimeToUtc(v, timeZone));
420
421
  str = _value.map(v => format(v, formatToken));
@@ -1,5 +1,6 @@
1
1
  import { format as dateFnsFormat, parse as dateFnsParse } from 'date-fns';
2
2
 
3
+ /* istanbul ignore next */
3
4
  const replace = function replace(str, replacements) {
4
5
  let _str = str;
5
6
  for (const key of Object.keys(replacements)) {
@@ -11,6 +12,7 @@ const replace = function replace(str, replacements) {
11
12
  return _str;
12
13
  };
13
14
 
15
+ /* istanbul ignore next */
14
16
  export function localeFormat(date, format, locale = {}, options = {}) {
15
17
  let str = dateFnsFormat(date, format, options);
16
18
 
@@ -19,6 +21,7 @@ export function localeFormat(date, format, locale = {}, options = {}) {
19
21
  return str;
20
22
  }
21
23
 
24
+ /* istanbul ignore next */
22
25
  export function localeParse(dateString, format, locale = {}, defaultDate = null, options = {}) {
23
26
  // const invertedLocale = invert(locale);
24
27
 
package/tree/tree.scss CHANGED
@@ -3,26 +3,6 @@
3
3
  $module: #{$prefix}-tree;
4
4
 
5
5
  .#{$module} {
6
- box-sizing: border-box;
7
- border-radius: $radius-tree;
8
- border: 1px solid $color-tree_default-border-default;
9
- height: $height-tree_default;
10
- line-height: $height-tree_default;
11
- font-weight: $font-tree_default-fontWeight;
12
- background-color: $color-tree_default-bg-default;
13
- display: inline-block;
14
- vertical-align: middle;
15
- position: relative;
16
- cursor: pointer;
17
-
18
- &:hover {
19
- background-color: $color-tree_default-bg-hover;
20
- }
21
-
22
- &-focus {
23
- border: $width-tree_focus-border solid $color-tree_default-border-focus;
24
- outline: 0;
25
- }
26
6
 
27
7
  &-search-wrapper {
28
8
  padding: $spacing-tree_search_wrapper-paddingY $spacing-tree_search_wrapper-paddingX;
package/tree/treeUtil.ts CHANGED
@@ -233,6 +233,7 @@ export function findChildKeys(keys: string[], options: any, omitKeys: any[] = []
233
233
  return res;
234
234
  }
235
235
 
236
+ /* istanbul ignore next */
236
237
  export function findLeafKeys(keys: string[], options: any) {
237
238
  const res: any[] = [];
238
239
  const findChild = (item: any) => {
@@ -1,10 +1,3 @@
1
- $color-tree_default-bg-default: var(--semi-color-fill-0); // 树背景颜色 - 默认
2
- $color-tree_default-border-default: transparent; // 树描边颜色 - 默认
3
- $color-tree_default-icon-default: var(--semi-color-text-2); // 树图标颜色 - 默认
4
- $color-tree_default-bg-hover: var(--semi-color-fill-1); // 树背景颜色 - 悬停
5
-
6
- $color-tree_default-border-focus: var(--semi-color-focus-border); // 树描边颜色 - 按下
7
-
8
1
  $color-tree_option-text-default: var(--semi-color-text-0); // 树选项文字颜色
9
2
  $color-tree_option-icon-default: var(--semi-color-text-2); // 树选项图标颜色
10
3
 
@@ -19,13 +12,9 @@ $color-tree_option_loading-icon-default: var(--semi-color-primary); // 树选项
19
12
 
20
13
  $color-tree_option_draggable_insert-border-default: var(--semi-color-primary); // 树选项加载 spin 颜色
21
14
 
22
- $height-tree_default: $height-control-default; // 树选项高度 - 默认
23
-
24
- $font-tree_default-fontWeight: $font-weight-regular; // 树选项文本字重 - 默认
25
15
  $font-tree_option_hightlight-fontWeight: $font-weight-bold; // 树选项高亮文本字重
26
16
  $color-tree_option_hightlight-text: var(--semi-color-primary); // 树选项高亮文本颜色
27
17
 
28
- $radius-tree: var(--semi-border-radius-small); // 树整体圆角
29
18
  $radius-tree_checkbox_addon: var(--semi-border-radius-small); // 多选树 checkbox 圆角
30
19
 
31
20
  $spacing-tree_search_wrapper-paddingX: 12px; // 树搜索框水平内边距
@@ -41,14 +30,7 @@ $spacing-tree_icon-marginRight: 8px; // 树选项图标右侧外边距
41
30
  $spacing-tree_label_withIcon-marginRight: 8px; // 树选项图标右侧外边距
42
31
  $spacing-tree_option_draggable-paddingY: 3px; // 可拖拽的树选项垂直内边距
43
32
  $spacing-tree_option_draggable-paddingX: 0; // 可拖拽的树选项水平内边距
44
- $spacing-tree_spinIcon-paddingY: 4px; // 树选项加载 spin 垂直内边距 (已废弃)
45
- $spacing-tree_spinIcon-paddingX: 0; // 树选项加载 spin 水平内边距 (已废弃)
46
33
 
47
- $width-tree-border: 1px; // 树选项描边宽度
48
- $width-tree_arrow: 32px; // 树选项箭头宽度
49
34
  $width-tree_emptyIcon: $width-icon-small; // 树选项空图标宽度
50
35
  $width-tree_spinIcon: $width-icon-small; // 树选项加载 spin 宽度
51
- $width-tree_focus-border: $border-thickness-control-focus; // 树选中态描边宽度
52
- $width-tree_option: 230px; // 树选项宽度
53
- $width-tree_search_wrapper-border: 1px; // 树搜索框容器描边宽度
54
36
  $width-tree_option_draggable-border: 2px; // 可拖拽的树标示线宽度
@@ -354,6 +354,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
354
354
  };
355
355
  }
356
356
 
357
+ /* istanbul ignore next */
357
358
  focusInput(bool: boolean) {
358
359
  this._adapter.updateInputFocus(bool);
359
360
  }
@@ -442,6 +443,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
442
443
  /**
443
444
  * A11y: simulate selection click
444
445
  */
446
+ /* istanbul ignore next */
445
447
  handleSelectionEnterPress(e: any) {
446
448
  if (isEnterPress(e)) {
447
449
  this.handleClick(e);
@@ -480,6 +482,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
480
482
  /**
481
483
  * A11y: simulate clear button click
482
484
  */
485
+ /* istanbul ignore next */
483
486
  handleClearEnterPress(e: any) {
484
487
  if (isEnterPress(e)) {
485
488
  this.handleClear(e);
@@ -693,6 +696,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
693
696
  let motionType = 'show';
694
697
  const { eventKey, expanded, data } = treeNode;
695
698
 
699
+ // debugger;
696
700
  if (!expanded) {
697
701
  filteredExpandedKeys.add(eventKey);
698
702
  } else if (filteredExpandedKeys.has(eventKey)) {
@@ -704,6 +708,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
704
708
  this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
705
709
 
706
710
  if (!this._isExpandControlled()) {
711
+ // debugger;
707
712
  const flattenNodes = flattenTreeData(treeData, filteredExpandedKeys, showFilteredOnly && filteredShownKeys);
708
713
  const motionKeys = this._isAnimated() ? getMotionKeys(eventKey, filteredExpandedKeys, keyEntities) : [];
709
714
  const newState = {
@@ -723,6 +728,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
723
728
  }
724
729
 
725
730
  handleNodeExpand(e: any, treeNode: BasicTreeNodeProps) {
731
+ // debugger;
726
732
  const { loadData } = this.getProps();
727
733
  const { inputValue, keyEntities } = this.getStates();
728
734
  const isSearching = Boolean(inputValue);
@@ -750,6 +756,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
750
756
  this._adapter.cacheFlattenNodes(motionType === 'hide' && this._isAnimated());
751
757
 
752
758
  if (!isExpandControlled) {
759
+ // debugger;
753
760
  const flattenNodes = flattenTreeData(treeData, expandedKeys);
754
761
  const motionKeys = this._isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
755
762
  const newState = {
@@ -228,6 +228,9 @@ $module: #{$prefix}-tree-select;
228
228
  &-large {
229
229
  min-height: $height-treeSelect_large;
230
230
  line-height: $font-treeSelect_large-lineHeight;
231
+ .#{$module}-selection {
232
+ @include font-size-header-6;
233
+ }
231
234
  }
232
235
 
233
236
  &-arrow {
package/utils/Logger.ts CHANGED
@@ -24,18 +24,22 @@ class Logger {
24
24
  }
25
25
  }
26
26
 
27
+ /* istanbul ignore next */
27
28
  log(...args: any[]) {
28
29
  this._baseLog('log', ...args);
29
30
  }
30
31
 
32
+ /* istanbul ignore next */
31
33
  warn(...args: any[]) {
32
34
  this._baseLog('warn', ...args);
33
35
  }
34
36
 
37
+ /* istanbul ignore next */
35
38
  error(...args: any[]) {
36
39
  this._baseLog('error', ...args);
37
40
  }
38
41
 
42
+ /* istanbul ignore next */
39
43
  info(...args: any[]) {
40
44
  this._baseLog('info', ...args);
41
45
  }
package/utils/Store.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /* istanbul ignore next */
1
2
  class Store<T = Record<string, any>> {
2
3
  _state: T;
3
4
  _listeners: any[];
@@ -87,6 +87,7 @@ export const toIANA = (tz: string | number) => {
87
87
  * @param {string} [options.timeZone]
88
88
  * @returns {Date}
89
89
  */
90
+ /* istanbul ignore next */
90
91
  const parse = (date: string | number | Date, formatToken: string, options?: any) => {
91
92
  if (typeof date === 'string') {
92
93
  date = dateFnsParse(date, formatToken, new Date(), options);
@@ -106,6 +107,7 @@ const parse = (date: string | number | Date, formatToken: string, options?: any)
106
107
  * @param {object} [options]
107
108
  * @param {string} [options.timeZone]
108
109
  */
110
+ /* istanbul ignore next */
109
111
  const format = (date: string | number | Date, formatToken: string, options?: any) => {
110
112
  if (options && options.timeZone != null && options.timeZone !== '') {
111
113
  const timeZone = toIANA(options.timeZone);
@@ -1,3 +1,4 @@
1
+ /* istanbul ignore next */
1
2
  export default function isElement(obj: any) {
2
3
  try {
3
4
  // Using W3 DOM2 (works for FF, Opera and Chrome)
@@ -1,6 +1,7 @@
1
1
  import { get } from 'lodash';
2
2
  import { ESC_KEY } from './keyCode';
3
3
 
4
+ /* istanbul ignore next */
4
5
  function isEscPress<T extends { key: string }>(e: T) {
5
6
  return get(e, 'key') === ESC_KEY ? true : false;
6
7
  }
package/utils/set.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { isSet } from 'lodash';
2
2
 
3
+ /* istanbul ignore next */
3
4
  export function copySet<T = unknown>(setA: Iterable<T>) {
4
5
  return new Set(setA);
5
6
  }