@economic/taco 2.19.0 → 2.20.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Provider/Localization.d.ts +18 -0
- package/dist/components/Report/components/Body/Body.d.ts +8 -0
- package/dist/components/Report/components/Cell/Cell.d.ts +3 -0
- package/dist/components/Report/components/Cell/DisplayCell.d.ts +7 -0
- package/dist/components/Report/components/Cell/GroupedCell.d.ts +7 -0
- package/dist/components/Report/components/Cell/util.d.ts +18 -0
- package/dist/components/Report/components/Footer/Footer.d.ts +6 -0
- package/dist/components/Report/components/Footer/Summary.d.ts +7 -0
- package/dist/components/Report/components/Header/Header.d.ts +37 -0
- package/dist/components/Report/components/Header/components/Goto.d.ts +6 -0
- package/dist/components/Report/components/Header/components/Menu.d.ts +17 -0
- package/dist/components/Report/components/Header/components/Resizer.d.ts +12 -0
- package/dist/components/Report/components/Header/components/SortIndicator.d.ts +15 -0
- package/dist/components/Report/components/Header/util.d.ts +4 -0
- package/dist/components/Report/components/Internal/Actions.d.ts +13 -0
- package/dist/components/Report/components/Internal/Expansion.d.ts +4 -0
- package/dist/components/Report/components/Internal/Selection.d.ts +4 -0
- package/dist/components/Report/components/Row/DisplayRow.d.ts +16 -0
- package/dist/components/Report/components/Row/Row.d.ts +8 -0
- package/dist/components/Report/components/Row/RowContext.d.ts +9 -0
- package/dist/components/Report/components/Row/SkeletonRow.d.ts +10 -0
- package/dist/components/Report/components/Toolbar/Toolbar.d.ts +15 -0
- package/dist/components/Report/components/Toolbar/components/Filters/Filters.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +12 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +9 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterComparator.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterValue.d.ts +10 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +12 -0
- package/dist/components/Report/components/Toolbar/components/Filters/util.d.ts +2 -0
- package/dist/components/Report/components/Toolbar/components/Print/Print.d.ts +9 -0
- package/dist/components/Report/components/Toolbar/components/Print/PrintDialog.d.ts +17 -0
- package/dist/components/Report/components/Toolbar/components/Search/Search.d.ts +8 -0
- package/dist/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Settings/Settings.d.ts +8 -0
- package/dist/components/Report/features/useReportExport.d.ts +3 -0
- package/dist/components/Report/styles/useColumnPinningStylesheet.d.ts +2 -0
- package/dist/components/Report/styles/useCssGridStylesheet.d.ts +3 -0
- package/dist/components/Report/styles/useStylesheet.d.ts +3 -0
- package/dist/components/Report/styles/util.d.ts +3 -0
- package/dist/components/Report/types.d.ts +20 -0
- package/dist/components/Report/useReport.d.ts +14 -0
- package/dist/components/Report/util/rows.d.ts +7 -0
- package/dist/components/Report/util/useTableGlobalShortcuts.d.ts +4 -0
- package/dist/components/Report/util/useTableRenderer.d.ts +9 -0
- package/dist/components/Table3/components/rows/Row.d.ts +1 -1
- package/dist/components/Table3/hooks/features/usePrinting.d.ts +7 -0
- package/dist/components/Table3/hooks/useTable.d.ts +5 -5
- package/dist/components/Table3/types.d.ts +21 -3
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +1 -1
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +2 -2
- package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
- package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js +1 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +5 -5
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Form/Form.js +1 -1
- package/dist/esm/packages/taco/src/components/Form/Form.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +2 -2
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/Header.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Button.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Link.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Logo.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Logo.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/IconButton/IconButton.js +1 -1
- package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/Layout.js +2 -2
- package/dist/esm/packages/taco/src/components/Layout/Layout.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Page.js +2 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Page.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/Listbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +2 -2
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Progress/Progress.js +1 -1
- package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +18 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/util.js +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +3 -3
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Title.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Title.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js +1 -1
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
- package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +1 -6
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +4 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +5 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/{primitives/Table/useTable/features/useTablePrinting.js → components/Table3/hooks/features/usePrinting.js} +3 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +4 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +1 -1
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +2 -2
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toast.js +2 -2
- package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +2 -2
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +1 -1
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js +27 -0
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +11 -21
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +42 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +10 -8
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +7 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -0
- package/dist/esm/packages/taco/src/utils/dom.js +10 -1
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/primitives/Table/types.d.ts +187 -2
- package/dist/primitives/Table/useTable/features/useTableColumnFreezing.d.ts +6 -0
- package/dist/primitives/Table/useTable/features/useTableFooter.d.ts +3 -0
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -0
- package/dist/primitives/Table/useTable/features/useTableRef.d.ts +4 -0
- package/dist/primitives/Table/useTable/features/useTableRowActions.d.ts +6 -0
- package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +0 -1
- package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +1 -1
- package/dist/primitives/Table/useTable/features/useTableRowExpansion.d.ts +5 -0
- package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +1 -1
- package/dist/primitives/Table/useTable/features/useTableRowGroups.d.ts +5 -0
- package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +1 -0
- package/dist/primitives/Table/useTable/features/useTableSearch.d.ts +11 -0
- package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +5 -2
- package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableRowHeightListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableSearchListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableSettingsListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/useTable.d.ts +57 -0
- package/dist/primitives/Table/useTable/util/columns.d.ts +7 -1
- package/dist/primitives/Table/useTable/util/columns.spec.d.ts +1 -0
- package/dist/primitives/Table/useTable/util/filtering.d.ts +7 -0
- package/dist/primitives/Table/useTable/util/presets.d.ts +2 -0
- package/dist/primitives/Table/useTable/util/search.d.ts +2 -0
- package/dist/primitives/Table/useTable/util/settings.d.ts +13 -0
- package/dist/primitives/Table/useTable/util/setup.d.ts +14 -0
- package/dist/primitives/Table/useTable/util/sorting.d.ts +2 -0
- package/dist/primitives/Table/useTableDataLoader.d.ts +23 -0
- package/dist/taco.cjs.development.js +149 -68
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/package.json +4 -3
- package/types.json +20882 -7749
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +0 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { createShortcutKeyDownHandler } from '../../../../../utils/keyboard.js';
|
4
4
|
import { IconButton } from '../../../../IconButton/IconButton.js';
|
5
5
|
import { useLocalization } from '../../../../Provider/Localization.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\nimport { createShortcutKeyDownHandler } from '../../../../../utils/keyboard';\nimport { getTableLeftScrollDistance } from '../../../util/scrolling';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n const ref = React.useRef<HTMLButtonElement>(null);\n\n const gotoShortcut = 'g';\n\n React.useEffect(() => {\n const { frozenColumnIndex: externalFrozenColumnIndex = -1, frozenInternalColumnCount = 0 } = tableMeta.columnFreezing;\n\n const handler = createShortcutKeyDownHandler(\n gotoShortcut,\n () => {\n // Only execute the below code if the header menu has goto menu item\n if (handleGoto) {\n const tableElement = tableMeta.tableRef.current;\n const frozenColumnIndex =\n externalFrozenColumnIndex > -1\n ? externalFrozenColumnIndex + frozenInternalColumnCount\n : frozenInternalColumnCount - 1;\n const parentHeader = ref.current?.closest('[role=\"columnheader\"]');\n\n if (!tableElement || !parentHeader) {\n return;\n }\n\n const leftScrollDistance = getTableLeftScrollDistance(tableElement, parentHeader, frozenColumnIndex);\n\n if (leftScrollDistance !== null) {\n tableElement.scrollLeft = leftScrollDistance;\n }\n }\n },\n // Prevents the stopping of event propagation\n false\n );\n\n document.addEventListener('keydown', handler);\n\n return () => document.removeEventListener('keydown', handler);\n }, [tableMeta.columnFreezing.frozenColumnIndex, handleGoto]);\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.rowActive.setRowActiveIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut={gotoShortcut}>\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n ref={ref}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","ref","useRef","gotoShortcut","useEffect","frozenColumnIndex","externalFrozenColumnIndex","frozenInternalColumnCount","handler","createShortcutKeyDownHandler","_ref$current","tableElement","tableRef","current","parentHeader","closest","leftScrollDistance","getTableLeftScrollDistance","scrollLeft","document","addEventListener","removeEventListener","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","rowActive","setRowActiveIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;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,CAAC;QAAE0G,OAAO,EAAElF;OAAW,CAAC;MAC/C,MAAMmF,WAAW,GAAGrF,cAAK,CAACsF,QAAQ,CAACC,OAAO,CAACJ,UAAU,CAACpG,KAAK,CAACyG,QAAQ,CAACzG,KAAK,CAACyG,QAAQ,CAAkB;MAErG,IAAIH,WAAW,CAACI,MAAM,EAAE;QACpB,IAAIvC,SAAS,CAACuC,MAAM,EAAE;UAClBvC,SAAS,CAACI,IAAI,eAACtD,6BAACuD,MAAa,CAACmC,SAAS,OAAG,CAAC;;QAG/CxC,SAAS,CAACI,IAAI,CAAC,GAAG+B,WAAW,CAAC;;;IAItC,OAAOnC,SAAS,CAACyC,GAAG,CAAC,CAACC,IAAI,EAAEC,GAAG,kBAAK7F,cAAK,CAAC8F,YAAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CACCnH,IAAI,EACJS,KAAK,EACLH,SAAS,EACTC,OAAO,EACPC,OAAO,EACPG,UAAU,EACVI,gBAAgB,EAChBE,aAAa,EACb5B,SAAS,CAACY,cAAc,CAAC8B,iBAAiB,CAC7C,CAAC;EAEF,oBACIT,6BAAC+F,UAAU;IACPjD,SAAS,EAAEA,SAAS;IACpBW,IAAI,EAAC,MAAM;IACX/E,IAAI,EACAkD,cAAc,GACR1B,SAAS,GACT8F,SAAS,mBACLhG,6BAACuD,MAAa,oBAAKyC,SAAS,gBACxBhG,6BAACuD,MAAa,CAAC0C,OAAO,QAAEjD,eAAe,CAAyB,CACpD,CACnB;IAEXlD,OAAO,EAAE8B,cAAc;IACvBsE,cAAc,EAAE9C,KAAK,IAAIA,KAAK,CAAC+C,cAAc,EAAE;IAC/C9F,GAAG,EAAEA;IACP;AAEV;;;;"}
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\nimport { createShortcutKeyDownHandler } from '../../../../../utils/keyboard';\nimport { getTableLeftScrollDistance } from '../../../util/scrolling';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n const ref = React.useRef<HTMLButtonElement>(null);\n\n const gotoShortcut = 'g';\n\n React.useEffect(() => {\n const { frozenColumnIndex: externalFrozenColumnIndex = -1, frozenInternalColumnCount = 0 } = tableMeta.columnFreezing;\n\n const handler = createShortcutKeyDownHandler(\n gotoShortcut,\n () => {\n // Only execute the below code if the header menu has goto menu item\n if (handleGoto) {\n const tableElement = tableMeta.tableRef.current;\n const frozenColumnIndex =\n externalFrozenColumnIndex > -1\n ? externalFrozenColumnIndex + frozenInternalColumnCount\n : frozenInternalColumnCount - 1;\n const parentHeader = ref.current?.closest('[role=\"columnheader\"]');\n\n if (!tableElement || !parentHeader) {\n return;\n }\n\n const leftScrollDistance = getTableLeftScrollDistance(tableElement, parentHeader, frozenColumnIndex);\n\n if (leftScrollDistance !== null) {\n tableElement.scrollLeft = leftScrollDistance;\n }\n }\n },\n // Prevents the stopping of event propagation\n false\n );\n\n document.addEventListener('keydown', handler);\n\n return () => document.removeEventListener('keydown', handler);\n }, [tableMeta.columnFreezing.frozenColumnIndex, handleGoto]);\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.rowActive.setRowActiveIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut={gotoShortcut}>\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n ref={ref}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","ref","useRef","gotoShortcut","useEffect","frozenColumnIndex","externalFrozenColumnIndex","frozenInternalColumnCount","handler","createShortcutKeyDownHandler","_ref$current","tableElement","tableRef","current","parentHeader","closest","leftScrollDistance","getTableLeftScrollDistance","scrollLeft","document","addEventListener","removeEventListener","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","rowActive","setRowActiveIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;;;;;SAcgBA,eAAeA,CAAkBC,KAAoB,EAAEC,MAAgC;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IAC7B,OAAO,KAAK;;EAGhB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OAAO,CAAC,EAAEF,SAAS,CAACG,OAAO,CAACC,SAAS,IAAIP,MAAM,CAACQ,MAAM,CAACC,UAAU,EAAE,IAAIT,MAAM,CAACQ,MAAM,CAACE,WAAW,EAAE,CAAC;AACvG;SAEgBC,eAAeA,CAAkBZ,KAAoB,EAAEC,MAAgC;;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAA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G,kBAAK7F,cAAK,CAAC8F,YAAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CACCnH,IAAI,EACJS,KAAK,EACLH,SAAS,EACTC,OAAO,EACPC,OAAO,EACPG,UAAU,EACVI,gBAAgB,EAChBE,aAAa,EACb5B,SAAS,CAACY,cAAc,CAAC8B,iBAAiB,CAC7C,CAAC;EAEF,oBACIT,6BAAC+F,UAAU;IACPjD,SAAS,EAAEA,SAAS;IACpBW,IAAI,EAAC,MAAM;IACX/E,IAAI,EACAkD,cAAc,GACR1B,SAAS,GACT8F,SAAS,mBACLhG,6BAACuD,MAAa,oBAAKyC,SAAS,gBACxBhG,6BAACuD,MAAa,CAAC0C,OAAO,QAAEjD,eAAe,CAAyB,CACpD,CACnB;IAEXlD,OAAO,EAAE8B,cAAc;IACvBsE,cAAc,EAAE9C,KAAK,IAAIA,KAAK,CAAC+C,cAAc,EAAE;IAC/C9F,GAAG,EAAEA;IACP;AAEV;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Resizer.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Resizer.tsx"],"sourcesContent":["import React from 'react';\nimport cn from '
|
1
|
+
{"version":3,"file":"Resizer.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Resizer.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\n\ntype ResizerProps = {\n isResizing: boolean;\n onResize: (event: unknown) => void;\n};\n\nexport function Resizer(props: ResizerProps) {\n const { isResizing, onResize: handleResize } = props;\n const { texts } = useLocalization();\n\n // this prevents sort handlers being activated\n const handleClick = event => {\n event.stopPropagation();\n event.preventDefault();\n };\n\n const handle = (\n <div\n className={cn(\n 'invisible absolute right-0 top-0 -mr-2 flex h-full w-4 cursor-col-resize touch-none select-none justify-center rounded py-0.5 group-hover/column:visible',\n '[[role=\"columnheader\"]:last-child>&]:!mr-0 [[role=\"columnheader\"]:last-child>&]:w-2',\n {\n '!visible': isResizing,\n }\n )}\n onClick={handleClick}\n onMouseDown={handleResize}\n onTouchStart={handleResize}>\n <div\n className={cn('h-full w-1 rounded', {\n '!bg-blue-500': isResizing,\n 'bg-grey-500 hover:bg-grey-700': !isResizing,\n })}\n />\n </div>\n );\n\n if (isResizing) {\n return handle;\n }\n\n return (\n <Tooltip placement=\"top\" title={texts.table3.columns.resize.tooltip}>\n {handle}\n </Tooltip>\n );\n}\n"],"names":["Resizer","props","isResizing","onResize","handleResize","texts","useLocalization","handleClick","event","stopPropagation","preventDefault","handle","React","className","cn","onClick","onMouseDown","onTouchStart","Tooltip","placement","title","table3","columns","resize","tooltip"],"mappings":";;;;;SAUgBA,OAAOA,CAACC,KAAmB;EACvC,MAAM;IAAEC,UAAU;IAAEC,QAAQ,EAAEC;GAAc,GAAGH,KAAK;EACpD,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;;EAGnC,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBD,KAAK,CAACE,cAAc,EAAE;GACzB;EAED,MAAMC,MAAM,gBACRC;IACIC,SAAS,EAAEC,EAAE,CACT,0JAA0J,EAC1J,qFAAqF,EACrF;MACI,UAAU,EAAEZ;KACf,CACJ;IACDa,OAAO,EAAER,WAAW;IACpBS,WAAW,EAAEZ,YAAY;IACzBa,YAAY,EAAEb;kBACdQ;IACIC,SAAS,EAAEC,EAAE,CAAC,oBAAoB,EAAE;MAChC,cAAc,EAAEZ,UAAU;MAC1B,+BAA+B,EAAE,CAACA;KACrC;IACH,CAET;EAED,IAAIA,UAAU,EAAE;IACZ,OAAOS,MAAM;;EAGjB,oBACIC,6BAACM,OAAO;IAACC,SAAS,EAAC,KAAK;IAACC,KAAK,EAAEf,KAAK,CAACgB,MAAM,CAACC,OAAO,CAACC,MAAM,CAACC;KACvDb,MAAM,CACD;AAElB;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { IconButton } from '../../../../IconButton/IconButton.js';
|
4
4
|
import { useLocalization } from '../../../../Provider/Localization.js';
|
5
5
|
import { Shortcut } from '../../../../Shortcut/Shortcut.js';
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3RowActionRenderer } from '../../../types';\nimport { FontSize, FontSizes } from '../../../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Menu } from '../../../../Menu/Menu';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { Footer } from '../footer/Footer';\nimport { getIndicatorCellClassName, isIndicatorVisible } from '../cell/Indicator';\n\nexport const COLUMN_ID = '__actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n actions?: Table3RowActionRenderer<TType>[];\n actionsLength: number;\n className?: string;\n fontSize: FontSize;\n isActiveRow: boolean;\n isEditing: boolean;\n isResizingColumn: boolean;\n isHoverStatePaused: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { actions, actionsLength, fontSize, isActiveRow, isEditing, isResizingColumn, isHoverStatePaused, row } = props;\n const { isHovered } = React.useContext(RowContext);\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLSpanElement | null>(null);\n /*\n const size = table.getState().columnSizing[COLUMN_ID];\n\n // the actions column needs to set its size based on its content, not the actual column\n // so we do this here instead of in the header\n React.useLayoutEffect(() => {\n if (ref.current && !size) {\n const width = ref.current.getBoundingClientRect().width;\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [COLUMN_ID]: width,\n }));\n }\n }, [ref.current]);\n */\n\n let content;\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && !isEditing && (isActiveRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n const visibleActions = actions.map(action => action(row.original)).filter(action => !!action) as JSX.Element[];\n\n const actionsOnRow =\n visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n const className = cn(\n '-mb-2 flex justify-end pl-2 text-right',\n {\n // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.\n '-mt-2': fontSize === FontSizes.small,\n '-mt-1.5': fontSize !== FontSizes.small,\n },\n props.className\n );\n\n content = (\n <span className={className} ref={ref}>\n {actionsOnRow.map((button, index) => {\n const tooltip = String(button.props.tooltip ?? button.props['aria-label'] ?? '');\n\n return React.cloneElement(button, {\n appearance: 'transparent',\n key: index,\n tabIndex: isActiveRow ? 0 : -1,\n tooltip: button.props.shortcut ? (\n <>\n {tooltip}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n tooltip\n ),\n });\n })}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={isActiveRow ? 0 : -1}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n />\n ) : null}\n </span>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown>;\n\nfunction Cell<TType = unknown>(context: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n const allVisibleColumns = context.table.getVisibleLeafColumns();\n const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;\n const className = isIndicatorVisible(rowIndex, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.rowMoveReason)\n ? getIndicatorCellClassName(context.index, lastColumnIndex)\n : undefined;\n\n return (\n <MemoedCell<TType>\n {...context}\n actions={tableMeta.rowActions.actionsForRow}\n actionsLength={tableMeta.rowActions.actionsForRowLength}\n className={className}\n fontSize={tableMeta.fontSize.size}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n isEditing={tableMeta.editing.isEditing}\n isResizingColumn={!!context.table.getState().columnSizingInfo.isResizingColumn}\n isHoverStatePaused={!!tableMeta.rowActive.isHoverStatePaused}\n />\n );\n}\n\nexport function createRowActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n '!pt-[var(--table3-cell-padding-y)] print:opacity-0 [[role=\"table\"][data-editing=\"false\"]_&]:group-[[data-current=\"true\"]]/row:sticky [[role=\"table\"][data-pause-hover=\"false\"][data-editing=\"false\"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1',\n 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n };\n}\n"],"names":["COLUMN_ID","MemoedCell","React","memo","props","actions","actionsLength","fontSize","isActiveRow","isEditing","isResizingColumn","isHoverStatePaused","row","isHovered","useContext","RowContext","texts","useLocalization","ref","useRef","content","length","visibleActions","map","action","original","filter","actionsOnRow","slice","actionsInMenu","className","cn","FontSizes","small","button","index","tooltip","String","_ref","_button$props$tooltip","cloneElement","appearance","key","tabIndex","shortcut","Shortcut","keys","IconButton","table3","columns","icon","menu","menuProps","Menu","Content","i","Item","DisplayCell","Cell","context","rowIndex","tableMeta","table","options","meta","allVisibleColumns","getVisibleLeafColumns","lastColumnIndex","isIndicatorVisible","rowActive","rowActiveIndex","editing","rowMoveReason","getIndicatorCellClassName","undefined","rowActions","actionsForRow","actionsForRowLength","size","getState","columnSizingInfo","createRowActionsColumn","id","header","ColumnHeader","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing"],"mappings":";;;;;;;;;;;;;MAeaA,SAAS,GAAG;AAazB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;EAC5F,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,QAAQ;IAAEC,WAAW;IAAEC,SAAS;IAAEC,gBAAgB;IAAEC,kBAAkB;IAAEC;GAAK,GAAGR,KAAK;EACrH,MAAM;IAAES;GAAW,GAAGX,cAAK,CAACY,UAAU,CAACC,UAAU,CAAC;EAClD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGhB,cAAK,CAACiB,MAAM,CAAyB,IAAI,CAAC;;;;;;;;;;;;;;;EAkBtD,IAAIC,OAAO;;;EAIX,IAAIf,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEgB,MAAM,IAAI,CAACZ,SAAS,KAAKD,WAAW,IAAKK,SAAS,IAAI,CAACF,kBAAkB,IAAI,CAACD,gBAAiB,CAAC,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GAAGsC,kBAAkB,CAACR,QAAQ,EAAEC,SAAS,CAACQ,SAAS,CAACC,cAAc,EAAET,SAAS,CAACU,OAAO,CAACC,aAAa,CAAC,GAC7GC,yBAAyB,CAACd,OAAO,CAACxB,KAAK,EAAEgC,eAAe,CAAC,GACzDO,SAAS;EAEf,oBACIxE,6BAACD,UAAU,oBACH0D,OAAO;IACXtD,OAAO,EAAEwD,SAAS,CAACc,UAAU,CAACC,aAAa;IAC3CtE,aAAa,EAAEuD,SAAS,CAACc,UAAU,CAACE,mBAAmB;IACvD/C,SAAS,EAAEA,SAAS;IACpBvB,QAAQ,EAAEsD,SAAS,CAACtD,QAAQ,CAACuE,IAAI;IACjCtE,WAAW,EAAEqD,SAAS,CAACQ,SAAS,CAACC,cAAc,KAAKV,QAAQ;IAC5DnD,SAAS,EAAEoD,SAAS,CAACU,OAAO,CAAC9D,SAAS;IACtCC,gBAAgB,EAAE,CAAC,CAACiD,OAAO,CAACG,KAAK,CAACiB,QAAQ,EAAE,CAACC,gBAAgB,CAACtE,gBAAgB;IAC9EC,kBAAkB,EAAE,CAAC,CAACkD,SAAS,CAACQ,SAAS,CAAC1D;KAC5C;AAEV;SAEgBsE,sBAAsBA;EAClC,OAAO;IACHC,EAAE,EAAElF,SAAS;IACbmF,MAAM,EAAEC,MAAY;IACpBC,IAAI,EAAE3B,IAAI;IACV4B,MAAM,EAAEC,MAAM;IACdvB,IAAI,EAAE;MACFwB,KAAK,EAAE,OAAO;MACd1D,SAAS,EAAEC,EAAE,CACT,oPAAoP,EACpP,wDAAwD,EACxD,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACD0D,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBR,MAAM,EAAE,EAAE;MACVS,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE;GACnB;AACL;;;;"}
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3RowActionRenderer } from '../../../types';\nimport { FontSize, FontSizes } from '../../../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Menu } from '../../../../Menu/Menu';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { Footer } from '../footer/Footer';\nimport { getIndicatorCellClassName, isIndicatorVisible } from '../cell/Indicator';\n\nexport const COLUMN_ID = '__actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n actions?: Table3RowActionRenderer<TType>[];\n actionsLength: number;\n className?: string;\n fontSize: FontSize;\n isActiveRow: boolean;\n isEditing: boolean;\n isResizingColumn: boolean;\n isHoverStatePaused: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { actions, actionsLength, fontSize, isActiveRow, isEditing, isResizingColumn, isHoverStatePaused, row } = props;\n const { isHovered } = React.useContext(RowContext);\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLSpanElement | null>(null);\n /*\n const size = table.getState().columnSizing[COLUMN_ID];\n\n // the actions column needs to set its size based on its content, not the actual column\n // so we do this here instead of in the header\n React.useLayoutEffect(() => {\n if (ref.current && !size) {\n const width = ref.current.getBoundingClientRect().width;\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [COLUMN_ID]: width,\n }));\n }\n }, [ref.current]);\n */\n\n let content;\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && !isEditing && (isActiveRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n const visibleActions = actions.map(action => action(row.original)).filter(action => !!action) as JSX.Element[];\n\n const actionsOnRow =\n visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n const className = cn(\n '-mb-2 flex justify-end pl-2 text-right',\n {\n // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.\n '-mt-2': fontSize === FontSizes.small,\n '-mt-1.5': fontSize !== FontSizes.small,\n },\n props.className\n );\n\n content = (\n <span className={className} ref={ref}>\n {actionsOnRow.map((button, index) => {\n const tooltip = String(button.props.tooltip ?? button.props['aria-label'] ?? '');\n\n return React.cloneElement(button, {\n appearance: 'transparent',\n key: index,\n tabIndex: isActiveRow ? 0 : -1,\n tooltip: button.props.shortcut ? (\n <>\n {tooltip}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n tooltip\n ),\n });\n })}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={isActiveRow ? 0 : -1}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n />\n ) : null}\n </span>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown>;\n\nfunction Cell<TType = unknown>(context: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n const allVisibleColumns = context.table.getVisibleLeafColumns();\n const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;\n const className = isIndicatorVisible(rowIndex, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.rowMoveReason)\n ? getIndicatorCellClassName(context.index, lastColumnIndex)\n : undefined;\n\n return (\n <MemoedCell<TType>\n {...context}\n actions={tableMeta.rowActions.actionsForRow}\n actionsLength={tableMeta.rowActions.actionsForRowLength}\n className={className}\n fontSize={tableMeta.fontSize.size}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n isEditing={tableMeta.editing.isEditing}\n isResizingColumn={!!context.table.getState().columnSizingInfo.isResizingColumn}\n isHoverStatePaused={!!tableMeta.rowActive.isHoverStatePaused}\n />\n );\n}\n\nexport function createRowActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n '!pt-[var(--table3-cell-padding-y)] print:opacity-0 [[role=\"table\"][data-editing=\"false\"]_&]:group-[[data-current=\"true\"]]/row:sticky [[role=\"table\"][data-pause-hover=\"false\"][data-editing=\"false\"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1',\n 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n };\n}\n"],"names":["COLUMN_ID","MemoedCell","React","memo","props","actions","actionsLength","fontSize","isActiveRow","isEditing","isResizingColumn","isHoverStatePaused","row","isHovered","useContext","RowContext","texts","useLocalization","ref","useRef","content","length","visibleActions","map","action","original","filter","actionsOnRow","slice","actionsInMenu","className","cn","FontSizes","small","button","index","tooltip","String","_ref","_button$props$tooltip","cloneElement","appearance","key","tabIndex","shortcut","Shortcut","keys","IconButton","table3","columns","icon","menu","menuProps","Menu","Content","i","Item","DisplayCell","Cell","context","rowIndex","tableMeta","table","options","meta","allVisibleColumns","getVisibleLeafColumns","lastColumnIndex","isIndicatorVisible","rowActive","rowActiveIndex","editing","rowMoveReason","getIndicatorCellClassName","undefined","rowActions","actionsForRow","actionsForRowLength","size","getState","columnSizingInfo","createRowActionsColumn","id","header","ColumnHeader","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing"],"mappings":";;;;;;;;;;;;;MAeaA,SAAS,GAAG;AAazB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;EAC5F,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,QAAQ;IAAEC,WAAW;IAAEC,SAAS;IAAEC,gBAAgB;IAAEC,kBAAkB;IAAEC;GAAK,GAAGR,KAAK;EACrH,MAAM;IAAES;GAAW,GAAGX,cAAK,CAACY,UAAU,CAACC,UAAU,CAAC;EAClD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGhB,cAAK,CAACiB,MAAM,CAAyB,IAAI,CAAC;;;;;;;;;;;;;;;EAkBtD,IAAIC,OAAO;;;EAIX,IAAIf,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEgB,MAAM,IAAI,CAACZ,SAAS,KAAKD,WAAW,IAAKK,SAAS,IAAI,CAACF,kBAAkB,IAAI,CAACD,gBAAiB,CAAC,EAAE;IAC3G,MAAMY,cAAc,GAAGjB,OAAO,CAACkB,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACZ,GAAG,CAACa,QAAQ,CAAC,CAAC,CAACC,MAAM,CAACF,MAAM,IAAI,CAAC,CAACA,MAAM,CAAkB;IAE9G,MAAMG,YAAY,GACdL,cAAc,CAACD,MAAM,KAAKf,aAAa,GAAGgB,cAAc,GAAGA,cAAc,CAACM,KAAK,CAAC,CAAC,EAAEtB,aAAa,GAAG,CAAC,CAAC;IACzG,MAAMuB,aAAa,GAAGP,cAAc,CAACM,KAAK,CAACN,cAAc,CAACD,MAAM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EsD,SAAS,CAACtD,QAAQ,CAACuE,IAAI;IACjCtE,WAAW,EAAEqD,SAAS,CAACQ,SAAS,CAACC,cAAc,KAAKV,QAAQ;IAC5DnD,SAAS,EAAEoD,SAAS,CAACU,OAAO,CAAC9D,SAAS;IACtCC,gBAAgB,EAAE,CAAC,CAACiD,OAAO,CAACG,KAAK,CAACiB,QAAQ,EAAE,CAACC,gBAAgB,CAACtE,gBAAgB;IAC9EC,kBAAkB,EAAE,CAAC,CAACkD,SAAS,CAACQ,SAAS,CAAC1D;KAC5C;AAEV;SAEgBsE,sBAAsBA;EAClC,OAAO;IACHC,EAAE,EAAElF,SAAS;IACbmF,MAAM,EAAEC,MAAY;IACpBC,IAAI,EAAE3B,IAAI;IACV4B,MAAM,EAAEC,MAAM;IACdvB,IAAI,EAAE;MACFwB,KAAK,EAAE,OAAO;MACd1D,SAAS,EAAEC,EAAE,CACT,oPAAoP,EACpP,wDAAwD,EACxD,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACD0D,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBR,MAAM,EAAE,EAAE;MACVS,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE;GACnB;AACL;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { Icon } from '../../../../Icon/Icon.js';
|
4
4
|
import { Tooltip } from '../../../../Tooltip/Tooltip.js';
|
5
5
|
import { IconButton } from '../../../../IconButton/IconButton.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditingActions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/EditingActions.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { CellContext, TableMeta, DisplayColumnDef } from '@tanstack/react-table';\nimport { Spinner } from '../../../../Spinner/Spinner';\nimport { SavingStatusValue, useEditing } from '../../../hooks/features/useEditing';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { RowContext } from '../../rows/RowContext';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { Footer } from '../footer/Footer';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport useTimer from '../../../../../utils/hooks/useTimer';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { Dialog } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { Button } from '../../../../Button/Button';\nimport { lastCellIndex } from '../../rows/Row';\nimport { getColumnIndex } from '../../../util/editing';\nimport { getIndicatorCellClassName, isIndicatorVisible } from '../cell/Indicator';\n\nexport type EditingActionsProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n isHovered: boolean;\n};\n\nconst savingIndicatorHideDelay = 3000;\n\nexport const COLUMN_ID = '__editing_actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n editing: ReturnType<typeof useEditing>;\n hasChanges: boolean;\n isActiveRow: boolean;\n rowIdentifier?: string;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { className, editing, hasChanges, isActiveRow, row, rowIdentifier, table } = props;\n\n const savingStatus = editing.getSavingStatus(row.id);\n const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React.useState(false);\n const { texts } = useLocalization();\n const [clearConfirmationOpen, setClearConfirmationOpen] = React.useState(false);\n const columns = table.getAllFlatColumns();\n const column = columns.find(column => column.id === rowIdentifier);\n const rowIdentifierHeader = column?.columnDef.meta?.header;\n const edititngActionsRef = React.useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const handleSaved = () => {\n setIsSavingIndicatorVisible(false);\n editing.resetSavingStatus(row.id);\n };\n const timer = useTimer(savingIndicatorHideDelay, handleSaved);\n\n React.useEffect(() => {\n if (savingStatus && savingStatus === SavingStatusValue.Saved && !isSavedIndicatorVisible) {\n setIsSavingIndicatorVisible(true);\n timer.start();\n }\n }, [savingStatus]);\n\n React.useEffect(() => {\n tableMeta.shortcutsState.pause(clearConfirmationOpen);\n }, [clearConfirmationOpen]);\n\n let content;\n\n if (savingStatus) {\n if (savingStatus === SavingStatusValue.Saving) {\n content = (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n } else if (isSavedIndicatorVisible) {\n content = (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <Icon name=\"tick\" className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n }\n }\n\n if (editing.isEditing && isActiveRow) {\n content = (\n <>\n {content}\n <IconButton\n ref={edititngActionsRef}\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n <Menu.Item icon=\"tick\" disabled={!hasChanges} onClick={() => editing.saveChangesIfNeeded()}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item icon=\"close\" disabled={!hasChanges} onClick={() => setClearConfirmationOpen(true)}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={() => editing.toggleEditing(false)}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n tabIndex={isActiveRow ? 0 : -1}\n />\n <Dialog\n size=\"xs\"\n open={clearConfirmationOpen}\n onClose={() => {\n setClearConfirmationOpen(false);\n requestAnimationFrame(() => {\n if (edititngActionsRef.current) {\n edititngActionsRef.current.focus();\n // When table looses focus, we need to re-set the last column index\n lastCellIndex.value = getColumnIndex(edititngActionsRef.current);\n }\n });\n }}>\n <Dialog.Content aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>\n {texts.table3.editing.clearChangesConfirmationDialog.description\n .replace(\n '[ROW_IDENTIFIER]',\n rowIdentifier && rowIdentifierHeader ? rowIdentifierHeader : texts.table3.validation.index\n )\n .replace(\n '[ROW_IDENTIFIER_VALUE]',\n rowIdentifier && rowIdentifierHeader ? row.original[rowIdentifier] : row.index\n )}\n </p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button\n tabIndex={0}\n appearance=\"primary\"\n autoFocus\n onClick={() => editing.resetChange(row.id)}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n </>\n );\n }\n\n const contentClassName = cn('flex items-center justify-end text-right', { '-mb-2 -mt-2': isActiveRow });\n return (\n <DisplayCell {...props} className={cn(className, { '!sticky': !!content })}>\n {content ? <span className={contentClassName}>{content}</span> : undefined}\n </DisplayCell>\n );\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n rowIdentifier?: string;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];\n const allVisibleColumns = props.table.getVisibleLeafColumns();\n const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;\n const className = isIndicatorVisible(rowIndex, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.rowMoveReason)\n ? getIndicatorCellClassName(props.index, lastColumnIndex)\n : undefined;\n\n return (\n <MemoedCell\n {...props}\n className={className}\n editing={tableMeta.editing}\n hasChanges={changeset.indexOf(props.row.id) >= 0}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n />\n );\n}\n\nexport const EDITING_ACTIONS_WIDTH = 60;\n\nexport function createRowEditingActionsColumn<TType = unknown>(rowIdentifier?: string): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} rowIdentifier={rowIdentifier} />,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n 'items-center print:opacity-0 [[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:sticky right-0 !pl-0 !pr-1',\n '[[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: EDITING_ACTIONS_WIDTH,\n minSize: EDITING_ACTIONS_WIDTH,\n };\n}\n"],"names":["savingIndicatorHideDelay","COLUMN_ID","MemoedCell","React","memo","props","className","editing","hasChanges","isActiveRow","row","rowIdentifier","table","savingStatus","getSavingStatus","id","isSavedIndicatorVisible","setIsSavingIndicatorVisible","useState","texts","useLocalization","clearConfirmationOpen","setClearConfirmationOpen","columns","getAllFlatColumns","column","find","rowIdentifierHeader","_column$columnDef$met","columnDef","meta","header","edititngActionsRef","useRef","tableMeta","options","handleSaved","resetSavingStatus","timer","useTimer","useEffect","SavingStatusValue","Saved","start","shortcutsState","pause","content","Saving","Tooltip","title","table3","saving","progress","Spinner","delay","complete","Icon","name","isEditing","IconButton","ref","appearance","actions","tooltip","icon","menu","menuProps","Menu","Content","Item","disabled","onClick","saveChangesIfNeeded","save","clear","toggleEditing","exit","tabIndex","Dialog","size","open","onClose","requestAnimationFrame","current","focus","lastCellIndex","value","getColumnIndex","clearChangesConfirmationDialog","Title","description","replace","validation","index","original","Footer","Group","Close","Button","cancel","autoFocus","resetChange","confirm","contentClassName","cn","DisplayCell","undefined","Cell","rowIndex","useContext","RowContext","changeset","changes","Object","keys","allVisibleColumns","getVisibleLeafColumns","lastColumnIndex","length","isIndicatorVisible","rowActive","rowActiveIndex","rowMoveReason","getIndicatorCellClassName","indexOf","EDITING_ACTIONS_WIDTH","createRowEditingActionsColumn","ColumnHeader","cell","context","footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,MAAMA,wBAAwB,GAAG,IAAI;MAExBC,SAAS,GAAG;AAUzB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;;EAC5F,MAAM;IAAEC,SAAS;IAAEC,OAAO;IAAEC,UAAU;IAAEC,WAAW;IAAEC,GAAG;IAAEC,aAAa;IAAEC;GAAO,GAAGP,KAAK;EAExF,MAAMQ,YAAY,GAAGN,OAAO,CAACO,eAAe,CAACJ,GAAG,CAACK,EAAE,CAAC;EACpD,MAAM,CAACC,uBAAuB,EAAEC,2BAA2B,CAAC,GAAGd,cAAK,CAACe,QAAQ,CAAC,KAAK,CAAC;EACpF,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,qBAAqB,EAAEC,wBAAwB,CAAC,GAAGnB,cAAK,CAACe,QAAQ,CAAC,KAAK,CAAC;EAC/E,MAAMK,OAAO,GAAGX,KAAK,CAACY,iBAAiB,EAAE;EACzC,MAAMC,MAAM,GAAGF,OAAO,CAACG,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACV,EAAE,KAAKJ,a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,eAAe,CAAC,GACvDX,SAAS;EAEf,oBACIvG,6BAACD,UAAU,oBACHG,KAAK;IACTC,SAAS,EAAEA,SAAS;IACpBC,OAAO,EAAE2B,SAAS,CAAC3B,OAAO;IAC1BC,UAAU,EAAEuG,SAAS,CAACa,OAAO,CAACvH,KAAK,CAACK,GAAG,CAACK,EAAE,CAAC,IAAI,CAAC;IAChDN,WAAW,EAAEyB,SAAS,CAACsF,SAAS,CAACC,cAAc,KAAKb;KACtD;AAEV;MAEaiB,qBAAqB,GAAG;SAErBC,6BAA6BA,CAAkBnH,aAAsB;EACjF,OAAO;IACHI,EAAE,EAAEd,SAAS;IACb8B,MAAM,EAAEgG,MAAY;IACpBC,IAAI,EAAGC,OAAoC,iBAAK9H,6BAACwG,IAAI,oBAAKsB,OAAO;MAAEtH,aAAa,EAAEA;OAAiB;IACnGuH,MAAM,EAAEnC,MAAM;IACdjE,IAAI,EAAE;MACFqG,KAAK,EAAE,OAAO;MACd7H,SAAS,EAAEkG,EAAE,CACT,mIAAmI,EACnI,kIAAkI,EAClI,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACD4B,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBvG,MAAM,EAAE,EAAE;MACVwG,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE,KAAK;IACrBzD,IAAI,EAAE8C,qBAAqB;IAC3BY,OAAO,EAAEZ;GACZ;AACL;;;;"}
|
1
|
+
{"version":3,"file":"EditingActions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/EditingActions.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { CellContext, TableMeta, DisplayColumnDef } from '@tanstack/react-table';\nimport { Spinner } from '../../../../Spinner/Spinner';\nimport { SavingStatusValue, useEditing } from '../../../hooks/features/useEditing';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { RowContext } from '../../rows/RowContext';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { Footer } from '../footer/Footer';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport useTimer from '../../../../../utils/hooks/useTimer';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { Dialog } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { Button } from '../../../../Button/Button';\nimport { lastCellIndex } from '../../rows/Row';\nimport { getColumnIndex } from '../../../util/editing';\nimport { getIndicatorCellClassName, isIndicatorVisible } from '../cell/Indicator';\n\nexport type EditingActionsProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n isHovered: boolean;\n};\n\nconst savingIndicatorHideDelay = 3000;\n\nexport const COLUMN_ID = '__editing_actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n editing: ReturnType<typeof useEditing>;\n hasChanges: boolean;\n isActiveRow: boolean;\n rowIdentifier?: string;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { className, editing, hasChanges, isActiveRow, row, rowIdentifier, table } = props;\n\n const savingStatus = editing.getSavingStatus(row.id);\n const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React.useState(false);\n const { texts } = useLocalization();\n const [clearConfirmationOpen, setClearConfirmationOpen] = React.useState(false);\n const columns = table.getAllFlatColumns();\n const column = columns.find(column => column.id === rowIdentifier);\n const rowIdentifierHeader = column?.columnDef.meta?.header;\n const edititngActionsRef = React.useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const handleSaved = () => {\n setIsSavingIndicatorVisible(false);\n editing.resetSavingStatus(row.id);\n };\n const timer = useTimer(savingIndicatorHideDelay, handleSaved);\n\n React.useEffect(() => {\n if (savingStatus && savingStatus === SavingStatusValue.Saved && !isSavedIndicatorVisible) {\n setIsSavingIndicatorVisible(true);\n timer.start();\n }\n }, [savingStatus]);\n\n React.useEffect(() => {\n tableMeta.shortcutsState.pause(clearConfirmationOpen);\n }, [clearConfirmationOpen]);\n\n let content;\n\n if (savingStatus) {\n if (savingStatus === SavingStatusValue.Saving) {\n content = (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n } else if (isSavedIndicatorVisible) {\n content = (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <Icon name=\"tick\" className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n }\n }\n\n if (editing.isEditing && isActiveRow) {\n content = (\n <>\n {content}\n <IconButton\n ref={edititngActionsRef}\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n <Menu.Item icon=\"tick\" disabled={!hasChanges} onClick={() => editing.saveChangesIfNeeded()}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item icon=\"close\" disabled={!hasChanges} onClick={() => setClearConfirmationOpen(true)}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={() => editing.toggleEditing(false)}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n tabIndex={isActiveRow ? 0 : -1}\n />\n <Dialog\n size=\"xs\"\n open={clearConfirmationOpen}\n onClose={() => {\n setClearConfirmationOpen(false);\n requestAnimationFrame(() => {\n if (edititngActionsRef.current) {\n edititngActionsRef.current.focus();\n // When table looses focus, we need to re-set the last column index\n lastCellIndex.value = getColumnIndex(edititngActionsRef.current);\n }\n });\n }}>\n <Dialog.Content aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>\n {texts.table3.editing.clearChangesConfirmationDialog.description\n .replace(\n '[ROW_IDENTIFIER]',\n rowIdentifier && rowIdentifierHeader ? rowIdentifierHeader : texts.table3.validation.index\n )\n .replace(\n '[ROW_IDENTIFIER_VALUE]',\n rowIdentifier && rowIdentifierHeader ? row.original[rowIdentifier] : row.index\n )}\n </p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button\n tabIndex={0}\n appearance=\"primary\"\n autoFocus\n onClick={() => editing.resetChange(row.id)}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n </>\n );\n }\n\n const contentClassName = cn('flex items-center justify-end text-right', { '-mb-2 -mt-2': isActiveRow });\n return (\n <DisplayCell {...props} className={cn(className, { '!sticky': !!content })}>\n {content ? <span className={contentClassName}>{content}</span> : undefined}\n </DisplayCell>\n );\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n rowIdentifier?: string;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];\n const allVisibleColumns = props.table.getVisibleLeafColumns();\n const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;\n const className = isIndicatorVisible(rowIndex, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.rowMoveReason)\n ? getIndicatorCellClassName(props.index, lastColumnIndex)\n : undefined;\n\n return (\n <MemoedCell\n {...props}\n className={className}\n editing={tableMeta.editing}\n hasChanges={changeset.indexOf(props.row.id) >= 0}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n />\n );\n}\n\nexport const EDITING_ACTIONS_WIDTH = 60;\n\nexport function createRowEditingActionsColumn<TType = unknown>(rowIdentifier?: string): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} rowIdentifier={rowIdentifier} />,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n 'items-center print:opacity-0 [[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:sticky right-0 !pl-0 !pr-1',\n '[[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: EDITING_ACTIONS_WIDTH,\n minSize: EDITING_ACTIONS_WIDTH,\n };\n}\n"],"names":["savingIndicatorHideDelay","COLUMN_ID","MemoedCell","React","memo","props","className","editing","hasChanges","isActiveRow","row","rowIdentifier","table","savingStatus","getSavingStatus","id","isSavedIndicatorVisible","setIsSavingIndicatorVisible","useState","texts","useLocalization","clearConfirmationOpen","setClearConfirmationOpen","columns","getAllFlatColumns","column","find","rowIdentifierHeader","_column$columnDef$met","columnDef","meta","header","edititngActionsRef","useRef","tableMeta","options","handleSaved","resetSavingStatus","timer","useTimer","useEffect","SavingStatusValue","Saved","start","shortcutsState","pause","content","Saving","Tooltip","title","table3","saving","progress","Spinner","delay","complete","Icon","name","isEditing","IconButton","ref","appearance","actions","tooltip","icon","menu","menuProps","Menu","Content","Item","disabled","onClick","saveChangesIfNeeded","save","clear","toggleEditing","exit","tabIndex","Dialog","size","open","onClose","requestAnimationFrame","current","focus","lastCellIndex","value","getColumnIndex","clearChangesConfirmationDialog","Title","description","replace","validation","index","original","Footer","Group","Close","Button","cancel","autoFocus","resetChange","confirm","contentClassName","cn","DisplayCell","undefined","Cell","rowIndex","useContext","RowContext","changeset","changes","Object","keys","allVisibleColumns","getVisibleLeafColumns","lastColumnIndex","length","isIndicatorVisible","rowActive","rowActiveIndex","rowMoveReason","getIndicatorCellClassName","indexOf","EDITING_ACTIONS_WIDTH","createRowEditingActionsColumn","ColumnHeader","cell","context","footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,MAAMA,wBAAwB,GAAG,IAAI;MAExBC,SAAS,GAAG;AAUzB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;;EAC5F,MAAM;IAAEC,SAAS;IAAEC,OAAO;IAAEC,UAAU;IAAEC,WAAW;IAAEC,GAAG;IAAEC,aAAa;IAAEC;GAAO,GAAGP,KAAK;EAExF,MAAMQ,YAAY,GAAGN,OAAO,CAACO,eAAe,CAACJ,GAAG,CAACK,EAAE,CAAC;EACpD,MAAM,CAACC,uBAAuB,EAAEC,2BAA2B,CAAC,GAAGd,cAAK,CAACe,QAAQ,CAAC,KAAK,CAAC;EACpF,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,qBAAqB,EAAEC,wBAAwB,CAAC,GAAGnB,cAAK,CAACe,QAAQ,CAAC,KAAK,CAAC;EAC/E,MAAMK,OAAO,GAAGX,KAAK,CAACY,iBAAiB,EAAE;EACzC,MAAMC,MAAM,GAAGF,OAAO,CAACG,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACV,EAAE,KAAKJ,aAAa,CAAC;EAClE,MAAMgB,mBAAmB,GAAGF,MAAM,aAANA,MAAM,wBAAAG,qBAAA,GAANH,MAAM,CAAEI,SAAS,CAACC,IAAI,cAAAF,qBAAA,uBAAtBA,qBAAA,CAAw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,EAAEuG,SAAS,CAACa,OAAO,CAACvH,KAAK,CAACK,GAAG,CAACK,EAAE,CAAC,IAAI,CAAC;IAChDN,WAAW,EAAEyB,SAAS,CAACsF,SAAS,CAACC,cAAc,KAAKb;KACtD;AAEV;MAEaiB,qBAAqB,GAAG;SAErBC,6BAA6BA,CAAkBnH,aAAsB;EACjF,OAAO;IACHI,EAAE,EAAEd,SAAS;IACb8B,MAAM,EAAEgG,MAAY;IACpBC,IAAI,EAAGC,OAAoC,iBAAK9H,6BAACwG,IAAI,oBAAKsB,OAAO;MAAEtH,aAAa,EAAEA;OAAiB;IACnGuH,MAAM,EAAEnC,MAAM;IACdjE,IAAI,EAAE;MACFqG,KAAK,EAAE,OAAO;MACd7H,SAAS,EAAEkG,EAAE,CACT,mIAAmI,EACnI,kIAAkI,EAClI,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACD4B,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBvG,MAAM,EAAE,EAAE;MACVwG,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE,KAAK;IACrBzD,IAAI,EAAE8C,qBAAqB;IAC3BY,OAAO,EAAEZ;GACZ;AACL;;;;"}
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { Tooltip } from '../../../../Tooltip/Tooltip.js';
|
4
4
|
import { useLocalization } from '../../../../Provider/Localization.js';
|
5
5
|
import { Checkbox } from '../../../../Checkbox/Checkbox.js';
|
package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\nimport { getRadioClassnames } from '../../../../RadioGroup/util';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\nexport const COLUMN_ID = '__select';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n if (context.table.options.enableMultiRowSelection) {\n const isAllRowsSelected = context.table.getIsAllRowsSelected();\n const isSomeRowsSelected = context.table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !mt-0\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={context.table.toggleAllRowsSelected}\n tabIndex={-1}\n />\n </Tooltip>\n </ColumnHeader>\n );\n } else {\n return <ColumnHeader {...context}></ColumnHeader>;\n }\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nconst Cell = React.memo(\n function MemoedCell<TType = unknown>(context: CellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const isSelected = context.row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (context.table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(\n tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0,\n rowIndex\n );\n\n context.table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n context.row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n tabIndex={isActiveRow ? 0 : -1}\n />\n </Tooltip>\n </DisplayCell>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n context.row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <button\n className={className}\n aria-checked={isSelected}\n onClick={handleClick}\n role=\"radio\"\n tabIndex={-1}\n type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n </DisplayCell>\n );\n }\n },\n function arePropsEqual(oldProps: CellContext<unknown, unknown>, newProps: CellContext<unknown, unknown>) {\n const oldTableMeta = oldProps.table.options.meta as TableMeta<unknown>;\n const newTableMeta = newProps.table.options.meta as TableMeta<unknown>;\n\n // we memo because we don't want the row re-rendering and removing focus from the checkbox\n // we can't default to the standard comparison because we need currentRow off the table meta\n // and we don't really care about re-rendering in any other scenario\n return (\n newTableMeta.rowActive.rowActiveIndex === oldTableMeta.rowActive.rowActiveIndex &&\n newProps.row.getIsSelected() !== oldProps.row.getIsSelected()\n );\n }\n) as <TType = unknown>(context: CellContext<TType, unknown>) => JSX.Element;\n\nexport function createRowSelectionColumn<TType = unknown>(\n hasDrag: boolean,\n hasExpansion: boolean\n): DisplayColumnDef<TType, unknown> {\n const size = hasDrag && hasExpansion ? 22 : 40;\n\n return {\n id: COLUMN_ID,\n header: Header,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'center',\n className: cn('!pt-[var(--table3-cell-padding-y)] !justify-end !p-0', {\n '!pr-0.5': hasExpansion,\n '!pr-3': !hasExpansion,\n }),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: cn('items-center !justify-end !p-0', { '!pr-0.5': hasExpansion, '!pr-3': !hasExpansion }),\n },\n // options\n enableResizing: false,\n size,\n minSize: size,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","table","options","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","React","ColumnHeader","Tooltip","Checkbox","className","key","String","checked","indeterminate","onChange","toggleAllRowsSelected","tabIndex","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","memo","MemoedCell","rowIndex","useContext","RowContext","tableMeta","meta","isActiveRow","rowActive","rowActiveIndex","isSelected","row","getIsSelected","deselect","handleClick","event","stopPropagation","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","getRowModel","rows","slice","forEach","toggleSelected","DisplayCell","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","arePropsEqual","oldProps","newProps","oldTableMeta","newTableMeta","createRowSelectionColumn","hasDrag","hasExpansion","size","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;MAaaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAA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D4B,wBAAwBA,CACpCC,OAAgB,EAChBC,YAAqB;EAErB,MAAMC,IAAI,GAAGF,OAAO,IAAIC,YAAY,GAAG,EAAE,GAAG,EAAE;EAE9C,OAAO;IACHE,EAAE,EAAEhF,SAAS;IACbiF,MAAM,EAAEhF,MAAM;IACdiF,IAAI,EAAE/C,IAAI;IACVgD,MAAM,EAAEC,MAAM;IACd1C,IAAI,EAAE;MACF2C,KAAK,EAAE,QAAQ;MACf/D,SAAS,EAAE6C,EAAE,CAAC,sDAAsD,EAAE;QAClE,SAAS,EAAEW,YAAY;QACvB,OAAO,EAAE,CAACA;OACb,CAAC;MACFQ,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBP,MAAM,EAAE,EAAE;MACVQ,eAAe,EAAEtB,EAAE,CAAC,gCAAgC,EAAE;QAAE,SAAS,EAAEW,YAAY;QAAE,OAAO,EAAE,CAACA;OAAc;KAC5G;;IAEDY,cAAc,EAAE,KAAK;IACrBX,IAAI;IACJY,OAAO,EAAEZ;GACZ;AACL;;;;"}
|
1
|
+
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\nimport { getRadioClassnames } from '../../../../RadioGroup/util';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\nexport const COLUMN_ID = '__select';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n if (context.table.options.enableMultiRowSelection) {\n const isAllRowsSelected = context.table.getIsAllRowsSelected();\n const isSomeRowsSelected = context.table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table3.columns.select.deselectAll : texts.table3.columns.select.selectAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !mt-0\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n onChange={context.table.toggleAllRowsSelected}\n tabIndex={-1}\n />\n </Tooltip>\n </ColumnHeader>\n );\n } else {\n return <ColumnHeader {...context}></ColumnHeader>;\n }\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nconst Cell = React.memo(\n function MemoedCell<TType = unknown>(context: CellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const isSelected = context.row.getIsSelected();\n const title = isSelected ? texts.table3.columns.select.deselect : texts.table3.columns.select.select;\n\n if (context.table.options.enableMultiRowSelection) {\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(\n tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0,\n rowIndex\n );\n\n context.table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n context.row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n tabIndex={isActiveRow ? 0 : -1}\n />\n </Tooltip>\n </DisplayCell>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n context.row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = rowIndex;\n };\n\n return (\n <DisplayCell {...context}>\n <button\n className={className}\n aria-checked={isSelected}\n onClick={handleClick}\n role=\"radio\"\n tabIndex={-1}\n type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n </DisplayCell>\n );\n }\n },\n function arePropsEqual(oldProps: CellContext<unknown, unknown>, newProps: CellContext<unknown, unknown>) {\n const oldTableMeta = oldProps.table.options.meta as TableMeta<unknown>;\n const newTableMeta = newProps.table.options.meta as TableMeta<unknown>;\n\n // we memo because we don't want the row re-rendering and removing focus from the checkbox\n // we can't default to the standard comparison because we need currentRow off the table meta\n // and we don't really care about re-rendering in any other scenario\n return (\n newTableMeta.rowActive.rowActiveIndex === oldTableMeta.rowActive.rowActiveIndex &&\n newProps.row.getIsSelected() !== oldProps.row.getIsSelected()\n );\n }\n) as <TType = unknown>(context: CellContext<TType, unknown>) => JSX.Element;\n\nexport function createRowSelectionColumn<TType = unknown>(\n hasDrag: boolean,\n hasExpansion: boolean\n): DisplayColumnDef<TType, unknown> {\n const size = hasDrag && hasExpansion ? 22 : 40;\n\n return {\n id: COLUMN_ID,\n header: Header,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'center',\n className: cn('!pt-[var(--table3-cell-padding-y)] !justify-end !p-0', {\n '!pr-0.5': hasExpansion,\n '!pr-3': !hasExpansion,\n }),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: cn('items-center !justify-end !p-0', { '!pr-0.5': hasExpansion, '!pr-3': !hasExpansion }),\n },\n // options\n enableResizing: false,\n size,\n minSize: size,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","table","options","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","table3","columns","select","deselectAll","selectAll","React","ColumnHeader","Tooltip","Checkbox","className","key","String","checked","indeterminate","onChange","toggleAllRowsSelected","tabIndex","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","memo","MemoedCell","rowIndex","useContext","RowContext","tableMeta","meta","isActiveRow","rowActive","rowActiveIndex","isSelected","row","getIsSelected","deselect","handleClick","event","stopPropagation","shiftKey","_tableMeta$rowSelecti","rowSelection","lastSelectedRowIndex","current","getRowModel","rows","slice","forEach","toggleSelected","DisplayCell","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","arePropsEqual","oldProps","newProps","oldTableMeta","newTableMeta","createRowSelectionColumn","hasDrag","hasExpansion","size","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;MAaaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAAIF,OAAO,CAACG,KAAK,CAACC,OAAO,CAACC,uBAAuB,EAAE;IAC/C,MAAMC,iBAAiB,GAAGN,OAAO,CAACG,KAAK,CAACI,oBAAoB,EAAE;IAC9D,MAAMC,kBAAkB,GAAGR,OAAO,CAACG,KAAK,CAACM,qBAAqB,EAAE;IAChE,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGL,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGb,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,MAAM,CAACE,SAAS;IAEjH,oBACIC,6BAACC,QAAY,oBAAKjB,OAAO,gBACrBgB,6BAACE,OAAO;MAACR,KAAK,EAAEA;o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K;MACnBC,cAAc,EAAE,KAAK;MACrBP,MAAM,EAAE,EAAE;MACVQ,eAAe,EAAEtB,EAAE,CAAC,gCAAgC,EAAE;QAAE,SAAS,EAAEW,YAAY;QAAE,OAAO,EAAE,CAACA;OAAc;KAC5G;;IAEDY,cAAc,EAAE,KAAK;IACrBX,IAAI;IACJY,OAAO,EAAEZ;GACZ;AACL;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from '
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from 'clsx';\nimport { Table3ColumnAlignment } from '../../types';\nimport { getCellMinWidth } from '../../../../primitives/Table/useTable/util/columns';\n\nexport const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take\n\nexport const getCellAlignmentClasses = (alignment: Table3ColumnAlignment = 'left') => {\n return cn({\n 'justify-start text-left': alignment === 'left',\n 'justify-end text-right': alignment === 'right',\n 'justify-center text-center': alignment === 'center',\n });\n};\n\nexport const getFontBasedMinColumnSize = getCellMinWidth;\n\n// Hiding input number spin buttons\nexport const getInputAppearanceClassnames = () => {\n return cn(\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none'\n );\n};\n"],"names":["PRINT_MIN_COLUMN_SIZE","getCellAlignmentClasses","alignment","cn","getFontBasedMinColumnSize","getCellMinWidth","getInputAppearanceClassnames"],"mappings":";;;MAIaA,qBAAqB,GAAG,GAAG;MAE3BC,uBAAuB,GAAGA,CAACC,YAAmC,MAAM;EAC7E,OAAOC,EAAE,CAAC;IACN,yBAAyB,EAAED,SAAS,KAAK,MAAM;IAC/C,wBAAwB,EAAEA,SAAS,KAAK,OAAO;IAC/C,4BAA4B,EAAEA,SAAS,KAAK;GAC/C,CAAC;AACN;MAEaE,yBAAyB,GAAGC;AAEzC;MACaC,4BAA4B,GAAGA;EACxC,OAAOH,EAAE,CACL,sHAAsH,CACzH;AACL;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { useFocusManager } from '@react-aria/focus';
|
4
4
|
import { useDropTarget } from '../../../../utils/hooks/useDropTarget.js';
|
5
5
|
import { RowContext, useRowContext } from './RowContext.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/rows/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { Row as RTRow, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { RowContext, useRowContext } from './RowContext';\nimport { useDropTarget } from '../../../../utils/hooks/useDropTarget';\nimport { Table3RowClickHandler, Table3RowDropHandler } from '../../types';\nimport { useFocusManager } from '@react-aria/focus';\nimport { LastCellIndex, focusableSelector, getColumnIndex } from '../../util/editing';\n\nconst FOCUS_MANAGER_OPTIONS = {\n tabbable: true,\n // Filter out all focusable elelemnts which are not in current row\n accept: (element: Element) => !!element.closest('[role=\"row\"][data-current=\"true\"]'),\n};\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n measureRef: (el: HTMLElement | null) => void;\n onClick?: Table3RowClickHandler<TType>;\n onDrop?: Table3RowDropHandler<TType>;\n row: RTRow<TType>;\n table: RTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const focusManager = useFocusManager();\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === props.index;\n const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];\n const isFirstRow = props.index === 0;\n // we use non-css hovered state to determine whether to render actions or not, for performance\n const [isHovered, setIsHovered] = React.useState(false);\n\n // tab behaviour is consistent across normal mode and edit mode, handle it here\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (event.key === 'Tab') {\n tableMeta.rowActive.setHoverStatePaused(true);\n let focusedElement: Element;\n\n if (event.shiftKey) {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no previous elements to focus, go up a row or go outside the table\n if (!isFirstRow) {\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(props.index - 1);\n setTimeout(() => focusManager.focusLast(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow) {\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(props.index + 1);\n setTimeout(() => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n }\n }\n };\n const hasError = !!Object.keys(tableMeta.validation.errors?.[props.row.id] ?? {}).length;\n\n // rows are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the row\n const memoedProps = {\n data: props.row.original,\n // aria-grabbed is being deprecated but there is no current alternative api, we use it until there is\n 'aria-grabbed': isDraggingRow ? true : tableMeta.rowDrag.isEnabled ? false : undefined,\n 'data-current': isActiveRow,\n 'data-selected': props.row.getIsSelected(),\n 'data-invalid': hasError,\n draggable: tableMeta.rowDrag.isEnabled,\n index: props.index,\n onClick: tableMeta.rowClick.handleClick,\n onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined,\n };\n\n let output = <MemoedRow<TType> {...props} {...memoedProps} onKeyDown={handleKeyDown} />;\n\n if (tableMeta.editing.isEditing && (isActiveRow || (isHovered && !tableMeta.rowActive.isHoverStatePaused))) {\n output = (\n <EditingRow\n {...props}\n {...memoedProps}\n isFirstRow={isFirstRow}\n setActiveRowIndex={tableMeta.rowActive.setRowActiveIndex}\n />\n );\n }\n\n // we store the row index in context because in a virtualised table the row index and the\n // react table row index do not match when, for example, sorting is applied\n const contextValue = React.useMemo(\n () => ({ isHovered, setIsHovered, rowIndex: props.index, hasError }),\n [isHovered, hasError, props.index]\n );\n\n return <RowContext.Provider value={contextValue}>{output}</RowContext.Provider>;\n}\n\n// turns out we might need some kind of \"state\" for the focused column, but it doesn't need to be react state that re-renders\nexport const lastCellIndex = new LastCellIndex();\n\n// This code is needed to avoid multiple rows being hovered at the same time (it happens since we use non-css hovering)\nlet previouslyHoveredIndex: number | undefined;\nconst unhoverPreviousRow = (tableRef: React.RefObject<HTMLDivElement>) => {\n if (previouslyHoveredIndex !== undefined) {\n const mouseoutEvent = new MouseEvent('mouseout', { view: window, bubbles: true, cancelable: true });\n const previouslyHovered = tableRef?.current?.querySelector(`[data-row-index=\"${previouslyHoveredIndex}\"]`);\n previouslyHovered?.dispatchEvent(mouseoutEvent);\n }\n};\n\nfunction EditingRow(props) {\n const { isFirstRow, isLastRow, onKeyDown, setActiveRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\n const tableMeta = props.table.options.meta as TableMeta<unknown>;\n\n const handleClickCapture = (event: React.FocusEvent) => {\n lastCellIndex.value = getColumnIndex(event.target);\n };\n\n const handleNavigationBackwards = event => {\n let focusedElement: Element;\n\n if (event.key === 'ArrowLeft' || (event.key === 'Tab' && event.shiftKey)) {\n // We need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n\n // \"CTRL + ArrowLeft\" or \"META + ArrowLeft\" should focus first focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // there are no previous elements to focus, go up a row (if there are rows above)\n if (!isFirstRow || !event.currentTarget.contains(focusedElement)) {\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n tableMeta.rowActive.setRowActiveIndex(props.index - 1);\n setTimeout(() => {\n focusedElement = focusManager.focusLast(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastCellIndex.value = getColumnIndex(focusedElement);\n }, 1);\n }\n }\n }\n }\n };\n\n const handleNavigationForward = event => {\n let focusedElement: Element;\n\n if (event.key === 'ArrowRight' || (event.key === 'Tab' && !event.shiftKey)) {\n // We need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n\n // \"CTRL + ArrowRight\" or \"META + ArrowRight\" should focus last focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusLast(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow && !event.currentTarget.contains(focusedElement)) {\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n tableMeta.rowActive.setRowActiveIndex(props.index + 1);\n setTimeout(() => {\n focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastCellIndex.value = getColumnIndex(focusedElement);\n }, 1);\n }\n }\n }\n }\n };\n\n React.useEffect(() => {\n // if some row stuck in hovered state, we heed to unhover it when hover state is paused\n if (tableMeta.rowActive.isHoverStatePaused) {\n unhoverPreviousRow(props.tableRef);\n }\n }, [tableMeta.rowActive.isHoverStatePaused]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n event.isDefaultPrevented() ||\n event.isPropagationStopped() ||\n tableMeta.editing.detailModeEditing ||\n tableMeta.shortcutsState.isPaused\n ) {\n return;\n }\n\n handleNavigationBackwards(event);\n handleNavigationForward(event);\n };\n\n // this ensures we focus either on a field or on the same column when keyboard navigating up/down\n React.useEffect(() => {\n // When table in searching state, whe should prevent editing control to be focused, because it will cause search field to loose focus.\n if (tableMeta.rowActive.rowActiveIndex === props.index && !tableMeta.search.isSearching) {\n if (lastCellIndex.value !== null) {\n const lastCellElement = props.tableRef.current?.querySelector(\n `[role=\"row\"][data-current=\"true\"] [data-column-index=\"${lastCellIndex.value}\"]`\n );\n const focusableElement = lastCellElement?.querySelector(focusableSelector);\n if (focusableElement) {\n focusableElement.focus();\n // if we found a cell but it doesn't contain focusable element, then we'll focus the first one in a row.\n } else if (lastCellElement) {\n const focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n }\n } else {\n const focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n }\n }\n // Need to subscribe to current row index and check is it a current row,\n // for a situation where hovered row is the next row after current row...\n // In this case row will not be re-rendered if user switch to next row, because hovered row also renders EditingRow.\n }, [tableMeta.rowActive.rowActiveIndex, tableMeta.search.isSearching]);\n\n return <MemoedRow {...attributes} onClickCapture={handleClickCapture} onKeyDown={handleKeyDown} />;\n}\n\n// Memoization\n\nexport type MemoedRowProps<TType = unknown> = Omit<RowProps<TType>, 'onClick'> & {\n data: TType;\n 'aria-grabbed'?: boolean;\n 'data-current': boolean;\n 'data-selected': boolean;\n draggable: boolean;\n index: number;\n onClick: (event: React.MouseEvent<HTMLDivElement>, data: unknown) => void;\n};\n\nconst clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];\n\nconst MemoedRow = React.memo(function MemoedRow<TType = unknown>(props: MemoedRowProps<TType>) {\n const {\n data,\n index,\n isLastRow: _1,\n measureRef,\n onClick,\n onClickCapture,\n onDrop,\n row,\n table,\n tableRef,\n ...attributes\n } = props;\n const ref = React.useRef<HTMLDivElement | null>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { setIsHovered } = useRowContext();\n\n // we measure the first cell (since the row has display: contents) so that the virtualiser height is correct\n React.useEffect(() => {\n const firstCell = ref.current?.querySelector('[role=cell]:first-child');\n\n if (firstCell) {\n measureRef(firstCell as HTMLElement);\n }\n }, [ref.current]);\n\n // we use capture because it also picks up clicks on e.g. select checkboxes\n const handleClickCapture = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (typeof onClickCapture === 'function') {\n onClickCapture(event);\n }\n\n // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable\n requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (typeof onClick === 'function') {\n const clickedElement = event.target as HTMLElement;\n\n if (\n !ref.current?.contains(event.target as HTMLElement) ||\n clickableElements.includes(clickedElement.tagName.toLowerCase()) ||\n clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))\n ) {\n return;\n }\n\n onClick(event, data);\n }\n };\n\n const handleMouseEnter = () => {\n // When user moving mouse to fast, then some of the rows are getting stuck in hover state,\n // because mouseleave event never got triggered, to avoid this to happen we're saving the index of last hovered row,\n // so that we can unhover it when new row got hovered, and saving it in a variable outside of react to save in performance,\n // since it would be very performance heavy to use state which is bound to mouse events.\n if (previouslyHoveredIndex !== undefined) {\n if (previouslyHoveredIndex !== index) {\n unhoverPreviousRow(tableRef);\n previouslyHoveredIndex = index;\n }\n } else {\n previouslyHoveredIndex = index;\n }\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n if (previouslyHoveredIndex === index) {\n previouslyHoveredIndex = undefined;\n }\n setIsHovered(false);\n };\n\n const [isDraggedOver, dropTargetProps] = useDropTarget(event => onDrop?.(event, row.original));\n\n const className = cn(\n 'group/row contents',\n // resizing column requires dragging, which means the mouse might (on rare occasions) move over rows and trigger hover state\n // that in turn triggers rendering of e.g. row actions, which could cause janky ui - so don't allow mouse interaction when resizing\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n {\n 'hover:cursor-pointer': typeof onClick === 'function',\n }\n );\n\n return (\n <div\n {...attributes}\n {...(onDrop ? dropTargetProps : undefined)}\n className={className}\n data-row-index={index}\n data-dragged-over={isDraggedOver}\n onClick={handleClick}\n onClickCapture={handleClickCapture}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"row\"\n ref={ref}\n />\n );\n}) as <TType = unknown>(props: MemoedRowProps<TType>) => JSX.Element;\n"],"names":["FOCUS_MANAGER_OPTIONS","tabbable","accept","element","closest","Row","props","focusManager","useFocusManager","tableMeta","table","options","meta","isActiveRow","rowActive","rowActiveIndex","index","isDraggingRow","rowDrag","dragging","row","id","isFirstRow","isHovered","setIsHovered","React","useState","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","key","setHoverStatePaused","focusedElement","shiftKey","focusPrevious","preventDefault","setRowActiveIndex","setTimeout","focusLast","focusNext","isLastRow","focusFirst","hasError","Object","keys","_tableMeta$validation","_tableMeta$validation2","validation","errors","length","memoedProps","data","original","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","output","MemoedRow","onKeyDown","editing","isEditing","isHoverStatePaused","EditingRow","setActiveRowIndex","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastCellIndex","LastCellIndex","previouslyHoveredIndex","unhoverPreviousRow","tableRef","_tableRef$current","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","handleClickCapture","getColumnIndex","target","handleNavigationBackwards","stopPropagation","ctrlKey","metaKey","blur","currentTarget","contains","handleNavigationForward","useEffect","detailModeEditing","shortcutsState","isPaused","search","isSearching","_props$tableRef$curre","lastCellElement","focusableElement","focusableSelector","focus","onClickCapture","clickableElements","memo","_1","measureRef","ref","useRef","useRowContext","firstCell","_ref$current","requestAnimationFrame","_ref$current2","clickedElement","includes","tagName","toLowerCase","map","tag","join","handleMouseEnter","handleMouseLeave","isDraggedOver","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;AASA,MAAMA,qBAAqB,GAAG;EAC1BC,QAAQ,EAAE,IAAI;;EAEdC,MAAM,EAAGC,OAAgB,IAAK,CAAC,CAACA,OAAO,CAACC,OAAO,CAAC,mCAAmC;CACtF;SAaeC,GAAGA,CAAkBC,KAAsB;;EACvD,MAAMC,YAAY,GAAGC,eAAe,EAAE;EACtC,MAAMC,SAAS,GAAGH,KAAK,CAACI,KAAK,CAACC,OAAO,CAACC,IAAwB;EAC9D,MAAMC,WAAW,GAAGJ,SAAS,CAACK,SAAS,CAACC,cAAc,KAAKT,KAAK,CAACU,KAAK;EACtE,MAAMC,aAAa,GAAGR,SAAS,CAACS,OAAO,CAACC,QAAQ,CAACb,KAAK,CAACc,GAAG,CAACC,EAAE,CAAC;EAC9D,MAAMC,UAAU,GAAGhB,KAAK,CAACU,KAAK,KAAK,CAAC;;EAEpC,MAAM,CAACO,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGvD,MAAMC,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAID,KAAK,CAACE,oBAAoB,EAAE,EAAE;MAC5D;;IAGJ,IAAIF,KAAK,CAACG,GAAG,KAAK,KAAK,EAAE;MACrBtB,SAAS,CAACK,SAAS,CAACkB,mBAAmB,CAAC,IAAI,CAAC;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B,GAAG,EAAEA;KACP;AAEV,CAAC,CAAmE;;;;"}
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/rows/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { Row as RTRow, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { RowContext, useRowContext } from './RowContext';\nimport { useDropTarget } from '../../../../utils/hooks/useDropTarget';\nimport { Table3RowClickHandler, Table3RowDropHandler } from '../../types';\nimport { useFocusManager } from '@react-aria/focus';\nimport { LastCellIndex, focusableSelector, getColumnIndex } from '../../util/editing';\n\nconst FOCUS_MANAGER_OPTIONS = {\n tabbable: true,\n // Filter out all focusable elelemnts which are not in current row\n accept: (element: Element) => !!element.closest('[role=\"row\"][data-current=\"true\"]'),\n};\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n measureRef: (el: HTMLElement | null) => void;\n onClick?: Table3RowClickHandler<TType>;\n onDrop?: Table3RowDropHandler<TType>;\n row: RTRow<TType>;\n table: RTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const focusManager = useFocusManager();\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === props.index;\n const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];\n const isFirstRow = props.index === 0;\n // we use non-css hovered state to determine whether to render actions or not, for performance\n const [isHovered, setIsHovered] = React.useState(false);\n\n // tab behaviour is consistent across normal mode and edit mode, handle it here\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped()) {\n return;\n }\n\n if (event.key === 'Tab') {\n tableMeta.rowActive.setHoverStatePaused(true);\n let focusedElement: Element;\n\n if (event.shiftKey) {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no previous elements to focus, go up a row or go outside the table\n if (!isFirstRow) {\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(props.index - 1);\n setTimeout(() => focusManager.focusLast(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n // override default behaviour, since we're handling focus internally now\n event.preventDefault();\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow) {\n event.preventDefault();\n tableMeta.rowActive.setRowActiveIndex(props.index + 1);\n setTimeout(() => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS), 1);\n }\n }\n }\n }\n };\n const hasError = !!Object.keys(tableMeta.validation.errors?.[props.row.id] ?? {}).length;\n\n // rows are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the row\n const memoedProps = {\n data: props.row.original,\n // aria-grabbed is being deprecated but there is no current alternative api, we use it until there is\n 'aria-grabbed': isDraggingRow ? true : tableMeta.rowDrag.isEnabled ? false : undefined,\n 'data-current': isActiveRow,\n 'data-selected': props.row.getIsSelected(),\n 'data-invalid': hasError,\n draggable: tableMeta.rowDrag.isEnabled,\n index: props.index,\n onClick: tableMeta.rowClick.handleClick,\n onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined,\n };\n\n let output = <MemoedRow<TType> {...props} {...memoedProps} onKeyDown={handleKeyDown} />;\n\n if (tableMeta.editing.isEditing && (isActiveRow || (isHovered && !tableMeta.rowActive.isHoverStatePaused))) {\n output = (\n <EditingRow\n {...props}\n {...memoedProps}\n isFirstRow={isFirstRow}\n setActiveRowIndex={tableMeta.rowActive.setRowActiveIndex}\n />\n );\n }\n\n // we store the row index in context because in a virtualised table the row index and the\n // react table row index do not match when, for example, sorting is applied\n const contextValue = React.useMemo(\n () => ({ isHovered, setIsHovered, rowIndex: props.index, hasError }),\n [isHovered, hasError, props.index]\n );\n\n return <RowContext.Provider value={contextValue}>{output}</RowContext.Provider>;\n}\n\n// turns out we might need some kind of \"state\" for the focused column, but it doesn't need to be react state that re-renders\nexport const lastCellIndex = new LastCellIndex();\n\n// This code is needed to avoid multiple rows being hovered at the same time (it happens since we use non-css hovering)\nlet previouslyHoveredIndex: number | undefined;\nconst unhoverPreviousRow = (tableRef: React.RefObject<HTMLDivElement>) => {\n if (previouslyHoveredIndex !== undefined) {\n const mouseoutEvent = new MouseEvent('mouseout', { view: window, bubbles: true, cancelable: true });\n const previouslyHovered = tableRef?.current?.querySelector(`[data-row-index=\"${previouslyHoveredIndex}\"]`);\n previouslyHovered?.dispatchEvent(mouseoutEvent);\n }\n};\n\nfunction EditingRow(props) {\n const { isFirstRow, isLastRow, onKeyDown, setActiveRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\n const tableMeta = props.table.options.meta as TableMeta<unknown>;\n\n const handleClickCapture = (event: React.FocusEvent) => {\n lastCellIndex.value = getColumnIndex(event.target);\n };\n\n const handleNavigationBackwards = event => {\n let focusedElement: Element;\n\n if (event.key === 'ArrowLeft' || (event.key === 'Tab' && event.shiftKey)) {\n // We need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n\n // \"CTRL + ArrowLeft\" or \"META + ArrowLeft\" should focus first focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // looping backwards\n focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // there are no previous elements to focus, go up a row (if there are rows above)\n if (!isFirstRow || !event.currentTarget.contains(focusedElement)) {\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n tableMeta.rowActive.setRowActiveIndex(props.index - 1);\n setTimeout(() => {\n focusedElement = focusManager.focusLast(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastCellIndex.value = getColumnIndex(focusedElement);\n }, 1);\n }\n }\n }\n }\n };\n\n const handleNavigationForward = event => {\n let focusedElement: Element;\n\n if (event.key === 'ArrowRight' || (event.key === 'Tab' && !event.shiftKey)) {\n // We need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n\n // \"CTRL + ArrowRight\" or \"META + ArrowRight\" should focus last focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusLast(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // looping forwards\n focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);\n\n if (focusedElement) {\n lastCellIndex.value = getColumnIndex(focusedElement);\n } else {\n // there are no next elements to focus, go down a row or go outside the table\n if (!props.isLastRow && !event.currentTarget.contains(focusedElement)) {\n event.preventDefault();\n tableMeta.rowActive.setHoverStatePaused(true);\n tableMeta.rowActive.setRowActiveIndex(props.index + 1);\n setTimeout(() => {\n focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n // Need to update lastIndex when row got changed and last element got selected.\n lastCellIndex.value = getColumnIndex(focusedElement);\n }, 1);\n }\n }\n }\n }\n };\n\n React.useEffect(() => {\n // if some row stuck in hovered state, we heed to unhover it when hover state is paused\n if (tableMeta.rowActive.isHoverStatePaused) {\n unhoverPreviousRow(props.tableRef);\n }\n }, [tableMeta.rowActive.isHoverStatePaused]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n event.isDefaultPrevented() ||\n event.isPropagationStopped() ||\n tableMeta.editing.detailModeEditing ||\n tableMeta.shortcutsState.isPaused\n ) {\n return;\n }\n\n handleNavigationBackwards(event);\n handleNavigationForward(event);\n };\n\n // this ensures we focus either on a field or on the same column when keyboard navigating up/down\n React.useEffect(() => {\n // When table in searching state, whe should prevent editing control to be focused, because it will cause search field to loose focus.\n if (tableMeta.rowActive.rowActiveIndex === props.index && !tableMeta.search.isSearching) {\n if (lastCellIndex.value !== null) {\n const lastCellElement = props.tableRef.current?.querySelector(\n `[role=\"row\"][data-current=\"true\"] [data-column-index=\"${lastCellIndex.value}\"]`\n );\n const focusableElement = lastCellElement?.querySelector(focusableSelector);\n if (focusableElement) {\n focusableElement.focus();\n // if we found a cell but it doesn't contain focusable element, then we'll focus the first one in a row.\n } else if (lastCellElement) {\n const focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n }\n } else {\n const focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);\n lastCellIndex.value = getColumnIndex(focusedElement);\n }\n }\n // Need to subscribe to current row index and check is it a current row,\n // for a situation where hovered row is the next row after current row...\n // In this case row will not be re-rendered if user switch to next row, because hovered row also renders EditingRow.\n }, [tableMeta.rowActive.rowActiveIndex, tableMeta.search.isSearching]);\n\n return <MemoedRow {...attributes} onClickCapture={handleClickCapture} onKeyDown={handleKeyDown} />;\n}\n\n// Memoization\n\nexport type MemoedRowProps<TType = unknown> = Omit<RowProps<TType>, 'onClick'> & {\n data: TType;\n 'aria-grabbed'?: boolean;\n 'data-current': boolean;\n 'data-selected': boolean;\n draggable: boolean;\n index: number;\n onClick: any; //(event: React.MouseEvent<HTMLElement,MouseEvent>, data: unknown) => void;\n};\n\nconst clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];\n\nconst MemoedRow = React.memo(function MemoedRow<TType = unknown>(props: MemoedRowProps<TType>) {\n const {\n data,\n index,\n isLastRow: _1,\n measureRef,\n onClick,\n onClickCapture,\n onDrop,\n row,\n table,\n tableRef,\n ...attributes\n } = props;\n const ref = React.useRef<HTMLDivElement | null>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { setIsHovered } = useRowContext();\n\n // we measure the first cell (since the row has display: contents) so that the virtualiser height is correct\n React.useEffect(() => {\n const firstCell = ref.current?.querySelector('[role=cell]:first-child');\n\n if (firstCell) {\n measureRef(firstCell as HTMLElement);\n }\n }, [ref.current]);\n\n // we use capture because it also picks up clicks on e.g. select checkboxes\n const handleClickCapture = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (typeof onClickCapture === 'function') {\n onClickCapture(event);\n }\n\n // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable\n requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (typeof onClick === 'function') {\n const clickedElement = event.target as HTMLElement;\n\n if (\n !ref.current?.contains(event.target as HTMLElement) ||\n clickableElements.includes(clickedElement.tagName.toLowerCase()) ||\n clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))\n ) {\n return;\n }\n\n onClick(event, data);\n }\n };\n\n const handleMouseEnter = () => {\n // When user moving mouse to fast, then some of the rows are getting stuck in hover state,\n // because mouseleave event never got triggered, to avoid this to happen we're saving the index of last hovered row,\n // so that we can unhover it when new row got hovered, and saving it in a variable outside of react to save in performance,\n // since it would be very performance heavy to use state which is bound to mouse events.\n if (previouslyHoveredIndex !== undefined) {\n if (previouslyHoveredIndex !== index) {\n unhoverPreviousRow(tableRef);\n previouslyHoveredIndex = index;\n }\n } else {\n previouslyHoveredIndex = index;\n }\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n if (previouslyHoveredIndex === index) {\n previouslyHoveredIndex = undefined;\n }\n setIsHovered(false);\n };\n\n const [isDraggedOver, dropTargetProps] = useDropTarget(event => onDrop?.(event, row.original));\n\n const className = cn(\n 'group/row contents',\n // resizing column requires dragging, which means the mouse might (on rare occasions) move over rows and trigger hover state\n // that in turn triggers rendering of e.g. row actions, which could cause janky ui - so don't allow mouse interaction when resizing\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n {\n 'hover:cursor-pointer': typeof onClick === 'function',\n }\n );\n\n return (\n <div\n {...attributes}\n {...(onDrop ? dropTargetProps : undefined)}\n className={className}\n data-row-index={index}\n data-dragged-over={isDraggedOver}\n onClick={handleClick}\n onClickCapture={handleClickCapture}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"row\"\n ref={ref}\n />\n );\n}) as <TType = unknown>(props: MemoedRowProps<TType>) => JSX.Element;\n"],"names":["FOCUS_MANAGER_OPTIONS","tabbable","accept","element","closest","Row","props","focusManager","useFocusManager","tableMeta","table","options","meta","isActiveRow","rowActive","rowActiveIndex","index","isDraggingRow","rowDrag","dragging","row","id","isFirstRow","isHovered","setIsHovered","React","useState","handleKeyDown","event","isDefaultPrevented","isPropagationStopped","key","setHoverStatePaused","focusedElement","shiftKey","focusPrevious","preventDefault","setRowActiveIndex","setTimeout","focusLast","focusNext","isLastRow","focusFirst","hasError","Object","keys","_tableMeta$validation","_tableMeta$validation2","validation","errors","length","memoedProps","data","original","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","output","MemoedRow","onKeyDown","editing","isEditing","isHoverStatePaused","EditingRow","setActiveRowIndex","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastCellIndex","LastCellIndex","previouslyHoveredIndex","unhoverPreviousRow","tableRef","_tableRef$current","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","handleClickCapture","getColumnIndex","target","handleNavigationBackwards","stopPropagation","ctrlKey","metaKey","blur","currentTarget","contains","handleNavigationForward","useEffect","detailModeEditing","shortcutsState","isPaused","search","isSearching","_props$tableRef$curre","lastCellElement","focusableElement","focusableSelector","focus","onClickCapture","clickableElements","memo","_1","measureRef","ref","useRef","useRowContext","firstCell","_ref$current","requestAnimationFrame","_ref$current2","clickedElement","includes","tagName","toLowerCase","map","tag","join","handleMouseEnter","handleMouseLeave","isDraggedOver","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;AASA,MAAMA,qBAAqB,GAAG;EAC1BC,QAAQ,EAAE,IAAI;;EAEdC,MAAM,EAAGC,OAAgB,IAAK,CAAC,CAACA,OAAO,CAACC,OAAO,CAAC,mCAAmC;CACtF;SAaeC,GAAGA,CAAkBC,KAAsB;;EACvD,MAAMC,YAAY,GAAGC,eAAe,EAAE;EACtC,MAAMC,SAAS,GAAGH,KAAK,CAACI,KAAK,CAACC,OAAO,CAACC,IAAwB;EAC9D,MAAMC,WAAW,GAAGJ,SAAS,CAACK,SAAS,CAACC,cAAc,KAAKT,KAAK,CAACU,KAAK;EACtE,MAAMC,aAAa,GAAGR,SAAS,CAACS,OAAO,CAACC,QAAQ,CAACb,KAAK,CAACc,GAAG,CAACC,EAAE,CAAC;EAC9D,MAAMC,UAAU,GAAGhB,KAAK,CAACU,KAAK,KAAK,CAAC;;EAEpC,MAAM,CAACO,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGvD,MAAMC,aAAa,GAAIC,KAA0B;IAC7C,IAAIA,KAAK,CAACC,kBAAkB,EAAE,IAAID,KAAK,CAACE,oBAAoB,EAAE,EAAE;MAC5D;;IAGJ,IAAIF,KAAK,CAACG,GAAG,KAAK,KAAK,EAAE;MACrBtB,SAAS,CAACK,SAAS,CAACkB,mBAAmB,CAAC,IAAI,CAAC;MAC7C,IAAIC,cAAuB;MAE3B,IAAIL,KAAK,CAACM,QAAQ,EAAE;;QAEhBD,cAAc,GAAG1B,YAAY,CAAC4B,aAAa,CAACnC,qBAAqB,CAAC;QAElE,IAAIiC,cAAc,EAAE;;UAEhBL,KAAK,CAACQ,cAAc,EAAE;SACzB,MAAM;;UAEH,IAAI,CAACd,UAAU,EAAE;YACbM,KAAK,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