lkd-web-kit 0.7.29 → 0.7.31
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/dist/form/base/FormTextarea.cjs +1 -7
- package/dist/form/base/FormTextarea.js +1 -7
- package/dist/index.cjs +18 -18
- package/dist/index.js +9 -9
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.cjs +5 -2
- package/dist/node_modules/@tanstack/react-virtual/dist/esm/index.js +5 -2
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +40 -20
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +40 -20
- package/package.json +13 -13
|
@@ -6,12 +6,6 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
const index = require('../../components/MyTextarea/index.cjs');
|
|
7
7
|
const withController = require('../../hocs/withController.cjs');
|
|
8
8
|
|
|
9
|
-
const FormTextarea = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
-
index.MyTextarea,
|
|
11
|
-
{
|
|
12
|
-
...field,
|
|
13
|
-
...props
|
|
14
|
-
}
|
|
15
|
-
));
|
|
9
|
+
const FormTextarea = withController.withController(({ field, props }) => /* @__PURE__ */ jsxRuntime.jsx(index.MyTextarea, { ...field, ...props }));
|
|
16
10
|
|
|
17
11
|
exports.FormTextarea = FormTextarea;
|
|
@@ -2,12 +2,6 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { MyTextarea } from '../../components/MyTextarea/index.js';
|
|
3
3
|
import { withController } from '../../hocs/withController.js';
|
|
4
4
|
|
|
5
|
-
const FormTextarea = withController(({ field, props }) => /* @__PURE__ */ jsx(
|
|
6
|
-
MyTextarea,
|
|
7
|
-
{
|
|
8
|
-
...field,
|
|
9
|
-
...props
|
|
10
|
-
}
|
|
11
|
-
));
|
|
5
|
+
const FormTextarea = withController(({ field, props }) => /* @__PURE__ */ jsx(MyTextarea, { ...field, ...props }));
|
|
12
6
|
|
|
13
7
|
export { FormTextarea };
|
package/dist/index.cjs
CHANGED
|
@@ -25,14 +25,13 @@ const revalidate = require('./consts/revalidate.cjs');
|
|
|
25
25
|
const index$g = require('./contexts/NavigationHistoryContext/index.cjs');
|
|
26
26
|
const hook = require('./contexts/NavigationHistoryContext/hook.cjs');
|
|
27
27
|
const index$h = require('./contexts/PageDataContext/index.cjs');
|
|
28
|
-
const Form = require('./form/Form.cjs');
|
|
29
|
-
const FormSubmitButton = require('./form/FormSubmitButton.cjs');
|
|
30
|
-
const zodValidator = require('./form/utils/zodValidator.cjs');
|
|
31
|
-
const nullableButRequired = require('./form/utils/nullable-but-required.cjs');
|
|
32
|
-
const optionalButRequired = require('./form/utils/optional-but-required.cjs');
|
|
33
28
|
const FormCheckbox = require('./form/base/FormCheckbox.cjs');
|
|
29
|
+
const FormCheckboxGroup = require('./form/base/FormCheckboxGroup.cjs');
|
|
30
|
+
const FormDateInput = require('./form/base/FormDateInput.cjs');
|
|
34
31
|
const FormDatePickerInput = require('./form/base/FormDatePickerInput.cjs');
|
|
35
32
|
const FormDateTimePicker = require('./form/base/FormDateTimePicker.cjs');
|
|
33
|
+
const FormMonthPickerInput = require('./form/base/FormMonthPickerInput.cjs');
|
|
34
|
+
const FormMultiSelect = require('./form/base/FormMultiSelect.cjs');
|
|
36
35
|
const FormNumberInput = require('./form/base/FormNumberInput.cjs');
|
|
37
36
|
const FormRadioGroup = require('./form/base/FormRadioGroup.cjs');
|
|
38
37
|
const FormSelect = require('./form/base/FormSelect.cjs');
|
|
@@ -40,10 +39,11 @@ const FormSelectInfinity = require('./form/base/FormSelectInfinity.cjs');
|
|
|
40
39
|
const FormTextarea = require('./form/base/FormTextarea.cjs');
|
|
41
40
|
const FormTextInput = require('./form/base/FormTextInput.cjs');
|
|
42
41
|
const FormTimeInput = require('./form/base/FormTimeInput.cjs');
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
42
|
+
const Form = require('./form/Form.cjs');
|
|
43
|
+
const FormSubmitButton = require('./form/FormSubmitButton.cjs');
|
|
44
|
+
const nullableButRequired = require('./form/utils/nullable-but-required.cjs');
|
|
45
|
+
const optionalButRequired = require('./form/utils/optional-but-required.cjs');
|
|
46
|
+
const zodValidator = require('./form/utils/zodValidator.cjs');
|
|
47
47
|
const withController = require('./hocs/withController.cjs');
|
|
48
48
|
const withModalManager = require('./hocs/withModalManager.cjs');
|
|
49
49
|
const useBreakpoint = require('./hooks/useBreakpoint.cjs');
|
|
@@ -91,14 +91,13 @@ exports.QP_BACK_URL_NAME = hook.QP_BACK_URL_NAME;
|
|
|
91
91
|
exports.useNavigationHistory = hook.useNavigationHistory;
|
|
92
92
|
exports.PageDataProvider = index$h.PageDataProvider;
|
|
93
93
|
exports.usePageData = index$h.usePageData;
|
|
94
|
-
exports.Form = Form.Form;
|
|
95
|
-
exports.FormSubmitButton = FormSubmitButton.FormSubmitButton;
|
|
96
|
-
exports.zodValidator = zodValidator.zodValidator;
|
|
97
|
-
exports.nullableButRequired = nullableButRequired.nullableButRequired;
|
|
98
|
-
exports.optionalButRequired = optionalButRequired.optionalButRequired;
|
|
99
94
|
exports.FormCheckbox = FormCheckbox.FormCheckbox;
|
|
95
|
+
exports.FormCheckboxGroup = FormCheckboxGroup.FormCheckboxGroup;
|
|
96
|
+
exports.FormDateInput = FormDateInput.FormDateInput;
|
|
100
97
|
exports.FormDatePickerInput = FormDatePickerInput.FormDatePickerInput;
|
|
101
98
|
exports.FormDateTimePicker = FormDateTimePicker.FormDateTimePicker;
|
|
99
|
+
exports.FormMonthPickerInput = FormMonthPickerInput.FormMonthPickerInput;
|
|
100
|
+
exports.FormMultiSelect = FormMultiSelect.FormMultiSelect;
|
|
102
101
|
exports.FormNumberInput = FormNumberInput.FormNumberInput;
|
|
103
102
|
exports.FormRadioGroup = FormRadioGroup.FormRadioGroup;
|
|
104
103
|
exports.FormSelect = FormSelect.FormSelect;
|
|
@@ -108,10 +107,11 @@ exports.FormTextInput = FormTextInput.FormTextInput;
|
|
|
108
107
|
exports.FormTimeInput = FormTimeInput.FormTimeInput;
|
|
109
108
|
exports.numberToTimeInput = FormTimeInput.numberToTimeInput;
|
|
110
109
|
exports.timeInputToNumber = FormTimeInput.timeInputToNumber;
|
|
111
|
-
exports.
|
|
112
|
-
exports.
|
|
113
|
-
exports.
|
|
114
|
-
exports.
|
|
110
|
+
exports.Form = Form.Form;
|
|
111
|
+
exports.FormSubmitButton = FormSubmitButton.FormSubmitButton;
|
|
112
|
+
exports.nullableButRequired = nullableButRequired.nullableButRequired;
|
|
113
|
+
exports.optionalButRequired = optionalButRequired.optionalButRequired;
|
|
114
|
+
exports.zodValidator = zodValidator.zodValidator;
|
|
115
115
|
exports.withController = withController.withController;
|
|
116
116
|
exports.withModalManager = withModalManager.withModalManager;
|
|
117
117
|
exports.useBreakpoint = useBreakpoint.useBreakpoint;
|
package/dist/index.js
CHANGED
|
@@ -21,14 +21,13 @@ export { Revalidate } from './consts/revalidate.js';
|
|
|
21
21
|
export { NavigationHistoryProvider } from './contexts/NavigationHistoryContext/index.js';
|
|
22
22
|
export { QP_BACK_URL_NAME, useNavigationHistory } from './contexts/NavigationHistoryContext/hook.js';
|
|
23
23
|
export { PageDataProvider, usePageData } from './contexts/PageDataContext/index.js';
|
|
24
|
-
export { Form } from './form/Form.js';
|
|
25
|
-
export { FormSubmitButton } from './form/FormSubmitButton.js';
|
|
26
|
-
export { zodValidator } from './form/utils/zodValidator.js';
|
|
27
|
-
export { nullableButRequired } from './form/utils/nullable-but-required.js';
|
|
28
|
-
export { optionalButRequired } from './form/utils/optional-but-required.js';
|
|
29
24
|
export { FormCheckbox } from './form/base/FormCheckbox.js';
|
|
25
|
+
export { FormCheckboxGroup } from './form/base/FormCheckboxGroup.js';
|
|
26
|
+
export { FormDateInput } from './form/base/FormDateInput.js';
|
|
30
27
|
export { FormDatePickerInput } from './form/base/FormDatePickerInput.js';
|
|
31
28
|
export { FormDateTimePicker } from './form/base/FormDateTimePicker.js';
|
|
29
|
+
export { FormMonthPickerInput } from './form/base/FormMonthPickerInput.js';
|
|
30
|
+
export { FormMultiSelect } from './form/base/FormMultiSelect.js';
|
|
32
31
|
export { FormNumberInput } from './form/base/FormNumberInput.js';
|
|
33
32
|
export { FormRadioGroup } from './form/base/FormRadioGroup.js';
|
|
34
33
|
export { FormSelect } from './form/base/FormSelect.js';
|
|
@@ -36,10 +35,11 @@ export { FormInfinitySelect } from './form/base/FormSelectInfinity.js';
|
|
|
36
35
|
export { FormTextarea } from './form/base/FormTextarea.js';
|
|
37
36
|
export { FormTextInput } from './form/base/FormTextInput.js';
|
|
38
37
|
export { FormTimeInput, numberToTimeInput, timeInputToNumber } from './form/base/FormTimeInput.js';
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
38
|
+
export { Form } from './form/Form.js';
|
|
39
|
+
export { FormSubmitButton } from './form/FormSubmitButton.js';
|
|
40
|
+
export { nullableButRequired } from './form/utils/nullable-but-required.js';
|
|
41
|
+
export { optionalButRequired } from './form/utils/optional-but-required.js';
|
|
42
|
+
export { zodValidator } from './form/utils/zodValidator.js';
|
|
43
43
|
export { withController } from './hocs/withController.js';
|
|
44
44
|
export { withModalManager } from './hocs/withModalManager.js';
|
|
45
45
|
export { useBreakpoint } from './hooks/useBreakpoint.js';
|
|
@@ -26,13 +26,16 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
27
27
|
|
|
28
28
|
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
29
|
-
function useVirtualizerBase(
|
|
29
|
+
function useVirtualizerBase({
|
|
30
|
+
useFlushSync = true,
|
|
31
|
+
...options
|
|
32
|
+
}) {
|
|
30
33
|
const rerender = React__namespace.useReducer(() => ({}), {})[1];
|
|
31
34
|
const resolvedOptions = {
|
|
32
35
|
...options,
|
|
33
36
|
onChange: (instance2, sync) => {
|
|
34
37
|
var _a;
|
|
35
|
-
if (sync) {
|
|
38
|
+
if (useFlushSync && sync) {
|
|
36
39
|
reactDom.flushSync(rerender);
|
|
37
40
|
} else {
|
|
38
41
|
rerender();
|
|
@@ -4,13 +4,16 @@ import { Virtualizer, elementScroll, observeElementOffset, observeElementRect }
|
|
|
4
4
|
export { defaultKeyExtractor, defaultRangeExtractor, measureElement } from '../../../virtual-core/dist/esm/index.js';
|
|
5
5
|
|
|
6
6
|
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
7
|
-
function useVirtualizerBase(
|
|
7
|
+
function useVirtualizerBase({
|
|
8
|
+
useFlushSync = true,
|
|
9
|
+
...options
|
|
10
|
+
}) {
|
|
8
11
|
const rerender = React.useReducer(() => ({}), {})[1];
|
|
9
12
|
const resolvedOptions = {
|
|
10
13
|
...options,
|
|
11
14
|
onChange: (instance2, sync) => {
|
|
12
15
|
var _a;
|
|
13
|
-
if (sync) {
|
|
16
|
+
if (useFlushSync && sync) {
|
|
14
17
|
flushSync(rerender);
|
|
15
18
|
} else {
|
|
16
19
|
rerender();
|
|
@@ -84,7 +84,6 @@ const observeElementOffset = (instance, cb) => {
|
|
|
84
84
|
};
|
|
85
85
|
const handler = createHandler(true);
|
|
86
86
|
const endHandler = createHandler(false);
|
|
87
|
-
endHandler();
|
|
88
87
|
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
89
88
|
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
90
89
|
if (registerScrollendEvent) {
|
|
@@ -126,6 +125,7 @@ class Virtualizer {
|
|
|
126
125
|
this.scrollElement = null;
|
|
127
126
|
this.targetWindow = null;
|
|
128
127
|
this.isScrolling = false;
|
|
128
|
+
this.currentScrollToIndex = null;
|
|
129
129
|
this.measurementsCache = [];
|
|
130
130
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
131
131
|
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
@@ -261,10 +261,6 @@ class Virtualizer {
|
|
|
261
261
|
this.elementsCache.forEach((cached) => {
|
|
262
262
|
this.observer.observe(cached);
|
|
263
263
|
});
|
|
264
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
|
265
|
-
adjustments: void 0,
|
|
266
|
-
behavior: void 0
|
|
267
|
-
});
|
|
268
264
|
this.unsubs.push(
|
|
269
265
|
this.options.observeElementRect(this, (rect) => {
|
|
270
266
|
this.scrollRect = rect;
|
|
@@ -280,6 +276,10 @@ class Virtualizer {
|
|
|
280
276
|
this.maybeNotify();
|
|
281
277
|
})
|
|
282
278
|
);
|
|
279
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
280
|
+
adjustments: void 0,
|
|
281
|
+
behavior: void 0
|
|
282
|
+
});
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
285
|
this.getSize = () => {
|
|
@@ -351,11 +351,7 @@ class Virtualizer {
|
|
|
351
351
|
};
|
|
352
352
|
},
|
|
353
353
|
{
|
|
354
|
-
key: false
|
|
355
|
-
skipInitialOnChange: true,
|
|
356
|
-
onChange: () => {
|
|
357
|
-
this.notify(this.isScrolling);
|
|
358
|
-
}
|
|
354
|
+
key: false
|
|
359
355
|
}
|
|
360
356
|
);
|
|
361
357
|
this.getMeasurements = utils.memo(
|
|
@@ -382,7 +378,7 @@ class Virtualizer {
|
|
|
382
378
|
this.laneAssignments.clear();
|
|
383
379
|
this.pendingMeasuredCacheIndexes = [];
|
|
384
380
|
}
|
|
385
|
-
if (this.measurementsCache.length === 0) {
|
|
381
|
+
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
386
382
|
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
387
383
|
this.measurementsCache.forEach((item) => {
|
|
388
384
|
this.itemSizeCache.set(item.key, item.size);
|
|
@@ -587,7 +583,17 @@ class Virtualizer {
|
|
|
587
583
|
)]
|
|
588
584
|
);
|
|
589
585
|
};
|
|
586
|
+
this.getMaxScrollOffset = () => {
|
|
587
|
+
if (!this.scrollElement) return 0;
|
|
588
|
+
if ("scrollHeight" in this.scrollElement) {
|
|
589
|
+
return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
590
|
+
} else {
|
|
591
|
+
const doc = this.scrollElement.document.documentElement;
|
|
592
|
+
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
593
|
+
}
|
|
594
|
+
};
|
|
590
595
|
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
596
|
+
if (!this.scrollElement) return 0;
|
|
591
597
|
const size = this.getSize();
|
|
592
598
|
const scrollOffset = this.getScrollOffset();
|
|
593
599
|
if (align === "auto") {
|
|
@@ -598,7 +604,7 @@ class Virtualizer {
|
|
|
598
604
|
} else if (align === "end") {
|
|
599
605
|
toOffset -= size;
|
|
600
606
|
}
|
|
601
|
-
const maxOffset = this.
|
|
607
|
+
const maxOffset = this.getMaxScrollOffset();
|
|
602
608
|
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
603
609
|
};
|
|
604
610
|
this.getOffsetForIndex = (index, align = "auto") => {
|
|
@@ -618,6 +624,9 @@ class Virtualizer {
|
|
|
618
624
|
return [scrollOffset, align];
|
|
619
625
|
}
|
|
620
626
|
}
|
|
627
|
+
if (align === "end" && index === this.options.count - 1) {
|
|
628
|
+
return [this.getMaxScrollOffset(), align];
|
|
629
|
+
}
|
|
621
630
|
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
622
631
|
return [
|
|
623
632
|
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
@@ -643,6 +652,7 @@ class Virtualizer {
|
|
|
643
652
|
);
|
|
644
653
|
}
|
|
645
654
|
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
655
|
+
this.currentScrollToIndex = index;
|
|
646
656
|
let attempts = 0;
|
|
647
657
|
const maxAttempts = 10;
|
|
648
658
|
const tryScroll = (currentAlign) => {
|
|
@@ -655,19 +665,29 @@ class Virtualizer {
|
|
|
655
665
|
const [offset, align] = offsetInfo;
|
|
656
666
|
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
657
667
|
this.targetWindow.requestAnimationFrame(() => {
|
|
658
|
-
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
668
|
+
if (!this.targetWindow) return;
|
|
669
|
+
const verify = () => {
|
|
670
|
+
if (this.currentScrollToIndex !== index) return;
|
|
671
|
+
const currentOffset = this.getScrollOffset();
|
|
672
|
+
const afterInfo = this.getOffsetForIndex(index, align);
|
|
673
|
+
if (!afterInfo) {
|
|
674
|
+
console.warn("Failed to get offset for index:", index);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (!utils.approxEqual(afterInfo[0], currentOffset)) {
|
|
678
|
+
scheduleRetry(align);
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
if (this.isDynamicMode()) {
|
|
682
|
+
this.targetWindow.requestAnimationFrame(verify);
|
|
683
|
+
} else {
|
|
684
|
+
verify();
|
|
666
685
|
}
|
|
667
686
|
});
|
|
668
687
|
};
|
|
669
688
|
const scheduleRetry = (align) => {
|
|
670
689
|
if (!this.targetWindow) return;
|
|
690
|
+
if (this.currentScrollToIndex !== index) return;
|
|
671
691
|
attempts++;
|
|
672
692
|
if (attempts < maxAttempts) {
|
|
673
693
|
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
|
@@ -80,7 +80,6 @@ const observeElementOffset = (instance, cb) => {
|
|
|
80
80
|
};
|
|
81
81
|
const handler = createHandler(true);
|
|
82
82
|
const endHandler = createHandler(false);
|
|
83
|
-
endHandler();
|
|
84
83
|
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
85
84
|
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
86
85
|
if (registerScrollendEvent) {
|
|
@@ -122,6 +121,7 @@ class Virtualizer {
|
|
|
122
121
|
this.scrollElement = null;
|
|
123
122
|
this.targetWindow = null;
|
|
124
123
|
this.isScrolling = false;
|
|
124
|
+
this.currentScrollToIndex = null;
|
|
125
125
|
this.measurementsCache = [];
|
|
126
126
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
127
127
|
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
@@ -257,10 +257,6 @@ class Virtualizer {
|
|
|
257
257
|
this.elementsCache.forEach((cached) => {
|
|
258
258
|
this.observer.observe(cached);
|
|
259
259
|
});
|
|
260
|
-
this._scrollToOffset(this.getScrollOffset(), {
|
|
261
|
-
adjustments: void 0,
|
|
262
|
-
behavior: void 0
|
|
263
|
-
});
|
|
264
260
|
this.unsubs.push(
|
|
265
261
|
this.options.observeElementRect(this, (rect) => {
|
|
266
262
|
this.scrollRect = rect;
|
|
@@ -276,6 +272,10 @@ class Virtualizer {
|
|
|
276
272
|
this.maybeNotify();
|
|
277
273
|
})
|
|
278
274
|
);
|
|
275
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
276
|
+
adjustments: void 0,
|
|
277
|
+
behavior: void 0
|
|
278
|
+
});
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
281
|
this.getSize = () => {
|
|
@@ -347,11 +347,7 @@ class Virtualizer {
|
|
|
347
347
|
};
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
|
-
key: false
|
|
351
|
-
skipInitialOnChange: true,
|
|
352
|
-
onChange: () => {
|
|
353
|
-
this.notify(this.isScrolling);
|
|
354
|
-
}
|
|
350
|
+
key: false
|
|
355
351
|
}
|
|
356
352
|
);
|
|
357
353
|
this.getMeasurements = memo(
|
|
@@ -378,7 +374,7 @@ class Virtualizer {
|
|
|
378
374
|
this.laneAssignments.clear();
|
|
379
375
|
this.pendingMeasuredCacheIndexes = [];
|
|
380
376
|
}
|
|
381
|
-
if (this.measurementsCache.length === 0) {
|
|
377
|
+
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
382
378
|
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
383
379
|
this.measurementsCache.forEach((item) => {
|
|
384
380
|
this.itemSizeCache.set(item.key, item.size);
|
|
@@ -583,7 +579,17 @@ class Virtualizer {
|
|
|
583
579
|
)]
|
|
584
580
|
);
|
|
585
581
|
};
|
|
582
|
+
this.getMaxScrollOffset = () => {
|
|
583
|
+
if (!this.scrollElement) return 0;
|
|
584
|
+
if ("scrollHeight" in this.scrollElement) {
|
|
585
|
+
return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
586
|
+
} else {
|
|
587
|
+
const doc = this.scrollElement.document.documentElement;
|
|
588
|
+
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
589
|
+
}
|
|
590
|
+
};
|
|
586
591
|
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
592
|
+
if (!this.scrollElement) return 0;
|
|
587
593
|
const size = this.getSize();
|
|
588
594
|
const scrollOffset = this.getScrollOffset();
|
|
589
595
|
if (align === "auto") {
|
|
@@ -594,7 +600,7 @@ class Virtualizer {
|
|
|
594
600
|
} else if (align === "end") {
|
|
595
601
|
toOffset -= size;
|
|
596
602
|
}
|
|
597
|
-
const maxOffset = this.
|
|
603
|
+
const maxOffset = this.getMaxScrollOffset();
|
|
598
604
|
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
599
605
|
};
|
|
600
606
|
this.getOffsetForIndex = (index, align = "auto") => {
|
|
@@ -614,6 +620,9 @@ class Virtualizer {
|
|
|
614
620
|
return [scrollOffset, align];
|
|
615
621
|
}
|
|
616
622
|
}
|
|
623
|
+
if (align === "end" && index === this.options.count - 1) {
|
|
624
|
+
return [this.getMaxScrollOffset(), align];
|
|
625
|
+
}
|
|
617
626
|
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
618
627
|
return [
|
|
619
628
|
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
@@ -639,6 +648,7 @@ class Virtualizer {
|
|
|
639
648
|
);
|
|
640
649
|
}
|
|
641
650
|
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
651
|
+
this.currentScrollToIndex = index;
|
|
642
652
|
let attempts = 0;
|
|
643
653
|
const maxAttempts = 10;
|
|
644
654
|
const tryScroll = (currentAlign) => {
|
|
@@ -651,19 +661,29 @@ class Virtualizer {
|
|
|
651
661
|
const [offset, align] = offsetInfo;
|
|
652
662
|
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
653
663
|
this.targetWindow.requestAnimationFrame(() => {
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
664
|
+
if (!this.targetWindow) return;
|
|
665
|
+
const verify = () => {
|
|
666
|
+
if (this.currentScrollToIndex !== index) return;
|
|
667
|
+
const currentOffset = this.getScrollOffset();
|
|
668
|
+
const afterInfo = this.getOffsetForIndex(index, align);
|
|
669
|
+
if (!afterInfo) {
|
|
670
|
+
console.warn("Failed to get offset for index:", index);
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
if (!approxEqual(afterInfo[0], currentOffset)) {
|
|
674
|
+
scheduleRetry(align);
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
if (this.isDynamicMode()) {
|
|
678
|
+
this.targetWindow.requestAnimationFrame(verify);
|
|
679
|
+
} else {
|
|
680
|
+
verify();
|
|
662
681
|
}
|
|
663
682
|
});
|
|
664
683
|
};
|
|
665
684
|
const scheduleRetry = (align) => {
|
|
666
685
|
if (!this.targetWindow) return;
|
|
686
|
+
if (this.currentScrollToIndex !== index) return;
|
|
667
687
|
attempts++;
|
|
668
688
|
if (attempts < maxAttempts) {
|
|
669
689
|
if (process.env.NODE_ENV !== "production" && this.options.debug) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lkd-web-kit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.31",
|
|
4
4
|
"description": "A template for creating React component libraries with Vite.",
|
|
5
5
|
"author": "LKD",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"vitest": "^3.2.4"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@mantine/core": "^8.3.
|
|
49
|
-
"@mantine/dates": "^8.3.
|
|
50
|
-
"@mantine/hooks": "^8.3.
|
|
51
|
-
"@mantine/notifications": "^8.3.
|
|
52
|
-
"@tanstack/react-query": "^5.
|
|
48
|
+
"@mantine/core": "^8.3.18",
|
|
49
|
+
"@mantine/dates": "^8.3.18",
|
|
50
|
+
"@mantine/hooks": "^8.3.18",
|
|
51
|
+
"@mantine/notifications": "^8.3.18",
|
|
52
|
+
"@tanstack/react-query": "^5.91.2",
|
|
53
53
|
"clsx": "^2.1.1",
|
|
54
|
-
"ky": "^1.14.
|
|
55
|
-
"next": "^16.
|
|
56
|
-
"react": "^19.2.
|
|
57
|
-
"react-dom": "^19.2.
|
|
58
|
-
"react-hook-form": "^7.71.
|
|
54
|
+
"ky": "^1.14.3",
|
|
55
|
+
"next": "^16.2.0",
|
|
56
|
+
"react": "^19.2.4",
|
|
57
|
+
"react-dom": "^19.2.4",
|
|
58
|
+
"react-hook-form": "^7.71.2",
|
|
59
59
|
"react-query-kit": "^3.3.2",
|
|
60
60
|
"zod": "^4.3.6"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@tanstack/react-virtual": "^3.13.
|
|
63
|
+
"@tanstack/react-virtual": "^3.13.19"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|