@servicetitan/anvil2 3.0.8 → 3.1.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/CHANGELOG.md +38 -0
- package/dist/{AiMark-CS6MvraM.js → AiMark-m-sG_BrY.js} +6 -6
- package/dist/{AiMark-CS6MvraM.js.map → AiMark-m-sG_BrY.js.map} +1 -1
- package/dist/AiMark.js +1 -1
- package/dist/{Alert-CNDLoh6b.js → Alert-DYmBt7Yo.js} +4 -4
- package/dist/{Alert-CNDLoh6b.js.map → Alert-DYmBt7Yo.js.map} +1 -1
- package/dist/Alert.js +1 -1
- package/dist/{Announcement-CgTqDU8A.js → Announcement-DXF8slQf.js} +4 -4
- package/dist/{Announcement-CgTqDU8A.js.map → Announcement-DXF8slQf.js.map} +1 -1
- package/dist/Announcement.js +1 -1
- package/dist/{AnvilProvider-BFK29dL5.js → AnvilProvider-Cw_zTBqJ.js} +5 -5
- package/dist/{AnvilProvider-BFK29dL5.js.map → AnvilProvider-Cw_zTBqJ.js.map} +1 -1
- package/dist/AnvilProvider.js +1 -1
- package/dist/{Avatar-Bl-Dxbhf.js → Avatar-CoQcOHWU.js} +2 -2
- package/dist/{Avatar-Bl-Dxbhf.js.map → Avatar-CoQcOHWU.js.map} +1 -1
- package/dist/{Avatar-CdAIJ5VK.js → Avatar-DX96Mxe7.js} +2 -2
- package/dist/{Avatar-CdAIJ5VK.js.map → Avatar-DX96Mxe7.js.map} +1 -1
- package/dist/Avatar.js +2 -2
- package/dist/{Badge-DtUI2AEk.js → Badge-BNrYBFiU.js} +2 -2
- package/dist/{Badge-DtUI2AEk.js.map → Badge-BNrYBFiU.js.map} +1 -1
- package/dist/Badge.js +1 -1
- package/dist/{Breadcrumbs--Xt6l_2L.js → Breadcrumbs-D1X1M_ej.js} +5 -5
- package/dist/{Breadcrumbs--Xt6l_2L.js.map → Breadcrumbs-D1X1M_ej.js.map} +1 -1
- package/dist/Breadcrumbs.js +1 -1
- package/dist/{Button-C_V2xQAs.js → Button-ChQARW0y.js} +3 -3
- package/dist/{Button-C_V2xQAs.js.map → Button-ChQARW0y.js.map} +1 -1
- package/dist/Button.js +1 -1
- package/dist/{ButtonCompound-BQb2gfAl.js → ButtonCompound-_0ddykI_.js} +2 -2
- package/dist/{ButtonCompound-BQb2gfAl.js.map → ButtonCompound-_0ddykI_.js.map} +1 -1
- package/dist/ButtonCompound.js +1 -1
- package/dist/{ButtonLink-UhLks0vM.js → ButtonLink-CWbYzTTz.js} +3 -3
- package/dist/{ButtonLink-UhLks0vM.js.map → ButtonLink-CWbYzTTz.js.map} +1 -1
- package/dist/ButtonLink.js +1 -1
- package/dist/{ButtonToggle-jnDMPSyK.js → ButtonToggle-BVv94C4U.js} +3 -3
- package/dist/{ButtonToggle-jnDMPSyK.js.map → ButtonToggle-BVv94C4U.js.map} +1 -1
- package/dist/ButtonToggle.js +1 -1
- package/dist/{Calendar-5mAxtdNh.js → Calendar-BTen4c8H.js} +2 -2
- package/dist/{Calendar-5mAxtdNh.js.map → Calendar-BTen4c8H.js.map} +1 -1
- package/dist/{Calendar-rITorBvD.js → Calendar-BvHvJOHb.js} +5 -5
- package/dist/{Calendar-rITorBvD.js.map → Calendar-BvHvJOHb.js.map} +1 -1
- package/dist/Calendar.js +2 -2
- package/dist/{Card-fBqg853U.js → Card-Bt0F6RTq.js} +2 -2
- package/dist/{Card-fBqg853U.js.map → Card-Bt0F6RTq.js.map} +1 -1
- package/dist/Card.js +1 -1
- package/dist/{Checkbox-DTzoDcJl.js → Checkbox-BcfY3iwE.js} +5 -5
- package/dist/{Checkbox-DTzoDcJl.js.map → Checkbox-BcfY3iwE.js.map} +1 -1
- package/dist/{Checkbox-BYWhkYoK.js → Checkbox-DqncM7th.js} +2 -2
- package/dist/{Checkbox-BYWhkYoK.js.map → Checkbox-DqncM7th.js.map} +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/{Chip-CyMNyEPR.js → Chip-B6LaPxtL.js} +5 -5
- package/dist/{Chip-CyMNyEPR.js.map → Chip-B6LaPxtL.js.map} +1 -1
- package/dist/Chip.js +1 -1
- package/dist/Combobox.js +1 -1
- package/dist/{DataTable-Dwhwvm6R.js → DataTable-B_GYRuR1.js} +1330 -506
- package/dist/DataTable-B_GYRuR1.js.map +1 -0
- package/dist/DataTable.css +323 -234
- package/dist/{DateFieldRange-BUug1tUy.js → DateFieldRange-DGjw3kTB.js} +5 -5
- package/dist/{DateFieldRange-BUug1tUy.js.map → DateFieldRange-DGjw3kTB.js.map} +1 -1
- package/dist/DateFieldRange.js +1 -1
- package/dist/{DateFieldSingle-DR7faQGD.js → DateFieldSingle-dB13x4lS.js} +5 -5
- package/dist/{DateFieldSingle-DR7faQGD.js.map → DateFieldSingle-dB13x4lS.js.map} +1 -1
- package/dist/DateFieldSingle.js +1 -1
- package/dist/{DateFieldYearless-7MFcR7L6.js → DateFieldYearless-BJ_1HLfi.js} +5 -5
- package/dist/{DateFieldYearless-7MFcR7L6.js.map → DateFieldYearless-BJ_1HLfi.js.map} +1 -1
- package/dist/DateFieldYearless.js +1 -1
- package/dist/{DateFieldYearlessRange-DGtdyISH.js → DateFieldYearlessRange-BXnvkTXC.js} +5 -5
- package/dist/{DateFieldYearlessRange-DGtdyISH.js.map → DateFieldYearlessRange-BXnvkTXC.js.map} +1 -1
- package/dist/DateFieldYearlessRange.js +1 -1
- package/dist/{DaysOfTheWeek-C7oN9nIe.js → DaysOfTheWeek-C78qSYxI.js} +5 -5
- package/dist/{DaysOfTheWeek-C7oN9nIe.js.map → DaysOfTheWeek-C78qSYxI.js.map} +1 -1
- package/dist/DaysOfTheWeek.js +1 -1
- package/dist/{Details-s2pVu-YL.js → Details-DK6ceYhs.js} +3 -3
- package/dist/{Details-s2pVu-YL.js.map → Details-DK6ceYhs.js.map} +1 -1
- package/dist/Details.js +1 -1
- package/dist/{Dialog-dE9c90iR.js → Dialog-DuGX-ngX.js} +4 -4
- package/dist/{Dialog-dE9c90iR.js.map → Dialog-DuGX-ngX.js.map} +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/{DialogCancelButton-DcidFC38.js → DialogCancelButton-lAq4bhHS.js} +2 -2
- package/dist/{DialogCancelButton-DcidFC38.js.map → DialogCancelButton-lAq4bhHS.js.map} +1 -1
- package/dist/{Divider-CxtTyw8_.js → Divider-C7fp5Xb6.js} +18 -18
- package/dist/{Divider-CxtTyw8_.js.map → Divider-C7fp5Xb6.js.map} +1 -1
- package/dist/Divider.css +21 -24
- package/dist/Divider.js +1 -1
- package/dist/Dnd.js +2 -2
- package/dist/{DndHandleButton-CHTOYRlq.js → DndHandleButton-Cj7pIegT.js} +4 -6
- package/dist/DndHandleButton-Cj7pIegT.js.map +1 -0
- package/dist/DndSort.js +6 -6
- package/dist/{Drawer-Dk0MsaOU.js → Drawer-9_HfTi3J.js} +4 -4
- package/dist/{Drawer-Dk0MsaOU.js.map → Drawer-9_HfTi3J.js.map} +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/DrillDown.js +1 -1
- package/dist/{EditCard-DV2N7zWr.js → EditCard-DeB4rQVo.js} +6 -6
- package/dist/{EditCard-DV2N7zWr.js.map → EditCard-DeB4rQVo.js.map} +1 -1
- package/dist/EditCard.js +1 -1
- package/dist/{FieldLabel-VVn8GR64.js → FieldLabel-CtvpqdG9.js} +4 -4
- package/dist/{FieldLabel-VVn8GR64.js.map → FieldLabel-CtvpqdG9.js.map} +1 -1
- package/dist/FieldLabel.js +1 -1
- package/dist/{FilterBar-CXGsoWw5.js → FilterBar-D0iRUjOy.js} +10 -10
- package/dist/{FilterBar-CXGsoWw5.js.map → FilterBar-D0iRUjOy.js.map} +1 -1
- package/dist/FilterBar.js +1 -1
- package/dist/{Flex-_orhvoxS.js → Flex-Bb3iHExM.js} +2 -2
- package/dist/{Flex-_orhvoxS.js.map → Flex-Bb3iHExM.js.map} +1 -1
- package/dist/Flex.js +1 -1
- package/dist/{Grid-BAN8WD_V.js → Grid-ho1pGJ5L.js} +2 -2
- package/dist/{Grid-BAN8WD_V.js.map → Grid-ho1pGJ5L.js.map} +1 -1
- package/dist/Grid.js +1 -1
- package/dist/{Icon-feeG7gXA.js → Icon-BEwHECSM.js} +2 -2
- package/dist/{Icon-feeG7gXA.js.map → Icon-BEwHECSM.js.map} +1 -1
- package/dist/Icon.js +1 -1
- package/dist/{InputMask-VBHWGZGN.js → InputMask-CZ57VFJA.js} +3 -3
- package/dist/{InputMask-VBHWGZGN.js.map → InputMask-CZ57VFJA.js.map} +1 -1
- package/dist/InputMask.js +1 -1
- package/dist/{InteractiveCard-Pu0j2qJd.js → InteractiveCard-CyUR_VLW.js} +2 -2
- package/dist/{InteractiveCard-Pu0j2qJd.js.map → InteractiveCard-CyUR_VLW.js.map} +1 -1
- package/dist/InteractiveCard.js +1 -1
- package/dist/{Link-D8A_WT94.js → Link-DI4eVVdI.js} +3 -3
- package/dist/{Link-D8A_WT94.js.map → Link-DI4eVVdI.js.map} +1 -1
- package/dist/Link.js +1 -1
- package/dist/{LinkButton-DxYsWiXB.js → LinkButton-C0wps8r1.js} +2 -2
- package/dist/{LinkButton-DxYsWiXB.js.map → LinkButton-C0wps8r1.js.map} +1 -1
- package/dist/LinkButton.js +1 -1
- package/dist/{List-GPS-GqH7.js → List-BvzfZ9TW.js} +2 -2
- package/dist/{List-GPS-GqH7.js.map → List-BvzfZ9TW.js.map} +1 -1
- package/dist/List.js +1 -1
- package/dist/{ListView-BUrfz75g.js → ListView-Ngeqpgna.js} +3 -3
- package/dist/{ListView-BUrfz75g.js.map → ListView-Ngeqpgna.js.map} +1 -1
- package/dist/ListView.js +1 -1
- package/dist/{Listbox-CRY-0BkS.js → Listbox-3ChcLAyg.js} +5 -5
- package/dist/{Listbox-CRY-0BkS.js.map → Listbox-3ChcLAyg.js.map} +1 -1
- package/dist/Listbox.js +1 -1
- package/dist/{LocalizationProvider-CO8fQGqs.js → LocalizationProvider-BPcOU7YX.js} +2 -2
- package/dist/{LocalizationProvider-CO8fQGqs.js.map → LocalizationProvider-BPcOU7YX.js.map} +1 -1
- package/dist/LocalizationProvider.js +1 -1
- package/dist/{Menu-DNJ0YqjA.js → Menu-BUIAooVS.js} +3 -3
- package/dist/{Menu-DNJ0YqjA.js.map → Menu-BUIAooVS.js.map} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/{MenuFooter-CrsZdXvN.js → MenuFooter-Dtckm9vY.js} +2 -2
- package/dist/{MenuFooter-CrsZdXvN.js.map → MenuFooter-Dtckm9vY.js.map} +1 -1
- package/dist/MultiSelectField.js +1 -1
- package/dist/{MultiSelectFieldSync-CIuy3aRD.js → MultiSelectFieldSync-jb57hWBG.js} +9 -9
- package/dist/{MultiSelectFieldSync-CIuy3aRD.js.map → MultiSelectFieldSync-jb57hWBG.js.map} +1 -1
- package/dist/MultiSelectMenu.js +1 -1
- package/dist/{MultiSelectMenuSync-Drz8SEk9.js → MultiSelectMenuSync-D6NI4Z2h.js} +6 -6
- package/dist/{MultiSelectMenuSync-Drz8SEk9.js.map → MultiSelectMenuSync-D6NI4Z2h.js.map} +1 -1
- package/dist/{NumberField-bgYX7JGs.js → NumberField-C_UAdOsK.js} +6 -6
- package/dist/{NumberField-bgYX7JGs.js.map → NumberField-C_UAdOsK.js.map} +1 -1
- package/dist/NumberField.js +1 -1
- package/dist/Overflow.js +2 -2
- package/dist/{Page-BSHydn4p.js → Page--5QCoYX4.js} +89 -89
- package/dist/Page--5QCoYX4.js.map +1 -0
- package/dist/Page.js +1 -1
- package/dist/{Pagination-CAeyJ7Pl.js → Pagination-Dtgyk0Xr.js} +7 -7
- package/dist/{Pagination-CAeyJ7Pl.js.map → Pagination-Dtgyk0Xr.js.map} +1 -1
- package/dist/Pagination.js +1 -1
- package/dist/{Popover-Cq5tirFz.js → Popover-B1_842BG.js} +3 -3
- package/dist/{Popover-Cq5tirFz.js.map → Popover-B1_842BG.js.map} +1 -1
- package/dist/Popover.js +1 -1
- package/dist/{ProgressBar-ByR50ln7.js → ProgressBar-B87CdCEB.js} +5 -5
- package/dist/{ProgressBar-ByR50ln7.js.map → ProgressBar-B87CdCEB.js.map} +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/{Radio-WlsZFRzX.js → Radio-CrGhNc6t.js} +5 -5
- package/dist/{Radio-WlsZFRzX.js.map → Radio-CrGhNc6t.js.map} +1 -1
- package/dist/{Radio-CPuctRpl.js → Radio-K8VUbkMe.js} +2 -2
- package/dist/{Radio-CPuctRpl.js.map → Radio-K8VUbkMe.js.map} +1 -1
- package/dist/Radio.js +1 -1
- package/dist/{RichTextEditor-CoPXdaWI.js → RichTextEditor-DiOWlG-j.js} +14 -14
- package/dist/{RichTextEditor-CoPXdaWI.js.map → RichTextEditor-DiOWlG-j.js.map} +1 -1
- package/dist/RichTextEditor.js +1 -1
- package/dist/{SavedFiltersButton-DzJijqHz.js → SavedFiltersButton-BpjGgsnS.js} +12 -12
- package/dist/{SavedFiltersButton-DzJijqHz.js.map → SavedFiltersButton-BpjGgsnS.js.map} +1 -1
- package/dist/SavedFiltersButton.js +1 -1
- package/dist/{SearchField-fXc_vWEr.js → SearchField-CD64ELrq.js} +3 -3
- package/dist/{SearchField-fXc_vWEr.js.map → SearchField-CD64ELrq.js.map} +1 -1
- package/dist/{SearchField-BMHJCVFu.js → SearchField-CWucSMdv.js} +2 -2
- package/dist/{SearchField-BMHJCVFu.js.map → SearchField-CWucSMdv.js.map} +1 -1
- package/dist/SearchField.js +1 -1
- package/dist/{SegmentedControl-PwLdTdrd.js → SegmentedControl-fBjqazBR.js} +3 -3
- package/dist/{SegmentedControl-PwLdTdrd.js.map → SegmentedControl-fBjqazBR.js.map} +1 -1
- package/dist/SegmentedControl.js +1 -1
- package/dist/{SelectCard-DLWLHi_i.js → SelectCard-YwnN2K4B.js} +5 -5
- package/dist/{SelectCard-DLWLHi_i.js.map → SelectCard-YwnN2K4B.js.map} +1 -1
- package/dist/SelectCard.js +1 -1
- package/dist/SelectField.js +1 -1
- package/dist/{SelectFieldLabel-vemffdmu.js → SelectFieldLabel-BopPrWWy.js} +2 -2
- package/dist/{SelectFieldLabel-vemffdmu.js.map → SelectFieldLabel-BopPrWWy.js.map} +1 -1
- package/dist/{SelectFieldSync-DlGiJ-Iy.js → SelectFieldSync-B30iR0EX.js} +7 -7
- package/dist/{SelectFieldSync-DlGiJ-Iy.js.map → SelectFieldSync-B30iR0EX.js.map} +1 -1
- package/dist/SelectMenu.js +1 -1
- package/dist/{SelectMenuSync-CAweNjRL.js → SelectMenuSync-BoxEMqcv.js} +6 -6
- package/dist/{SelectMenuSync-CAweNjRL.js.map → SelectMenuSync-BoxEMqcv.js.map} +1 -1
- package/dist/{SelectOptions-BGCap9fZ.js → SelectOptions-kx_udzjX.js} +2 -2
- package/dist/{SelectOptions-BGCap9fZ.js.map → SelectOptions-kx_udzjX.js.map} +1 -1
- package/dist/{SelectTrigger-BbneVXMz.js → SelectTrigger-BjMduiax.js} +5 -5
- package/dist/{SelectTrigger-BbneVXMz.js.map → SelectTrigger-BjMduiax.js.map} +1 -1
- package/dist/SelectTrigger.js +1 -1
- package/dist/{SelectTriggerBase-BjIOERXr.js → SelectTriggerBase-CL9Zpbxn.js} +5 -5
- package/dist/{SelectTriggerBase-BjIOERXr.js.map → SelectTriggerBase-CL9Zpbxn.js.map} +1 -1
- package/dist/{SideNav-JzIIZSK_.js → SideNav-BFkruKa4.js} +3 -3
- package/dist/{SideNav-JzIIZSK_.js.map → SideNav-BFkruKa4.js.map} +1 -1
- package/dist/SideNav.js +1 -1
- package/dist/Skeleton.js +1 -1
- package/dist/{Stepper-lYywxPU5.js → Stepper-BXgMeUHu.js} +5 -5
- package/dist/{Stepper-lYywxPU5.js.map → Stepper-BXgMeUHu.js.map} +1 -1
- package/dist/Stepper.js +1 -1
- package/dist/{Switch-B6bKmpwN.js → Switch-Crcn7ffO.js} +5 -5
- package/dist/{Switch-B6bKmpwN.js.map → Switch-Crcn7ffO.js.map} +1 -1
- package/dist/Switch.js +1 -1
- package/dist/{Tab-CIY6BO2e.js → Tab-FOIali7o.js} +4 -4
- package/dist/{Tab-CIY6BO2e.js.map → Tab-FOIali7o.js.map} +1 -1
- package/dist/Tab.js +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Text-w2gWn4K6.js → Text-CK1TI4Gz.js} +3 -3
- package/dist/{Text-w2gWn4K6.js.map → Text-CK1TI4Gz.js.map} +1 -1
- package/dist/Text.js +1 -1
- package/dist/{TextField-BQsCh5Nb.js → TextField-CFRhRDXu.js} +2 -2
- package/dist/{TextField-BQsCh5Nb.js.map → TextField-CFRhRDXu.js.map} +1 -1
- package/dist/{TextField-DJ3gEIP6.js → TextField-Dn2pwnKf.js} +4 -4
- package/dist/{TextField-DJ3gEIP6.js.map → TextField-Dn2pwnKf.js.map} +1 -1
- package/dist/TextField.js +1 -1
- package/dist/{Textarea-BK4Vf84K.js → Textarea-DPRvsIhS.js} +4 -4
- package/dist/{Textarea-BK4Vf84K.js.map → Textarea-DPRvsIhS.js.map} +1 -1
- package/dist/Textarea.js +1 -1
- package/dist/{ThemeProvider-BC6wbuLU.js → ThemeProvider-Sd8LK0A9.js} +3 -3
- package/dist/{ThemeProvider-BC6wbuLU.js.map → ThemeProvider-Sd8LK0A9.js.map} +1 -1
- package/dist/ThemeProvider.css +16 -4
- package/dist/ThemeProvider.js +1 -1
- package/dist/ThemeProvider.module-_7m6Tav-.js +8 -0
- package/dist/ThemeProvider.module-_7m6Tav-.js.map +1 -0
- package/dist/{TimeField-B4IW2B_o.js → TimeField-IK0j6q87.js} +6 -6
- package/dist/{TimeField-B4IW2B_o.js.map → TimeField-IK0j6q87.js.map} +1 -1
- package/dist/TimeField.js +1 -1
- package/dist/Toast.js +2 -2
- package/dist/{Toaster-DTF9qnTy.js → Toaster-C1Hjsfo4.js} +2 -2
- package/dist/{Toaster-DTF9qnTy.js.map → Toaster-C1Hjsfo4.js.map} +1 -1
- package/dist/{Toaster-BGY2IzF5.js → Toaster-CFU3OD-A.js} +5 -5
- package/dist/{Toaster-BGY2IzF5.js.map → Toaster-CFU3OD-A.js.map} +1 -1
- package/dist/{Toolbar-DObrJ_S5.js → Toolbar-CTF1WCrJ.js} +9 -9
- package/dist/{Toolbar-DObrJ_S5.js.map → Toolbar-CTF1WCrJ.js.map} +1 -1
- package/dist/{Toolbar-DRJGKk8D.js → Toolbar-Cv8AR7mj.js} +11 -11
- package/dist/{Toolbar-DRJGKk8D.js.map → Toolbar-Cv8AR7mj.js.map} +1 -1
- package/dist/Toolbar.js +2 -2
- package/dist/{ToolbarButtonToggle-BCKgA8FE.js → ToolbarButtonToggle-6agLSzkp.js} +3 -3
- package/dist/{ToolbarButtonToggle-BCKgA8FE.js.map → ToolbarButtonToggle-6agLSzkp.js.map} +1 -1
- package/dist/{Tooltip-DqS6xDUf.js → Tooltip-DYR7-Ova.js} +3 -3
- package/dist/{Tooltip-DqS6xDUf.js.map → Tooltip-DYR7-Ova.js.map} +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/TreeSelectField.js +1 -1
- package/dist/{TreeSelectFieldSync-Do5ffU0b.js → TreeSelectFieldSync-CqY6lbDJ.js} +8 -8
- package/dist/{TreeSelectFieldSync-Do5ffU0b.js.map → TreeSelectFieldSync-CqY6lbDJ.js.map} +1 -1
- package/dist/TreeSelectMenu.js +1 -1
- package/dist/{TreeSelectMenuSync-s05Ly6lj.js → TreeSelectMenuSync-DGUoVfN-.js} +5 -5
- package/dist/{TreeSelectMenuSync-s05Ly6lj.js.map → TreeSelectMenuSync-DGUoVfN-.js.map} +1 -1
- package/dist/{YearlessDateInputWithPicker-BHfFjCqE.js → YearlessDateInputWithPicker-CPhBofEJ.js} +5 -5
- package/dist/{YearlessDateInputWithPicker-BHfFjCqE.js.map → YearlessDateInputWithPicker-CPhBofEJ.js.map} +1 -1
- package/dist/beta.js +16 -16
- package/dist/drag_indicator-BRHAPLSJ.js +6 -0
- package/dist/drag_indicator-BRHAPLSJ.js.map +1 -0
- package/dist/{filter-state-DyMDjdRS.js → filter-state-HDQUPdOL.js} +25 -25
- package/dist/filter-state-HDQUPdOL.js.map +1 -0
- package/dist/{index-CukEaIHB.js → index-iTige6rD.js} +2 -2
- package/dist/{index-CukEaIHB.js.map → index-iTige6rD.js.map} +1 -1
- package/dist/{index-fSKD4ey4.js → index-vOZvfuE6.js} +2 -2
- package/dist/{index-fSKD4ey4.js.map → index-vOZvfuE6.js.map} +1 -1
- package/dist/index.js +65 -65
- package/dist/{portalScopeClassNames-jlZkdug_.js → portalScopeClassNames-BTyv0FY8.js} +2 -2
- package/dist/{portalScopeClassNames-jlZkdug_.js.map → portalScopeClassNames-BTyv0FY8.js.map} +1 -1
- package/dist/{primitive-DXlHdTFb.js → primitive-BXgYQTTw.js} +61 -1
- package/dist/{primitive-DXlHdTFb.js.map → primitive-BXgYQTTw.js.map} +1 -1
- package/dist/src/beta/components/Table/DataTable/DataTable.d.ts +24 -25
- package/dist/src/beta/components/Table/DataTable/internal/DataTableBody.d.ts +2 -19
- package/dist/src/beta/components/Table/DataTable/internal/DataTableBodyRow.d.ts +12 -13
- package/dist/src/beta/components/Table/DataTable/internal/context/rowClick/DataTableRowClickContext.d.ts +10 -0
- package/dist/src/beta/components/Table/DataTable/internal/context/rowClick/DataTableRowClickProvider.d.ts +19 -0
- package/dist/src/beta/components/Table/DataTable/internal/context/rowClick/useDataTableRowClick.d.ts +1 -0
- package/dist/src/beta/components/Table/DataTable/internal/context/surface/DataTableSurfaceCoordinatorContext.d.ts +13 -0
- package/dist/src/beta/components/Table/DataTable/internal/context/surface/DataTableSurfaceCoordinatorProvider.d.ts +7 -0
- package/dist/src/beta/components/Table/DataTable/internal/context/surface/useDataTableSurfaceCoordinator.d.ts +1 -0
- package/dist/src/beta/components/Table/DataTable/internal/editable-cells/useCustomEditHelpers.d.ts +8 -6
- package/dist/src/beta/components/Table/createColumnHelper.d.ts +4 -2
- package/dist/src/beta/components/Table/formatters/htmlFormatter.d.ts +4 -2
- package/dist/src/beta/components/Table/formatters/htmlToMarkdown.d.ts +5 -2
- package/dist/src/beta/components/Table/formatters/markdownFormatter.d.ts +3 -2
- package/dist/src/beta/components/Table/internal/TruncateChips.d.ts +5 -15
- package/dist/src/beta/components/Table/types.d.ts +47 -30
- package/dist/src/components/Page/Page.d.ts +2 -2
- package/dist/src/components/Page/pageBreakpoint.d.ts +26 -0
- package/dist/src/integration-testing/page-resize-loop.spec.d.ts +1 -0
- package/dist/src/internal/components/Surface/Surface.d.ts +4 -0
- package/dist/src/internal/components/Surface/surfaceGeometry.d.ts +31 -0
- package/dist/{stripInlineMarkdown-C0bVmYgG.js → stripInlineMarkdown-B-pONfu5.js} +2 -2
- package/dist/{stripInlineMarkdown-C0bVmYgG.js.map → stripInlineMarkdown-B-pONfu5.js.map} +1 -1
- package/dist/{syncFilterUtils-DZqeVWTS.js → syncFilterUtils-Cg2yX7al.js} +6 -6
- package/dist/{syncFilterUtils-DZqeVWTS.js.map → syncFilterUtils-Cg2yX7al.js.map} +1 -1
- package/dist/token/core/primitive-variables.scss +12 -0
- package/dist/token/core/primitive.d.ts +12 -0
- package/dist/token/core/primitive.js +48 -0
- package/dist/token/core/primitive.scss +12 -0
- package/dist/token.js +1 -1
- package/dist/{treeSync-Cz3H08cr.js → treeSync-CASYkjhr.js} +4 -4
- package/dist/{treeSync-Cz3H08cr.js.map → treeSync-CASYkjhr.js.map} +1 -1
- package/dist/{useAdaptiveView-CeYKH0Me.js → useAdaptiveView-BDqpk9G2.js} +9 -9
- package/dist/{useAdaptiveView-CeYKH0Me.js.map → useAdaptiveView-BDqpk9G2.js.map} +1 -1
- package/dist/{useBreakpoint-CeaUyHxh.js → useBreakpoint-BBNRlMGZ.js} +2 -2
- package/dist/{useBreakpoint-CeaUyHxh.js.map → useBreakpoint-BBNRlMGZ.js.map} +1 -1
- package/dist/useBreakpoint.js +1 -1
- package/dist/{useDrilldown-BJ2dHHKV.js → useDrilldown-DCXYrcGK.js} +4 -4
- package/dist/{useDrilldown-BJ2dHHKV.js.map → useDrilldown-DCXYrcGK.js.map} +1 -1
- package/dist/{useInfiniteCombobox-C6TDFfds.js → useInfiniteCombobox-D_y_FHCj.js} +9 -9
- package/dist/{useInfiniteCombobox-C6TDFfds.js.map → useInfiniteCombobox-D_y_FHCj.js.map} +1 -1
- package/dist/{useLayoutPropsUtil-CB_zHDbW.js → useLayoutPropsUtil-DjqeAJZ9.js} +3 -3
- package/dist/{useLayoutPropsUtil-CB_zHDbW.js.map → useLayoutPropsUtil-DjqeAJZ9.js.map} +1 -1
- package/dist/{useToggleSelection-Bn7h-gGD.js → useToggleSelection-BSLh569m.js} +2 -2
- package/dist/{useToggleSelection-Bn7h-gGD.js.map → useToggleSelection-BSLh569m.js.map} +1 -1
- package/package.json +3 -3
- package/dist/DataTable-Dwhwvm6R.js.map +0 -1
- package/dist/DndHandleButton-CHTOYRlq.js.map +0 -1
- package/dist/Page-BSHydn4p.js.map +0 -1
- package/dist/ThemeProvider.module-D9pNGYjP.js +0 -8
- package/dist/ThemeProvider.module-D9pNGYjP.js.map +0 -1
- package/dist/filter-state-DyMDjdRS.js.map +0 -1
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { C as Chip } from './Chip-
|
|
3
|
-
import { F as Flex } from './Flex-
|
|
2
|
+
import { C as Chip } from './Chip-B6LaPxtL.js';
|
|
3
|
+
import { F as Flex } from './Flex-Bb3iHExM.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useId, useRef, useCallback, useMemo, createContext, forwardRef, useEffect, useContext,
|
|
5
|
+
import { useId, useRef, useCallback, useMemo, createContext, forwardRef, useState, useEffect, useContext, useLayoutEffect, useImperativeHandle, memo as memo$1, Fragment as Fragment$1, isValidElement } from 'react';
|
|
6
|
+
import { T as Tooltip } from './Tooltip-DYR7-Ova.js';
|
|
6
7
|
import { c as cx } from './index-De1g9FRV.js';
|
|
7
8
|
import { D as DateTime } from './luxon-wpz4A-OQ.js';
|
|
8
|
-
import { C as Checkbox } from './Checkbox-
|
|
9
|
-
import { B as Button } from './Button-
|
|
9
|
+
import { C as Checkbox } from './Checkbox-DqncM7th.js';
|
|
10
|
+
import { B as Button } from './Button-ChQARW0y.js';
|
|
10
11
|
import { S as SvgChevronRight } from './chevron_right-BdpsxX7x.js';
|
|
11
12
|
import { S as SvgEdit } from './edit-DQOiktcu.js';
|
|
12
|
-
import { I as Icon } from './Icon-
|
|
13
|
+
import { I as Icon } from './Icon-BEwHECSM.js';
|
|
13
14
|
import { S as SrOnly } from './SrOnly-pnf8ajnh.js';
|
|
14
15
|
import { u as useNumberField } from './useNumberField-D_ic9i2q.js';
|
|
15
16
|
import { u as useMergeRefs, m as mergeRefs } from './useMergeRefs-Dfmtq9cI.js';
|
|
16
|
-
import { a as SelectMenuSync, S as SelectMenu } from './SelectMenuSync-
|
|
17
|
-
import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-
|
|
17
|
+
import { a as SelectMenuSync, S as SelectMenu } from './SelectMenuSync-BoxEMqcv.js';
|
|
18
|
+
import { a as MultiSelectMenuSync, M as MultiSelectMenu } from './MultiSelectMenuSync-D6NI4Z2h.js';
|
|
18
19
|
import { S as SvgClose } from './close-DZj38AEh.js';
|
|
19
|
-
import {
|
|
20
|
+
import { S as SvgDragIndicator } from './drag_indicator-BRHAPLSJ.js';
|
|
21
|
+
import { p as portalScopeClassNames } from './portalScopeClassNames-BTyv0FY8.js';
|
|
20
22
|
import { a as useOnClickOutside, r as registerLayer, u as unregisterLayer } from './useOnClickOutside-Zw5vzxSq.js';
|
|
23
|
+
import { u as useBreakpoint } from './useBreakpoint-BBNRlMGZ.js';
|
|
21
24
|
import { c as computePosition, o as offset, h as autoPlacement, d as shift, g as size, a as autoUpdate, s as safeShowPopover, b as safeHidePopover } from './floating-ui.react-dom-BIKT960u.js';
|
|
22
|
-
import { F as FieldLabel } from './FieldLabel-
|
|
25
|
+
import { F as FieldLabel } from './FieldLabel-CtvpqdG9.js';
|
|
23
26
|
import { S as SvgError } from './error-DR_wWdYY.js';
|
|
24
27
|
import { S as SvgWarning } from './warning-c4Wj1rI4.js';
|
|
25
|
-
import { T as Tooltip } from './Tooltip-DqS6xDUf.js';
|
|
26
28
|
import { flushSync } from 'react-dom';
|
|
27
|
-
import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-
|
|
29
|
+
import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-DjqeAJZ9.js';
|
|
28
30
|
import { S as SvgKeyboardArrowLeft } from './keyboard_arrow_left-CiE1n99w.js';
|
|
29
31
|
import { S as SvgKeyboardArrowRight } from './keyboard_arrow_right-DMloHg_F.js';
|
|
30
|
-
import { a as Pagination, P as Pagination$1 } from './Pagination-
|
|
32
|
+
import { a as Pagination, P as Pagination$1 } from './Pagination-Dtgyk0Xr.js';
|
|
31
33
|
import { useTrackingId } from './useTrackingId.js';
|
|
32
34
|
import { T as ThemeProviderContext } from './ThemeProviderContext-l52GohYT.js';
|
|
33
35
|
import { u as useVirtualizer } from './index-DXeGMe23.js';
|
|
@@ -35,20 +37,214 @@ import { u as useOptionallyControlledState } from './useOptionallyControlledStat
|
|
|
35
37
|
import { u as usePrefersColorScheme } from './usePrefersColorScheme-_hT7dK7_.js';
|
|
36
38
|
import { S as Spinner } from './Spinner-B7tTWcP6.js';
|
|
37
39
|
|
|
38
|
-
import './DataTable.css';const
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
40
|
+
import './DataTable.css';const SvgResizeWindowAlt = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M4.4 21 21 4.425 19.575 3 3 19.575zm10.025 0L21 14.425 19.575 13 13 19.575z" }));
|
|
41
|
+
|
|
42
|
+
const SURFACE_VIEWPORT_PADDING = 8;
|
|
43
|
+
const SURFACE_MIN_WIDTH = 240;
|
|
44
|
+
const SURFACE_MIN_HEIGHT = 120;
|
|
45
|
+
function clampValue(value, min, max) {
|
|
46
|
+
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
47
|
+
}
|
|
48
|
+
function getMaxSurfaceWidth(viewport, x) {
|
|
49
|
+
return Math.max(
|
|
50
|
+
SURFACE_MIN_WIDTH,
|
|
51
|
+
viewport.width - x - SURFACE_VIEWPORT_PADDING
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function getMaxSurfaceHeight(viewport, y) {
|
|
55
|
+
return Math.max(
|
|
56
|
+
SURFACE_MIN_HEIGHT,
|
|
57
|
+
viewport.height - y - SURFACE_VIEWPORT_PADDING
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function isFiniteRect(rect) {
|
|
61
|
+
return Number.isFinite(rect.x) && Number.isFinite(rect.y) && Number.isFinite(rect.width) && Number.isFinite(rect.height) && rect.width > 0 && rect.height > 0;
|
|
62
|
+
}
|
|
63
|
+
function getEffectiveSurfaceHeight(geometry, options) {
|
|
64
|
+
if (geometry.height !== null) return geometry.height;
|
|
65
|
+
return options.measuredHeight ?? SURFACE_MIN_HEIGHT;
|
|
66
|
+
}
|
|
67
|
+
function toSurfaceRect(geometry, options) {
|
|
68
|
+
return {
|
|
69
|
+
x: geometry.x,
|
|
70
|
+
y: geometry.y,
|
|
71
|
+
width: geometry.width,
|
|
72
|
+
height: getEffectiveSurfaceHeight(geometry, options)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function hasStrictRectIntersection(rect, boundary) {
|
|
76
|
+
return rect.x + rect.width > boundary.x && boundary.x + boundary.width > rect.x && rect.y + rect.height > boundary.y && boundary.y + boundary.height > rect.y;
|
|
77
|
+
}
|
|
78
|
+
function getAxisCorrection({
|
|
79
|
+
boundarySize,
|
|
80
|
+
boundaryStart,
|
|
81
|
+
max,
|
|
82
|
+
min,
|
|
83
|
+
size,
|
|
84
|
+
start
|
|
85
|
+
}) {
|
|
86
|
+
const boundaryEnd = boundaryStart + boundarySize;
|
|
87
|
+
const end = start + size;
|
|
88
|
+
if (end > boundaryStart && start < boundaryEnd) {
|
|
89
|
+
return { value: start, delta: 0 };
|
|
90
|
+
}
|
|
91
|
+
const target = end <= boundaryStart ? boundaryStart - size + 1 : boundaryEnd - 1;
|
|
92
|
+
const value = clampValue(target, min, max);
|
|
93
|
+
if (value + size <= boundaryStart || value >= boundaryEnd) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return { value, delta: Math.abs(value - start) };
|
|
97
|
+
}
|
|
98
|
+
function restoreBoundaryIntersection(geometry, viewport, options) {
|
|
99
|
+
const boundary = options.intersectionBoundary;
|
|
100
|
+
if (!boundary || !isFiniteRect(boundary)) return geometry;
|
|
101
|
+
const rect = toSurfaceRect(geometry, options);
|
|
102
|
+
if (hasStrictRectIntersection(rect, boundary)) return geometry;
|
|
103
|
+
const xCorrection = getAxisCorrection({
|
|
104
|
+
boundarySize: boundary.width,
|
|
105
|
+
boundaryStart: boundary.x,
|
|
106
|
+
max: viewport.width - SURFACE_VIEWPORT_PADDING - rect.width,
|
|
107
|
+
min: SURFACE_VIEWPORT_PADDING,
|
|
108
|
+
size: rect.width,
|
|
109
|
+
start: geometry.x
|
|
110
|
+
});
|
|
111
|
+
const yCorrection = getAxisCorrection({
|
|
112
|
+
boundarySize: boundary.height,
|
|
113
|
+
boundaryStart: boundary.y,
|
|
114
|
+
max: viewport.height - SURFACE_VIEWPORT_PADDING - rect.height,
|
|
115
|
+
min: SURFACE_VIEWPORT_PADDING,
|
|
116
|
+
size: rect.height,
|
|
117
|
+
start: geometry.y
|
|
118
|
+
});
|
|
119
|
+
if (!xCorrection || !yCorrection) return geometry;
|
|
120
|
+
const xCorrected = {
|
|
121
|
+
...geometry,
|
|
122
|
+
x: xCorrection.value
|
|
123
|
+
};
|
|
124
|
+
const yCorrected = {
|
|
125
|
+
...geometry,
|
|
126
|
+
y: yCorrection.value
|
|
127
|
+
};
|
|
128
|
+
const xCorrectionIntersects = hasStrictRectIntersection(
|
|
129
|
+
toSurfaceRect(xCorrected, options),
|
|
130
|
+
boundary
|
|
131
|
+
);
|
|
132
|
+
const yCorrectionIntersects = hasStrictRectIntersection(
|
|
133
|
+
toSurfaceRect(yCorrected, options),
|
|
134
|
+
boundary
|
|
135
|
+
);
|
|
136
|
+
if (xCorrectionIntersects && yCorrectionIntersects) {
|
|
137
|
+
return xCorrection.delta <= yCorrection.delta ? xCorrected : yCorrected;
|
|
138
|
+
}
|
|
139
|
+
if (xCorrectionIntersects) return xCorrected;
|
|
140
|
+
if (yCorrectionIntersects) return yCorrected;
|
|
141
|
+
const corrected = {
|
|
142
|
+
...geometry,
|
|
143
|
+
x: xCorrection.value,
|
|
144
|
+
y: yCorrection.value
|
|
145
|
+
};
|
|
146
|
+
if (!hasStrictRectIntersection(toSurfaceRect(corrected, options), boundary)) {
|
|
147
|
+
return geometry;
|
|
148
|
+
}
|
|
149
|
+
return corrected;
|
|
150
|
+
}
|
|
151
|
+
function clampSurfaceGeometry(geometry, viewport, options = {}) {
|
|
152
|
+
const width = clampValue(
|
|
153
|
+
geometry.width,
|
|
154
|
+
SURFACE_MIN_WIDTH,
|
|
155
|
+
Math.max(SURFACE_MIN_WIDTH, viewport.width - SURFACE_VIEWPORT_PADDING * 2)
|
|
156
|
+
);
|
|
157
|
+
const effectiveHeight = clampValue(
|
|
158
|
+
getEffectiveSurfaceHeight(geometry, options),
|
|
159
|
+
SURFACE_MIN_HEIGHT,
|
|
160
|
+
Math.max(
|
|
161
|
+
SURFACE_MIN_HEIGHT,
|
|
162
|
+
viewport.height - SURFACE_VIEWPORT_PADDING * 2
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
const x = clampValue(
|
|
166
|
+
geometry.x,
|
|
167
|
+
SURFACE_VIEWPORT_PADDING,
|
|
168
|
+
viewport.width - SURFACE_VIEWPORT_PADDING - width
|
|
169
|
+
);
|
|
170
|
+
const y = clampValue(
|
|
171
|
+
geometry.y,
|
|
172
|
+
SURFACE_VIEWPORT_PADDING,
|
|
173
|
+
viewport.height - SURFACE_VIEWPORT_PADDING - effectiveHeight
|
|
174
|
+
);
|
|
175
|
+
const height = geometry.height === null ? null : clampValue(
|
|
176
|
+
geometry.height,
|
|
177
|
+
SURFACE_MIN_HEIGHT,
|
|
178
|
+
getMaxSurfaceHeight(viewport, y)
|
|
179
|
+
);
|
|
180
|
+
return restoreBoundaryIntersection(
|
|
181
|
+
{
|
|
182
|
+
...geometry,
|
|
183
|
+
x,
|
|
184
|
+
y,
|
|
185
|
+
width: clampValue(
|
|
186
|
+
width,
|
|
187
|
+
SURFACE_MIN_WIDTH,
|
|
188
|
+
getMaxSurfaceWidth(viewport, x)
|
|
189
|
+
),
|
|
190
|
+
height
|
|
191
|
+
},
|
|
192
|
+
viewport,
|
|
193
|
+
options
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
function clampActiveResizeSurfaceGeometry(geometry, viewport) {
|
|
197
|
+
return {
|
|
198
|
+
...geometry,
|
|
199
|
+
width: clampValue(
|
|
200
|
+
geometry.width,
|
|
201
|
+
SURFACE_MIN_WIDTH,
|
|
202
|
+
getMaxSurfaceWidth(viewport, geometry.x)
|
|
203
|
+
),
|
|
204
|
+
height: geometry.height === null ? null : clampValue(
|
|
205
|
+
geometry.height,
|
|
206
|
+
SURFACE_MIN_HEIGHT,
|
|
207
|
+
getMaxSurfaceHeight(viewport, geometry.y)
|
|
208
|
+
)
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function restoreSurfaceGeometryIntersection(geometry, viewport, options = {}) {
|
|
212
|
+
const effectiveHeight = getEffectiveSurfaceHeight(geometry, options);
|
|
213
|
+
return restoreBoundaryIntersection(
|
|
214
|
+
{
|
|
215
|
+
...geometry,
|
|
216
|
+
x: clampValue(
|
|
217
|
+
geometry.x,
|
|
218
|
+
SURFACE_VIEWPORT_PADDING,
|
|
219
|
+
viewport.width - SURFACE_VIEWPORT_PADDING - geometry.width
|
|
220
|
+
),
|
|
221
|
+
y: clampValue(
|
|
222
|
+
geometry.y,
|
|
223
|
+
SURFACE_VIEWPORT_PADDING,
|
|
224
|
+
viewport.height - SURFACE_VIEWPORT_PADDING - effectiveHeight
|
|
225
|
+
)
|
|
226
|
+
},
|
|
227
|
+
viewport,
|
|
228
|
+
options
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const surface = "_surface_9apry_1";
|
|
233
|
+
const header = "_header_9apry_55";
|
|
234
|
+
const title = "_title_9apry_83";
|
|
235
|
+
const content = "_content_9apry_110";
|
|
42
236
|
const styles$i = {
|
|
43
237
|
surface: surface,
|
|
44
238
|
header: header,
|
|
45
|
-
"header-bottom-border": "_header-bottom-
|
|
46
|
-
"header-copy": "_header-
|
|
239
|
+
"header-bottom-border": "_header-bottom-border_9apry_71",
|
|
240
|
+
"header-copy": "_header-copy_9apry_75",
|
|
47
241
|
title: title,
|
|
48
|
-
"header-actions": "_header-
|
|
49
|
-
"close-button": "_close-
|
|
242
|
+
"header-actions": "_header-actions_9apry_91",
|
|
243
|
+
"close-button": "_close-button_9apry_98",
|
|
244
|
+
"drag-handle": "_drag-handle_9apry_102",
|
|
50
245
|
content: content,
|
|
51
|
-
"content-title-spacing": "_content-title-
|
|
246
|
+
"content-title-spacing": "_content-title-spacing_9apry_122",
|
|
247
|
+
"resize-handle": "_resize-handle_9apry_127"
|
|
52
248
|
};
|
|
53
249
|
|
|
54
250
|
const SurfaceContext = createContext(null);
|
|
@@ -77,6 +273,63 @@ function resolveCssDimension(value, fallback) {
|
|
|
77
273
|
if (typeof value === "string") return value;
|
|
78
274
|
return fallback;
|
|
79
275
|
}
|
|
276
|
+
const SURFACE_KEYBOARD_STEP = 8;
|
|
277
|
+
const SURFACE_KEYBOARD_SHIFT_STEP = 32;
|
|
278
|
+
const SURFACE_KEYBOARD_STEP_INTERVAL_MS = 33;
|
|
279
|
+
const SURFACE_ARROW_KEYS = [
|
|
280
|
+
"ArrowLeft",
|
|
281
|
+
"ArrowRight",
|
|
282
|
+
"ArrowUp",
|
|
283
|
+
"ArrowDown"
|
|
284
|
+
];
|
|
285
|
+
function createSurfacePressedArrowKeys() {
|
|
286
|
+
return {
|
|
287
|
+
ArrowLeft: false,
|
|
288
|
+
ArrowRight: false,
|
|
289
|
+
ArrowUp: false,
|
|
290
|
+
ArrowDown: false
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function isSurfaceArrowKey(key) {
|
|
294
|
+
return SURFACE_ARROW_KEYS.some((arrowKey) => arrowKey === key);
|
|
295
|
+
}
|
|
296
|
+
function getKeyboardAxisDelta(pressedKeys) {
|
|
297
|
+
return {
|
|
298
|
+
x: Number(pressedKeys.ArrowRight) - Number(pressedKeys.ArrowLeft),
|
|
299
|
+
y: Number(pressedKeys.ArrowDown) - Number(pressedKeys.ArrowUp)
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function hasPressedSurfaceArrowKey(pressedKeys) {
|
|
303
|
+
return SURFACE_ARROW_KEYS.some((arrowKey) => pressedKeys[arrowKey]);
|
|
304
|
+
}
|
|
305
|
+
function hasKeyboardAxisDelta(axis) {
|
|
306
|
+
return axis.x !== 0 || axis.y !== 0;
|
|
307
|
+
}
|
|
308
|
+
function parsePixelDimension(value) {
|
|
309
|
+
const numericValue = Number.parseFloat(value);
|
|
310
|
+
if (!Number.isFinite(numericValue)) return null;
|
|
311
|
+
if (value.trim().endsWith("px")) return numericValue;
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
function getViewportSize() {
|
|
315
|
+
return {
|
|
316
|
+
width: window.innerWidth,
|
|
317
|
+
height: window.innerHeight
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function getMeasuredSurfaceHeight(element) {
|
|
321
|
+
return element.getBoundingClientRect().height;
|
|
322
|
+
}
|
|
323
|
+
function getInteractionStep(shiftKey) {
|
|
324
|
+
return shiftKey ? SURFACE_KEYBOARD_SHIFT_STEP : SURFACE_KEYBOARD_STEP;
|
|
325
|
+
}
|
|
326
|
+
function getElementDimension(element, authoredValue, fallback, dimension) {
|
|
327
|
+
const parsedValue = parsePixelDimension(authoredValue);
|
|
328
|
+
if (parsedValue !== null) return parsedValue;
|
|
329
|
+
const rect = element.getBoundingClientRect();
|
|
330
|
+
const measuredValue = rect.width ;
|
|
331
|
+
return measuredValue > 0 ? measuredValue : fallback;
|
|
332
|
+
}
|
|
80
333
|
const SurfaceContent = forwardRef(
|
|
81
334
|
function SurfaceContent2(props, ref) {
|
|
82
335
|
const {
|
|
@@ -86,6 +339,7 @@ const SurfaceContent = forwardRef(
|
|
|
86
339
|
title,
|
|
87
340
|
headerContent,
|
|
88
341
|
initialFocusRef,
|
|
342
|
+
intersectionBoundaryRef,
|
|
89
343
|
width,
|
|
90
344
|
maxHeight,
|
|
91
345
|
closeButtonLabel = "Close surface",
|
|
@@ -95,16 +349,149 @@ const SurfaceContent = forwardRef(
|
|
|
95
349
|
...rest
|
|
96
350
|
} = props;
|
|
97
351
|
const { open, referenceElement, surfaceId } = useSurfaceContext();
|
|
352
|
+
const breakpoint = useBreakpoint();
|
|
353
|
+
const isDrawerMode = breakpoint ? !breakpoint.md : false;
|
|
354
|
+
const [localElement, setLocalElement] = useState(
|
|
355
|
+
null
|
|
356
|
+
);
|
|
98
357
|
const localRef = useRef(null);
|
|
99
|
-
const
|
|
358
|
+
const setLocalRef = useCallback((node) => {
|
|
359
|
+
localRef.current = node;
|
|
360
|
+
setLocalElement(node);
|
|
361
|
+
}, []);
|
|
362
|
+
const surfaceRef = useMergeRefs([setLocalRef, ref]);
|
|
100
363
|
const layerId = `${surfaceId}-layer`;
|
|
101
364
|
const titleId = `${surfaceId}-title`;
|
|
102
365
|
const resolvedWidth = resolveCssDimension(width, "325px");
|
|
103
366
|
const resolvedMaxHeight = resolveCssDimension(maxHeight, "450px");
|
|
104
367
|
const handleCancel = onCancel ?? onClose;
|
|
368
|
+
const [geometry, setGeometry] = useState(null);
|
|
369
|
+
const interactionRef = useRef({ type: "idle" });
|
|
370
|
+
const keyboardInteractionModeRef = useRef(null);
|
|
371
|
+
const pressedArrowKeysRef = useRef(
|
|
372
|
+
createSurfacePressedArrowKeys()
|
|
373
|
+
);
|
|
374
|
+
const keyboardShiftKeyRef = useRef(false);
|
|
375
|
+
const keyboardAnimationFrameRef = useRef(null);
|
|
376
|
+
const keyboardLastStepTimestampRef = useRef(null);
|
|
377
|
+
const getClampOptions = useCallback(
|
|
378
|
+
(measuredHeight) => {
|
|
379
|
+
const boundaryRect = intersectionBoundaryRef?.current?.getBoundingClientRect();
|
|
380
|
+
const intersectionBoundary = boundaryRect ? {
|
|
381
|
+
x: boundaryRect.x,
|
|
382
|
+
y: boundaryRect.y,
|
|
383
|
+
width: boundaryRect.width,
|
|
384
|
+
height: boundaryRect.height
|
|
385
|
+
} : null;
|
|
386
|
+
return {
|
|
387
|
+
measuredHeight,
|
|
388
|
+
intersectionBoundary
|
|
389
|
+
};
|
|
390
|
+
},
|
|
391
|
+
[intersectionBoundaryRef]
|
|
392
|
+
);
|
|
393
|
+
const restoreResizeIntersection = useCallback(() => {
|
|
394
|
+
const viewport = getViewportSize();
|
|
395
|
+
const measuredHeight = localRef.current ? getMeasuredSurfaceHeight(localRef.current) : void 0;
|
|
396
|
+
const clampOptions = getClampOptions(measuredHeight);
|
|
397
|
+
setGeometry(
|
|
398
|
+
(currentGeometry) => currentGeometry ? restoreSurfaceGeometryIntersection(
|
|
399
|
+
currentGeometry,
|
|
400
|
+
viewport,
|
|
401
|
+
clampOptions
|
|
402
|
+
) : currentGeometry
|
|
403
|
+
);
|
|
404
|
+
}, [getClampOptions]);
|
|
405
|
+
const cancelKeyboardAnimationFrame = useCallback(() => {
|
|
406
|
+
if (keyboardAnimationFrameRef.current !== null) {
|
|
407
|
+
window.cancelAnimationFrame(keyboardAnimationFrameRef.current);
|
|
408
|
+
keyboardAnimationFrameRef.current = null;
|
|
409
|
+
}
|
|
410
|
+
keyboardLastStepTimestampRef.current = null;
|
|
411
|
+
}, []);
|
|
412
|
+
const clearKeyboardInteraction = useCallback(() => {
|
|
413
|
+
cancelKeyboardAnimationFrame();
|
|
414
|
+
keyboardInteractionModeRef.current = null;
|
|
415
|
+
pressedArrowKeysRef.current = createSurfacePressedArrowKeys();
|
|
416
|
+
keyboardShiftKeyRef.current = false;
|
|
417
|
+
}, [cancelKeyboardAnimationFrame]);
|
|
418
|
+
const applyKeyboardInteractionStep = useCallback(() => {
|
|
419
|
+
const mode = keyboardInteractionModeRef.current;
|
|
420
|
+
if (!mode) return;
|
|
421
|
+
const axis = getKeyboardAxisDelta(pressedArrowKeysRef.current);
|
|
422
|
+
if (!hasKeyboardAxisDelta(axis)) return;
|
|
423
|
+
const step = getInteractionStep(keyboardShiftKeyRef.current);
|
|
424
|
+
const viewport = getViewportSize();
|
|
425
|
+
if (mode === "drag") {
|
|
426
|
+
const measuredHeight = localRef.current ? getMeasuredSurfaceHeight(localRef.current) : void 0;
|
|
427
|
+
const clampOptions = getClampOptions(measuredHeight);
|
|
428
|
+
setGeometry(
|
|
429
|
+
(currentGeometry) => currentGeometry ? clampSurfaceGeometry(
|
|
430
|
+
{
|
|
431
|
+
...currentGeometry,
|
|
432
|
+
x: currentGeometry.x + axis.x * step,
|
|
433
|
+
y: currentGeometry.y + axis.y * step,
|
|
434
|
+
isUserModified: true
|
|
435
|
+
},
|
|
436
|
+
viewport,
|
|
437
|
+
clampOptions
|
|
438
|
+
) : currentGeometry
|
|
439
|
+
);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
setGeometry((currentGeometry) => {
|
|
443
|
+
if (!currentGeometry || !localRef.current) return currentGeometry;
|
|
444
|
+
const rect = localRef.current.getBoundingClientRect();
|
|
445
|
+
return clampActiveResizeSurfaceGeometry(
|
|
446
|
+
{
|
|
447
|
+
...currentGeometry,
|
|
448
|
+
width: currentGeometry.width + axis.x * step,
|
|
449
|
+
height: (currentGeometry.height ?? rect.height) + axis.y * step,
|
|
450
|
+
isUserModified: true,
|
|
451
|
+
hasUserResized: true
|
|
452
|
+
},
|
|
453
|
+
viewport
|
|
454
|
+
);
|
|
455
|
+
});
|
|
456
|
+
}, [getClampOptions]);
|
|
457
|
+
const runKeyboardInteractionFrame = useCallback(
|
|
458
|
+
(timestamp) => {
|
|
459
|
+
const mode = keyboardInteractionModeRef.current;
|
|
460
|
+
const pressedKeys = pressedArrowKeysRef.current;
|
|
461
|
+
if (!mode || !hasPressedSurfaceArrowKey(pressedKeys)) {
|
|
462
|
+
clearKeyboardInteraction();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const axis = getKeyboardAxisDelta(pressedKeys);
|
|
466
|
+
if (!hasKeyboardAxisDelta(axis)) {
|
|
467
|
+
cancelKeyboardAnimationFrame();
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
const lastStepTimestamp = keyboardLastStepTimestampRef.current;
|
|
471
|
+
if (lastStepTimestamp === null || timestamp - lastStepTimestamp >= SURFACE_KEYBOARD_STEP_INTERVAL_MS) {
|
|
472
|
+
keyboardLastStepTimestampRef.current = timestamp;
|
|
473
|
+
applyKeyboardInteractionStep();
|
|
474
|
+
}
|
|
475
|
+
keyboardAnimationFrameRef.current = window.requestAnimationFrame(
|
|
476
|
+
runKeyboardInteractionFrame
|
|
477
|
+
);
|
|
478
|
+
},
|
|
479
|
+
[
|
|
480
|
+
applyKeyboardInteractionStep,
|
|
481
|
+
cancelKeyboardAnimationFrame,
|
|
482
|
+
clearKeyboardInteraction
|
|
483
|
+
]
|
|
484
|
+
);
|
|
485
|
+
const startKeyboardInteractionLoop = useCallback(() => {
|
|
486
|
+
if (keyboardAnimationFrameRef.current !== null) return;
|
|
487
|
+
keyboardLastStepTimestampRef.current = null;
|
|
488
|
+
keyboardAnimationFrameRef.current = window.requestAnimationFrame(
|
|
489
|
+
runKeyboardInteractionFrame
|
|
490
|
+
);
|
|
491
|
+
}, [runKeyboardInteractionFrame]);
|
|
105
492
|
useOnClickOutside({
|
|
106
493
|
targets: [
|
|
107
|
-
|
|
494
|
+
localElement ?? void 0,
|
|
108
495
|
referenceElement.current ?? void 0
|
|
109
496
|
],
|
|
110
497
|
onClickOutside: () => {
|
|
@@ -114,10 +501,12 @@ const SurfaceContent = forwardRef(
|
|
|
114
501
|
layerId
|
|
115
502
|
});
|
|
116
503
|
const updatePosition = useCallback(async () => {
|
|
117
|
-
if (!localRef.current || !referenceElement.current)
|
|
504
|
+
if (isDrawerMode || !localRef.current || !referenceElement.current)
|
|
505
|
+
return;
|
|
506
|
+
const surfaceElement = localRef.current;
|
|
118
507
|
const position = await computePosition(
|
|
119
508
|
referenceElement.current,
|
|
120
|
-
|
|
509
|
+
surfaceElement,
|
|
121
510
|
{
|
|
122
511
|
placement: "bottom-start",
|
|
123
512
|
middleware: [
|
|
@@ -129,14 +518,15 @@ const SurfaceContent = forwardRef(
|
|
|
129
518
|
"top-start",
|
|
130
519
|
"top-end"
|
|
131
520
|
],
|
|
132
|
-
padding:
|
|
521
|
+
padding: SURFACE_VIEWPORT_PADDING
|
|
133
522
|
}),
|
|
134
|
-
shift({ padding:
|
|
523
|
+
shift({ padding: SURFACE_VIEWPORT_PADDING }),
|
|
135
524
|
size({
|
|
136
|
-
padding:
|
|
525
|
+
padding: SURFACE_VIEWPORT_PADDING,
|
|
137
526
|
apply({ availableHeight, availableWidth, elements }) {
|
|
527
|
+
const isUserModified = elements.floating.getAttribute("data-user-modified") === "true";
|
|
138
528
|
Object.assign(elements.floating.style, {
|
|
139
|
-
width: resolvedWidth,
|
|
529
|
+
width: isUserModified ? elements.floating.style.width : resolvedWidth,
|
|
140
530
|
maxWidth: `${Math.max(0, availableWidth)}px`,
|
|
141
531
|
maxHeight: `min(${resolvedMaxHeight}, ${Math.max(0, availableHeight)}px)`
|
|
142
532
|
});
|
|
@@ -145,24 +535,65 @@ const SurfaceContent = forwardRef(
|
|
|
145
535
|
]
|
|
146
536
|
}
|
|
147
537
|
);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
538
|
+
const viewport = getViewportSize();
|
|
539
|
+
const measuredWidth = getElementDimension(
|
|
540
|
+
surfaceElement,
|
|
541
|
+
resolvedWidth,
|
|
542
|
+
325);
|
|
543
|
+
const measuredHeight = getMeasuredSurfaceHeight(surfaceElement);
|
|
544
|
+
const clampOptions = getClampOptions(measuredHeight);
|
|
545
|
+
setGeometry((currentGeometry) => {
|
|
546
|
+
if (currentGeometry?.isUserModified) {
|
|
547
|
+
return clampSurfaceGeometry(currentGeometry, viewport, clampOptions);
|
|
548
|
+
}
|
|
549
|
+
return clampSurfaceGeometry(
|
|
550
|
+
{
|
|
551
|
+
x: position.x,
|
|
552
|
+
y: position.y,
|
|
553
|
+
width: measuredWidth,
|
|
554
|
+
height: null,
|
|
555
|
+
isUserModified: false,
|
|
556
|
+
hasUserResized: false
|
|
557
|
+
},
|
|
558
|
+
viewport,
|
|
559
|
+
clampOptions
|
|
560
|
+
);
|
|
561
|
+
});
|
|
562
|
+
}, [
|
|
563
|
+
getClampOptions,
|
|
564
|
+
isDrawerMode,
|
|
565
|
+
referenceElement,
|
|
566
|
+
resolvedMaxHeight,
|
|
567
|
+
resolvedWidth
|
|
568
|
+
]);
|
|
151
569
|
useEffect(() => {
|
|
152
|
-
if (!open || !localRef.current || !referenceElement.current)
|
|
570
|
+
if (isDrawerMode || !open || !localRef.current || !referenceElement.current) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
153
573
|
return autoUpdate(referenceElement.current, localRef.current, () => {
|
|
154
574
|
void updatePosition();
|
|
155
575
|
});
|
|
156
|
-
}, [open, referenceElement, updatePosition]);
|
|
576
|
+
}, [isDrawerMode, open, referenceElement, updatePosition]);
|
|
157
577
|
useEffect(() => {
|
|
158
578
|
if (!localRef.current) return;
|
|
159
579
|
if (open) {
|
|
160
580
|
safeShowPopover(localRef.current);
|
|
161
|
-
|
|
581
|
+
if (!isDrawerMode) {
|
|
582
|
+
void updatePosition();
|
|
583
|
+
}
|
|
162
584
|
return;
|
|
163
585
|
}
|
|
586
|
+
interactionRef.current = { type: "idle" };
|
|
587
|
+
clearKeyboardInteraction();
|
|
588
|
+
setGeometry(null);
|
|
164
589
|
safeHidePopover(localRef.current);
|
|
165
|
-
}, [open, updatePosition]);
|
|
590
|
+
}, [clearKeyboardInteraction, isDrawerMode, open, updatePosition]);
|
|
591
|
+
useEffect(() => {
|
|
592
|
+
if (!isDrawerMode) return;
|
|
593
|
+
interactionRef.current = { type: "idle" };
|
|
594
|
+
clearKeyboardInteraction();
|
|
595
|
+
setGeometry(null);
|
|
596
|
+
}, [clearKeyboardInteraction, isDrawerMode]);
|
|
166
597
|
useEffect(() => {
|
|
167
598
|
if (!open) return;
|
|
168
599
|
registerLayer(layerId);
|
|
@@ -170,6 +601,11 @@ const SurfaceContent = forwardRef(
|
|
|
170
601
|
unregisterLayer(layerId);
|
|
171
602
|
};
|
|
172
603
|
}, [layerId, open]);
|
|
604
|
+
useEffect(() => {
|
|
605
|
+
return () => {
|
|
606
|
+
clearKeyboardInteraction();
|
|
607
|
+
};
|
|
608
|
+
}, [clearKeyboardInteraction]);
|
|
173
609
|
useEffect(() => {
|
|
174
610
|
if (!open || !initialFocusRef?.current) return;
|
|
175
611
|
const focusHandle = window.requestAnimationFrame(() => {
|
|
@@ -179,10 +615,8 @@ const SurfaceContent = forwardRef(
|
|
|
179
615
|
window.cancelAnimationFrame(focusHandle);
|
|
180
616
|
};
|
|
181
617
|
}, [initialFocusRef, open]);
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (!surfaceElement) return;
|
|
185
|
-
const handleSurfaceKeyDown = (event) => {
|
|
618
|
+
const handleSurfaceKeyDown = useCallback(
|
|
619
|
+
(event) => {
|
|
186
620
|
onKeyDown?.(event);
|
|
187
621
|
if (event.defaultPrevented) return;
|
|
188
622
|
if (event.key === "Escape") {
|
|
@@ -190,73 +624,286 @@ const SurfaceContent = forwardRef(
|
|
|
190
624
|
event.stopPropagation();
|
|
191
625
|
handleCancel();
|
|
192
626
|
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
627
|
+
},
|
|
628
|
+
[handleCancel, onKeyDown]
|
|
629
|
+
);
|
|
630
|
+
const handleDragPointerDown = useCallback(
|
|
631
|
+
(event) => {
|
|
632
|
+
if (event.button !== 0 || isDrawerMode || !geometry) return;
|
|
633
|
+
event.preventDefault();
|
|
634
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
635
|
+
interactionRef.current = {
|
|
636
|
+
type: "dragging",
|
|
637
|
+
pointerId: event.pointerId,
|
|
638
|
+
startClientX: event.clientX,
|
|
639
|
+
startClientY: event.clientY,
|
|
640
|
+
startX: geometry.x,
|
|
641
|
+
startY: geometry.y
|
|
642
|
+
};
|
|
643
|
+
},
|
|
644
|
+
[geometry, isDrawerMode]
|
|
645
|
+
);
|
|
646
|
+
const handleResizePointerDown = useCallback(
|
|
647
|
+
(event) => {
|
|
648
|
+
if (event.button !== 0 || isDrawerMode || !geometry || !localRef.current) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const rect = localRef.current.getBoundingClientRect();
|
|
652
|
+
event.preventDefault();
|
|
653
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
654
|
+
interactionRef.current = {
|
|
655
|
+
type: "resizing",
|
|
656
|
+
pointerId: event.pointerId,
|
|
657
|
+
startClientX: event.clientX,
|
|
658
|
+
startClientY: event.clientY,
|
|
659
|
+
startWidth: rect.width > 0 ? rect.width : geometry.width,
|
|
660
|
+
startHeight: geometry.height ?? rect.height
|
|
661
|
+
};
|
|
662
|
+
},
|
|
663
|
+
[geometry, isDrawerMode]
|
|
664
|
+
);
|
|
665
|
+
const handleInteractionPointerMove = useCallback(
|
|
666
|
+
(event) => {
|
|
667
|
+
const interaction = interactionRef.current;
|
|
668
|
+
if (interaction.type === "idle" || interaction.pointerId !== event.pointerId) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
event.preventDefault();
|
|
672
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
673
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
674
|
+
const viewport = getViewportSize();
|
|
675
|
+
const measuredHeight = localRef.current ? getMeasuredSurfaceHeight(localRef.current) : void 0;
|
|
676
|
+
const clampOptions = getClampOptions(measuredHeight);
|
|
677
|
+
setGeometry((currentGeometry) => {
|
|
678
|
+
if (!currentGeometry) return currentGeometry;
|
|
679
|
+
if (interaction.type === "dragging") {
|
|
680
|
+
return clampSurfaceGeometry(
|
|
681
|
+
{
|
|
682
|
+
...currentGeometry,
|
|
683
|
+
x: interaction.startX + deltaX,
|
|
684
|
+
y: interaction.startY + deltaY,
|
|
685
|
+
isUserModified: true
|
|
686
|
+
},
|
|
687
|
+
viewport,
|
|
688
|
+
clampOptions
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
return clampActiveResizeSurfaceGeometry(
|
|
692
|
+
{
|
|
693
|
+
...currentGeometry,
|
|
694
|
+
width: interaction.startWidth + deltaX,
|
|
695
|
+
height: interaction.startHeight + deltaY,
|
|
696
|
+
isUserModified: true,
|
|
697
|
+
hasUserResized: true
|
|
698
|
+
},
|
|
699
|
+
viewport
|
|
700
|
+
);
|
|
701
|
+
});
|
|
702
|
+
},
|
|
703
|
+
[getClampOptions]
|
|
704
|
+
);
|
|
705
|
+
const handleInteractionPointerEnd = useCallback(
|
|
706
|
+
(event) => {
|
|
707
|
+
const interaction = interactionRef.current;
|
|
708
|
+
if (interaction.type === "idle" || interaction.pointerId !== event.pointerId) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
const shouldRestoreIntersection = interaction.type === "resizing";
|
|
712
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
713
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
714
|
+
}
|
|
715
|
+
interactionRef.current = { type: "idle" };
|
|
716
|
+
if (shouldRestoreIntersection) {
|
|
717
|
+
restoreResizeIntersection();
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
[restoreResizeIntersection]
|
|
721
|
+
);
|
|
722
|
+
const handleDragKeyboardInteractionBlur = useCallback(() => {
|
|
723
|
+
clearKeyboardInteraction();
|
|
724
|
+
}, [clearKeyboardInteraction]);
|
|
725
|
+
const handleResizeKeyboardInteractionBlur = useCallback(() => {
|
|
726
|
+
restoreResizeIntersection();
|
|
727
|
+
clearKeyboardInteraction();
|
|
728
|
+
}, [clearKeyboardInteraction, restoreResizeIntersection]);
|
|
729
|
+
const handleDragKeyDown = useCallback(
|
|
730
|
+
(event) => {
|
|
731
|
+
if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
|
|
732
|
+
event.preventDefault();
|
|
733
|
+
event.stopPropagation();
|
|
734
|
+
pressedArrowKeysRef.current[event.key] = true;
|
|
735
|
+
keyboardShiftKeyRef.current = event.shiftKey;
|
|
736
|
+
keyboardInteractionModeRef.current = "drag";
|
|
737
|
+
startKeyboardInteractionLoop();
|
|
738
|
+
},
|
|
739
|
+
[isDrawerMode, startKeyboardInteractionLoop]
|
|
740
|
+
);
|
|
741
|
+
const handleDragKeyUp = useCallback(
|
|
742
|
+
(event) => {
|
|
743
|
+
if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
|
|
744
|
+
event.preventDefault();
|
|
745
|
+
event.stopPropagation();
|
|
746
|
+
pressedArrowKeysRef.current[event.key] = false;
|
|
747
|
+
keyboardShiftKeyRef.current = event.shiftKey;
|
|
748
|
+
if (!hasPressedSurfaceArrowKey(pressedArrowKeysRef.current)) {
|
|
749
|
+
clearKeyboardInteraction();
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
keyboardInteractionModeRef.current = "drag";
|
|
753
|
+
if (hasKeyboardAxisDelta(
|
|
754
|
+
getKeyboardAxisDelta(pressedArrowKeysRef.current)
|
|
755
|
+
)) {
|
|
756
|
+
startKeyboardInteractionLoop();
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
[clearKeyboardInteraction, isDrawerMode, startKeyboardInteractionLoop]
|
|
760
|
+
);
|
|
761
|
+
const handleResizeKeyDown = useCallback(
|
|
762
|
+
(event) => {
|
|
763
|
+
if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
|
|
764
|
+
event.preventDefault();
|
|
765
|
+
event.stopPropagation();
|
|
766
|
+
pressedArrowKeysRef.current[event.key] = true;
|
|
767
|
+
keyboardShiftKeyRef.current = event.shiftKey;
|
|
768
|
+
keyboardInteractionModeRef.current = "resize";
|
|
769
|
+
startKeyboardInteractionLoop();
|
|
770
|
+
},
|
|
771
|
+
[isDrawerMode, startKeyboardInteractionLoop]
|
|
772
|
+
);
|
|
773
|
+
const handleResizeKeyUp = useCallback(
|
|
774
|
+
(event) => {
|
|
775
|
+
if (isDrawerMode || !isSurfaceArrowKey(event.key)) return;
|
|
776
|
+
event.preventDefault();
|
|
777
|
+
event.stopPropagation();
|
|
778
|
+
pressedArrowKeysRef.current[event.key] = false;
|
|
779
|
+
keyboardShiftKeyRef.current = event.shiftKey;
|
|
780
|
+
if (!hasPressedSurfaceArrowKey(pressedArrowKeysRef.current)) {
|
|
781
|
+
restoreResizeIntersection();
|
|
782
|
+
clearKeyboardInteraction();
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
keyboardInteractionModeRef.current = "resize";
|
|
786
|
+
if (hasKeyboardAxisDelta(
|
|
787
|
+
getKeyboardAxisDelta(pressedArrowKeysRef.current)
|
|
788
|
+
)) {
|
|
789
|
+
startKeyboardInteractionLoop();
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
[
|
|
793
|
+
clearKeyboardInteraction,
|
|
794
|
+
isDrawerMode,
|
|
795
|
+
restoreResizeIntersection,
|
|
796
|
+
startKeyboardInteractionLoop
|
|
797
|
+
]
|
|
798
|
+
);
|
|
199
799
|
const defaultLabelProps = !("aria-label" in rest) && !("aria-labelledby" in rest) && title ? { "aria-labelledby": titleId } : {};
|
|
200
800
|
const dialogProps = {
|
|
201
|
-
role: "dialog",
|
|
801
|
+
role: open ? "dialog" : void 0,
|
|
202
802
|
"aria-modal": false
|
|
203
803
|
};
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
804
|
+
const surfaceStyle = isDrawerMode ? { ...style } : {
|
|
805
|
+
...style,
|
|
806
|
+
left: geometry ? `${geometry.x}px` : void 0,
|
|
807
|
+
top: geometry ? `${geometry.y}px` : void 0,
|
|
808
|
+
width: geometry ? `${geometry.width}px` : resolvedWidth,
|
|
809
|
+
maxWidth: geometry ? `${getMaxSurfaceWidth(getViewportSize(), geometry.x)}px` : void 0,
|
|
810
|
+
height: geometry?.hasUserResized && geometry.height !== null ? `${geometry.height}px` : void 0,
|
|
811
|
+
maxHeight: geometry?.hasUserResized && geometry.height !== null ? void 0 : resolvedMaxHeight
|
|
812
|
+
};
|
|
813
|
+
return (
|
|
814
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- Surface dialog handles keyboard shortcuts for moving and resizing its nested controls.
|
|
815
|
+
/* @__PURE__ */ jsxs(
|
|
816
|
+
"div",
|
|
817
|
+
{
|
|
818
|
+
...rest,
|
|
819
|
+
...defaultLabelProps,
|
|
820
|
+
id: surfaceId,
|
|
821
|
+
ref: surfaceRef,
|
|
822
|
+
popover: "manual",
|
|
823
|
+
...dialogProps,
|
|
824
|
+
tabIndex: -1,
|
|
825
|
+
className: cx(className, styles$i["surface"], portalScopeClassNames),
|
|
826
|
+
style: surfaceStyle,
|
|
827
|
+
onKeyDown: handleSurfaceKeyDown,
|
|
828
|
+
"data-anv": "surface-content",
|
|
829
|
+
"data-surface-variant": isDrawerMode ? "drawer" : "popover",
|
|
830
|
+
"data-user-modified": geometry?.isUserModified ? "true" : void 0,
|
|
831
|
+
children: [
|
|
832
|
+
/* @__PURE__ */ jsxs(
|
|
833
|
+
"div",
|
|
834
|
+
{
|
|
835
|
+
className: cx(styles$i["header"], {
|
|
836
|
+
[styles$i["header-bottom-border"]]: title
|
|
837
|
+
}),
|
|
838
|
+
children: [
|
|
839
|
+
/* @__PURE__ */ jsx("div", { className: styles$i["header-copy"], children: title ? /* @__PURE__ */ jsx("div", { id: titleId, className: styles$i["title"], children: title }) : null }),
|
|
840
|
+
/* @__PURE__ */ jsxs("div", { className: styles$i["header-actions"], children: [
|
|
841
|
+
headerContent,
|
|
842
|
+
!isDrawerMode ? /* @__PURE__ */ jsx(
|
|
843
|
+
Button,
|
|
844
|
+
{
|
|
845
|
+
appearance: "ghost",
|
|
846
|
+
"aria-label": "Move surface",
|
|
847
|
+
className: styles$i["drag-handle"],
|
|
848
|
+
"data-anv": "surface-drag-handle",
|
|
849
|
+
icon: SvgDragIndicator,
|
|
850
|
+
onBlur: handleDragKeyboardInteractionBlur,
|
|
851
|
+
onKeyDown: handleDragKeyDown,
|
|
852
|
+
onKeyUp: handleDragKeyUp,
|
|
853
|
+
onPointerCancel: handleInteractionPointerEnd,
|
|
854
|
+
onPointerDown: handleDragPointerDown,
|
|
855
|
+
onPointerMove: handleInteractionPointerMove,
|
|
856
|
+
onPointerUp: handleInteractionPointerEnd,
|
|
857
|
+
size: "small",
|
|
858
|
+
type: "button"
|
|
859
|
+
}
|
|
860
|
+
) : null,
|
|
861
|
+
/* @__PURE__ */ jsx(
|
|
862
|
+
Button,
|
|
863
|
+
{
|
|
864
|
+
appearance: "ghost",
|
|
865
|
+
"aria-label": closeButtonLabel,
|
|
866
|
+
className: styles$i["close-button"],
|
|
867
|
+
"data-anv": "surface-close-button",
|
|
868
|
+
icon: SvgClose,
|
|
869
|
+
onClick: onClose,
|
|
870
|
+
size: "small",
|
|
871
|
+
type: "button"
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
] })
|
|
875
|
+
]
|
|
876
|
+
}
|
|
877
|
+
),
|
|
878
|
+
/* @__PURE__ */ jsx(
|
|
879
|
+
"div",
|
|
880
|
+
{
|
|
881
|
+
className: cx(styles$i["content"], {
|
|
882
|
+
[styles$i["content-title-spacing"]]: title
|
|
883
|
+
}),
|
|
884
|
+
children
|
|
885
|
+
}
|
|
886
|
+
),
|
|
887
|
+
!isDrawerMode ? /* @__PURE__ */ jsx(
|
|
888
|
+
"button",
|
|
889
|
+
{
|
|
890
|
+
"aria-label": "Resize surface",
|
|
891
|
+
className: styles$i["resize-handle"],
|
|
892
|
+
"data-anv": "surface-resize-handle",
|
|
893
|
+
onBlur: handleResizeKeyboardInteractionBlur,
|
|
894
|
+
onKeyDown: handleResizeKeyDown,
|
|
895
|
+
onKeyUp: handleResizeKeyUp,
|
|
896
|
+
onPointerDown: handleResizePointerDown,
|
|
897
|
+
onPointerMove: handleInteractionPointerMove,
|
|
898
|
+
onPointerUp: handleInteractionPointerEnd,
|
|
899
|
+
onPointerCancel: handleInteractionPointerEnd,
|
|
900
|
+
type: "button",
|
|
901
|
+
children: /* @__PURE__ */ jsx(SvgResizeWindowAlt, { "aria-hidden": "true", "data-anv": "icon" })
|
|
902
|
+
}
|
|
903
|
+
) : null
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
)
|
|
260
907
|
);
|
|
261
908
|
}
|
|
262
909
|
);
|
|
@@ -311,19 +958,19 @@ const booleanFormatter = (value, { trueLabel = "True", falseLabel = "False" } =
|
|
|
311
958
|
};
|
|
312
959
|
|
|
313
960
|
const styles$h = {
|
|
314
|
-
"table-header-cell": "_table-header-
|
|
315
|
-
"table-body-cell": "_table-body-
|
|
316
|
-
"table-footer-cell": "_table-footer-
|
|
317
|
-
"last-pinned-left-column": "_last-pinned-left-
|
|
318
|
-
"first-pinned-right-column": "_first-pinned-right-
|
|
319
|
-
"first-pinned-left-column": "_first-pinned-left-
|
|
320
|
-
"last-pinned-right-column": "_last-pinned-right-
|
|
321
|
-
"empty-cell": "_empty-
|
|
322
|
-
"table-cell-internal-select": "_table-cell-internal-
|
|
323
|
-
"table-cell-internal-expand": "_table-cell-internal-
|
|
324
|
-
"table-header-cell-sortable": "_table-header-cell-
|
|
325
|
-
"table-header-cell-interactive": "_table-header-cell-
|
|
326
|
-
"table-header-cell-group": "_table-header-cell-
|
|
961
|
+
"table-header-cell": "_table-header-cell_11yr3_4",
|
|
962
|
+
"table-body-cell": "_table-body-cell_11yr3_5",
|
|
963
|
+
"table-footer-cell": "_table-footer-cell_11yr3_6",
|
|
964
|
+
"last-pinned-left-column": "_last-pinned-left-column_11yr3_30",
|
|
965
|
+
"first-pinned-right-column": "_first-pinned-right-column_11yr3_30",
|
|
966
|
+
"first-pinned-left-column": "_first-pinned-left-column_11yr3_51",
|
|
967
|
+
"last-pinned-right-column": "_last-pinned-right-column_11yr3_56",
|
|
968
|
+
"empty-cell": "_empty-cell_11yr3_73",
|
|
969
|
+
"table-cell-internal-select": "_table-cell-internal-select_11yr3_90",
|
|
970
|
+
"table-cell-internal-expand": "_table-cell-internal-expand_11yr3_94",
|
|
971
|
+
"table-header-cell-sortable": "_table-header-cell-sortable_11yr3_99",
|
|
972
|
+
"table-header-cell-interactive": "_table-header-cell-interactive_11yr3_100",
|
|
973
|
+
"table-header-cell-group": "_table-header-cell-group_11yr3_104"
|
|
327
974
|
};
|
|
328
975
|
|
|
329
976
|
const TableEmptyCellContent = () => {
|
|
@@ -331,7 +978,8 @@ const TableEmptyCellContent = () => {
|
|
|
331
978
|
};
|
|
332
979
|
|
|
333
980
|
const styles$g = {
|
|
334
|
-
"truncate-chips": "_truncate-
|
|
981
|
+
"truncate-chips": "_truncate-chips_16wxd_4",
|
|
982
|
+
"truncate-chips-measurement": "_truncate-chips-measurement_16wxd_17"
|
|
335
983
|
};
|
|
336
984
|
|
|
337
985
|
const TruncateChips = ({
|
|
@@ -340,114 +988,107 @@ const TruncateChips = ({
|
|
|
340
988
|
...rest
|
|
341
989
|
}) => {
|
|
342
990
|
const containerRef = useRef(null);
|
|
343
|
-
const
|
|
344
|
-
const
|
|
345
|
-
const
|
|
346
|
-
const plusChipRef = useRef(null);
|
|
347
|
-
const [plusChipWidth, setPlusChipWidth] = useState(0);
|
|
991
|
+
const measurementRef = useRef(null);
|
|
992
|
+
const measurementPlusRef = useRef(null);
|
|
993
|
+
const [visibleCount, setVisibleCount] = useState(null);
|
|
348
994
|
const overflowChipSize = items[0]?.size;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
el: target,
|
|
369
|
-
rect: target.getBoundingClientRect()
|
|
370
|
-
});
|
|
371
|
-
target.style.visibility = "hidden";
|
|
372
|
-
target.style.display = "none";
|
|
373
|
-
totalHiddenCount++;
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
setHiddenCount(totalHiddenCount);
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
root: containerRef.current,
|
|
380
|
-
rootMargin: "0px",
|
|
381
|
-
threshold: 1
|
|
382
|
-
}
|
|
995
|
+
const compute = useCallback(() => {
|
|
996
|
+
const container = containerRef.current;
|
|
997
|
+
const measurement = measurementRef.current;
|
|
998
|
+
if (!container || !measurement) return;
|
|
999
|
+
const parent = container.parentElement;
|
|
1000
|
+
if (!parent) return;
|
|
1001
|
+
const parentStyle = window.getComputedStyle(parent);
|
|
1002
|
+
const paddingLeft = parseFloat(parentStyle.paddingLeft) || 0;
|
|
1003
|
+
const paddingRight = parseFloat(parentStyle.paddingRight) || 0;
|
|
1004
|
+
const availableWidth = parent.clientWidth - paddingLeft - paddingRight;
|
|
1005
|
+
if (items.length === 0) {
|
|
1006
|
+
setVisibleCount(0);
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
if (availableWidth <= 0) return;
|
|
1010
|
+
const gap = parseFloat(window.getComputedStyle(measurement).columnGap || "0") || 0;
|
|
1011
|
+
const chipNodes = Array.from(measurement.children).slice(
|
|
1012
|
+
0,
|
|
1013
|
+
items.length
|
|
383
1014
|
);
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
1015
|
+
const plusWidth = measurementPlusRef.current?.getBoundingClientRect().width ?? 0;
|
|
1016
|
+
let widthUsed = 0;
|
|
1017
|
+
let fitAll = true;
|
|
1018
|
+
for (let i = 0; i < chipNodes.length; i++) {
|
|
1019
|
+
const chipWidth = chipNodes[i].getBoundingClientRect().width;
|
|
1020
|
+
const widthWithChip = widthUsed + (i > 0 ? gap : 0) + chipWidth;
|
|
1021
|
+
if (widthWithChip > availableWidth) {
|
|
1022
|
+
fitAll = false;
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
widthUsed = widthWithChip;
|
|
1026
|
+
}
|
|
1027
|
+
if (fitAll) {
|
|
1028
|
+
setVisibleCount(items.length);
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
const availableForChips = availableWidth - plusWidth - gap;
|
|
1032
|
+
widthUsed = 0;
|
|
1033
|
+
let fit = 0;
|
|
1034
|
+
for (let i = 0; i < chipNodes.length; i++) {
|
|
1035
|
+
const chipWidth = chipNodes[i].getBoundingClientRect().width;
|
|
1036
|
+
const next = widthUsed + (i > 0 ? gap : 0) + chipWidth;
|
|
1037
|
+
if (next > availableForChips) break;
|
|
1038
|
+
widthUsed = next;
|
|
1039
|
+
fit = i + 1;
|
|
1040
|
+
}
|
|
1041
|
+
setVisibleCount(fit);
|
|
391
1042
|
}, [items]);
|
|
392
1043
|
useLayoutEffect(() => {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
(currentPlusChipWidth) => currentPlusChipWidth === nextPlusChipWidth ? currentPlusChipWidth : nextPlusChipWidth
|
|
397
|
-
);
|
|
398
|
-
};
|
|
399
|
-
measurePlusChipWidth();
|
|
400
|
-
if (!plusChipRef.current) return;
|
|
1044
|
+
compute();
|
|
1045
|
+
const parent = containerRef.current?.parentElement;
|
|
1046
|
+
if (!parent) return;
|
|
401
1047
|
const observer = new ResizeObserver(() => {
|
|
402
|
-
|
|
1048
|
+
compute();
|
|
403
1049
|
});
|
|
404
|
-
observer.observe(
|
|
1050
|
+
observer.observe(parent);
|
|
405
1051
|
return () => {
|
|
406
1052
|
observer.disconnect();
|
|
407
1053
|
};
|
|
408
|
-
}, [
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
const entry = entries[entries.length - 1];
|
|
413
|
-
if (entry) {
|
|
414
|
-
if (hiddenCount > 0 && containerRef.current) {
|
|
415
|
-
const containerRect = containerRef.current.getBoundingClientRect();
|
|
416
|
-
const chipRect = hiddenChips.current[hiddenChips.current.length - 1].rect;
|
|
417
|
-
const fitsHorizontally = chipRect.width <= containerRect.width && chipRect.left >= containerRect.left && chipRect.right <= containerRect.right;
|
|
418
|
-
const fitsVertically = chipRect.height <= containerRect.height && chipRect.top >= containerRect.top && chipRect.bottom <= containerRect.bottom;
|
|
419
|
-
const hasEnoughSpace = fitsHorizontally && fitsVertically;
|
|
420
|
-
hiddenChips.current[hiddenCount - 1].el.style.display = hasEnoughSpace ? "flex" : "none";
|
|
421
|
-
if (hasEnoughSpace) {
|
|
422
|
-
hiddenChips.current.pop();
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
observer.observe(containerRef.current);
|
|
428
|
-
return () => {
|
|
429
|
-
observer.disconnect();
|
|
430
|
-
};
|
|
431
|
-
}, [hiddenCount]);
|
|
1054
|
+
}, [compute]);
|
|
1055
|
+
const hiddenCount = visibleCount === null ? 0 : Math.max(0, items.length - visibleCount);
|
|
1056
|
+
const visibleItems = visibleCount === null ? [] : items.slice(0, visibleCount);
|
|
1057
|
+
const hiddenItems = visibleCount === null ? [] : items.slice(visibleCount);
|
|
432
1058
|
return /* @__PURE__ */ jsxs(
|
|
433
1059
|
"div",
|
|
434
1060
|
{
|
|
435
1061
|
ref: containerRef,
|
|
1062
|
+
"data-anv": "truncate-chips",
|
|
436
1063
|
className: cx(styles$g["truncate-chips"], className),
|
|
437
|
-
style: {
|
|
438
|
-
marginInlineEnd: plusChipWidth
|
|
439
|
-
},
|
|
1064
|
+
style: { visibility: visibleCount === null ? "hidden" : void 0 },
|
|
440
1065
|
...rest,
|
|
441
1066
|
children: [
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
|
|
444
|
-
Chip,
|
|
1067
|
+
/* @__PURE__ */ jsxs(
|
|
1068
|
+
"div",
|
|
445
1069
|
{
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
1070
|
+
ref: measurementRef,
|
|
1071
|
+
"data-anv": "truncate-chips-measurement",
|
|
1072
|
+
className: styles$g["truncate-chips-measurement"],
|
|
1073
|
+
"aria-hidden": true,
|
|
1074
|
+
children: [
|
|
1075
|
+
items.map((chip, index) => /* @__PURE__ */ jsx(Chip, { ...chip }, index)),
|
|
1076
|
+
/* @__PURE__ */ jsx(
|
|
1077
|
+
Chip,
|
|
1078
|
+
{
|
|
1079
|
+
ref: measurementPlusRef,
|
|
1080
|
+
label: `+${items.length || 1}`,
|
|
1081
|
+
size: overflowChipSize
|
|
1082
|
+
}
|
|
1083
|
+
)
|
|
1084
|
+
]
|
|
449
1085
|
}
|
|
450
|
-
)
|
|
1086
|
+
),
|
|
1087
|
+
visibleItems.map((chip, index) => /* @__PURE__ */ jsx(Chip, { ...chip }, index)),
|
|
1088
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs(Tooltip, { placement: "top", children: [
|
|
1089
|
+
/* @__PURE__ */ jsx(Tooltip.Trigger, { children: /* @__PURE__ */ jsx(Chip, { label: `+${hiddenCount}`, size: overflowChipSize }) }),
|
|
1090
|
+
/* @__PURE__ */ jsx(Tooltip.Content, { children: hiddenItems.map((item) => item.label).join(", ") })
|
|
1091
|
+
] })
|
|
451
1092
|
]
|
|
452
1093
|
}
|
|
453
1094
|
);
|
|
@@ -587,7 +1228,17 @@ const dateTimeFormatter = (value, {
|
|
|
587
1228
|
return localizedDateTime.toLocaleString(formatOptions);
|
|
588
1229
|
};
|
|
589
1230
|
|
|
590
|
-
const SUPPORTED_INLINE_TAGS = [
|
|
1231
|
+
const SUPPORTED_INLINE_TAGS = [
|
|
1232
|
+
"strong",
|
|
1233
|
+
"b",
|
|
1234
|
+
"em",
|
|
1235
|
+
"i",
|
|
1236
|
+
"code",
|
|
1237
|
+
"mark",
|
|
1238
|
+
"s",
|
|
1239
|
+
"strike",
|
|
1240
|
+
"del"
|
|
1241
|
+
];
|
|
591
1242
|
const INLINE_TAG_REGEX = new RegExp(
|
|
592
1243
|
`<(${SUPPORTED_INLINE_TAGS.join("|")})(\\s[^>]*)?>([\\s\\S]*?)</\\1>`,
|
|
593
1244
|
"gi"
|
|
@@ -598,7 +1249,10 @@ const INLINE_WRAPPERS = {
|
|
|
598
1249
|
em: ["*", "*"],
|
|
599
1250
|
i: ["*", "*"],
|
|
600
1251
|
code: ["`", "`"],
|
|
601
|
-
mark: ["==", "=="]
|
|
1252
|
+
mark: ["==", "=="],
|
|
1253
|
+
s: ["~~", "~~"],
|
|
1254
|
+
strike: ["~~", "~~"],
|
|
1255
|
+
del: ["~~", "~~"]
|
|
602
1256
|
};
|
|
603
1257
|
function convertInlineTags(html) {
|
|
604
1258
|
let result = html;
|
|
@@ -614,9 +1268,25 @@ function convertInlineTags(html) {
|
|
|
614
1268
|
}
|
|
615
1269
|
return result;
|
|
616
1270
|
}
|
|
1271
|
+
const UNWRAP_TAGS = ["u", "span"];
|
|
1272
|
+
const UNWRAP_TAG_REGEX = new RegExp(
|
|
1273
|
+
`</?(?:${UNWRAP_TAGS.join("|")})(\\s[^>]*)?>`,
|
|
1274
|
+
"gi"
|
|
1275
|
+
);
|
|
1276
|
+
function unwrapTags(html) {
|
|
1277
|
+
return html.replace(UNWRAP_TAG_REGEX, "");
|
|
1278
|
+
}
|
|
617
1279
|
const BR_REGEX = /<br\s*\/?>/gi;
|
|
618
1280
|
const P_OPEN_REGEX = /<p(\s[^>]*)?>/gi;
|
|
619
1281
|
const P_CLOSE_REGEX = /<\/p>/gi;
|
|
1282
|
+
const HEADING_REGEX$1 = /<h([1-3])(\s[^>]*)?>([\s\S]*?)<\/h\1>/gi;
|
|
1283
|
+
function convertHeadings(html) {
|
|
1284
|
+
return html.replace(HEADING_REGEX$1, (_, level, _attrs, content) => {
|
|
1285
|
+
const hashes = "#".repeat(Number(level));
|
|
1286
|
+
return `${hashes} ${content.trim()}
|
|
1287
|
+
`;
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
620
1290
|
const NAMED_ENTITIES = {
|
|
621
1291
|
amp: "&",
|
|
622
1292
|
lt: "<",
|
|
@@ -644,6 +1314,12 @@ const SUPPORTED_TAGS = [
|
|
|
644
1314
|
"i",
|
|
645
1315
|
"code",
|
|
646
1316
|
"mark",
|
|
1317
|
+
"s",
|
|
1318
|
+
"strike",
|
|
1319
|
+
"del",
|
|
1320
|
+
"h1",
|
|
1321
|
+
"h2",
|
|
1322
|
+
"h3",
|
|
647
1323
|
"ul",
|
|
648
1324
|
"ol",
|
|
649
1325
|
"li",
|
|
@@ -693,7 +1369,9 @@ function htmlToMarkdown(value) {
|
|
|
693
1369
|
return "";
|
|
694
1370
|
}
|
|
695
1371
|
let result = value;
|
|
1372
|
+
result = unwrapTags(result);
|
|
696
1373
|
result = removeUnsupportedTags(result);
|
|
1374
|
+
result = convertHeadings(result);
|
|
697
1375
|
result = result.replace(P_OPEN_REGEX, "");
|
|
698
1376
|
result = result.replace(P_CLOSE_REGEX, "\n");
|
|
699
1377
|
result = convertLists(result);
|
|
@@ -704,20 +1382,27 @@ function htmlToMarkdown(value) {
|
|
|
704
1382
|
return result;
|
|
705
1383
|
}
|
|
706
1384
|
|
|
707
|
-
const highlight = "
|
|
708
|
-
const code = "
|
|
709
|
-
const list = "
|
|
710
|
-
const container = "
|
|
1385
|
+
const highlight = "_highlight_16fej_1";
|
|
1386
|
+
const code = "_code_16fej_7";
|
|
1387
|
+
const list = "_list_16fej_15";
|
|
1388
|
+
const container = "_container_16fej_23";
|
|
1389
|
+
const heading1 = "_heading1_16fej_29";
|
|
1390
|
+
const heading2 = "_heading2_16fej_30";
|
|
1391
|
+
const heading3 = "_heading3_16fej_31";
|
|
711
1392
|
const styles$f = {
|
|
712
1393
|
highlight: highlight,
|
|
713
1394
|
code: code,
|
|
714
1395
|
list: list,
|
|
715
|
-
container: container
|
|
1396
|
+
container: container,
|
|
1397
|
+
heading1: heading1,
|
|
1398
|
+
heading2: heading2,
|
|
1399
|
+
heading3: heading3
|
|
716
1400
|
};
|
|
717
1401
|
|
|
718
|
-
const INLINE_REGEX = /\*\*\*(.+?)\*\*\*|\*\*(.+?)\*\*|\*(.+?)\*|==(.+?)==|`(.+?)
|
|
1402
|
+
const INLINE_REGEX = /\*\*\*(.+?)\*\*\*|\*\*(.+?)\*\*|\*(.+?)\*|==(.+?)==|`(.+?)`|~~(.+?)~~/g;
|
|
719
1403
|
const UNORDERED_LIST_REGEX = /^- (.+)$/;
|
|
720
1404
|
const ORDERED_LIST_REGEX = /^\d+\. (.+)$/;
|
|
1405
|
+
const HEADING_REGEX = /^(#{1,3}) +(\S.*)$/;
|
|
721
1406
|
function parseInline(text) {
|
|
722
1407
|
const parts = [];
|
|
723
1408
|
let lastIndex = 0;
|
|
@@ -745,6 +1430,8 @@ function parseInline(text) {
|
|
|
745
1430
|
parts.push(
|
|
746
1431
|
/* @__PURE__ */ jsx("code", { className: styles$f.code, children: match[5] }, key)
|
|
747
1432
|
);
|
|
1433
|
+
} else if (match[6]) {
|
|
1434
|
+
parts.push(/* @__PURE__ */ jsx("s", { children: parseInline(match[6]) }, key));
|
|
748
1435
|
}
|
|
749
1436
|
INLINE_REGEX.lastIndex = savedIndex;
|
|
750
1437
|
lastIndex = savedIndex;
|
|
@@ -760,9 +1447,17 @@ function parseBlocks(text) {
|
|
|
760
1447
|
let i = 0;
|
|
761
1448
|
while (i < lines.length) {
|
|
762
1449
|
const line = lines[i];
|
|
1450
|
+
const headingMatch = line.match(HEADING_REGEX);
|
|
763
1451
|
const ulMatch = line.match(UNORDERED_LIST_REGEX);
|
|
764
1452
|
const olMatch = line.match(ORDERED_LIST_REGEX);
|
|
765
|
-
if (
|
|
1453
|
+
if (headingMatch) {
|
|
1454
|
+
blocks.push({
|
|
1455
|
+
type: "heading",
|
|
1456
|
+
level: headingMatch[1].length,
|
|
1457
|
+
content: headingMatch[2]
|
|
1458
|
+
});
|
|
1459
|
+
i++;
|
|
1460
|
+
} else if (ulMatch) {
|
|
766
1461
|
const items = [ulMatch[1]];
|
|
767
1462
|
i++;
|
|
768
1463
|
while (i < lines.length) {
|
|
@@ -796,6 +1491,8 @@ function renderBlocks(blocks) {
|
|
|
796
1491
|
switch (block.type) {
|
|
797
1492
|
case "text":
|
|
798
1493
|
return /* @__PURE__ */ jsx("span", { children: parseInline(block.content) }, index);
|
|
1494
|
+
case "heading":
|
|
1495
|
+
return /* @__PURE__ */ jsx("span", { className: styles$f[`heading${block.level}`], children: parseInline(block.content) }, index);
|
|
799
1496
|
case "ul":
|
|
800
1497
|
return /* @__PURE__ */ jsx("ul", { className: styles$f.list, children: block.items.map((item, i) => /* @__PURE__ */ jsx("li", { children: parseInline(item) }, i)) }, index);
|
|
801
1498
|
case "ol":
|
|
@@ -4364,9 +5061,9 @@ const getCommonPinningClasses = (column) => {
|
|
|
4364
5061
|
};
|
|
4365
5062
|
|
|
4366
5063
|
const styles$c = {
|
|
4367
|
-
"data-table-body-cell-affordance-container": "_data-table-body-cell-affordance-
|
|
4368
|
-
"data-table-body-cell-affordance-host": "_data-table-body-cell-affordance-
|
|
4369
|
-
"data-table-body-cell-affordance-container-interactive": "_data-table-body-cell-affordance-container-
|
|
5064
|
+
"data-table-body-cell-affordance-container": "_data-table-body-cell-affordance-container_1eir6_1",
|
|
5065
|
+
"data-table-body-cell-affordance-host": "_data-table-body-cell-affordance-host_1eir6_6",
|
|
5066
|
+
"data-table-body-cell-affordance-container-interactive": "_data-table-body-cell-affordance-container-interactive_1eir6_21"
|
|
4370
5067
|
};
|
|
4371
5068
|
|
|
4372
5069
|
const dataTableCellAffordanceHostClassName = styles$c["data-table-body-cell-affordance-host"];
|
|
@@ -4415,20 +5112,20 @@ const styles$b = {
|
|
|
4415
5112
|
"data-table-body-cell-input": "_data-table-body-cell-input_1t30b_4"};
|
|
4416
5113
|
|
|
4417
5114
|
const styles$a = {
|
|
4418
|
-
"data-table-body-cell": "_data-table-body-
|
|
4419
|
-
"data-table-body-cell-input": "_data-table-body-cell-
|
|
4420
|
-
"table-body-cell": "_table-body-
|
|
4421
|
-
"table-header-cell": "_table-header-
|
|
4422
|
-
"table-footer-cell": "_table-footer-
|
|
4423
|
-
"data-table-cell-content": "_data-table-cell-
|
|
4424
|
-
"data-table-cell-overflow-content": "_data-table-cell-overflow-
|
|
4425
|
-
"data-table-body-cell-editing": "_data-table-body-cell-
|
|
4426
|
-
"data-table-header-cell": "_data-table-header-
|
|
4427
|
-
"data-table-footer-cell": "_data-table-footer-
|
|
4428
|
-
"data-table-body-cell-error": "_data-table-body-cell-
|
|
4429
|
-
"data-table-body-cell-warning": "_data-table-body-cell-
|
|
4430
|
-
"cell-error-icon": "_cell-error-
|
|
4431
|
-
"cell-warning-icon": "_cell-warning-
|
|
5115
|
+
"data-table-body-cell": "_data-table-body-cell_105ir_4",
|
|
5116
|
+
"data-table-body-cell-input": "_data-table-body-cell-input_105ir_5",
|
|
5117
|
+
"table-body-cell": "_table-body-cell_105ir_10",
|
|
5118
|
+
"table-header-cell": "_table-header-cell_105ir_11",
|
|
5119
|
+
"table-footer-cell": "_table-footer-cell_105ir_12",
|
|
5120
|
+
"data-table-cell-content": "_data-table-cell-content_105ir_24",
|
|
5121
|
+
"data-table-cell-overflow-content": "_data-table-cell-overflow-content_105ir_45",
|
|
5122
|
+
"data-table-body-cell-editing": "_data-table-body-cell-editing_105ir_52",
|
|
5123
|
+
"data-table-header-cell": "_data-table-header-cell_105ir_53",
|
|
5124
|
+
"data-table-footer-cell": "_data-table-footer-cell_105ir_56",
|
|
5125
|
+
"data-table-body-cell-error": "_data-table-body-cell-error_105ir_109",
|
|
5126
|
+
"data-table-body-cell-warning": "_data-table-body-cell-warning_105ir_124",
|
|
5127
|
+
"cell-error-icon": "_cell-error-icon_105ir_134",
|
|
5128
|
+
"cell-warning-icon": "_cell-warning-icon_105ir_139"
|
|
4432
5129
|
};
|
|
4433
5130
|
|
|
4434
5131
|
function formatCellPositionString(cellPosition) {
|
|
@@ -4496,6 +5193,16 @@ const useCommonPinningStyles = (column) => {
|
|
|
4496
5193
|
}, [left, right, isPinned]);
|
|
4497
5194
|
};
|
|
4498
5195
|
|
|
5196
|
+
const DataTableRowClickContext = createContext({
|
|
5197
|
+
isRowClickEnabled: false,
|
|
5198
|
+
clickRow: () => {
|
|
5199
|
+
}
|
|
5200
|
+
});
|
|
5201
|
+
|
|
5202
|
+
function useDataTableRowClick() {
|
|
5203
|
+
return useContext(DataTableRowClickContext);
|
|
5204
|
+
}
|
|
5205
|
+
|
|
4499
5206
|
const FOCUSABLE_SELECTOR = [
|
|
4500
5207
|
"button:not([disabled])",
|
|
4501
5208
|
"a[href]",
|
|
@@ -4543,6 +5250,7 @@ function DataTableBodyImmutableCell(props) {
|
|
|
4543
5250
|
});
|
|
4544
5251
|
const commonPinningStyles = useCommonPinningStyles(column);
|
|
4545
5252
|
const { jumpFocus, moveFocus } = useDTFocusDispatchContext();
|
|
5253
|
+
const { isRowClickEnabled, clickRow } = useDataTableRowClick();
|
|
4546
5254
|
const [isInteractionMode, setIsInteractionMode] = useState(false);
|
|
4547
5255
|
useLayoutEffect(() => {
|
|
4548
5256
|
if (!cellRef.current) return;
|
|
@@ -4634,7 +5342,13 @@ function DataTableBodyImmutableCell(props) {
|
|
|
4634
5342
|
const interactives = getManagedInteractives(cellRef.current).filter(
|
|
4635
5343
|
(el) => !el.disabled
|
|
4636
5344
|
);
|
|
4637
|
-
if (interactives.length === 0)
|
|
5345
|
+
if (interactives.length === 0) {
|
|
5346
|
+
if (event.key === "Enter" && isRowClickEnabled) {
|
|
5347
|
+
event.preventDefault();
|
|
5348
|
+
clickRow(cell.row.id);
|
|
5349
|
+
}
|
|
5350
|
+
return;
|
|
5351
|
+
}
|
|
4638
5352
|
event.preventDefault();
|
|
4639
5353
|
if (interactives.length === 1) {
|
|
4640
5354
|
interactives[0].focus();
|
|
@@ -4660,7 +5374,9 @@ function DataTableBodyImmutableCell(props) {
|
|
|
4660
5374
|
cell,
|
|
4661
5375
|
rowCanExpand,
|
|
4662
5376
|
rowIsExpanded,
|
|
4663
|
-
toggleRowExpanded
|
|
5377
|
+
toggleRowExpanded,
|
|
5378
|
+
isRowClickEnabled,
|
|
5379
|
+
clickRow
|
|
4664
5380
|
]
|
|
4665
5381
|
);
|
|
4666
5382
|
const handleBlur = useCallback(
|
|
@@ -4835,6 +5551,7 @@ function DataTableEditableTextCellInner(props, ref) {
|
|
|
4835
5551
|
onFocus: handleCellFocus,
|
|
4836
5552
|
onBlur: handleCellBlur,
|
|
4837
5553
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
5554
|
+
"data-anv-editable-cell": "true",
|
|
4838
5555
|
children: [
|
|
4839
5556
|
isEditing ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
4840
5557
|
"input",
|
|
@@ -5029,6 +5746,7 @@ function DataTableEditableNumberCellInner(props, ref) {
|
|
|
5029
5746
|
onFocus: handleCellFocus,
|
|
5030
5747
|
onBlur: handleCellBlur,
|
|
5031
5748
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
5749
|
+
"data-anv-editable-cell": "true",
|
|
5032
5750
|
children: [
|
|
5033
5751
|
isEditing ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
5034
5752
|
"input",
|
|
@@ -5210,6 +5928,7 @@ function DataTableEditableSelectCellInner(props, ref) {
|
|
|
5210
5928
|
onBlur: handleCellBlur,
|
|
5211
5929
|
onFocus: handleCellFocus,
|
|
5212
5930
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
5931
|
+
"data-anv-editable-cell": "true",
|
|
5213
5932
|
"aria-controls": ariaControls,
|
|
5214
5933
|
"aria-expanded": ariaExpanded,
|
|
5215
5934
|
"aria-haspopup": ariaHaspopup,
|
|
@@ -5356,6 +6075,7 @@ function DataTableEditableSelectAsyncCellInner(props, ref) {
|
|
|
5356
6075
|
onBlur: handleCellBlur,
|
|
5357
6076
|
onFocus: handleCellFocus,
|
|
5358
6077
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
6078
|
+
"data-anv-editable-cell": "true",
|
|
5359
6079
|
"aria-controls": ariaControls,
|
|
5360
6080
|
"aria-expanded": ariaExpanded,
|
|
5361
6081
|
"aria-haspopup": ariaHaspopup,
|
|
@@ -5467,6 +6187,7 @@ function DataTableEditableMultiselectCellInner(props, ref) {
|
|
|
5467
6187
|
onBlur: handleCellBlur,
|
|
5468
6188
|
onFocus: handleCellFocus,
|
|
5469
6189
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
6190
|
+
"data-anv-editable-cell": "true",
|
|
5470
6191
|
"aria-controls": ariaControls,
|
|
5471
6192
|
"aria-expanded": ariaExpanded,
|
|
5472
6193
|
"aria-haspopup": ariaHaspopup,
|
|
@@ -5613,6 +6334,7 @@ function DataTableEditableMultiselectAsyncCellInner(props, ref) {
|
|
|
5613
6334
|
onBlur: handleCellBlur,
|
|
5614
6335
|
onFocus: handleCellFocus,
|
|
5615
6336
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
6337
|
+
"data-anv-editable-cell": "true",
|
|
5616
6338
|
"aria-controls": ariaControls,
|
|
5617
6339
|
"aria-expanded": ariaExpanded,
|
|
5618
6340
|
"aria-haspopup": ariaHaspopup,
|
|
@@ -5750,6 +6472,7 @@ function DataTableEditableBooleanCellInner(props, ref) {
|
|
|
5750
6472
|
onBlur: handleCellBlur,
|
|
5751
6473
|
onFocus: handleCellFocus,
|
|
5752
6474
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
6475
|
+
"data-anv-editable-cell": "true",
|
|
5753
6476
|
"aria-controls": ariaControls,
|
|
5754
6477
|
"aria-expanded": ariaExpanded,
|
|
5755
6478
|
"aria-haspopup": ariaHaspopup,
|
|
@@ -5786,30 +6509,49 @@ const DataTableEditableBooleanCell = Object.assign(
|
|
|
5786
6509
|
{ displayName: "DataTableEditableBooleanCell" }
|
|
5787
6510
|
);
|
|
5788
6511
|
|
|
6512
|
+
const DataTableSurfaceCoordinatorContext = createContext(null);
|
|
6513
|
+
|
|
6514
|
+
function useDataTableSurfaceCoordinator() {
|
|
6515
|
+
return useContext(DataTableSurfaceCoordinatorContext);
|
|
6516
|
+
}
|
|
6517
|
+
|
|
5789
6518
|
function isCustomDraftValueUpdater(nextValue) {
|
|
5790
6519
|
return typeof nextValue === "function";
|
|
5791
6520
|
}
|
|
5792
6521
|
function isCustomFieldValueUpdater(nextValue) {
|
|
5793
6522
|
return typeof nextValue === "function";
|
|
5794
6523
|
}
|
|
6524
|
+
function isObjectDraftValue(value) {
|
|
6525
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6526
|
+
}
|
|
6527
|
+
function getDraftObject(draftValue) {
|
|
6528
|
+
return isObjectDraftValue(draftValue) ? draftValue : {};
|
|
6529
|
+
}
|
|
5795
6530
|
function deriveChangedFields(initialValue, draftValue) {
|
|
6531
|
+
const initialObject = getDraftObject(initialValue);
|
|
6532
|
+
const draftObject = getDraftObject(draftValue);
|
|
5796
6533
|
const orderedKeys = Array.from(
|
|
5797
|
-
/* @__PURE__ */ new Set([...Object.keys(
|
|
6534
|
+
/* @__PURE__ */ new Set([...Object.keys(initialObject), ...Object.keys(draftObject)])
|
|
5798
6535
|
);
|
|
5799
6536
|
return orderedKeys.filter(
|
|
5800
|
-
(field) => !Object.is(
|
|
6537
|
+
(field) => !Object.is(initialObject[field], draftObject[field])
|
|
5801
6538
|
);
|
|
5802
6539
|
}
|
|
6540
|
+
function deriveIsDirty(initialValue, draftValue, changedFields) {
|
|
6541
|
+
const initialValueIsNullish = initialValue == null;
|
|
6542
|
+
const draftValueIsNullish = draftValue == null;
|
|
6543
|
+
if (initialValueIsNullish || draftValueIsNullish) {
|
|
6544
|
+
return initialValueIsNullish && draftValueIsNullish ? !Object.is(initialValue, draftValue) : true;
|
|
6545
|
+
}
|
|
6546
|
+
return changedFields.length > 0;
|
|
6547
|
+
}
|
|
5803
6548
|
function deriveValidation(validateDraft, draftValue, rowId) {
|
|
5804
6549
|
return validateDraft?.(draftValue, rowId) ?? {};
|
|
5805
6550
|
}
|
|
5806
6551
|
function hasValidationErrors(validation) {
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
return Object.values(validation.fieldErrors ?? {}).some(
|
|
5811
|
-
(fieldError) => fieldError != null
|
|
5812
|
-
);
|
|
6552
|
+
const formError = validation.formError;
|
|
6553
|
+
const fieldErrors = Object.values(validation.fieldErrors ?? {});
|
|
6554
|
+
return formError != null && formError !== false || fieldErrors.some((fieldError) => fieldError != null && fieldError !== false);
|
|
5813
6555
|
}
|
|
5814
6556
|
function useCustomEditControllerState({
|
|
5815
6557
|
row,
|
|
@@ -5818,7 +6560,9 @@ function useCustomEditControllerState({
|
|
|
5818
6560
|
onCloseEditor
|
|
5819
6561
|
}) {
|
|
5820
6562
|
const rowId = String(row.id);
|
|
5821
|
-
const initialValueRef = useRef(
|
|
6563
|
+
const initialValueRef = useRef(
|
|
6564
|
+
row[columnId]
|
|
6565
|
+
);
|
|
5822
6566
|
const initialValue = initialValueRef.current;
|
|
5823
6567
|
const [draftValue, setDraftValueState] = useState(initialValue);
|
|
5824
6568
|
const draftValueRef = useRef(draftValue);
|
|
@@ -5829,12 +6573,10 @@ function useCustomEditControllerState({
|
|
|
5829
6573
|
);
|
|
5830
6574
|
const setDraftValue = useCallback(
|
|
5831
6575
|
(nextValue) => {
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
return resolvedValue;
|
|
5837
|
-
});
|
|
6576
|
+
const previousValue = draftValueRef.current;
|
|
6577
|
+
const resolvedValue = isCustomDraftValueUpdater(nextValue) ? nextValue(previousValue) : nextValue;
|
|
6578
|
+
draftValueRef.current = resolvedValue;
|
|
6579
|
+
setDraftValueState(resolvedValue);
|
|
5838
6580
|
editConfig.onDraftUpdate?.(resolvedValue, rowId);
|
|
5839
6581
|
return resolvedValue;
|
|
5840
6582
|
},
|
|
@@ -5842,26 +6584,26 @@ function useCustomEditControllerState({
|
|
|
5842
6584
|
);
|
|
5843
6585
|
const setDraftField = useCallback(
|
|
5844
6586
|
(field, nextValue) => {
|
|
5845
|
-
return setDraftValue((previousValue) =>
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
6587
|
+
return setDraftValue((previousValue) => {
|
|
6588
|
+
const previousObject = getDraftObject(previousValue);
|
|
6589
|
+
return {
|
|
6590
|
+
...previousObject,
|
|
6591
|
+
[field]: isCustomFieldValueUpdater(nextValue) ? nextValue(previousObject[field], previousObject) : nextValue
|
|
6592
|
+
};
|
|
6593
|
+
});
|
|
5849
6594
|
},
|
|
5850
6595
|
[setDraftValue]
|
|
5851
6596
|
);
|
|
5852
6597
|
const performClose = useCallback(
|
|
5853
6598
|
(reason, action) => {
|
|
5854
6599
|
const currentDraftValue = draftValueRef.current;
|
|
6600
|
+
const changedFields2 = deriveChangedFields(initialValue, currentDraftValue);
|
|
5855
6601
|
const validation2 = getValidation(currentDraftValue);
|
|
5856
|
-
const changedFields2 = deriveChangedFields(
|
|
5857
|
-
initialValue,
|
|
5858
|
-
currentDraftValue
|
|
5859
|
-
);
|
|
5860
6602
|
const request = {
|
|
5861
6603
|
reason,
|
|
5862
6604
|
draftValue: currentDraftValue,
|
|
5863
6605
|
initialValue,
|
|
5864
|
-
isDirty:
|
|
6606
|
+
isDirty: deriveIsDirty(initialValue, currentDraftValue, changedFields2),
|
|
5865
6607
|
validation: validation2
|
|
5866
6608
|
};
|
|
5867
6609
|
if (action === "submit" && editConfig.blockOnValidationError === true && hasValidationErrors(validation2)) {
|
|
@@ -5875,24 +6617,26 @@ function useCustomEditControllerState({
|
|
|
5875
6617
|
} else {
|
|
5876
6618
|
draftValueRef.current = initialValue;
|
|
5877
6619
|
setDraftValueState(initialValue);
|
|
5878
|
-
editConfig.onDraftUpdate?.(
|
|
6620
|
+
editConfig.onDraftUpdate?.(
|
|
6621
|
+
initialValue,
|
|
6622
|
+
rowId
|
|
6623
|
+
);
|
|
5879
6624
|
}
|
|
5880
6625
|
onCloseEditor?.();
|
|
5881
|
-
return true;
|
|
5882
6626
|
},
|
|
5883
6627
|
[editConfig, getValidation, initialValue, onCloseEditor, rowId]
|
|
5884
6628
|
);
|
|
5885
6629
|
const requestClose = useCallback(
|
|
5886
6630
|
(reason) => {
|
|
5887
|
-
|
|
6631
|
+
performClose(reason, reason === "escape" ? "discard" : "submit");
|
|
5888
6632
|
},
|
|
5889
6633
|
[performClose]
|
|
5890
6634
|
);
|
|
5891
6635
|
const submit = useCallback(() => {
|
|
5892
|
-
|
|
6636
|
+
performClose("programmatic", "submit");
|
|
5893
6637
|
}, [performClose]);
|
|
5894
6638
|
const discard = useCallback(() => {
|
|
5895
|
-
|
|
6639
|
+
performClose("programmatic", "discard");
|
|
5896
6640
|
}, [performClose]);
|
|
5897
6641
|
const setInitialFocus = useCallback((focus) => {
|
|
5898
6642
|
initialFocusRef.current = focus;
|
|
@@ -5905,9 +6649,16 @@ function useCustomEditControllerState({
|
|
|
5905
6649
|
[requestClose]
|
|
5906
6650
|
);
|
|
5907
6651
|
const changedFields = useMemo(
|
|
5908
|
-
() => deriveChangedFields(
|
|
6652
|
+
() => deriveChangedFields(
|
|
6653
|
+
initialValue,
|
|
6654
|
+
draftValue
|
|
6655
|
+
),
|
|
5909
6656
|
[draftValue, initialValue]
|
|
5910
6657
|
);
|
|
6658
|
+
const isDirty = useMemo(
|
|
6659
|
+
() => deriveIsDirty(initialValue, draftValue, changedFields),
|
|
6660
|
+
[changedFields, draftValue, initialValue]
|
|
6661
|
+
);
|
|
5911
6662
|
const validation = useMemo(
|
|
5912
6663
|
() => getValidation(draftValue),
|
|
5913
6664
|
[draftValue, getValidation]
|
|
@@ -5916,7 +6667,7 @@ function useCustomEditControllerState({
|
|
|
5916
6667
|
() => ({
|
|
5917
6668
|
draftValue,
|
|
5918
6669
|
initialValue,
|
|
5919
|
-
isDirty
|
|
6670
|
+
isDirty,
|
|
5920
6671
|
changedFields,
|
|
5921
6672
|
validation,
|
|
5922
6673
|
setDraftValue,
|
|
@@ -5933,6 +6684,7 @@ function useCustomEditControllerState({
|
|
|
5933
6684
|
draftValue,
|
|
5934
6685
|
handleSubmit,
|
|
5935
6686
|
initialValue,
|
|
6687
|
+
isDirty,
|
|
5936
6688
|
requestClose,
|
|
5937
6689
|
setDraftValue,
|
|
5938
6690
|
setInitialFocus,
|
|
@@ -6059,23 +6811,25 @@ function DataTableEditableCustomCellInner(props, ref) {
|
|
|
6059
6811
|
const closeReasonRef = useRef(
|
|
6060
6812
|
"outside-click"
|
|
6061
6813
|
);
|
|
6814
|
+
const shouldRestoreFocusRef = useRef(true);
|
|
6062
6815
|
const [isOpen, setIsOpen] = useState(false);
|
|
6063
6816
|
const [tabIndex, setTabIndex] = useState(-1);
|
|
6064
6817
|
const { moveFocusToCell } = useDTFocusDispatchContext();
|
|
6818
|
+
const surfaceCoordinator = useDataTableSurfaceCoordinator();
|
|
6065
6819
|
const columnId = getColumnId(cell);
|
|
6066
6820
|
const cellValue = getCellValue(cell);
|
|
6067
6821
|
const meta = cell.column.columnDef.meta;
|
|
6068
6822
|
const editConfig = meta?.editConfig;
|
|
6069
6823
|
const customEditConfig = editConfig?.mode === "custom" ? editConfig : void 0;
|
|
6070
6824
|
const isValidValueType = useMemo(() => {
|
|
6071
|
-
if (cellValue
|
|
6825
|
+
if (cellValue == null || typeof cellValue === "object" && !Array.isArray(cellValue)) {
|
|
6072
6826
|
return true;
|
|
6073
6827
|
}
|
|
6074
6828
|
logWarningForInvalidCellValueType({
|
|
6075
6829
|
columnId: String(columnId),
|
|
6076
6830
|
editMode: "custom",
|
|
6077
|
-
expectedType: "non-null
|
|
6078
|
-
receivedType:
|
|
6831
|
+
expectedType: "non-array object, null, or undefined",
|
|
6832
|
+
receivedType: Array.isArray(cellValue) ? "array" : typeof cellValue
|
|
6079
6833
|
});
|
|
6080
6834
|
return false;
|
|
6081
6835
|
}, [cellValue, columnId]);
|
|
@@ -6091,11 +6845,6 @@ function DataTableEditableCustomCellInner(props, ref) {
|
|
|
6091
6845
|
const surfaceTitle = customEditConfig?.surface?.title ?? null;
|
|
6092
6846
|
const accessibleSurfaceLabel = `Edit ${defaultSurfaceTitle}`;
|
|
6093
6847
|
const closeButtonLabel = customEditConfig?.surface?.closeButtonLabel ?? `Commit changes and close ${defaultSurfaceTitle} custom editable cell`;
|
|
6094
|
-
const beginEditing = useCallback(() => {
|
|
6095
|
-
setIsOpen(true);
|
|
6096
|
-
setTabIndex(0);
|
|
6097
|
-
moveFocusToCell(cellPosition);
|
|
6098
|
-
}, [cellPosition, moveFocusToCell]);
|
|
6099
6848
|
const restoreFocusToOriginCell = useCallback(() => {
|
|
6100
6849
|
window.requestAnimationFrame(() => {
|
|
6101
6850
|
moveFocusToCell(cellPosition);
|
|
@@ -6103,11 +6852,47 @@ function DataTableEditableCustomCellInner(props, ref) {
|
|
|
6103
6852
|
setTabIndex(0);
|
|
6104
6853
|
});
|
|
6105
6854
|
}, [cellPosition, moveFocusToCell]);
|
|
6106
|
-
const closeSurface = useCallback(
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6855
|
+
const closeSurface = useCallback(
|
|
6856
|
+
(options = {}) => {
|
|
6857
|
+
customEditControllerRef.current = null;
|
|
6858
|
+
shouldRestoreFocusRef.current = options.restoreFocus ?? shouldRestoreFocusRef.current;
|
|
6859
|
+
setIsOpen(false);
|
|
6860
|
+
surfaceCoordinator?.clear(surfaceId);
|
|
6861
|
+
if (shouldRestoreFocusRef.current) {
|
|
6862
|
+
restoreFocusToOriginCell();
|
|
6863
|
+
}
|
|
6864
|
+
shouldRestoreFocusRef.current = true;
|
|
6865
|
+
},
|
|
6866
|
+
[restoreFocusToOriginCell, surfaceCoordinator, surfaceId]
|
|
6867
|
+
);
|
|
6868
|
+
const beginEditing = useCallback(() => {
|
|
6869
|
+
surfaceCoordinator?.requestOpen({
|
|
6870
|
+
id: surfaceId,
|
|
6871
|
+
close: (options) => {
|
|
6872
|
+
shouldRestoreFocusRef.current = options?.restoreFocus ?? true;
|
|
6873
|
+
if (customEditControllerRef.current) {
|
|
6874
|
+
customEditControllerRef.current.requestClose("programmatic");
|
|
6875
|
+
return;
|
|
6876
|
+
}
|
|
6877
|
+
closeSurface(options);
|
|
6878
|
+
}
|
|
6879
|
+
});
|
|
6880
|
+
shouldRestoreFocusRef.current = true;
|
|
6881
|
+
setIsOpen(true);
|
|
6882
|
+
setTabIndex(0);
|
|
6883
|
+
moveFocusToCell(cellPosition);
|
|
6884
|
+
}, [
|
|
6885
|
+
cellPosition,
|
|
6886
|
+
closeSurface,
|
|
6887
|
+
moveFocusToCell,
|
|
6888
|
+
surfaceCoordinator,
|
|
6889
|
+
surfaceId
|
|
6890
|
+
]);
|
|
6891
|
+
useEffect(() => {
|
|
6892
|
+
return () => {
|
|
6893
|
+
surfaceCoordinator?.clear(surfaceId);
|
|
6894
|
+
};
|
|
6895
|
+
}, [surfaceCoordinator, surfaceId]);
|
|
6111
6896
|
const handleSurfaceClose = useCallback(() => {
|
|
6112
6897
|
const controller = customEditControllerRef.current;
|
|
6113
6898
|
const reason = closeReasonRef.current;
|
|
@@ -6228,6 +7013,7 @@ function DataTableEditableCustomCellInner(props, ref) {
|
|
|
6228
7013
|
onPointerDown: handleCellPointerDown,
|
|
6229
7014
|
onKeyDown: handleCellKeyDown,
|
|
6230
7015
|
"data-cell-pos": formatCellPositionString(cellPosition),
|
|
7016
|
+
"data-anv-editable-cell": "true",
|
|
6231
7017
|
"aria-controls": triggerProps["aria-controls"],
|
|
6232
7018
|
"aria-expanded": triggerProps["aria-expanded"],
|
|
6233
7019
|
"aria-haspopup": triggerProps["aria-haspopup"],
|
|
@@ -6243,6 +7029,7 @@ function DataTableEditableCustomCellInner(props, ref) {
|
|
|
6243
7029
|
/* @__PURE__ */ jsxs(
|
|
6244
7030
|
Surface.Content,
|
|
6245
7031
|
{
|
|
7032
|
+
intersectionBoundaryRef: surfaceCoordinator?.intersectionBoundaryRef,
|
|
6246
7033
|
onClose: handleSurfaceClose,
|
|
6247
7034
|
onCancel: handleSurfaceCancel,
|
|
6248
7035
|
onClickCapture: handleSurfaceClickCapture,
|
|
@@ -6432,6 +7219,7 @@ function DataTableOverflowCell(props) {
|
|
|
6432
7219
|
const [isCellHovered, setIsCellHovered] = useState(false);
|
|
6433
7220
|
const [tabIndex, setTabIndex] = useState(-1);
|
|
6434
7221
|
const { moveFocus, jumpFocus, moveFocusToCell } = useDTFocusDispatchContext();
|
|
7222
|
+
const surfaceCoordinator = useDataTableSurfaceCoordinator();
|
|
6435
7223
|
const surfaceTitle = getSurfaceTitle(props);
|
|
6436
7224
|
const rowCanExpand = cell.row.getCanExpand();
|
|
6437
7225
|
const rowIsExpanded = cell.row.getIsExpanded();
|
|
@@ -6447,6 +7235,7 @@ function DataTableOverflowCell(props) {
|
|
|
6447
7235
|
const surfaceInstructionsId = `${surfaceId}-surface-instructions`;
|
|
6448
7236
|
const isClipped = hasOverflow(overflow);
|
|
6449
7237
|
const isResizeObserverEnabled = isOpen || isCellFocused || isCellHovered;
|
|
7238
|
+
const shouldRestoreFocusRef = useRef(true);
|
|
6450
7239
|
const commonPinningStyles = useCommonPinningStyles(cell.column);
|
|
6451
7240
|
const updateOverflow = useCallback(() => {
|
|
6452
7241
|
const viewport = viewportRef.current;
|
|
@@ -6485,20 +7274,46 @@ function DataTableOverflowCell(props) {
|
|
|
6485
7274
|
setTabIndex(0);
|
|
6486
7275
|
});
|
|
6487
7276
|
}, [cellPosition, moveFocusToCell]);
|
|
7277
|
+
const closeSurface = useCallback(
|
|
7278
|
+
(options = {}) => {
|
|
7279
|
+
shouldRestoreFocusRef.current = options.restoreFocus ?? shouldRestoreFocusRef.current;
|
|
7280
|
+
setIsOpen(false);
|
|
7281
|
+
surfaceCoordinator?.clear(surfaceId);
|
|
7282
|
+
if (shouldRestoreFocusRef.current) {
|
|
7283
|
+
restoreFocusToOriginCell();
|
|
7284
|
+
}
|
|
7285
|
+
shouldRestoreFocusRef.current = true;
|
|
7286
|
+
},
|
|
7287
|
+
[restoreFocusToOriginCell, surfaceCoordinator, surfaceId]
|
|
7288
|
+
);
|
|
6488
7289
|
const openSurface = useCallback(() => {
|
|
6489
7290
|
const nextOverflow = updateOverflow();
|
|
6490
7291
|
if (!hasOverflow(nextOverflow ?? overflow)) {
|
|
6491
7292
|
return false;
|
|
6492
7293
|
}
|
|
7294
|
+
surfaceCoordinator?.requestOpen({
|
|
7295
|
+
id: surfaceId,
|
|
7296
|
+
close: closeSurface
|
|
7297
|
+
});
|
|
7298
|
+
shouldRestoreFocusRef.current = true;
|
|
6493
7299
|
setIsOpen(true);
|
|
6494
7300
|
setTabIndex(0);
|
|
6495
7301
|
moveFocusToCell(cellPosition);
|
|
6496
7302
|
return true;
|
|
6497
|
-
}, [
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
7303
|
+
}, [
|
|
7304
|
+
cellPosition,
|
|
7305
|
+
closeSurface,
|
|
7306
|
+
moveFocusToCell,
|
|
7307
|
+
overflow,
|
|
7308
|
+
surfaceCoordinator,
|
|
7309
|
+
surfaceId,
|
|
7310
|
+
updateOverflow
|
|
7311
|
+
]);
|
|
7312
|
+
useEffect(() => {
|
|
7313
|
+
return () => {
|
|
7314
|
+
surfaceCoordinator?.clear(surfaceId);
|
|
7315
|
+
};
|
|
7316
|
+
}, [surfaceCoordinator, surfaceId]);
|
|
6502
7317
|
const handleCellFocus = useCallback(
|
|
6503
7318
|
(event) => {
|
|
6504
7319
|
if (event.target !== cellRef.current) {
|
|
@@ -6614,7 +7429,7 @@ function DataTableOverflowCell(props) {
|
|
|
6614
7429
|
{
|
|
6615
7430
|
ref: viewportRef,
|
|
6616
7431
|
className: styles$9["data-table-body-cell-overflow-viewport"],
|
|
6617
|
-
children: /* @__PURE__ */ jsx("div", { className:
|
|
7432
|
+
children: /* @__PURE__ */ jsx("div", { className: styles$9["data-table-body-cell-overflow-content"], children })
|
|
6618
7433
|
}
|
|
6619
7434
|
);
|
|
6620
7435
|
return /* @__PURE__ */ jsxs(Surface, { id: surfaceId, open: isOpen, children: [
|
|
@@ -6653,6 +7468,7 @@ function DataTableOverflowCell(props) {
|
|
|
6653
7468
|
/* @__PURE__ */ jsx(
|
|
6654
7469
|
Surface.Content,
|
|
6655
7470
|
{
|
|
7471
|
+
intersectionBoundaryRef: surfaceCoordinator?.intersectionBoundaryRef,
|
|
6656
7472
|
initialFocusRef: surfaceContentRef,
|
|
6657
7473
|
onClose: closeSurface,
|
|
6658
7474
|
onCancel: closeSurface,
|
|
@@ -6695,49 +7511,35 @@ function DataTableBodyCell(props) {
|
|
|
6695
7511
|
}
|
|
6696
7512
|
|
|
6697
7513
|
const styles$8 = {
|
|
6698
|
-
"data-table-body-row": "_data-table-body-
|
|
6699
|
-
"data-table-body-
|
|
6700
|
-
"data-table-body-
|
|
6701
|
-
"data-table-body-
|
|
6702
|
-
"data-table-body-
|
|
6703
|
-
"data-table-body-sub-component-
|
|
6704
|
-
"data-table-body-
|
|
6705
|
-
"data-table-body-cell-
|
|
6706
|
-
"data-table-body-cell-
|
|
6707
|
-
"data-table-body-
|
|
6708
|
-
"data-table-body-row-active": "_data-table-body-row-active_hfxpb_96",
|
|
6709
|
-
"data-table-body-row-ancestor-hovered": "_data-table-body-row-ancestor-hovered_hfxpb_107",
|
|
6710
|
-
"data-table-body-sub-component-row-active": "_data-table-body-sub-component-row-active_hfxpb_111",
|
|
6711
|
-
"data-table-body-row-read-only": "_data-table-body-row-read-only_hfxpb_115",
|
|
6712
|
-
"data-table-body-row-top-active": "_data-table-body-row-top-active_hfxpb_131"
|
|
7514
|
+
"data-table-body-row": "_data-table-body-row_1sv3s_4",
|
|
7515
|
+
"data-table-body-row-read-only": "_data-table-body-row-read-only_1sv3s_28",
|
|
7516
|
+
"data-table-body-sub-component-row": "_data-table-body-sub-component-row_1sv3s_35",
|
|
7517
|
+
"data-table-body-virtualized": "_data-table-body-virtualized_1sv3s_69",
|
|
7518
|
+
"data-table-body-row-virtualized": "_data-table-body-row-virtualized_1sv3s_75",
|
|
7519
|
+
"data-table-body-sub-component-container": "_data-table-body-sub-component-container_1sv3s_84",
|
|
7520
|
+
"data-table-body-sub-component-content": "_data-table-body-sub-component-content_1sv3s_90",
|
|
7521
|
+
"data-table-body-cell-group": "_data-table-body-cell-group_1sv3s_98",
|
|
7522
|
+
"data-table-body-cell-depth-indent": "_data-table-body-cell-depth-indent_1sv3s_108",
|
|
7523
|
+
"data-table-body-cell-action-depth-indent": "_data-table-body-cell-action-depth-indent_1sv3s_114"
|
|
6713
7524
|
};
|
|
6714
7525
|
|
|
6715
|
-
const
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
7526
|
+
const HOVER_ATTR = "data-anv-is-hovered-row";
|
|
7527
|
+
const SELECTED_ATTR = "data-anv-is-selected-row";
|
|
7528
|
+
const HAS_SUB_COMPONENT_ATTR = "data-anv-has-sub-component";
|
|
7529
|
+
const ROW_CLICK_IGNORE_SELECTOR = 'button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="menuitem"], [data-anv="checkbox"], [data-anv-editable-cell]';
|
|
7530
|
+
function hasRowSubComponent(value) {
|
|
7531
|
+
if (typeof value !== "object" || value === null || !("subComponent" in value)) {
|
|
7532
|
+
return false;
|
|
6719
7533
|
}
|
|
6720
|
-
return value.
|
|
6721
|
-
}
|
|
6722
|
-
function getRowElementById(doc, rowId) {
|
|
6723
|
-
const rowIdText = String(rowId);
|
|
6724
|
-
const rowElement = doc.querySelector(
|
|
6725
|
-
`[data-row-id="${escapeRowIdSelectorValue(rowIdText)}"]`
|
|
6726
|
-
);
|
|
6727
|
-
return rowElement?.dataset.rowId === rowIdText ? rowElement : void 0;
|
|
7534
|
+
return typeof value.subComponent !== "boolean" && value.subComponent != null;
|
|
6728
7535
|
}
|
|
6729
|
-
function
|
|
6730
|
-
const
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
if (!current) continue;
|
|
6735
|
-
out.push(current.id);
|
|
6736
|
-
if (current.subRows?.length) {
|
|
6737
|
-
stack.push(...current.subRows);
|
|
7536
|
+
function collectDescendantRowIds(row, out) {
|
|
7537
|
+
for (const child of row.subRows) {
|
|
7538
|
+
out.push(child.id);
|
|
7539
|
+
if (child.subRows.length > 0) {
|
|
7540
|
+
collectDescendantRowIds(child, out);
|
|
6738
7541
|
}
|
|
6739
7542
|
}
|
|
6740
|
-
return out;
|
|
6741
7543
|
}
|
|
6742
7544
|
function DataTableBodyRowInner({
|
|
6743
7545
|
// columnOrder is no longer read directly; the row only needs the
|
|
@@ -6753,70 +7555,94 @@ function DataTableBodyRowInner({
|
|
|
6753
7555
|
canExpand,
|
|
6754
7556
|
depth,
|
|
6755
7557
|
parentRowCanExpand,
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
isReadOnly
|
|
6760
|
-
onToggleActive
|
|
7558
|
+
isSelected,
|
|
7559
|
+
isSomeSelected,
|
|
7560
|
+
isAncestorSelected,
|
|
7561
|
+
isReadOnly
|
|
6761
7562
|
}) {
|
|
6762
7563
|
const visibleCells = row.getVisibleCells();
|
|
6763
7564
|
const id = row.id;
|
|
6764
7565
|
const original = row.original;
|
|
6765
|
-
const
|
|
7566
|
+
const hasSubComponent = hasRowSubComponent(original);
|
|
7567
|
+
const rowRef = useRef(null);
|
|
7568
|
+
const isSelectedRow = isSelected || isSomeSelected || isAncestorSelected;
|
|
7569
|
+
const { isRowClickEnabled, clickRow } = useDataTableRowClick();
|
|
7570
|
+
const isRowClickable = isRowClickEnabled && !isReadOnly;
|
|
6766
7571
|
const handleRowClick = useCallback(
|
|
6767
7572
|
(event) => {
|
|
6768
|
-
if (!isActivatable) return;
|
|
6769
|
-
if (isReadOnly) return;
|
|
6770
7573
|
const target = event.target;
|
|
6771
|
-
if (target?.closest(
|
|
6772
|
-
|
|
6773
|
-
row.id,
|
|
6774
|
-
descendantIds
|
|
6775
|
-
);
|
|
7574
|
+
if (target?.closest(ROW_CLICK_IGNORE_SELECTOR)) return;
|
|
7575
|
+
clickRow(row.id);
|
|
6776
7576
|
},
|
|
6777
|
-
[
|
|
7577
|
+
[clickRow, row.id]
|
|
7578
|
+
);
|
|
7579
|
+
const setRowHover = useCallback(
|
|
7580
|
+
(rowEl, on) => {
|
|
7581
|
+
const apply = (el) => {
|
|
7582
|
+
if (!el) return;
|
|
7583
|
+
if (on) {
|
|
7584
|
+
el.setAttribute(HOVER_ATTR, "true");
|
|
7585
|
+
} else {
|
|
7586
|
+
el.removeAttribute(HOVER_ATTR);
|
|
7587
|
+
}
|
|
7588
|
+
};
|
|
7589
|
+
apply(rowEl);
|
|
7590
|
+
const base = rowEl.closest('[data-anv="data-table-base"]');
|
|
7591
|
+
const scope = base ?? rowEl.ownerDocument;
|
|
7592
|
+
apply(scope.querySelector(`#${CSS.escape(`${row.id}-sub-component`)}`));
|
|
7593
|
+
const descendantIds = [];
|
|
7594
|
+
collectDescendantRowIds(row, descendantIds);
|
|
7595
|
+
for (const childId of descendantIds) {
|
|
7596
|
+
apply(scope.querySelector(`[data-row-id="${CSS.escape(childId)}"]`));
|
|
7597
|
+
}
|
|
7598
|
+
},
|
|
7599
|
+
[row]
|
|
6778
7600
|
);
|
|
6779
|
-
const shouldCascadeHover = isActivatable && canExpand;
|
|
6780
7601
|
const handleMouseEnter = useCallback(
|
|
6781
7602
|
(event) => {
|
|
6782
|
-
|
|
6783
|
-
const doc = event.currentTarget.ownerDocument ?? document;
|
|
6784
|
-
const className = styles$8["data-table-body-row-ancestor-hovered"];
|
|
6785
|
-
for (const descendantId of descendantIds) {
|
|
6786
|
-
const el = getRowElementById(doc, descendantId);
|
|
6787
|
-
el?.classList.add(className);
|
|
6788
|
-
}
|
|
7603
|
+
setRowHover(event.currentTarget, true);
|
|
6789
7604
|
},
|
|
6790
|
-
[
|
|
7605
|
+
[setRowHover]
|
|
6791
7606
|
);
|
|
6792
7607
|
const handleMouseLeave = useCallback(
|
|
6793
7608
|
(event) => {
|
|
6794
|
-
|
|
6795
|
-
const doc = event.currentTarget.ownerDocument ?? document;
|
|
6796
|
-
const className = styles$8["data-table-body-row-ancestor-hovered"];
|
|
6797
|
-
for (const descendantId of descendantIds) {
|
|
6798
|
-
const el = getRowElementById(doc, descendantId);
|
|
6799
|
-
el?.classList.remove(className);
|
|
6800
|
-
}
|
|
7609
|
+
setRowHover(event.currentTarget, false);
|
|
6801
7610
|
},
|
|
6802
|
-
[
|
|
7611
|
+
[setRowHover]
|
|
7612
|
+
);
|
|
7613
|
+
const handleSubComponentMouseEnter = useCallback(
|
|
7614
|
+
(event) => {
|
|
7615
|
+
event.currentTarget.setAttribute(HOVER_ATTR, "true");
|
|
7616
|
+
},
|
|
7617
|
+
[]
|
|
7618
|
+
);
|
|
7619
|
+
const handleSubComponentMouseLeave = useCallback(
|
|
7620
|
+
(event) => {
|
|
7621
|
+
event.currentTarget.removeAttribute(HOVER_ATTR);
|
|
7622
|
+
},
|
|
7623
|
+
[]
|
|
6803
7624
|
);
|
|
6804
|
-
const rowRef = useRef(null);
|
|
6805
7625
|
useLayoutEffect(() => {
|
|
6806
|
-
const
|
|
6807
|
-
if (!
|
|
6808
|
-
const
|
|
6809
|
-
const
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
7626
|
+
const rowEl = rowRef.current;
|
|
7627
|
+
if (!rowEl) return;
|
|
7628
|
+
const base = rowEl.closest('[data-anv="data-table-base"]');
|
|
7629
|
+
const scope = base ?? rowEl.ownerDocument;
|
|
7630
|
+
const anyAncestorHovered = row.getParentRows().some((parent) => {
|
|
7631
|
+
const el = scope.querySelector(
|
|
7632
|
+
`[data-row-id="${CSS.escape(parent.id)}"]`
|
|
7633
|
+
);
|
|
7634
|
+
return el?.getAttribute(HOVER_ATTR) === "true";
|
|
7635
|
+
});
|
|
7636
|
+
if (anyAncestorHovered) {
|
|
7637
|
+
rowEl.setAttribute(HOVER_ATTR, "true");
|
|
7638
|
+
}
|
|
7639
|
+
if (rowEl.getAttribute(HOVER_ATTR) === "true") {
|
|
7640
|
+
const subComp = scope.querySelector(
|
|
7641
|
+
`#${CSS.escape(`${row.id}-sub-component`)}`
|
|
7642
|
+
);
|
|
7643
|
+
if (subComp) subComp.setAttribute(HOVER_ATTR, "true");
|
|
6818
7644
|
}
|
|
6819
|
-
}
|
|
7645
|
+
});
|
|
6820
7646
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6821
7647
|
/* @__PURE__ */ jsx(
|
|
6822
7648
|
"div",
|
|
@@ -6827,16 +7653,16 @@ function DataTableBodyRowInner({
|
|
|
6827
7653
|
"aria-expanded": tableHasSubRows && canExpand ? isExpanded : void 0,
|
|
6828
7654
|
"aria-level": tableHasSubRows && (canExpand || parentRowCanExpand) ? depth + 1 : void 0,
|
|
6829
7655
|
"data-row-id": row.id,
|
|
7656
|
+
...hasSubComponent ? { [HAS_SUB_COMPONENT_ATTR]: "true" } : {},
|
|
7657
|
+
...isSelectedRow ? { [SELECTED_ATTR]: "true" } : {},
|
|
7658
|
+
onMouseEnter: handleMouseEnter,
|
|
7659
|
+
onMouseLeave: handleMouseLeave,
|
|
7660
|
+
onClick: isRowClickable ? handleRowClick : void 0,
|
|
7661
|
+
...isRowClickable ? { "data-anv-row-clickable": "true" } : {},
|
|
6830
7662
|
className: cx(styles$8["data-table-body-row"], {
|
|
6831
|
-
[styles$8["data-table-body-row-activatable"]]: isActivatable,
|
|
6832
|
-
[styles$8["data-table-body-row-active"]]: isActive,
|
|
6833
|
-
[styles$8["data-table-body-row-top-active"]]: isTopMostActive,
|
|
6834
7663
|
[styles$8["data-table-body-row-read-only"]]: isReadOnly
|
|
6835
7664
|
}),
|
|
6836
7665
|
style: depth > 0 ? { "--a2-row-depth": depth } : void 0,
|
|
6837
|
-
onClick: isActivatable ? handleRowClick : void 0,
|
|
6838
|
-
onMouseEnter: shouldCascadeHover ? handleMouseEnter : void 0,
|
|
6839
|
-
onMouseLeave: shouldCascadeHover ? handleMouseLeave : void 0,
|
|
6840
7666
|
children: (() => {
|
|
6841
7667
|
let firstDataCellClaimed = false;
|
|
6842
7668
|
return visibleCells.map((cell) => {
|
|
@@ -6870,14 +7696,16 @@ function DataTableBodyRowInner({
|
|
|
6870
7696
|
})()
|
|
6871
7697
|
}
|
|
6872
7698
|
),
|
|
6873
|
-
isExpanded &&
|
|
7699
|
+
isExpanded && hasSubComponent && /* @__PURE__ */ jsx(
|
|
6874
7700
|
"div",
|
|
6875
7701
|
{
|
|
6876
7702
|
id: `${id}-sub-component`,
|
|
6877
7703
|
"aria-hidden": !isExpanded,
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
7704
|
+
...{ [HAS_SUB_COMPONENT_ATTR]: "true" },
|
|
7705
|
+
...isSelectedRow ? { [SELECTED_ATTR]: "true" } : {},
|
|
7706
|
+
className: styles$8["data-table-body-sub-component-row"],
|
|
7707
|
+
onMouseEnter: handleSubComponentMouseEnter,
|
|
7708
|
+
onMouseLeave: handleSubComponentMouseLeave,
|
|
6881
7709
|
children: /* @__PURE__ */ jsx("div", { className: styles$8["data-table-body-sub-component-container"], children: /* @__PURE__ */ jsx(Flex, { className: styles$8["data-table-body-sub-component-content"], children: original.subComponent }) })
|
|
6882
7710
|
}
|
|
6883
7711
|
)
|
|
@@ -6888,7 +7716,7 @@ function areRowPropsEqual(prev, next) {
|
|
|
6888
7716
|
if (!getRowVersion) {
|
|
6889
7717
|
return false;
|
|
6890
7718
|
}
|
|
6891
|
-
return prev.row.id === next.row.id && getRowVersion(prev.row.original) === getRowVersion(next.row.original) && prev.rowIndex === next.rowIndex && prev.isExpanded === next.isExpanded && prev.canExpand === next.canExpand && prev.depth === next.depth && prev.parentRowCanExpand === next.parentRowCanExpand && prev.tableHasSubRows === next.tableHasSubRows && prev.columnOrder === next.columnOrder && prev.isSelected === next.isSelected && prev.isSomeSelected === next.isSomeSelected && prev.
|
|
7719
|
+
return prev.row.id === next.row.id && getRowVersion(prev.row.original) === getRowVersion(next.row.original) && prev.rowIndex === next.rowIndex && prev.isExpanded === next.isExpanded && prev.canExpand === next.canExpand && prev.depth === next.depth && prev.parentRowCanExpand === next.parentRowCanExpand && prev.tableHasSubRows === next.tableHasSubRows && prev.columnOrder === next.columnOrder && prev.isSelected === next.isSelected && prev.isSomeSelected === next.isSomeSelected && prev.isAncestorSelected === next.isAncestorSelected && prev.isReadOnly === next.isReadOnly;
|
|
6892
7720
|
}
|
|
6893
7721
|
const DataTableBodyRow = memo$1(
|
|
6894
7722
|
DataTableBodyRowInner,
|
|
@@ -6930,67 +7758,44 @@ const useColumnOrder = ({ table }) => {
|
|
|
6930
7758
|
};
|
|
6931
7759
|
};
|
|
6932
7760
|
|
|
6933
|
-
function getIsRowActivatable(row, isActivatable) {
|
|
6934
|
-
if (!isActivatable) return false;
|
|
6935
|
-
if (typeof isActivatable === "function") {
|
|
6936
|
-
return isActivatable(row.original);
|
|
6937
|
-
}
|
|
6938
|
-
return true;
|
|
6939
|
-
}
|
|
6940
|
-
function getIsRowTopMostActive(row, activeRowMap) {
|
|
6941
|
-
if (!activeRowMap[row.id]) return false;
|
|
6942
|
-
if (!row.getCanExpand()) return false;
|
|
6943
|
-
let ancestor = row.getParentRow();
|
|
6944
|
-
while (ancestor) {
|
|
6945
|
-
if (activeRowMap[ancestor.id]) return false;
|
|
6946
|
-
ancestor = ancestor.getParentRow();
|
|
6947
|
-
}
|
|
6948
|
-
return true;
|
|
6949
|
-
}
|
|
6950
7761
|
function NonVirtualizedContent({
|
|
6951
7762
|
table,
|
|
6952
7763
|
hasSubRows,
|
|
6953
7764
|
getRowVersion,
|
|
6954
|
-
|
|
6955
|
-
activeRowMap,
|
|
6956
|
-
readOnlyRowMap,
|
|
6957
|
-
onToggleActive
|
|
7765
|
+
readOnlyRowMap
|
|
6958
7766
|
}) {
|
|
6959
7767
|
const { columnOrder, columnIndexMap } = useColumnOrder({ table });
|
|
6960
7768
|
const headerCount = table.getHeaderGroups().length;
|
|
6961
|
-
return /* @__PURE__ */ jsx(Fragment, { children: table.getRowModel().rows.map((row, rowIndex) =>
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
)
|
|
7769
|
+
return /* @__PURE__ */ jsx(Fragment, { children: table.getRowModel().rows.map((row, rowIndex) => {
|
|
7770
|
+
const isAncestorSelected = row.getParentRows().some((parent) => parent.getIsSelected());
|
|
7771
|
+
return /* @__PURE__ */ jsx(
|
|
7772
|
+
DataTableBodyRow,
|
|
7773
|
+
{
|
|
7774
|
+
columnOrder,
|
|
7775
|
+
columnIndexMap,
|
|
7776
|
+
row,
|
|
7777
|
+
rowIndex: rowIndex + headerCount,
|
|
7778
|
+
tableHasSubRows: hasSubRows,
|
|
7779
|
+
isExpanded: row.getIsExpanded(),
|
|
7780
|
+
canExpand: row.getCanExpand(),
|
|
7781
|
+
depth: row.depth,
|
|
7782
|
+
parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
|
|
7783
|
+
isSelected: row.getIsSelected(),
|
|
7784
|
+
isSomeSelected: row.getIsSomeSelected(),
|
|
7785
|
+
isAncestorSelected,
|
|
7786
|
+
isReadOnly: !!readOnlyRowMap[row.id],
|
|
7787
|
+
getRowVersion
|
|
7788
|
+
},
|
|
7789
|
+
row.id
|
|
7790
|
+
);
|
|
7791
|
+
}) });
|
|
6984
7792
|
}
|
|
6985
7793
|
function VirtualizedContent({
|
|
6986
7794
|
table,
|
|
6987
7795
|
hasSubRows,
|
|
6988
7796
|
virtualizer,
|
|
6989
7797
|
getRowVersion,
|
|
6990
|
-
|
|
6991
|
-
activeRowMap,
|
|
6992
|
-
readOnlyRowMap,
|
|
6993
|
-
onToggleActive
|
|
7798
|
+
readOnlyRowMap
|
|
6994
7799
|
}) {
|
|
6995
7800
|
const { columnOrder, columnIndexMap } = useColumnOrder({ table });
|
|
6996
7801
|
const headerCount = table.getHeaderGroups().length;
|
|
@@ -7011,6 +7816,7 @@ function VirtualizedContent({
|
|
|
7011
7816
|
style: { height: `${totalSize}px` },
|
|
7012
7817
|
children: virtualItems.map((virtualRow) => {
|
|
7013
7818
|
const row = rows[virtualRow.index];
|
|
7819
|
+
const isAncestorSelected = row.getParentRows().some((parent) => parent.getIsSelected());
|
|
7014
7820
|
return /* @__PURE__ */ jsx(
|
|
7015
7821
|
"div",
|
|
7016
7822
|
{
|
|
@@ -7032,11 +7838,8 @@ function VirtualizedContent({
|
|
|
7032
7838
|
parentRowCanExpand: row.getParentRow()?.getCanExpand() ?? false,
|
|
7033
7839
|
isSelected: row.getIsSelected(),
|
|
7034
7840
|
isSomeSelected: row.getIsSomeSelected(),
|
|
7035
|
-
|
|
7036
|
-
isActive: !!activeRowMap[row.id],
|
|
7037
|
-
isTopMostActive: getIsRowTopMostActive(row, activeRowMap),
|
|
7841
|
+
isAncestorSelected,
|
|
7038
7842
|
isReadOnly: !!readOnlyRowMap[row.id],
|
|
7039
|
-
onToggleActive,
|
|
7040
7843
|
getRowVersion
|
|
7041
7844
|
}
|
|
7042
7845
|
)
|
|
@@ -7053,10 +7856,7 @@ function DataTableBody(props) {
|
|
|
7053
7856
|
hasSubRows,
|
|
7054
7857
|
virtualizer,
|
|
7055
7858
|
getRowVersion,
|
|
7056
|
-
isActivatable,
|
|
7057
|
-
activeRowMap,
|
|
7058
7859
|
readOnlyRowMap,
|
|
7059
|
-
onToggleActive,
|
|
7060
7860
|
...rest
|
|
7061
7861
|
} = props;
|
|
7062
7862
|
return /* @__PURE__ */ jsx(TableBody, { type: "data-table", ...rest, children: virtualizer ? /* @__PURE__ */ jsx(
|
|
@@ -7066,10 +7866,7 @@ function DataTableBody(props) {
|
|
|
7066
7866
|
hasSubRows,
|
|
7067
7867
|
virtualizer,
|
|
7068
7868
|
getRowVersion,
|
|
7069
|
-
|
|
7070
|
-
activeRowMap,
|
|
7071
|
-
readOnlyRowMap,
|
|
7072
|
-
onToggleActive
|
|
7869
|
+
readOnlyRowMap
|
|
7073
7870
|
}
|
|
7074
7871
|
) : /* @__PURE__ */ jsx(
|
|
7075
7872
|
NonVirtualizedContent,
|
|
@@ -7077,10 +7874,7 @@ function DataTableBody(props) {
|
|
|
7077
7874
|
table,
|
|
7078
7875
|
hasSubRows,
|
|
7079
7876
|
getRowVersion,
|
|
7080
|
-
|
|
7081
|
-
activeRowMap,
|
|
7082
|
-
readOnlyRowMap,
|
|
7083
|
-
onToggleActive
|
|
7877
|
+
readOnlyRowMap
|
|
7084
7878
|
}
|
|
7085
7879
|
) });
|
|
7086
7880
|
}
|
|
@@ -8577,6 +9371,58 @@ function DTFocusProvider({
|
|
|
8577
9371
|
return /* @__PURE__ */ jsx(DTFocusStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx(DTFocusDispatchContext.Provider, { value: dispatch, children }) });
|
|
8578
9372
|
}
|
|
8579
9373
|
|
|
9374
|
+
function DataTableSurfaceCoordinatorProvider({
|
|
9375
|
+
children,
|
|
9376
|
+
intersectionBoundaryRef
|
|
9377
|
+
}) {
|
|
9378
|
+
const activeSurfaceRef = useRef(null);
|
|
9379
|
+
const requestOpen = useCallback(
|
|
9380
|
+
(registration) => {
|
|
9381
|
+
const activeSurface = activeSurfaceRef.current;
|
|
9382
|
+
if (activeSurface && activeSurface.id !== registration.id) {
|
|
9383
|
+
activeSurface.close({ restoreFocus: false });
|
|
9384
|
+
}
|
|
9385
|
+
activeSurfaceRef.current = registration;
|
|
9386
|
+
},
|
|
9387
|
+
[]
|
|
9388
|
+
);
|
|
9389
|
+
const clear = useCallback((id) => {
|
|
9390
|
+
if (activeSurfaceRef.current?.id === id) {
|
|
9391
|
+
activeSurfaceRef.current = null;
|
|
9392
|
+
}
|
|
9393
|
+
}, []);
|
|
9394
|
+
const value = useMemo(
|
|
9395
|
+
() => ({
|
|
9396
|
+
requestOpen,
|
|
9397
|
+
clear,
|
|
9398
|
+
intersectionBoundaryRef
|
|
9399
|
+
}),
|
|
9400
|
+
[clear, intersectionBoundaryRef, requestOpen]
|
|
9401
|
+
);
|
|
9402
|
+
return /* @__PURE__ */ jsx(DataTableSurfaceCoordinatorContext.Provider, { value, children });
|
|
9403
|
+
}
|
|
9404
|
+
|
|
9405
|
+
function DataTableRowClickProvider({
|
|
9406
|
+
onClickRow,
|
|
9407
|
+
readOnlyRowMap,
|
|
9408
|
+
children
|
|
9409
|
+
}) {
|
|
9410
|
+
const onClickRowRef = useRef(onClickRow);
|
|
9411
|
+
onClickRowRef.current = onClickRow;
|
|
9412
|
+
const readOnlyRowMapRef = useRef(readOnlyRowMap);
|
|
9413
|
+
readOnlyRowMapRef.current = readOnlyRowMap;
|
|
9414
|
+
const clickRow = useCallback((rowId) => {
|
|
9415
|
+
if (readOnlyRowMapRef.current[rowId]) return;
|
|
9416
|
+
onClickRowRef.current?.(rowId);
|
|
9417
|
+
}, []);
|
|
9418
|
+
const isRowClickEnabled = !!onClickRow;
|
|
9419
|
+
const value = useMemo(
|
|
9420
|
+
() => ({ isRowClickEnabled, clickRow }),
|
|
9421
|
+
[isRowClickEnabled, clickRow]
|
|
9422
|
+
);
|
|
9423
|
+
return /* @__PURE__ */ jsx(DataTableRowClickContext.Provider, { value, children });
|
|
9424
|
+
}
|
|
9425
|
+
|
|
8580
9426
|
const VIRTUALIZATION_THRESHOLD = 50;
|
|
8581
9427
|
const DEFAULT_ESTIMATED_ROW_HEIGHT = 35;
|
|
8582
9428
|
function useDataTableVirtualizer({
|
|
@@ -8617,18 +9463,15 @@ function DataTableInner(props, ref) {
|
|
|
8617
9463
|
data: dataProp,
|
|
8618
9464
|
columns: columnsProp,
|
|
8619
9465
|
customFooter,
|
|
8620
|
-
defaultActiveRowIds,
|
|
8621
9466
|
defaultExpandedRowIds,
|
|
8622
9467
|
defaultSelectedRowIds,
|
|
8623
9468
|
defaultSortedColumn,
|
|
8624
9469
|
disableExpandAll,
|
|
8625
9470
|
disableSelectAll,
|
|
8626
9471
|
expandedRowIds,
|
|
8627
|
-
activeRowIds,
|
|
8628
|
-
isActivatable,
|
|
8629
9472
|
isSelectable,
|
|
8630
|
-
onActivateRow,
|
|
8631
9473
|
onSelectRow,
|
|
9474
|
+
onClickRow,
|
|
8632
9475
|
readOnlyRowIds,
|
|
8633
9476
|
onSort,
|
|
8634
9477
|
onExpandRow,
|
|
@@ -8657,41 +9500,10 @@ function DataTableInner(props, ref) {
|
|
|
8657
9500
|
onSelectRow?.(Object.keys(newRowSelection));
|
|
8658
9501
|
}
|
|
8659
9502
|
});
|
|
8660
|
-
const [rowActivation, setRowActivation] = useOptionallyControlledState({
|
|
8661
|
-
controlledValue: isActivatable && activeRowIds ? Object.fromEntries(activeRowIds.map((id) => [id, true])) : void 0,
|
|
8662
|
-
defaultValue: isActivatable ? defaultActiveRowIds ? Object.fromEntries(defaultActiveRowIds.map((id) => [id, true])) : {} : {},
|
|
8663
|
-
onChange: (newRowActivation) => {
|
|
8664
|
-
onActivateRow?.(Object.keys(newRowActivation));
|
|
8665
|
-
}
|
|
8666
|
-
});
|
|
8667
|
-
const activeRowMap = rowActivation ?? {};
|
|
8668
9503
|
const readOnlyRowMap = useMemo(
|
|
8669
9504
|
() => readOnlyRowIds ? Object.fromEntries(readOnlyRowIds.map((id) => [String(id), true])) : {},
|
|
8670
9505
|
[readOnlyRowIds]
|
|
8671
9506
|
);
|
|
8672
|
-
const setRowActivationRef = useRef(setRowActivation);
|
|
8673
|
-
setRowActivationRef.current = setRowActivation;
|
|
8674
|
-
const toggleRowActivation = useCallback(
|
|
8675
|
-
(rowId, descendantIds = []) => {
|
|
8676
|
-
setRowActivationRef.current((prev) => {
|
|
8677
|
-
const prevMap = prev ?? {};
|
|
8678
|
-
const rowKey = String(rowId);
|
|
8679
|
-
const descendantKeys = descendantIds.map(String);
|
|
8680
|
-
const next = { ...prevMap };
|
|
8681
|
-
if (prevMap[rowKey]) {
|
|
8682
|
-
delete next[rowKey];
|
|
8683
|
-
descendantKeys.forEach((key) => delete next[key]);
|
|
8684
|
-
} else {
|
|
8685
|
-
next[rowKey] = true;
|
|
8686
|
-
descendantKeys.forEach((key) => {
|
|
8687
|
-
next[key] = true;
|
|
8688
|
-
});
|
|
8689
|
-
}
|
|
8690
|
-
return next;
|
|
8691
|
-
});
|
|
8692
|
-
},
|
|
8693
|
-
[]
|
|
8694
|
-
);
|
|
8695
9507
|
const [sorting, setSorting] = useOptionallyControlledState({
|
|
8696
9508
|
controlledValue: sortedColumn ? [sortedColumn] : void 0,
|
|
8697
9509
|
defaultValue: defaultSortedColumn ? [defaultSortedColumn] : void 0,
|
|
@@ -8923,18 +9735,23 @@ function DataTableInner(props, ref) {
|
|
|
8923
9735
|
}
|
|
8924
9736
|
) });
|
|
8925
9737
|
},
|
|
8926
|
-
cell: ({ row }) =>
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
9738
|
+
cell: ({ row }) => {
|
|
9739
|
+
const original = row.original;
|
|
9740
|
+
const isReadOnlyRow = Boolean(readOnlyRowMap[String(original.id)]);
|
|
9741
|
+
return /* @__PURE__ */ jsx(
|
|
9742
|
+
Checkbox,
|
|
9743
|
+
{
|
|
9744
|
+
tabIndex: -1,
|
|
9745
|
+
"aria-label": row.getIsSelected() ? "Deselect row" : "Select row",
|
|
9746
|
+
checked: row.getIsSelected(),
|
|
9747
|
+
disabled: !row.getCanSelect(),
|
|
9748
|
+
readOnly: isReadOnlyRow,
|
|
9749
|
+
indeterminate: row.getIsSomeSelected(),
|
|
9750
|
+
onChange: row.getToggleSelectedHandler(),
|
|
9751
|
+
"data-cell-action": "select"
|
|
9752
|
+
}
|
|
9753
|
+
);
|
|
9754
|
+
}
|
|
8938
9755
|
});
|
|
8939
9756
|
}
|
|
8940
9757
|
return tableColumns;
|
|
@@ -8946,7 +9763,8 @@ function DataTableInner(props, ref) {
|
|
|
8946
9763
|
hasRowStatus,
|
|
8947
9764
|
hasSubComponent,
|
|
8948
9765
|
isExpandable,
|
|
8949
|
-
isSelectable
|
|
9766
|
+
isSelectable,
|
|
9767
|
+
readOnlyRowMap
|
|
8950
9768
|
]);
|
|
8951
9769
|
const table = useReactTable({
|
|
8952
9770
|
data: tableData ?? [],
|
|
@@ -9041,6 +9859,7 @@ function DataTableInner(props, ref) {
|
|
|
9041
9859
|
[bodyRowCount, headerRowCount, footerLength]
|
|
9042
9860
|
);
|
|
9043
9861
|
const isEmpty = !isLoading && (!tableData || tableData.length === 0);
|
|
9862
|
+
const isTrulyEmpty = isEmpty && (isCursorPagination ? !paginationObject?.hasPrevPage && !paginationObject?.hasNextPage : !totalItemCount);
|
|
9044
9863
|
const { mode: themeMode } = useContext(ThemeProviderContext);
|
|
9045
9864
|
const { mode: sysMode } = usePrefersColorScheme();
|
|
9046
9865
|
const colorSchemeMode = themeMode ?? sysMode;
|
|
@@ -9086,6 +9905,9 @@ function DataTableInner(props, ref) {
|
|
|
9086
9905
|
const columnCount = useMemo(() => {
|
|
9087
9906
|
return headers.filter((header) => header.subHeaders?.length === 0).length;
|
|
9088
9907
|
}, [headers]);
|
|
9908
|
+
const containerClassName = cx(className, {
|
|
9909
|
+
[styles["container-with-pagination"]]: pagination && !isTrulyEmpty
|
|
9910
|
+
});
|
|
9089
9911
|
return /* @__PURE__ */ jsx(
|
|
9090
9912
|
DTFocusProvider,
|
|
9091
9913
|
{
|
|
@@ -9096,7 +9918,7 @@ function DataTableInner(props, ref) {
|
|
|
9096
9918
|
rightPinnedWidth: table.getRightTotalSize(),
|
|
9097
9919
|
virtualizer: rowVirtualizer,
|
|
9098
9920
|
headerRowCount,
|
|
9099
|
-
children: /* @__PURE__ */ jsxs(
|
|
9921
|
+
children: /* @__PURE__ */ jsx(DataTableSurfaceCoordinatorProvider, { intersectionBoundaryRef: tableRef, children: /* @__PURE__ */ jsxs(
|
|
9100
9922
|
TableContainer,
|
|
9101
9923
|
{
|
|
9102
9924
|
...rest,
|
|
@@ -9105,9 +9927,7 @@ function DataTableInner(props, ref) {
|
|
|
9105
9927
|
...styleCombined,
|
|
9106
9928
|
width: cssVars["--a2-table-width"]
|
|
9107
9929
|
},
|
|
9108
|
-
className:
|
|
9109
|
-
[styles["container-with-pagination"]]: pagination
|
|
9110
|
-
}),
|
|
9930
|
+
className: containerClassName,
|
|
9111
9931
|
children: [
|
|
9112
9932
|
/* @__PURE__ */ jsxs(
|
|
9113
9933
|
TableBase,
|
|
@@ -9120,16 +9940,20 @@ function DataTableInner(props, ref) {
|
|
|
9120
9940
|
children: [
|
|
9121
9941
|
/* @__PURE__ */ jsx(DataTableHeader, { table, tableRef }),
|
|
9122
9942
|
/* @__PURE__ */ jsx(
|
|
9123
|
-
|
|
9943
|
+
DataTableRowClickProvider,
|
|
9124
9944
|
{
|
|
9125
|
-
|
|
9126
|
-
hasSubRows,
|
|
9127
|
-
virtualizer: rowVirtualizer,
|
|
9128
|
-
getRowVersion,
|
|
9129
|
-
isActivatable,
|
|
9130
|
-
activeRowMap,
|
|
9945
|
+
onClickRow,
|
|
9131
9946
|
readOnlyRowMap,
|
|
9132
|
-
|
|
9947
|
+
children: /* @__PURE__ */ jsx(
|
|
9948
|
+
DataTableBody,
|
|
9949
|
+
{
|
|
9950
|
+
table,
|
|
9951
|
+
hasSubRows,
|
|
9952
|
+
virtualizer: rowVirtualizer,
|
|
9953
|
+
getRowVersion,
|
|
9954
|
+
readOnlyRowMap
|
|
9955
|
+
}
|
|
9956
|
+
)
|
|
9133
9957
|
}
|
|
9134
9958
|
),
|
|
9135
9959
|
isEmpty && emptyState && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -9178,7 +10002,7 @@ function DataTableInner(props, ref) {
|
|
|
9178
10002
|
}
|
|
9179
10003
|
)
|
|
9180
10004
|
] }),
|
|
9181
|
-
hasFooters && /* @__PURE__ */ jsx(
|
|
10005
|
+
hasFooters && !isTrulyEmpty && /* @__PURE__ */ jsx(
|
|
9182
10006
|
DataTableFooter,
|
|
9183
10007
|
{
|
|
9184
10008
|
className: pagination ? styles["footer-with-pagination"] : void 0,
|
|
@@ -9190,7 +10014,7 @@ function DataTableInner(props, ref) {
|
|
|
9190
10014
|
]
|
|
9191
10015
|
}
|
|
9192
10016
|
),
|
|
9193
|
-
pagination && (isCursorPagination ? /* @__PURE__ */ jsx(
|
|
10017
|
+
pagination && !isTrulyEmpty && (isCursorPagination ? /* @__PURE__ */ jsx(
|
|
9194
10018
|
DataTableCursorPagination,
|
|
9195
10019
|
{
|
|
9196
10020
|
itemsPerPage: rowsPerPage,
|
|
@@ -9223,11 +10047,11 @@ function DataTableInner(props, ref) {
|
|
|
9223
10047
|
))
|
|
9224
10048
|
]
|
|
9225
10049
|
}
|
|
9226
|
-
)
|
|
10050
|
+
) })
|
|
9227
10051
|
}
|
|
9228
10052
|
);
|
|
9229
10053
|
}
|
|
9230
10054
|
const DataTable = forwardRef(DataTableInner);
|
|
9231
10055
|
|
|
9232
10056
|
export { COLUMN_TYPE_DEFAULTS as C, DataTable as D, chipsFormatter as a, booleanFormatter as b, createColumnHelper$1 as c, currencyFormatter as d, dateFormatter as e, dateTimeFormatter as f, getColumnTypeDefaults as g, htmlFormatter as h, dateFormatPresets as i, timeFormatter as j, markdownFormatter as m, numberFormatter as n, percentFormatter as p, resolveColumnTypeConfig as r, timeFormatPresets as t, yearlessDateFormatter as y };
|
|
9233
|
-
//# sourceMappingURL=DataTable-
|
|
10057
|
+
//# sourceMappingURL=DataTable-B_GYRuR1.js.map
|