@midas-ds/components 10.1.0 → 10.2.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.
- package/AccordionItem-DZT76sWu.js +320 -0
- package/AccordionItem-Z_c9MpAM.cjs +1 -0
- package/BadgeContainer-D3RtqcPF.js +37 -0
- package/BadgeContainer-DeUgqGqb.cjs +1 -0
- package/Breadcrumbs-CmZXtTiS.js +250 -0
- package/Breadcrumbs-Cx09jwZZ.cjs +1 -0
- package/Button-CbFRzRrF.js +38 -0
- package/Button-DnhqHU01.cjs +1 -0
- package/Button-ZOQy9Ivu.js +78 -0
- package/Button-iSiWjocA.cjs +1 -0
- package/Button.module-CMMhIrkn.js +14 -0
- package/Button.module-DO5s9hOk.cjs +1 -0
- package/ButtonGroup-DUqW5dzM.cjs +1 -0
- package/ButtonGroup-DvVvear6.js +22 -0
- package/CHANGELOG.md +81 -0
- package/Card-C0BFW3wJ.cjs +1 -0
- package/Card-CaKKKv9k.js +131 -0
- package/CharacterCounter-CPGdboVJ.js +22 -0
- package/CharacterCounter-CrY8QRuY.cjs +1 -0
- package/Checkbox-CvFsn_FL.js +380 -0
- package/Checkbox-DSxGAJX2.cjs +1 -0
- package/CheckboxGroup-Bk9DPq4I.cjs +1 -0
- package/CheckboxGroup-Dij9zKlF.js +54 -0
- package/Collection-C5ONNBqd.js +576 -0
- package/Collection-Csx3L9gh.cjs +1 -0
- package/ColorSchemeSwitch-CbAWIJCg.js +106 -0
- package/ColorSchemeSwitch-JRrCyYVv.cjs +16 -0
- package/ComboBox-BCaqPEIH.js +1375 -0
- package/ComboBox-gveQKHU3.cjs +1 -0
- package/DateField-CAQlzuDD.js +46 -0
- package/DateField-deVVFwKA.cjs +1 -0
- package/DateInputDivider-DnUxETEC.cjs +1 -0
- package/DateInputDivider-Dx8n1Lxp.js +2908 -0
- package/DateRangePicker-BmBvwqo6.js +881 -0
- package/DateRangePicker-BzfitoK0.cjs +6 -0
- package/Dialog-Bd5hK360.cjs +1 -0
- package/Dialog-Bxx8cBEq.js +208 -0
- package/Dialog-CYxThuMl.js +1609 -0
- package/Dialog-CwTEAujZ.cjs +1 -0
- package/DragAndDrop-CSwmPhxC.js +60 -0
- package/DragAndDrop-HvycSrKY.cjs +1 -0
- package/Dropdown-CaGon9OR.cjs +6 -0
- package/Dropdown-nkjzsVYX.js +84 -0
- package/FieldError-BZw8UzBk.cjs +1 -0
- package/FieldError-CZikNDxX.js +28 -0
- package/FieldError-DqdfJ3fs.cjs +1 -0
- package/FieldError-Dv3bBEjh.js +23 -0
- package/FileUpload-DYRZ0M9F.cjs +2 -0
- package/FileUpload-ULwcYDxs.js +2372 -0
- package/FocusScope-DwIqdYpQ.js +625 -0
- package/FocusScope-NaPbvuuS.cjs +1 -0
- package/Form-BuOomA4T.cjs +1 -0
- package/Form-CXcEMuBf.js +5 -0
- package/Grid--OhtgCo6.js +27 -0
- package/Grid-DVQtOcu9.cjs +1 -0
- package/GridItem-DlbSdRmB.js +246 -0
- package/GridItem-XgHmZWXY.cjs +1 -0
- package/Group-CeSsSQVC.js +44 -0
- package/Group-CgiqQHH1.cjs +1 -0
- package/Heading-BY5-QN4S.js +46 -0
- package/Heading-DoJAtYZf.cjs +1 -0
- package/Hidden-B5ir3Lei.js +34 -0
- package/Hidden-BxRZGdEW.cjs +1 -0
- package/InfoBanner-BS-dAfzO.cjs +1 -0
- package/InfoBanner-CVIBFSWx.js +82 -0
- package/Input-D8Ku_FQz.js +41 -0
- package/Input-DKSAYvsw.cjs +1 -0
- package/Label-C9ivwkAd.js +21 -0
- package/Label-CUV21CAv.cjs +1 -0
- package/Label-DkDOsmUF.js +16 -0
- package/Label-IMWAyoKb.cjs +1 -0
- package/Layout-BWeHHnqU.cjs +16 -0
- package/Layout-CCt_2L1k.js +468 -0
- package/Link-B-nus-FT.js +71 -0
- package/Link-DsnCtNeI.cjs +6 -0
- package/Link-SHMbeyIP.cjs +1 -0
- package/Link-uFowN4qv.js +59 -0
- package/LinkButton-CuBilDML.js +69 -0
- package/LinkButton-CymMrcGL.cjs +6 -0
- package/ListBox-CDOsQChA.cjs +1 -0
- package/ListBox-DOi_y_Lt.js +530 -0
- package/ListBoxButton-CFeNhJhr.cjs +1 -0
- package/ListBoxButton-O6zN3P4W.js +15 -0
- package/ListBoxSection-C1aLKL9p.js +1058 -0
- package/ListBoxSection-DGCP6xpf.cjs +1 -0
- package/ListKeyboardDelegate-BqMETvPv.cjs +1 -0
- package/ListKeyboardDelegate-DNOzQ8nc.js +158 -0
- package/LiveAnnouncer-B6177m92.js +51 -0
- package/LiveAnnouncer-CwEWPU8b.cjs +1 -0
- package/LocalizedStringFormatter-C0C54hjf.cjs +1 -0
- package/LocalizedStringFormatter-D-4Qyql0.js +77 -0
- package/Logo-BIrOEINM.js +133 -0
- package/Logo-DT2_2O43.cjs +1 -0
- package/NumberFormatter-DewVDY5w.cjs +1 -0
- package/NumberFormatter-DgOUVrge.js +119 -0
- package/OverlayArrow-D75k-EMl.cjs +1 -0
- package/OverlayArrow-DorA4Rbr.js +506 -0
- package/PressResponder-C06O3Z5P.cjs +1 -0
- package/PressResponder-CVEg5kND.js +33 -0
- package/ProgressBar-Bkw9zavs.cjs +1 -0
- package/ProgressBar-CEX2WNoW.js +77 -0
- package/ProgressBar-Dqh3ftSP.cjs +1 -0
- package/ProgressBar-gmAzSsrz.js +53 -0
- package/RSPContexts-BW2SEIqe.js +11 -0
- package/RSPContexts-D8hmBfGm.cjs +1 -0
- package/Radio-CDKrvQe4.cjs +1 -0
- package/Radio-_ukSkxPT.js +311 -0
- package/RangeCalendar-cbCKBPZv.cjs +11 -0
- package/RangeCalendar-uXwoBL-O.js +1685 -0
- package/SearchField-6yBGiojX.cjs +6 -0
- package/SearchField-DYl2uo7o.js +362 -0
- package/Select-CpHjd1tp.cjs +1 -0
- package/Select-PvCqY7Lp.js +646 -0
- package/SelectionManager-6H88Cv6B.js +1033 -0
- package/SelectionManager-C5NGBzvz.cjs +1 -0
- package/Separator-LYnFqh4L.js +60 -0
- package/Separator-nPra6kD-.cjs +1 -0
- package/Skeleton-BAwbfKBW.cjs +1 -0
- package/Skeleton-BePDRmrO.js +40 -0
- package/Spinner-D31SXm-U.js +41 -0
- package/Spinner-DAJtfxqJ.cjs +6 -0
- package/Table-B_N7wUmA.js +2451 -0
- package/Table-D9vNc_y-.cjs +16 -0
- package/Tabs-Ct6D83aR.js +404 -0
- package/Tabs-Dtcl2oK2.cjs +1 -0
- package/Tag-CVFkzg3s.cjs +1 -0
- package/Tag-g6HN-YCv.js +748 -0
- package/Text-3MNwRMpI.cjs +1 -0
- package/Text-B2K-BJKQ.cjs +1 -0
- package/Text-BN-g1iWi.js +32 -0
- package/Text-B_H68Tvq.js +15 -0
- package/TextArea-DSiQ578a.js +206 -0
- package/TextArea-cVyGBRbL.cjs +1 -0
- package/TextField-B70CL2qz.cjs +1 -0
- package/TextField-DBaRuNj7.js +119 -0
- package/TextField.module-BcpPBWnD.js +13 -0
- package/TextField.module-Dw5Rtn9y.cjs +1 -0
- package/Toast-CjpldAI8.js +988 -0
- package/Toast-DrkOGy4d.cjs +1 -0
- package/ToggleButtonGroup-BuU_6dYe.cjs +1 -0
- package/ToggleButtonGroup-Ceh9_yBM.js +210 -0
- package/Tooltip-BAIjaYax.js +283 -0
- package/Tooltip-CiWg4zIC.cjs +1 -0
- package/VisuallyHidden-CtXvK_Tw.cjs +1 -0
- package/VisuallyHidden-D-4z1VgU.js +40 -0
- package/accordion/index.cjs +1 -0
- package/accordion/index.js +5 -0
- package/arrow-right-Cw48o2oW.cjs +6 -0
- package/arrow-right-Dg8sttFO.js +14 -0
- package/assets/AccordionItem.css +1 -0
- package/assets/BadgeContainer.css +1 -0
- package/assets/Breadcrumbs.css +1 -0
- package/assets/Button.css +1 -0
- package/assets/ButtonGroup.css +1 -0
- package/assets/Card.css +1 -0
- package/assets/CharacterCounter.css +1 -0
- package/assets/Checkbox.css +1 -0
- package/assets/ColorSchemeSwitch.css +1 -0
- package/assets/ComboBox.css +1 -0
- package/assets/DateField.css +1 -0
- package/assets/DateInputDivider.css +1 -0
- package/assets/DateRangePicker.css +1 -0
- package/assets/Dialog.css +1 -0
- package/assets/Dropdown.css +1 -0
- package/assets/FieldError.css +1 -0
- package/assets/FileUpload.css +1 -0
- package/assets/GridItem.css +1 -0
- package/assets/Heading.css +1 -0
- package/assets/InfoBanner.css +1 -0
- package/assets/Label.css +1 -0
- package/assets/Layout.css +1 -0
- package/assets/Link.css +1 -0
- package/assets/LinkButton.css +1 -0
- package/assets/ListBoxSection.css +1 -0
- package/assets/Logo.css +1 -0
- package/assets/ProgressBar.css +1 -0
- package/assets/Radio.css +1 -0
- package/assets/RangeCalendar.css +1 -0
- package/assets/SearchField.css +1 -0
- package/assets/Select.css +1 -0
- package/assets/Skeleton.css +1 -0
- package/assets/Spinner.css +1 -0
- package/assets/Table.css +1 -0
- package/assets/Tabs.css +1 -0
- package/assets/Tag.css +1 -0
- package/assets/Text.css +1 -0
- package/assets/TextField.css +1 -0
- package/assets/Toast.css +1 -0
- package/assets/ToggleButtonGroup.css +1 -0
- package/assets/Tooltip.css +1 -0
- package/badge/index.cjs +1 -0
- package/badge/index.js +5 -0
- package/breadcrumbs/index.cjs +1 -0
- package/breadcrumbs/index.js +4 -0
- package/button/index.cjs +1 -0
- package/button/index.js +6 -0
- package/calendar/CalendarHeader.d.ts +2 -1
- package/calendar/index.cjs +1 -0
- package/calendar/index.js +5 -0
- package/card/Card.d.ts +3 -0
- package/card/index.cjs +1 -0
- package/card/index.js +10 -0
- package/character-counter/index.cjs +1 -0
- package/character-counter/index.js +4 -0
- package/check-CLF6Yxza.js +11 -0
- package/check-Dw9c62O4.cjs +6 -0
- package/checkbox/index.cjs +1 -0
- package/checkbox/index.js +6 -0
- package/chevron-down-C2E7aZ3N.cjs +6 -0
- package/chevron-down-Cd1bkzXT.js +13 -0
- package/clsx-C11secjj.cjs +1 -0
- package/clsx-OuTLNxxd.js +16 -0
- package/color-scheme-switch/index.cjs +1 -0
- package/color-scheme-switch/index.js +4 -0
- package/combobox/ComboBox.d.ts +9 -5
- package/combobox/index.cjs +1 -0
- package/combobox/index.d.ts +1 -1
- package/combobox/index.js +7 -0
- package/combobox/types.d.ts +6 -0
- package/combobox/utils.d.ts +3 -10
- package/common/types.d.ts +2 -0
- package/context-B8cn10po.js +80 -0
- package/context-DjwhtgxQ.cjs +1 -0
- package/createLucideIcon-DAY4oS-S.cjs +21 -0
- package/createLucideIcon-DeWljiyi.js +79 -0
- package/date-field/index.cjs +1 -0
- package/date-field/index.js +8 -0
- package/date-picker/index.cjs +1 -0
- package/date-picker/index.js +5 -0
- package/dropdown/index.cjs +1 -0
- package/dropdown/index.js +5 -0
- package/field-error/FieldError.d.ts +4 -1
- package/field-error/index.cjs +1 -0
- package/field-error/index.js +4 -0
- package/file-upload/index.cjs +1 -0
- package/file-upload/index.js +4 -0
- package/filterDOMProps-BS2lrgFA.cjs +1 -0
- package/filterDOMProps-D6KHYVBX.js +24 -0
- package/focusSafely-Bqfo_DH7.cjs +1 -0
- package/focusSafely-C48ucRUz.js +56 -0
- package/getScrollParent-DuKmPmUa.cjs +1 -0
- package/getScrollParent-Ru2U2LlM.js +9 -0
- package/grid/Grid.d.ts +15 -4
- package/grid/GridItem.d.ts +31 -2
- package/grid/index.cjs +1 -0
- package/grid/index.d.ts +2 -2
- package/grid/index.js +8 -0
- package/heading/index.cjs +1 -0
- package/heading/index.js +4 -0
- package/index-BSMrH_Du.js +120 -0
- package/index-D97L3EBk.cjs +17 -0
- package/index.cjs +1 -164
- package/index.d.ts +1 -1
- package/index.js +127 -30044
- package/inertValue-B7loUihk.js +8 -0
- package/inertValue-BWmZ1afe.cjs +1 -0
- package/info-DkzVqB8I.js +38 -0
- package/info-DlzSeKbc.cjs +16 -0
- package/info-banner/index.cjs +1 -0
- package/info-banner/index.js +4 -0
- package/label/index.cjs +1 -0
- package/label/index.js +4 -0
- package/layout/index.cjs +1 -0
- package/layout/index.js +8 -0
- package/link/Link.d.ts +4 -1
- package/link/index.cjs +1 -0
- package/link/index.js +6 -0
- package/link-button/LinkButton.d.ts +24 -1
- package/link-button/index.cjs +1 -0
- package/link-button/index.js +6 -0
- package/list-box/ListBox.d.ts +4 -0
- package/list-box/ListBoxButton.d.ts +2 -0
- package/list-box/ListBoxItem.d.ts +3 -0
- package/list-box/ListBoxPopover.d.ts +3 -0
- package/list-box/ListBoxSection.d.ts +8 -0
- package/list-box/index.cjs +1 -0
- package/list-box/index.d.ts +6 -0
- package/list-box/index.js +9 -0
- package/list-box/types.d.ts +23 -0
- package/logo/index.cjs +1 -0
- package/logo/index.js +4 -0
- package/modal/index.cjs +1 -0
- package/modal/index.js +6 -0
- package/number-BE8InLgI.js +6 -0
- package/number-E0x3H9cL.cjs +1 -0
- package/package.json +4 -4
- package/progress-bar/index.cjs +1 -0
- package/progress-bar/index.js +4 -0
- package/radio/index.cjs +1 -0
- package/radio/index.js +5 -0
- package/scrollIntoView-ClEACHUk.js +57 -0
- package/scrollIntoView-DRSoJp89.cjs +1 -0
- package/search-field/index.cjs +1 -0
- package/search-field/index.js +4 -0
- package/select/HiddenMultiSelect.d.ts +5 -4
- package/select/MultiSelectValueTag.d.ts +11 -0
- package/select/Select.d.ts +2 -77
- package/select/SelectFieldError.d.ts +8 -0
- package/select/SelectListBox.d.ts +4 -3
- package/select/SelectTrigger.d.ts +10 -0
- package/select/index.cjs +1 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +4 -0
- package/select/types.d.ts +188 -0
- package/select/useMultiSelect.d.ts +4 -21
- package/select/useMultiSelectListState.d.ts +3 -15
- package/select/useMultiSelectState.d.ts +3 -19
- package/skeleton/Skeleton.d.ts +5 -0
- package/skeleton/index.cjs +1 -0
- package/skeleton/index.js +4 -0
- package/spinner/index.cjs +1 -0
- package/spinner/index.js +4 -0
- package/square-arrow-out-up-right-BCAO2eJs.cjs +6 -0
- package/square-arrow-out-up-right-BkyqV2PN.js +15 -0
- package/table/Table.d.ts +7 -1
- package/table/index.cjs +1 -0
- package/table/index.js +9 -0
- package/tabs/index.cjs +1 -0
- package/tabs/index.js +4 -0
- package/tag/index.cjs +1 -0
- package/tag/index.js +5 -0
- package/text/index.cjs +1 -0
- package/text/index.js +4 -0
- package/textfield/index.cjs +1 -0
- package/textfield/index.js +7 -0
- package/theme/index.cjs +1 -0
- package/theme/index.d.ts +4 -0
- package/{theme.js → theme/index.js} +2 -2
- package/theme/tokens.d.ts +10 -0
- package/toast/index.cjs +1 -0
- package/toast/index.js +9 -0
- package/toggle-button/index.cjs +1 -0
- package/toggle-button/index.js +5 -0
- package/tokens-p6pg1Cea.cjs +1 -0
- package/{tokens-C0U7hdoO.js → tokens-xp-7KMK7.js} +18 -8
- package/tooltip/index.cjs +1 -0
- package/tooltip/index.js +5 -0
- package/triangle-alert-C0lvfCYH.cjs +6 -0
- package/triangle-alert-wxyxspAl.js +21 -0
- package/useButton-B1Fa-6qE.cjs +1 -0
- package/useButton-C-Lq7CNY.js +47 -0
- package/useCollator-C_ozeWLo.cjs +1 -0
- package/useCollator-CgZcHC8N.js +11 -0
- package/useControlledState-D0L6S_5r.cjs +1 -0
- package/useControlledState-u436Wbp1.js +30 -0
- package/useDateFormatter-C53Uxdli.js +1571 -0
- package/useDateFormatter-g2maMTGH.cjs +1 -0
- package/useDescription-CVKhFa3c.js +32 -0
- package/useDescription-DmQYSEES.cjs +1 -0
- package/useEvent-CjkbBniY.cjs +1 -0
- package/useEvent-Cyd2ZL0c.js +21 -0
- package/useField-B1RU0GKs.cjs +1 -0
- package/useField-BPMAlIbU.js +35 -0
- package/useFilter-ChIbnALW.js +35 -0
- package/useFilter-CtIwF2qW.cjs +1 -0
- package/useFocusRing-BDGH3lpn.js +82 -0
- package/useFocusRing-CbImDrwF.cjs +1 -0
- package/useFocusable-CaedRTpB.js +74 -0
- package/useFocusable-CuPQ7Cm5.cjs +1 -0
- package/useFormValidation-ClximP89.cjs +1 -0
- package/useFormValidation-R8hQIjWP.js +215 -0
- package/useHasTabbableChild-DgphNvnk.cjs +1 -0
- package/useHasTabbableChild-DsD9AJwE.js +34 -0
- package/useHighlightSelectionDescription-BizKjvPU.cjs +1 -0
- package/useHighlightSelectionDescription-DFfcgbUj.js +567 -0
- package/useHover-_mv5J4_q.cjs +1 -0
- package/useHover-qRAon4nS.js +490 -0
- package/useLabel-DDdAJ1JO.js +23 -0
- package/useLabel-m_S5xkHy.cjs +1 -0
- package/useLabels-BLOfc6Y-.cjs +1 -0
- package/useLabels-BZjoZA1Z.js +17 -0
- package/useListState-Ca2-uZMO.cjs +1 -0
- package/useListState-DFQ9d-uE.js +132 -0
- package/useLocalizedStringFormatter-D07YB2e1.js +22 -0
- package/useLocalizedStringFormatter-u9SJaOwk.cjs +1 -0
- package/useObserveElement-BdI4zgd7.js +27 -0
- package/useObserveElement-BzEr5D32.cjs +1 -0
- package/usePress-BFa6cT9o.cjs +7 -0
- package/usePress-CUJ3pMOw.js +542 -0
- package/useSingleSelectListState-C-nB8cug.js +34 -0
- package/useSingleSelectListState-MGNxUTum.cjs +1 -0
- package/useTextField-5OZQPyOW.js +86 -0
- package/useTextField-CtUDWsUl.cjs +1 -0
- package/useToggleState-Bz5rAf4C.js +18 -0
- package/useToggleState-DoIkSQdj.cjs +1 -0
- package/useUpdateEffect-CCDx8D4X.js +13 -0
- package/useUpdateEffect-sk3kiVGz.cjs +1 -0
- package/utils/test.d.ts +1 -1
- package/utils-BNtZbAib.cjs +1 -0
- package/utils-HNTsIwux.js +308 -0
- package/x-CvxiAZTW.cjs +6 -0
- package/x-JK7i-TQC.js +14 -0
- package/flex/Flex.d.ts +0 -17
- package/flex/FlexItem.d.ts +0 -15
- package/flex/index.d.ts +0 -2
- package/index.css +0 -1
- package/select/SelectPopover.d.ts +0 -10
- package/theme.cjs +0 -1
- package/tokens-COoF1t17.cjs +0 -1
- /package/{global.css → assets/global.css} +0 -0
- /package/{select → list-box}/SectionedListLayout.d.ts +0 -0
|
@@ -0,0 +1,1058 @@
|
|
|
1
|
+
import { jsx as _, jsxs as le } from "react/jsx-runtime";
|
|
2
|
+
import { $ as oe, a as ne, b as se } from "./ListBox-DOi_y_Lt.js";
|
|
3
|
+
import { d as re, h as ae } from "./Collection-C5ONNBqd.js";
|
|
4
|
+
import w, { useState as S, useRef as C, useMemo as k, useCallback as L, useEffect as he, createContext as X, useContext as A } from "react";
|
|
5
|
+
import { $ as E, g as de } from "./utils-HNTsIwux.js";
|
|
6
|
+
import { $ as F } from "./context-B8cn10po.js";
|
|
7
|
+
import { flushSync as P } from "react-dom";
|
|
8
|
+
import { g as ce } from "./OverlayArrow-DorA4Rbr.js";
|
|
9
|
+
import { $ as ue } from "./useEvent-Cyd2ZL0c.js";
|
|
10
|
+
import { c as K } from "./clsx-OuTLNxxd.js";
|
|
11
|
+
import { f as Y } from "./SelectionManager-6H88Cv6B.js";
|
|
12
|
+
import { b as fe } from "./Dialog-CYxThuMl.js";
|
|
13
|
+
import { e as ge } from "./Separator-LYnFqh4L.js";
|
|
14
|
+
import './assets/ListBoxSection.css';class ye {
|
|
15
|
+
/**
|
|
16
|
+
* Returns whether the layout should invalidate in response to
|
|
17
|
+
* visible rectangle changes. By default, it only invalidates
|
|
18
|
+
* when the virtualizer's size changes. Return true always
|
|
19
|
+
* to make the layout invalidate while scrolling (e.g. sticky headers).
|
|
20
|
+
*/
|
|
21
|
+
shouldInvalidate(e, t) {
|
|
22
|
+
return e.width !== t.width || e.height !== t.height;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns whether the layout should invalidate when the layout options change.
|
|
26
|
+
* By default it invalidates when the object identity changes. Override this
|
|
27
|
+
* method to optimize layout updates based on specific option changes.
|
|
28
|
+
*/
|
|
29
|
+
shouldInvalidateLayoutOptions(e, t) {
|
|
30
|
+
return e !== t;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* This method allows the layout to perform any pre-computation
|
|
34
|
+
* it needs to in order to prepare LayoutInfos for retrieval.
|
|
35
|
+
* Called by the virtualizer before `getVisibleLayoutInfos`
|
|
36
|
+
* or `getLayoutInfo` are called.
|
|
37
|
+
*/
|
|
38
|
+
update(e) {
|
|
39
|
+
}
|
|
40
|
+
/** @private */
|
|
41
|
+
getItemRect(e) {
|
|
42
|
+
var t, i;
|
|
43
|
+
return (i = (t = this.getLayoutInfo(e)) === null || t === void 0 ? void 0 : t.rect) !== null && i !== void 0 ? i : null;
|
|
44
|
+
}
|
|
45
|
+
/** @private */
|
|
46
|
+
getVisibleRect() {
|
|
47
|
+
return this.virtualizer.visibleRect;
|
|
48
|
+
}
|
|
49
|
+
constructor() {
|
|
50
|
+
this.virtualizer = null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
class b {
|
|
54
|
+
/**
|
|
55
|
+
* Returns a copy of the LayoutInfo.
|
|
56
|
+
*/
|
|
57
|
+
copy() {
|
|
58
|
+
let e = new b(this.type, this.key, this.rect.copy());
|
|
59
|
+
return e.estimatedSize = this.estimatedSize, e.opacity = this.opacity, e.transform = this.transform, e.parentKey = this.parentKey, e.content = this.content, e.isSticky = this.isSticky, e.zIndex = this.zIndex, e.allowOverflow = this.allowOverflow, e;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @param type The type of element represented by this LayoutInfo. Should match the `type` of the corresponding collection node.
|
|
63
|
+
* @param key A unique key for this LayoutInfo. Should match the `key` of the corresponding collection node.
|
|
64
|
+
* @param rect The rectangle describing the size and position of this element.
|
|
65
|
+
*/
|
|
66
|
+
constructor(e, t, i) {
|
|
67
|
+
this.type = e, this.key = t, this.parentKey = null, this.content = null, this.rect = i, this.estimatedSize = !1, this.isSticky = !1, this.opacity = 1, this.transform = null, this.zIndex = 0, this.allowOverflow = !1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class x {
|
|
71
|
+
/**
|
|
72
|
+
* Returns a copy of this point.
|
|
73
|
+
*/
|
|
74
|
+
copy() {
|
|
75
|
+
return new x(this.x, this.y);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Checks if two points are equal.
|
|
79
|
+
*/
|
|
80
|
+
equals(e) {
|
|
81
|
+
return this.x === e.x && this.y === e.y;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns true if this point is the origin.
|
|
85
|
+
*/
|
|
86
|
+
isOrigin() {
|
|
87
|
+
return this.x === 0 && this.y === 0;
|
|
88
|
+
}
|
|
89
|
+
constructor(e = 0, t = 0) {
|
|
90
|
+
this.x = e, this.y = t;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
class u {
|
|
94
|
+
/**
|
|
95
|
+
* The maximum x-coordinate in the rectangle.
|
|
96
|
+
*/
|
|
97
|
+
get maxX() {
|
|
98
|
+
return this.x + this.width;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The maximum y-coordinate in the rectangle.
|
|
102
|
+
*/
|
|
103
|
+
get maxY() {
|
|
104
|
+
return this.y + this.height;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The area of the rectangle.
|
|
108
|
+
*/
|
|
109
|
+
get area() {
|
|
110
|
+
return this.width * this.height;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The top left corner of the rectangle.
|
|
114
|
+
*/
|
|
115
|
+
get topLeft() {
|
|
116
|
+
return new x(this.x, this.y);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The top right corner of the rectangle.
|
|
120
|
+
*/
|
|
121
|
+
get topRight() {
|
|
122
|
+
return new x(this.maxX, this.y);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The bottom left corner of the rectangle.
|
|
126
|
+
*/
|
|
127
|
+
get bottomLeft() {
|
|
128
|
+
return new x(this.x, this.maxY);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The bottom right corner of the rectangle.
|
|
132
|
+
*/
|
|
133
|
+
get bottomRight() {
|
|
134
|
+
return new x(this.maxX, this.maxY);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns whether this rectangle intersects another rectangle.
|
|
138
|
+
* @param rect - The rectangle to check.
|
|
139
|
+
*/
|
|
140
|
+
intersects(e) {
|
|
141
|
+
return this.area > 0 && e.area > 0 && this.x <= e.x + e.width && e.x <= this.x + this.width && this.y <= e.y + e.height && e.y <= this.y + this.height;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Returns whether this rectangle fully contains another rectangle.
|
|
145
|
+
* @param rect - The rectangle to check.
|
|
146
|
+
*/
|
|
147
|
+
containsRect(e) {
|
|
148
|
+
return this.x <= e.x && this.y <= e.y && this.maxX >= e.maxX && this.maxY >= e.maxY;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns whether the rectangle contains the given point.
|
|
152
|
+
* @param point - The point to check.
|
|
153
|
+
*/
|
|
154
|
+
containsPoint(e) {
|
|
155
|
+
return this.x <= e.x && this.y <= e.y && this.maxX >= e.x && this.maxY >= e.y;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Returns the first corner of this rectangle (from top to bottom, left to right)
|
|
159
|
+
* that is contained in the given rectangle, or null of the rectangles do not intersect.
|
|
160
|
+
* @param rect - The rectangle to check.
|
|
161
|
+
*/
|
|
162
|
+
getCornerInRect(e) {
|
|
163
|
+
for (let t of [
|
|
164
|
+
"topLeft",
|
|
165
|
+
"topRight",
|
|
166
|
+
"bottomLeft",
|
|
167
|
+
"bottomRight"
|
|
168
|
+
])
|
|
169
|
+
if (e.containsPoint(this[t])) return t;
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
equals(e) {
|
|
173
|
+
return e.x === this.x && e.y === this.y && e.width === this.width && e.height === this.height;
|
|
174
|
+
}
|
|
175
|
+
pointEquals(e) {
|
|
176
|
+
return this.x === e.x && this.y === e.y;
|
|
177
|
+
}
|
|
178
|
+
sizeEquals(e) {
|
|
179
|
+
return this.width === e.width && this.height === e.height;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Returns the union of this Rect and another.
|
|
183
|
+
*/
|
|
184
|
+
union(e) {
|
|
185
|
+
let t = Math.min(this.x, e.x), i = Math.min(this.y, e.y), l = Math.max(this.maxX, e.maxX) - t, o = Math.max(this.maxY, e.maxY) - i;
|
|
186
|
+
return new u(t, i, l, o);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Returns the intersection of this Rect with another.
|
|
190
|
+
* If the rectangles do not intersect, an all zero Rect is returned.
|
|
191
|
+
*/
|
|
192
|
+
intersection(e) {
|
|
193
|
+
if (!this.intersects(e)) return new u(0, 0, 0, 0);
|
|
194
|
+
let t = Math.max(this.x, e.x), i = Math.max(this.y, e.y);
|
|
195
|
+
return new u(t, i, Math.min(this.maxX, e.maxX) - t, Math.min(this.maxY, e.maxY) - i);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Returns a copy of this rectangle.
|
|
199
|
+
*/
|
|
200
|
+
copy() {
|
|
201
|
+
return new u(this.x, this.y, this.width, this.height);
|
|
202
|
+
}
|
|
203
|
+
constructor(e = 0, t = 0, i = 0, l = 0) {
|
|
204
|
+
this.x = e, this.y = t, this.width = i, this.height = l;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
class z {
|
|
208
|
+
/**
|
|
209
|
+
* Returns a copy of this size.
|
|
210
|
+
*/
|
|
211
|
+
copy() {
|
|
212
|
+
return new z(this.width, this.height);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Returns whether this size is equal to another one.
|
|
216
|
+
*/
|
|
217
|
+
equals(e) {
|
|
218
|
+
return this.width === e.width && this.height === e.height;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The total area of the Size.
|
|
222
|
+
*/
|
|
223
|
+
get area() {
|
|
224
|
+
return this.width * this.height;
|
|
225
|
+
}
|
|
226
|
+
constructor(e = 0, t = 0) {
|
|
227
|
+
this.width = Math.max(e, 0), this.height = Math.max(t, 0);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
let ve = 0;
|
|
231
|
+
class j {
|
|
232
|
+
/**
|
|
233
|
+
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
234
|
+
*/
|
|
235
|
+
prepareForReuse() {
|
|
236
|
+
this.content = null, this.rendered = null, this.layoutInfo = null;
|
|
237
|
+
}
|
|
238
|
+
getReusableView(e) {
|
|
239
|
+
let t = this.reusableViews.get(e);
|
|
240
|
+
return t && t.length > 0 ? t.shift() : new me(this.virtualizer, this, e);
|
|
241
|
+
}
|
|
242
|
+
reuseChild(e) {
|
|
243
|
+
e.prepareForReuse();
|
|
244
|
+
let t = this.reusableViews.get(e.viewType);
|
|
245
|
+
t || (t = [], this.reusableViews.set(e.viewType, t)), t.push(e);
|
|
246
|
+
}
|
|
247
|
+
constructor(e, t) {
|
|
248
|
+
this.virtualizer = e, this.key = ++ve, this.viewType = t, this.children = /* @__PURE__ */ new Set(), this.reusableViews = /* @__PURE__ */ new Map(), this.layoutInfo = null, this.content = null, this.rendered = null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
class pe extends j {
|
|
252
|
+
constructor(e) {
|
|
253
|
+
super(e, "root");
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
class me extends j {
|
|
257
|
+
constructor(e, t, i) {
|
|
258
|
+
super(e, i), this.parent = t;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function we(n, e) {
|
|
262
|
+
if (n === e) return !0;
|
|
263
|
+
if (n.size !== e.size) return !1;
|
|
264
|
+
for (let t of n)
|
|
265
|
+
if (!e.has(t)) return !1;
|
|
266
|
+
return !0;
|
|
267
|
+
}
|
|
268
|
+
class be {
|
|
269
|
+
setVisibleRect(e) {
|
|
270
|
+
let t = performance.now() - this.startTime;
|
|
271
|
+
t < 500 && (e.x !== this.visibleRect.x && t > 0 && (this.velocity.x = (e.x - this.visibleRect.x) / t), e.y !== this.visibleRect.y && t > 0 && (this.velocity.y = (e.y - this.visibleRect.y) / t)), this.startTime = performance.now(), this.visibleRect = e;
|
|
272
|
+
}
|
|
273
|
+
getOverscannedRect() {
|
|
274
|
+
let e = this.visibleRect.copy(), t = this.visibleRect.height / 3;
|
|
275
|
+
if (e.height += t, this.velocity.y < 0 && (e.y -= t), this.velocity.x !== 0) {
|
|
276
|
+
let i = this.visibleRect.width / 3;
|
|
277
|
+
e.width += i, this.velocity.x < 0 && (e.x -= i);
|
|
278
|
+
}
|
|
279
|
+
return e;
|
|
280
|
+
}
|
|
281
|
+
constructor() {
|
|
282
|
+
this.startTime = 0, this.velocity = new x(0, 0), this.visibleRect = new u();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
class xe {
|
|
286
|
+
/** Returns whether the given key, or an ancestor, is persisted. */
|
|
287
|
+
isPersistedKey(e) {
|
|
288
|
+
if (this.persistedKeys.has(e)) return !0;
|
|
289
|
+
for (let t of this.persistedKeys) for (; t != null; ) {
|
|
290
|
+
let i = this.layout.getLayoutInfo(t);
|
|
291
|
+
if (!i || i.parentKey == null) break;
|
|
292
|
+
if (t = i.parentKey, t === e) return !0;
|
|
293
|
+
}
|
|
294
|
+
return !1;
|
|
295
|
+
}
|
|
296
|
+
getParentView(e) {
|
|
297
|
+
return e.parentKey != null ? this._visibleViews.get(e.parentKey) : this._rootView;
|
|
298
|
+
}
|
|
299
|
+
getReusableView(e) {
|
|
300
|
+
let i = this.getParentView(e).getReusableView(e.type);
|
|
301
|
+
return i.layoutInfo = e, this._renderView(i), i;
|
|
302
|
+
}
|
|
303
|
+
_renderView(e) {
|
|
304
|
+
if (e.layoutInfo) {
|
|
305
|
+
let { type: t, key: i, content: l } = e.layoutInfo;
|
|
306
|
+
e.content = l || this.collection.getItem(i), e.rendered = this._renderContent(t, e.content);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
_renderContent(e, t) {
|
|
310
|
+
let i = t != null ? this._renderedContent.get(t) : null;
|
|
311
|
+
if (i != null) return i;
|
|
312
|
+
let l = this.delegate.renderView(e, t);
|
|
313
|
+
return t && this._renderedContent.set(t, l), l;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Returns the key for the item view currently at the given point.
|
|
317
|
+
*/
|
|
318
|
+
keyAtPoint(e) {
|
|
319
|
+
let t = new u(e.x, e.y, 1, 1), i = t.area === 0 ? [] : this.layout.getVisibleLayoutInfos(t);
|
|
320
|
+
for (let l of i)
|
|
321
|
+
if (l.rect.intersects(t)) return l.key;
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
relayout(e = {}) {
|
|
325
|
+
this.layout.update(e), this.contentSize = this.layout.getContentSize();
|
|
326
|
+
let t = this.visibleRect, i = e.contentChanged ? 0 : t.x, l = e.contentChanged ? 0 : t.y;
|
|
327
|
+
if (i = Math.max(0, Math.min(this.contentSize.width - t.width, i)), l = Math.max(0, Math.min(this.contentSize.height - t.height, l)), i !== t.x || l !== t.y) {
|
|
328
|
+
let o = new u(i, l, t.width, t.height);
|
|
329
|
+
this.delegate.setVisibleRect(o);
|
|
330
|
+
} else this.updateSubviews();
|
|
331
|
+
}
|
|
332
|
+
getVisibleLayoutInfos() {
|
|
333
|
+
let e = process.env.NODE_ENV === "test" && !process.env.VIRT_ON, t = e && typeof HTMLElement < "u" && Object.getOwnPropertyNames(HTMLElement.prototype).includes("clientWidth"), i = e && typeof HTMLElement < "u" && Object.getOwnPropertyNames(HTMLElement.prototype).includes("clientHeight"), l;
|
|
334
|
+
e && !(t && i) ? l = new u(0, 0, this.contentSize.width, this.contentSize.height) : l = this._overscanManager.getOverscannedRect();
|
|
335
|
+
let o = this.layout.getVisibleLayoutInfos(l), s = /* @__PURE__ */ new Map();
|
|
336
|
+
for (let a of o) s.set(a.key, a);
|
|
337
|
+
return s;
|
|
338
|
+
}
|
|
339
|
+
updateSubviews() {
|
|
340
|
+
let e = this.getVisibleLayoutInfos(), t = /* @__PURE__ */ new Set();
|
|
341
|
+
for (let [i, l] of this._visibleViews) {
|
|
342
|
+
let o = e.get(i);
|
|
343
|
+
(!o || l.parent !== this.getParentView(o)) && (this._visibleViews.delete(i), l.parent.reuseChild(l), t.add(l));
|
|
344
|
+
}
|
|
345
|
+
for (let [i, l] of e) {
|
|
346
|
+
let o = this._visibleViews.get(i);
|
|
347
|
+
if (!o)
|
|
348
|
+
o = this.getReusableView(l), o.parent.children.add(o), this._visibleViews.set(i, o), t.delete(o);
|
|
349
|
+
else {
|
|
350
|
+
o.layoutInfo = l;
|
|
351
|
+
let s = this.collection.getItem(l.key);
|
|
352
|
+
o.content !== s && (o.content != null && this._renderedContent.delete(o.content), this._renderView(o));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
for (let i of t)
|
|
356
|
+
i.parent.children.delete(i), i.parent.reusableViews.clear();
|
|
357
|
+
if (!this._isScrolling)
|
|
358
|
+
for (let i of e.keys()) {
|
|
359
|
+
let l = this._visibleViews.get(i);
|
|
360
|
+
l.parent.children.delete(l), l.parent.children.add(l);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/** Performs layout and updates visible views as needed. */
|
|
364
|
+
render(e) {
|
|
365
|
+
let t = this, i = !1, l = !1, o = !1, s = !1, a = !1, h = !1;
|
|
366
|
+
return e.collection !== this.collection && (t.collection = e.collection, i = !0), (e.layout !== this.layout || this.layout.virtualizer !== this) && (this.layout && (this.layout.virtualizer = null), e.layout.virtualizer = this, t.layout = e.layout, i = !0), e.persistedKeys && !we(e.persistedKeys, this.persistedKeys) && (t.persistedKeys = e.persistedKeys, h = !0), this.visibleRect.equals(e.visibleRect) || (this._overscanManager.setVisibleRect(e.visibleRect), this.layout.shouldInvalidate(e.visibleRect, this.visibleRect) ? (l = !e.visibleRect.pointEquals(this.visibleRect), o = !e.visibleRect.sizeEquals(this.visibleRect), i = !0) : h = !0, t.visibleRect = e.visibleRect), e.invalidationContext !== this._invalidationContext && (e.invalidationContext && (o || (o = e.invalidationContext.sizeChanged || !1), l || (l = e.invalidationContext.offsetChanged || !1), s || (s = e.invalidationContext.itemSizeChanged || !1), a || (a = e.invalidationContext.layoutOptions != null && this._invalidationContext.layoutOptions != null && e.invalidationContext.layoutOptions !== this._invalidationContext.layoutOptions && this.layout.shouldInvalidateLayoutOptions(e.invalidationContext.layoutOptions, this._invalidationContext.layoutOptions)), i || (i = s || o || l || a)), this._invalidationContext = e.invalidationContext), e.isScrolling !== this._isScrolling && (this._isScrolling = e.isScrolling, e.isScrolling || (h = !0)), i ? this.relayout({
|
|
367
|
+
offsetChanged: l,
|
|
368
|
+
sizeChanged: o,
|
|
369
|
+
itemSizeChanged: s,
|
|
370
|
+
layoutOptionsChanged: a,
|
|
371
|
+
layoutOptions: this._invalidationContext.layoutOptions
|
|
372
|
+
}) : h && this.updateSubviews(), Array.from(this._rootView.children);
|
|
373
|
+
}
|
|
374
|
+
getVisibleView(e) {
|
|
375
|
+
return this._visibleViews.get(e);
|
|
376
|
+
}
|
|
377
|
+
invalidate(e) {
|
|
378
|
+
this.delegate.invalidate(e);
|
|
379
|
+
}
|
|
380
|
+
updateItemSize(e, t) {
|
|
381
|
+
if (!this.layout.updateItemSize) return;
|
|
382
|
+
this.layout.updateItemSize(e, t) && this.invalidate({
|
|
383
|
+
itemSizeChanged: !0
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
constructor(e) {
|
|
387
|
+
this.delegate = e.delegate, this.collection = e.collection, this.layout = e.layout, this.contentSize = new z(), this.visibleRect = new u(), this.persistedKeys = /* @__PURE__ */ new Set(), this._visibleViews = /* @__PURE__ */ new Map(), this._renderedContent = /* @__PURE__ */ new WeakMap(), this._rootView = new pe(this), this._isScrolling = !1, this._invalidationContext = {}, this._overscanManager = new be();
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
function Ie(n) {
|
|
391
|
+
let [e, t] = S(new u(0, 0, 0, 0)), [i, l] = S(!1), [o, s] = S({}), a = C(!1), [h] = S(() => new xe({
|
|
392
|
+
collection: n.collection,
|
|
393
|
+
layout: n.layout,
|
|
394
|
+
delegate: {
|
|
395
|
+
setVisibleRect(p) {
|
|
396
|
+
t(p), a.current = !0;
|
|
397
|
+
},
|
|
398
|
+
// TODO: should changing these invalidate the entire cache?
|
|
399
|
+
renderView: n.renderView,
|
|
400
|
+
invalidate: s
|
|
401
|
+
}
|
|
402
|
+
}));
|
|
403
|
+
E(() => {
|
|
404
|
+
a.current && (a.current = !1, n.onVisibleRectChange(e));
|
|
405
|
+
});
|
|
406
|
+
let r = k(() => n.layoutOptions != null ? {
|
|
407
|
+
...o,
|
|
408
|
+
layoutOptions: n.layoutOptions
|
|
409
|
+
} : o, [
|
|
410
|
+
o,
|
|
411
|
+
n.layoutOptions
|
|
412
|
+
]), d = h.render({
|
|
413
|
+
layout: n.layout,
|
|
414
|
+
collection: n.collection,
|
|
415
|
+
persistedKeys: n.persistedKeys,
|
|
416
|
+
layoutOptions: n.layoutOptions,
|
|
417
|
+
visibleRect: e,
|
|
418
|
+
invalidationContext: r,
|
|
419
|
+
isScrolling: i
|
|
420
|
+
}), c = h.contentSize, f = L(() => {
|
|
421
|
+
l(!0);
|
|
422
|
+
}, []), g = L(() => {
|
|
423
|
+
l(!1);
|
|
424
|
+
}, []);
|
|
425
|
+
return k(() => ({
|
|
426
|
+
virtualizer: h,
|
|
427
|
+
visibleViews: d,
|
|
428
|
+
setVisibleRect: t,
|
|
429
|
+
contentSize: c,
|
|
430
|
+
isScrolling: i,
|
|
431
|
+
startScrolling: f,
|
|
432
|
+
endScrolling: g
|
|
433
|
+
}), [
|
|
434
|
+
h,
|
|
435
|
+
d,
|
|
436
|
+
t,
|
|
437
|
+
c,
|
|
438
|
+
i,
|
|
439
|
+
f,
|
|
440
|
+
g
|
|
441
|
+
]);
|
|
442
|
+
}
|
|
443
|
+
const R = 48;
|
|
444
|
+
class Re extends ye {
|
|
445
|
+
// Backward compatibility for subclassing.
|
|
446
|
+
get collection() {
|
|
447
|
+
return this.virtualizer.collection;
|
|
448
|
+
}
|
|
449
|
+
getLayoutInfo(e) {
|
|
450
|
+
var t;
|
|
451
|
+
return this.ensureLayoutInfo(e), ((t = this.layoutNodes.get(e)) === null || t === void 0 ? void 0 : t.layoutInfo) || null;
|
|
452
|
+
}
|
|
453
|
+
getVisibleLayoutInfos(e) {
|
|
454
|
+
if (e.height > 1) {
|
|
455
|
+
var t, i;
|
|
456
|
+
let s = ((i = (t = this.rowHeight) !== null && t !== void 0 ? t : this.estimatedRowHeight) !== null && i !== void 0 ? i : R) + this.gap;
|
|
457
|
+
e.y = Math.floor(e.y / s) * s, e.height = Math.ceil(e.height / s) * s;
|
|
458
|
+
}
|
|
459
|
+
this.layoutIfNeeded(e);
|
|
460
|
+
let l = [], o = (s) => {
|
|
461
|
+
for (let a of s) this.isVisible(a, e) && (l.push(a.layoutInfo), a.children && o(a.children));
|
|
462
|
+
};
|
|
463
|
+
return o(this.rootNodes), l;
|
|
464
|
+
}
|
|
465
|
+
layoutIfNeeded(e) {
|
|
466
|
+
if (this.lastCollection) {
|
|
467
|
+
this.requestedRect.containsRect(e) || (this.requestedRect = this.requestedRect.union(e), this.rootNodes = this.buildCollection());
|
|
468
|
+
for (let t of this.virtualizer.persistedKeys)
|
|
469
|
+
if (this.ensureLayoutInfo(t)) return;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
ensureLayoutInfo(e) {
|
|
473
|
+
return !this.layoutNodes.has(e) && this.requestedRect.area < this.contentSize.area && this.lastCollection ? (this.requestedRect = new u(0, 0, 1 / 0, 1 / 0), this.rootNodes = this.buildCollection(), this.requestedRect = new u(0, 0, this.contentSize.width, this.contentSize.height), !0) : !1;
|
|
474
|
+
}
|
|
475
|
+
isVisible(e, t) {
|
|
476
|
+
return e.layoutInfo.rect.intersects(t) || e.layoutInfo.isSticky || e.layoutInfo.type === "header" || e.layoutInfo.type === "loader" || this.virtualizer.isPersistedKey(e.layoutInfo.key);
|
|
477
|
+
}
|
|
478
|
+
shouldInvalidateEverything(e) {
|
|
479
|
+
let t = e.layoutOptions;
|
|
480
|
+
var i, l, o, s, a;
|
|
481
|
+
return e.sizeChanged || this.rowHeight !== ((i = t == null ? void 0 : t.rowHeight) !== null && i !== void 0 ? i : this.rowHeight) || this.headingHeight !== ((l = t == null ? void 0 : t.headingHeight) !== null && l !== void 0 ? l : this.headingHeight) || this.loaderHeight !== ((o = t == null ? void 0 : t.loaderHeight) !== null && o !== void 0 ? o : this.loaderHeight) || this.gap !== ((s = t == null ? void 0 : t.gap) !== null && s !== void 0 ? s : this.gap) || this.padding !== ((a = t == null ? void 0 : t.padding) !== null && a !== void 0 ? a : this.padding);
|
|
482
|
+
}
|
|
483
|
+
shouldInvalidateLayoutOptions(e, t) {
|
|
484
|
+
return e.rowHeight !== t.rowHeight || e.estimatedRowHeight !== t.estimatedRowHeight || e.headingHeight !== t.headingHeight || e.estimatedHeadingHeight !== t.estimatedHeadingHeight || e.loaderHeight !== t.loaderHeight || e.dropIndicatorThickness !== t.dropIndicatorThickness || e.gap !== t.gap || e.padding !== t.padding;
|
|
485
|
+
}
|
|
486
|
+
update(e) {
|
|
487
|
+
let t = this.virtualizer.collection;
|
|
488
|
+
this.invalidateEverything = this.shouldInvalidateEverything(e), this.invalidateEverything && (this.requestedRect = this.virtualizer.visibleRect.copy(), this.layoutNodes.clear());
|
|
489
|
+
let i = e.layoutOptions;
|
|
490
|
+
var l;
|
|
491
|
+
this.rowHeight = (l = i == null ? void 0 : i.rowHeight) !== null && l !== void 0 ? l : this.rowHeight;
|
|
492
|
+
var o;
|
|
493
|
+
this.estimatedRowHeight = (o = i == null ? void 0 : i.estimatedRowHeight) !== null && o !== void 0 ? o : this.estimatedRowHeight;
|
|
494
|
+
var s;
|
|
495
|
+
this.headingHeight = (s = i == null ? void 0 : i.headingHeight) !== null && s !== void 0 ? s : this.headingHeight;
|
|
496
|
+
var a;
|
|
497
|
+
this.estimatedHeadingHeight = (a = i == null ? void 0 : i.estimatedHeadingHeight) !== null && a !== void 0 ? a : this.estimatedHeadingHeight;
|
|
498
|
+
var h;
|
|
499
|
+
this.loaderHeight = (h = i == null ? void 0 : i.loaderHeight) !== null && h !== void 0 ? h : this.loaderHeight;
|
|
500
|
+
var r;
|
|
501
|
+
this.dropIndicatorThickness = (r = i == null ? void 0 : i.dropIndicatorThickness) !== null && r !== void 0 ? r : this.dropIndicatorThickness;
|
|
502
|
+
var d;
|
|
503
|
+
this.gap = (d = i == null ? void 0 : i.gap) !== null && d !== void 0 ? d : this.gap;
|
|
504
|
+
var c;
|
|
505
|
+
if (this.padding = (c = i == null ? void 0 : i.padding) !== null && c !== void 0 ? c : this.padding, this.rootNodes = this.buildCollection(), this.lastCollection && t !== this.lastCollection)
|
|
506
|
+
for (let f of this.lastCollection.getKeys()) t.getItem(f) || this.layoutNodes.get(f) && this.layoutNodes.delete(f);
|
|
507
|
+
this.lastCollection = t, this.invalidateEverything = !1, this.validRect = this.requestedRect.copy();
|
|
508
|
+
}
|
|
509
|
+
buildCollection(e = this.padding) {
|
|
510
|
+
let t = this.virtualizer.collection, i = 0, l = [], o = (t == null ? void 0 : t.size) === 0 || t.size === 1 && t.getItem(t.getFirstKey()).type === "loader";
|
|
511
|
+
o && (e = 0);
|
|
512
|
+
for (let r of t) {
|
|
513
|
+
var s, a;
|
|
514
|
+
let d = ((a = (s = this.rowHeight) !== null && s !== void 0 ? s : this.estimatedRowHeight) !== null && a !== void 0 ? a : R) + this.gap;
|
|
515
|
+
if (r.type === "item" && e + d < this.requestedRect.y && !this.isValid(r, e)) {
|
|
516
|
+
e += d, i++;
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
let c = this.buildChild(r, this.padding, e, null);
|
|
520
|
+
if (e = c.layoutInfo.rect.maxY + this.gap, l.push(c), r.type === "item" && e > this.requestedRect.maxY) {
|
|
521
|
+
var h;
|
|
522
|
+
let f = t.size - (l.length + i), g = t.getItem(t.getLastKey());
|
|
523
|
+
if ((g == null ? void 0 : g.type) === "loader" && f--, e += f * d, (g == null ? void 0 : g.type) === "loader" && ((h = l.at(-1)) === null || h === void 0 ? void 0 : h.layoutInfo.type) !== "loader") {
|
|
524
|
+
let y = this.buildChild(g, this.padding, e, null);
|
|
525
|
+
l.push(y), e = y.layoutInfo.rect.maxY;
|
|
526
|
+
}
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return e -= this.gap, e += o ? 0 : this.padding, this.contentSize = new z(this.virtualizer.visibleRect.width, e), l;
|
|
531
|
+
}
|
|
532
|
+
isValid(e, t) {
|
|
533
|
+
let i = this.layoutNodes.get(e.key);
|
|
534
|
+
return !this.invalidateEverything && !!i && i.node === e && t === i.layoutInfo.rect.y && i.layoutInfo.rect.intersects(this.validRect) && i.validRect.containsRect(i.layoutInfo.rect.intersection(this.requestedRect));
|
|
535
|
+
}
|
|
536
|
+
buildChild(e, t, i, l) {
|
|
537
|
+
if (this.isValid(e, i)) return this.layoutNodes.get(e.key);
|
|
538
|
+
let o = this.buildNode(e, t, i);
|
|
539
|
+
return o.layoutInfo.parentKey = l ?? null, o.layoutInfo.allowOverflow = !0, this.layoutNodes.set(e.key, o), o;
|
|
540
|
+
}
|
|
541
|
+
buildNode(e, t, i) {
|
|
542
|
+
switch (e.type) {
|
|
543
|
+
case "section":
|
|
544
|
+
return this.buildSection(e, t, i);
|
|
545
|
+
case "item":
|
|
546
|
+
return this.buildItem(e, t, i);
|
|
547
|
+
case "header":
|
|
548
|
+
return this.buildSectionHeader(e, t, i);
|
|
549
|
+
case "loader":
|
|
550
|
+
return this.buildLoader(e, t, i);
|
|
551
|
+
case "separator":
|
|
552
|
+
return this.buildItem(e, t, i);
|
|
553
|
+
default:
|
|
554
|
+
throw new Error("Unsupported node type: " + e.type);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
buildLoader(e, t, i) {
|
|
558
|
+
let l = new u(t, i, this.padding, 0), o = new b("loader", e.key, l);
|
|
559
|
+
l.width = this.virtualizer.contentSize.width - this.padding - t;
|
|
560
|
+
var s, a, h;
|
|
561
|
+
return l.height = e.props.isLoading ? (h = (a = (s = this.loaderHeight) !== null && s !== void 0 ? s : this.rowHeight) !== null && a !== void 0 ? a : this.estimatedRowHeight) !== null && h !== void 0 ? h : R : 0, {
|
|
562
|
+
layoutInfo: o,
|
|
563
|
+
validRect: l.intersection(this.requestedRect)
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
buildSection(e, t, i) {
|
|
567
|
+
let l = this.virtualizer.collection, o = this.virtualizer.visibleRect.width - this.padding, s = new u(t, i, o - t, 0), a = new b(e.type, e.key, s), h = i, r = 0, d = [];
|
|
568
|
+
for (let g of Y(e, l)) {
|
|
569
|
+
var c, f;
|
|
570
|
+
let y = ((f = (c = this.rowHeight) !== null && c !== void 0 ? c : this.estimatedRowHeight) !== null && f !== void 0 ? f : R) + this.gap;
|
|
571
|
+
if (i + y < this.requestedRect.y && !this.isValid(e, i)) {
|
|
572
|
+
i += y, r++;
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
let p = this.buildChild(g, t, i, a.key);
|
|
576
|
+
if (i = p.layoutInfo.rect.maxY + this.gap, d.push(p), i > this.requestedRect.maxY) {
|
|
577
|
+
i += ([
|
|
578
|
+
...Y(e, l)
|
|
579
|
+
].length - (d.length + r)) * y;
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return i -= this.gap, s.height = i - h, {
|
|
584
|
+
layoutInfo: a,
|
|
585
|
+
children: d,
|
|
586
|
+
validRect: a.rect.intersection(this.requestedRect),
|
|
587
|
+
node: e
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
buildSectionHeader(e, t, i) {
|
|
591
|
+
let l = this.virtualizer.visibleRect.width - this.padding, o = this.headingHeight, s = !1;
|
|
592
|
+
if (o == null) {
|
|
593
|
+
let r = this.layoutNodes.get(e.key), d = r == null ? void 0 : r.layoutInfo;
|
|
594
|
+
if (d) {
|
|
595
|
+
let c = this.virtualizer.collection.getItem(e.key), f = this.lastCollection ? this.lastCollection.getItem(e.key) : null;
|
|
596
|
+
o = d.rect.height, s = l !== d.rect.width || c !== f || d.estimatedSize;
|
|
597
|
+
} else
|
|
598
|
+
o = e.rendered ? this.estimatedHeadingHeight : 0, s = !0;
|
|
599
|
+
}
|
|
600
|
+
o == null && (o = R);
|
|
601
|
+
let a = new u(t, i, l - t, o), h = new b("header", e.key, a);
|
|
602
|
+
return h.estimatedSize = s, {
|
|
603
|
+
layoutInfo: h,
|
|
604
|
+
children: [],
|
|
605
|
+
validRect: h.rect.intersection(this.requestedRect),
|
|
606
|
+
node: e
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
buildItem(e, t, i) {
|
|
610
|
+
let l = this.virtualizer.visibleRect.width - this.padding - t, o = this.rowHeight, s = !1;
|
|
611
|
+
if (o == null) {
|
|
612
|
+
let r = this.layoutNodes.get(e.key);
|
|
613
|
+
r ? (o = r.layoutInfo.rect.height, s = l !== r.layoutInfo.rect.width || e !== r.node || r.layoutInfo.estimatedSize) : (o = this.estimatedRowHeight, s = !0);
|
|
614
|
+
}
|
|
615
|
+
o == null && (o = R);
|
|
616
|
+
let a = new u(t, i, l, o), h = new b(e.type, e.key, a);
|
|
617
|
+
return h.estimatedSize = s, {
|
|
618
|
+
layoutInfo: h,
|
|
619
|
+
children: [],
|
|
620
|
+
validRect: h.rect,
|
|
621
|
+
node: e
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
updateItemSize(e, t) {
|
|
625
|
+
let i = this.layoutNodes.get(e);
|
|
626
|
+
if (!i) return !1;
|
|
627
|
+
let l = this.virtualizer.collection, o = i.layoutInfo;
|
|
628
|
+
if (o.estimatedSize = !1, o.rect.height !== t.height) {
|
|
629
|
+
let s = o.copy();
|
|
630
|
+
s.rect.height = t.height, i.layoutInfo = s, this.validRect.height = Math.min(this.validRect.height, o.rect.y - this.validRect.y), this.requestedRect.height += s.rect.height - o.rect.height, this.updateLayoutNode(e, o, s);
|
|
631
|
+
let a = o.parentKey != null ? l.getItem(o.parentKey) : null;
|
|
632
|
+
for (; a; )
|
|
633
|
+
this.updateLayoutNode(a.key, o, s), a = a.parentKey != null ? l.getItem(a.parentKey) : null;
|
|
634
|
+
return !0;
|
|
635
|
+
}
|
|
636
|
+
return !1;
|
|
637
|
+
}
|
|
638
|
+
updateLayoutNode(e, t, i) {
|
|
639
|
+
let l = this.layoutNodes.get(e);
|
|
640
|
+
l && (l.validRect = l.validRect.intersection(this.validRect), l.layoutInfo === t && (l.layoutInfo = i));
|
|
641
|
+
}
|
|
642
|
+
getContentSize() {
|
|
643
|
+
return this.contentSize;
|
|
644
|
+
}
|
|
645
|
+
getDropTargetFromPoint(e, t, i) {
|
|
646
|
+
e += this.virtualizer.visibleRect.x, t += this.virtualizer.visibleRect.y;
|
|
647
|
+
let l = new u(e, Math.max(0, t - this.gap), 1, Math.max(1, this.gap * 2)), o = this.getVisibleLayoutInfos(l), s = null, a = 1 / 0;
|
|
648
|
+
for (let c of o) {
|
|
649
|
+
if (!c.rect.intersects(l)) continue;
|
|
650
|
+
let f = Math.abs(c.rect.y - t), g = Math.abs(c.rect.maxY - t), y = Math.min(f, g);
|
|
651
|
+
y < a && (a = y, s = c.key);
|
|
652
|
+
}
|
|
653
|
+
if (s == null || this.virtualizer.collection.size === 0) return {
|
|
654
|
+
type: "root"
|
|
655
|
+
};
|
|
656
|
+
let h = this.getLayoutInfo(s);
|
|
657
|
+
if (!h) return null;
|
|
658
|
+
let r = h.rect, d = {
|
|
659
|
+
type: "item",
|
|
660
|
+
key: h.key,
|
|
661
|
+
dropPosition: "on"
|
|
662
|
+
};
|
|
663
|
+
return i(d) ? t <= r.y + 10 && i({
|
|
664
|
+
...d,
|
|
665
|
+
dropPosition: "before"
|
|
666
|
+
}) ? d.dropPosition = "before" : t >= r.maxY - 10 && i({
|
|
667
|
+
...d,
|
|
668
|
+
dropPosition: "after"
|
|
669
|
+
}) && (d.dropPosition = "after") : t <= r.y + r.height / 2 && i({
|
|
670
|
+
...d,
|
|
671
|
+
dropPosition: "before"
|
|
672
|
+
}) ? d.dropPosition = "before" : i({
|
|
673
|
+
...d,
|
|
674
|
+
dropPosition: "after"
|
|
675
|
+
}) && (d.dropPosition = "after"), d;
|
|
676
|
+
}
|
|
677
|
+
getDropTargetLayoutInfo(e) {
|
|
678
|
+
let t = this.getLayoutInfo(e.key), i;
|
|
679
|
+
return e.dropPosition === "before" ? i = new u(t.rect.x, t.rect.y - this.dropIndicatorThickness / 2, t.rect.width, this.dropIndicatorThickness) : e.dropPosition === "after" ? i = new u(t.rect.x, t.rect.maxY - this.dropIndicatorThickness / 2, t.rect.width, this.dropIndicatorThickness) : i = t.rect, new b("dropIndicator", e.key + ":" + e.dropPosition, i);
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Creates a new ListLayout with options. See the list of properties below for a description
|
|
683
|
+
* of the options that can be provided.
|
|
684
|
+
*/
|
|
685
|
+
constructor(e = {}) {
|
|
686
|
+
super();
|
|
687
|
+
var t;
|
|
688
|
+
this.rowHeight = (t = e.rowHeight) !== null && t !== void 0 ? t : null;
|
|
689
|
+
var i;
|
|
690
|
+
this.estimatedRowHeight = (i = e.estimatedRowHeight) !== null && i !== void 0 ? i : null;
|
|
691
|
+
var l;
|
|
692
|
+
this.headingHeight = (l = e.headingHeight) !== null && l !== void 0 ? l : null;
|
|
693
|
+
var o;
|
|
694
|
+
this.estimatedHeadingHeight = (o = e.estimatedHeadingHeight) !== null && o !== void 0 ? o : null;
|
|
695
|
+
var s;
|
|
696
|
+
this.loaderHeight = (s = e.loaderHeight) !== null && s !== void 0 ? s : null, this.dropIndicatorThickness = e.dropIndicatorThickness || 2, this.gap = e.gap || 0, this.padding = e.padding || 0, this.layoutNodes = /* @__PURE__ */ new Map(), this.rootNodes = [], this.lastCollection = null, this.invalidateEverything = !1, this.validRect = new u(), this.requestedRect = new u(), this.contentSize = new z();
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
let $ = null;
|
|
700
|
+
function $e(n = !1) {
|
|
701
|
+
if ($ === null || n) {
|
|
702
|
+
const e = document.createElement("div"), t = e.style;
|
|
703
|
+
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
704
|
+
const i = document.createElement("div"), l = i.style;
|
|
705
|
+
return l.width = "100px", l.height = "100px", e.appendChild(i), document.body.appendChild(e), e.scrollLeft > 0 ? $ = "positive-descending" : (e.scrollLeft = 1, e.scrollLeft === 0 ? $ = "negative" : $ = "positive-ascending"), document.body.removeChild(e), $;
|
|
706
|
+
}
|
|
707
|
+
return $;
|
|
708
|
+
}
|
|
709
|
+
function Se(n, e) {
|
|
710
|
+
let { scrollLeft: t } = n;
|
|
711
|
+
if (e === "rtl") {
|
|
712
|
+
let { scrollWidth: i, clientWidth: l } = n;
|
|
713
|
+
switch ($e()) {
|
|
714
|
+
case "negative":
|
|
715
|
+
t = -t;
|
|
716
|
+
break;
|
|
717
|
+
case "positive-descending":
|
|
718
|
+
t = i - l - t;
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return t;
|
|
723
|
+
}
|
|
724
|
+
function ze(n, e) {
|
|
725
|
+
let { contentSize: t, onVisibleRectChange: i, innerStyle: l, onScrollStart: o, onScrollEnd: s, scrollDirection: a = "both", ...h } = n, r = C({
|
|
726
|
+
scrollTop: 0,
|
|
727
|
+
scrollLeft: 0,
|
|
728
|
+
scrollEndTime: 0,
|
|
729
|
+
scrollTimeout: null,
|
|
730
|
+
width: 0,
|
|
731
|
+
height: 0,
|
|
732
|
+
isScrolling: !1
|
|
733
|
+
}).current, { direction: d } = F(), [c, f] = S(!1), g = L((v) => {
|
|
734
|
+
v.target === v.currentTarget && (n.onScroll && n.onScroll(v), P(() => {
|
|
735
|
+
let m = v.currentTarget.scrollTop, H = Se(v.currentTarget, d);
|
|
736
|
+
r.scrollTop = Math.max(0, Math.min(m, t.height - r.height)), r.scrollLeft = Math.max(0, Math.min(H, t.width - r.width)), i(new u(r.scrollLeft, r.scrollTop, r.width, r.height)), r.isScrolling || (r.isScrolling = !0, f(!0), window.dispatchEvent(new Event("tk.disconnect-observer")), o && o());
|
|
737
|
+
let T = Date.now();
|
|
738
|
+
r.scrollEndTime <= T + 50 && (r.scrollEndTime = T + 300, r.scrollTimeout != null && clearTimeout(r.scrollTimeout), r.scrollTimeout = setTimeout(() => {
|
|
739
|
+
r.isScrolling = !1, f(!1), r.scrollTimeout = null, window.dispatchEvent(new Event("tk.connect-observer")), s && s();
|
|
740
|
+
}, 300));
|
|
741
|
+
}));
|
|
742
|
+
}, [
|
|
743
|
+
n,
|
|
744
|
+
d,
|
|
745
|
+
r,
|
|
746
|
+
t,
|
|
747
|
+
i,
|
|
748
|
+
o,
|
|
749
|
+
s
|
|
750
|
+
]);
|
|
751
|
+
ue(e, "scroll", g), he(() => () => {
|
|
752
|
+
r.scrollTimeout != null && clearTimeout(r.scrollTimeout), r.isScrolling && window.dispatchEvent(new Event("tk.connect-observer"));
|
|
753
|
+
}, []);
|
|
754
|
+
let y = C(!1), p = de((v) => {
|
|
755
|
+
let m = e.current;
|
|
756
|
+
if (!m || y.current) return;
|
|
757
|
+
y.current = !0;
|
|
758
|
+
let H = process.env.NODE_ENV === "test" && !process.env.VIRT_ON, T = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes("clientWidth"), ie = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes("clientHeight"), q = m.clientWidth, B = m.clientHeight, M = H && !T ? 1 / 0 : q, O = H && !ie ? 1 / 0 : B;
|
|
759
|
+
(r.width !== M || r.height !== O) && (r.width = M, r.height = O, v(() => {
|
|
760
|
+
i(new u(r.scrollLeft, r.scrollTop, M, O));
|
|
761
|
+
}), (!H && q !== m.clientWidth || B !== m.clientHeight) && (r.width = m.clientWidth, r.height = m.clientHeight, v(() => {
|
|
762
|
+
i(new u(r.scrollLeft, r.scrollTop, r.width, r.height));
|
|
763
|
+
}))), y.current = !1;
|
|
764
|
+
}), N = C(null), [Z, ee] = S({});
|
|
765
|
+
E(() => {
|
|
766
|
+
if (!y.current && (N.current == null || !t.equals(N.current)))
|
|
767
|
+
if (typeof IS_REACT_ACT_ENVIRONMENT == "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest < "u") {
|
|
768
|
+
ee({}), N.current = t;
|
|
769
|
+
return;
|
|
770
|
+
} else queueMicrotask(() => p(P));
|
|
771
|
+
N.current = t;
|
|
772
|
+
}), E(() => {
|
|
773
|
+
p((v) => v());
|
|
774
|
+
}, [
|
|
775
|
+
Z
|
|
776
|
+
]);
|
|
777
|
+
let te = L(() => {
|
|
778
|
+
p(P);
|
|
779
|
+
}, [
|
|
780
|
+
p
|
|
781
|
+
]);
|
|
782
|
+
ce({
|
|
783
|
+
ref: e,
|
|
784
|
+
box: "border-box",
|
|
785
|
+
onResize: te
|
|
786
|
+
});
|
|
787
|
+
let I = {
|
|
788
|
+
// Reset padding so that relative positioning works correctly. Padding will be done in JS layout.
|
|
789
|
+
padding: 0,
|
|
790
|
+
...h.style
|
|
791
|
+
};
|
|
792
|
+
return a === "horizontal" ? (I.overflowX = "auto", I.overflowY = "hidden") : a === "vertical" || t.width === r.width ? (I.overflowY = "auto", I.overflowX = "hidden") : I.overflow = "auto", l = {
|
|
793
|
+
width: Number.isFinite(t.width) ? t.width : void 0,
|
|
794
|
+
height: Number.isFinite(t.height) ? t.height : void 0,
|
|
795
|
+
pointerEvents: c ? "none" : "auto",
|
|
796
|
+
position: "relative",
|
|
797
|
+
...l
|
|
798
|
+
}, {
|
|
799
|
+
scrollViewProps: {
|
|
800
|
+
...h,
|
|
801
|
+
style: I
|
|
802
|
+
},
|
|
803
|
+
contentProps: {
|
|
804
|
+
role: "presentation",
|
|
805
|
+
style: l
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
function He(n) {
|
|
810
|
+
let { layoutInfo: e, virtualizer: t, ref: i } = n, l = e == null ? void 0 : e.key, o = L(() => {
|
|
811
|
+
if (l != null && i.current) {
|
|
812
|
+
let s = Ce(i.current);
|
|
813
|
+
t.updateItemSize(l, s);
|
|
814
|
+
}
|
|
815
|
+
}, [
|
|
816
|
+
t,
|
|
817
|
+
l,
|
|
818
|
+
i
|
|
819
|
+
]);
|
|
820
|
+
return E(() => {
|
|
821
|
+
e != null && e.estimatedSize && o();
|
|
822
|
+
}), {
|
|
823
|
+
updateSize: o
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
function Ce(n) {
|
|
827
|
+
let e = n.style.height;
|
|
828
|
+
n.style.height = "";
|
|
829
|
+
let t = new z(n.scrollWidth, n.scrollHeight);
|
|
830
|
+
return n.style.height = e, t;
|
|
831
|
+
}
|
|
832
|
+
function U(n) {
|
|
833
|
+
let { style: e, className: t, layoutInfo: i, virtualizer: l, parent: o, children: s } = n, { direction: a } = F(), h = C(null);
|
|
834
|
+
return He({
|
|
835
|
+
layoutInfo: i,
|
|
836
|
+
virtualizer: l,
|
|
837
|
+
ref: h
|
|
838
|
+
}), /* @__PURE__ */ w.createElement("div", {
|
|
839
|
+
role: "presentation",
|
|
840
|
+
ref: h,
|
|
841
|
+
className: t,
|
|
842
|
+
style: {
|
|
843
|
+
..._e(i, a, o),
|
|
844
|
+
...e
|
|
845
|
+
}
|
|
846
|
+
}, s);
|
|
847
|
+
}
|
|
848
|
+
let W = /* @__PURE__ */ new WeakMap();
|
|
849
|
+
function _e(n, e, t) {
|
|
850
|
+
let i = e === "rtl" ? "right" : "left", l = W.get(n);
|
|
851
|
+
if (l && l[i] != null) {
|
|
852
|
+
if (!t) return l;
|
|
853
|
+
let h = n.rect.y - t.rect.y, r = n.rect.x - t.rect.x;
|
|
854
|
+
if (l.top === h && l[i] === r) return l;
|
|
855
|
+
}
|
|
856
|
+
let o = {
|
|
857
|
+
// TODO: For layoutInfos that are sticky that have parents with overflow visible, their "top" will be relative to the to the nearest scrolling container
|
|
858
|
+
// which WON'T be the parent since the parent has overflow visible. This means we shouldn't offset the height by the parent's position
|
|
859
|
+
// Not 100% about this change here since it is quite ambigious what the scrolling container maybe and how its top is positioned with respect to the
|
|
860
|
+
// calculated layoutInfo.y here
|
|
861
|
+
top: n.rect.y - (t && !(t.allowOverflow && n.isSticky) ? t.rect.y : 0),
|
|
862
|
+
[i]: n.rect.x - (t && !(t.allowOverflow && n.isSticky) ? t.rect.x : 0),
|
|
863
|
+
width: n.rect.width,
|
|
864
|
+
height: n.rect.height
|
|
865
|
+
};
|
|
866
|
+
Object.entries(o).forEach(([h, r]) => {
|
|
867
|
+
Number.isFinite(r) || (o[h] = void 0);
|
|
868
|
+
});
|
|
869
|
+
var s;
|
|
870
|
+
let a = {
|
|
871
|
+
position: n.isSticky ? "sticky" : "absolute",
|
|
872
|
+
// Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
|
|
873
|
+
display: n.isSticky ? "inline-block" : void 0,
|
|
874
|
+
overflow: n.allowOverflow ? "visible" : "hidden",
|
|
875
|
+
opacity: n.opacity,
|
|
876
|
+
zIndex: n.zIndex,
|
|
877
|
+
transform: (s = n.transform) !== null && s !== void 0 ? s : void 0,
|
|
878
|
+
contain: "size layout style",
|
|
879
|
+
...o
|
|
880
|
+
};
|
|
881
|
+
return W.set(n, a), a;
|
|
882
|
+
}
|
|
883
|
+
const G = /* @__PURE__ */ X(null), J = /* @__PURE__ */ X(null);
|
|
884
|
+
function ke(n) {
|
|
885
|
+
let { children: e, layout: t, layoutOptions: i } = n, l = k(() => typeof t == "function" ? new t() : t, [
|
|
886
|
+
t
|
|
887
|
+
]), o = k(() => ({
|
|
888
|
+
isVirtualized: !0,
|
|
889
|
+
layoutDelegate: l,
|
|
890
|
+
dropTargetDelegate: l.getDropTargetFromPoint ? l : void 0,
|
|
891
|
+
CollectionRoot: Le,
|
|
892
|
+
CollectionBranch: Ne
|
|
893
|
+
}), [
|
|
894
|
+
l
|
|
895
|
+
]);
|
|
896
|
+
return /* @__PURE__ */ w.createElement(re.Provider, {
|
|
897
|
+
value: o
|
|
898
|
+
}, /* @__PURE__ */ w.createElement(J.Provider, {
|
|
899
|
+
value: {
|
|
900
|
+
layout: l,
|
|
901
|
+
layoutOptions: i
|
|
902
|
+
}
|
|
903
|
+
}, e));
|
|
904
|
+
}
|
|
905
|
+
function Le({ collection: n, persistedKeys: e, scrollRef: t, renderDropIndicator: i }) {
|
|
906
|
+
var l;
|
|
907
|
+
let { layout: o, layoutOptions: s } = A(J), a = (l = o.useLayoutOptions) === null || l === void 0 ? void 0 : l.call(o), h = Ie({
|
|
908
|
+
layout: o,
|
|
909
|
+
collection: n,
|
|
910
|
+
renderView: (d, c) => {
|
|
911
|
+
var f;
|
|
912
|
+
return c == null || (f = c.render) === null || f === void 0 ? void 0 : f.call(c, c);
|
|
913
|
+
},
|
|
914
|
+
onVisibleRectChange(d) {
|
|
915
|
+
let c = t == null ? void 0 : t.current;
|
|
916
|
+
c && (c.scrollLeft = d.x, c.scrollTop = d.y);
|
|
917
|
+
},
|
|
918
|
+
persistedKeys: e,
|
|
919
|
+
layoutOptions: k(() => s && a ? {
|
|
920
|
+
...s,
|
|
921
|
+
...a
|
|
922
|
+
} : s || a, [
|
|
923
|
+
s,
|
|
924
|
+
a
|
|
925
|
+
])
|
|
926
|
+
}), { contentProps: r } = ze({
|
|
927
|
+
onVisibleRectChange: h.setVisibleRect,
|
|
928
|
+
contentSize: h.contentSize,
|
|
929
|
+
onScrollStart: h.startScrolling,
|
|
930
|
+
onScrollEnd: h.endScrolling
|
|
931
|
+
}, t);
|
|
932
|
+
return /* @__PURE__ */ w.createElement("div", r, /* @__PURE__ */ w.createElement(G.Provider, {
|
|
933
|
+
value: h
|
|
934
|
+
}, Q(null, h.visibleViews, i)));
|
|
935
|
+
}
|
|
936
|
+
function Ne({ parent: n, renderDropIndicator: e }) {
|
|
937
|
+
let i = A(G).virtualizer.getVisibleView(n.key);
|
|
938
|
+
return Q(i, Array.from(i.children), e);
|
|
939
|
+
}
|
|
940
|
+
function Q(n, e, t) {
|
|
941
|
+
return e.map((i) => Te(n, i, t));
|
|
942
|
+
}
|
|
943
|
+
function Te(n, e, t) {
|
|
944
|
+
let i = /* @__PURE__ */ w.createElement(U, {
|
|
945
|
+
key: e.key,
|
|
946
|
+
layoutInfo: e.layoutInfo,
|
|
947
|
+
virtualizer: e.virtualizer,
|
|
948
|
+
parent: n == null ? void 0 : n.layoutInfo
|
|
949
|
+
}, e.rendered), { collection: l, layout: o } = e.virtualizer, s = e.content;
|
|
950
|
+
return (s == null ? void 0 : s.type) === "item" && t && o.getDropTargetLayoutInfo && (i = /* @__PURE__ */ w.createElement(w.Fragment, {
|
|
951
|
+
key: e.key
|
|
952
|
+
}, D(n, e, {
|
|
953
|
+
type: "item",
|
|
954
|
+
key: e.content.key,
|
|
955
|
+
dropPosition: "before"
|
|
956
|
+
}, t), i, ae(l, s, (a) => D(n, e, a, t)))), i;
|
|
957
|
+
}
|
|
958
|
+
function D(n, e, t, i) {
|
|
959
|
+
let l = i(t);
|
|
960
|
+
if (l) {
|
|
961
|
+
let o = e.virtualizer.layout.getDropTargetLayoutInfo(t);
|
|
962
|
+
l = /* @__PURE__ */ w.createElement(U, {
|
|
963
|
+
layoutInfo: o,
|
|
964
|
+
virtualizer: e.virtualizer,
|
|
965
|
+
parent: n == null ? void 0 : n.layoutInfo
|
|
966
|
+
}, l);
|
|
967
|
+
}
|
|
968
|
+
return l;
|
|
969
|
+
}
|
|
970
|
+
class Ee extends Re {
|
|
971
|
+
/**
|
|
972
|
+
* When using the ListLayout our scroll container height is not calculated properly when the content is partially sectioned.
|
|
973
|
+
* ```ts
|
|
974
|
+
* const partiallySectionedContent = [
|
|
975
|
+
* {
|
|
976
|
+
* name: 'fruit section',
|
|
977
|
+
* children: [{ id: 'kiwi', name: 'Kiwi' }]
|
|
978
|
+
* },
|
|
979
|
+
* // berries have no section, because it's optional
|
|
980
|
+
* { id: 'lingonberries', name: 'Lingonberries' }
|
|
981
|
+
* ];
|
|
982
|
+
* ```
|
|
983
|
+
* If we load the layout info for each key in the collection the calculation is correct.
|
|
984
|
+
*
|
|
985
|
+
* This might not be optional for performance, FYI
|
|
986
|
+
*/
|
|
987
|
+
getContentSize() {
|
|
988
|
+
var t;
|
|
989
|
+
const e = (t = this == null ? void 0 : this.virtualizer) == null ? void 0 : t.collection.getKeys();
|
|
990
|
+
return Array.from(e || []).forEach((i) => {
|
|
991
|
+
this.getLayoutInfo(i);
|
|
992
|
+
}), this.contentSize;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
const Ve = "_listBox_iev2c_7", Me = "_listBoxPopover_iev2c_19", Oe = "_listBoxSectionHeading_iev2c_31", Pe = "_listBoxButton_iev2c_38", Ke = "_listBoxItem_iev2c_50", V = {
|
|
996
|
+
listBox: Ve,
|
|
997
|
+
listBoxPopover: Me,
|
|
998
|
+
listBoxSectionHeading: Oe,
|
|
999
|
+
listBoxButton: Pe,
|
|
1000
|
+
listBoxItem: Ke
|
|
1001
|
+
}, Ze = ({
|
|
1002
|
+
className: n,
|
|
1003
|
+
children: e,
|
|
1004
|
+
...t
|
|
1005
|
+
}) => /* @__PURE__ */ _(
|
|
1006
|
+
ke,
|
|
1007
|
+
{
|
|
1008
|
+
layout: Ee,
|
|
1009
|
+
layoutOptions: {
|
|
1010
|
+
headingHeight: 44
|
|
1011
|
+
},
|
|
1012
|
+
children: /* @__PURE__ */ _(
|
|
1013
|
+
oe,
|
|
1014
|
+
{
|
|
1015
|
+
className: K(V.listBox, n),
|
|
1016
|
+
...t,
|
|
1017
|
+
children: e
|
|
1018
|
+
}
|
|
1019
|
+
)
|
|
1020
|
+
}
|
|
1021
|
+
), et = ({
|
|
1022
|
+
children: n,
|
|
1023
|
+
className: e,
|
|
1024
|
+
...t
|
|
1025
|
+
}) => /* @__PURE__ */ _(
|
|
1026
|
+
ne,
|
|
1027
|
+
{
|
|
1028
|
+
className: K(V.listBoxItem, e),
|
|
1029
|
+
...t,
|
|
1030
|
+
children: n
|
|
1031
|
+
}
|
|
1032
|
+
), tt = ({
|
|
1033
|
+
className: n,
|
|
1034
|
+
children: e,
|
|
1035
|
+
...t
|
|
1036
|
+
}) => /* @__PURE__ */ _(
|
|
1037
|
+
fe,
|
|
1038
|
+
{
|
|
1039
|
+
className: K(n, V.listBoxPopover),
|
|
1040
|
+
offset: 0,
|
|
1041
|
+
...t,
|
|
1042
|
+
children: e
|
|
1043
|
+
}
|
|
1044
|
+
), it = ({
|
|
1045
|
+
children: n,
|
|
1046
|
+
name: e,
|
|
1047
|
+
...t
|
|
1048
|
+
}) => /* @__PURE__ */ le(se, { ...t, children: [
|
|
1049
|
+
/* @__PURE__ */ _(ge, { className: V.listBoxSectionHeading, children: e }),
|
|
1050
|
+
n
|
|
1051
|
+
] });
|
|
1052
|
+
export {
|
|
1053
|
+
Ze as L,
|
|
1054
|
+
et as a,
|
|
1055
|
+
tt as b,
|
|
1056
|
+
it as c,
|
|
1057
|
+
V as s
|
|
1058
|
+
};
|