@abcagency/hc-ui-components 1.4.22 → 1.5.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.
- package/dist/components/HireControlMap.js +20 -32
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/filter-container.js +5 -13
- package/dist/components/containers/accordions/filter-container.js.map +1 -1
- package/dist/components/containers/accordions/filter-item-container.js +9 -9
- package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js +5 -10
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/filter/commute-container.js +3 -3
- package/dist/components/containers/filter/commute-container.js.map +1 -1
- package/dist/components/containers/filter/filter-container.js +5 -6
- package/dist/components/containers/filter/filter-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js +12 -12
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/filter/location-container.js +5 -6
- package/dist/components/containers/filter/location-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-container.js +5 -5
- package/dist/components/containers/filter/points-of-interest-container.js.map +1 -1
- package/dist/components/containers/filter/points-of-interest-radio-item-container.js +2 -2
- package/dist/components/containers/filter/points-of-interest-radio-item-container.js.map +1 -1
- package/dist/components/containers/filter/search-container.js +2 -2
- package/dist/components/containers/filter/search-container.js.map +1 -1
- package/dist/components/containers/jobListing/listing-details-container.js +2 -2
- package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
- package/dist/components/containers/list/item-list-container.js +8 -8
- package/dist/components/containers/list/item-list-container.js.map +1 -1
- package/dist/components/containers/list/list-item/list-item-container.js +2 -2
- package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js +2 -2
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +9 -8
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/containers/maps/map-list-container.js +5 -5
- package/dist/components/containers/maps/map-list-container.js.map +1 -1
- package/dist/components/containers/maps/map-marker-container.js +6 -6
- package/dist/components/containers/maps/map-marker-container.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js +5 -5
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/accordions/default.js +15 -15
- package/dist/components/modules/accordions/default.js.map +1 -1
- package/dist/components/modules/accordions/filterItem.js +4 -4
- package/dist/components/modules/accordions/filterItem.js.map +1 -1
- package/dist/components/modules/accordions/filters.js +6 -6
- package/dist/components/modules/accordions/filters.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +19 -19
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/components/modules/buttons/default.js +9 -9
- package/dist/components/modules/buttons/default.js.map +1 -1
- package/dist/components/modules/buttons/items-pill.js +2 -2
- package/dist/components/modules/buttons/items-pill.js.map +1 -1
- package/dist/components/modules/buttons/pill-wrapper.js +2 -2
- package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js +3 -3
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/cards/default.js +11 -11
- package/dist/components/modules/cards/default.js.map +1 -1
- package/dist/components/modules/cards/filter.js +5 -5
- package/dist/components/modules/cards/filter.js.map +1 -1
- package/dist/components/modules/dialogs/apply-dialog.js +19 -19
- package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
- package/dist/components/modules/filter/commute.js +19 -18
- package/dist/components/modules/filter/commute.js.map +1 -1
- package/dist/components/modules/filter/index.js +10 -10
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/item.js +6 -6
- package/dist/components/modules/filter/item.js.map +1 -1
- package/dist/components/modules/filter/location.js +6 -6
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js +6 -6
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js +10 -10
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/filter/sort.js +28 -28
- package/dist/components/modules/filter/sort.js.map +1 -1
- package/dist/components/modules/grid.js +4 -4
- package/dist/components/modules/grid.js.map +1 -1
- package/dist/components/modules/icon.js +4 -4
- package/dist/components/modules/icon.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details.js +4 -4
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/list/field-mapper-desktop.js +8 -8
- package/dist/components/modules/list/field-mapper-desktop.js.map +1 -1
- package/dist/components/modules/list/field-mapper-mobile.js +18 -18
- package/dist/components/modules/list/field-mapper-mobile.js.map +1 -1
- package/dist/components/modules/list/header-item.js +7 -7
- package/dist/components/modules/list/header-item.js.map +1 -1
- package/dist/components/modules/list/header.js +5 -5
- package/dist/components/modules/list/header.js.map +1 -1
- package/dist/components/modules/list/item-expand-card/index.js +3 -3
- package/dist/components/modules/list/item-expand-card/index.js.map +1 -1
- package/dist/components/modules/list/item-list.js +15 -15
- package/dist/components/modules/list/item-list.js.map +1 -1
- package/dist/components/modules/list/list-item/list-item.js +13 -13
- package/dist/components/modules/list/list-item/list-item.js.map +1 -1
- package/dist/components/modules/maps/info-window-card.js +2 -2
- package/dist/components/modules/maps/info-window-card.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js +5 -5
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/components/modules/maps/map-list.js +5 -5
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map-marker.js +3 -3
- package/dist/components/modules/maps/map-marker.js.map +1 -1
- package/dist/components/modules/maps/map.js +5 -5
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/components/modules/maps/place-marker.js +5 -5
- package/dist/components/modules/maps/place-marker.js.map +1 -1
- package/dist/components/modules/maps/tabs.js +21 -21
- package/dist/components/modules/maps/tabs.js.map +1 -1
- package/dist/contexts/mapContext.js +2 -2
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +46 -39
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/placesContext.js +2 -2
- package/dist/contexts/placesContext.js.map +1 -1
- package/dist/contexts/themeContext.js +2 -2
- package/dist/contexts/themeContext.js.map +1 -1
- package/dist/contexts/trackEventContext.js +2 -2
- package/dist/contexts/trackEventContext.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/core/dist/floating-ui.core.js +34 -21
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +103 -30
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +12 -4
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +37 -15
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +9 -8
- package/dist/packages/hc-ui-components/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/primitive/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/primitive/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-accordion/dist/index.js +8 -6
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-accordion/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-arrow/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-arrow/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collapsible/dist/index.js +5 -4
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collapsible/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collection/dist/index.js +5 -3
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-collection/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-compose-refs/dist/index.js +24 -3
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-context/dist/index.js +9 -9
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-context/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-dialog/dist/index.js +6 -4
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-direction/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-direction/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-focus-guards/dist/index.js +4 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-id/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-id/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-popper/dist/index.js +6 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-popper/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-presence/dist/index.js +17 -6
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-primitive/dist/index.js +4 -2
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-roving-focus/dist/index.js +8 -5
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-roving-focus/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-select/dist/index.js +77 -31
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-select/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-slot/dist/index.js +46 -38
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-tabs/dist/index.js +2 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-tabs/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +39 -15
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-previous/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-previous/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-size/dist/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-use-size/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-visually-hidden/dist/index.js +16 -16
- package/dist/packages/hc-ui-components/node_modules/@radix-ui/react-visually-hidden/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@react-google-maps/api/dist/esm.js +8086 -7852
- package/dist/packages/hc-ui-components/node_modules/@react-google-maps/api/dist/esm.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@remix-run/router/dist/router.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/@remix-run/router/dist/router.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/react-virtual/dist/esm/index.js +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/index.js +213 -152
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/utils.js +6 -2
- package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/utils.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/aria-hidden/dist/es2015/index.js +3 -2
- package/dist/packages/hc-ui-components/node_modules/aria-hidden/dist/es2015/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/UI.js +2 -2
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +12 -8
- package/dist/packages/hc-ui-components/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-router/dist/index.js +6 -6
- package/dist/packages/hc-ui-components/node_modules/react-router/dist/index.js.map +1 -1
- package/dist/packages/hc-ui-components/node_modules/react-router-dom/dist/index.js +7 -7
- package/dist/packages/hc-ui-components/node_modules/react-router-dom/dist/index.js.map +1 -1
- package/dist/services/listingAggregatorService.js +15 -19
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +2 -3
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +16 -1
- package/dist/services/listingService.js.map +1 -1
- package/dist/styles/index.css +3 -1
- package/dist/types/services/listingAggregatorService.d.ts +2 -2
- package/dist/types/services/listingEntityService.d.ts +3 -2
- package/dist/types/types/GetListingParams.d.ts +1 -1
- package/dist/types/types/ListingEntity.d.ts +1 -2
- package/dist/types/types/ListingFields.d.ts +2 -4
- package/dist/types/types/Listings.d.ts +1 -0
- package/dist/types/util/mapUtil.d.ts +3 -3
- package/dist/util/filterUtil.js +6 -6
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/loading.js +3 -3
- package/dist/util/loading.js.map +1 -1
- package/dist/util/mapUtil.js +25 -37
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +17 -60
- package/src/components/HireControlMap.js +7 -18
- package/src/components/containers/accordions/filter-container.js +1 -6
- package/src/components/containers/accordions/filter-item-container.js +2 -2
- package/src/components/containers/accordions/map-accordion-item-container.js +2 -6
- package/src/components/containers/filter/filter-container.js +2 -3
- package/src/components/containers/filter/filter-item-container.js +10 -10
- package/src/components/containers/filter/location-container.js +3 -3
- package/src/components/containers/list/item-list-container.tsx +3 -3
- package/src/components/containers/maps/info-window-content-container.js +1 -1
- package/src/components/containers/maps/map-container.js +1 -2
- package/src/components/modules/buttons/button-group-apply.js +8 -8
- package/src/components/modules/dialogs/apply-dialog.js +2 -2
- package/src/components/modules/list/field-mapper-desktop.jsx +2 -2
- package/src/components/modules/list/field-mapper-mobile.jsx +8 -8
- package/src/components/modules/list/header-item.js +1 -1
- package/src/components/modules/maps/map-list.js +1 -1
- package/src/contexts/mapListContext.tsx +70 -64
- package/src/services/listingAggregatorService.ts +21 -29
- package/src/services/listingEntityService.ts +3 -3
- package/src/services/listingService.ts +11 -1
- package/src/types/GetListingParams.ts +1 -1
- package/src/types/ListingEntity.ts +1 -2
- package/src/types/ListingFields.ts +2 -4
- package/src/types/Listings.ts +1 -0
- package/src/util/filterUtil.js +6 -6
- package/src/util/mapUtil.js +41 -52
- package/src/styles/components.css +0 -30
package/dist/packages/hc-ui-components/node_modules/@tanstack/react-virtual/dist/esm/index.js
CHANGED
|
@@ -22,7 +22,7 @@ function useVirtualizerBase(options) {
|
|
|
22
22
|
() => new Virtualizer(resolvedOptions)
|
|
23
23
|
);
|
|
24
24
|
instance.setOptions(resolvedOptions);
|
|
25
|
-
|
|
25
|
+
useIsomorphicLayoutEffect(() => {
|
|
26
26
|
return instance._didMount();
|
|
27
27
|
}, []);
|
|
28
28
|
useIsomorphicLayoutEffect(() => {
|
package/dist/packages/hc-ui-components/node_modules/@tanstack/react-virtual/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js"],"sourcesContent":["import * as React from \"react\";\nimport { flushSync } from \"react-dom\";\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@tanstack/react-virtual/dist/esm/index.js"],"sourcesContent":["import * as React from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { Virtualizer, elementScroll, observeElementOffset, observeElementRect, windowScroll, observeWindowOffset, observeWindowRect } from \"@tanstack/virtual-core\";\nexport * from \"@tanstack/virtual-core\";\nconst useIsomorphicLayoutEffect = typeof document !== \"undefined\" ? React.useLayoutEffect : React.useEffect;\nfunction useVirtualizerBase(options) {\n const rerender = React.useReducer(() => ({}), {})[1];\n const resolvedOptions = {\n ...options,\n onChange: (instance2, sync) => {\n var _a;\n if (sync) {\n flushSync(rerender);\n } else {\n rerender();\n }\n (_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);\n }\n };\n const [instance] = React.useState(\n () => new Virtualizer(resolvedOptions)\n );\n instance.setOptions(resolvedOptions);\n useIsomorphicLayoutEffect(() => {\n return instance._didMount();\n }, []);\n useIsomorphicLayoutEffect(() => {\n return instance._willUpdate();\n });\n return instance;\n}\nfunction useVirtualizer(options) {\n return useVirtualizerBase({\n observeElementRect,\n observeElementOffset,\n scrollToFn: elementScroll,\n ...options\n });\n}\nfunction useWindowVirtualizer(options) {\n return useVirtualizerBase({\n getScrollElement: () => typeof document !== \"undefined\" ? window : null,\n observeElementRect: observeWindowRect,\n observeElementOffset: observeWindowOffset,\n scrollToFn: windowScroll,\n initialOffset: () => typeof document !== \"undefined\" ? window.scrollY : 0,\n ...options\n });\n}\nexport {\n useVirtualizer,\n useWindowVirtualizer\n};\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":";;;;;AAIA,MAAM,yBAAyB,GAAG,OAAO,QAAQ,KAAK,WAAW,GAAG,KAAK,CAAC,eAAe,GAAG,KAAK,CAAC,SAAS,CAAC;AAC5G,SAAS,kBAAkB,CAAC,OAAO,EAAE;AACrC,EAAE,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,EAAE,MAAM,eAAe,GAAG;AAC1B,IAAI,GAAG,OAAO;AACd,IAAI,QAAQ,EAAE,CAAC,SAAS,EAAE,IAAI,KAAK;AACnC,MAAM,IAAI,EAAE,CAAC;AACb,MAAM,IAAI,IAAI,EAAE;AAChB,QAAQ,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC5B,OAAO,MAAM;AACb,QAAQ,QAAQ,EAAE,CAAC;AACnB,OAAO;AACP,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACnF,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ;AACnC,IAAI,MAAM,IAAI,WAAW,CAAC,eAAe,CAAC;AAC1C,GAAG,CAAC;AACJ,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AACvC,EAAE,yBAAyB,CAAC,MAAM;AAClC,IAAI,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAC;AAChC,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,yBAAyB,CAAC,MAAM;AAClC,IAAI,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAClC,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACD,SAAS,cAAc,CAAC,OAAO,EAAE;AACjC,EAAE,OAAO,kBAAkB,CAAC;AAC5B,IAAI,kBAAkB;AACtB,IAAI,oBAAoB;AACxB,IAAI,UAAU,EAAE,aAAa;AAC7B,IAAI,GAAG,OAAO;AACd,GAAG,CAAC,CAAC;AACL;;;;","x_google_ignoreList":[0]}
|
package/dist/packages/hc-ui-components/node_modules/@tanstack/virtual-core/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { debounce, memo, notUndefined, approxEqual } from './utils.js';
|
|
2
2
|
|
|
3
|
+
const getRect = (element) => {
|
|
4
|
+
const { offsetWidth, offsetHeight } = element;
|
|
5
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
6
|
+
};
|
|
3
7
|
const defaultKeyExtractor = (index) => index;
|
|
4
8
|
const defaultRangeExtractor = (range) => {
|
|
5
9
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
@@ -23,21 +27,24 @@ const observeElementRect = (instance, cb) => {
|
|
|
23
27
|
const { width, height } = rect;
|
|
24
28
|
cb({ width: Math.round(width), height: Math.round(height) });
|
|
25
29
|
};
|
|
26
|
-
handler(element
|
|
30
|
+
handler(getRect(element));
|
|
27
31
|
if (!targetWindow.ResizeObserver) {
|
|
28
32
|
return () => {
|
|
29
33
|
};
|
|
30
34
|
}
|
|
31
35
|
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const run = () => {
|
|
37
|
+
const entry = entries[0];
|
|
38
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
39
|
+
const box = entry.borderBoxSize[0];
|
|
40
|
+
if (box) {
|
|
41
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
handler(getRect(element));
|
|
46
|
+
};
|
|
47
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
41
48
|
});
|
|
42
49
|
observer.observe(element, { box: "border-box" });
|
|
43
50
|
return () => {
|
|
@@ -58,7 +65,7 @@ const observeElementOffset = (instance, cb) => {
|
|
|
58
65
|
return;
|
|
59
66
|
}
|
|
60
67
|
let offset = 0;
|
|
61
|
-
const fallback = supportsScrollend ? () => void 0 : debounce(
|
|
68
|
+
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
|
|
62
69
|
targetWindow,
|
|
63
70
|
() => {
|
|
64
71
|
cb(offset, false);
|
|
@@ -66,7 +73,8 @@ const observeElementOffset = (instance, cb) => {
|
|
|
66
73
|
instance.options.isScrollingResetDelay
|
|
67
74
|
);
|
|
68
75
|
const createHandler = (isScrolling) => () => {
|
|
69
|
-
|
|
76
|
+
const { horizontal, isRtl } = instance.options;
|
|
77
|
+
offset = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
|
|
70
78
|
fallback();
|
|
71
79
|
cb(offset, isScrolling);
|
|
72
80
|
};
|
|
@@ -74,10 +82,15 @@ const observeElementOffset = (instance, cb) => {
|
|
|
74
82
|
const endHandler = createHandler(false);
|
|
75
83
|
endHandler();
|
|
76
84
|
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
77
|
-
|
|
85
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
86
|
+
if (registerScrollendEvent) {
|
|
87
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
88
|
+
}
|
|
78
89
|
return () => {
|
|
79
90
|
element.removeEventListener("scroll", handler);
|
|
80
|
-
|
|
91
|
+
if (registerScrollendEvent) {
|
|
92
|
+
element.removeEventListener("scrollend", endHandler);
|
|
93
|
+
}
|
|
81
94
|
};
|
|
82
95
|
};
|
|
83
96
|
const measureElement = (element, entry, instance) => {
|
|
@@ -90,9 +103,7 @@ const measureElement = (element, entry, instance) => {
|
|
|
90
103
|
return size;
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
|
-
return
|
|
94
|
-
element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
|
|
95
|
-
);
|
|
106
|
+
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
96
107
|
};
|
|
97
108
|
const elementScroll = (offset, {
|
|
98
109
|
adjustments = 0,
|
|
@@ -111,7 +122,6 @@ class Virtualizer {
|
|
|
111
122
|
this.scrollElement = null;
|
|
112
123
|
this.targetWindow = null;
|
|
113
124
|
this.isScrolling = false;
|
|
114
|
-
this.scrollToIndexTimeoutId = null;
|
|
115
125
|
this.measurementsCache = [];
|
|
116
126
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
117
127
|
this.pendingMeasuredCacheIndexes = [];
|
|
@@ -131,14 +141,18 @@ class Virtualizer {
|
|
|
131
141
|
}
|
|
132
142
|
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
133
143
|
entries.forEach((entry) => {
|
|
134
|
-
|
|
144
|
+
const run = () => {
|
|
145
|
+
this._measureElement(entry.target, entry);
|
|
146
|
+
};
|
|
147
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
135
148
|
});
|
|
136
149
|
});
|
|
137
150
|
};
|
|
138
151
|
return {
|
|
139
152
|
disconnect: () => {
|
|
140
153
|
var _a;
|
|
141
|
-
|
|
154
|
+
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
155
|
+
_ro = null;
|
|
142
156
|
},
|
|
143
157
|
observe: (target) => {
|
|
144
158
|
var _a;
|
|
@@ -177,27 +191,44 @@ class Virtualizer {
|
|
|
177
191
|
lanes: 1,
|
|
178
192
|
isScrollingResetDelay: 150,
|
|
179
193
|
enabled: true,
|
|
194
|
+
isRtl: false,
|
|
195
|
+
useScrollendEvent: false,
|
|
196
|
+
useAnimationFrameWithResizeObserver: false,
|
|
180
197
|
...opts2
|
|
181
198
|
};
|
|
182
199
|
};
|
|
183
|
-
this.notify = (
|
|
200
|
+
this.notify = (sync) => {
|
|
184
201
|
var _a, _b;
|
|
185
|
-
|
|
186
|
-
startIndex: void 0,
|
|
187
|
-
endIndex: void 0
|
|
188
|
-
};
|
|
189
|
-
const range = this.calculateRange();
|
|
190
|
-
if (force || startIndex !== (range == null ? void 0 : range.startIndex) || endIndex !== (range == null ? void 0 : range.endIndex)) {
|
|
191
|
-
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
192
|
-
}
|
|
202
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
193
203
|
};
|
|
204
|
+
this.maybeNotify = memo(
|
|
205
|
+
() => {
|
|
206
|
+
this.calculateRange();
|
|
207
|
+
return [
|
|
208
|
+
this.isScrolling,
|
|
209
|
+
this.range ? this.range.startIndex : null,
|
|
210
|
+
this.range ? this.range.endIndex : null
|
|
211
|
+
];
|
|
212
|
+
},
|
|
213
|
+
(isScrolling) => {
|
|
214
|
+
this.notify(isScrolling);
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
key: "production" !== "production" ,
|
|
218
|
+
debug: () => this.options.debug,
|
|
219
|
+
initialDeps: [
|
|
220
|
+
this.isScrolling,
|
|
221
|
+
this.range ? this.range.startIndex : null,
|
|
222
|
+
this.range ? this.range.endIndex : null
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
);
|
|
194
226
|
this.cleanup = () => {
|
|
195
227
|
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
196
228
|
this.unsubs = [];
|
|
229
|
+
this.observer.disconnect();
|
|
197
230
|
this.scrollElement = null;
|
|
198
231
|
this.targetWindow = null;
|
|
199
|
-
this.observer.disconnect();
|
|
200
|
-
this.elementsCache.clear();
|
|
201
232
|
};
|
|
202
233
|
this._didMount = () => {
|
|
203
234
|
return () => {
|
|
@@ -210,7 +241,7 @@ class Virtualizer {
|
|
|
210
241
|
if (this.scrollElement !== scrollElement) {
|
|
211
242
|
this.cleanup();
|
|
212
243
|
if (!scrollElement) {
|
|
213
|
-
this.
|
|
244
|
+
this.maybeNotify();
|
|
214
245
|
return;
|
|
215
246
|
}
|
|
216
247
|
this.scrollElement = scrollElement;
|
|
@@ -219,6 +250,9 @@ class Virtualizer {
|
|
|
219
250
|
} else {
|
|
220
251
|
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
|
221
252
|
}
|
|
253
|
+
this.elementsCache.forEach((cached) => {
|
|
254
|
+
this.observer.observe(cached);
|
|
255
|
+
});
|
|
222
256
|
this._scrollToOffset(this.getScrollOffset(), {
|
|
223
257
|
adjustments: void 0,
|
|
224
258
|
behavior: void 0
|
|
@@ -226,7 +260,7 @@ class Virtualizer {
|
|
|
226
260
|
this.unsubs.push(
|
|
227
261
|
this.options.observeElementRect(this, (rect) => {
|
|
228
262
|
this.scrollRect = rect;
|
|
229
|
-
this.
|
|
263
|
+
this.maybeNotify();
|
|
230
264
|
})
|
|
231
265
|
);
|
|
232
266
|
this.unsubs.push(
|
|
@@ -234,9 +268,8 @@ class Virtualizer {
|
|
|
234
268
|
this.scrollAdjustments = 0;
|
|
235
269
|
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
236
270
|
this.scrollOffset = offset;
|
|
237
|
-
const prevIsScrolling = this.isScrolling;
|
|
238
271
|
this.isScrolling = isScrolling;
|
|
239
|
-
this.
|
|
272
|
+
this.maybeNotify();
|
|
240
273
|
})
|
|
241
274
|
);
|
|
242
275
|
}
|
|
@@ -309,7 +342,6 @@ class Virtualizer {
|
|
|
309
342
|
this.getMeasurements = memo(
|
|
310
343
|
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
311
344
|
({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
|
|
312
|
-
var _a;
|
|
313
345
|
if (!enabled) {
|
|
314
346
|
this.measurementsCache = [];
|
|
315
347
|
this.itemSizeCache.clear();
|
|
@@ -325,33 +357,6 @@ class Virtualizer {
|
|
|
325
357
|
this.pendingMeasuredCacheIndexes = [];
|
|
326
358
|
const measurements = this.measurementsCache.slice(0, min);
|
|
327
359
|
for (let i = min; i < count; i++) {
|
|
328
|
-
let measureElement2 = (_a = this.measurementsCache[i]) == null ? void 0 : _a.measureElement;
|
|
329
|
-
if (!measureElement2) {
|
|
330
|
-
measureElement2 = (node) => {
|
|
331
|
-
const key2 = getItemKey(i);
|
|
332
|
-
const prevNode = this.elementsCache.get(key2);
|
|
333
|
-
if (!node) {
|
|
334
|
-
if (prevNode) {
|
|
335
|
-
this.observer.unobserve(prevNode);
|
|
336
|
-
this.elementsCache.delete(key2);
|
|
337
|
-
}
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
if (prevNode !== node) {
|
|
341
|
-
if (prevNode) {
|
|
342
|
-
this.observer.unobserve(prevNode);
|
|
343
|
-
}
|
|
344
|
-
this.observer.observe(node);
|
|
345
|
-
this.elementsCache.set(key2, node);
|
|
346
|
-
}
|
|
347
|
-
if (node.isConnected) {
|
|
348
|
-
this.resizeItem(
|
|
349
|
-
i,
|
|
350
|
-
this.options.measureElement(node, void 0, this)
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
360
|
const key = getItemKey(i);
|
|
356
361
|
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
357
362
|
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
@@ -365,8 +370,7 @@ class Virtualizer {
|
|
|
365
370
|
size,
|
|
366
371
|
end,
|
|
367
372
|
key,
|
|
368
|
-
lane
|
|
369
|
-
measureElement: measureElement2
|
|
373
|
+
lane
|
|
370
374
|
};
|
|
371
375
|
}
|
|
372
376
|
this.measurementsCache = measurements;
|
|
@@ -378,12 +382,18 @@ class Virtualizer {
|
|
|
378
382
|
}
|
|
379
383
|
);
|
|
380
384
|
this.calculateRange = memo(
|
|
381
|
-
() => [
|
|
382
|
-
|
|
385
|
+
() => [
|
|
386
|
+
this.getMeasurements(),
|
|
387
|
+
this.getSize(),
|
|
388
|
+
this.getScrollOffset(),
|
|
389
|
+
this.options.lanes
|
|
390
|
+
],
|
|
391
|
+
(measurements, outerSize, scrollOffset, lanes) => {
|
|
383
392
|
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
384
393
|
measurements,
|
|
385
394
|
outerSize,
|
|
386
|
-
scrollOffset
|
|
395
|
+
scrollOffset,
|
|
396
|
+
lanes
|
|
387
397
|
}) : null;
|
|
388
398
|
},
|
|
389
399
|
{
|
|
@@ -391,17 +401,28 @@ class Virtualizer {
|
|
|
391
401
|
debug: () => this.options.debug
|
|
392
402
|
}
|
|
393
403
|
);
|
|
394
|
-
this.
|
|
395
|
-
() =>
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
this.
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
404
|
+
this.getVirtualIndexes = memo(
|
|
405
|
+
() => {
|
|
406
|
+
let startIndex = null;
|
|
407
|
+
let endIndex = null;
|
|
408
|
+
const range = this.calculateRange();
|
|
409
|
+
if (range) {
|
|
410
|
+
startIndex = range.startIndex;
|
|
411
|
+
endIndex = range.endIndex;
|
|
412
|
+
}
|
|
413
|
+
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
414
|
+
return [
|
|
415
|
+
this.options.rangeExtractor,
|
|
416
|
+
this.options.overscan,
|
|
417
|
+
this.options.count,
|
|
418
|
+
startIndex,
|
|
419
|
+
endIndex
|
|
420
|
+
];
|
|
421
|
+
},
|
|
422
|
+
(rangeExtractor, overscan, count, startIndex, endIndex) => {
|
|
423
|
+
return startIndex === null || endIndex === null ? [] : rangeExtractor({
|
|
424
|
+
startIndex,
|
|
425
|
+
endIndex,
|
|
405
426
|
overscan,
|
|
406
427
|
count
|
|
407
428
|
});
|
|
@@ -423,29 +444,26 @@ class Virtualizer {
|
|
|
423
444
|
return parseInt(indexStr, 10);
|
|
424
445
|
};
|
|
425
446
|
this._measureElement = (node, entry) => {
|
|
426
|
-
const
|
|
427
|
-
const item = this.
|
|
428
|
-
if (!item
|
|
429
|
-
this.elementsCache.forEach((cached, key) => {
|
|
430
|
-
if (cached === node) {
|
|
431
|
-
this.observer.unobserve(node);
|
|
432
|
-
this.elementsCache.delete(key);
|
|
433
|
-
}
|
|
434
|
-
});
|
|
447
|
+
const index = this.indexFromElement(node);
|
|
448
|
+
const item = this.measurementsCache[index];
|
|
449
|
+
if (!item) {
|
|
435
450
|
return;
|
|
436
451
|
}
|
|
437
|
-
const
|
|
452
|
+
const key = item.key;
|
|
453
|
+
const prevNode = this.elementsCache.get(key);
|
|
438
454
|
if (prevNode !== node) {
|
|
439
455
|
if (prevNode) {
|
|
440
456
|
this.observer.unobserve(prevNode);
|
|
441
457
|
}
|
|
442
458
|
this.observer.observe(node);
|
|
443
|
-
this.elementsCache.set(
|
|
459
|
+
this.elementsCache.set(key, node);
|
|
460
|
+
}
|
|
461
|
+
if (node.isConnected) {
|
|
462
|
+
this.resizeItem(index, this.options.measureElement(node, entry, this));
|
|
444
463
|
}
|
|
445
|
-
this.resizeItem(i, this.options.measureElement(node, entry, this));
|
|
446
464
|
};
|
|
447
465
|
this.resizeItem = (index, size) => {
|
|
448
|
-
const item = this.
|
|
466
|
+
const item = this.measurementsCache[index];
|
|
449
467
|
if (!item) {
|
|
450
468
|
return;
|
|
451
469
|
}
|
|
@@ -460,17 +478,23 @@ class Virtualizer {
|
|
|
460
478
|
}
|
|
461
479
|
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
462
480
|
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
463
|
-
this.notify(
|
|
481
|
+
this.notify(false);
|
|
464
482
|
}
|
|
465
483
|
};
|
|
466
484
|
this.measureElement = (node) => {
|
|
467
485
|
if (!node) {
|
|
486
|
+
this.elementsCache.forEach((cached, key) => {
|
|
487
|
+
if (!cached.isConnected) {
|
|
488
|
+
this.observer.unobserve(cached);
|
|
489
|
+
this.elementsCache.delete(key);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
468
492
|
return;
|
|
469
493
|
}
|
|
470
494
|
this._measureElement(node, void 0);
|
|
471
495
|
};
|
|
472
496
|
this.getVirtualItems = memo(
|
|
473
|
-
() => [this.
|
|
497
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
474
498
|
(indexes, measurements) => {
|
|
475
499
|
const virtualItems = [];
|
|
476
500
|
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
@@ -499,33 +523,23 @@ class Virtualizer {
|
|
|
499
523
|
)]
|
|
500
524
|
);
|
|
501
525
|
};
|
|
502
|
-
this.getOffsetForAlignment = (toOffset, align) => {
|
|
526
|
+
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
503
527
|
const size = this.getSize();
|
|
504
528
|
const scrollOffset = this.getScrollOffset();
|
|
505
529
|
if (align === "auto") {
|
|
506
|
-
|
|
507
|
-
align = "start";
|
|
508
|
-
} else if (toOffset >= scrollOffset + size) {
|
|
509
|
-
align = "end";
|
|
510
|
-
} else {
|
|
511
|
-
align = "start";
|
|
512
|
-
}
|
|
530
|
+
align = toOffset >= scrollOffset + size ? "end" : "start";
|
|
513
531
|
}
|
|
514
|
-
if (align === "
|
|
515
|
-
toOffset
|
|
532
|
+
if (align === "center") {
|
|
533
|
+
toOffset += (itemSize - size) / 2;
|
|
516
534
|
} else if (align === "end") {
|
|
517
|
-
toOffset
|
|
518
|
-
} else if (align === "center") {
|
|
519
|
-
toOffset = toOffset - size / 2;
|
|
535
|
+
toOffset -= size;
|
|
520
536
|
}
|
|
521
|
-
const
|
|
522
|
-
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
|
|
523
|
-
const maxOffset = scrollSize - size;
|
|
537
|
+
const maxOffset = this.getTotalSize() + this.options.scrollMargin - size;
|
|
524
538
|
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
525
539
|
};
|
|
526
540
|
this.getOffsetForIndex = (index, align = "auto") => {
|
|
527
541
|
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
528
|
-
const item = this.
|
|
542
|
+
const item = this.measurementsCache[index];
|
|
529
543
|
if (!item) {
|
|
530
544
|
return void 0;
|
|
531
545
|
}
|
|
@@ -541,17 +555,13 @@ class Virtualizer {
|
|
|
541
555
|
}
|
|
542
556
|
}
|
|
543
557
|
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
544
|
-
return [
|
|
558
|
+
return [
|
|
559
|
+
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
560
|
+
align
|
|
561
|
+
];
|
|
545
562
|
};
|
|
546
563
|
this.isDynamicMode = () => this.elementsCache.size > 0;
|
|
547
|
-
this.cancelScrollToIndex = () => {
|
|
548
|
-
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
|
|
549
|
-
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
|
|
550
|
-
this.scrollToIndexTimeoutId = null;
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
564
|
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
|
|
554
|
-
this.cancelScrollToIndex();
|
|
555
565
|
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
556
566
|
console.warn(
|
|
557
567
|
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
@@ -563,38 +573,49 @@ class Virtualizer {
|
|
|
563
573
|
});
|
|
564
574
|
};
|
|
565
575
|
this.scrollToIndex = (index, { align: initialAlign = "auto", behavior } = {}) => {
|
|
566
|
-
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
567
|
-
this.cancelScrollToIndex();
|
|
568
576
|
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
569
577
|
console.warn(
|
|
570
578
|
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
571
579
|
);
|
|
572
580
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
581
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
582
|
+
let attempts = 0;
|
|
583
|
+
const maxAttempts = 10;
|
|
584
|
+
const tryScroll = (currentAlign) => {
|
|
585
|
+
if (!this.targetWindow) return;
|
|
586
|
+
const offsetInfo = this.getOffsetForIndex(index, currentAlign);
|
|
587
|
+
if (!offsetInfo) {
|
|
588
|
+
console.warn("Failed to get offset for index:", index);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const [offset, align] = offsetInfo;
|
|
592
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
593
|
+
this.targetWindow.requestAnimationFrame(() => {
|
|
594
|
+
const currentOffset = this.getScrollOffset();
|
|
595
|
+
const afterInfo = this.getOffsetForIndex(index, align);
|
|
596
|
+
if (!afterInfo) {
|
|
597
|
+
console.warn("Failed to get offset for index:", index);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (!approxEqual(afterInfo[0], currentOffset)) {
|
|
601
|
+
scheduleRetry(align);
|
|
592
602
|
}
|
|
593
603
|
});
|
|
594
|
-
}
|
|
604
|
+
};
|
|
605
|
+
const scheduleRetry = (align) => {
|
|
606
|
+
if (!this.targetWindow) return;
|
|
607
|
+
attempts++;
|
|
608
|
+
if (attempts < maxAttempts) {
|
|
609
|
+
this.targetWindow.requestAnimationFrame(() => tryScroll(align));
|
|
610
|
+
} else {
|
|
611
|
+
console.warn(
|
|
612
|
+
`Failed to scroll to index ${index} after ${maxAttempts} attempts.`
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
tryScroll(initialAlign);
|
|
595
617
|
};
|
|
596
618
|
this.scrollBy = (delta, { behavior } = {}) => {
|
|
597
|
-
this.cancelScrollToIndex();
|
|
598
619
|
if (behavior === "smooth" && this.isDynamicMode()) {
|
|
599
620
|
console.warn(
|
|
600
621
|
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
@@ -611,12 +632,24 @@ class Virtualizer {
|
|
|
611
632
|
let end;
|
|
612
633
|
if (measurements.length === 0) {
|
|
613
634
|
end = this.options.paddingStart;
|
|
635
|
+
} else if (this.options.lanes === 1) {
|
|
636
|
+
end = ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0;
|
|
614
637
|
} else {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
)
|
|
638
|
+
const endByLane = Array(this.options.lanes).fill(null);
|
|
639
|
+
let endIndex = measurements.length - 1;
|
|
640
|
+
while (endIndex >= 0 && endByLane.some((val) => val === null)) {
|
|
641
|
+
const item = measurements[endIndex];
|
|
642
|
+
if (endByLane[item.lane] === null) {
|
|
643
|
+
endByLane[item.lane] = item.end;
|
|
644
|
+
}
|
|
645
|
+
endIndex--;
|
|
646
|
+
}
|
|
647
|
+
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
618
648
|
}
|
|
619
|
-
return
|
|
649
|
+
return Math.max(
|
|
650
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
651
|
+
0
|
|
652
|
+
);
|
|
620
653
|
};
|
|
621
654
|
this._scrollToOffset = (offset, {
|
|
622
655
|
adjustments,
|
|
@@ -625,9 +658,8 @@ class Virtualizer {
|
|
|
625
658
|
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
626
659
|
};
|
|
627
660
|
this.measure = () => {
|
|
628
|
-
var _a, _b;
|
|
629
661
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
630
|
-
|
|
662
|
+
this.notify(false);
|
|
631
663
|
};
|
|
632
664
|
this.setOptions(opts);
|
|
633
665
|
}
|
|
@@ -653,14 +685,43 @@ const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
|
653
685
|
function calculateRange({
|
|
654
686
|
measurements,
|
|
655
687
|
outerSize,
|
|
656
|
-
scrollOffset
|
|
688
|
+
scrollOffset,
|
|
689
|
+
lanes
|
|
657
690
|
}) {
|
|
658
|
-
const
|
|
691
|
+
const lastIndex = measurements.length - 1;
|
|
659
692
|
const getOffset = (index) => measurements[index].start;
|
|
660
|
-
|
|
693
|
+
if (measurements.length <= lanes) {
|
|
694
|
+
return {
|
|
695
|
+
startIndex: 0,
|
|
696
|
+
endIndex: lastIndex
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
let startIndex = findNearestBinarySearch(
|
|
700
|
+
0,
|
|
701
|
+
lastIndex,
|
|
702
|
+
getOffset,
|
|
703
|
+
scrollOffset
|
|
704
|
+
);
|
|
661
705
|
let endIndex = startIndex;
|
|
662
|
-
|
|
663
|
-
endIndex
|
|
706
|
+
if (lanes === 1) {
|
|
707
|
+
while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
708
|
+
endIndex++;
|
|
709
|
+
}
|
|
710
|
+
} else if (lanes > 1) {
|
|
711
|
+
const endPerLane = Array(lanes).fill(0);
|
|
712
|
+
while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
|
|
713
|
+
const item = measurements[endIndex];
|
|
714
|
+
endPerLane[item.lane] = item.end;
|
|
715
|
+
endIndex++;
|
|
716
|
+
}
|
|
717
|
+
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
718
|
+
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
719
|
+
const item = measurements[startIndex];
|
|
720
|
+
startPerLane[item.lane] = item.start;
|
|
721
|
+
startIndex--;
|
|
722
|
+
}
|
|
723
|
+
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
724
|
+
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
664
725
|
}
|
|
665
726
|
return { startIndex, endIndex };
|
|
666
727
|
}
|