@douyinfe/semi-foundation 2.38.2-alpha.1 → 2.38.2

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,12 +184,9 @@ 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 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');
187
+ const innermostAction = get(actions, '0');
188
+ const el = get(innermostAction, 'el');
189
+ const top = get(innermostAction, 'top');
193
190
  if (el) {
194
191
  const offsetTop = top - targetOffset;
195
192
  if (el.scroll && canSmoothScroll) {
@@ -165,14 +165,9 @@ class AnchorFoundation extends _foundation.default {
165
165
  */
166
166
  behavior: actions => {
167
167
  // We just need to scroll the innermost target container
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');
168
+ const innermostAction = (0, _get2.default)(actions, '0');
169
+ const el = (0, _get2.default)(innermostAction, 'el');
170
+ const top = (0, _get2.default)(innermostAction, 'top');
176
171
  if (el) {
177
172
  const offsetTop = top - targetOffset;
178
173
  if (el.scroll && canSmoothScroll) {
@@ -158,14 +158,9 @@ 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 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');
161
+ const innermostAction = _get(actions, '0');
162
+ const el = _get(innermostAction, 'el');
163
+ const top = _get(innermostAction, 'top');
169
164
  if (el) {
170
165
  const offsetTop = top - targetOffset;
171
166
  if (el.scroll && canSmoothScroll) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.38.2-alpha.1",
3
+ "version": "2.38.2",
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-alpha.1",
10
+ "@douyinfe/semi-animation": "2.38.2",
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": "cb42a0565bba8660255835264d23dfcba6ff4aa3",
26
+ "gitHead": "e761d8bc2ba54e3b69ac77f5e6425c62ed6b02f1",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",