@economic/taco 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +35 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/esm/components/Accordion/Accordion.js +93 -0
- package/dist/esm/components/Accordion/Accordion.js.map +1 -0
- package/dist/esm/components/Backdrop/Backdrop.js +13 -0
- package/dist/esm/components/Backdrop/Backdrop.js.map +1 -0
- package/dist/esm/components/Badge/Badge.js +32 -0
- package/dist/esm/components/Badge/Badge.js.map +1 -0
- package/dist/esm/components/Banner/Banner.js +24 -0
- package/dist/esm/components/Banner/Banner.js.map +1 -0
- package/dist/esm/components/Banner/util.js +36 -0
- package/dist/esm/components/Banner/util.js.map +1 -0
- package/dist/esm/components/Button/Button.js +36 -0
- package/dist/esm/components/Button/Button.js.map +1 -0
- package/dist/esm/components/Button/util.js +77 -0
- package/dist/esm/components/Button/util.js.map +1 -0
- package/dist/esm/components/Calendar/Calendar.js +152 -0
- package/dist/esm/components/Calendar/Calendar.js.map +1 -0
- package/dist/esm/components/Checkbox/Checkbox.js +58 -0
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/esm/components/Combobox/Combobox.js +89 -0
- package/dist/esm/components/Combobox/Combobox.js.map +1 -0
- package/dist/esm/components/Combobox/useCombobox.js +285 -0
- package/dist/esm/components/Combobox/useCombobox.js.map +1 -0
- package/dist/esm/components/Datepicker/Datepicker.js +75 -0
- package/dist/esm/components/Datepicker/Datepicker.js.map +1 -0
- package/dist/esm/components/Datepicker/useDatepicker.js +88 -0
- package/dist/esm/components/Datepicker/useDatepicker.js.map +1 -0
- package/dist/esm/components/Dialog/Context.js +26 -0
- package/dist/esm/components/Dialog/Context.js.map +1 -0
- package/dist/esm/components/Dialog/Dialog.js +98 -0
- package/dist/esm/components/Dialog/Dialog.js.map +1 -0
- package/dist/esm/components/Dialog/components/Content.js +135 -0
- package/dist/esm/components/Dialog/components/Content.js.map +1 -0
- package/dist/esm/components/Dialog/components/Drawer.js +42 -0
- package/dist/esm/components/Dialog/components/Drawer.js.map +1 -0
- package/dist/esm/components/Dialog/components/Extra.js +15 -0
- package/dist/esm/components/Dialog/components/Extra.js.map +1 -0
- package/dist/esm/components/Dialog/components/Trigger.js +15 -0
- package/dist/esm/components/Dialog/components/Trigger.js.map +1 -0
- package/dist/esm/components/Field/Field.js +33 -0
- package/dist/esm/components/Field/Field.js.map +1 -0
- package/dist/esm/components/Form/Form.js +22 -0
- package/dist/esm/components/Form/Form.js.map +1 -0
- package/dist/esm/components/Group/Group.js +20 -0
- package/dist/esm/components/Group/Group.js.map +1 -0
- package/dist/esm/components/Hanger/Hanger.js +104 -0
- package/dist/esm/components/Hanger/Hanger.js.map +1 -0
- package/dist/esm/components/HoverCard/HoverCard.js +33 -0
- package/dist/esm/components/HoverCard/HoverCard.js.map +1 -0
- package/dist/esm/components/Icon/Icon.js +30 -0
- package/dist/esm/components/Icon/Icon.js.map +1 -0
- package/dist/esm/components/Icon/components/AccountPreview.js +18 -0
- package/dist/esm/components/Icon/components/AccountPreview.js.map +1 -0
- package/dist/esm/components/Icon/components/Accounting.js +18 -0
- package/dist/esm/components/Icon/components/Accounting.js.map +1 -0
- package/dist/esm/components/Icon/components/AccountingYear.js +18 -0
- package/dist/esm/components/Icon/components/AccountingYear.js.map +1 -0
- package/dist/esm/components/Icon/components/AccountingYearCancel.js +18 -0
- package/dist/esm/components/Icon/components/AccountingYearCancel.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowBottom.js +18 -0
- package/dist/esm/components/Icon/components/ArrowBottom.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowDown.js +18 -0
- package/dist/esm/components/Icon/components/ArrowDown.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowEnd.js +18 -0
- package/dist/esm/components/Icon/components/ArrowEnd.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowLeft.js +18 -0
- package/dist/esm/components/Icon/components/ArrowLeft.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowRight.js +18 -0
- package/dist/esm/components/Icon/components/ArrowRight.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowStart.js +18 -0
- package/dist/esm/components/Icon/components/ArrowStart.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowTop.js +18 -0
- package/dist/esm/components/Icon/components/ArrowTop.js.map +1 -0
- package/dist/esm/components/Icon/components/ArrowUp.js +18 -0
- package/dist/esm/components/Icon/components/ArrowUp.js.map +1 -0
- package/dist/esm/components/Icon/components/Attach.js +18 -0
- package/dist/esm/components/Icon/components/Attach.js.map +1 -0
- package/dist/esm/components/Icon/components/AttachAuto.js +18 -0
- package/dist/esm/components/Icon/components/AttachAuto.js.map +1 -0
- package/dist/esm/components/Icon/components/AttachCancel.js +18 -0
- package/dist/esm/components/Icon/components/AttachCancel.js.map +1 -0
- package/dist/esm/components/Icon/components/Autotext.js +18 -0
- package/dist/esm/components/Icon/components/Autotext.js.map +1 -0
- package/dist/esm/components/Icon/components/AutotextInsert.js +18 -0
- package/dist/esm/components/Icon/components/AutotextInsert.js.map +1 -0
- package/dist/esm/components/Icon/components/Basic.js +18 -0
- package/dist/esm/components/Icon/components/Basic.js.map +1 -0
- package/dist/esm/components/Icon/components/BasicTabs.js +18 -0
- package/dist/esm/components/Icon/components/BasicTabs.js.map +1 -0
- package/dist/esm/components/Icon/components/BellSolid.js +18 -0
- package/dist/esm/components/Icon/components/BellSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Book.js +18 -0
- package/dist/esm/components/Icon/components/Book.js.map +1 -0
- package/dist/esm/components/Icon/components/Booking.js +18 -0
- package/dist/esm/components/Icon/components/Booking.js.map +1 -0
- package/dist/esm/components/Icon/components/Budget.js +18 -0
- package/dist/esm/components/Icon/components/Budget.js.map +1 -0
- package/dist/esm/components/Icon/components/Calendar.js +18 -0
- package/dist/esm/components/Icon/components/Calendar.js.map +1 -0
- package/dist/esm/components/Icon/components/CashAccount.js +17 -0
- package/dist/esm/components/Icon/components/CashAccount.js.map +1 -0
- package/dist/esm/components/Icon/components/CashReports.js +18 -0
- package/dist/esm/components/Icon/components/CashReports.js.map +1 -0
- package/dist/esm/components/Icon/components/Chat.js +18 -0
- package/dist/esm/components/Icon/components/Chat.js.map +1 -0
- package/dist/esm/components/Icon/components/ChatSolid.js +18 -0
- package/dist/esm/components/Icon/components/ChatSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronDown.js +18 -0
- package/dist/esm/components/Icon/components/ChevronDown.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronDownDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronDownDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronDownSolid.js +18 -0
- package/dist/esm/components/Icon/components/ChevronDownSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronLeft.js +18 -0
- package/dist/esm/components/Icon/components/ChevronLeft.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronLeftDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronLeftDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronRight.js +18 -0
- package/dist/esm/components/Icon/components/ChevronRight.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronRightDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronRightDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronUp.js +18 -0
- package/dist/esm/components/Icon/components/ChevronUp.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronUpDouble.js +18 -0
- package/dist/esm/components/Icon/components/ChevronUpDouble.js.map +1 -0
- package/dist/esm/components/Icon/components/ChevronUpSolid.js +18 -0
- package/dist/esm/components/Icon/components/ChevronUpSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/CircleClose.js +19 -0
- package/dist/esm/components/Icon/components/CircleClose.js.map +1 -0
- package/dist/esm/components/Icon/components/CircleMinus.js +18 -0
- package/dist/esm/components/Icon/components/CircleMinus.js.map +1 -0
- package/dist/esm/components/Icon/components/CirclePlus.js +18 -0
- package/dist/esm/components/Icon/components/CirclePlus.js.map +1 -0
- package/dist/esm/components/Icon/components/CircleTick.js +18 -0
- package/dist/esm/components/Icon/components/CircleTick.js.map +1 -0
- package/dist/esm/components/Icon/components/Clamp.js +18 -0
- package/dist/esm/components/Icon/components/Clamp.js.map +1 -0
- package/dist/esm/components/Icon/components/ClampOpen.js +18 -0
- package/dist/esm/components/Icon/components/ClampOpen.js.map +1 -0
- package/dist/esm/components/Icon/components/Close.js +18 -0
- package/dist/esm/components/Icon/components/Close.js.map +1 -0
- package/dist/esm/components/Icon/components/ConnectionEnable.js +17 -0
- package/dist/esm/components/Icon/components/ConnectionEnable.js.map +1 -0
- package/dist/esm/components/Icon/components/ConnectionRevoke.js +17 -0
- package/dist/esm/components/Icon/components/ConnectionRevoke.js.map +1 -0
- package/dist/esm/components/Icon/components/Contacts.js +18 -0
- package/dist/esm/components/Icon/components/Contacts.js.map +1 -0
- package/dist/esm/components/Icon/components/Copy.js +18 -0
- package/dist/esm/components/Icon/components/Copy.js.map +1 -0
- package/dist/esm/components/Icon/components/Courses.js +17 -0
- package/dist/esm/components/Icon/components/Courses.js.map +1 -0
- package/dist/esm/components/Icon/components/Credit.js +18 -0
- package/dist/esm/components/Icon/components/Credit.js.map +1 -0
- package/dist/esm/components/Icon/components/Delete.js +18 -0
- package/dist/esm/components/Icon/components/Delete.js.map +1 -0
- package/dist/esm/components/Icon/components/DeletePermanently.js +18 -0
- package/dist/esm/components/Icon/components/DeletePermanently.js.map +1 -0
- package/dist/esm/components/Icon/components/Depecriate.js +18 -0
- package/dist/esm/components/Icon/components/Depecriate.js.map +1 -0
- package/dist/esm/components/Icon/components/Developer.js +18 -0
- package/dist/esm/components/Icon/components/Developer.js.map +1 -0
- package/dist/esm/components/Icon/components/DistributionTemplate.js +18 -0
- package/dist/esm/components/Icon/components/DistributionTemplate.js.map +1 -0
- package/dist/esm/components/Icon/components/Document.js +17 -0
- package/dist/esm/components/Icon/components/Document.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentApprove.js +18 -0
- package/dist/esm/components/Icon/components/DocumentApprove.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentCreateEntry.js +18 -0
- package/dist/esm/components/Icon/components/DocumentCreateEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentCut.js +18 -0
- package/dist/esm/components/Icon/components/DocumentCut.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentError.js +18 -0
- package/dist/esm/components/Icon/components/DocumentError.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentIsolatePage.js +18 -0
- package/dist/esm/components/Icon/components/DocumentIsolatePage.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentMerge.js +18 -0
- package/dist/esm/components/Icon/components/DocumentMerge.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentMove.js +18 -0
- package/dist/esm/components/Icon/components/DocumentMove.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentPreview.js +18 -0
- package/dist/esm/components/Icon/components/DocumentPreview.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentReceived.js +17 -0
- package/dist/esm/components/Icon/components/DocumentReceived.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentRejectedRequest.js +17 -0
- package/dist/esm/components/Icon/components/DocumentRejectedRequest.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentSplit.js +18 -0
- package/dist/esm/components/Icon/components/DocumentSplit.js.map +1 -0
- package/dist/esm/components/Icon/components/DocumentTime.js +18 -0
- package/dist/esm/components/Icon/components/DocumentTime.js.map +1 -0
- package/dist/esm/components/Icon/components/Download.js +18 -0
- package/dist/esm/components/Icon/components/Download.js.map +1 -0
- package/dist/esm/components/Icon/components/Drag.js +18 -0
- package/dist/esm/components/Icon/components/Drag.js.map +1 -0
- package/dist/esm/components/Icon/components/ECopedia.js +18 -0
- package/dist/esm/components/Icon/components/ECopedia.js.map +1 -0
- package/dist/esm/components/Icon/components/ESignature.js +18 -0
- package/dist/esm/components/Icon/components/ESignature.js.map +1 -0
- package/dist/esm/components/Icon/components/Edit.js +18 -0
- package/dist/esm/components/Icon/components/Edit.js.map +1 -0
- package/dist/esm/components/Icon/components/EllipsisHorizontal.js +18 -0
- package/dist/esm/components/Icon/components/EllipsisHorizontal.js.map +1 -0
- package/dist/esm/components/Icon/components/EllipsisVertical.js +18 -0
- package/dist/esm/components/Icon/components/EllipsisVertical.js.map +1 -0
- package/dist/esm/components/Icon/components/EntriesOnAccount.js +18 -0
- package/dist/esm/components/Icon/components/EntriesOnAccount.js.map +1 -0
- package/dist/esm/components/Icon/components/EntriesOpen.js +18 -0
- package/dist/esm/components/Icon/components/EntriesOpen.js.map +1 -0
- package/dist/esm/components/Icon/components/EntriesWarning.js +18 -0
- package/dist/esm/components/Icon/components/EntriesWarning.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeCustomerPayment.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeJournalEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeManualCustomerInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js +18 -0
- package/dist/esm/components/Icon/components/EntryTypeSupplierPayment.js.map +1 -0
- package/dist/esm/components/Icon/components/Envelope.js +18 -0
- package/dist/esm/components/Icon/components/Envelope.js.map +1 -0
- package/dist/esm/components/Icon/components/EnvelopeApproved.js +18 -0
- package/dist/esm/components/Icon/components/EnvelopeApproved.js.map +1 -0
- package/dist/esm/components/Icon/components/ExpandView.js +18 -0
- package/dist/esm/components/Icon/components/ExpandView.js.map +1 -0
- package/dist/esm/components/Icon/components/Expenses.js +18 -0
- package/dist/esm/components/Icon/components/Expenses.js.map +1 -0
- package/dist/esm/components/Icon/components/Export.js +18 -0
- package/dist/esm/components/Icon/components/Export.js.map +1 -0
- package/dist/esm/components/Icon/components/ExportToExcel.js +18 -0
- package/dist/esm/components/Icon/components/ExportToExcel.js.map +1 -0
- package/dist/esm/components/Icon/components/ExportToPdf.js +18 -0
- package/dist/esm/components/Icon/components/ExportToPdf.js.map +1 -0
- package/dist/esm/components/Icon/components/Filter.js +18 -0
- package/dist/esm/components/Icon/components/Filter.js.map +1 -0
- package/dist/esm/components/Icon/components/FilterSolid.js +18 -0
- package/dist/esm/components/Icon/components/FilterSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/GraphSolid.js +18 -0
- package/dist/esm/components/Icon/components/GraphSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Hash.js +18 -0
- package/dist/esm/components/Icon/components/Hash.js.map +1 -0
- package/dist/esm/components/Icon/components/Home.js +18 -0
- package/dist/esm/components/Icon/components/Home.js.map +1 -0
- package/dist/esm/components/Icon/components/Images.js +18 -0
- package/dist/esm/components/Icon/components/Images.js.map +1 -0
- package/dist/esm/components/Icon/components/Import.js +18 -0
- package/dist/esm/components/Icon/components/Import.js.map +1 -0
- package/dist/esm/components/Icon/components/Inbox.js +20 -0
- package/dist/esm/components/Icon/components/Inbox.js.map +1 -0
- package/dist/esm/components/Icon/components/InboxEinvoicing.js +20 -0
- package/dist/esm/components/Icon/components/InboxEinvoicing.js.map +1 -0
- package/dist/esm/components/Icon/components/InboxScanning.js +20 -0
- package/dist/esm/components/Icon/components/InboxScanning.js.map +1 -0
- package/dist/esm/components/Icon/components/InboxSmart.js +20 -0
- package/dist/esm/components/Icon/components/InboxSmart.js.map +1 -0
- package/dist/esm/components/Icon/components/Info.js +18 -0
- package/dist/esm/components/Icon/components/Info.js.map +1 -0
- package/dist/esm/components/Icon/components/Inventory.js +18 -0
- package/dist/esm/components/Icon/components/Inventory.js.map +1 -0
- package/dist/esm/components/Icon/components/InventoryMatrix.js +18 -0
- package/dist/esm/components/Icon/components/InventoryMatrix.js.map +1 -0
- package/dist/esm/components/Icon/components/JournalPro.js +18 -0
- package/dist/esm/components/Icon/components/JournalPro.js.map +1 -0
- package/dist/esm/components/Icon/components/Layout.js +18 -0
- package/dist/esm/components/Icon/components/Layout.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutBoth.js +18 -0
- package/dist/esm/components/Icon/components/LayoutBoth.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutFirst.js +18 -0
- package/dist/esm/components/Icon/components/LayoutFirst.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutLast.js +18 -0
- package/dist/esm/components/Icon/components/LayoutLast.js.map +1 -0
- package/dist/esm/components/Icon/components/LayoutNone.js +18 -0
- package/dist/esm/components/Icon/components/LayoutNone.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCard.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCard.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardCustomerReminder.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardManualCustomerInvoice.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardObsoleteStock.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardOpeningEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardReservedEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardShrinkagePilferage.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardStockAdjustment.js.map +1 -0
- package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js +18 -0
- package/dist/esm/components/Icon/components/LedgerCardTransferredOpeningEntry.js.map +1 -0
- package/dist/esm/components/Icon/components/Lightbulb.js +18 -0
- package/dist/esm/components/Icon/components/Lightbulb.js.map +1 -0
- package/dist/esm/components/Icon/components/Line.js +18 -0
- package/dist/esm/components/Icon/components/Line.js.map +1 -0
- package/dist/esm/components/Icon/components/List.js +18 -0
- package/dist/esm/components/Icon/components/List.js.map +1 -0
- package/dist/esm/components/Icon/components/ListBulleted.js +18 -0
- package/dist/esm/components/Icon/components/ListBulleted.js.map +1 -0
- package/dist/esm/components/Icon/components/ListSearch.js +18 -0
- package/dist/esm/components/Icon/components/ListSearch.js.map +1 -0
- package/dist/esm/components/Icon/components/LockOpen.js +18 -0
- package/dist/esm/components/Icon/components/LockOpen.js.map +1 -0
- package/dist/esm/components/Icon/components/Log.js +18 -0
- package/dist/esm/components/Icon/components/Log.js.map +1 -0
- package/dist/esm/components/Icon/components/Market.js +18 -0
- package/dist/esm/components/Icon/components/Market.js.map +1 -0
- package/dist/esm/components/Icon/components/MatchAmount.js +18 -0
- package/dist/esm/components/Icon/components/MatchAmount.js.map +1 -0
- package/dist/esm/components/Icon/components/MatchEntries.js +18 -0
- package/dist/esm/components/Icon/components/MatchEntries.js.map +1 -0
- package/dist/esm/components/Icon/components/Mileage.js +18 -0
- package/dist/esm/components/Icon/components/Mileage.js.map +1 -0
- package/dist/esm/components/Icon/components/ModalResize.js +18 -0
- package/dist/esm/components/Icon/components/ModalResize.js.map +1 -0
- package/dist/esm/components/Icon/components/ModalShrink.js +18 -0
- package/dist/esm/components/Icon/components/ModalShrink.js.map +1 -0
- package/dist/esm/components/Icon/components/More.js +18 -0
- package/dist/esm/components/Icon/components/More.js.map +1 -0
- package/dist/esm/components/Icon/components/MoreSolid.js +18 -0
- package/dist/esm/components/Icon/components/MoreSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Move.js +18 -0
- package/dist/esm/components/Icon/components/Move.js.map +1 -0
- package/dist/esm/components/Icon/components/NavigationList.js +18 -0
- package/dist/esm/components/Icon/components/NavigationList.js.map +1 -0
- package/dist/esm/components/Icon/components/Note.js +18 -0
- package/dist/esm/components/Icon/components/Note.js.map +1 -0
- package/dist/esm/components/Icon/components/NoteFollowUp.js +18 -0
- package/dist/esm/components/Icon/components/NoteFollowUp.js.map +1 -0
- package/dist/esm/components/Icon/components/NoteRead.js +18 -0
- package/dist/esm/components/Icon/components/NoteRead.js.map +1 -0
- package/dist/esm/components/Icon/components/PartnerApi.js +18 -0
- package/dist/esm/components/Icon/components/PartnerApi.js.map +1 -0
- package/dist/esm/components/Icon/components/Period.js +18 -0
- package/dist/esm/components/Icon/components/Period.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonChange.js +18 -0
- package/dist/esm/components/Icon/components/PersonChange.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonMinus.js +18 -0
- package/dist/esm/components/Icon/components/PersonMinus.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonPlus.js +18 -0
- package/dist/esm/components/Icon/components/PersonPlus.js.map +1 -0
- package/dist/esm/components/Icon/components/PersonTick.js +18 -0
- package/dist/esm/components/Icon/components/PersonTick.js.map +1 -0
- package/dist/esm/components/Icon/components/Play.js +18 -0
- package/dist/esm/components/Icon/components/Play.js.map +1 -0
- package/dist/esm/components/Icon/components/PlusMinus.js +18 -0
- package/dist/esm/components/Icon/components/PlusMinus.js.map +1 -0
- package/dist/esm/components/Icon/components/Print.js +18 -0
- package/dist/esm/components/Icon/components/Print.js.map +1 -0
- package/dist/esm/components/Icon/components/ProcessPayment.js +18 -0
- package/dist/esm/components/Icon/components/ProcessPayment.js.map +1 -0
- package/dist/esm/components/Icon/components/ProductLedgerCard.js +18 -0
- package/dist/esm/components/Icon/components/ProductLedgerCard.js.map +1 -0
- package/dist/esm/components/Icon/components/ProjectCards.js +18 -0
- package/dist/esm/components/Icon/components/ProjectCards.js.map +1 -0
- package/dist/esm/components/Icon/components/Projects.js +18 -0
- package/dist/esm/components/Icon/components/Projects.js.map +1 -0
- package/dist/esm/components/Icon/components/Quicklinks.js +18 -0
- package/dist/esm/components/Icon/components/Quicklinks.js.map +1 -0
- package/dist/esm/components/Icon/components/RatingBankruptcy.js +18 -0
- package/dist/esm/components/Icon/components/RatingBankruptcy.js.map +1 -0
- package/dist/esm/components/Icon/components/RatingPaymentProblems.js +18 -0
- package/dist/esm/components/Icon/components/RatingPaymentProblems.js.map +1 -0
- package/dist/esm/components/Icon/components/Reconciled.js +18 -0
- package/dist/esm/components/Icon/components/Reconciled.js.map +1 -0
- package/dist/esm/components/Icon/components/Refresh.js +17 -0
- package/dist/esm/components/Icon/components/Refresh.js.map +1 -0
- package/dist/esm/components/Icon/components/Report.js +18 -0
- package/dist/esm/components/Icon/components/Report.js.map +1 -0
- package/dist/esm/components/Icon/components/ReportSolid.js +18 -0
- package/dist/esm/components/Icon/components/ReportSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Restore.js +18 -0
- package/dist/esm/components/Icon/components/Restore.js.map +1 -0
- package/dist/esm/components/Icon/components/RotateLeft.js +17 -0
- package/dist/esm/components/Icon/components/RotateLeft.js.map +1 -0
- package/dist/esm/components/Icon/components/RotateRight.js +17 -0
- package/dist/esm/components/Icon/components/RotateRight.js.map +1 -0
- package/dist/esm/components/Icon/components/Sales.js +18 -0
- package/dist/esm/components/Icon/components/Sales.js.map +1 -0
- package/dist/esm/components/Icon/components/Search.js +18 -0
- package/dist/esm/components/Icon/components/Search.js.map +1 -0
- package/dist/esm/components/Icon/components/SearchBold.js +18 -0
- package/dist/esm/components/Icon/components/SearchBold.js.map +1 -0
- package/dist/esm/components/Icon/components/Secure.js +18 -0
- package/dist/esm/components/Icon/components/Secure.js.map +1 -0
- package/dist/esm/components/Icon/components/SecureTick.js +18 -0
- package/dist/esm/components/Icon/components/SecureTick.js.map +1 -0
- package/dist/esm/components/Icon/components/Settings.js +18 -0
- package/dist/esm/components/Icon/components/Settings.js.map +1 -0
- package/dist/esm/components/Icon/components/SettingsSolid.js +18 -0
- package/dist/esm/components/Icon/components/SettingsSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Shortcuts.js +18 -0
- package/dist/esm/components/Icon/components/Shortcuts.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowAll.js +18 -0
- package/dist/esm/components/Icon/components/ShowAll.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowLess.js +18 -0
- package/dist/esm/components/Icon/components/ShowLess.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowMore.js +18 -0
- package/dist/esm/components/Icon/components/ShowMore.js.map +1 -0
- package/dist/esm/components/Icon/components/ShowTemplate.js +18 -0
- package/dist/esm/components/Icon/components/ShowTemplate.js.map +1 -0
- package/dist/esm/components/Icon/components/Sliders.js +18 -0
- package/dist/esm/components/Icon/components/Sliders.js.map +1 -0
- package/dist/esm/components/Icon/components/Smartpay.js +18 -0
- package/dist/esm/components/Icon/components/Smartpay.js.map +1 -0
- package/dist/esm/components/Icon/components/SortBy.js +18 -0
- package/dist/esm/components/Icon/components/SortBy.js.map +1 -0
- package/dist/esm/components/Icon/components/Spinner.js +21 -0
- package/dist/esm/components/Icon/components/Spinner.js.map +1 -0
- package/dist/esm/components/Icon/components/Star.js +18 -0
- package/dist/esm/components/Icon/components/Star.js.map +1 -0
- package/dist/esm/components/Icon/components/StarSolid.js +18 -0
- package/dist/esm/components/Icon/components/StarSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Subscriptions.js +18 -0
- package/dist/esm/components/Icon/components/Subscriptions.js.map +1 -0
- package/dist/esm/components/Icon/components/SystemEntries.js +18 -0
- package/dist/esm/components/Icon/components/SystemEntries.js.map +1 -0
- package/dist/esm/components/Icon/components/Tag.js +18 -0
- package/dist/esm/components/Icon/components/Tag.js.map +1 -0
- package/dist/esm/components/Icon/components/TemplateOverride.js +18 -0
- package/dist/esm/components/Icon/components/TemplateOverride.js.map +1 -0
- package/dist/esm/components/Icon/components/Templates.js +18 -0
- package/dist/esm/components/Icon/components/Templates.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbBoth.js +18 -0
- package/dist/esm/components/Icon/components/ThumbBoth.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbDown.js +18 -0
- package/dist/esm/components/Icon/components/ThumbDown.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbDownSolid.js +18 -0
- package/dist/esm/components/Icon/components/ThumbDownSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbUp.js +18 -0
- package/dist/esm/components/Icon/components/ThumbUp.js.map +1 -0
- package/dist/esm/components/Icon/components/ThumbUpSolid.js +18 -0
- package/dist/esm/components/Icon/components/ThumbUpSolid.js.map +1 -0
- package/dist/esm/components/Icon/components/Tick.js +18 -0
- package/dist/esm/components/Icon/components/Tick.js.map +1 -0
- package/dist/esm/components/Icon/components/Time.js +18 -0
- package/dist/esm/components/Icon/components/Time.js.map +1 -0
- package/dist/esm/components/Icon/components/Transfer.js +18 -0
- package/dist/esm/components/Icon/components/Transfer.js.map +1 -0
- package/dist/esm/components/Icon/components/TransferCancel.js +24 -0
- package/dist/esm/components/Icon/components/TransferCancel.js.map +1 -0
- package/dist/esm/components/Icon/components/TransferLocked.js +18 -0
- package/dist/esm/components/Icon/components/TransferLocked.js.map +1 -0
- package/dist/esm/components/Icon/components/Undock.js +18 -0
- package/dist/esm/components/Icon/components/Undock.js.map +1 -0
- package/dist/esm/components/Icon/components/Unreconciled.js +18 -0
- package/dist/esm/components/Icon/components/Unreconciled.js.map +1 -0
- package/dist/esm/components/Icon/components/Warning.js +17 -0
- package/dist/esm/components/Icon/components/Warning.js.map +1 -0
- package/dist/esm/components/Icon/components/Webshop.js +18 -0
- package/dist/esm/components/Icon/components/Webshop.js.map +1 -0
- package/dist/esm/components/Icon/components/Website.js +18 -0
- package/dist/esm/components/Icon/components/Website.js.map +1 -0
- package/dist/esm/components/Icon/components/Workflow.js +17 -0
- package/dist/esm/components/Icon/components/Workflow.js.map +1 -0
- package/dist/esm/components/Icon/components/Zoom.js +18 -0
- package/dist/esm/components/Icon/components/Zoom.js.map +1 -0
- package/dist/esm/components/Icon/components/index.js +414 -0
- package/dist/esm/components/Icon/components/index.js.map +1 -0
- package/dist/esm/components/IconButton/IconButton.js +35 -0
- package/dist/esm/components/IconButton/IconButton.js.map +1 -0
- package/dist/esm/components/Input/Input.js +85 -0
- package/dist/esm/components/Input/Input.js.map +1 -0
- package/dist/esm/components/Input/util.js +22 -0
- package/dist/esm/components/Input/util.js.map +1 -0
- package/dist/esm/components/Listbox/Listbox.js +58 -0
- package/dist/esm/components/Listbox/Listbox.js.map +1 -0
- package/dist/esm/components/Listbox/ScrollableList.js +174 -0
- package/dist/esm/components/Listbox/ScrollableList.js.map +1 -0
- package/dist/esm/components/Listbox/useListbox.js +145 -0
- package/dist/esm/components/Listbox/useListbox.js.map +1 -0
- package/dist/esm/components/Listbox/useMultiListbox.js +196 -0
- package/dist/esm/components/Listbox/useMultiListbox.js.map +1 -0
- package/dist/esm/components/Listbox/useTypeahead.js +28 -0
- package/dist/esm/components/Listbox/useTypeahead.js.map +1 -0
- package/dist/esm/components/Listbox/util.js +150 -0
- package/dist/esm/components/Listbox/util.js.map +1 -0
- package/dist/esm/components/Menu/Context.js +9 -0
- package/dist/esm/components/Menu/Context.js.map +1 -0
- package/dist/esm/components/Menu/Menu.js +74 -0
- package/dist/esm/components/Menu/Menu.js.map +1 -0
- package/dist/esm/components/Menu/components/Checkbox.js +31 -0
- package/dist/esm/components/Menu/components/Checkbox.js.map +1 -0
- package/dist/esm/components/Menu/components/Content.js +50 -0
- package/dist/esm/components/Menu/components/Content.js.map +1 -0
- package/dist/esm/components/Menu/components/Header.js +38 -0
- package/dist/esm/components/Menu/components/Header.js.map +1 -0
- package/dist/esm/components/Menu/components/Item.js +140 -0
- package/dist/esm/components/Menu/components/Item.js.map +1 -0
- package/dist/esm/components/Menu/components/Link.js +39 -0
- package/dist/esm/components/Menu/components/Link.js.map +1 -0
- package/dist/esm/components/Menu/components/RadioGroup.js +48 -0
- package/dist/esm/components/Menu/components/RadioGroup.js.map +1 -0
- package/dist/esm/components/Menu/components/Separator.js +35 -0
- package/dist/esm/components/Menu/components/Separator.js.map +1 -0
- package/dist/esm/components/Menu/components/Trigger.js +33 -0
- package/dist/esm/components/Menu/components/Trigger.js.map +1 -0
- package/dist/esm/components/Navigation/Navigation.js +125 -0
- package/dist/esm/components/Navigation/Navigation.js.map +1 -0
- package/dist/esm/components/Pagination/PageNumbers.js +50 -0
- package/dist/esm/components/Pagination/PageNumbers.js.map +1 -0
- package/dist/esm/components/Pagination/Pagination.js +103 -0
- package/dist/esm/components/Pagination/Pagination.js.map +1 -0
- package/dist/esm/components/Pagination/usePagination.js +15 -0
- package/dist/esm/components/Pagination/usePagination.js.map +1 -0
- package/dist/esm/components/Pagination/usePaginationShortcuts.js +50 -0
- package/dist/esm/components/Pagination/usePaginationShortcuts.js.map +1 -0
- package/dist/esm/components/Popover/Popover.js +84 -0
- package/dist/esm/components/Popover/Popover.js.map +1 -0
- package/dist/esm/components/Popover/Primitives.js +41 -0
- package/dist/esm/components/Popover/Primitives.js.map +1 -0
- package/dist/esm/components/Progress/Progress.js +32 -0
- package/dist/esm/components/Progress/Progress.js.map +1 -0
- package/dist/esm/components/Provider/Provider.js +105 -0
- package/dist/esm/components/Provider/Provider.js.map +1 -0
- package/dist/esm/components/RadioGroup/RadioGroup.js +106 -0
- package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/esm/components/SearchInput/SearchInput.js +95 -0
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -0
- package/dist/esm/components/Select/Select.js +100 -0
- package/dist/esm/components/Select/Select.js.map +1 -0
- package/dist/esm/components/Select/useSelect.js +212 -0
- package/dist/esm/components/Select/useSelect.js.map +1 -0
- package/dist/esm/components/Spinner/Spinner.js +48 -0
- package/dist/esm/components/Spinner/Spinner.js.map +1 -0
- package/dist/esm/components/Switch/Switch.js +37 -0
- package/dist/esm/components/Switch/Switch.js.map +1 -0
- package/dist/esm/components/Table/components/BaseTable.js +48 -0
- package/dist/esm/components/Table/components/BaseTable.js.map +1 -0
- package/dist/esm/components/Table/components/PaginatedTable.js +16 -0
- package/dist/esm/components/Table/components/PaginatedTable.js.map +1 -0
- package/dist/esm/components/Table/components/Table.js +56 -0
- package/dist/esm/components/Table/components/Table.js.map +1 -0
- package/dist/esm/components/Table/components/WindowedTable.js +186 -0
- package/dist/esm/components/Table/components/WindowedTable.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js +236 -0
- package/dist/esm/components/Table/hooks/plugins/useRowActions.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js +129 -0
- package/dist/esm/components/Table/hooks/plugins/useRowDraggable.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowEditing.js +100 -0
- package/dist/esm/components/Table/hooks/plugins/useRowEditing.js.map +1 -0
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js +108 -0
- package/dist/esm/components/Table/hooks/plugins/useRowSelect.js.map +1 -0
- package/dist/esm/components/Table/hooks/useRowCreation.js +106 -0
- package/dist/esm/components/Table/hooks/useRowCreation.js.map +1 -0
- package/dist/esm/components/Table/hooks/useTable.js +217 -0
- package/dist/esm/components/Table/hooks/useTable.js.map +1 -0
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js +132 -0
- package/dist/esm/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -0
- package/dist/esm/components/Table/util/renderColumn.js +40 -0
- package/dist/esm/components/Table/util/renderColumn.js.map +1 -0
- package/dist/esm/components/Table/util/renderRow.js +101 -0
- package/dist/esm/components/Table/util/renderRow.js.map +1 -0
- package/dist/esm/components/Table/util/rowIndexPath.js +57 -0
- package/dist/esm/components/Table/util/rowIndexPath.js.map +1 -0
- package/dist/esm/components/Table/util/sortTypes.js +82 -0
- package/dist/esm/components/Table/util/sortTypes.js.map +1 -0
- package/dist/esm/components/Table/util.js +99 -0
- package/dist/esm/components/Table/util.js.map +1 -0
- package/dist/esm/components/Tabs/Tabs.js +69 -0
- package/dist/esm/components/Tabs/Tabs.js.map +1 -0
- package/dist/esm/components/Textarea/Textarea.js +39 -0
- package/dist/esm/components/Textarea/Textarea.js.map +1 -0
- package/dist/esm/components/Toast/Toast.js +79 -0
- package/dist/esm/components/Toast/Toast.js.map +1 -0
- package/dist/esm/components/Toast/Toaster.js +163 -0
- package/dist/esm/components/Toast/Toaster.js.map +1 -0
- package/dist/esm/components/Toast/util.js +46 -0
- package/dist/esm/components/Toast/util.js.map +1 -0
- package/dist/esm/components/Tooltip/Tooltip.js +32 -0
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/esm/components/Tour/Tour.js +142 -0
- package/dist/esm/components/Tour/Tour.js.map +1 -0
- package/dist/esm/components/Treeview/Treeview.js +73 -0
- package/dist/esm/components/Treeview/Treeview.js.map +1 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +11 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/esm/index.css +661 -0
- package/dist/esm/index.js +50 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/primitives/Button.js +21 -0
- package/dist/esm/primitives/Button.js.map +1 -0
- package/dist/esm/utils/date.js +98 -0
- package/dist/esm/utils/date.js.map +1 -0
- package/dist/esm/utils/hooks/useBoundingClientRectListener.js +50 -0
- package/dist/esm/utils/hooks/useBoundingClientRectListener.js.map +1 -0
- package/dist/esm/utils/hooks/useDraggable.js +42 -0
- package/dist/esm/utils/hooks/useDraggable.js.map +1 -0
- package/dist/esm/utils/hooks/useDropTarget.js +38 -0
- package/dist/esm/utils/hooks/useDropTarget.js.map +1 -0
- package/dist/esm/utils/hooks/useListKeyboardNavigation.js +58 -0
- package/dist/esm/utils/hooks/useListKeyboardNavigation.js.map +1 -0
- package/dist/esm/utils/hooks/useListScrollTo.js +38 -0
- package/dist/esm/utils/hooks/useListScrollTo.js.map +1 -0
- package/dist/esm/utils/hooks/useOnClickOutside.js +27 -0
- package/dist/esm/utils/hooks/useOnClickOutside.js.map +1 -0
- package/dist/esm/utils/hooks/useProxiedRef.js +18 -0
- package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -0
- package/dist/esm/utils/hooks/useTimer.js +50 -0
- package/dist/esm/utils/hooks/useTimer.js.map +1 -0
- package/dist/esm/utils/input.js +49 -0
- package/dist/esm/utils/input.js.map +1 -0
- package/dist/esm/utils/mergeRefs.js +14 -0
- package/dist/esm/utils/mergeRefs.js.map +1 -0
- package/dist/esm/utils/taillwind.js +41 -0
- package/dist/esm/utils/taillwind.js.map +1 -0
- package/dist/taco.cjs.development.js +458 -552
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +2 -0
- package/dist/taco.cjs.production.min.js.map +1 -0
- package/package.json +2 -2
@@ -0,0 +1,217 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { useLocalization } from '../../Provider/Provider.js';
|
3
|
+
import { useTable as useTable$1, useRowState, useSortBy, useExpanded, usePagination } from 'react-table';
|
4
|
+
import { getColumnsFromChildren, getInternalSortRules, sanitizeRowProps } from '../util.js';
|
5
|
+
import { sortTypes } from '../util/sortTypes.js';
|
6
|
+
import { useRowEditing } from './plugins/useRowEditing.js';
|
7
|
+
import { useRowActions } from './plugins/useRowActions.js';
|
8
|
+
import { useRowSelect } from './plugins/useRowSelect.js';
|
9
|
+
import { useTableKeyboardNavigation } from './useTableKeyboardNavigation.js';
|
10
|
+
import { useRowDraggable } from './plugins/useRowDraggable.js';
|
11
|
+
|
12
|
+
const useTableRowActive = (activeIndex, rows, rowExpansionRenderer, handleonRowActive) => {
|
13
|
+
React__default.useEffect(() => {
|
14
|
+
if (activeIndex !== undefined && rows.length && handleonRowActive) {
|
15
|
+
const focusedRow = rows[activeIndex];
|
16
|
+
|
17
|
+
if (focusedRow) {
|
18
|
+
const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);
|
19
|
+
handleonRowActive(sanitizedFocusedRow);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}, [activeIndex, rows]);
|
23
|
+
};
|
24
|
+
|
25
|
+
const useTableInstance = (instance, ref) => {
|
26
|
+
const sanitizedInstance = React__default.useMemo(() => ({
|
27
|
+
toggleAllRowsExpanded: instance.toggleAllRowsExpanded,
|
28
|
+
toggleHideAllColumns: instance.toggleHideAllColumns,
|
29
|
+
toggleHideColumn: instance.toggleHideColumn,
|
30
|
+
toggleEditing: instance.toggleEditing,
|
31
|
+
toggleRowEditing: instance.toggleRowEditing,
|
32
|
+
resetRowEditing: instance.resetRowEditing,
|
33
|
+
toggleRowExpanded: instance.toggleRowExpanded,
|
34
|
+
toggleSortBy: instance.toggleSortBy
|
35
|
+
}), []);
|
36
|
+
React__default.useEffect(() => {
|
37
|
+
if (ref !== null && ref !== void 0 && ref.current) {
|
38
|
+
ref.current.instance = sanitizedInstance;
|
39
|
+
}
|
40
|
+
}, [ref]);
|
41
|
+
return sanitizedInstance;
|
42
|
+
};
|
43
|
+
|
44
|
+
const useTablePaginationListener = (disablePagination, onPaginate, state) => {
|
45
|
+
React__default.useEffect(() => {
|
46
|
+
if (!disablePagination && onPaginate) {
|
47
|
+
onPaginate(state.pageIndex, state.pageSize);
|
48
|
+
}
|
49
|
+
}, [state.pageIndex, state.pageSize]);
|
50
|
+
};
|
51
|
+
|
52
|
+
const useTableSortingListener = (data, sortedRows, onSort, manualSorting, state) => {
|
53
|
+
React__default.useEffect(() => {
|
54
|
+
if (onSort) {
|
55
|
+
const sortRules = state.sortBy.map(rule => ({
|
56
|
+
accessor: rule.id,
|
57
|
+
desc: rule.desc
|
58
|
+
}));
|
59
|
+
|
60
|
+
if (manualSorting) {
|
61
|
+
onSort(sortRules);
|
62
|
+
} else {
|
63
|
+
let sortedData;
|
64
|
+
|
65
|
+
if (sortRules.length && sortedRows !== null && sortedRows !== void 0 && sortedRows.length) {
|
66
|
+
sortedData = sortedRows.map(row => row.original);
|
67
|
+
}
|
68
|
+
|
69
|
+
onSort(sortRules, sortedData || data);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}, [onSort && JSON.stringify(state.sortBy), manualSorting]);
|
73
|
+
};
|
74
|
+
|
75
|
+
const DEFAULT_PAGE_SIZE = 10;
|
76
|
+
const useTable = (props, ref) => {
|
77
|
+
var _otherProps$tabIndex;
|
78
|
+
|
79
|
+
const {
|
80
|
+
children,
|
81
|
+
data,
|
82
|
+
dangerouslyHijackGlobalKeyboardNavigation: _1,
|
83
|
+
onRowClick,
|
84
|
+
onRowDrag,
|
85
|
+
onSelectedRows,
|
86
|
+
rowClassName,
|
87
|
+
rowExpansionRenderer,
|
88
|
+
rowHeight,
|
89
|
+
selectedRows,
|
90
|
+
// sorting
|
91
|
+
disableSorting,
|
92
|
+
manualSorting,
|
93
|
+
onSort,
|
94
|
+
sortRules,
|
95
|
+
// pagination
|
96
|
+
disablePagination = true,
|
97
|
+
length,
|
98
|
+
onPaginate,
|
99
|
+
pageSize = DEFAULT_PAGE_SIZE,
|
100
|
+
pageIndex = 0,
|
101
|
+
// row editing
|
102
|
+
inlineEditingUniqueId = undefined,
|
103
|
+
onRowCreate,
|
104
|
+
// actions
|
105
|
+
actions,
|
106
|
+
onRowEdit,
|
107
|
+
onRowCopy,
|
108
|
+
onRowDelete,
|
109
|
+
onRowActive,
|
110
|
+
windowed = false,
|
111
|
+
...otherProps
|
112
|
+
} = props;
|
113
|
+
|
114
|
+
if (onSelectedRows && !selectedRows || !onSelectedRows && selectedRows) {
|
115
|
+
throw new Error('Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection');
|
116
|
+
}
|
117
|
+
|
118
|
+
const {
|
119
|
+
texts
|
120
|
+
} = useLocalization();
|
121
|
+
const {
|
122
|
+
columns,
|
123
|
+
sortRules: defaultSortRules
|
124
|
+
} = React__default.useMemo(() => getColumnsFromChildren(children, rowExpansionRenderer), [children, rowExpansionRenderer]);
|
125
|
+
const manualPagination = !disablePagination && !!onPaginate && !!length;
|
126
|
+
const {
|
127
|
+
headerGroups,
|
128
|
+
rows,
|
129
|
+
sortedRows,
|
130
|
+
prepareRow: prepareBaseRow,
|
131
|
+
state,
|
132
|
+
// pagination
|
133
|
+
page,
|
134
|
+
gotoPage,
|
135
|
+
setPageSize,
|
136
|
+
...instance
|
137
|
+
} = useTable$1({
|
138
|
+
columns,
|
139
|
+
data,
|
140
|
+
initialState: {
|
141
|
+
// eslint-disable-next-line
|
142
|
+
// @ts-ignore: not sure how to type this correctly right now
|
143
|
+
sortBy: getInternalSortRules(sortRules) || defaultSortRules,
|
144
|
+
pageSize: !disablePagination ? pageSize : undefined,
|
145
|
+
pageIndex: !disablePagination ? pageIndex : undefined
|
146
|
+
},
|
147
|
+
manualPagination,
|
148
|
+
pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,
|
149
|
+
manualSortBy: manualSorting,
|
150
|
+
disableSortBy: disableSorting,
|
151
|
+
// most of these resets preventions are needed for editing mode
|
152
|
+
autoResetExpanded: false,
|
153
|
+
autoResetSelectedRows: false,
|
154
|
+
autoResetSortBy: false,
|
155
|
+
autoResetPage: false,
|
156
|
+
sortTypes: React__default.useMemo(() => sortTypes, []),
|
157
|
+
useControlledState: currentState => {
|
158
|
+
return React__default.useMemo(() => ({ ...currentState,
|
159
|
+
selectedRowIds: selectedRows || []
|
160
|
+
}), [currentState, selectedRows]);
|
161
|
+
}
|
162
|
+
}, useRowState, useSortBy, useExpanded, usePagination, useRowSelect(onSelectedRows), useRowDraggable(onRowDrag), useRowEditing(inlineEditingUniqueId), useRowActions(inlineEditingUniqueId, {
|
163
|
+
onRowCreate,
|
164
|
+
onRowEdit,
|
165
|
+
onRowCopy,
|
166
|
+
onRowDelete
|
167
|
+
}, actions, rowExpansionRenderer, texts, windowed));
|
168
|
+
useTablePaginationListener(disablePagination, onPaginate, state);
|
169
|
+
useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);
|
170
|
+
const sanitizedInstance = useTableInstance(instance, ref);
|
171
|
+
const visibleRows = !disablePagination && !manualPagination ? page : rows;
|
172
|
+
const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation(props, visibleRows, {
|
173
|
+
onRowClick,
|
174
|
+
onRowCreate,
|
175
|
+
onRowEdit,
|
176
|
+
onRowCopy,
|
177
|
+
onRowDelete,
|
178
|
+
rowExpansionRenderer
|
179
|
+
}, ref);
|
180
|
+
useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);
|
181
|
+
const prepareRow = React__default.useCallback((row, index) => {
|
182
|
+
prepareBaseRow(row);
|
183
|
+
|
184
|
+
row.setActive = () => setActiveIndex(index);
|
185
|
+
}, [prepareBaseRow, setActiveIndex]);
|
186
|
+
return {
|
187
|
+
rowProps: {
|
188
|
+
activeIndex,
|
189
|
+
setActiveIndex,
|
190
|
+
onRowClick,
|
191
|
+
rowClassName,
|
192
|
+
rowExpansionRenderer,
|
193
|
+
rowHeight,
|
194
|
+
inlineEditingUniqueId
|
195
|
+
},
|
196
|
+
tableProps: { ...otherProps,
|
197
|
+
headerGroups,
|
198
|
+
onFocus: handleFocus,
|
199
|
+
onKeyDown: handleKeyDown,
|
200
|
+
tabIndex: (_otherProps$tabIndex = otherProps.tabIndex) !== null && _otherProps$tabIndex !== void 0 ? _otherProps$tabIndex : 0
|
201
|
+
},
|
202
|
+
state,
|
203
|
+
pagination: !disablePagination ? {
|
204
|
+
length: manualPagination && length ? length : data.length,
|
205
|
+
pageIndex: state.pageIndex,
|
206
|
+
pageSize: state.pageSize,
|
207
|
+
setPageIndex: gotoPage,
|
208
|
+
setPageSize: setPageSize
|
209
|
+
} : null,
|
210
|
+
rows: visibleRows,
|
211
|
+
prepareRow,
|
212
|
+
instance: sanitizedInstance
|
213
|
+
};
|
214
|
+
};
|
215
|
+
|
216
|
+
export { useTable };
|
217
|
+
//# sourceMappingURL=useTable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTable.js","sources":["../../../../../src/components/Table/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\r\nimport { useTable as useReactTable, useExpanded, useSortBy, usePagination, useRowState } from 'react-table';\r\nimport { getColumnsFromChildren, getInternalSortRules } from '../util';\r\nimport { sortTypes } from '../util/sortTypes';\r\nimport { useRowEditing } from './plugins/useRowEditing';\r\nimport { useRowActions } from './plugins/useRowActions';\r\nimport { useRowSelect } from './plugins/useRowSelect';\r\nimport {\r\n InternalTable,\r\n InternalTableRow,\r\n PaginationHandler,\r\n RowActiveHandler,\r\n SortHandler,\r\n TableProps,\r\n TableRef,\r\n} from '../types';\r\nimport { useTableKeyboardNavigation } from './useTableKeyboardNavigation';\r\nimport { useLocalization } from '../../Provider/Provider';\r\nimport { useRowDraggable } from './plugins/useRowDraggable';\r\nimport { sanitizeRowProps } from '../util';\r\n\r\nconst useTableRowActive = (\r\n activeIndex: number | undefined,\r\n rows: InternalTableRow[],\r\n rowExpansionRenderer: TableProps<any>['rowExpansionRenderer'],\r\n handleonRowActive: RowActiveHandler<any> | undefined\r\n) => {\r\n React.useEffect(() => {\r\n if (activeIndex !== undefined && rows.length && handleonRowActive) {\r\n const focusedRow = rows[activeIndex];\r\n if (focusedRow) {\r\n const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);\r\n handleonRowActive(sanitizedFocusedRow);\r\n }\r\n }\r\n }, [activeIndex, rows]);\r\n};\r\n\r\nconst useTableInstance = (instance: any, ref: React.RefObject<TableRef>): object => {\r\n const sanitizedInstance = React.useMemo(\r\n () => ({\r\n toggleAllRowsExpanded: instance.toggleAllRowsExpanded,\r\n toggleHideAllColumns: instance.toggleHideAllColumns,\r\n toggleHideColumn: instance.toggleHideColumn,\r\n toggleEditing: instance.toggleEditing,\r\n toggleRowEditing: instance.toggleRowEditing,\r\n resetRowEditing: instance.resetRowEditing,\r\n toggleRowExpanded: instance.toggleRowExpanded,\r\n toggleSortBy: instance.toggleSortBy,\r\n }),\r\n []\r\n );\r\n\r\n React.useEffect(() => {\r\n if (ref?.current) {\r\n ref.current.instance = sanitizedInstance;\r\n }\r\n }, [ref]);\r\n\r\n return sanitizedInstance;\r\n};\r\n\r\nconst useTablePaginationListener = (disablePagination: boolean, onPaginate: PaginationHandler | undefined, state: any): void => {\r\n React.useEffect(() => {\r\n if (!disablePagination && onPaginate) {\r\n onPaginate(state.pageIndex, state.pageSize);\r\n }\r\n }, [state.pageIndex, state.pageSize]);\r\n};\r\n\r\nconst useTableSortingListener = (\r\n data: any[],\r\n sortedRows: any[],\r\n onSort: SortHandler<any> | undefined,\r\n manualSorting: boolean,\r\n state: any\r\n): void => {\r\n React.useEffect(() => {\r\n if (onSort) {\r\n const sortRules = state.sortBy.map((rule: any) => ({ accessor: rule.id, desc: rule.desc }));\r\n\r\n if (manualSorting) {\r\n onSort(sortRules);\r\n } else {\r\n let sortedData;\r\n\r\n if (sortRules.length && sortedRows?.length) {\r\n sortedData = sortedRows.map((row: any) => row.original);\r\n }\r\n\r\n onSort(sortRules, sortedData || data);\r\n }\r\n }\r\n }, [onSort && JSON.stringify(state.sortBy), manualSorting]);\r\n};\r\n\r\nconst DEFAULT_PAGE_SIZE = 10;\r\n\r\nexport const useTable = <T extends {}>(\r\n props: TableProps<T> & { windowed?: boolean },\r\n ref: React.RefObject<TableRef>\r\n): InternalTable => {\r\n const {\r\n children,\r\n data,\r\n dangerouslyHijackGlobalKeyboardNavigation: _1,\r\n onRowClick,\r\n onRowDrag,\r\n onSelectedRows,\r\n rowClassName,\r\n rowExpansionRenderer,\r\n rowHeight,\r\n selectedRows,\r\n\r\n // sorting\r\n disableSorting,\r\n manualSorting,\r\n onSort,\r\n sortRules,\r\n\r\n // pagination\r\n disablePagination = true,\r\n length,\r\n onPaginate,\r\n pageSize = DEFAULT_PAGE_SIZE,\r\n pageIndex = 0,\r\n\r\n // row editing\r\n inlineEditingUniqueId = undefined,\r\n onRowCreate,\r\n\r\n // actions\r\n actions,\r\n onRowEdit,\r\n onRowCopy,\r\n onRowDelete,\r\n onRowActive,\r\n\r\n windowed = false,\r\n\r\n ...otherProps\r\n } = props;\r\n\r\n if ((onSelectedRows && !selectedRows) || (!onSelectedRows && selectedRows)) {\r\n throw new Error(\r\n 'Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection'\r\n );\r\n }\r\n\r\n const { texts } = useLocalization();\r\n const { columns, sortRules: defaultSortRules } = React.useMemo(\r\n () => getColumnsFromChildren(children, rowExpansionRenderer),\r\n [children, rowExpansionRenderer]\r\n );\r\n\r\n const manualPagination = !disablePagination && !!onPaginate && !!length;\r\n\r\n const {\r\n headerGroups,\r\n rows,\r\n sortedRows,\r\n prepareRow: prepareBaseRow,\r\n state,\r\n // pagination\r\n page,\r\n gotoPage,\r\n setPageSize,\r\n ...instance\r\n }: any = useReactTable(\r\n {\r\n columns,\r\n data,\r\n initialState: {\r\n // eslint-disable-next-line\r\n // @ts-ignore: not sure how to type this correctly right now\r\n sortBy: getInternalSortRules(sortRules) || defaultSortRules,\r\n pageSize: !disablePagination ? pageSize : undefined,\r\n pageIndex: !disablePagination ? pageIndex : undefined,\r\n },\r\n manualPagination,\r\n pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,\r\n manualSortBy: manualSorting,\r\n disableSortBy: disableSorting,\r\n // most of these resets preventions are needed for editing mode\r\n autoResetExpanded: false,\r\n autoResetSelectedRows: false,\r\n autoResetSortBy: false,\r\n autoResetPage: false,\r\n sortTypes: React.useMemo(() => sortTypes, []),\r\n useControlledState: currentState => {\r\n return React.useMemo(\r\n () => ({\r\n ...currentState,\r\n selectedRowIds: selectedRows || [],\r\n }),\r\n [currentState, selectedRows]\r\n );\r\n },\r\n },\r\n useRowState,\r\n useSortBy,\r\n useExpanded,\r\n usePagination,\r\n useRowSelect(onSelectedRows),\r\n useRowDraggable(onRowDrag),\r\n useRowEditing(inlineEditingUniqueId),\r\n useRowActions(\r\n inlineEditingUniqueId,\r\n { onRowCreate, onRowEdit, onRowCopy, onRowDelete },\r\n actions,\r\n rowExpansionRenderer,\r\n texts,\r\n windowed\r\n )\r\n );\r\n\r\n useTablePaginationListener(disablePagination, onPaginate, state);\r\n useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);\r\n\r\n const sanitizedInstance = useTableInstance(instance, ref);\r\n\r\n const visibleRows = !disablePagination && !manualPagination ? page : rows;\r\n\r\n const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation<T>(\r\n props,\r\n visibleRows,\r\n { onRowClick, onRowCreate, onRowEdit, onRowCopy, onRowDelete, rowExpansionRenderer },\r\n ref\r\n );\r\n\r\n useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);\r\n\r\n const prepareRow = React.useCallback(\r\n (row: any, index: number) => {\r\n prepareBaseRow(row);\r\n row.setActive = () => setActiveIndex(index);\r\n },\r\n [prepareBaseRow, setActiveIndex]\r\n );\r\n\r\n return {\r\n rowProps: {\r\n activeIndex,\r\n setActiveIndex,\r\n onRowClick,\r\n rowClassName,\r\n rowExpansionRenderer,\r\n rowHeight,\r\n inlineEditingUniqueId,\r\n },\r\n tableProps: {\r\n ...otherProps,\r\n headerGroups,\r\n onFocus: handleFocus,\r\n onKeyDown: handleKeyDown,\r\n tabIndex: otherProps.tabIndex ?? 0,\r\n },\r\n state,\r\n pagination: !disablePagination\r\n ? {\r\n length: manualPagination && length ? length : data.length,\r\n pageIndex: state.pageIndex,\r\n pageSize: state.pageSize,\r\n setPageIndex: gotoPage,\r\n setPageSize: setPageSize,\r\n }\r\n : null,\r\n rows: visibleRows,\r\n prepareRow,\r\n instance: sanitizedInstance,\r\n };\r\n};\r\n"],"names":["useTableRowActive","activeIndex","rows","rowExpansionRenderer","handleonRowActive","React","useEffect","undefined","length","focusedRow","sanitizedFocusedRow","sanitizeRowProps","useTableInstance","instance","ref","sanitizedInstance","useMemo","toggleAllRowsExpanded","toggleHideAllColumns","toggleHideColumn","toggleEditing","toggleRowEditing","resetRowEditing","toggleRowExpanded","toggleSortBy","current","useTablePaginationListener","disablePagination","onPaginate","state","pageIndex","pageSize","useTableSortingListener","data","sortedRows","onSort","manualSorting","sortRules","sortBy","map","rule","accessor","id","desc","sortedData","row","original","JSON","stringify","DEFAULT_PAGE_SIZE","useTable","props","children","dangerouslyHijackGlobalKeyboardNavigation","_1","onRowClick","onRowDrag","onSelectedRows","rowClassName","rowHeight","selectedRows","disableSorting","inlineEditingUniqueId","onRowCreate","actions","onRowEdit","onRowCopy","onRowDelete","onRowActive","windowed","otherProps","Error","texts","useLocalization","columns","defaultSortRules","getColumnsFromChildren","manualPagination","headerGroups","prepareRow","prepareBaseRow","page","gotoPage","setPageSize","useReactTable","initialState","getInternalSortRules","pageCount","Math","ceil","manualSortBy","disableSortBy","autoResetExpanded","autoResetSelectedRows","autoResetSortBy","autoResetPage","sortTypes","useControlledState","currentState","selectedRowIds","useRowState","useSortBy","useExpanded","usePagination","useRowSelect","useRowDraggable","useRowEditing","useRowActions","visibleRows","setActiveIndex","handleKeyDown","handleFocus","useTableKeyboardNavigation","useCallback","index","setActive","rowProps","tableProps","onFocus","onKeyDown","tabIndex","pagination","setPageIndex"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,iBAAiB,GAAG,CACtBC,WADsB,EAEtBC,IAFsB,EAGtBC,oBAHsB,EAItBC,iBAJsB;AAMtBC,EAAAA,cAAK,CAACC,SAAN,CAAgB;AACZ,QAAIL,WAAW,KAAKM,SAAhB,IAA6BL,IAAI,CAACM,MAAlC,IAA4CJ,iBAAhD,EAAmE;AAC/D,YAAMK,UAAU,GAAGP,IAAI,CAACD,WAAD,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SAAO;AACHO,IAAAA,QAAQ,EAAE;AACNnH,MAAAA,WADM;AAEN4G,MAAAA,cAFM;AAGNtD,MAAAA,UAHM;AAING,MAAAA,YAJM;AAKNvD,MAAAA,oBALM;AAMNwD,MAAAA,SANM;AAONG,MAAAA;AAPM,KADP;AAUHuD,IAAAA,UAAU,EAAE,EACR,GAAG/C,UADK;AAERQ,MAAAA,YAFQ;AAGRwC,MAAAA,OAAO,EAAEP,WAHD;AAIRQ,MAAAA,SAAS,EAAET,aAJH;AAKRU,MAAAA,QAAQ,0BAAElD,UAAU,CAACkD,QAAb,uEAAyB;AALzB,KAVT;AAiBH3F,IAAAA,KAjBG;AAkBH4F,IAAAA,UAAU,EAAE,CAAC9F,iBAAD,GACN;AACInB,MAAAA,MAAM,EAAEqE,gBAAgB,IAAIrE,MAApB,GAA6BA,MAA7B,GAAsCyB,IAAI,CAACzB,MADvD;AAEIsB,MAAAA,SAAS,EAAED,KAAK,CAACC,SAFrB;AAGIC,MAAAA,QAAQ,EAAEF,KAAK,CAACE,QAHpB;AAII2F,MAAAA,YAAY,EAAExC,QAJlB;AAKIC,MAAAA,WAAW,EAAEA;AALjB,KADM,GAQN,IA1BH;AA2BHjF,IAAAA,IAAI,EAAE0G,WA3BH;AA4BH7B,IAAAA,UA5BG;AA6BHlE,IAAAA,QAAQ,EAAEE;AA7BP,GAAP;AA+BH;;;;"}
|
@@ -0,0 +1,132 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import keycode from 'keycode';
|
3
|
+
import { getNextIndexFromKeycode } from '../../../utils/hooks/useListKeyboardNavigation.js';
|
4
|
+
import { sanitizeRowProps } from '../util.js';
|
5
|
+
|
6
|
+
const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
7
|
+
const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;
|
8
|
+
const [activeIndex, setActiveIndex] = React__default.useState(useGlobalKeyboardNavigation ? 0 : undefined);
|
9
|
+
|
10
|
+
const onKeyDown = event => {
|
11
|
+
var _document$activeEleme;
|
12
|
+
|
13
|
+
const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;
|
14
|
+
|
15
|
+
if (useGlobalKeyboardNavigation && document.activeElement !== ref.current && ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('type')) !== 'search' && document.activeElement !== document.body) {
|
16
|
+
return;
|
17
|
+
} // abort key handling if other elements inside table are focused and we don't use global keyboard navigation
|
18
|
+
|
19
|
+
|
20
|
+
if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
|
24
|
+
if (activeIndex !== undefined) {
|
25
|
+
const currentRow = rows[activeIndex];
|
26
|
+
|
27
|
+
if (currentRow) {
|
28
|
+
const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);
|
29
|
+
|
30
|
+
if (rowProps.onRowClick && event.keyCode === keycode('enter')) {
|
31
|
+
event.preventDefault();
|
32
|
+
rowProps.onRowClick(sanitizedRow);
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
|
36
|
+
if (currentRow.toggleRowSelected && event.keyCode === keycode('space')) {
|
37
|
+
event.preventDefault();
|
38
|
+
currentRow.toggleRowSelected();
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
if (currentRow.toggleRowExpanded) {
|
43
|
+
if (currentRow.isExpanded && event.keyCode === keycode('left')) {
|
44
|
+
event.preventDefault();
|
45
|
+
currentRow.toggleRowExpanded();
|
46
|
+
return;
|
47
|
+
} else if (!currentRow.isExpanded && event.keyCode === keycode('right')) {
|
48
|
+
event.preventDefault();
|
49
|
+
currentRow.toggleRowExpanded();
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
} // inline editing
|
53
|
+
|
54
|
+
|
55
|
+
if (currentRow.toggleRowEditing) {
|
56
|
+
if (currentRow.canEdit && !currentRow.isEditing) {
|
57
|
+
if (rowProps.onRowCreate && event.shiftKey && event.keyCode === keycode('n')) {
|
58
|
+
event.preventDefault();
|
59
|
+
|
60
|
+
if (!currentRow.isExpanded) {
|
61
|
+
currentRow.toggleRowExpanded();
|
62
|
+
}
|
63
|
+
|
64
|
+
rowProps.onRowCreate(sanitizedRow, event);
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
if (event.keyCode === keycode('e')) {
|
69
|
+
event.preventDefault();
|
70
|
+
currentRow.toggleRowEditing();
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
if (rowProps.onRowEdit && event.keyCode === keycode('e') && !isModifierKeyPressed) {
|
77
|
+
event.preventDefault();
|
78
|
+
rowProps.onRowEdit(sanitizedRow, event);
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
|
82
|
+
if (rowProps.onRowCopy && event.keyCode === keycode('c') && !isModifierKeyPressed) {
|
83
|
+
event.preventDefault();
|
84
|
+
rowProps.onRowCopy(sanitizedRow, event);
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
|
88
|
+
if (rowProps.onRowDelete && event.keyCode === keycode('delete') && !isModifierKeyPressed) {
|
89
|
+
event.preventDefault();
|
90
|
+
rowProps.onRowDelete(sanitizedRow, event);
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
const nextIndex = getNextIndexFromKeycode(event.keyCode, rows.length, activeIndex);
|
97
|
+
|
98
|
+
if (nextIndex !== undefined) {
|
99
|
+
event.preventDefault();
|
100
|
+
setActiveIndex(nextIndex);
|
101
|
+
}
|
102
|
+
};
|
103
|
+
|
104
|
+
const handleKeyDown = event => {
|
105
|
+
if (!useGlobalKeyboardNavigation) {
|
106
|
+
onKeyDown(event.nativeEvent);
|
107
|
+
}
|
108
|
+
};
|
109
|
+
|
110
|
+
React__default.useEffect(() => {
|
111
|
+
if (useGlobalKeyboardNavigation) {
|
112
|
+
window.addEventListener('keydown', onKeyDown);
|
113
|
+
}
|
114
|
+
|
115
|
+
return () => {
|
116
|
+
if (useGlobalKeyboardNavigation) {
|
117
|
+
window.removeEventListener('keydown', onKeyDown);
|
118
|
+
}
|
119
|
+
};
|
120
|
+
}, [onKeyDown]);
|
121
|
+
|
122
|
+
const handleFocus = () => {
|
123
|
+
if (activeIndex === undefined && rows.length) {
|
124
|
+
setActiveIndex(0);
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
128
|
+
return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];
|
129
|
+
};
|
130
|
+
|
131
|
+
export { useTableKeyboardNavigation };
|
132
|
+
//# sourceMappingURL=useTableKeyboardNavigation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableKeyboardNavigation.js","sources":["../../../../../src/components/Table/hooks/useTableKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\r\nimport keycode from 'keycode';\r\nimport { getNextIndexFromKeycode } from '../../../utils/hooks/useListKeyboardNavigation';\r\nimport { sanitizeRowProps } from '../util';\r\nimport { TableProps } from '../types';\r\n\r\nexport const useTableKeyboardNavigation = <T extends {}>(\r\n props: TableProps<T>,\r\n rows: any[],\r\n rowProps: any,\r\n ref: React.RefObject<HTMLDivElement>\r\n): [\r\n number | undefined,\r\n (index: number) => void,\r\n (event: React.KeyboardEvent<HTMLElement>) => void,\r\n (event: React.FocusEvent<HTMLElement>) => void\r\n] => {\r\n const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;\r\n const [activeIndex, setActiveIndex] = React.useState<number | undefined>(useGlobalKeyboardNavigation ? 0 : undefined);\r\n\r\n const onKeyDown = (event: KeyboardEvent): void => {\r\n const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;\r\n\r\n if (\r\n useGlobalKeyboardNavigation &&\r\n document.activeElement !== ref.current &&\r\n document.activeElement?.getAttribute('type') !== 'search' &&\r\n document.activeElement !== document.body\r\n ) {\r\n return;\r\n }\r\n // abort key handling if other elements inside table are focused and we don't use global keyboard navigation\r\n if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {\r\n return;\r\n }\r\n\r\n if (activeIndex !== undefined) {\r\n const currentRow = rows[activeIndex];\r\n\r\n if (currentRow) {\r\n const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);\r\n\r\n if (rowProps.onRowClick && event.keyCode === keycode('enter')) {\r\n event.preventDefault();\r\n rowProps.onRowClick(sanitizedRow);\r\n return;\r\n }\r\n\r\n if (currentRow.toggleRowSelected && event.keyCode === keycode('space')) {\r\n event.preventDefault();\r\n currentRow.toggleRowSelected();\r\n return;\r\n }\r\n\r\n if (currentRow.toggleRowExpanded) {\r\n if (currentRow.isExpanded && event.keyCode === keycode('left')) {\r\n event.preventDefault();\r\n currentRow.toggleRowExpanded();\r\n return;\r\n } else if (!currentRow.isExpanded && event.keyCode === keycode('right')) {\r\n event.preventDefault();\r\n currentRow.toggleRowExpanded();\r\n return;\r\n }\r\n }\r\n\r\n // inline editing\r\n if (currentRow.toggleRowEditing) {\r\n if (currentRow.canEdit && !currentRow.isEditing) {\r\n if (rowProps.onRowCreate && event.shiftKey && event.keyCode === keycode('n')) {\r\n event.preventDefault();\r\n\r\n if (!currentRow.isExpanded) {\r\n currentRow.toggleRowExpanded();\r\n }\r\n\r\n rowProps.onRowCreate(sanitizedRow, event);\r\n return;\r\n }\r\n\r\n if (event.keyCode === keycode('e')) {\r\n event.preventDefault();\r\n currentRow.toggleRowEditing();\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (rowProps.onRowEdit && event.keyCode === keycode('e') && !isModifierKeyPressed) {\r\n event.preventDefault();\r\n rowProps.onRowEdit(sanitizedRow, event);\r\n return;\r\n }\r\n\r\n if (rowProps.onRowCopy && event.keyCode === keycode('c') && !isModifierKeyPressed) {\r\n event.preventDefault();\r\n rowProps.onRowCopy(sanitizedRow, event);\r\n return;\r\n }\r\n\r\n if (rowProps.onRowDelete && event.keyCode === keycode('delete') && !isModifierKeyPressed) {\r\n event.preventDefault();\r\n rowProps.onRowDelete(sanitizedRow, event);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n const nextIndex = getNextIndexFromKeycode(event.keyCode, rows.length, activeIndex);\r\n\r\n if (nextIndex !== undefined) {\r\n event.preventDefault();\r\n setActiveIndex(nextIndex);\r\n }\r\n };\r\n\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\r\n if (!useGlobalKeyboardNavigation) {\r\n onKeyDown(event.nativeEvent);\r\n }\r\n };\r\n\r\n React.useEffect(() => {\r\n if (useGlobalKeyboardNavigation) {\r\n window.addEventListener('keydown', onKeyDown);\r\n }\r\n\r\n return () => {\r\n if (useGlobalKeyboardNavigation) {\r\n window.removeEventListener('keydown', onKeyDown);\r\n }\r\n };\r\n }, [onKeyDown]);\r\n\r\n const handleFocus = (): void => {\r\n if (activeIndex === undefined && rows.length) {\r\n setActiveIndex(0);\r\n }\r\n };\r\n\r\n return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];\r\n};\r\n"],"names":["useTableKeyboardNavigation","props","rows","rowProps","ref","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","activeIndex","setActiveIndex","React","useState","undefined","onKeyDown","event","isModifierKeyPressed","metaKey","ctrlKey","altKey","shiftKey","document","activeElement","current","getAttribute","body","currentRow","sanitizedRow","sanitizeRowProps","rowExpansionRenderer","onRowClick","keyCode","keycode","preventDefault","toggleRowSelected","toggleRowExpanded","isExpanded","toggleRowEditing","canEdit","isEditing","onRowCreate","onRowEdit","onRowCopy","onRowDelete","nextIndex","getNextIndexFromKeycode","length","handleKeyDown","nativeEvent","useEffect","window","addEventListener","removeEventListener","handleFocus"],"mappings":";;;;;MAMaA,0BAA0B,GAAG,CACtCC,KADsC,EAEtCC,IAFsC,EAGtCC,QAHsC,EAItCC,GAJsC;AAWtC,QAAMC,2BAA2B,GAAGJ,KAAK,CAACK,yCAA1C;AACA,QAAM,CAACC,WAAD,EAAcC,cAA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I,CAAC0C,MAAtC,EAA8C;AAC1CpC,MAAAA,cAAc,CAAC,CAAD,CAAd;AACH;AACJ,GAJD;;AAMA,SAAO,CAACD,WAAD,EAAcC,cAAd,EAA8BqC,aAA9B,EAA6CM,WAA7C,CAAP;AACH;;;;"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import cn from 'classnames';
|
3
|
+
import { Icon } from '../../Icon/Icon.js';
|
4
|
+
|
5
|
+
const Column = ({
|
6
|
+
cell
|
7
|
+
}) => {
|
8
|
+
const props = { ...cell.getHeaderProps(),
|
9
|
+
...(cell.getSortByToggleProps && cell.getSortByToggleProps({
|
10
|
+
title: undefined
|
11
|
+
})),
|
12
|
+
className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-darkest hover:text-black', cell.className, {
|
13
|
+
'yt-table__cell__group': !!cell.columns,
|
14
|
+
'cursor-pointer': !cell.disableSorting,
|
15
|
+
'justify-start text-left': cell.align === 'left',
|
16
|
+
'justify-end text-right': cell.align === 'right',
|
17
|
+
'justify-center text-center': cell.align === 'center' || !cell.align
|
18
|
+
}),
|
19
|
+
style: { ...cell.style,
|
20
|
+
flex: cell.flex
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
if (cell.isSorted) {
|
25
|
+
props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';
|
26
|
+
}
|
27
|
+
|
28
|
+
return React__default.createElement("div", Object.assign({}, props, {
|
29
|
+
key: cell.id,
|
30
|
+
"data-taco": "table-column"
|
31
|
+
}), React__default.createElement("span", {
|
32
|
+
className: "truncate"
|
33
|
+
}, cell.render('Header')), cell.isSorted ? React__default.createElement(Icon, {
|
34
|
+
name: cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid',
|
35
|
+
className: "-mt-0.5"
|
36
|
+
}) : null);
|
37
|
+
};
|
38
|
+
|
39
|
+
export { Column };
|
40
|
+
//# sourceMappingURL=renderColumn.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderColumn.js","sources":["../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { Icon } from '../../Icon/Icon';\r\n\r\nexport const Column = ({ cell }: any): any => {\r\n const props = {\r\n ...cell.getHeaderProps(),\r\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\r\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-darkest hover:text-black', cell.className, {\r\n 'yt-table__cell__group': !!cell.columns,\r\n 'cursor-pointer': !cell.disableSorting,\r\n 'justify-start text-left': cell.align === 'left',\r\n 'justify-end text-right': cell.align === 'right',\r\n 'justify-center text-center': cell.align === 'center' || !cell.align,\r\n }),\r\n style: { ...cell.style, flex: cell.flex },\r\n };\r\n\r\n if (cell.isSorted) {\r\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\r\n }\r\n\r\n return (\r\n <div {...props} key={cell.id} data-taco=\"table-column\">\r\n <span className=\"truncate\">{cell.render('Header')}</span>\r\n {cell.isSorted ? (\r\n <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} className=\"-mt-0.5\" />\r\n ) : null}\r\n </div>\r\n );\r\n};\r\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;MAIaA,MAAM,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD;AAClB,QAAMC,KAAK,GAAG,EACV,GAAGD,IAAI,CAACE,cAAL,EADO;AAEV,QAAIF,IAAI,CAACG,oBAAL,IAA6BH,IAAI,CAACG,oBAAL,CAA0B;AAAEC,MAAAA,KAAK,EAAEC;AAAT,KAA1B,CAAjC,CAFU;AAGVC,IAAAA,SAAS,EAAEC,EAAE,CAAC,yFAAD,EAA4FP,IAAI,CAACM,SAAjG,EAA4G;AACrH,+BAAyB,CAAC,CAACN,IAAI,CAACQ,OADqF;AAErH,wBAAkB,CAACR,IAAI,CAACS,cAF6F;AAGrH,iCAA2BT,IAAI,CAACU,KAAL,KAAe,MAH2E;AAIrH,gCAA0BV,IAAI,CAACU,KAAL,KAAe,OAJ4E;AAKrH,oCAA8BV,IAAI,CAACU,KAAL,KAAe,QAAf,IAA2B,CAACV,IAAI,CAACU;AALsD,KAA5G,CAHH;AAUVC,IAAAA,KAAK,EAAE,EAAE,GAAGX,IAAI,CAACW,KAAV;AAAiBC,MAAAA,IAAI,EAAEZ,IAAI,CAACY;AAA5B;AAVG,GAAd;;AAaA,MAAIZ,IAAI,CAACa,QAAT,EAAmB;AACfZ,IAAAA,KAAK,CAAC,WAAD,CAAL,GAAqBD,IAAI,CAACc,YAAL,GAAoB,YAApB,GAAmC,WAAxD;AACH;;AAED,SACIC,4BAAA,MAAA,oBAASd;AAAOe,IAAAA,GAAG,EAAEhB,IAAI,CAACiB;iBAAc;IAAxC,EACIF,4BAAA,OAAA;AAAMT,IAAAA,SAAS,EAAC;GAAhB,EAA4BN,IAAI,CAACkB,MAAL,CAAY,QAAZ,CAA5B,CADJ,EAEKlB,IAAI,CAACa,QAAL,GACGE,4BAAA,CAACI,IAAD;AAAMC,IAAAA,IAAI,EAAEpB,IAAI,CAACc,YAAL,GAAoB,oBAApB,GAA2C;AAAoBR,IAAAA,SAAS,EAAC;GAArF,CADH,GAEG,IAJR,CADJ;AAQH;;;;"}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import cn from 'classnames';
|
3
|
+
import { sanitizeRowProps } from '../util.js';
|
4
|
+
import { FocusScope } from '@react-aria/focus';
|
5
|
+
|
6
|
+
const renderCell = (cell, row) => {
|
7
|
+
const props = { ...cell.getCellProps(),
|
8
|
+
className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {
|
9
|
+
'justify-start text-left': cell.column.align === 'left',
|
10
|
+
'justify-end text-right': cell.column.align === 'right',
|
11
|
+
'text-center': !cell.column.align
|
12
|
+
}),
|
13
|
+
style: { ...cell.column.style,
|
14
|
+
flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex
|
15
|
+
}
|
16
|
+
};
|
17
|
+
return React__default.createElement("div", Object.assign({}, props, {
|
18
|
+
role: "gridcell",
|
19
|
+
"data-taco": "table-cell"
|
20
|
+
}), cell.render('Cell') || null);
|
21
|
+
};
|
22
|
+
|
23
|
+
const Row = /*#__PURE__*/React__default.forwardRef(function TableRow({
|
24
|
+
row,
|
25
|
+
index,
|
26
|
+
instance,
|
27
|
+
headerGroups,
|
28
|
+
...rowProps
|
29
|
+
}, ref) {
|
30
|
+
const {
|
31
|
+
activeIndex,
|
32
|
+
onRowClick,
|
33
|
+
rowClassName,
|
34
|
+
rowExpansionRenderer,
|
35
|
+
rowHeight,
|
36
|
+
setActiveIndex,
|
37
|
+
style,
|
38
|
+
inlineEditingUniqueId
|
39
|
+
} = rowProps;
|
40
|
+
const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);
|
41
|
+
const props = { ...row.getRowProps(),
|
42
|
+
style: { ...style,
|
43
|
+
minHeight: rowHeight ? `${rowHeight}px` : undefined,
|
44
|
+
paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined
|
45
|
+
},
|
46
|
+
className: cn('yt-table__row border-grey-light flex border-b min-h-[2.5rem] hover:bg-grey-light', {
|
47
|
+
'yt-table__row--active bg-grey-light hover:bg-grey-light': activeIndex === index,
|
48
|
+
'yt-table__row--clickable': !!onRowClick,
|
49
|
+
'yt-table__row--dragging': !!row.isDragging,
|
50
|
+
'yt-table__row--editing': !!row.isEditing
|
51
|
+
}, typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName),
|
52
|
+
onClick: onRowClick ? event => {
|
53
|
+
if (event.target === event.currentTarget || event.target.classList.contains('yt-table__cell')) {
|
54
|
+
event.preventDefault();
|
55
|
+
event.persist();
|
56
|
+
setActiveIndex(index);
|
57
|
+
onRowClick(sanitizedRow);
|
58
|
+
}
|
59
|
+
} : () => {
|
60
|
+
setActiveIndex(index);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
let cells = row.cells;
|
64
|
+
|
65
|
+
if (row.depth > 0) {
|
66
|
+
cells = row.cells.filter(cell => !cell.column.hiddenOnSubRows);
|
67
|
+
}
|
68
|
+
|
69
|
+
const expandedRow = rowExpansionRenderer && row.isExpanded && React__default.createElement("div", null, rowExpansionRenderer(sanitizedRow, instance));
|
70
|
+
const rowContent = React__default.useMemo(() => {
|
71
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement(FocusScope, {
|
72
|
+
key: row.original._createKey,
|
73
|
+
contain: true,
|
74
|
+
restoreFocus: true,
|
75
|
+
autoFocus: true
|
76
|
+
}, React__default.createElement("div", Object.assign({}, props, {
|
77
|
+
role: "row",
|
78
|
+
ref: ref
|
79
|
+
}), React__default.createElement("input", {
|
80
|
+
type: "hidden",
|
81
|
+
name: "_rowIndexPath",
|
82
|
+
value: row.id
|
83
|
+
}), React__default.createElement("input", {
|
84
|
+
type: "hidden",
|
85
|
+
name: "_inlineEditingUniqueId",
|
86
|
+
value: row.original[inlineEditingUniqueId]
|
87
|
+
}), cells.map(cell => renderCell(cell, sanitizedRow)))), expandedRow);
|
88
|
+
}, [row.original._createKey]);
|
89
|
+
|
90
|
+
if (row.isEditing) {
|
91
|
+
return rowContent;
|
92
|
+
}
|
93
|
+
|
94
|
+
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", Object.assign({}, props, {
|
95
|
+
role: "row",
|
96
|
+
ref: ref
|
97
|
+
}), cells.map(cell => renderCell(cell, sanitizedRow))), expandedRow);
|
98
|
+
});
|
99
|
+
|
100
|
+
export { Row };
|
101
|
+
//# sourceMappingURL=renderRow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderRow.js","sources":["../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\r\nimport cn from 'classnames';\r\nimport { FocusScope } from '@react-aria/focus';\r\nimport { InternalTableCell, TableRow } from '../types';\r\nimport { sanitizeRowProps } from '../util';\r\n\r\nconst renderCell = (cell: InternalTableCell, row: TableRow<any>): JSX.Element => {\r\n const props = {\r\n ...cell.getCellProps(),\r\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\r\n 'justify-start text-left': cell.column.align === 'left',\r\n 'justify-end text-right': cell.column.align === 'right',\r\n 'text-center': !cell.column.align,\r\n }),\r\n style: {\r\n ...cell.column.style,\r\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\r\n },\r\n };\r\n return (\r\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\r\n {cell.render('Cell') || null}\r\n </div>\r\n );\r\n};\r\n\r\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\r\n const {\r\n activeIndex,\r\n onRowClick,\r\n rowClassName,\r\n rowExpansionRenderer,\r\n rowHeight,\r\n setActiveIndex,\r\n style,\r\n inlineEditingUniqueId,\r\n } = rowProps;\r\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\r\n\r\n const props = {\r\n ...row.getRowProps(),\r\n style: {\r\n ...style,\r\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\r\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\r\n },\r\n className: cn(\r\n 'yt-table__row border-grey-light flex border-b min-h-[2.5rem] hover:bg-grey-light',\r\n {\r\n 'yt-table__row--active bg-grey-light hover:bg-grey-light': activeIndex === index,\r\n 'yt-table__row--clickable': !!onRowClick,\r\n 'yt-table__row--dragging': !!row.isDragging,\r\n 'yt-table__row--editing': !!row.isEditing,\r\n },\r\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\r\n ),\r\n onClick: onRowClick\r\n ? (event: React.MouseEvent<HTMLElement>) => {\r\n if (\r\n event.target === event.currentTarget ||\r\n (event.target as HTMLElement).classList.contains('yt-table__cell')\r\n ) {\r\n event.preventDefault();\r\n event.persist();\r\n setActiveIndex(index);\r\n onRowClick(sanitizedRow);\r\n }\r\n }\r\n : () => {\r\n setActiveIndex(index);\r\n },\r\n };\r\n\r\n let cells = row.cells;\r\n\r\n if (row.depth > 0) {\r\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\r\n }\r\n\r\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\r\n const rowContent = React.useMemo(() => {\r\n return (\r\n <>\r\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\r\n <div {...props} role=\"row\" ref={ref}>\r\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\r\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\r\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\r\n </div>\r\n </FocusScope>\r\n {expandedRow}\r\n </>\r\n );\r\n }, [row.original._createKey]);\r\n\r\n if (row.isEditing) {\r\n return rowContent;\r\n }\r\n\r\n return (\r\n <>\r\n <div {...props} role=\"row\" ref={ref}>\r\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\r\n </div>\r\n {expandedRow}\r\n </>\r\n );\r\n});\r\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,IAAD,EAA0BC,GAA1B;A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CADJ,EAIKoB,WAJL,CADJ;AAQH,CAjFkB;;;;"}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import set from 'lodash-es/set';
|
2
|
+
|
3
|
+
const convertRowIndexPathToNumberArray = rowIndexPath => {
|
4
|
+
var _rowIndexPath$split$m;
|
5
|
+
|
6
|
+
return (_rowIndexPath$split$m = rowIndexPath === null || rowIndexPath === void 0 ? void 0 : rowIndexPath.split('.').map(Number)) !== null && _rowIndexPath$split$m !== void 0 ? _rowIndexPath$split$m : [];
|
7
|
+
};
|
8
|
+
const getByRowIndexPath = (data, rowIndexPath) => {
|
9
|
+
if (!rowIndexPath) {
|
10
|
+
return undefined;
|
11
|
+
}
|
12
|
+
|
13
|
+
const currenTRow = [...data];
|
14
|
+
const indexes = convertRowIndexPathToNumberArray(String(rowIndexPath));
|
15
|
+
|
16
|
+
if (indexes.length) {
|
17
|
+
const startIndex = indexes.shift();
|
18
|
+
return indexes.reduce((value, index) => {
|
19
|
+
var _value$subRows;
|
20
|
+
|
21
|
+
return value === null || value === void 0 ? void 0 : (_value$subRows = value.subRows) === null || _value$subRows === void 0 ? void 0 : _value$subRows[index];
|
22
|
+
}, currenTRow[startIndex]);
|
23
|
+
}
|
24
|
+
|
25
|
+
return undefined;
|
26
|
+
};
|
27
|
+
const setByRowIndexPath = (data, rowIndexPath, values) => {
|
28
|
+
const nexTRow = [...data];
|
29
|
+
const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);
|
30
|
+
const rootIndex = rowIndexes.shift();
|
31
|
+
|
32
|
+
if (rowIndexes.length) {
|
33
|
+
const path = rowIndexes.map(index => `subRows[${index}]`).join('.');
|
34
|
+
set(nexTRow[rootIndex], path, values);
|
35
|
+
} else {
|
36
|
+
nexTRow[rootIndex] = values;
|
37
|
+
}
|
38
|
+
|
39
|
+
return nexTRow;
|
40
|
+
};
|
41
|
+
const getParentRowIndexPath = rowIndexPath => {
|
42
|
+
let parentIndexPath;
|
43
|
+
|
44
|
+
if (rowIndexPath) {
|
45
|
+
const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);
|
46
|
+
rowIndexes.pop();
|
47
|
+
|
48
|
+
if (rowIndexes.length) {
|
49
|
+
parentIndexPath = rowIndexes.join('.');
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
return parentIndexPath;
|
54
|
+
};
|
55
|
+
|
56
|
+
export { convertRowIndexPathToNumberArray, getByRowIndexPath, getParentRowIndexPath, setByRowIndexPath };
|
57
|
+
//# sourceMappingURL=rowIndexPath.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rowIndexPath.js","sources":["../../../../../src/components/Table/util/rowIndexPath.ts"],"sourcesContent":["import set from 'lodash/set';\r\nimport { Row, RowIndexPath } from '../types';\r\n\r\nexport const convertRowIndexPathToNumberArray = (rowIndexPath: RowIndexPath): number[] =>\r\n rowIndexPath?.split('.').map(Number) ?? [];\r\n\r\nexport const getByRowIndexPath = <TRow>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow> | undefined => {\r\n if (!rowIndexPath) {\r\n return undefined;\r\n }\r\n\r\n const currenTRow = [...data];\r\n const indexes = convertRowIndexPathToNumberArray(String(rowIndexPath));\r\n\r\n if (indexes.length) {\r\n const startIndex = indexes.shift() as number;\r\n return indexes.reduce((value, index) => value?.subRows?.[index], currenTRow[startIndex]);\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport const setByRowIndexPath = <TRow>(data: Row<TRow>[], rowIndexPath: RowIndexPath, values: any): Row<TRow>[] => {\r\n const nexTRow = [...data];\r\n\r\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\r\n const rootIndex = rowIndexes.shift() as number;\r\n\r\n if (rowIndexes.length) {\r\n const path = rowIndexes.map(index => `subRows[${index}]`).join('.');\r\n set(nexTRow[rootIndex], path, values);\r\n } else {\r\n nexTRow[rootIndex] = values;\r\n }\r\n\r\n return nexTRow;\r\n};\r\n\r\nexport const getParentRowIndexPath = (rowIndexPath: RowIndexPath): RowIndexPath => {\r\n let parentIndexPath;\r\n\r\n if (rowIndexPath) {\r\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\r\n rowIndexes.pop();\r\n\r\n if (rowIndexes.length) {\r\n parentIndexPath = rowIndexes.join('.');\r\n }\r\n }\r\n\r\n return parentIndexPath;\r\n};\r\n"],"names":["convertRowIndexPathToNumberArray","rowIndexPath","split","map","Number","getByRowIndexPath","data","undefined","currenTRow","indexes","String","length","startIndex","shift","reduce","value","index","subRows","setByRowIndexPath","values","nexTRow","rowIndexes","rootIndex","path","join","set","getParentRowIndexPath","parentIndexPath","pop"],"mappings":";;MAGaA,gCAAgC,GAAIC,YAAD;AAAA;;AAAA,kCAC5CA,YAD4C,aAC5CA,YAD4C,uBAC5CA,YAAY,CAAEC,KAAd,CAAoB,GAApB,EAAyBC,GAAzB,CAA6BC,MAA7B,CAD4C,yEACJ,EADI;AAAA;MAGnCC,iBAAiB,GAAG,CAAOC,IAAP,EAA0BL,YAA1B;AAC7B,MAAI,CAACA,YAAL,EAAmB;AACf,WAAOM,SAAP;AACH;;AAED,QAAMC,UAAU,GAAG,CAAC,GAAGF,IAAJ,CAAnB;AACA,QAAMG,OAAO,GAAGT,gCAAgC,CAACU,MAAM,CAACT,YAAD,CAAP,CAAhD;;AAEA,MAAIQ,OAAO,CAACE,MAAZ,EAAoB;AAChB,UAAMC,UAAU,GAAGH,OAAO,CAACI,KAAR,EAAnB;AACA,WAAOJ,OAAO,CAACK,MAAR,CAAe,CAACC,KAAD,EAAQC,KAAR;AAAA;;AAAA,aAAkBD,KAAlB,aAAkBA,KAAlB,yCAAkBA,KAAK,CAAEE,OAAzB,mDAAkB,eAAiBD,KAAjB,CAAlB;AAAA,KAAf,EAA0DR,UAAU,CAACI,UAAD,CAApE,CAAP;AACH;;AAED,SAAOL,SAAP;AACH;MAEYW,iBAAiB,GAAG,CAAOZ,IAAP,EAA0BL,YAA1B,EAAsDkB,MAAtD;AAC7B,QAAMC,OA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