@tidbcloud/uikit 2.0.0-beta.46 → 2.0.0-beta.47

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tidbcloud/uikit
2
2
 
3
+ ## 2.0.0-beta.47
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix scroll position adjust when controlled value change
8
+
3
9
  ## 2.0.0-beta.46
4
10
 
5
11
  ### Minor Changes
@@ -182,14 +182,15 @@ const usePickerScrollColumn = ({ min, max, curr, open, render }) => {
182
182
  );
183
183
  }, [numbers, handleClickCell, onScroll, curr, render, classes]);
184
184
  const adjustScrollTop = ahooks.useMemoizedFn(() => {
185
+ var _a;
185
186
  const i = numbers.findIndex((i2) => i2 === val);
186
- if (i !== -1 && open && ref.current) {
187
+ if (i !== -1 && open) {
187
188
  const s = i * constant.CellHeight;
188
- ref.current.scrollTo({ top: s, behavior: "auto" });
189
+ (_a = ref.current) == null ? void 0 : _a.scrollTo({ top: s, behavior: "auto" });
189
190
  }
190
191
  });
191
192
  React.useEffect(() => {
192
- requestAnimationFrame(() => {
193
+ requestIdleCallback(() => {
193
194
  adjustScrollTop();
194
195
  });
195
196
  }, [open, val, adjustScrollTop]);
@@ -180,14 +180,15 @@ const usePickerScrollColumn = ({ min, max, curr, open, render }) => {
180
180
  );
181
181
  }, [numbers, handleClickCell, onScroll, curr, render, classes]);
182
182
  const adjustScrollTop = useMemoizedFn(() => {
183
+ var _a;
183
184
  const i = numbers.findIndex((i2) => i2 === val);
184
- if (i !== -1 && open && ref.current) {
185
+ if (i !== -1 && open) {
185
186
  const s = i * CellHeight;
186
- ref.current.scrollTo({ top: s, behavior: "auto" });
187
+ (_a = ref.current) == null ? void 0 : _a.scrollTo({ top: s, behavior: "auto" });
187
188
  }
188
189
  });
189
190
  useEffect(() => {
190
- requestAnimationFrame(() => {
191
+ requestIdleCallback(() => {
191
192
  adjustScrollTop();
192
193
  });
193
194
  }, [open, val, adjustScrollTop]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidbcloud/uikit",
3
- "version": "2.0.0-beta.46",
3
+ "version": "2.0.0-beta.47",
4
4
  "description": "tidbcloud uikit",
5
5
  "type": "module",
6
6
  "main": "dist/primitive/index.cjs",