@douyinfe/semi-foundation 2.38.2 → 2.39.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.
@@ -171,7 +171,7 @@ export default class AnchorFoundation<P = Record<string, any>, S = Record<string
171
171
  * 2. There is a scroll axis (clientHeight < scrollHeight | | clientWidth < scrollWidth)
172
172
  * 3.overflowX or overflowY has a value and is not visible or clip
173
173
  * For details, please see https://github.com/stipsan/compute-scroll-into-view
174
- *
174
+ *
175
175
  * behavior定义滚动行为
176
176
  * - 可选 'auto' | 'smooth' | Function
177
177
  * - Function 自定义滚动行为
@@ -184,9 +184,12 @@ export default class AnchorFoundation<P = Record<string, any>, S = Record<string
184
184
  */
185
185
  behavior: actions => {
186
186
  // We just need to scroll the innermost target container
187
- const innermostAction = get(actions, '0');
188
- const el = get(innermostAction, 'el');
189
- const top = get(innermostAction, 'top');
187
+ const verticalScrollAction = actions.find(action => {
188
+ const { el } = action;
189
+ return el.scrollHeight > el.clientHeight;
190
+ });
191
+ const el = get(verticalScrollAction, 'el');
192
+ const top = get(verticalScrollAction, 'top');
190
193
  if (el) {
191
194
  const offsetTop = top - targetOffset;
192
195
  if (el.scroll && canSmoothScroll) {
@@ -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,
@@ -165,9 +165,14 @@ class AnchorFoundation extends _foundation.default {
165
165
  */
166
166
  behavior: actions => {
167
167
  // We just need to scroll the innermost target container
168
- const innermostAction = (0, _get2.default)(actions, '0');
169
- const el = (0, _get2.default)(innermostAction, 'el');
170
- const top = (0, _get2.default)(innermostAction, 'top');
168
+ const verticalScrollAction = actions.find(action => {
169
+ const {
170
+ el
171
+ } = action;
172
+ return el.scrollHeight > el.clientHeight;
173
+ });
174
+ const el = (0, _get2.default)(verticalScrollAction, 'el');
175
+ const top = (0, _get2.default)(verticalScrollAction, 'top');
171
176
  if (el) {
172
177
  const offsetTop = top - targetOffset;
173
178
  if (el.scroll && canSmoothScroll) {
@@ -6,7 +6,6 @@
6
6
  position: relative;
7
7
  display: flex;
8
8
  align-items: flex-start;
9
- flex-wrap: wrap;
10
9
  font-size: 14px;
11
10
  line-height: 20px;
12
11
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
@@ -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,
@@ -51,6 +51,9 @@
51
51
  .semi-switch-disabled:active {
52
52
  background-color: transparent;
53
53
  }
54
+ .semi-switch-disabled:active .semi-switch-knob {
55
+ width: 18px;
56
+ }
54
57
  .semi-switch-disabled .semi-switch-knob {
55
58
  cursor: not-allowed;
56
59
  box-shadow: none;
@@ -64,6 +67,9 @@
64
67
  border-color: transparent;
65
68
  background-color: var(--semi-color-success-disabled);
66
69
  }
70
+ .semi-switch-disabled.semi-switch-checked:active .semi-switch-knob {
71
+ transform: translateX(18px);
72
+ }
67
73
  .semi-switch-disabled.semi-switch-checked .semi-switch-knob {
68
74
  box-shadow: none;
69
75
  border: none;
@@ -25,9 +25,7 @@ $module: #{$prefix}-switch;
25
25
 
26
26
  &:active {
27
27
  border: $border-thickness-control $color-switch_default-bg-active solid;
28
-
29
28
  .#{$module}-knob {
30
- // width: $knob-size + $knob-active-expand;
31
29
  width: $width-switch_knob_active;
32
30
  }
33
31
  }
@@ -69,6 +67,9 @@ $module: #{$prefix}-switch;
69
67
 
70
68
  &:active {
71
69
  background-color: $color-switch_disabled-bg-active;
70
+ .#{$module}-knob {
71
+ width: $width-switch_knob_default;
72
+ }
72
73
  }
73
74
 
74
75
  .#{$module}-knob {
@@ -85,6 +86,11 @@ $module: #{$prefix}-switch;
85
86
  &.#{$module}-checked {
86
87
  border-color: $color-switch_checked_disabled-border-default;
87
88
  background-color: $color-switch_checked_disabled-bg-default;
89
+ &:active {
90
+ .#{$module}-knob {
91
+ transform: translateX($spacing-switch_checked-translateX);
92
+ }
93
+ }
88
94
  .#{$module}-knob {
89
95
  @include shadow-0;
90
96
  border: none;
@@ -108,11 +108,14 @@
108
108
  padding-right: 0;
109
109
  cursor: pointer;
110
110
  color: var(--semi-color-text-0);
111
+ position: relative;
111
112
  }
112
- .semi-tree-select-selection-placeholder {
113
+ .semi-tree-select-selection-content {
113
114
  overflow: hidden;
114
115
  white-space: nowrap;
115
116
  text-overflow: ellipsis;
117
+ }
118
+ .semi-tree-select-selection-placeholder {
116
119
  color: var(--semi-color-text-2);
117
120
  }
118
121
  .semi-tree-select-selection .semi-tag-group {
@@ -126,6 +129,10 @@
126
129
  }
127
130
  .semi-tree-select-selection-TriggerSearchItem {
128
131
  position: absolute;
132
+ max-width: calc(100% - 12px);
133
+ text-overflow: ellipsis;
134
+ overflow: hidden;
135
+ white-space: nowrap;
129
136
  }
130
137
  .semi-tree-select-selection-TriggerSearchItem-placeholder {
131
138
  opacity: 0.6;
@@ -133,11 +133,15 @@ $module: #{$prefix}-tree-select;
133
133
  padding-right: 0;
134
134
  cursor: pointer;
135
135
  color: $color-treeSelect_selection-text-default;
136
+ position: relative;
136
137
 
137
- &-placeholder {
138
+ &-content {
138
139
  overflow: hidden;
139
140
  white-space: nowrap;
140
141
  text-overflow: ellipsis;
142
+ }
143
+
144
+ &-placeholder {
141
145
  color: $color-treeSelect_input_placeholder-text-default;
142
146
  }
143
147
 
@@ -154,6 +158,10 @@ $module: #{$prefix}-tree-select;
154
158
 
155
159
  &-TriggerSearchItem {
156
160
  position: absolute;
161
+ max-width: calc(100% - $spacing-treeSelect_selection-paddingLeft);
162
+ text-overflow: ellipsis;
163
+ overflow: hidden;
164
+ white-space: nowrap;
157
165
 
158
166
  &-placeholder {
159
167
  opacity: .6;
@@ -158,9 +158,14 @@ export default class AnchorFoundation extends BaseFoundation {
158
158
  */
159
159
  behavior: actions => {
160
160
  // We just need to scroll the innermost target container
161
- const innermostAction = _get(actions, '0');
162
- const el = _get(innermostAction, 'el');
163
- const top = _get(innermostAction, 'top');
161
+ const verticalScrollAction = actions.find(action => {
162
+ const {
163
+ el
164
+ } = action;
165
+ return el.scrollHeight > el.clientHeight;
166
+ });
167
+ const el = _get(verticalScrollAction, 'el');
168
+ const top = _get(verticalScrollAction, 'top');
164
169
  if (el) {
165
170
  const offsetTop = top - targetOffset;
166
171
  if (el.scroll && canSmoothScroll) {
@@ -6,7 +6,6 @@
6
6
  position: relative;
7
7
  display: flex;
8
8
  align-items: flex-start;
9
- flex-wrap: wrap;
10
9
  font-size: 14px;
11
10
  line-height: 20px;
12
11
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
@@ -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,
@@ -51,6 +51,9 @@
51
51
  .semi-switch-disabled:active {
52
52
  background-color: transparent;
53
53
  }
54
+ .semi-switch-disabled:active .semi-switch-knob {
55
+ width: 18px;
56
+ }
54
57
  .semi-switch-disabled .semi-switch-knob {
55
58
  cursor: not-allowed;
56
59
  box-shadow: none;
@@ -64,6 +67,9 @@
64
67
  border-color: transparent;
65
68
  background-color: var(--semi-color-success-disabled);
66
69
  }
70
+ .semi-switch-disabled.semi-switch-checked:active .semi-switch-knob {
71
+ transform: translateX(18px);
72
+ }
67
73
  .semi-switch-disabled.semi-switch-checked .semi-switch-knob {
68
74
  box-shadow: none;
69
75
  border: none;
@@ -25,9 +25,7 @@ $module: #{$prefix}-switch;
25
25
 
26
26
  &:active {
27
27
  border: $border-thickness-control $color-switch_default-bg-active solid;
28
-
29
28
  .#{$module}-knob {
30
- // width: $knob-size + $knob-active-expand;
31
29
  width: $width-switch_knob_active;
32
30
  }
33
31
  }
@@ -69,6 +67,9 @@ $module: #{$prefix}-switch;
69
67
 
70
68
  &:active {
71
69
  background-color: $color-switch_disabled-bg-active;
70
+ .#{$module}-knob {
71
+ width: $width-switch_knob_default;
72
+ }
72
73
  }
73
74
 
74
75
  .#{$module}-knob {
@@ -85,6 +86,11 @@ $module: #{$prefix}-switch;
85
86
  &.#{$module}-checked {
86
87
  border-color: $color-switch_checked_disabled-border-default;
87
88
  background-color: $color-switch_checked_disabled-bg-default;
89
+ &:active {
90
+ .#{$module}-knob {
91
+ transform: translateX($spacing-switch_checked-translateX);
92
+ }
93
+ }
88
94
  .#{$module}-knob {
89
95
  @include shadow-0;
90
96
  border: none;
@@ -108,11 +108,14 @@
108
108
  padding-right: 0;
109
109
  cursor: pointer;
110
110
  color: var(--semi-color-text-0);
111
+ position: relative;
111
112
  }
112
- .semi-tree-select-selection-placeholder {
113
+ .semi-tree-select-selection-content {
113
114
  overflow: hidden;
114
115
  white-space: nowrap;
115
116
  text-overflow: ellipsis;
117
+ }
118
+ .semi-tree-select-selection-placeholder {
116
119
  color: var(--semi-color-text-2);
117
120
  }
118
121
  .semi-tree-select-selection .semi-tag-group {
@@ -126,6 +129,10 @@
126
129
  }
127
130
  .semi-tree-select-selection-TriggerSearchItem {
128
131
  position: absolute;
132
+ max-width: calc(100% - 12px);
133
+ text-overflow: ellipsis;
134
+ overflow: hidden;
135
+ white-space: nowrap;
129
136
  }
130
137
  .semi-tree-select-selection-TriggerSearchItem-placeholder {
131
138
  opacity: 0.6;
@@ -133,11 +133,15 @@ $module: #{$prefix}-tree-select;
133
133
  padding-right: 0;
134
134
  cursor: pointer;
135
135
  color: $color-treeSelect_selection-text-default;
136
+ position: relative;
136
137
 
137
- &-placeholder {
138
+ &-content {
138
139
  overflow: hidden;
139
140
  white-space: nowrap;
140
141
  text-overflow: ellipsis;
142
+ }
143
+
144
+ &-placeholder {
141
145
  color: $color-treeSelect_input_placeholder-text-default;
142
146
  }
143
147
 
@@ -154,6 +158,10 @@ $module: #{$prefix}-tree-select;
154
158
 
155
159
  &-TriggerSearchItem {
156
160
  position: absolute;
161
+ max-width: calc(100% - $spacing-treeSelect_selection-paddingLeft);
162
+ text-overflow: ellipsis;
163
+ overflow: hidden;
164
+ white-space: nowrap;
157
165
 
158
166
  &-placeholder {
159
167
  opacity: .6;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.38.2",
3
+ "version": "2.39.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.38.2",
10
+ "@douyinfe/semi-animation": "2.39.0",
11
11
  "async-validator": "^3.5.0",
12
12
  "classnames": "^2.2.6",
13
13
  "date-fns": "^2.29.3",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "e761d8bc2ba54e3b69ac77f5e6425c62ed6b02f1",
26
+ "gitHead": "7c7257d1e4bca9c1485c077470366e9776661e71",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -25,9 +25,7 @@ $module: #{$prefix}-switch;
25
25
 
26
26
  &:active {
27
27
  border: $border-thickness-control $color-switch_default-bg-active solid;
28
-
29
28
  .#{$module}-knob {
30
- // width: $knob-size + $knob-active-expand;
31
29
  width: $width-switch_knob_active;
32
30
  }
33
31
  }
@@ -69,6 +67,9 @@ $module: #{$prefix}-switch;
69
67
 
70
68
  &:active {
71
69
  background-color: $color-switch_disabled-bg-active;
70
+ .#{$module}-knob {
71
+ width: $width-switch_knob_default;
72
+ }
72
73
  }
73
74
 
74
75
  .#{$module}-knob {
@@ -85,6 +86,11 @@ $module: #{$prefix}-switch;
85
86
  &.#{$module}-checked {
86
87
  border-color: $color-switch_checked_disabled-border-default;
87
88
  background-color: $color-switch_checked_disabled-bg-default;
89
+ &:active {
90
+ .#{$module}-knob {
91
+ transform: translateX($spacing-switch_checked-translateX);
92
+ }
93
+ }
88
94
  .#{$module}-knob {
89
95
  @include shadow-0;
90
96
  border: none;
@@ -133,11 +133,15 @@ $module: #{$prefix}-tree-select;
133
133
  padding-right: 0;
134
134
  cursor: pointer;
135
135
  color: $color-treeSelect_selection-text-default;
136
+ position: relative;
136
137
 
137
- &-placeholder {
138
+ &-content {
138
139
  overflow: hidden;
139
140
  white-space: nowrap;
140
141
  text-overflow: ellipsis;
142
+ }
143
+
144
+ &-placeholder {
141
145
  color: $color-treeSelect_input_placeholder-text-default;
142
146
  }
143
147
 
@@ -154,6 +158,10 @@ $module: #{$prefix}-tree-select;
154
158
 
155
159
  &-TriggerSearchItem {
156
160
  position: absolute;
161
+ max-width: calc(100% - $spacing-treeSelect_selection-paddingLeft);
162
+ text-overflow: ellipsis;
163
+ overflow: hidden;
164
+ white-space: nowrap;
157
165
 
158
166
  &-placeholder {
159
167
  opacity: .6;